@fluentic/style 0.1.0-beta.3 → 0.1.0-beta.5
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 +55 -1
- package/README.md +10 -9
- package/atomic/className.ts +12 -12
- package/atomic/debug/className/className.ts +10 -15
- package/atomic/element.ts +1 -1
- package/atomic/rule.ts +8 -5
- package/atomic/scope.ts +19 -0
- package/atomic/theme.ts +41 -2
- package/atomic/token.ts +4 -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/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 +7 -1
- 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 +71 -21
- package/builder/data/state.ts +16 -2
- package/builder/extract/index.ts +1 -0
- package/builder/extract/sheet.ts +26 -0
- package/builder/extract/token.ts +30 -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 +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/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/compiler.ts +4 -7
- 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 +35 -0
- package/compiler/index.ts +1 -0
- package/compiler/transform/cssProp/index.ts +1 -0
- package/compiler/transform/cssProp/plugin.ts +129 -0
- package/compiler/transform/debug/plugin.ts +85 -1
- package/compiler/transform/debug/transform.ts +2 -1
- package/compiler/transform/evaluator/evaluator.ts +106 -30
- package/compiler/transform/evaluator/tracer.ts +30 -2
- package/compiler/transform/extract/chain/chain.ts +541 -63
- 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 +52 -2
- package/compiler/transform/extract/utils/state.ts +2 -0
- package/compiler/transform/extract/utils/theme.ts +6 -6
- 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/utils/constants.ts +8 -1
- package/compiler/utils/imports.ts +11 -1
- package/config/build.ts +1 -8
- package/config/config/css.ts +1 -0
- package/config/config/debug.ts +11 -0
- package/css/index.ts +2 -0
- package/css/sheet.ts +119 -0
- package/css/styleTarget.ts +251 -0
- package/dialect/namedTokens.ts +22 -5
- 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/{style-Bw5ka-Nq.js → combine-Ca6LfFxv.js} +427 -722
- package/dist/combine-Ca6LfFxv.js.map +1 -0
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-D5v5tJXI.mjs → compiler-OgDBuqfs.mjs} +1635 -607
- package/dist/compiler-OgDBuqfs.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/config-B-KbXpIh.js +6 -0
- package/dist/{config-OXHoDUIo.js.map → config-B-KbXpIh.js.map} +1 -1
- package/dist/config-Barf8f4B.js +35 -0
- package/dist/config-Barf8f4B.js.map +1 -0
- package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
- package/dist/config-BtANtGAh.js.map +1 -0
- package/dist/config-CsB4MuFI.js +6 -0
- package/dist/config-CsB4MuFI.js.map +1 -0
- package/dist/config-DOWSNV8w.js +1 -0
- package/dist/{config-FIfi5aJ8.js → config-t76UljYv.js} +9 -7
- package/dist/config-t76UljYv.js.map +1 -0
- package/dist/createTransformElement-DDqld3RF.js +34 -0
- package/dist/createTransformElement-DDqld3RF.js.map +1 -0
- package/dist/css-CZwrac6F.js +3923 -0
- package/dist/css-CZwrac6F.js.map +1 -0
- package/dist/{global-zaCE-g1C.js → css-GtUPEO9U.js} +16 -3
- package/dist/css-GtUPEO9U.js.map +1 -0
- package/dist/css-YfHN_8Nk.js +479 -0
- package/dist/css-YfHN_8Nk.js.map +1 -0
- package/dist/css-a9O5so0b.js +1246 -0
- package/dist/css-a9O5so0b.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/{css_extra-DeTuIlcO.js → css_extra-BiG57TKN.js} +2 -2
- package/dist/{css_extra-DQdCrYoC.js.map → css_extra-BiG57TKN.js.map} +1 -1
- package/dist/{css_extra-DQdCrYoC.js → css_extra-CXXZAylc.js} +2 -2
- package/dist/{css_extra-DeTuIlcO.js.map → css_extra-CXXZAylc.js.map} +1 -1
- package/dist/data-CzHJg147.js +763 -0
- package/dist/data-CzHJg147.js.map +1 -0
- package/dist/{debug-D96KGgpH.js → debug-DkrxyknP.js} +80 -4
- package/dist/debug-DkrxyknP.js.map +1 -0
- package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
- package/dist/debug-DycdGrul.js.map +1 -0
- package/dist/dev/rsc.js +6 -9
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-fOtWB5K3.js → dev-z4laBwlS.js} +7 -6
- package/dist/{dev-fOtWB5K3.js.map → dev-z4laBwlS.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-CvqqIb7J.js → elementMarker-CqhU_l_m.js} +95 -9
- package/dist/elementMarker-CqhU_l_m.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 +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 -4
- package/dist/entry/prod.js +85 -1201
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/adapter/preact.js +12 -0
- package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/react.js +12 -0
- package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/solid.js +12 -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 +6 -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 +323 -615
- 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 +241 -10
- package/dist/entry/rsc-prod.js.map +1 -0
- package/dist/{styleStore-ydQcDBD4.js → env-Db2cRt-h.js} +1256 -355
- package/dist/env-Db2cRt-h.js.map +1 -0
- package/dist/{jsx-A4cK517J.js → getClassName-DKtQl5ZX.js} +5 -11
- package/dist/getClassName-DKtQl5ZX.js.map +1 -0
- package/dist/{utils-hoYnMiA7.js → getClassName-DaZF5nfJ.js} +28 -65
- package/dist/getClassName-DaZF5nfJ.js.map +1 -0
- package/dist/getClassName-a6p2uMFM.js +536 -0
- package/dist/getClassName-a6p2uMFM.js.map +1 -0
- package/dist/{getClassName-oiQ8CnkS.js → getClassName-aD9zqg9U.js} +56 -14
- package/dist/getClassName-aD9zqg9U.js.map +1 -0
- package/dist/global-zYTvWskP.js +10 -0
- package/dist/{global-Cul1dX8k.js.map → global-zYTvWskP.js.map} +1 -1
- package/dist/{hash-Bycpk3MR.js → hash-BOlQThNz.js} +48 -4
- package/dist/hash-BOlQThNz.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 +1 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.server.js +1 -1
- package/dist/jsx-C2pnWLcb.js +39 -0
- package/dist/jsx-C2pnWLcb.js.map +1 -0
- package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-kSrmu6b1.js} +2 -3
- package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-kSrmu6b1.js.map} +1 -1
- package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-BgK90E2O.js} +2 -3
- package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-BgK90E2O.js.map} +1 -1
- package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-XJSHujgI.js} +2 -2
- package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-XJSHujgI.js.map} +1 -1
- package/dist/{loader-BAth2yZ1.mjs → loader-DHvgp0fK.mjs} +3 -3
- package/dist/{loader-BAth2yZ1.mjs.map → loader-DHvgp0fK.mjs.map} +1 -1
- package/dist/{misc-DFBKJGLT.mjs → misc-BuSLnvx0.mjs} +4 -4
- package/dist/misc-BuSLnvx0.mjs.map +1 -0
- package/dist/{namedTokens-BUa6raTb.js → namedTokens-D3tt-joz.js} +8 -6
- package/dist/namedTokens-D3tt-joz.js.map +1 -0
- package/dist/plugin/farm/index.mjs +4 -3
- package/dist/plugin/farm/index.mjs.map +1 -1
- package/dist/plugin/nextjs/index.mjs +5 -5
- 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 +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 +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 +9 -7
- 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-CiwvMfx8.mjs → registry-r3BKWqpI.mjs} +2 -2
- package/dist/{registry-CiwvMfx8.mjs.map → registry-r3BKWqpI.mjs.map} +1 -1
- package/dist/resolveClassNameRuntime-D5a37GNr.js +63 -0
- package/dist/resolveClassNameRuntime-D5a37GNr.js.map +1 -0
- package/dist/{rules-DlXcch7-.js → rules-B0_rKPfB.js} +598 -132
- package/dist/rules-B0_rKPfB.js.map +1 -0
- package/dist/scope-BSuRLice.js +601 -0
- package/dist/scope-BSuRLice.js.map +1 -0
- package/dist/selector/index.js +1 -2
- package/dist/server.js +15 -13
- package/dist/server.js.map +1 -1
- package/dist/{shared-yDD0nfm1.cjs → shared-8_Msr7Q5.cjs} +1630 -597
- package/dist/shared-8_Msr7Q5.cjs.map +1 -0
- package/dist/{shared-x59dI2NW.mjs → shared-BGO_05rW.mjs} +4 -4
- package/dist/{shared-x59dI2NW.mjs.map → shared-BGO_05rW.mjs.map} +1 -1
- package/dist/sheet-BpLZIIuO.js +7 -0
- package/dist/{sheet-B-uJfHRY.js.map → sheet-BpLZIIuO.js.map} +1 -1
- package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-Bu2x35JE.mjs} +3 -3
- package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-Bu2x35JE.mjs.map} +1 -1
- package/dist/{styleStore-DJ0Msgkh.js → styleStore-BDy5TH6N.js} +5 -6
- package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-BDy5TH6N.js.map} +1 -1
- package/dist/styleStore-DX3z_UVK.js +51 -0
- package/dist/styleStore-DX3z_UVK.js.map +1 -0
- package/dist/token-BsW_S8fN.js +138 -0
- package/dist/token-BsW_S8fN.js.map +1 -0
- package/dist/{trace-D8j96G57.js → trace-BdKEpgME.js} +2 -2
- package/dist/{trace-D8j96G57.js.map → trace-BdKEpgME.js.map} +1 -1
- package/dist/{trace-CO36aenp.js → trace-DcuMxR45.js} +3 -3
- package/dist/{trace-CO36aenp.js.map → trace-DcuMxR45.js.map} +1 -1
- package/dist/{transform-BTJOg8Hg.js → transform-BkrLIiIR.js} +2 -2
- package/dist/{transform-BTJOg8Hg.js.map → transform-BkrLIiIR.js.map} +1 -1
- package/dist/{style-DFFK06Of.js → types-BEUgXuu2.js} +356 -129
- package/dist/types-BEUgXuu2.js.map +1 -0
- package/dist/{utils-D2fygyTm.mjs → utils-BPDxr-oc.mjs} +4 -4
- package/dist/{utils-D2fygyTm.mjs.map → utils-BPDxr-oc.mjs.map} +1 -1
- package/dist/utils-CLnpwhJd.js +83 -0
- package/dist/utils-CLnpwhJd.js.map +1 -0
- package/dist/utils-CUl1BU40.js +72 -0
- package/dist/utils-CUl1BU40.js.map +1 -0
- package/dist/{utils-DTXCTUlS.mjs → utils-DZjLTV4D.mjs} +3 -3
- package/dist/{utils-DTXCTUlS.mjs.map → utils-DZjLTV4D.mjs.map} +1 -1
- package/dist/utils-okFWrQsg.js +41 -0
- package/dist/utils-okFWrQsg.js.map +1 -0
- package/dist/{utils-DVFxZnVC.js → utils-sBVZEq4u.js} +190 -144
- package/dist/utils-sBVZEq4u.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-BOU7_xld.mjs → webpack-DTKgR-HY.mjs} +5 -5
- package/dist/webpack-DTKgR-HY.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/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 +1 -0
- package/entry/rsc_dev/adapter/react.ts +1 -0
- package/entry/rsc_dev/adapter/solid.ts +1 -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/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 +78 -12
- package/plugin/bundler/farm/plugin.ts +2 -0
- package/plugin/bundler/parcel/optimizer.ts +1 -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/nextjs/plugin.ts +3 -0
- package/plugin/utils/compiler.ts +2 -0
- package/plugin/utils/runtimeEntry.ts +2 -2
- package/presets/tailwind/style/transform.ts +9 -3
- package/runtime/adapter/utils.ts +94 -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 +16 -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/extract/combineStyle.ts +211 -0
- package/runtime/extract/getClassName.ts +54 -17
- package/runtime/extract/index.ts +3 -1
- package/runtime/extract/token.ts +41 -0
- package/runtime/extract/tokenResolver.ts +17 -0
- package/runtime/sheet/rule.ts +3 -10
- package/runtime/style/scope.ts +0 -24
- package/runtime/style/style.ts +181 -6
- 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 +17 -5
- package/style/theme.ts +0 -1
- package/style/token.ts +26 -21
- package/style/tokens.ts +18 -12
- package/style/transform.ts +1 -1
- 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/dist/assert-BGdigdr5.js.map +0 -1
- package/dist/className-CKo4TxuT.js +0 -144
- package/dist/className-CKo4TxuT.js.map +0 -1
- package/dist/className-ZJ5pBA-o.js +0 -263
- package/dist/className-ZJ5pBA-o.js.map +0 -1
- package/dist/compiler-D5v5tJXI.mjs.map +0 -1
- package/dist/config-BEvP7108.js.map +0 -1
- package/dist/config-B_cbG3S6.js +0 -1
- package/dist/config-FIfi5aJ8.js.map +0 -1
- package/dist/config-OXHoDUIo.js +0 -6
- package/dist/css-CELBp6Gu.js +0 -58
- package/dist/css-CELBp6Gu.js.map +0 -1
- package/dist/css-DcuJ_jSH.js +0 -243
- package/dist/css-DcuJ_jSH.js.map +0 -1
- package/dist/css-dPoZJDQH.js +0 -807
- package/dist/css-dPoZJDQH.js.map +0 -1
- package/dist/css-oOt6ZR54.js +0 -237
- package/dist/css-oOt6ZR54.js.map +0 -1
- package/dist/data-CeYstKMP.js +0 -482
- package/dist/data-CeYstKMP.js.map +0 -1
- package/dist/debug-D96KGgpH.js.map +0 -1
- package/dist/dev-p8tW7X-A.js +0 -81
- package/dist/dev-p8tW7X-A.js.map +0 -1
- package/dist/elementMarker-CvqqIb7J.js.map +0 -1
- package/dist/extract-CzWJeQi8.js +0 -121
- package/dist/extract-CzWJeQi8.js.map +0 -1
- package/dist/extract-DeOytHKW.js +0 -2
- package/dist/getClassName-oiQ8CnkS.js.map +0 -1
- package/dist/global-Cul1dX8k.js +0 -14
- package/dist/global-zaCE-g1C.js.map +0 -1
- package/dist/hash-Bycpk3MR.js.map +0 -1
- package/dist/jsx-A4cK517J.js.map +0 -1
- package/dist/jsx-Ba-XV33u.js +0 -39
- package/dist/jsx-Ba-XV33u.js.map +0 -1
- package/dist/layer-CbQzwZF-.js +0 -94
- package/dist/layer-CbQzwZF-.js.map +0 -1
- package/dist/misc-DFBKJGLT.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-CF6JgpTq.js +0 -406
- package/dist/property-CF6JgpTq.js.map +0 -1
- package/dist/rules-DlXcch7-.js.map +0 -1
- package/dist/runtime-BKChZZ2-.js.map +0 -1
- package/dist/shared-yDD0nfm1.cjs.map +0 -1
- package/dist/sheet-B-uJfHRY.js +0 -7
- package/dist/style-91J0B5ef.js +0 -771
- package/dist/style-91J0B5ef.js.map +0 -1
- package/dist/style-Bw5ka-Nq.js.map +0 -1
- package/dist/style-DFFK06Of.js.map +0 -1
- package/dist/style-pz8e5To1.js +0 -5
- package/dist/styleStore-ydQcDBD4.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/token-DT_sCPtm.js +0 -298
- package/dist/token-DT_sCPtm.js.map +0 -1
- package/dist/utils-Bmw655wa.js +0 -170
- package/dist/utils-Bmw655wa.js.map +0 -1
- package/dist/utils-DVFxZnVC.js.map +0 -1
- package/dist/utils-hoYnMiA7.js.map +0 -1
- package/dist/value-D-ZcRzLA.js +0 -42
- package/dist/value-D-ZcRzLA.js.map +0 -1
- package/dist/value-DvFkGBy2.js +0 -1029
- package/dist/value-DvFkGBy2.js.map +0 -1
- package/dist/value-dG9LK0Gq.js +0 -85
- package/dist/value-dG9LK0Gq.js.map +0 -1
- package/dist/valueRef-CsLVJwjA.js +0 -16
- package/dist/valueRef-CsLVJwjA.js.map +0 -1
- package/dist/webpack-BOU7_xld.mjs.map +0 -1
- package/dist/withTokens-LRidu3Vc.js +0 -95
- package/dist/withTokens-LRidu3Vc.js.map +0 -1
|
@@ -1,113 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
import { S as isAtRuleRef, c as createIdCounter, l as getId, r as createKeyframes, w as shouldAppendCssPx } from "./css-dPoZJDQH.js";
|
|
4
|
-
import { S as isStyleData, b as isSlotData, f as getAtomicClassName, p as getClassNameDedupe, v as isScopeData, w as DEV_CONFIG, x as isSlotOverrideData } from "./style-91J0B5ef.js";
|
|
5
|
-
import { c as BUILDER_CALLSITE, d as BUILDER_SLOT_ID, f as BUILDER_STATE, l as BUILDER_SCOPE, p as BUILDER_TYPE, u as BUILDER_SCOPE_ID } from "./withTokens-LRidu3Vc.js";
|
|
1
|
+
import { H as RUNTIME_CONFIG, K as symbol, L as BUILDER_SELECTOR, P as BUILDER_CALLSITE, R as BUILDER_SLOT_ID, V as SHEET_SELECTOR_ANCHOR, g as isExtractedTokenBoundData, h as getExtractedTokenBoundData, l as createCacheTreeNode, u as getCacheTreeChild, z as BUILDER_STATE } from "./className-hiAsQ9V6.js";
|
|
2
|
+
import { A as FnPrefixSelector, At as setBuildConfig, Ct as weightValue, D as createIdCounter, Dt as hashString, Et as DEV_CONFIG, F as mergeSelectorOverrideData, I as mergeSlotData, K as classNameValue, L as mergeSlotOverrideData, M as FnPrefixStyle, N as resolveCallsite, O as getId, P as transformStyle, R as mergeStyleData, S as createKeyframes, St as isStyleWeightValue, Tt as isStyleImportantValue, V as normalizeSelectorArg, Y as mergeScopeData, Z as createStyleToken, _ as getCombinedStyleStyles, _t as createSlotOverrideData, a as createThemeClassName, at as isScopeTargetData, bt as traceError, c as createCombinedStyleTokenWrapper, ct as isStyleData, d as addTokenValues, dt as isDebugData, f as createMutableTokenValues, ft as createScopeData, g as getCombinedStyleScopes, gt as createSlotData, h as mergeTokenValues, ht as createSelectorOverrideData, it as isScopeData, j as FnPrefixSlot, jt as CSS_CONFIG, k as FnPrefixScope, kt as setBuildDebugClassName, l as getStyleTokenValues, lt as getDebugCallsiteId, m as mergeTokenOverrides, mt as createSelectorData, nt as getScopeTargetScope, ot as isSheetData, p as finishTokenValues, pt as createScopeTargetData, q as isClassNameValue, rt as getScopeTargetSlotId, s as createCombinedStyleFacade, tt as getChildStyleTokenName, u as addTokenOverride, ut as getTraceCallsiteId, v as isCombinedStyle, vt as createStyleData, wt as importantValue, xt as traceMarker, yt as createThemeData } from "./css-CZwrac6F.js";
|
|
6
3
|
import { SelectorType, parse } from "css-what";
|
|
7
|
-
//#region
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: FN_MARKER + name,
|
|
12
|
-
configurable: true
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
const CALLSITE_REGEX = /(.+):(\d+):(\d+)$/;
|
|
16
|
-
function traceCallsite() {
|
|
17
|
-
const lines = (traceAdjustError(/* @__PURE__ */ new Error()).stack || "").split("\n");
|
|
18
|
-
const parsedFrames = lines.slice(1).map(parseStackFrame).filter((frame) => frame !== null);
|
|
19
|
-
if (!parsedFrames.length) return null;
|
|
20
|
-
const targetFrame = parsedFrames.find((frame) => !isInternalCallsite(frame.filePath)) ?? parsedFrames[0];
|
|
21
|
-
return {
|
|
22
|
-
stack: [lines[0] || "Error", createStackFrameLine(targetFrame)].join("\n"),
|
|
23
|
-
filePath: targetFrame.filePath,
|
|
24
|
-
sourceUrl: targetFrame.sourceUrl,
|
|
25
|
-
line: targetFrame.line,
|
|
26
|
-
column: targetFrame.column
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function parseStackFrame(lineText) {
|
|
30
|
-
const match = getStackFrameLocationText(lineText).match(CALLSITE_REGEX);
|
|
31
|
-
if (!match) return null;
|
|
32
|
-
const rawFilePath = normalizeCallsiteSourceUrl(match[1]);
|
|
33
|
-
return {
|
|
34
|
-
filePath: normalizeCallsiteFilePath(rawFilePath),
|
|
35
|
-
sourceUrl: isFetchableCallsiteSourceUrl(rawFilePath) ? rawFilePath : void 0,
|
|
36
|
-
line: parseInt(match[2], 10),
|
|
37
|
-
column: parseInt(match[3], 10)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function getStackFrameLocationText(lineText) {
|
|
41
|
-
let frame = lineText.trim().replace(/^at\s+/, "");
|
|
42
|
-
if (frame.endsWith(")")) {
|
|
43
|
-
const parenIndex = frame.lastIndexOf("(");
|
|
44
|
-
if (parenIndex !== -1) frame = frame.slice(parenIndex + 1, -1);
|
|
45
|
-
}
|
|
46
|
-
return frame;
|
|
47
|
-
}
|
|
48
|
-
function normalizeCallsiteSourceUrl(source) {
|
|
49
|
-
let filePath = source.trim();
|
|
50
|
-
try {
|
|
51
|
-
filePath = decodeURI(filePath);
|
|
52
|
-
} catch {}
|
|
53
|
-
if (filePath.startsWith("source:///at ") || filePath.startsWith("source:///at%20")) filePath = filePath.slice(10);
|
|
54
|
-
const strayAtMatch = filePath.match(/(?:^|\/)at\s+([a-zA-Z][a-zA-Z\d+.-]*:\/\/.+|\/.+)$/);
|
|
55
|
-
return strayAtMatch ? strayAtMatch[1] : filePath.replace(/^at\s+/, "");
|
|
56
|
-
}
|
|
57
|
-
function normalizeCallsiteFilePath(filePath) {
|
|
58
|
-
filePath = normalizeCallsiteSourceUrl(filePath);
|
|
59
|
-
const queryIndex = findFirstIndex(filePath, ["?", "#"]);
|
|
60
|
-
if (queryIndex !== -1) filePath = filePath.substring(0, queryIndex);
|
|
61
|
-
filePath = filePath.replace(/^file:\/\/\/?/, "");
|
|
62
|
-
if (filePath.startsWith("/@fs/")) filePath = "/" + filePath.slice(5);
|
|
63
|
-
const webpackInternalMatch = filePath.match(/^webpack-internal:\/\/\/(?:\([^)]+\)\/)?(.+)$/);
|
|
64
|
-
if (webpackInternalMatch) filePath = webpackInternalMatch[1];
|
|
65
|
-
const webpackSourceMatch = filePath.match(/^webpack:\/\/[^/]+\/(.+)$/);
|
|
66
|
-
if (webpackSourceMatch) filePath = webpackSourceMatch[1];
|
|
67
|
-
return filePath;
|
|
68
|
-
}
|
|
69
|
-
function isFetchableCallsiteSourceUrl(filePath) {
|
|
70
|
-
return /^https?:\/\//.test(filePath) || filePath.startsWith("/");
|
|
71
|
-
}
|
|
72
|
-
function findFirstIndex(text, needles) {
|
|
73
|
-
let index = -1;
|
|
74
|
-
for (const needle of needles) {
|
|
75
|
-
const next = text.indexOf(needle);
|
|
76
|
-
if (next !== -1 && (index === -1 || next < index)) index = next;
|
|
77
|
-
}
|
|
78
|
-
return index;
|
|
79
|
-
}
|
|
80
|
-
function createStackFrameLine(frame) {
|
|
81
|
-
return ` at ${frame.filePath}:${frame.line}:${frame.column}`;
|
|
82
|
-
}
|
|
83
|
-
function isInternalCallsite(filePath) {
|
|
84
|
-
const normalized = filePath.replace(/\\/g, "/");
|
|
85
|
-
return normalized.startsWith("node:") || normalized.startsWith("internal/") || normalized.includes("/node_modules/") || normalized.includes("/packages/style/dist/") || normalized.includes("/packages/style/builder/") || normalized.includes("/packages/style/runtime/") || normalized.includes("/packages/style/utils/trace.");
|
|
86
|
-
}
|
|
87
|
-
function traceError(message, options = {}) {
|
|
88
|
-
const error = new Error(message || "");
|
|
89
|
-
error.name = options.name || "StyleError";
|
|
90
|
-
if (typeof options.stack === "string") {
|
|
91
|
-
error.stack = options.stack;
|
|
92
|
-
return error;
|
|
93
|
-
}
|
|
94
|
-
return traceAdjustError(error, options);
|
|
95
|
-
}
|
|
96
|
-
function traceAdjustError(error, options = {}) {
|
|
97
|
-
const offset = options.offset ?? 0;
|
|
98
|
-
const stack = error.stack;
|
|
99
|
-
if (!stack) return error;
|
|
100
|
-
const lines = stack.split("\n");
|
|
101
|
-
const markerIndex = lines.findIndex((line) => line.includes(FN_MARKER));
|
|
102
|
-
if (markerIndex === -1) return error;
|
|
103
|
-
const traced = new Error(error.message);
|
|
104
|
-
traced.name = error.name;
|
|
105
|
-
const frameStartIndex = Math.max(markerIndex + 1 + offset, 1);
|
|
106
|
-
let frames = lines.slice(frameStartIndex);
|
|
107
|
-
if (options.limit) frames = frames.slice(0, options.limit);
|
|
108
|
-
traced.stack = [lines[0], ...frames].join("\n");
|
|
109
|
-
return traced;
|
|
110
|
-
}
|
|
4
|
+
//#region entry/shared/config_debug.ts
|
|
5
|
+
const buildConfig = JSON.parse(FLUENTIC_STYLE_BUILD_CONFIG);
|
|
6
|
+
setBuildConfig(buildConfig);
|
|
7
|
+
setBuildDebugClassName(buildConfig.css?.debugClassName, false);
|
|
111
8
|
//#endregion
|
|
112
9
|
//#region selector/selector.ts
|
|
113
10
|
function selector(selector, ...args) {
|
|
@@ -252,553 +149,6 @@ function checkSelector$1(fnPrefix, fnName, fnSelector, arg) {
|
|
|
252
149
|
throw traceError(`${fnPrefix}${fnName}(${arg || ""}): ${message}`);
|
|
253
150
|
}
|
|
254
151
|
//#endregion
|
|
255
|
-
//#region builder/data/create.ts
|
|
256
|
-
function createStyleData(callsite) {
|
|
257
|
-
return {
|
|
258
|
-
[BUILDER_TYPE]: 1,
|
|
259
|
-
[BUILDER_STATE]: {
|
|
260
|
-
items: [],
|
|
261
|
-
lookup: {}
|
|
262
|
-
},
|
|
263
|
-
[BUILDER_CALLSITE]: callsite
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function createSlotData(callsite, slotId) {
|
|
267
|
-
return {
|
|
268
|
-
[BUILDER_TYPE]: 2,
|
|
269
|
-
[BUILDER_STATE]: {
|
|
270
|
-
items: [],
|
|
271
|
-
lookup: {}
|
|
272
|
-
},
|
|
273
|
-
[BUILDER_CALLSITE]: callsite,
|
|
274
|
-
[BUILDER_SLOT_ID]: slotId
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function createSlotOverrideData(callsite, slotId) {
|
|
278
|
-
return {
|
|
279
|
-
[BUILDER_TYPE]: 3,
|
|
280
|
-
[BUILDER_STATE]: {
|
|
281
|
-
items: [],
|
|
282
|
-
lookup: {}
|
|
283
|
-
},
|
|
284
|
-
[BUILDER_CALLSITE]: callsite,
|
|
285
|
-
[BUILDER_SLOT_ID]: slotId
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function createScopeData(callsite) {
|
|
289
|
-
return {
|
|
290
|
-
[BUILDER_TYPE]: 4,
|
|
291
|
-
[BUILDER_STATE]: {
|
|
292
|
-
items: [],
|
|
293
|
-
lookup: {}
|
|
294
|
-
},
|
|
295
|
-
[BUILDER_CALLSITE]: callsite
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
function createScopeTargetData(scope, slot) {
|
|
299
|
-
return {
|
|
300
|
-
[BUILDER_TYPE]: 5,
|
|
301
|
-
[BUILDER_SCOPE]: scope,
|
|
302
|
-
[BUILDER_SCOPE_ID]: slot[BUILDER_SLOT_ID]
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
function createThemeData(callsite, id, className, tokens) {
|
|
306
|
-
return {
|
|
307
|
-
[BUILDER_TYPE]: 6,
|
|
308
|
-
[BUILDER_STATE]: {
|
|
309
|
-
items: [],
|
|
310
|
-
lookup: {}
|
|
311
|
-
},
|
|
312
|
-
[BUILDER_CALLSITE]: callsite,
|
|
313
|
-
id,
|
|
314
|
-
className,
|
|
315
|
-
tokens
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
function isDebugData(value) {
|
|
319
|
-
if (!value || typeof value !== "object") return false;
|
|
320
|
-
const data = value;
|
|
321
|
-
return data.$$debug === true && Array.isArray(data.loc) && Array.isArray(data.label);
|
|
322
|
-
}
|
|
323
|
-
function getDebugCallsiteId(debug) {
|
|
324
|
-
const label = debug.label[0] || debug.label[1];
|
|
325
|
-
if (!label) return null;
|
|
326
|
-
const hash = debug.sourceUrl + "\n" + debug.loc[0] + ":" + debug.loc[1] + "\n" + (debug.label[1] || label);
|
|
327
|
-
return label + "_" + hashString(hash);
|
|
328
|
-
}
|
|
329
|
-
function getTraceCallsiteId(callsite) {
|
|
330
|
-
return hashString(callsite.filePath + "\n" + callsite.line + ":" + callsite.column);
|
|
331
|
-
}
|
|
332
|
-
function getDebugCallsite(debug) {
|
|
333
|
-
return createDebugCallsite(debug.loc, debug);
|
|
334
|
-
}
|
|
335
|
-
function getDebugFieldCallsite(debug, field) {
|
|
336
|
-
if (!debug) return null;
|
|
337
|
-
const loc = getDebugFieldLoc(debug, field);
|
|
338
|
-
return loc ? createDebugCallsite(loc, debug) : null;
|
|
339
|
-
}
|
|
340
|
-
function getDebugFieldVarName(debug, field) {
|
|
341
|
-
return debug?.vars?.[field] ?? null;
|
|
342
|
-
}
|
|
343
|
-
function getDebugFieldLoc(debug, field) {
|
|
344
|
-
const loc = debug?.fields?.[field];
|
|
345
|
-
if (!loc) return null;
|
|
346
|
-
if (Array.isArray(loc)) return loc;
|
|
347
|
-
return loc[DEV_CONFIG.sourcemapLocationMode === "value" ? 1 : 0] ?? loc[0] ?? loc[1] ?? null;
|
|
348
|
-
}
|
|
349
|
-
function createDebugCallsite(loc, debug) {
|
|
350
|
-
const [line, column] = loc;
|
|
351
|
-
const sourceUrl = loc[3] ?? debug.sourceUrl;
|
|
352
|
-
const sourceContent = loc[4] ?? debug.code;
|
|
353
|
-
return {
|
|
354
|
-
stack: `Error\n at ${sourceUrl}:${line}:${column}`,
|
|
355
|
-
filePath: sourceUrl,
|
|
356
|
-
sourceUrl,
|
|
357
|
-
sourceContent,
|
|
358
|
-
line,
|
|
359
|
-
column
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region builder/data/merge/utils.ts
|
|
364
|
-
function cloneData(data, source, debug, merge = true) {
|
|
365
|
-
const runtimeType = DEV_CONFIG.isDev ? debug ? -2 : -1 : -3;
|
|
366
|
-
const state = data[BUILDER_STATE];
|
|
367
|
-
state.items = merge ? source[BUILDER_STATE].items.slice() : [];
|
|
368
|
-
state.lookup = Object.assign(Object.create(null), merge ? source[BUILDER_STATE].lookup : null);
|
|
369
|
-
const lookup = state.lookup;
|
|
370
|
-
return [
|
|
371
|
-
runtimeType,
|
|
372
|
-
data,
|
|
373
|
-
state.items,
|
|
374
|
-
lookup
|
|
375
|
-
];
|
|
376
|
-
}
|
|
377
|
-
function logInvalidData(message, data) {
|
|
378
|
-
console.log(traceError(message), "data:", data);
|
|
379
|
-
}
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region builder/data/merge/scope.ts
|
|
382
|
-
function mergeScopeData(scope, callsite, items, debug, parentSelector, scopeAtRule) {
|
|
383
|
-
if (!items) return scope;
|
|
384
|
-
const sourceItems = Array.isArray(items) ? items : [items];
|
|
385
|
-
const [runtimeType, data, styles, lookup] = cloneData(scope, scope, debug);
|
|
386
|
-
let source;
|
|
387
|
-
let item;
|
|
388
|
-
let lookupIndex;
|
|
389
|
-
let priority;
|
|
390
|
-
let value;
|
|
391
|
-
let atRule;
|
|
392
|
-
let dedupe;
|
|
393
|
-
let className;
|
|
394
|
-
let itemDebug;
|
|
395
|
-
let itemCallsite;
|
|
396
|
-
for (let i = 0, len = sourceItems.length; i < len; i++) {
|
|
397
|
-
source = sourceItems[i];
|
|
398
|
-
if (!source) continue;
|
|
399
|
-
if (isStyleTokenOverrideData(source)) {
|
|
400
|
-
addTokenOverride(source, styles, lookup);
|
|
401
|
-
continue;
|
|
402
|
-
}
|
|
403
|
-
if (isScopeData(source)) {
|
|
404
|
-
const scopeItems = source[BUILDER_STATE].items;
|
|
405
|
-
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
406
|
-
item = scopeItems[j];
|
|
407
|
-
if (isStyleTokenOverrideData(item)) {
|
|
408
|
-
addTokenOverride(item, styles, lookup);
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
if (Array.isArray(item) || item.type !== 4) {
|
|
412
|
-
logInvalidData("invalid scope data", {
|
|
413
|
-
source,
|
|
414
|
-
item
|
|
415
|
-
});
|
|
416
|
-
continue;
|
|
417
|
-
}
|
|
418
|
-
const sourceScopeItem = item;
|
|
419
|
-
atRule = scopeAtRule ? sourceScopeItem.atRule ? [scopeAtRule].concat(sourceScopeItem.atRule) : [scopeAtRule] : sourceScopeItem.atRule;
|
|
420
|
-
const scopeItem = {
|
|
421
|
-
...sourceScopeItem,
|
|
422
|
-
runtime: runtimeType,
|
|
423
|
-
atRule,
|
|
424
|
-
parentSelector: parentSelector ?? sourceScopeItem.parentSelector
|
|
425
|
-
};
|
|
426
|
-
itemDebug = getMergedScopeDebug(debug, scopeItem);
|
|
427
|
-
itemCallsite = getDebugFieldCallsite(itemDebug ?? null, scopeItem.property) ?? callsite ?? scopeItem.callsite;
|
|
428
|
-
value = scopeItem.value;
|
|
429
|
-
priority = null;
|
|
430
|
-
if (Array.isArray(value)) {
|
|
431
|
-
priority = value[1];
|
|
432
|
-
value = value[0];
|
|
433
|
-
}
|
|
434
|
-
dedupe = getClassNameDedupe(scopeItem.property, priority, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule);
|
|
435
|
-
className = getAtomicClassName(scopeItem.property, priority, value, scopeItem.selector, scopeItem.parentSelector, scopeItem.atRule, itemCallsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null);
|
|
436
|
-
scopeItem.dedupe = dedupe;
|
|
437
|
-
scopeItem.className = className;
|
|
438
|
-
scopeItem.callsite = itemCallsite;
|
|
439
|
-
scopeItem.debug = itemDebug ?? null;
|
|
440
|
-
scopeItem.debugField = itemDebug ? scopeItem.property : null;
|
|
441
|
-
const lookupKey = getScopeLookupKey(scopeItem.slotId, dedupe);
|
|
442
|
-
lookupIndex = lookup[lookupKey];
|
|
443
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
444
|
-
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
445
|
-
}
|
|
446
|
-
continue;
|
|
447
|
-
}
|
|
448
|
-
if (!isSlotOverrideData(source)) {
|
|
449
|
-
logInvalidData("invalid scope data", { source });
|
|
450
|
-
continue;
|
|
451
|
-
}
|
|
452
|
-
const slotId = source[BUILDER_SLOT_ID];
|
|
453
|
-
const overrideItems = source[BUILDER_STATE].items;
|
|
454
|
-
for (let j = 0, len = overrideItems.length; j < len; j++) {
|
|
455
|
-
item = overrideItems[j];
|
|
456
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 3) {
|
|
457
|
-
logInvalidData("invalid scope data", {
|
|
458
|
-
source,
|
|
459
|
-
item
|
|
460
|
-
});
|
|
461
|
-
continue;
|
|
462
|
-
}
|
|
463
|
-
const overrideItem = item;
|
|
464
|
-
atRule = scopeAtRule ? overrideItem.atRule ? [scopeAtRule].concat(overrideItem.atRule) : [scopeAtRule] : overrideItem.atRule;
|
|
465
|
-
const scopeItem = {
|
|
466
|
-
type: 4,
|
|
467
|
-
slotId,
|
|
468
|
-
runtime: runtimeType,
|
|
469
|
-
dedupe: "",
|
|
470
|
-
className: "",
|
|
471
|
-
property: overrideItem.property,
|
|
472
|
-
value: overrideItem.value,
|
|
473
|
-
transformClassName: overrideItem.transformClassName,
|
|
474
|
-
token: overrideItem.token,
|
|
475
|
-
selector: overrideItem.selector,
|
|
476
|
-
atRule,
|
|
477
|
-
callsite: overrideItem.callsite ?? callsite,
|
|
478
|
-
debug: overrideItem.debug,
|
|
479
|
-
debugField: overrideItem.debugField,
|
|
480
|
-
parentSelector
|
|
481
|
-
};
|
|
482
|
-
value = scopeItem.value;
|
|
483
|
-
priority = null;
|
|
484
|
-
if (Array.isArray(value)) {
|
|
485
|
-
priority = value[1];
|
|
486
|
-
value = value[0];
|
|
487
|
-
}
|
|
488
|
-
dedupe = getClassNameDedupe(scopeItem.property, priority, scopeItem.selector, parentSelector, scopeItem.atRule);
|
|
489
|
-
className = getAtomicClassName(scopeItem.property, priority, value, scopeItem.selector, parentSelector, scopeItem.atRule, scopeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, scopeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null);
|
|
490
|
-
scopeItem.dedupe = dedupe;
|
|
491
|
-
scopeItem.className = className;
|
|
492
|
-
const lookupKey = getScopeLookupKey(slotId, dedupe);
|
|
493
|
-
lookupIndex = lookup[lookupKey];
|
|
494
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = scopeItem;
|
|
495
|
-
else lookup[lookupKey] = styles.push(scopeItem) - 1;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
return data;
|
|
499
|
-
}
|
|
500
|
-
function addTokenOverride(item, styles, lookup) {
|
|
501
|
-
const lookupKey = getTokenLookupKey(getStyleTokenId(item));
|
|
502
|
-
const lookupIndex = lookup[lookupKey];
|
|
503
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = item;
|
|
504
|
-
else lookup[lookupKey] = styles.push(item) - 1;
|
|
505
|
-
}
|
|
506
|
-
function getMergedScopeDebug(debug, item) {
|
|
507
|
-
if (!debug) return item.debug;
|
|
508
|
-
if (debug.fields?.[item.property]) return debug;
|
|
509
|
-
const valueLoc = getRuntimeScopeItemValueLoc(item);
|
|
510
|
-
if (!valueLoc) return debug;
|
|
511
|
-
return {
|
|
512
|
-
...debug,
|
|
513
|
-
fields: {
|
|
514
|
-
...debug.fields,
|
|
515
|
-
[item.property]: {
|
|
516
|
-
[0]: debug.loc,
|
|
517
|
-
[1]: valueLoc
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
function getRuntimeScopeItemValueLoc(item) {
|
|
523
|
-
if (item.debug && item.debugField) {
|
|
524
|
-
const loc = item.debug.fields?.[item.debugField];
|
|
525
|
-
if (Array.isArray(loc)) return withDebugSource$1(loc, item.debug.sourceUrl, item.debug.code);
|
|
526
|
-
if (loc) {
|
|
527
|
-
const valueLoc = loc[1] ?? loc[0] ?? null;
|
|
528
|
-
return valueLoc ? withDebugSource$1(valueLoc, item.debug.sourceUrl, item.debug.code) : null;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return item.callsite ? [
|
|
532
|
-
item.callsite.line,
|
|
533
|
-
item.callsite.column,
|
|
534
|
-
void 0,
|
|
535
|
-
item.callsite.sourceUrl,
|
|
536
|
-
item.callsite.sourceContent
|
|
537
|
-
] : null;
|
|
538
|
-
}
|
|
539
|
-
function withDebugSource$1(loc, sourceUrl, sourceContent) {
|
|
540
|
-
return loc[3] ? loc : [
|
|
541
|
-
loc[0],
|
|
542
|
-
loc[1],
|
|
543
|
-
loc[2],
|
|
544
|
-
sourceUrl,
|
|
545
|
-
sourceContent
|
|
546
|
-
];
|
|
547
|
-
}
|
|
548
|
-
function getScopeLookupKey(slotId, dedupe) {
|
|
549
|
-
return slotId + "\0" + dedupe;
|
|
550
|
-
}
|
|
551
|
-
function getTokenLookupKey(tokenId) {
|
|
552
|
-
return "token\0" + tokenId;
|
|
553
|
-
}
|
|
554
|
-
//#endregion
|
|
555
|
-
//#region style/transform.ts
|
|
556
|
-
const CLASS_NAME_VALUE = symbol("transform.classNameValue");
|
|
557
|
-
function classNameValue(value, className) {
|
|
558
|
-
return {
|
|
559
|
-
[CLASS_NAME_VALUE]: true,
|
|
560
|
-
value,
|
|
561
|
-
className
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function isClassNameValue(value) {
|
|
565
|
-
return !!value && typeof value === "object" && value[CLASS_NAME_VALUE] === true && typeof value.className === "string";
|
|
566
|
-
}
|
|
567
|
-
function styleTransform(options) {
|
|
568
|
-
return options;
|
|
569
|
-
}
|
|
570
|
-
function classNameTransform(options) {
|
|
571
|
-
return options;
|
|
572
|
-
}
|
|
573
|
-
//#endregion
|
|
574
|
-
//#region builder/data/merge/style.ts
|
|
575
|
-
function mergeBuilderData(create, callsite, source, style, debug, selector, atRule, type) {
|
|
576
|
-
if (!style) return source;
|
|
577
|
-
const [runtimeType, data, styles, lookup] = cloneData(create(callsite, source), source, debug);
|
|
578
|
-
const slotId = isSlotData(source) || isSlotOverrideData(source) ? source[BUILDER_SLOT_ID] : null;
|
|
579
|
-
const items = [];
|
|
580
|
-
let item;
|
|
581
|
-
let itemData;
|
|
582
|
-
let valueRaw;
|
|
583
|
-
let value;
|
|
584
|
-
let priority;
|
|
585
|
-
let itemCallsite;
|
|
586
|
-
let className;
|
|
587
|
-
let dedupe;
|
|
588
|
-
let token;
|
|
589
|
-
let ref;
|
|
590
|
-
let variableName;
|
|
591
|
-
let transformClassName;
|
|
592
|
-
let lookupIndex;
|
|
593
|
-
if (isStyleData(style)) {
|
|
594
|
-
const stylesItems = style[BUILDER_STATE].items;
|
|
595
|
-
for (let i = 0, len = stylesItems.length; i < len; i++) {
|
|
596
|
-
item = stylesItems[i];
|
|
597
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item) || item.type !== 1) {
|
|
598
|
-
logInvalidData("invalid style data", {
|
|
599
|
-
item,
|
|
600
|
-
style
|
|
601
|
-
});
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (atRule) item = Object.assign({}, item, { atRule: item.atRule ? atRule.concat(item.atRule) : atRule });
|
|
605
|
-
if (type === 2 && slotId !== null) item = Object.assign({}, item, {
|
|
606
|
-
type: 2,
|
|
607
|
-
slotId
|
|
608
|
-
});
|
|
609
|
-
else if (type === 3 && slotId !== null) item = Object.assign({}, item, {
|
|
610
|
-
type: 3,
|
|
611
|
-
slotId
|
|
612
|
-
});
|
|
613
|
-
const itemDebug = getMergedStyleDebug(debug, item);
|
|
614
|
-
const debugCallsite = getDebugFieldCallsite(itemDebug, item.property);
|
|
615
|
-
if (debugCallsite) item = Object.assign({}, item, {
|
|
616
|
-
callsite: debugCallsite,
|
|
617
|
-
debug: itemDebug,
|
|
618
|
-
debugField: item.property
|
|
619
|
-
});
|
|
620
|
-
items.push(item);
|
|
621
|
-
}
|
|
622
|
-
} else for (const property in style) {
|
|
623
|
-
valueRaw = style[property];
|
|
624
|
-
priority = null;
|
|
625
|
-
if (Array.isArray(valueRaw) && valueRaw.length === 2 && typeof valueRaw[0] === "number") {
|
|
626
|
-
priority = valueRaw[0];
|
|
627
|
-
valueRaw = valueRaw[1];
|
|
628
|
-
}
|
|
629
|
-
transformClassName = null;
|
|
630
|
-
if (isClassNameValue(valueRaw)) {
|
|
631
|
-
transformClassName = valueRaw.className;
|
|
632
|
-
valueRaw = valueRaw.value;
|
|
633
|
-
}
|
|
634
|
-
ref = isAtRuleRef(valueRaw) ? valueRaw : null;
|
|
635
|
-
if (ref) valueRaw = ref.value;
|
|
636
|
-
token = isStyleTokenData(valueRaw) ? valueRaw : null;
|
|
637
|
-
variableName = getDebugFieldVarName(debug, property);
|
|
638
|
-
value = variableName && token ? getCssVarRawFallback(variableName, getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null)) : token ? getTokenVar(token, CSS_CONFIG.tokenNameFormat ?? null) : String(valueRaw ?? "");
|
|
639
|
-
value = priority !== null ? [value, priority] : value;
|
|
640
|
-
itemCallsite = getDebugFieldCallsite(debug, property) ?? callsite;
|
|
641
|
-
itemData = {
|
|
642
|
-
runtime: runtimeType,
|
|
643
|
-
debug,
|
|
644
|
-
debugField: property,
|
|
645
|
-
dedupe: "",
|
|
646
|
-
className: "",
|
|
647
|
-
property,
|
|
648
|
-
value,
|
|
649
|
-
transformClassName,
|
|
650
|
-
variable: ref ? [3, ref] : variableName && token ? [
|
|
651
|
-
1,
|
|
652
|
-
variableName,
|
|
653
|
-
valueRaw,
|
|
654
|
-
shouldAppendCssPx(property) ? 1 : void 0
|
|
655
|
-
] : ref ? [3, ref] : void 0,
|
|
656
|
-
token,
|
|
657
|
-
selector,
|
|
658
|
-
atRule,
|
|
659
|
-
callsite: itemCallsite
|
|
660
|
-
};
|
|
661
|
-
if (type === 1) {
|
|
662
|
-
items.push({
|
|
663
|
-
...itemData,
|
|
664
|
-
type: 1
|
|
665
|
-
});
|
|
666
|
-
continue;
|
|
667
|
-
}
|
|
668
|
-
if (slotId === null) {
|
|
669
|
-
logInvalidData("invalid style data", {
|
|
670
|
-
property,
|
|
671
|
-
style
|
|
672
|
-
});
|
|
673
|
-
continue;
|
|
674
|
-
}
|
|
675
|
-
if (type === 2) {
|
|
676
|
-
items.push({
|
|
677
|
-
...itemData,
|
|
678
|
-
type: 2,
|
|
679
|
-
slotId
|
|
680
|
-
});
|
|
681
|
-
continue;
|
|
682
|
-
}
|
|
683
|
-
if (type === 3) {
|
|
684
|
-
items.push({
|
|
685
|
-
...itemData,
|
|
686
|
-
type: 3,
|
|
687
|
-
slotId
|
|
688
|
-
});
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
|
-
logInvalidData("invalid style data", {
|
|
692
|
-
property,
|
|
693
|
-
style
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
if (!items.length) return data;
|
|
697
|
-
for (let i = 0, len = items.length; i < len; i++) {
|
|
698
|
-
item = items[i];
|
|
699
|
-
if (Array.isArray(item) || isStyleTokenOverrideData(item)) {
|
|
700
|
-
logInvalidData("invalid style data", {
|
|
701
|
-
item,
|
|
702
|
-
style
|
|
703
|
-
});
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
const runtimeItem = item;
|
|
707
|
-
value = runtimeItem.value;
|
|
708
|
-
priority = null;
|
|
709
|
-
if (Array.isArray(value)) {
|
|
710
|
-
priority = value[1];
|
|
711
|
-
value = value[0];
|
|
712
|
-
}
|
|
713
|
-
dedupe = getClassNameDedupe(runtimeItem.property, priority, runtimeItem.selector, null, runtimeItem.atRule);
|
|
714
|
-
className = getAtomicClassName(runtimeItem.property, priority, value, runtimeItem.selector, null, runtimeItem.atRule, runtimeItem.callsite, DEV_CONFIG.isLocalClassNameEnabled, DEBUG_CONFIG.isDebugClassNameEnabled, CSS_CONFIG.classNameFormat ?? null, runtimeItem.transformClassName ?? null, CSS_CONFIG.transformClassNameFormat ?? null);
|
|
715
|
-
runtimeItem.dedupe = dedupe;
|
|
716
|
-
runtimeItem.className = className;
|
|
717
|
-
lookupIndex = lookup[dedupe];
|
|
718
|
-
if (typeof lookupIndex === "number") styles[lookupIndex] = runtimeItem;
|
|
719
|
-
else lookup[dedupe] = styles.push(runtimeItem) - 1;
|
|
720
|
-
}
|
|
721
|
-
return data;
|
|
722
|
-
}
|
|
723
|
-
function getMergedStyleDebug(debug, item) {
|
|
724
|
-
if (!debug) return null;
|
|
725
|
-
if (debug.fields?.[item.property]) return debug;
|
|
726
|
-
const valueLoc = getMergedItemValueLoc(item);
|
|
727
|
-
if (!valueLoc) return debug;
|
|
728
|
-
return {
|
|
729
|
-
...debug,
|
|
730
|
-
fields: {
|
|
731
|
-
...debug.fields,
|
|
732
|
-
[item.property]: {
|
|
733
|
-
[0]: withDebugSource(debug.loc, debug),
|
|
734
|
-
[1]: valueLoc
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
function getMergedItemValueLoc(item) {
|
|
740
|
-
if (item.debug && item.debugField) {
|
|
741
|
-
const loc = item.debug.fields?.[item.debugField];
|
|
742
|
-
if (Array.isArray(loc)) return withDebugSource(loc, item.debug);
|
|
743
|
-
if (loc) {
|
|
744
|
-
const traceLoc = loc[1] ?? loc[0] ?? null;
|
|
745
|
-
return traceLoc ? withDebugSource(traceLoc, item.debug) : null;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return item.callsite ? [
|
|
749
|
-
item.callsite.line,
|
|
750
|
-
item.callsite.column,
|
|
751
|
-
void 0,
|
|
752
|
-
item.callsite.sourceUrl,
|
|
753
|
-
item.callsite.sourceContent
|
|
754
|
-
] : null;
|
|
755
|
-
}
|
|
756
|
-
function withDebugSource(loc, debug) {
|
|
757
|
-
return loc[3] ? loc : [
|
|
758
|
-
loc[0],
|
|
759
|
-
loc[1],
|
|
760
|
-
loc[2],
|
|
761
|
-
debug.sourceUrl,
|
|
762
|
-
debug.code
|
|
763
|
-
];
|
|
764
|
-
}
|
|
765
|
-
function normalizeSelectorArg(arg) {
|
|
766
|
-
return arg.includes("\n") ? arg.replace(/\n/g, "") : arg;
|
|
767
|
-
}
|
|
768
|
-
//#endregion
|
|
769
|
-
//#region builder/style_data.ts
|
|
770
|
-
const mergeStyleCreate = (callsite) => {
|
|
771
|
-
return createStyleData(callsite);
|
|
772
|
-
};
|
|
773
|
-
const mergeStyleData = createMerge(mergeStyleCreate, 1);
|
|
774
|
-
const mergeSlotCreate = (callsite, data) => {
|
|
775
|
-
return createSlotData(callsite, data[BUILDER_SLOT_ID]);
|
|
776
|
-
};
|
|
777
|
-
const mergeSlotData = createMerge(mergeSlotCreate, 2);
|
|
778
|
-
const mergeSlotOverrideCreate = (callsite, data) => {
|
|
779
|
-
return createSlotOverrideData(callsite, data[BUILDER_SLOT_ID]);
|
|
780
|
-
};
|
|
781
|
-
const mergeSlotOverrideData = createMerge(mergeSlotOverrideCreate, 3);
|
|
782
|
-
function createMerge(create, type) {
|
|
783
|
-
return (data, callsite, style, debug, selector, atRule) => {
|
|
784
|
-
return mergeBuilderData(create, callsite, data, style, debug, selector, atRule, type);
|
|
785
|
-
};
|
|
786
|
-
}
|
|
787
|
-
//#endregion
|
|
788
|
-
//#region builder/utils.ts
|
|
789
|
-
const FnPrefixStyle = "style.";
|
|
790
|
-
const FnPrefixSlot = "slot.";
|
|
791
|
-
const FnPrefixScope = "scope.";
|
|
792
|
-
function runtimeCallsite() {
|
|
793
|
-
return traceCallsite();
|
|
794
|
-
}
|
|
795
|
-
function resolveCallsite(debug) {
|
|
796
|
-
return debug ? getDebugCallsite(debug) : runtimeCallsite();
|
|
797
|
-
}
|
|
798
|
-
function transformStyle(style, transform) {
|
|
799
|
-
return transform ? transform.transform(style) : style;
|
|
800
|
-
}
|
|
801
|
-
//#endregion
|
|
802
152
|
//#region builder/style_fns.ts
|
|
803
153
|
const createDefaultFnResult = (data, fns) => {
|
|
804
154
|
return Object.assign(Object.create(fns), data);
|
|
@@ -849,9 +199,9 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
849
199
|
let arg;
|
|
850
200
|
let style;
|
|
851
201
|
let debug;
|
|
852
|
-
let
|
|
202
|
+
let weight = null;
|
|
853
203
|
if (hasArg) if (isMedia && typeof params[0] === "number") {
|
|
854
|
-
|
|
204
|
+
weight = params[0];
|
|
855
205
|
arg = params[1];
|
|
856
206
|
style = params[2];
|
|
857
207
|
debug = params[3];
|
|
@@ -861,7 +211,7 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
861
211
|
debug = params[2];
|
|
862
212
|
}
|
|
863
213
|
else if (isMedia && typeof params[0] === "number") {
|
|
864
|
-
|
|
214
|
+
weight = params[0];
|
|
865
215
|
arg = fnSelector.selector;
|
|
866
216
|
style = params[1];
|
|
867
217
|
debug = params[2];
|
|
@@ -881,7 +231,7 @@ function createAtRuleFn$1(mergeData, fns, createFnResult, fnPrefix, fnName, fnSe
|
|
|
881
231
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
882
232
|
for (let j = 0, len = items.length; j < len; j++) {
|
|
883
233
|
const item = items[j];
|
|
884
|
-
data = mergeData(data, callsite, isStyleData(item) ? item : transformStyle(item, transform), debug ?? null, null, [
|
|
234
|
+
data = mergeData(data, callsite, isStyleData(item) ? item : transformStyle(item, transform), debug ?? null, null, [weight !== null ? [selector, weight] : selector]);
|
|
885
235
|
}
|
|
886
236
|
}
|
|
887
237
|
return createFnResult(data, fns);
|
|
@@ -948,9 +298,9 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
948
298
|
let arg;
|
|
949
299
|
let data;
|
|
950
300
|
let debug;
|
|
951
|
-
let
|
|
301
|
+
let weight = null;
|
|
952
302
|
if (hasArg) if (isMedia && typeof params[0] === "number") {
|
|
953
|
-
|
|
303
|
+
weight = params[0];
|
|
954
304
|
arg = params[1];
|
|
955
305
|
data = params[2];
|
|
956
306
|
debug = params[3];
|
|
@@ -960,7 +310,7 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
960
310
|
debug = params[2];
|
|
961
311
|
}
|
|
962
312
|
else if (isMedia && typeof params[0] === "number") {
|
|
963
|
-
|
|
313
|
+
weight = params[0];
|
|
964
314
|
arg = fnSelector.selector;
|
|
965
315
|
data = params[1];
|
|
966
316
|
debug = params[2];
|
|
@@ -977,7 +327,7 @@ function createScopeAtRuleFn(fnPrefix, fnName, fnSelector, cloneScope) {
|
|
|
977
327
|
selector = args[i];
|
|
978
328
|
if (hasArg && DEV_CONFIG.isCheckSelectorEnabled);
|
|
979
329
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
980
|
-
result = mergeScopeItems(result, callsite, data, debug ?? null, null,
|
|
330
|
+
result = mergeScopeItems(result, callsite, data, debug ?? null, null, weight !== null ? [selector, weight] : selector, cloneScope);
|
|
981
331
|
}
|
|
982
332
|
return result;
|
|
983
333
|
};
|
|
@@ -1065,9 +415,9 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1065
415
|
const [withoutDebug, debug] = splitDebug(params);
|
|
1066
416
|
let arg;
|
|
1067
417
|
let items;
|
|
1068
|
-
let
|
|
418
|
+
let weight = null;
|
|
1069
419
|
if (hasArg) if (isMedia && typeof withoutDebug[0] === "number") {
|
|
1070
|
-
|
|
420
|
+
weight = withoutDebug[0];
|
|
1071
421
|
arg = withoutDebug[1];
|
|
1072
422
|
items = withoutDebug.slice(2);
|
|
1073
423
|
} else {
|
|
@@ -1075,7 +425,7 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1075
425
|
items = withoutDebug.slice(1);
|
|
1076
426
|
}
|
|
1077
427
|
else if (isMedia && typeof withoutDebug[0] === "number") {
|
|
1078
|
-
|
|
428
|
+
weight = withoutDebug[0];
|
|
1079
429
|
arg = fnSelector.selector;
|
|
1080
430
|
items = withoutDebug.slice(1);
|
|
1081
431
|
} else {
|
|
@@ -1090,7 +440,7 @@ function createAtRuleFn(fns, fnPrefix, fnName, fnSelector, transform) {
|
|
|
1090
440
|
let selector = argItem;
|
|
1091
441
|
if (hasArg && DEV_CONFIG.isCheckSelectorEnabled) checkSelector$1(fnPrefix, fnName, fnSelector, selector);
|
|
1092
442
|
selector = hasArg ? before + normalizeSelectorArg(selector) + after : selector;
|
|
1093
|
-
data = mergeStyleData(data, callsite, classNameStyle.style, classNameStyle.debug, null, [
|
|
443
|
+
data = mergeStyleData(data, callsite, classNameStyle.style, classNameStyle.debug, null, [weight !== null ? [selector, weight] : selector]);
|
|
1094
444
|
}
|
|
1095
445
|
return createDefaultFnResult(data, fns);
|
|
1096
446
|
};
|
|
@@ -1140,7 +490,8 @@ function classNameItemsToStyle(items, transform, debug) {
|
|
|
1140
490
|
for (const item of flattenClassNameItems(items)) {
|
|
1141
491
|
const transformed = decorateClassNameStyle(transform.transform(item.className), item.className);
|
|
1142
492
|
const weighted = item.weight === null ? transformed : applyClassNameWeight(transformed, item.weight);
|
|
1143
|
-
|
|
493
|
+
const nextStyle = item.important ? applyClassNameImportant(weighted) : weighted;
|
|
494
|
+
style = style ? Object.assign({}, style, nextStyle) : nextStyle;
|
|
1144
495
|
const loc = debug?.classNames?.[item.className];
|
|
1145
496
|
if (loc) {
|
|
1146
497
|
const nextDebugFields = debugFields ? Object.assign({}, debugFields) : Object.assign({}, debug?.fields ?? {});
|
|
@@ -1163,15 +514,16 @@ function decorateClassNameStyle(style, className) {
|
|
|
1163
514
|
result[property] = value;
|
|
1164
515
|
continue;
|
|
1165
516
|
}
|
|
1166
|
-
|
|
1167
|
-
const rawValue = value[1];
|
|
1168
|
-
result[property] = isClassNameValue(rawValue) ? value : [value[0], classNameValue(rawValue, className)];
|
|
1169
|
-
continue;
|
|
1170
|
-
}
|
|
1171
|
-
result[property] = isClassNameValue(value) ? value : classNameValue(value, className);
|
|
517
|
+
result[property] = decorateClassNameValue(value, className);
|
|
1172
518
|
}
|
|
1173
519
|
return result;
|
|
1174
520
|
}
|
|
521
|
+
function decorateClassNameValue(value, className) {
|
|
522
|
+
if (isClassNameValue(value)) return value;
|
|
523
|
+
if (isStyleImportantValue(value)) return importantValue(decorateClassNameValue(value.value, className));
|
|
524
|
+
if (isStyleWeightValue(value)) return weightValue(decorateClassNameValue(value.value, className), value.weight);
|
|
525
|
+
return classNameValue(value, className);
|
|
526
|
+
}
|
|
1175
527
|
function flattenClassNameItems(items) {
|
|
1176
528
|
const result = [];
|
|
1177
529
|
for (const item of items) collectClassNameItem(item, result);
|
|
@@ -1182,6 +534,7 @@ function collectClassNameItem(item, result) {
|
|
|
1182
534
|
if (typeof item === "string") {
|
|
1183
535
|
result.push({
|
|
1184
536
|
className: item,
|
|
537
|
+
important: false,
|
|
1185
538
|
weight: null
|
|
1186
539
|
});
|
|
1187
540
|
return;
|
|
@@ -1190,13 +543,29 @@ function collectClassNameItem(item, result) {
|
|
|
1190
543
|
for (const child of item) collectClassNameItem(child, result);
|
|
1191
544
|
return;
|
|
1192
545
|
}
|
|
1193
|
-
if (isWeightedClassName(item))
|
|
546
|
+
if (isWeightedClassName(item)) {
|
|
547
|
+
result.push({
|
|
548
|
+
...item,
|
|
549
|
+
important: false
|
|
550
|
+
});
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (isImportantClassName(item)) result.push({
|
|
554
|
+
className: item.className,
|
|
555
|
+
important: true,
|
|
556
|
+
weight: null
|
|
557
|
+
});
|
|
1194
558
|
}
|
|
1195
559
|
function isWeightedClassName(item) {
|
|
1196
560
|
if (!item || typeof item !== "object") return false;
|
|
1197
561
|
const weighted = item;
|
|
1198
562
|
return typeof weighted.className === "string" && typeof weighted.weight === "number";
|
|
1199
563
|
}
|
|
564
|
+
function isImportantClassName(item) {
|
|
565
|
+
if (!item || typeof item !== "object") return false;
|
|
566
|
+
const important = item;
|
|
567
|
+
return typeof important.className === "string" && important.important === true;
|
|
568
|
+
}
|
|
1200
569
|
function applyClassNameWeight(style, weight) {
|
|
1201
570
|
const weighted = {};
|
|
1202
571
|
for (const [property, value] of Object.entries(style)) {
|
|
@@ -1204,10 +573,21 @@ function applyClassNameWeight(style, weight) {
|
|
|
1204
573
|
weighted[property] = value;
|
|
1205
574
|
continue;
|
|
1206
575
|
}
|
|
1207
|
-
weighted[property] =
|
|
576
|
+
weighted[property] = weightValue(value, weight);
|
|
1208
577
|
}
|
|
1209
578
|
return weighted;
|
|
1210
579
|
}
|
|
580
|
+
function applyClassNameImportant(style) {
|
|
581
|
+
const important = {};
|
|
582
|
+
for (const [property, value] of Object.entries(style)) {
|
|
583
|
+
if (value === null || value === void 0) {
|
|
584
|
+
important[property] = value;
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
important[property] = importantValue(value);
|
|
588
|
+
}
|
|
589
|
+
return important;
|
|
590
|
+
}
|
|
1211
591
|
function splitDebug(params) {
|
|
1212
592
|
const last = params[params.length - 1];
|
|
1213
593
|
if (!isDebugData(last)) return [params.slice(), void 0];
|
|
@@ -1312,6 +692,36 @@ selectorPriority({
|
|
|
1312
692
|
...AtRuleSelectors
|
|
1313
693
|
}, PrioritySelectors);
|
|
1314
694
|
//#endregion
|
|
695
|
+
//#region builder/selector_override_core.ts
|
|
696
|
+
function normalizeManualSelectors$1(input, assertManualSelector) {
|
|
697
|
+
const selectors = Array.isArray(input) ? input : [input];
|
|
698
|
+
if (!selectors.length) throw new Error("selector array cannot be empty");
|
|
699
|
+
return selectors.flatMap((selector) => normalizeManualSelector(selector, assertManualSelector));
|
|
700
|
+
}
|
|
701
|
+
function assertManualSelectorSyntax(selector) {
|
|
702
|
+
if (!selector) throw new Error("selector cannot be empty");
|
|
703
|
+
if (selector.includes("{") || selector.includes("}")) throw new Error("selector must not contain \"{\" or \"}\"");
|
|
704
|
+
if (selector.includes(",")) throw new Error("selector must not contain \",\"; use an array of selectors instead");
|
|
705
|
+
const ampersandIndex = selector.indexOf("&");
|
|
706
|
+
if (ampersandIndex > 0) throw new Error("selector can only use \"&\" at the beginning");
|
|
707
|
+
const ampersandSelector = selector.startsWith("&?") ? selector.slice(2) : selector.slice(1);
|
|
708
|
+
if (ampersandIndex === 0 && ampersandSelector && /^\s/.test(ampersandSelector)) throw new Error("selector cannot have whitespace after \"&\"; omit \"&\" for descendant selectors");
|
|
709
|
+
}
|
|
710
|
+
function normalizeManualSelector(selector, assertManualSelector) {
|
|
711
|
+
const value = selector.trim();
|
|
712
|
+
assertManualSelector(value);
|
|
713
|
+
if (value.startsWith("&?")) {
|
|
714
|
+
const suffix = value.slice(2);
|
|
715
|
+
return suffix ? [SHEET_SELECTOR_ANCHOR + suffix, SHEET_SELECTOR_ANCHOR + " " + suffix] : [SHEET_SELECTOR_ANCHOR];
|
|
716
|
+
}
|
|
717
|
+
return [SHEET_SELECTOR_ANCHOR + (value.startsWith("&") ? value.slice(1) : " " + value)];
|
|
718
|
+
}
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region builder/selector_override.noop.ts
|
|
721
|
+
function normalizeManualSelectors(input) {
|
|
722
|
+
return normalizeManualSelectors$1(input, assertManualSelectorSyntax);
|
|
723
|
+
}
|
|
724
|
+
//#endregion
|
|
1315
725
|
//#region builder/style_builder.ts
|
|
1316
726
|
function createStyleBuilder(selectors, transform) {
|
|
1317
727
|
const fns = createStyleFns(mergeStyleData, selectors, FnPrefixStyle, transform, null);
|
|
@@ -1345,6 +755,20 @@ function createSlotBuilder(selectors, transform) {
|
|
|
1345
755
|
traceMarker(fn, "slot");
|
|
1346
756
|
return fn;
|
|
1347
757
|
}
|
|
758
|
+
function createSelectorBuilder(selectors, transform) {
|
|
759
|
+
const fns = createStyleFns(mergeSelectorOverrideData, selectors, FnPrefixSelector, transform, null);
|
|
760
|
+
const fn = (selector, style, debug) => {
|
|
761
|
+
if (isDebugData(style) && debug === void 0) {
|
|
762
|
+
debug = style;
|
|
763
|
+
style = void 0;
|
|
764
|
+
}
|
|
765
|
+
const target = createCallableSelector(createSelectorData(resolveCallsite(debug), normalizeManualSelectors(selector)), fns, transform);
|
|
766
|
+
if (style === void 0) return target;
|
|
767
|
+
return target(style, debug);
|
|
768
|
+
};
|
|
769
|
+
traceMarker(fn, "style.selector");
|
|
770
|
+
return fn;
|
|
771
|
+
}
|
|
1348
772
|
function createScopeBuilder(selectors) {
|
|
1349
773
|
const fns = createScopeFns(selectors, FnPrefixScope, cloneScope);
|
|
1350
774
|
const fn = (items, debug) => {
|
|
@@ -1360,6 +784,34 @@ function createScopeBuilder(selectors) {
|
|
|
1360
784
|
traceMarker(fn, "scope");
|
|
1361
785
|
return fn;
|
|
1362
786
|
}
|
|
787
|
+
function createCallableSelectorOverride(data, fns, transform) {
|
|
788
|
+
const callable = ((style, debug) => {
|
|
789
|
+
if (isDebugData(style) && debug === void 0) {
|
|
790
|
+
debug = style;
|
|
791
|
+
style = void 0;
|
|
792
|
+
}
|
|
793
|
+
const callsite = resolveCallsite(debug);
|
|
794
|
+
return createCallableSelectorOverride(mergeSelectorOverrideData(createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]), callsite, style ? isStyleData(style) ? style : transformStyle(style, transform) : null, debug ?? null, null, null), fns, transform);
|
|
795
|
+
});
|
|
796
|
+
traceMarker(callable, "selector.override");
|
|
797
|
+
Object.setPrototypeOf(callable, fns);
|
|
798
|
+
Object.assign(callable, data);
|
|
799
|
+
return callable;
|
|
800
|
+
}
|
|
801
|
+
function createCallableSelector(data, overrideFns, transform) {
|
|
802
|
+
const callable = ((style, debug) => {
|
|
803
|
+
if (isDebugData(style) && debug === void 0) {
|
|
804
|
+
debug = style;
|
|
805
|
+
style = void 0;
|
|
806
|
+
}
|
|
807
|
+
const callsite = resolveCallsite(debug);
|
|
808
|
+
return createCallableSelectorOverride(mergeSelectorOverrideData(createSelectorOverrideData(callsite, data[BUILDER_SELECTOR]), callsite, style ? isStyleData(style) ? style : transformStyle(style, transform) : null, debug ?? null, null, null), overrideFns, transform);
|
|
809
|
+
});
|
|
810
|
+
traceMarker(callable, "selector");
|
|
811
|
+
Object.setPrototypeOf(callable, overrideFns);
|
|
812
|
+
Object.assign(callable, data);
|
|
813
|
+
return callable;
|
|
814
|
+
}
|
|
1363
815
|
function createCallableSlot(data, fns, overrideFns, transform) {
|
|
1364
816
|
const slotId = data[BUILDER_SLOT_ID];
|
|
1365
817
|
const callable = ((style, debug) => {
|
|
@@ -1422,9 +874,11 @@ function createStyleFn(args) {
|
|
|
1422
874
|
const fnStyle = createStyleBuilder(selectors, transform);
|
|
1423
875
|
const fnSlot = createSlotBuilder(selectors, transform);
|
|
1424
876
|
const fnScope = createScopeBuilder(selectors);
|
|
1425
|
-
const
|
|
1426
|
-
|
|
877
|
+
const fnSelector = createSelectorBuilder(selectors, transform);
|
|
878
|
+
const fnWeight = (value, weight) => {
|
|
879
|
+
return weightValue(value, weight);
|
|
1427
880
|
};
|
|
881
|
+
const fnImportant = (value) => importantValue(value);
|
|
1428
882
|
const fnRaw = (style) => style;
|
|
1429
883
|
const fnPlain = (style) => style;
|
|
1430
884
|
const fnKeyframes = ((frames, stableId) => createStyleKeyframes(frames, transform ?? null, stableId));
|
|
@@ -1436,11 +890,13 @@ function createStyleFn(args) {
|
|
|
1436
890
|
const style = fnStyle;
|
|
1437
891
|
style.slot = fnSlot;
|
|
1438
892
|
style.scope = fnScope;
|
|
1439
|
-
style.
|
|
893
|
+
style.weight = fnWeight;
|
|
894
|
+
style.important = fnImportant;
|
|
1440
895
|
style.raw = fnRaw;
|
|
1441
896
|
style.plain = fnPlain;
|
|
1442
897
|
style.keyframes = fnKeyframes;
|
|
1443
898
|
style.merge = fnMerge;
|
|
899
|
+
style.selector = fnSelector;
|
|
1444
900
|
assignStyleFnMeta(style, {
|
|
1445
901
|
mode: "StyleObject",
|
|
1446
902
|
selectors,
|
|
@@ -1466,12 +922,18 @@ function getStyleFnMeta(styleFn) {
|
|
|
1466
922
|
function createClassNameFn(args) {
|
|
1467
923
|
const { selectors, transform } = args;
|
|
1468
924
|
const className = createClassNameBuilder(selectors, transform);
|
|
1469
|
-
className.weight = (
|
|
925
|
+
className.weight = (className, weight) => {
|
|
1470
926
|
return {
|
|
1471
|
-
className
|
|
927
|
+
className,
|
|
1472
928
|
weight
|
|
1473
929
|
};
|
|
1474
930
|
};
|
|
931
|
+
className.important = (className) => {
|
|
932
|
+
return {
|
|
933
|
+
className,
|
|
934
|
+
important: true
|
|
935
|
+
};
|
|
936
|
+
};
|
|
1475
937
|
assignStyleFnMeta(className, {
|
|
1476
938
|
mode: "ClassName",
|
|
1477
939
|
selectors,
|
|
@@ -1479,20 +941,6 @@ function createClassNameFn(args) {
|
|
|
1479
941
|
});
|
|
1480
942
|
return { className };
|
|
1481
943
|
}
|
|
1482
|
-
const formatThemeName = createNameFormatter(["name"]);
|
|
1483
|
-
function createThemeClassName(name, id, themeNameFormat) {
|
|
1484
|
-
return formatThemeName(themeNameFormat || "theme[-(name)]-$hash", getIdentifierSafeHash(id, CSS_CONFIG.hashLength), { name });
|
|
1485
|
-
}
|
|
1486
|
-
function getThemeRuleCss(className, tokens, tokenNameFormat) {
|
|
1487
|
-
const declarations = [];
|
|
1488
|
-
for (let i = 0, len = tokens.length; i < len; i++) declarations.push(getThemeDeclaration(tokens[i], tokenNameFormat));
|
|
1489
|
-
return "." + escapeCssIdent(className) + "{" + declarations.join(";") + "}";
|
|
1490
|
-
}
|
|
1491
|
-
function getThemeDeclaration(token, tokenNameFormat) {
|
|
1492
|
-
const name = getTokenVarName(token, tokenNameFormat);
|
|
1493
|
-
const value = token.ref ? getTokenOverrideValue(token, tokenNameFormat) : escapeCssValue(String(token.value ?? ""));
|
|
1494
|
-
return name + ":" + value;
|
|
1495
|
-
}
|
|
1496
944
|
//#endregion
|
|
1497
945
|
//#region style/theme.ts
|
|
1498
946
|
const idCounter = createIdCounter("theme");
|
|
@@ -1508,22 +956,47 @@ function createTheme(tokens, stableId, callsite) {
|
|
|
1508
956
|
return createThemeData(callsite ?? null, id, className, tokens);
|
|
1509
957
|
}
|
|
1510
958
|
//#endregion
|
|
959
|
+
//#region style/tokens.ts
|
|
960
|
+
function createTokens(values, stableId) {
|
|
961
|
+
const tokens = {};
|
|
962
|
+
if (Array.isArray(values)) for (let i = 0, len = values.length; i < len; i++) {
|
|
963
|
+
const value = values[i];
|
|
964
|
+
tokens[value] = createStyleToken(value, getChildStableId$1(stableId, String(i)), getChildStyleTokenName(stableId, String(i)));
|
|
965
|
+
}
|
|
966
|
+
else assignTokenRecord(tokens, values, stableId, stableId ?? null);
|
|
967
|
+
return tokens;
|
|
968
|
+
}
|
|
969
|
+
function assignTokenRecord(target, values, stableId, debugName) {
|
|
970
|
+
for (let key in values) {
|
|
971
|
+
const value = values[key];
|
|
972
|
+
const childName = getChildStyleTokenName(debugName, key);
|
|
973
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
974
|
+
const child = {};
|
|
975
|
+
target[key] = child;
|
|
976
|
+
assignTokenRecord(child, value, getChildStableId$1(stableId, key), childName);
|
|
977
|
+
} else target[key] = createStyleToken(value, getChildStableId$1(stableId, key), childName);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
function getChildStableId$1(stableId, child) {
|
|
981
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
982
|
+
}
|
|
983
|
+
//#endregion
|
|
1511
984
|
//#region style/value.ts
|
|
1512
|
-
function createToken(value,
|
|
1513
|
-
return createStyleToken(value,
|
|
985
|
+
function createToken(value, stableId) {
|
|
986
|
+
return createStyleToken(value, stableId);
|
|
1514
987
|
}
|
|
1515
988
|
function createValues(...args) {
|
|
1516
989
|
let values = args[0];
|
|
1517
990
|
let isNumber = false;
|
|
1518
|
-
let
|
|
991
|
+
let stableId = args[1];
|
|
1519
992
|
if (args[0] === Number) {
|
|
1520
993
|
values = args[1];
|
|
1521
|
-
|
|
994
|
+
stableId = args[2];
|
|
1522
995
|
isNumber = true;
|
|
1523
996
|
}
|
|
1524
997
|
if (!values.length) throw new Error("[Style.values] NO_VALUES");
|
|
1525
998
|
const tokens = /* @__PURE__ */ new Map();
|
|
1526
|
-
for (let value of values) tokens.set(value,
|
|
999
|
+
for (let value of values) tokens.set(value, createStyleToken(parseValue(value, isNumber), getChildStableId(stableId, hashString(String(value))), getChildStyleTokenName(stableId ?? null, getValueDebugName(value))));
|
|
1527
1000
|
return function ValueFn(...args) {
|
|
1528
1001
|
const [value, provide, debug] = args;
|
|
1529
1002
|
const token = tokens.get(value);
|
|
@@ -1533,8 +1006,18 @@ function createValues(...args) {
|
|
|
1533
1006
|
return token;
|
|
1534
1007
|
};
|
|
1535
1008
|
}
|
|
1536
|
-
function
|
|
1537
|
-
return
|
|
1009
|
+
function getChildStableId(stableId, child) {
|
|
1010
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
1011
|
+
}
|
|
1012
|
+
function getValueDebugName(value) {
|
|
1013
|
+
if (typeof value === "number") return String(value);
|
|
1014
|
+
const parts = String(value).split(/[;|]/);
|
|
1015
|
+
const label = parts[1]?.trim();
|
|
1016
|
+
if (label) return sanitizeDebugName(label);
|
|
1017
|
+
return sanitizeDebugName(parts[0]?.trim() ?? "");
|
|
1018
|
+
}
|
|
1019
|
+
function sanitizeDebugName(value) {
|
|
1020
|
+
return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || null;
|
|
1538
1021
|
}
|
|
1539
1022
|
function parseValue(value, isNumber) {
|
|
1540
1023
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -1545,30 +1028,252 @@ function parseValue(value, isNumber) {
|
|
|
1545
1028
|
return number;
|
|
1546
1029
|
}
|
|
1547
1030
|
//#endregion
|
|
1548
|
-
//#region style/
|
|
1549
|
-
function
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1031
|
+
//#region runtime/style/scope.ts
|
|
1032
|
+
function combineScope(...scopes) {
|
|
1033
|
+
return (target) => resolveScopeTargets(target, scopes);
|
|
1034
|
+
}
|
|
1035
|
+
function bindScope(target, ...scopes) {
|
|
1036
|
+
return resolveScopeTargets(target, scopes);
|
|
1037
|
+
}
|
|
1038
|
+
function resolveScopeTargets(target, scopes) {
|
|
1039
|
+
const targets = [];
|
|
1040
|
+
const stack = scopes.slice();
|
|
1041
|
+
while (stack.length > 0) {
|
|
1042
|
+
const item = stack.pop();
|
|
1043
|
+
if (!item) continue;
|
|
1044
|
+
if (Array.isArray(item)) {
|
|
1045
|
+
for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
|
|
1046
|
+
continue;
|
|
1047
|
+
}
|
|
1048
|
+
if (isScopeData(item)) targets.push(item(target));
|
|
1049
|
+
}
|
|
1050
|
+
return targets;
|
|
1051
|
+
}
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region runtime/core/cache/pool.ts
|
|
1054
|
+
const DEFAULT_TTL = 1e3 * 60 * 5;
|
|
1055
|
+
const TOKEN_WRAPPER_CACHE_LIMIT = 32;
|
|
1056
|
+
function createCombinedStylePool(resolver, ttl = DEFAULT_TTL) {
|
|
1057
|
+
const root = createPoolNode();
|
|
1058
|
+
let timer = null;
|
|
1059
|
+
return {
|
|
1060
|
+
get(styles, inheritedScopes, items, prevTokensData = null) {
|
|
1061
|
+
if (ttl === 0) {
|
|
1062
|
+
const collected = collectItems(null, items, prevTokensData, resolver);
|
|
1063
|
+
return {
|
|
1064
|
+
style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
|
|
1065
|
+
tokenCache: null,
|
|
1066
|
+
tokens: collected.tokens
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
const now = Date.now();
|
|
1070
|
+
let node = getPoolChild(root, styles);
|
|
1071
|
+
node = walkScopes(node, inheritedScopes);
|
|
1072
|
+
const collected = collectItems(node, items, prevTokensData, resolver);
|
|
1073
|
+
node = collected.node ?? node;
|
|
1074
|
+
node.value.updatedAt = now;
|
|
1075
|
+
if (node.value.style) {
|
|
1076
|
+
scheduleCleanup();
|
|
1077
|
+
return {
|
|
1078
|
+
style: node.value.style,
|
|
1079
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
1080
|
+
tokens: collected.tokens
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
const allScopes = concatScopes(inheritedScopes, collected.scopes);
|
|
1084
|
+
node.value.style = createCombinedStyleFacade(styles, allScopes);
|
|
1085
|
+
scheduleCleanup();
|
|
1086
|
+
return {
|
|
1087
|
+
style: node.value.style,
|
|
1088
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
1089
|
+
tokens: collected.tokens
|
|
1090
|
+
};
|
|
1091
|
+
},
|
|
1092
|
+
cleanup(now = Date.now()) {
|
|
1093
|
+
cleanupNode(root, now, ttl);
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
function scheduleCleanup() {
|
|
1097
|
+
if (timer) return;
|
|
1098
|
+
timer = setTimeout(() => {
|
|
1099
|
+
timer = null;
|
|
1100
|
+
cleanupNode(root, Date.now(), ttl);
|
|
1101
|
+
}, Math.max(ttl, 0));
|
|
1102
|
+
timer.unref?.();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
function getCachedTokenWrapper(cache, tokens, create) {
|
|
1106
|
+
if (!cache) return create();
|
|
1107
|
+
const key = getTokenWrapperCacheKey(tokens);
|
|
1108
|
+
const cached = cache.get(key);
|
|
1109
|
+
if (cached) {
|
|
1110
|
+
cache.delete(key);
|
|
1111
|
+
cache.set(key, cached);
|
|
1112
|
+
return cached;
|
|
1113
|
+
}
|
|
1114
|
+
const value = create();
|
|
1115
|
+
cache.set(key, value);
|
|
1116
|
+
if (cache.size > TOKEN_WRAPPER_CACHE_LIMIT) {
|
|
1117
|
+
const oldest = cache.keys().next().value;
|
|
1118
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
1119
|
+
}
|
|
1120
|
+
return value;
|
|
1121
|
+
}
|
|
1122
|
+
function getTokenWrapperCache(node) {
|
|
1123
|
+
if (!node.tokenCache) node.tokenCache = /* @__PURE__ */ new Map();
|
|
1124
|
+
return node.tokenCache;
|
|
1125
|
+
}
|
|
1126
|
+
function getTokenWrapperCacheKey(tokens) {
|
|
1127
|
+
return tokens.ids.join("") + "" + tokens.values.join("");
|
|
1128
|
+
}
|
|
1129
|
+
function collectItems(node, items, prevTokensData, resolver) {
|
|
1130
|
+
const scopes = [];
|
|
1131
|
+
const tokens = createMutableTokenValues(prevTokensData);
|
|
1132
|
+
let currentNode = node;
|
|
1133
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
1134
|
+
const item = items[i];
|
|
1135
|
+
if (addTokenOverride(tokens, item, resolver)) continue;
|
|
1136
|
+
if (isScopeTargetData(item)) {
|
|
1137
|
+
scopes.push(item);
|
|
1138
|
+
currentNode = currentNode ? walkScope(currentNode, item) : null;
|
|
1139
|
+
addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item), resolver));
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const tokensData = finishTokenValues(prevTokensData, tokens);
|
|
1143
|
+
if (!tokensData) return {
|
|
1144
|
+
node: currentNode,
|
|
1145
|
+
scopes,
|
|
1146
|
+
tokens: null
|
|
1147
|
+
};
|
|
1148
|
+
return {
|
|
1149
|
+
node: currentNode,
|
|
1150
|
+
scopes,
|
|
1151
|
+
tokens: tokensData
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function walkScopes(node, scopes) {
|
|
1155
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
1156
|
+
const scope = scopes[i];
|
|
1157
|
+
if (!scope) continue;
|
|
1158
|
+
node = walkScope(node, scope);
|
|
1159
|
+
}
|
|
1160
|
+
return node;
|
|
1161
|
+
}
|
|
1162
|
+
function walkScope(node, scope) {
|
|
1163
|
+
node = getPoolChild(node, getScopeTargetScope(scope));
|
|
1164
|
+
node = getPoolChild(node, getScopeTargetSlotId(scope));
|
|
1165
|
+
return node;
|
|
1166
|
+
}
|
|
1167
|
+
function getScopeTokenValues(node, scope, resolver) {
|
|
1168
|
+
if (node && node.value.h && node.value.f === resolver.key) return node.value.s;
|
|
1169
|
+
const values = createMutableTokenValues(null);
|
|
1170
|
+
const items = scope[BUILDER_STATE].items;
|
|
1171
|
+
for (let i = 0, len = items.length; i < len; i++) addTokenOverride(values, items[i], resolver);
|
|
1172
|
+
const tokens = finishTokenValues(null, values);
|
|
1173
|
+
if (node) {
|
|
1174
|
+
node.value.h = true;
|
|
1175
|
+
node.value.s = tokens;
|
|
1176
|
+
node.value.f = resolver.key;
|
|
1554
1177
|
}
|
|
1555
|
-
else assignTokenRecord(tokens, values, debugId);
|
|
1556
1178
|
return tokens;
|
|
1557
1179
|
}
|
|
1558
|
-
function
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1180
|
+
function concatScopes(inheritedScopes, scopes) {
|
|
1181
|
+
const items = [];
|
|
1182
|
+
for (let i = 0, len = inheritedScopes.length; i < len; i++) {
|
|
1183
|
+
const item = inheritedScopes[i];
|
|
1184
|
+
if (item) items.push(item);
|
|
1185
|
+
}
|
|
1186
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
1187
|
+
const item = scopes[i];
|
|
1188
|
+
if (item) items.push(item);
|
|
1189
|
+
}
|
|
1190
|
+
return items;
|
|
1191
|
+
}
|
|
1192
|
+
function getPoolChild(node, key) {
|
|
1193
|
+
return getCacheTreeChild(node, key, createPoolValue);
|
|
1194
|
+
}
|
|
1195
|
+
function createPoolNode() {
|
|
1196
|
+
return createCacheTreeNode(createPoolValue());
|
|
1197
|
+
}
|
|
1198
|
+
function createPoolValue() {
|
|
1199
|
+
return {
|
|
1200
|
+
style: null,
|
|
1201
|
+
tokenCache: null,
|
|
1202
|
+
h: false,
|
|
1203
|
+
s: null,
|
|
1204
|
+
f: void 0,
|
|
1205
|
+
updatedAt: Date.now()
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function cleanupNode(node, now, ttl) {
|
|
1209
|
+
for (const [key, child] of node.children) {
|
|
1210
|
+
cleanupNode(child, now, ttl);
|
|
1211
|
+
if (child.value.style && now - child.value.updatedAt >= ttl) child.value.style = null;
|
|
1212
|
+
if (!child.value.style && !child.children.size) node.children.delete(key);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region runtime/core/cache/combine.ts
|
|
1217
|
+
function createCombinedStyleGetter(resolver) {
|
|
1218
|
+
let configuredPool = null;
|
|
1219
|
+
let configuredPoolTTL = -1;
|
|
1220
|
+
return function getConfiguredCombinedStyle(styles, args) {
|
|
1221
|
+
const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
|
|
1222
|
+
if (!configuredPool || configuredPoolTTL !== ttl) {
|
|
1223
|
+
configuredPool = createCombinedStylePool(resolver, ttl);
|
|
1224
|
+
configuredPoolTTL = ttl;
|
|
1225
|
+
}
|
|
1226
|
+
const normalized = normalizeStyleItems(styles, args, resolver);
|
|
1227
|
+
const result = configuredPool.get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
|
|
1228
|
+
return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
function normalizeStyleItems(styles, args, resolver) {
|
|
1232
|
+
const result = {
|
|
1233
|
+
inheritedScopes: [],
|
|
1234
|
+
items: [],
|
|
1235
|
+
tokens: null
|
|
1236
|
+
};
|
|
1237
|
+
for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result, resolver);
|
|
1238
|
+
return result;
|
|
1239
|
+
}
|
|
1240
|
+
function collectStyleArg(styles, arg, result, resolver) {
|
|
1241
|
+
if (!arg) return;
|
|
1242
|
+
if (Array.isArray(arg)) {
|
|
1243
|
+
for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result, resolver);
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
|
|
1247
|
+
const bound = getExtractedTokenBoundData(arg);
|
|
1248
|
+
collectStyleArg(styles, bound.data, result, resolver);
|
|
1249
|
+
result.tokens = mergeTokenOverrides(result.tokens, bound.tokens, resolver);
|
|
1250
|
+
return;
|
|
1566
1251
|
}
|
|
1252
|
+
if (isCombinedStyle(arg)) {
|
|
1253
|
+
if (getCombinedStyleStyles(arg) !== styles) throw new TypeError("[fluentic-style] combineStyle styles mismatch.");
|
|
1254
|
+
const scopes = getCombinedStyleScopes(arg);
|
|
1255
|
+
for (let i = 0, len = scopes.length; i < len; i++) result.inheritedScopes.push(scopes[i]);
|
|
1256
|
+
result.tokens = mergeTokenValues(result.tokens, getStyleTokenValues(arg));
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
if (isSheetData(arg)) {
|
|
1260
|
+
collectTokenOverrides(arg, result, resolver);
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
if (isScopeData(arg)) {
|
|
1264
|
+
collectTokenOverrides(arg, result, resolver);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
result.items.push(arg);
|
|
1567
1268
|
}
|
|
1568
|
-
function
|
|
1569
|
-
|
|
1269
|
+
function collectTokenOverrides(data, result, resolver) {
|
|
1270
|
+
const items = data[BUILDER_STATE]?.items ?? [];
|
|
1271
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
1272
|
+
const item = items[i];
|
|
1273
|
+
if (resolver.is(item)) result.tokens = mergeTokenOverrides(result.tokens, [item], resolver);
|
|
1274
|
+
}
|
|
1570
1275
|
}
|
|
1571
1276
|
//#endregion
|
|
1572
|
-
export {
|
|
1277
|
+
export { createValues as a, resetStyleThemeIdCounter as c, createStyleFn as d, getStyleFnMeta as f, type as g, transformKeyframes as h, createToken as i, createClassNameFn as l, createStyleKeyframes as m, bindScope as n, createTokens as o, style as p, combineScope as r, createTheme as s, createCombinedStyleGetter as t, assignStyleFnMeta as u };
|
|
1573
1278
|
|
|
1574
|
-
//# sourceMappingURL=
|
|
1279
|
+
//# sourceMappingURL=combine-Ca6LfFxv.js.map
|