@fluentic/style 0.1.0-beta.4 → 0.1.0-beta.6
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 +56 -1
- package/README.md +106 -31
- package/atomic/className.ts +29 -6
- package/atomic/debug/className/className.ts +10 -0
- package/atomic/rule.ts +6 -3
- package/atomic/utils/hash.ts +1 -65
- package/atomic/utils/selector.ts +14 -1
- 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 +6 -0
- package/builder/data/create.ts +42 -0
- package/builder/data/data.ts +20 -1
- package/builder/data/index.ts +0 -1
- package/builder/data/is.ts +23 -0
- package/builder/data/merge/scope.ts +20 -19
- package/builder/data/merge/style.ts +70 -20
- package/builder/data/state.ts +16 -2
- package/builder/extract/index.ts +1 -0
- package/builder/extract/sheet.ts +26 -0
- 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 +30 -0
- package/builder/selector_override_core.ts +66 -0
- package/builder/style_builder.ts +127 -3
- package/builder/style_data.ts +24 -0
- package/builder/style_fns.ts +24 -24
- 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/compiler.ts +88 -14
- package/compiler/compiler/constants.ts +6 -0
- package/compiler/compiler/index.ts +1 -0
- package/compiler/compiler/types.ts +2 -0
- package/compiler/cssProp.ts +21 -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 +6 -0
- package/compiler/transform/debug/transform.ts +2 -1
- package/compiler/transform/evaluator/evaluator.ts +33 -4
- package/compiler/transform/evaluator/tracer.ts +30 -2
- package/compiler/transform/extract/chain/chain.ts +660 -73
- package/compiler/transform/extract/chain/extract_chain.ts +12 -4
- package/compiler/transform/extract/chain/types.ts +1 -1
- package/compiler/transform/extract/plugin.ts +20 -4
- package/compiler/transform/extract/transform.ts +2 -1
- package/compiler/transform/extract/utils/replacement.ts +47 -2
- package/compiler/transform/extract/utils/state.ts +2 -0
- package/compiler/transform/index.ts +1 -0
- package/compiler/transform/syntax/isStaticStyleValue.ts +15 -9
- package/compiler/utils/constants.ts +8 -1
- package/compiler/utils/import_source.ts +17 -7
- package/compiler/utils/imports.ts +11 -1
- package/config/config/css.ts +1 -0
- package/css/index.ts +2 -0
- package/css/sheet.ts +119 -0
- package/css/styleTarget.ts +251 -0
- package/dist/adapter/preact.js +2 -0
- package/dist/adapter/react.js +2 -0
- package/dist/adapter/solid.js +2 -0
- package/dist/className-hiAsQ9V6.js +303 -0
- package/dist/className-hiAsQ9V6.js.map +1 -0
- package/dist/combine-D0AXSTn-.js +1279 -0
- package/dist/combine-D0AXSTn-.js.map +1 -0
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-CE0ZgkdH.mjs → compiler-CCvRlaq0.mjs} +1467 -534
- package/dist/compiler-CCvRlaq0.mjs.map +1 -0
- package/dist/config-B-KbXpIh.js +6 -0
- package/dist/{config-oKOjOTWi.js.map → config-B-KbXpIh.js.map} +1 -1
- package/dist/config-B-w6rOe0.js +35 -0
- package/dist/config-B-w6rOe0.js.map +1 -0
- package/dist/{config-lJNLh7eM.js → config-B1WtpYar.js} +2 -2
- package/dist/{config-lJNLh7eM.js.map → config-B1WtpYar.js.map} +1 -1
- package/dist/{config-CduqubI8.js → config-CCMwA9Gm.js} +3 -3
- package/dist/config-CCMwA9Gm.js.map +1 -0
- package/dist/config-DOWSNV8w.js +1 -0
- package/dist/createTransformElement-PCilcudP.js +34 -0
- package/dist/createTransformElement-PCilcudP.js.map +1 -0
- package/dist/css-DirG7Jwu.js +1280 -0
- package/dist/css-DirG7Jwu.js.map +1 -0
- package/dist/css-GtUPEO9U.js.map +1 -1
- package/dist/css-nmclCl2P.js +479 -0
- package/dist/css-nmclCl2P.js.map +1 -0
- package/dist/css-shX7_73D.js +3894 -0
- package/dist/css-shX7_73D.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/{data-D7NFt4JG.js → data-DUvixly5.js} +155 -61
- package/dist/data-DUvixly5.js.map +1 -0
- package/dist/{debug-Cvpo5cVu.js → debug-DJRCBKhM.js} +80 -5
- package/dist/debug-DJRCBKhM.js.map +1 -0
- package/dist/dev/rsc.js +5 -8
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-DdRWa6dJ.js → dev-Cwha8aAp.js} +4 -4
- package/dist/{dev-DdRWa6dJ.js.map → dev-Cwha8aAp.js.map} +1 -1
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +1 -1
- package/dist/dialect/index.js +1 -1
- package/dist/{elementMarker-ng0y3fN0.js → elementMarker-Cb46vtLU.js} +94 -8
- package/dist/elementMarker-Cb46vtLU.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 +10 -8
- 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 +240 -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 -5
- package/dist/entry/prod.js +84 -1229
- 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 +3 -3
- package/dist/entry/rsc-dev/dev.js +5 -10
- package/dist/entry/rsc-dev/dev.js.map +1 -1
- package/dist/entry/rsc-dev/jsx-dev-runtime.js +2 -2
- package/dist/entry/rsc-dev/jsx-runtime.js +2 -2
- package/dist/entry/rsc-dev.js +252 -750
- 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 -5
- package/dist/entry/rsc-prod.js +236 -11
- package/dist/entry/rsc-prod.js.map +1 -1
- package/dist/{styleStore-CajcAEPO.js → env-0Gu2Jh47.js} +1148 -162
- package/dist/env-0Gu2Jh47.js.map +1 -0
- package/dist/getClassName-CHZKhmde.js +45 -0
- package/dist/getClassName-CHZKhmde.js.map +1 -0
- package/dist/{utils-B_VhPBHH.js → getClassName-CHd0iCXp.js} +28 -65
- package/dist/getClassName-CHd0iCXp.js.map +1 -0
- package/dist/getClassName-a6p2uMFM.js +536 -0
- package/dist/getClassName-a6p2uMFM.js.map +1 -0
- package/dist/{getClassName-CrNVjAoJ.js → getClassName-aD9zqg9U.js} +31 -10
- package/dist/getClassName-aD9zqg9U.js.map +1 -0
- package/dist/global-Dg37z0lV.js +14 -0
- package/dist/global-Dg37z0lV.js.map +1 -0
- package/dist/{hash-BfeJDf5U.js → hash-Cr-LCWDt.js} +35 -38
- package/dist/hash-Cr-LCWDt.js.map +1 -0
- package/dist/index.js +7 -6
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- package/dist/jsx/jsx-dev-runtime.server.js +1 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.server.js +1 -1
- package/dist/jsx-BMFC8_tA.js +39 -0
- package/dist/jsx-BMFC8_tA.js.map +1 -0
- package/dist/{jsx_dev_runtime-aAhNYDeS.js → jsx_dev_runtime-kSrmu6b1.js} +2 -3
- package/dist/{jsx_dev_runtime-aAhNYDeS.js.map → jsx_dev_runtime-kSrmu6b1.js.map} +1 -1
- package/dist/{jsx_runtime-D7Y5up6H.js → jsx_runtime-BgK90E2O.js} +2 -3
- package/dist/{jsx_runtime-D7Y5up6H.js.map → jsx_runtime-BgK90E2O.js.map} +1 -1
- package/dist/{jsx_runtime-C6i1bWlu.js → jsx_runtime-Ch1pZ6-n.js} +2 -2
- package/dist/{jsx_runtime-C6i1bWlu.js.map → jsx_runtime-Ch1pZ6-n.js.map} +1 -1
- package/dist/{loader-BmYS_Rju.mjs → loader-hNaefW-U.mjs} +13 -14
- package/dist/loader-hNaefW-U.mjs.map +1 -0
- package/dist/{misc-BIS_c7BJ.mjs → misc-1OS0aeY1.mjs} +4 -4
- package/dist/misc-1OS0aeY1.mjs.map +1 -0
- package/dist/{namedTokens-CN_yhhik.js → namedTokens-mgRfd9hs.js} +3 -3
- package/dist/{namedTokens-CN_yhhik.js.map → namedTokens-mgRfd9hs.js.map} +1 -1
- package/dist/plugin/farm/index.mjs +4 -3
- package/dist/plugin/farm/index.mjs.map +1 -1
- package/dist/plugin/nextjs/index.mjs +121 -17
- package/dist/plugin/nextjs/index.mjs.map +1 -1
- package/dist/plugin/nextjs/loader.mjs +4 -4
- package/dist/plugin/parcel/index.cjs +2 -0
- package/dist/plugin/parcel/index.mjs +3 -1
- package/dist/plugin/parcel/optimizer.cjs +1 -1
- package/dist/plugin/parcel/optimizer.mjs +2 -2
- package/dist/plugin/parcel/resolver.cjs +1 -1
- package/dist/plugin/parcel/resolver.mjs +2 -2
- package/dist/plugin/parcel/runtime.cjs +1 -1
- package/dist/plugin/parcel/runtime.mjs +1 -1
- package/dist/plugin/parcel/transformer.cjs +1 -1
- package/dist/plugin/parcel/transformer.mjs +2 -2
- package/dist/plugin/rspack/index.mjs +3 -2
- package/dist/plugin/rspack/index.mjs.map +1 -1
- package/dist/plugin/vite/index.mjs +6 -6
- 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 +26 -5
- 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-IaXmLQzA.mjs → registry-OA0niXJL.mjs} +2 -2
- package/dist/{registry-IaXmLQzA.mjs.map → registry-OA0niXJL.mjs.map} +1 -1
- package/dist/resolveClassNameRuntime-BKXT1bmR.js +63 -0
- package/dist/resolveClassNameRuntime-BKXT1bmR.js.map +1 -0
- package/dist/{rules-CxVzovt-.js → rules-DgcCENkw.js} +583 -154
- package/dist/rules-DgcCENkw.js.map +1 -0
- package/dist/{combine-C9vjpKCs.js → scope-BSuRLice.js} +239 -150
- package/dist/scope-BSuRLice.js.map +1 -0
- package/dist/selector/index.js +1 -2
- package/dist/server.js +12 -9
- package/dist/server.js.map +1 -1
- package/dist/{shared-CaJuvw03.cjs → shared-Bc9RwNNj.cjs} +1473 -535
- package/dist/shared-Bc9RwNNj.cjs.map +1 -0
- package/dist/{shared-DdPTZ0O3.mjs → shared-COiLPdZ1.mjs} +4 -4
- package/dist/{shared-DdPTZ0O3.mjs.map → shared-COiLPdZ1.mjs.map} +1 -1
- package/dist/sheet-B87QCFWF.js +7 -0
- package/dist/{sheet-BWBzuy4D.js.map → sheet-B87QCFWF.js.map} +1 -1
- package/dist/{sidecar-B3oCK9vC.mjs → sidecar-ViZUL9B8.mjs} +3 -3
- package/dist/{sidecar-B3oCK9vC.mjs.map → sidecar-ViZUL9B8.mjs.map} +1 -1
- package/dist/{styleStore-0fARJlZV.js → styleStore-BlC8Ax9f.js} +3 -4
- package/dist/{styleStore-0fARJlZV.js.map → styleStore-BlC8Ax9f.js.map} +1 -1
- package/dist/styleStore-DHzH25A7.js +51 -0
- package/dist/styleStore-DHzH25A7.js.map +1 -0
- package/dist/{token-D-S-4_mN.js → token-CAQWMtan.js} +2 -2
- package/dist/{token-D-S-4_mN.js.map → token-CAQWMtan.js.map} +1 -1
- package/dist/{trace-CFnhyCVf.js → trace-D3yBmJad.js} +2 -2
- package/dist/{trace-CFnhyCVf.js.map → trace-D3yBmJad.js.map} +1 -1
- package/dist/{trace-ZtgeY-8s.js → trace-DdXWjgAD.js} +3 -3
- package/dist/{trace-ZtgeY-8s.js.map → trace-DdXWjgAD.js.map} +1 -1
- package/dist/{style-CGaJndOl.js → types-BhdAXX7z.js} +268 -89
- package/dist/types-BhdAXX7z.js.map +1 -0
- package/dist/utils-B6HVRX10.js +42 -0
- package/dist/utils-B6HVRX10.js.map +1 -0
- package/dist/{utils-B5Xqf1lV.mjs → utils-C7UalRKf.mjs} +41 -7
- package/dist/utils-C7UalRKf.mjs.map +1 -0
- package/dist/utils-CUl1BU40.js +72 -0
- package/dist/utils-CUl1BU40.js.map +1 -0
- package/dist/{utils-DzydRwYo.js → utils-Cd4wqN56.js} +142 -149
- package/dist/utils-Cd4wqN56.js.map +1 -0
- package/dist/{utils-DaAiEEIG.mjs → utils-DjxH0zc7.mjs} +3 -3
- package/dist/{utils-DaAiEEIG.mjs.map → utils-DjxH0zc7.mjs.map} +1 -1
- package/dist/utils-DxCpyV2E.js +62 -0
- package/dist/utils-DxCpyV2E.js.map +1 -0
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/dist/value-CpJpQ00y.js +145 -0
- package/dist/value-CpJpQ00y.js.map +1 -0
- package/dist/{webpack-CHydnRXB.mjs → webpack-6et2ZVI6.mjs} +5 -5
- package/dist/webpack-6et2ZVI6.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/prod/adapter/preact.ts +8 -0
- package/entry/prod/adapter/react.ts +8 -0
- package/entry/prod/adapter/solid.ts +8 -0
- 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_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/shared/config_dev.ts +1 -1
- package/jsx/types/index.ts +3 -0
- package/jsx/types/preact.ts +14 -0
- package/jsx/{types.ts → types/react.ts} +2 -2
- package/jsx/types/solid.ts +32 -0
- package/package.json +98 -22
- package/plugin/bundler/farm/plugin.ts +2 -0
- package/plugin/bundler/parcel/plugin.ts +2 -0
- package/plugin/bundler/rspack/plugin.ts +1 -0
- package/plugin/bundler/vite/plugin.ts +3 -8
- package/plugin/bundler/vite/state.ts +2 -2
- package/plugin/bundler/webpack/plugin.ts +2 -1
- package/plugin/bundler/webpack/shared/loader.ts +9 -7
- package/plugin/nextjs/plugin.ts +208 -15
- package/plugin/nextjs/types.ts +1 -2
- package/plugin/nextjs/utils.ts +50 -0
- package/plugin/utils/compiler.ts +2 -0
- package/plugin/utils/runtimeEntry.ts +2 -2
- package/presets/tailwind/classname/transform.ts +32 -1
- package/runtime/adapter/utils.ts +120 -0
- package/runtime/core/cache/combine.ts +33 -4
- package/runtime/core/cache/item.ts +31 -12
- package/runtime/core/cache/itemWithResolver.ts +44 -0
- package/runtime/core/cache/prop.ts +7 -6
- package/runtime/core/cache/result.ts +2 -2
- package/runtime/core/cache/stateItem.ts +16 -1
- package/runtime/core/combinedStyle.ts +4 -4
- package/runtime/extract/combineStyle.ts +179 -5
- package/runtime/extract/getClassName.ts +49 -6
- package/runtime/sheet/rule.ts +3 -10
- package/runtime/style/scope.ts +0 -24
- package/runtime/style/style.ts +179 -5
- package/runtime/types.ts +3 -3
- package/style/classname.ts +12 -6
- package/style/important.ts +19 -0
- package/style/index.ts +2 -0
- package/style/style.ts +16 -4
- package/style/types.ts +6 -4
- package/style/utils/expose.ts +4 -3
- package/style/weight.ts +21 -0
- package/dist/assert-BGdigdr5.js.map +0 -1
- package/dist/className-Do2Crx4b.js +0 -143
- package/dist/className-Do2Crx4b.js.map +0 -1
- package/dist/combine-C9vjpKCs.js.map +0 -1
- package/dist/combineStyle-DwAhsOmS.js +0 -26
- package/dist/combineStyle-DwAhsOmS.js.map +0 -1
- package/dist/compiler-CE0ZgkdH.mjs.map +0 -1
- package/dist/config-BE5D5x2N.js +0 -2
- package/dist/config-CduqubI8.js.map +0 -1
- package/dist/config-oKOjOTWi.js +0 -7
- package/dist/css-BewrRz3_.js +0 -243
- package/dist/css-BewrRz3_.js.map +0 -1
- package/dist/css-CiTI58yl.js +0 -1094
- package/dist/css-CiTI58yl.js.map +0 -1
- package/dist/css-Rc7ILf-3.js +0 -236
- package/dist/css-Rc7ILf-3.js.map +0 -1
- package/dist/cssIdent-BsyUXNNk.js +0 -38
- package/dist/cssIdent-BsyUXNNk.js.map +0 -1
- package/dist/cssVar-DGgQ2GIK.js +0 -92
- package/dist/cssVar-DGgQ2GIK.js.map +0 -1
- package/dist/css_extra-DYtS3g6Z.js +0 -8
- package/dist/css_extra-DYtS3g6Z.js.map +0 -1
- package/dist/data-D7NFt4JG.js.map +0 -1
- package/dist/debug-Cvpo5cVu.js.map +0 -1
- package/dist/dev-px0_6TNq.js +0 -81
- package/dist/dev-px0_6TNq.js.map +0 -1
- package/dist/elementMarker-ng0y3fN0.js.map +0 -1
- package/dist/extract-B-Vs88ME.js +0 -3
- package/dist/extract-CM8Fk2eK.js +0 -130
- package/dist/extract-CM8Fk2eK.js.map +0 -1
- package/dist/getClassName-CrNVjAoJ.js.map +0 -1
- package/dist/global-CZBlA9E7.js +0 -14
- package/dist/global-CZBlA9E7.js.map +0 -1
- package/dist/hash-BfeJDf5U.js.map +0 -1
- package/dist/jsx-BY1iFewe.js +0 -39
- package/dist/jsx-BY1iFewe.js.map +0 -1
- package/dist/jsx-DL-DEAz8.js +0 -39
- package/dist/jsx-DL-DEAz8.js.map +0 -1
- package/dist/layer-BSxAr-hy.js +0 -94
- package/dist/layer-BSxAr-hy.js.map +0 -1
- package/dist/loader-BmYS_Rju.mjs.map +0 -1
- package/dist/misc-BIS_c7BJ.mjs.map +0 -1
- package/dist/presets-BhXa232U.js +0 -108
- package/dist/presets-BhXa232U.js.map +0 -1
- package/dist/property-BuLbzviK.js +0 -406
- package/dist/property-BuLbzviK.js.map +0 -1
- package/dist/rules-CxVzovt-.js.map +0 -1
- package/dist/selector-A-mRmMnI.js +0 -64
- package/dist/selector-A-mRmMnI.js.map +0 -1
- package/dist/shared-CaJuvw03.cjs.map +0 -1
- package/dist/sheet-BWBzuy4D.js +0 -7
- package/dist/style-CGaJndOl.js.map +0 -1
- package/dist/style-DDxjKdX0.js +0 -1891
- package/dist/style-DDxjKdX0.js.map +0 -1
- package/dist/style-S7LTQbRu.js +0 -5
- package/dist/styleStore-CajcAEPO.js.map +0 -1
- package/dist/symbols-Cp4ymzKF.js +0 -14
- package/dist/symbols-Cp4ymzKF.js.map +0 -1
- package/dist/utils-B5Xqf1lV.mjs.map +0 -1
- package/dist/utils-B_VhPBHH.js.map +0 -1
- package/dist/utils-CDUaX81o.js +0 -170
- package/dist/utils-CDUaX81o.js.map +0 -1
- package/dist/utils-DzydRwYo.js.map +0 -1
- package/dist/value-C0JRsyax.js +0 -64
- package/dist/value-C0JRsyax.js.map +0 -1
- package/dist/value-D08AocUs.js +0 -1053
- package/dist/value-D08AocUs.js.map +0 -1
- package/dist/valueRef-M3E1oza7.js +0 -16
- package/dist/valueRef-M3E1oza7.js.map +0 -1
- package/dist/webpack-CHydnRXB.mjs.map +0 -1
- package/dist/withTokens-DAzUIPvA.js +0 -95
- package/dist/withTokens-DAzUIPvA.js.map +0 -1
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
import { $ as isSelectorData, B as isStyleTokenData, Et as getDebugCallsite, Gt as normalizePropertyName, Ht as getIdentifierSafeHash, Jt as DEV_CONFIG, Kt as sanitizeDebugPropertyName, L as getStyleTokenId, Nt as traceCallsite, Ot as getDebugFieldCallsite, Pt as traceError, Ut as createNameFormatter, V as isStyleTokenOverrideData, Vt as LayerDefaultLayers, Wt as normalizeDebugKeywordValue, X as getSelectorSelectors, Z as isScopeData, a as insertRuntimeThemeRule, at as BUILDER_CALLSITE, c as shouldAppendCssPx, ct as BUILDER_SELECTOR, d as hasSheetSelectorAnchor, dn as symbol, dt as BUILDER_TYPE, en as hashString, et as isSelectorOverrideData, f as getCssPropertyName, g as getCssVarRawFallback, h as getTokenVar, i as walkStylePropItemsSheetRules, in as CSS_CONFIG, it as isStyleData, kt as getDebugFieldVarName, l as getSelectorHash, lt as BUILDER_SLOT_ID, mt as createElementMarkerClassName, n as isServerRSC, nt as isSlotData, ot as BUILDER_SCOPE, rt as isSlotOverrideData, s as getCssPropertyValue, sn as RUNTIME_CONFIG, st as BUILDER_SCOPE_ID, tn as DEBUG_CONFIG, u as getSelectorText$1, un as globalData, ut as BUILDER_STATE, yt as splitElementMarkerStyleProp } from "./env-0Gu2Jh47.js";
|
|
2
|
+
import { t as resolveClassNameRuntime } from "./resolveClassNameRuntime-BKXT1bmR.js";
|
|
3
|
+
import { n as CSS_EXTRA_CONFIG, t as getGlobalSheet } from "./global-Dg37z0lV.js";
|
|
4
|
+
import { t as createTransformElement } from "./createTransformElement-PCilcudP.js";
|
|
5
|
+
//#region builder/data/create.ts
|
|
6
|
+
function createStyleData(callsite) {
|
|
7
|
+
return {
|
|
8
|
+
[BUILDER_TYPE]: 1,
|
|
9
|
+
[BUILDER_STATE]: {
|
|
10
|
+
items: [],
|
|
11
|
+
lookup: {}
|
|
12
|
+
},
|
|
13
|
+
[BUILDER_CALLSITE]: callsite
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createSheetData(callsite) {
|
|
17
|
+
return {
|
|
18
|
+
[BUILDER_TYPE]: 9,
|
|
19
|
+
[BUILDER_STATE]: {
|
|
20
|
+
items: [],
|
|
21
|
+
lookup: {}
|
|
22
|
+
},
|
|
23
|
+
[BUILDER_CALLSITE]: callsite
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function createSlotData(callsite, slotId) {
|
|
27
|
+
return {
|
|
28
|
+
[BUILDER_TYPE]: 2,
|
|
29
|
+
[BUILDER_STATE]: {
|
|
30
|
+
items: [],
|
|
31
|
+
lookup: {}
|
|
32
|
+
},
|
|
33
|
+
[BUILDER_CALLSITE]: callsite,
|
|
34
|
+
[BUILDER_SLOT_ID]: slotId
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createSlotOverrideData(callsite, slotId) {
|
|
38
|
+
return {
|
|
39
|
+
[BUILDER_TYPE]: 3,
|
|
40
|
+
[BUILDER_STATE]: {
|
|
41
|
+
items: [],
|
|
42
|
+
lookup: {}
|
|
43
|
+
},
|
|
44
|
+
[BUILDER_CALLSITE]: callsite,
|
|
45
|
+
[BUILDER_SLOT_ID]: slotId
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createSelectorOverrideData(callsite, selectors) {
|
|
49
|
+
return {
|
|
50
|
+
[BUILDER_TYPE]: 8,
|
|
51
|
+
[BUILDER_STATE]: {
|
|
52
|
+
items: [],
|
|
53
|
+
lookup: {}
|
|
54
|
+
},
|
|
55
|
+
[BUILDER_CALLSITE]: callsite,
|
|
56
|
+
[BUILDER_SELECTOR]: selectors
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createSelectorData(callsite, selectors) {
|
|
60
|
+
return {
|
|
61
|
+
[BUILDER_TYPE]: 7,
|
|
62
|
+
[BUILDER_STATE]: {
|
|
63
|
+
items: [],
|
|
64
|
+
lookup: {}
|
|
65
|
+
},
|
|
66
|
+
[BUILDER_CALLSITE]: callsite,
|
|
67
|
+
[BUILDER_SELECTOR]: selectors
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function createScopeData(callsite) {
|
|
71
|
+
return {
|
|
72
|
+
[BUILDER_TYPE]: 4,
|
|
73
|
+
[BUILDER_STATE]: {
|
|
74
|
+
items: [],
|
|
75
|
+
lookup: {}
|
|
76
|
+
},
|
|
77
|
+
[BUILDER_CALLSITE]: callsite
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function createScopeTargetData(scope, slot) {
|
|
81
|
+
return {
|
|
82
|
+
[BUILDER_TYPE]: 5,
|
|
83
|
+
[BUILDER_SCOPE]: scope,
|
|
84
|
+
[BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function createThemeData(callsite, id, className, tokens) {
|
|
88
|
+
return {
|
|
89
|
+
[BUILDER_TYPE]: 6,
|
|
90
|
+
[BUILDER_STATE]: {
|
|
91
|
+
items: [],
|
|
92
|
+
lookup: {}
|
|
93
|
+
},
|
|
94
|
+
[BUILDER_CALLSITE]: callsite,
|
|
95
|
+
id,
|
|
96
|
+
className,
|
|
97
|
+
tokens
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const formatClassName = createNameFormatter([
|
|
101
|
+
"atRule",
|
|
102
|
+
"scopeSelector",
|
|
103
|
+
"property",
|
|
104
|
+
"selector",
|
|
105
|
+
"value"
|
|
106
|
+
]);
|
|
107
|
+
const formatTransformClassName = createNameFormatter(["className"]);
|
|
108
|
+
function getDebugClassName(format, hash, info) {
|
|
109
|
+
return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
|
|
110
|
+
}
|
|
111
|
+
function getDebugSheetClassName(format, hash, info) {
|
|
112
|
+
return formatClassName(format || "sheet-(property)[-(value)]--$hash", hash, info);
|
|
113
|
+
}
|
|
114
|
+
function getDebugTransformClassName(format, hash, info) {
|
|
115
|
+
return formatTransformClassName(format || "(className)--$hash", hash, info);
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region atomic/debug/value.ts
|
|
119
|
+
function getDebugValueName(value) {
|
|
120
|
+
if (!value) return {
|
|
121
|
+
value: null,
|
|
122
|
+
arbitraryValue: null
|
|
123
|
+
};
|
|
124
|
+
const normalized = value.trim().toLowerCase();
|
|
125
|
+
if (!normalized) return {
|
|
126
|
+
value: null,
|
|
127
|
+
arbitraryValue: null
|
|
128
|
+
};
|
|
129
|
+
if (normalized.startsWith("url") || normalized.includes("gradient") || normalized.startsWith("image") || normalized.startsWith("calc(") || normalized.startsWith("var(") || normalized.startsWith("env(") || normalized.startsWith("rgb") || normalized.startsWith("hsl")) return {
|
|
130
|
+
value: null,
|
|
131
|
+
arbitraryValue: null
|
|
132
|
+
};
|
|
133
|
+
if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
|
|
134
|
+
value: normalized,
|
|
135
|
+
arbitraryValue: null
|
|
136
|
+
};
|
|
137
|
+
const name = normalized.replace(/px/g, "").replace(/rem/g, "rem").replace(/em/g, "em").replace(/%/g, "pct").replace(/fr/g, "fr").replace(/[,()"'#]/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9._%-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
138
|
+
if (!name) return {
|
|
139
|
+
value: null,
|
|
140
|
+
arbitraryValue: null
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
value: null,
|
|
144
|
+
arbitraryValue: name
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region atomic/debug/property/data.ts
|
|
149
|
+
const PROPERTY_ALIASES = {
|
|
150
|
+
"border-radius": "radius",
|
|
151
|
+
"flex-direction": "flex",
|
|
152
|
+
"font-style": "font",
|
|
153
|
+
"font-weight": "font",
|
|
154
|
+
"grid-template-columns": "grid-cols",
|
|
155
|
+
"grid-template-rows": "grid-rows",
|
|
156
|
+
"align-items": "items",
|
|
157
|
+
"justify-content": "justify",
|
|
158
|
+
"z-index": "zindex",
|
|
159
|
+
"pointer-events": "pointer"
|
|
160
|
+
};
|
|
161
|
+
const KEYWORD_VALUE_PROPERTIES = new Set([
|
|
162
|
+
"align-content",
|
|
163
|
+
"align-items",
|
|
164
|
+
"align-self",
|
|
165
|
+
"background-repeat",
|
|
166
|
+
"background-size",
|
|
167
|
+
"border-collapse",
|
|
168
|
+
"border-style",
|
|
169
|
+
"box-sizing",
|
|
170
|
+
"clear",
|
|
171
|
+
"cursor",
|
|
172
|
+
"display",
|
|
173
|
+
"flex-direction",
|
|
174
|
+
"flex-wrap",
|
|
175
|
+
"float",
|
|
176
|
+
"font-weight",
|
|
177
|
+
"font-style",
|
|
178
|
+
"justify-content",
|
|
179
|
+
"justify-items",
|
|
180
|
+
"justify-self",
|
|
181
|
+
"list-style-position",
|
|
182
|
+
"list-style-type",
|
|
183
|
+
"object-fit",
|
|
184
|
+
"object-position",
|
|
185
|
+
"overflow",
|
|
186
|
+
"overflow-x",
|
|
187
|
+
"overflow-y",
|
|
188
|
+
"pointer-events",
|
|
189
|
+
"place-content",
|
|
190
|
+
"place-items",
|
|
191
|
+
"place-self",
|
|
192
|
+
"position",
|
|
193
|
+
"resize",
|
|
194
|
+
"table-layout",
|
|
195
|
+
"text-align",
|
|
196
|
+
"text-decoration-line",
|
|
197
|
+
"text-transform",
|
|
198
|
+
"user-select",
|
|
199
|
+
"vertical-align",
|
|
200
|
+
"visibility",
|
|
201
|
+
"white-space"
|
|
202
|
+
]);
|
|
203
|
+
const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region atomic/debug/property/property.ts
|
|
206
|
+
function getDebugPropertyName(property, value) {
|
|
207
|
+
if (!property) return null;
|
|
208
|
+
const normalized = normalizePropertyName(property);
|
|
209
|
+
const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
|
|
210
|
+
if (!name) return null;
|
|
211
|
+
return {
|
|
212
|
+
property: name,
|
|
213
|
+
...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function withArbitraryValueFallback(property, valueName) {
|
|
217
|
+
if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
|
|
218
|
+
return {
|
|
219
|
+
value: valueName.value,
|
|
220
|
+
arbitraryValue: null
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function withKeywordValueFallback(property, value, valueName) {
|
|
224
|
+
if (valueName.value || valueName.arbitraryValue) return valueName;
|
|
225
|
+
if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
|
|
226
|
+
const normalized = normalizeDebugKeywordValue(value);
|
|
227
|
+
if (!normalized) return valueName;
|
|
228
|
+
return {
|
|
229
|
+
value: normalized,
|
|
230
|
+
arbitraryValue: null
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region atomic/debug/selector.ts
|
|
235
|
+
function getDebugSelectorName(selector) {
|
|
236
|
+
if (!selector) return null;
|
|
237
|
+
const normalized = selector.trim().toLowerCase();
|
|
238
|
+
if (/^[a-z0-9]+$/.test(normalized)) return null;
|
|
239
|
+
return validateName(normalized.replace(/\$\$/g, "args").replace(/\$/g, "arg").replace(/\.\.\./g, "merge").replace(/:not\(/g, "not-").replace(/:(is|where|has)\(/g, "$1-").replace(/:nth-(child|of-type)\(/g, "nth-").replace(/[.#]/g, "-").replace(/[[\]()]/g, "-").replace(/:+/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
240
|
+
}
|
|
241
|
+
function getDebugAtRuleName(selector) {
|
|
242
|
+
if (!selector || Array.isArray(selector) && selector.length === 0) return null;
|
|
243
|
+
return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
244
|
+
}
|
|
245
|
+
function compressQuery(query) {
|
|
246
|
+
return query.trim().toLowerCase().replace(/prefers-color-scheme\s*:\s*dark/g, "dark").replace(/prefers-color-scheme\s*:\s*light/g, "light").replace(/min-width\s*:\s*/g, "min-").replace(/max-width\s*:\s*/g, "max-").replace(/min-height\s*:\s*/g, "minh-").replace(/max-height\s*:\s*/g, "maxh-").replace(/inline-size/g, "inline").replace(/\b(and|or|only|not)\b/g, "").replace(/>=/g, "-gte-").replace(/<=/g, "-lte-").replace(/>/g, "-gt-").replace(/</g, "-lt-").replace(/[():=\s]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
247
|
+
}
|
|
248
|
+
function validateName(name) {
|
|
249
|
+
if (!name || name === "selector" || name.length < 2) return null;
|
|
250
|
+
return name;
|
|
251
|
+
}
|
|
252
|
+
function parseAtRule(rule) {
|
|
253
|
+
const normalized = rule.trim().toLowerCase();
|
|
254
|
+
if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
|
|
255
|
+
if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
|
|
256
|
+
if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
|
|
257
|
+
return compressQuery(normalized);
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region atomic/className.ts
|
|
261
|
+
function getAtomicClassName(property, priority, important, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, sheetClassNameFormat = null, hashLength = null) {
|
|
262
|
+
let hash = property;
|
|
263
|
+
hash += "\n" + (priority || "");
|
|
264
|
+
if (important) hash += "\nimportant";
|
|
265
|
+
hash += "\n" + value;
|
|
266
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
267
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
268
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
269
|
+
hash += "\n" + getCallsiteHash(callsite, localClassName);
|
|
270
|
+
hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
|
|
271
|
+
if (!debugClassName) return hash;
|
|
272
|
+
if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
|
|
273
|
+
const propertyName = getDebugPropertyName(property, value);
|
|
274
|
+
const isSheetClassName = hasSheetSelectorAnchor(selector);
|
|
275
|
+
return (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(isSheetClassName ? sheetClassNameFormat : classNameFormat, hash, {
|
|
276
|
+
atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText$1)) : null,
|
|
277
|
+
scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText$1(parentSelector)) : null,
|
|
278
|
+
selector: selector ? getDebugSelectorName(getSelectorText$1(selector)) : null,
|
|
279
|
+
property: propertyName ? propertyName.property : property,
|
|
280
|
+
value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function getRuntimeClassNameHashLength(debugClassName) {
|
|
284
|
+
return getClassNameHashLength({
|
|
285
|
+
debugClassName,
|
|
286
|
+
isDev: DEV_CONFIG.isDev,
|
|
287
|
+
devHashLength: DEV_CONFIG.hashLength,
|
|
288
|
+
cssHashLength: CSS_CONFIG.hashLength
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function getClassNameHashLength(options) {
|
|
292
|
+
if (options.debugClassName && options.isDev) return options.devHashLength ?? options.cssHashLength ?? 3;
|
|
293
|
+
return options.cssHashLength ?? 7;
|
|
294
|
+
}
|
|
295
|
+
function getClassNameDedupe(property, priority, important, selector, parentSelector, atRule) {
|
|
296
|
+
let hash = property;
|
|
297
|
+
hash += "\n" + (priority || "");
|
|
298
|
+
if (important) hash += "\nimportant";
|
|
299
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
300
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
301
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
302
|
+
return hashString(hash);
|
|
303
|
+
}
|
|
304
|
+
function getCallsiteHash(callsite, localClassName) {
|
|
305
|
+
if (!localClassName || !callsite) return "";
|
|
306
|
+
return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region builder/data/merge/utils.ts
|
|
310
|
+
function cloneData(data, source, debug, merge = true) {
|
|
311
|
+
const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
|
|
312
|
+
const state = data[BUILDER_STATE];
|
|
313
|
+
state.items = merge ? source[BUILDER_STATE].items.slice() : [];
|
|
314
|
+
state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
|
|
315
|
+
const lookup = state.lookup;
|
|
316
|
+
return [
|
|
317
|
+
runtimeType,
|
|
318
|
+
data,
|
|
319
|
+
state.items,
|
|
320
|
+
lookup
|
|
321
|
+
];
|
|
322
|
+
}
|
|
323
|
+
function logInvalidData(message, data) {
|
|
324
|
+
console.log(traceError(message), "data:", data);
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region builder/data/merge/scope.ts
|
|
328
|
+
function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
|
|
329
|
+
if (!items) return scope;
|
|
330
|
+
const sourceItems = Array.isArray(items) ? items : [items];
|
|
331
|
+
const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
|
|
332
|
+
let source;
|
|
333
|
+
let item;
|
|
334
|
+
let lookupIndex;
|
|
335
|
+
let weight;
|
|
336
|
+
let important;
|
|
337
|
+
let value;
|
|
338
|
+
let atRule;
|
|
339
|
+
let dedupe;
|
|
340
|
+
let className;
|
|
341
|
+
let itemDebug;
|
|
342
|
+
let itemCallsite;
|
|
343
|
+
for (let i = 0, len = sourceItems.length; i < len; i++) {
|
|
344
|
+
source = sourceItems[i];
|
|
345
|
+
if (!source) continue;
|
|
346
|
+
if (isStyleTokenOverrideData(source)) {
|
|
347
|
+
addTokenOverride(source, styles, lookup);
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (isScopeData(source)) {
|
|
351
|
+
const scopeItems = source[BUILDER_STATE].items;
|
|
352
|
+
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
353
|
+
item = scopeItems[j];
|
|
354
|
+
if (isStyleTokenOverrideData(item)) {
|
|
355
|
+
addTokenOverride(item, styles, lookup);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (Array.isArray(item) || item.type !== 4) {
|
|
359
|
+
logInvalidData("invalid scope data", {
|
|
360
|
+
source,
|
|
361
|
+
item
|
|
362
|
+
});
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const sourceScopeItem = item;
|
|
366
|
+
atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
|
|
367
|
+
const scopeItem = {
|
|
368
|
+
...sourceScopeItem,
|
|
369
|
+
runtime: runtimeType,
|
|
370
|
+
atRule,
|
|
371
|
+
parentSelector: parentSelector ?? sourceScopeItem.parentSelector
|
|
372
|
+
};
|
|
373
|
+
itemDebug = getMergedScopeDebug(debug, scopeItem);
|
|
374
|
+
itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
|
|
375
|
+
value = scopeItem.value;
|
|
376
|
+
weight = scopeItem.weight;
|
|
377
|
+
important = scopeItem.important;
|
|
378
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
|
|
379
|
+
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, itemCallsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
380
|
+
scopeItem.dedupe = dedupe;
|
|
381
|
+
scopeItem.className = className;
|
|
382
|
+
scopeItem.callsite = itemCallsite;
|
|
383
|
+
scopeItem.debug = itemDebug ?? null;
|
|
384
|
+
scopeItem.debugField = itemDebug ? scopeItem.property : null;
|
|
385
|
+
const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
|
|
386
|
+
lookupIndex = lookup[lookupKey];
|
|
387
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
388
|
+
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
389
|
+
}
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (!isSlotOverrideData(source)) {
|
|
393
|
+
logInvalidData("invalid scope data", { source });
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
const slotId = source[BUILDER_SLOT_ID];
|
|
397
|
+
const overrideItems = source[BUILDER_STATE].items;
|
|
398
|
+
for (let j = 0, len = overrideItems.length; j < len; j++) {
|
|
399
|
+
item = overrideItems[j];
|
|
400
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
|
|
401
|
+
logInvalidData("invalid scope data", {
|
|
402
|
+
source,
|
|
403
|
+
item
|
|
404
|
+
});
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
const overrideItem = item;
|
|
408
|
+
atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
|
|
409
|
+
const scopeItem = {
|
|
410
|
+
type: 4,
|
|
411
|
+
slotId,
|
|
412
|
+
runtime: runtimeType,
|
|
413
|
+
dedupe: "",
|
|
414
|
+
className: "",
|
|
415
|
+
property: overrideItem.property,
|
|
416
|
+
weight: overrideItem.weight,
|
|
417
|
+
important: overrideItem.important,
|
|
418
|
+
value: overrideItem.value,
|
|
419
|
+
transformClassName: overrideItem.transformClassName,
|
|
420
|
+
token: overrideItem.token,
|
|
421
|
+
selector: overrideItem.selector,
|
|
422
|
+
atRule,
|
|
423
|
+
callsite: overrideItem.callsite ?? callsite,
|
|
424
|
+
debug: overrideItem.debug,
|
|
425
|
+
debugField: overrideItem.debugField,
|
|
426
|
+
parentSelector
|
|
427
|
+
};
|
|
428
|
+
value = scopeItem.value;
|
|
429
|
+
weight = scopeItem.weight;
|
|
430
|
+
important = scopeItem.important;
|
|
431
|
+
dedupe = getClassNameDedupe(scopeItem.property, weight, important, scopeItem.selector, parentSelector, scopeItem.atRule);
|
|
432
|
+
className = getAtomicClassName(scopeItem.property, weight, important, value, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
433
|
+
scopeItem.dedupe = dedupe;
|
|
434
|
+
scopeItem.className = className;
|
|
435
|
+
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
436
|
+
lookupIndex = lookup[lookupKey];
|
|
437
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
438
|
+
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return data;
|
|
442
|
+
}
|
|
443
|
+
function addTokenOverride(item, styles, lookup) {
|
|
444
|
+
const lookupKey = getTokenLookupKey(getStyleTokenId(item));
|
|
445
|
+
const lookupIndex = lookup[lookupKey];
|
|
446
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = item;
|
|
447
|
+
else lookup[lookupKey] = styles.push(item) - 1;
|
|
448
|
+
}
|
|
449
|
+
function getMergedScopeDebug(debug, item) {
|
|
450
|
+
if (!debug) return item.debug;
|
|
451
|
+
if (debug.fields?.[item.property]) return debug;
|
|
452
|
+
const valueLoc = getRuntimeScopeItemValueLoc(item);
|
|
453
|
+
if (!valueLoc) return debug;
|
|
454
|
+
return {
|
|
455
|
+
...debug,
|
|
456
|
+
fields: {
|
|
457
|
+
...debug.fields,
|
|
458
|
+
[item.property]: {
|
|
459
|
+
[0]: debug.loc,
|
|
460
|
+
[1]: valueLoc
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function getRuntimeScopeItemValueLoc(item) {
|
|
466
|
+
if (item.debug && item.debugField) {
|
|
467
|
+
const loc = item.debug.fields?.[item.debugField];
|
|
468
|
+
if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
|
|
469
|
+
if (loc) {
|
|
470
|
+
const valueLoc = loc[1] ?? loc[0] ?? null;
|
|
471
|
+
return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return item.callsite ? [
|
|
475
|
+
item.callsite.line,
|
|
476
|
+
item.callsite.column,
|
|
477
|
+
void 0,
|
|
478
|
+
item.callsite.sourceUrl,
|
|
479
|
+
item.callsite.sourceContent
|
|
480
|
+
] : null;
|
|
481
|
+
}
|
|
482
|
+
function withDebugSource$1(loc, sourceUrl, sourceContent) {
|
|
483
|
+
return loc[3] ? loc : [
|
|
484
|
+
loc[0],
|
|
485
|
+
loc[1],
|
|
486
|
+
loc[2],
|
|
487
|
+
sourceUrl,
|
|
488
|
+
sourceContent
|
|
489
|
+
];
|
|
490
|
+
}
|
|
491
|
+
function getScopeLookupKey(slotId, dedupe) {
|
|
492
|
+
return slotId + "\0" + dedupe;
|
|
493
|
+
}
|
|
494
|
+
function getTokenLookupKey(tokenId) {
|
|
495
|
+
return "token\0" + tokenId;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region style/important.ts
|
|
499
|
+
const STYLE_IMPORTANT = symbol("style.important");
|
|
500
|
+
function importantValue(value) {
|
|
501
|
+
return {
|
|
502
|
+
[STYLE_IMPORTANT]: true,
|
|
503
|
+
value
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function isStyleImportantValue(value) {
|
|
507
|
+
return !!value && typeof value === "object" && value[STYLE_IMPORTANT] === true;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region style/transform.ts
|
|
511
|
+
const CLASS_NAME_VALUE = symbol("transform.classNameValue");
|
|
512
|
+
function classNameValue(value, className) {
|
|
513
|
+
return {
|
|
514
|
+
[CLASS_NAME_VALUE]: true,
|
|
515
|
+
value,
|
|
516
|
+
className
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function isClassNameValue(value) {
|
|
520
|
+
return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
|
|
521
|
+
}
|
|
522
|
+
function styleTransform(options) {
|
|
523
|
+
return options;
|
|
524
|
+
}
|
|
525
|
+
function classNameTransform(options) {
|
|
526
|
+
return options;
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region style/valueRef.ts
|
|
530
|
+
const AT_RULE_REF = symbol("atRule.ref");
|
|
531
|
+
function createAtRuleRef(data) {
|
|
532
|
+
return {
|
|
533
|
+
[AT_RULE_REF]: true,
|
|
534
|
+
...data
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function isAtRuleRef(value) {
|
|
538
|
+
return !!value && typeof value === "object" && value[AT_RULE_REF] === true;
|
|
539
|
+
}
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region style/weight.ts
|
|
542
|
+
const STYLE_WEIGHT = symbol("style.weight");
|
|
543
|
+
function weightValue(value, weight) {
|
|
544
|
+
return {
|
|
545
|
+
[STYLE_WEIGHT]: true,
|
|
546
|
+
value,
|
|
547
|
+
weight
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function isStyleWeightValue(value) {
|
|
551
|
+
return !!value && typeof value === "object" && value[STYLE_WEIGHT] === true;
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region builder/data/merge/style.ts
|
|
555
|
+
function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
|
|
556
|
+
if (!style) return source;
|
|
557
|
+
const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
|
|
558
|
+
const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
|
|
559
|
+
const items = [];
|
|
560
|
+
let item;
|
|
561
|
+
let itemData;
|
|
562
|
+
let valueRaw;
|
|
563
|
+
let value;
|
|
564
|
+
let weight;
|
|
565
|
+
let important;
|
|
566
|
+
let itemCallsite;
|
|
567
|
+
let className;
|
|
568
|
+
let dedupe;
|
|
569
|
+
let token;
|
|
570
|
+
let ref;
|
|
571
|
+
let variableName;
|
|
572
|
+
let transformClassName;
|
|
573
|
+
let lookupIndex;
|
|
574
|
+
if (isStyleData(style)) {
|
|
575
|
+
const stylesItems = style[BUILDER_STATE].items;
|
|
576
|
+
for (let i = 0, len = stylesItems.length; i < len; i++) {
|
|
577
|
+
item = stylesItems[i];
|
|
578
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
|
|
579
|
+
logInvalidData("invalid style data", {
|
|
580
|
+
item,
|
|
581
|
+
style
|
|
582
|
+
});
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
|
|
586
|
+
if (selector) item = Object.assign({}, item, { selector: item.selector ? combineSelectors(selector, item.selector) : selector });
|
|
587
|
+
if (type === 2 && slotId !== null) item = Object.assign({}, item, {
|
|
588
|
+
type: 2,
|
|
589
|
+
slotId
|
|
590
|
+
});
|
|
591
|
+
else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
|
|
592
|
+
type: 3,
|
|
593
|
+
slotId
|
|
594
|
+
});
|
|
595
|
+
else if (type === 8) item = Object.assign({}, item, { type: 1 });
|
|
596
|
+
const itemDebug = getMergedStyleDebug(debug, item);
|
|
597
|
+
const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
|
|
598
|
+
if (debugCallsite) item = Object.assign({}, item, {
|
|
599
|
+
callsite: debugCallsite,
|
|
600
|
+
debug: itemDebug,
|
|
601
|
+
debugField: item.property
|
|
602
|
+
});
|
|
603
|
+
items.push(item);
|
|
604
|
+
}
|
|
605
|
+
} else for (const property in style) {
|
|
606
|
+
valueRaw = style[property];
|
|
607
|
+
[valueRaw, weight, important] = unwrapAuthoredStyleValue(valueRaw);
|
|
608
|
+
transformClassName = null;
|
|
609
|
+
if (isClassNameValue(valueRaw)) {
|
|
610
|
+
transformClassName = valueRaw.className;
|
|
611
|
+
valueRaw = valueRaw.value;
|
|
612
|
+
}
|
|
613
|
+
ref = isAtRuleRef(valueRaw) ? valueRaw : null;
|
|
614
|
+
if (ref) valueRaw = ref.value;
|
|
615
|
+
token = isStyleTokenData(valueRaw) ? valueRaw : null;
|
|
616
|
+
variableName = getDebugFieldVarName(debug, property);
|
|
617
|
+
value = variableName && token ? getCssVarRawFallback(variableName, getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null)) : token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
|
|
618
|
+
itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
|
|
619
|
+
itemData = {
|
|
620
|
+
runtime: runtimeType,
|
|
621
|
+
debug,
|
|
622
|
+
debugField: property,
|
|
623
|
+
dedupe: "",
|
|
624
|
+
className: "",
|
|
625
|
+
property,
|
|
626
|
+
weight,
|
|
627
|
+
important,
|
|
628
|
+
value,
|
|
629
|
+
transformClassName,
|
|
630
|
+
variable: ref ? [3, ref] : variableName && token ? [
|
|
631
|
+
1,
|
|
632
|
+
variableName,
|
|
633
|
+
valueRaw,
|
|
634
|
+
shouldAppendCssPx(property) ? 1 : void 0
|
|
635
|
+
] : ref ? [3, ref] : void 0,
|
|
636
|
+
token,
|
|
637
|
+
selector,
|
|
638
|
+
atRule,
|
|
639
|
+
callsite: itemCallsite
|
|
640
|
+
};
|
|
641
|
+
if (type === 1 || type === 8) {
|
|
642
|
+
items.push({
|
|
643
|
+
...itemData,
|
|
644
|
+
type: 1
|
|
645
|
+
});
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
if (slotId === null) {
|
|
649
|
+
logInvalidData("invalid style data", {
|
|
650
|
+
property,
|
|
651
|
+
style
|
|
652
|
+
});
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
if (type === 2) {
|
|
656
|
+
items.push({
|
|
657
|
+
...itemData,
|
|
658
|
+
type: 2,
|
|
659
|
+
slotId
|
|
660
|
+
});
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
if (type === 3) {
|
|
664
|
+
items.push({
|
|
665
|
+
...itemData,
|
|
666
|
+
type: 3,
|
|
667
|
+
slotId
|
|
668
|
+
});
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
logInvalidData("invalid style data", {
|
|
672
|
+
property,
|
|
673
|
+
style
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
if (!items.length) return data;
|
|
677
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
678
|
+
item = items[i];
|
|
679
|
+
if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
|
|
680
|
+
logInvalidData("invalid style data", {
|
|
681
|
+
item,
|
|
682
|
+
style
|
|
683
|
+
});
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
const runtimeItem = item;
|
|
687
|
+
value = runtimeItem.value;
|
|
688
|
+
weight = runtimeItem.weight;
|
|
689
|
+
important = runtimeItem.important;
|
|
690
|
+
dedupe = getClassNameDedupe(runtimeItem.property, weight, important, runtimeItem.selector, null, runtimeItem.atRule);
|
|
691
|
+
className = getAtomicClassName(runtimeItem.property, weight, important, value, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, runtimeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null, CSS_CONFIG.sheetClassNameFormat ?? null);
|
|
692
|
+
runtimeItem.dedupe = dedupe;
|
|
693
|
+
runtimeItem.className = className;
|
|
694
|
+
lookupIndex = lookup[dedupe];
|
|
695
|
+
if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
|
|
696
|
+
else lookup[dedupe] = styles.push(runtimeItem) - 1;
|
|
697
|
+
}
|
|
698
|
+
return data;
|
|
699
|
+
}
|
|
700
|
+
function unwrapAuthoredStyleValue(value) {
|
|
701
|
+
let weight = null;
|
|
702
|
+
let important = false;
|
|
703
|
+
while (true) {
|
|
704
|
+
if (isStyleImportantValue(value)) {
|
|
705
|
+
important = true;
|
|
706
|
+
value = value.value;
|
|
707
|
+
continue;
|
|
708
|
+
}
|
|
709
|
+
if (isStyleWeightValue(value)) {
|
|
710
|
+
weight = value.weight;
|
|
711
|
+
value = value.value;
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
return [
|
|
717
|
+
value,
|
|
718
|
+
weight,
|
|
719
|
+
important
|
|
720
|
+
];
|
|
721
|
+
}
|
|
722
|
+
function combineSelectors(parent, child) {
|
|
723
|
+
const parentText = getSelectorText(parent);
|
|
724
|
+
const childText = getSelectorText(child);
|
|
725
|
+
const priority = Math.max(getSelectorPriority(parent), getSelectorPriority(child));
|
|
726
|
+
const selector = parentText + childText;
|
|
727
|
+
return priority > 0 ? [selector, priority] : selector;
|
|
728
|
+
}
|
|
729
|
+
function getSelectorText(selector) {
|
|
730
|
+
return Array.isArray(selector) ? selector[0] : selector;
|
|
731
|
+
}
|
|
732
|
+
function getSelectorPriority(selector) {
|
|
733
|
+
return Array.isArray(selector) ? selector[1] : 0;
|
|
734
|
+
}
|
|
735
|
+
function getMergedStyleDebug(debug, item) {
|
|
736
|
+
if (!debug) return null;
|
|
737
|
+
if (debug.fields?.[item.property]) return debug;
|
|
738
|
+
const valueLoc = getMergedItemValueLoc(item);
|
|
739
|
+
if (!valueLoc) return debug;
|
|
740
|
+
return {
|
|
741
|
+
...debug,
|
|
742
|
+
fields: {
|
|
743
|
+
...debug.fields,
|
|
744
|
+
[item.property]: {
|
|
745
|
+
[0]: withDebugSource(debug.loc, debug),
|
|
746
|
+
[1]: valueLoc
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
function getMergedItemValueLoc(item) {
|
|
752
|
+
if (item.debug && item.debugField) {
|
|
753
|
+
const loc = item.debug.fields?.[item.debugField];
|
|
754
|
+
if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
|
|
755
|
+
if (loc) {
|
|
756
|
+
const traceLoc = loc[1] ?? loc[0] ?? null;
|
|
757
|
+
return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return item.callsite ? [
|
|
761
|
+
item.callsite.line,
|
|
762
|
+
item.callsite.column,
|
|
763
|
+
void 0,
|
|
764
|
+
item.callsite.sourceUrl,
|
|
765
|
+
item.callsite.sourceContent
|
|
766
|
+
] : null;
|
|
767
|
+
}
|
|
768
|
+
function withDebugSource(loc, debug) {
|
|
769
|
+
return loc[3] ? loc : [
|
|
770
|
+
loc[0],
|
|
771
|
+
loc[1],
|
|
772
|
+
loc[2],
|
|
773
|
+
debug.sourceUrl,
|
|
774
|
+
debug.code
|
|
775
|
+
];
|
|
776
|
+
}
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region builder/data/selector.ts
|
|
779
|
+
const SELECTOR_MEDIA = "@media";
|
|
780
|
+
const SELECTOR_CONTAINER = "@container";
|
|
781
|
+
function normalizeSelectorArg(arg) {
|
|
782
|
+
return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
|
|
783
|
+
}
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region runtime/core/getToken.ts
|
|
786
|
+
function getToken(value) {
|
|
787
|
+
if (isStyleTokenData(value)) return getTokenVar(value, CSS_CONFIG.tokenNameFormat ?? null);
|
|
788
|
+
return value;
|
|
789
|
+
}
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region builder/style_data.ts
|
|
792
|
+
const mergeStyleCreate = (callsite) => {
|
|
793
|
+
return createStyleData(callsite);
|
|
794
|
+
};
|
|
795
|
+
const mergeStyleData = createMerge(mergeStyleCreate, 1);
|
|
796
|
+
const mergeSheetCreate = (callsite) => {
|
|
797
|
+
return createSheetData(callsite);
|
|
798
|
+
};
|
|
799
|
+
const mergeSheetData = createMerge(mergeSheetCreate, 1);
|
|
800
|
+
const mergeSlotCreate = (callsite, data) => {
|
|
801
|
+
return createSlotData(callsite, data[BUILDER_SLOT_ID]);
|
|
802
|
+
};
|
|
803
|
+
const mergeSlotData = createMerge(mergeSlotCreate, 2);
|
|
804
|
+
const mergeSlotOverrideCreate = (callsite, data) => {
|
|
805
|
+
return createSlotOverrideData(callsite, data[BUILDER_SLOT_ID]);
|
|
806
|
+
};
|
|
807
|
+
const mergeSlotOverrideData = createMerge(mergeSlotOverrideCreate, 3);
|
|
808
|
+
const mergeSelectorOverrideCreate = (callsite, data) => {
|
|
809
|
+
return createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]);
|
|
810
|
+
};
|
|
811
|
+
const mergeSelectorOverrideData = createMerge(mergeSelectorOverrideCreate, 8);
|
|
812
|
+
function createMerge(create, type) {
|
|
813
|
+
return (data, callsite, style, debug, selector, atRule) => {
|
|
814
|
+
return mergeBuilderData(create, callsite, data, style, debug, selector, atRule, type);
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region builder/utils.ts
|
|
819
|
+
const FnPrefixStyle = "style.";
|
|
820
|
+
const FnPrefixSlot = "slot.";
|
|
821
|
+
const FnPrefixScope = "scope.";
|
|
822
|
+
const FnPrefixSelector = "selector.";
|
|
823
|
+
function runtimeCallsite() {
|
|
824
|
+
return traceCallsite();
|
|
825
|
+
}
|
|
826
|
+
function resolveCallsite(debug) {
|
|
827
|
+
return debug ? getDebugCallsite(debug) : runtimeCallsite();
|
|
828
|
+
}
|
|
829
|
+
function transformStyle(style, transform) {
|
|
830
|
+
return transform ? transform.transform(style) : style;
|
|
831
|
+
}
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region atomic/atRule/utils.ts
|
|
834
|
+
function createAtRuleNameFormatter(defaultFormat, prefix) {
|
|
835
|
+
const formatter = createNameFormatter(["name"]);
|
|
836
|
+
return (format, id, info) => {
|
|
837
|
+
const hash = getIdentifierSafeHash(id, CSS_CONFIG.hashLength);
|
|
838
|
+
const name = formatter(format || defaultFormat, hash, info);
|
|
839
|
+
if (!prefix) return name;
|
|
840
|
+
return name.startsWith(prefix) ? name : prefix + name;
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
function buildNamedAtRuleCss(atRule, name, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
844
|
+
return `@${atRule} ${name} {${buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true)}}`;
|
|
845
|
+
}
|
|
846
|
+
function buildAtRuleDeclarationCss(style, tokens, tokenLookup, tokenNameFormat, rawValue, shouldInclude) {
|
|
847
|
+
let css = "";
|
|
848
|
+
for (const property in style) {
|
|
849
|
+
if (shouldInclude && !shouldInclude(property)) continue;
|
|
850
|
+
let value = style[property];
|
|
851
|
+
if (Array.isArray(value) && value.length === 2 && typeof value[0] === "number") value = value[1];
|
|
852
|
+
if (isStyleTokenData(value)) {
|
|
853
|
+
const tokenId = getStyleTokenId(value);
|
|
854
|
+
if (!tokenLookup.has(tokenId)) {
|
|
855
|
+
tokenLookup.add(tokenId);
|
|
856
|
+
tokens.push(value);
|
|
857
|
+
}
|
|
858
|
+
css += `${getCssPropertyName(property)}: ${getTokenVar(value, tokenNameFormat)};`;
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
const valueString = String(value ?? "");
|
|
862
|
+
css += `${getCssPropertyName(property)}: ${rawValue ? valueString : getCssPropertyValue(property, valueString)};`;
|
|
863
|
+
}
|
|
864
|
+
return css;
|
|
865
|
+
}
|
|
866
|
+
//#endregion
|
|
867
|
+
//#region atomic/atRule/counterStyle.ts
|
|
868
|
+
const COUNTER_STYLE_AT_RULE = "counter-style";
|
|
869
|
+
const formatCounterStyleName = createAtRuleNameFormatter("counter-style[-(name)]-$hash");
|
|
870
|
+
function buildCounterStyleCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
871
|
+
name = formatCounterStyleName(format, id, { name });
|
|
872
|
+
const css = buildNamedAtRuleCss(COUNTER_STYLE_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
873
|
+
return {
|
|
874
|
+
name,
|
|
875
|
+
css
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region utils/id.ts
|
|
880
|
+
function createIdCounter(name) {
|
|
881
|
+
return globalData("idCounter." + name, () => ({ value: 0 }));
|
|
882
|
+
}
|
|
883
|
+
function getId(idCounter, stableId) {
|
|
884
|
+
return stableId || {
|
|
885
|
+
name: null,
|
|
886
|
+
id: String(idCounter.value++)
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
//#endregion
|
|
890
|
+
//#region css/utils.ts
|
|
891
|
+
function createNamedAtRuleRef(config) {
|
|
892
|
+
const { id, name } = getId(config.idCounter, config.stableId || null);
|
|
893
|
+
const tokens = [];
|
|
894
|
+
const tokenLookup = /* @__PURE__ */ new Set();
|
|
895
|
+
const css = config.buildCss(config.format || null, name, id, config.value, tokens, tokenLookup, CSS_CONFIG.tokenNameFormat || null);
|
|
896
|
+
return createAtRuleRef({
|
|
897
|
+
key: css.name,
|
|
898
|
+
value: css.name,
|
|
899
|
+
css: css.css,
|
|
900
|
+
tokens: tokens.length ? tokens : void 0
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region css/counterStyle.ts
|
|
905
|
+
const idCounter$5 = createIdCounter("counterStyle");
|
|
906
|
+
function createCounterStyle(descriptors, stableId) {
|
|
907
|
+
return createNamedAtRuleRef({
|
|
908
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.counterStyle,
|
|
909
|
+
buildCss: buildCounterStyleCss,
|
|
910
|
+
value: descriptors,
|
|
911
|
+
idCounter: idCounter$5,
|
|
912
|
+
stableId
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region atomic/atRule/fontFace.ts
|
|
917
|
+
const FONT_FACE_AT_RULE = "font-face";
|
|
918
|
+
const formatFontFaceName = createAtRuleNameFormatter("font[-(name)]-$hash");
|
|
919
|
+
function buildFontFaceCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
920
|
+
name = formatFontFaceName(format, id, { name });
|
|
921
|
+
let css = buildAtRuleDeclarationCss(descriptors, tokens, tokenLookup, tokenNameFormat, true, (property) => property !== "fontFamily");
|
|
922
|
+
css = `@${FONT_FACE_AT_RULE} { font-family: ${name}; ${css} }`;
|
|
923
|
+
return {
|
|
924
|
+
name,
|
|
925
|
+
css
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
//#endregion
|
|
929
|
+
//#region atomic/atRule/fontSrc.ts
|
|
930
|
+
function fontSrc(url, format) {
|
|
931
|
+
if (typeof url !== "string") throw new Error("fontSrc url must be a static string");
|
|
932
|
+
const src = `url("${escapeFontSrcPart(url)}")`;
|
|
933
|
+
return format ? `${src} format("${escapeFontSrcPart(format)}")` : src;
|
|
934
|
+
}
|
|
935
|
+
function escapeFontSrcPart(value) {
|
|
936
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
937
|
+
}
|
|
938
|
+
//#endregion
|
|
939
|
+
//#region css/fontFace.ts
|
|
940
|
+
const idCounter$4 = createIdCounter("fontFace");
|
|
941
|
+
function createFontFace(descriptors, stableId) {
|
|
942
|
+
if (typeof descriptors.src !== "string") throw new Error("createFontFace \"src\" must be a static string");
|
|
943
|
+
return createNamedAtRuleRef({
|
|
944
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontFace,
|
|
945
|
+
buildCss: buildFontFaceCss,
|
|
946
|
+
value: descriptors,
|
|
947
|
+
idCounter: idCounter$4,
|
|
948
|
+
stableId
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region atomic/atRule/fontPaletteValues.ts
|
|
953
|
+
const FONT_PALETTE_VALUES_AT_RULE = "font-palette-values";
|
|
954
|
+
const formatFontPaletteValuesName = createAtRuleNameFormatter("font-palettle[-(name)]-$hash", "--");
|
|
955
|
+
function buildFontPaletteValuesCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
956
|
+
name = formatFontPaletteValuesName(format, id, { name });
|
|
957
|
+
const css = buildNamedAtRuleCss(FONT_PALETTE_VALUES_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
958
|
+
return {
|
|
959
|
+
name,
|
|
960
|
+
css
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
//#endregion
|
|
964
|
+
//#region css/fontPaletteValues.ts
|
|
965
|
+
const idCounter$3 = createIdCounter("fontPaletteValues");
|
|
966
|
+
function createFontPaletteValues(descriptors, stableId) {
|
|
967
|
+
return createNamedAtRuleRef({
|
|
968
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontPaletteValues,
|
|
969
|
+
buildCss: buildFontPaletteValuesCss,
|
|
970
|
+
value: descriptors,
|
|
971
|
+
idCounter: idCounter$3,
|
|
972
|
+
stableId
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
//#endregion
|
|
976
|
+
//#region atomic/atRule/keyframes.ts
|
|
977
|
+
const KEYFRAMES_AT_RULE = "keyframes";
|
|
978
|
+
const formatKeyFramesName = createAtRuleNameFormatter("keyframes[-(name)]-$hash");
|
|
979
|
+
function buildKeyframesCss(format, name, id, frames, tokens, tokenLookup, tokenNameFormat) {
|
|
980
|
+
name = formatKeyFramesName(format, id, { name });
|
|
981
|
+
let css = `@${KEYFRAMES_AT_RULE} ${name} {`;
|
|
982
|
+
for (const selector in frames) {
|
|
983
|
+
const frame = frames[selector];
|
|
984
|
+
if (!frame) continue;
|
|
985
|
+
css += selector + "{";
|
|
986
|
+
css += buildAtRuleDeclarationCss(frame, tokens, tokenLookup, tokenNameFormat, false);
|
|
987
|
+
css += "}";
|
|
988
|
+
}
|
|
989
|
+
css += "}";
|
|
990
|
+
return {
|
|
991
|
+
name,
|
|
992
|
+
css
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region css/keyframes.ts
|
|
997
|
+
const idCounter$2 = createIdCounter("keyframes");
|
|
998
|
+
function createKeyframes(frames, stableId) {
|
|
999
|
+
return createNamedAtRuleRef({
|
|
1000
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
1001
|
+
buildCss: buildKeyframesCss,
|
|
1002
|
+
value: frames,
|
|
1003
|
+
idCounter: idCounter$2,
|
|
1004
|
+
stableId
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
//#endregion
|
|
1008
|
+
//#region atomic/atRule/positionTry.ts
|
|
1009
|
+
const POSITION_TRY_AT_RULE = "position-try";
|
|
1010
|
+
const formatPositionTryName = createAtRuleNameFormatter("position-try[-(name)]-$hash", "--");
|
|
1011
|
+
function buildPositionTryCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
1012
|
+
name = formatPositionTryName(format, id, { name });
|
|
1013
|
+
const css = buildNamedAtRuleCss(POSITION_TRY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat);
|
|
1014
|
+
return {
|
|
1015
|
+
name,
|
|
1016
|
+
css
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
//#endregion
|
|
1020
|
+
//#region css/positionTry.ts
|
|
1021
|
+
const idCounter$1 = createIdCounter("positionTry");
|
|
1022
|
+
function createPositionTry(descriptors, stableId) {
|
|
1023
|
+
return createNamedAtRuleRef({
|
|
1024
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
1025
|
+
buildCss: buildPositionTryCss,
|
|
1026
|
+
value: descriptors,
|
|
1027
|
+
idCounter: idCounter$1,
|
|
1028
|
+
stableId
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region atomic/atRule/property.ts
|
|
1033
|
+
const PROPERTY_AT_RULE = "property";
|
|
1034
|
+
const formatPropertyName = createAtRuleNameFormatter("[-(name)]-$hash", "--");
|
|
1035
|
+
function buildPropertyCss(format, name, id, descriptors, tokens, tokenLookup, tokenNameFormat) {
|
|
1036
|
+
name = formatPropertyName(format, id, { name });
|
|
1037
|
+
return {
|
|
1038
|
+
css: buildNamedAtRuleCss(PROPERTY_AT_RULE, name, descriptors, tokens, tokenLookup, tokenNameFormat),
|
|
1039
|
+
name
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region css/property.ts
|
|
1044
|
+
const idCounter = createIdCounter("property");
|
|
1045
|
+
function createProperty(nameOrDescriptors, descriptorsOrStableId) {
|
|
1046
|
+
const descriptors = typeof nameOrDescriptors === "string" ? descriptorsOrStableId : nameOrDescriptors;
|
|
1047
|
+
return createNamedAtRuleRef({
|
|
1048
|
+
idCounter,
|
|
1049
|
+
stableId: typeof nameOrDescriptors === "string" ? {
|
|
1050
|
+
name: nameOrDescriptors,
|
|
1051
|
+
id: nameOrDescriptors
|
|
1052
|
+
} : descriptorsOrStableId,
|
|
1053
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
1054
|
+
value: descriptors,
|
|
1055
|
+
buildCss: buildPropertyCss
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
//#endregion
|
|
1059
|
+
//#region css/sheet.ts
|
|
1060
|
+
function createSheet(items, debug) {
|
|
1061
|
+
const callsite = resolveCallsite(debug);
|
|
1062
|
+
let data = createSheetData(callsite);
|
|
1063
|
+
if (items) data = mergeSheetItems(data, callsite, items);
|
|
1064
|
+
return data;
|
|
1065
|
+
}
|
|
1066
|
+
function mergeSheetItems(data, callsite, items) {
|
|
1067
|
+
if (!items) return data;
|
|
1068
|
+
if (Array.isArray(items)) {
|
|
1069
|
+
let next = data;
|
|
1070
|
+
for (let i = 0, len = items.length; i < len; i++) next = mergeSheetItems(next, callsite, items[i]);
|
|
1071
|
+
return next;
|
|
1072
|
+
}
|
|
1073
|
+
if (isStyleTokenOverrideData(items)) {
|
|
1074
|
+
addSheetTokenOverride(data, items);
|
|
1075
|
+
return data;
|
|
1076
|
+
}
|
|
1077
|
+
if (!isSelectorData(items) && !isSelectorOverrideData(items)) throw new Error("createSheet(items) requires selector items from style.selector(...) or token overrides");
|
|
1078
|
+
const selectorItem = items;
|
|
1079
|
+
const selectors = getSelectorSelectors(selectorItem);
|
|
1080
|
+
let next = data;
|
|
1081
|
+
if (isSelectorData(selectorItem)) return next;
|
|
1082
|
+
for (let i = 0, len = selectors.length; i < len; i++) next = mergeSheetData(next, callsite, getSelectorItemStyleData(selectorItem), null, selectors[i], null);
|
|
1083
|
+
return next;
|
|
1084
|
+
}
|
|
1085
|
+
function addSheetTokenOverride(data, item) {
|
|
1086
|
+
const state = data[BUILDER_STATE];
|
|
1087
|
+
const lookup = state.lookup ??= {};
|
|
1088
|
+
const lookupKey = getSheetTokenLookupKey(getStyleTokenId(item));
|
|
1089
|
+
const lookupIndex = lookup[lookupKey];
|
|
1090
|
+
if (typeof lookupIndex === "number") state.items[lookupIndex] = item;
|
|
1091
|
+
else lookup[lookupKey] = state.items.push(item) - 1;
|
|
1092
|
+
}
|
|
1093
|
+
function getSelectorItemStyleData(data) {
|
|
1094
|
+
return {
|
|
1095
|
+
[BUILDER_TYPE]: 1,
|
|
1096
|
+
[BUILDER_STATE]: data[BUILDER_STATE],
|
|
1097
|
+
[BUILDER_CALLSITE]: data[BUILDER_CALLSITE]
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
function getSheetTokenLookupKey(tokenId) {
|
|
1101
|
+
return "token\0" + tokenId;
|
|
1102
|
+
}
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region runtime/sheet/insert.ts
|
|
1105
|
+
function insertStylePropRuntimeItems(sheet, items) {
|
|
1106
|
+
if (!items.length) return;
|
|
1107
|
+
sheet.updateLayers(CSS_CONFIG.layers || LayerDefaultLayers);
|
|
1108
|
+
walkStylePropItemsSheetRules(items, (rule) => sheet.insert(rule), (theme) => insertRuntimeThemeRule(sheet, theme));
|
|
1109
|
+
}
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region runtime/core/getClassName.ts
|
|
1112
|
+
function getClassName(styleProp, props = {}) {
|
|
1113
|
+
const marker = splitElementMarkerStyleProp(styleProp);
|
|
1114
|
+
const resolved = resolveClassNameRuntime(marker.styleProp, props);
|
|
1115
|
+
if (resolved.items.length) {
|
|
1116
|
+
if (!RUNTIME_CONFIG.isExtracted && !isServerRSC()) {
|
|
1117
|
+
const sheet = getGlobalSheet();
|
|
1118
|
+
insertStylePropRuntimeItems(sheet, resolved.items);
|
|
1119
|
+
sheet.flush();
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
prependClassName(resolved.result, createElementMarkerClassName(marker.debug));
|
|
1123
|
+
return resolved.result;
|
|
1124
|
+
}
|
|
1125
|
+
function prependClassName(result, className) {
|
|
1126
|
+
if (!className) return;
|
|
1127
|
+
result.className = result.className ? `${className} ${result.className}` : className;
|
|
1128
|
+
}
|
|
1129
|
+
createTransformElement(getClassName);
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region css/styleTarget.ts
|
|
1132
|
+
const sharedTargets = /* @__PURE__ */ new WeakMap();
|
|
1133
|
+
function createStyleTarget() {
|
|
1134
|
+
const owner = {};
|
|
1135
|
+
const targets = /* @__PURE__ */ new Map();
|
|
1136
|
+
return {
|
|
1137
|
+
apply(target, css, options) {
|
|
1138
|
+
if (!target) return;
|
|
1139
|
+
if (options?.enabled === false) {
|
|
1140
|
+
clearTarget(targets, owner, target);
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
const result = getClassName(css);
|
|
1144
|
+
const classNames = new Set(result.className?.split(/\s+/).filter(Boolean) ?? []);
|
|
1145
|
+
const styleEntries = Object.entries(result.style ?? {});
|
|
1146
|
+
const signature = createSignature(classNames, styleEntries);
|
|
1147
|
+
const previous = targets.get(target);
|
|
1148
|
+
if (previous?.signature === signature) return;
|
|
1149
|
+
const state = previous ?? {
|
|
1150
|
+
classNames: /* @__PURE__ */ new Set(),
|
|
1151
|
+
styleValues: /* @__PURE__ */ new Map(),
|
|
1152
|
+
signature: ""
|
|
1153
|
+
};
|
|
1154
|
+
updateClasses(target, state.classNames, classNames);
|
|
1155
|
+
updateStyles(target, owner, state.styleValues, styleEntries);
|
|
1156
|
+
state.classNames = classNames;
|
|
1157
|
+
state.signature = signature;
|
|
1158
|
+
targets.set(target, state);
|
|
1159
|
+
},
|
|
1160
|
+
destroy() {
|
|
1161
|
+
targets.forEach((_, target) => clearTarget(targets, owner, target));
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
function createSignature(classNames, styleEntries) {
|
|
1166
|
+
let signature = [...classNames].sort().join(" ");
|
|
1167
|
+
for (let i = 0, len = styleEntries.length; i < len; i++) {
|
|
1168
|
+
const [name, value] = styleEntries[i];
|
|
1169
|
+
signature += `\n${name}:${String(value)}`;
|
|
1170
|
+
}
|
|
1171
|
+
return signature;
|
|
1172
|
+
}
|
|
1173
|
+
function updateClasses(target, previous, next) {
|
|
1174
|
+
previous.forEach((className) => {
|
|
1175
|
+
if (!next.has(className)) removeClassName(target, className);
|
|
1176
|
+
});
|
|
1177
|
+
next.forEach((className) => {
|
|
1178
|
+
if (!previous.has(className)) addClassName(target, className);
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
function addClassName(target, className) {
|
|
1182
|
+
const state = getSharedTargetState(target);
|
|
1183
|
+
const count = state.classNames.get(className) ?? 0;
|
|
1184
|
+
if (count === 0) target.classList.add(className);
|
|
1185
|
+
state.classNames.set(className, count + 1);
|
|
1186
|
+
}
|
|
1187
|
+
function removeClassName(target, className) {
|
|
1188
|
+
const state = getSharedTargetState(target);
|
|
1189
|
+
const count = state.classNames.get(className) ?? 0;
|
|
1190
|
+
if (count <= 1) {
|
|
1191
|
+
state.classNames.delete(className);
|
|
1192
|
+
target.classList.remove(className);
|
|
1193
|
+
deleteSharedStateIfEmpty(target, state);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
state.classNames.set(className, count - 1);
|
|
1197
|
+
}
|
|
1198
|
+
function updateStyles(target, owner, previousValues, nextEntries) {
|
|
1199
|
+
const nextNames = /* @__PURE__ */ new Set();
|
|
1200
|
+
for (let i = 0, len = nextEntries.length; i < len; i++) {
|
|
1201
|
+
const [name, value] = nextEntries[i];
|
|
1202
|
+
const nextValue = String(value);
|
|
1203
|
+
nextNames.add(name);
|
|
1204
|
+
if (previousValues.get(name) !== nextValue) {
|
|
1205
|
+
setStyleValue(target, owner, name, nextValue);
|
|
1206
|
+
previousValues.set(name, nextValue);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
previousValues.forEach((_, name) => {
|
|
1210
|
+
if (nextNames.has(name)) return;
|
|
1211
|
+
removeStyleValue(target, owner, name);
|
|
1212
|
+
previousValues.delete(name);
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
function clearTarget(targets, owner, target) {
|
|
1216
|
+
const state = targets.get(target);
|
|
1217
|
+
if (!state) return;
|
|
1218
|
+
state.classNames.forEach((className) => removeClassName(target, className));
|
|
1219
|
+
state.styleValues.forEach((_, name) => {
|
|
1220
|
+
removeStyleValue(target, owner, name);
|
|
1221
|
+
});
|
|
1222
|
+
targets.delete(target);
|
|
1223
|
+
}
|
|
1224
|
+
function setStyleValue(target, owner, name, value) {
|
|
1225
|
+
const targetState = getSharedTargetState(target);
|
|
1226
|
+
let styleState = targetState.styleNames.get(name);
|
|
1227
|
+
if (!styleState) {
|
|
1228
|
+
styleState = {
|
|
1229
|
+
initialValue: target.style.getPropertyValue(name),
|
|
1230
|
+
owners: /* @__PURE__ */ new Map()
|
|
1231
|
+
};
|
|
1232
|
+
targetState.styleNames.set(name, styleState);
|
|
1233
|
+
}
|
|
1234
|
+
styleState.owners.delete(owner);
|
|
1235
|
+
styleState.owners.set(owner, value);
|
|
1236
|
+
target.style.setProperty(name, value);
|
|
1237
|
+
}
|
|
1238
|
+
function removeStyleValue(target, owner, name) {
|
|
1239
|
+
const targetState = getSharedTargetState(target);
|
|
1240
|
+
const styleState = targetState.styleNames.get(name);
|
|
1241
|
+
if (!styleState) return;
|
|
1242
|
+
styleState.owners.delete(owner);
|
|
1243
|
+
const currentValue = getLastStyleValue(styleState);
|
|
1244
|
+
if (currentValue !== null) {
|
|
1245
|
+
target.style.setProperty(name, currentValue);
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
targetState.styleNames.delete(name);
|
|
1249
|
+
restoreStyleValue(target, name, styleState.initialValue);
|
|
1250
|
+
deleteSharedStateIfEmpty(target, targetState);
|
|
1251
|
+
}
|
|
1252
|
+
function getLastStyleValue(styleState) {
|
|
1253
|
+
let value = null;
|
|
1254
|
+
styleState.owners.forEach((ownerValue) => {
|
|
1255
|
+
value = ownerValue;
|
|
1256
|
+
});
|
|
1257
|
+
return value;
|
|
1258
|
+
}
|
|
1259
|
+
function getSharedTargetState(target) {
|
|
1260
|
+
let state = sharedTargets.get(target);
|
|
1261
|
+
if (!state) {
|
|
1262
|
+
state = {
|
|
1263
|
+
classNames: /* @__PURE__ */ new Map(),
|
|
1264
|
+
styleNames: /* @__PURE__ */ new Map()
|
|
1265
|
+
};
|
|
1266
|
+
sharedTargets.set(target, state);
|
|
1267
|
+
}
|
|
1268
|
+
return state;
|
|
1269
|
+
}
|
|
1270
|
+
function deleteSharedStateIfEmpty(target, state) {
|
|
1271
|
+
if (!state.classNames.size && !state.styleNames.size) sharedTargets.delete(target);
|
|
1272
|
+
}
|
|
1273
|
+
function restoreStyleValue(target, name, value) {
|
|
1274
|
+
if (value) target.style.setProperty(name, value);
|
|
1275
|
+
else target.style.removeProperty(name);
|
|
1276
|
+
}
|
|
1277
|
+
//#endregion
|
|
1278
|
+
export { isAtRuleRef as A, createSelectorData as B, SELECTOR_CONTAINER as C, weightValue as D, isStyleWeightValue as E, importantValue as F, createThemeData as G, createSlotData as H, isStyleImportantValue as I, mergeScopeData as L, classNameValue as M, isClassNameValue as N, AT_RULE_REF as O, styleTransform as P, createScopeData as R, getToken as S, normalizeSelectorArg as T, createSlotOverrideData as U, createSelectorOverrideData as V, createStyleData as W, transformStyle as _, createKeyframes as a, mergeSlotOverrideData as b, fontSrc as c, getId as d, FnPrefixScope as f, resolveCallsite as g, FnPrefixStyle as h, createPositionTry as i, classNameTransform as j, createAtRuleRef as k, createCounterStyle as l, FnPrefixSlot as m, createSheet as n, createFontPaletteValues as o, FnPrefixSelector as p, createProperty as r, createFontFace as s, createStyleTarget as t, createIdCounter as u, mergeSelectorOverrideData as v, SELECTOR_MEDIA as w, mergeStyleData as x, mergeSlotData as y, createScopeTargetData as z };
|
|
1279
|
+
|
|
1280
|
+
//# sourceMappingURL=css-DirG7Jwu.js.map
|