@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
|
@@ -1,113 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { S as isAtRuleRef, c as createIdCounter, l as getId, r as createKeyframes, w as shouldAppendCssPx } from "./css-DfH4Gb1c.js";
|
|
4
|
-
import { S as isStyleData, b as isSlotData, f as getAtomicClassName, p as getClassNameDedupe, v as isScopeData, w as DEV_CONFIG, x as isSlotOverrideData } from "./style-CYXTs1iu.js";
|
|
5
|
-
import { c as BUILDER_CALLSITE, d as BUILDER_SLOT_ID, f as BUILDER_STATE, l as BUILDER_SCOPE, p as BUILDER_TYPE, u as BUILDER_SCOPE_ID } from "./withTokens-LRidu3Vc.js";
|
|
1
|
+
import { B as BUILDER_STATE, L as BUILDER_SELECTOR, P as BUILDER_CALLSITE, W as RUNTIME_CONFIG, X as symbol, d as getExtractedTokenBoundData, f as isExtractedTokenBoundData, l as createCacheTreeNode, u as getCacheTreeChild, z as BUILDER_SLOT_ID } from "./className-CC5PHcXI.js";
|
|
2
|
+
import { A as assertManualSelectorSyntax, At as hashString, B as mergeSlotOverrideData, C as isCombinedStyle, Ct as traceError, Dt as importantValue, Et as weightValue, F as FnPrefixStyle, I as resolveCallsite, L as transformStyle, M as FnPrefixScope, Mt as setBuildDebugClassName, N as FnPrefixSelector, Nt as setBuildConfig, O as createIdCounter, Ot as isStyleImportantValue, P as FnPrefixSlot, Pt as CSS_CONFIG, Q as mergeScopeData, R as mergeSelectorOverrideData, S as getCombinedStyleStyles, St as createThemeData, Tt as isStyleWeightValue, V as mergeStyleData, W as normalizeSelectorArg, X as isClassNameValue, Y as classNameValue, _ as createMutableTokenValues, _t as createSelectorData, at as getScopeTargetScope, b as mergeTokenValues, bt as createSlotOverrideData, ct as isScopeTargetData, dt as isStyleData, et as createStyleToken, f as createCombinedStyleFacade, ft as getDebugCallsiteId, g as addTokenValues, gt as createScopeTargetData, h as addTokenOverride, ht as createScopeData, it as getChildStyleTokenName, j as normalizeManualSelectors$1, k as getId, kt as DEV_CONFIG, lt as isSheetData, m as getStyleTokenValues, mt as isDebugData, ot as getScopeTargetSlotId, p as createCombinedStyleTokenWrapper, pt as getTraceCallsiteId, s as createKeyframes, st as isScopeData, u as createThemeClassName, v as finishTokenValues, vt as createSelectorOverrideData, wt as traceMarker, x as getCombinedStyleScopes, xt as createStyleData, y as mergeTokenOverrides, yt as createSlotData, z as mergeSlotData } from "./css-B-7-Do-J.js";
|
|
6
3
|
import { SelectorType, parse } from "css-what";
|
|
7
|
-
//#region
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: FN_MARKER + name,
|
|
12
|
-
configurable: true
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
const CALLSITE_REGEX = /(.+):(\d+):(\d+)$/;
|
|
16
|
-
function traceCallsite() {
|
|
17
|
-
const lines = (traceAdjustError(/* @__PURE__ */ new Error()).stack || "").split("\n");
|
|
18
|
-
const parsedFrames = lines.slice(1).map(parseStackFrame).filter((frame) => frame !== null);
|
|
19
|
-
if (!parsedFrames.length) return null;
|
|
20
|
-
const targetFrame = parsedFrames.find((frame) => !isInternalCallsite(frame.filePath)) ?? parsedFrames[0];
|
|
21
|
-
return {
|
|
22
|
-
stack: [lines[0] || "Error", createStackFrameLine(targetFrame)].join("\n"),
|
|
23
|
-
filePath: targetFrame.filePath,
|
|
24
|
-
sourceUrl: targetFrame.sourceUrl,
|
|
25
|
-
line: targetFrame.line,
|
|
26
|
-
column: targetFrame.column
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function parseStackFrame(lineText) {
|
|
30
|
-
const match = getStackFrameLocationText(lineText).match(CALLSITE_REGEX);
|
|
31
|
-
if (!match) return null;
|
|
32
|
-
const rawFilePath = normalizeCallsiteSourceUrl(match[1]);
|
|
33
|
-
return {
|
|
34
|
-
filePath: normalizeCallsiteFilePath(rawFilePath),
|
|
35
|
-
sourceUrl: isFetchableCallsiteSourceUrl(rawFilePath) ? rawFilePath : void 0,
|
|
36
|
-
line: parseInt(match[2], 10),
|
|
37
|
-
column: parseInt(match[3], 10)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function getStackFrameLocationText(lineText) {
|
|
41
|
-
let frame = lineText.trim().replace(/^at\s+/, "");
|
|
42
|
-
if (frame.endsWith(")")) {
|
|
43
|
-
const parenIndex = frame.lastIndexOf("(");
|
|
44
|
-
if (parenIndex !== -1) frame = frame.slice(parenIndex + 1, -1);
|
|
45
|
-
}
|
|
46
|
-
return frame;
|
|
47
|
-
}
|
|
48
|
-
function normalizeCallsiteSourceUrl(source) {
|
|
49
|
-
let filePath = source.trim();
|
|
50
|
-
try {
|
|
51
|
-
filePath = decodeURI(filePath);
|
|
52
|
-
} catch {}
|
|
53
|
-
if (filePath.startsWith("source:///at ") || filePath.startsWith("source:///at%20")) filePath = filePath.slice(10);
|
|
54
|
-
const strayAtMatch = filePath.match(/(?:^|\/)at\s+([a-zA-Z][a-zA-Z\d+.-]*:\/\/.+|\/.+)$/);
|
|
55
|
-
return strayAtMatch ? strayAtMatch[1] : filePath.replace(/^at\s+/, "");
|
|
56
|
-
}
|
|
57
|
-
function normalizeCallsiteFilePath(filePath) {
|
|
58
|
-
filePath = normalizeCallsiteSourceUrl(filePath);
|
|
59
|
-
const queryIndex = findFirstIndex(filePath, ["?", "#"]);
|
|
60
|
-
if (queryIndex !== -1) filePath = filePath.substring(0, queryIndex);
|
|
61
|
-
filePath = filePath.replace(/^file:\/\/\/?/, "");
|
|
62
|
-
if (filePath.startsWith("/@fs/")) filePath = "/" + filePath.slice(5);
|
|
63
|
-
const webpackInternalMatch = filePath.match(/^webpack-internal:\/\/\/(?:\([^)]+\)\/)?(.+)$/);
|
|
64
|
-
if (webpackInternalMatch) filePath = webpackInternalMatch[1];
|
|
65
|
-
const webpackSourceMatch = filePath.match(/^webpack:\/\/[^/]+\/(.+)$/);
|
|
66
|
-
if (webpackSourceMatch) filePath = webpackSourceMatch[1];
|
|
67
|
-
return filePath;
|
|
68
|
-
}
|
|
69
|
-
function isFetchableCallsiteSourceUrl(filePath) {
|
|
70
|
-
return /^https?:\/\//.test(filePath) || filePath.startsWith("/");
|
|
71
|
-
}
|
|
72
|
-
function findFirstIndex(text, needles) {
|
|
73
|
-
let index = -1;
|
|
74
|
-
for (const needle of needles) {
|
|
75
|
-
const next = text.indexOf(needle);
|
|
76
|
-
if (next !== -1 && (index === -1 || next < index)) index = next;
|
|
77
|
-
}
|
|
78
|
-
return index;
|
|
79
|
-
}
|
|
80
|
-
function createStackFrameLine(frame) {
|
|
81
|
-
return ` at ${frame.filePath}:${frame.line}:${frame.column}`;
|
|
82
|
-
}
|
|
83
|
-
function isInternalCallsite(filePath) {
|
|
84
|
-
const normalized = filePath.replace(/\\/g, "/");
|
|
85
|
-
return normalized.startsWith("node:") || normalized.startsWith("internal/") || normalized.includes("/node_modules/") || normalized.includes("/packages/style/dist/") || normalized.includes("/packages/style/builder/") || normalized.includes("/packages/style/runtime/") || normalized.includes("/packages/style/utils/trace.");
|
|
86
|
-
}
|
|
87
|
-
function traceError(message, options = {}) {
|
|
88
|
-
const error = new Error(message || "");
|
|
89
|
-
error.name = options.name || "StyleError";
|
|
90
|
-
if (typeof options.stack === "string") {
|
|
91
|
-
error.stack = options.stack;
|
|
92
|
-
return error;
|
|
93
|
-
}
|
|
94
|
-
return traceAdjustError(error, options);
|
|
95
|
-
}
|
|
96
|
-
function traceAdjustError(error, options = {}) {
|
|
97
|
-
const offset = options.offset ?? 0;
|
|
98
|
-
const stack = error.stack;
|
|
99
|
-
if (!stack) return error;
|
|
100
|
-
const lines = stack.split("\n");
|
|
101
|
-
const markerIndex = lines.findIndex((line) => line.includes(FN_MARKER));
|
|
102
|
-
if (markerIndex === -1) return error;
|
|
103
|
-
const traced = new Error(error.message);
|
|
104
|
-
traced.name = error.name;
|
|
105
|
-
const frameStartIndex = Math.max(markerIndex + 1 + offset, 1);
|
|
106
|
-
let frames = lines.slice(frameStartIndex);
|
|
107
|
-
if (options.limit) frames = frames.slice(0, options.limit);
|
|
108
|
-
traced.stack = [lines[0], ...frames].join("\n");
|
|
109
|
-
return traced;
|
|
110
|
-
}
|
|
4
|
+
//#region entry/shared/config_debug.ts
|
|
5
|
+
const buildConfig = JSON.parse(FLUENTIC_STYLE_BUILD_CONFIG);
|
|
6
|
+
setBuildConfig(buildConfig);
|
|
7
|
+
setBuildDebugClassName(buildConfig.css?.debugClassName, false);
|
|
111
8
|
//#endregion
|
|
112
9
|
//#region selector/selector.ts
|
|
113
10
|
function selector(selector, ...args) {
|
|
@@ -252,564 +149,6 @@ function checkSelector$1(fnPrefix, fnName, fnSelector, arg) {
|
|
|
252
149
|
throw traceError(`${fnPrefix}${fnName}(${arg || ""}): ${message}`);
|
|
253
150
|
}
|
|
254
151
|
//#endregion
|
|
255
|
-
//#region builder/data/create.ts
|
|
256
|
-
function createStyleData(callsite) {
|
|
257
|
-
return {
|
|
258
|
-
[BUILDER_TYPE]: 1,
|
|
259
|
-
[BUILDER_STATE]: {
|
|
260
|
-
items: [],
|
|
261
|
-
lookup: {}
|
|
262
|
-
},
|
|
263
|
-
[BUILDER_CALLSITE]: callsite
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function createSlotData(callsite, slotId) {
|
|
267
|
-
return {
|
|
268
|
-
[BUILDER_TYPE]: 2,
|
|
269
|
-
[BUILDER_STATE]: {
|
|
270
|
-
items: [],
|
|
271
|
-
lookup: {}
|
|
272
|
-
},
|
|
273
|
-
[BUILDER_CALLSITE]: callsite,
|
|
274
|
-
[BUILDER_SLOT_ID]: slotId
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function createSlotOverrideData(callsite, slotId) {
|
|
278
|
-
return {
|
|
279
|
-
[BUILDER_TYPE]: 3,
|
|
280
|
-
[BUILDER_STATE]: {
|
|
281
|
-
items: [],
|
|
282
|
-
lookup: {}
|
|
283
|
-
},
|
|
284
|
-
[BUILDER_CALLSITE]: callsite,
|
|
285
|
-
[BUILDER_SLOT_ID]: slotId
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function createScopeData(callsite) {
|
|
289
|
-
return {
|
|
290
|
-
[BUILDER_TYPE]: 4,
|
|
291
|
-
[BUILDER_STATE]: {
|
|
292
|
-
items: [],
|
|
293
|
-
lookup: {}
|
|
294
|
-
},
|
|
295
|
-
[BUILDER_CALLSITE]: callsite
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
function createScopeTargetData(scope, slot) {
|
|
299
|
-
return {
|
|
300
|
-
[BUILDER_TYPE]: 5,
|
|
301
|
-
[BUILDER_SCOPE]: scope,
|
|
302
|
-
[BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
function createThemeData(callsite, id, className, tokens) {
|
|
306
|
-
return {
|
|
307
|
-
[BUILDER_TYPE]: 6,
|
|
308
|
-
[BUILDER_STATE]: {
|
|
309
|
-
items: [],
|
|
310
|
-
lookup: {}
|
|
311
|
-
},
|
|
312
|
-
[BUILDER_CALLSITE]: callsite,
|
|
313
|
-
id,
|
|
314
|
-
className,
|
|
315
|
-
tokens
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
function isDebugData(value) {
|
|
319
|
-
if (!value || typeof value !== "object") return false;
|
|
320
|
-
const data = value;
|
|
321
|
-
return data.$$debug === true && Array.isArray(data.loc) && Array.isArray(data.label);
|
|
322
|
-
}
|
|
323
|
-
function getDebugCallsiteId(debug) {
|
|
324
|
-
const label = debug.label[0] || debug.label[1];
|
|
325
|
-
if (!label) return null;
|
|
326
|
-
const hash = debug.sourceUrl + "\n" + debug.loc[0] + ":" + debug.loc[1] + "\n" + (debug.label[1] || label);
|
|
327
|
-
return label + "_" + hashString(hash);
|
|
328
|
-
}
|
|
329
|
-
function getTraceCallsiteId(callsite) {
|
|
330
|
-
return hashString(callsite.filePath + "\n" + callsite.line + ":" + callsite.column);
|
|
331
|
-
}
|
|
332
|
-
function getDebugCallsite(debug) {
|
|
333
|
-
return createDebugCallsite(debug.loc, debug);
|
|
334
|
-
}
|
|
335
|
-
function getDebugFieldCallsite(debug, field) {
|
|
336
|
-
if (!debug) return null;
|
|
337
|
-
const loc = getDebugFieldLoc(debug, field);
|
|
338
|
-
return loc ? createDebugCallsite(loc, debug) : null;
|
|
339
|
-
}
|
|
340
|
-
function getDebugFieldVarName(debug, field) {
|
|
341
|
-
return debug?.vars?.[field] ?? null;
|
|
342
|
-
}
|
|
343
|
-
function getDebugFieldLoc(debug, field) {
|
|
344
|
-
const loc = debug?.fields?.[field];
|
|
345
|
-
if (!loc) return null;
|
|
346
|
-
if (Array.isArray(loc)) return loc;
|
|
347
|
-
return loc[DEV_CONFIG.sourcemapLocationMode === "value" ? 1 : 0] ?? loc[0] ?? loc[1] ?? null;
|
|
348
|
-
}
|
|
349
|
-
function createDebugCallsite(loc, debug) {
|
|
350
|
-
const [line, column] = loc;
|
|
351
|
-
const sourceUrl = loc[3] ?? debug.sourceUrl;
|
|
352
|
-
const sourceContent = loc[4] ?? debug.code;
|
|
353
|
-
return {
|
|
354
|
-
stack: `Error\n at ${sourceUrl}:${line}:${column}`,
|
|
355
|
-
filePath: sourceUrl,
|
|
356
|
-
sourceUrl,
|
|
357
|
-
sourceContent,
|
|
358
|
-
line,
|
|
359
|
-
column
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region config/config/debug.ts
|
|
364
|
-
const DEFAULT_DEBUG_CONFIG = {
|
|
365
|
-
isDebugClassNameEnabled: true,
|
|
366
|
-
maxPropertyLength: 24,
|
|
367
|
-
maxValueLength: 8,
|
|
368
|
-
maxSelectorLength: 8,
|
|
369
|
-
maxParentSelectorLength: 8,
|
|
370
|
-
maxAtRuleLength: 10
|
|
371
|
-
};
|
|
372
|
-
const DEBUG_CONFIG = globalData("config.debug", () => ({ ...DEFAULT_DEBUG_CONFIG }));
|
|
373
|
-
//#endregion
|
|
374
|
-
//#region builder/data/merge/utils.ts
|
|
375
|
-
function cloneData(data, source, debug, merge = true) {
|
|
376
|
-
const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
|
|
377
|
-
const state = data[BUILDER_STATE];
|
|
378
|
-
state.items = merge ? source[BUILDER_STATE].items.slice() : [];
|
|
379
|
-
state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
|
|
380
|
-
const lookup = state.lookup;
|
|
381
|
-
return [
|
|
382
|
-
runtimeType,
|
|
383
|
-
data,
|
|
384
|
-
state.items,
|
|
385
|
-
lookup
|
|
386
|
-
];
|
|
387
|
-
}
|
|
388
|
-
function logInvalidData(message, data) {
|
|
389
|
-
console.log(traceError(message), "data:", data);
|
|
390
|
-
}
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region builder/data/merge/scope.ts
|
|
393
|
-
function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
|
|
394
|
-
if (!items) return scope;
|
|
395
|
-
const sourceItems = Array.isArray(items) ? items : [items];
|
|
396
|
-
const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
|
|
397
|
-
let source;
|
|
398
|
-
let item;
|
|
399
|
-
let lookupIndex;
|
|
400
|
-
let priority;
|
|
401
|
-
let value;
|
|
402
|
-
let atRule;
|
|
403
|
-
let dedupe;
|
|
404
|
-
let className;
|
|
405
|
-
let itemDebug;
|
|
406
|
-
let itemCallsite;
|
|
407
|
-
for (let i = 0, len = sourceItems.length; i < len; i++) {
|
|
408
|
-
source = sourceItems[i];
|
|
409
|
-
if (!source) continue;
|
|
410
|
-
if (isStyleTokenOverrideData(source)) {
|
|
411
|
-
addTokenOverride(source, styles, lookup);
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
if (isScopeData(source)) {
|
|
415
|
-
const scopeItems = source[BUILDER_STATE].items;
|
|
416
|
-
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
417
|
-
item = scopeItems[j];
|
|
418
|
-
if (isStyleTokenOverrideData(item)) {
|
|
419
|
-
addTokenOverride(item, styles, lookup);
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
if (Array.isArray(item) || item.type !== 4) {
|
|
423
|
-
logInvalidData("invalid scope data", {
|
|
424
|
-
source,
|
|
425
|
-
item
|
|
426
|
-
});
|
|
427
|
-
continue;
|
|
428
|
-
}
|
|
429
|
-
const sourceScopeItem = item;
|
|
430
|
-
atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
|
|
431
|
-
const scopeItem = {
|
|
432
|
-
...sourceScopeItem,
|
|
433
|
-
runtime: runtimeType,
|
|
434
|
-
atRule,
|
|
435
|
-
parentSelector: parentSelector ?? sourceScopeItem.parentSelector
|
|
436
|
-
};
|
|
437
|
-
itemDebug = getMergedScopeDebug(debug, scopeItem);
|
|
438
|
-
itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
|
|
439
|
-
value = scopeItem.value;
|
|
440
|
-
priority = null;
|
|
441
|
-
if (Array.isArray(value)) {
|
|
442
|
-
priority = value[1];
|
|
443
|
-
value = value[0];
|
|
444
|
-
}
|
|
445
|
-
dedupe = getClassNameDedupe(scopeItem.property, priority, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
|
|
446
|
-
className = getAtomicClassName(scopeItem.property, priority, 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);
|
|
447
|
-
scopeItem.dedupe = dedupe;
|
|
448
|
-
scopeItem.className = className;
|
|
449
|
-
scopeItem.callsite = itemCallsite;
|
|
450
|
-
scopeItem.debug = itemDebug ?? null;
|
|
451
|
-
scopeItem.debugField = itemDebug ? scopeItem.property : null;
|
|
452
|
-
const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
|
|
453
|
-
lookupIndex = lookup[lookupKey];
|
|
454
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
455
|
-
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
456
|
-
}
|
|
457
|
-
continue;
|
|
458
|
-
}
|
|
459
|
-
if (!isSlotOverrideData(source)) {
|
|
460
|
-
logInvalidData("invalid scope data", { source });
|
|
461
|
-
continue;
|
|
462
|
-
}
|
|
463
|
-
const slotId = source[BUILDER_SLOT_ID];
|
|
464
|
-
const overrideItems = source[BUILDER_STATE].items;
|
|
465
|
-
for (let j = 0, len = overrideItems.length; j < len; j++) {
|
|
466
|
-
item = overrideItems[j];
|
|
467
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
|
|
468
|
-
logInvalidData("invalid scope data", {
|
|
469
|
-
source,
|
|
470
|
-
item
|
|
471
|
-
});
|
|
472
|
-
continue;
|
|
473
|
-
}
|
|
474
|
-
const overrideItem = item;
|
|
475
|
-
atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
|
|
476
|
-
const scopeItem = {
|
|
477
|
-
type: 4,
|
|
478
|
-
slotId,
|
|
479
|
-
runtime: runtimeType,
|
|
480
|
-
dedupe: "",
|
|
481
|
-
className: "",
|
|
482
|
-
property: overrideItem.property,
|
|
483
|
-
value: overrideItem.value,
|
|
484
|
-
transformClassName: overrideItem.transformClassName,
|
|
485
|
-
token: overrideItem.token,
|
|
486
|
-
selector: overrideItem.selector,
|
|
487
|
-
atRule,
|
|
488
|
-
callsite: overrideItem.callsite ?? callsite,
|
|
489
|
-
debug: overrideItem.debug,
|
|
490
|
-
debugField: overrideItem.debugField,
|
|
491
|
-
parentSelector
|
|
492
|
-
};
|
|
493
|
-
value = scopeItem.value;
|
|
494
|
-
priority = null;
|
|
495
|
-
if (Array.isArray(value)) {
|
|
496
|
-
priority = value[1];
|
|
497
|
-
value = value[0];
|
|
498
|
-
}
|
|
499
|
-
dedupe = getClassNameDedupe(scopeItem.property, priority, scopeItem.selector, parentSelector, scopeItem.atRule);
|
|
500
|
-
className = getAtomicClassName(scopeItem.property, priority, 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);
|
|
501
|
-
scopeItem.dedupe = dedupe;
|
|
502
|
-
scopeItem.className = className;
|
|
503
|
-
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
504
|
-
lookupIndex = lookup[lookupKey];
|
|
505
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
506
|
-
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return data;
|
|
510
|
-
}
|
|
511
|
-
function addTokenOverride(item, styles, lookup) {
|
|
512
|
-
const lookupKey = getTokenLookupKey(getStyleTokenId(item));
|
|
513
|
-
const lookupIndex = lookup[lookupKey];
|
|
514
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = item;
|
|
515
|
-
else lookup[lookupKey] = styles.push(item) - 1;
|
|
516
|
-
}
|
|
517
|
-
function getMergedScopeDebug(debug, item) {
|
|
518
|
-
if (!debug) return item.debug;
|
|
519
|
-
if (debug.fields?.[item.property]) return debug;
|
|
520
|
-
const valueLoc = getRuntimeScopeItemValueLoc(item);
|
|
521
|
-
if (!valueLoc) return debug;
|
|
522
|
-
return {
|
|
523
|
-
...debug,
|
|
524
|
-
fields: {
|
|
525
|
-
...debug.fields,
|
|
526
|
-
[item.property]: {
|
|
527
|
-
[0]: debug.loc,
|
|
528
|
-
[1]: valueLoc
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
function getRuntimeScopeItemValueLoc(item) {
|
|
534
|
-
if (item.debug && item.debugField) {
|
|
535
|
-
const loc = item.debug.fields?.[item.debugField];
|
|
536
|
-
if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
|
|
537
|
-
if (loc) {
|
|
538
|
-
const valueLoc = loc[1] ?? loc[0] ?? null;
|
|
539
|
-
return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
return item.callsite ? [
|
|
543
|
-
item.callsite.line,
|
|
544
|
-
item.callsite.column,
|
|
545
|
-
void 0,
|
|
546
|
-
item.callsite.sourceUrl,
|
|
547
|
-
item.callsite.sourceContent
|
|
548
|
-
] : null;
|
|
549
|
-
}
|
|
550
|
-
function withDebugSource$1(loc, sourceUrl, sourceContent) {
|
|
551
|
-
return loc[3] ? loc : [
|
|
552
|
-
loc[0],
|
|
553
|
-
loc[1],
|
|
554
|
-
loc[2],
|
|
555
|
-
sourceUrl,
|
|
556
|
-
sourceContent
|
|
557
|
-
];
|
|
558
|
-
}
|
|
559
|
-
function getScopeLookupKey(slotId, dedupe) {
|
|
560
|
-
return slotId + "\0" + dedupe;
|
|
561
|
-
}
|
|
562
|
-
function getTokenLookupKey(tokenId) {
|
|
563
|
-
return "token\0" + tokenId;
|
|
564
|
-
}
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region style/transform.ts
|
|
567
|
-
const CLASS_NAME_VALUE = symbol("transform.classNameValue");
|
|
568
|
-
function classNameValue(value, className) {
|
|
569
|
-
return {
|
|
570
|
-
[CLASS_NAME_VALUE]: true,
|
|
571
|
-
value,
|
|
572
|
-
className
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
function isClassNameValue(value) {
|
|
576
|
-
return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
|
|
577
|
-
}
|
|
578
|
-
function styleTransform(options) {
|
|
579
|
-
return options;
|
|
580
|
-
}
|
|
581
|
-
function classNameTransform(options) {
|
|
582
|
-
return options;
|
|
583
|
-
}
|
|
584
|
-
//#endregion
|
|
585
|
-
//#region builder/data/merge/style.ts
|
|
586
|
-
function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
|
|
587
|
-
if (!style) return source;
|
|
588
|
-
const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
|
|
589
|
-
const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
|
|
590
|
-
const items = [];
|
|
591
|
-
let item;
|
|
592
|
-
let itemData;
|
|
593
|
-
let valueRaw;
|
|
594
|
-
let value;
|
|
595
|
-
let priority;
|
|
596
|
-
let itemCallsite;
|
|
597
|
-
let className;
|
|
598
|
-
let dedupe;
|
|
599
|
-
let token;
|
|
600
|
-
let ref;
|
|
601
|
-
let variableName;
|
|
602
|
-
let transformClassName;
|
|
603
|
-
let lookupIndex;
|
|
604
|
-
if (isStyleData(style)) {
|
|
605
|
-
const stylesItems = style[BUILDER_STATE].items;
|
|
606
|
-
for (let i = 0, len = stylesItems.length; i < len; i++) {
|
|
607
|
-
item = stylesItems[i];
|
|
608
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
|
|
609
|
-
logInvalidData("invalid style data", {
|
|
610
|
-
item,
|
|
611
|
-
style
|
|
612
|
-
});
|
|
613
|
-
continue;
|
|
614
|
-
}
|
|
615
|
-
if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
|
|
616
|
-
if (type === 2 && slotId !== null) item = Object.assign({}, item, {
|
|
617
|
-
type: 2,
|
|
618
|
-
slotId
|
|
619
|
-
});
|
|
620
|
-
else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
|
|
621
|
-
type: 3,
|
|
622
|
-
slotId
|
|
623
|
-
});
|
|
624
|
-
const itemDebug = getMergedStyleDebug(debug, item);
|
|
625
|
-
const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
|
|
626
|
-
if (debugCallsite) item = Object.assign({}, item, {
|
|
627
|
-
callsite: debugCallsite,
|
|
628
|
-
debug: itemDebug,
|
|
629
|
-
debugField: item.property
|
|
630
|
-
});
|
|
631
|
-
items.push(item);
|
|
632
|
-
}
|
|
633
|
-
} else for (const property in style) {
|
|
634
|
-
valueRaw = style[property];
|
|
635
|
-
priority = null;
|
|
636
|
-
if (Array.isArray(valueRaw) && valueRaw.length === 2 && typeof valueRaw[0] === "number") {
|
|
637
|
-
priority = valueRaw[0];
|
|
638
|
-
valueRaw = valueRaw[1];
|
|
639
|
-
}
|
|
640
|
-
transformClassName = null;
|
|
641
|
-
if (isClassNameValue(valueRaw)) {
|
|
642
|
-
transformClassName = valueRaw.className;
|
|
643
|
-
valueRaw = valueRaw.value;
|
|
644
|
-
}
|
|
645
|
-
ref = isAtRuleRef(valueRaw) ? valueRaw : null;
|
|
646
|
-
if (ref) valueRaw = ref.value;
|
|
647
|
-
token = isStyleTokenData(valueRaw) ? valueRaw : null;
|
|
648
|
-
variableName = getDebugFieldVarName(debug, property);
|
|
649
|
-
value = variableName && token ? getCssVarRawFallback(variableName, getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null)) : token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
|
|
650
|
-
value = priority !== null ? [value, priority] : value;
|
|
651
|
-
itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
|
|
652
|
-
itemData = {
|
|
653
|
-
runtime: runtimeType,
|
|
654
|
-
debug,
|
|
655
|
-
debugField: property,
|
|
656
|
-
dedupe: "",
|
|
657
|
-
className: "",
|
|
658
|
-
property,
|
|
659
|
-
value,
|
|
660
|
-
transformClassName,
|
|
661
|
-
variable: ref ? [3, ref] : variableName && token ? [
|
|
662
|
-
1,
|
|
663
|
-
variableName,
|
|
664
|
-
valueRaw,
|
|
665
|
-
shouldAppendCssPx(property) ? 1 : void 0
|
|
666
|
-
] : ref ? [3, ref] : void 0,
|
|
667
|
-
token,
|
|
668
|
-
selector,
|
|
669
|
-
atRule,
|
|
670
|
-
callsite: itemCallsite
|
|
671
|
-
};
|
|
672
|
-
if (type === 1) {
|
|
673
|
-
items.push({
|
|
674
|
-
...itemData,
|
|
675
|
-
type: 1
|
|
676
|
-
});
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
if (slotId === null) {
|
|
680
|
-
logInvalidData("invalid style data", {
|
|
681
|
-
property,
|
|
682
|
-
style
|
|
683
|
-
});
|
|
684
|
-
continue;
|
|
685
|
-
}
|
|
686
|
-
if (type === 2) {
|
|
687
|
-
items.push({
|
|
688
|
-
...itemData,
|
|
689
|
-
type: 2,
|
|
690
|
-
slotId
|
|
691
|
-
});
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
|
-
if (type === 3) {
|
|
695
|
-
items.push({
|
|
696
|
-
...itemData,
|
|
697
|
-
type: 3,
|
|
698
|
-
slotId
|
|
699
|
-
});
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
logInvalidData("invalid style data", {
|
|
703
|
-
property,
|
|
704
|
-
style
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
if (!items.length) return data;
|
|
708
|
-
for (let i = 0, len = items.length; i < len; i++) {
|
|
709
|
-
item = items[i];
|
|
710
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
|
|
711
|
-
logInvalidData("invalid style data", {
|
|
712
|
-
item,
|
|
713
|
-
style
|
|
714
|
-
});
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
const runtimeItem = item;
|
|
718
|
-
value = runtimeItem.value;
|
|
719
|
-
priority = null;
|
|
720
|
-
if (Array.isArray(value)) {
|
|
721
|
-
priority = value[1];
|
|
722
|
-
value = value[0];
|
|
723
|
-
}
|
|
724
|
-
dedupe = getClassNameDedupe(runtimeItem.property, priority, runtimeItem.selector, null, runtimeItem.atRule);
|
|
725
|
-
className = getAtomicClassName(runtimeItem.property, priority, 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);
|
|
726
|
-
runtimeItem.dedupe = dedupe;
|
|
727
|
-
runtimeItem.className = className;
|
|
728
|
-
lookupIndex = lookup[dedupe];
|
|
729
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
|
|
730
|
-
else lookup[dedupe] = styles.push(runtimeItem) - 1;
|
|
731
|
-
}
|
|
732
|
-
return data;
|
|
733
|
-
}
|
|
734
|
-
function getMergedStyleDebug(debug, item) {
|
|
735
|
-
if (!debug) return null;
|
|
736
|
-
if (debug.fields?.[item.property]) return debug;
|
|
737
|
-
const valueLoc = getMergedItemValueLoc(item);
|
|
738
|
-
if (!valueLoc) return debug;
|
|
739
|
-
return {
|
|
740
|
-
...debug,
|
|
741
|
-
fields: {
|
|
742
|
-
...debug.fields,
|
|
743
|
-
[item.property]: {
|
|
744
|
-
[0]: withDebugSource(debug.loc, debug),
|
|
745
|
-
[1]: valueLoc
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
function getMergedItemValueLoc(item) {
|
|
751
|
-
if (item.debug && item.debugField) {
|
|
752
|
-
const loc = item.debug.fields?.[item.debugField];
|
|
753
|
-
if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
|
|
754
|
-
if (loc) {
|
|
755
|
-
const traceLoc = loc[1] ?? loc[0] ?? null;
|
|
756
|
-
return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
return item.callsite ? [
|
|
760
|
-
item.callsite.line,
|
|
761
|
-
item.callsite.column,
|
|
762
|
-
void 0,
|
|
763
|
-
item.callsite.sourceUrl,
|
|
764
|
-
item.callsite.sourceContent
|
|
765
|
-
] : null;
|
|
766
|
-
}
|
|
767
|
-
function withDebugSource(loc, debug) {
|
|
768
|
-
return loc[3] ? loc : [
|
|
769
|
-
loc[0],
|
|
770
|
-
loc[1],
|
|
771
|
-
loc[2],
|
|
772
|
-
debug.sourceUrl,
|
|
773
|
-
debug.code
|
|
774
|
-
];
|
|
775
|
-
}
|
|
776
|
-
function normalizeSelectorArg(arg) {
|
|
777
|
-
return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
|
|
778
|
-
}
|
|
779
|
-
//#endregion
|
|
780
|
-
//#region builder/style_data.ts
|
|
781
|
-
const mergeStyleCreate = (callsite) => {
|
|
782
|
-
return createStyleData(callsite);
|
|
783
|
-
};
|
|
784
|
-
const mergeStyleData = createMerge(mergeStyleCreate, 1);
|
|
785
|
-
const mergeSlotCreate = (callsite, data) => {
|
|
786
|
-
return createSlotData(callsite, data[BUILDER_SLOT_ID]);
|
|
787
|
-
};
|
|
788
|
-
const mergeSlotData = createMerge(mergeSlotCreate, 2);
|
|
789
|
-
const mergeSlotOverrideCreate = (callsite, data) => {
|
|
790
|
-
return createSlotOverrideData(callsite, data[BUILDER_SLOT_ID]);
|
|
791
|
-
};
|
|
792
|
-
const mergeSlotOverrideData = createMerge(mergeSlotOverrideCreate, 3);
|
|
793
|
-
function createMerge(create, type) {
|
|
794
|
-
return (data, callsite, style, debug, selector, atRule) => {
|
|
795
|
-
return mergeBuilderData(create, callsite, data, style, debug, selector, atRule, type);
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
//#endregion
|
|
799
|
-
//#region builder/utils.ts
|
|
800
|
-
const FnPrefixStyle = "style.";
|
|
801
|
-
const FnPrefixSlot = "slot.";
|
|
802
|
-
const FnPrefixScope = "scope.";
|
|
803
|
-
function runtimeCallsite() {
|
|
804
|
-
return traceCallsite();
|
|
805
|
-
}
|
|
806
|
-
function resolveCallsite(debug) {
|
|
807
|
-
return debug ? getDebugCallsite(debug) : runtimeCallsite();
|
|
808
|
-
}
|
|
809
|
-
function transformStyle(style, transform) {
|
|
810
|
-
return transform ? transform.transform(style) : style;
|
|
811
|
-
}
|
|
812
|
-
//#endregion
|
|
813
152
|
//#region builder/style_fns.ts
|
|
814
153
|
const createDefaultFnResult = (data, fns) => {
|
|
815
154
|
return Object.assign(Object.create(fns), data);
|
|
@@ -860,9 +199,9 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
860
199
|
let arg;
|
|
861
200
|
let style;
|
|
862
201
|
let debug;
|
|
863
|
-
let
|
|
202
|
+
let weight = null;
|
|
864
203
|
if (hasArg) if (isMedia && typeof params[0] === "number") {
|
|
865
|
-
|
|
204
|
+
weight = params[0];
|
|
866
205
|
arg = params[1];
|
|
867
206
|
style = params[2];
|
|
868
207
|
debug = params[3];
|
|
@@ -872,7 +211,7 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
872
211
|
debug = params[2];
|
|
873
212
|
}
|
|
874
213
|
else if (isMedia && typeof params[0] === "number") {
|
|
875
|
-
|
|
214
|
+
weight = params[0];
|
|
876
215
|
arg = fnSelector.selector;
|
|
877
216
|
style = params[1];
|
|
878
217
|
debug = params[2];
|
|
@@ -892,7 +231,7 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
892
231
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
893
232
|
for (let j = 0, len = items.length; j < len; j++) {
|
|
894
233
|
const item = items[j];
|
|
895
|
-
data = mergeData(data, callsite, isStyleData(item) ? item : transformStyle(item, transform), debug ?? null, null, [
|
|
234
|
+
data = mergeData(data, callsite, isStyleData(item) ? item : transformStyle(item, transform), debug ?? null, null, [weight !== null ? [selector, weight] : selector]);
|
|
896
235
|
}
|
|
897
236
|
}
|
|
898
237
|
return createFnResult(data, fns);
|
|
@@ -959,9 +298,9 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
959
298
|
let arg;
|
|
960
299
|
let data;
|
|
961
300
|
let debug;
|
|
962
|
-
let
|
|
301
|
+
let weight = null;
|
|
963
302
|
if (hasArg) if (isMedia && typeof params[0] === "number") {
|
|
964
|
-
|
|
303
|
+
weight = params[0];
|
|
965
304
|
arg = params[1];
|
|
966
305
|
data = params[2];
|
|
967
306
|
debug = params[3];
|
|
@@ -971,7 +310,7 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
971
310
|
debug = params[2];
|
|
972
311
|
}
|
|
973
312
|
else if (isMedia && typeof params[0] === "number") {
|
|
974
|
-
|
|
313
|
+
weight = params[0];
|
|
975
314
|
arg = fnSelector.selector;
|
|
976
315
|
data = params[1];
|
|
977
316
|
debug = params[2];
|
|
@@ -988,7 +327,7 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
988
327
|
selector = args[i];
|
|
989
328
|
if (hasArg && DEV_CONFIG.isCheckSelectorEnabled);
|
|
990
329
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
991
|
-
result = mergeScopeItems(result, callsite, data, debug ?? null, null,
|
|
330
|
+
result = mergeScopeItems(result, callsite, data, debug ?? null, null, weight !== null ? [selector, weight] : selector, cloneScope);
|
|
992
331
|
}
|
|
993
332
|
return result;
|
|
994
333
|
};
|
|
@@ -1076,9 +415,9 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1076
415
|
const [withoutDebug, debug] = splitDebug(params);
|
|
1077
416
|
let arg;
|
|
1078
417
|
let items;
|
|
1079
|
-
let
|
|
418
|
+
let weight = null;
|
|
1080
419
|
if (hasArg) if (isMedia && typeof withoutDebug[0] === "number") {
|
|
1081
|
-
|
|
420
|
+
weight = withoutDebug[0];
|
|
1082
421
|
arg = withoutDebug[1];
|
|
1083
422
|
items = withoutDebug.slice(2);
|
|
1084
423
|
} else {
|
|
@@ -1086,7 +425,7 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1086
425
|
items = withoutDebug.slice(1);
|
|
1087
426
|
}
|
|
1088
427
|
else if (isMedia && typeof withoutDebug[0] === "number") {
|
|
1089
|
-
|
|
428
|
+
weight = withoutDebug[0];
|
|
1090
429
|
arg = fnSelector.selector;
|
|
1091
430
|
items = withoutDebug.slice(1);
|
|
1092
431
|
} else {
|
|
@@ -1101,7 +440,7 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1101
440
|
let selector = argItem;
|
|
1102
441
|
if (hasArg && DEV_CONFIG.isCheckSelectorEnabled) checkSelector$1(fnPrefix, fnName, fnSelector, selector);
|
|
1103
442
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
1104
|
-
data = mergeStyleData(data, callsite, classNameStyle.style, classNameStyle.debug, null, [
|
|
443
|
+
data = mergeStyleData(data, callsite, classNameStyle.style, classNameStyle.debug, null, [weight !== null ? [selector, weight] : selector]);
|
|
1105
444
|
}
|
|
1106
445
|
return createDefaultFnResult(data, fns);
|
|
1107
446
|
};
|
|
@@ -1151,7 +490,8 @@ function classNameItemsToStyle(items, transform, debug) {
|
|
|
1151
490
|
for (const item of flattenClassNameItems(items)) {
|
|
1152
491
|
const transformed = decorateClassNameStyle(transform.transform(item.className), item.className);
|
|
1153
492
|
const weighted = item.weight === null ? transformed : applyClassNameWeight(transformed, item.weight);
|
|
1154
|
-
|
|
493
|
+
const nextStyle = item.important ? applyClassNameImportant(weighted) : weighted;
|
|
494
|
+
style = style ? Object.assign({}, style, nextStyle) : nextStyle;
|
|
1155
495
|
const loc = debug?.classNames?.[item.className];
|
|
1156
496
|
if (loc) {
|
|
1157
497
|
const nextDebugFields = debugFields ? Object.assign({}, debugFields) : Object.assign({}, debug?.fields ?? {});
|
|
@@ -1174,15 +514,16 @@ function decorateClassNameStyle(style, className) {
|
|
|
1174
514
|
result[property] = value;
|
|
1175
515
|
continue;
|
|
1176
516
|
}
|
|
1177
|
-
|
|
1178
|
-
const rawValue = value[1];
|
|
1179
|
-
result[property] = isClassNameValue(rawValue) ? value : [value[0], classNameValue(rawValue, className)];
|
|
1180
|
-
continue;
|
|
1181
|
-
}
|
|
1182
|
-
result[property] = isClassNameValue(value) ? value : classNameValue(value, className);
|
|
517
|
+
result[property] = decorateClassNameValue(value, className);
|
|
1183
518
|
}
|
|
1184
519
|
return result;
|
|
1185
520
|
}
|
|
521
|
+
function decorateClassNameValue(value, className) {
|
|
522
|
+
if (isClassNameValue(value)) return value;
|
|
523
|
+
if (isStyleImportantValue(value)) return importantValue(decorateClassNameValue(value.value, className), value.native);
|
|
524
|
+
if (isStyleWeightValue(value)) return weightValue(decorateClassNameValue(value.value, className), value.weight);
|
|
525
|
+
return classNameValue(value, className);
|
|
526
|
+
}
|
|
1186
527
|
function flattenClassNameItems(items) {
|
|
1187
528
|
const result = [];
|
|
1188
529
|
for (const item of items) collectClassNameItem(item, result);
|
|
@@ -1193,6 +534,7 @@ function collectClassNameItem(item, result) {
|
|
|
1193
534
|
if (typeof item === "string") {
|
|
1194
535
|
result.push({
|
|
1195
536
|
className: item,
|
|
537
|
+
important: false,
|
|
1196
538
|
weight: null
|
|
1197
539
|
});
|
|
1198
540
|
return;
|
|
@@ -1201,13 +543,29 @@ function collectClassNameItem(item, result) {
|
|
|
1201
543
|
for (const child of item) collectClassNameItem(child, result);
|
|
1202
544
|
return;
|
|
1203
545
|
}
|
|
1204
|
-
if (isWeightedClassName(item))
|
|
546
|
+
if (isWeightedClassName(item)) {
|
|
547
|
+
result.push({
|
|
548
|
+
...item,
|
|
549
|
+
important: false
|
|
550
|
+
});
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (isImportantClassName(item)) result.push({
|
|
554
|
+
className: item.className,
|
|
555
|
+
important: true,
|
|
556
|
+
weight: null
|
|
557
|
+
});
|
|
1205
558
|
}
|
|
1206
559
|
function isWeightedClassName(item) {
|
|
1207
560
|
if (!item || typeof item !== "object") return false;
|
|
1208
561
|
const weighted = item;
|
|
1209
562
|
return typeof weighted.className === "string" && typeof weighted.weight === "number";
|
|
1210
563
|
}
|
|
564
|
+
function isImportantClassName(item) {
|
|
565
|
+
if (!item || typeof item !== "object") return false;
|
|
566
|
+
const important = item;
|
|
567
|
+
return typeof important.className === "string" && important.important === true;
|
|
568
|
+
}
|
|
1211
569
|
function applyClassNameWeight(style, weight) {
|
|
1212
570
|
const weighted = {};
|
|
1213
571
|
for (const [property, value] of Object.entries(style)) {
|
|
@@ -1215,10 +573,21 @@ function applyClassNameWeight(style, weight) {
|
|
|
1215
573
|
weighted[property] = value;
|
|
1216
574
|
continue;
|
|
1217
575
|
}
|
|
1218
|
-
weighted[property] =
|
|
576
|
+
weighted[property] = weightValue(value, weight);
|
|
1219
577
|
}
|
|
1220
578
|
return weighted;
|
|
1221
579
|
}
|
|
580
|
+
function applyClassNameImportant(style) {
|
|
581
|
+
const important = {};
|
|
582
|
+
for (const [property, value] of Object.entries(style)) {
|
|
583
|
+
if (value === null || value === void 0) {
|
|
584
|
+
important[property] = value;
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
important[property] = importantValue(value);
|
|
588
|
+
}
|
|
589
|
+
return important;
|
|
590
|
+
}
|
|
1222
591
|
function splitDebug(params) {
|
|
1223
592
|
const last = params[params.length - 1];
|
|
1224
593
|
if (!isDebugData(last)) return [params.slice(), void 0];
|
|
@@ -1323,6 +692,11 @@ selectorPriority({
|
|
|
1323
692
|
...AtRuleSelectors
|
|
1324
693
|
}, PrioritySelectors);
|
|
1325
694
|
//#endregion
|
|
695
|
+
//#region builder/selector_override.noop.ts
|
|
696
|
+
function normalizeManualSelectors(input) {
|
|
697
|
+
return normalizeManualSelectors$1(input, assertManualSelectorSyntax);
|
|
698
|
+
}
|
|
699
|
+
//#endregion
|
|
1326
700
|
//#region builder/style_builder.ts
|
|
1327
701
|
function createStyleBuilder(selectors, transform) {
|
|
1328
702
|
const fns = createStyleFns(mergeStyleData, selectors, FnPrefixStyle, transform, null);
|
|
@@ -1356,6 +730,20 @@ function createSlotBuilder(selectors, transform) {
|
|
|
1356
730
|
traceMarker(fn, "slot");
|
|
1357
731
|
return fn;
|
|
1358
732
|
}
|
|
733
|
+
function createSelectorBuilder(selectors, transform) {
|
|
734
|
+
const fns = createStyleFns(mergeSelectorOverrideData, selectors, FnPrefixSelector, transform, null);
|
|
735
|
+
const fn = (selector, style, debug) => {
|
|
736
|
+
if (isDebugData(style) && debug === void 0) {
|
|
737
|
+
debug = style;
|
|
738
|
+
style = void 0;
|
|
739
|
+
}
|
|
740
|
+
const target = createCallableSelector(createSelectorData(resolveCallsite(debug), normalizeManualSelectors(selector)), fns, transform);
|
|
741
|
+
if (style === void 0) return target;
|
|
742
|
+
return target(style, debug);
|
|
743
|
+
};
|
|
744
|
+
traceMarker(fn, "style.selector");
|
|
745
|
+
return fn;
|
|
746
|
+
}
|
|
1359
747
|
function createScopeBuilder(selectors) {
|
|
1360
748
|
const fns = createScopeFns(selectors, FnPrefixScope, cloneScope);
|
|
1361
749
|
const fn = (items, debug) => {
|
|
@@ -1371,6 +759,34 @@ function createScopeBuilder(selectors) {
|
|
|
1371
759
|
traceMarker(fn, "scope");
|
|
1372
760
|
return fn;
|
|
1373
761
|
}
|
|
762
|
+
function createCallableSelectorOverride(data, fns, transform) {
|
|
763
|
+
const callable = ((style, debug) => {
|
|
764
|
+
if (isDebugData(style) && debug === void 0) {
|
|
765
|
+
debug = style;
|
|
766
|
+
style = void 0;
|
|
767
|
+
}
|
|
768
|
+
const callsite = resolveCallsite(debug);
|
|
769
|
+
return createCallableSelectorOverride(mergeSelectorOverrideData(createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]), callsite, style ? isStyleData(style) ? style : transformStyle(style, transform) : null, debug ?? null, null, null), fns, transform);
|
|
770
|
+
});
|
|
771
|
+
traceMarker(callable, "selector.override");
|
|
772
|
+
Object.setPrototypeOf(callable, fns);
|
|
773
|
+
Object.assign(callable, data);
|
|
774
|
+
return callable;
|
|
775
|
+
}
|
|
776
|
+
function createCallableSelector(data, overrideFns, transform) {
|
|
777
|
+
const callable = ((style, debug) => {
|
|
778
|
+
if (isDebugData(style) && debug === void 0) {
|
|
779
|
+
debug = style;
|
|
780
|
+
style = void 0;
|
|
781
|
+
}
|
|
782
|
+
const callsite = resolveCallsite(debug);
|
|
783
|
+
return createCallableSelectorOverride(mergeSelectorOverrideData(createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]), callsite, style ? isStyleData(style) ? style : transformStyle(style, transform) : null, debug ?? null, null, null), overrideFns, transform);
|
|
784
|
+
});
|
|
785
|
+
traceMarker(callable, "selector");
|
|
786
|
+
Object.setPrototypeOf(callable, overrideFns);
|
|
787
|
+
Object.assign(callable, data);
|
|
788
|
+
return callable;
|
|
789
|
+
}
|
|
1374
790
|
function createCallableSlot(data, fns, overrideFns, transform) {
|
|
1375
791
|
const slotId = data[BUILDER_SLOT_ID];
|
|
1376
792
|
const callable = ((style, debug) => {
|
|
@@ -1433,9 +849,11 @@ function createStyleFn(args) {
|
|
|
1433
849
|
const fnStyle = createStyleBuilder(selectors, transform);
|
|
1434
850
|
const fnSlot = createSlotBuilder(selectors, transform);
|
|
1435
851
|
const fnScope = createScopeBuilder(selectors);
|
|
1436
|
-
const
|
|
1437
|
-
|
|
852
|
+
const fnSelector = createSelectorBuilder(selectors, transform);
|
|
853
|
+
const fnWeight = (value, weight) => {
|
|
854
|
+
return weightValue(value, weight);
|
|
1438
855
|
};
|
|
856
|
+
const fnImportant = (value, native) => importantValue(value, native);
|
|
1439
857
|
const fnRaw = (style) => style;
|
|
1440
858
|
const fnPlain = (style) => style;
|
|
1441
859
|
const fnKeyframes = ((frames, stableId) => createStyleKeyframes(frames, transform ?? null, stableId));
|
|
@@ -1447,11 +865,13 @@ function createStyleFn(args) {
|
|
|
1447
865
|
const style = fnStyle;
|
|
1448
866
|
style.slot = fnSlot;
|
|
1449
867
|
style.scope = fnScope;
|
|
1450
|
-
style.
|
|
868
|
+
style.weight = fnWeight;
|
|
869
|
+
style.important = fnImportant;
|
|
1451
870
|
style.raw = fnRaw;
|
|
1452
871
|
style.plain = fnPlain;
|
|
1453
872
|
style.keyframes = fnKeyframes;
|
|
1454
873
|
style.merge = fnMerge;
|
|
874
|
+
style.selector = fnSelector;
|
|
1455
875
|
assignStyleFnMeta(style, {
|
|
1456
876
|
mode: "StyleObject",
|
|
1457
877
|
selectors,
|
|
@@ -1477,12 +897,18 @@ function getStyleFnMeta(styleFn) {
|
|
|
1477
897
|
function createClassNameFn(args) {
|
|
1478
898
|
const { selectors, transform } = args;
|
|
1479
899
|
const className = createClassNameBuilder(selectors, transform);
|
|
1480
|
-
className.weight = (
|
|
900
|
+
className.weight = (className, weight) => {
|
|
1481
901
|
return {
|
|
1482
|
-
className
|
|
902
|
+
className,
|
|
1483
903
|
weight
|
|
1484
904
|
};
|
|
1485
905
|
};
|
|
906
|
+
className.important = (className) => {
|
|
907
|
+
return {
|
|
908
|
+
className,
|
|
909
|
+
important: true
|
|
910
|
+
};
|
|
911
|
+
};
|
|
1486
912
|
assignStyleFnMeta(className, {
|
|
1487
913
|
mode: "ClassName",
|
|
1488
914
|
selectors,
|
|
@@ -1490,20 +916,6 @@ function createClassNameFn(args) {
|
|
|
1490
916
|
});
|
|
1491
917
|
return { className };
|
|
1492
918
|
}
|
|
1493
|
-
const formatThemeName = createNameFormatter(["name"]);
|
|
1494
|
-
function createThemeClassName(name, id, themeNameFormat) {
|
|
1495
|
-
return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name });
|
|
1496
|
-
}
|
|
1497
|
-
function getThemeRuleCss(className, tokens, tokenNameFormat) {
|
|
1498
|
-
const declarations = [];
|
|
1499
|
-
for (let i = 0, len = tokens.length; i < len; i++) declarations.push(getThemeDeclaration(tokens[i], tokenNameFormat));
|
|
1500
|
-
return "." + escapeCssIdent(className) + "{" + declarations.join(";") + "}";
|
|
1501
|
-
}
|
|
1502
|
-
function getThemeDeclaration(token, tokenNameFormat) {
|
|
1503
|
-
const name = getTokenVarName(token, tokenNameFormat);
|
|
1504
|
-
const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
|
|
1505
|
-
return name + ":" + value;
|
|
1506
|
-
}
|
|
1507
919
|
//#endregion
|
|
1508
920
|
//#region style/theme.ts
|
|
1509
921
|
const idCounter = createIdCounter("theme");
|
|
@@ -1519,22 +931,47 @@ function createTheme(tokens, stableId, callsite) {
|
|
|
1519
931
|
return createThemeData(callsite ?? null, id, className, tokens);
|
|
1520
932
|
}
|
|
1521
933
|
//#endregion
|
|
934
|
+
//#region style/tokens.ts
|
|
935
|
+
function createTokens(values, stableId) {
|
|
936
|
+
const tokens = {};
|
|
937
|
+
if (Array.isArray(values)) for (let i = 0, len = values.length; i < len; i++) {
|
|
938
|
+
const value = values[i];
|
|
939
|
+
tokens[value] = createStyleToken(value, getChildStableId$1(stableId, String(i)), getChildStyleTokenName(stableId, String(i)));
|
|
940
|
+
}
|
|
941
|
+
else assignTokenRecord(tokens, values, stableId, stableId ?? null);
|
|
942
|
+
return tokens;
|
|
943
|
+
}
|
|
944
|
+
function assignTokenRecord(target, values, stableId, debugName) {
|
|
945
|
+
for (let key in values) {
|
|
946
|
+
const value = values[key];
|
|
947
|
+
const childName = getChildStyleTokenName(debugName, key);
|
|
948
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
949
|
+
const child = {};
|
|
950
|
+
target[key] = child;
|
|
951
|
+
assignTokenRecord(child, value, getChildStableId$1(stableId, key), childName);
|
|
952
|
+
} else target[key] = createStyleToken(value, getChildStableId$1(stableId, key), childName);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
function getChildStableId$1(stableId, child) {
|
|
956
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
957
|
+
}
|
|
958
|
+
//#endregion
|
|
1522
959
|
//#region style/value.ts
|
|
1523
|
-
function createToken(value,
|
|
1524
|
-
return createStyleToken(value,
|
|
960
|
+
function createToken(value, stableId) {
|
|
961
|
+
return createStyleToken(value, stableId);
|
|
1525
962
|
}
|
|
1526
963
|
function createValues(...args) {
|
|
1527
964
|
let values = args[0];
|
|
1528
965
|
let isNumber = false;
|
|
1529
|
-
let
|
|
966
|
+
let stableId = args[1];
|
|
1530
967
|
if (args[0] === Number) {
|
|
1531
968
|
values = args[1];
|
|
1532
|
-
|
|
969
|
+
stableId = args[2];
|
|
1533
970
|
isNumber = true;
|
|
1534
971
|
}
|
|
1535
972
|
if (!values.length) throw new Error("[Style.values] NO_VALUES");
|
|
1536
973
|
const tokens = /* @__PURE__ */ new Map();
|
|
1537
|
-
for (let value of values) tokens.set(value,
|
|
974
|
+
for (let value of values) tokens.set(value, createStyleToken(parseValue(value, isNumber), getChildStableId(stableId, hashString(String(value))), getChildStyleTokenName(stableId ?? null, getValueDebugName(value))));
|
|
1538
975
|
return function ValueFn(...args) {
|
|
1539
976
|
const [value, provide, debug] = args;
|
|
1540
977
|
const token = tokens.get(value);
|
|
@@ -1544,8 +981,18 @@ function createValues(...args) {
|
|
|
1544
981
|
return token;
|
|
1545
982
|
};
|
|
1546
983
|
}
|
|
1547
|
-
function
|
|
1548
|
-
return
|
|
984
|
+
function getChildStableId(stableId, child) {
|
|
985
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
986
|
+
}
|
|
987
|
+
function getValueDebugName(value) {
|
|
988
|
+
if (typeof value === "number") return String(value);
|
|
989
|
+
const parts = String(value).split(/[;|]/);
|
|
990
|
+
const label = parts[1]?.trim();
|
|
991
|
+
if (label) return sanitizeDebugName(label);
|
|
992
|
+
return sanitizeDebugName(parts[0]?.trim() ?? "");
|
|
993
|
+
}
|
|
994
|
+
function sanitizeDebugName(value) {
|
|
995
|
+
return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || null;
|
|
1549
996
|
}
|
|
1550
997
|
function parseValue(value, isNumber) {
|
|
1551
998
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -1556,30 +1003,252 @@ function parseValue(value, isNumber) {
|
|
|
1556
1003
|
return number;
|
|
1557
1004
|
}
|
|
1558
1005
|
//#endregion
|
|
1559
|
-
//#region style/
|
|
1560
|
-
function
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1006
|
+
//#region runtime/style/scope.ts
|
|
1007
|
+
function combineScope(...scopes) {
|
|
1008
|
+
return (target) => resolveScopeTargets(target, scopes);
|
|
1009
|
+
}
|
|
1010
|
+
function bindScope(target, ...scopes) {
|
|
1011
|
+
return resolveScopeTargets(target, scopes);
|
|
1012
|
+
}
|
|
1013
|
+
function resolveScopeTargets(target, scopes) {
|
|
1014
|
+
const targets = [];
|
|
1015
|
+
const stack = scopes.slice();
|
|
1016
|
+
while (stack.length > 0) {
|
|
1017
|
+
const item = stack.pop();
|
|
1018
|
+
if (!item) continue;
|
|
1019
|
+
if (Array.isArray(item)) {
|
|
1020
|
+
for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
if (isScopeData(item)) targets.push(item(target));
|
|
1024
|
+
}
|
|
1025
|
+
return targets;
|
|
1026
|
+
}
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region runtime/core/cache/pool.ts
|
|
1029
|
+
const DEFAULT_TTL = 1e3 * 60 * 5;
|
|
1030
|
+
const TOKEN_WRAPPER_CACHE_LIMIT = 32;
|
|
1031
|
+
function createCombinedStylePool(resolver, ttl = DEFAULT_TTL) {
|
|
1032
|
+
const root = createPoolNode();
|
|
1033
|
+
let timer = null;
|
|
1034
|
+
return {
|
|
1035
|
+
get(styles, inheritedScopes, items, prevTokensData = null) {
|
|
1036
|
+
if (ttl === 0) {
|
|
1037
|
+
const collected = collectItems(null, items, prevTokensData, resolver);
|
|
1038
|
+
return {
|
|
1039
|
+
style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
|
|
1040
|
+
tokenCache: null,
|
|
1041
|
+
tokens: collected.tokens
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
const now = Date.now();
|
|
1045
|
+
let node = getPoolChild(root, styles);
|
|
1046
|
+
node = walkScopes(node, inheritedScopes);
|
|
1047
|
+
const collected = collectItems(node, items, prevTokensData, resolver);
|
|
1048
|
+
node = collected.node ?? node;
|
|
1049
|
+
node.value.updatedAt = now;
|
|
1050
|
+
if (node.value.style) {
|
|
1051
|
+
scheduleCleanup();
|
|
1052
|
+
return {
|
|
1053
|
+
style: node.value.style,
|
|
1054
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
1055
|
+
tokens: collected.tokens
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
const allScopes = concatScopes(inheritedScopes, collected.scopes);
|
|
1059
|
+
node.value.style = createCombinedStyleFacade(styles, allScopes);
|
|
1060
|
+
scheduleCleanup();
|
|
1061
|
+
return {
|
|
1062
|
+
style: node.value.style,
|
|
1063
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
1064
|
+
tokens: collected.tokens
|
|
1065
|
+
};
|
|
1066
|
+
},
|
|
1067
|
+
cleanup(now = Date.now()) {
|
|
1068
|
+
cleanupNode(root, now, ttl);
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
function scheduleCleanup() {
|
|
1072
|
+
if (timer) return;
|
|
1073
|
+
timer = setTimeout(() => {
|
|
1074
|
+
timer = null;
|
|
1075
|
+
cleanupNode(root, Date.now(), ttl);
|
|
1076
|
+
}, Math.max(ttl, 0));
|
|
1077
|
+
timer.unref?.();
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
function getCachedTokenWrapper(cache, tokens, create) {
|
|
1081
|
+
if (!cache) return create();
|
|
1082
|
+
const key = getTokenWrapperCacheKey(tokens);
|
|
1083
|
+
const cached = cache.get(key);
|
|
1084
|
+
if (cached) {
|
|
1085
|
+
cache.delete(key);
|
|
1086
|
+
cache.set(key, cached);
|
|
1087
|
+
return cached;
|
|
1088
|
+
}
|
|
1089
|
+
const value = create();
|
|
1090
|
+
cache.set(key, value);
|
|
1091
|
+
if (cache.size > TOKEN_WRAPPER_CACHE_LIMIT) {
|
|
1092
|
+
const oldest = cache.keys().next().value;
|
|
1093
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
1094
|
+
}
|
|
1095
|
+
return value;
|
|
1096
|
+
}
|
|
1097
|
+
function getTokenWrapperCache(node) {
|
|
1098
|
+
if (!node.tokenCache) node.tokenCache = /* @__PURE__ */ new Map();
|
|
1099
|
+
return node.tokenCache;
|
|
1100
|
+
}
|
|
1101
|
+
function getTokenWrapperCacheKey(tokens) {
|
|
1102
|
+
return tokens.ids.join("") + "" + tokens.values.join("");
|
|
1103
|
+
}
|
|
1104
|
+
function collectItems(node, items, prevTokensData, resolver) {
|
|
1105
|
+
const scopes = [];
|
|
1106
|
+
const tokens = createMutableTokenValues(prevTokensData);
|
|
1107
|
+
let currentNode = node;
|
|
1108
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
1109
|
+
const item = items[i];
|
|
1110
|
+
if (addTokenOverride(tokens, item, resolver)) continue;
|
|
1111
|
+
if (isScopeTargetData(item)) {
|
|
1112
|
+
scopes.push(item);
|
|
1113
|
+
currentNode = currentNode ? walkScope(currentNode, item) : null;
|
|
1114
|
+
addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item), resolver));
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
const tokensData = finishTokenValues(prevTokensData, tokens);
|
|
1118
|
+
if (!tokensData) return {
|
|
1119
|
+
node: currentNode,
|
|
1120
|
+
scopes,
|
|
1121
|
+
tokens: null
|
|
1122
|
+
};
|
|
1123
|
+
return {
|
|
1124
|
+
node: currentNode,
|
|
1125
|
+
scopes,
|
|
1126
|
+
tokens: tokensData
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
function walkScopes(node, scopes) {
|
|
1130
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
1131
|
+
const scope = scopes[i];
|
|
1132
|
+
if (!scope) continue;
|
|
1133
|
+
node = walkScope(node, scope);
|
|
1134
|
+
}
|
|
1135
|
+
return node;
|
|
1136
|
+
}
|
|
1137
|
+
function walkScope(node, scope) {
|
|
1138
|
+
node = getPoolChild(node, getScopeTargetScope(scope));
|
|
1139
|
+
node = getPoolChild(node, getScopeTargetSlotId(scope));
|
|
1140
|
+
return node;
|
|
1141
|
+
}
|
|
1142
|
+
function getScopeTokenValues(node, scope, resolver) {
|
|
1143
|
+
if (node && node.value.h && node.value.f === resolver.key) return node.value.s;
|
|
1144
|
+
const values = createMutableTokenValues(null);
|
|
1145
|
+
const items = scope[BUILDER_STATE].items;
|
|
1146
|
+
for (let i = 0, len = items.length; i < len; i++) addTokenOverride(values, items[i], resolver);
|
|
1147
|
+
const tokens = finishTokenValues(null, values);
|
|
1148
|
+
if (node) {
|
|
1149
|
+
node.value.h = true;
|
|
1150
|
+
node.value.s = tokens;
|
|
1151
|
+
node.value.f = resolver.key;
|
|
1565
1152
|
}
|
|
1566
|
-
else assignTokenRecord(tokens, values, debugId);
|
|
1567
1153
|
return tokens;
|
|
1568
1154
|
}
|
|
1569
|
-
function
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1155
|
+
function concatScopes(inheritedScopes, scopes) {
|
|
1156
|
+
const items = [];
|
|
1157
|
+
for (let i = 0, len = inheritedScopes.length; i < len; i++) {
|
|
1158
|
+
const item = inheritedScopes[i];
|
|
1159
|
+
if (item) items.push(item);
|
|
1160
|
+
}
|
|
1161
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
1162
|
+
const item = scopes[i];
|
|
1163
|
+
if (item) items.push(item);
|
|
1164
|
+
}
|
|
1165
|
+
return items;
|
|
1166
|
+
}
|
|
1167
|
+
function getPoolChild(node, key) {
|
|
1168
|
+
return getCacheTreeChild(node, key, createPoolValue);
|
|
1169
|
+
}
|
|
1170
|
+
function createPoolNode() {
|
|
1171
|
+
return createCacheTreeNode(createPoolValue());
|
|
1172
|
+
}
|
|
1173
|
+
function createPoolValue() {
|
|
1174
|
+
return {
|
|
1175
|
+
style: null,
|
|
1176
|
+
tokenCache: null,
|
|
1177
|
+
h: false,
|
|
1178
|
+
s: null,
|
|
1179
|
+
f: void 0,
|
|
1180
|
+
updatedAt: Date.now()
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
function cleanupNode(node, now, ttl) {
|
|
1184
|
+
for (const [key, child] of node.children) {
|
|
1185
|
+
cleanupNode(child, now, ttl);
|
|
1186
|
+
if (child.value.style && now - child.value.updatedAt >= ttl) child.value.style = null;
|
|
1187
|
+
if (!child.value.style && !child.children.size) node.children.delete(key);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region runtime/core/cache/combine.ts
|
|
1192
|
+
function createCombinedStyleGetter(resolver) {
|
|
1193
|
+
let configuredPool = null;
|
|
1194
|
+
let configuredPoolTTL = -1;
|
|
1195
|
+
return function getConfiguredCombinedStyle(styles, args) {
|
|
1196
|
+
const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
|
|
1197
|
+
if (!configuredPool || configuredPoolTTL !== ttl) {
|
|
1198
|
+
configuredPool = createCombinedStylePool(resolver, ttl);
|
|
1199
|
+
configuredPoolTTL = ttl;
|
|
1200
|
+
}
|
|
1201
|
+
const normalized = normalizeStyleItems(styles, args, resolver);
|
|
1202
|
+
const result = configuredPool.get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
|
|
1203
|
+
return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
function normalizeStyleItems(styles, args, resolver) {
|
|
1207
|
+
const result = {
|
|
1208
|
+
inheritedScopes: [],
|
|
1209
|
+
items: [],
|
|
1210
|
+
tokens: null
|
|
1211
|
+
};
|
|
1212
|
+
for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result, resolver);
|
|
1213
|
+
return result;
|
|
1214
|
+
}
|
|
1215
|
+
function collectStyleArg(styles, arg, result, resolver) {
|
|
1216
|
+
if (!arg) return;
|
|
1217
|
+
if (Array.isArray(arg)) {
|
|
1218
|
+
for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result, resolver);
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
|
|
1222
|
+
const bound = getExtractedTokenBoundData(arg);
|
|
1223
|
+
collectStyleArg(styles, bound.data, result, resolver);
|
|
1224
|
+
result.tokens = mergeTokenOverrides(result.tokens, bound.tokens, resolver);
|
|
1225
|
+
return;
|
|
1577
1226
|
}
|
|
1227
|
+
if (isCombinedStyle(arg)) {
|
|
1228
|
+
if (getCombinedStyleStyles(arg) !== styles) throw new TypeError("[fluentic-style] combineStyle styles mismatch.");
|
|
1229
|
+
const scopes = getCombinedStyleScopes(arg);
|
|
1230
|
+
for (let i = 0, len = scopes.length; i < len; i++) result.inheritedScopes.push(scopes[i]);
|
|
1231
|
+
result.tokens = mergeTokenValues(result.tokens, getStyleTokenValues(arg));
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
if (isSheetData(arg)) {
|
|
1235
|
+
collectTokenOverrides(arg, result, resolver);
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
if (isScopeData(arg)) {
|
|
1239
|
+
collectTokenOverrides(arg, result, resolver);
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
result.items.push(arg);
|
|
1578
1243
|
}
|
|
1579
|
-
function
|
|
1580
|
-
|
|
1244
|
+
function collectTokenOverrides(data, result, resolver) {
|
|
1245
|
+
const items = data[BUILDER_STATE]?.items ?? [];
|
|
1246
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
1247
|
+
const item = items[i];
|
|
1248
|
+
if (resolver.is(item)) result.tokens = mergeTokenOverrides(result.tokens, [item], resolver);
|
|
1249
|
+
}
|
|
1581
1250
|
}
|
|
1582
1251
|
//#endregion
|
|
1583
|
-
export {
|
|
1252
|
+
export { createValues as a, resetStyleThemeIdCounter as c, createStyleFn as d, getStyleFnMeta as f, type as g, transformKeyframes as h, createToken as i, createClassNameFn as l, createStyleKeyframes as m, bindScope as n, createTokens as o, style as p, combineScope as r, createTheme as s, createCombinedStyleGetter as t, assignStyleFnMeta as u };
|
|
1584
1253
|
|
|
1585
|
-
//# sourceMappingURL=
|
|
1254
|
+
//# sourceMappingURL=combine-CtR6MyD4.js.map
|