@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
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { C as CSS_CONFIG, S as RUNTIME_CONFIG, _ as BUILDER_SCOPE, b as BUILDER_STATE, c as getResolvedStyleItemTokenValues, d as setResolvedStyleItemTokenValues, f as getStyleTokenId, g as isExtractedTokenBoundData, h as getExtractedTokenBoundData, i as getExtractedTokenOverrideValue, l as isResolvedStyleItem$1, m as hasOwn, o as createCacheTreeNode, p as isStyleTokenOverrideData, s as getCacheTreeChild, u as markResolvedStyleItem, v as BUILDER_SCOPE_ID, w as globalData, x as BUILDER_TYPE, y as BUILDER_SLOT_ID } from "./getClassName-a6p2uMFM.js";
|
|
2
|
+
//#region builder/data/is.ts
|
|
3
|
+
function getSlotId(data) {
|
|
4
|
+
return data[BUILDER_SLOT_ID];
|
|
5
|
+
}
|
|
6
|
+
function getScopeTargetSlotId(data) {
|
|
7
|
+
return data[BUILDER_SCOPE_ID];
|
|
8
|
+
}
|
|
9
|
+
function getScopeTargetScope(data) {
|
|
10
|
+
return data[BUILDER_SCOPE];
|
|
11
|
+
}
|
|
12
|
+
function isStyleData(value) {
|
|
13
|
+
return getBuilderType(value) === 1;
|
|
14
|
+
}
|
|
15
|
+
function isSlotData(value) {
|
|
16
|
+
return getBuilderType(value) === 2;
|
|
17
|
+
}
|
|
18
|
+
function isSelectorData(value) {
|
|
19
|
+
return getBuilderType(value) === 7;
|
|
20
|
+
}
|
|
21
|
+
function isSheetData(value) {
|
|
22
|
+
return getBuilderType(value) === 9;
|
|
23
|
+
}
|
|
24
|
+
function isScopeData(value) {
|
|
25
|
+
return getBuilderType(value) === 4;
|
|
26
|
+
}
|
|
27
|
+
function isScopeTargetData(value) {
|
|
28
|
+
return getBuilderType(value) === 5;
|
|
29
|
+
}
|
|
30
|
+
function getBuilderType(value) {
|
|
31
|
+
if (!value || typeof value !== "object" && typeof value !== "function") return null;
|
|
32
|
+
return value[BUILDER_TYPE];
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region runtime/core/combinedStyle.ts
|
|
36
|
+
const targets = globalData("runtime.combinedStyle.targets", () => /* @__PURE__ */ new WeakMap());
|
|
37
|
+
function createCombinedStyle(meta, getField) {
|
|
38
|
+
const target = {
|
|
39
|
+
...meta,
|
|
40
|
+
cache: Object.create(null),
|
|
41
|
+
getField
|
|
42
|
+
};
|
|
43
|
+
const proxyTarget = {};
|
|
44
|
+
const proxy = new Proxy(proxyTarget, handlers);
|
|
45
|
+
targets.set(proxyTarget, target);
|
|
46
|
+
targets.set(proxy, target);
|
|
47
|
+
return proxy;
|
|
48
|
+
}
|
|
49
|
+
function isCombinedStyle(value) {
|
|
50
|
+
return !!value && typeof value === "object" && targets.has(value);
|
|
51
|
+
}
|
|
52
|
+
function getCombinedStyleStyles(style) {
|
|
53
|
+
return getTarget(style).styles;
|
|
54
|
+
}
|
|
55
|
+
function getCombinedStyleScopes(style) {
|
|
56
|
+
return getTarget(style).scopes;
|
|
57
|
+
}
|
|
58
|
+
function getCombinedStyleTokens(style) {
|
|
59
|
+
return getTarget(style).tokens;
|
|
60
|
+
}
|
|
61
|
+
const handlers = { get(proxy, prop) {
|
|
62
|
+
const target = getTarget(proxy);
|
|
63
|
+
if (hasOwn(target.cache, prop)) return target.cache[prop];
|
|
64
|
+
const value = target.getField(target, prop);
|
|
65
|
+
if (value && typeof value === "object") target.cache[prop] = value;
|
|
66
|
+
return value;
|
|
67
|
+
} };
|
|
68
|
+
function getTarget(value) {
|
|
69
|
+
const target = targets.get(value);
|
|
70
|
+
if (!target) throw new Error("[fluentic-style] Expected combined style.");
|
|
71
|
+
return target;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region runtime/core/cache/tokenValues.ts
|
|
75
|
+
function createMutableTokenValues(base) {
|
|
76
|
+
return {
|
|
77
|
+
ids: base ? base.ids.slice() : null,
|
|
78
|
+
values: base ? base.values.slice() : null,
|
|
79
|
+
lookup: base ? { ...base.lookup } : null,
|
|
80
|
+
index: base ? createTokenIndexLookup(base.ids) : null
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function addTokenOverride(values, item, resolver) {
|
|
84
|
+
if (!resolver.is(item)) return false;
|
|
85
|
+
addTokenValue(values, resolver.id(item), resolver.value(item));
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function addTokenValue(values, id, value) {
|
|
89
|
+
if (!values.ids) values.ids = [];
|
|
90
|
+
if (!values.values) values.values = [];
|
|
91
|
+
if (!values.lookup) values.lookup = Object.create(null);
|
|
92
|
+
if (!values.index) values.index = Object.create(null);
|
|
93
|
+
const ids = values.ids;
|
|
94
|
+
const tokenValues = values.values;
|
|
95
|
+
const lookup = values.lookup;
|
|
96
|
+
const indexLookup = values.index;
|
|
97
|
+
const index = indexLookup[id];
|
|
98
|
+
if (index === void 0) {
|
|
99
|
+
indexLookup[id] = ids.push(id) - 1;
|
|
100
|
+
tokenValues.push(value);
|
|
101
|
+
} else tokenValues[index] = value;
|
|
102
|
+
lookup[id] = value;
|
|
103
|
+
}
|
|
104
|
+
function addTokenValues(values, next) {
|
|
105
|
+
if (!next) return;
|
|
106
|
+
for (let i = 0, len = next.ids.length; i < len; i++) addTokenValue(values, next.ids[i], next.values[i]);
|
|
107
|
+
}
|
|
108
|
+
function addTokenOverrides(values, overrides, resolver) {
|
|
109
|
+
for (let i = 0, len = overrides.length; i < len; i++) addTokenOverride(values, overrides[i], resolver);
|
|
110
|
+
}
|
|
111
|
+
function finishTokenValues(base, values) {
|
|
112
|
+
if (!values.ids || !values.values || !values.lookup) return null;
|
|
113
|
+
if (isSameTokenValues(base, values.ids, values.values)) return base;
|
|
114
|
+
return {
|
|
115
|
+
ids: values.ids,
|
|
116
|
+
values: values.values,
|
|
117
|
+
lookup: values.lookup
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function mergeTokenValues(base, next) {
|
|
121
|
+
if (!next) return base;
|
|
122
|
+
if (!base) return next;
|
|
123
|
+
const values = createMutableTokenValues(base);
|
|
124
|
+
addTokenValues(values, next);
|
|
125
|
+
return finishTokenValues(base, values);
|
|
126
|
+
}
|
|
127
|
+
function mergeTokenOverrides(base, overrides, resolver) {
|
|
128
|
+
if (!overrides.length) return base;
|
|
129
|
+
const values = createMutableTokenValues(base);
|
|
130
|
+
addTokenOverrides(values, overrides, resolver);
|
|
131
|
+
return finishTokenValues(base, values);
|
|
132
|
+
}
|
|
133
|
+
function createTokenIndexLookup(ids) {
|
|
134
|
+
const lookup = Object.create(null);
|
|
135
|
+
for (let i = 0, len = ids.length; i < len; i++) lookup[ids[i]] = i;
|
|
136
|
+
return lookup;
|
|
137
|
+
}
|
|
138
|
+
function isSameTokenValues(base, ids, values) {
|
|
139
|
+
if (!base || base.ids.length !== ids.length) return false;
|
|
140
|
+
const baseLookup = base.lookup;
|
|
141
|
+
for (let i = 0, len = ids.length; i < len; i++) {
|
|
142
|
+
if (!hasOwn(baseLookup, ids[i])) return false;
|
|
143
|
+
if (baseLookup[ids[i]] !== values[i]) return false;
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
globalData("runtime.directStyleItemCache", () => /* @__PURE__ */ new WeakMap());
|
|
148
|
+
function isResolvedStyleItem(value) {
|
|
149
|
+
return isResolvedStyleItem$1(value);
|
|
150
|
+
}
|
|
151
|
+
function createResolvedStyleItem(data, scopes, tokens = null) {
|
|
152
|
+
return createStyleItem({
|
|
153
|
+
data,
|
|
154
|
+
items: resolveItems(data, scopes)
|
|
155
|
+
}, tokens);
|
|
156
|
+
}
|
|
157
|
+
function getStyleTokenValues(value) {
|
|
158
|
+
if (isCombinedStyle(value)) return getCombinedStyleTokens(value);
|
|
159
|
+
return getResolvedStyleItemTokenValues(value);
|
|
160
|
+
}
|
|
161
|
+
function createCombinedStyleFacade(styles, scopes) {
|
|
162
|
+
return createCombinedStyle({
|
|
163
|
+
styles,
|
|
164
|
+
scopes,
|
|
165
|
+
tokens: null
|
|
166
|
+
}, getStyleField);
|
|
167
|
+
}
|
|
168
|
+
function createCombinedStyleTokenWrapper(style, tokens) {
|
|
169
|
+
return createCombinedStyle({
|
|
170
|
+
styles: getCombinedStyleStyles(style),
|
|
171
|
+
scopes: getCombinedStyleScopes(style),
|
|
172
|
+
tokens
|
|
173
|
+
}, getTokenField(style));
|
|
174
|
+
}
|
|
175
|
+
const getStyleField = (meta, prop) => {
|
|
176
|
+
const value = meta.styles?.[prop] ?? null;
|
|
177
|
+
if (isStyleData(value) || isSheetData(value) || isSlotData(value)) return createResolvedStyleItem(value, meta.scopes);
|
|
178
|
+
if (isSelectorData(value)) return value;
|
|
179
|
+
if (value && typeof value === "object") return createCombinedStyleFacade(value, meta.scopes);
|
|
180
|
+
return value;
|
|
181
|
+
};
|
|
182
|
+
function getTokenField(base) {
|
|
183
|
+
return (meta, prop) => {
|
|
184
|
+
const value = base?.[prop] ?? null;
|
|
185
|
+
if (isResolvedStyleItem(value)) {
|
|
186
|
+
const tokens = mergeTokenValues(getStyleTokenValues(value), meta.tokens);
|
|
187
|
+
return createStyleItem({
|
|
188
|
+
data: value.data,
|
|
189
|
+
items: value.items
|
|
190
|
+
}, tokens);
|
|
191
|
+
}
|
|
192
|
+
if (isCombinedStyle(value)) return createCombinedStyleTokenWrapper(value, meta.tokens);
|
|
193
|
+
return value;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function createStyleItem(item, tokens = null) {
|
|
197
|
+
markResolvedStyleItem(item);
|
|
198
|
+
if (tokens) setResolvedStyleItemTokenValues(item, tokens);
|
|
199
|
+
return item;
|
|
200
|
+
}
|
|
201
|
+
function resolveItems(data, scopes) {
|
|
202
|
+
const items = [];
|
|
203
|
+
const stateItems = data[BUILDER_STATE]?.items ?? [];
|
|
204
|
+
const slotId = isSlotData(data) ? getSlotId(data) : null;
|
|
205
|
+
for (let i = 0, len = stateItems.length; i < len; i++) {
|
|
206
|
+
const item = stateItems[i];
|
|
207
|
+
if (Array.isArray(item)) {
|
|
208
|
+
items.push(item);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (isStyleTokenOverrideData(item)) {
|
|
212
|
+
items.push(item);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (slotId && item.type !== 2) continue;
|
|
216
|
+
items.push(item);
|
|
217
|
+
}
|
|
218
|
+
if (!slotId || isSheetData(data)) return items;
|
|
219
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
220
|
+
const boundScope = scopes[i];
|
|
221
|
+
const scope = getScopeTargetScope(boundScope);
|
|
222
|
+
if (!scope) continue;
|
|
223
|
+
const scopeItems = scope[BUILDER_STATE]?.items;
|
|
224
|
+
if (!scopeItems) continue;
|
|
225
|
+
const targetSlotId = getScopeTargetSlotId(boundScope);
|
|
226
|
+
for (let j = 0, len = scopeItems.length; j < len; j++) {
|
|
227
|
+
const item = scopeItems[j];
|
|
228
|
+
if (Array.isArray(item)) {
|
|
229
|
+
if (item[1] === slotId) items.push(item);
|
|
230
|
+
const hasParentSelector = isExtractedScopeParentMarker(item[4]) || isExtractedScopeParentMarker(item[5]);
|
|
231
|
+
if (targetSlotId === slotId && hasParentSelector) items.push(getScopeParentItem(String(item[3])));
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (isStyleTokenOverrideData(item)) continue;
|
|
235
|
+
if (item.type !== 4) continue;
|
|
236
|
+
if (item.slotId === slotId) items.push(item);
|
|
237
|
+
if (item.parentSelector && targetSlotId === slotId) items.push(getScopeParentItem(item.className));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return items;
|
|
241
|
+
}
|
|
242
|
+
function getScopeParentItem(className) {
|
|
243
|
+
const parentClassName = formatScopeClassName(className);
|
|
244
|
+
return [parentClassName, parentClassName];
|
|
245
|
+
}
|
|
246
|
+
function formatScopeClassName(className) {
|
|
247
|
+
const format = CSS_CONFIG.scopeClassNameFormat;
|
|
248
|
+
if (!format) return "-" + className;
|
|
249
|
+
if (typeof format === "function") return format({ className });
|
|
250
|
+
return format.replace(/\[|\]/g, "").replace(/\(className\)/g, className);
|
|
251
|
+
}
|
|
252
|
+
function isExtractedScopeParentMarker(value) {
|
|
253
|
+
return value === 1 || value === true;
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region runtime/core/cache/pool.ts
|
|
257
|
+
const DEFAULT_TTL = 1e3 * 60 * 5;
|
|
258
|
+
const TOKEN_WRAPPER_CACHE_LIMIT = 32;
|
|
259
|
+
function createCombinedStylePool(resolver, ttl = DEFAULT_TTL) {
|
|
260
|
+
const root = createPoolNode();
|
|
261
|
+
let timer = null;
|
|
262
|
+
return {
|
|
263
|
+
get(styles, inheritedScopes, items, prevTokensData = null) {
|
|
264
|
+
if (ttl === 0) {
|
|
265
|
+
const collected = collectItems(null, items, prevTokensData, resolver);
|
|
266
|
+
return {
|
|
267
|
+
style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
|
|
268
|
+
tokenCache: null,
|
|
269
|
+
tokens: collected.tokens
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const now = Date.now();
|
|
273
|
+
let node = getPoolChild(root, styles);
|
|
274
|
+
node = walkScopes(node, inheritedScopes);
|
|
275
|
+
const collected = collectItems(node, items, prevTokensData, resolver);
|
|
276
|
+
node = collected.node ?? node;
|
|
277
|
+
node.value.updatedAt = now;
|
|
278
|
+
if (node.value.style) {
|
|
279
|
+
scheduleCleanup();
|
|
280
|
+
return {
|
|
281
|
+
style: node.value.style,
|
|
282
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
283
|
+
tokens: collected.tokens
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const allScopes = concatScopes(inheritedScopes, collected.scopes);
|
|
287
|
+
node.value.style = createCombinedStyleFacade(styles, allScopes);
|
|
288
|
+
scheduleCleanup();
|
|
289
|
+
return {
|
|
290
|
+
style: node.value.style,
|
|
291
|
+
tokenCache: collected.tokens ? getTokenWrapperCache(node.value) : null,
|
|
292
|
+
tokens: collected.tokens
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
cleanup(now = Date.now()) {
|
|
296
|
+
cleanupNode(root, now, ttl);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
function scheduleCleanup() {
|
|
300
|
+
if (timer) return;
|
|
301
|
+
timer = setTimeout(() => {
|
|
302
|
+
timer = null;
|
|
303
|
+
cleanupNode(root, Date.now(), ttl);
|
|
304
|
+
}, Math.max(ttl, 0));
|
|
305
|
+
timer.unref?.();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function getCachedTokenWrapper(cache, tokens, create) {
|
|
309
|
+
if (!cache) return create();
|
|
310
|
+
const key = getTokenWrapperCacheKey(tokens);
|
|
311
|
+
const cached = cache.get(key);
|
|
312
|
+
if (cached) {
|
|
313
|
+
cache.delete(key);
|
|
314
|
+
cache.set(key, cached);
|
|
315
|
+
return cached;
|
|
316
|
+
}
|
|
317
|
+
const value = create();
|
|
318
|
+
cache.set(key, value);
|
|
319
|
+
if (cache.size > TOKEN_WRAPPER_CACHE_LIMIT) {
|
|
320
|
+
const oldest = cache.keys().next().value;
|
|
321
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
322
|
+
}
|
|
323
|
+
return value;
|
|
324
|
+
}
|
|
325
|
+
function getTokenWrapperCache(node) {
|
|
326
|
+
if (!node.tokenCache) node.tokenCache = /* @__PURE__ */ new Map();
|
|
327
|
+
return node.tokenCache;
|
|
328
|
+
}
|
|
329
|
+
function getTokenWrapperCacheKey(tokens) {
|
|
330
|
+
return tokens.ids.join("") + "" + tokens.values.join("");
|
|
331
|
+
}
|
|
332
|
+
function collectItems(node, items, prevTokensData, resolver) {
|
|
333
|
+
const scopes = [];
|
|
334
|
+
const tokens = createMutableTokenValues(prevTokensData);
|
|
335
|
+
let currentNode = node;
|
|
336
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
337
|
+
const item = items[i];
|
|
338
|
+
if (addTokenOverride(tokens, item, resolver)) continue;
|
|
339
|
+
if (isScopeTargetData(item)) {
|
|
340
|
+
scopes.push(item);
|
|
341
|
+
currentNode = currentNode ? walkScope(currentNode, item) : null;
|
|
342
|
+
addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item), resolver));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const tokensData = finishTokenValues(prevTokensData, tokens);
|
|
346
|
+
if (!tokensData) return {
|
|
347
|
+
node: currentNode,
|
|
348
|
+
scopes,
|
|
349
|
+
tokens: null
|
|
350
|
+
};
|
|
351
|
+
return {
|
|
352
|
+
node: currentNode,
|
|
353
|
+
scopes,
|
|
354
|
+
tokens: tokensData
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function walkScopes(node, scopes) {
|
|
358
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
359
|
+
const scope = scopes[i];
|
|
360
|
+
if (!scope) continue;
|
|
361
|
+
node = walkScope(node, scope);
|
|
362
|
+
}
|
|
363
|
+
return node;
|
|
364
|
+
}
|
|
365
|
+
function walkScope(node, scope) {
|
|
366
|
+
node = getPoolChild(node, getScopeTargetScope(scope));
|
|
367
|
+
node = getPoolChild(node, getScopeTargetSlotId(scope));
|
|
368
|
+
return node;
|
|
369
|
+
}
|
|
370
|
+
function getScopeTokenValues(node, scope, resolver) {
|
|
371
|
+
if (node && node.value.h && node.value.f === resolver.key) return node.value.s;
|
|
372
|
+
const values = createMutableTokenValues(null);
|
|
373
|
+
const items = scope[BUILDER_STATE].items;
|
|
374
|
+
for (let i = 0, len = items.length; i < len; i++) addTokenOverride(values, items[i], resolver);
|
|
375
|
+
const tokens = finishTokenValues(null, values);
|
|
376
|
+
if (node) {
|
|
377
|
+
node.value.h = true;
|
|
378
|
+
node.value.s = tokens;
|
|
379
|
+
node.value.f = resolver.key;
|
|
380
|
+
}
|
|
381
|
+
return tokens;
|
|
382
|
+
}
|
|
383
|
+
function concatScopes(inheritedScopes, scopes) {
|
|
384
|
+
const items = [];
|
|
385
|
+
for (let i = 0, len = inheritedScopes.length; i < len; i++) {
|
|
386
|
+
const item = inheritedScopes[i];
|
|
387
|
+
if (item) items.push(item);
|
|
388
|
+
}
|
|
389
|
+
for (let i = 0, len = scopes.length; i < len; i++) {
|
|
390
|
+
const item = scopes[i];
|
|
391
|
+
if (item) items.push(item);
|
|
392
|
+
}
|
|
393
|
+
return items;
|
|
394
|
+
}
|
|
395
|
+
function getPoolChild(node, key) {
|
|
396
|
+
return getCacheTreeChild(node, key, createPoolValue);
|
|
397
|
+
}
|
|
398
|
+
function createPoolNode() {
|
|
399
|
+
return createCacheTreeNode(createPoolValue());
|
|
400
|
+
}
|
|
401
|
+
function createPoolValue() {
|
|
402
|
+
return {
|
|
403
|
+
style: null,
|
|
404
|
+
tokenCache: null,
|
|
405
|
+
h: false,
|
|
406
|
+
s: null,
|
|
407
|
+
f: void 0,
|
|
408
|
+
updatedAt: Date.now()
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function cleanupNode(node, now, ttl) {
|
|
412
|
+
for (const [key, child] of node.children) {
|
|
413
|
+
cleanupNode(child, now, ttl);
|
|
414
|
+
if (child.value.style && now - child.value.updatedAt >= ttl) child.value.style = null;
|
|
415
|
+
if (!child.value.style && !child.children.size) node.children.delete(key);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region runtime/core/cache/combine.ts
|
|
420
|
+
function createCombinedStyleGetter(resolver) {
|
|
421
|
+
let configuredPool = null;
|
|
422
|
+
let configuredPoolTTL = -1;
|
|
423
|
+
return function getConfiguredCombinedStyle(styles, args) {
|
|
424
|
+
const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
|
|
425
|
+
if (!configuredPool || configuredPoolTTL !== ttl) {
|
|
426
|
+
configuredPool = createCombinedStylePool(resolver, ttl);
|
|
427
|
+
configuredPoolTTL = ttl;
|
|
428
|
+
}
|
|
429
|
+
const normalized = normalizeStyleItems(styles, args, resolver);
|
|
430
|
+
const result = configuredPool.get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
|
|
431
|
+
return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function normalizeStyleItems(styles, args, resolver) {
|
|
435
|
+
const result = {
|
|
436
|
+
inheritedScopes: [],
|
|
437
|
+
items: [],
|
|
438
|
+
tokens: null
|
|
439
|
+
};
|
|
440
|
+
for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result, resolver);
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
function collectStyleArg(styles, arg, result, resolver) {
|
|
444
|
+
if (!arg) return;
|
|
445
|
+
if (Array.isArray(arg)) {
|
|
446
|
+
for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result, resolver);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
|
|
450
|
+
const bound = getExtractedTokenBoundData(arg);
|
|
451
|
+
collectStyleArg(styles, bound.data, result, resolver);
|
|
452
|
+
result.tokens = mergeTokenOverrides(result.tokens, bound.tokens, resolver);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (isCombinedStyle(arg)) {
|
|
456
|
+
if (getCombinedStyleStyles(arg) !== styles) throw new TypeError("[fluentic-style] combineStyle styles mismatch.");
|
|
457
|
+
const scopes = getCombinedStyleScopes(arg);
|
|
458
|
+
for (let i = 0, len = scopes.length; i < len; i++) result.inheritedScopes.push(scopes[i]);
|
|
459
|
+
result.tokens = mergeTokenValues(result.tokens, getStyleTokenValues(arg));
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (isSheetData(arg)) {
|
|
463
|
+
collectTokenOverrides(arg, result, resolver);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (isScopeData(arg)) {
|
|
467
|
+
collectTokenOverrides(arg, result, resolver);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
result.items.push(arg);
|
|
471
|
+
}
|
|
472
|
+
function collectTokenOverrides(data, result, resolver) {
|
|
473
|
+
const items = data[BUILDER_STATE]?.items ?? [];
|
|
474
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
475
|
+
const item = items[i];
|
|
476
|
+
if (resolver.is(item)) result.tokens = mergeTokenOverrides(result.tokens, [item], resolver);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region runtime/extract/tokenResolver.ts
|
|
481
|
+
const extractedTokenValueResolver = {
|
|
482
|
+
key: null,
|
|
483
|
+
is: isStyleTokenOverrideData,
|
|
484
|
+
id(token) {
|
|
485
|
+
return getStyleTokenId(token);
|
|
486
|
+
},
|
|
487
|
+
value(token) {
|
|
488
|
+
return getExtractedTokenOverrideValue(token);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region runtime/extract/combineStyle.ts
|
|
493
|
+
const singleStyleWrappers = /* @__PURE__ */ new WeakMap();
|
|
494
|
+
const combineStyleBase = (styles, ...args) => getExtractedCombinedStyle(styles, args);
|
|
495
|
+
const combineStyleResolve = ((styles, ...args) => {
|
|
496
|
+
if (Array.isArray(styles)) return combineStyleArray(styles, collectStyleWithArgs(args));
|
|
497
|
+
return isSingleStyleItem(styles) ? combineStyleSingle(styles, collectStyleWithArgs(args)) : combineStyleBase(styles, ...args);
|
|
498
|
+
});
|
|
499
|
+
const combineStyleFor = (styles) => {
|
|
500
|
+
return (...args) => combineStyleBase(styles, ...args);
|
|
501
|
+
};
|
|
502
|
+
const combineStyleWith = (...args) => {
|
|
503
|
+
const withArgs = collectStyleWithArgs(args);
|
|
504
|
+
return ((styles) => {
|
|
505
|
+
return isSingleStyleItem(styles) ? combineStyleSingle(styles, withArgs) : combineStyleBase(styles, ...withArgs.combineArgs);
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
const combineStyleMulti = (styles, ...args) => {
|
|
509
|
+
const withArgs = collectStyleWithArgs(args);
|
|
510
|
+
return styles.map((style) => combineStyleSingle(style, withArgs));
|
|
511
|
+
};
|
|
512
|
+
function combineStyleSingle(style, args) {
|
|
513
|
+
const result = combineStyleSingleItem(style, args.combineArgs);
|
|
514
|
+
if (!args.styles.length) return result;
|
|
515
|
+
const styles = [result];
|
|
516
|
+
for (let i = 0, len = args.styles.length; i < len; i++) styles.push(combineStyleSingleItem(args.styles[i], args.combineArgs));
|
|
517
|
+
return styles;
|
|
518
|
+
}
|
|
519
|
+
function combineStyleArray(styles, args) {
|
|
520
|
+
const result = [];
|
|
521
|
+
collectDirectStyles(styles, result, args);
|
|
522
|
+
for (let i = 0, len = args.styles.length; i < len; i++) result.push(combineStyleSingleItem(args.styles[i], args.combineArgs));
|
|
523
|
+
return result;
|
|
524
|
+
}
|
|
525
|
+
function collectDirectStyles(styles, result, args) {
|
|
526
|
+
for (let i = 0, len = styles.length; i < len; i++) {
|
|
527
|
+
const style = styles[i];
|
|
528
|
+
if (!style) continue;
|
|
529
|
+
if (Array.isArray(style)) {
|
|
530
|
+
collectDirectStyles(style, result, args);
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (isSingleStyleItem(style)) result.push(combineStyleSingleItem(style, args.combineArgs));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function combineStyleSingleItem(style, args) {
|
|
537
|
+
return combineStyleBase(getSingleStyleWrapper(style), ...args).value;
|
|
538
|
+
}
|
|
539
|
+
function getSingleStyleWrapper(style) {
|
|
540
|
+
let wrapper = singleStyleWrappers.get(style);
|
|
541
|
+
if (!wrapper) {
|
|
542
|
+
wrapper = { value: style };
|
|
543
|
+
singleStyleWrappers.set(style, wrapper);
|
|
544
|
+
}
|
|
545
|
+
return wrapper;
|
|
546
|
+
}
|
|
547
|
+
function isSingleStyleItem(value) {
|
|
548
|
+
return isStyleData(value) || isSheetData(value) || isSlotData(value);
|
|
549
|
+
}
|
|
550
|
+
function collectStyleWithArgs(args) {
|
|
551
|
+
const result = {
|
|
552
|
+
combineArgs: [],
|
|
553
|
+
styles: []
|
|
554
|
+
};
|
|
555
|
+
collectArgs(args, result);
|
|
556
|
+
return result;
|
|
557
|
+
}
|
|
558
|
+
function collectArgs(args, result) {
|
|
559
|
+
for (let i = 0, len = args.length; i < len; i++) {
|
|
560
|
+
const arg = args[i];
|
|
561
|
+
if (!arg) continue;
|
|
562
|
+
if (Array.isArray(arg)) {
|
|
563
|
+
collectArgs(arg, result);
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
result.combineArgs.push(arg);
|
|
567
|
+
if (isSingleStyleItem(arg)) result.styles.push(arg);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const combineStyle = Object.assign(combineStyleResolve, {
|
|
571
|
+
for: combineStyleFor,
|
|
572
|
+
with: combineStyleWith,
|
|
573
|
+
multi: combineStyleMulti
|
|
574
|
+
});
|
|
575
|
+
const getExtractedCombinedStyle = createCombinedStyleGetter(extractedTokenValueResolver);
|
|
576
|
+
//#endregion
|
|
577
|
+
//#region runtime/style/scope.ts
|
|
578
|
+
function combineScope(...scopes) {
|
|
579
|
+
return (target) => resolveScopeTargets(target, scopes);
|
|
580
|
+
}
|
|
581
|
+
function bindScope(target, ...scopes) {
|
|
582
|
+
return resolveScopeTargets(target, scopes);
|
|
583
|
+
}
|
|
584
|
+
function resolveScopeTargets(target, scopes) {
|
|
585
|
+
const targets = [];
|
|
586
|
+
const stack = scopes.slice();
|
|
587
|
+
while (stack.length > 0) {
|
|
588
|
+
const item = stack.pop();
|
|
589
|
+
if (!item) continue;
|
|
590
|
+
if (Array.isArray(item)) {
|
|
591
|
+
for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
if (isScopeData(item)) targets.push(item(target));
|
|
595
|
+
}
|
|
596
|
+
return targets;
|
|
597
|
+
}
|
|
598
|
+
//#endregion
|
|
599
|
+
export { combineScope as n, combineStyle as r, bindScope as t };
|
|
600
|
+
|
|
601
|
+
//# sourceMappingURL=scope-BSuRLice.js.map
|