@fluentic/style 0.1.0-beta.13 → 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 +22 -0
- package/README.md +3 -2
- package/atomic/className.ts +4 -0
- package/atomic/rule.ts +15 -7
- package/atomic/token.ts +10 -1
- 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/extract/token.ts +10 -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 +87 -10
- package/compiler/transform/evaluator/tracer.ts +4 -0
- 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 +81 -29
- package/compiler/transform/extract/utils/imports.ts +8 -1
- package/compiler/transform/extract/utils/replacement.ts +17 -5
- package/compiler/transform/extract/utils/state.ts +2 -0
- package/compiler/transform/extract/utils/token.ts +107 -0
- package/compiler/transform/utils/babel.ts +1 -1
- package/compiler/utils/constants.ts +2 -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/dialect/namedTokens.ts +13 -8
- package/dist/{className-yhJCGT0F.js → className-CC5PHcXI.js} +9 -2
- package/dist/className-CC5PHcXI.js.map +1 -0
- package/dist/{combine-yuoQ_qpx.js → combine-BpOQWCtM.js} +5 -5
- package/dist/combine-BpOQWCtM.js.map +1 -0
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-BEHxZYjz.mjs → compiler-AOb_VaKQ.mjs} +626 -188
- package/dist/compiler-AOb_VaKQ.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/{config-B5nEd-TV.js → config-B70LIQhi.js} +2 -2
- package/dist/{config-B5nEd-TV.js.map → config-B70LIQhi.js.map} +1 -1
- package/dist/{config-BWGBkVrM.js → config-BF-mxuPk.js} +4 -4
- package/dist/{config-BWGBkVrM.js.map → config-BF-mxuPk.js.map} +1 -1
- package/dist/config-B_OQYZSm.js +57 -0
- package/dist/config-B_OQYZSm.js.map +1 -0
- package/dist/{css-BQRIvzwZ.js → css-C7tcD3IO.js} +615 -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-p_5ZNny_.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-DuVzUIYx.js.map → css_extra-BC1Z_hDy.js.map} +1 -1
- package/dist/{css_extra-DuVzUIYx.js → css_extra-CuzJtAR_.js} +2 -2
- package/dist/css_extra-CuzJtAR_.js.map +1 -0
- package/dist/{data-QXDBLlWs.js → data-Bw3Xod5J.js} +28 -20
- package/dist/data-Bw3Xod5J.js.map +1 -0
- package/dist/{debug-CkgcZDaX.js → debug-CVO3xx4C.js} +24 -3
- 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-DocaGP3_.js → dev-BnQXPLQB.js} +6 -7
- package/dist/{dev-DocaGP3_.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-DZjd1NuA.js → elementMarker-BrHXg161.js} +334 -54
- 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 +10 -1
- 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 +14 -5
- package/dist/entry/rsc-prod.js.map +1 -1
- package/dist/{rules-znG9bsKI.js → env-D6daex-9.js} +64 -20
- 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-BIqt1S41.js → getClassName-B3azD1TO.js} +6 -4
- package/dist/getClassName-B3azD1TO.js.map +1 -0
- package/dist/{getClassName-BB_L7U_v.js → getClassName-m5DOkMFQ.js} +4 -5
- package/dist/{getClassName-BB_L7U_v.js.map → getClassName-m5DOkMFQ.js.map} +1 -1
- package/dist/global-DeIYtcdl.js +36 -0
- package/dist/global-DeIYtcdl.js.map +1 -0
- package/dist/{css-CGMAis1n.js → globalSheet-CdgVpvCb.js} +185 -426
- package/dist/globalSheet-CdgVpvCb.js.map +1 -0
- package/dist/{debug-0iaVEC7z.js → hash-DCJkLls_.js} +168 -6
- 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-BCufpzdb.js → jsx-CvloSSpb.js} +4 -4
- package/dist/{jsx-BCufpzdb.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-vMHuD1zT.mjs → loader-fAuIjIik.mjs} +3 -3
- package/dist/{loader-vMHuD1zT.mjs.map → loader-fAuIjIik.mjs.map} +1 -1
- package/dist/{misc-9EGKYkZo.mjs → misc-CyZgGtc9.mjs} +3 -3
- package/dist/{misc-9EGKYkZo.mjs.map → misc-CyZgGtc9.mjs.map} +1 -1
- package/dist/{namedTokens-DnpyC5XT.js → namedTokens-DwgmUMBM.js} +13 -9
- package/dist/namedTokens-DwgmUMBM.js.map +1 -0
- 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-DVB7n6V-.mjs → registry-BMijh1CM.mjs} +2 -2
- package/dist/{registry-DVB7n6V-.mjs.map → registry-BMijh1CM.mjs.map} +1 -1
- package/dist/{resolveClassNameRuntime-DvH6j_4N.js → resolveClassNameRuntime-B6vKNL5y.js} +2 -2
- package/dist/{resolveClassNameRuntime-DvH6j_4N.js.map → resolveClassNameRuntime-B6vKNL5y.js.map} +1 -1
- package/dist/server.js +87 -17
- package/dist/server.js.map +1 -1
- package/dist/{shared-O-5Fcsxa.mjs → shared-BfASWZo1.mjs} +4 -4
- package/dist/{shared-O-5Fcsxa.mjs.map → shared-BfASWZo1.mjs.map} +1 -1
- package/dist/{shared-DaEDCb8I.cjs → shared-DY0kuBcN.cjs} +622 -184
- 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-Bqe8Y-4_.js → sheet-C6ymGhKV.js} +23 -2
- package/dist/sheet-C6ymGhKV.js.map +1 -0
- package/dist/sheet-D4f9KYPf.js +1 -0
- package/dist/{sidecar-DiYLwXbk.mjs → sidecar-cCzTDkzg.mjs} +3 -3
- package/dist/{sidecar-DiYLwXbk.mjs.map → sidecar-cCzTDkzg.mjs.map} +1 -1
- package/dist/{style-CtXEZqgx.js → style-a6ccye6R.js} +12 -13
- 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-DJyXPJ9q.js → styleStore-D1IEmq1v.js} +439 -63
- package/dist/styleStore-D1IEmq1v.js.map +1 -0
- package/dist/{token-DyLO6Hnf.js → token-Ci73NE6h.js} +5 -33
- package/dist/token-Ci73NE6h.js.map +1 -0
- package/dist/{trace-C1_6fM21.js → trace-DDsvwdF0.js} +3 -3
- package/dist/{trace-C1_6fM21.js.map → trace-DDsvwdF0.js.map} +1 -1
- package/dist/{trace-Bsh-Kkg_.js → trace-uHVvnYiw.js} +2 -2
- package/dist/{trace-Bsh-Kkg_.js.map → trace-uHVvnYiw.js.map} +1 -1
- package/dist/{transform-8TIMiF5A.js → transform-BkxIouPX.js} +2 -2
- package/dist/{transform-8TIMiF5A.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/merge/utils.d.ts +6 -1
- package/dist/types/builder/data/state.d.ts +17 -2
- package/dist/types/builder/extract/token.d.ts +6 -1
- 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/style_fns.d.ts +1 -1
- package/dist/types/builder/types/alias.d.ts +2 -2
- package/dist/types/builder/utils.d.ts +1 -1
- package/dist/types/compiler/extract/types.d.ts +7 -1
- package/dist/types/compiler/transform/evaluator/evaluator.d.ts +18 -1
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +2 -0
- package/dist/types/compiler/transform/extract/utils/replacement.d.ts +2 -0
- package/dist/types/compiler/transform/extract/utils/state.d.ts +1 -0
- package/dist/types/compiler/transform/extract/utils/token.d.ts +3 -0
- package/dist/types/compiler/transform/utils/selector.d.ts +1 -1
- package/dist/types/compiler/utils/constants.d.ts +2 -0
- package/dist/types/compiler/utils/import_source.d.ts +8 -2
- 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/plugin/bundler/farm/plugin.d.ts +8 -2
- package/dist/types/presets/tailwind/selectors.d.ts +24 -24
- package/dist/types/presets/tailwind/theme.d.ts +361 -361
- package/dist/types/runtime/core/cache/itemWithResolver.d.ts +1 -1
- package/dist/types/runtime/core/cache/stateItem.d.ts +8 -2
- 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/runtime/types.d.ts +4 -1
- package/dist/types/selector/presets/default.d.ts +28 -28
- package/dist/types/selector/presets/minimal.d.ts +10 -10
- package/dist/types/selector/selector.d.ts +15 -2
- 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 +95 -95
- package/dist/{utils-BBN9msTv.mjs → utils-BO6Ix8t5.mjs} +4 -4
- package/dist/{utils-BBN9msTv.mjs.map → utils-BO6Ix8t5.mjs.map} +1 -1
- package/dist/{utils-DoKJnvxk.js → utils-CB70kIh6.js} +3 -3
- package/dist/{utils-DoKJnvxk.js.map → utils-CB70kIh6.js.map} +1 -1
- package/dist/{utils-Bjh9pO87.mjs → utils-EG9gh2g3.mjs} +3 -3
- package/dist/{utils-Bjh9pO87.mjs.map → utils-EG9gh2g3.mjs.map} +1 -1
- package/dist/{utils-10MTZOuB.js → utils-sG7IWYP6.js} +1091 -643
- package/dist/utils-sG7IWYP6.js.map +1 -0
- package/dist/utils.js +3 -3
- package/dist/{value-Dg6ALjjj.js → value-B-ThmbY-.js} +47 -6
- package/dist/value-B-ThmbY-.js.map +1 -0
- package/dist/{webpack-C1j49Psk.mjs → webpack-WXAJ3IYn.mjs} +5 -5
- package/dist/{webpack-C1j49Psk.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 +5 -4
- package/plugin/nextjs/loader.ts +18 -2
- package/runtime/core/elementMarker.ts +9 -3
- package/runtime/extract/getClassName.ts +1 -1
- 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/style/token.ts +2 -0
- package/utils/trace.ts +1 -0
- package/dist/className-yhJCGT0F.js.map +0 -1
- package/dist/combine-yuoQ_qpx.js.map +0 -1
- package/dist/compiler-BEHxZYjz.mjs.map +0 -1
- package/dist/config-Bqe8Y-4_.js.map +0 -1
- package/dist/config-DggQEE-4.js +0 -36
- package/dist/config-DggQEE-4.js.map +0 -1
- package/dist/createTransformElement-B2jSnugo.js +0 -34
- package/dist/createTransformElement-B2jSnugo.js.map +0 -1
- package/dist/css-BQRIvzwZ.js.map +0 -1
- package/dist/css-CGMAis1n.js.map +0 -1
- package/dist/css-D7eTqvMH.js +0 -57
- package/dist/css-D7eTqvMH.js.map +0 -1
- package/dist/css-p_5ZNny_.js.map +0 -1
- package/dist/data-QXDBLlWs.js.map +0 -1
- package/dist/debug-0iaVEC7z.js.map +0 -1
- package/dist/debug-CkgcZDaX.js.map +0 -1
- package/dist/elementMarker-DZjd1NuA.js.map +0 -1
- package/dist/env-DJyXPJ9q.js.map +0 -1
- package/dist/getClassName-BIqt1S41.js.map +0 -1
- package/dist/global-CBQGormL.js +0 -14
- package/dist/global-CBQGormL.js.map +0 -1
- package/dist/hash-Cr-LCWDt.js +0 -166
- package/dist/hash-Cr-LCWDt.js.map +0 -1
- package/dist/jsx_runtime-Bu_A8mr4.js +0 -12
- package/dist/jsx_runtime-Bu_A8mr4.js.map +0 -1
- package/dist/namedTokens-DnpyC5XT.js.map +0 -1
- package/dist/rules-znG9bsKI.js.map +0 -1
- package/dist/shared-DaEDCb8I.cjs.map +0 -1
- package/dist/sheet-SlZRjOmw.js +0 -7
- package/dist/sheet-SlZRjOmw.js.map +0 -1
- package/dist/style-CtXEZqgx.js.map +0 -1
- package/dist/styleStore-BImBZdt6.js +0 -57
- package/dist/styleStore-BImBZdt6.js.map +0 -1
- package/dist/styleStore-CBan0gHQ.js +0 -60
- package/dist/styleStore-CBan0gHQ.js.map +0 -1
- package/dist/token-DyLO6Hnf.js.map +0 -1
- package/dist/utils-10MTZOuB.js.map +0 -1
- package/dist/value-Dg6ALjjj.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as TOKEN_ID, B as BUILDER_STATE, C as getCssVar, 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") : "");
|
|
@@ -918,12 +945,14 @@ function createStyleTokenOverride(token, value, debug) {
|
|
|
918
945
|
[TOKEN_ID]: getStyleTokenId(token),
|
|
919
946
|
[TOKEN_OVERRIDE]: true,
|
|
920
947
|
[TOKEN_NAME]: getStyleTokenName(token),
|
|
948
|
+
[TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
|
|
921
949
|
value: value.value,
|
|
922
950
|
ref: value
|
|
923
951
|
} : {
|
|
924
952
|
[TOKEN_ID]: getStyleTokenId(token),
|
|
925
953
|
[TOKEN_OVERRIDE]: true,
|
|
926
954
|
[TOKEN_NAME]: getStyleTokenName(token),
|
|
955
|
+
[TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
|
|
927
956
|
value,
|
|
928
957
|
ref: null
|
|
929
958
|
};
|
|
@@ -1007,8 +1036,8 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1007
1036
|
value = scopeItem.value;
|
|
1008
1037
|
weight = scopeItem.weight;
|
|
1009
1038
|
important = scopeItem.important;
|
|
1010
|
-
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
|
|
1011
|
-
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);
|
|
1012
1041
|
scopeItem.dedupe = dedupe;
|
|
1013
1042
|
scopeItem.className = className;
|
|
1014
1043
|
scopeItem.callsite = itemCallsite;
|
|
@@ -1047,6 +1076,7 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1047
1076
|
property: overrideItem.property,
|
|
1048
1077
|
weight: overrideItem.weight,
|
|
1049
1078
|
important: overrideItem.important,
|
|
1079
|
+
importantNative: overrideItem.importantNative,
|
|
1050
1080
|
value: overrideItem.value,
|
|
1051
1081
|
transformClassName: overrideItem.transformClassName,
|
|
1052
1082
|
token: overrideItem.token,
|
|
@@ -1060,8 +1090,8 @@ function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRu
|
|
|
1060
1090
|
value = scopeItem.value;
|
|
1061
1091
|
weight = scopeItem.weight;
|
|
1062
1092
|
important = scopeItem.important;
|
|
1063
|
-
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule);
|
|
1064
|
-
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);
|
|
1065
1095
|
scopeItem.dedupe = dedupe;
|
|
1066
1096
|
scopeItem.className = className;
|
|
1067
1097
|
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
@@ -1128,6 +1158,8 @@ function getTokenLookupKey(tokenId) {
|
|
|
1128
1158
|
}
|
|
1129
1159
|
const formatTokenName = createNameFormatter(["name"]);
|
|
1130
1160
|
function getTokenVarName(token, format) {
|
|
1161
|
+
const explicitName = getStyleTokenVarName(token);
|
|
1162
|
+
if (explicitName) return explicitName;
|
|
1131
1163
|
const id = getStyleTokenId(token);
|
|
1132
1164
|
const debugName = getStyleTokenName(token);
|
|
1133
1165
|
return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: debugName });
|
|
@@ -1248,6 +1280,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1248
1280
|
let value;
|
|
1249
1281
|
let weight;
|
|
1250
1282
|
let important;
|
|
1283
|
+
let importantNative;
|
|
1251
1284
|
let itemCallsite;
|
|
1252
1285
|
let className;
|
|
1253
1286
|
let dedupe;
|
|
@@ -1289,7 +1322,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1289
1322
|
}
|
|
1290
1323
|
} else for (const property in style) {
|
|
1291
1324
|
valueRaw = style[property];
|
|
1292
|
-
[valueRaw, weight, important] = unwrapAuthoredStyleValue(valueRaw);
|
|
1325
|
+
[valueRaw, weight, important, importantNative] = unwrapAuthoredStyleValue(valueRaw);
|
|
1293
1326
|
const sourceType = source[BUILDER_TYPE];
|
|
1294
1327
|
checkImportantUsage(valueRaw, important, sourceType === 9 || sourceType === 8);
|
|
1295
1328
|
transformClassName = null;
|
|
@@ -1312,6 +1345,7 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1312
1345
|
property,
|
|
1313
1346
|
weight,
|
|
1314
1347
|
important,
|
|
1348
|
+
importantNative,
|
|
1315
1349
|
value,
|
|
1316
1350
|
transformClassName,
|
|
1317
1351
|
variable: ref ? [3, ref] : variableName && token ? [
|
|
@@ -1374,8 +1408,8 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1374
1408
|
value = runtimeItem.value;
|
|
1375
1409
|
weight = runtimeItem.weight;
|
|
1376
1410
|
important = runtimeItem.important;
|
|
1377
|
-
dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule);
|
|
1378
|
-
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);
|
|
1379
1413
|
runtimeItem.dedupe = dedupe;
|
|
1380
1414
|
runtimeItem.className = className;
|
|
1381
1415
|
lookupIndex = lookup[dedupe];
|
|
@@ -1387,9 +1421,11 @@ function mergeBuilderData(create, callsite, source, style, debug, selector, atRu
|
|
|
1387
1421
|
function unwrapAuthoredStyleValue(value) {
|
|
1388
1422
|
let weight = null;
|
|
1389
1423
|
let important = false;
|
|
1424
|
+
let native = false;
|
|
1390
1425
|
while (true) {
|
|
1391
1426
|
if (isStyleImportantValue(value)) {
|
|
1392
1427
|
important = true;
|
|
1428
|
+
native ||= value.native === true;
|
|
1393
1429
|
value = value.value;
|
|
1394
1430
|
continue;
|
|
1395
1431
|
}
|
|
@@ -1403,7 +1439,8 @@ function unwrapAuthoredStyleValue(value) {
|
|
|
1403
1439
|
return [
|
|
1404
1440
|
value,
|
|
1405
1441
|
weight,
|
|
1406
|
-
important
|
|
1442
|
+
important,
|
|
1443
|
+
native
|
|
1407
1444
|
];
|
|
1408
1445
|
}
|
|
1409
1446
|
function checkImportantUsage(value, important, isSheet) {
|
|
@@ -1538,9 +1575,9 @@ function assertManualSelectorSyntax(selector) {
|
|
|
1538
1575
|
if (ampersandIndex === 0 && ampersandSelector && /^\s/.test(ampersandSelector)) throw new Error("selector cannot have whitespace after \"&\"; omit \"&\" for descendant selectors");
|
|
1539
1576
|
}
|
|
1540
1577
|
function setSheetSelectorOptions(selector, options) {
|
|
1541
|
-
if (options.
|
|
1578
|
+
if (options.specificity === void 0 && options.layer === void 0) return selector;
|
|
1542
1579
|
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
1543
|
-
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);
|
|
1544
1581
|
return Array.isArray(selector) ? [weighted, selector[1]] : weighted;
|
|
1545
1582
|
}
|
|
1546
1583
|
function normalizeManualSelector(selector, assertManualSelector) {
|
|
@@ -1552,6 +1589,13 @@ function normalizeManualSelector(selector, assertManualSelector) {
|
|
|
1552
1589
|
}
|
|
1553
1590
|
return [SHEET_SELECTOR_ANCHOR + (value.startsWith("&") ? value.slice(1) : " " + value)];
|
|
1554
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
|
+
}
|
|
1555
1599
|
//#endregion
|
|
1556
1600
|
//#region atomic/layer/layer.ts
|
|
1557
1601
|
function compareLayerPriority(p1, p2) {
|
|
@@ -2184,152 +2228,117 @@ function createFontPaletteValues(descriptors, stableId) {
|
|
|
2184
2228
|
});
|
|
2185
2229
|
}
|
|
2186
2230
|
//#endregion
|
|
2187
|
-
//#region
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
|
|
2191
|
-
name = formatKeyFramesName(format, id, { name });
|
|
2192
|
-
let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
|
|
2193
|
-
for (const selector in frames) {
|
|
2194
|
-
const frame = frames[selector];
|
|
2195
|
-
if (!frame) continue;
|
|
2196
|
-
css += selector + "{";
|
|
2197
|
-
css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
|
|
2198
|
-
css += "}";
|
|
2199
|
-
}
|
|
2200
|
-
css += "}";
|
|
2201
|
-
return {
|
|
2202
|
-
name,
|
|
2203
|
-
css
|
|
2204
|
-
};
|
|
2231
|
+
//#region sheet/utils/layer.ts
|
|
2232
|
+
function createSheetLayerState() {
|
|
2233
|
+
return createLayerPool(getStyleLayerName());
|
|
2205
2234
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
const idCounter$2 = createIdCounter("keyframes");
|
|
2209
|
-
function createKeyframes(frames, stableId) {
|
|
2210
|
-
return createNamedAtRuleRef({
|
|
2211
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
2212
|
-
buildCss: buildKeyframesCss,
|
|
2213
|
-
value: frames,
|
|
2214
|
-
idCounter: idCounter$2,
|
|
2215
|
-
stableId
|
|
2216
|
-
});
|
|
2235
|
+
function getSheetRulePriority(priority) {
|
|
2236
|
+
return priority ?? LayerDefaultPriority;
|
|
2217
2237
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
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;
|
|
2229
2249
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
const idCounter$1 = createIdCounter("positionTry");
|
|
2233
|
-
function createPositionTry(descriptors, stableId) {
|
|
2234
|
-
return createNamedAtRuleRef({
|
|
2235
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
2236
|
-
buildCss: buildPositionTryCss,
|
|
2237
|
-
value: descriptors,
|
|
2238
|
-
idCounter: idCounter$1,
|
|
2239
|
-
stableId
|
|
2240
|
-
});
|
|
2250
|
+
function getStyleLayerName() {
|
|
2251
|
+
return CSS_CONFIG.layerNamespace || "css";
|
|
2241
2252
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const PROPERTY_AT_RULE = "property";
|
|
2245
|
-
const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
|
|
2246
|
-
function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2247
|
-
name = formatPropertyName(format, id, { name });
|
|
2248
|
-
return {
|
|
2249
|
-
css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
|
|
2250
|
-
name
|
|
2251
|
-
};
|
|
2253
|
+
function getSheetLayerName() {
|
|
2254
|
+
return getStyleLayerName() + ".sheet";
|
|
2252
2255
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
stableId: typeof nameOrDescriptors === "string" ? {
|
|
2261
|
-
name: nameOrDescriptors,
|
|
2262
|
-
id: nameOrDescriptors
|
|
2263
|
-
} : descriptorsOrStableId,
|
|
2264
|
-
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
2265
|
-
value: descriptors,
|
|
2266
|
-
buildCss: buildPropertyCss
|
|
2267
|
-
});
|
|
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
|
+
])];
|
|
2268
2263
|
}
|
|
2269
2264
|
//#endregion
|
|
2270
|
-
//#region
|
|
2271
|
-
function
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
if (
|
|
2280
|
-
return
|
|
2281
|
-
}
|
|
2282
|
-
function
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
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);
|
|
2292
2300
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
function addSheetTokenOverride(data, item) {
|
|
2311
|
-
const state = data[BUILDER_STATE];
|
|
2312
|
-
const lookup = state.lookup ??= {};
|
|
2313
|
-
const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
|
|
2314
|
-
const lookupIndex = lookup[lookupKey];
|
|
2315
|
-
if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
|
|
2316
|
-
else lookup[lookupKey] = state.items.push(item) - 1;
|
|
2317
|
-
}
|
|
2318
|
-
function getSelectorItemStyleData(data) {
|
|
2319
|
-
return {
|
|
2320
|
-
[BUILDER_TYPE]: 1,
|
|
2321
|
-
[BUILDER_STATE]: data[BUILDER_STATE],
|
|
2322
|
-
[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) ?? []);
|
|
2323
2318
|
};
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
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);
|
|
2333
2342
|
}
|
|
2334
2343
|
//#endregion
|
|
2335
2344
|
//#region sheet/utils/dom.ts
|
|
@@ -2370,38 +2379,166 @@ function getFirstCssSheetTag(head) {
|
|
|
2370
2379
|
return null;
|
|
2371
2380
|
}
|
|
2372
2381
|
//#endregion
|
|
2373
|
-
//#region sheet/
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
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
|
+
};
|
|
2405
2542
|
}
|
|
2406
2543
|
//#endregion
|
|
2407
2544
|
//#region sheet/utils/noop.ts
|
|
@@ -2850,7 +2987,7 @@ function ensureGroup(groups, priority, layer) {
|
|
|
2850
2987
|
return group;
|
|
2851
2988
|
}
|
|
2852
2989
|
function getLayerRank(layer) {
|
|
2853
|
-
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;
|
|
2854
2991
|
}
|
|
2855
2992
|
function createGroupTag(document, groups, group, options) {
|
|
2856
2993
|
const previous = getPreviousTag(groups, group, options.previous);
|
|
@@ -2893,6 +3030,9 @@ function getPriorityKey(priority) {
|
|
|
2893
3030
|
//#region sheet/dev/index.ts
|
|
2894
3031
|
const DEV_SHEETS = globalData("sheet.dev.sheets", () => /* @__PURE__ */ new Set());
|
|
2895
3032
|
function createDevSheet(options = {}) {
|
|
3033
|
+
return createOrderedSheet(createDevSheetBase, options, true);
|
|
3034
|
+
}
|
|
3035
|
+
function createDevSheetBase(options = {}) {
|
|
2896
3036
|
let activeMode = DEV_CONFIG.stylePriorityMode;
|
|
2897
3037
|
let active = createDevSheetForMode(activeMode, options);
|
|
2898
3038
|
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
@@ -2912,6 +3052,15 @@ function createDevSheet(options = {}) {
|
|
|
2912
3052
|
rules.push(rule);
|
|
2913
3053
|
active.insert(rule);
|
|
2914
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
|
+
},
|
|
2915
3064
|
flush() {
|
|
2916
3065
|
ensureActiveMode();
|
|
2917
3066
|
active.flush();
|
|
@@ -2931,7 +3080,11 @@ function createDevSheet(options = {}) {
|
|
|
2931
3080
|
removeDevSheetTags(options.document, options.tagName);
|
|
2932
3081
|
active = createDevSheetForMode(activeMode, options);
|
|
2933
3082
|
active.updateLayers(activeLayers);
|
|
2934
|
-
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
|
+
}
|
|
2935
3088
|
active.flush();
|
|
2936
3089
|
}
|
|
2937
3090
|
}
|
|
@@ -2957,14 +3110,22 @@ function removeDevSheetTags(documentOverride, tagName) {
|
|
|
2957
3110
|
pruneDevSourcemapTags();
|
|
2958
3111
|
}
|
|
2959
3112
|
function matchesDevSheetTag(sheetName, tagName) {
|
|
2960
|
-
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
|
+
}
|
|
2961
3118
|
return sheetName === "layers" || sheetName === "rules" || sheetName.startsWith("rules ");
|
|
2962
3119
|
}
|
|
2963
3120
|
//#endregion
|
|
2964
3121
|
//#region sheet/prod.ts
|
|
2965
3122
|
function createProdSheet(options = {}) {
|
|
3123
|
+
return createOrderedSheet(createProdSheetBase, options, false);
|
|
3124
|
+
}
|
|
3125
|
+
function createProdSheetBase(options = {}) {
|
|
2966
3126
|
const document = resolveDocument(options.document);
|
|
2967
3127
|
if (!document) return createNoopSheet();
|
|
3128
|
+
const tagPrefix = options.tagName ? options.tagName + " " : "";
|
|
2968
3129
|
const inserted = /* @__PURE__ */ new Set();
|
|
2969
3130
|
const layerState = createSheetLayerState();
|
|
2970
3131
|
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
@@ -2979,7 +3140,7 @@ function createProdSheet(options = {}) {
|
|
|
2979
3140
|
const next = getLayerOrderCss(layers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2980
3141
|
if (next === layerText) return;
|
|
2981
3142
|
layerText = next;
|
|
2982
|
-
layerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3143
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
2983
3144
|
layerTag.textContent = next;
|
|
2984
3145
|
},
|
|
2985
3146
|
insert(rule) {
|
|
@@ -2994,27 +3155,32 @@ function createProdSheet(options = {}) {
|
|
|
2994
3155
|
const nextLayerText = getLayerOrderCss(activeLayers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2995
3156
|
if (nextLayerText !== layerText) {
|
|
2996
3157
|
layerText = nextLayerText;
|
|
2997
|
-
layerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3158
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
2998
3159
|
layerTag.textContent = nextLayerText;
|
|
2999
3160
|
}
|
|
3000
3161
|
const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
|
|
3001
3162
|
const key = typeof rule === "string" ? css : ruleKey;
|
|
3002
3163
|
if (key && inserted.has(key)) return;
|
|
3003
3164
|
if (key) inserted.add(key);
|
|
3004
|
-
const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce);
|
|
3165
|
+
const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3005
3166
|
layerTag = activeLayerTag;
|
|
3006
3167
|
if (!ruleTag) {
|
|
3007
|
-
ruleTag = createStyleTag(document, "rules", options.nonce);
|
|
3168
|
+
ruleTag = createStyleTag(document, tagPrefix + "rules", options.nonce);
|
|
3008
3169
|
insertStyleTagAfter(document, ruleTag, activeLayerTag);
|
|
3009
3170
|
}
|
|
3010
3171
|
insertRule(ruleTag, css);
|
|
3011
3172
|
},
|
|
3012
|
-
flush() {}
|
|
3173
|
+
flush() {},
|
|
3174
|
+
destroy() {
|
|
3175
|
+
layerTag?.parentNode?.removeChild(layerTag);
|
|
3176
|
+
ruleTag?.parentNode?.removeChild(ruleTag);
|
|
3177
|
+
inserted.clear();
|
|
3178
|
+
}
|
|
3013
3179
|
};
|
|
3014
3180
|
}
|
|
3015
|
-
function ensureLayerTag(document, tag, nonce) {
|
|
3181
|
+
function ensureLayerTag(document, tag, nonce, prefix = "") {
|
|
3016
3182
|
if (tag) return tag;
|
|
3017
|
-
const next = createStyleTag(document, "layers", nonce);
|
|
3183
|
+
const next = createStyleTag(document, prefix + "layers", nonce);
|
|
3018
3184
|
insertStyleTagAfter(document, next, null);
|
|
3019
3185
|
return next;
|
|
3020
3186
|
}
|
|
@@ -3032,10 +3198,24 @@ function createStyleSheet(options = {}) {
|
|
|
3032
3198
|
return options.dev ?? DEV_CONFIG.isDev ? createDevSheet(options) : createProdSheet(options);
|
|
3033
3199
|
}
|
|
3034
3200
|
//#endregion
|
|
3035
|
-
//#region runtime/sheet/
|
|
3201
|
+
//#region runtime/sheet/document.ts
|
|
3036
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
|
|
3037
3217
|
function getGlobalSheet() {
|
|
3038
|
-
return
|
|
3218
|
+
return getDocumentSheet(createStyleSheet);
|
|
3039
3219
|
}
|
|
3040
3220
|
//#endregion
|
|
3041
3221
|
//#region runtime/core/combinedStyle.ts
|
|
@@ -3599,10 +3779,10 @@ function buildAtomicRule(className, property, value, important, selector, parent
|
|
|
3599
3779
|
const cssProp = getCssPropertyName(property);
|
|
3600
3780
|
const cssValue = getCssPropertyValue(property, value) + (important ? " !important" : "");
|
|
3601
3781
|
const escapedClass = escapeCssIdent(className);
|
|
3602
|
-
const
|
|
3603
|
-
const classSelector =
|
|
3782
|
+
const specificity = hasSheetSelectorAnchor(selector) ? getSheetSelectorSpecificity(selector) ?? 1 : 1;
|
|
3783
|
+
const classSelector = specificity === 0 ? `:where(.${escapedClass})` : Array(specificity).fill("." + escapedClass).join("");
|
|
3604
3784
|
const itemSelector = selector ? getSelectorText$1(selector) : "";
|
|
3605
|
-
let selectorStr = classSelector + itemSelector;
|
|
3785
|
+
let selectorStr = hasGlobalSheetSelectorAnchor(selector) ? itemSelector : classSelector + itemSelector;
|
|
3606
3786
|
if (parentSelector) {
|
|
3607
3787
|
const parentWhere = `:where(${"." + escapeCssIdent(getScopeClassName(className, scopeClassNameFormat)) + getSelectorText$1(parentSelector)})`;
|
|
3608
3788
|
selectorStr = classSelector + parentWhere + itemSelector + "," + parentWhere + " " + selectorStr;
|
|
@@ -3659,6 +3839,8 @@ function createRuntimeSheetRules(item, sheetOptions = null) {
|
|
|
3659
3839
|
dedupe: runtimeItem.dedupe,
|
|
3660
3840
|
priority: layerPriority,
|
|
3661
3841
|
important: runtimeItem.important,
|
|
3842
|
+
importantNative: runtimeItem.importantNative,
|
|
3843
|
+
sheet: !!sheetOptions,
|
|
3662
3844
|
layer: getRuntimeRuleLayer(sheetOptions),
|
|
3663
3845
|
css: ruleCss,
|
|
3664
3846
|
callsite: runtimeItem.callsite,
|
|
@@ -3677,7 +3859,7 @@ function createRuntimeSheetRules(item, sheetOptions = null) {
|
|
|
3677
3859
|
}
|
|
3678
3860
|
function getRuntimeRuleLayer(sheetOptions) {
|
|
3679
3861
|
if (!sheetOptions) return "style";
|
|
3680
|
-
return resolveSheetLayerOption(sheetOptions.layer ??
|
|
3862
|
+
return resolveSheetLayerOption(sheetOptions.layer ?? false, CSS_CONFIG.layerNamespace || "css");
|
|
3681
3863
|
}
|
|
3682
3864
|
const formatThemeName = createNameFormatter(["name"]);
|
|
3683
3865
|
function createThemeClassName(name, id, themeNameFormat) {
|
|
@@ -3730,6 +3912,11 @@ function createThemeRule(theme) {
|
|
|
3730
3912
|
}
|
|
3731
3913
|
//#endregion
|
|
3732
3914
|
//#region runtime/sheet/rules.ts
|
|
3915
|
+
function walkStylePropSheetRules(styleProp, onRule, onTheme) {
|
|
3916
|
+
walkStyleProp(styleProp, (item) => {
|
|
3917
|
+
walkStylePropItemSheetRules(item, onRule, onTheme);
|
|
3918
|
+
});
|
|
3919
|
+
}
|
|
3733
3920
|
function walkStylePropItemsSheetRules(items, onRule, onTheme) {
|
|
3734
3921
|
for (let i = 0, len = items.length; i < len; i++) walkStylePropItemSheetRules(items[i], onRule, onTheme);
|
|
3735
3922
|
}
|
|
@@ -3747,6 +3934,216 @@ function walkStylePropItemSheetRules(item, onRule, onTheme) {
|
|
|
3747
3934
|
for (let j = 0, len = rules.length; j < len; j++) onRule(rules[j]);
|
|
3748
3935
|
}
|
|
3749
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
|
+
}
|
|
3750
4147
|
//#endregion
|
|
3751
4148
|
//#region runtime/sheet/insert.ts
|
|
3752
4149
|
function insertStylePropRuntimeItems(sheet, items) {
|
|
@@ -3783,7 +4180,7 @@ function createElementMarkerClassName(debug) {
|
|
|
3783
4180
|
return marker.className;
|
|
3784
4181
|
}
|
|
3785
4182
|
function insertElementMarkerSheetRule(rule, documentOverride) {
|
|
3786
|
-
const document = documentOverride
|
|
4183
|
+
const document = getRuntimeDocument(documentOverride);
|
|
3787
4184
|
if (!document) return;
|
|
3788
4185
|
const className = getElementMarkerClassNameFromRule(rule);
|
|
3789
4186
|
if (!className) return;
|
|
@@ -3811,6 +4208,7 @@ function getElementMarkerClassNameFromRule(rule) {
|
|
|
3811
4208
|
function getElementMarkerSheet(document) {
|
|
3812
4209
|
const current = ELEMENT_MARKER_SHEET.sheet;
|
|
3813
4210
|
if (current?.document === document) return current;
|
|
4211
|
+
current?.sheet.destroy?.();
|
|
3814
4212
|
const sheet = {
|
|
3815
4213
|
document,
|
|
3816
4214
|
sheet: createDevSheet({
|
|
@@ -3823,6 +4221,10 @@ function getElementMarkerSheet(document) {
|
|
|
3823
4221
|
ELEMENT_MARKER_SHEET.sheet = sheet;
|
|
3824
4222
|
return sheet;
|
|
3825
4223
|
}
|
|
4224
|
+
onRuntimeDocumentChange(() => {
|
|
4225
|
+
ELEMENT_MARKER_SHEET.sheet?.sheet.destroy?.();
|
|
4226
|
+
ELEMENT_MARKER_SHEET.sheet = null;
|
|
4227
|
+
});
|
|
3826
4228
|
function getElementCallsite(debug) {
|
|
3827
4229
|
if (debug) return {
|
|
3828
4230
|
filePath: debug.sourceUrl,
|
|
@@ -4056,6 +4458,6 @@ function restoreStyleValue(target, name, value) {
|
|
|
4056
4458
|
else target.style.removeProperty(name);
|
|
4057
4459
|
}
|
|
4058
4460
|
//#endregion
|
|
4059
|
-
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 };
|
|
4060
4462
|
|
|
4061
|
-
//# sourceMappingURL=css-
|
|
4463
|
+
//# sourceMappingURL=css-C7tcD3IO.js.map
|