@fluentic/style 0.1.0-beta.2 → 0.1.0-beta.20
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 +228 -16
- package/README.md +182 -49
- package/atomic/className.ts +33 -12
- package/atomic/debug/className/className.ts +10 -15
- package/atomic/element.ts +2 -2
- package/atomic/layer/layer.ts +7 -3
- package/atomic/rule.ts +20 -6
- package/atomic/scope.ts +19 -0
- package/atomic/theme.ts +41 -2
- package/atomic/token.ts +13 -3
- package/atomic/utils/{css.ts → cssIdent.ts} +0 -20
- package/atomic/utils/cssVar.ts +19 -0
- package/atomic/utils/debug.ts +1 -1
- package/atomic/utils/hash.ts +1 -65
- package/atomic/utils/selector.ts +40 -1
- package/atomic/utils/types.ts +4 -2
- package/builder/classname/class_name_builder.ts +68 -24
- package/builder/classname/fns.ts +2 -2
- package/builder/classname/types.ts +7 -0
- package/builder/data/const.ts +10 -1
- package/builder/data/create.ts +46 -0
- package/builder/data/data.ts +26 -1
- package/builder/data/index.ts +0 -1
- package/builder/data/is.ts +23 -0
- package/builder/data/merge/scope.ts +27 -19
- package/builder/data/merge/style.ts +115 -46
- package/builder/data/state.ts +17 -2
- package/builder/extract/index.ts +1 -0
- package/builder/extract/sheet.ts +30 -0
- package/builder/extract/token.ts +40 -14
- package/builder/extract/utils.ts +2 -0
- package/builder/extract/withTokens.ts +2 -1
- package/builder/selector_override.noop.ts +11 -0
- package/builder/selector_override.ts +31 -0
- package/builder/selector_override_core.ts +99 -0
- package/builder/style_builder.ts +127 -3
- package/builder/style_data.ts +25 -0
- package/builder/style_fns.ts +24 -24
- package/builder/token/data.ts +30 -0
- package/builder/token/index.ts +3 -0
- package/builder/token/name.ts +54 -0
- package/builder/token/symbols.ts +6 -0
- package/builder/types/alias.ts +34 -6
- package/builder/types/fns.ts +13 -5
- package/builder/types/types.ts +32 -2
- package/builder/utils.ts +1 -0
- package/compiler/compiler/cache_identity.ts +115 -0
- package/compiler/compiler/compiler.ts +123 -18
- package/compiler/compiler/constants.ts +6 -0
- package/compiler/compiler/index.ts +1 -0
- package/compiler/compiler/persistent_cache.ts +310 -0
- package/compiler/compiler/types.ts +16 -1
- package/compiler/cssProp.ts +21 -0
- package/compiler/extract/collector.ts +2 -2
- package/compiler/extract/extract.ts +24 -45
- package/compiler/extract/types.ts +6 -0
- package/compiler/index.ts +1 -0
- package/compiler/transform/cssProp/index.ts +1 -0
- package/compiler/transform/cssProp/plugin.ts +161 -0
- package/compiler/transform/debug/plugin.ts +107 -1
- package/compiler/transform/debug/transform.ts +2 -1
- package/compiler/transform/evaluator/evaluator.ts +223 -38
- package/compiler/transform/evaluator/lazy_bindings.ts +63 -0
- package/compiler/transform/evaluator/metadata_cache.ts +124 -0
- package/compiler/transform/evaluator/tracer.ts +151 -89
- package/compiler/transform/extract/chain/chain.ts +794 -84
- package/compiler/transform/extract/chain/extract_chain.ts +28 -4
- package/compiler/transform/extract/chain/types.ts +3 -1
- package/compiler/transform/extract/plugin.ts +159 -42
- package/compiler/transform/extract/transform.ts +2 -1
- package/compiler/transform/extract/utils/imports.ts +8 -1
- package/compiler/transform/extract/utils/replacement.ts +92 -5
- package/compiler/transform/extract/utils/state.ts +8 -2
- package/compiler/transform/extract/utils/theme.ts +6 -6
- package/compiler/transform/extract/utils/token.ts +107 -0
- package/compiler/transform/index.ts +1 -0
- package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
- package/compiler/transform/syntax/static_ids.ts +1 -1
- package/compiler/transform/utils/babel.ts +1 -1
- package/compiler/utils/check_diagnostics.ts +18 -0
- package/compiler/utils/constants.ts +10 -5
- package/compiler/utils/file_resolver.ts +27 -1
- package/compiler/utils/import_source.ts +17 -7
- package/compiler/utils/imports.ts +11 -1
- package/config/build.ts +9 -2
- package/config/config/check.ts +25 -0
- package/config/config/css.ts +36 -1
- package/config/config/debug.ts +24 -1
- package/config/config/dev.ts +8 -0
- package/config/configure.ts +23 -2
- package/config/document.ts +23 -0
- package/css/globalSheet.ts +66 -0
- package/css/index.ts +5 -0
- package/css/sheet.ts +173 -0
- package/css/styleTarget.ts +251 -0
- package/dev/config.ts +2 -3
- package/dev/utils.ts +3 -3
- package/dialect/namedTokens.ts +30 -8
- package/dist/adapter/preact.js +2 -0
- package/dist/adapter/react.js +2 -0
- package/dist/adapter/solid.js +2 -0
- package/dist/className-CC5PHcXI.js +311 -0
- package/dist/className-CC5PHcXI.js.map +1 -0
- package/dist/{style-DUztHzBz.js → combine-CtR6MyD4.js} +402 -733
- package/dist/combine-CtR6MyD4.js.map +1 -0
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-BXcGyZUP.mjs → compiler-oXXProzz.mjs} +3092 -850
- package/dist/compiler-oXXProzz.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/config-BK7oK4Hx.js +57 -0
- package/dist/config-BK7oK4Hx.js.map +1 -0
- package/dist/config-BWFlaJ_v.js +6 -0
- package/dist/config-BWFlaJ_v.js.map +1 -0
- package/dist/config-BsF-QRgz.js +6 -0
- package/dist/{config-DcYrUB-M.js.map → config-BsF-QRgz.js.map} +1 -1
- package/dist/{config-C1k9vUrM.js → config-DKaGtG9O.js} +9 -7
- package/dist/config-DKaGtG9O.js.map +1 -0
- package/dist/config-IFmsTOQp.js +1 -0
- package/dist/css-B-7-Do-J.js +4541 -0
- package/dist/css-B-7-Do-J.js.map +1 -0
- package/dist/{css-CohHH2tn.js → css-BmIytNon.js} +185 -14
- package/dist/css-BmIytNon.js.map +1 -0
- package/dist/css-CYnQKnPu.js +563 -0
- package/dist/css-CYnQKnPu.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/{css_extra-DQdCrYoC.js → css_extra-Br7eDCrf.js} +2 -2
- package/dist/{css_extra-9BZ_jVET.js.map → css_extra-Br7eDCrf.js.map} +1 -1
- package/dist/{css_extra-9BZ_jVET.js → css_extra-qzi_eFFf.js} +2 -2
- package/dist/{css_extra-DQdCrYoC.js.map → css_extra-qzi_eFFf.js.map} +1 -1
- package/dist/data-D6dD67li.js +786 -0
- package/dist/data-D6dD67li.js.map +1 -0
- package/dist/debug-Bo43rBKc.js +73 -0
- package/dist/debug-Bo43rBKc.js.map +1 -0
- package/dist/dev/rsc.js +138 -28
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-C2u78xuv.js → dev-_DW5n4U4.js} +9 -10
- package/dist/dev-_DW5n4U4.js.map +1 -0
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/{elementMarker-BKzZyg5V.js → elementMarker-u0d2LH8r.js} +582 -61
- package/dist/elementMarker-u0d2LH8r.js.map +1 -0
- package/dist/entry/dev/adapter/preact.js +12 -0
- package/dist/entry/dev/adapter/preact.js.map +1 -0
- package/dist/entry/dev/adapter/react.js +12 -0
- package/dist/entry/dev/adapter/react.js.map +1 -0
- package/dist/entry/dev/adapter/solid.js +12 -0
- package/dist/entry/dev/adapter/solid.js.map +1 -0
- 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 +13 -12
- package/dist/entry/prod/adapter/preact.js +12 -0
- package/dist/entry/prod/adapter/preact.js.map +1 -0
- package/dist/entry/prod/adapter/react.js +12 -0
- package/dist/entry/prod/adapter/react.js.map +1 -0
- package/dist/entry/prod/adapter/solid.js +12 -0
- package/dist/entry/prod/adapter/solid.js.map +1 -0
- package/dist/entry/prod/css.js +3 -3
- package/dist/entry/prod/extract.js +251 -3
- package/dist/entry/prod/extract.js.map +1 -0
- package/dist/entry/prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/prod/jsx-runtime.js +2 -2
- package/dist/entry/prod/runtime.js +3 -4
- package/dist/entry/prod.js +84 -1201
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/adapter/preact.js +13 -0
- package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/react.js +13 -0
- package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/solid.js +13 -0
- package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
- package/dist/entry/rsc-dev/css.js +4 -3
- package/dist/entry/rsc-dev/dev.js +135 -32
- 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 +298 -616
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/adapter/preact.js +2 -0
- package/dist/entry/rsc-prod/adapter/react.js +2 -0
- package/dist/entry/rsc-prod/adapter/solid.js +2 -0
- package/dist/entry/rsc-prod/css.js +9 -3
- package/dist/entry/rsc-prod/css.js.map +1 -0
- package/dist/entry/rsc-prod/jsx-dev-runtime.js +2 -2
- package/dist/entry/rsc-prod/jsx-runtime.js +2 -2
- package/dist/entry/rsc-prod/runtime.js +3 -4
- package/dist/entry/rsc-prod.js +251 -10
- package/dist/entry/rsc-prod.js.map +1 -0
- package/dist/{rules-Dz7Pu2K6.js → env-C8lKN1dB.js} +727 -147
- package/dist/env-C8lKN1dB.js.map +1 -0
- package/dist/{getClassName-C6690_nr.js → getClassName-BraU01Hd.js} +60 -15
- package/dist/getClassName-BraU01Hd.js.map +1 -0
- package/dist/getClassName-C35yO40s.js +548 -0
- package/dist/getClassName-C35yO40s.js.map +1 -0
- package/dist/getClassName-CfkGcBZy.js +49 -0
- package/dist/getClassName-CfkGcBZy.js.map +1 -0
- package/dist/{utils-D4YWF2K0.js → getClassName-i4oy2Up_.js} +27 -65
- package/dist/getClassName-i4oy2Up_.js.map +1 -0
- package/dist/{global-zaCE-g1C.js → global-DGcWZODV.js} +7 -8
- package/dist/global-DGcWZODV.js.map +1 -0
- package/dist/globalSheet-2ozCV1Zm.js +1091 -0
- package/dist/globalSheet-2ozCV1Zm.js.map +1 -0
- package/dist/hash-CGO13tOn.js +407 -0
- package/dist/hash-CGO13tOn.js.map +1 -0
- package/dist/index.js +10 -10
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- 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 +2 -2
- package/dist/jsx/jsx-runtime.server.js +4 -4
- package/dist/jsx/jsx-runtime.server.js.map +1 -1
- package/dist/jsx-C-v1b99-.js +39 -0
- package/dist/jsx-C-v1b99-.js.map +1 -0
- package/dist/{jsx_dev_runtime-DXlSD6kV.js → jsx_dev_runtime-Bd7FO7C1.js} +2 -3
- package/dist/{jsx_dev_runtime-DXlSD6kV.js.map → jsx_dev_runtime-Bd7FO7C1.js.map} +1 -1
- package/dist/jsx_runtime-BxumFGUy.js +13 -0
- package/dist/jsx_runtime-BxumFGUy.js.map +1 -0
- package/dist/{jsx_runtime-DPWo5qvV.js → jsx_runtime-gO4GQFcW.js} +3 -3
- package/dist/{jsx_runtime-CMdEXGNZ.js.map → jsx_runtime-gO4GQFcW.js.map} +1 -1
- package/dist/{loader-DCT1Q9yi.mjs → loader-A15L-NVK.mjs} +13 -14
- package/dist/loader-A15L-NVK.mjs.map +1 -0
- package/dist/{misc-o8pviMUi.mjs → misc-CRRQr1DT.mjs} +35 -8
- package/dist/misc-CRRQr1DT.mjs.map +1 -0
- package/dist/{namedTokens-BUa6raTb.js → namedTokens-paLD-Pdk.js} +15 -9
- package/dist/namedTokens-paLD-Pdk.js.map +1 -0
- package/dist/plugin/farm/index.mjs +5 -4
- package/dist/plugin/farm/index.mjs.map +1 -1
- package/dist/plugin/nextjs/index.mjs +153 -33
- package/dist/plugin/nextjs/index.mjs.map +1 -1
- package/dist/plugin/nextjs/loader.mjs +7 -5
- package/dist/plugin/nextjs/loader.mjs.map +1 -1
- package/dist/plugin/parcel/index.cjs +2 -0
- package/dist/plugin/parcel/index.mjs +3 -1
- package/dist/plugin/parcel/optimizer.cjs +3 -2
- package/dist/plugin/parcel/optimizer.cjs.map +1 -1
- package/dist/plugin/parcel/optimizer.mjs +3 -2
- package/dist/plugin/parcel/optimizer.mjs.map +1 -1
- 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 +3 -2
- package/dist/plugin/rspack/index.mjs.map +1 -1
- package/dist/plugin/vite/index.mjs +26 -23
- package/dist/plugin/vite/index.mjs.map +1 -1
- package/dist/plugin/webpack/index.mjs +3 -2
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +32 -8
- package/dist/presets/tailwind/index.js.map +1 -1
- package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
- package/dist/presets-DSanixJV.js.map +1 -0
- package/dist/{registry-D3x1EDJm.mjs → registry-D2C6hTdx.mjs} +2 -2
- package/dist/{registry-D3x1EDJm.mjs.map → registry-D2C6hTdx.mjs.map} +1 -1
- package/dist/resolveClassNameRuntime-Cp8_UcxF.js +63 -0
- package/dist/resolveClassNameRuntime-Cp8_UcxF.js.map +1 -0
- package/dist/scope-Dg83Az-2.js +601 -0
- package/dist/scope-Dg83Az-2.js.map +1 -0
- package/dist/selector/index.js +1 -2
- package/dist/server.js +91 -17
- package/dist/server.js.map +1 -1
- package/dist/{shared-B_gJf5uj.cjs → shared-B7Nw_dcx.cjs} +3152 -891
- package/dist/shared-B7Nw_dcx.cjs.map +1 -0
- package/dist/{shared-uAzFeq0x.mjs → shared-BmJmaxu8.mjs} +5 -5
- package/dist/shared-BmJmaxu8.mjs.map +1 -0
- package/dist/sheet-CHnDkjn4.js +56 -0
- package/dist/sheet-CHnDkjn4.js.map +1 -0
- package/dist/sheet-PVxRQrOp.js +7 -0
- package/dist/sheet-PVxRQrOp.js.map +1 -0
- package/dist/sheet-ueNBw_2u.js +1 -0
- package/dist/{sidecar-BUO1hKXu.mjs → sidecar-DVegwGec.mjs} +3 -3
- package/dist/{sidecar-BUO1hKXu.mjs.map → sidecar-DVegwGec.mjs.map} +1 -1
- package/dist/{style-BkeAZl0n.js → style-B1tkE8zl.js} +329 -129
- package/dist/style-B1tkE8zl.js.map +1 -0
- package/dist/styleStore-BK2XBS8n.js +45 -0
- package/dist/styleStore-BK2XBS8n.js.map +1 -0
- package/dist/styleStore-D4umgIwQ.js +3457 -0
- package/dist/styleStore-D4umgIwQ.js.map +1 -0
- package/dist/token-BX5jRxMb.js +110 -0
- package/dist/token-BX5jRxMb.js.map +1 -0
- package/dist/token-CS0iRIIa.js +140 -0
- package/dist/token-CS0iRIIa.js.map +1 -0
- package/dist/{trace-D0IL6JT8.js → trace-DZYKSwdB.js} +2 -2
- package/dist/{trace-D0IL6JT8.js.map → trace-DZYKSwdB.js.map} +1 -1
- package/dist/{trace-DR7_Rpkg.js → trace-EEKXwKSr.js} +3 -3
- package/dist/{trace-DR7_Rpkg.js.map → trace-EEKXwKSr.js.map} +1 -1
- package/dist/{transform-BTJOg8Hg.js → transform-BZ4jPwy3.js} +2 -2
- package/dist/transform-BZ4jPwy3.js.map +1 -0
- package/dist/types/adapter/preact.d.ts +1 -0
- package/dist/types/adapter/react.d.ts +1 -0
- package/dist/types/adapter/solid.d.ts +1 -0
- package/dist/types/atomic/atRule/counterStyle.d.ts +10 -0
- package/dist/types/atomic/atRule/fontFace.d.ts +10 -0
- package/dist/types/atomic/atRule/fontPaletteValues.d.ts +10 -0
- package/dist/types/atomic/atRule/fontSrc.d.ts +1 -0
- package/dist/types/atomic/atRule/keyframes.d.ts +13 -0
- package/dist/types/atomic/atRule/positionTry.d.ts +13 -0
- package/dist/types/atomic/atRule/property.d.ts +13 -0
- package/dist/types/atomic/atRule/utils.d.ts +5 -0
- package/dist/types/atomic/className.d.ts +11 -0
- package/dist/types/atomic/debug/className/className.d.ts +9 -0
- package/dist/types/atomic/debug/className/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/data.d.ts +3 -0
- package/dist/types/atomic/debug/property/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/property.d.ts +5 -0
- package/dist/types/atomic/debug/selector.d.ts +2 -0
- package/dist/types/atomic/debug/value.d.ts +5 -0
- package/dist/types/atomic/element.d.ts +5 -0
- package/dist/types/atomic/layer/index.d.ts +3 -0
- package/dist/types/atomic/layer/layer.d.ts +12 -0
- package/dist/types/atomic/layer/types.d.ts +30 -0
- package/dist/types/atomic/layer/utils.d.ts +4 -0
- package/dist/types/atomic/property/index.d.ts +2 -0
- package/dist/types/atomic/property/presets.d.ts +4 -0
- package/dist/types/atomic/property/property.d.ts +3 -0
- package/dist/types/atomic/property/type_maps.d.ts +31 -0
- package/dist/types/atomic/property/types.d.ts +4 -0
- package/dist/types/atomic/rule.d.ts +5 -0
- package/dist/types/atomic/scope.d.ts +3 -0
- package/dist/types/atomic/theme.d.ts +7 -0
- package/dist/types/atomic/token.d.ts +7 -0
- package/dist/types/atomic/utils/cssIdent.d.ts +2 -0
- package/dist/types/atomic/utils/cssVar.d.ts +3 -0
- package/dist/types/atomic/utils/debug.d.ts +4 -0
- package/dist/types/atomic/utils/format.d.ts +5 -0
- package/dist/types/atomic/utils/hash.d.ts +1 -0
- package/dist/types/atomic/utils/selector.d.ts +7 -0
- package/dist/types/atomic/utils/types.d.ts +8 -0
- package/dist/types/atomic/value/index.d.ts +2 -0
- package/dist/types/atomic/value/unitless.d.ts +1 -0
- package/dist/types/atomic/value/value.d.ts +2 -0
- package/dist/types/atomic/var.d.ts +4 -0
- package/dist/types/builder/classname/class_name_builder.d.ts +4 -0
- package/dist/types/builder/classname/fns.d.ts +48 -0
- package/dist/types/builder/classname/index.d.ts +3 -0
- package/dist/types/builder/classname/types.d.ts +18 -0
- package/dist/types/builder/data/check_selector.d.ts +2 -0
- package/dist/types/builder/data/const.d.ts +27 -0
- package/dist/types/builder/data/create.d.ts +13 -0
- package/dist/types/builder/data/data.d.ts +44 -0
- package/dist/types/builder/data/debug.d.ts +38 -0
- package/dist/types/builder/data/index.d.ts +8 -0
- package/dist/types/builder/data/is.d.ts +16 -0
- package/dist/types/builder/data/merge/index.d.ts +2 -0
- package/dist/types/builder/data/merge/scope.d.ts +7 -0
- package/dist/types/builder/data/merge/style.d.ts +6 -0
- package/dist/types/builder/data/merge/utils.d.ts +10 -0
- package/dist/types/builder/data/selector.d.ts +8 -0
- package/dist/types/builder/data/state.d.ts +100 -0
- package/dist/types/builder/extract/index.d.ts +7 -0
- package/dist/types/builder/extract/scope.d.ts +14 -0
- package/dist/types/builder/extract/sheet.d.ts +10 -0
- package/dist/types/builder/extract/slot.d.ts +9 -0
- package/dist/types/builder/extract/style.d.ts +11 -0
- package/dist/types/builder/extract/theme.d.ts +2 -0
- package/dist/types/builder/extract/token.d.ts +12 -0
- package/dist/types/builder/extract/utils.d.ts +28 -0
- package/dist/types/builder/extract/withTokens.d.ts +10 -0
- package/dist/types/builder/index.d.ts +2 -0
- package/dist/types/builder/selector_override.d.ts +5 -0
- package/dist/types/builder/selector_override_core.d.ts +8 -0
- package/dist/types/builder/style_builder.d.ts +15 -0
- package/dist/types/builder/style_data.d.ts +8 -0
- package/dist/types/builder/style_fns.d.ts +14 -0
- package/dist/types/builder/token/data.d.ts +10 -0
- package/dist/types/builder/token/name.d.ts +3 -0
- package/dist/types/builder/token/symbols.d.ts +4 -0
- package/dist/types/builder/types/alias.d.ts +59 -0
- package/dist/types/builder/types/fns.d.ts +115 -0
- package/dist/types/builder/types/index.d.ts +1 -0
- package/dist/types/builder/types/types.d.ts +22 -0
- package/dist/types/builder/utils.d.ts +9 -0
- package/dist/types/compiler/compiler/cache.d.ts +24 -0
- package/dist/types/compiler/compiler/cache_identity.d.ts +4 -0
- package/dist/types/compiler/compiler/compiler.d.ts +40 -0
- package/dist/types/compiler/compiler/constants.d.ts +6 -0
- package/dist/types/compiler/compiler/index.d.ts +4 -0
- package/dist/types/compiler/compiler/persistent_cache.d.ts +14 -0
- package/dist/types/compiler/compiler/types.d.ts +64 -0
- package/dist/types/compiler/cssProp.d.ts +8 -0
- package/dist/types/compiler/extract/collector.d.ts +8 -0
- package/dist/types/compiler/extract/extract.d.ts +6 -0
- package/dist/types/compiler/extract/index.d.ts +3 -0
- package/dist/types/compiler/extract/types.d.ts +29 -0
- package/dist/types/compiler/index.d.ts +3 -0
- package/dist/types/compiler/transform/cssProp/index.d.ts +1 -0
- package/dist/types/compiler/transform/cssProp/plugin.d.ts +13 -0
- package/dist/types/compiler/transform/debug/index.d.ts +2 -0
- package/dist/types/compiler/transform/debug/plugin.d.ts +34 -0
- package/dist/types/compiler/transform/debug/transform.d.ts +7 -0
- package/dist/types/compiler/transform/debug/utils/debug_data.d.ts +11 -0
- package/dist/types/compiler/transform/debug/utils/source_url.d.ts +2 -0
- package/dist/types/compiler/transform/evaluator/evaluator.d.ts +58 -0
- package/dist/types/compiler/transform/evaluator/index.d.ts +3 -0
- package/dist/types/compiler/transform/evaluator/lazy_bindings.d.ts +22 -0
- package/dist/types/compiler/transform/evaluator/metadata_cache.d.ts +13 -0
- package/dist/types/compiler/transform/evaluator/tracer.d.ts +15 -0
- package/dist/types/compiler/transform/evaluator/types.d.ts +21 -0
- package/dist/types/compiler/transform/extract/chain/chain.d.ts +18 -0
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +21 -0
- package/dist/types/compiler/transform/extract/chain/index.d.ts +3 -0
- package/dist/types/compiler/transform/extract/chain/types.d.ts +32 -0
- package/dist/types/compiler/transform/extract/index.d.ts +2 -0
- package/dist/types/compiler/transform/extract/plugin.d.ts +20 -0
- package/dist/types/compiler/transform/extract/transform.d.ts +10 -0
- package/dist/types/compiler/transform/extract/utils/imports.d.ts +3 -0
- package/dist/types/compiler/transform/extract/utils/replacement.d.ts +11 -0
- package/dist/types/compiler/transform/extract/utils/slot.d.ts +4 -0
- package/dist/types/compiler/transform/extract/utils/state.d.ts +36 -0
- package/dist/types/compiler/transform/extract/utils/theme.d.ts +9 -0
- package/dist/types/compiler/transform/extract/utils/token.d.ts +4 -0
- package/dist/types/compiler/transform/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/isStaticStyleValue.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/isStyleChainCall.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/static_ids.d.ts +16 -0
- package/dist/types/compiler/transform/syntax/types.d.ts +4 -0
- package/dist/types/compiler/transform/syntax/utils.d.ts +5 -0
- package/dist/types/compiler/transform/utils/babel.d.ts +21 -0
- package/dist/types/compiler/transform/utils/import.d.ts +2 -0
- package/dist/types/compiler/transform/utils/path.d.ts +1 -0
- package/dist/types/compiler/transform/utils/selector.d.ts +18 -0
- package/dist/types/compiler/utils/check_diagnostics.d.ts +7 -0
- package/dist/types/compiler/utils/constants.d.ts +70 -0
- package/dist/types/compiler/utils/file_resolver.d.ts +16 -0
- package/dist/types/compiler/utils/import_source.d.ts +34 -0
- package/dist/types/compiler/utils/imports.d.ts +6 -0
- package/dist/types/compiler/utils/path.d.ts +4 -0
- package/dist/types/compiler/utils/sourcemap.d.ts +36 -0
- package/dist/types/config/build.d.ts +20 -0
- package/dist/types/config/config/check.d.ts +11 -0
- package/dist/types/config/config/css.d.ts +29 -0
- package/dist/types/config/config/css_extra.d.ts +13 -0
- package/dist/types/config/config/debug.d.ts +14 -0
- package/dist/types/config/config/dev.d.ts +36 -0
- package/dist/types/config/config/runtime.d.ts +10 -0
- package/dist/types/config/configure.d.ts +14 -0
- package/dist/types/config/constants.d.ts +1 -0
- package/dist/types/config/document.d.ts +3 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/types.d.ts +47 -0
- package/dist/types/config/utils.d.ts +2 -0
- package/dist/types/css/counterStyle.d.ts +4 -0
- package/dist/types/css/fontFace.d.ts +5 -0
- package/dist/types/css/fontPaletteValues.d.ts +4 -0
- package/dist/types/css/globalSheet.d.ts +24 -0
- package/dist/types/css/index.d.ts +12 -0
- package/dist/types/css/keyframes.d.ts +4 -0
- package/dist/types/css/positionTry.d.ts +4 -0
- package/dist/types/css/property.d.ts +7 -0
- package/dist/types/css/sheet.d.ts +8 -0
- package/dist/types/css/styleTarget.d.ts +9 -0
- package/dist/types/css/utils.d.ts +19 -0
- package/dist/types/dev/config.d.ts +6 -0
- package/dist/types/dev/fns.d.ts +14 -0
- package/dist/types/dev/index.d.ts +2 -0
- package/dist/types/dev/trace.d.ts +8 -0
- package/dist/types/dev/utils.d.ts +5 -0
- package/dist/types/dialect/extracted/index.d.ts +1 -0
- package/dist/types/dialect/index.d.ts +1 -0
- package/dist/types/dialect/namedTokens.d.ts +9 -0
- package/dist/types/entry/dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/dev/config.d.ts +2 -0
- package/dist/types/entry/dev/css.d.ts +2 -0
- package/dist/types/entry/dev/index.d.ts +3 -0
- package/dist/types/entry/dev/jsx_dev_runtime.d.ts +3 -0
- package/dist/types/entry/dev/sheet.d.ts +1 -0
- package/dist/types/entry/prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/prod/config.d.ts +2 -0
- package/dist/types/entry/prod/config_debug.d.ts +2 -0
- package/dist/types/entry/prod/css.d.ts +2 -0
- package/dist/types/entry/prod/extract.d.ts +1 -0
- package/dist/types/entry/prod/index.d.ts +2 -0
- package/dist/types/entry/prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/prod/runtime.d.ts +8 -0
- package/dist/types/entry/rsc_dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_dev/config.d.ts +2 -0
- package/dist/types/entry/rsc_dev/css.d.ts +3 -0
- package/dist/types/entry/rsc_dev/index.d.ts +2 -0
- package/dist/types/entry/rsc_dev/server.d.ts +10 -0
- package/dist/types/entry/rsc_prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_prod/config.d.ts +2 -0
- package/dist/types/entry/rsc_prod/config_debug.d.ts +2 -0
- package/dist/types/entry/rsc_prod/css.d.ts +2 -0
- package/dist/types/entry/rsc_prod/index.d.ts +2 -0
- package/dist/types/entry/rsc_prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/rsc_prod/runtime.d.ts +4 -0
- package/dist/types/entry/rsc_prod/server.d.ts +6 -0
- package/dist/types/entry/shared/config.d.ts +1 -0
- package/dist/types/entry/shared/config_debug.d.ts +1 -0
- package/dist/types/entry/shared/config_dev.d.ts +1 -0
- package/dist/types/entry/shared/dev.d.ts +1 -0
- package/dist/types/entry/shared/prod.d.ts +1 -0
- package/dist/types/entry/shared/utils.d.ts +2 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/jsx/extracted/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc_extracted/jsx_runtime.d.ts +2 -0
- package/dist/types/jsx/runtime/jsx_dev_runtime.d.ts +6 -0
- package/dist/types/jsx/runtime/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/types/index.d.ts +1 -0
- package/dist/types/jsx/types/preact.d.ts +12 -0
- package/dist/types/jsx/types/react.d.ts +10 -0
- package/dist/types/jsx/types/solid.d.ts +12 -0
- package/dist/types/jsx/utils.d.ts +19 -0
- package/dist/types/plugin/bundler/farm/index.d.ts +1 -0
- package/dist/types/plugin/bundler/farm/plugin.d.ts +97 -0
- package/dist/types/plugin/bundler/parcel/index.d.ts +1 -0
- package/dist/types/plugin/bundler/parcel/optimizer.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/parcel/resolver.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/runtime.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/shared.d.ts +37 -0
- package/dist/types/plugin/bundler/parcel/transformer.d.ts +3 -0
- package/dist/types/plugin/bundler/rspack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/rspack/plugin.d.ts +7 -0
- package/dist/types/plugin/bundler/vite/index.d.ts +1 -0
- package/dist/types/plugin/bundler/vite/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/vite/state.d.ts +79 -0
- package/dist/types/plugin/bundler/webpack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/webpack/loader.d.ts +2 -0
- package/dist/types/plugin/bundler/webpack/plugin.d.ts +11 -0
- package/dist/types/plugin/bundler/webpack/shared/loader.d.ts +31 -0
- package/dist/types/plugin/bundler/webpack/shared/registry.d.ts +4 -0
- package/dist/types/plugin/bundler/webpack/utils.d.ts +18 -0
- package/dist/types/plugin/nextjs/constants.d.ts +3 -0
- package/dist/types/plugin/nextjs/html.d.ts +1 -0
- package/dist/types/plugin/nextjs/index.d.ts +2 -0
- package/dist/types/plugin/nextjs/loader.d.ts +3 -0
- package/dist/types/plugin/nextjs/plugin.d.ts +5 -0
- package/dist/types/plugin/nextjs/types.d.ts +21 -0
- package/dist/types/plugin/nextjs/utils.d.ts +59 -0
- package/dist/types/plugin/utils/cache/css_cache.d.ts +34 -0
- package/dist/types/plugin/utils/cache/file.d.ts +4 -0
- package/dist/types/plugin/utils/cache/index.d.ts +2 -0
- package/dist/types/plugin/utils/compiler.d.ts +51 -0
- package/dist/types/plugin/utils/constants.d.ts +4 -0
- package/dist/types/plugin/utils/cssMarker.d.ts +4 -0
- package/dist/types/plugin/utils/cssOutput.d.ts +10 -0
- package/dist/types/plugin/utils/filter.d.ts +25 -0
- package/dist/types/plugin/utils/imports.d.ts +3 -0
- package/dist/types/plugin/utils/index.d.ts +10 -0
- package/dist/types/plugin/utils/injection.d.ts +3 -0
- package/dist/types/plugin/utils/misc.d.ts +1 -0
- package/dist/types/plugin/utils/runtimeEntry.d.ts +8 -0
- package/dist/types/plugin/utils/sidecar/index.d.ts +1 -0
- package/dist/types/plugin/utils/sidecar/server.d.ts +19 -0
- package/dist/types/plugin/utils/sidecar/sidecar.d.ts +17 -0
- package/dist/types/plugin/utils/sidecar/utils.d.ts +33 -0
- package/dist/types/plugin/utils/sourcemap.d.ts +9 -0
- package/dist/types/plugin/utils/virtual.d.ts +12 -0
- package/dist/types/presets/tailwind/classname/index.d.ts +2 -0
- package/dist/types/presets/tailwind/classname/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/classname/types.d.ts +27 -0
- package/dist/types/presets/tailwind/index.d.ts +5 -0
- package/dist/types/presets/tailwind/selectors.d.ts +68 -0
- package/dist/types/presets/tailwind/style/index.d.ts +2 -0
- package/dist/types/presets/tailwind/style/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/style/types.d.ts +149 -0
- package/dist/types/presets/tailwind/theme.d.ts +477 -0
- package/dist/types/presets/tailwind/types.d.ts +53 -0
- package/dist/types/runtime/adapter/utils.d.ts +12 -0
- package/dist/types/runtime/core/cache/combine.d.ts +6 -0
- package/dist/types/runtime/core/cache/combineRuntime.d.ts +1 -0
- package/dist/types/runtime/core/cache/item.d.ts +15 -0
- package/dist/types/runtime/core/cache/itemWithResolver.d.ts +4 -0
- package/dist/types/runtime/core/cache/pool.d.ts +16 -0
- package/dist/types/runtime/core/cache/prop.d.ts +19 -0
- package/dist/types/runtime/core/cache/propCache.d.ts +12 -0
- package/dist/types/runtime/core/cache/resolvedItem.d.ts +5 -0
- package/dist/types/runtime/core/cache/result.d.ts +9 -0
- package/dist/types/runtime/core/cache/stateItem.d.ts +14 -0
- package/dist/types/runtime/core/cache/token.d.ts +2 -0
- package/dist/types/runtime/core/cache/tokenValues.d.ts +26 -0
- package/dist/types/runtime/core/cache/utils/tree.d.ts +12 -0
- package/dist/types/runtime/core/cache/utils/walk.d.ts +1 -0
- package/dist/types/runtime/core/className.d.ts +18 -0
- package/dist/types/runtime/core/combinedStyle.d.ts +20 -0
- package/dist/types/runtime/core/createTransformElement.d.ts +4 -0
- package/dist/types/runtime/core/elementMarker.d.ts +12 -0
- package/dist/types/runtime/core/elementMarkerData.d.ts +7 -0
- package/dist/types/runtime/core/getClassName.d.ts +4 -0
- package/dist/types/runtime/core/getSheetRules.d.ts +3 -0
- package/dist/types/runtime/core/getToken.d.ts +3 -0
- package/dist/types/runtime/core/index.d.ts +5 -0
- package/dist/types/runtime/core/jsx.d.ts +1 -0
- package/dist/types/runtime/core/resolveClassNameRuntime.d.ts +8 -0
- package/dist/types/runtime/env.d.ts +2 -0
- package/dist/types/runtime/extract/combineStyle.d.ts +27 -0
- package/dist/types/runtime/extract/getClassName.d.ts +10 -0
- package/dist/types/runtime/extract/index.d.ts +6 -0
- package/dist/types/runtime/extract/jsx.d.ts +10 -0
- package/dist/types/runtime/extract/token.d.ts +5 -0
- package/dist/types/runtime/extract/tokenResolver.d.ts +2 -0
- package/dist/types/runtime/rsc/constants.d.ts +6 -0
- package/dist/types/runtime/rsc/dev.d.ts +11 -0
- package/dist/types/runtime/rsc/getClassName.d.ts +27 -0
- package/dist/types/runtime/rsc/globalSheet.d.ts +22 -0
- package/dist/types/runtime/rsc/index.d.ts +1 -0
- package/dist/types/runtime/rsc/jsx.d.ts +1 -0
- package/dist/types/runtime/rsc/observer.d.ts +10 -0
- package/dist/types/runtime/rsc/styleStore.d.ts +7 -0
- package/dist/types/runtime/sheet/document.d.ts +3 -0
- package/dist/types/runtime/sheet/element.d.ts +2 -0
- package/dist/types/runtime/sheet/global.d.ts +3 -0
- package/dist/types/runtime/sheet/index.d.ts +3 -0
- package/dist/types/runtime/sheet/insert.d.ts +5 -0
- package/dist/types/runtime/sheet/rule.d.ts +8 -0
- package/dist/types/runtime/sheet/rules.d.ts +10 -0
- package/dist/types/runtime/sheet/theme.d.ts +5 -0
- package/dist/types/runtime/style/index.d.ts +3 -0
- package/dist/types/runtime/style/scope.d.ts +4 -0
- package/dist/types/runtime/style/style.d.ts +27 -0
- package/dist/types/runtime/style/token.d.ts +1 -0
- package/dist/types/runtime/types.d.ts +31 -0
- package/dist/types/selector/assert.d.ts +13 -0
- package/dist/types/selector/index.d.ts +5 -0
- package/dist/types/selector/presets/default.d.ts +108 -0
- package/dist/types/selector/presets/index.d.ts +3 -0
- package/dist/types/selector/presets/minimal.d.ts +46 -0
- package/dist/types/selector/presets/selectors.d.ts +62 -0
- package/dist/types/selector/selector.d.ts +25 -0
- package/dist/types/selector/types.d.ts +12 -0
- package/dist/types/selector/validate.d.ts +5 -0
- package/dist/types/sheet/dev/dev_layer.d.ts +4 -0
- package/dist/types/sheet/dev/dev_sort.d.ts +2 -0
- package/dist/types/sheet/dev/index.d.ts +5 -0
- package/dist/types/sheet/dev/utils.d.ts +26 -0
- package/dist/types/sheet/index.d.ts +4 -0
- package/dist/types/sheet/ordered.d.ts +4 -0
- package/dist/types/sheet/ordering.d.ts +15 -0
- package/dist/types/sheet/prod.d.ts +2 -0
- package/dist/types/sheet/sheet.d.ts +2 -0
- package/dist/types/sheet/sourcemap.d.ts +11 -0
- package/dist/types/sheet/types.d.ts +37 -0
- package/dist/types/sheet/utils/dom.d.ts +5 -0
- package/dist/types/sheet/utils/index.d.ts +4 -0
- package/dist/types/sheet/utils/layer.d.ts +10 -0
- package/dist/types/sheet/utils/noop.d.ts +2 -0
- package/dist/types/sheet/utils/rule.d.ts +3 -0
- package/dist/types/sheet/utils/sourcemap.d.ts +12 -0
- package/dist/types/style/classname.d.ts +15 -0
- package/dist/types/style/important.d.ts +9 -0
- package/dist/types/style/index.d.ts +12 -0
- package/dist/types/style/keyframes.d.ts +10 -0
- package/dist/types/style/style.d.ts +426 -0
- package/dist/types/style/theme.d.ts +5 -0
- package/dist/types/style/token.d.ts +29 -0
- package/dist/types/style/tokens.d.ts +10 -0
- package/dist/types/style/transform.d.ts +22 -0
- package/dist/types/style/types.d.ts +22 -0
- package/dist/types/style/utils/expose.d.ts +8 -0
- package/dist/types/style/utils/index.d.ts +1 -0
- package/dist/types/style/value.d.ts +12 -0
- package/dist/types/style/valueRef.d.ts +13 -0
- package/dist/types/style/weight.d.ts +9 -0
- package/dist/types/utils/global.d.ts +4 -0
- package/dist/types/utils/hash.d.ts +3 -0
- package/dist/types/utils/id.d.ts +12 -0
- package/dist/types/utils/object.d.ts +10 -0
- package/dist/types/utils/symbol.d.ts +1 -0
- package/dist/types/utils/trace.d.ts +21 -0
- package/dist/types/utils/type.d.ts +11 -0
- package/dist/utils-0UTYm294.js +42 -0
- package/dist/utils-0UTYm294.js.map +1 -0
- package/dist/utils-CO1ZXzKK.mjs +182 -0
- package/dist/utils-CO1ZXzKK.mjs.map +1 -0
- package/dist/{utils-DQGa0uzS.mjs → utils-CxYxZSSk.mjs} +3 -3
- package/dist/{utils-DQGa0uzS.mjs.map → utils-CxYxZSSk.mjs.map} +1 -1
- package/dist/utils-D1duUYV9.js +72 -0
- package/dist/utils-D1duUYV9.js.map +1 -0
- package/dist/utils-DxCpyV2E.js +62 -0
- package/dist/utils-DxCpyV2E.js.map +1 -0
- package/dist/{utils-BsbfH6cd.js → utils-ymEmGz-T.js} +1274 -608
- package/dist/utils-ymEmGz-T.js.map +1 -0
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/dist/{webpack-Fb9xF5jS.mjs → webpack-DF165M2x.mjs} +7 -7
- package/dist/webpack-DF165M2x.mjs.map +1 -0
- package/entry/dev/adapter/preact.ts +8 -0
- package/entry/dev/adapter/react.ts +8 -0
- package/entry/dev/adapter/solid.ts +8 -0
- package/entry/dev/sheet.ts +4 -2
- package/entry/prod/adapter/preact.ts +8 -0
- package/entry/prod/adapter/react.ts +8 -0
- package/entry/prod/adapter/solid.ts +8 -0
- package/entry/prod/config_debug.ts +2 -0
- package/entry/prod/index.ts +1 -1
- package/entry/prod/runtime.ts +3 -1
- package/entry/rsc_dev/adapter/preact.ts +9 -0
- package/entry/rsc_dev/adapter/react.ts +9 -0
- package/entry/rsc_dev/adapter/solid.ts +9 -0
- package/entry/rsc_dev/css.ts +2 -0
- package/entry/rsc_prod/adapter/preact.ts +1 -0
- package/entry/rsc_prod/adapter/react.ts +1 -0
- package/entry/rsc_prod/adapter/solid.ts +1 -0
- package/entry/rsc_prod/config_debug.ts +6 -0
- package/entry/rsc_prod/index.ts +1 -1
- package/entry/shared/config_debug.ts +9 -0
- package/entry/shared/config_dev.ts +9 -7
- package/index.ts +1 -0
- package/jsx/rsc/jsx_dev_runtime.ts +11 -2
- package/jsx/rsc/jsx_runtime.ts +14 -3
- package/jsx/types/index.ts +1 -0
- package/jsx/types/preact.ts +14 -0
- package/jsx/{types.ts → types/react.ts} +2 -2
- package/jsx/types/solid.ts +15 -0
- package/package.json +179 -74
- package/plugin/bundler/farm/plugin.ts +3 -1
- package/plugin/bundler/parcel/optimizer.ts +1 -0
- package/plugin/bundler/parcel/plugin.ts +2 -0
- package/plugin/bundler/parcel/shared.ts +1 -1
- package/plugin/bundler/rspack/plugin.ts +1 -0
- package/plugin/bundler/vite/plugin.ts +23 -25
- package/plugin/bundler/vite/state.ts +7 -8
- package/plugin/bundler/webpack/plugin.ts +4 -3
- package/plugin/bundler/webpack/shared/loader.ts +13 -7
- package/plugin/nextjs/loader.ts +18 -2
- package/plugin/nextjs/plugin.ts +248 -35
- package/plugin/nextjs/types.ts +1 -2
- package/plugin/nextjs/utils.ts +122 -1
- package/plugin/utils/compiler.ts +3 -2
- package/plugin/utils/filter.ts +65 -1
- package/plugin/utils/runtimeEntry.ts +3 -2
- package/presets/tailwind/classname/transform.ts +32 -1
- package/presets/tailwind/style/transform.ts +9 -3
- package/runtime/adapter/utils.ts +120 -0
- package/runtime/core/cache/combine.ts +76 -28
- package/runtime/core/cache/combineRuntime.ts +4 -0
- package/runtime/core/cache/index.ts +2 -1
- package/runtime/core/cache/item.ts +32 -13
- package/runtime/core/cache/itemWithResolver.ts +44 -0
- package/runtime/core/cache/pool.ts +15 -30
- package/runtime/core/cache/prop.ts +10 -8
- package/runtime/core/cache/result.ts +2 -2
- package/runtime/core/cache/stateItem.ts +19 -1
- package/runtime/core/cache/token.ts +20 -0
- package/runtime/core/cache/tokenValues.ts +19 -11
- package/runtime/core/combinedStyle.ts +4 -4
- package/runtime/core/elementMarker.ts +9 -3
- package/runtime/extract/combineStyle.ts +211 -0
- package/runtime/extract/getClassName.ts +61 -16
- package/runtime/extract/index.ts +3 -1
- package/runtime/extract/token.ts +41 -0
- package/runtime/extract/tokenResolver.ts +17 -0
- package/runtime/rsc/constants.ts +3 -0
- package/runtime/rsc/dev.ts +31 -15
- package/runtime/rsc/getClassName.ts +10 -0
- package/runtime/rsc/globalSheet.ts +130 -0
- package/runtime/rsc/observer.ts +125 -15
- package/runtime/rsc/styleStore.ts +10 -19
- 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 +18 -12
- package/runtime/sheet/rules.ts +11 -3
- package/runtime/style/scope.ts +0 -24
- package/runtime/style/style.ts +181 -6
- package/runtime/types.ts +3 -3
- package/sheet/dev/dev_layer.ts +76 -17
- package/sheet/dev/dev_sort.ts +70 -18
- package/sheet/dev/index.ts +23 -3
- package/sheet/ordered.ts +225 -0
- package/sheet/ordering.ts +156 -0
- package/sheet/prod.ts +39 -12
- package/sheet/types.ts +7 -0
- package/sheet/utils/layer.ts +34 -0
- package/style/classname.ts +12 -6
- package/style/important.ts +21 -0
- package/style/index.ts +2 -0
- package/style/style.ts +17 -5
- package/style/theme.ts +0 -1
- package/style/token.ts +28 -21
- package/style/tokens.ts +20 -13
- package/style/transform.ts +5 -4
- package/style/types.ts +6 -4
- package/style/utils/expose.ts +4 -3
- package/style/value.ts +26 -11
- package/style/valueRef.ts +1 -1
- package/style/weight.ts +21 -0
- package/utils/global.ts +1 -3
- package/utils/symbol.ts +3 -0
- package/utils/trace.ts +1 -0
- package/dist/assert-BGdigdr5.js.map +0 -1
- package/dist/className-Cuh2JNxO.js +0 -263
- package/dist/className-Cuh2JNxO.js.map +0 -1
- package/dist/className-W2kDyeVl.js +0 -144
- package/dist/className-W2kDyeVl.js.map +0 -1
- package/dist/compiler-BXcGyZUP.mjs.map +0 -1
- package/dist/config-C1k9vUrM.js.map +0 -1
- package/dist/config-CLYMN3_p.js +0 -26
- package/dist/config-CLYMN3_p.js.map +0 -1
- package/dist/config-DcYrUB-M.js +0 -6
- package/dist/config-oI_yS50f.js +0 -1
- package/dist/css-CELBp6Gu.js +0 -58
- package/dist/css-CELBp6Gu.js.map +0 -1
- package/dist/css-CohHH2tn.js.map +0 -1
- package/dist/css-D_DL1yOz.js +0 -237
- package/dist/css-D_DL1yOz.js.map +0 -1
- package/dist/css-DfH4Gb1c.js +0 -805
- package/dist/css-DfH4Gb1c.js.map +0 -1
- package/dist/data-Ze8GNiJm.js +0 -483
- package/dist/data-Ze8GNiJm.js.map +0 -1
- package/dist/debug-BefbXMq1.js +0 -15
- package/dist/debug-BefbXMq1.js.map +0 -1
- package/dist/debug-DLmUG3Vh.js +0 -172
- package/dist/debug-DLmUG3Vh.js.map +0 -1
- package/dist/debug-OG2wSB5R.js +0 -15
- package/dist/debug-OG2wSB5R.js.map +0 -1
- package/dist/dev-4TqJORRn.js +0 -75
- package/dist/dev-4TqJORRn.js.map +0 -1
- package/dist/dev-C2u78xuv.js.map +0 -1
- package/dist/elementMarker-BKzZyg5V.js.map +0 -1
- package/dist/extract-B9j4TBkU.js +0 -2
- package/dist/extract-CzWJeQi8.js +0 -121
- package/dist/extract-CzWJeQi8.js.map +0 -1
- package/dist/getClassName-C6690_nr.js.map +0 -1
- package/dist/global-C7GsCW6Y.js +0 -14
- package/dist/global-C7GsCW6Y.js.map +0 -1
- package/dist/global-zaCE-g1C.js.map +0 -1
- package/dist/hash-Bycpk3MR.js +0 -160
- package/dist/hash-Bycpk3MR.js.map +0 -1
- package/dist/jsx-Berx-L-r.js +0 -39
- package/dist/jsx-Berx-L-r.js.map +0 -1
- package/dist/jsx-DsMajv_M.js +0 -38
- package/dist/jsx-DsMajv_M.js.map +0 -1
- package/dist/jsx_runtime-CMdEXGNZ.js +0 -13
- package/dist/jsx_runtime-DPWo5qvV.js.map +0 -1
- package/dist/layer-DiNeeTgG.js +0 -94
- package/dist/layer-DiNeeTgG.js.map +0 -1
- package/dist/loader-DCT1Q9yi.mjs.map +0 -1
- package/dist/misc-o8pviMUi.mjs.map +0 -1
- package/dist/namedTokens-BUa6raTb.js.map +0 -1
- package/dist/presets-BhXa232U.js +0 -108
- package/dist/presets-BhXa232U.js.map +0 -1
- package/dist/property-BzZSTVIh.js +0 -406
- package/dist/property-BzZSTVIh.js.map +0 -1
- package/dist/rules-Dz7Pu2K6.js.map +0 -1
- package/dist/runtime-B3jHW9B1.js +0 -32
- package/dist/runtime-B3jHW9B1.js.map +0 -1
- package/dist/shared-B_gJf5uj.cjs.map +0 -1
- package/dist/shared-uAzFeq0x.mjs.map +0 -1
- package/dist/sheet-DasbRnvy.js +0 -7
- package/dist/sheet-DasbRnvy.js.map +0 -1
- package/dist/style-B0F1sgRZ.js +0 -5
- package/dist/style-BkeAZl0n.js.map +0 -1
- package/dist/style-CYXTs1iu.js +0 -771
- package/dist/style-CYXTs1iu.js.map +0 -1
- package/dist/style-DUztHzBz.js.map +0 -1
- package/dist/styleStore-BGJ2ZYtK.js +0 -2009
- package/dist/styleStore-BGJ2ZYtK.js.map +0 -1
- package/dist/styleStore-DVDp-gI-.js +0 -55
- package/dist/styleStore-DVDp-gI-.js.map +0 -1
- package/dist/token-CA1j7suG.js +0 -273
- package/dist/token-CA1j7suG.js.map +0 -1
- package/dist/token-CKXUECuU.js +0 -76
- package/dist/token-CKXUECuU.js.map +0 -1
- package/dist/token-DTOyFLmp.js +0 -58
- package/dist/token-DTOyFLmp.js.map +0 -1
- package/dist/transform-BTJOg8Hg.js.map +0 -1
- package/dist/utils-BsbfH6cd.js.map +0 -1
- package/dist/utils-CpA-dSpY.mjs +0 -97
- package/dist/utils-CpA-dSpY.mjs.map +0 -1
- package/dist/utils-D4YWF2K0.js.map +0 -1
- package/dist/utils-R6QadAsY.js +0 -170
- package/dist/utils-R6QadAsY.js.map +0 -1
- package/dist/value-CJG6EWe8.js +0 -85
- package/dist/value-CJG6EWe8.js.map +0 -1
- package/dist/value-D-ZcRzLA.js +0 -42
- package/dist/value-D-ZcRzLA.js.map +0 -1
- package/dist/value-DBtSe-9B.js +0 -1000
- package/dist/value-DBtSe-9B.js.map +0 -1
- package/dist/valueRef-CsLVJwjA.js +0 -16
- package/dist/valueRef-CsLVJwjA.js.map +0 -1
- package/dist/webpack-Fb9xF5jS.mjs.map +0 -1
- package/dist/withTokens-LRidu3Vc.js +0 -95
- package/dist/withTokens-LRidu3Vc.js.map +0 -1
|
@@ -0,0 +1,4541 @@
|
|
|
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
|
+
//#region config/config/check.ts
|
|
3
|
+
const CHECK_CONFIG_DEFAULT = {};
|
|
4
|
+
const CHECK_CONFIG = globalData("config.check", () => ({ ...CHECK_CONFIG_DEFAULT }));
|
|
5
|
+
function setStyleCheckOptions(options) {
|
|
6
|
+
CHECK_CONFIG.important = options.important ? { ...options.important } : void 0;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region config/constants.ts
|
|
10
|
+
const LayerPlaceholder = "$layer";
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region config/config/css.ts
|
|
13
|
+
const CSS_CONFIG_DEFAULT = {
|
|
14
|
+
layer: true,
|
|
15
|
+
layers: [LayerPlaceholder],
|
|
16
|
+
layerNamespace: "css"
|
|
17
|
+
};
|
|
18
|
+
const CSS_CONFIG = globalData("config.css", () => ({ ...CSS_CONFIG_DEFAULT }));
|
|
19
|
+
function isStyleLayerEnabled(layer = CSS_CONFIG.layer) {
|
|
20
|
+
return typeof layer === "boolean" ? layer : layer.style ?? true;
|
|
21
|
+
}
|
|
22
|
+
function isSheetLayerOption(value) {
|
|
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
|
+
}
|
|
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 };
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region config/build.ts
|
|
31
|
+
const BUILD_CONFIG = globalData("config.build", () => ({ current: null }));
|
|
32
|
+
function setBuildConfig(config) {
|
|
33
|
+
BUILD_CONFIG.current = config;
|
|
34
|
+
RUNTIME_CONFIG.isHoist = config.hoist;
|
|
35
|
+
if (config.css) {
|
|
36
|
+
const { debugClassName: _debugClassName, ...css } = config.css;
|
|
37
|
+
Object.assign(CSS_CONFIG, css);
|
|
38
|
+
}
|
|
39
|
+
setStyleCheckOptions(config.check ?? {});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region config/config/debug.ts
|
|
43
|
+
const DEFAULT_DEBUG_CONFIG = {
|
|
44
|
+
isDebugClassNameEnabled: false,
|
|
45
|
+
isDebugClassNameConfigured: false,
|
|
46
|
+
maxPropertyLength: 24,
|
|
47
|
+
maxValueLength: 8,
|
|
48
|
+
maxSelectorLength: 8,
|
|
49
|
+
maxParentSelectorLength: 8,
|
|
50
|
+
maxAtRuleLength: 10
|
|
51
|
+
};
|
|
52
|
+
const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
|
|
53
|
+
function setDebugClassNameEnabled(value) {
|
|
54
|
+
DEBUG_CONFIG.isDebugClassNameEnabled = value;
|
|
55
|
+
DEBUG_CONFIG.isDebugClassNameConfigured = true;
|
|
56
|
+
}
|
|
57
|
+
function setDebugClassNameDefault(value) {
|
|
58
|
+
if (DEBUG_CONFIG.isDebugClassNameConfigured) return;
|
|
59
|
+
DEBUG_CONFIG.isDebugClassNameEnabled = value;
|
|
60
|
+
}
|
|
61
|
+
function setBuildDebugClassName(value, fallback) {
|
|
62
|
+
if (typeof value === "boolean") setDebugClassNameEnabled(value);
|
|
63
|
+
else setDebugClassNameDefault(fallback);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region entry/shared/prod.ts
|
|
67
|
+
RUNTIME_CONFIG.isPlugin = true;
|
|
68
|
+
RUNTIME_CONFIG.isExtracted = true;
|
|
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
|
|
90
|
+
//#region config/configure.ts
|
|
91
|
+
function configureStyleRuntime(options = {}) {
|
|
92
|
+
if (options.document !== void 0) setRuntimeDocument(options.document);
|
|
93
|
+
if (options.css) {
|
|
94
|
+
checkBuildConfig("css");
|
|
95
|
+
const { debugClassName, ...css } = options.css;
|
|
96
|
+
Object.assign(CSS_CONFIG, css);
|
|
97
|
+
if (typeof debugClassName === "boolean") setDebugClassNameEnabled(debugClassName);
|
|
98
|
+
}
|
|
99
|
+
if (options.cacheTTL !== void 0) RUNTIME_CONFIG.runtimeCacheTTL = getCacheTTL(options.cacheTTL);
|
|
100
|
+
if (options.check) {
|
|
101
|
+
checkBuildConfig("check");
|
|
102
|
+
setStyleCheckOptions(options.check);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function checkBuildConfig(field) {
|
|
106
|
+
if (!BUILD_CONFIG.current) return;
|
|
107
|
+
throw new Error(`Configure "${field}" via plugin options.`);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region utils/hash.ts
|
|
111
|
+
function hashString(str) {
|
|
112
|
+
let hash = 2166136261;
|
|
113
|
+
for (let i = 0; i < str.length; i++) hash = Math.imul(hash ^ str.charCodeAt(i), 16777619);
|
|
114
|
+
return (hash >>> 0).toString(36).padEnd(7, "0");
|
|
115
|
+
}
|
|
116
|
+
function normalizeHashLength(length) {
|
|
117
|
+
return Number.isFinite(length) ? Math.max(1, Math.floor(length)) : 7;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region utils/object.ts
|
|
121
|
+
function hasOwn(target, field) {
|
|
122
|
+
return Object.prototype.hasOwnProperty.call(target, field);
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region config/config/dev.ts
|
|
126
|
+
const DEV_CONFIG_DEFAULT = {
|
|
127
|
+
isDev: false,
|
|
128
|
+
isCheckSelectorEnabled: true,
|
|
129
|
+
isSourcemapEnabled: true,
|
|
130
|
+
isLocalClassNameEnabled: true,
|
|
131
|
+
sheetMaxRules: 1e3,
|
|
132
|
+
sheetStyleTagNonce: null,
|
|
133
|
+
hashLength: null,
|
|
134
|
+
stylePriorityMode: "sort",
|
|
135
|
+
sourcemapLocationMode: "style",
|
|
136
|
+
isElementClassNameEnabled: true
|
|
137
|
+
};
|
|
138
|
+
globalData("config.dev.isDev", () => ({ isDev: false }));
|
|
139
|
+
const DEV_CONFIG = globalData("config.dev", () => ({ ...DEV_CONFIG_DEFAULT }));
|
|
140
|
+
globalData("config.dev.plugin", () => ({ config: null }));
|
|
141
|
+
globalData("config.dev.base", () => ({ config: null }));
|
|
142
|
+
globalData("config.dev.utils", () => ({ config: null }));
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region style/important.ts
|
|
145
|
+
const STYLE_IMPORTANT = symbol("style.important");
|
|
146
|
+
function importantValue(value, native = false) {
|
|
147
|
+
return {
|
|
148
|
+
[STYLE_IMPORTANT]: true,
|
|
149
|
+
value,
|
|
150
|
+
native
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function isStyleImportantValue(value) {
|
|
154
|
+
return !!value && typeof value === "object" && value[STYLE_IMPORTANT] === true;
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region style/weight.ts
|
|
158
|
+
const STYLE_WEIGHT = symbol("style.weight");
|
|
159
|
+
function weightValue(value, weight) {
|
|
160
|
+
return {
|
|
161
|
+
[STYLE_WEIGHT]: true,
|
|
162
|
+
value,
|
|
163
|
+
weight
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function isStyleWeightValue(value) {
|
|
167
|
+
return !!value && typeof value === "object" && value[STYLE_WEIGHT] === true;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region utils/trace.ts
|
|
171
|
+
const FN_MARKER = "$fn_";
|
|
172
|
+
function traceMarker(fn, name) {
|
|
173
|
+
Object.defineProperty(fn, "name", {
|
|
174
|
+
value: FN_MARKER + name,
|
|
175
|
+
configurable: true
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const CALLSITE_REGEX = /(.+):(\d+):(\d+)$/;
|
|
179
|
+
function traceCallsite() {
|
|
180
|
+
const lines = (traceAdjustError(/* @__PURE__ */ new Error()).stack || "").split("\n");
|
|
181
|
+
const parsedFrames = lines.slice(1).map(parseStackFrame).filter((frame) => frame !== null);
|
|
182
|
+
if (!parsedFrames.length) return null;
|
|
183
|
+
const targetFrame = parsedFrames.find((frame) => !isInternalCallsite(frame.filePath)) ?? parsedFrames[0];
|
|
184
|
+
return {
|
|
185
|
+
stack: [lines[0] || "Error", createStackFrameLine(targetFrame)].join("\n"),
|
|
186
|
+
filePath: targetFrame.filePath,
|
|
187
|
+
sourceUrl: targetFrame.sourceUrl,
|
|
188
|
+
line: targetFrame.line,
|
|
189
|
+
column: targetFrame.column
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function parseStackFrame(lineText) {
|
|
193
|
+
const match = getStackFrameLocationText(lineText).match(CALLSITE_REGEX);
|
|
194
|
+
if (!match) return null;
|
|
195
|
+
const rawFilePath = normalizeCallsiteSourceUrl(match[1]);
|
|
196
|
+
return {
|
|
197
|
+
filePath: normalizeCallsiteFilePath(rawFilePath),
|
|
198
|
+
sourceUrl: isFetchableCallsiteSourceUrl(rawFilePath) ? rawFilePath : void 0,
|
|
199
|
+
line: parseInt(match[2], 10),
|
|
200
|
+
column: parseInt(match[3], 10)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function getStackFrameLocationText(lineText) {
|
|
204
|
+
let frame = lineText.trim().replace(/^at\s+/, "");
|
|
205
|
+
if (frame.endsWith(")")) {
|
|
206
|
+
const parenIndex = frame.lastIndexOf("(");
|
|
207
|
+
if (parenIndex !== -1) frame = frame.slice(parenIndex + 1, -1);
|
|
208
|
+
}
|
|
209
|
+
return frame;
|
|
210
|
+
}
|
|
211
|
+
function normalizeCallsiteSourceUrl(source) {
|
|
212
|
+
let filePath = source.trim();
|
|
213
|
+
try {
|
|
214
|
+
filePath = decodeURI(filePath);
|
|
215
|
+
} catch {}
|
|
216
|
+
if (filePath.startsWith("source:///at ") || filePath.startsWith("source:///at%20")) filePath = filePath.slice(10);
|
|
217
|
+
const strayAtMatch = filePath.match(/(?:^|\/)at\s+([a-zA-Z][a-zA-Z\d+.-]*:\/\/.+|\/.+)$/);
|
|
218
|
+
return strayAtMatch ? strayAtMatch[1] : filePath.replace(/^at\s+/, "");
|
|
219
|
+
}
|
|
220
|
+
function normalizeCallsiteFilePath(filePath) {
|
|
221
|
+
filePath = normalizeCallsiteSourceUrl(filePath);
|
|
222
|
+
const queryIndex = findFirstIndex(filePath, ["?", "#"]);
|
|
223
|
+
if (queryIndex !== -1) filePath = filePath.substring(0, queryIndex);
|
|
224
|
+
filePath = filePath.replace(/^file:\/\/\/?/, "");
|
|
225
|
+
if (filePath.startsWith("/@fs/")) filePath = "/" + filePath.slice(5);
|
|
226
|
+
const webpackInternalMatch = filePath.match(/^webpack-internal:\/\/\/(?:\([^)]+\)\/)?(.+)$/);
|
|
227
|
+
if (webpackInternalMatch) filePath = webpackInternalMatch[1];
|
|
228
|
+
const webpackSourceMatch = filePath.match(/^webpack:\/\/[^/]+\/(.+)$/);
|
|
229
|
+
if (webpackSourceMatch) filePath = webpackSourceMatch[1];
|
|
230
|
+
return filePath;
|
|
231
|
+
}
|
|
232
|
+
function isFetchableCallsiteSourceUrl(filePath) {
|
|
233
|
+
return /^https?:\/\//.test(filePath) || filePath.startsWith("/");
|
|
234
|
+
}
|
|
235
|
+
function findFirstIndex(text, needles) {
|
|
236
|
+
let index = -1;
|
|
237
|
+
for (const needle of needles) {
|
|
238
|
+
const next = text.indexOf(needle);
|
|
239
|
+
if (next !== -1 && (index === -1 || next < index)) index = next;
|
|
240
|
+
}
|
|
241
|
+
return index;
|
|
242
|
+
}
|
|
243
|
+
function createStackFrameLine(frame) {
|
|
244
|
+
return ` at ${frame.filePath}:${frame.line}:${frame.column}`;
|
|
245
|
+
}
|
|
246
|
+
function isInternalCallsite(filePath) {
|
|
247
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
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.");
|
|
249
|
+
}
|
|
250
|
+
function traceError(message, options = {}) {
|
|
251
|
+
const error = new Error(message || "");
|
|
252
|
+
error.name = options.name || "StyleError";
|
|
253
|
+
if (typeof options.stack === "string") {
|
|
254
|
+
error.stack = options.stack;
|
|
255
|
+
return error;
|
|
256
|
+
}
|
|
257
|
+
return traceAdjustError(error, options);
|
|
258
|
+
}
|
|
259
|
+
function traceAdjustError(error, options = {}) {
|
|
260
|
+
const offset = options.offset ?? 0;
|
|
261
|
+
const stack = error.stack;
|
|
262
|
+
if (!stack) return error;
|
|
263
|
+
const lines = stack.split("\n");
|
|
264
|
+
const markerIndex = lines.findIndex((line) => line.includes(FN_MARKER));
|
|
265
|
+
if (markerIndex === -1) return error;
|
|
266
|
+
const traced = new Error(error.message);
|
|
267
|
+
traced.name = error.name;
|
|
268
|
+
const frameStartIndex = Math.max(markerIndex + 1 + offset, 1);
|
|
269
|
+
let frames = lines.slice(frameStartIndex);
|
|
270
|
+
if (options.limit) frames = frames.slice(0, options.limit);
|
|
271
|
+
traced.stack = [lines[0], ...frames].join("\n");
|
|
272
|
+
return traced;
|
|
273
|
+
}
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region builder/data/create.ts
|
|
276
|
+
function createStyleData(callsite) {
|
|
277
|
+
return {
|
|
278
|
+
[BUILDER_TYPE]: 1,
|
|
279
|
+
[BUILDER_STATE]: {
|
|
280
|
+
items: [],
|
|
281
|
+
lookup: {}
|
|
282
|
+
},
|
|
283
|
+
[BUILDER_CALLSITE]: callsite
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function createSheetData(callsite, options = {}) {
|
|
287
|
+
return {
|
|
288
|
+
[BUILDER_TYPE]: 9,
|
|
289
|
+
[BUILDER_STATE]: {
|
|
290
|
+
items: [],
|
|
291
|
+
lookup: {}
|
|
292
|
+
},
|
|
293
|
+
[BUILDER_CALLSITE]: callsite,
|
|
294
|
+
[BUILDER_SHEET_OPTIONS]: options
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function createSlotData(callsite, slotId) {
|
|
298
|
+
return {
|
|
299
|
+
[BUILDER_TYPE]: 2,
|
|
300
|
+
[BUILDER_STATE]: {
|
|
301
|
+
items: [],
|
|
302
|
+
lookup: {}
|
|
303
|
+
},
|
|
304
|
+
[BUILDER_CALLSITE]: callsite,
|
|
305
|
+
[BUILDER_SLOT_ID]: slotId
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function createSlotOverrideData(callsite, slotId) {
|
|
309
|
+
return {
|
|
310
|
+
[BUILDER_TYPE]: 3,
|
|
311
|
+
[BUILDER_STATE]: {
|
|
312
|
+
items: [],
|
|
313
|
+
lookup: {}
|
|
314
|
+
},
|
|
315
|
+
[BUILDER_CALLSITE]: callsite,
|
|
316
|
+
[BUILDER_SLOT_ID]: slotId
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function createSelectorOverrideData(callsite, selectors) {
|
|
320
|
+
return {
|
|
321
|
+
[BUILDER_TYPE]: 8,
|
|
322
|
+
[BUILDER_STATE]: {
|
|
323
|
+
items: [],
|
|
324
|
+
lookup: {}
|
|
325
|
+
},
|
|
326
|
+
[BUILDER_CALLSITE]: callsite,
|
|
327
|
+
[BUILDER_SELECTOR]: selectors
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function createSelectorData(callsite, selectors) {
|
|
331
|
+
return {
|
|
332
|
+
[BUILDER_TYPE]: 7,
|
|
333
|
+
[BUILDER_STATE]: {
|
|
334
|
+
items: [],
|
|
335
|
+
lookup: {}
|
|
336
|
+
},
|
|
337
|
+
[BUILDER_CALLSITE]: callsite,
|
|
338
|
+
[BUILDER_SELECTOR]: selectors
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function createScopeData(callsite) {
|
|
342
|
+
return {
|
|
343
|
+
[BUILDER_TYPE]: 4,
|
|
344
|
+
[BUILDER_STATE]: {
|
|
345
|
+
items: [],
|
|
346
|
+
lookup: {}
|
|
347
|
+
},
|
|
348
|
+
[BUILDER_CALLSITE]: callsite
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function createScopeTargetData(scope, slot) {
|
|
352
|
+
return {
|
|
353
|
+
[BUILDER_TYPE]: 5,
|
|
354
|
+
[BUILDER_SCOPE]: scope,
|
|
355
|
+
[BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function createThemeData(callsite, id, className, tokens) {
|
|
359
|
+
return {
|
|
360
|
+
[BUILDER_TYPE]: 6,
|
|
361
|
+
[BUILDER_STATE]: {
|
|
362
|
+
items: [],
|
|
363
|
+
lookup: {}
|
|
364
|
+
},
|
|
365
|
+
[BUILDER_CALLSITE]: callsite,
|
|
366
|
+
id,
|
|
367
|
+
className,
|
|
368
|
+
tokens
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function isDebugData(value) {
|
|
372
|
+
if (!value || typeof value !== "object") return false;
|
|
373
|
+
const data = value;
|
|
374
|
+
return data.$$debug === true && Array.isArray(data.loc) && Array.isArray(data.label);
|
|
375
|
+
}
|
|
376
|
+
function getDebugCallsiteId(debug) {
|
|
377
|
+
const label = debug.label[0] || debug.label[1];
|
|
378
|
+
if (!label) return null;
|
|
379
|
+
const hash = debug.sourceUrl + "\n" + debug.loc[0] + ":" + debug.loc[1] + "\n" + (debug.label[1] || label);
|
|
380
|
+
return label + "_" + hashString(hash);
|
|
381
|
+
}
|
|
382
|
+
function getTraceCallsiteId(callsite) {
|
|
383
|
+
return hashString(callsite.filePath + "\n" + callsite.line + ":" + callsite.column);
|
|
384
|
+
}
|
|
385
|
+
function getDebugCallsite(debug) {
|
|
386
|
+
return createDebugCallsite(debug.loc, debug);
|
|
387
|
+
}
|
|
388
|
+
function getDebugFieldCallsite(debug, field) {
|
|
389
|
+
if (!debug) return null;
|
|
390
|
+
const loc = getDebugFieldLoc(debug, field);
|
|
391
|
+
return loc ? createDebugCallsite(loc, debug) : null;
|
|
392
|
+
}
|
|
393
|
+
function getDebugFieldLoc(debug, field) {
|
|
394
|
+
const loc = debug?.fields?.[field];
|
|
395
|
+
if (!loc) return null;
|
|
396
|
+
if (Array.isArray(loc)) return loc;
|
|
397
|
+
return loc[DEV_CONFIG.sourcemapLocationMode === "value" ? 1 : 0] ?? loc[0] ?? loc[1] ?? null;
|
|
398
|
+
}
|
|
399
|
+
function createDebugCallsite(loc, debug) {
|
|
400
|
+
const [line, column] = loc;
|
|
401
|
+
const sourceUrl = loc[3] ?? debug.sourceUrl;
|
|
402
|
+
const sourceContent = loc[4] ?? debug.code;
|
|
403
|
+
return {
|
|
404
|
+
stack: `Error\n at ${sourceUrl}:${line}:${column}`,
|
|
405
|
+
filePath: sourceUrl,
|
|
406
|
+
sourceUrl,
|
|
407
|
+
sourceContent,
|
|
408
|
+
line,
|
|
409
|
+
column
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region builder/data/is.ts
|
|
414
|
+
function getSlotId(data) {
|
|
415
|
+
return data[BUILDER_SLOT_ID];
|
|
416
|
+
}
|
|
417
|
+
function getScopeTargetSlotId(data) {
|
|
418
|
+
return data[BUILDER_SCOPE_ID];
|
|
419
|
+
}
|
|
420
|
+
function getScopeTargetScope(data) {
|
|
421
|
+
return data[BUILDER_SCOPE];
|
|
422
|
+
}
|
|
423
|
+
function getSelectorSelectors(data) {
|
|
424
|
+
return data[BUILDER_SELECTOR];
|
|
425
|
+
}
|
|
426
|
+
function isStyleData(value) {
|
|
427
|
+
return getBuilderType(value) === 1;
|
|
428
|
+
}
|
|
429
|
+
function isSlotData(value) {
|
|
430
|
+
return getBuilderType(value) === 2;
|
|
431
|
+
}
|
|
432
|
+
function isSlotOverrideData(value) {
|
|
433
|
+
return getBuilderType(value) === 3;
|
|
434
|
+
}
|
|
435
|
+
function isSelectorData(value) {
|
|
436
|
+
return getBuilderType(value) === 7;
|
|
437
|
+
}
|
|
438
|
+
function isSelectorOverrideData(value) {
|
|
439
|
+
return getBuilderType(value) === 8;
|
|
440
|
+
}
|
|
441
|
+
function isSheetData(value) {
|
|
442
|
+
return getBuilderType(value) === 9;
|
|
443
|
+
}
|
|
444
|
+
function isScopeData(value) {
|
|
445
|
+
return getBuilderType(value) === 4;
|
|
446
|
+
}
|
|
447
|
+
function isScopeTargetData(value) {
|
|
448
|
+
return getBuilderType(value) === 5;
|
|
449
|
+
}
|
|
450
|
+
function isThemeData(value) {
|
|
451
|
+
return getBuilderType(value) === 6;
|
|
452
|
+
}
|
|
453
|
+
function getBuilderType(value) {
|
|
454
|
+
if (!value || typeof value !== "object" && typeof value !== "function") return null;
|
|
455
|
+
return value[BUILDER_TYPE];
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region atomic/utils/format.ts
|
|
459
|
+
const TOKEN_REGEX = /\(([a-zA-Z][a-zA-Z0-9]*)(?::([0-9]+)(!)?)?\)/g;
|
|
460
|
+
const OPTIONAL_REGEX = /\[([^[\]]*)\]/g;
|
|
461
|
+
const HASH_TOKEN = "$hash";
|
|
462
|
+
function createNameFormatter(keys) {
|
|
463
|
+
const keySet = new Set(keys);
|
|
464
|
+
const cache = /* @__PURE__ */ new Map();
|
|
465
|
+
function getFormatFn(format) {
|
|
466
|
+
if (typeof format === "function") return format;
|
|
467
|
+
let fn = cache.get(format);
|
|
468
|
+
if (!fn) {
|
|
469
|
+
fn = compileFormat(format, keySet);
|
|
470
|
+
cache.set(format, fn);
|
|
471
|
+
}
|
|
472
|
+
return fn;
|
|
473
|
+
}
|
|
474
|
+
return function format(format, hash, info) {
|
|
475
|
+
const name = getFormatFn(format)(info);
|
|
476
|
+
if (!hash) return name;
|
|
477
|
+
if (name.includes(HASH_TOKEN)) return name.replace(HASH_TOKEN, hash);
|
|
478
|
+
return name ? name + "--" + hash : hash;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function compileFormat(format, keySet) {
|
|
482
|
+
const segments = compileSegments(format, keySet);
|
|
483
|
+
return (info) => {
|
|
484
|
+
let name = "";
|
|
485
|
+
for (const segment of segments) {
|
|
486
|
+
const text = formatSegment(info, segment);
|
|
487
|
+
if (text === null) {
|
|
488
|
+
if (!segment.optional) return "";
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
name += text;
|
|
492
|
+
}
|
|
493
|
+
return name;
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
function compileSegments(format, keySet) {
|
|
497
|
+
const segments = [];
|
|
498
|
+
let lastIndex = 0;
|
|
499
|
+
for (const match of format.matchAll(OPTIONAL_REGEX)) {
|
|
500
|
+
const index = match.index ?? 0;
|
|
501
|
+
if (index > lastIndex) segments.push({
|
|
502
|
+
optional: false,
|
|
503
|
+
parts: compileParts(format.slice(lastIndex, index), keySet)
|
|
504
|
+
});
|
|
505
|
+
segments.push({
|
|
506
|
+
optional: true,
|
|
507
|
+
parts: compileParts(match[1], keySet)
|
|
508
|
+
});
|
|
509
|
+
lastIndex = index + match[0].length;
|
|
510
|
+
}
|
|
511
|
+
if (lastIndex < format.length) segments.push({
|
|
512
|
+
optional: false,
|
|
513
|
+
parts: compileParts(format.slice(lastIndex), keySet)
|
|
514
|
+
});
|
|
515
|
+
return segments;
|
|
516
|
+
}
|
|
517
|
+
function compileParts(segment, keySet) {
|
|
518
|
+
const parts = [];
|
|
519
|
+
let lastIndex = 0;
|
|
520
|
+
for (const match of segment.matchAll(TOKEN_REGEX)) {
|
|
521
|
+
const index = match.index ?? 0;
|
|
522
|
+
const key = match[1];
|
|
523
|
+
if (!keySet.has(key)) continue;
|
|
524
|
+
if (index > lastIndex) parts.push({
|
|
525
|
+
type: "text",
|
|
526
|
+
value: segment.slice(lastIndex, index)
|
|
527
|
+
});
|
|
528
|
+
parts.push({
|
|
529
|
+
type: "token",
|
|
530
|
+
key,
|
|
531
|
+
maxLength: match[2] ? Number(match[2]) : null,
|
|
532
|
+
truncate: Boolean(match[3])
|
|
533
|
+
});
|
|
534
|
+
lastIndex = index + match[0].length;
|
|
535
|
+
}
|
|
536
|
+
if (lastIndex < segment.length) parts.push({
|
|
537
|
+
type: "text",
|
|
538
|
+
value: segment.slice(lastIndex)
|
|
539
|
+
});
|
|
540
|
+
return parts;
|
|
541
|
+
}
|
|
542
|
+
function formatSegment(info, segment) {
|
|
543
|
+
let text = "";
|
|
544
|
+
for (const part of segment.parts) {
|
|
545
|
+
if (part.type === "text") {
|
|
546
|
+
text += part.value;
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
const value = formatTokenValue(info[part.key], part.maxLength, part.truncate);
|
|
550
|
+
if (value === null) {
|
|
551
|
+
if (segment.optional) return null;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
text += value;
|
|
555
|
+
}
|
|
556
|
+
return text;
|
|
557
|
+
}
|
|
558
|
+
function formatTokenValue(value, maxLength, truncate) {
|
|
559
|
+
if (!value) return null;
|
|
560
|
+
if (!maxLength) return value;
|
|
561
|
+
if (!Number.isFinite(maxLength) || maxLength < 0 || value.length <= maxLength) return value;
|
|
562
|
+
return truncate ? value.slice(0, maxLength) : null;
|
|
563
|
+
}
|
|
564
|
+
const formatClassName = createNameFormatter([
|
|
565
|
+
"atRule",
|
|
566
|
+
"scopeSelector",
|
|
567
|
+
"property",
|
|
568
|
+
"selector",
|
|
569
|
+
"value"
|
|
570
|
+
]);
|
|
571
|
+
const formatTransformClassName = createNameFormatter(["className"]);
|
|
572
|
+
function getDebugClassName(format, hash, info) {
|
|
573
|
+
return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
|
|
574
|
+
}
|
|
575
|
+
function getDebugSheetClassName(format, hash, info) {
|
|
576
|
+
return formatClassName(format || "sheet-(property)[-(value)]--$hash", hash, info);
|
|
577
|
+
}
|
|
578
|
+
function getDebugTransformClassName(format, hash, info) {
|
|
579
|
+
return formatTransformClassName(format || "(className)--$hash", hash, info);
|
|
580
|
+
}
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region atomic/utils/cssIdent.ts
|
|
583
|
+
function escapeCssIdent(ident) {
|
|
584
|
+
let result = "";
|
|
585
|
+
for (let i = 0; i < ident.length; i++) {
|
|
586
|
+
const char = ident.charAt(i);
|
|
587
|
+
const code = ident.charCodeAt(i);
|
|
588
|
+
const nextCode = ident.charCodeAt(i + 1);
|
|
589
|
+
if (code === 0) {
|
|
590
|
+
result += "�";
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
if (code >= 1 && code <= 31 || code === 127 || i === 0 && code >= 48 && code <= 57 || i === 1 && code >= 48 && code <= 57 && ident.charCodeAt(0) === 45) {
|
|
594
|
+
result += "\\" + code.toString(16) + " ";
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
if (i === 0 && code === 45 && ident.length === 1) {
|
|
598
|
+
result += "\\-";
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
if (code >= 55296 && code <= 56319 && nextCode >= 56320 && nextCode <= 57343) {
|
|
602
|
+
result += char + ident.charAt(++i);
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
if (code >= 128 || code === 45 || code === 95 || code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
606
|
+
result += char;
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
result += "\\" + char;
|
|
610
|
+
}
|
|
611
|
+
return result;
|
|
612
|
+
}
|
|
613
|
+
function sanitizeCssIdentName(value, fallback = "") {
|
|
614
|
+
return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || fallback;
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region atomic/utils/debug.ts
|
|
618
|
+
function normalizeDebugKeywordValue(value) {
|
|
619
|
+
const normalized = value.trim().toLowerCase();
|
|
620
|
+
return /^[a-z][a-z0-9-]*$/.test(normalized) ? normalized : null;
|
|
621
|
+
}
|
|
622
|
+
function sanitizeDebugName(value) {
|
|
623
|
+
if (!value) return "";
|
|
624
|
+
return sanitizeCssIdentName(value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), "");
|
|
625
|
+
}
|
|
626
|
+
function normalizePropertyName(property) {
|
|
627
|
+
return property.trim().replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
628
|
+
}
|
|
629
|
+
function sanitizeDebugPropertyName(property) {
|
|
630
|
+
let name = property;
|
|
631
|
+
if (name.charCodeAt(0) === 45 && name.charCodeAt(1) === 45) name = name.slice(2);
|
|
632
|
+
return name.replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
633
|
+
}
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region atomic/debug/value.ts
|
|
636
|
+
function getDebugValueName(value) {
|
|
637
|
+
if (!value) return {
|
|
638
|
+
value: null,
|
|
639
|
+
arbitraryValue: null
|
|
640
|
+
};
|
|
641
|
+
const normalized = value.trim().toLowerCase();
|
|
642
|
+
if (!normalized) return {
|
|
643
|
+
value: null,
|
|
644
|
+
arbitraryValue: null
|
|
645
|
+
};
|
|
646
|
+
if (normalized.startsWith("url") || normalized.includes("gradient") || normalized.startsWith("image") || normalized.startsWith("calc(") || normalized.startsWith("var(") || normalized.startsWith("env(") || normalized.startsWith("rgb") || normalized.startsWith("hsl")) return {
|
|
647
|
+
value: null,
|
|
648
|
+
arbitraryValue: null
|
|
649
|
+
};
|
|
650
|
+
if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
|
|
651
|
+
value: normalized,
|
|
652
|
+
arbitraryValue: null
|
|
653
|
+
};
|
|
654
|
+
const name = normalized.replace(/px/g, "").replace(/rem/g, "rem").replace(/em/g, "em").replace(/%/g, "pct").replace(/fr/g, "fr").replace(/[,()"'#]/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9._%-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
655
|
+
if (!name) return {
|
|
656
|
+
value: null,
|
|
657
|
+
arbitraryValue: null
|
|
658
|
+
};
|
|
659
|
+
return {
|
|
660
|
+
value: null,
|
|
661
|
+
arbitraryValue: name
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region atomic/debug/property/data.ts
|
|
666
|
+
const PROPERTY_ALIASES = {
|
|
667
|
+
"border-radius": "radius",
|
|
668
|
+
"flex-direction": "flex",
|
|
669
|
+
"font-style": "font",
|
|
670
|
+
"font-weight": "font",
|
|
671
|
+
"grid-template-columns": "grid-cols",
|
|
672
|
+
"grid-template-rows": "grid-rows",
|
|
673
|
+
"align-items": "items",
|
|
674
|
+
"justify-content": "justify",
|
|
675
|
+
"z-index": "zindex",
|
|
676
|
+
"pointer-events": "pointer"
|
|
677
|
+
};
|
|
678
|
+
const KEYWORD_VALUE_PROPERTIES = new Set([
|
|
679
|
+
"align-content",
|
|
680
|
+
"align-items",
|
|
681
|
+
"align-self",
|
|
682
|
+
"background-repeat",
|
|
683
|
+
"background-size",
|
|
684
|
+
"border-collapse",
|
|
685
|
+
"border-style",
|
|
686
|
+
"box-sizing",
|
|
687
|
+
"clear",
|
|
688
|
+
"cursor",
|
|
689
|
+
"display",
|
|
690
|
+
"flex-direction",
|
|
691
|
+
"flex-wrap",
|
|
692
|
+
"float",
|
|
693
|
+
"font-weight",
|
|
694
|
+
"font-style",
|
|
695
|
+
"justify-content",
|
|
696
|
+
"justify-items",
|
|
697
|
+
"justify-self",
|
|
698
|
+
"list-style-position",
|
|
699
|
+
"list-style-type",
|
|
700
|
+
"object-fit",
|
|
701
|
+
"object-position",
|
|
702
|
+
"overflow",
|
|
703
|
+
"overflow-x",
|
|
704
|
+
"overflow-y",
|
|
705
|
+
"pointer-events",
|
|
706
|
+
"place-content",
|
|
707
|
+
"place-items",
|
|
708
|
+
"place-self",
|
|
709
|
+
"position",
|
|
710
|
+
"resize",
|
|
711
|
+
"table-layout",
|
|
712
|
+
"text-align",
|
|
713
|
+
"text-decoration-line",
|
|
714
|
+
"text-transform",
|
|
715
|
+
"user-select",
|
|
716
|
+
"vertical-align",
|
|
717
|
+
"visibility",
|
|
718
|
+
"white-space"
|
|
719
|
+
]);
|
|
720
|
+
const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region atomic/debug/property/property.ts
|
|
723
|
+
function getDebugPropertyName(property, value) {
|
|
724
|
+
if (!property) return null;
|
|
725
|
+
const normalized = normalizePropertyName(property);
|
|
726
|
+
const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
|
|
727
|
+
if (!name) return null;
|
|
728
|
+
return {
|
|
729
|
+
property: name,
|
|
730
|
+
...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function withArbitraryValueFallback(property, valueName) {
|
|
734
|
+
if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
|
|
735
|
+
return {
|
|
736
|
+
value: valueName.value,
|
|
737
|
+
arbitraryValue: null
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function withKeywordValueFallback(property, value, valueName) {
|
|
741
|
+
if (valueName.value || valueName.arbitraryValue) return valueName;
|
|
742
|
+
if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
|
|
743
|
+
const normalized = normalizeDebugKeywordValue(value);
|
|
744
|
+
if (!normalized) return valueName;
|
|
745
|
+
return {
|
|
746
|
+
value: normalized,
|
|
747
|
+
arbitraryValue: null
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region atomic/debug/selector.ts
|
|
752
|
+
function getDebugSelectorName(selector) {
|
|
753
|
+
if (!selector) return null;
|
|
754
|
+
const normalized = selector.trim().toLowerCase();
|
|
755
|
+
if (/^[a-z0-9]+$/.test(normalized)) return null;
|
|
756
|
+
return validateName(normalized.replace(/\$\$/g, "args").replace(/\$/g, "arg").replace(/\.\.\./g, "merge").replace(/:not\(/g, "not-").replace(/:(is|where|has)\(/g, "$1-").replace(/:nth-(child|of-type)\(/g, "nth-").replace(/[.#]/g, "-").replace(/[[\]()]/g, "-").replace(/:+/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
757
|
+
}
|
|
758
|
+
function getDebugAtRuleName(selector) {
|
|
759
|
+
if (!selector || Array.isArray(selector) && selector.length === 0) return null;
|
|
760
|
+
return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
761
|
+
}
|
|
762
|
+
function compressQuery(query) {
|
|
763
|
+
return query.trim().toLowerCase().replace(/prefers-color-scheme\s*:\s*dark/g, "dark").replace(/prefers-color-scheme\s*:\s*light/g, "light").replace(/min-width\s*:\s*/g, "min-").replace(/max-width\s*:\s*/g, "max-").replace(/min-height\s*:\s*/g, "minh-").replace(/max-height\s*:\s*/g, "maxh-").replace(/inline-size/g, "inline").replace(/\b(and|or|only|not)\b/g, "").replace(/>=/g, "-gte-").replace(/<=/g, "-lte-").replace(/>/g, "-gt-").replace(/</g, "-lt-").replace(/[():=\s]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
764
|
+
}
|
|
765
|
+
function validateName(name) {
|
|
766
|
+
if (!name || name === "selector" || name.length < 2) return null;
|
|
767
|
+
return name;
|
|
768
|
+
}
|
|
769
|
+
function parseAtRule(rule) {
|
|
770
|
+
const normalized = rule.trim().toLowerCase();
|
|
771
|
+
if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
|
|
772
|
+
if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
|
|
773
|
+
if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
|
|
774
|
+
return compressQuery(normalized);
|
|
775
|
+
}
|
|
776
|
+
function getScopeClassName(className, scopeClassNameFormat) {
|
|
777
|
+
return formatScopeClassName$1(scopeClassNameFormat || "-(className)", { className });
|
|
778
|
+
}
|
|
779
|
+
function formatScopeClassName$1(format, info) {
|
|
780
|
+
if (typeof format === "function") return format(info);
|
|
781
|
+
return format.replace(/\[|\]/g, "").replace(/\(className\)/g, info.className);
|
|
782
|
+
}
|
|
783
|
+
//#endregion
|
|
784
|
+
//#region atomic/utils/hash.ts
|
|
785
|
+
function getIdentifierSafeHash(value, startLength = 7) {
|
|
786
|
+
const normalizedStartLength = normalizeHashLength(startLength);
|
|
787
|
+
return getIdentifierSafeHashValue(hashString(value)).slice(0, normalizedStartLength);
|
|
788
|
+
}
|
|
789
|
+
function getIdentifierSafeHashValue(hash) {
|
|
790
|
+
const first = hash.charCodeAt(0);
|
|
791
|
+
if (first < 48 || first > 57) return hash;
|
|
792
|
+
return String.fromCharCode(97 + first - 48) + hash.slice(1);
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region atomic/utils/selector.ts
|
|
796
|
+
function getSelectorText$1(selector) {
|
|
797
|
+
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
798
|
+
if (text.startsWith("\0global")) return text.slice(text.indexOf("\0", GLOBAL_SHEET_SELECTOR_ANCHOR.length) + 1);
|
|
799
|
+
return stripSheetSelectorAnchor(text);
|
|
800
|
+
}
|
|
801
|
+
function getSelectorHash(selector) {
|
|
802
|
+
return Array.isArray(selector) ? selector.join("|") : selector;
|
|
803
|
+
}
|
|
804
|
+
function getSelectorPriority$1(selector) {
|
|
805
|
+
if (!selector) return 0;
|
|
806
|
+
return Array.isArray(selector) ? selector[1] : 0;
|
|
807
|
+
}
|
|
808
|
+
function hasSheetSelectorAnchor(selector) {
|
|
809
|
+
return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(SHEET_SELECTOR_ANCHOR);
|
|
810
|
+
}
|
|
811
|
+
function getSheetSelectorSpecificity(selector) {
|
|
812
|
+
const text = selector ? Array.isArray(selector) ? selector[0] : selector : "";
|
|
813
|
+
if (!text.startsWith("\0sheet:")) return null;
|
|
814
|
+
const end = text.indexOf("\0", SHEET_SELECTOR_ANCHOR.length);
|
|
815
|
+
if (end < 0) return null;
|
|
816
|
+
const [weightValue] = text.slice(SHEET_SELECTOR_ANCHOR.length + 1, end).split(":");
|
|
817
|
+
if (!weightValue) return null;
|
|
818
|
+
const weight = Number(weightValue);
|
|
819
|
+
return Number.isInteger(weight) && weight >= 0 ? weight : null;
|
|
820
|
+
}
|
|
821
|
+
function stripSheetSelectorAnchor(selector) {
|
|
822
|
+
if (!selector.startsWith("\0sheet")) return selector;
|
|
823
|
+
if (selector.startsWith("\0sheet:")) {
|
|
824
|
+
const end = selector.indexOf("\0", SHEET_SELECTOR_ANCHOR.length);
|
|
825
|
+
if (end >= 0) return selector.slice(end + 1);
|
|
826
|
+
}
|
|
827
|
+
return selector.slice(SHEET_SELECTOR_ANCHOR.length);
|
|
828
|
+
}
|
|
829
|
+
function hasGlobalSheetSelectorAnchor(selector) {
|
|
830
|
+
return (selector ? Array.isArray(selector) ? selector[0] : selector : "").startsWith(GLOBAL_SHEET_SELECTOR_ANCHOR);
|
|
831
|
+
}
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region atomic/className.ts
|
|
834
|
+
function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null, importantNative = false) {
|
|
835
|
+
let hash = property;
|
|
836
|
+
hash += "\n" + (priority || "");
|
|
837
|
+
if (important) hash += "\nimportant";
|
|
838
|
+
if (importantNative) hash += "\nnative-important";
|
|
839
|
+
hash += "\n" + value;
|
|
840
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
841
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
842
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
843
|
+
hash += "\n" + getCallsiteHash(callsite, localClassName);
|
|
844
|
+
hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
|
|
845
|
+
if (!debugClassName) return hash;
|
|
846
|
+
if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
|
|
847
|
+
const propertyName = getDebugPropertyName(property, value);
|
|
848
|
+
const isSheetClassName = hasSheetSelectorAnchor(selector);
|
|
849
|
+
return (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(isSheetClassName ? sheetClassNameFormat : classNameFormat, hash, {
|
|
850
|
+
atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText$1)) : null,
|
|
851
|
+
scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText$1(parentSelector)) : null,
|
|
852
|
+
selector: selector ? getDebugSelectorName(getSelectorText$1(selector)) : null,
|
|
853
|
+
property: propertyName ? propertyName.property : property,
|
|
854
|
+
value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
function getRuntimeClassNameHashLength(debugClassName) {
|
|
858
|
+
return getClassNameHashLength({
|
|
859
|
+
debugClassName,
|
|
860
|
+
isDev: DEV_CONFIG.isDev,
|
|
861
|
+
devHashLength: DEV_CONFIG.hashLength,
|
|
862
|
+
cssHashLength: CSS_CONFIG.hashLength
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
function getClassNameHashLength(options) {
|
|
866
|
+
if (options.debugClassName && options.isDev) return options.devHashLength ?? options.cssHashLength ?? 5;
|
|
867
|
+
return options.cssHashLength ?? 7;
|
|
868
|
+
}
|
|
869
|
+
function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule, importantNative = false) {
|
|
870
|
+
let hash = property;
|
|
871
|
+
hash += "\n" + (priority || "");
|
|
872
|
+
if (important) hash += "\nimportant";
|
|
873
|
+
if (importantNative) hash += "\nnative-important";
|
|
874
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
875
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
876
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
877
|
+
return hashString(hash);
|
|
878
|
+
}
|
|
879
|
+
function getCallsiteHash(callsite, localClassName) {
|
|
880
|
+
if (!localClassName || !callsite) return "";
|
|
881
|
+
return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
|
|
882
|
+
}
|
|
883
|
+
//#endregion
|
|
884
|
+
//#region builder/token/name.ts
|
|
885
|
+
function getStyleTokenNameFromId(id) {
|
|
886
|
+
if (!id) return null;
|
|
887
|
+
const parts = id.split("--");
|
|
888
|
+
const first = normalizeStyleTokenName(parts[0]);
|
|
889
|
+
if (!first) return parts.length > 1 ? normalizeStyleTokenName(parts.slice(1).join("--")) : null;
|
|
890
|
+
return normalizeStyleTokenName([first, ...parts.slice(1)].join("--"));
|
|
891
|
+
}
|
|
892
|
+
function getChildStyleTokenName(name, child) {
|
|
893
|
+
const childName = normalizeStyleTokenName(child);
|
|
894
|
+
if (!childName) return normalizeStyleTokenName(name);
|
|
895
|
+
const parentName = normalizeStyleTokenName(name);
|
|
896
|
+
return parentName ? parentName + "--" + childName : childName;
|
|
897
|
+
}
|
|
898
|
+
function normalizeStyleTokenName(value) {
|
|
899
|
+
if (!value) return null;
|
|
900
|
+
value = value.trim();
|
|
901
|
+
if (!value) return null;
|
|
902
|
+
if (/^\d+$/.test(value)) return null;
|
|
903
|
+
if (isGeneratedTokenHash(value)) return null;
|
|
904
|
+
value = stripGenericTokenPrefix(value);
|
|
905
|
+
if (!value) return null;
|
|
906
|
+
const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
|
|
907
|
+
if (stableSuffix?.[1] && isGeneratedTokenHash(value.slice(-7))) return normalizeStyleTokenName(stableSuffix[1]);
|
|
908
|
+
return value;
|
|
909
|
+
}
|
|
910
|
+
function isGeneratedTokenHash(value) {
|
|
911
|
+
return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
|
|
912
|
+
}
|
|
913
|
+
function stripGenericTokenPrefix(value) {
|
|
914
|
+
const parts = value.split("--");
|
|
915
|
+
while (parts[0] === "token" || parts[0] === "tokens") parts.shift();
|
|
916
|
+
return parts.join("--");
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region style/token.ts
|
|
920
|
+
const TOKEN_DEBUG = symbol("style:token.debug");
|
|
921
|
+
const idCounter$6 = globalData("style.token.idCounter", () => ({ value: 0 }));
|
|
922
|
+
function resetStyleTokenIdCounter() {
|
|
923
|
+
idCounter$6.value = 0;
|
|
924
|
+
}
|
|
925
|
+
function createStyleToken(value, stableId, debugName) {
|
|
926
|
+
const token = (value, debug) => {
|
|
927
|
+
return createStyleTokenOverride(token, value, debug);
|
|
928
|
+
};
|
|
929
|
+
token[TOKEN_ID] = stableId || String(idCounter$6.value++);
|
|
930
|
+
token[TOKEN_NAME] = debugName === void 0 ? getStyleTokenNameFromId(stableId) : normalizeStyleTokenName(debugName);
|
|
931
|
+
if (isStyleTokenData(value)) {
|
|
932
|
+
token.value = value.value;
|
|
933
|
+
token.ref = value;
|
|
934
|
+
} else {
|
|
935
|
+
token.value = value;
|
|
936
|
+
token.ref = null;
|
|
937
|
+
}
|
|
938
|
+
return token;
|
|
939
|
+
}
|
|
940
|
+
function createStyleTokenOverride(token, value, debug) {
|
|
941
|
+
const override = isStyleTokenData(value) ? {
|
|
942
|
+
[TOKEN_ID]: getStyleTokenId(token),
|
|
943
|
+
[TOKEN_OVERRIDE]: true,
|
|
944
|
+
[TOKEN_NAME]: getStyleTokenName(token),
|
|
945
|
+
[TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
|
|
946
|
+
value: value.value,
|
|
947
|
+
ref: value
|
|
948
|
+
} : {
|
|
949
|
+
[TOKEN_ID]: getStyleTokenId(token),
|
|
950
|
+
[TOKEN_OVERRIDE]: true,
|
|
951
|
+
[TOKEN_NAME]: getStyleTokenName(token),
|
|
952
|
+
[TOKEN_VAR_NAME]: token[TOKEN_VAR_NAME] ?? null,
|
|
953
|
+
value,
|
|
954
|
+
ref: null
|
|
955
|
+
};
|
|
956
|
+
if (debug) Object.defineProperty(override, TOKEN_DEBUG, {
|
|
957
|
+
configurable: true,
|
|
958
|
+
enumerable: false,
|
|
959
|
+
value: debug
|
|
960
|
+
});
|
|
961
|
+
return override;
|
|
962
|
+
}
|
|
963
|
+
function getStyleTokenOverrideDebug(token) {
|
|
964
|
+
return token[TOKEN_DEBUG] ?? null;
|
|
965
|
+
}
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region builder/data/merge/utils.ts
|
|
968
|
+
function cloneData(data, source, debug, merge = true) {
|
|
969
|
+
const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
|
|
970
|
+
const state = data[BUILDER_STATE];
|
|
971
|
+
state.items = merge ? source[BUILDER_STATE].items.slice() : [];
|
|
972
|
+
state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
|
|
973
|
+
const lookup = state.lookup;
|
|
974
|
+
return [
|
|
975
|
+
runtimeType,
|
|
976
|
+
data,
|
|
977
|
+
state.items,
|
|
978
|
+
lookup
|
|
979
|
+
];
|
|
980
|
+
}
|
|
981
|
+
function logInvalidData(message, data) {
|
|
982
|
+
console.log(traceError(message), "data:", data);
|
|
983
|
+
}
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region builder/data/merge/scope.ts
|
|
986
|
+
function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
|
|
987
|
+
if (!items) return scope;
|
|
988
|
+
const sourceItems = Array.isArray(items) ? items : [items];
|
|
989
|
+
const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
|
|
990
|
+
let source;
|
|
991
|
+
let item;
|
|
992
|
+
let lookupIndex;
|
|
993
|
+
let weight;
|
|
994
|
+
let important;
|
|
995
|
+
let value;
|
|
996
|
+
let atRule;
|
|
997
|
+
let dedupe;
|
|
998
|
+
let className;
|
|
999
|
+
let itemDebug;
|
|
1000
|
+
let itemCallsite;
|
|
1001
|
+
for (let i = 0, len = sourceItems.length; i < len; i++) {
|
|
1002
|
+
source = sourceItems[i];
|
|
1003
|
+
if (!source) continue;
|
|
1004
|
+
if (isStyleTokenOverrideData(source)) {
|
|
1005
|
+
addTokenOverride$1(source, styles, lookup);
|
|
1006
|
+
continue;
|
|
1007
|
+
}
|
|
1008
|
+
if (isScopeData(source)) {
|
|
1009
|
+
const scopeItems = source[BUILDER_STATE].items;
|
|
1010
|
+
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
1011
|
+
item = scopeItems[j];
|
|
1012
|
+
if (isStyleTokenOverrideData(item)) {
|
|
1013
|
+
addTokenOverride$1(item, styles, lookup);
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
if (Array.isArray(item) || item.type !== 4) {
|
|
1017
|
+
logInvalidData("invalid scope data", {
|
|
1018
|
+
source,
|
|
1019
|
+
item
|
|
1020
|
+
});
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
const sourceScopeItem = item;
|
|
1024
|
+
atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
|
|
1025
|
+
const scopeItem = {
|
|
1026
|
+
...sourceScopeItem,
|
|
1027
|
+
runtime: runtimeType,
|
|
1028
|
+
atRule,
|
|
1029
|
+
parentSelector: parentSelector ?? sourceScopeItem.parentSelector
|
|
1030
|
+
};
|
|
1031
|
+
itemDebug = getMergedScopeDebug(debug, scopeItem);
|
|
1032
|
+
itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
|
|
1033
|
+
value = scopeItem.value;
|
|
1034
|
+
weight = scopeItem.weight;
|
|
1035
|
+
important = scopeItem.important;
|
|
1036
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, scopeItem.importantNative);
|
|
1037
|
+
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);
|
|
1038
|
+
scopeItem.dedupe = dedupe;
|
|
1039
|
+
scopeItem.className = className;
|
|
1040
|
+
scopeItem.callsite = itemCallsite;
|
|
1041
|
+
scopeItem.debug = itemDebug ?? null;
|
|
1042
|
+
scopeItem.debugField = itemDebug ? scopeItem.property : null;
|
|
1043
|
+
const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
|
|
1044
|
+
lookupIndex = lookup[lookupKey];
|
|
1045
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
1046
|
+
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
1047
|
+
}
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
if (!isSlotOverrideData(source)) {
|
|
1051
|
+
logInvalidData("invalid scope data", { source });
|
|
1052
|
+
continue;
|
|
1053
|
+
}
|
|
1054
|
+
const slotId = source[BUILDER_SLOT_ID];
|
|
1055
|
+
const overrideItems = source[BUILDER_STATE].items;
|
|
1056
|
+
for (let j = 0, len = overrideItems.length; j < len; j++) {
|
|
1057
|
+
item = overrideItems[j];
|
|
1058
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
|
|
1059
|
+
logInvalidData("invalid scope data", {
|
|
1060
|
+
source,
|
|
1061
|
+
item
|
|
1062
|
+
});
|
|
1063
|
+
continue;
|
|
1064
|
+
}
|
|
1065
|
+
const overrideItem = item;
|
|
1066
|
+
atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
|
|
1067
|
+
const scopeItem = {
|
|
1068
|
+
type: 4,
|
|
1069
|
+
slotId,
|
|
1070
|
+
runtime: runtimeType,
|
|
1071
|
+
dedupe: "",
|
|
1072
|
+
className: "",
|
|
1073
|
+
property: overrideItem.property,
|
|
1074
|
+
weight: overrideItem.weight,
|
|
1075
|
+
important: overrideItem.important,
|
|
1076
|
+
importantNative: overrideItem.importantNative,
|
|
1077
|
+
value: overrideItem.value,
|
|
1078
|
+
transformClassName: overrideItem.transformClassName,
|
|
1079
|
+
token: overrideItem.token,
|
|
1080
|
+
selector: overrideItem.selector,
|
|
1081
|
+
atRule,
|
|
1082
|
+
callsite: overrideItem.callsite ?? callsite,
|
|
1083
|
+
debug: overrideItem.debug,
|
|
1084
|
+
debugField: overrideItem.debugField,
|
|
1085
|
+
parentSelector
|
|
1086
|
+
};
|
|
1087
|
+
value = scopeItem.value;
|
|
1088
|
+
weight = scopeItem.weight;
|
|
1089
|
+
important = scopeItem.important;
|
|
1090
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.importantNative);
|
|
1091
|
+
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);
|
|
1092
|
+
scopeItem.dedupe = dedupe;
|
|
1093
|
+
scopeItem.className = className;
|
|
1094
|
+
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
1095
|
+
lookupIndex = lookup[lookupKey];
|
|
1096
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
1097
|
+
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return data;
|
|
1101
|
+
}
|
|
1102
|
+
function addTokenOverride$1(item, styles, lookup) {
|
|
1103
|
+
const lookupKey = getTokenLookupKey(getStyleTokenId(item));
|
|
1104
|
+
const lookupIndex = lookup[lookupKey];
|
|
1105
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = item;
|
|
1106
|
+
else lookup[lookupKey] = styles.push(item) - 1;
|
|
1107
|
+
}
|
|
1108
|
+
function getMergedScopeDebug(debug, item) {
|
|
1109
|
+
if (!debug) return item.debug;
|
|
1110
|
+
if (debug.fields?.[item.property]) return debug;
|
|
1111
|
+
const valueLoc = getRuntimeScopeItemValueLoc(item);
|
|
1112
|
+
if (!valueLoc) return debug;
|
|
1113
|
+
return {
|
|
1114
|
+
...debug,
|
|
1115
|
+
fields: {
|
|
1116
|
+
...debug.fields,
|
|
1117
|
+
[item.property]: {
|
|
1118
|
+
[0]: debug.loc,
|
|
1119
|
+
[1]: valueLoc
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
function getRuntimeScopeItemValueLoc(item) {
|
|
1125
|
+
if (item.debug && item.debugField) {
|
|
1126
|
+
const loc = item.debug.fields?.[item.debugField];
|
|
1127
|
+
if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
|
|
1128
|
+
if (loc) {
|
|
1129
|
+
const valueLoc = loc[1] ?? loc[0] ?? null;
|
|
1130
|
+
return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
return item.callsite ? [
|
|
1134
|
+
item.callsite.line,
|
|
1135
|
+
item.callsite.column,
|
|
1136
|
+
void 0,
|
|
1137
|
+
item.callsite.sourceUrl,
|
|
1138
|
+
item.callsite.sourceContent
|
|
1139
|
+
] : null;
|
|
1140
|
+
}
|
|
1141
|
+
function withDebugSource$1(loc, sourceUrl, sourceContent) {
|
|
1142
|
+
return loc[3] ? loc : [
|
|
1143
|
+
loc[0],
|
|
1144
|
+
loc[1],
|
|
1145
|
+
loc[2],
|
|
1146
|
+
sourceUrl,
|
|
1147
|
+
sourceContent
|
|
1148
|
+
];
|
|
1149
|
+
}
|
|
1150
|
+
function getScopeLookupKey(slotId, dedupe) {
|
|
1151
|
+
return slotId + "\0" + dedupe;
|
|
1152
|
+
}
|
|
1153
|
+
function getTokenLookupKey(tokenId) {
|
|
1154
|
+
return "token\0" + tokenId;
|
|
1155
|
+
}
|
|
1156
|
+
const formatTokenName = createNameFormatter(["name"]);
|
|
1157
|
+
function getTokenVarName(token, format) {
|
|
1158
|
+
const explicitName = getStyleTokenVarName(token);
|
|
1159
|
+
if (explicitName) return explicitName;
|
|
1160
|
+
const id = getStyleTokenId(token);
|
|
1161
|
+
const debugName = getStyleTokenName(token);
|
|
1162
|
+
return "--" + formatTokenName(format || "token[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: debugName });
|
|
1163
|
+
}
|
|
1164
|
+
function getTokenVar(token, format) {
|
|
1165
|
+
return getTokenVarFallback(token, format);
|
|
1166
|
+
}
|
|
1167
|
+
function getTokenOverrideValue(token, format) {
|
|
1168
|
+
return token.ref ? getTokenVar(token.ref, format) : token.value;
|
|
1169
|
+
}
|
|
1170
|
+
function getTokenVarFallback(token, tokenNameFormat) {
|
|
1171
|
+
const varName = getTokenVarName(token, tokenNameFormat);
|
|
1172
|
+
if (token.ref) return getCssVarRawFallback(varName, getTokenVarFallback(token.ref, tokenNameFormat));
|
|
1173
|
+
return getCssVar(varName, String(token.value ?? ""));
|
|
1174
|
+
}
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region style/transform.ts
|
|
1177
|
+
const CLASS_NAME_VALUE = symbol("transform.classNameValue");
|
|
1178
|
+
function classNameValue(value, className) {
|
|
1179
|
+
return {
|
|
1180
|
+
[CLASS_NAME_VALUE]: true,
|
|
1181
|
+
value,
|
|
1182
|
+
className
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
function isClassNameValue(value) {
|
|
1186
|
+
return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
|
|
1187
|
+
}
|
|
1188
|
+
function styleTransform(options) {
|
|
1189
|
+
return options;
|
|
1190
|
+
}
|
|
1191
|
+
function classNameTransform(options) {
|
|
1192
|
+
return options;
|
|
1193
|
+
}
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region style/valueRef.ts
|
|
1196
|
+
const AT_RULE_REF = symbol("atRule.ref");
|
|
1197
|
+
function createAtRuleRef(data) {
|
|
1198
|
+
return {
|
|
1199
|
+
[AT_RULE_REF]: true,
|
|
1200
|
+
...data
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
function isAtRuleRef(value) {
|
|
1204
|
+
return !!value && typeof value === "object" && value[AT_RULE_REF] === true;
|
|
1205
|
+
}
|
|
1206
|
+
//#endregion
|
|
1207
|
+
//#region builder/data/merge/style.ts
|
|
1208
|
+
function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
|
|
1209
|
+
if (!style) return source;
|
|
1210
|
+
const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
|
|
1211
|
+
const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
|
|
1212
|
+
const items = [];
|
|
1213
|
+
let item;
|
|
1214
|
+
let itemData;
|
|
1215
|
+
let valueRaw;
|
|
1216
|
+
let value;
|
|
1217
|
+
let weight;
|
|
1218
|
+
let important;
|
|
1219
|
+
let importantNative;
|
|
1220
|
+
let itemCallsite;
|
|
1221
|
+
let className;
|
|
1222
|
+
let dedupe;
|
|
1223
|
+
let token;
|
|
1224
|
+
let ref;
|
|
1225
|
+
let transformClassName;
|
|
1226
|
+
let lookupIndex;
|
|
1227
|
+
if (isStyleData(style)) {
|
|
1228
|
+
const stylesItems = style[BUILDER_STATE].items;
|
|
1229
|
+
for (let i = 0, len = stylesItems.length; i < len; i++) {
|
|
1230
|
+
item = stylesItems[i];
|
|
1231
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
|
|
1232
|
+
logInvalidData("invalid style data", {
|
|
1233
|
+
item,
|
|
1234
|
+
style
|
|
1235
|
+
});
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
|
|
1239
|
+
if (selector) item = Object.assign({}, item, { selector: item.selector ? combineSelectors(selector, item.selector) : selector });
|
|
1240
|
+
if (type === 2 && slotId !== null) item = Object.assign({}, item, {
|
|
1241
|
+
type: 2,
|
|
1242
|
+
slotId
|
|
1243
|
+
});
|
|
1244
|
+
else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
|
|
1245
|
+
type: 3,
|
|
1246
|
+
slotId
|
|
1247
|
+
});
|
|
1248
|
+
else if (type === 8) item = Object.assign({}, item, { type: 1 });
|
|
1249
|
+
const itemDebug = getMergedStyleDebug(debug, item);
|
|
1250
|
+
const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
|
|
1251
|
+
if (debugCallsite) item = Object.assign({}, item, {
|
|
1252
|
+
callsite: debugCallsite,
|
|
1253
|
+
debug: itemDebug,
|
|
1254
|
+
debugField: item.property
|
|
1255
|
+
});
|
|
1256
|
+
items.push(item);
|
|
1257
|
+
}
|
|
1258
|
+
} else for (const property in style) {
|
|
1259
|
+
valueRaw = style[property];
|
|
1260
|
+
[valueRaw, weight, important, importantNative] = unwrapAuthoredStyleValue(valueRaw);
|
|
1261
|
+
const sourceType = source[BUILDER_TYPE];
|
|
1262
|
+
checkImportantUsage(valueRaw, important, sourceType === 9 || sourceType === 8);
|
|
1263
|
+
transformClassName = null;
|
|
1264
|
+
if (isClassNameValue(valueRaw)) {
|
|
1265
|
+
transformClassName = valueRaw.className;
|
|
1266
|
+
valueRaw = valueRaw.value;
|
|
1267
|
+
}
|
|
1268
|
+
ref = isAtRuleRef(valueRaw) ? valueRaw : null;
|
|
1269
|
+
if (ref) valueRaw = ref.value;
|
|
1270
|
+
token = isStyleTokenData(valueRaw) ? valueRaw : null;
|
|
1271
|
+
value = token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
|
|
1272
|
+
itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
|
|
1273
|
+
itemData = {
|
|
1274
|
+
runtime: runtimeType,
|
|
1275
|
+
debug,
|
|
1276
|
+
debugField: property,
|
|
1277
|
+
dedupe: "",
|
|
1278
|
+
className: "",
|
|
1279
|
+
property,
|
|
1280
|
+
weight,
|
|
1281
|
+
important,
|
|
1282
|
+
importantNative,
|
|
1283
|
+
value,
|
|
1284
|
+
transformClassName,
|
|
1285
|
+
variable: ref ? [3, ref] : void 0,
|
|
1286
|
+
token,
|
|
1287
|
+
selector,
|
|
1288
|
+
atRule,
|
|
1289
|
+
callsite: itemCallsite
|
|
1290
|
+
};
|
|
1291
|
+
if (type === 1 || type === 8) {
|
|
1292
|
+
items.push({
|
|
1293
|
+
...itemData,
|
|
1294
|
+
type: 1
|
|
1295
|
+
});
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
if (slotId === null) {
|
|
1299
|
+
logInvalidData("invalid style data", {
|
|
1300
|
+
property,
|
|
1301
|
+
style
|
|
1302
|
+
});
|
|
1303
|
+
continue;
|
|
1304
|
+
}
|
|
1305
|
+
if (type === 2) {
|
|
1306
|
+
items.push({
|
|
1307
|
+
...itemData,
|
|
1308
|
+
type: 2,
|
|
1309
|
+
slotId
|
|
1310
|
+
});
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
if (type === 3) {
|
|
1314
|
+
items.push({
|
|
1315
|
+
...itemData,
|
|
1316
|
+
type: 3,
|
|
1317
|
+
slotId
|
|
1318
|
+
});
|
|
1319
|
+
continue;
|
|
1320
|
+
}
|
|
1321
|
+
logInvalidData("invalid style data", {
|
|
1322
|
+
property,
|
|
1323
|
+
style
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
if (!items.length) return data;
|
|
1327
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
1328
|
+
item = items[i];
|
|
1329
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
|
|
1330
|
+
logInvalidData("invalid style data", {
|
|
1331
|
+
item,
|
|
1332
|
+
style
|
|
1333
|
+
});
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
const runtimeItem = item;
|
|
1337
|
+
value = runtimeItem.value;
|
|
1338
|
+
weight = runtimeItem.weight;
|
|
1339
|
+
important = runtimeItem.important;
|
|
1340
|
+
dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.importantNative);
|
|
1341
|
+
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);
|
|
1342
|
+
runtimeItem.dedupe = dedupe;
|
|
1343
|
+
runtimeItem.className = className;
|
|
1344
|
+
lookupIndex = lookup[dedupe];
|
|
1345
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
|
|
1346
|
+
else lookup[dedupe] = styles.push(runtimeItem) - 1;
|
|
1347
|
+
}
|
|
1348
|
+
return data;
|
|
1349
|
+
}
|
|
1350
|
+
function unwrapAuthoredStyleValue(value) {
|
|
1351
|
+
let weight = null;
|
|
1352
|
+
let important = false;
|
|
1353
|
+
let native = false;
|
|
1354
|
+
while (true) {
|
|
1355
|
+
if (isStyleImportantValue(value)) {
|
|
1356
|
+
important = true;
|
|
1357
|
+
native ||= value.native === true;
|
|
1358
|
+
value = value.value;
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
if (isStyleWeightValue(value)) {
|
|
1362
|
+
weight = value.weight;
|
|
1363
|
+
value = value.value;
|
|
1364
|
+
continue;
|
|
1365
|
+
}
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
return [
|
|
1369
|
+
value,
|
|
1370
|
+
weight,
|
|
1371
|
+
important,
|
|
1372
|
+
native
|
|
1373
|
+
];
|
|
1374
|
+
}
|
|
1375
|
+
function checkImportantUsage(value, important, isSheet) {
|
|
1376
|
+
const options = CHECK_CONFIG.important;
|
|
1377
|
+
if (!options) return;
|
|
1378
|
+
if (typeof value === "string" && /!\s*important\b/i.test(value)) reportImportantCheck(options.rawValue, "Do not write raw \"!important\" values. Wrap the value with style.important(...) instead.");
|
|
1379
|
+
if (important && !isSheet) reportImportantCheck(options.outsideSheet, "style.important(...) outside createSheet is discouraged. Prefer style.weight(...) for Fluentic style priority.");
|
|
1380
|
+
}
|
|
1381
|
+
function reportImportantCheck(level, message) {
|
|
1382
|
+
if (!level) return;
|
|
1383
|
+
if (level === "error") throw new Error(message);
|
|
1384
|
+
if (DEV_CONFIG.isDev) console.warn("[fluentic-style] " + message);
|
|
1385
|
+
}
|
|
1386
|
+
function combineSelectors(parent, child) {
|
|
1387
|
+
const parentText = getSelectorText(parent);
|
|
1388
|
+
const childText = getSelectorText(child);
|
|
1389
|
+
const priority = Math.max(getSelectorPriority(parent), getSelectorPriority(child));
|
|
1390
|
+
const selector = parentText + childText;
|
|
1391
|
+
return priority > 0 ? [selector, priority] : selector;
|
|
1392
|
+
}
|
|
1393
|
+
function getSelectorText(selector) {
|
|
1394
|
+
return Array.isArray(selector) ? selector[0] : selector;
|
|
1395
|
+
}
|
|
1396
|
+
function getSelectorPriority(selector) {
|
|
1397
|
+
return Array.isArray(selector) ? selector[1] : 0;
|
|
1398
|
+
}
|
|
1399
|
+
function getMergedStyleDebug(debug, item) {
|
|
1400
|
+
if (!debug) return null;
|
|
1401
|
+
if (debug.fields?.[item.property]) return debug;
|
|
1402
|
+
const valueLoc = getMergedItemValueLoc(item);
|
|
1403
|
+
if (!valueLoc) return debug;
|
|
1404
|
+
return {
|
|
1405
|
+
...debug,
|
|
1406
|
+
fields: {
|
|
1407
|
+
...debug.fields,
|
|
1408
|
+
[item.property]: {
|
|
1409
|
+
[0]: withDebugSource(debug.loc, debug),
|
|
1410
|
+
[1]: valueLoc
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function getMergedItemValueLoc(item) {
|
|
1416
|
+
if (item.debug && item.debugField) {
|
|
1417
|
+
const loc = item.debug.fields?.[item.debugField];
|
|
1418
|
+
if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
|
|
1419
|
+
if (loc) {
|
|
1420
|
+
const traceLoc = loc[1] ?? loc[0] ?? null;
|
|
1421
|
+
return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return item.callsite ? [
|
|
1425
|
+
item.callsite.line,
|
|
1426
|
+
item.callsite.column,
|
|
1427
|
+
void 0,
|
|
1428
|
+
item.callsite.sourceUrl,
|
|
1429
|
+
item.callsite.sourceContent
|
|
1430
|
+
] : null;
|
|
1431
|
+
}
|
|
1432
|
+
function withDebugSource(loc, debug) {
|
|
1433
|
+
return loc[3] ? loc : [
|
|
1434
|
+
loc[0],
|
|
1435
|
+
loc[1],
|
|
1436
|
+
loc[2],
|
|
1437
|
+
debug.sourceUrl,
|
|
1438
|
+
debug.code
|
|
1439
|
+
];
|
|
1440
|
+
}
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region builder/data/selector.ts
|
|
1443
|
+
const SELECTOR_MEDIA = "@media";
|
|
1444
|
+
const SELECTOR_CONTAINER = "@container";
|
|
1445
|
+
function normalizeSelectorArg(arg) {
|
|
1446
|
+
return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
|
|
1447
|
+
}
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region builder/style_data.ts
|
|
1450
|
+
const mergeStyleCreate = (callsite) => {
|
|
1451
|
+
return createStyleData(callsite);
|
|
1452
|
+
};
|
|
1453
|
+
const mergeStyleData = createMerge(mergeStyleCreate, 1);
|
|
1454
|
+
const mergeSheetCreate = (callsite, data) => {
|
|
1455
|
+
return createSheetData(callsite, data[BUILDER_SHEET_OPTIONS]);
|
|
1456
|
+
};
|
|
1457
|
+
const mergeSheetData = createMerge(mergeSheetCreate, 1);
|
|
1458
|
+
const mergeSlotCreate = (callsite, data) => {
|
|
1459
|
+
return createSlotData(callsite, data[BUILDER_SLOT_ID]);
|
|
1460
|
+
};
|
|
1461
|
+
const mergeSlotData = createMerge(mergeSlotCreate, 2);
|
|
1462
|
+
const mergeSlotOverrideCreate = (callsite, data) => {
|
|
1463
|
+
return createSlotOverrideData(callsite, data[BUILDER_SLOT_ID]);
|
|
1464
|
+
};
|
|
1465
|
+
const mergeSlotOverrideData = createMerge(mergeSlotOverrideCreate, 3);
|
|
1466
|
+
const mergeSelectorOverrideCreate = (callsite, data) => {
|
|
1467
|
+
return createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]);
|
|
1468
|
+
};
|
|
1469
|
+
const mergeSelectorOverrideData = createMerge(mergeSelectorOverrideCreate, 8);
|
|
1470
|
+
function createMerge(create, type) {
|
|
1471
|
+
return (data, callsite, style, debug, selector, atRule) => {
|
|
1472
|
+
return mergeBuilderData(create, callsite, data, style, debug, selector, atRule, type);
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
//#endregion
|
|
1476
|
+
//#region builder/utils.ts
|
|
1477
|
+
const FnPrefixStyle = "style.";
|
|
1478
|
+
const FnPrefixSlot = "slot.";
|
|
1479
|
+
const FnPrefixScope = "scope.";
|
|
1480
|
+
const FnPrefixSelector = "selector.";
|
|
1481
|
+
function runtimeCallsite() {
|
|
1482
|
+
return traceCallsite();
|
|
1483
|
+
}
|
|
1484
|
+
function resolveCallsite(debug) {
|
|
1485
|
+
return debug ? getDebugCallsite(debug) : runtimeCallsite();
|
|
1486
|
+
}
|
|
1487
|
+
function transformStyle(style, transform) {
|
|
1488
|
+
return transform ? transform.transform(style) : style;
|
|
1489
|
+
}
|
|
1490
|
+
//#endregion
|
|
1491
|
+
//#region builder/selector_override_core.ts
|
|
1492
|
+
function normalizeManualSelectors(input, assertManualSelector) {
|
|
1493
|
+
const selectors = Array.isArray(input) ? input : [input];
|
|
1494
|
+
if (!selectors.length) throw new Error("selector array cannot be empty");
|
|
1495
|
+
return selectors.flatMap((selector) => normalizeManualSelector(selector, assertManualSelector));
|
|
1496
|
+
}
|
|
1497
|
+
function assertManualSelectorSyntax(selector) {
|
|
1498
|
+
if (!selector) throw new Error("selector cannot be empty");
|
|
1499
|
+
if (selector.includes("{") || selector.includes("}")) throw new Error("selector must not contain \"{\" or \"}\"");
|
|
1500
|
+
if (selector.includes(",")) throw new Error("selector must not contain \",\"; use an array of selectors instead");
|
|
1501
|
+
const ampersandIndex = selector.indexOf("&");
|
|
1502
|
+
if (ampersandIndex > 0) throw new Error("selector can only use \"&\" at the beginning");
|
|
1503
|
+
const ampersandSelector = selector.startsWith("&?") ? selector.slice(2) : selector.slice(1);
|
|
1504
|
+
if (ampersandIndex === 0 && ampersandSelector && /^\s/.test(ampersandSelector)) throw new Error("selector cannot have whitespace after \"&\"; omit \"&\" for descendant selectors");
|
|
1505
|
+
}
|
|
1506
|
+
function setSheetSelectorOptions(selector, options) {
|
|
1507
|
+
if (options.specificity === void 0 && options.layer === void 0) return selector;
|
|
1508
|
+
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
1509
|
+
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);
|
|
1510
|
+
return Array.isArray(selector) ? [weighted, selector[1]] : weighted;
|
|
1511
|
+
}
|
|
1512
|
+
function normalizeManualSelector(selector, assertManualSelector) {
|
|
1513
|
+
const value = selector.trim();
|
|
1514
|
+
assertManualSelector(value);
|
|
1515
|
+
if (value.startsWith("&?")) {
|
|
1516
|
+
const suffix = value.slice(2);
|
|
1517
|
+
return suffix ? [SHEET_SELECTOR_ANCHOR + suffix, SHEET_SELECTOR_ANCHOR + " " + suffix] : [SHEET_SELECTOR_ANCHOR];
|
|
1518
|
+
}
|
|
1519
|
+
return [SHEET_SELECTOR_ANCHOR + (value.startsWith("&") ? value.slice(1) : " " + value)];
|
|
1520
|
+
}
|
|
1521
|
+
/** Convert a normalized explicit selector into an unscoped sheet selector. */
|
|
1522
|
+
function setGlobalSheetSelectorOptions(selector, options) {
|
|
1523
|
+
const suffix = (Array.isArray(selector) ? selector[0] : selector).slice(SHEET_SELECTOR_ANCHOR.length);
|
|
1524
|
+
if (!suffix.startsWith(" ") || !suffix.trim()) throw new Error("createGlobalSheet requires explicit selectors without an ampersand anchor");
|
|
1525
|
+
const global = GLOBAL_SHEET_SELECTOR_ANCHOR + JSON.stringify(options.layer ?? null) + "\0" + suffix.trimStart();
|
|
1526
|
+
return Array.isArray(selector) ? [global, selector[1]] : global;
|
|
1527
|
+
}
|
|
1528
|
+
//#endregion
|
|
1529
|
+
//#region atomic/layer/layer.ts
|
|
1530
|
+
function compareLayerPriority(p1, p2) {
|
|
1531
|
+
return p1[0] - p2[0] || p1[1] - p2[1] || p1[2] - p2[2] || p1[3] - p2[3] || p1[4] - p2[4] || p1[5] - p2[5] || p1[6] - p2[6];
|
|
1532
|
+
}
|
|
1533
|
+
function createLayerNamePool() {
|
|
1534
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
1535
|
+
const getLayerId = (priority) => {
|
|
1536
|
+
const key = priority.join("|");
|
|
1537
|
+
let name = lookup.get(key);
|
|
1538
|
+
if (name) return name;
|
|
1539
|
+
name = "p" + hashString(key);
|
|
1540
|
+
lookup.set(key, name);
|
|
1541
|
+
return name;
|
|
1542
|
+
};
|
|
1543
|
+
const getLayerName = (layerNamespace, priority) => {
|
|
1544
|
+
const layerId = getLayerId(priority);
|
|
1545
|
+
return layerNamespace ? layerNamespace + "." + layerId : layerId;
|
|
1546
|
+
};
|
|
1547
|
+
return {
|
|
1548
|
+
getLayerName,
|
|
1549
|
+
getLayerId
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
function createLayerPool(layerNamespace) {
|
|
1553
|
+
const namePool = createLayerNamePool();
|
|
1554
|
+
const priorities = /* @__PURE__ */ new Map();
|
|
1555
|
+
const getName = (priority) => {
|
|
1556
|
+
const key = priority.join("|");
|
|
1557
|
+
if (!priorities.has(key)) priorities.set(key, priority);
|
|
1558
|
+
return namePool.getLayerName(layerNamespace, priority);
|
|
1559
|
+
};
|
|
1560
|
+
const getNames = () => {
|
|
1561
|
+
return Array.from(priorities.values()).sort(compareLayerPriority).map((priority) => namePool.getLayerName(layerNamespace, priority));
|
|
1562
|
+
};
|
|
1563
|
+
return {
|
|
1564
|
+
getName,
|
|
1565
|
+
getNames
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
function flattenCssLayers(layers, layerNames) {
|
|
1569
|
+
const names = typeof layerNames === "string" ? [layerNames] : layerNames;
|
|
1570
|
+
return [...new Set(layers.flatMap((layer) => layer === "$layer" ? names.filter((name) => !layers.includes(name)) : layer).filter(Boolean))];
|
|
1571
|
+
}
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region atomic/layer/types.ts
|
|
1574
|
+
const LayerDefaultLayers = [LayerPlaceholder];
|
|
1575
|
+
const LayerDefaultPriority = [
|
|
1576
|
+
0,
|
|
1577
|
+
0,
|
|
1578
|
+
0,
|
|
1579
|
+
0,
|
|
1580
|
+
0,
|
|
1581
|
+
0,
|
|
1582
|
+
0
|
|
1583
|
+
];
|
|
1584
|
+
const LayerMediaPriorities = {
|
|
1585
|
+
base: 0,
|
|
1586
|
+
media: 1,
|
|
1587
|
+
priorityMedia: 2
|
|
1588
|
+
};
|
|
1589
|
+
const LayerSelectorPriorities = {
|
|
1590
|
+
base: 0,
|
|
1591
|
+
parentSelector: 1,
|
|
1592
|
+
selector: 2,
|
|
1593
|
+
prioritySelector: 3
|
|
1594
|
+
};
|
|
1595
|
+
const LayerPropertyPriorities = {
|
|
1596
|
+
shorthand: 0,
|
|
1597
|
+
intermediate: 1,
|
|
1598
|
+
longhand: 2
|
|
1599
|
+
};
|
|
1600
|
+
//#endregion
|
|
1601
|
+
//#region atomic/layer/utils.ts
|
|
1602
|
+
function getLayerOrderCss(layers, layerNames) {
|
|
1603
|
+
const names = flattenCssLayers(layers, layerNames);
|
|
1604
|
+
if (!names.length) return "";
|
|
1605
|
+
return "@layer " + names.join(", ") + ";";
|
|
1606
|
+
}
|
|
1607
|
+
function getLayerBlockCss(layerName, css) {
|
|
1608
|
+
return "@layer " + layerName + " {" + css + "}";
|
|
1609
|
+
}
|
|
1610
|
+
//#endregion
|
|
1611
|
+
//#region atomic/property/types.ts
|
|
1612
|
+
const LONGHAND = LayerPropertyPriorities.longhand;
|
|
1613
|
+
const SHORTHAND = LayerPropertyPriorities.shorthand;
|
|
1614
|
+
const INTERMEDIATE = LayerPropertyPriorities.intermediate;
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region atomic/property/type_maps.ts
|
|
1617
|
+
const animation = {
|
|
1618
|
+
animation: SHORTHAND,
|
|
1619
|
+
animationComposition: LONGHAND,
|
|
1620
|
+
animationDelay: LONGHAND,
|
|
1621
|
+
animationDirection: LONGHAND,
|
|
1622
|
+
animationDuration: LONGHAND,
|
|
1623
|
+
animationFillMode: LONGHAND,
|
|
1624
|
+
animationIterationCount: LONGHAND,
|
|
1625
|
+
animationName: LONGHAND,
|
|
1626
|
+
animationPlayState: LONGHAND,
|
|
1627
|
+
animationRange: INTERMEDIATE,
|
|
1628
|
+
animationRangeEnd: LONGHAND,
|
|
1629
|
+
animationRangeStart: LONGHAND,
|
|
1630
|
+
animationTimeline: LONGHAND,
|
|
1631
|
+
animationTimingFunction: LONGHAND
|
|
1632
|
+
};
|
|
1633
|
+
const background = {
|
|
1634
|
+
background: SHORTHAND,
|
|
1635
|
+
backgroundAttachment: LONGHAND,
|
|
1636
|
+
backgroundBlendMode: LONGHAND,
|
|
1637
|
+
backgroundClip: LONGHAND,
|
|
1638
|
+
backgroundColor: LONGHAND,
|
|
1639
|
+
backgroundImage: LONGHAND,
|
|
1640
|
+
backgroundOrigin: LONGHAND,
|
|
1641
|
+
backgroundPosition: INTERMEDIATE,
|
|
1642
|
+
backgroundPositionX: LONGHAND,
|
|
1643
|
+
backgroundPositionY: LONGHAND,
|
|
1644
|
+
backgroundRepeat: INTERMEDIATE,
|
|
1645
|
+
backgroundSize: LONGHAND
|
|
1646
|
+
};
|
|
1647
|
+
const border = {
|
|
1648
|
+
border: SHORTHAND,
|
|
1649
|
+
borderBlock: INTERMEDIATE,
|
|
1650
|
+
borderBlockColor: INTERMEDIATE,
|
|
1651
|
+
borderBlockEnd: INTERMEDIATE,
|
|
1652
|
+
borderBlockEndColor: LONGHAND,
|
|
1653
|
+
borderBlockEndStyle: LONGHAND,
|
|
1654
|
+
borderBlockEndWidth: LONGHAND,
|
|
1655
|
+
borderBlockStart: INTERMEDIATE,
|
|
1656
|
+
borderBlockStartColor: LONGHAND,
|
|
1657
|
+
borderBlockStartStyle: LONGHAND,
|
|
1658
|
+
borderBlockStartWidth: LONGHAND,
|
|
1659
|
+
borderBlockStyle: INTERMEDIATE,
|
|
1660
|
+
borderBlockWidth: INTERMEDIATE,
|
|
1661
|
+
borderBottom: INTERMEDIATE,
|
|
1662
|
+
borderBottomColor: LONGHAND,
|
|
1663
|
+
borderBottomLeftRadius: LONGHAND,
|
|
1664
|
+
borderBottomRightRadius: LONGHAND,
|
|
1665
|
+
borderBottomStyle: LONGHAND,
|
|
1666
|
+
borderBottomWidth: LONGHAND,
|
|
1667
|
+
borderColor: INTERMEDIATE,
|
|
1668
|
+
borderImage: INTERMEDIATE,
|
|
1669
|
+
borderImageOutset: LONGHAND,
|
|
1670
|
+
borderImageRepeat: LONGHAND,
|
|
1671
|
+
borderImageSlice: LONGHAND,
|
|
1672
|
+
borderImageSource: LONGHAND,
|
|
1673
|
+
borderImageWidth: LONGHAND,
|
|
1674
|
+
borderInline: INTERMEDIATE,
|
|
1675
|
+
borderInlineColor: INTERMEDIATE,
|
|
1676
|
+
borderInlineEnd: INTERMEDIATE,
|
|
1677
|
+
borderInlineEndColor: LONGHAND,
|
|
1678
|
+
borderInlineEndStyle: LONGHAND,
|
|
1679
|
+
borderInlineEndWidth: LONGHAND,
|
|
1680
|
+
borderInlineStart: INTERMEDIATE,
|
|
1681
|
+
borderInlineStartColor: LONGHAND,
|
|
1682
|
+
borderInlineStartStyle: LONGHAND,
|
|
1683
|
+
borderInlineStartWidth: LONGHAND,
|
|
1684
|
+
borderInlineStyle: INTERMEDIATE,
|
|
1685
|
+
borderInlineWidth: INTERMEDIATE,
|
|
1686
|
+
borderLeft: INTERMEDIATE,
|
|
1687
|
+
borderLeftColor: LONGHAND,
|
|
1688
|
+
borderLeftStyle: LONGHAND,
|
|
1689
|
+
borderLeftWidth: LONGHAND,
|
|
1690
|
+
borderRadius: SHORTHAND,
|
|
1691
|
+
borderEndEndRadius: LONGHAND,
|
|
1692
|
+
borderEndStartRadius: LONGHAND,
|
|
1693
|
+
borderRight: INTERMEDIATE,
|
|
1694
|
+
borderRightColor: LONGHAND,
|
|
1695
|
+
borderRightStyle: LONGHAND,
|
|
1696
|
+
borderRightWidth: LONGHAND,
|
|
1697
|
+
borderSpacing: SHORTHAND,
|
|
1698
|
+
borderStartEndRadius: LONGHAND,
|
|
1699
|
+
borderStartStartRadius: LONGHAND,
|
|
1700
|
+
borderStyle: INTERMEDIATE,
|
|
1701
|
+
borderTop: INTERMEDIATE,
|
|
1702
|
+
borderTopColor: LONGHAND,
|
|
1703
|
+
borderTopLeftRadius: LONGHAND,
|
|
1704
|
+
borderTopRightRadius: LONGHAND,
|
|
1705
|
+
borderTopStyle: LONGHAND,
|
|
1706
|
+
borderTopWidth: LONGHAND,
|
|
1707
|
+
borderWidth: INTERMEDIATE
|
|
1708
|
+
};
|
|
1709
|
+
const columns = {
|
|
1710
|
+
columns: SHORTHAND,
|
|
1711
|
+
columnCount: LONGHAND,
|
|
1712
|
+
columnRule: INTERMEDIATE,
|
|
1713
|
+
columnRuleColor: LONGHAND,
|
|
1714
|
+
columnRuleStyle: LONGHAND,
|
|
1715
|
+
columnRuleWidth: LONGHAND,
|
|
1716
|
+
columnWidth: LONGHAND
|
|
1717
|
+
};
|
|
1718
|
+
const containIntrinsicSize = {
|
|
1719
|
+
containIntrinsicSize: SHORTHAND,
|
|
1720
|
+
containIntrinsicBlockSize: LONGHAND,
|
|
1721
|
+
containIntrinsicHeight: LONGHAND,
|
|
1722
|
+
containIntrinsicInlineSize: LONGHAND,
|
|
1723
|
+
containIntrinsicWidth: LONGHAND
|
|
1724
|
+
};
|
|
1725
|
+
const container = {
|
|
1726
|
+
container: SHORTHAND,
|
|
1727
|
+
containerName: LONGHAND,
|
|
1728
|
+
containerType: LONGHAND
|
|
1729
|
+
};
|
|
1730
|
+
const flex = {
|
|
1731
|
+
flex: SHORTHAND,
|
|
1732
|
+
flexBasis: LONGHAND,
|
|
1733
|
+
flexDirection: LONGHAND,
|
|
1734
|
+
flexFlow: INTERMEDIATE,
|
|
1735
|
+
flexGrow: LONGHAND,
|
|
1736
|
+
flexShrink: LONGHAND,
|
|
1737
|
+
flexWrap: LONGHAND
|
|
1738
|
+
};
|
|
1739
|
+
const font = {
|
|
1740
|
+
font: SHORTHAND,
|
|
1741
|
+
fontFamily: LONGHAND,
|
|
1742
|
+
fontFeatureSettings: LONGHAND,
|
|
1743
|
+
fontKerning: LONGHAND,
|
|
1744
|
+
fontLanguageOverride: LONGHAND,
|
|
1745
|
+
fontOpticalSizing: LONGHAND,
|
|
1746
|
+
fontPalette: LONGHAND,
|
|
1747
|
+
fontSize: LONGHAND,
|
|
1748
|
+
fontSizeAdjust: LONGHAND,
|
|
1749
|
+
fontStretch: LONGHAND,
|
|
1750
|
+
fontStyle: LONGHAND,
|
|
1751
|
+
fontSynthesis: INTERMEDIATE,
|
|
1752
|
+
fontSynthesisSmallCaps: LONGHAND,
|
|
1753
|
+
fontSynthesisStyle: LONGHAND,
|
|
1754
|
+
fontSynthesisWeight: LONGHAND,
|
|
1755
|
+
fontVariant: INTERMEDIATE,
|
|
1756
|
+
fontVariantAlternates: LONGHAND,
|
|
1757
|
+
fontVariantCaps: LONGHAND,
|
|
1758
|
+
fontVariantEastAsian: LONGHAND,
|
|
1759
|
+
fontVariantEmoji: LONGHAND,
|
|
1760
|
+
fontVariantLigatures: LONGHAND,
|
|
1761
|
+
fontVariantNumeric: LONGHAND,
|
|
1762
|
+
fontVariantPosition: LONGHAND,
|
|
1763
|
+
fontVariationSettings: LONGHAND,
|
|
1764
|
+
fontWeight: LONGHAND,
|
|
1765
|
+
lineHeight: LONGHAND
|
|
1766
|
+
};
|
|
1767
|
+
const gap = {
|
|
1768
|
+
gap: SHORTHAND,
|
|
1769
|
+
columnGap: LONGHAND,
|
|
1770
|
+
rowGap: LONGHAND
|
|
1771
|
+
};
|
|
1772
|
+
const grid = {
|
|
1773
|
+
grid: SHORTHAND,
|
|
1774
|
+
gridArea: INTERMEDIATE,
|
|
1775
|
+
gridAutoColumns: LONGHAND,
|
|
1776
|
+
gridAutoFlow: LONGHAND,
|
|
1777
|
+
gridAutoRows: LONGHAND,
|
|
1778
|
+
gridColumn: INTERMEDIATE,
|
|
1779
|
+
gridColumnEnd: LONGHAND,
|
|
1780
|
+
gridColumnStart: LONGHAND,
|
|
1781
|
+
gridRow: INTERMEDIATE,
|
|
1782
|
+
gridRowEnd: LONGHAND,
|
|
1783
|
+
gridRowStart: LONGHAND,
|
|
1784
|
+
gridTemplate: INTERMEDIATE,
|
|
1785
|
+
gridTemplateAreas: LONGHAND,
|
|
1786
|
+
gridTemplateColumns: LONGHAND,
|
|
1787
|
+
gridTemplateRows: LONGHAND
|
|
1788
|
+
};
|
|
1789
|
+
const inset = {
|
|
1790
|
+
inset: SHORTHAND,
|
|
1791
|
+
insetBlock: INTERMEDIATE,
|
|
1792
|
+
insetBlockEnd: LONGHAND,
|
|
1793
|
+
insetBlockStart: LONGHAND,
|
|
1794
|
+
insetInline: INTERMEDIATE,
|
|
1795
|
+
insetInlineEnd: LONGHAND,
|
|
1796
|
+
insetInlineStart: LONGHAND,
|
|
1797
|
+
bottom: LONGHAND,
|
|
1798
|
+
left: LONGHAND,
|
|
1799
|
+
right: LONGHAND,
|
|
1800
|
+
top: LONGHAND
|
|
1801
|
+
};
|
|
1802
|
+
const listStyle = {
|
|
1803
|
+
listStyle: SHORTHAND,
|
|
1804
|
+
listStyleImage: LONGHAND,
|
|
1805
|
+
listStylePosition: LONGHAND,
|
|
1806
|
+
listStyleType: LONGHAND
|
|
1807
|
+
};
|
|
1808
|
+
const margin = {
|
|
1809
|
+
margin: SHORTHAND,
|
|
1810
|
+
marginBlock: INTERMEDIATE,
|
|
1811
|
+
marginBlockEnd: LONGHAND,
|
|
1812
|
+
marginBlockStart: LONGHAND,
|
|
1813
|
+
marginBottom: LONGHAND,
|
|
1814
|
+
marginInline: INTERMEDIATE,
|
|
1815
|
+
marginInlineEnd: LONGHAND,
|
|
1816
|
+
marginInlineStart: LONGHAND,
|
|
1817
|
+
marginLeft: LONGHAND,
|
|
1818
|
+
marginRight: LONGHAND,
|
|
1819
|
+
marginTop: LONGHAND
|
|
1820
|
+
};
|
|
1821
|
+
const mask = {
|
|
1822
|
+
mask: SHORTHAND,
|
|
1823
|
+
maskBorder: INTERMEDIATE,
|
|
1824
|
+
maskBorderMode: LONGHAND,
|
|
1825
|
+
maskBorderOutset: LONGHAND,
|
|
1826
|
+
maskBorderRepeat: LONGHAND,
|
|
1827
|
+
maskBorderSlice: LONGHAND,
|
|
1828
|
+
maskBorderSource: LONGHAND,
|
|
1829
|
+
maskBorderWidth: LONGHAND,
|
|
1830
|
+
maskClip: LONGHAND,
|
|
1831
|
+
maskComposite: LONGHAND,
|
|
1832
|
+
maskImage: LONGHAND,
|
|
1833
|
+
maskMode: LONGHAND,
|
|
1834
|
+
maskOrigin: LONGHAND,
|
|
1835
|
+
maskPosition: LONGHAND,
|
|
1836
|
+
maskRepeat: LONGHAND,
|
|
1837
|
+
maskSize: LONGHAND,
|
|
1838
|
+
maskType: LONGHAND,
|
|
1839
|
+
WebkitMask: SHORTHAND,
|
|
1840
|
+
WebkitMaskBoxImage: INTERMEDIATE,
|
|
1841
|
+
WebkitMaskBoxImageOutset: LONGHAND,
|
|
1842
|
+
WebkitMaskBoxImageRepeat: LONGHAND,
|
|
1843
|
+
WebkitMaskBoxImageSlice: LONGHAND,
|
|
1844
|
+
WebkitMaskBoxImageSource: LONGHAND,
|
|
1845
|
+
WebkitMaskBoxImageWidth: LONGHAND,
|
|
1846
|
+
WebkitMaskClip: LONGHAND,
|
|
1847
|
+
WebkitMaskComposite: LONGHAND,
|
|
1848
|
+
WebkitMaskImage: LONGHAND,
|
|
1849
|
+
WebkitMaskOrigin: LONGHAND,
|
|
1850
|
+
WebkitMaskPosition: LONGHAND,
|
|
1851
|
+
WebkitMaskPositionX: LONGHAND,
|
|
1852
|
+
WebkitMaskPositionY: LONGHAND,
|
|
1853
|
+
WebkitMaskRepeat: LONGHAND,
|
|
1854
|
+
WebkitMaskRepeatX: LONGHAND,
|
|
1855
|
+
WebkitMaskRepeatY: LONGHAND,
|
|
1856
|
+
WebkitMaskSize: LONGHAND
|
|
1857
|
+
};
|
|
1858
|
+
const offset = {
|
|
1859
|
+
offset: SHORTHAND,
|
|
1860
|
+
offsetAnchor: LONGHAND,
|
|
1861
|
+
offsetDistance: LONGHAND,
|
|
1862
|
+
offsetPath: LONGHAND,
|
|
1863
|
+
offsetPosition: LONGHAND,
|
|
1864
|
+
offsetRotate: LONGHAND
|
|
1865
|
+
};
|
|
1866
|
+
const outline = {
|
|
1867
|
+
outline: SHORTHAND,
|
|
1868
|
+
outlineColor: LONGHAND,
|
|
1869
|
+
outlineOffset: LONGHAND,
|
|
1870
|
+
outlineStyle: LONGHAND,
|
|
1871
|
+
outlineWidth: LONGHAND
|
|
1872
|
+
};
|
|
1873
|
+
const overflow = {
|
|
1874
|
+
overflow: SHORTHAND,
|
|
1875
|
+
overflowBlock: LONGHAND,
|
|
1876
|
+
overflowClipMargin: SHORTHAND,
|
|
1877
|
+
overflowInline: LONGHAND,
|
|
1878
|
+
overflowWrap: LONGHAND,
|
|
1879
|
+
overflowX: LONGHAND,
|
|
1880
|
+
overflowY: LONGHAND
|
|
1881
|
+
};
|
|
1882
|
+
const overscrollBehavior = {
|
|
1883
|
+
overscrollBehavior: SHORTHAND,
|
|
1884
|
+
overscrollBehaviorBlock: LONGHAND,
|
|
1885
|
+
overscrollBehaviorInline: LONGHAND,
|
|
1886
|
+
overscrollBehaviorX: LONGHAND,
|
|
1887
|
+
overscrollBehaviorY: LONGHAND
|
|
1888
|
+
};
|
|
1889
|
+
const padding = {
|
|
1890
|
+
padding: SHORTHAND,
|
|
1891
|
+
paddingBlock: INTERMEDIATE,
|
|
1892
|
+
paddingBlockEnd: LONGHAND,
|
|
1893
|
+
paddingBlockStart: LONGHAND,
|
|
1894
|
+
paddingBottom: LONGHAND,
|
|
1895
|
+
paddingInline: INTERMEDIATE,
|
|
1896
|
+
paddingInlineEnd: LONGHAND,
|
|
1897
|
+
paddingInlineStart: LONGHAND,
|
|
1898
|
+
paddingLeft: LONGHAND,
|
|
1899
|
+
paddingRight: LONGHAND,
|
|
1900
|
+
paddingTop: LONGHAND
|
|
1901
|
+
};
|
|
1902
|
+
const place = {
|
|
1903
|
+
placeContent: SHORTHAND,
|
|
1904
|
+
alignContent: LONGHAND,
|
|
1905
|
+
justifyContent: LONGHAND,
|
|
1906
|
+
placeItems: SHORTHAND,
|
|
1907
|
+
alignItems: LONGHAND,
|
|
1908
|
+
justifyItems: LONGHAND,
|
|
1909
|
+
placeSelf: SHORTHAND,
|
|
1910
|
+
alignSelf: LONGHAND,
|
|
1911
|
+
justifySelf: LONGHAND
|
|
1912
|
+
};
|
|
1913
|
+
const scrollMargin = {
|
|
1914
|
+
scrollMargin: SHORTHAND,
|
|
1915
|
+
scrollMarginBlock: INTERMEDIATE,
|
|
1916
|
+
scrollMarginBlockEnd: LONGHAND,
|
|
1917
|
+
scrollMarginBlockStart: LONGHAND,
|
|
1918
|
+
scrollMarginBottom: LONGHAND,
|
|
1919
|
+
scrollMarginInline: INTERMEDIATE,
|
|
1920
|
+
scrollMarginInlineEnd: LONGHAND,
|
|
1921
|
+
scrollMarginInlineStart: LONGHAND,
|
|
1922
|
+
scrollMarginLeft: LONGHAND,
|
|
1923
|
+
scrollMarginRight: LONGHAND,
|
|
1924
|
+
scrollMarginTop: LONGHAND
|
|
1925
|
+
};
|
|
1926
|
+
const scrollPadding = {
|
|
1927
|
+
scrollPadding: SHORTHAND,
|
|
1928
|
+
scrollPaddingBlock: INTERMEDIATE,
|
|
1929
|
+
scrollPaddingBlockEnd: LONGHAND,
|
|
1930
|
+
scrollPaddingBlockStart: LONGHAND,
|
|
1931
|
+
scrollPaddingBottom: LONGHAND,
|
|
1932
|
+
scrollPaddingInline: INTERMEDIATE,
|
|
1933
|
+
scrollPaddingInlineEnd: LONGHAND,
|
|
1934
|
+
scrollPaddingInlineStart: LONGHAND,
|
|
1935
|
+
scrollPaddingLeft: LONGHAND,
|
|
1936
|
+
scrollPaddingRight: LONGHAND,
|
|
1937
|
+
scrollPaddingTop: LONGHAND
|
|
1938
|
+
};
|
|
1939
|
+
const scrollTimeline = {
|
|
1940
|
+
scrollTimeline: SHORTHAND,
|
|
1941
|
+
scrollTimelineAxis: LONGHAND,
|
|
1942
|
+
scrollTimelineName: LONGHAND
|
|
1943
|
+
};
|
|
1944
|
+
const text = {
|
|
1945
|
+
textDecoration: SHORTHAND,
|
|
1946
|
+
textDecorationColor: LONGHAND,
|
|
1947
|
+
textDecorationLine: LONGHAND,
|
|
1948
|
+
textDecorationSkip: LONGHAND,
|
|
1949
|
+
textDecorationSkipInk: LONGHAND,
|
|
1950
|
+
textDecorationStyle: LONGHAND,
|
|
1951
|
+
textDecorationThickness: LONGHAND,
|
|
1952
|
+
textEmphasis: SHORTHAND,
|
|
1953
|
+
textEmphasisColor: LONGHAND,
|
|
1954
|
+
textEmphasisPosition: LONGHAND,
|
|
1955
|
+
textEmphasisStyle: LONGHAND
|
|
1956
|
+
};
|
|
1957
|
+
const transition = {
|
|
1958
|
+
transition: SHORTHAND,
|
|
1959
|
+
transitionBehavior: LONGHAND,
|
|
1960
|
+
transitionDelay: LONGHAND,
|
|
1961
|
+
transitionDuration: LONGHAND,
|
|
1962
|
+
transitionProperty: LONGHAND,
|
|
1963
|
+
transitionTimingFunction: LONGHAND
|
|
1964
|
+
};
|
|
1965
|
+
const viewTimeline = {
|
|
1966
|
+
viewTimeline: SHORTHAND,
|
|
1967
|
+
viewTimelineAxis: LONGHAND,
|
|
1968
|
+
viewTimelineInset: LONGHAND,
|
|
1969
|
+
viewTimelineName: LONGHAND
|
|
1970
|
+
};
|
|
1971
|
+
const whiteSpace = {
|
|
1972
|
+
whiteSpace: SHORTHAND,
|
|
1973
|
+
whiteSpaceCollapse: LONGHAND
|
|
1974
|
+
};
|
|
1975
|
+
//#endregion
|
|
1976
|
+
//#region atomic/property/presets.ts
|
|
1977
|
+
const DefaultPropertyTypes = {
|
|
1978
|
+
...animation,
|
|
1979
|
+
...background,
|
|
1980
|
+
...border,
|
|
1981
|
+
...columns,
|
|
1982
|
+
...containIntrinsicSize,
|
|
1983
|
+
...container,
|
|
1984
|
+
...flex,
|
|
1985
|
+
...font,
|
|
1986
|
+
...gap,
|
|
1987
|
+
...grid,
|
|
1988
|
+
...inset,
|
|
1989
|
+
...listStyle,
|
|
1990
|
+
...margin,
|
|
1991
|
+
...mask,
|
|
1992
|
+
...offset,
|
|
1993
|
+
...outline,
|
|
1994
|
+
...overflow,
|
|
1995
|
+
...overscrollBehavior,
|
|
1996
|
+
...padding,
|
|
1997
|
+
...place,
|
|
1998
|
+
...scrollMargin,
|
|
1999
|
+
...scrollPadding,
|
|
2000
|
+
...scrollTimeline,
|
|
2001
|
+
...text,
|
|
2002
|
+
...transition,
|
|
2003
|
+
...viewTimeline,
|
|
2004
|
+
...whiteSpace
|
|
2005
|
+
};
|
|
2006
|
+
function getPropertyPriority(property) {
|
|
2007
|
+
return DefaultPropertyTypes[property] ?? 0;
|
|
2008
|
+
}
|
|
2009
|
+
function getCssPropertyName(property) {
|
|
2010
|
+
return property.replace(/^(webkit|moz|ms|o)([A-Z])/g, (_, prefix, c) => `-${prefix}-${c.toLowerCase()}`).replace(/[A-Z]/g, (c) => "-" + c.toLowerCase());
|
|
2011
|
+
}
|
|
2012
|
+
//#endregion
|
|
2013
|
+
//#region atomic/value/unitless.ts
|
|
2014
|
+
const UnitlessProperties = [
|
|
2015
|
+
"animationIterationCount",
|
|
2016
|
+
"aspectRatio",
|
|
2017
|
+
"borderImageOutset",
|
|
2018
|
+
"borderImageSlice",
|
|
2019
|
+
"borderImageWidth",
|
|
2020
|
+
"boxFlex",
|
|
2021
|
+
"boxFlexGroup",
|
|
2022
|
+
"boxOrdinalGroup",
|
|
2023
|
+
"columnCount",
|
|
2024
|
+
"columns",
|
|
2025
|
+
"fillOpacity",
|
|
2026
|
+
"flex",
|
|
2027
|
+
"flexGrow",
|
|
2028
|
+
"flexNegative",
|
|
2029
|
+
"flexOrder",
|
|
2030
|
+
"flexPositive",
|
|
2031
|
+
"flexShrink",
|
|
2032
|
+
"floodOpacity",
|
|
2033
|
+
"fontWeight",
|
|
2034
|
+
"gridArea",
|
|
2035
|
+
"gridColumn",
|
|
2036
|
+
"gridColumnEnd",
|
|
2037
|
+
"gridColumnSpan",
|
|
2038
|
+
"gridColumnStart",
|
|
2039
|
+
"gridRow",
|
|
2040
|
+
"gridRowEnd",
|
|
2041
|
+
"gridRowSpan",
|
|
2042
|
+
"gridRowStart",
|
|
2043
|
+
"imageOrientation",
|
|
2044
|
+
"lineClamp",
|
|
2045
|
+
"lineHeight",
|
|
2046
|
+
"opacity",
|
|
2047
|
+
"order",
|
|
2048
|
+
"orphans",
|
|
2049
|
+
"scale",
|
|
2050
|
+
"stopOpacity",
|
|
2051
|
+
"strokeDasharray",
|
|
2052
|
+
"strokeDashoffset",
|
|
2053
|
+
"strokeMiterlimit",
|
|
2054
|
+
"strokeOpacity",
|
|
2055
|
+
"strokeWidth",
|
|
2056
|
+
"tabSize",
|
|
2057
|
+
"widows",
|
|
2058
|
+
"zIndex",
|
|
2059
|
+
"zoom"
|
|
2060
|
+
];
|
|
2061
|
+
//#endregion
|
|
2062
|
+
//#region atomic/value/value.ts
|
|
2063
|
+
const CSS_NUMBER_VALUE = /^-?(\d+\.?\d*|\.\d+)$/;
|
|
2064
|
+
const UNITLESS = new Set(UnitlessProperties);
|
|
2065
|
+
function getCssPropertyValue(property, value) {
|
|
2066
|
+
if (!value || !shouldAppendCssPx(property)) return value;
|
|
2067
|
+
if (CSS_NUMBER_VALUE.test(value)) return value + "px";
|
|
2068
|
+
return value;
|
|
2069
|
+
}
|
|
2070
|
+
function shouldAppendCssPx(property) {
|
|
2071
|
+
return !UNITLESS.has(property);
|
|
2072
|
+
}
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region atomic/atRule/utils.ts
|
|
2075
|
+
function createAtRuleNameFormatter(defaultFormat, prefix) {
|
|
2076
|
+
const formatter = createNameFormatter(["name"]);
|
|
2077
|
+
return (format, id, info) => {
|
|
2078
|
+
const hash = getIdentifierSafeHash(id, CSS_CONFIG.hashLength);
|
|
2079
|
+
const name = formatter(format || defaultFormat, hash, info);
|
|
2080
|
+
if (!prefix) return name;
|
|
2081
|
+
return name.startsWith(prefix) ? name : prefix + name;
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
function buildNamedAtRuleCss(atRule, name, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2085
|
+
return `@${atRule} ${name} {${buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true)}}`;
|
|
2086
|
+
}
|
|
2087
|
+
function buildAtRuleDeclarationCss(style, tokens, tokenLookup, tokenNameFormat, rawValue, shouldInclude) {
|
|
2088
|
+
let css = "";
|
|
2089
|
+
for (const property in style) {
|
|
2090
|
+
if (shouldInclude && !shouldInclude(property)) continue;
|
|
2091
|
+
let value = style[property];
|
|
2092
|
+
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "number") value = value[1];
|
|
2093
|
+
if (isStyleTokenData(value)) {
|
|
2094
|
+
const tokenId = getStyleTokenId(value);
|
|
2095
|
+
if (!tokenLookup.has(tokenId)) {
|
|
2096
|
+
tokenLookup.add(tokenId);
|
|
2097
|
+
tokens.push(value);
|
|
2098
|
+
}
|
|
2099
|
+
css += `${getCssPropertyName(property)}: ${getTokenVar(value, tokenNameFormat)};`;
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2102
|
+
const valueString = String(value ?? "");
|
|
2103
|
+
css += `${getCssPropertyName(property)}: ${rawValue ? valueString : getCssPropertyValue(property, valueString)};`;
|
|
2104
|
+
}
|
|
2105
|
+
return css;
|
|
2106
|
+
}
|
|
2107
|
+
//#endregion
|
|
2108
|
+
//#region atomic/atRule/counterStyle.ts
|
|
2109
|
+
const COUNTER_STYLE_AT_RULE = "counter-style";
|
|
2110
|
+
const formatCounterStyleName = createAtRuleNameFormatter("counter-style[-(name)]-$hash");
|
|
2111
|
+
function buildCounterStyleCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2112
|
+
name = formatCounterStyleName(format, id, { name });
|
|
2113
|
+
const css = buildNamedAtRuleCss(COUNTER_STYLE_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
2114
|
+
return {
|
|
2115
|
+
name,
|
|
2116
|
+
css
|
|
2117
|
+
};
|
|
2118
|
+
}
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region config/config/css_extra.ts
|
|
2121
|
+
const CSS_EXTRA_CONFIG_DEFAULT = { namedRuleFormat: {} };
|
|
2122
|
+
const CSS_EXTRA_CONFIG = globalData("config.cssExtra", () => ({ ...CSS_EXTRA_CONFIG_DEFAULT }));
|
|
2123
|
+
//#endregion
|
|
2124
|
+
//#region utils/id.ts
|
|
2125
|
+
function createIdCounter(name) {
|
|
2126
|
+
return globalData("idCounter." + name, () => ({ value: 0 }));
|
|
2127
|
+
}
|
|
2128
|
+
function getId(idCounter, stableId) {
|
|
2129
|
+
return stableId || {
|
|
2130
|
+
name: null,
|
|
2131
|
+
id: String(idCounter.value++)
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
//#endregion
|
|
2135
|
+
//#region css/utils.ts
|
|
2136
|
+
function createNamedAtRuleRef(config) {
|
|
2137
|
+
const { id, name } = getId(config.idCounter, config.stableId || null);
|
|
2138
|
+
const tokens = [];
|
|
2139
|
+
const tokenLookup = /* @__PURE__ */ new Set();
|
|
2140
|
+
const css = config.buildCss(config.format || null, name, id, config.value, tokens, tokenLookup, CSS_CONFIG.tokenNameFormat || null);
|
|
2141
|
+
return createAtRuleRef({
|
|
2142
|
+
key: css.name,
|
|
2143
|
+
value: css.name,
|
|
2144
|
+
css: css.css,
|
|
2145
|
+
tokens: tokens.length ? tokens : void 0
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
//#endregion
|
|
2149
|
+
//#region css/counterStyle.ts
|
|
2150
|
+
const idCounter$5 = createIdCounter("counterStyle");
|
|
2151
|
+
function createCounterStyle(descriptors, stableId) {
|
|
2152
|
+
return createNamedAtRuleRef({
|
|
2153
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.counterStyle,
|
|
2154
|
+
buildCss: buildCounterStyleCss,
|
|
2155
|
+
value: descriptors,
|
|
2156
|
+
idCounter: idCounter$5,
|
|
2157
|
+
stableId
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
//#endregion
|
|
2161
|
+
//#region atomic/atRule/fontFace.ts
|
|
2162
|
+
const FONT_FACE_AT_RULE = "font-face";
|
|
2163
|
+
const formatFontFaceName = createAtRuleNameFormatter("font[-(name)]-$hash");
|
|
2164
|
+
function buildFontFaceCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2165
|
+
name = formatFontFaceName(format, id, { name });
|
|
2166
|
+
let css = buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true, (property) => property !== "fontFamily");
|
|
2167
|
+
css = `@${FONT_FACE_AT_RULE} { font-family: ${name}; ${css} }`;
|
|
2168
|
+
return {
|
|
2169
|
+
name,
|
|
2170
|
+
css
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
//#endregion
|
|
2174
|
+
//#region atomic/atRule/fontSrc.ts
|
|
2175
|
+
function fontSrc(url, format) {
|
|
2176
|
+
if (typeof url !== "string") throw new Error("fontSrc url must be a static string");
|
|
2177
|
+
const src = `url("${escapeFontSrcPart(url)}")`;
|
|
2178
|
+
return format ? `${src} format("${escapeFontSrcPart(format)}")` : src;
|
|
2179
|
+
}
|
|
2180
|
+
function escapeFontSrcPart(value) {
|
|
2181
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
2182
|
+
}
|
|
2183
|
+
//#endregion
|
|
2184
|
+
//#region css/fontFace.ts
|
|
2185
|
+
const idCounter$4 = createIdCounter("fontFace");
|
|
2186
|
+
function createFontFace(descriptors, stableId) {
|
|
2187
|
+
if (typeof descriptors.src !== "string") throw new Error("createFontFace \"src\" must be a static string");
|
|
2188
|
+
return createNamedAtRuleRef({
|
|
2189
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontFace,
|
|
2190
|
+
buildCss: buildFontFaceCss,
|
|
2191
|
+
value: descriptors,
|
|
2192
|
+
idCounter: idCounter$4,
|
|
2193
|
+
stableId
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
//#endregion
|
|
2197
|
+
//#region atomic/atRule/fontPaletteValues.ts
|
|
2198
|
+
const FONT_PALETTE_VALUES_AT_RULE = "font-palette-values";
|
|
2199
|
+
const formatFontPaletteValuesName = createAtRuleNameFormatter("font-palettle[-(name)]-$hash", "--");
|
|
2200
|
+
function buildFontPaletteValuesCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
2201
|
+
name = formatFontPaletteValuesName(format, id, { name });
|
|
2202
|
+
const css = buildNamedAtRuleCss(FONT_PALETTE_VALUES_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
2203
|
+
return {
|
|
2204
|
+
name,
|
|
2205
|
+
css
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
//#endregion
|
|
2209
|
+
//#region css/fontPaletteValues.ts
|
|
2210
|
+
const idCounter$3 = createIdCounter("fontPaletteValues");
|
|
2211
|
+
function createFontPaletteValues(descriptors, stableId) {
|
|
2212
|
+
return createNamedAtRuleRef({
|
|
2213
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontPaletteValues,
|
|
2214
|
+
buildCss: buildFontPaletteValuesCss,
|
|
2215
|
+
value: descriptors,
|
|
2216
|
+
idCounter: idCounter$3,
|
|
2217
|
+
stableId
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
//#endregion
|
|
2221
|
+
//#region sheet/utils/layer.ts
|
|
2222
|
+
function createSheetLayerState() {
|
|
2223
|
+
return createLayerPool(getStyleLayerName());
|
|
2224
|
+
}
|
|
2225
|
+
function getSheetRulePriority(priority) {
|
|
2226
|
+
return priority ?? LayerDefaultPriority;
|
|
2227
|
+
}
|
|
2228
|
+
function getSheetRuleLayerPriority(priority, important) {
|
|
2229
|
+
const resolved = getSheetRulePriority(priority);
|
|
2230
|
+
return important ? [
|
|
2231
|
+
-resolved[0],
|
|
2232
|
+
-resolved[1],
|
|
2233
|
+
-resolved[2],
|
|
2234
|
+
-resolved[3],
|
|
2235
|
+
-resolved[4],
|
|
2236
|
+
-resolved[5],
|
|
2237
|
+
-resolved[6]
|
|
2238
|
+
] : resolved;
|
|
2239
|
+
}
|
|
2240
|
+
function getStyleLayerName() {
|
|
2241
|
+
return CSS_CONFIG.layerNamespace || "css";
|
|
2242
|
+
}
|
|
2243
|
+
function getSheetLayerName() {
|
|
2244
|
+
return getStyleLayerName() + ".sheet";
|
|
2245
|
+
}
|
|
2246
|
+
function getSheetLayerNames(layerState, hasSheetLayer, namedLayers = /* @__PURE__ */ new Set()) {
|
|
2247
|
+
const names = layerState.getNames();
|
|
2248
|
+
return [...new Set([
|
|
2249
|
+
...names,
|
|
2250
|
+
...hasSheetLayer ? [getSheetLayerName()] : [],
|
|
2251
|
+
...namedLayers
|
|
2252
|
+
])];
|
|
2253
|
+
}
|
|
2254
|
+
//#endregion
|
|
2255
|
+
//#region sheet/ordering.ts
|
|
2256
|
+
function sheetRuleLayer(rule, config = CSS_CONFIG) {
|
|
2257
|
+
const mainEnabled = isStyleLayerEnabled(config.layer);
|
|
2258
|
+
let layer = rule.layer ?? "style";
|
|
2259
|
+
if (layer === "style" && !mainEnabled) layer = false;
|
|
2260
|
+
if (rule.sheet && rule.important && !rule.importantNative && layer !== false) return { name: (typeof layer === "object" ? layer.name : config.layerNamespace || "css") + ".important" };
|
|
2261
|
+
return layer;
|
|
2262
|
+
}
|
|
2263
|
+
function sheetRuleGroup(rule, config = CSS_CONFIG) {
|
|
2264
|
+
if (rule.globalSheet) return "global:" + rule.globalSheet.id;
|
|
2265
|
+
return rule.sheet && sheetRuleLayer(rule, config) === false ? "local-unlayered" : "regular";
|
|
2266
|
+
}
|
|
2267
|
+
function compareSheetGroups(a, b) {
|
|
2268
|
+
const region = (rule) => rule.globalSheet ? rule.globalSheet.order <= 0 ? 0 : 2 : 1;
|
|
2269
|
+
const order = region(a) - region(b);
|
|
2270
|
+
if (order) return order;
|
|
2271
|
+
if (a.globalSheet && b.globalSheet) return a.globalSheet.order - b.globalSheet.order;
|
|
2272
|
+
return 0;
|
|
2273
|
+
}
|
|
2274
|
+
function compareSheetRules(a, b, config = CSS_CONFIG) {
|
|
2275
|
+
const layerRank = (rule) => {
|
|
2276
|
+
const layer = sheetRuleLayer(rule, config);
|
|
2277
|
+
const main = config.layerNamespace || "css";
|
|
2278
|
+
return layer === false ? 2 : layer === "style" || typeof layer === "object" && layer.name === main ? 0 : 1;
|
|
2279
|
+
};
|
|
2280
|
+
return layerRank(a) - layerRank(b) || compareLayerPriority(getSheetRulePriority(a.priority), getSheetRulePriority(b.priority));
|
|
2281
|
+
}
|
|
2282
|
+
/** Stable group sort: equal global orders keep the first-discovered sheet first. */
|
|
2283
|
+
function orderSheetRules(rules, config = CSS_CONFIG) {
|
|
2284
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2285
|
+
for (const rule of rules) {
|
|
2286
|
+
const key = sheetRuleGroup(rule, config);
|
|
2287
|
+
const group = groups.get(key) ?? [];
|
|
2288
|
+
group.push(rule);
|
|
2289
|
+
groups.set(key, group);
|
|
2290
|
+
}
|
|
2291
|
+
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)));
|
|
2292
|
+
}
|
|
2293
|
+
/** Reserve each parent's first child for managed important declarations. */
|
|
2294
|
+
function sheetLayerOrder(names, config = CSS_CONFIG, reservedParents = names) {
|
|
2295
|
+
const roots = [];
|
|
2296
|
+
const children = /* @__PURE__ */ new Map();
|
|
2297
|
+
const add = (name) => {
|
|
2298
|
+
const parts = name.split(".");
|
|
2299
|
+
if (!roots.includes(parts[0])) roots.push(parts[0]);
|
|
2300
|
+
for (let i = 1; i < parts.length; i++) {
|
|
2301
|
+
const parent = parts.slice(0, i).join(".");
|
|
2302
|
+
const child = parts.slice(0, i + 1).join(".");
|
|
2303
|
+
const list = children.get(parent) ?? [];
|
|
2304
|
+
if (!list.includes(child)) list.push(child);
|
|
2305
|
+
children.set(parent, list);
|
|
2306
|
+
}
|
|
2307
|
+
if (!name.endsWith(".important") && reservedParents.includes(name)) children.set(name, children.get(name) ?? []);
|
|
2308
|
+
};
|
|
2309
|
+
for (const name of [...(config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).filter((name) => name !== "$layer"), ...names]) add(name);
|
|
2310
|
+
const rootOrder = flattenCssLayers((config.layers ?? CSS_CONFIG_DEFAULT.layers ?? []).map((name) => name === "$layer" ? name : name.split(".")[0]), roots);
|
|
2311
|
+
const ordered = /* @__PURE__ */ new Set();
|
|
2312
|
+
const append = (name) => {
|
|
2313
|
+
ordered.add(name);
|
|
2314
|
+
const list = children.get(name);
|
|
2315
|
+
if (!list || name.endsWith(".important")) return;
|
|
2316
|
+
ordered.add(name + ".important");
|
|
2317
|
+
for (const child of list) append(child);
|
|
2318
|
+
};
|
|
2319
|
+
for (const root of new Set([...rootOrder, ...roots.filter((name) => children.has(name))])) append(root);
|
|
2320
|
+
return ordered.size ? "@layer " + [...ordered].join(", ") + ";" : "";
|
|
2321
|
+
}
|
|
2322
|
+
function layerNameForRule(rule, config, mode, pool) {
|
|
2323
|
+
const layer = sheetRuleLayer(rule, config);
|
|
2324
|
+
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";
|
|
2325
|
+
}
|
|
2326
|
+
/** Build only ordering declarations; runtime flushing need not serialize rule bodies. */
|
|
2327
|
+
function sheetOrderingPreamble(rules, config = CSS_CONFIG, mode = "sort") {
|
|
2328
|
+
const pool = createLayerPool(config.layerNamespace || "css");
|
|
2329
|
+
const names = /* @__PURE__ */ new Set();
|
|
2330
|
+
for (const rule of orderSheetRules(rules, config)) {
|
|
2331
|
+
const name = layerNameForRule(rule, config, mode, pool);
|
|
2332
|
+
if (name) names.add(name);
|
|
2333
|
+
}
|
|
2334
|
+
const priorities = pool.getNames();
|
|
2335
|
+
const named = [...names].filter((name) => !priorities.includes(name));
|
|
2336
|
+
return sheetLayerOrder([...priorities, ...named], config, named);
|
|
2337
|
+
}
|
|
2338
|
+
//#endregion
|
|
2339
|
+
//#region sheet/utils/dom.ts
|
|
2340
|
+
function resolveDocument(documentOverride) {
|
|
2341
|
+
if (documentOverride !== void 0) return documentOverride;
|
|
2342
|
+
if (typeof document === "undefined") return null;
|
|
2343
|
+
return document;
|
|
2344
|
+
}
|
|
2345
|
+
function createStyleTag(document, name, nonce = DEV_CONFIG.sheetStyleTagNonce) {
|
|
2346
|
+
const tag = document.createElement("style");
|
|
2347
|
+
tag.setAttribute("data-css-sheet", name);
|
|
2348
|
+
if (nonce) tag.setAttribute("nonce", nonce);
|
|
2349
|
+
return tag;
|
|
2350
|
+
}
|
|
2351
|
+
function appendStyleTag(document, tag) {
|
|
2352
|
+
(document.head || document.getElementsByTagName("head")[0] || document.documentElement).appendChild(tag);
|
|
2353
|
+
}
|
|
2354
|
+
function insertStyleTagAfter(document, tag, previous) {
|
|
2355
|
+
if (!previous || !previous.parentNode) {
|
|
2356
|
+
appendStyleTag(document, tag);
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2359
|
+
previous.parentNode.insertBefore(tag, previous.nextSibling);
|
|
2360
|
+
}
|
|
2361
|
+
function insertStyleTagAtTop(document, tag) {
|
|
2362
|
+
const head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
|
2363
|
+
const first = getFirstCssSheetTag(head);
|
|
2364
|
+
if (first) head.insertBefore(tag, first);
|
|
2365
|
+
else head.appendChild(tag);
|
|
2366
|
+
}
|
|
2367
|
+
function getFirstCssSheetTag(head) {
|
|
2368
|
+
const nodes = head.childNodes;
|
|
2369
|
+
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
2370
|
+
const node = nodes[i];
|
|
2371
|
+
if (typeof node.getAttribute !== "function") continue;
|
|
2372
|
+
if (node.getAttribute("data-css-sheet")) return node;
|
|
2373
|
+
}
|
|
2374
|
+
return null;
|
|
2375
|
+
}
|
|
2376
|
+
//#endregion
|
|
2377
|
+
//#region sheet/ordered.ts
|
|
2378
|
+
const refreshers = globalData("sheet.ordered.refreshers", () => /* @__PURE__ */ new Set());
|
|
2379
|
+
/** Keep whole global sheets together; move DOM groups without rebuilding unrelated rules. */
|
|
2380
|
+
function createOrderedSheet(create, options, dev) {
|
|
2381
|
+
const document = resolveDocument(options.document);
|
|
2382
|
+
if (!document) return create(options);
|
|
2383
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2384
|
+
const owners = /* @__PURE__ */ new Map();
|
|
2385
|
+
const direct = [];
|
|
2386
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2387
|
+
let activeLayers = CSS_CONFIG.layers;
|
|
2388
|
+
let enabled = false;
|
|
2389
|
+
let header = null;
|
|
2390
|
+
let serial = 0;
|
|
2391
|
+
let dirty = false;
|
|
2392
|
+
let orderingDirty = true;
|
|
2393
|
+
let order = "";
|
|
2394
|
+
let mode = DEV_CONFIG.stylePriorityMode;
|
|
2395
|
+
const pending = /* @__PURE__ */ new Set();
|
|
2396
|
+
const regular = getGroup("regular");
|
|
2397
|
+
const refresh = () => {
|
|
2398
|
+
dirty = true;
|
|
2399
|
+
orderingDirty = true;
|
|
2400
|
+
flush();
|
|
2401
|
+
};
|
|
2402
|
+
if (dev) refreshers.add(refresh);
|
|
2403
|
+
function getGroup(name) {
|
|
2404
|
+
const previous = groups.get(name);
|
|
2405
|
+
if (previous) return previous;
|
|
2406
|
+
const tagName = name === "regular" ? options.tagName : (options.tagName ? options.tagName + " " : "") + "ordered-" + ++serial;
|
|
2407
|
+
const group = {
|
|
2408
|
+
name,
|
|
2409
|
+
tagName,
|
|
2410
|
+
rules: [],
|
|
2411
|
+
ordering: /* @__PURE__ */ new Map(),
|
|
2412
|
+
sheet: create({
|
|
2413
|
+
...options,
|
|
2414
|
+
tagName
|
|
2415
|
+
})
|
|
2416
|
+
};
|
|
2417
|
+
group.sheet.updateLayers(activeLayers ?? []);
|
|
2418
|
+
groups.set(name, group);
|
|
2419
|
+
return group;
|
|
2420
|
+
}
|
|
2421
|
+
function route(rule) {
|
|
2422
|
+
return {
|
|
2423
|
+
...rule,
|
|
2424
|
+
layer: sheetRuleLayer(rule)
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
function insert(rule) {
|
|
2428
|
+
const item = typeof rule === "string" ? { css: rule } : rule;
|
|
2429
|
+
const key = sheetRuleGroup(item) + "\0" + (item.key ?? item.css);
|
|
2430
|
+
if (seen.has(key)) return;
|
|
2431
|
+
seen.add(key);
|
|
2432
|
+
direct.push(item);
|
|
2433
|
+
add(item);
|
|
2434
|
+
}
|
|
2435
|
+
function add(item) {
|
|
2436
|
+
enabled ||= !!(item.sheet || item.globalSheet);
|
|
2437
|
+
const group = getGroup(sheetRuleGroup(item));
|
|
2438
|
+
const previous = group.rules[group.rules.length - 1];
|
|
2439
|
+
group.rules.push(item);
|
|
2440
|
+
trackOrdering(group, item);
|
|
2441
|
+
if (!dev && 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 trackOrdering(group, rule) {
|
|
2446
|
+
const key = JSON.stringify([
|
|
2447
|
+
rule.layer ?? "style",
|
|
2448
|
+
rule.priority ?? [
|
|
2449
|
+
0,
|
|
2450
|
+
0,
|
|
2451
|
+
0,
|
|
2452
|
+
0,
|
|
2453
|
+
0,
|
|
2454
|
+
0,
|
|
2455
|
+
0
|
|
2456
|
+
],
|
|
2457
|
+
!!rule.sheet,
|
|
2458
|
+
!!rule.important,
|
|
2459
|
+
!!rule.importantNative,
|
|
2460
|
+
rule.globalSheet?.order
|
|
2461
|
+
]);
|
|
2462
|
+
if (group.ordering.has(key)) return;
|
|
2463
|
+
group.ordering.set(key, rule);
|
|
2464
|
+
orderingDirty = true;
|
|
2465
|
+
}
|
|
2466
|
+
function rebuild(group) {
|
|
2467
|
+
pending.delete(group);
|
|
2468
|
+
group.sheet.destroy?.();
|
|
2469
|
+
group.sheet = create({
|
|
2470
|
+
...options,
|
|
2471
|
+
tagName: group.tagName
|
|
2472
|
+
});
|
|
2473
|
+
group.sheet.updateLayers(activeLayers ?? []);
|
|
2474
|
+
group.rules.sort((a, b) => compareSheetRules(a, b));
|
|
2475
|
+
group.ordering.clear();
|
|
2476
|
+
orderingDirty = true;
|
|
2477
|
+
for (const rule of group.rules) trackOrdering(group, rule);
|
|
2478
|
+
for (const rule of group.rules) group.sheet.insert(route(rule));
|
|
2479
|
+
group.sheet.flush();
|
|
2480
|
+
dirty = true;
|
|
2481
|
+
}
|
|
2482
|
+
function collectTags() {
|
|
2483
|
+
const lookup = new Map([...groups.values()].map((group) => [group.tagName ?? "", group]));
|
|
2484
|
+
const result = /* @__PURE__ */ new Map();
|
|
2485
|
+
const head = document.head || document.documentElement;
|
|
2486
|
+
for (const node of Array.from(head.childNodes)) {
|
|
2487
|
+
if (typeof node.getAttribute !== "function") continue;
|
|
2488
|
+
const match = node.getAttribute("data-css-sheet")?.match(/^(?:(.*) )?(?:layers|rules(?: .*)?)$/);
|
|
2489
|
+
const group = match && lookup.get(match[1] ?? "");
|
|
2490
|
+
if (!group) continue;
|
|
2491
|
+
const list = result.get(group) ?? [];
|
|
2492
|
+
list.push(node);
|
|
2493
|
+
result.set(group, list);
|
|
2494
|
+
}
|
|
2495
|
+
return result;
|
|
2496
|
+
}
|
|
2497
|
+
function flush() {
|
|
2498
|
+
if (dev && mode !== DEV_CONFIG.stylePriorityMode) {
|
|
2499
|
+
mode = DEV_CONFIG.stylePriorityMode;
|
|
2500
|
+
dirty = true;
|
|
2501
|
+
orderingDirty = true;
|
|
2502
|
+
}
|
|
2503
|
+
for (const group of pending) rebuild(group);
|
|
2504
|
+
pending.clear();
|
|
2505
|
+
for (const group of groups.values()) group.sheet.flush();
|
|
2506
|
+
if (!enabled || !dirty) return;
|
|
2507
|
+
if (orderingDirty) {
|
|
2508
|
+
const config = {
|
|
2509
|
+
...CSS_CONFIG,
|
|
2510
|
+
layers: activeLayers ? [...activeLayers] : void 0
|
|
2511
|
+
};
|
|
2512
|
+
const all = [];
|
|
2513
|
+
for (const group of groups.values()) for (const rule of group.ordering.values()) all.push(rule);
|
|
2514
|
+
order = sheetOrderingPreamble(all, config, dev ? DEV_CONFIG.stylePriorityMode : "layer");
|
|
2515
|
+
orderingDirty = false;
|
|
2516
|
+
}
|
|
2517
|
+
const head = document.head || document.documentElement;
|
|
2518
|
+
const groupTags = collectTags();
|
|
2519
|
+
if (!header) {
|
|
2520
|
+
header = createStyleTag(document, (options.tagName ? options.tagName + " " : "") + "ordering", options.nonce);
|
|
2521
|
+
const first = groupTags.get(regular)?.[0];
|
|
2522
|
+
if (first) head.insertBefore(header, first);
|
|
2523
|
+
else head.appendChild(header);
|
|
2524
|
+
}
|
|
2525
|
+
if (header.textContent !== order) header.textContent = order;
|
|
2526
|
+
const sorted = [...groups.values()].sort((a, b) => {
|
|
2527
|
+
const ar = a.rules[0] ?? { css: "" };
|
|
2528
|
+
const br = b.rules[0] ?? { css: "" };
|
|
2529
|
+
return compareSheetGroups(ar, br) || (!ar.globalSheet && !br.globalSheet ? Number(a.name === "local-unlayered") - Number(b.name === "local-unlayered") : 0);
|
|
2530
|
+
});
|
|
2531
|
+
let previous = header;
|
|
2532
|
+
for (const group of sorted) for (const tag of groupTags.get(group) ?? []) {
|
|
2533
|
+
if (previous.nextSibling !== tag) {
|
|
2534
|
+
const oldSheet = tag.sheet;
|
|
2535
|
+
const css = oldSheet ? Array.from(oldSheet.cssRules).map((rule) => rule.cssText) : [];
|
|
2536
|
+
head.insertBefore(tag, previous.nextSibling);
|
|
2537
|
+
if (oldSheet && tag.sheet !== oldSheet && css.length && !tag.sheet?.cssRules.length) for (const rule of css) tag.sheet?.insertRule(rule, tag.sheet.cssRules.length);
|
|
2538
|
+
}
|
|
2539
|
+
previous = tag;
|
|
2540
|
+
}
|
|
2541
|
+
dirty = false;
|
|
2542
|
+
}
|
|
2543
|
+
return {
|
|
2544
|
+
insert,
|
|
2545
|
+
flush,
|
|
2546
|
+
updateLayers(layers) {
|
|
2547
|
+
if (activeLayers?.length === layers.length && layers.every((name, index) => activeLayers[index] === name)) return;
|
|
2548
|
+
activeLayers = [...layers];
|
|
2549
|
+
orderingDirty = true;
|
|
2550
|
+
for (const group of groups.values()) group.sheet.updateLayers(layers);
|
|
2551
|
+
dirty = true;
|
|
2552
|
+
},
|
|
2553
|
+
replaceRules(owner, rules) {
|
|
2554
|
+
const previous = owners.get(owner) ?? [];
|
|
2555
|
+
owners.set(owner, rules);
|
|
2556
|
+
enabled = true;
|
|
2557
|
+
const affected = new Set([...previous, ...rules].map((rule) => sheetRuleGroup(rule)));
|
|
2558
|
+
const all = [...direct, ...[...owners.values()].flat()];
|
|
2559
|
+
for (const name of affected) {
|
|
2560
|
+
const group = getGroup(name);
|
|
2561
|
+
group.rules = all.filter((rule) => sheetRuleGroup(rule) === name);
|
|
2562
|
+
rebuild(group);
|
|
2563
|
+
}
|
|
2564
|
+
flush();
|
|
2565
|
+
},
|
|
2566
|
+
destroy() {
|
|
2567
|
+
refreshers.delete(refresh);
|
|
2568
|
+
for (const group of groups.values()) group.sheet.destroy?.();
|
|
2569
|
+
if (header?.parentNode) header.parentNode.removeChild(header);
|
|
2570
|
+
groups.clear();
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
//#endregion
|
|
2575
|
+
//#region sheet/utils/noop.ts
|
|
2576
|
+
const noopSheet = {
|
|
2577
|
+
updateLayers() {},
|
|
2578
|
+
insert() {},
|
|
2579
|
+
flush() {}
|
|
2580
|
+
};
|
|
2581
|
+
function createNoopSheet() {
|
|
2582
|
+
return noopSheet;
|
|
2583
|
+
}
|
|
2584
|
+
//#endregion
|
|
2585
|
+
//#region sheet/utils/rule.ts
|
|
2586
|
+
function normalizeRule(rule) {
|
|
2587
|
+
return typeof rule === "string" ? rule : rule.css;
|
|
2588
|
+
}
|
|
2589
|
+
//#endregion
|
|
2590
|
+
//#region sheet/utils/sourcemap.ts
|
|
2591
|
+
const VLQ_BASE_SHIFT = 5;
|
|
2592
|
+
const VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
2593
|
+
const VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
2594
|
+
const VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
2595
|
+
const BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2596
|
+
const SOURCE_URL_PREFIX = "source://";
|
|
2597
|
+
function createSourceMapComment$1(rules) {
|
|
2598
|
+
const sources = [];
|
|
2599
|
+
const sourceLookup = Object.create(null);
|
|
2600
|
+
let generatedLine = 0;
|
|
2601
|
+
let previousSource = 0;
|
|
2602
|
+
let previousOriginalLine = 0;
|
|
2603
|
+
let previousOriginalColumn = 0;
|
|
2604
|
+
const mappingLines = [];
|
|
2605
|
+
for (let i = 0, len = rules.length; i < len; i++) {
|
|
2606
|
+
const rule = rules[i];
|
|
2607
|
+
const sourceData = rule.source;
|
|
2608
|
+
let mapping = "";
|
|
2609
|
+
if (sourceData) {
|
|
2610
|
+
const source = getSource(sources, sourceLookup, getSourceMapSourceUrl(sourceData), sourceData.sourceContent);
|
|
2611
|
+
const originalLine = Math.max(sourceData.line - 1, 0);
|
|
2612
|
+
const originalColumn = Math.max(sourceData.column - 1, 0);
|
|
2613
|
+
mapping += encodeVlq(0);
|
|
2614
|
+
mapping += encodeVlq(source.sourceIndex - previousSource);
|
|
2615
|
+
mapping += encodeVlq(originalLine - previousOriginalLine);
|
|
2616
|
+
mapping += encodeVlq(originalColumn - previousOriginalColumn);
|
|
2617
|
+
previousSource = source.sourceIndex;
|
|
2618
|
+
previousOriginalLine = originalLine;
|
|
2619
|
+
previousOriginalColumn = originalColumn;
|
|
2620
|
+
}
|
|
2621
|
+
mappingLines[generatedLine] = mapping;
|
|
2622
|
+
const lineCount = getLineCount(rule.css);
|
|
2623
|
+
for (let j = 1; j < lineCount; j++) mappingLines[generatedLine + j] = "";
|
|
2624
|
+
generatedLine += lineCount;
|
|
2625
|
+
}
|
|
2626
|
+
if (!sources.length) return "";
|
|
2627
|
+
const data = {
|
|
2628
|
+
version: 3,
|
|
2629
|
+
sources: sources.map((source) => source.filePath),
|
|
2630
|
+
sourcesContent: sources.some((source) => source.sourceContent !== void 0) ? sources.map((source) => source.sourceContent ?? null) : void 0,
|
|
2631
|
+
names: [],
|
|
2632
|
+
mappings: mappingLines.join(";")
|
|
2633
|
+
};
|
|
2634
|
+
return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + encodeBase64(JSON.stringify(data)) + " */";
|
|
2635
|
+
}
|
|
2636
|
+
function encodeBase64(text) {
|
|
2637
|
+
const bytes = new TextEncoder().encode(text);
|
|
2638
|
+
let binary = "";
|
|
2639
|
+
for (let i = 0, len = bytes.length; i < len; i++) binary += String.fromCharCode(bytes[i]);
|
|
2640
|
+
return btoa(binary);
|
|
2641
|
+
}
|
|
2642
|
+
function getSource(sources, sourceLookup, filePath, sourceContent) {
|
|
2643
|
+
let source = sourceLookup[filePath];
|
|
2644
|
+
if (source) {
|
|
2645
|
+
if (source.sourceContent === void 0) source.sourceContent = sourceContent;
|
|
2646
|
+
return source;
|
|
2647
|
+
}
|
|
2648
|
+
source = {
|
|
2649
|
+
filePath,
|
|
2650
|
+
sourceIndex: sources.length,
|
|
2651
|
+
sourceContent
|
|
2652
|
+
};
|
|
2653
|
+
sources.push(source);
|
|
2654
|
+
sourceLookup[filePath] = source;
|
|
2655
|
+
return source;
|
|
2656
|
+
}
|
|
2657
|
+
function normalizeSourcePath(filePath) {
|
|
2658
|
+
filePath = normalizeCallsiteSourceUrl(filePath);
|
|
2659
|
+
const atIndex = filePath.indexOf("/at ");
|
|
2660
|
+
if (atIndex !== -1) return filePath.slice(atIndex + 4);
|
|
2661
|
+
return filePath.replace(/^at\s+/, "");
|
|
2662
|
+
}
|
|
2663
|
+
function getSourceMapSourceUrl(sourceData) {
|
|
2664
|
+
const sourceUrl = sourceData.sourceUrl || sourceData.filePath;
|
|
2665
|
+
if (sourceData.sourceContent !== void 0) return normalizeSourcePath(sourceUrl);
|
|
2666
|
+
return normalizeSourcePath(resolveSidecarSourceUrl(sourceUrl));
|
|
2667
|
+
}
|
|
2668
|
+
function resolveSidecarSourceUrl(sourceUrl) {
|
|
2669
|
+
const sidecarUrl = getSidecarUrl();
|
|
2670
|
+
if (!sidecarUrl) return sourceUrl;
|
|
2671
|
+
return joinSourceUrl(sidecarUrl, getSourceUrlPath(sourceUrl));
|
|
2672
|
+
}
|
|
2673
|
+
function getSidecarUrl() {
|
|
2674
|
+
const value = globalThis[Symbol.for(SIDECAR_URL_GLOBAL_SYMBOL)];
|
|
2675
|
+
return typeof value === "string" && value ? value : null;
|
|
2676
|
+
}
|
|
2677
|
+
function getSourceUrlPath(sourceUrl) {
|
|
2678
|
+
if (sourceUrl.startsWith(SOURCE_URL_PREFIX)) return sourceUrl.slice(9).replace(/^\/+/, "");
|
|
2679
|
+
try {
|
|
2680
|
+
return new URL(sourceUrl).pathname.replace(/^\/+/, "");
|
|
2681
|
+
} catch {
|
|
2682
|
+
return sourceUrl.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:\/+/, "").replace(/^\/+/, "");
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
function joinSourceUrl(baseUrl, sourcePath) {
|
|
2686
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
2687
|
+
const path = sourcePath.replace(/^\/+/, "");
|
|
2688
|
+
return path ? `${base}/${path}` : base;
|
|
2689
|
+
}
|
|
2690
|
+
function getLineCount(css) {
|
|
2691
|
+
let count = 1;
|
|
2692
|
+
for (let i = 0, len = css.length; i < len; i++) if (css.charCodeAt(i) === 10) count++;
|
|
2693
|
+
return count;
|
|
2694
|
+
}
|
|
2695
|
+
function encodeVlq(value) {
|
|
2696
|
+
let vlq = value < 0 ? (-value << 1) + 1 : value << 1;
|
|
2697
|
+
let encoded = "";
|
|
2698
|
+
do {
|
|
2699
|
+
let digit = vlq & VLQ_BASE_MASK;
|
|
2700
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
|
2701
|
+
if (vlq > 0) digit |= VLQ_CONTINUATION_BIT;
|
|
2702
|
+
encoded += BASE64[digit];
|
|
2703
|
+
} while (vlq > 0);
|
|
2704
|
+
return encoded;
|
|
2705
|
+
}
|
|
2706
|
+
//#endregion
|
|
2707
|
+
//#region sheet/sourcemap.ts
|
|
2708
|
+
function getRuleCallsite(callsite, debug, debugField) {
|
|
2709
|
+
if (debug && debugField) {
|
|
2710
|
+
const loc = getDebugFieldLoc(debug, debugField);
|
|
2711
|
+
if (loc) return normalizeRuleCallsite({
|
|
2712
|
+
filePath: loc[3] ?? debug.sourceUrl,
|
|
2713
|
+
sourceUrl: loc[3] ?? debug.sourceUrl,
|
|
2714
|
+
sourceContent: loc[4] ?? debug.code,
|
|
2715
|
+
line: loc[0],
|
|
2716
|
+
column: loc[1]
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
if (callsite) return normalizeRuleCallsite(callsite);
|
|
2720
|
+
if (debug) return normalizeRuleCallsite({
|
|
2721
|
+
filePath: debug.sourceUrl,
|
|
2722
|
+
sourceUrl: debug.sourceUrl,
|
|
2723
|
+
sourceContent: debug.code,
|
|
2724
|
+
line: debug.loc[0],
|
|
2725
|
+
column: debug.loc[1]
|
|
2726
|
+
});
|
|
2727
|
+
return callsite || null;
|
|
2728
|
+
}
|
|
2729
|
+
function normalizeRuleCallsite(callsite) {
|
|
2730
|
+
return {
|
|
2731
|
+
...callsite,
|
|
2732
|
+
filePath: normalizeCallsiteSourceUrl(callsite.filePath),
|
|
2733
|
+
sourceUrl: callsite.sourceUrl ? normalizeCallsiteSourceUrl(callsite.sourceUrl) : callsite.sourceUrl
|
|
2734
|
+
};
|
|
2735
|
+
}
|
|
2736
|
+
function createSourceMapComment(rules) {
|
|
2737
|
+
return createSourceMapComment$1(rules.map((rule) => ({
|
|
2738
|
+
css: rule.css,
|
|
2739
|
+
source: getSourcemapRuleCallsite(rule)
|
|
2740
|
+
})));
|
|
2741
|
+
}
|
|
2742
|
+
function getSourcemapRuleCallsite(rule) {
|
|
2743
|
+
return getRuleCallsite(rule.callsite, rule.debug, rule.debugField);
|
|
2744
|
+
}
|
|
2745
|
+
//#endregion
|
|
2746
|
+
//#region sheet/dev/utils.ts
|
|
2747
|
+
const SOURCEMAP_TAGS = globalData("sheet.dev.sourcemapTags", () => []);
|
|
2748
|
+
function pruneDevSourcemapTags() {
|
|
2749
|
+
for (let i = SOURCEMAP_TAGS.length - 1; i >= 0; i--) if (!SOURCEMAP_TAGS[i].tag.parentNode) SOURCEMAP_TAGS.splice(i, 1);
|
|
2750
|
+
}
|
|
2751
|
+
function createDevTag(document, previous, options) {
|
|
2752
|
+
const tag = createStyleTag(document, options.className ?? "rules", options.nonce);
|
|
2753
|
+
const wrapperEndNode = options.wrapper ? document.createTextNode(options.wrapper.after) : null;
|
|
2754
|
+
const sourceMapNode = options.sourcemap ? document.createTextNode("") : null;
|
|
2755
|
+
if (options.wrapper) tag.appendChild(document.createTextNode(options.wrapper.before));
|
|
2756
|
+
if (wrapperEndNode) tag.appendChild(wrapperEndNode);
|
|
2757
|
+
if (sourceMapNode) tag.appendChild(sourceMapNode);
|
|
2758
|
+
if (options.before) options.before.parentNode?.insertBefore(tag, options.before);
|
|
2759
|
+
else if (options.top && (!previous || !previous.parentNode)) insertStyleTagAtTop(document, tag);
|
|
2760
|
+
else insertStyleTagAfter(document, tag, previous);
|
|
2761
|
+
const item = {
|
|
2762
|
+
tag,
|
|
2763
|
+
rules: [],
|
|
2764
|
+
sourceMapNode,
|
|
2765
|
+
insertBeforeNode: wrapperEndNode ?? sourceMapNode,
|
|
2766
|
+
count: 0,
|
|
2767
|
+
updateSourceMap() {
|
|
2768
|
+
if (!sourceMapNode) return;
|
|
2769
|
+
if (sourceMapNode.parentNode !== tag) tag.appendChild(sourceMapNode);
|
|
2770
|
+
sourceMapNode.data = "\n" + createSourceMapComment(getSourceMapRules(item.rules, options.wrapper?.sourceMapLineOffset ?? 0));
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
if (sourceMapNode) SOURCEMAP_TAGS.push(item);
|
|
2774
|
+
return item;
|
|
2775
|
+
}
|
|
2776
|
+
function insertDevRule(document, item, fragment, css, rule) {
|
|
2777
|
+
fragment.appendChild(document.createTextNode(css + "\n"));
|
|
2778
|
+
item.rules.push({
|
|
2779
|
+
css,
|
|
2780
|
+
callsite: rule?.callsite ?? null,
|
|
2781
|
+
debug: rule?.debug ?? null,
|
|
2782
|
+
debugField: rule?.debugField ?? null
|
|
2783
|
+
});
|
|
2784
|
+
item.count++;
|
|
2785
|
+
}
|
|
2786
|
+
function getSourceMapRules(rules, offset) {
|
|
2787
|
+
if (!offset) return rules;
|
|
2788
|
+
const output = [];
|
|
2789
|
+
for (let i = 0; i < offset; i++) output.push({
|
|
2790
|
+
css: "",
|
|
2791
|
+
callsite: null
|
|
2792
|
+
});
|
|
2793
|
+
return output.concat(rules);
|
|
2794
|
+
}
|
|
2795
|
+
//#endregion
|
|
2796
|
+
//#region sheet/dev/dev_layer.ts
|
|
2797
|
+
function createDevLayerSheet(options = {}) {
|
|
2798
|
+
const document = resolveDocument(options.document);
|
|
2799
|
+
if (!document) return createNoopSheet();
|
|
2800
|
+
const maxRules = Math.max(options.maxRules ?? DEV_CONFIG.sheetMaxRules, 1);
|
|
2801
|
+
const sourcemap = options.sourcemap ?? DEV_CONFIG.isSourcemapEnabled;
|
|
2802
|
+
const inserted = /* @__PURE__ */ new Set();
|
|
2803
|
+
const layerState = createSheetLayerState();
|
|
2804
|
+
const tagPrefix = options.tagName ? options.tagName + " " : "";
|
|
2805
|
+
const rootLayer = tagPrefix === "element-marker " ? getStyleLayerName() : null;
|
|
2806
|
+
const layerTag = createStyleTag(document, tagPrefix + "layers", options.nonce);
|
|
2807
|
+
const queued = [];
|
|
2808
|
+
let layerText = "";
|
|
2809
|
+
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
2810
|
+
const groups = [];
|
|
2811
|
+
const groupLookup = /* @__PURE__ */ new Map();
|
|
2812
|
+
let hasSheetLayer = false;
|
|
2813
|
+
const namedLayers = /* @__PURE__ */ new Set();
|
|
2814
|
+
if (options.top) insertStyleTagAtTop(document, layerTag);
|
|
2815
|
+
else insertStyleTagAfter(document, layerTag, null);
|
|
2816
|
+
return {
|
|
2817
|
+
updateLayers(layers) {
|
|
2818
|
+
activeLayers = layers;
|
|
2819
|
+
const next = getLayerOrderCss(layers, rootLayer ?? getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2820
|
+
if (next === layerText) return;
|
|
2821
|
+
layerText = next;
|
|
2822
|
+
layerTag.textContent = next;
|
|
2823
|
+
},
|
|
2824
|
+
insert(rule) {
|
|
2825
|
+
const rawCss = normalizeRule(rule);
|
|
2826
|
+
const ruleKey = typeof rule === "string" ? null : rule.key;
|
|
2827
|
+
if (ruleKey && inserted.has(ruleKey)) return;
|
|
2828
|
+
const priority = typeof rule === "string" ? getSheetRuleLayerPriority(null, false) : getSheetRuleLayerPriority(rule.priority, rule.important);
|
|
2829
|
+
const ruleLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
|
|
2830
|
+
if (ruleLayer === "sheet") hasSheetLayer = true;
|
|
2831
|
+
if (typeof ruleLayer === "object") namedLayers.add(ruleLayer.name);
|
|
2832
|
+
const layerName = rootLayer ?? (typeof ruleLayer === "object" ? ruleLayer.name : ruleLayer === "sheet" ? getSheetLayerName() : ruleLayer === false || !isStyleLayerEnabled() ? null : layerState.getName(priority));
|
|
2833
|
+
const nextLayerText = getLayerOrderCss(activeLayers, rootLayer ?? getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
2834
|
+
if (nextLayerText !== layerText) {
|
|
2835
|
+
layerText = nextLayerText;
|
|
2836
|
+
layerTag.textContent = nextLayerText;
|
|
2837
|
+
}
|
|
2838
|
+
const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
|
|
2839
|
+
const key = typeof rule === "string" ? css : ruleKey;
|
|
2840
|
+
if (key && inserted.has(key)) return;
|
|
2841
|
+
if (key) inserted.add(key);
|
|
2842
|
+
queued.push({
|
|
2843
|
+
css,
|
|
2844
|
+
rule: typeof rule === "string" ? null : rule,
|
|
2845
|
+
group: getGroup(typeof rule === "string" ? { css: rule } : rule)
|
|
2846
|
+
});
|
|
2847
|
+
},
|
|
2848
|
+
flush() {
|
|
2849
|
+
if (!queued.length) return;
|
|
2850
|
+
const touched = /* @__PURE__ */ new Set();
|
|
2851
|
+
let fragment = null;
|
|
2852
|
+
let fragmentTag = null;
|
|
2853
|
+
const flushFragment = () => {
|
|
2854
|
+
if (!fragment || !fragmentTag) return;
|
|
2855
|
+
if (fragmentTag.insertBeforeNode && fragmentTag.insertBeforeNode.parentNode === fragmentTag.tag) fragmentTag.tag.insertBefore(fragment, fragmentTag.insertBeforeNode);
|
|
2856
|
+
else fragmentTag.tag.appendChild(fragment);
|
|
2857
|
+
fragment = null;
|
|
2858
|
+
fragmentTag = null;
|
|
2859
|
+
};
|
|
2860
|
+
for (let i = 0, len = queued.length; i < len; i++) {
|
|
2861
|
+
const item = queued[i];
|
|
2862
|
+
const group = item.group;
|
|
2863
|
+
let active = group.tags[group.tags.length - 1];
|
|
2864
|
+
if (!active || active.count >= maxRules) {
|
|
2865
|
+
flushFragment();
|
|
2866
|
+
const index = groups.indexOf(group);
|
|
2867
|
+
let before;
|
|
2868
|
+
let previous = layerTag;
|
|
2869
|
+
for (let i = index + 1; i < groups.length; i++) if (groups[i].tags.length) {
|
|
2870
|
+
before = groups[i].tags[0].tag;
|
|
2871
|
+
break;
|
|
2872
|
+
}
|
|
2873
|
+
for (let i = index; i >= 0; i--) {
|
|
2874
|
+
const tags = groups[i].tags;
|
|
2875
|
+
if (tags.length) {
|
|
2876
|
+
previous = tags[tags.length - 1].tag;
|
|
2877
|
+
break;
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
active = createDevTag(document, previous, {
|
|
2881
|
+
before,
|
|
2882
|
+
sourcemap,
|
|
2883
|
+
nonce: options.nonce,
|
|
2884
|
+
className: tagPrefix + "rules",
|
|
2885
|
+
top: options.top
|
|
2886
|
+
});
|
|
2887
|
+
group.tags.push(active);
|
|
2888
|
+
}
|
|
2889
|
+
if (fragmentTag !== active) {
|
|
2890
|
+
flushFragment();
|
|
2891
|
+
fragmentTag = active;
|
|
2892
|
+
fragment = document.createDocumentFragment();
|
|
2893
|
+
}
|
|
2894
|
+
insertDevRule(document, active, fragment, item.css, item.rule);
|
|
2895
|
+
touched.add(active);
|
|
2896
|
+
}
|
|
2897
|
+
flushFragment();
|
|
2898
|
+
queued.length = 0;
|
|
2899
|
+
if (!sourcemap) return;
|
|
2900
|
+
for (const tag of touched) tag.updateSourceMap();
|
|
2901
|
+
}
|
|
2902
|
+
};
|
|
2903
|
+
function getGroup(rule) {
|
|
2904
|
+
const layer = rule.layer ?? "style";
|
|
2905
|
+
const key = (layer === false || layer === "style" && !isStyleLayerEnabled() ? 2 : layer === "style" || typeof layer === "object" && layer.name === getStyleLayerName() ? 0 : 1) + ":" + getSheetRulePriority(rule.priority).join(",");
|
|
2906
|
+
const cached = groupLookup.get(key);
|
|
2907
|
+
if (cached) return cached;
|
|
2908
|
+
const group = {
|
|
2909
|
+
rule,
|
|
2910
|
+
tags: []
|
|
2911
|
+
};
|
|
2912
|
+
const index = groups.findIndex((existing) => compareSheetRules(rule, existing.rule) < 0);
|
|
2913
|
+
if (index < 0) groups.push(group);
|
|
2914
|
+
else groups.splice(index, 0, group);
|
|
2915
|
+
groupLookup.set(key, group);
|
|
2916
|
+
return group;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
//#endregion
|
|
2920
|
+
//#region sheet/dev/dev_sort.ts
|
|
2921
|
+
function createDevSortSheet(options = {}) {
|
|
2922
|
+
const document = resolveDocument(options.document);
|
|
2923
|
+
if (!document) return createNoopSheet();
|
|
2924
|
+
const maxRules = Math.max(options.maxRules ?? DEV_CONFIG.sheetMaxRules, 1);
|
|
2925
|
+
const sourcemap = options.sourcemap ?? DEV_CONFIG.isSourcemapEnabled;
|
|
2926
|
+
const inserted = /* @__PURE__ */ new Set();
|
|
2927
|
+
const queued = [];
|
|
2928
|
+
const groups = [];
|
|
2929
|
+
const groupLookup = /* @__PURE__ */ new Map();
|
|
2930
|
+
const shouldLayer = isStyleLayerEnabled();
|
|
2931
|
+
const layerName = getStyleLayerName();
|
|
2932
|
+
const tagPrefix = options.tagName ? options.tagName + " " : "";
|
|
2933
|
+
let layerTag = shouldLayer ? createStyleTag(document, tagPrefix + "layers", options.nonce) : null;
|
|
2934
|
+
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
2935
|
+
let layerText = "";
|
|
2936
|
+
let hasSheetLayer = false;
|
|
2937
|
+
const namedLayers = /* @__PURE__ */ new Set();
|
|
2938
|
+
if (layerTag) if (options.top) insertStyleTagAtTop(document, layerTag);
|
|
2939
|
+
else insertStyleTagAfter(document, layerTag, null);
|
|
2940
|
+
return {
|
|
2941
|
+
updateLayers(layers) {
|
|
2942
|
+
activeLayers = layers;
|
|
2943
|
+
updateLayerText();
|
|
2944
|
+
},
|
|
2945
|
+
insert(rule) {
|
|
2946
|
+
const css = normalizeRule(rule);
|
|
2947
|
+
const ruleKey = typeof rule === "string" ? null : rule.key;
|
|
2948
|
+
if (ruleKey && inserted.has(ruleKey)) return;
|
|
2949
|
+
const key = typeof rule === "string" ? css : ruleKey;
|
|
2950
|
+
if (key && inserted.has(key)) return;
|
|
2951
|
+
if (key) inserted.add(key);
|
|
2952
|
+
const requestedLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
|
|
2953
|
+
const layer = requestedLayer === "style" && !shouldLayer ? false : requestedLayer;
|
|
2954
|
+
if (layer === "sheet" || typeof layer === "object") {
|
|
2955
|
+
if (layer === "sheet") hasSheetLayer = true;
|
|
2956
|
+
else namedLayers.add(layer.name);
|
|
2957
|
+
ensureLayerTag();
|
|
2958
|
+
updateLayerText();
|
|
2959
|
+
}
|
|
2960
|
+
queued.push({
|
|
2961
|
+
css,
|
|
2962
|
+
rule: typeof rule === "string" ? null : rule,
|
|
2963
|
+
priority: getSheetRulePriority(typeof rule === "string" ? null : rule.priority),
|
|
2964
|
+
layer
|
|
2965
|
+
});
|
|
2966
|
+
},
|
|
2967
|
+
flush() {
|
|
2968
|
+
if (!queued.length) return;
|
|
2969
|
+
const touched = /* @__PURE__ */ new Set();
|
|
2970
|
+
let fragment = null;
|
|
2971
|
+
let fragmentTag = null;
|
|
2972
|
+
const flushFragment = () => {
|
|
2973
|
+
if (!fragment || !fragmentTag) return;
|
|
2974
|
+
if (fragmentTag.insertBeforeNode && fragmentTag.insertBeforeNode.parentNode === fragmentTag.tag) fragmentTag.tag.insertBefore(fragment, fragmentTag.insertBeforeNode);
|
|
2975
|
+
else fragmentTag.tag.appendChild(fragment);
|
|
2976
|
+
fragment = null;
|
|
2977
|
+
fragmentTag = null;
|
|
2978
|
+
};
|
|
2979
|
+
queued.sort((a, b) => compareLayerPriority(a.priority, b.priority));
|
|
2980
|
+
for (let i = 0, len = queued.length; i < len; i++) {
|
|
2981
|
+
const item = queued[i];
|
|
2982
|
+
const group = ensureGroup(groups, groupLookup, item.priority, item.layer);
|
|
2983
|
+
let active = group.tags[group.tags.length - 1] ?? null;
|
|
2984
|
+
if (!active || active.count >= maxRules) {
|
|
2985
|
+
flushFragment();
|
|
2986
|
+
active = createGroupTag(document, groups, group, {
|
|
2987
|
+
previous: layerTag,
|
|
2988
|
+
className: tagPrefix + "rules " + group.key,
|
|
2989
|
+
top: options.top,
|
|
2990
|
+
layerName: typeof group.layer === "object" ? group.layer.name : group.layer === "style" ? layerName : group.layer === "sheet" ? getSheetLayerName() : null,
|
|
2991
|
+
sourcemap,
|
|
2992
|
+
nonce: options.nonce
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2995
|
+
if (fragmentTag !== active) {
|
|
2996
|
+
flushFragment();
|
|
2997
|
+
fragmentTag = active;
|
|
2998
|
+
fragment = document.createDocumentFragment();
|
|
2999
|
+
}
|
|
3000
|
+
insertDevRule(document, active, fragment, item.css, item.rule);
|
|
3001
|
+
touched.add(active);
|
|
3002
|
+
}
|
|
3003
|
+
flushFragment();
|
|
3004
|
+
queued.length = 0;
|
|
3005
|
+
if (!sourcemap) return;
|
|
3006
|
+
for (const tag of touched) tag.updateSourceMap();
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
3009
|
+
function updateLayerText() {
|
|
3010
|
+
if (!layerTag) return;
|
|
3011
|
+
const names = [
|
|
3012
|
+
shouldLayer ? layerName : "",
|
|
3013
|
+
hasSheetLayer ? getSheetLayerName() : "",
|
|
3014
|
+
...namedLayers
|
|
3015
|
+
].filter(Boolean);
|
|
3016
|
+
const next = getLayerOrderCss(activeLayers, names);
|
|
3017
|
+
if (next === layerText) return;
|
|
3018
|
+
layerText = next;
|
|
3019
|
+
layerTag.textContent = next;
|
|
3020
|
+
}
|
|
3021
|
+
function ensureLayerTag() {
|
|
3022
|
+
if (layerTag) return;
|
|
3023
|
+
layerTag = createStyleTag(document, tagPrefix + "layers", options.nonce);
|
|
3024
|
+
if (options.top) insertStyleTagAtTop(document, layerTag);
|
|
3025
|
+
else insertStyleTagAfter(document, layerTag, null);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function ensureGroup(groups, lookup, priority, layer) {
|
|
3029
|
+
const key = (typeof layer === "object" ? "named-" + layer.name + "-" : layer === "sheet" ? "sheet-" : "") + getPriorityKey(priority);
|
|
3030
|
+
const lookupKey = JSON.stringify([layer, priority]);
|
|
3031
|
+
const cached = lookup.get(lookupKey);
|
|
3032
|
+
if (cached) return cached;
|
|
3033
|
+
for (let i = 0, len = groups.length; i < len; i++) {
|
|
3034
|
+
const group = groups[i];
|
|
3035
|
+
const order = getLayerRank(layer) - getLayerRank(group.layer) || compareLayerPriority(priority, group.priority);
|
|
3036
|
+
if (order === 0 && key === group.key && layer === false === (group.layer === false)) {
|
|
3037
|
+
lookup.set(lookupKey, group);
|
|
3038
|
+
return group;
|
|
3039
|
+
}
|
|
3040
|
+
if (order < 0) {
|
|
3041
|
+
const next = {
|
|
3042
|
+
key,
|
|
3043
|
+
priority,
|
|
3044
|
+
tags: [],
|
|
3045
|
+
layer
|
|
3046
|
+
};
|
|
3047
|
+
groups.splice(i, 0, next);
|
|
3048
|
+
lookup.set(lookupKey, next);
|
|
3049
|
+
return next;
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
const group = {
|
|
3053
|
+
key,
|
|
3054
|
+
priority,
|
|
3055
|
+
tags: [],
|
|
3056
|
+
layer
|
|
3057
|
+
};
|
|
3058
|
+
groups.push(group);
|
|
3059
|
+
lookup.set(lookupKey, group);
|
|
3060
|
+
return group;
|
|
3061
|
+
}
|
|
3062
|
+
function getLayerRank(layer) {
|
|
3063
|
+
return layer === "style" || typeof layer === "object" && layer.name === getStyleLayerName() ? 0 : layer === "sheet" || typeof layer === "object" ? 1 : 2;
|
|
3064
|
+
}
|
|
3065
|
+
function createGroupTag(document, groups, group, options) {
|
|
3066
|
+
const previous = getPreviousTag(groups, group, options.previous);
|
|
3067
|
+
const before = getNextTag(groups, group);
|
|
3068
|
+
const item = createDevTag(document, previous, {
|
|
3069
|
+
...options,
|
|
3070
|
+
className: options.className,
|
|
3071
|
+
before: before?.tag ?? null,
|
|
3072
|
+
top: options.top,
|
|
3073
|
+
wrapper: options.layerName ? {
|
|
3074
|
+
before: "@layer " + options.layerName + " {\n",
|
|
3075
|
+
after: "}\n",
|
|
3076
|
+
sourceMapLineOffset: 1
|
|
3077
|
+
} : void 0
|
|
3078
|
+
});
|
|
3079
|
+
group.tags.push(item);
|
|
3080
|
+
return item;
|
|
3081
|
+
}
|
|
3082
|
+
function getPreviousTag(groups, group, fallback) {
|
|
3083
|
+
const index = groups.indexOf(group);
|
|
3084
|
+
for (let i = index; i >= 0; i--) {
|
|
3085
|
+
const tags = groups[i].tags;
|
|
3086
|
+
const tag = tags[tags.length - 1];
|
|
3087
|
+
if (tag) return tag.tag;
|
|
3088
|
+
}
|
|
3089
|
+
return fallback;
|
|
3090
|
+
}
|
|
3091
|
+
function getNextTag(groups, group) {
|
|
3092
|
+
const index = groups.indexOf(group);
|
|
3093
|
+
for (let i = index + 1, len = groups.length; i < len; i++) {
|
|
3094
|
+
const tag = groups[i].tags[0];
|
|
3095
|
+
if (tag) return tag;
|
|
3096
|
+
}
|
|
3097
|
+
return null;
|
|
3098
|
+
}
|
|
3099
|
+
function getPriorityKey(priority) {
|
|
3100
|
+
return "p-" + priority.join("-").replace(/^-/, "n");
|
|
3101
|
+
}
|
|
3102
|
+
//#endregion
|
|
3103
|
+
//#region sheet/dev/index.ts
|
|
3104
|
+
const DEV_SHEETS = globalData("sheet.dev.sheets", () => /* @__PURE__ */ new Set());
|
|
3105
|
+
function createDevSheet(options = {}) {
|
|
3106
|
+
return createOrderedSheet(createDevSheetBase, options, true);
|
|
3107
|
+
}
|
|
3108
|
+
function createDevSheetBase(options = {}) {
|
|
3109
|
+
let activeMode = DEV_CONFIG.stylePriorityMode;
|
|
3110
|
+
let active = createDevSheetForMode(activeMode, options);
|
|
3111
|
+
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
3112
|
+
const rules = [];
|
|
3113
|
+
const inserted = /* @__PURE__ */ new Set();
|
|
3114
|
+
const state = { rebuild };
|
|
3115
|
+
DEV_SHEETS.add(state);
|
|
3116
|
+
return {
|
|
3117
|
+
updateLayers(layers) {
|
|
3118
|
+
activeLayers = layers;
|
|
3119
|
+
active.updateLayers(layers);
|
|
3120
|
+
},
|
|
3121
|
+
insert(rule) {
|
|
3122
|
+
const key = getStoredRuleKey(rule);
|
|
3123
|
+
if (key && inserted.has(key)) return;
|
|
3124
|
+
if (key) inserted.add(key);
|
|
3125
|
+
rules.push(rule);
|
|
3126
|
+
active.insert(rule);
|
|
3127
|
+
},
|
|
3128
|
+
replaceRules(owner, next) {
|
|
3129
|
+
const group = rules.find((rule) => typeof rule === "object" && "owner" in rule && rule.owner === owner);
|
|
3130
|
+
if (group && typeof group === "object" && "owner" in group) group.rules = next;
|
|
3131
|
+
else rules.push({
|
|
3132
|
+
owner,
|
|
3133
|
+
rules: next
|
|
3134
|
+
});
|
|
3135
|
+
rebuild();
|
|
3136
|
+
},
|
|
3137
|
+
flush() {
|
|
3138
|
+
ensureActiveMode();
|
|
3139
|
+
active.flush();
|
|
3140
|
+
},
|
|
3141
|
+
destroy() {
|
|
3142
|
+
DEV_SHEETS.delete(state);
|
|
3143
|
+
removeDevSheetTags(options.document, options.tagName);
|
|
3144
|
+
pruneDevSourcemapTags();
|
|
3145
|
+
}
|
|
3146
|
+
};
|
|
3147
|
+
function ensureActiveMode() {
|
|
3148
|
+
if (activeMode === DEV_CONFIG.stylePriorityMode) return;
|
|
3149
|
+
rebuild();
|
|
3150
|
+
}
|
|
3151
|
+
function rebuild() {
|
|
3152
|
+
activeMode = DEV_CONFIG.stylePriorityMode;
|
|
3153
|
+
removeDevSheetTags(options.document, options.tagName);
|
|
3154
|
+
active = createDevSheetForMode(activeMode, options);
|
|
3155
|
+
active.updateLayers(activeLayers);
|
|
3156
|
+
for (let i = 0, len = rules.length; i < len; i++) {
|
|
3157
|
+
const rule = rules[i];
|
|
3158
|
+
if (typeof rule === "object" && "owner" in rule) for (const item of rule.rules) active.insert(item);
|
|
3159
|
+
else active.insert(rule);
|
|
3160
|
+
}
|
|
3161
|
+
active.flush();
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
function createDevSheetForMode(mode, options) {
|
|
3165
|
+
return mode === "sort" ? createDevSortSheet(options) : createDevLayerSheet(options);
|
|
3166
|
+
}
|
|
3167
|
+
function getStoredRuleKey(rule) {
|
|
3168
|
+
return typeof rule === "string" ? rule : rule.key ?? rule.css;
|
|
3169
|
+
}
|
|
3170
|
+
function removeDevSheetTags(documentOverride, tagName) {
|
|
3171
|
+
const document = documentOverride === void 0 ? typeof globalThis.document === "undefined" ? null : globalThis.document : documentOverride;
|
|
3172
|
+
if (!document) return;
|
|
3173
|
+
const head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
|
3174
|
+
const nodes = Array.from(head.childNodes);
|
|
3175
|
+
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
3176
|
+
const node = nodes[i];
|
|
3177
|
+
if (typeof node.getAttribute !== "function") continue;
|
|
3178
|
+
const sheetName = node.getAttribute("data-css-sheet");
|
|
3179
|
+
if (!sheetName) continue;
|
|
3180
|
+
if (!matchesDevSheetTag(sheetName, tagName)) continue;
|
|
3181
|
+
node.parentNode?.removeChild(node);
|
|
3182
|
+
}
|
|
3183
|
+
pruneDevSourcemapTags();
|
|
3184
|
+
}
|
|
3185
|
+
function matchesDevSheetTag(sheetName, tagName) {
|
|
3186
|
+
if (tagName) {
|
|
3187
|
+
if (sheetName === tagName) return true;
|
|
3188
|
+
if (!sheetName.startsWith(tagName + " ")) return false;
|
|
3189
|
+
sheetName = sheetName.slice(tagName.length + 1);
|
|
3190
|
+
}
|
|
3191
|
+
return sheetName === "layers" || sheetName === "rules" || sheetName.startsWith("rules ");
|
|
3192
|
+
}
|
|
3193
|
+
//#endregion
|
|
3194
|
+
//#region sheet/prod.ts
|
|
3195
|
+
function createProdSheet(options = {}) {
|
|
3196
|
+
return createOrderedSheet(createProdSheetBase, options, false);
|
|
3197
|
+
}
|
|
3198
|
+
function createProdSheetBase(options = {}) {
|
|
3199
|
+
const document = resolveDocument(options.document);
|
|
3200
|
+
if (!document) return createNoopSheet();
|
|
3201
|
+
const tagPrefix = options.tagName ? options.tagName + " " : "";
|
|
3202
|
+
const inserted = /* @__PURE__ */ new Set();
|
|
3203
|
+
const layerState = createSheetLayerState();
|
|
3204
|
+
let activeLayers = CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? [];
|
|
3205
|
+
let layerText = "";
|
|
3206
|
+
let layerTag = null;
|
|
3207
|
+
let ruleTag = null;
|
|
3208
|
+
let hasSheetLayer = false;
|
|
3209
|
+
const namedLayers = /* @__PURE__ */ new Set();
|
|
3210
|
+
return {
|
|
3211
|
+
updateLayers(layers) {
|
|
3212
|
+
activeLayers = layers;
|
|
3213
|
+
const next = getLayerOrderCss(layers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
3214
|
+
if (next === layerText) return;
|
|
3215
|
+
layerText = next;
|
|
3216
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3217
|
+
layerTag.textContent = next;
|
|
3218
|
+
},
|
|
3219
|
+
insert(rule) {
|
|
3220
|
+
const rawCss = normalizeRule(rule);
|
|
3221
|
+
const ruleKey = typeof rule === "string" ? null : rule.key;
|
|
3222
|
+
if (ruleKey && inserted.has(ruleKey)) return;
|
|
3223
|
+
const priority = typeof rule === "string" ? getSheetRuleLayerPriority(null, false) : getSheetRuleLayerPriority(rule.priority, rule.important);
|
|
3224
|
+
const ruleLayer = typeof rule === "string" ? "style" : rule.layer ?? "style";
|
|
3225
|
+
if (ruleLayer === "sheet") hasSheetLayer = true;
|
|
3226
|
+
if (typeof ruleLayer === "object") namedLayers.add(ruleLayer.name);
|
|
3227
|
+
const layerName = typeof ruleLayer === "object" ? ruleLayer.name : ruleLayer === "sheet" ? getSheetLayerName() : ruleLayer === false || !isStyleLayerEnabled() ? null : layerState.getName(priority);
|
|
3228
|
+
const nextLayerText = getLayerOrderCss(activeLayers, getSheetLayerNames(layerState, hasSheetLayer, namedLayers));
|
|
3229
|
+
if (nextLayerText !== layerText) {
|
|
3230
|
+
layerText = nextLayerText;
|
|
3231
|
+
layerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3232
|
+
layerTag.textContent = nextLayerText;
|
|
3233
|
+
}
|
|
3234
|
+
const css = layerName ? getLayerBlockCss(layerName, rawCss) : rawCss;
|
|
3235
|
+
const key = typeof rule === "string" ? css : ruleKey;
|
|
3236
|
+
if (key && inserted.has(key)) return;
|
|
3237
|
+
if (key) inserted.add(key);
|
|
3238
|
+
const activeLayerTag = ensureLayerTag(document, layerTag, options.nonce, tagPrefix);
|
|
3239
|
+
layerTag = activeLayerTag;
|
|
3240
|
+
if (!ruleTag) {
|
|
3241
|
+
ruleTag = createStyleTag(document, tagPrefix + "rules", options.nonce);
|
|
3242
|
+
insertStyleTagAfter(document, ruleTag, activeLayerTag);
|
|
3243
|
+
}
|
|
3244
|
+
insertRule(ruleTag, css);
|
|
3245
|
+
},
|
|
3246
|
+
flush() {},
|
|
3247
|
+
destroy() {
|
|
3248
|
+
layerTag?.parentNode?.removeChild(layerTag);
|
|
3249
|
+
ruleTag?.parentNode?.removeChild(ruleTag);
|
|
3250
|
+
inserted.clear();
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
}
|
|
3254
|
+
function ensureLayerTag(document, tag, nonce, prefix = "") {
|
|
3255
|
+
if (tag) return tag;
|
|
3256
|
+
const next = createStyleTag(document, prefix + "layers", nonce);
|
|
3257
|
+
insertStyleTagAfter(document, next, null);
|
|
3258
|
+
return next;
|
|
3259
|
+
}
|
|
3260
|
+
function insertRule(tag, css) {
|
|
3261
|
+
const sheet = tag.sheet;
|
|
3262
|
+
if (sheet) try {
|
|
3263
|
+
sheet.insertRule(css, sheet.cssRules.length);
|
|
3264
|
+
return;
|
|
3265
|
+
} catch {}
|
|
3266
|
+
tag.appendChild(tag.ownerDocument.createTextNode(css));
|
|
3267
|
+
}
|
|
3268
|
+
//#endregion
|
|
3269
|
+
//#region sheet/sheet.ts
|
|
3270
|
+
function createStyleSheet(options = {}) {
|
|
3271
|
+
return options.dev ?? DEV_CONFIG.isDev ? createDevSheet(options) : createProdSheet(options);
|
|
3272
|
+
}
|
|
3273
|
+
//#endregion
|
|
3274
|
+
//#region runtime/sheet/document.ts
|
|
3275
|
+
const GLOBAL_KEY = "runtime.sheet.global";
|
|
3276
|
+
const state = globalData("runtime.sheet.document", () => ({ document: getRuntimeDocument() }));
|
|
3277
|
+
function resetSheet() {
|
|
3278
|
+
getGlobalData(GLOBAL_KEY)?.destroy?.();
|
|
3279
|
+
clearGlobalData(GLOBAL_KEY);
|
|
3280
|
+
state.document = getRuntimeDocument();
|
|
3281
|
+
}
|
|
3282
|
+
onRuntimeDocumentChange(resetSheet);
|
|
3283
|
+
function getDocumentSheet(create) {
|
|
3284
|
+
const document = getRuntimeDocument();
|
|
3285
|
+
if (state.document !== document) resetSheet();
|
|
3286
|
+
return globalData(GLOBAL_KEY, () => document ? create({ document }) : createNoopSheet());
|
|
3287
|
+
}
|
|
3288
|
+
//#endregion
|
|
3289
|
+
//#region runtime/sheet/global.ts
|
|
3290
|
+
function getGlobalSheet() {
|
|
3291
|
+
return getDocumentSheet(createStyleSheet);
|
|
3292
|
+
}
|
|
3293
|
+
//#endregion
|
|
3294
|
+
//#region runtime/core/combinedStyle.ts
|
|
3295
|
+
const targets = globalData("runtime.combinedStyle.targets", () => /* @__PURE__ */ new WeakMap());
|
|
3296
|
+
function createCombinedStyle(meta, getField) {
|
|
3297
|
+
const target = {
|
|
3298
|
+
...meta,
|
|
3299
|
+
cache: Object.create(null),
|
|
3300
|
+
getField
|
|
3301
|
+
};
|
|
3302
|
+
const proxyTarget = {};
|
|
3303
|
+
const proxy = new Proxy(proxyTarget, handlers);
|
|
3304
|
+
targets.set(proxyTarget, target);
|
|
3305
|
+
targets.set(proxy, target);
|
|
3306
|
+
return proxy;
|
|
3307
|
+
}
|
|
3308
|
+
function isCombinedStyle(value) {
|
|
3309
|
+
return !!value && typeof value === "object" && targets.has(value);
|
|
3310
|
+
}
|
|
3311
|
+
function getCombinedStyleStyles(style) {
|
|
3312
|
+
return getTarget(style).styles;
|
|
3313
|
+
}
|
|
3314
|
+
function getCombinedStyleScopes(style) {
|
|
3315
|
+
return getTarget(style).scopes;
|
|
3316
|
+
}
|
|
3317
|
+
function getCombinedStyleTokens(style) {
|
|
3318
|
+
return getTarget(style).tokens;
|
|
3319
|
+
}
|
|
3320
|
+
const handlers = { get(proxy, prop) {
|
|
3321
|
+
const target = getTarget(proxy);
|
|
3322
|
+
if (hasOwn(target.cache, prop)) return target.cache[prop];
|
|
3323
|
+
const value = target.getField(target, prop);
|
|
3324
|
+
if (value && typeof value === "object") target.cache[prop] = value;
|
|
3325
|
+
return value;
|
|
3326
|
+
} };
|
|
3327
|
+
function getTarget(value) {
|
|
3328
|
+
const target = targets.get(value);
|
|
3329
|
+
if (!target) throw new Error("[fluentic-style] Expected combined style.");
|
|
3330
|
+
return target;
|
|
3331
|
+
}
|
|
3332
|
+
//#endregion
|
|
3333
|
+
//#region runtime/core/cache/tokenValues.ts
|
|
3334
|
+
function createMutableTokenValues(base) {
|
|
3335
|
+
return {
|
|
3336
|
+
ids: base ? base.ids.slice() : null,
|
|
3337
|
+
values: base ? base.values.slice() : null,
|
|
3338
|
+
lookup: base ? { ...base.lookup } : null,
|
|
3339
|
+
index: base ? createTokenIndexLookup(base.ids) : null
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3342
|
+
function addTokenOverride(values, item, resolver) {
|
|
3343
|
+
if (!resolver.is(item)) return false;
|
|
3344
|
+
addTokenValue(values, resolver.id(item), resolver.value(item));
|
|
3345
|
+
return true;
|
|
3346
|
+
}
|
|
3347
|
+
function addTokenValue(values, id, value) {
|
|
3348
|
+
if (!values.ids) values.ids = [];
|
|
3349
|
+
if (!values.values) values.values = [];
|
|
3350
|
+
if (!values.lookup) values.lookup = Object.create(null);
|
|
3351
|
+
if (!values.index) values.index = Object.create(null);
|
|
3352
|
+
const ids = values.ids;
|
|
3353
|
+
const tokenValues = values.values;
|
|
3354
|
+
const lookup = values.lookup;
|
|
3355
|
+
const indexLookup = values.index;
|
|
3356
|
+
const index = indexLookup[id];
|
|
3357
|
+
if (index === void 0) {
|
|
3358
|
+
indexLookup[id] = ids.push(id) - 1;
|
|
3359
|
+
tokenValues.push(value);
|
|
3360
|
+
} else tokenValues[index] = value;
|
|
3361
|
+
lookup[id] = value;
|
|
3362
|
+
}
|
|
3363
|
+
function addTokenValues(values, next) {
|
|
3364
|
+
if (!next) return;
|
|
3365
|
+
for (let i = 0, len = next.ids.length; i < len; i++) addTokenValue(values, next.ids[i], next.values[i]);
|
|
3366
|
+
}
|
|
3367
|
+
function addTokenOverrides(values, overrides, resolver) {
|
|
3368
|
+
for (let i = 0, len = overrides.length; i < len; i++) addTokenOverride(values, overrides[i], resolver);
|
|
3369
|
+
}
|
|
3370
|
+
function finishTokenValues(base, values) {
|
|
3371
|
+
if (!values.ids || !values.values || !values.lookup) return null;
|
|
3372
|
+
if (isSameTokenValues(base, values.ids, values.values)) return base;
|
|
3373
|
+
return {
|
|
3374
|
+
ids: values.ids,
|
|
3375
|
+
values: values.values,
|
|
3376
|
+
lookup: values.lookup
|
|
3377
|
+
};
|
|
3378
|
+
}
|
|
3379
|
+
function mergeTokenValues(base, next) {
|
|
3380
|
+
if (!next) return base;
|
|
3381
|
+
if (!base) return next;
|
|
3382
|
+
const values = createMutableTokenValues(base);
|
|
3383
|
+
addTokenValues(values, next);
|
|
3384
|
+
return finishTokenValues(base, values);
|
|
3385
|
+
}
|
|
3386
|
+
function mergeTokenOverrides(base, overrides, resolver) {
|
|
3387
|
+
if (!overrides.length) return base;
|
|
3388
|
+
const values = createMutableTokenValues(base);
|
|
3389
|
+
addTokenOverrides(values, overrides, resolver);
|
|
3390
|
+
return finishTokenValues(base, values);
|
|
3391
|
+
}
|
|
3392
|
+
function createTokenIndexLookup(ids) {
|
|
3393
|
+
const lookup = Object.create(null);
|
|
3394
|
+
for (let i = 0, len = ids.length; i < len; i++) lookup[ids[i]] = i;
|
|
3395
|
+
return lookup;
|
|
3396
|
+
}
|
|
3397
|
+
function isSameTokenValues(base, ids, values) {
|
|
3398
|
+
if (!base || base.ids.length !== ids.length) return false;
|
|
3399
|
+
const baseLookup = base.lookup;
|
|
3400
|
+
for (let i = 0, len = ids.length; i < len; i++) {
|
|
3401
|
+
if (!hasOwn(baseLookup, ids[i])) return false;
|
|
3402
|
+
if (baseLookup[ids[i]] !== values[i]) return false;
|
|
3403
|
+
}
|
|
3404
|
+
return true;
|
|
3405
|
+
}
|
|
3406
|
+
globalData("runtime.directStyleItemCache", () => /* @__PURE__ */ new WeakMap());
|
|
3407
|
+
function isResolvedStyleItem(value) {
|
|
3408
|
+
return isResolvedStyleItem$1(value);
|
|
3409
|
+
}
|
|
3410
|
+
function createResolvedStyleItem(data, scopes, tokens = null) {
|
|
3411
|
+
return createStyleItem({
|
|
3412
|
+
data,
|
|
3413
|
+
items: resolveItems(data, scopes)
|
|
3414
|
+
}, tokens);
|
|
3415
|
+
}
|
|
3416
|
+
function createResolvedStyleItemFromItems(item, tokens) {
|
|
3417
|
+
return createStyleItem({
|
|
3418
|
+
data: item.data,
|
|
3419
|
+
items: item.items
|
|
3420
|
+
}, tokens);
|
|
3421
|
+
}
|
|
3422
|
+
function getStyleTokenValues(value) {
|
|
3423
|
+
if (isCombinedStyle(value)) return getCombinedStyleTokens(value);
|
|
3424
|
+
return getResolvedStyleItemTokenValues(value);
|
|
3425
|
+
}
|
|
3426
|
+
function createCombinedStyleFacade(styles, scopes) {
|
|
3427
|
+
return createCombinedStyle({
|
|
3428
|
+
styles,
|
|
3429
|
+
scopes,
|
|
3430
|
+
tokens: null
|
|
3431
|
+
}, getStyleField);
|
|
3432
|
+
}
|
|
3433
|
+
function createCombinedStyleTokenWrapper(style, tokens) {
|
|
3434
|
+
return createCombinedStyle({
|
|
3435
|
+
styles: getCombinedStyleStyles(style),
|
|
3436
|
+
scopes: getCombinedStyleScopes(style),
|
|
3437
|
+
tokens
|
|
3438
|
+
}, getTokenField(style));
|
|
3439
|
+
}
|
|
3440
|
+
const getStyleField = (meta, prop) => {
|
|
3441
|
+
const value = meta.styles?.[prop] ?? null;
|
|
3442
|
+
if (isStyleData(value) || isSheetData(value) || isSlotData(value)) return createResolvedStyleItem(value, meta.scopes);
|
|
3443
|
+
if (isSelectorData(value)) return value;
|
|
3444
|
+
if (value && typeof value === "object") return createCombinedStyleFacade(value, meta.scopes);
|
|
3445
|
+
return value;
|
|
3446
|
+
};
|
|
3447
|
+
function getTokenField(base) {
|
|
3448
|
+
return (meta, prop) => {
|
|
3449
|
+
const value = base?.[prop] ?? null;
|
|
3450
|
+
if (isResolvedStyleItem(value)) {
|
|
3451
|
+
const tokens = mergeTokenValues(getStyleTokenValues(value), meta.tokens);
|
|
3452
|
+
return createStyleItem({
|
|
3453
|
+
data: value.data,
|
|
3454
|
+
items: value.items
|
|
3455
|
+
}, tokens);
|
|
3456
|
+
}
|
|
3457
|
+
if (isCombinedStyle(value)) return createCombinedStyleTokenWrapper(value, meta.tokens);
|
|
3458
|
+
return value;
|
|
3459
|
+
};
|
|
3460
|
+
}
|
|
3461
|
+
function createStyleItem(item, tokens = null) {
|
|
3462
|
+
markResolvedStyleItem(item);
|
|
3463
|
+
if (tokens) setResolvedStyleItemTokenValues(item, tokens);
|
|
3464
|
+
return item;
|
|
3465
|
+
}
|
|
3466
|
+
function resolveItems(data, scopes) {
|
|
3467
|
+
const items = [];
|
|
3468
|
+
const stateItems = data[BUILDER_STATE]?.items ?? [];
|
|
3469
|
+
const slotId = isSlotData(data) ? getSlotId(data) : null;
|
|
3470
|
+
for (let i = 0, len = stateItems.length; i < len; i++) {
|
|
3471
|
+
const item = stateItems[i];
|
|
3472
|
+
if (Array.isArray(item)) {
|
|
3473
|
+
items.push(item);
|
|
3474
|
+
continue;
|
|
3475
|
+
}
|
|
3476
|
+
if (isStyleTokenOverrideData(item)) {
|
|
3477
|
+
items.push(item);
|
|
3478
|
+
continue;
|
|
3479
|
+
}
|
|
3480
|
+
if (slotId && item.type !== 2) continue;
|
|
3481
|
+
items.push(item);
|
|
3482
|
+
}
|
|
3483
|
+
if (!slotId || isSheetData(data)) return items;
|
|
3484
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
3485
|
+
const boundScope = scopes[i];
|
|
3486
|
+
const scope = getScopeTargetScope(boundScope);
|
|
3487
|
+
if (!scope) continue;
|
|
3488
|
+
const scopeItems = scope[BUILDER_STATE]?.items;
|
|
3489
|
+
if (!scopeItems) continue;
|
|
3490
|
+
const targetSlotId = getScopeTargetSlotId(boundScope);
|
|
3491
|
+
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
3492
|
+
const item = scopeItems[j];
|
|
3493
|
+
if (Array.isArray(item)) {
|
|
3494
|
+
if (item[1] === slotId) items.push(item);
|
|
3495
|
+
const hasParentSelector = isExtractedScopeParentMarker$1(item[4]) || isExtractedScopeParentMarker$1(item[5]);
|
|
3496
|
+
if (targetSlotId === slotId && hasParentSelector) items.push(getScopeParentItem(String(item[3])));
|
|
3497
|
+
continue;
|
|
3498
|
+
}
|
|
3499
|
+
if (isStyleTokenOverrideData(item)) continue;
|
|
3500
|
+
if (item.type !== 4) continue;
|
|
3501
|
+
if (item.slotId === slotId) items.push(item);
|
|
3502
|
+
if (item.parentSelector && targetSlotId === slotId) items.push(getScopeParentItem(item.className));
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
return items;
|
|
3506
|
+
}
|
|
3507
|
+
function getScopeParentItem(className) {
|
|
3508
|
+
const parentClassName = formatScopeClassName(className);
|
|
3509
|
+
return [parentClassName, parentClassName];
|
|
3510
|
+
}
|
|
3511
|
+
function formatScopeClassName(className) {
|
|
3512
|
+
const format = CSS_CONFIG.scopeClassNameFormat;
|
|
3513
|
+
if (!format) return "-" + className;
|
|
3514
|
+
if (typeof format === "function") return format({ className });
|
|
3515
|
+
return format.replace(/\[|\]/g, "").replace(/\(className\)/g, className);
|
|
3516
|
+
}
|
|
3517
|
+
function isExtractedScopeParentMarker$1(value) {
|
|
3518
|
+
return value === 1 || value === true;
|
|
3519
|
+
}
|
|
3520
|
+
//#endregion
|
|
3521
|
+
//#region runtime/core/elementMarkerData.ts
|
|
3522
|
+
function splitElementMarkerStyleProp(styleProp) {
|
|
3523
|
+
if (isElementDebugData(styleProp)) return {
|
|
3524
|
+
debug: styleProp,
|
|
3525
|
+
styleProp: void 0
|
|
3526
|
+
};
|
|
3527
|
+
if (!Array.isArray(styleProp) || !isElementDebugData(styleProp[0])) return {
|
|
3528
|
+
debug: void 0,
|
|
3529
|
+
styleProp
|
|
3530
|
+
};
|
|
3531
|
+
return {
|
|
3532
|
+
debug: styleProp[0],
|
|
3533
|
+
styleProp: styleProp.length > 2 ? styleProp.slice(1) : styleProp[1]
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
function isElementDebugData(value) {
|
|
3537
|
+
if (!value || typeof value !== "object") return false;
|
|
3538
|
+
return value.$$elementDebug === true;
|
|
3539
|
+
}
|
|
3540
|
+
//#endregion
|
|
3541
|
+
//#region runtime/core/cache/itemWithResolver.ts
|
|
3542
|
+
function createResolvedStyleItemWithResolver(data, tokens, resolver) {
|
|
3543
|
+
return createResolvedStyleItem(data, [], mergeTokenValues(getDataTokenValues(data, resolver), tokens));
|
|
3544
|
+
}
|
|
3545
|
+
function getDirectStyleItemWithResolver(item, resolver) {
|
|
3546
|
+
return createResolvedStyleItemWithResolver(item, null, resolver);
|
|
3547
|
+
}
|
|
3548
|
+
function getDataTokenValues(data, resolver) {
|
|
3549
|
+
const stateItems = data[BUILDER_STATE]?.items ?? [];
|
|
3550
|
+
const values = createMutableTokenValues(null);
|
|
3551
|
+
for (let i = 0, len = stateItems.length; i < len; i++) addTokenOverride(values, stateItems[i], resolver);
|
|
3552
|
+
return finishTokenValues(null, values);
|
|
3553
|
+
}
|
|
3554
|
+
//#endregion
|
|
3555
|
+
//#region runtime/core/cache/stateItem.ts
|
|
3556
|
+
function getStateItemDedupe(item) {
|
|
3557
|
+
if (Array.isArray(item)) {
|
|
3558
|
+
if (typeof item[0] === "number") switch (item[0]) {
|
|
3559
|
+
case 1:
|
|
3560
|
+
case 9: return item[1];
|
|
3561
|
+
case 2:
|
|
3562
|
+
case 3:
|
|
3563
|
+
case 4: return item[2];
|
|
3564
|
+
}
|
|
3565
|
+
else if (typeof item[1] === "string") return item[1];
|
|
3566
|
+
return "";
|
|
3567
|
+
}
|
|
3568
|
+
if (isStyleTokenOverrideData(item)) return "";
|
|
3569
|
+
return item.dedupe;
|
|
3570
|
+
}
|
|
3571
|
+
function getStateItemClassName(item) {
|
|
3572
|
+
if (Array.isArray(item)) {
|
|
3573
|
+
if (typeof item[0] === "number") switch (item[0]) {
|
|
3574
|
+
case 1:
|
|
3575
|
+
case 9: return item[2];
|
|
3576
|
+
case 2:
|
|
3577
|
+
case 3:
|
|
3578
|
+
case 4: return item[3];
|
|
3579
|
+
}
|
|
3580
|
+
else return item[1];
|
|
3581
|
+
return "";
|
|
3582
|
+
}
|
|
3583
|
+
if (isStyleTokenOverrideData(item)) return "";
|
|
3584
|
+
return item.className;
|
|
3585
|
+
}
|
|
3586
|
+
function getStateItemVariableValue(item, tokens) {
|
|
3587
|
+
if (isStyleTokenOverrideData(item)) {
|
|
3588
|
+
const id = getStyleTokenId(item);
|
|
3589
|
+
return [getTokenVarName(item, CSS_CONFIG.tokenNameFormat ?? null), tokens && hasOwn(tokens.lookup, id) ? tokens.lookup[id] : getTokenOverrideValue(item, CSS_CONFIG.tokenNameFormat ?? null)];
|
|
3590
|
+
}
|
|
3591
|
+
const value = getStateItemValue(item);
|
|
3592
|
+
if (Array.isArray(value) && value[0] === 1) {
|
|
3593
|
+
if (isStyleTokenData(value[2]) && value[1] === getTokenVarName(value[2], CSS_CONFIG.tokenNameFormat ?? null)) {
|
|
3594
|
+
if (!tokens || !hasOwn(tokens.lookup, getStyleTokenId(value[2]))) return null;
|
|
3595
|
+
}
|
|
3596
|
+
return [value[1], resolveMarkedVariableValue(value[2], value[3], tokens)];
|
|
3597
|
+
}
|
|
3598
|
+
if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.variable?.[0] === 1) return [item.variable[1], resolveMarkedVariableValue(item.variable[2], item.variable[3], tokens)];
|
|
3599
|
+
if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.token) {
|
|
3600
|
+
if (!tokens) return null;
|
|
3601
|
+
const id = getStyleTokenId(item.token);
|
|
3602
|
+
if (!hasOwn(tokens.lookup, id)) return null;
|
|
3603
|
+
return [getTokenVarName(item.token, CSS_CONFIG.tokenNameFormat ?? null), tokens.lookup[id]];
|
|
3604
|
+
}
|
|
3605
|
+
return null;
|
|
3606
|
+
}
|
|
3607
|
+
function resolveMarkedVariableValue(value, valueMode, tokens) {
|
|
3608
|
+
return normalizeVariableValue(resolveVariableValue(value, tokens), valueMode);
|
|
3609
|
+
}
|
|
3610
|
+
function normalizeVariableValue(value, valueMode) {
|
|
3611
|
+
if (typeof value !== "number") return value;
|
|
3612
|
+
return valueMode === 1 ? value + "px" : String(value);
|
|
3613
|
+
}
|
|
3614
|
+
function getStateItemAtRuleRef(item) {
|
|
3615
|
+
const value = getStateItemValue(item);
|
|
3616
|
+
if (Array.isArray(value) && value[0] === 3) return value[1];
|
|
3617
|
+
if (!Array.isArray(item) && !isStyleTokenOverrideData(item) && item.variable?.[0] === 3) return item.variable[1];
|
|
3618
|
+
return null;
|
|
3619
|
+
}
|
|
3620
|
+
function getStateItemAtRuleRefVariables(item, tokens) {
|
|
3621
|
+
if (!tokens) return null;
|
|
3622
|
+
const refTokens = getStateItemAtRuleRef(item)?.tokens;
|
|
3623
|
+
if (!refTokens?.length) return null;
|
|
3624
|
+
const values = [];
|
|
3625
|
+
for (let i = 0, len = refTokens.length; i < len; i++) {
|
|
3626
|
+
const token = refTokens[i];
|
|
3627
|
+
const id = getStyleTokenId(token);
|
|
3628
|
+
if (!hasOwn(tokens.lookup, id)) continue;
|
|
3629
|
+
values.push([getTokenVarName(token, CSS_CONFIG.tokenNameFormat ?? null), tokens.lookup[id]]);
|
|
3630
|
+
}
|
|
3631
|
+
return values.length ? values : null;
|
|
3632
|
+
}
|
|
3633
|
+
function getStateItemValue(item) {
|
|
3634
|
+
if (Array.isArray(item)) if (typeof item[0] === "number") switch (item[0]) {
|
|
3635
|
+
case 1:
|
|
3636
|
+
case 9: return item[3];
|
|
3637
|
+
case 2:
|
|
3638
|
+
case 3: return item[4];
|
|
3639
|
+
case 4: return isExtractedScopeParentMarker(item[4]) ? void 0 : item[4];
|
|
3640
|
+
}
|
|
3641
|
+
else return item[2];
|
|
3642
|
+
}
|
|
3643
|
+
function isExtractedScopeParentMarker(value) {
|
|
3644
|
+
return value === 1 || value === true;
|
|
3645
|
+
}
|
|
3646
|
+
function resolveVariableValue(value, tokens) {
|
|
3647
|
+
if (isStyleTokenData(value)) return resolveTokenValue(value, tokens);
|
|
3648
|
+
return value;
|
|
3649
|
+
}
|
|
3650
|
+
function resolveTokenValue(token, tokens) {
|
|
3651
|
+
if (tokens) {
|
|
3652
|
+
const id = getStyleTokenId(token);
|
|
3653
|
+
if (hasOwn(tokens.lookup, id)) return tokens.lookup[id];
|
|
3654
|
+
}
|
|
3655
|
+
return getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null);
|
|
3656
|
+
}
|
|
3657
|
+
//#endregion
|
|
3658
|
+
//#region runtime/core/cache/result.ts
|
|
3659
|
+
const emptyStylePropResult = {
|
|
3660
|
+
className: "",
|
|
3661
|
+
style: void 0
|
|
3662
|
+
};
|
|
3663
|
+
let runId = 0;
|
|
3664
|
+
const dedupeRun = Object.create(null);
|
|
3665
|
+
const dedupeIndex = Object.create(null);
|
|
3666
|
+
function createStylePropResult(items, getThemeClassName) {
|
|
3667
|
+
runId++;
|
|
3668
|
+
const classNames = [];
|
|
3669
|
+
let style;
|
|
3670
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
3671
|
+
const item = items[i];
|
|
3672
|
+
if (!isResolvedStyleItem(item)) {
|
|
3673
|
+
const themeClassName = getThemeClassName(item);
|
|
3674
|
+
if (themeClassName) classNames.push(themeClassName);
|
|
3675
|
+
continue;
|
|
3676
|
+
}
|
|
3677
|
+
const tokens = getStyleTokenValues(item);
|
|
3678
|
+
const stateItems = item.items;
|
|
3679
|
+
for (let j = 0, itemLen = stateItems.length; j < itemLen; j++) style = addItem(classNames, style, stateItems[j], tokens);
|
|
3680
|
+
}
|
|
3681
|
+
if (!classNames.length && !style) return emptyStylePropResult;
|
|
3682
|
+
return {
|
|
3683
|
+
className: classNames.join(" "),
|
|
3684
|
+
style
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3687
|
+
function addItem(classNames, style, item, tokens) {
|
|
3688
|
+
const dedupe = getStateItemDedupe(item);
|
|
3689
|
+
const className = getStateItemClassName(item);
|
|
3690
|
+
if (!dedupe || !className) return addItemStyle(style, item, tokens);
|
|
3691
|
+
if (dedupeRun[dedupe] === runId) {
|
|
3692
|
+
classNames[dedupeIndex[dedupe]] = className;
|
|
3693
|
+
return addItemStyle(style, item, tokens);
|
|
3694
|
+
}
|
|
3695
|
+
dedupeRun[dedupe] = runId;
|
|
3696
|
+
dedupeIndex[dedupe] = classNames.push(className) - 1;
|
|
3697
|
+
return addItemStyle(style, item, tokens);
|
|
3698
|
+
}
|
|
3699
|
+
function addItemStyle(style, item, tokens) {
|
|
3700
|
+
const variableValue = getStateItemVariableValue(item, tokens);
|
|
3701
|
+
if (variableValue) style = setStyleValue$1(style, variableValue[0], variableValue[1]);
|
|
3702
|
+
const refValues = getStateItemAtRuleRefVariables(item, tokens);
|
|
3703
|
+
if (!refValues) return style;
|
|
3704
|
+
for (let i = 0, len = refValues.length; i < len; i++) style = setStyleValue$1(style, refValues[i][0], refValues[i][1]);
|
|
3705
|
+
return style;
|
|
3706
|
+
}
|
|
3707
|
+
function setStyleValue$1(style, name, value) {
|
|
3708
|
+
const next = style ?? {};
|
|
3709
|
+
next[name] = value;
|
|
3710
|
+
return next;
|
|
3711
|
+
}
|
|
3712
|
+
//#endregion
|
|
3713
|
+
//#region runtime/core/cache/token.ts
|
|
3714
|
+
const runtimeTokenValueResolver = {
|
|
3715
|
+
get key() {
|
|
3716
|
+
return CSS_CONFIG.tokenNameFormat;
|
|
3717
|
+
},
|
|
3718
|
+
is: isStyleTokenOverrideData,
|
|
3719
|
+
id(token) {
|
|
3720
|
+
return getStyleTokenId(token);
|
|
3721
|
+
},
|
|
3722
|
+
value(token) {
|
|
3723
|
+
return getTokenOverrideValue(token, CSS_CONFIG.tokenNameFormat ?? null);
|
|
3724
|
+
}
|
|
3725
|
+
};
|
|
3726
|
+
//#endregion
|
|
3727
|
+
//#region runtime/core/cache/prop.ts
|
|
3728
|
+
function resolveStylePropRuntime(styleProp) {
|
|
3729
|
+
if (!styleProp) return null;
|
|
3730
|
+
styleProp = splitElementMarkerStyleProp(styleProp).styleProp;
|
|
3731
|
+
if (!styleProp) return null;
|
|
3732
|
+
if (RUNTIME_CONFIG.runtimeCacheTTL === 0) {
|
|
3733
|
+
const items = collectStylePropItems(styleProp);
|
|
3734
|
+
return {
|
|
3735
|
+
items,
|
|
3736
|
+
result: createStylePropResult(items, getThemeClassName)
|
|
3737
|
+
};
|
|
3738
|
+
}
|
|
3739
|
+
let unsupportedItem;
|
|
3740
|
+
const tokenBindings = [];
|
|
3741
|
+
const cache = getStylePropCacheValue(styleProp, walkStylePropCachePath, () => warnUnsupportedStylePropItem(unsupportedItem));
|
|
3742
|
+
if (cache?.d) {
|
|
3743
|
+
if (!tokenBindings.length) return {
|
|
3744
|
+
items: cache.d.i,
|
|
3745
|
+
result: cache.d.r
|
|
3746
|
+
};
|
|
3747
|
+
return {
|
|
3748
|
+
items: cache.d.i,
|
|
3749
|
+
result: createStylePropResult(applyTokenBindings(cache.d.i, tokenBindings), getThemeClassName)
|
|
3750
|
+
};
|
|
3751
|
+
}
|
|
3752
|
+
const items = collectStylePropItems(styleProp, tokenBindings.length > 0);
|
|
3753
|
+
const data = {
|
|
3754
|
+
i: items,
|
|
3755
|
+
r: createStylePropResult(items, getThemeClassName)
|
|
3756
|
+
};
|
|
3757
|
+
if (cache) cache.d = data;
|
|
3758
|
+
if (!tokenBindings.length) return {
|
|
3759
|
+
items: data.i,
|
|
3760
|
+
result: data.r
|
|
3761
|
+
};
|
|
3762
|
+
return {
|
|
3763
|
+
items,
|
|
3764
|
+
result: createStylePropResult(applyTokenBindings(items, tokenBindings), getThemeClassName)
|
|
3765
|
+
};
|
|
3766
|
+
function walkStylePropCachePath(styleProp, fn, onUnsupported) {
|
|
3767
|
+
walkRecursiveItems(styleProp, (item) => {
|
|
3768
|
+
if (isElementDebugData(item)) return;
|
|
3769
|
+
const key = getStylePropCacheKey(item, tokenBindings);
|
|
3770
|
+
if (key) fn(key);
|
|
3771
|
+
else {
|
|
3772
|
+
unsupportedItem = item;
|
|
3773
|
+
onUnsupported();
|
|
3774
|
+
}
|
|
3775
|
+
});
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
function walkStyleProp(styleProp, fn, options) {
|
|
3779
|
+
walkRecursiveItems(styleProp, (item) => {
|
|
3780
|
+
if (isElementDebugData(item)) return;
|
|
3781
|
+
const styleItem = normalizeStylePropItem(item, options?.stableTokenBound ?? false);
|
|
3782
|
+
if (styleItem) fn(styleItem);
|
|
3783
|
+
else options?.onUnsupported?.(item);
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
function getStylePropItems(item) {
|
|
3787
|
+
if (isResolvedStyleItem(item)) return item.items;
|
|
3788
|
+
return [];
|
|
3789
|
+
}
|
|
3790
|
+
function collectStylePropItems(styleProp, stableTokenBound = false) {
|
|
3791
|
+
const items = [];
|
|
3792
|
+
walkStyleProp(styleProp, (item) => {
|
|
3793
|
+
items.push(item);
|
|
3794
|
+
}, { stableTokenBound });
|
|
3795
|
+
return items;
|
|
3796
|
+
}
|
|
3797
|
+
function warnUnsupportedStylePropItem(item) {
|
|
3798
|
+
if (!DEV_CONFIG.isDev) return;
|
|
3799
|
+
if (isElementDebugData(item)) return;
|
|
3800
|
+
if (isSlotOverrideData(item) || isScopeData(item) || isScopeTargetData(item) || isStyleTokenOverrideData(item)) {
|
|
3801
|
+
console.warn("[fluentic-style] Unsupported style prop value. Pass themes, scopes, slot overrides, and token overrides to combineStyle before using style prop.", item);
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
if (item) console.warn("[fluentic-style] Unsupported style prop value.", item);
|
|
3805
|
+
}
|
|
3806
|
+
function normalizeStylePropItem(item, stableTokenBound) {
|
|
3807
|
+
if (isElementDebugData(item)) return null;
|
|
3808
|
+
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(item)) {
|
|
3809
|
+
const bound = getExtractedTokenBoundData(item);
|
|
3810
|
+
if (stableTokenBound) return normalizeStylePropItem(bound.data, true);
|
|
3811
|
+
const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
|
|
3812
|
+
if (isStyleData(bound.data) || isSheetData(bound.data) || isSlotData(bound.data)) return createResolvedStyleItemWithResolver(bound.data, tokens, runtimeTokenValueResolver);
|
|
3813
|
+
return normalizeStylePropItem(bound.data, false);
|
|
3814
|
+
}
|
|
3815
|
+
if (isResolvedStyleItem(item) || isThemeData(item)) return item;
|
|
3816
|
+
if (isStyleData(item) || isSheetData(item) || isSlotData(item)) return getDirectStyleItemWithResolver(item, runtimeTokenValueResolver);
|
|
3817
|
+
return null;
|
|
3818
|
+
}
|
|
3819
|
+
function getStylePropCacheKey(item, tokenBindings) {
|
|
3820
|
+
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(item)) {
|
|
3821
|
+
const bound = getExtractedTokenBoundData(item);
|
|
3822
|
+
const key = getStylePropCacheKey(bound.data, tokenBindings);
|
|
3823
|
+
const tokens = mergeTokenOverrides(null, bound.tokens, runtimeTokenValueResolver);
|
|
3824
|
+
if (key && tokens) tokenBindings.push({
|
|
3825
|
+
data: key,
|
|
3826
|
+
tokens
|
|
3827
|
+
});
|
|
3828
|
+
return key;
|
|
3829
|
+
}
|
|
3830
|
+
if (isResolvedStyleItem(item) || isThemeData(item) || isStyleData(item) || isSheetData(item) || isSlotData(item)) return item;
|
|
3831
|
+
return null;
|
|
3832
|
+
}
|
|
3833
|
+
function getThemeClassName(item) {
|
|
3834
|
+
return isThemeData(item) ? item.className : null;
|
|
3835
|
+
}
|
|
3836
|
+
function applyTokenBindings(items, bindings) {
|
|
3837
|
+
if (!bindings.length) return items.slice();
|
|
3838
|
+
return items.map((item) => {
|
|
3839
|
+
if (!isResolvedStyleItem(item)) return item;
|
|
3840
|
+
const tokens = getBoundTokens(item, bindings);
|
|
3841
|
+
if (!tokens) return item;
|
|
3842
|
+
return createResolvedStyleItemFromItems(item, tokens);
|
|
3843
|
+
});
|
|
3844
|
+
}
|
|
3845
|
+
function getBoundTokens(item, bindings) {
|
|
3846
|
+
let tokens = getStyleTokenValues(item);
|
|
3847
|
+
for (let i = 0, len = bindings.length; i < len; i++) {
|
|
3848
|
+
const binding = bindings[i];
|
|
3849
|
+
if (binding.data !== item.data && binding.data !== item) continue;
|
|
3850
|
+
tokens = mergeTokenValues(tokens, binding.tokens);
|
|
3851
|
+
}
|
|
3852
|
+
return tokens;
|
|
3853
|
+
}
|
|
3854
|
+
//#endregion
|
|
3855
|
+
//#region atomic/rule.ts
|
|
3856
|
+
function buildAtomicRule(className, property, value, important, selector, parentSelector, atRules, scopeClassNameFormat) {
|
|
3857
|
+
const cssProp = getCssPropertyName(property);
|
|
3858
|
+
const cssValue = getCssPropertyValue(property, value) + (important ? " !important" : "");
|
|
3859
|
+
const escapedClass = escapeCssIdent(className);
|
|
3860
|
+
const specificity = hasSheetSelectorAnchor(selector) ? getSheetSelectorSpecificity(selector) ?? 1 : 1;
|
|
3861
|
+
const classSelector = specificity === 0 ? `:where(.${escapedClass})` : Array(specificity).fill("." + escapedClass).join("");
|
|
3862
|
+
const itemSelector = selector ? getSelectorText$1(selector) : "";
|
|
3863
|
+
let selectorStr = hasGlobalSheetSelectorAnchor(selector) ? itemSelector : classSelector + itemSelector;
|
|
3864
|
+
if (parentSelector) {
|
|
3865
|
+
const parentWhere = `:where(${"." + escapeCssIdent(getScopeClassName(className, scopeClassNameFormat)) + getSelectorText$1(parentSelector)})`;
|
|
3866
|
+
selectorStr = classSelector + parentWhere + itemSelector + "," + parentWhere + " " + selectorStr;
|
|
3867
|
+
}
|
|
3868
|
+
let rule = `${selectorStr}{${cssProp}: ${cssValue}}`;
|
|
3869
|
+
if (atRules) for (let i = atRules.length - 1; i >= 0; i--) rule = `${getSelectorText$1(atRules[i])}{${rule}}`;
|
|
3870
|
+
return rule;
|
|
3871
|
+
}
|
|
3872
|
+
function getAtomicRuleLayerPriority(property, priority, selector, parentSelector, atRules, isScopeRule = false) {
|
|
3873
|
+
const selectorPriority = getSelectorPriority$1(selector);
|
|
3874
|
+
const parentSelectorPriority = getSelectorPriority$1(parentSelector);
|
|
3875
|
+
const atRulePriority = getAtRulePriority(atRules);
|
|
3876
|
+
return [
|
|
3877
|
+
priority ?? 0,
|
|
3878
|
+
getLayerSelectorPriority(selector, parentSelector, selectorPriority),
|
|
3879
|
+
getParentSelectorPriority(parentSelector, parentSelectorPriority),
|
|
3880
|
+
getMediaPriority(atRules, atRulePriority),
|
|
3881
|
+
atRules ? atRules.length : 0,
|
|
3882
|
+
isScopeRule && !parentSelector ? 1 : 0,
|
|
3883
|
+
getPropertyPriority(property)
|
|
3884
|
+
];
|
|
3885
|
+
}
|
|
3886
|
+
function getMediaPriority(atRules, priority) {
|
|
3887
|
+
if (!atRules?.length) return LayerMediaPriorities.base;
|
|
3888
|
+
if (priority <= 0) return LayerMediaPriorities.media;
|
|
3889
|
+
return LayerMediaPriorities.priorityMedia + priority;
|
|
3890
|
+
}
|
|
3891
|
+
function getLayerSelectorPriority(selector, parentSelector, priority) {
|
|
3892
|
+
if (selector) return priority > 0 ? LayerSelectorPriorities.prioritySelector + priority : LayerSelectorPriorities.selector;
|
|
3893
|
+
if (parentSelector) return LayerSelectorPriorities.parentSelector;
|
|
3894
|
+
return LayerSelectorPriorities.base;
|
|
3895
|
+
}
|
|
3896
|
+
function getParentSelectorPriority(parentSelector, priority) {
|
|
3897
|
+
if (!parentSelector) return 0;
|
|
3898
|
+
return priority > 0 ? priority + 1 : 1;
|
|
3899
|
+
}
|
|
3900
|
+
function getAtRulePriority(atRules) {
|
|
3901
|
+
if (!atRules?.length) return 0;
|
|
3902
|
+
let priority = 0;
|
|
3903
|
+
for (let i = 0, len = atRules.length; i < len; i++) priority = Math.max(priority, getSelectorPriority$1(atRules[i]));
|
|
3904
|
+
return priority;
|
|
3905
|
+
}
|
|
3906
|
+
//#endregion
|
|
3907
|
+
//#region runtime/sheet/rule.ts
|
|
3908
|
+
function createRuntimeSheetRules(item, sheetOptions = null) {
|
|
3909
|
+
if (Array.isArray(item)) return null;
|
|
3910
|
+
if (isStyleTokenOverrideData(item)) return null;
|
|
3911
|
+
const runtimeItem = item;
|
|
3912
|
+
const parentSelector = runtimeItem.type === 4 ? runtimeItem.parentSelector : null;
|
|
3913
|
+
const layerPriority = getAtomicRuleLayerPriority(runtimeItem.property, runtimeItem.weight, runtimeItem.selector, parentSelector, runtimeItem.atRule, runtimeItem.type === 4);
|
|
3914
|
+
const ruleCss = buildAtomicRule(runtimeItem.className, runtimeItem.property, runtimeItem.value, runtimeItem.important, runtimeItem.selector, parentSelector, runtimeItem.atRule, CSS_CONFIG.scopeClassNameFormat || null);
|
|
3915
|
+
const rule = {
|
|
3916
|
+
key: runtimeItem.className,
|
|
3917
|
+
dedupe: runtimeItem.dedupe,
|
|
3918
|
+
priority: layerPriority,
|
|
3919
|
+
important: runtimeItem.important,
|
|
3920
|
+
importantNative: runtimeItem.importantNative,
|
|
3921
|
+
sheet: !!sheetOptions,
|
|
3922
|
+
layer: getRuntimeRuleLayer(sheetOptions),
|
|
3923
|
+
css: ruleCss,
|
|
3924
|
+
callsite: runtimeItem.callsite,
|
|
3925
|
+
debug: runtimeItem.debug,
|
|
3926
|
+
debugField: runtimeItem.debugField
|
|
3927
|
+
};
|
|
3928
|
+
const ref = getStateItemAtRuleRef(item);
|
|
3929
|
+
if (!ref?.css) return [rule];
|
|
3930
|
+
return [{
|
|
3931
|
+
key: ref.key,
|
|
3932
|
+
dedupe: ref.key,
|
|
3933
|
+
priority: null,
|
|
3934
|
+
css: ref.css,
|
|
3935
|
+
callsite: runtimeItem.callsite
|
|
3936
|
+
}, rule];
|
|
3937
|
+
}
|
|
3938
|
+
function getRuntimeRuleLayer(sheetOptions) {
|
|
3939
|
+
if (!sheetOptions) return "style";
|
|
3940
|
+
return resolveSheetLayerOption(sheetOptions.layer ?? false, CSS_CONFIG.layerNamespace || "css");
|
|
3941
|
+
}
|
|
3942
|
+
const formatThemeName = createNameFormatter(["name"]);
|
|
3943
|
+
function createThemeClassName(name, id, themeNameFormat) {
|
|
3944
|
+
return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name: normalizeThemeName(name) });
|
|
3945
|
+
}
|
|
3946
|
+
function getThemeRuleCss(className, tokens, tokenNameFormat) {
|
|
3947
|
+
const declarations = [];
|
|
3948
|
+
for (let i = 0, len = tokens.length; i < len; i++) declarations.push(getThemeDeclaration(tokens[i], tokenNameFormat));
|
|
3949
|
+
return "." + escapeCssIdent(className) + "{" + declarations.join(";") + "}";
|
|
3950
|
+
}
|
|
3951
|
+
function getThemeDeclaration(token, tokenNameFormat) {
|
|
3952
|
+
const name = getTokenVarName(token, tokenNameFormat);
|
|
3953
|
+
const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
|
|
3954
|
+
return name + ":" + value;
|
|
3955
|
+
}
|
|
3956
|
+
function normalizeThemeName(value) {
|
|
3957
|
+
if (!value) return null;
|
|
3958
|
+
value = value.trim();
|
|
3959
|
+
if (!value) return null;
|
|
3960
|
+
if (/^\d+$/.test(value)) return null;
|
|
3961
|
+
if (isGeneratedNameHash(value)) return null;
|
|
3962
|
+
const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
|
|
3963
|
+
if (stableSuffix?.[1] && isGeneratedNameHash(value.slice(-7))) return normalizeThemeName(stableSuffix[1]);
|
|
3964
|
+
value = stripGenericThemePrefix(value);
|
|
3965
|
+
if (!value) return null;
|
|
3966
|
+
return value;
|
|
3967
|
+
}
|
|
3968
|
+
function stripGenericThemePrefix(value) {
|
|
3969
|
+
const parts = value.split("--");
|
|
3970
|
+
while (parts[0] === "theme" || parts[0] === "themes") parts.shift();
|
|
3971
|
+
value = parts.join("--");
|
|
3972
|
+
if (value.startsWith("theme-")) return value.slice(6);
|
|
3973
|
+
if (value.startsWith("themes-")) return value.slice(7);
|
|
3974
|
+
return value;
|
|
3975
|
+
}
|
|
3976
|
+
function isGeneratedNameHash(value) {
|
|
3977
|
+
return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
|
|
3978
|
+
}
|
|
3979
|
+
//#endregion
|
|
3980
|
+
//#region runtime/sheet/theme.ts
|
|
3981
|
+
function insertRuntimeThemeRule(sheet, theme) {
|
|
3982
|
+
sheet.insert({
|
|
3983
|
+
key: theme.className,
|
|
3984
|
+
css: createThemeRule(theme),
|
|
3985
|
+
callsite: theme[BUILDER_CALLSITE]
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
function createThemeRule(theme) {
|
|
3989
|
+
return getThemeRuleCss(theme.className, theme.tokens, CSS_CONFIG.tokenNameFormat || null);
|
|
3990
|
+
}
|
|
3991
|
+
//#endregion
|
|
3992
|
+
//#region runtime/sheet/rules.ts
|
|
3993
|
+
function walkStylePropSheetRules(styleProp, onRule, onTheme) {
|
|
3994
|
+
walkStyleProp(styleProp, (item) => {
|
|
3995
|
+
walkStylePropItemSheetRules(item, onRule, onTheme);
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
function walkStylePropItemsSheetRules(items, onRule, onTheme) {
|
|
3999
|
+
for (let i = 0, len = items.length; i < len; i++) walkStylePropItemSheetRules(items[i], onRule, onTheme);
|
|
4000
|
+
}
|
|
4001
|
+
function walkStylePropItemSheetRules(item, onRule, onTheme) {
|
|
4002
|
+
if (isThemeData(item)) {
|
|
4003
|
+
onTheme?.(item);
|
|
4004
|
+
return;
|
|
4005
|
+
}
|
|
4006
|
+
const items = getStylePropItems(item);
|
|
4007
|
+
const sheetData = isResolvedStyleItem(item) && isSheetData(item.data) ? item.data : null;
|
|
4008
|
+
const sheetOptions = sheetData ? sheetData[BUILDER_SHEET_OPTIONS] : null;
|
|
4009
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
4010
|
+
const rules = createRuntimeSheetRules(items[i], sheetOptions);
|
|
4011
|
+
if (!rules) continue;
|
|
4012
|
+
for (let j = 0, len = rules.length; j < len; j++) onRule(rules[j]);
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
function collectStylePropSheetRules(styleProp) {
|
|
4016
|
+
return collectStylePropRules((onRule) => {
|
|
4017
|
+
walkStylePropSheetRules(styleProp, onRule);
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
function collectStylePropRules(walk) {
|
|
4021
|
+
const rules = [];
|
|
4022
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
4023
|
+
walk((rule) => {
|
|
4024
|
+
if (!rule.key || !rule.dedupe) return;
|
|
4025
|
+
const index = lookup.get(rule.dedupe);
|
|
4026
|
+
if (index === void 0) lookup.set(rule.dedupe, rules.push(createSheetRulePayload(rule)) - 1);
|
|
4027
|
+
else rules[index] = createSheetRulePayload(rule);
|
|
4028
|
+
});
|
|
4029
|
+
return rules;
|
|
4030
|
+
}
|
|
4031
|
+
function createSheetRulePayload(rule) {
|
|
4032
|
+
return {
|
|
4033
|
+
key: rule.key,
|
|
4034
|
+
css: rule.css,
|
|
4035
|
+
callsite: rule.callsite || null,
|
|
4036
|
+
debug: rule.debug || null,
|
|
4037
|
+
debugField: rule.debugField || null,
|
|
4038
|
+
priority: rule.priority,
|
|
4039
|
+
important: rule.important,
|
|
4040
|
+
importantNative: rule.importantNative,
|
|
4041
|
+
sheet: rule.sheet,
|
|
4042
|
+
globalSheet: rule.globalSheet,
|
|
4043
|
+
layer: rule.layer
|
|
4044
|
+
};
|
|
4045
|
+
}
|
|
4046
|
+
//#endregion
|
|
4047
|
+
//#region css/sheet.ts
|
|
4048
|
+
function createSheet(optionsOrItems, itemsOrDebug, debug) {
|
|
4049
|
+
const hasOptions = arguments.length >= 2 && !isDebugData(itemsOrDebug);
|
|
4050
|
+
return buildSheet(hasOptions ? optionsOrItems : {}, hasOptions ? itemsOrDebug : optionsOrItems, hasOptions ? debug : itemsOrDebug);
|
|
4051
|
+
}
|
|
4052
|
+
function buildSheet(options, items, resolvedDebug, global = false) {
|
|
4053
|
+
assertCreateSheetOptions(options);
|
|
4054
|
+
const callsite = resolveCallsite(resolvedDebug);
|
|
4055
|
+
let data = createSheetData(callsite, options);
|
|
4056
|
+
if (items) data = mergeSheetItems(data, callsite, items, global);
|
|
4057
|
+
return data;
|
|
4058
|
+
}
|
|
4059
|
+
function mergeSheetItems(data, callsite, items, global = false) {
|
|
4060
|
+
if (!items) return data;
|
|
4061
|
+
if (Array.isArray(items)) {
|
|
4062
|
+
let next = data;
|
|
4063
|
+
for (let i = 0, len = items.length; i < len; i++) next = mergeSheetItems(next, callsite, items[i], global);
|
|
4064
|
+
return next;
|
|
4065
|
+
}
|
|
4066
|
+
if (isStyleTokenOverrideData(items)) {
|
|
4067
|
+
if (global) throw new Error("createGlobalSheet requires token overrides inside an explicit selector");
|
|
4068
|
+
addSheetTokenOverride(data, items);
|
|
4069
|
+
return data;
|
|
4070
|
+
}
|
|
4071
|
+
if (!isSelectorData(items) && !isSelectorOverrideData(items)) throw new Error("createSheet(items) requires selector items from style.selector(...) or token overrides");
|
|
4072
|
+
const selectorItem = items;
|
|
4073
|
+
const selectors = getSelectorSelectors(selectorItem);
|
|
4074
|
+
const options = data[BUILDER_SHEET_OPTIONS];
|
|
4075
|
+
let next = data;
|
|
4076
|
+
const sheetSelectors = selectors.map((selector) => global ? setGlobalSheetSelectorOptions(selector, options) : setSheetSelectorOptions(selector, options));
|
|
4077
|
+
if (isSelectorData(selectorItem)) return next;
|
|
4078
|
+
for (let i = 0, len = selectors.length; i < len; i++) next = mergeSheetData(next, callsite, getSelectorItemStyleData(selectorItem), null, sheetSelectors[i], null);
|
|
4079
|
+
return next;
|
|
4080
|
+
}
|
|
4081
|
+
function assertCreateSheetOptions(options) {
|
|
4082
|
+
if (!options || typeof options !== "object" || Object.keys(options).some((key) => key !== "layer" && key !== "specificity")) throw new Error("createSheet only supports layer and specificity options");
|
|
4083
|
+
if (!isSheetLayerOption(options.layer)) throw new Error("createSheet options.layer must be a boolean or a valid layer name");
|
|
4084
|
+
if (options.specificity !== void 0 && (!Number.isInteger(options.specificity) || options.specificity < 0)) throw new Error("createSheet options.specificity must be a non-negative integer");
|
|
4085
|
+
}
|
|
4086
|
+
function addSheetTokenOverride(data, item) {
|
|
4087
|
+
const state = data[BUILDER_STATE];
|
|
4088
|
+
const lookup = state.lookup ??= {};
|
|
4089
|
+
const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
|
|
4090
|
+
const lookupIndex = lookup[lookupKey];
|
|
4091
|
+
if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
|
|
4092
|
+
else lookup[lookupKey] = state.items.push(item) - 1;
|
|
4093
|
+
}
|
|
4094
|
+
function getSelectorItemStyleData(data) {
|
|
4095
|
+
return {
|
|
4096
|
+
[BUILDER_TYPE]: 1,
|
|
4097
|
+
[BUILDER_STATE]: data[BUILDER_STATE],
|
|
4098
|
+
[BUILDER_CALLSITE]: data[BUILDER_CALLSITE]
|
|
4099
|
+
};
|
|
4100
|
+
}
|
|
4101
|
+
function getSheetTokenLookupKey(tokenId) {
|
|
4102
|
+
return "token\0" + tokenId;
|
|
4103
|
+
}
|
|
4104
|
+
//#endregion
|
|
4105
|
+
//#region css/globalSheet.ts
|
|
4106
|
+
function createGlobalSheet(optionsOrItems, items, debug) {
|
|
4107
|
+
const rules = buildGlobalSheetRules(optionsOrItems, items, debug, arguments.length >= 2 && !isDebugData(items));
|
|
4108
|
+
const sheet = getGlobalSheet();
|
|
4109
|
+
sheet.updateLayers(CSS_CONFIG.layers ?? CSS_CONFIG_DEFAULT.layers ?? []);
|
|
4110
|
+
for (const rule of rules) sheet.insert(rule);
|
|
4111
|
+
sheet.flush();
|
|
4112
|
+
}
|
|
4113
|
+
function buildGlobalSheetRules(optionsOrItems, items, debug, hasOptions = arguments.length >= 2 && !isDebugData(items)) {
|
|
4114
|
+
const options = hasOptions ? optionsOrItems : {};
|
|
4115
|
+
if (!options || typeof options !== "object" || Object.keys(options).some((key) => key !== "layer" && key !== "order")) throw new Error("createGlobalSheet only supports layer and order options");
|
|
4116
|
+
if (options.order !== void 0 && !Number.isFinite(options.order)) throw new Error("createGlobalSheet order must be a finite number");
|
|
4117
|
+
const data = buildSheet({ layer: options.layer }, hasOptions ? items : optionsOrItems, isDebugData(items) ? items : debug, true);
|
|
4118
|
+
const rules = collectStylePropSheetRules(data);
|
|
4119
|
+
const site = isDebugData(items) || debug ? data[BUILDER_CALLSITE] : null;
|
|
4120
|
+
const id = hashString(JSON.stringify(site ? [
|
|
4121
|
+
site.filePath,
|
|
4122
|
+
site.line,
|
|
4123
|
+
site.column
|
|
4124
|
+
] : [options, rules.map((rule) => rule.css)]));
|
|
4125
|
+
const globals = [];
|
|
4126
|
+
for (const rule of rules) globals.push({
|
|
4127
|
+
...rule,
|
|
4128
|
+
key: id + ":" + rule.key,
|
|
4129
|
+
globalSheet: {
|
|
4130
|
+
id,
|
|
4131
|
+
order: options.order ?? 0
|
|
4132
|
+
}
|
|
4133
|
+
});
|
|
4134
|
+
return globals;
|
|
4135
|
+
}
|
|
4136
|
+
//#endregion
|
|
4137
|
+
//#region atomic/atRule/keyframes.ts
|
|
4138
|
+
const KEYFRAMES_AT_RULE = "keyframes";
|
|
4139
|
+
const formatKeyFramesName = createAtRuleNameFormatter("keyframes[-(name)]-$hash");
|
|
4140
|
+
function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
|
|
4141
|
+
name = formatKeyFramesName(format, id, { name });
|
|
4142
|
+
let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
|
|
4143
|
+
for (const selector in frames) {
|
|
4144
|
+
const frame = frames[selector];
|
|
4145
|
+
if (!frame) continue;
|
|
4146
|
+
css += selector + "{";
|
|
4147
|
+
css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
|
|
4148
|
+
css += "}";
|
|
4149
|
+
}
|
|
4150
|
+
css += "}";
|
|
4151
|
+
return {
|
|
4152
|
+
name,
|
|
4153
|
+
css
|
|
4154
|
+
};
|
|
4155
|
+
}
|
|
4156
|
+
//#endregion
|
|
4157
|
+
//#region css/keyframes.ts
|
|
4158
|
+
const idCounter$2 = createIdCounter("keyframes");
|
|
4159
|
+
function createKeyframes(frames, stableId) {
|
|
4160
|
+
return createNamedAtRuleRef({
|
|
4161
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
4162
|
+
buildCss: buildKeyframesCss,
|
|
4163
|
+
value: frames,
|
|
4164
|
+
idCounter: idCounter$2,
|
|
4165
|
+
stableId
|
|
4166
|
+
});
|
|
4167
|
+
}
|
|
4168
|
+
//#endregion
|
|
4169
|
+
//#region atomic/atRule/positionTry.ts
|
|
4170
|
+
const POSITION_TRY_AT_RULE = "position-try";
|
|
4171
|
+
const formatPositionTryName = createAtRuleNameFormatter("position-try[-(name)]-$hash", "--");
|
|
4172
|
+
function buildPositionTryCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
4173
|
+
name = formatPositionTryName(format, id, { name });
|
|
4174
|
+
const css = buildNamedAtRuleCss(POSITION_TRY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
4175
|
+
return {
|
|
4176
|
+
name,
|
|
4177
|
+
css
|
|
4178
|
+
};
|
|
4179
|
+
}
|
|
4180
|
+
//#endregion
|
|
4181
|
+
//#region css/positionTry.ts
|
|
4182
|
+
const idCounter$1 = createIdCounter("positionTry");
|
|
4183
|
+
function createPositionTry(descriptors, stableId) {
|
|
4184
|
+
return createNamedAtRuleRef({
|
|
4185
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
4186
|
+
buildCss: buildPositionTryCss,
|
|
4187
|
+
value: descriptors,
|
|
4188
|
+
idCounter: idCounter$1,
|
|
4189
|
+
stableId
|
|
4190
|
+
});
|
|
4191
|
+
}
|
|
4192
|
+
//#endregion
|
|
4193
|
+
//#region atomic/atRule/property.ts
|
|
4194
|
+
const PROPERTY_AT_RULE = "property";
|
|
4195
|
+
const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
|
|
4196
|
+
function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
4197
|
+
name = formatPropertyName(format, id, { name });
|
|
4198
|
+
return {
|
|
4199
|
+
css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
|
|
4200
|
+
name
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
//#endregion
|
|
4204
|
+
//#region css/property.ts
|
|
4205
|
+
const idCounter = createIdCounter("property");
|
|
4206
|
+
function createProperty(nameOrDescriptors, descriptorsOrStableId) {
|
|
4207
|
+
const descriptors = typeof nameOrDescriptors === "string" ? descriptorsOrStableId : nameOrDescriptors;
|
|
4208
|
+
return createNamedAtRuleRef({
|
|
4209
|
+
idCounter,
|
|
4210
|
+
stableId: typeof nameOrDescriptors === "string" ? {
|
|
4211
|
+
name: nameOrDescriptors,
|
|
4212
|
+
id: nameOrDescriptors
|
|
4213
|
+
} : descriptorsOrStableId,
|
|
4214
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
4215
|
+
value: descriptors,
|
|
4216
|
+
buildCss: buildPropertyCss
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
//#endregion
|
|
4220
|
+
//#region runtime/env.ts
|
|
4221
|
+
const IS_SERVER_RUNTIME = typeof window === "undefined";
|
|
4222
|
+
function isServerRSC() {
|
|
4223
|
+
return RUNTIME_CONFIG.isRSC && IS_SERVER_RUNTIME;
|
|
4224
|
+
}
|
|
4225
|
+
//#endregion
|
|
4226
|
+
//#region runtime/sheet/insert.ts
|
|
4227
|
+
function insertStylePropRuntimeItems(sheet, items) {
|
|
4228
|
+
if (!items.length) return;
|
|
4229
|
+
sheet.updateLayers(CSS_CONFIG.layers || LayerDefaultLayers);
|
|
4230
|
+
walkStylePropItemsSheetRules(items, (rule) => sheet.insert(rule), (theme) => insertRuntimeThemeRule(sheet, theme));
|
|
4231
|
+
}
|
|
4232
|
+
const formatElementClassName = createNameFormatter(["name"]);
|
|
4233
|
+
function getElementClassName(label, id, elementClassNameFormat) {
|
|
4234
|
+
const name = sanitizeDebugName(label) || null;
|
|
4235
|
+
const hash = getIdentifierSafeHash(id, DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 5);
|
|
4236
|
+
return formatElementClassName(elementClassNameFormat || "@(name)", hash, { name });
|
|
4237
|
+
}
|
|
4238
|
+
function getElementMarkerRuleCss(className) {
|
|
4239
|
+
return `.${escapeCssIdent(className)}{--fluentic-element-marker:0}`;
|
|
4240
|
+
}
|
|
4241
|
+
//#endregion
|
|
4242
|
+
//#region runtime/sheet/element.ts
|
|
4243
|
+
function createElementMarkerRule(className, callsite) {
|
|
4244
|
+
return {
|
|
4245
|
+
key: `element-marker:${className}`,
|
|
4246
|
+
css: getElementMarkerRuleCss(className),
|
|
4247
|
+
callsite
|
|
4248
|
+
};
|
|
4249
|
+
}
|
|
4250
|
+
//#endregion
|
|
4251
|
+
//#region runtime/core/elementMarker.ts
|
|
4252
|
+
const ELEMENT_MARKER_SHEET = globalData("runtime.elementMarkerSheet", () => ({ sheet: null }));
|
|
4253
|
+
function createElementMarkerClassName(debug) {
|
|
4254
|
+
if (!DEV_CONFIG.isDev || !DEV_CONFIG.isElementClassNameEnabled) return null;
|
|
4255
|
+
const marker = createElementMarkerRuleFromDebug(debug);
|
|
4256
|
+
if (!marker) return null;
|
|
4257
|
+
insertElementMarkerSheetRule(marker.rule);
|
|
4258
|
+
return marker.className;
|
|
4259
|
+
}
|
|
4260
|
+
function insertElementMarkerSheetRule(rule, documentOverride) {
|
|
4261
|
+
const document = getRuntimeDocument(documentOverride);
|
|
4262
|
+
if (!document) return;
|
|
4263
|
+
const className = getElementMarkerClassNameFromRule(rule);
|
|
4264
|
+
if (!className) return;
|
|
4265
|
+
const sheet = getElementMarkerSheet(document);
|
|
4266
|
+
sheet.classNames.add(className);
|
|
4267
|
+
sheet.sheet.insert(rule);
|
|
4268
|
+
sheet.sheet.flush();
|
|
4269
|
+
}
|
|
4270
|
+
function createElementMarkerRuleFromDebug(debug) {
|
|
4271
|
+
const callsite = getElementCallsite(debug);
|
|
4272
|
+
if (!callsite) return null;
|
|
4273
|
+
const className = getElementClassName(debug?.label, getElementCallsiteId(callsite), CSS_CONFIG.elementClassNameFormat || null);
|
|
4274
|
+
return {
|
|
4275
|
+
className,
|
|
4276
|
+
rule: createElementMarkerRule(className, callsite)
|
|
4277
|
+
};
|
|
4278
|
+
}
|
|
4279
|
+
function isElementMarkerRule(rule) {
|
|
4280
|
+
return typeof rule.key === "string" && rule.key.startsWith("element-marker:");
|
|
4281
|
+
}
|
|
4282
|
+
function getElementMarkerClassNameFromRule(rule) {
|
|
4283
|
+
if (!isElementMarkerRule(rule)) return null;
|
|
4284
|
+
return rule.key.slice(15) || null;
|
|
4285
|
+
}
|
|
4286
|
+
function getElementMarkerSheet(document) {
|
|
4287
|
+
const current = ELEMENT_MARKER_SHEET.sheet;
|
|
4288
|
+
if (current?.document === document) return current;
|
|
4289
|
+
current?.sheet.destroy?.();
|
|
4290
|
+
const sheet = {
|
|
4291
|
+
document,
|
|
4292
|
+
sheet: createDevSheet({
|
|
4293
|
+
document,
|
|
4294
|
+
tagName: "element-marker",
|
|
4295
|
+
top: true
|
|
4296
|
+
}),
|
|
4297
|
+
classNames: /* @__PURE__ */ new Set()
|
|
4298
|
+
};
|
|
4299
|
+
ELEMENT_MARKER_SHEET.sheet = sheet;
|
|
4300
|
+
return sheet;
|
|
4301
|
+
}
|
|
4302
|
+
onRuntimeDocumentChange(() => {
|
|
4303
|
+
ELEMENT_MARKER_SHEET.sheet?.sheet.destroy?.();
|
|
4304
|
+
ELEMENT_MARKER_SHEET.sheet = null;
|
|
4305
|
+
});
|
|
4306
|
+
function getElementCallsite(debug) {
|
|
4307
|
+
if (debug) return {
|
|
4308
|
+
filePath: debug.sourceUrl,
|
|
4309
|
+
sourceUrl: debug.sourceUrl,
|
|
4310
|
+
sourceContent: debug.code,
|
|
4311
|
+
line: debug.loc[0],
|
|
4312
|
+
column: debug.loc[1]
|
|
4313
|
+
};
|
|
4314
|
+
return null;
|
|
4315
|
+
}
|
|
4316
|
+
function getElementCallsiteId(callsite) {
|
|
4317
|
+
return `${callsite.filePath}\n${callsite.line}:${callsite.column}`;
|
|
4318
|
+
}
|
|
4319
|
+
//#endregion
|
|
4320
|
+
//#region runtime/core/resolveClassNameRuntime.ts
|
|
4321
|
+
function resolveClassNameRuntime(styleProp, props = {}) {
|
|
4322
|
+
const result = createClassNameResult(props);
|
|
4323
|
+
const resolved = resolveStylePropRuntime(styleProp);
|
|
4324
|
+
if (resolved) {
|
|
4325
|
+
mergeResolvedClassName(result, resolved.result.className);
|
|
4326
|
+
mergeResolvedStyle(result, resolved.result.style);
|
|
4327
|
+
}
|
|
4328
|
+
return {
|
|
4329
|
+
result: finishClassNameResult(result),
|
|
4330
|
+
items: resolved?.items ?? []
|
|
4331
|
+
};
|
|
4332
|
+
}
|
|
4333
|
+
//#endregion
|
|
4334
|
+
//#region runtime/core/getClassName.ts
|
|
4335
|
+
function getClassName(styleProp, props = {}) {
|
|
4336
|
+
const marker = splitElementMarkerStyleProp(styleProp);
|
|
4337
|
+
const resolved = resolveClassNameRuntime(marker.styleProp, props);
|
|
4338
|
+
if (resolved.items.length) {
|
|
4339
|
+
if (!RUNTIME_CONFIG.isExtracted && !isServerRSC()) {
|
|
4340
|
+
const sheet = getGlobalSheet();
|
|
4341
|
+
insertStylePropRuntimeItems(sheet, resolved.items);
|
|
4342
|
+
sheet.flush();
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
prependClassName$1(resolved.result, createElementMarkerClassName(marker.debug));
|
|
4346
|
+
return resolved.result;
|
|
4347
|
+
}
|
|
4348
|
+
function prependClassName$1(result, className) {
|
|
4349
|
+
if (!className) return;
|
|
4350
|
+
result.className = result.className ? `${className} ${result.className}` : className;
|
|
4351
|
+
}
|
|
4352
|
+
//#endregion
|
|
4353
|
+
//#region runtime/core/getToken.ts
|
|
4354
|
+
function getToken(value) {
|
|
4355
|
+
if (isStyleTokenData(value)) return getTokenVar(value, CSS_CONFIG.tokenNameFormat ?? null);
|
|
4356
|
+
return value;
|
|
4357
|
+
}
|
|
4358
|
+
//#endregion
|
|
4359
|
+
//#region runtime/core/createTransformElement.ts
|
|
4360
|
+
function createTransformElement(getClassName) {
|
|
4361
|
+
return ({ type, props }) => {
|
|
4362
|
+
if (!props || typeof type !== "string") return {
|
|
4363
|
+
type,
|
|
4364
|
+
props
|
|
4365
|
+
};
|
|
4366
|
+
if (!hasOwn(props, "css")) return {
|
|
4367
|
+
type,
|
|
4368
|
+
props
|
|
4369
|
+
};
|
|
4370
|
+
const { css, ...rest } = props;
|
|
4371
|
+
if (!css) return {
|
|
4372
|
+
type,
|
|
4373
|
+
props: rest
|
|
4374
|
+
};
|
|
4375
|
+
const marker = splitElementMarkerStyleProp(css);
|
|
4376
|
+
if (marker.styleProp) Object.assign(rest, getClassName(marker.styleProp, rest));
|
|
4377
|
+
prependClassName(rest, createElementMarkerClassName(marker.debug));
|
|
4378
|
+
return {
|
|
4379
|
+
type,
|
|
4380
|
+
props: rest
|
|
4381
|
+
};
|
|
4382
|
+
};
|
|
4383
|
+
}
|
|
4384
|
+
function prependClassName(props, className) {
|
|
4385
|
+
if (!className) return;
|
|
4386
|
+
props.className = props.className ? `${className} ${props.className}` : className;
|
|
4387
|
+
}
|
|
4388
|
+
//#endregion
|
|
4389
|
+
//#region runtime/core/jsx.ts
|
|
4390
|
+
const transformElement = createTransformElement(getClassName);
|
|
4391
|
+
//#endregion
|
|
4392
|
+
//#region css/styleTarget.ts
|
|
4393
|
+
const sharedTargets = /* @__PURE__ */ new WeakMap();
|
|
4394
|
+
function createStyleTarget() {
|
|
4395
|
+
const owner = {};
|
|
4396
|
+
const targets = /* @__PURE__ */ new Map();
|
|
4397
|
+
return {
|
|
4398
|
+
apply(target, css, options) {
|
|
4399
|
+
if (!target) return;
|
|
4400
|
+
if (options?.enabled === false) {
|
|
4401
|
+
clearTarget(targets, owner, target);
|
|
4402
|
+
return;
|
|
4403
|
+
}
|
|
4404
|
+
const result = getClassName(css);
|
|
4405
|
+
const classNames = new Set(result.className?.split(/\s+/).filter(Boolean) ?? []);
|
|
4406
|
+
const styleEntries = Object.entries(result.style ?? {});
|
|
4407
|
+
const signature = createSignature(classNames, styleEntries);
|
|
4408
|
+
const previous = targets.get(target);
|
|
4409
|
+
if (previous?.signature === signature) return;
|
|
4410
|
+
const state = previous ?? {
|
|
4411
|
+
classNames: /* @__PURE__ */ new Set(),
|
|
4412
|
+
styleValues: /* @__PURE__ */ new Map(),
|
|
4413
|
+
signature: ""
|
|
4414
|
+
};
|
|
4415
|
+
updateClasses(target, state.classNames, classNames);
|
|
4416
|
+
updateStyles(target, owner, state.styleValues, styleEntries);
|
|
4417
|
+
state.classNames = classNames;
|
|
4418
|
+
state.signature = signature;
|
|
4419
|
+
targets.set(target, state);
|
|
4420
|
+
},
|
|
4421
|
+
destroy() {
|
|
4422
|
+
targets.forEach((_, target) => clearTarget(targets, owner, target));
|
|
4423
|
+
}
|
|
4424
|
+
};
|
|
4425
|
+
}
|
|
4426
|
+
function createSignature(classNames, styleEntries) {
|
|
4427
|
+
let signature = [...classNames].sort().join(" ");
|
|
4428
|
+
for (let i = 0, len = styleEntries.length; i < len; i++) {
|
|
4429
|
+
const [name, value] = styleEntries[i];
|
|
4430
|
+
signature += `\n${name}:${String(value)}`;
|
|
4431
|
+
}
|
|
4432
|
+
return signature;
|
|
4433
|
+
}
|
|
4434
|
+
function updateClasses(target, previous, next) {
|
|
4435
|
+
previous.forEach((className) => {
|
|
4436
|
+
if (!next.has(className)) removeClassName(target, className);
|
|
4437
|
+
});
|
|
4438
|
+
next.forEach((className) => {
|
|
4439
|
+
if (!previous.has(className)) addClassName(target, className);
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
function addClassName(target, className) {
|
|
4443
|
+
const state = getSharedTargetState(target);
|
|
4444
|
+
const count = state.classNames.get(className) ?? 0;
|
|
4445
|
+
if (count === 0) target.classList.add(className);
|
|
4446
|
+
state.classNames.set(className, count + 1);
|
|
4447
|
+
}
|
|
4448
|
+
function removeClassName(target, className) {
|
|
4449
|
+
const state = getSharedTargetState(target);
|
|
4450
|
+
const count = state.classNames.get(className) ?? 0;
|
|
4451
|
+
if (count <= 1) {
|
|
4452
|
+
state.classNames.delete(className);
|
|
4453
|
+
target.classList.remove(className);
|
|
4454
|
+
deleteSharedStateIfEmpty(target, state);
|
|
4455
|
+
return;
|
|
4456
|
+
}
|
|
4457
|
+
state.classNames.set(className, count - 1);
|
|
4458
|
+
}
|
|
4459
|
+
function updateStyles(target, owner, previousValues, nextEntries) {
|
|
4460
|
+
const nextNames = /* @__PURE__ */ new Set();
|
|
4461
|
+
for (let i = 0, len = nextEntries.length; i < len; i++) {
|
|
4462
|
+
const [name, value] = nextEntries[i];
|
|
4463
|
+
const nextValue = String(value);
|
|
4464
|
+
nextNames.add(name);
|
|
4465
|
+
if (previousValues.get(name) !== nextValue) {
|
|
4466
|
+
setStyleValue(target, owner, name, nextValue);
|
|
4467
|
+
previousValues.set(name, nextValue);
|
|
4468
|
+
}
|
|
4469
|
+
}
|
|
4470
|
+
previousValues.forEach((_, name) => {
|
|
4471
|
+
if (nextNames.has(name)) return;
|
|
4472
|
+
removeStyleValue(target, owner, name);
|
|
4473
|
+
previousValues.delete(name);
|
|
4474
|
+
});
|
|
4475
|
+
}
|
|
4476
|
+
function clearTarget(targets, owner, target) {
|
|
4477
|
+
const state = targets.get(target);
|
|
4478
|
+
if (!state) return;
|
|
4479
|
+
state.classNames.forEach((className) => removeClassName(target, className));
|
|
4480
|
+
state.styleValues.forEach((_, name) => {
|
|
4481
|
+
removeStyleValue(target, owner, name);
|
|
4482
|
+
});
|
|
4483
|
+
targets.delete(target);
|
|
4484
|
+
}
|
|
4485
|
+
function setStyleValue(target, owner, name, value) {
|
|
4486
|
+
const targetState = getSharedTargetState(target);
|
|
4487
|
+
let styleState = targetState.styleNames.get(name);
|
|
4488
|
+
if (!styleState) {
|
|
4489
|
+
styleState = {
|
|
4490
|
+
initialValue: target.style.getPropertyValue(name),
|
|
4491
|
+
owners: /* @__PURE__ */ new Map()
|
|
4492
|
+
};
|
|
4493
|
+
targetState.styleNames.set(name, styleState);
|
|
4494
|
+
}
|
|
4495
|
+
styleState.owners.delete(owner);
|
|
4496
|
+
styleState.owners.set(owner, value);
|
|
4497
|
+
target.style.setProperty(name, value);
|
|
4498
|
+
}
|
|
4499
|
+
function removeStyleValue(target, owner, name) {
|
|
4500
|
+
const targetState = getSharedTargetState(target);
|
|
4501
|
+
const styleState = targetState.styleNames.get(name);
|
|
4502
|
+
if (!styleState) return;
|
|
4503
|
+
styleState.owners.delete(owner);
|
|
4504
|
+
const currentValue = getLastStyleValue(styleState);
|
|
4505
|
+
if (currentValue !== null) {
|
|
4506
|
+
target.style.setProperty(name, currentValue);
|
|
4507
|
+
return;
|
|
4508
|
+
}
|
|
4509
|
+
targetState.styleNames.delete(name);
|
|
4510
|
+
restoreStyleValue(target, name, styleState.initialValue);
|
|
4511
|
+
deleteSharedStateIfEmpty(target, targetState);
|
|
4512
|
+
}
|
|
4513
|
+
function getLastStyleValue(styleState) {
|
|
4514
|
+
let value = null;
|
|
4515
|
+
styleState.owners.forEach((ownerValue) => {
|
|
4516
|
+
value = ownerValue;
|
|
4517
|
+
});
|
|
4518
|
+
return value;
|
|
4519
|
+
}
|
|
4520
|
+
function getSharedTargetState(target) {
|
|
4521
|
+
let state = sharedTargets.get(target);
|
|
4522
|
+
if (!state) {
|
|
4523
|
+
state = {
|
|
4524
|
+
classNames: /* @__PURE__ */ new Map(),
|
|
4525
|
+
styleNames: /* @__PURE__ */ new Map()
|
|
4526
|
+
};
|
|
4527
|
+
sharedTargets.set(target, state);
|
|
4528
|
+
}
|
|
4529
|
+
return state;
|
|
4530
|
+
}
|
|
4531
|
+
function deleteSharedStateIfEmpty(target, state) {
|
|
4532
|
+
if (!state.classNames.size && !state.styleNames.size) sharedTargets.delete(target);
|
|
4533
|
+
}
|
|
4534
|
+
function restoreStyleValue(target, name, value) {
|
|
4535
|
+
if (value) target.style.setProperty(name, value);
|
|
4536
|
+
else target.style.removeProperty(name);
|
|
4537
|
+
}
|
|
4538
|
+
//#endregion
|
|
4539
|
+
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 };
|
|
4540
|
+
|
|
4541
|
+
//# sourceMappingURL=css-B-7-Do-J.js.map
|