@fluentic/style 0.1.0-beta.3 → 0.1.0-beta.4
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 +13 -0
- package/README.md +1 -1
- package/atomic/className.ts +3 -9
- package/atomic/debug/className/className.ts +0 -15
- package/atomic/element.ts +1 -1
- package/atomic/rule.ts +2 -2
- 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/builder/data/const.ts +1 -1
- package/builder/data/merge/style.ts +1 -1
- package/builder/extract/token.ts +30 -14
- 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/compiler/transform/debug/plugin.ts +79 -1
- package/compiler/transform/evaluator/evaluator.ts +74 -26
- package/compiler/transform/extract/chain/chain.ts +1 -1
- package/compiler/transform/extract/utils/replacement.ts +6 -1
- package/compiler/transform/extract/utils/theme.ts +6 -6
- package/compiler/transform/syntax/static_ids.ts +1 -1
- package/config/build.ts +1 -8
- package/config/config/debug.ts +11 -0
- package/dialect/namedTokens.ts +22 -5
- package/dist/{className-CKo4TxuT.js → className-Do2Crx4b.js} +2 -3
- package/dist/{className-CKo4TxuT.js.map → className-Do2Crx4b.js.map} +1 -1
- package/dist/{style-91J0B5ef.js → combine-C9vjpKCs.js} +45 -304
- package/dist/combine-C9vjpKCs.js.map +1 -0
- package/dist/combineStyle-DwAhsOmS.js +26 -0
- package/dist/combineStyle-DwAhsOmS.js.map +1 -0
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-D5v5tJXI.mjs → compiler-CE0ZgkdH.mjs} +231 -84
- package/dist/compiler-CE0ZgkdH.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/config-BE5D5x2N.js +2 -0
- package/dist/{config-BEvP7108.js → config-BtANtGAh.js} +4 -6
- package/dist/config-BtANtGAh.js.map +1 -0
- package/dist/{config-FIfi5aJ8.js → config-CduqubI8.js} +8 -6
- package/dist/config-CduqubI8.js.map +1 -0
- package/dist/config-lJNLh7eM.js +6 -0
- package/dist/config-lJNLh7eM.js.map +1 -0
- package/dist/config-oKOjOTWi.js +7 -0
- package/dist/{config-OXHoDUIo.js.map → config-oKOjOTWi.js.map} +1 -1
- package/dist/{css-DcuJ_jSH.js → css-BewrRz3_.js} +3 -3
- package/dist/{css-DcuJ_jSH.js.map → css-BewrRz3_.js.map} +1 -1
- package/dist/{css-dPoZJDQH.js → css-CiTI58yl.js} +291 -4
- package/dist/css-CiTI58yl.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-oOt6ZR54.js → css-Rc7ILf-3.js} +8 -9
- package/dist/{css-oOt6ZR54.js.map → css-Rc7ILf-3.js.map} +1 -1
- package/dist/css.js +1 -1
- package/dist/{css-CELBp6Gu.js → cssIdent-BsyUXNNk.js} +3 -23
- package/dist/cssIdent-BsyUXNNk.js.map +1 -0
- package/dist/cssVar-DGgQ2GIK.js +92 -0
- package/dist/cssVar-DGgQ2GIK.js.map +1 -0
- 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-DYtS3g6Z.js} +2 -2
- package/dist/{css_extra-DeTuIlcO.js.map → css_extra-DYtS3g6Z.js.map} +1 -1
- package/dist/{data-CeYstKMP.js → data-D7NFt4JG.js} +205 -10
- package/dist/data-D7NFt4JG.js.map +1 -0
- package/dist/{debug-D96KGgpH.js → debug-Cvpo5cVu.js} +4 -3
- package/dist/{debug-D96KGgpH.js.map → debug-Cvpo5cVu.js.map} +1 -1
- package/dist/{runtime-BKChZZ2-.js → debug-DycdGrul.js} +20 -27
- package/dist/debug-DycdGrul.js.map +1 -0
- package/dist/dev/rsc.js +9 -9
- package/dist/{dev-fOtWB5K3.js → dev-DdRWa6dJ.js} +7 -6
- package/dist/{dev-fOtWB5K3.js.map → dev-DdRWa6dJ.js.map} +1 -1
- package/dist/{dev-p8tW7X-A.js → dev-px0_6TNq.js} +4 -4
- package/dist/{dev-p8tW7X-A.js.map → dev-px0_6TNq.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-ng0y3fN0.js} +8 -8
- package/dist/{elementMarker-CvqqIb7J.js.map → elementMarker-ng0y3fN0.js.map} +1 -1
- package/dist/entry/dev/css.js +2 -2
- package/dist/entry/dev/jsx-dev-runtime.js +2 -2
- package/dist/entry/dev/jsx-runtime.js +2 -2
- package/dist/entry/dev.js +11 -12
- package/dist/entry/prod/css.js +2 -2
- package/dist/entry/prod/extract.js +2 -2
- 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 +5 -4
- package/dist/entry/prod.js +40 -11
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/css.js +2 -2
- package/dist/entry/rsc-dev/dev.js +4 -4
- 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 +274 -68
- package/dist/entry/rsc-dev.js.map +1 -1
- package/dist/entry/rsc-prod/css.js +2 -2
- 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 +5 -4
- package/dist/entry/rsc-prod.js +16 -10
- package/dist/entry/rsc-prod.js.map +1 -0
- package/dist/extract-B-Vs88ME.js +3 -0
- package/dist/{extract-CzWJeQi8.js → extract-CM8Fk2eK.js} +24 -15
- package/dist/{extract-CzWJeQi8.js.map → extract-CM8Fk2eK.js.map} +1 -1
- package/dist/{getClassName-oiQ8CnkS.js → getClassName-CrNVjAoJ.js} +29 -8
- package/dist/getClassName-CrNVjAoJ.js.map +1 -0
- package/dist/{global-Cul1dX8k.js → global-CZBlA9E7.js} +3 -3
- package/dist/{global-Cul1dX8k.js.map → global-CZBlA9E7.js.map} +1 -1
- package/dist/{hash-Bycpk3MR.js → hash-BfeJDf5U.js} +13 -4
- package/dist/hash-BfeJDf5U.js.map +1 -0
- package/dist/index.js +9 -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-Ba-XV33u.js → jsx-BY1iFewe.js} +3 -3
- package/dist/{jsx-Ba-XV33u.js.map → jsx-BY1iFewe.js.map} +1 -1
- package/dist/{jsx-A4cK517J.js → jsx-DL-DEAz8.js} +8 -7
- package/dist/{jsx-A4cK517J.js.map → jsx-DL-DEAz8.js.map} +1 -1
- package/dist/{jsx_dev_runtime-BQcRzl5D.js → jsx_dev_runtime-aAhNYDeS.js} +2 -2
- package/dist/{jsx_dev_runtime-BQcRzl5D.js.map → jsx_dev_runtime-aAhNYDeS.js.map} +1 -1
- package/dist/{jsx_runtime-B9KEoAQN.js → jsx_runtime-C6i1bWlu.js} +2 -2
- package/dist/{jsx_runtime-B9KEoAQN.js.map → jsx_runtime-C6i1bWlu.js.map} +1 -1
- package/dist/{jsx_runtime-BXcbW8Yp.js → jsx_runtime-D7Y5up6H.js} +2 -2
- package/dist/{jsx_runtime-BXcbW8Yp.js.map → jsx_runtime-D7Y5up6H.js.map} +1 -1
- package/dist/{layer-CbQzwZF-.js → layer-BSxAr-hy.js} +4 -4
- package/dist/{layer-CbQzwZF-.js.map → layer-BSxAr-hy.js.map} +1 -1
- package/dist/{loader-BAth2yZ1.mjs → loader-BmYS_Rju.mjs} +3 -3
- package/dist/{loader-BAth2yZ1.mjs.map → loader-BmYS_Rju.mjs.map} +1 -1
- package/dist/{misc-DFBKJGLT.mjs → misc-BIS_c7BJ.mjs} +2 -2
- package/dist/{misc-DFBKJGLT.mjs.map → misc-BIS_c7BJ.mjs.map} +1 -1
- package/dist/{namedTokens-BUa6raTb.js → namedTokens-CN_yhhik.js} +8 -6
- package/dist/namedTokens-CN_yhhik.js.map +1 -0
- package/dist/plugin/farm/index.mjs +2 -2
- package/dist/plugin/nextjs/index.mjs +4 -4
- package/dist/plugin/nextjs/loader.mjs +4 -4
- 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 +1 -1
- package/dist/plugin/vite/index.mjs +3 -3
- package/dist/plugin/webpack/index.mjs +1 -1
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/presets/tailwind/index.js +8 -5
- package/dist/presets/tailwind/index.js.map +1 -1
- package/dist/{property-CF6JgpTq.js → property-BuLbzviK.js} +2 -2
- package/dist/{property-CF6JgpTq.js.map → property-BuLbzviK.js.map} +1 -1
- package/dist/{registry-CiwvMfx8.mjs → registry-IaXmLQzA.mjs} +2 -2
- package/dist/{registry-CiwvMfx8.mjs.map → registry-IaXmLQzA.mjs.map} +1 -1
- package/dist/{rules-DlXcch7-.js → rules-CxVzovt-.js} +60 -23
- package/dist/rules-CxVzovt-.js.map +1 -0
- package/dist/selector-A-mRmMnI.js +64 -0
- package/dist/selector-A-mRmMnI.js.map +1 -0
- package/dist/server.js +12 -13
- package/dist/server.js.map +1 -1
- package/dist/{shared-yDD0nfm1.cjs → shared-CaJuvw03.cjs} +231 -84
- package/dist/shared-CaJuvw03.cjs.map +1 -0
- package/dist/{shared-x59dI2NW.mjs → shared-DdPTZ0O3.mjs} +4 -4
- package/dist/{shared-x59dI2NW.mjs.map → shared-DdPTZ0O3.mjs.map} +1 -1
- package/dist/sheet-BWBzuy4D.js +7 -0
- package/dist/{sheet-B-uJfHRY.js.map → sheet-BWBzuy4D.js.map} +1 -1
- package/dist/{sidecar-CJ6i4wmn.mjs → sidecar-B3oCK9vC.mjs} +3 -3
- package/dist/{sidecar-CJ6i4wmn.mjs.map → sidecar-B3oCK9vC.mjs.map} +1 -1
- package/dist/{style-DFFK06Of.js → style-CGaJndOl.js} +102 -54
- package/dist/style-CGaJndOl.js.map +1 -0
- package/dist/{style-Bw5ka-Nq.js → style-DDxjKdX0.js} +356 -39
- package/dist/style-DDxjKdX0.js.map +1 -0
- package/dist/style-S7LTQbRu.js +5 -0
- package/dist/{styleStore-DJ0Msgkh.js → styleStore-0fARJlZV.js} +6 -6
- package/dist/{styleStore-DJ0Msgkh.js.map → styleStore-0fARJlZV.js.map} +1 -1
- package/dist/{styleStore-ydQcDBD4.js → styleStore-CajcAEPO.js} +101 -223
- package/dist/styleStore-CajcAEPO.js.map +1 -0
- package/dist/symbols-Cp4ymzKF.js +14 -0
- package/dist/symbols-Cp4ymzKF.js.map +1 -0
- package/dist/token-D-S-4_mN.js +138 -0
- package/dist/token-D-S-4_mN.js.map +1 -0
- package/dist/{trace-D8j96G57.js → trace-CFnhyCVf.js} +2 -2
- package/dist/{trace-D8j96G57.js.map → trace-CFnhyCVf.js.map} +1 -1
- package/dist/{trace-CO36aenp.js → trace-ZtgeY-8s.js} +3 -3
- package/dist/{trace-CO36aenp.js.map → trace-ZtgeY-8s.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/{utils-D2fygyTm.mjs → utils-B5Xqf1lV.mjs} +4 -4
- package/dist/{utils-D2fygyTm.mjs.map → utils-B5Xqf1lV.mjs.map} +1 -1
- package/dist/{utils-hoYnMiA7.js → utils-B_VhPBHH.js} +4 -4
- package/dist/{utils-hoYnMiA7.js.map → utils-B_VhPBHH.js.map} +1 -1
- package/dist/{utils-Bmw655wa.js → utils-CDUaX81o.js} +3 -3
- package/dist/{utils-Bmw655wa.js.map → utils-CDUaX81o.js.map} +1 -1
- package/dist/{utils-DTXCTUlS.mjs → utils-DaAiEEIG.mjs} +3 -3
- package/dist/{utils-DTXCTUlS.mjs.map → utils-DaAiEEIG.mjs.map} +1 -1
- package/dist/{utils-DVFxZnVC.js → utils-DzydRwYo.js} +65 -49
- package/dist/utils-DzydRwYo.js.map +1 -0
- package/dist/utils.js +3 -3
- package/dist/value-C0JRsyax.js +64 -0
- package/dist/value-C0JRsyax.js.map +1 -0
- package/dist/{value-DvFkGBy2.js → value-D08AocUs.js} +96 -72
- package/dist/value-D08AocUs.js.map +1 -0
- package/dist/{valueRef-CsLVJwjA.js → valueRef-M3E1oza7.js} +2 -2
- package/dist/{valueRef-CsLVJwjA.js.map → valueRef-M3E1oza7.js.map} +1 -1
- package/dist/{webpack-BOU7_xld.mjs → webpack-CHydnRXB.mjs} +5 -5
- package/dist/{webpack-BOU7_xld.mjs.map → webpack-CHydnRXB.mjs.map} +1 -1
- package/dist/{withTokens-LRidu3Vc.js → withTokens-DAzUIPvA.js} +2 -2
- package/dist/{withTokens-LRidu3Vc.js.map → withTokens-DAzUIPvA.js.map} +1 -1
- 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_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/package.json +1 -1
- package/plugin/bundler/parcel/optimizer.ts +1 -0
- package/presets/tailwind/style/transform.ts +9 -3
- package/runtime/core/cache/combine.ts +44 -25
- package/runtime/core/cache/combineRuntime.ts +4 -0
- package/runtime/core/cache/index.ts +2 -1
- package/runtime/core/cache/item.ts +2 -2
- package/runtime/core/cache/pool.ts +15 -30
- package/runtime/core/cache/prop.ts +3 -2
- package/runtime/core/cache/token.ts +20 -0
- package/runtime/core/cache/tokenValues.ts +19 -11
- package/runtime/extract/combineStyle.ts +37 -0
- package/runtime/extract/getClassName.ts +5 -11
- package/runtime/extract/index.ts +3 -1
- package/runtime/extract/token.ts +41 -0
- package/runtime/extract/tokenResolver.ts +17 -0
- package/runtime/style/style.ts +2 -1
- package/style/style.ts +1 -1
- 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/value.ts +26 -11
- package/style/valueRef.ts +1 -1
- package/utils/global.ts +1 -3
- package/utils/symbol.ts +3 -0
- 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.map +0 -1
- package/dist/css-dPoZJDQH.js.map +0 -1
- package/dist/data-CeYstKMP.js.map +0 -1
- package/dist/extract-DeOytHKW.js +0 -2
- package/dist/getClassName-oiQ8CnkS.js.map +0 -1
- package/dist/global-zaCE-g1C.js.map +0 -1
- package/dist/hash-Bycpk3MR.js.map +0 -1
- package/dist/namedTokens-BUa6raTb.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.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-DVFxZnVC.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.map +0 -1
- package/dist/value-dG9LK0Gq.js +0 -85
- package/dist/value-dG9LK0Gq.js.map +0 -1
package/dist/entry/rsc-dev.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { o as getClassName } from "../utils-
|
|
4
|
-
import { c as createIdCounter, d as createAtRuleRef, f as isAtRuleRef, l as getId, r as createKeyframes, u as AT_RULE_REF } from "../css-
|
|
5
|
-
import { n as createElement } from "../jsx_runtime-
|
|
1
|
+
import { C as TOKEN_OVERRIDE, F as createNameFormatter, G as LayerPlaceholder, H as DEBUG_CONFIG, I as configureStyleRuntime, K as RUNTIME_CONFIG, L as DEV_CONFIG, P as getIdentifierSafeHash, S as TOKEN_NAME, U as CSS_CONFIG, V as hashString, X as symbol, _ as getStyleTokenName, b as isStyleTokenOverrideData, d as createStyleToken, f as createStyleTokenOverride, g as getStyleTokenId, h as getChildStyleTokenName, l as getCssVarRawFallback, m as resetStyleTokenIdCounter, n as shouldAppendCssPx, o as getTokenVar, p as getStyleTokenOverrideDebug, u as TOKEN_DEBUG, v as getStyleTokenVarName, w as TOKEN_VAR_NAME, x as TOKEN_ID, y as isStyleTokenData } from "../value-D08AocUs.js";
|
|
2
|
+
import { A as getScopeTargetSlotId, B as BUILDER_STATE, C as getStyleTokenValues, D as getExtractedTokenBoundData, E as isCombinedStyle, F as isStyleData, I as BUILDER_CALLSITE, L as BUILDER_SCOPE, M as isScopeTargetData, N as isSlotData, O as isExtractedTokenBoundData, P as isSlotOverrideData, R as BUILDER_SCOPE_ID, S as createCombinedStyleTokenWrapper, T as getCombinedStyleStyles, V as BUILDER_TYPE, _ as mergeTokenValues, at as getTraceCallsiteId, b as getCacheTreeChild, c as createThemeClassName, ct as traceCallsite, dt as normalizeDebugKeywordValue, f as addTokenOverride$1, ft as normalizePropertyName, g as mergeTokenOverrides, h as finishTokenValues, it as getDebugFieldVarName, j as isScopeData, k as getScopeTargetScope, l as getSelectorHash, lt as traceError, m as createMutableTokenValues, nt as getDebugCallsiteId, ot as isDebugData, p as addTokenValues, pt as sanitizeDebugPropertyName, rt as getDebugFieldCallsite, tt as getDebugCallsite, u as getSelectorText, ut as traceMarker, v as runtimeTokenValueResolver, w as getCombinedStyleScopes, x as createCombinedStyleFacade, y as createCacheTreeNode, z as BUILDER_SLOT_ID } from "../styleStore-CajcAEPO.js";
|
|
3
|
+
import { o as getClassName } from "../utils-CDUaX81o.js";
|
|
4
|
+
import { c as createIdCounter, d as createAtRuleRef, f as isAtRuleRef, l as getId, r as createKeyframes, u as AT_RULE_REF } from "../css-BewrRz3_.js";
|
|
5
|
+
import { n as createElement } from "../jsx_runtime-C6i1bWlu.js";
|
|
6
6
|
import { SelectorType, parse } from "css-what";
|
|
7
7
|
//#region runtime/style/scope.ts
|
|
8
8
|
function combineScope(...scopes) {
|
|
@@ -40,23 +40,13 @@ function resolveScopeTargets(target, scopes) {
|
|
|
40
40
|
//#region runtime/core/cache/pool.ts
|
|
41
41
|
const DEFAULT_TTL = 1e3 * 60 * 5;
|
|
42
42
|
const TOKEN_WRAPPER_CACHE_LIMIT = 32;
|
|
43
|
-
|
|
44
|
-
let configuredPoolTTL = -1;
|
|
45
|
-
function getCombinedStylePool() {
|
|
46
|
-
const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
|
|
47
|
-
if (!configuredPool || configuredPoolTTL !== ttl) {
|
|
48
|
-
configuredPool = createCombinedStylePool(ttl);
|
|
49
|
-
configuredPoolTTL = ttl;
|
|
50
|
-
}
|
|
51
|
-
return configuredPool;
|
|
52
|
-
}
|
|
53
|
-
function createCombinedStylePool(ttl = DEFAULT_TTL) {
|
|
43
|
+
function createCombinedStylePool(resolver, ttl = DEFAULT_TTL) {
|
|
54
44
|
const root = createPoolNode();
|
|
55
45
|
let timer = null;
|
|
56
46
|
return {
|
|
57
47
|
get(styles, inheritedScopes, items, prevTokensData = null) {
|
|
58
48
|
if (ttl === 0) {
|
|
59
|
-
const collected = collectItems(null, items, prevTokensData);
|
|
49
|
+
const collected = collectItems(null, items, prevTokensData, resolver);
|
|
60
50
|
return {
|
|
61
51
|
style: createCombinedStyleFacade(styles, concatScopes(inheritedScopes, collected.scopes)),
|
|
62
52
|
tokenCache: null,
|
|
@@ -66,7 +56,7 @@ function createCombinedStylePool(ttl = DEFAULT_TTL) {
|
|
|
66
56
|
const now = Date.now();
|
|
67
57
|
let node = getPoolChild(root, styles);
|
|
68
58
|
node = walkScopes(node, inheritedScopes);
|
|
69
|
-
const collected = collectItems(node, items, prevTokensData);
|
|
59
|
+
const collected = collectItems(node, items, prevTokensData, resolver);
|
|
70
60
|
node = collected.node ?? node;
|
|
71
61
|
node.value.updatedAt = now;
|
|
72
62
|
if (node.value.style) {
|
|
@@ -123,17 +113,17 @@ function getTokenWrapperCache(node) {
|
|
|
123
113
|
function getTokenWrapperCacheKey(tokens) {
|
|
124
114
|
return tokens.ids.join("") + "" + tokens.values.join("");
|
|
125
115
|
}
|
|
126
|
-
function collectItems(node, items, prevTokensData) {
|
|
116
|
+
function collectItems(node, items, prevTokensData, resolver) {
|
|
127
117
|
const scopes = [];
|
|
128
118
|
const tokens = createMutableTokenValues(prevTokensData);
|
|
129
119
|
let currentNode = node;
|
|
130
120
|
for (let i = 0, len = items.length; i < len; i++) {
|
|
131
121
|
const item = items[i];
|
|
132
|
-
if (addTokenOverride$1(tokens, item)) continue;
|
|
122
|
+
if (addTokenOverride$1(tokens, item, resolver)) continue;
|
|
133
123
|
if (isScopeTargetData(item)) {
|
|
134
124
|
scopes.push(item);
|
|
135
125
|
currentNode = currentNode ? walkScope(currentNode, item) : null;
|
|
136
|
-
addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item)));
|
|
126
|
+
addTokenValues(tokens, getScopeTokenValues(currentNode, getScopeTargetScope(item), resolver));
|
|
137
127
|
}
|
|
138
128
|
}
|
|
139
129
|
const tokensData = finishTokenValues(prevTokensData, tokens);
|
|
@@ -161,17 +151,16 @@ function walkScope(node, scope) {
|
|
|
161
151
|
node = getPoolChild(node, getScopeTargetSlotId(scope));
|
|
162
152
|
return node;
|
|
163
153
|
}
|
|
164
|
-
function getScopeTokenValues(node, scope) {
|
|
165
|
-
|
|
166
|
-
if (node && node.value.h && node.value.f === tokenNameFormat) return node.value.s;
|
|
154
|
+
function getScopeTokenValues(node, scope, resolver) {
|
|
155
|
+
if (node && node.value.h && node.value.f === resolver.key) return node.value.s;
|
|
167
156
|
const values = createMutableTokenValues(null);
|
|
168
157
|
const items = scope[BUILDER_STATE].items;
|
|
169
|
-
for (let i = 0, len = items.length; i < len; i++) addTokenOverride$1(values, items[i]);
|
|
158
|
+
for (let i = 0, len = items.length; i < len; i++) addTokenOverride$1(values, items[i], resolver);
|
|
170
159
|
const tokens = finishTokenValues(null, values);
|
|
171
160
|
if (node) {
|
|
172
161
|
node.value.h = true;
|
|
173
162
|
node.value.s = tokens;
|
|
174
|
-
node.value.f =
|
|
163
|
+
node.value.f = resolver.key;
|
|
175
164
|
}
|
|
176
165
|
return tokens;
|
|
177
166
|
}
|
|
@@ -212,30 +201,39 @@ function cleanupNode(node, now, ttl) {
|
|
|
212
201
|
}
|
|
213
202
|
//#endregion
|
|
214
203
|
//#region runtime/core/cache/combine.ts
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return
|
|
204
|
+
function createCombinedStyleGetter(resolver) {
|
|
205
|
+
let configuredPool = null;
|
|
206
|
+
let configuredPoolTTL = -1;
|
|
207
|
+
return function getConfiguredCombinedStyle(styles, args) {
|
|
208
|
+
const ttl = RUNTIME_CONFIG.runtimeCacheTTL;
|
|
209
|
+
if (!configuredPool || configuredPoolTTL !== ttl) {
|
|
210
|
+
configuredPool = createCombinedStylePool(resolver, ttl);
|
|
211
|
+
configuredPoolTTL = ttl;
|
|
212
|
+
}
|
|
213
|
+
const normalized = normalizeStyleItems(styles, args, resolver);
|
|
214
|
+
const result = configuredPool.get(styles, normalized.inheritedScopes, normalized.items, normalized.tokens);
|
|
215
|
+
return result.tokens ? getCachedTokenWrapper(result.tokenCache, result.tokens, () => createCombinedStyleTokenWrapper(result.style, result.tokens)) : result.style;
|
|
216
|
+
};
|
|
219
217
|
}
|
|
220
|
-
function normalizeStyleItems(styles, args) {
|
|
218
|
+
function normalizeStyleItems(styles, args, resolver) {
|
|
221
219
|
const result = {
|
|
222
220
|
inheritedScopes: [],
|
|
223
221
|
items: [],
|
|
224
222
|
tokens: null
|
|
225
223
|
};
|
|
226
|
-
for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result);
|
|
224
|
+
for (let i = 0, len = args.length; i < len; i++) collectStyleArg(styles, args[i], result, resolver);
|
|
227
225
|
return result;
|
|
228
226
|
}
|
|
229
|
-
function collectStyleArg(styles, arg, result) {
|
|
227
|
+
function collectStyleArg(styles, arg, result, resolver) {
|
|
230
228
|
if (!arg) return;
|
|
231
229
|
if (Array.isArray(arg)) {
|
|
232
|
-
for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result);
|
|
230
|
+
for (let i = 0, len = arg.length; i < len; i++) collectStyleArg(styles, arg[i], result, resolver);
|
|
233
231
|
return;
|
|
234
232
|
}
|
|
235
233
|
if (RUNTIME_CONFIG.isHoist && isExtractedTokenBoundData(arg)) {
|
|
236
234
|
const bound = getExtractedTokenBoundData(arg);
|
|
237
|
-
result.tokens = mergeTokenOverrides(result.tokens, bound.tokens);
|
|
238
|
-
collectStyleArg(styles, bound.data, result);
|
|
235
|
+
result.tokens = mergeTokenOverrides(result.tokens, bound.tokens, resolver);
|
|
236
|
+
collectStyleArg(styles, bound.data, result, resolver);
|
|
239
237
|
return;
|
|
240
238
|
}
|
|
241
239
|
if (isCombinedStyle(arg)) {
|
|
@@ -248,6 +246,9 @@ function collectStyleArg(styles, arg, result) {
|
|
|
248
246
|
result.items.push(arg);
|
|
249
247
|
}
|
|
250
248
|
//#endregion
|
|
249
|
+
//#region runtime/core/cache/combineRuntime.ts
|
|
250
|
+
const getCombinedStyle = createCombinedStyleGetter(runtimeTokenValueResolver);
|
|
251
|
+
//#endregion
|
|
251
252
|
//#region runtime/style/style.ts
|
|
252
253
|
const combineStyleBase = (styles, ...args) => getCombinedStyle(styles, args);
|
|
253
254
|
const combineStyleFor = (styles) => {
|
|
@@ -467,6 +468,200 @@ function createThemeData(callsite, id, className, tokens) {
|
|
|
467
468
|
tokens
|
|
468
469
|
};
|
|
469
470
|
}
|
|
471
|
+
const formatClassName = createNameFormatter([
|
|
472
|
+
"atRule",
|
|
473
|
+
"scopeSelector",
|
|
474
|
+
"property",
|
|
475
|
+
"selector",
|
|
476
|
+
"value"
|
|
477
|
+
]);
|
|
478
|
+
const formatTransformClassName = createNameFormatter(["className"]);
|
|
479
|
+
function getDebugClassName(format, hash, info) {
|
|
480
|
+
return formatClassName(format || "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash", hash, info);
|
|
481
|
+
}
|
|
482
|
+
function getDebugTransformClassName(format, hash, info) {
|
|
483
|
+
return formatTransformClassName(format || "(className)--$hash", hash, info);
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region atomic/debug/value.ts
|
|
487
|
+
function getDebugValueName(value) {
|
|
488
|
+
if (!value) return {
|
|
489
|
+
value: null,
|
|
490
|
+
arbitraryValue: null
|
|
491
|
+
};
|
|
492
|
+
const normalized = value.trim().toLowerCase();
|
|
493
|
+
if (!normalized) return {
|
|
494
|
+
value: null,
|
|
495
|
+
arbitraryValue: null
|
|
496
|
+
};
|
|
497
|
+
if (normalized.startsWith("url") || normalized.includes("gradient") || normalized.startsWith("image") || normalized.startsWith("calc(") || normalized.startsWith("var(") || normalized.startsWith("env(") || normalized.startsWith("rgb") || normalized.startsWith("hsl")) return {
|
|
498
|
+
value: null,
|
|
499
|
+
arbitraryValue: null
|
|
500
|
+
};
|
|
501
|
+
if (/^[a-z][a-z0-9-]*$/.test(normalized)) return {
|
|
502
|
+
value: normalized,
|
|
503
|
+
arbitraryValue: null
|
|
504
|
+
};
|
|
505
|
+
const name = normalized.replace(/px/g, "").replace(/rem/g, "rem").replace(/em/g, "em").replace(/%/g, "pct").replace(/fr/g, "fr").replace(/[,()"'#]/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9._%-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
506
|
+
if (!name) return {
|
|
507
|
+
value: null,
|
|
508
|
+
arbitraryValue: null
|
|
509
|
+
};
|
|
510
|
+
return {
|
|
511
|
+
value: null,
|
|
512
|
+
arbitraryValue: name
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region atomic/debug/property/data.ts
|
|
517
|
+
const PROPERTY_ALIASES = {
|
|
518
|
+
"border-radius": "radius",
|
|
519
|
+
"flex-direction": "flex",
|
|
520
|
+
"font-style": "font",
|
|
521
|
+
"font-weight": "font",
|
|
522
|
+
"grid-template-columns": "grid-cols",
|
|
523
|
+
"grid-template-rows": "grid-rows",
|
|
524
|
+
"align-items": "items",
|
|
525
|
+
"justify-content": "justify",
|
|
526
|
+
"z-index": "zindex",
|
|
527
|
+
"pointer-events": "pointer"
|
|
528
|
+
};
|
|
529
|
+
const KEYWORD_VALUE_PROPERTIES = new Set([
|
|
530
|
+
"align-content",
|
|
531
|
+
"align-items",
|
|
532
|
+
"align-self",
|
|
533
|
+
"background-repeat",
|
|
534
|
+
"background-size",
|
|
535
|
+
"border-collapse",
|
|
536
|
+
"border-style",
|
|
537
|
+
"box-sizing",
|
|
538
|
+
"clear",
|
|
539
|
+
"cursor",
|
|
540
|
+
"display",
|
|
541
|
+
"flex-direction",
|
|
542
|
+
"flex-wrap",
|
|
543
|
+
"float",
|
|
544
|
+
"font-weight",
|
|
545
|
+
"font-style",
|
|
546
|
+
"justify-content",
|
|
547
|
+
"justify-items",
|
|
548
|
+
"justify-self",
|
|
549
|
+
"list-style-position",
|
|
550
|
+
"list-style-type",
|
|
551
|
+
"object-fit",
|
|
552
|
+
"object-position",
|
|
553
|
+
"overflow",
|
|
554
|
+
"overflow-x",
|
|
555
|
+
"overflow-y",
|
|
556
|
+
"pointer-events",
|
|
557
|
+
"place-content",
|
|
558
|
+
"place-items",
|
|
559
|
+
"place-self",
|
|
560
|
+
"position",
|
|
561
|
+
"resize",
|
|
562
|
+
"table-layout",
|
|
563
|
+
"text-align",
|
|
564
|
+
"text-decoration-line",
|
|
565
|
+
"text-transform",
|
|
566
|
+
"user-select",
|
|
567
|
+
"vertical-align",
|
|
568
|
+
"visibility",
|
|
569
|
+
"white-space"
|
|
570
|
+
]);
|
|
571
|
+
const ARBITRARY_VALUE_PROPERTIES = new Set(["font-weight"]);
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region atomic/debug/property/property.ts
|
|
574
|
+
function getDebugPropertyName(property, value) {
|
|
575
|
+
if (!property) return null;
|
|
576
|
+
const normalized = normalizePropertyName(property);
|
|
577
|
+
const name = PROPERTY_ALIASES[normalized] || sanitizeDebugPropertyName(normalized);
|
|
578
|
+
if (!name) return null;
|
|
579
|
+
return {
|
|
580
|
+
property: name,
|
|
581
|
+
...withKeywordValueFallback(normalized, value, withArbitraryValueFallback(normalized, getDebugValueName(value)))
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function withArbitraryValueFallback(property, valueName) {
|
|
585
|
+
if (!valueName.arbitraryValue || ARBITRARY_VALUE_PROPERTIES.has(property)) return valueName;
|
|
586
|
+
return {
|
|
587
|
+
value: valueName.value,
|
|
588
|
+
arbitraryValue: null
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function withKeywordValueFallback(property, value, valueName) {
|
|
592
|
+
if (valueName.value || valueName.arbitraryValue) return valueName;
|
|
593
|
+
if (!KEYWORD_VALUE_PROPERTIES.has(property)) return valueName;
|
|
594
|
+
const normalized = normalizeDebugKeywordValue(value);
|
|
595
|
+
if (!normalized) return valueName;
|
|
596
|
+
return {
|
|
597
|
+
value: normalized,
|
|
598
|
+
arbitraryValue: null
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region atomic/debug/selector.ts
|
|
603
|
+
function getDebugSelectorName(selector) {
|
|
604
|
+
if (!selector) return null;
|
|
605
|
+
const normalized = selector.trim().toLowerCase();
|
|
606
|
+
if (/^[a-z0-9]+$/.test(normalized)) return null;
|
|
607
|
+
return validateName(normalized.replace(/\$\$/g, "args").replace(/\$/g, "arg").replace(/\.\.\./g, "merge").replace(/:not\(/g, "not-").replace(/:(is|where|has)\(/g, "$1-").replace(/:nth-(child|of-type)\(/g, "nth-").replace(/[.#]/g, "-").replace(/[[\]()]/g, "-").replace(/:+/g, "-").replace(/\s+/g, "-").replace(/[^a-z0-9_-]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
608
|
+
}
|
|
609
|
+
function getDebugAtRuleName(selector) {
|
|
610
|
+
if (!selector || Array.isArray(selector) && selector.length === 0) return null;
|
|
611
|
+
return validateName((Array.isArray(selector) ? selector.map(parseAtRule).filter(Boolean).join("-") : parseAtRule(selector)).replace(/[-_]+/g, "-").replace(/^-+|-+$/g, ""));
|
|
612
|
+
}
|
|
613
|
+
function compressQuery(query) {
|
|
614
|
+
return query.trim().toLowerCase().replace(/prefers-color-scheme\s*:\s*dark/g, "dark").replace(/prefers-color-scheme\s*:\s*light/g, "light").replace(/min-width\s*:\s*/g, "min-").replace(/max-width\s*:\s*/g, "max-").replace(/min-height\s*:\s*/g, "minh-").replace(/max-height\s*:\s*/g, "maxh-").replace(/inline-size/g, "inline").replace(/\b(and|or|only|not)\b/g, "").replace(/>=/g, "-gte-").replace(/<=/g, "-lte-").replace(/>/g, "-gt-").replace(/</g, "-lt-").replace(/[():=\s]+/g, "-").replace(/[-_]+/g, "-").replace(/^-+|-+$/g, "");
|
|
615
|
+
}
|
|
616
|
+
function validateName(name) {
|
|
617
|
+
if (!name || name === "selector" || name.length < 2) return null;
|
|
618
|
+
return name;
|
|
619
|
+
}
|
|
620
|
+
function parseAtRule(rule) {
|
|
621
|
+
const normalized = rule.trim().toLowerCase();
|
|
622
|
+
if (normalized.startsWith("@media")) return compressQuery(normalized.slice(6));
|
|
623
|
+
if (normalized.startsWith("@container")) return compressQuery(normalized.slice(10));
|
|
624
|
+
if (normalized.startsWith("@supports")) return compressQuery(normalized.slice(9));
|
|
625
|
+
return compressQuery(normalized);
|
|
626
|
+
}
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region atomic/className.ts
|
|
629
|
+
function getAtomicClassName(property, priority, value, selector, parentSelector, atRule, callsite, localClassName, debugClassName, classNameFormat, transformClassName, transformClassNameFormat, hashLength = null) {
|
|
630
|
+
let hash = property;
|
|
631
|
+
hash += "\n" + (priority || "");
|
|
632
|
+
hash += "\n" + value;
|
|
633
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
634
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
635
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
636
|
+
hash += "\n" + getCallsiteHash(callsite, localClassName);
|
|
637
|
+
hash = getIdentifierSafeHash(hash, hashLength ?? getRuntimeClassNameHashLength(debugClassName));
|
|
638
|
+
if (!debugClassName) return hash;
|
|
639
|
+
if (transformClassName) return getDebugTransformClassName(transformClassNameFormat, hash, { className: transformClassName });
|
|
640
|
+
const propertyName = getDebugPropertyName(property, value);
|
|
641
|
+
return getDebugClassName(classNameFormat, hash, {
|
|
642
|
+
atRule: atRule ? getDebugAtRuleName(atRule.map(getSelectorText)) : null,
|
|
643
|
+
scopeSelector: parentSelector ? getDebugSelectorName(getSelectorText(parentSelector)) : null,
|
|
644
|
+
selector: selector ? getDebugSelectorName(getSelectorText(selector)) : null,
|
|
645
|
+
property: propertyName ? propertyName.property : property,
|
|
646
|
+
value: propertyName ? propertyName.value ?? propertyName.arbitraryValue : null
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function getRuntimeClassNameHashLength(debugClassName) {
|
|
650
|
+
if (debugClassName && DEV_CONFIG.isDev) return DEV_CONFIG.hashLength ?? CSS_CONFIG.hashLength ?? 3;
|
|
651
|
+
return CSS_CONFIG.hashLength ?? 7;
|
|
652
|
+
}
|
|
653
|
+
function getClassNameDedupe(property, priority, selector, parentSelector, atRule) {
|
|
654
|
+
let hash = property;
|
|
655
|
+
hash += "\n" + (priority || "");
|
|
656
|
+
hash += "\n" + (selector ? getSelectorHash(selector) : "");
|
|
657
|
+
hash += "\n" + (parentSelector ? getSelectorHash(parentSelector) : "");
|
|
658
|
+
hash += "\n" + (atRule ? atRule.map(getSelectorHash).join("\n") : "");
|
|
659
|
+
return hashString(hash);
|
|
660
|
+
}
|
|
661
|
+
function getCallsiteHash(callsite, localClassName) {
|
|
662
|
+
if (!localClassName || !callsite) return "";
|
|
663
|
+
return callsite.filePath + "\n" + callsite.line + ":" + callsite.column;
|
|
664
|
+
}
|
|
470
665
|
//#endregion
|
|
471
666
|
//#region builder/data/merge/utils.ts
|
|
472
667
|
function cloneData(data, source, debug, merge = true) {
|
|
@@ -1602,22 +1797,47 @@ function createTheme(tokens, stableId, callsite) {
|
|
|
1602
1797
|
return createThemeData(callsite ?? null, id, className, tokens);
|
|
1603
1798
|
}
|
|
1604
1799
|
//#endregion
|
|
1800
|
+
//#region style/tokens.ts
|
|
1801
|
+
function createTokens(values, stableId) {
|
|
1802
|
+
const tokens = {};
|
|
1803
|
+
if (Array.isArray(values)) for (let i = 0, len = values.length; i < len; i++) {
|
|
1804
|
+
const value = values[i];
|
|
1805
|
+
tokens[value] = createStyleToken(value, getChildStableId$1(stableId, String(i)), getChildStyleTokenName(stableId, String(i)));
|
|
1806
|
+
}
|
|
1807
|
+
else assignTokenRecord(tokens, values, stableId, stableId ?? null);
|
|
1808
|
+
return tokens;
|
|
1809
|
+
}
|
|
1810
|
+
function assignTokenRecord(target, values, stableId, debugName) {
|
|
1811
|
+
for (let key in values) {
|
|
1812
|
+
const value = values[key];
|
|
1813
|
+
const childName = getChildStyleTokenName(debugName, key);
|
|
1814
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1815
|
+
const child = {};
|
|
1816
|
+
target[key] = child;
|
|
1817
|
+
assignTokenRecord(child, value, getChildStableId$1(stableId, key), childName);
|
|
1818
|
+
} else target[key] = createStyleToken(value, getChildStableId$1(stableId, key), childName);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function getChildStableId$1(stableId, child) {
|
|
1822
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
1823
|
+
}
|
|
1824
|
+
//#endregion
|
|
1605
1825
|
//#region style/value.ts
|
|
1606
|
-
function createToken(value,
|
|
1607
|
-
return createStyleToken(value,
|
|
1826
|
+
function createToken(value, stableId) {
|
|
1827
|
+
return createStyleToken(value, stableId);
|
|
1608
1828
|
}
|
|
1609
1829
|
function createValues(...args) {
|
|
1610
1830
|
let values = args[0];
|
|
1611
1831
|
let isNumber = false;
|
|
1612
|
-
let
|
|
1832
|
+
let stableId = args[1];
|
|
1613
1833
|
if (args[0] === Number) {
|
|
1614
1834
|
values = args[1];
|
|
1615
|
-
|
|
1835
|
+
stableId = args[2];
|
|
1616
1836
|
isNumber = true;
|
|
1617
1837
|
}
|
|
1618
1838
|
if (!values.length) throw new Error("[Style.values] NO_VALUES");
|
|
1619
1839
|
const tokens = /* @__PURE__ */ new Map();
|
|
1620
|
-
for (let value of values) tokens.set(value,
|
|
1840
|
+
for (let value of values) tokens.set(value, createStyleToken(parseValue(value, isNumber), getChildStableId(stableId, hashString(String(value))), getChildStyleTokenName(stableId ?? null, getValueDebugName(value))));
|
|
1621
1841
|
return function ValueFn(...args) {
|
|
1622
1842
|
const [value, provide, debug] = args;
|
|
1623
1843
|
const token = tokens.get(value);
|
|
@@ -1627,8 +1847,18 @@ function createValues(...args) {
|
|
|
1627
1847
|
return token;
|
|
1628
1848
|
};
|
|
1629
1849
|
}
|
|
1630
|
-
function
|
|
1631
|
-
return
|
|
1850
|
+
function getChildStableId(stableId, child) {
|
|
1851
|
+
return stableId ? stableId + "--" + child : void 0;
|
|
1852
|
+
}
|
|
1853
|
+
function getValueDebugName(value) {
|
|
1854
|
+
if (typeof value === "number") return String(value);
|
|
1855
|
+
const parts = String(value).split(/[;|]/);
|
|
1856
|
+
const label = parts[1]?.trim();
|
|
1857
|
+
if (label) return sanitizeDebugName(label);
|
|
1858
|
+
return sanitizeDebugName(parts[0]?.trim() ?? "");
|
|
1859
|
+
}
|
|
1860
|
+
function sanitizeDebugName(value) {
|
|
1861
|
+
return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || null;
|
|
1632
1862
|
}
|
|
1633
1863
|
function parseValue(value, isNumber) {
|
|
1634
1864
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
@@ -1639,30 +1869,6 @@ function parseValue(value, isNumber) {
|
|
|
1639
1869
|
return number;
|
|
1640
1870
|
}
|
|
1641
1871
|
//#endregion
|
|
1642
|
-
|
|
1643
|
-
function createTokens(values, debugId) {
|
|
1644
|
-
const tokens = {};
|
|
1645
|
-
if (Array.isArray(values)) for (let i = 0, len = values.length; i < len; i++) {
|
|
1646
|
-
const value = values[i];
|
|
1647
|
-
tokens[value] = createToken(value, getChildDebugId(debugId, String(i)));
|
|
1648
|
-
}
|
|
1649
|
-
else assignTokenRecord(tokens, values, debugId);
|
|
1650
|
-
return tokens;
|
|
1651
|
-
}
|
|
1652
|
-
function assignTokenRecord(target, values, debugId) {
|
|
1653
|
-
for (let key in values) {
|
|
1654
|
-
const value = values[key];
|
|
1655
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
1656
|
-
const child = {};
|
|
1657
|
-
target[key] = child;
|
|
1658
|
-
assignTokenRecord(child, value, getChildDebugId(debugId, key));
|
|
1659
|
-
} else target[key] = createToken(value, getChildDebugId(debugId, key));
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
function getChildDebugId(debugId, child) {
|
|
1663
|
-
return debugId ? debugId + "--" + child : void 0;
|
|
1664
|
-
}
|
|
1665
|
-
//#endregion
|
|
1666
|
-
export { AT_RULE_REF, LayerPlaceholder, TOKEN_DEBUG, TOKEN_ID, TOKEN_OVERRIDE, assignStyleFnMeta, bindScope, classNameTransform, classNameValue, combineScope, combineStyle, configureStyleRuntime, createAtRuleRef, createClassNameFn, createElement, createStyleFn, createStyleKeyframes, createStyleToken, createStyleTokenOverride, createTheme, createToken, createTokens, createValues, getClassName, getStyleFnMeta, getStyleTokenId, getStyleTokenOverrideDebug, getToken, isAtRuleRef, isClassNameValue, isStyleTokenData, isStyleTokenOverrideData, resetStyleThemeIdCounter, resetStyleTokenIdCounter, style, styleTransform, transformKeyframes, type };
|
|
1872
|
+
export { AT_RULE_REF, LayerPlaceholder, TOKEN_DEBUG, TOKEN_ID, TOKEN_NAME, TOKEN_OVERRIDE, TOKEN_VAR_NAME, assignStyleFnMeta, bindScope, classNameTransform, classNameValue, combineScope, combineStyle, configureStyleRuntime, createAtRuleRef, createClassNameFn, createElement, createStyleFn, createStyleKeyframes, createStyleToken, createStyleTokenOverride, createTheme, createToken, createTokens, createValues, getClassName, getStyleFnMeta, getStyleTokenId, getStyleTokenName, getStyleTokenOverrideDebug, getStyleTokenVarName, getToken, isAtRuleRef, isClassNameValue, isStyleTokenData, isStyleTokenOverrideData, resetStyleThemeIdCounter, resetStyleTokenIdCounter, style, styleTransform, transformKeyframes, type };
|
|
1667
1873
|
|
|
1668
1874
|
//# sourceMappingURL=rsc-dev.js.map
|