@fluentic/style 0.1.0-beta.14 → 0.1.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/atomic/className.ts +4 -0
- package/atomic/rule.ts +15 -7
- package/atomic/utils/selector.ts +12 -3
- package/builder/classname/class_name_builder.ts +1 -1
- package/builder/data/const.ts +2 -0
- package/builder/data/data.ts +1 -1
- package/builder/data/merge/scope.ts +7 -0
- package/builder/data/merge/style.ts +12 -3
- package/builder/data/state.ts +1 -0
- package/builder/selector_override.ts +1 -1
- package/builder/selector_override_core.ts +17 -3
- package/builder/types/alias.ts +1 -1
- package/compiler/extract/extract.ts +21 -75
- package/compiler/extract/types.ts +4 -1
- package/compiler/transform/debug/plugin.ts +22 -0
- package/compiler/transform/evaluator/evaluator.ts +4 -1
- package/compiler/transform/extract/chain/chain.ts +82 -22
- package/compiler/transform/extract/chain/extract_chain.ts +2 -0
- package/compiler/transform/extract/plugin.ts +51 -25
- package/compiler/transform/extract/utils/imports.ts +4 -1
- package/compiler/transform/extract/utils/replacement.ts +2 -2
- package/compiler/transform/utils/babel.ts +1 -1
- package/compiler/utils/constants.ts +1 -0
- package/config/config/css.ts +5 -3
- package/config/configure.ts +4 -0
- package/config/document.ts +23 -0
- package/css/globalSheet.ts +66 -0
- package/css/index.ts +4 -1
- package/css/sheet.ts +34 -14
- package/dist/{className-yhJCGT0F.js → className-CC5PHcXI.js} +9 -2
- package/dist/className-CC5PHcXI.js.map +1 -0
- package/dist/{combine-CC9bY-hu.js → combine-BpOQWCtM.js} +5 -5
- package/dist/combine-BpOQWCtM.js.map +1 -0
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-Ct5xGIeu.mjs → compiler-AOb_VaKQ.mjs} +464 -166
- package/dist/compiler-AOb_VaKQ.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/{config-CCgsVvyR.js → config-B70LIQhi.js} +2 -2
- package/dist/{config-CCgsVvyR.js.map → config-B70LIQhi.js.map} +1 -1
- package/dist/{config-DZKR6gH1.js → config-BF-mxuPk.js} +4 -4
- package/dist/{config-DZKR6gH1.js.map → config-BF-mxuPk.js.map} +1 -1
- package/dist/{config-BiiMS4rU.js → config-B_OQYZSm.js} +25 -4
- package/dist/config-B_OQYZSm.js.map +1 -0
- package/dist/{css-WaHZ6gxv.js → css-C7tcD3IO.js} +611 -213
- package/dist/css-C7tcD3IO.js.map +1 -0
- package/dist/css-Cdxkur4h.js +414 -0
- package/dist/css-Cdxkur4h.js.map +1 -0
- package/dist/{css-IecKRNxs.js → css-RohOR3Vq.js} +112 -73
- package/dist/css-RohOR3Vq.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/css_extra-BC1Z_hDy.js +8 -0
- package/dist/{css_extra-DDeJc2Cu.js.map → css_extra-BC1Z_hDy.js.map} +1 -1
- package/dist/{css_extra-DDeJc2Cu.js → css_extra-CuzJtAR_.js} +2 -2
- package/dist/css_extra-CuzJtAR_.js.map +1 -0
- package/dist/{data-BgZmL55Y.js → data-Bw3Xod5J.js} +28 -19
- package/dist/data-Bw3Xod5J.js.map +1 -0
- package/dist/{debug-D-1hhd0G.js → debug-CVO3xx4C.js} +6 -9
- package/dist/debug-CVO3xx4C.js.map +1 -0
- package/dist/dev/rsc.js +134 -25
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-CBRbVaeq.js → dev-BnQXPLQB.js} +6 -6
- package/dist/{dev-CBRbVaeq.js.map → dev-BnQXPLQB.js.map} +1 -1
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/{elementMarker-CJcfpKL1.js → elementMarker-BrHXg161.js} +334 -53
- package/dist/elementMarker-BrHXg161.js.map +1 -0
- package/dist/entry/dev/adapter/preact.js +1 -1
- package/dist/entry/dev/adapter/react.js +1 -1
- package/dist/entry/dev/adapter/solid.js +1 -1
- package/dist/entry/dev/css.js +3 -3
- package/dist/entry/dev/jsx-dev-runtime.js +2 -2
- package/dist/entry/dev/jsx-runtime.js +2 -2
- package/dist/entry/dev.js +11 -11
- package/dist/entry/prod/adapter/preact.js +1 -1
- package/dist/entry/prod/adapter/react.js +1 -1
- package/dist/entry/prod/adapter/solid.js +1 -1
- package/dist/entry/prod/css.js +3 -3
- package/dist/entry/prod/extract.js.map +1 -1
- package/dist/entry/prod.js +3 -3
- package/dist/entry/rsc-dev/adapter/preact.js +1 -1
- package/dist/entry/rsc-dev/adapter/react.js +1 -1
- package/dist/entry/rsc-dev/adapter/solid.js +1 -1
- package/dist/entry/rsc-dev/css.js +4 -3
- package/dist/entry/rsc-dev/dev.js +129 -24
- package/dist/entry/rsc-dev/dev.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-dev-runtime.js +5 -4
- package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
- package/dist/entry/rsc-dev.js +8 -7
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/css.js +4 -4
- package/dist/entry/rsc-prod.js +4 -4
- package/dist/{rules-Dz-szpPu.js → env-D6daex-9.js} +64 -19
- package/dist/env-D6daex-9.js.map +1 -0
- package/dist/{getClassName-DtkplEIt.js → getClassName-5yYUibKw.js} +2 -2
- package/dist/{getClassName-DtkplEIt.js.map → getClassName-5yYUibKw.js.map} +1 -1
- package/dist/getClassName-9CsXbNls.js.map +1 -1
- package/dist/{getClassName-CeoxISNW.js → getClassName-B3azD1TO.js} +6 -4
- package/dist/getClassName-B3azD1TO.js.map +1 -0
- package/dist/{getClassName-BNe3Ycyy.js → getClassName-m5DOkMFQ.js} +4 -4
- package/dist/{getClassName-BNe3Ycyy.js.map → getClassName-m5DOkMFQ.js.map} +1 -1
- package/dist/{global-UOHFwqHN.js → global-DeIYtcdl.js} +5 -2
- package/dist/{global-UOHFwqHN.js.map → global-DeIYtcdl.js.map} +1 -1
- package/dist/{css-BhoclXaw.js → globalSheet-CdgVpvCb.js} +185 -426
- package/dist/globalSheet-CdgVpvCb.js.map +1 -0
- package/dist/{hash-DlXmmPPm.js → hash-DCJkLls_.js} +4 -4
- package/dist/hash-DCJkLls_.js.map +1 -0
- package/dist/index.js +9 -9
- package/dist/jsx/jsx-dev-runtime.js +1 -1
- package/dist/jsx/jsx-dev-runtime.server.js +3 -3
- package/dist/jsx/jsx-dev-runtime.server.js.map +1 -1
- package/dist/jsx/jsx-runtime.js +1 -1
- package/dist/jsx/jsx-runtime.server.js +4 -4
- package/dist/jsx/jsx-runtime.server.js.map +1 -1
- package/dist/{jsx-8TwYuvgM.js → jsx-CvloSSpb.js} +4 -4
- package/dist/{jsx-8TwYuvgM.js.map → jsx-CvloSSpb.js.map} +1 -1
- package/dist/jsx_runtime-pt7DOZOE.js +13 -0
- package/dist/jsx_runtime-pt7DOZOE.js.map +1 -0
- package/dist/{loader-BVebGteg.mjs → loader-fAuIjIik.mjs} +3 -3
- package/dist/{loader-BVebGteg.mjs.map → loader-fAuIjIik.mjs.map} +1 -1
- package/dist/{misc-Bs2DgdG7.mjs → misc-CyZgGtc9.mjs} +3 -3
- package/dist/{misc-Bs2DgdG7.mjs.map → misc-CyZgGtc9.mjs.map} +1 -1
- package/dist/{namedTokens-CwniouKk.js → namedTokens-DwgmUMBM.js} +2 -2
- package/dist/{namedTokens-CwniouKk.js.map → namedTokens-DwgmUMBM.js.map} +1 -1
- package/dist/plugin/farm/index.mjs +3 -3
- package/dist/plugin/nextjs/index.mjs +4 -4
- package/dist/plugin/nextjs/loader.mjs +7 -5
- package/dist/plugin/nextjs/loader.mjs.map +1 -1
- package/dist/plugin/parcel/index.cjs +1 -1
- package/dist/plugin/parcel/index.mjs +2 -2
- package/dist/plugin/parcel/optimizer.cjs +1 -1
- package/dist/plugin/parcel/optimizer.mjs +2 -2
- package/dist/plugin/parcel/resolver.cjs +1 -1
- package/dist/plugin/parcel/resolver.mjs +2 -2
- package/dist/plugin/parcel/runtime.cjs +1 -1
- package/dist/plugin/parcel/runtime.mjs +1 -1
- package/dist/plugin/parcel/transformer.cjs +1 -1
- package/dist/plugin/parcel/transformer.mjs +2 -2
- package/dist/plugin/rspack/index.mjs +2 -2
- package/dist/plugin/vite/index.mjs +3 -3
- package/dist/plugin/webpack/index.mjs +2 -2
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +3 -3
- package/dist/{registry-D1n78rd7.mjs → registry-BMijh1CM.mjs} +2 -2
- package/dist/{registry-D1n78rd7.mjs.map → registry-BMijh1CM.mjs.map} +1 -1
- package/dist/{resolveClassNameRuntime-BJcykzdl.js → resolveClassNameRuntime-B6vKNL5y.js} +2 -2
- package/dist/{resolveClassNameRuntime-BJcykzdl.js.map → resolveClassNameRuntime-B6vKNL5y.js.map} +1 -1
- package/dist/server.js +87 -17
- package/dist/server.js.map +1 -1
- package/dist/{shared-D4-AKGn6.mjs → shared-BfASWZo1.mjs} +4 -4
- package/dist/{shared-D4-AKGn6.mjs.map → shared-BfASWZo1.mjs.map} +1 -1
- package/dist/{shared-C9XQd8p_.cjs → shared-DY0kuBcN.cjs} +460 -162
- package/dist/shared-DY0kuBcN.cjs.map +1 -0
- package/dist/sheet-B-5idGtZ.js +9 -0
- package/dist/sheet-B-5idGtZ.js.map +1 -0
- package/dist/{config-TyjNpRrV.js → sheet-C6ymGhKV.js} +23 -2
- package/dist/sheet-C6ymGhKV.js.map +1 -0
- package/dist/sheet-D4f9KYPf.js +1 -0
- package/dist/{sidecar-CZTYX2vA.mjs → sidecar-cCzTDkzg.mjs} +3 -3
- package/dist/{sidecar-CZTYX2vA.mjs.map → sidecar-cCzTDkzg.mjs.map} +1 -1
- package/dist/{style-CmXHCPF4.js → style-a6ccye6R.js} +12 -12
- package/dist/style-a6ccye6R.js.map +1 -0
- package/dist/styleStore-Ceoaqa5U.js +45 -0
- package/dist/styleStore-Ceoaqa5U.js.map +1 -0
- package/dist/{env-C8TRVSyb.js → styleStore-D1IEmq1v.js} +435 -63
- package/dist/styleStore-D1IEmq1v.js.map +1 -0
- package/dist/{token-DMrBbat8.js → token-Ci73NE6h.js} +2 -2
- package/dist/{token-DMrBbat8.js.map → token-Ci73NE6h.js.map} +1 -1
- package/dist/{trace-C7EzEj2Q.js → trace-DDsvwdF0.js} +3 -3
- package/dist/{trace-C7EzEj2Q.js.map → trace-DDsvwdF0.js.map} +1 -1
- package/dist/{trace-DzCntvK4.js → trace-uHVvnYiw.js} +2 -2
- package/dist/{trace-DzCntvK4.js.map → trace-uHVvnYiw.js.map} +1 -1
- package/dist/{transform-CSZMklMb.js → transform-BkxIouPX.js} +2 -2
- package/dist/{transform-CSZMklMb.js.map → transform-BkxIouPX.js.map} +1 -1
- package/dist/types/atomic/className.d.ts +2 -2
- package/dist/types/atomic/utils/selector.d.ts +2 -1
- package/dist/types/builder/data/const.d.ts +1 -0
- package/dist/types/builder/data/data.d.ts +1 -1
- package/dist/types/builder/data/state.d.ts +1 -0
- package/dist/types/builder/selector_override.d.ts +1 -1
- package/dist/types/builder/selector_override_core.d.ts +2 -0
- package/dist/types/builder/types/alias.d.ts +2 -2
- package/dist/types/compiler/extract/types.d.ts +7 -1
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +2 -0
- package/dist/types/compiler/utils/constants.d.ts +1 -0
- package/dist/types/config/config/css.d.ts +2 -1
- package/dist/types/config/configure.d.ts +2 -0
- package/dist/types/config/document.d.ts +3 -0
- package/dist/types/css/globalSheet.d.ts +24 -0
- package/dist/types/css/index.d.ts +4 -1
- package/dist/types/css/sheet.d.ts +3 -2
- package/dist/types/entry/rsc_dev/css.d.ts +1 -0
- package/dist/types/runtime/rsc/constants.d.ts +2 -0
- package/dist/types/runtime/rsc/dev.d.ts +5 -0
- package/dist/types/runtime/rsc/getClassName.d.ts +3 -0
- package/dist/types/runtime/rsc/globalSheet.d.ts +22 -0
- package/dist/types/runtime/rsc/observer.d.ts +5 -0
- package/dist/types/runtime/rsc/styleStore.d.ts +2 -0
- package/dist/types/runtime/sheet/document.d.ts +3 -0
- package/dist/types/sheet/ordered.d.ts +4 -0
- package/dist/types/sheet/ordering.d.ts +15 -0
- package/dist/types/sheet/types.d.ts +7 -0
- package/dist/types/style/important.d.ts +2 -1
- package/dist/types/style/style.d.ts +2 -2
- package/dist/{utils-CoMwEfhG.mjs → utils-BO6Ix8t5.mjs} +4 -4
- package/dist/{utils-CoMwEfhG.mjs.map → utils-BO6Ix8t5.mjs.map} +1 -1
- package/dist/{utils-B7QcJ-Yw.js → utils-CB70kIh6.js} +3 -3
- package/dist/{utils-B7QcJ-Yw.js.map → utils-CB70kIh6.js.map} +1 -1
- package/dist/{utils-BYpkJ-uE.mjs → utils-EG9gh2g3.mjs} +3 -3
- package/dist/{utils-BYpkJ-uE.mjs.map → utils-EG9gh2g3.mjs.map} +1 -1
- package/dist/{utils-D4KMqCu2.js → utils-sG7IWYP6.js} +1089 -646
- package/dist/utils-sG7IWYP6.js.map +1 -0
- package/dist/utils.js +3 -3
- package/dist/{value-yd2SZ1XQ.js → value-B-ThmbY-.js} +16 -9
- package/dist/value-B-ThmbY-.js.map +1 -0
- package/dist/{webpack-B6z1UHh9.mjs → webpack-WXAJ3IYn.mjs} +5 -5
- package/dist/{webpack-B6z1UHh9.mjs.map → webpack-WXAJ3IYn.mjs.map} +1 -1
- package/entry/dev/sheet.ts +4 -1
- package/entry/rsc_dev/css.ts +2 -0
- package/jsx/rsc/jsx_dev_runtime.ts +11 -2
- package/jsx/rsc/jsx_runtime.ts +14 -3
- package/package.json +1 -1
- package/plugin/nextjs/loader.ts +18 -2
- package/runtime/core/elementMarker.ts +9 -3
- package/runtime/rsc/constants.ts +3 -0
- package/runtime/rsc/dev.ts +31 -15
- package/runtime/rsc/getClassName.ts +6 -0
- package/runtime/rsc/globalSheet.ts +130 -0
- package/runtime/rsc/observer.ts +118 -15
- package/runtime/rsc/styleStore.ts +12 -36
- package/runtime/sheet/document.ts +28 -0
- package/runtime/sheet/global-prod.ts +3 -5
- package/runtime/sheet/global.ts +3 -5
- package/runtime/sheet/rule.ts +4 -2
- package/runtime/sheet/rules.ts +3 -0
- package/sheet/dev/dev_sort.ts +5 -1
- package/sheet/dev/index.ts +23 -3
- package/sheet/ordered.ts +188 -0
- package/sheet/ordering.ts +138 -0
- package/sheet/prod.ts +17 -5
- package/sheet/types.ts +4 -0
- package/style/important.ts +3 -1
- package/style/style.ts +1 -1
- package/utils/trace.ts +1 -0
- package/dist/className-yhJCGT0F.js.map +0 -1
- package/dist/combine-CC9bY-hu.js.map +0 -1
- package/dist/compiler-Ct5xGIeu.mjs.map +0 -1
- package/dist/config-BiiMS4rU.js.map +0 -1
- package/dist/config-TyjNpRrV.js.map +0 -1
- package/dist/createTransformElement-BGznW-Mu.js +0 -34
- package/dist/createTransformElement-BGznW-Mu.js.map +0 -1
- package/dist/css-BhoclXaw.js.map +0 -1
- package/dist/css-IecKRNxs.js.map +0 -1
- package/dist/css-WaHZ6gxv.js.map +0 -1
- package/dist/data-BgZmL55Y.js.map +0 -1
- package/dist/debug-D-1hhd0G.js.map +0 -1
- package/dist/elementMarker-CJcfpKL1.js.map +0 -1
- package/dist/env-C8TRVSyb.js.map +0 -1
- package/dist/getClassName-CeoxISNW.js.map +0 -1
- package/dist/global-CWYOol4o.js +0 -14
- package/dist/global-CWYOol4o.js.map +0 -1
- package/dist/hash-DlXmmPPm.js.map +0 -1
- package/dist/jsx_runtime-CPojW0KD.js +0 -12
- package/dist/jsx_runtime-CPojW0KD.js.map +0 -1
- package/dist/rules-Dz-szpPu.js.map +0 -1
- package/dist/shared-C9XQd8p_.cjs.map +0 -1
- package/dist/sheet-LU89fcH_.js +0 -7
- package/dist/sheet-LU89fcH_.js.map +0 -1
- package/dist/style-CmXHCPF4.js.map +0 -1
- package/dist/styleStore-B0x4Ahpx.js +0 -60
- package/dist/styleStore-B0x4Ahpx.js.map +0 -1
- package/dist/styleStore-BrpgLNgc.js +0 -57
- package/dist/styleStore-BrpgLNgc.js.map +0 -1
- package/dist/utils-D4KMqCu2.js.map +0 -1
- package/dist/value-yd2SZ1XQ.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as TOKEN_ID, B as BUILDER_STATE, C as getCssVar, D as getStyleTokenVarName, E as getStyleTokenName, F as BUILDER_SCOPE, G as
|
|
1
|
+
import { A as TOKEN_ID, B as BUILDER_STATE, C as getCssVar, D as getStyleTokenVarName, E as getStyleTokenName, F as BUILDER_SCOPE, G as SIDECAR_URL_GLOBAL_SYMBOL, H as GLOBAL_SHEET_SELECTOR_ANCHOR, I as BUILDER_SCOPE_ID, J as getGlobalData, K as getCacheTTL, L as BUILDER_SELECTOR, M as TOKEN_OVERRIDE, N as TOKEN_VAR_NAME, O as isStyleTokenData, P as BUILDER_CALLSITE, R as BUILDER_SHEET_OPTIONS, S as escapeCssValue, T as getStyleTokenId, U as SHEET_SELECTOR_ANCHOR, V as BUILDER_TYPE, W as RUNTIME_CONFIG, X as symbol, Y as globalData, a as mergeResolvedStyle, b as markResolvedStyleItem, c as getStylePropCacheValue, d as getExtractedTokenBoundData, f as isExtractedTokenBoundData, i as mergeResolvedClassName, j as TOKEN_NAME, k as isStyleTokenOverrideData, n as finishClassNameResult, q as clearGlobalData, s as walkRecursiveItems, t as createClassNameResult, v as getResolvedStyleItemTokenValues, w as getCssVarRawFallback, x as setResolvedStyleItemTokenValues, y as isResolvedStyleItem$1, z as BUILDER_SLOT_ID } from "./className-CC5PHcXI.js";
|
|
2
2
|
//#region config/config/check.ts
|
|
3
3
|
const CHECK_CONFIG_DEFAULT = {};
|
|
4
4
|
const CHECK_CONFIG = globalData("config.check", () => ({ ...CHECK_CONFIG_DEFAULT }));
|
|
@@ -22,12 +22,9 @@ function isStyleLayerEnabled(layer = CSS_CONFIG.layer) {
|
|
|
22
22
|
function isSheetLayerOption(value) {
|
|
23
23
|
return value === void 0 || typeof value === "boolean" || typeof value === "string" && /^\.?(?:--|-?[a-zA-Z_\u0080-\uFFFF])[\w\u0080-\uFFFF-]*(?:\.(?:--|-?[a-zA-Z_\u0080-\uFFFF])[\w\u0080-\uFFFF-]*)*$/.test(value);
|
|
24
24
|
}
|
|
25
|
-
function resolveSheetLayerOption(layer, namespace) {
|
|
26
|
-
if (typeof layer !== "string") return layer ? "
|
|
27
|
-
return { name: layer.startsWith(".") ? namespace ? namespace + layer : layer.slice(1) : layer };
|
|
28
|
-
}
|
|
29
|
-
function isSheetLayerEnabled(layer = CSS_CONFIG.layer) {
|
|
30
|
-
return typeof layer === "object" && (layer.sheet ?? false);
|
|
25
|
+
function resolveSheetLayerOption(layer, namespace, mainLayerEnabled = isStyleLayerEnabled()) {
|
|
26
|
+
if (typeof layer !== "string") return layer && mainLayerEnabled ? "style" : false;
|
|
27
|
+
return { name: layer.startsWith(".") ? mainLayerEnabled && namespace ? namespace + layer : layer.slice(1) : layer };
|
|
31
28
|
}
|
|
32
29
|
//#endregion
|
|
33
30
|
//#region config/build.ts
|
|
@@ -70,8 +67,29 @@ function setBuildDebugClassName(value, fallback) {
|
|
|
70
67
|
RUNTIME_CONFIG.isPlugin = true;
|
|
71
68
|
RUNTIME_CONFIG.isExtracted = true;
|
|
72
69
|
//#endregion
|
|
70
|
+
//#region config/document.ts
|
|
71
|
+
const state$1 = globalData("config.document", () => ({
|
|
72
|
+
target: true,
|
|
73
|
+
listeners: /* @__PURE__ */ new Set()
|
|
74
|
+
}));
|
|
75
|
+
function getRuntimeDocument(documentOverride) {
|
|
76
|
+
if (state$1.target === false) return null;
|
|
77
|
+
if (state$1.target !== true) return state$1.target;
|
|
78
|
+
if (documentOverride) return documentOverride;
|
|
79
|
+
return typeof globalThis.document === "undefined" ? null : globalThis.document;
|
|
80
|
+
}
|
|
81
|
+
function setRuntimeDocument(target) {
|
|
82
|
+
if (state$1.target === target) return;
|
|
83
|
+
state$1.target = target;
|
|
84
|
+
state$1.listeners.forEach((listener) => listener());
|
|
85
|
+
}
|
|
86
|
+
function onRuntimeDocumentChange(listener) {
|
|
87
|
+
state$1.listeners.add(listener);
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
73
90
|
//#region config/configure.ts
|
|
74
91
|
function configureStyleRuntime(options = {}) {
|
|
92
|
+
if (options.document !== void 0) setRuntimeDocument(options.document);
|
|
75
93
|
if (options.css) {
|
|
76
94
|
checkBuildConfig("css");
|
|
77
95
|
const { debugClassName, ...css } = options.css;
|
|
@@ -125,10 +143,11 @@ globalData("config.dev.utils", () => ({ config: null }));
|
|
|
125
143
|
//#endregion
|
|
126
144
|
//#region style/important.ts
|
|
127
145
|
const STYLE_IMPORTANT = symbol("style.important");
|
|
128
|
-
function importantValue(value) {
|
|
146
|
+
function importantValue(value, native = false) {
|
|
129
147
|
return {
|
|
130
148
|
[STYLE_IMPORTANT]: true,
|
|
131
|
-
value
|
|
149
|
+
value,
|
|
150
|
+
native
|
|
132
151
|
};
|
|
133
152
|
}
|
|
134
153
|
function isStyleImportantValue(value) {
|
|
@@ -226,7 +245,7 @@ function createStackFrameLine(frame) {
|
|
|
226
245
|
}
|
|
227
246
|
function isInternalCallsite(filePath) {
|
|
228
247
|
const normalized = filePath.replace(/\\/g, "/");
|
|
229
|
-
return normalized.startsWith("node:") || normalized.startsWith("internal/") || normalized.includes("/node_modules/") || normalized.includes("/packages/style/dist/") || normalized.includes("/packages/style/builder/") || normalized.includes("/packages/style/runtime/") || normalized.includes("/packages/style/utils/trace.");
|
|
248
|
+
return normalized.startsWith("node:") || normalized.startsWith("internal/") || normalized.includes("/node_modules/") || normalized.includes("/packages/style/dist/") || normalized.includes("/packages/style/builder/") || normalized.includes("/packages/style/css/") || normalized.includes("/packages/style/runtime/") || normalized.includes("/packages/style/utils/trace.");
|
|
230
249
|
}
|
|
231
250
|
function traceError(message, options = {}) {
|
|
232
251
|
const error = new Error(message || "");
|
|
@@ -778,7 +797,9 @@ function getIdentifierSafeHashValue(hash) {
|
|
|
778
797
|
//#endregion
|
|
779
798
|
//#region atomic/utils/selector.ts
|
|
780
799
|
function getSelectorText$1(selector) {
|
|
781
|
-
|
|
800
|
+
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
801
|
+
if (text.startsWith("\0global")) return text.slice(text.indexOf("\0", GLOBAL_SHEET_SELECTOR_ANCHOR.length) + 1);
|
|
802
|
+
return stripSheetSelectorAnchor(text);
|
|
782
803
|
}
|
|
783
804
|
function getSelectorHash(selector) {
|
|
784
805
|
return Array.isArray(selector) ? selector.join("|") : selector;
|
|
@@ -790,14 +811,15 @@ function getSelectorPriority$1(selector) {
|
|
|
790
811
|
function hasSheetSelectorAnchor(selector) {
|
|
791
812
|
return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(SHEET_SELECTOR_ANCHOR);
|
|
792
813
|
}
|
|
793
|
-
function
|
|
814
|
+
function getSheetSelectorSpecificity(selector) {
|
|
794
815
|
const text = selector ? Array.isArray(selector) ? selector[0] : selector : "";
|
|
795
816
|
if (!text.startsWith("\0sheet:")) return null;
|
|
796
817
|
const end = text.indexOf("\0", SHEET_SELECTOR_ANCHOR.length);
|
|
797
818
|
if (end < 0) return null;
|
|
798
819
|
const [weightValue] = text.slice(SHEET_SELECTOR_ANCHOR.length + 1, end).split(":");
|
|
820
|
+
if (!weightValue) return null;
|
|
799
821
|
const weight = Number(weightValue);
|
|
800
|
-
return Number.isInteger(weight) && weight
|
|
822
|
+
return Number.isInteger(weight) && weight >= 0 ? weight : null;
|
|
801
823
|
}
|
|
802
824
|
function stripSheetSelectorAnchor(selector) {
|
|
803
825
|
if (!selector.startsWith("\0sheet")) return selector;
|
|
@@ -807,12 +829,16 @@ function stripSheetSelectorAnchor(selector) {
|
|
|
807
829
|
}
|
|
808
830
|
return selector.slice(SHEET_SELECTOR_ANCHOR.length);
|
|
809
831
|
}
|
|
832
|
+
function hasGlobalSheetSelectorAnchor(selector) {
|
|
833
|
+
return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(GLOBAL_SHEET_SELECTOR_ANCHOR);
|
|
834
|
+
}
|
|
810
835
|
//#endregion
|
|
811
836
|
//#region atomic/className.ts
|
|
812
|
-
function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null) {
|
|
837
|
+
function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null, importantNative = false) {
|
|
813
838
|
let hash = property;
|
|
814
839
|
hash += "\n" + (priority || "");
|
|
815
840
|
if (important) hash += "\nimportant";
|
|
841
|
+
if (importantNative) hash += "\nnative-important";
|
|
816
842
|
hash += "\n" + value;
|
|
817
843
|
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
818
844
|
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
@@ -843,10 +869,11 @@ function getClassNameHashLength(options) {
|
|
|
843
869
|
if (options.debugClassName && options.isDev) return options.devHashLength ?? options.cssHashLength ?? 5;
|
|
844
870
|
return options.cssHashLength ?? 7;
|
|
845
871
|
}
|
|
846
|
-
function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule) {
|
|
872
|
+
function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule, importantNative = false) {
|
|
847
873
|
let hash = property;
|
|
848
874
|
hash += "\n" + (priority || "");
|
|
849
875
|
if (important) hash += "\nimportant";
|
|
876
|
+
if (importantNative) hash += "\nnative-important";
|
|
850
877
|
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
851
878
|
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
852
879
|
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
@@ -1009,8 +1036,8 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1009
1036
|
value = scopeItem.value;
|
|
1010
1037
|
weight = scopeItem.weight;
|
|
1011
1038
|
important = scopeItem.important;
|
|
1012
|
-
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
|
|
1013
|
-
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, itemCallsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
1039
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, scopeItem.importantNative);
|
|
1040
|
+
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, itemCallsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null, null, scopeItem.importantNative);
|
|
1014
1041
|
scopeItem.dedupe = dedupe;
|
|
1015
1042
|
scopeItem.className = className;
|
|
1016
1043
|
scopeItem.callsite = itemCallsite;
|
|
@@ -1049,6 +1076,7 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1049
1076
|
property: overrideItem.property,
|
|
1050
1077
|
weight: overrideItem.weight,
|
|
1051
1078
|
important: overrideItem.important,
|
|
1079
|
+
importantNative: overrideItem.importantNative,
|
|
1052
1080
|
value: overrideItem.value,
|
|
1053
1081
|
transformClassName: overrideItem.transformClassName,
|
|
1054
1082
|
token: overrideItem.token,
|
|
@@ -1062,8 +1090,8 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1062
1090
|
value = scopeItem.value;
|
|
1063
1091
|
weight = scopeItem.weight;
|
|
1064
1092
|
important = scopeItem.important;
|
|
1065
|
-
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule);
|
|
1066
|
-
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
1093
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.importantNative);
|
|
1094
|
+
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null, null, scopeItem.importantNative);
|
|
1067
1095
|
scopeItem.dedupe = dedupe;
|
|
1068
1096
|
scopeItem.className = className;
|
|
1069
1097
|
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
@@ -1252,6 +1280,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1252
1280
|
let value;
|
|
1253
1281
|
let weight;
|
|
1254
1282
|
let important;
|
|
1283
|
+
let importantNative;
|
|
1255
1284
|
let itemCallsite;
|
|
1256
1285
|
let className;
|
|
1257
1286
|
let dedupe;
|
|
@@ -1293,7 +1322,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1293
1322
|
}
|
|
1294
1323
|
} else for (const property in style) {
|
|
1295
1324
|
valueRaw = style[property];
|
|
1296
|
-
[valueRaw, weight, important] = unwrapAuthoredStyleValue(valueRaw);
|
|
1325
|
+
[valueRaw, weight, important, importantNative] = unwrapAuthoredStyleValue(valueRaw);
|
|
1297
1326
|
const sourceType = source[BUILDER_TYPE];
|
|
1298
1327
|
checkImportantUsage(valueRaw, important, sourceType === 9 || sourceType === 8);
|
|
1299
1328
|
transformClassName = null;
|
|
@@ -1316,6 +1345,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1316
1345
|
property,
|
|
1317
1346
|
weight,
|
|
1318
1347
|
important,
|
|
1348
|
+
importantNative,
|
|
1319
1349
|
value,
|
|
1320
1350
|
transformClassName,
|
|
1321
1351
|
variable: ref ? [3, ref] : variableName && token ? [
|
|
@@ -1378,8 +1408,8 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1378
1408
|
value = runtimeItem.value;
|
|
1379
1409
|
weight = runtimeItem.weight;
|
|
1380
1410
|
important = runtimeItem.important;
|
|
1381
|
-
dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule);
|
|
1382
|
-
className = getAtomicClassName(runtimeItem.property, weight, important, value, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, runtimeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
1411
|
+
dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.importantNative);
|
|
1412
|
+
className = getAtomicClassName(runtimeItem.property, weight, important, value, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, runtimeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null, null, runtimeItem.importantNative);
|
|
1383
1413
|
runtimeItem.dedupe = dedupe;
|
|
1384
1414
|
runtimeItem.className = className;
|
|
1385
1415
|
lookupIndex = lookup[dedupe];
|
|
@@ -1391,9 +1421,11 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1391
1421
|
function unwrapAuthoredStyleValue(value) {
|
|
1392
1422
|
let weight = null;
|
|
1393
1423
|
let important = false;
|
|
1424
|
+
let native = false;
|
|
1394
1425
|
while (true) {
|
|
1395
1426
|
if (isStyleImportantValue(value)) {
|
|
1396
1427
|
important = true;
|
|
1428
|
+
native ||= value.native === true;
|
|
1397
1429
|
value = value.value;
|
|
1398
1430
|
continue;
|
|
1399
1431
|
}
|
|
@@ -1407,7 +1439,8 @@ function unwrapAuthoredStyleValue(value) {
|
|
|
1407
1439
|
return [
|
|
1408
1440
|
value,
|
|
1409
1441
|
weight,
|
|
1410
|
-
important
|
|
1442
|
+
important,
|
|
1443
|
+
native
|
|
1411
1444
|
];
|
|
1412
1445
|
}
|
|
1413
1446
|
function checkImportantUsage(value, important, isSheet) {
|
|
@@ -1542,9 +1575,9 @@ function assertManualSelectorSyntax(selector) {
|
|
|
1542
1575
|
if (ampersandIndex === 0 && ampersandSelector && /^\s/.test(ampersandSelector)) throw new Error("selector cannot have whitespace after \"&\"; omit \"&\" for descendant selectors");
|
|
1543
1576
|
}
|
|
1544
1577
|
function setSheetSelectorOptions(selector, options) {
|
|
1545
|
-
if (options.
|
|
1578
|
+
if (options.specificity === void 0 && options.layer === void 0) return selector;
|
|
1546
1579
|
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
1547
|
-
const weighted = SHEET_SELECTOR_ANCHOR + (":" + (options.
|
|
1580
|
+
const weighted = SHEET_SELECTOR_ANCHOR + (":" + (options.specificity ?? "") + ":" + (typeof options.layer === "string" ? JSON.stringify(options.layer) : options.layer === void 0 ? "" : options.layer ? "1" : "0")) + "\0" + text.slice(SHEET_SELECTOR_ANCHOR.length);
|
|
1548
1581
|
return Array.isArray(selector) ? [weighted, selector[1]] : weighted;
|
|
1549
1582
|
}
|
|
1550
1583
|
function normalizeManualSelector(selector, assertManualSelector) {
|
|
@@ -1556,6 +1589,13 @@ function normalizeManualSelector(selector, assertManualSelector) {
|
|
|
1556
1589
|
}
|
|
1557
1590
|
return [SHEET_SELECTOR_ANCHOR + (value.startsWith("&") ? value.slice(1) : " " + value)];
|
|
1558
1591
|
}
|
|
1592
|
+
/** Convert a normalized explicit selector into an unscoped sheet selector. */
|
|
1593
|
+
function setGlobalSheetSelectorOptions(selector, options) {
|
|
1594
|
+
const suffix = (Array.isArray(selector) ? selector[0] : selector).slice(SHEET_SELECTOR_ANCHOR.length);
|
|
1595
|
+
if (!suffix.startsWith(" ") || !suffix.trim()) throw new Error("createGlobalSheet requires explicit selectors without an ampersand anchor");
|
|
1596
|
+
const global = GLOBAL_SHEET_SELECTOR_ANCHOR + JSON.stringify(options.layer ?? null) + "\0" + suffix.trimStart();
|
|
1597
|
+
return Array.isArray(selector) ? [global, selector[1]] : global;
|
|
1598
|
+
}
|
|
1559
1599
|
//#endregion
|
|
1560
1600
|
//#region atomic/layer/layer.ts
|
|
1561
1601
|
function compareLayerPriority(p1, p2) {
|
|
@@ -2188,152 +2228,117 @@ function createFontPaletteValues(descriptors, stableId) {
|
|
|
2188
2228
|
});
|
|
2189
2229
|
}
|
|
2190
2230
|
//#endregion
|
|
2191
|
-
//#region
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
|
|
2195
|
-
name = formatKeyFramesName(format, id, { name });
|
|
2196
|
-
let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
|
|
2197
|
-
for (const selector in frames) {
|
|
2198
|
-
const frame = frames[selector];
|
|
2199
|
-
if (!frame) continue;
|
|
2200
|
-
css += selector + "{";
|
|
2201
|
-
css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
|
|
2202
|
-
css += "}";
|
|
2203
|
-
}
|
|
2204
|
-
css += "}";
|
|
2205
|
-
return {
|
|
2206
|
-
name,
|
|
2207
|
-
css
|
|
2208
|
-
};
|
|
2231
|
+
//#region sheet/utils/layer.ts
|
|
2232
|
+
function createSheetLayerState() {
|
|
2233
|
+
return createLayerPool(getStyleLayerName());
|
|
2209
2234
|
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
const idCounter$2 = createIdCounter("keyframes");
|
|
2213
|
-
function createKeyframes(frames, stableId) {
|
|
2214
|
-
return createNamedAtRuleRef({
|
|
2215
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
2216
|
-
buildCss: buildKeyframesCss,
|
|
2217
|
-
value: frames,
|
|
2218
|
-
idCounter: idCounter$2,
|
|
2219
|
-
stableId
|
|
2220
|
-
});
|
|
2235
|
+
function getSheetRulePriority(priority) {
|
|
2236
|
+
return priority ?? LayerDefaultPriority;
|
|
2221
2237
|
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2238
|
+
function getSheetRuleLayerPriority(priority, important) {
|
|
2239
|
+
const resolved = getSheetRulePriority(priority);
|
|
2240
|
+
return important ? [
|
|
2241
|
+
-resolved[0],
|
|
2242
|
+
-resolved[1],
|
|
2243
|
+
-resolved[2],
|
|
2244
|
+
-resolved[3],
|
|
2245
|
+
-resolved[4],
|
|
2246
|
+
-resolved[5],
|
|
2247
|
+
-resolved[6]
|
|
2248
|
+
] : resolved;
|
|
2233
2249
|
}
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
const idCounter$1 = createIdCounter("positionTry");
|
|
2237
|
-
function createPositionTry(descriptors, stableId) {
|
|
2238
|
-
return createNamedAtRuleRef({
|
|
2239
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
2240
|
-
buildCss: buildPositionTryCss,
|
|
2241
|
-
value: descriptors,
|
|
2242
|
-
idCounter: idCounter$1,
|
|
2243
|
-
stableId
|
|
2244
|
-
});
|
|
2250
|
+
function getStyleLayerName() {
|
|
2251
|
+
return CSS_CONFIG.layerNamespace || "css";
|
|
2245
2252
|
}
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
const PROPERTY_AT_RULE = "property";
|
|
2249
|
-
const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
|
|
2250
|
-
function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2251
|
-
name = formatPropertyName(format, id, { name });
|
|
2252
|
-
return {
|
|
2253
|
-
css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
|
|
2254
|
-
name
|
|
2255
|
-
};
|
|
2253
|
+
function getSheetLayerName() {
|
|
2254
|
+
return getStyleLayerName() + ".sheet";
|
|
2256
2255
|
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
stableId: typeof nameOrDescriptors === "string" ? {
|
|
2265
|
-
name: nameOrDescriptors,
|
|
2266
|
-
id: nameOrDescriptors
|
|
2267
|
-
} : descriptorsOrStableId,
|
|
2268
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
2269
|
-
value: descriptors,
|
|
2270
|
-
buildCss: buildPropertyCss
|
|
2271
|
-
});
|
|
2256
|
+
function getSheetLayerNames(layerState, hasSheetLayer, namedLayers = /* @__PURE__ */ new Set()) {
|
|
2257
|
+
const names = layerState.getNames();
|
|
2258
|
+
return [...new Set([
|
|
2259
|
+
...names,
|
|
2260
|
+
...hasSheetLayer ? [getSheetLayerName()] : [],
|
|
2261
|
+
...namedLayers
|
|
2262
|
+
])];
|
|
2272
2263
|
}
|
|
2273
2264
|
//#endregion
|
|
2274
|
-
//#region
|
|
2275
|
-
function
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
if (
|
|
2284
|
-
return
|
|
2285
|
-
}
|
|
2286
|
-
function
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2265
|
+
//#region sheet/ordering.ts
|
|
2266
|
+
function sheetRuleLayer(rule, config = CSS_CONFIG) {
|
|
2267
|
+
const mainEnabled = isStyleLayerEnabled(config.layer);
|
|
2268
|
+
let layer = rule.layer ?? "style";
|
|
2269
|
+
if (layer === "style" && !mainEnabled) layer = false;
|
|
2270
|
+
if (rule.sheet && rule.important && !rule.importantNative && layer !== false) return { name: (typeof layer === "object" ? layer.name : config.layerNamespace || "css") + ".important" };
|
|
2271
|
+
return layer;
|
|
2272
|
+
}
|
|
2273
|
+
function sheetRuleGroup(rule, config = CSS_CONFIG) {
|
|
2274
|
+
if (rule.globalSheet) return "global:" + rule.globalSheet.id;
|
|
2275
|
+
return rule.sheet && sheetRuleLayer(rule, config) === false ? "local-unlayered" : "regular";
|
|
2276
|
+
}
|
|
2277
|
+
function compareSheetGroups(a, b) {
|
|
2278
|
+
const region = (rule) => rule.globalSheet ? rule.globalSheet.order <= 0 ? 0 : 2 : 1;
|
|
2279
|
+
const order = region(a) - region(b);
|
|
2280
|
+
if (order) return order;
|
|
2281
|
+
if (a.globalSheet && b.globalSheet) return a.globalSheet.order - b.globalSheet.order;
|
|
2282
|
+
return 0;
|
|
2283
|
+
}
|
|
2284
|
+
function compareSheetRules(a, b, config = CSS_CONFIG) {
|
|
2285
|
+
const layerRank = (rule) => {
|
|
2286
|
+
const layer = sheetRuleLayer(rule, config);
|
|
2287
|
+
const main = config.layerNamespace || "css";
|
|
2288
|
+
return layer === false ? 2 : layer === "style" || typeof layer === "object" && layer.name === main ? 0 : 1;
|
|
2289
|
+
};
|
|
2290
|
+
return layerRank(a) - layerRank(b) || compareLayerPriority(getSheetRulePriority(a.priority), getSheetRulePriority(b.priority));
|
|
2291
|
+
}
|
|
2292
|
+
/** Stable group sort: equal global orders keep the first-discovered sheet first. */
|
|
2293
|
+
function orderSheetRules(rules, config = CSS_CONFIG) {
|
|
2294
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2295
|
+
for (const rule of rules) {
|
|
2296
|
+
const key = sheetRuleGroup(rule, config);
|
|
2297
|
+
const group = groups.get(key) ?? [];
|
|
2298
|
+
group.push(rule);
|
|
2299
|
+
groups.set(key, group);
|
|
2296
2300
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
function addSheetTokenOverride(data, item) {
|
|
2315
|
-
const state = data[BUILDER_STATE];
|
|
2316
|
-
const lookup = state.lookup ??= {};
|
|
2317
|
-
const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
|
|
2318
|
-
const lookupIndex = lookup[lookupKey];
|
|
2319
|
-
if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
|
|
2320
|
-
else lookup[lookupKey] = state.items.push(item) - 1;
|
|
2321
|
-
}
|
|
2322
|
-
function getSelectorItemStyleData(data) {
|
|
2323
|
-
return {
|
|
2324
|
-
[BUILDER_TYPE]: 1,
|
|
2325
|
-
[BUILDER_STATE]: data[BUILDER_STATE],
|
|
2326
|
-
[BUILDER_CALLSITE]: data[BUILDER_CALLSITE]
|
|
2301
|
+
return [...groups.entries()].sort(([ak, a], [bk, b]) => compareSheetGroups(a[0], b[0]) || (!a[0].globalSheet && !b[0].globalSheet ? Number(ak === "local-unlayered") - Number(bk === "local-unlayered") : 0)).flatMap(([, group]) => group.slice().sort((a, b) => compareSheetRules(a, b, config)));
|
|
2302
|
+
}
|
|
2303
|
+
/** Reserve each parent's first child for managed important declarations. */
|
|
2304
|
+
function sheetLayerOrder(names, config = CSS_CONFIG, reservedParents = names) {
|
|
2305
|
+
const roots = [];
|
|
2306
|
+
const children = /* @__PURE__ */ new Map();
|
|
2307
|
+
const add = (name) => {
|
|
2308
|
+
const parts = name.split(".");
|
|
2309
|
+
if (!roots.includes(parts[0])) roots.push(parts[0]);
|
|
2310
|
+
for (let i = 1; i < parts.length; i++) {
|
|
2311
|
+
const parent = parts.slice(0, i).join(".");
|
|
2312
|
+
const child = parts.slice(0, i + 1).join(".");
|
|
2313
|
+
const list = children.get(parent) ?? [];
|
|
2314
|
+
if (!list.includes(child)) list.push(child);
|
|
2315
|
+
children.set(parent, list);
|
|
2316
|
+
}
|
|
2317
|
+
if (!name.endsWith(".important") && reservedParents.includes(name)) children.set(name, children.get(name) ?? []);
|
|
2327
2318
|
};
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2319
|
+
for (const name of [...(config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).filter((name) => name !== "$layer"), ...names]) add(name);
|
|
2320
|
+
const declarations = [getLayerOrderCss((config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).map((name) => name === "$layer" ? name : name.split(".")[0]), roots)];
|
|
2321
|
+
for (const [parent, list] of children) {
|
|
2322
|
+
if (parent.endsWith(".important")) continue;
|
|
2323
|
+
declarations.push("@layer " + [...new Set([parent + ".important", ...list])].join(", ") + ";");
|
|
2324
|
+
}
|
|
2325
|
+
return declarations.filter(Boolean).join("\n");
|
|
2326
|
+
}
|
|
2327
|
+
function layerNameForRule(rule, config, mode, pool) {
|
|
2328
|
+
const layer = sheetRuleLayer(rule, config);
|
|
2329
|
+
return typeof layer === "object" ? layer.name : layer === false ? null : layer === "sheet" ? (config.layerNamespace || "css") + ".sheet" : mode === "layer" ? pool.getName(getSheetRuleLayerPriority(rule.priority, rule.important)) : config.layerNamespace || "css";
|
|
2330
|
+
}
|
|
2331
|
+
/** Build only ordering declarations; runtime flushing need not serialize rule bodies. */
|
|
2332
|
+
function sheetOrderingPreamble(rules, config = CSS_CONFIG, mode = "sort") {
|
|
2333
|
+
const pool = createLayerPool(config.layerNamespace || "css");
|
|
2334
|
+
const names = /* @__PURE__ */ new Set();
|
|
2335
|
+
for (const rule of orderSheetRules(rules, config)) {
|
|
2336
|
+
const name = layerNameForRule(rule, config, mode, pool);
|
|
2337
|
+
if (name) names.add(name);
|
|
2338
|
+
}
|
|
2339
|
+
const priorities = pool.getNames();
|
|
2340
|
+
const named = [...names].filter((name) => !priorities.includes(name));
|
|
2341
|
+
return sheetLayerOrder([...priorities, ...named], config, named);
|
|
2337
2342
|
}
|
|
2338
2343
|
//#endregion
|
|
2339
2344
|
//#region sheet/utils/dom.ts
|
|
@@ -2374,38 +2379,166 @@ function getFirstCssSheetTag(head) {
|
|
|
2374
2379
|
return null;
|
|
2375
2380
|
}
|
|
2376
2381
|
//#endregion
|
|
2377
|
-
//#region sheet/
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2382
|
+
//#region sheet/ordered.ts
|
|
2383
|
+
const refreshers = globalData("sheet.ordered.refreshers", () => /* @__PURE__ */ new Set());
|
|
2384
|
+
/** Keep whole global sheets together; move DOM groups without rebuilding unrelated rules. */
|
|
2385
|
+
function createOrderedSheet(create, options, dev) {
|
|
2386
|
+
const document = resolveDocument(options.document);
|
|
2387
|
+
if (!document) return create(options);
|
|
2388
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2389
|
+
const owners = /* @__PURE__ */ new Map();
|
|
2390
|
+
const direct = [];
|
|
2391
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2392
|
+
let activeLayers = CSS_CONFIG.layers;
|
|
2393
|
+
let enabled = false;
|
|
2394
|
+
let header = null;
|
|
2395
|
+
let serial = 0;
|
|
2396
|
+
let dirty = false;
|
|
2397
|
+
let mode = DEV_CONFIG.stylePriorityMode;
|
|
2398
|
+
const pending = /* @__PURE__ */ new Set();
|
|
2399
|
+
const regular = getGroup("regular");
|
|
2400
|
+
const refresh = () => {
|
|
2401
|
+
dirty = true;
|
|
2402
|
+
flush();
|
|
2403
|
+
};
|
|
2404
|
+
if (dev) refreshers.add(refresh);
|
|
2405
|
+
function getGroup(name) {
|
|
2406
|
+
const previous = groups.get(name);
|
|
2407
|
+
if (previous) return previous;
|
|
2408
|
+
const tagName = name === "regular" ? options.tagName : (options.tagName ? options.tagName + " " : "") + "ordered-" + ++serial;
|
|
2409
|
+
const group = {
|
|
2410
|
+
name,
|
|
2411
|
+
tagName,
|
|
2412
|
+
rules: [],
|
|
2413
|
+
sheet: create({
|
|
2414
|
+
...options,
|
|
2415
|
+
tagName
|
|
2416
|
+
})
|
|
2417
|
+
};
|
|
2418
|
+
group.sheet.updateLayers(activeLayers ?? []);
|
|
2419
|
+
groups.set(name, group);
|
|
2420
|
+
return group;
|
|
2421
|
+
}
|
|
2422
|
+
function route(rule) {
|
|
2423
|
+
return {
|
|
2424
|
+
...rule,
|
|
2425
|
+
layer: sheetRuleLayer(rule)
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
function insert(rule) {
|
|
2429
|
+
const item = typeof rule === "string" ? { css: rule } : rule;
|
|
2430
|
+
const key = sheetRuleGroup(item) + "\0" + (item.key ?? item.css);
|
|
2431
|
+
if (seen.has(key)) return;
|
|
2432
|
+
seen.add(key);
|
|
2433
|
+
direct.push(item);
|
|
2434
|
+
add(item);
|
|
2435
|
+
}
|
|
2436
|
+
function add(item) {
|
|
2437
|
+
enabled ||= !!(item.sheet || item.globalSheet);
|
|
2438
|
+
const group = getGroup(sheetRuleGroup(item));
|
|
2439
|
+
const previous = group.rules[group.rules.length - 1];
|
|
2440
|
+
group.rules.push(item);
|
|
2441
|
+
if (enabled && previous && compareSheetRules(previous, item) > 0) pending.add(group);
|
|
2442
|
+
if (!pending.has(group)) group.sheet.insert(route(item));
|
|
2443
|
+
dirty = true;
|
|
2444
|
+
}
|
|
2445
|
+
function rebuild(group) {
|
|
2446
|
+
pending.delete(group);
|
|
2447
|
+
group.sheet.destroy?.();
|
|
2448
|
+
group.sheet = create({
|
|
2449
|
+
...options,
|
|
2450
|
+
tagName: group.tagName
|
|
2451
|
+
});
|
|
2452
|
+
group.sheet.updateLayers(activeLayers ?? []);
|
|
2453
|
+
group.rules.sort((a, b) => compareSheetRules(a, b));
|
|
2454
|
+
for (const rule of group.rules) group.sheet.insert(route(rule));
|
|
2455
|
+
group.sheet.flush();
|
|
2456
|
+
dirty = true;
|
|
2457
|
+
}
|
|
2458
|
+
function collectTags() {
|
|
2459
|
+
const lookup = new Map([...groups.values()].map((group) => [group.tagName ?? "", group]));
|
|
2460
|
+
const result = /* @__PURE__ */ new Map();
|
|
2461
|
+
const head = document.head || document.documentElement;
|
|
2462
|
+
for (const node of Array.from(head.childNodes)) {
|
|
2463
|
+
if (typeof node.getAttribute !== "function") continue;
|
|
2464
|
+
const match = node.getAttribute("data-css-sheet")?.match(/^(?:(.*) )?(?:layers|rules(?: .*)?)$/);
|
|
2465
|
+
const group = match && lookup.get(match[1] ?? "");
|
|
2466
|
+
if (!group) continue;
|
|
2467
|
+
const list = result.get(group) ?? [];
|
|
2468
|
+
list.push(node);
|
|
2469
|
+
result.set(group, list);
|
|
2470
|
+
}
|
|
2471
|
+
return result;
|
|
2472
|
+
}
|
|
2473
|
+
function flush() {
|
|
2474
|
+
if (dev && mode !== DEV_CONFIG.stylePriorityMode) {
|
|
2475
|
+
mode = DEV_CONFIG.stylePriorityMode;
|
|
2476
|
+
dirty = true;
|
|
2477
|
+
}
|
|
2478
|
+
for (const group of pending) rebuild(group);
|
|
2479
|
+
pending.clear();
|
|
2480
|
+
for (const group of groups.values()) group.sheet.flush();
|
|
2481
|
+
if (!enabled || !dirty) return;
|
|
2482
|
+
const config = {
|
|
2483
|
+
...CSS_CONFIG,
|
|
2484
|
+
layers: activeLayers ? [...activeLayers] : void 0
|
|
2485
|
+
};
|
|
2486
|
+
const order = sheetOrderingPreamble([...groups.values()].flatMap((group) => group.rules), config, dev ? DEV_CONFIG.stylePriorityMode : "layer");
|
|
2487
|
+
const head = document.head || document.documentElement;
|
|
2488
|
+
const groupTags = collectTags();
|
|
2489
|
+
if (!header) {
|
|
2490
|
+
header = createStyleTag(document, (options.tagName ? options.tagName + " " : "") + "ordering", options.nonce);
|
|
2491
|
+
const first = groupTags.get(regular)?.[0];
|
|
2492
|
+
if (first) head.insertBefore(header, first);
|
|
2493
|
+
else head.appendChild(header);
|
|
2494
|
+
}
|
|
2495
|
+
if (header.textContent !== order) header.textContent = order;
|
|
2496
|
+
const sorted = [...groups.values()].sort((a, b) => {
|
|
2497
|
+
const ar = a.rules[0] ?? { css: "" };
|
|
2498
|
+
const br = b.rules[0] ?? { css: "" };
|
|
2499
|
+
return compareSheetGroups(ar, br) || (!ar.globalSheet && !br.globalSheet ? Number(a.name === "local-unlayered") - Number(b.name === "local-unlayered") : 0);
|
|
2500
|
+
});
|
|
2501
|
+
let previous = header;
|
|
2502
|
+
for (const group of sorted) for (const tag of groupTags.get(group) ?? []) {
|
|
2503
|
+
if (previous.nextSibling !== tag) {
|
|
2504
|
+
const oldSheet = tag.sheet;
|
|
2505
|
+
const css = oldSheet ? Array.from(oldSheet.cssRules).map((rule) => rule.cssText) : [];
|
|
2506
|
+
head.insertBefore(tag, previous.nextSibling);
|
|
2507
|
+
if (oldSheet && tag.sheet !== oldSheet && css.length && !tag.sheet?.cssRules.length) for (const rule of css) tag.sheet?.insertRule(rule, tag.sheet.cssRules.length);
|
|
2508
|
+
}
|
|
2509
|
+
previous = tag;
|
|
2510
|
+
}
|
|
2511
|
+
dirty = false;
|
|
2512
|
+
}
|
|
2513
|
+
return {
|
|
2514
|
+
insert,
|
|
2515
|
+
flush,
|
|
2516
|
+
updateLayers(layers) {
|
|
2517
|
+
if (activeLayers?.length === layers.length && layers.every((name, index) => activeLayers[index] === name)) return;
|
|
2518
|
+
activeLayers = [...layers];
|
|
2519
|
+
for (const group of groups.values()) group.sheet.updateLayers(layers);
|
|
2520
|
+
dirty = true;
|
|
2521
|
+
},
|
|
2522
|
+
replaceRules(owner, rules) {
|
|
2523
|
+
const previous = owners.get(owner) ?? [];
|
|
2524
|
+
owners.set(owner, rules);
|
|
2525
|
+
enabled = true;
|
|
2526
|
+
const affected = new Set([...previous, ...rules].map((rule) => sheetRuleGroup(rule)));
|
|
2527
|
+
const all = [...direct, ...[...owners.values()].flat()];
|
|
2528
|
+
for (const name of affected) {
|
|
2529
|
+
const group = getGroup(name);
|
|
2530
|
+
group.rules = all.filter((rule) => sheetRuleGroup(rule) === name);
|
|
2531
|
+
rebuild(group);
|
|
2532
|
+
}
|
|
2533
|
+
flush();
|
|
2534
|
+
},
|
|
2535
|
+
destroy() {
|
|
2536
|
+
refreshers.delete(refresh);
|
|
2537
|
+
for (const group of groups.values()) group.sheet.destroy?.();
|
|
2538
|
+
if (header?.parentNode) header.parentNode.removeChild(header);
|
|
2539
|
+
groups.clear();
|
|
2540
|
+
}
|
|
2541
|
+
};
|
|
2409
2542
|
}
|
|
2410
2543
|
//#endregion
|
|
2411
2544
|
//#region sheet/utils/noop.ts
|
|
@@ -2854,7 +2987,7 @@ function ensureGroup(groups, priority, layer) {
|
|
|
2854
2987
|
return group;
|
|
2855
2988
|
}
|
|
2856
2989
|
function getLayerRank(layer) {
|
|
2857
|
-
return layer === "style" ? 0 : layer === "sheet" || typeof layer === "object" ? 1 : 2;
|
|
2990
|
+
return layer === "style" || typeof layer === "object" && layer.name === getStyleLayerName() ? 0 : layer === "sheet" || typeof layer === "object" ? 1 : 2;
|
|
2858
2991
|
}
|
|
2859
2992
|
function createGroupTag(document, groups, group, options) {
|
|
2860
2993
|
const previous = getPreviousTag(groups, group, options.previous);
|
|
@@ -2897,6 +3030,9 @@ function getPriorityKey(priority) {
|
|
|
2897
3030
|
//#region sheet/dev/index.ts
|
|
2898
3031
|
const DEV_SHEETS = globalData("sheet.dev.sheets", () => /* @__PURE__ */ new Set());
|
|
2899
3032
|
function createDevSheet(options = {}) {
|
|
3033
|
+
return createOrderedSheet(createDevSheetBase, options, true);
|
|
3034
|
+
}
|
|
3035
|
+
function createDevSheetBase(options = {}) {
|
|
2900
3036
|
let activeMode = DEV_CONFIG.stylePriorityMode;
|
|
2901
3037
|
let active = createDevSheetForMode(activeMode, options);
|
|
2902
3038
|
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
@@ -2916,6 +3052,15 @@ function createDevSheet(options = {}) {
|
|
|
2916
3052
|
rules.push(rule);
|
|
2917
3053
|
active.insert(rule);
|
|
2918
3054
|
},
|
|
3055
|
+
replaceRules(owner, next) {
|
|
3056
|
+
const group = rules.find((rule) => typeof rule === "object" && "owner" in rule && rule.owner === owner);
|
|
3057
|
+
if (group && typeof group === "object" && "owner" in group) group.rules = next;
|
|
3058
|
+
else rules.push({
|
|
3059
|
+
owner,
|
|
3060
|
+
rules: next
|
|
3061
|
+
});
|
|
3062
|
+
rebuild();
|
|
3063
|
+
},
|
|
2919
3064
|
flush() {
|
|
2920
3065
|
ensureActiveMode();
|
|
2921
3066
|
active.flush();
|
|
@@ -2935,7 +3080,11 @@ function createDevSheet(options = {}) {
|
|
|
2935
3080
|
removeDevSheetTags(options.document, options.tagName);
|
|
2936
3081
|
active = createDevSheetForMode(activeMode, options);
|
|
2937
3082
|
active.updateLayers(activeLayers);
|
|
2938
|
-
for (let i = 0, len = rules.length; i < len; i++)
|
|
3083
|
+
for (let i = 0, len = rules.length; i < len; i++) {
|
|
3084
|
+
const rule = rules[i];
|
|
3085
|
+
if (typeof rule === "object" && "owner" in rule) for (const item of rule.rules) active.insert(item);
|
|
3086
|
+
else active.insert(rule);
|
|
3087
|
+
}
|
|
2939
3088
|
active.flush();
|
|
2940
3089
|
}
|
|
2941
3090
|
}
|
|
@@ -2961,14 +3110,22 @@ function removeDevSheetTags(documentOverride, tagName) {
|
|
|
2961
3110
|
pruneDevSourcemapTags();
|
|
2962
3111
|
}
|
|
2963
3112
|
function matchesDevSheetTag(sheetName, tagName) {
|
|
2964
|
-
if (tagName)
|
|
3113
|
+
if (tagName) {
|
|
3114
|
+
if (sheetName === tagName) return true;
|
|
3115
|
+
if (!sheetName.startsWith(tagName + " ")) return false;
|
|
3116
|
+
sheetName = sheetName.slice(tagName.length + 1);
|
|
3117
|
+
}
|
|
2965
3118
|
return sheetName === "layers" || sheetName === "rules" || sheetName.startsWith("rules ");
|
|
2966
3119
|
}
|
|
2967
3120
|
//#endregion
|
|
2968
3121
|
//#region sheet/prod.ts
|
|
2969
3122
|
function createProdSheet(options = {}) {
|
|
3123
|
+
return createOrderedSheet(createProdSheetBase, options, false);
|
|
3124
|
+
}
|
|
3125
|
+
function createProdSheetBase(options = {}) {
|
|
2970
3126
|
const document = resolveDocument(options.document);
|
|
2971
3127
|
if (!document) return createNoopSheet();
|
|
3128
|
+
const tagPrefix = options.tagName ? options.tagName + " " : "";
|
|
2972
3129
|
const inserted = /* @__PURE__ */ new Set();
|
|
2973
3130
|
const layerState = createSheetLayerState();
|
|
2974
3131
|
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
@@ -2983,7 +3140,7 @@ function createProdSheet(options = {}) {
|
|
|
2983
3140
|
const next = getLayerOrderCss(layers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2984
3141
|
if (next === layerText) return;
|
|
2985
3142
|
layerText = next;
|
|
2986
|
-
layerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3143
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
2987
3144
|
layerTag.textContent = next;
|
|
2988
3145
|
},
|
|
2989
3146
|
insert(rule) {
|
|
@@ -2998,27 +3155,32 @@ function createProdSheet(options = {}) {
|
|
|
2998
3155
|
const nextLayerText = getLayerOrderCss(activeLayers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2999
3156
|
if (nextLayerText !== layerText) {
|
|
3000
3157
|
layerText = nextLayerText;
|
|
3001
|
-
layerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3158
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3002
3159
|
layerTag.textContent = nextLayerText;
|
|
3003
3160
|
}
|
|
3004
3161
|
const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
|
|
3005
3162
|
const key = typeof rule === "string" ? css : ruleKey;
|
|
3006
3163
|
if (key && inserted.has(key)) return;
|
|
3007
3164
|
if (key) inserted.add(key);
|
|
3008
|
-
const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3165
|
+
const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3009
3166
|
layerTag = activeLayerTag;
|
|
3010
3167
|
if (!ruleTag) {
|
|
3011
|
-
ruleTag = createStyleTag(document, "rules", options.nonce);
|
|
3168
|
+
ruleTag = createStyleTag(document, tagPrefix + "rules", options.nonce);
|
|
3012
3169
|
insertStyleTagAfter(document, ruleTag, activeLayerTag);
|
|
3013
3170
|
}
|
|
3014
3171
|
insertRule(ruleTag, css);
|
|
3015
3172
|
},
|
|
3016
|
-
flush() {}
|
|
3173
|
+
flush() {},
|
|
3174
|
+
destroy() {
|
|
3175
|
+
layerTag?.parentNode?.removeChild(layerTag);
|
|
3176
|
+
ruleTag?.parentNode?.removeChild(ruleTag);
|
|
3177
|
+
inserted.clear();
|
|
3178
|
+
}
|
|
3017
3179
|
};
|
|
3018
3180
|
}
|
|
3019
|
-
function ensureLayerTag(document, tag, nonce) {
|
|
3181
|
+
function ensureLayerTag(document, tag, nonce, prefix = "") {
|
|
3020
3182
|
if (tag) return tag;
|
|
3021
|
-
const next = createStyleTag(document, "layers", nonce);
|
|
3183
|
+
const next = createStyleTag(document, prefix + "layers", nonce);
|
|
3022
3184
|
insertStyleTagAfter(document, next, null);
|
|
3023
3185
|
return next;
|
|
3024
3186
|
}
|
|
@@ -3036,10 +3198,24 @@ function createStyleSheet(options = {}) {
|
|
|
3036
3198
|
return options.dev ?? DEV_CONFIG.isDev ? createDevSheet(options) : createProdSheet(options);
|
|
3037
3199
|
}
|
|
3038
3200
|
//#endregion
|
|
3039
|
-
//#region runtime/sheet/
|
|
3201
|
+
//#region runtime/sheet/document.ts
|
|
3040
3202
|
const GLOBAL_KEY = "runtime.sheet.global";
|
|
3203
|
+
const state = globalData("runtime.sheet.document", () => ({ document: getRuntimeDocument() }));
|
|
3204
|
+
function resetSheet() {
|
|
3205
|
+
getGlobalData(GLOBAL_KEY)?.destroy?.();
|
|
3206
|
+
clearGlobalData(GLOBAL_KEY);
|
|
3207
|
+
state.document = getRuntimeDocument();
|
|
3208
|
+
}
|
|
3209
|
+
onRuntimeDocumentChange(resetSheet);
|
|
3210
|
+
function getDocumentSheet(create) {
|
|
3211
|
+
const document = getRuntimeDocument();
|
|
3212
|
+
if (state.document !== document) resetSheet();
|
|
3213
|
+
return globalData(GLOBAL_KEY, () => document ? create({ document }) : createNoopSheet());
|
|
3214
|
+
}
|
|
3215
|
+
//#endregion
|
|
3216
|
+
//#region runtime/sheet/global.ts
|
|
3041
3217
|
function getGlobalSheet() {
|
|
3042
|
-
return
|
|
3218
|
+
return getDocumentSheet(createStyleSheet);
|
|
3043
3219
|
}
|
|
3044
3220
|
//#endregion
|
|
3045
3221
|
//#region runtime/core/combinedStyle.ts
|
|
@@ -3603,10 +3779,10 @@ function buildAtomicRule(className, property, value, important, selector, parent
|
|
|
3603
3779
|
const cssProp = getCssPropertyName(property);
|
|
3604
3780
|
const cssValue = getCssPropertyValue(property, value) + (important ? " !important" : "");
|
|
3605
3781
|
const escapedClass = escapeCssIdent(className);
|
|
3606
|
-
const
|
|
3607
|
-
const classSelector =
|
|
3782
|
+
const specificity = hasSheetSelectorAnchor(selector) ? getSheetSelectorSpecificity(selector) ?? 1 : 1;
|
|
3783
|
+
const classSelector = specificity === 0 ? `:where(.${escapedClass})` : Array(specificity).fill("." + escapedClass).join("");
|
|
3608
3784
|
const itemSelector = selector ? getSelectorText$1(selector) : "";
|
|
3609
|
-
let selectorStr = classSelector + itemSelector;
|
|
3785
|
+
let selectorStr = hasGlobalSheetSelectorAnchor(selector) ? itemSelector : classSelector + itemSelector;
|
|
3610
3786
|
if (parentSelector) {
|
|
3611
3787
|
const parentWhere = `:where(${"." + escapeCssIdent(getScopeClassName(className, scopeClassNameFormat)) + getSelectorText$1(parentSelector)})`;
|
|
3612
3788
|
selectorStr = classSelector + parentWhere + itemSelector + "," + parentWhere + " " + selectorStr;
|
|
@@ -3663,6 +3839,8 @@ function createRuntimeSheetRules(item, sheetOptions = null) {
|
|
|
3663
3839
|
dedupe: runtimeItem.dedupe,
|
|
3664
3840
|
priority: layerPriority,
|
|
3665
3841
|
important: runtimeItem.important,
|
|
3842
|
+
importantNative: runtimeItem.importantNative,
|
|
3843
|
+
sheet: !!sheetOptions,
|
|
3666
3844
|
layer: getRuntimeRuleLayer(sheetOptions),
|
|
3667
3845
|
css: ruleCss,
|
|
3668
3846
|
callsite: runtimeItem.callsite,
|
|
@@ -3681,7 +3859,7 @@ function createRuntimeSheetRules(item, sheetOptions = null) {
|
|
|
3681
3859
|
}
|
|
3682
3860
|
function getRuntimeRuleLayer(sheetOptions) {
|
|
3683
3861
|
if (!sheetOptions) return "style";
|
|
3684
|
-
return resolveSheetLayerOption(sheetOptions.layer ??
|
|
3862
|
+
return resolveSheetLayerOption(sheetOptions.layer ?? false, CSS_CONFIG.layerNamespace || "css");
|
|
3685
3863
|
}
|
|
3686
3864
|
const formatThemeName = createNameFormatter(["name"]);
|
|
3687
3865
|
function createThemeClassName(name, id, themeNameFormat) {
|
|
@@ -3734,6 +3912,11 @@ function createThemeRule(theme) {
|
|
|
3734
3912
|
}
|
|
3735
3913
|
//#endregion
|
|
3736
3914
|
//#region runtime/sheet/rules.ts
|
|
3915
|
+
function walkStylePropSheetRules(styleProp, onRule, onTheme) {
|
|
3916
|
+
walkStyleProp(styleProp, (item) => {
|
|
3917
|
+
walkStylePropItemSheetRules(item, onRule, onTheme);
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3737
3920
|
function walkStylePropItemsSheetRules(items, onRule, onTheme) {
|
|
3738
3921
|
for (let i = 0, len = items.length; i < len; i++) walkStylePropItemSheetRules(items[i], onRule, onTheme);
|
|
3739
3922
|
}
|
|
@@ -3751,6 +3934,216 @@ function walkStylePropItemSheetRules(item, onRule, onTheme) {
|
|
|
3751
3934
|
for (let j = 0, len = rules.length; j < len; j++) onRule(rules[j]);
|
|
3752
3935
|
}
|
|
3753
3936
|
}
|
|
3937
|
+
function collectStylePropSheetRules(styleProp) {
|
|
3938
|
+
return collectStylePropRules((onRule) => {
|
|
3939
|
+
walkStylePropSheetRules(styleProp, onRule);
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
function collectStylePropRules(walk) {
|
|
3943
|
+
const rules = [];
|
|
3944
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
3945
|
+
walk((rule) => {
|
|
3946
|
+
if (!rule.key || !rule.dedupe) return;
|
|
3947
|
+
const index = lookup.get(rule.dedupe);
|
|
3948
|
+
if (index === void 0) lookup.set(rule.dedupe, rules.push(createSheetRulePayload(rule)) - 1);
|
|
3949
|
+
else rules[index] = createSheetRulePayload(rule);
|
|
3950
|
+
});
|
|
3951
|
+
return rules;
|
|
3952
|
+
}
|
|
3953
|
+
function createSheetRulePayload(rule) {
|
|
3954
|
+
return {
|
|
3955
|
+
key: rule.key,
|
|
3956
|
+
css: rule.css,
|
|
3957
|
+
callsite: rule.callsite || null,
|
|
3958
|
+
debug: rule.debug || null,
|
|
3959
|
+
debugField: rule.debugField || null,
|
|
3960
|
+
priority: rule.priority,
|
|
3961
|
+
important: rule.important,
|
|
3962
|
+
importantNative: rule.importantNative,
|
|
3963
|
+
sheet: rule.sheet,
|
|
3964
|
+
globalSheet: rule.globalSheet,
|
|
3965
|
+
layer: rule.layer
|
|
3966
|
+
};
|
|
3967
|
+
}
|
|
3968
|
+
//#endregion
|
|
3969
|
+
//#region css/sheet.ts
|
|
3970
|
+
function createSheet(optionsOrItems, itemsOrDebug, debug) {
|
|
3971
|
+
const hasOptions = arguments.length >= 2 && !isDebugData(itemsOrDebug);
|
|
3972
|
+
return buildSheet(hasOptions ? optionsOrItems : {}, hasOptions ? itemsOrDebug : optionsOrItems, hasOptions ? debug : itemsOrDebug);
|
|
3973
|
+
}
|
|
3974
|
+
function buildSheet(options, items, resolvedDebug, global = false) {
|
|
3975
|
+
assertCreateSheetOptions(options);
|
|
3976
|
+
const callsite = resolveCallsite(resolvedDebug);
|
|
3977
|
+
let data = createSheetData(callsite, options);
|
|
3978
|
+
if (items) data = mergeSheetItems(data, callsite, items, global);
|
|
3979
|
+
return data;
|
|
3980
|
+
}
|
|
3981
|
+
function mergeSheetItems(data, callsite, items, global = false) {
|
|
3982
|
+
if (!items) return data;
|
|
3983
|
+
if (Array.isArray(items)) {
|
|
3984
|
+
let next = data;
|
|
3985
|
+
for (let i = 0, len = items.length; i < len; i++) next = mergeSheetItems(next, callsite, items[i], global);
|
|
3986
|
+
return next;
|
|
3987
|
+
}
|
|
3988
|
+
if (isStyleTokenOverrideData(items)) {
|
|
3989
|
+
if (global) throw new Error("createGlobalSheet requires token overrides inside an explicit selector");
|
|
3990
|
+
addSheetTokenOverride(data, items);
|
|
3991
|
+
return data;
|
|
3992
|
+
}
|
|
3993
|
+
if (!isSelectorData(items) && !isSelectorOverrideData(items)) throw new Error("createSheet(items) requires selector items from style.selector(...) or token overrides");
|
|
3994
|
+
const selectorItem = items;
|
|
3995
|
+
const selectors = getSelectorSelectors(selectorItem);
|
|
3996
|
+
const options = data[BUILDER_SHEET_OPTIONS];
|
|
3997
|
+
let next = data;
|
|
3998
|
+
const sheetSelectors = selectors.map((selector) => global ? setGlobalSheetSelectorOptions(selector, options) : setSheetSelectorOptions(selector, options));
|
|
3999
|
+
if (isSelectorData(selectorItem)) return next;
|
|
4000
|
+
for (let i = 0, len = selectors.length; i < len; i++) next = mergeSheetData(next, callsite, getSelectorItemStyleData(selectorItem), null, sheetSelectors[i], null);
|
|
4001
|
+
return next;
|
|
4002
|
+
}
|
|
4003
|
+
function assertCreateSheetOptions(options) {
|
|
4004
|
+
if (!options || typeof options !== "object" || Object.keys(options).some((key) => key !== "layer" && key !== "specificity")) throw new Error("createSheet only supports layer and specificity options");
|
|
4005
|
+
if (!isSheetLayerOption(options.layer)) throw new Error("createSheet options.layer must be a boolean or a valid layer name");
|
|
4006
|
+
if (options.specificity !== void 0 && (!Number.isInteger(options.specificity) || options.specificity < 0)) throw new Error("createSheet options.specificity must be a non-negative integer");
|
|
4007
|
+
}
|
|
4008
|
+
function addSheetTokenOverride(data, item) {
|
|
4009
|
+
const state = data[BUILDER_STATE];
|
|
4010
|
+
const lookup = state.lookup ??= {};
|
|
4011
|
+
const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
|
|
4012
|
+
const lookupIndex = lookup[lookupKey];
|
|
4013
|
+
if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
|
|
4014
|
+
else lookup[lookupKey] = state.items.push(item) - 1;
|
|
4015
|
+
}
|
|
4016
|
+
function getSelectorItemStyleData(data) {
|
|
4017
|
+
return {
|
|
4018
|
+
[BUILDER_TYPE]: 1,
|
|
4019
|
+
[BUILDER_STATE]: data[BUILDER_STATE],
|
|
4020
|
+
[BUILDER_CALLSITE]: data[BUILDER_CALLSITE]
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
4023
|
+
function getSheetTokenLookupKey(tokenId) {
|
|
4024
|
+
return "token\0" + tokenId;
|
|
4025
|
+
}
|
|
4026
|
+
//#endregion
|
|
4027
|
+
//#region css/globalSheet.ts
|
|
4028
|
+
function createGlobalSheet(optionsOrItems, items, debug) {
|
|
4029
|
+
const rules = buildGlobalSheetRules(optionsOrItems, items, debug, arguments.length >= 2 && !isDebugData(items));
|
|
4030
|
+
const sheet = getGlobalSheet();
|
|
4031
|
+
sheet.updateLayers(CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? []);
|
|
4032
|
+
for (const rule of rules) sheet.insert(rule);
|
|
4033
|
+
sheet.flush();
|
|
4034
|
+
}
|
|
4035
|
+
function buildGlobalSheetRules(optionsOrItems, items, debug, hasOptions = arguments.length >= 2 && !isDebugData(items)) {
|
|
4036
|
+
const options = hasOptions ? optionsOrItems : {};
|
|
4037
|
+
if (!options || typeof options !== "object" || Object.keys(options).some((key) => key !== "layer" && key !== "order")) throw new Error("createGlobalSheet only supports layer and order options");
|
|
4038
|
+
if (options.order !== void 0 && !Number.isFinite(options.order)) throw new Error("createGlobalSheet order must be a finite number");
|
|
4039
|
+
const data = buildSheet({ layer: options.layer }, hasOptions ? items : optionsOrItems, isDebugData(items) ? items : debug, true);
|
|
4040
|
+
const rules = collectStylePropSheetRules(data);
|
|
4041
|
+
const site = isDebugData(items) || debug ? data[BUILDER_CALLSITE] : null;
|
|
4042
|
+
const id = hashString(JSON.stringify(site ? [
|
|
4043
|
+
site.filePath,
|
|
4044
|
+
site.line,
|
|
4045
|
+
site.column
|
|
4046
|
+
] : [options, rules.map((rule) => rule.css)]));
|
|
4047
|
+
const globals = [];
|
|
4048
|
+
for (const rule of rules) globals.push({
|
|
4049
|
+
...rule,
|
|
4050
|
+
key: id + ":" + rule.key,
|
|
4051
|
+
globalSheet: {
|
|
4052
|
+
id,
|
|
4053
|
+
order: options.order ?? 0
|
|
4054
|
+
}
|
|
4055
|
+
});
|
|
4056
|
+
return globals;
|
|
4057
|
+
}
|
|
4058
|
+
//#endregion
|
|
4059
|
+
//#region atomic/atRule/keyframes.ts
|
|
4060
|
+
const KEYFRAMES_AT_RULE = "keyframes";
|
|
4061
|
+
const formatKeyFramesName = createAtRuleNameFormatter("keyframes[-(name)]-$hash");
|
|
4062
|
+
function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
|
|
4063
|
+
name = formatKeyFramesName(format, id, { name });
|
|
4064
|
+
let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
|
|
4065
|
+
for (const selector in frames) {
|
|
4066
|
+
const frame = frames[selector];
|
|
4067
|
+
if (!frame) continue;
|
|
4068
|
+
css += selector + "{";
|
|
4069
|
+
css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
|
|
4070
|
+
css += "}";
|
|
4071
|
+
}
|
|
4072
|
+
css += "}";
|
|
4073
|
+
return {
|
|
4074
|
+
name,
|
|
4075
|
+
css
|
|
4076
|
+
};
|
|
4077
|
+
}
|
|
4078
|
+
//#endregion
|
|
4079
|
+
//#region css/keyframes.ts
|
|
4080
|
+
const idCounter$2 = createIdCounter("keyframes");
|
|
4081
|
+
function createKeyframes(frames, stableId) {
|
|
4082
|
+
return createNamedAtRuleRef({
|
|
4083
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
4084
|
+
buildCss: buildKeyframesCss,
|
|
4085
|
+
value: frames,
|
|
4086
|
+
idCounter: idCounter$2,
|
|
4087
|
+
stableId
|
|
4088
|
+
});
|
|
4089
|
+
}
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region atomic/atRule/positionTry.ts
|
|
4092
|
+
const POSITION_TRY_AT_RULE = "position-try";
|
|
4093
|
+
const formatPositionTryName = createAtRuleNameFormatter("position-try[-(name)]-$hash", "--");
|
|
4094
|
+
function buildPositionTryCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
4095
|
+
name = formatPositionTryName(format, id, { name });
|
|
4096
|
+
const css = buildNamedAtRuleCss(POSITION_TRY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
4097
|
+
return {
|
|
4098
|
+
name,
|
|
4099
|
+
css
|
|
4100
|
+
};
|
|
4101
|
+
}
|
|
4102
|
+
//#endregion
|
|
4103
|
+
//#region css/positionTry.ts
|
|
4104
|
+
const idCounter$1 = createIdCounter("positionTry");
|
|
4105
|
+
function createPositionTry(descriptors, stableId) {
|
|
4106
|
+
return createNamedAtRuleRef({
|
|
4107
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
4108
|
+
buildCss: buildPositionTryCss,
|
|
4109
|
+
value: descriptors,
|
|
4110
|
+
idCounter: idCounter$1,
|
|
4111
|
+
stableId
|
|
4112
|
+
});
|
|
4113
|
+
}
|
|
4114
|
+
//#endregion
|
|
4115
|
+
//#region atomic/atRule/property.ts
|
|
4116
|
+
const PROPERTY_AT_RULE = "property";
|
|
4117
|
+
const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
|
|
4118
|
+
function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
4119
|
+
name = formatPropertyName(format, id, { name });
|
|
4120
|
+
return {
|
|
4121
|
+
css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
|
|
4122
|
+
name
|
|
4123
|
+
};
|
|
4124
|
+
}
|
|
4125
|
+
//#endregion
|
|
4126
|
+
//#region css/property.ts
|
|
4127
|
+
const idCounter = createIdCounter("property");
|
|
4128
|
+
function createProperty(nameOrDescriptors, descriptorsOrStableId) {
|
|
4129
|
+
const descriptors = typeof nameOrDescriptors === "string" ? descriptorsOrStableId : nameOrDescriptors;
|
|
4130
|
+
return createNamedAtRuleRef({
|
|
4131
|
+
idCounter,
|
|
4132
|
+
stableId: typeof nameOrDescriptors === "string" ? {
|
|
4133
|
+
name: nameOrDescriptors,
|
|
4134
|
+
id: nameOrDescriptors
|
|
4135
|
+
} : descriptorsOrStableId,
|
|
4136
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
4137
|
+
value: descriptors,
|
|
4138
|
+
buildCss: buildPropertyCss
|
|
4139
|
+
});
|
|
4140
|
+
}
|
|
4141
|
+
//#endregion
|
|
4142
|
+
//#region runtime/env.ts
|
|
4143
|
+
const IS_SERVER_RUNTIME = typeof window === "undefined";
|
|
4144
|
+
function isServerRSC() {
|
|
4145
|
+
return RUNTIME_CONFIG.isRSC && IS_SERVER_RUNTIME;
|
|
4146
|
+
}
|
|
3754
4147
|
//#endregion
|
|
3755
4148
|
//#region runtime/sheet/insert.ts
|
|
3756
4149
|
function insertStylePropRuntimeItems(sheet, items) {
|
|
@@ -3787,7 +4180,7 @@ function createElementMarkerClassName(debug) {
|
|
|
3787
4180
|
return marker.className;
|
|
3788
4181
|
}
|
|
3789
4182
|
function insertElementMarkerSheetRule(rule, documentOverride) {
|
|
3790
|
-
const document = documentOverride
|
|
4183
|
+
const document = getRuntimeDocument(documentOverride);
|
|
3791
4184
|
if (!document) return;
|
|
3792
4185
|
const className = getElementMarkerClassNameFromRule(rule);
|
|
3793
4186
|
if (!className) return;
|
|
@@ -3815,6 +4208,7 @@ function getElementMarkerClassNameFromRule(rule) {
|
|
|
3815
4208
|
function getElementMarkerSheet(document) {
|
|
3816
4209
|
const current = ELEMENT_MARKER_SHEET.sheet;
|
|
3817
4210
|
if (current?.document === document) return current;
|
|
4211
|
+
current?.sheet.destroy?.();
|
|
3818
4212
|
const sheet = {
|
|
3819
4213
|
document,
|
|
3820
4214
|
sheet: createDevSheet({
|
|
@@ -3827,6 +4221,10 @@ function getElementMarkerSheet(document) {
|
|
|
3827
4221
|
ELEMENT_MARKER_SHEET.sheet = sheet;
|
|
3828
4222
|
return sheet;
|
|
3829
4223
|
}
|
|
4224
|
+
onRuntimeDocumentChange(() => {
|
|
4225
|
+
ELEMENT_MARKER_SHEET.sheet?.sheet.destroy?.();
|
|
4226
|
+
ELEMENT_MARKER_SHEET.sheet = null;
|
|
4227
|
+
});
|
|
3830
4228
|
function getElementCallsite(debug) {
|
|
3831
4229
|
if (debug) return {
|
|
3832
4230
|
filePath: debug.sourceUrl,
|
|
@@ -4060,6 +4458,6 @@ function restoreStyleValue(target, name, value) {
|
|
|
4060
4458
|
else target.style.removeProperty(name);
|
|
4061
4459
|
}
|
|
4062
4460
|
//#endregion
|
|
4063
|
-
export {
|
|
4461
|
+
export { TOKEN_DEBUG as $, assertManualSelectorSyntax as A, hashString as At, mergeSlotOverrideData as B, isCombinedStyle as C, traceError as Ct, createCounterStyle as D, importantValue as Dt, fontSrc as E, weightValue as Et, FnPrefixStyle as F, LayerPlaceholder as Ft, AT_RULE_REF as G, SELECTOR_CONTAINER as H, resolveCallsite as I, classNameTransform as J, createAtRuleRef as K, transformStyle as L, FnPrefixScope as M, setBuildDebugClassName as Mt, FnPrefixSelector as N, setBuildConfig as Nt, createIdCounter as O, isStyleImportantValue as Ot, FnPrefixSlot as P, CSS_CONFIG as Pt, mergeScopeData as Q, mergeSelectorOverrideData as R, getCombinedStyleStyles as S, createThemeData as St, createFontFace as T, isStyleWeightValue as Tt, SELECTOR_MEDIA as U, mergeStyleData as V, normalizeSelectorArg as W, isClassNameValue as X, classNameValue as Y, styleTransform as Z, createMutableTokenValues as _, createSelectorData as _t, createProperty as a, getScopeTargetScope as at, mergeTokenValues as b, createSlotOverrideData as bt, createGlobalSheet as c, isScopeTargetData as ct, runtimeTokenValueResolver as d, isStyleData as dt, createStyleToken as et, createCombinedStyleFacade as f, getDebugCallsiteId as ft, addTokenValues as g, createScopeTargetData as gt, addTokenOverride as h, createScopeData as ht, getClassName as i, getChildStyleTokenName as it, normalizeManualSelectors as j, configureStyleRuntime as jt, getId as k, DEV_CONFIG as kt, createSheet as l, isSheetData as lt, getStyleTokenValues as m, isDebugData as mt, transformElement as n, getStyleTokenOverrideDebug as nt, createPositionTry as o, getScopeTargetSlotId as ot, createCombinedStyleTokenWrapper as p, getTraceCallsiteId as pt, isAtRuleRef as q, getToken as r, resetStyleTokenIdCounter as rt, createKeyframes as s, isScopeData as st, createStyleTarget as t, createStyleTokenOverride as tt, createThemeClassName as u, isSlotData as ut, finishTokenValues as v, createSelectorOverrideData as vt, createFontPaletteValues as w, traceMarker as wt, getCombinedStyleScopes as x, createStyleData as xt, mergeTokenOverrides as y, createSlotData as yt, mergeSlotData as z };
|
|
4064
4462
|
|
|
4065
|
-
//# sourceMappingURL=css-
|
|
4463
|
+
//# sourceMappingURL=css-C7tcD3IO.js.map
|