formacao
This commit is contained in:
+20
-5
@@ -2,6 +2,7 @@
|
||||
import { raw } from "../../helper/html/index.js";
|
||||
import { DOM_RENDERER } from "../../jsx/constants.js";
|
||||
import { createCssJsxDomObjects } from "../../jsx/dom/css.js";
|
||||
import { escapeToBuffer } from "../../utils/html.js";
|
||||
import {
|
||||
CLASS_NAME,
|
||||
DEFAULT_STYLE_ID,
|
||||
@@ -15,7 +16,11 @@ import {
|
||||
viewTransitionCommon
|
||||
} from "./common.js";
|
||||
import { rawCssString } from "./common.js";
|
||||
var createCssContext = ({ id }) => {
|
||||
var createCssContext = ({
|
||||
id,
|
||||
classNameSlug,
|
||||
onInvalidSlug
|
||||
}) => {
|
||||
const [cssJsxDomObject, StyleRenderToDom] = createCssJsxDomObjects({ id });
|
||||
const contextMap = /* @__PURE__ */ new WeakMap();
|
||||
const nonceMap = /* @__PURE__ */ new WeakMap();
|
||||
@@ -68,7 +73,14 @@ var createCssContext = ({ id }) => {
|
||||
}
|
||||
return Promise.resolve(raw("", [appendStyle]));
|
||||
};
|
||||
const className = new String(cssClassName[CLASS_NAME]);
|
||||
const rawClassName = cssClassName[CLASS_NAME];
|
||||
let escapedClassName = rawClassName;
|
||||
if (/[&<>'"]/.test(rawClassName)) {
|
||||
const escapedBuffer = [""];
|
||||
escapeToBuffer(rawClassName, escapedBuffer);
|
||||
escapedClassName = escapedBuffer[0];
|
||||
}
|
||||
const className = new String(escapedClassName);
|
||||
Object.assign(className, cssClassName);
|
||||
className.isEscaped = true;
|
||||
className.callbacks = [addClassNameToContext];
|
||||
@@ -78,15 +90,18 @@ var createCssContext = ({ id }) => {
|
||||
return promise;
|
||||
};
|
||||
const css2 = (strings, ...values) => {
|
||||
return newCssClassNameObject(cssCommon(strings, values));
|
||||
return newCssClassNameObject(cssCommon(strings, values, classNameSlug, onInvalidSlug));
|
||||
};
|
||||
const cx2 = (...args) => {
|
||||
args = cxCommon(args);
|
||||
return css2(Array(args.length).fill(""), ...args);
|
||||
};
|
||||
const keyframes2 = keyframesCommon;
|
||||
const keyframes2 = (strings, ...values) => keyframesCommon(strings, values, classNameSlug, onInvalidSlug);
|
||||
const viewTransition2 = ((strings, ...values) => {
|
||||
return newCssClassNameObject(viewTransitionCommon(strings, values));
|
||||
return newCssClassNameObject(
|
||||
viewTransitionCommon(strings, values, classNameSlug, onInvalidSlug)
|
||||
// eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
);
|
||||
});
|
||||
const Style2 = ({ children, nonce } = {}) => raw(
|
||||
`<style id="${id}"${nonce ? ` nonce="${nonce}"` : ""}>${children ? children[STYLE_STRING] : ""}</style>`,
|
||||
|
||||
Reference in New Issue
Block a user