@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,4 +1,4 @@
|
|
|
1
|
-
import { FN_STYLE_MERGE, FN_STYLE_SCOPE, FN_STYLE_SLOT } from '../../../utils/constants';
|
|
1
|
+
import { FN_STYLE_MERGE, FN_STYLE_SCOPE, FN_STYLE_SELECTOR, FN_STYLE_SLOT } from '../../../utils/constants';
|
|
2
2
|
import type { BabelTypes } from '../../utils/babel';
|
|
3
3
|
|
|
4
4
|
export const STATIC_MERGE_METHOD = '$$style.merge';
|
|
@@ -10,7 +10,9 @@ export type StyleChainMethod = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export type StyleChainParseResult = {
|
|
13
|
-
|
|
13
|
+
global?: boolean;
|
|
14
|
+
sheetId?: string;
|
|
15
|
+
kind: 'style' | 'slot' | 'scope' | 'sheet' | 'selector';
|
|
14
16
|
rootName: string;
|
|
15
17
|
baseArgs: BabelTypes.Node[];
|
|
16
18
|
methods: StyleChainMethod[];
|
|
@@ -25,15 +27,34 @@ export type StyleSlotRef = {
|
|
|
25
27
|
export function extractStyleChain(
|
|
26
28
|
node: BabelTypes.Node,
|
|
27
29
|
styleNames: Set<string>,
|
|
30
|
+
sheetNames: Set<string> = new Set(),
|
|
28
31
|
): StyleChainParseResult {
|
|
29
32
|
if (node.type !== 'CallExpression') return null;
|
|
30
33
|
|
|
31
34
|
const callee = node.callee;
|
|
32
35
|
|
|
36
|
+
if (callee.type === 'CallExpression') {
|
|
37
|
+
const target = extractStyleChain(callee, styleNames, sheetNames);
|
|
38
|
+
if (
|
|
39
|
+
target?.kind !== 'selector' || target.baseArgs.length !== 1 ||
|
|
40
|
+
target.methods.length !== 0 || node.arguments.length > 1
|
|
41
|
+
) return null;
|
|
42
|
+
|
|
43
|
+
// style.selector(selector)(styles) is the inline form of a selector target call.
|
|
44
|
+
return {
|
|
45
|
+
...target,
|
|
46
|
+
baseArgs: [...target.baseArgs, ...(node.arguments as BabelTypes.Node[])],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
if (callee.type === 'Identifier' && styleNames.has(callee.name)) {
|
|
34
51
|
return { kind: 'style', rootName: callee.name, baseArgs: node.arguments as BabelTypes.Node[], methods: [] };
|
|
35
52
|
}
|
|
36
53
|
|
|
54
|
+
if (callee.type === 'Identifier' && sheetNames.has(callee.name)) {
|
|
55
|
+
return { kind: 'sheet', rootName: callee.name, baseArgs: node.arguments as BabelTypes.Node[], methods: [] };
|
|
56
|
+
}
|
|
57
|
+
|
|
37
58
|
if (callee.type === 'MemberExpression' && !callee.computed) {
|
|
38
59
|
const prop = callee.property.type === 'Identifier'
|
|
39
60
|
? callee.property.name
|
|
@@ -50,12 +71,15 @@ export function extractStyleChain(
|
|
|
50
71
|
if (prop === FN_STYLE_SCOPE) {
|
|
51
72
|
return { kind: 'scope', rootName: obj.name, baseArgs: node.arguments as BabelTypes.Node[], methods: [] };
|
|
52
73
|
}
|
|
74
|
+
if (prop === FN_STYLE_SELECTOR) {
|
|
75
|
+
return { kind: 'selector', rootName: obj.name, baseArgs: node.arguments as BabelTypes.Node[], methods: [] };
|
|
76
|
+
}
|
|
53
77
|
if (prop !== FN_STYLE_MERGE) return null;
|
|
54
78
|
|
|
55
79
|
const target = node.arguments[0] as BabelTypes.Node | undefined;
|
|
56
80
|
if (!target) return null;
|
|
57
81
|
|
|
58
|
-
const targetChain = extractStyleChain(target, styleNames);
|
|
82
|
+
const targetChain = extractStyleChain(target, styleNames, sheetNames);
|
|
59
83
|
if (!targetChain) return null;
|
|
60
84
|
|
|
61
85
|
return {
|
|
@@ -71,7 +95,7 @@ export function extractStyleChain(
|
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
if (obj.type === 'CallExpression') {
|
|
74
|
-
const inner = extractStyleChain(obj, styleNames);
|
|
98
|
+
const inner = extractStyleChain(obj, styleNames, sheetNames);
|
|
75
99
|
if (!inner) return null;
|
|
76
100
|
|
|
77
101
|
return {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { CreateSheetOptions } from '../../../../builder/data';
|
|
1
2
|
import type { StyleTokenOverride } from '../../../../style/token';
|
|
2
3
|
import type { CssExtractItem, CssExtractRule } from '../../../extract';
|
|
3
4
|
import type { BabelTypes } from '../../utils/babel';
|
|
4
5
|
|
|
5
6
|
export type { CssExtractItem, CssExtractRule };
|
|
6
7
|
|
|
7
|
-
export type CompiledChainType = 'style' | 'slot' | 'scope';
|
|
8
|
+
export type CompiledChainType = 'style' | 'sheet' | 'slot' | 'scope';
|
|
8
9
|
|
|
9
10
|
export type CompiledCssItem = CssExtractItem & {
|
|
10
11
|
valueNode?: BabelTypes.Expression;
|
|
@@ -34,4 +35,5 @@ export type CompiledChainData = {
|
|
|
34
35
|
slotId?: string;
|
|
35
36
|
items: CompiledItem[];
|
|
36
37
|
rules: CssExtractRule[];
|
|
38
|
+
sheetOptions?: CreateSheetOptions;
|
|
37
39
|
};
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
+
import type { CheckImportantOptions, StyleCheckLevel } from '../../../config/config/check';
|
|
1
2
|
import { hashString } from '../../../utils/hash';
|
|
2
3
|
import type { CompilerRuntimeMode } from '../../compiler';
|
|
3
4
|
import type { CompilerOptions } from '../../compiler/types';
|
|
4
5
|
import type { CompilerCssCollector } from '../../extract/collector';
|
|
6
|
+
import { recordCheckDiagnostic } from '../../utils/check_diagnostics';
|
|
5
7
|
import {
|
|
6
8
|
FN_CREATE_EXTRACTED_THEME,
|
|
7
9
|
FN_CREATE_EXTRACTED_TOKEN,
|
|
10
|
+
FN_CREATE_GLOBAL_SHEET,
|
|
11
|
+
FN_CREATE_SHEET,
|
|
8
12
|
FN_STYLE_PLAIN,
|
|
9
13
|
FN_STYLE_RAW,
|
|
10
14
|
FN_WITH_TOKENS,
|
|
11
15
|
IMPORT_EXTRACT,
|
|
16
|
+
STYLE_CSS_IMPORT_PATH,
|
|
12
17
|
} from '../../utils/constants';
|
|
13
18
|
import { createImportSourceMatcher } from '../../utils/import_source';
|
|
14
19
|
import { normalizePath } from '../../utils/path';
|
|
15
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
COMPILED_TOKEN_REFERENCE,
|
|
22
|
+
type CompiledTokenReference,
|
|
23
|
+
evaluateEnumDeclaration,
|
|
24
|
+
evaluateNode,
|
|
25
|
+
} from '../evaluator/evaluator';
|
|
26
|
+
import { LazyBindings } from '../evaluator/lazy_bindings';
|
|
16
27
|
import { getImportedName } from '../syntax';
|
|
17
28
|
import { annotateAtRuleDeclaration } from '../syntax/static_ids';
|
|
18
29
|
import { BabelCore } from '../utils/babel';
|
|
@@ -25,7 +36,7 @@ import { buildReplacement } from './utils/replacement';
|
|
|
25
36
|
import { recordCompiledBinding } from './utils/slot';
|
|
26
37
|
import { type ExtractPluginState, getEvalScope, type HoistedDeclaration } from './utils/state';
|
|
27
38
|
import { compileThemeCall } from './utils/theme';
|
|
28
|
-
import { annotateTokenDeclaration } from './utils/token';
|
|
39
|
+
import { annotateTokenDeclaration, compileTokenFactory } from './utils/token';
|
|
29
40
|
|
|
30
41
|
export type PluginState = BabelCore.PluginPass & ExtractPluginState;
|
|
31
42
|
|
|
@@ -56,9 +67,11 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
56
67
|
|
|
57
68
|
return {
|
|
58
69
|
pre(this) {
|
|
70
|
+
this.tokenFactoryReplacements = new Map();
|
|
59
71
|
this.styleNames = new Set();
|
|
72
|
+
this.sheetNames = new Set();
|
|
60
73
|
this.styleMetas = new Map();
|
|
61
|
-
this.bindings = new
|
|
74
|
+
this.bindings = new LazyBindings();
|
|
62
75
|
this.bindingNodes = new Map();
|
|
63
76
|
this.imports = new Map();
|
|
64
77
|
this.needsExtractImport = false;
|
|
@@ -73,7 +86,9 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
73
86
|
this.filePath = this.file?.opts?.filename ?? 'unknown';
|
|
74
87
|
this.styleFilePath = args.styleFilePath ?? this.filePath;
|
|
75
88
|
this.sourcemapTrace = options.dev?.sourcemapMode ?? 'style';
|
|
76
|
-
this.fileId = args.
|
|
89
|
+
this.fileId = args.runtimeMode === 'rsc-dev'
|
|
90
|
+
? getProjectFileId(args.projectDir, this.file?.opts?.filename)
|
|
91
|
+
: args.styleFilePath ?? getProjectFileId(args.projectDir, this.file?.opts?.filename);
|
|
77
92
|
},
|
|
78
93
|
|
|
79
94
|
visitor: {
|
|
@@ -104,6 +119,13 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
104
119
|
state.styleNames.add(spec.local.name);
|
|
105
120
|
state.styleMetas.set(spec.local.name, meta);
|
|
106
121
|
}
|
|
122
|
+
|
|
123
|
+
if (
|
|
124
|
+
sourceName === STYLE_CSS_IMPORT_PATH &&
|
|
125
|
+
(imported === FN_CREATE_SHEET || imported === FN_CREATE_GLOBAL_SHEET)
|
|
126
|
+
) {
|
|
127
|
+
state.sheetNames.add(spec.local.name);
|
|
128
|
+
}
|
|
107
129
|
});
|
|
108
130
|
},
|
|
109
131
|
|
|
@@ -117,11 +139,7 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
117
139
|
annotateAtRuleDeclaration(decl, state, t);
|
|
118
140
|
|
|
119
141
|
const name = decl.id.name;
|
|
120
|
-
|
|
121
|
-
const result = evaluateNode(decl.init, scope);
|
|
122
|
-
|
|
123
|
-
state.bindings.set(name, result);
|
|
124
|
-
state.bindingNodes.set(name, decl.init);
|
|
142
|
+
recordLazyBinding(state, name, t.cloneNode(decl.init, true));
|
|
125
143
|
});
|
|
126
144
|
},
|
|
127
145
|
|
|
@@ -136,11 +154,7 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
136
154
|
annotateAtRuleDeclaration(decl, state, t);
|
|
137
155
|
|
|
138
156
|
const name = decl.id.name;
|
|
139
|
-
|
|
140
|
-
const result = evaluateNode(decl.init, scope);
|
|
141
|
-
|
|
142
|
-
state.bindings.set(name, result);
|
|
143
|
-
state.bindingNodes.set(name, decl.init);
|
|
157
|
+
recordLazyBinding(state, name, t.cloneNode(decl.init, true));
|
|
144
158
|
});
|
|
145
159
|
},
|
|
146
160
|
|
|
@@ -151,6 +165,14 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
151
165
|
},
|
|
152
166
|
|
|
153
167
|
CallExpression(path, state) {
|
|
168
|
+
if (mode === 'extract') {
|
|
169
|
+
try {
|
|
170
|
+
const tokenFactory = compileTokenFactory(path.node, state, t);
|
|
171
|
+
if (tokenFactory) state.tokenFactoryReplacements.set(path.node, tokenFactory);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
throw path.buildCodeFrameError(error instanceof Error ? error.message : String(error));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
154
176
|
if (
|
|
155
177
|
path.parent.type === 'MemberExpression' &&
|
|
156
178
|
!(path.parent.computed)
|
|
@@ -180,10 +202,12 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
180
202
|
return;
|
|
181
203
|
}
|
|
182
204
|
|
|
183
|
-
if (!state.styleNames.size) return;
|
|
205
|
+
if (!state.styleNames.size && !state.sheetNames.size) return;
|
|
184
206
|
|
|
185
|
-
const chain = extractStyleChain(path.node, state.styleNames);
|
|
207
|
+
const chain = extractStyleChain(path.node, state.styleNames, state.sheetNames);
|
|
186
208
|
if (!chain) return;
|
|
209
|
+
chain.global = chain.kind === 'sheet' && state.imports.get(chain.rootName)?.name === FN_CREATE_GLOBAL_SHEET;
|
|
210
|
+
if (chain.global) chain.sheetId = state.fileId + ':' + path.node.start;
|
|
187
211
|
|
|
188
212
|
if (
|
|
189
213
|
chain.kind === 'slot' &&
|
|
@@ -198,11 +222,20 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
198
222
|
const scope = getEvalScope(state);
|
|
199
223
|
const loc = path.node.loc?.start;
|
|
200
224
|
const meta = state.styleMetas.get(chain.rootName);
|
|
201
|
-
if (!meta) return;
|
|
225
|
+
if (chain.kind !== 'sheet' && !meta) return;
|
|
202
226
|
|
|
203
227
|
let result: ReturnType<typeof compileChain>;
|
|
204
228
|
try {
|
|
205
|
-
result = compileChain(
|
|
229
|
+
result = compileChain(
|
|
230
|
+
chain,
|
|
231
|
+
state.fileId,
|
|
232
|
+
loc,
|
|
233
|
+
scope,
|
|
234
|
+
options,
|
|
235
|
+
state.runtimeMode,
|
|
236
|
+
meta ?? null,
|
|
237
|
+
state.styleNames,
|
|
238
|
+
);
|
|
206
239
|
} catch (error) {
|
|
207
240
|
const message = error instanceof Error ? error.message : String(error);
|
|
208
241
|
const node = getSelectorCompileErrorNode(error);
|
|
@@ -210,6 +243,12 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
210
243
|
}
|
|
211
244
|
if (!result) return;
|
|
212
245
|
|
|
246
|
+
checkCompiledImportantUsage(result, options.check?.important, (level, message) => {
|
|
247
|
+
recordCheckDiagnostic({ level, message });
|
|
248
|
+
if (level === 'error') throw path.buildCodeFrameError(message);
|
|
249
|
+
console.warn('[fluentic-style] ' + message);
|
|
250
|
+
});
|
|
251
|
+
|
|
213
252
|
result.rules.forEach((rule) => {
|
|
214
253
|
state.collector.add(rule);
|
|
215
254
|
});
|
|
@@ -218,6 +257,13 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
218
257
|
return;
|
|
219
258
|
}
|
|
220
259
|
|
|
260
|
+
if (chain.global) {
|
|
261
|
+
if (path.parentPath.isExpressionStatement()) path.parentPath.remove();
|
|
262
|
+
else path.replaceWith(t.unaryExpression('void', t.numericLiteral(0)));
|
|
263
|
+
path.skip();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
221
267
|
const replacement = createChainReplacement({
|
|
222
268
|
t,
|
|
223
269
|
path,
|
|
@@ -246,6 +292,15 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
246
292
|
exit(path, state) {
|
|
247
293
|
if (mode === 'collect') return;
|
|
248
294
|
|
|
295
|
+
path.traverse({
|
|
296
|
+
CallExpression(factoryPath) {
|
|
297
|
+
const replacement = state.tokenFactoryReplacements.get(factoryPath.node);
|
|
298
|
+
if (!replacement) return;
|
|
299
|
+
factoryPath.replaceWith(replacement);
|
|
300
|
+
factoryPath.skip();
|
|
301
|
+
state.needsExtractImport = true;
|
|
302
|
+
},
|
|
303
|
+
});
|
|
249
304
|
pruneUnusedStyleInputDeclarations(path, state);
|
|
250
305
|
pruneUnusedStyleImports(path, state);
|
|
251
306
|
|
|
@@ -268,34 +323,87 @@ export function createExtractPlugin(args: PluginArgs) {
|
|
|
268
323
|
});
|
|
269
324
|
}
|
|
270
325
|
|
|
271
|
-
function
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
)
|
|
275
|
-
|
|
326
|
+
function recordLazyBinding(state: ExtractPluginState, name: string, initializer: BabelTypes.Node) {
|
|
327
|
+
// Capture the declaration environment without evaluating it. Later shadowed
|
|
328
|
+
// declarations must not change the meaning of a pending initializer.
|
|
329
|
+
const bindings = state.bindings.fork();
|
|
330
|
+
const scope = {
|
|
331
|
+
...getEvalScope(state),
|
|
332
|
+
bindings,
|
|
333
|
+
bindingNodes: new Map(state.bindingNodes),
|
|
334
|
+
imports: new Map(state.imports),
|
|
335
|
+
};
|
|
336
|
+
bindings.setLazy(name, () => evaluateNode(initializer, scope));
|
|
337
|
+
state.bindings.setLazy(name, () => bindings.get(name)!);
|
|
338
|
+
state.bindingNodes.set(name, initializer);
|
|
339
|
+
}
|
|
276
340
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
341
|
+
function checkCompiledImportantUsage(
|
|
342
|
+
result: NonNullable<ReturnType<typeof compileChain>>,
|
|
343
|
+
options: CheckImportantOptions | undefined,
|
|
344
|
+
report: (level: Exclude<StyleCheckLevel, false>, message: string) => void,
|
|
345
|
+
) {
|
|
346
|
+
if (!options) return;
|
|
280
347
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (!isStyleInputCall(node.init, state)) return;
|
|
348
|
+
let hasRawValue = false;
|
|
349
|
+
let hasOutsideSheet = false;
|
|
284
350
|
|
|
285
|
-
|
|
286
|
-
|
|
351
|
+
for (let i = 0, len = result.rules.length; i < len; i++) {
|
|
352
|
+
const rule = result.rules[i];
|
|
353
|
+
if (!rule.important && /!\s*important\b/i.test(rule.css)) hasRawValue = true;
|
|
354
|
+
if (result.type !== 'sheet' && rule.important) hasOutsideSheet = true;
|
|
355
|
+
}
|
|
287
356
|
|
|
288
|
-
|
|
289
|
-
|
|
357
|
+
if (hasRawValue && options.rawValue) {
|
|
358
|
+
report(
|
|
359
|
+
options.rawValue,
|
|
360
|
+
'Do not write raw "!important" values. Wrap the value with style.important(...) instead.',
|
|
361
|
+
);
|
|
362
|
+
}
|
|
290
363
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
364
|
+
if (hasOutsideSheet && options.outsideSheet) {
|
|
365
|
+
report(
|
|
366
|
+
options.outsideSheet,
|
|
367
|
+
'style.important(...) outside createSheet is discouraged. Prefer style.weight(...) for Fluentic style priority.',
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
298
371
|
|
|
372
|
+
function pruneUnusedStyleInputDeclarations(
|
|
373
|
+
path: BabelCore.NodePath<BabelTypes.Program>,
|
|
374
|
+
state: PluginState,
|
|
375
|
+
) {
|
|
376
|
+
const dependencies = new Set<BabelTypes.VariableDeclarator>();
|
|
377
|
+
let changed: boolean;
|
|
378
|
+
do {
|
|
379
|
+
changed = false;
|
|
380
|
+
path.scope.crawl();
|
|
381
|
+
path.traverse({
|
|
382
|
+
VariableDeclarator(declaratorPath) {
|
|
383
|
+
const node = declaratorPath.node;
|
|
384
|
+
if (declaratorPath.parentPath?.parentPath?.isExportNamedDeclaration()) return;
|
|
385
|
+
if (node.id.type !== 'Identifier') return;
|
|
386
|
+
const binding = declaratorPath.scope.getBinding(node.id.name);
|
|
387
|
+
if (!binding || !binding.constant || binding.referencePaths.length) return;
|
|
388
|
+
if (
|
|
389
|
+
!isStyleInputCall(node.init, state) &&
|
|
390
|
+
!(dependencies.has(node) && declaratorPath.get('init').isPure())
|
|
391
|
+
) return;
|
|
392
|
+
|
|
393
|
+
declaratorPath.get('init').traverse({
|
|
394
|
+
ReferencedIdentifier(reference) {
|
|
395
|
+
const dependency = reference.scope.getBinding(reference.node.name);
|
|
396
|
+
if (dependency?.path.isVariableDeclarator()) dependencies.add(dependency.path.node);
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
const declarationPath = declaratorPath.parentPath;
|
|
400
|
+
if (!declarationPath?.isVariableDeclaration()) return;
|
|
401
|
+
if (declarationPath.node.declarations.length > 1) declaratorPath.remove();
|
|
402
|
+
else declarationPath.remove();
|
|
403
|
+
changed = true;
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
} while (changed);
|
|
299
407
|
path.scope.crawl();
|
|
300
408
|
}
|
|
301
409
|
|
|
@@ -305,6 +413,12 @@ function isStyleInputCall(
|
|
|
305
413
|
) {
|
|
306
414
|
if (!node || node.type !== 'CallExpression') return false;
|
|
307
415
|
|
|
416
|
+
const selectorChain = extractStyleChain(node, state.styleNames, state.sheetNames);
|
|
417
|
+
if (selectorChain?.kind === 'selector') {
|
|
418
|
+
return selectorChain.baseArgs.every((arg) => evaluateNode(arg, getEvalScope(state)).ok) &&
|
|
419
|
+
selectorChain.methods.every((method) => method.args.every((arg) => evaluateNode(arg, getEvalScope(state)).ok));
|
|
420
|
+
}
|
|
421
|
+
|
|
308
422
|
const callee = node.callee;
|
|
309
423
|
if (callee.type !== 'MemberExpression' || callee.computed) return false;
|
|
310
424
|
if (callee.object.type !== 'Identifier') return false;
|
|
@@ -411,8 +525,11 @@ function createRuntimeTokenCollector(
|
|
|
411
525
|
|
|
412
526
|
return {
|
|
413
527
|
overrides,
|
|
414
|
-
addOverride(item: { valueNode: BabelTypes.Expression; }) {
|
|
415
|
-
|
|
528
|
+
addOverride(item: { valueNode: BabelTypes.Expression; value: unknown; }) {
|
|
529
|
+
const reference = (item.value as CompiledTokenReference)[COMPILED_TOKEN_REFERENCE];
|
|
530
|
+
overrides.push(
|
|
531
|
+
args.t.cloneNode(reference?.filePath === args.state.filePath ? reference.expression : item.valueNode, true),
|
|
532
|
+
);
|
|
416
533
|
},
|
|
417
534
|
add(item: object, valueNode: BabelTypes.Expression) {
|
|
418
535
|
if (canHoistRuntimeValue(args.path, valueNode)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompilerInternal, TransformExtractArgs, TransformExtractResult } from '../../compiler';
|
|
2
2
|
import type { CompilerCssCollector } from '../../extract';
|
|
3
|
+
import { createCssPropPlugin } from '../cssProp';
|
|
3
4
|
import { babelTransform } from '../utils/babel';
|
|
4
5
|
import { createExtractPlugin, type ExtractTracer } from './plugin';
|
|
5
6
|
|
|
@@ -31,7 +32,7 @@ export function transformExtract(
|
|
|
31
32
|
code: args.code,
|
|
32
33
|
filePath: args.filePath,
|
|
33
34
|
sourcemap: args.sourcemap,
|
|
34
|
-
plugins: [plugin],
|
|
35
|
+
plugins: [createCssPropPlugin({ options: internal.options }), plugin],
|
|
35
36
|
errorLabel: '[style] compiler error',
|
|
36
37
|
});
|
|
37
38
|
|
|
@@ -2,7 +2,12 @@ import {
|
|
|
2
2
|
FN_BIND_SCOPE,
|
|
3
3
|
FN_COMBINE_SCOPE,
|
|
4
4
|
FN_COMBINE_STYLE,
|
|
5
|
+
FN_CREATE_GLOBAL_SHEET,
|
|
6
|
+
FN_CREATE_SHEET,
|
|
5
7
|
FN_CREATE_THEME,
|
|
8
|
+
FN_CREATE_TOKEN,
|
|
9
|
+
FN_CREATE_TOKENS,
|
|
10
|
+
FN_CREATE_VALUES,
|
|
6
11
|
FN_GET_CLASS_NAME,
|
|
7
12
|
FN_GET_TOKEN,
|
|
8
13
|
IMPORT_PATHS,
|
|
@@ -128,5 +133,7 @@ function isCompilerHandledImport(
|
|
|
128
133
|
source: string,
|
|
129
134
|
name: string,
|
|
130
135
|
) {
|
|
131
|
-
return IMPORT_PATHS.includes(source) &&
|
|
136
|
+
return IMPORT_PATHS.includes(source) &&
|
|
137
|
+
[FN_CREATE_THEME, FN_CREATE_TOKEN, FN_CREATE_TOKENS, FN_CREATE_VALUES, FN_CREATE_SHEET, FN_CREATE_GLOBAL_SHEET]
|
|
138
|
+
.includes(name);
|
|
132
139
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { getTokenVarName } from '../../../../atomic/token';
|
|
1
2
|
import {
|
|
2
3
|
BUILDER_TYPE_SCOPE,
|
|
4
|
+
BUILDER_TYPE_SHEET,
|
|
3
5
|
BUILDER_TYPE_SLOT,
|
|
4
6
|
BUILDER_TYPE_SLOT_OVERRIDE,
|
|
5
7
|
BUILDER_TYPE_STYLE,
|
|
@@ -8,15 +10,24 @@ import {
|
|
|
8
10
|
ITEM_VALUE_TYPE_VARIABLE,
|
|
9
11
|
} from '../../../../builder/data/const';
|
|
10
12
|
import type { BuilderType, ExtractedItemValue } from '../../../../builder/data/state';
|
|
11
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getStyleTokenId,
|
|
15
|
+
getStyleTokenName,
|
|
16
|
+
isStyleTokenData,
|
|
17
|
+
type StyleTokenData,
|
|
18
|
+
type StyleTokenOverride,
|
|
19
|
+
} from '../../../../style/token';
|
|
12
20
|
import type { AtRuleRefData } from '../../../../style/valueRef';
|
|
21
|
+
import { DEFAULT_CONFIG } from '../../../utils/constants';
|
|
13
22
|
import {
|
|
14
23
|
FN_CREATE_EXTRACTED_SCOPE,
|
|
24
|
+
FN_CREATE_EXTRACTED_SHEET,
|
|
15
25
|
FN_CREATE_EXTRACTED_SLOT,
|
|
16
26
|
FN_CREATE_EXTRACTED_STYLE,
|
|
17
27
|
FN_CREATE_EXTRACTED_STYLE_MERGE,
|
|
18
28
|
FN_CREATE_EXTRACTED_TOKEN,
|
|
19
29
|
} from '../../../utils/constants';
|
|
30
|
+
import { COMPILED_TOKEN_REFERENCE, type CompiledTokenReference } from '../../evaluator/evaluator';
|
|
20
31
|
import type { BabelTypes } from '../../utils/babel';
|
|
21
32
|
import type {
|
|
22
33
|
CompiledChainData,
|
|
@@ -50,6 +61,18 @@ export function buildReplacement(
|
|
|
50
61
|
);
|
|
51
62
|
}
|
|
52
63
|
|
|
64
|
+
if (chain.type === 'sheet') {
|
|
65
|
+
state.usedHelpers.add(FN_CREATE_EXTRACTED_SHEET);
|
|
66
|
+
|
|
67
|
+
return t.callExpression(
|
|
68
|
+
t.identifier(FN_CREATE_EXTRACTED_SHEET),
|
|
69
|
+
[
|
|
70
|
+
buildItemsArray(t, chain, BUILDER_TYPE_SHEET, state, options),
|
|
71
|
+
buildSheetOptions(t, chain),
|
|
72
|
+
],
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
53
76
|
if (chain.type === 'slot') {
|
|
54
77
|
state.usedHelpers.add(FN_CREATE_EXTRACTED_SLOT);
|
|
55
78
|
|
|
@@ -74,6 +97,28 @@ export function buildReplacement(
|
|
|
74
97
|
return null;
|
|
75
98
|
}
|
|
76
99
|
|
|
100
|
+
function buildSheetOptions(
|
|
101
|
+
t: typeof BabelTypes,
|
|
102
|
+
chain: CompiledChainData,
|
|
103
|
+
): BabelTypes.ObjectExpression {
|
|
104
|
+
const options = chain.sheetOptions ?? {};
|
|
105
|
+
const properties: BabelTypes.ObjectProperty[] = [];
|
|
106
|
+
|
|
107
|
+
if (options.layer !== undefined) {
|
|
108
|
+
properties.push(
|
|
109
|
+
t.objectProperty(
|
|
110
|
+
t.identifier('layer'),
|
|
111
|
+
typeof options.layer === 'string' ? t.stringLiteral(options.layer) : t.booleanLiteral(options.layer),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (options.specificity !== undefined) {
|
|
116
|
+
properties.push(t.objectProperty(t.identifier('specificity'), t.numericLiteral(options.specificity)));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return t.objectExpression(properties);
|
|
120
|
+
}
|
|
121
|
+
|
|
77
122
|
function buildStyleMergeArgs(
|
|
78
123
|
t: typeof BabelTypes,
|
|
79
124
|
chain: CompiledChainData,
|
|
@@ -126,7 +171,7 @@ function buildItemsArray(
|
|
|
126
171
|
if (options.getTokenOverride) {
|
|
127
172
|
options.getTokenOverride(item);
|
|
128
173
|
} else {
|
|
129
|
-
itemExpressions.push(t
|
|
174
|
+
itemExpressions.push(buildExtractedTokenOverrideExpression(t, item.value, state));
|
|
130
175
|
}
|
|
131
176
|
return;
|
|
132
177
|
}
|
|
@@ -308,7 +353,11 @@ function buildVariableValueExpression(
|
|
|
308
353
|
options: BuildReplacementOptions,
|
|
309
354
|
): BabelTypes.Expression {
|
|
310
355
|
if (isStyleTokenData(value)) {
|
|
311
|
-
|
|
356
|
+
const reference = (value as CompiledTokenReference)[COMPILED_TOKEN_REFERENCE];
|
|
357
|
+
if (reference?.filePath === state.filePath) {
|
|
358
|
+
const runtimeToken = options.getRuntimeToken?.(item, reference.expression);
|
|
359
|
+
if (runtimeToken) return runtimeToken;
|
|
360
|
+
}
|
|
312
361
|
return buildExtractedTokenExpression(t, value, state);
|
|
313
362
|
}
|
|
314
363
|
|
|
@@ -319,12 +368,18 @@ function buildVariableValueExpression(
|
|
|
319
368
|
return valueNode ? t.cloneNode(valueNode) : literalExpression(t, value);
|
|
320
369
|
}
|
|
321
370
|
|
|
322
|
-
function buildExtractedTokenExpression(
|
|
371
|
+
export function buildExtractedTokenExpression(
|
|
323
372
|
t: typeof BabelTypes,
|
|
324
373
|
token: StyleTokenData,
|
|
325
374
|
state: ExtractPluginState,
|
|
375
|
+
preserveReference = true,
|
|
326
376
|
): BabelTypes.Expression {
|
|
377
|
+
const reference = (token as CompiledTokenReference)[COMPILED_TOKEN_REFERENCE];
|
|
378
|
+
if (preserveReference && reference?.filePath === state.filePath) {
|
|
379
|
+
return t.cloneNode(reference.expression, true);
|
|
380
|
+
}
|
|
327
381
|
state.usedHelpers.add(FN_CREATE_EXTRACTED_TOKEN);
|
|
382
|
+
const tokenNameFormat = state.options.css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null;
|
|
328
383
|
|
|
329
384
|
return t.callExpression(
|
|
330
385
|
t.identifier(FN_CREATE_EXTRACTED_TOKEN),
|
|
@@ -332,6 +387,38 @@ function buildExtractedTokenExpression(
|
|
|
332
387
|
t.stringLiteral(getStyleTokenId(token)),
|
|
333
388
|
literalExpression(t, token.value),
|
|
334
389
|
token.ref ? buildExtractedTokenExpression(t, token.ref, state) : t.nullLiteral(),
|
|
390
|
+
getStyleTokenName(token) ? t.stringLiteral(getStyleTokenName(token)!) : t.nullLiteral(),
|
|
391
|
+
t.stringLiteral(getTokenVarName(token, tokenNameFormat)),
|
|
392
|
+
],
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function buildExtractedTokenOverrideExpression(
|
|
397
|
+
t: typeof BabelTypes,
|
|
398
|
+
token: StyleTokenOverride,
|
|
399
|
+
state: ExtractPluginState,
|
|
400
|
+
): BabelTypes.Expression {
|
|
401
|
+
const reference = (token as CompiledTokenReference)[COMPILED_TOKEN_REFERENCE];
|
|
402
|
+
if (reference?.filePath === state.filePath) return t.cloneNode(reference.expression, true);
|
|
403
|
+
state.usedHelpers.add(FN_CREATE_EXTRACTED_TOKEN);
|
|
404
|
+
const tokenNameFormat = state.options.css?.tokenNameFormat ?? DEFAULT_CONFIG.tokenNameFormat ?? null;
|
|
405
|
+
const extractedToken = t.callExpression(
|
|
406
|
+
t.identifier(FN_CREATE_EXTRACTED_TOKEN),
|
|
407
|
+
[
|
|
408
|
+
t.stringLiteral(getStyleTokenId(token)),
|
|
409
|
+
t.nullLiteral(),
|
|
410
|
+
t.nullLiteral(),
|
|
411
|
+
getStyleTokenName(token) ? t.stringLiteral(getStyleTokenName(token)!) : t.nullLiteral(),
|
|
412
|
+
t.stringLiteral(getTokenVarName(token, tokenNameFormat)),
|
|
413
|
+
],
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
return t.callExpression(
|
|
417
|
+
extractedToken,
|
|
418
|
+
[
|
|
419
|
+
token.ref
|
|
420
|
+
? buildExtractedTokenExpression(t, token.ref, state)
|
|
421
|
+
: literalExpression(t, token.value),
|
|
335
422
|
],
|
|
336
423
|
);
|
|
337
424
|
}
|
|
@@ -345,5 +432,5 @@ function literalExpression(
|
|
|
345
432
|
if (typeof value === 'boolean') return t.booleanLiteral(value);
|
|
346
433
|
if (value === null || value === undefined) return t.nullLiteral();
|
|
347
434
|
|
|
348
|
-
return t.
|
|
435
|
+
return t.valueToNode(value) as BabelTypes.Expression;
|
|
349
436
|
}
|
|
@@ -4,7 +4,8 @@ import type { CompilerOptions } from '../../../compiler/types';
|
|
|
4
4
|
import type { CompilerCssCollector } from '../../../extract';
|
|
5
5
|
import type { ImportSourceMatcher } from '../../../utils/import_source';
|
|
6
6
|
import type { EvalScope } from '../../evaluator/evaluator';
|
|
7
|
-
import type {
|
|
7
|
+
import type { LazyBindings } from '../../evaluator/lazy_bindings';
|
|
8
|
+
import type { ImportMap, ResolveImportFn } from '../../evaluator/types';
|
|
8
9
|
import type { BabelTypes } from '../../utils/babel';
|
|
9
10
|
|
|
10
11
|
export type HoistedDeclaration = {
|
|
@@ -13,13 +14,15 @@ export type HoistedDeclaration = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export type ExtractPluginState = {
|
|
17
|
+
tokenFactoryReplacements: Map<BabelTypes.CallExpression, BabelTypes.Expression>;
|
|
16
18
|
fileId: string;
|
|
17
19
|
filePath: string;
|
|
18
20
|
styleFilePath: string;
|
|
19
21
|
sourcemapTrace: 'style' | 'value';
|
|
20
22
|
styleNames: Set<string>;
|
|
23
|
+
sheetNames: Set<string>;
|
|
21
24
|
styleMetas: Map<string, StyleFnMeta>;
|
|
22
|
-
bindings:
|
|
25
|
+
bindings: LazyBindings;
|
|
23
26
|
bindingNodes: Map<string, BabelTypes.Node>;
|
|
24
27
|
imports: ImportMap;
|
|
25
28
|
needsExtractImport: boolean;
|
|
@@ -42,7 +45,10 @@ export function getEvalScope(state: ExtractPluginState): EvalScope {
|
|
|
42
45
|
styleFilePath: state.styleFilePath,
|
|
43
46
|
sourcemapTrace: state.sourcemapTrace,
|
|
44
47
|
styleNames: state.styleNames,
|
|
48
|
+
sheetNames: state.sheetNames,
|
|
45
49
|
styleMetas: state.styleMetas,
|
|
46
50
|
bindingNodes: state.bindingNodes,
|
|
51
|
+
runtimeMode: state.runtimeMode,
|
|
52
|
+
tokenNameFormat: state.options.css?.tokenNameFormat ?? null,
|
|
47
53
|
};
|
|
48
54
|
}
|