@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @fluentic/style
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add attachable selector sheets for styling fixed third-party class names
|
|
8
|
+
without emitting global CSS.
|
|
9
|
+
|
|
10
|
+
- Add `style.selector(...)` selector targets and `createSheet(...)` from
|
|
11
|
+
`@fluentic/style/css` for manual selector rules that still attach through
|
|
12
|
+
generated Fluentic classes.
|
|
13
|
+
- Support selector overrides and token overrides inside sheets so component
|
|
14
|
+
wrappers can expose local third-party themes with the same shape as
|
|
15
|
+
scoped style composition.
|
|
16
|
+
- Add `&` and `&?` selector handling for attached-element and portal-friendly
|
|
17
|
+
selector rules. Comma-separated selector strings are rejected; pass an
|
|
18
|
+
array when a rule should target multiple selectors.
|
|
19
|
+
- Add `createStyleTarget(...)` for applying style props to explicit DOM
|
|
20
|
+
targets such as `document.body`, with shared-target reference counting for
|
|
21
|
+
overlapping portal users.
|
|
22
|
+
- Make `combineStyle(...)` compose sheets directly, and add
|
|
23
|
+
`combineStyle.with(...)` plus array-only `combineStyle.multi(...)` for
|
|
24
|
+
cache-friendly style and sheet composition.
|
|
25
|
+
- Support selector sheet extraction, local token overrides, debug class
|
|
26
|
+
names, source tracing, and sourcemap data across runtime and extracted
|
|
27
|
+
builds.
|
|
28
|
+
- Add Preact css-prop support with a `CssPropPresets.Preact` compiler
|
|
29
|
+
preset, runtime adapters, JSX types, and a Vite example.
|
|
30
|
+
- Keep plugin css-prop configuration focused on `CssPropPresets` instead of
|
|
31
|
+
exporting each framework preset as a separate top-level plugin API.
|
|
32
|
+
- Add `style.important(...)` and `className.important(...)` for interop cases
|
|
33
|
+
that need emitted `!important` declarations, especially selector sheets
|
|
34
|
+
wrapping third-party CSS.
|
|
35
|
+
- Add `style.weight(...)` as the style-object counterpart to
|
|
36
|
+
`className.weight(...)`.
|
|
37
|
+
- Keep the extracted production runtime below 5 KB minified and gzipped with
|
|
38
|
+
`combineStyle` included, and keep selector parsing helpers out of the
|
|
39
|
+
extracted production entry.
|
|
40
|
+
- Add a React Select third-party selectors example, Preact integration docs,
|
|
41
|
+
and a clearer third-party styling guide for selector sheets, style targets,
|
|
42
|
+
portal menus, and the new `combineStyle` helpers.
|
|
43
|
+
|
|
44
|
+
## 0.1.0-beta.4
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Slim the extracted production runtime token path and fix named token refs in token-bound extracted styles.
|
|
49
|
+
|
|
50
|
+
- Keep token symbols, guards, naming, and extracted token helpers in builder/runtime internals instead of the public style token surface.
|
|
51
|
+
- Split extracted combine, token resolution, CSS variable, scope, and debug config helpers so extracted builds retain less eager runtime code.
|
|
52
|
+
- Make named tokens carry their extracted CSS variable name so production token bindings can reference named token values without compiler metadata errors.
|
|
53
|
+
- Hide manual stable ids from the public token and theme factory types while preserving internal compiler-provided identities.
|
|
54
|
+
- Add snapshot and runtime contract coverage for createToken, createTokens, createValues, createTheme, scopes, bindScope, combineStyle, and named-token refs in extracted output.
|
|
55
|
+
- Keep the Parcel optimizer on Node's `Buffer` import path and declare the Parcel example polyfill dependency so workspace builds do not rely on Parcel auto-install.
|
|
56
|
+
|
|
3
57
|
## 0.1.0-beta.3
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
|
@@ -14,7 +68,7 @@ for transform-driven styling.
|
|
|
14
68
|
### Highlights
|
|
15
69
|
|
|
16
70
|
- Add `createClassNameFn` for class-name-driven style builders.
|
|
17
|
-
- Support nested class-name values, conditional
|
|
71
|
+
- Support nested class-name values, conditional falsy entries, weighted
|
|
18
72
|
class-name tokens, selector chaining, at-rules, and merges.
|
|
19
73
|
- Add compiler extraction for class-name style chains.
|
|
20
74
|
- Add Tailwind presets for both style-object and class-name authoring.
|
package/README.md
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# Fluentic Style
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build your own styling language on top of a stable JSX styling model.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Styling JSX apps has a lot of good answers already: CSS files, utility classes,
|
|
6
6
|
CSS-in-JS, compiled CSS, design tokens, and component libraries. Fluentic
|
|
7
7
|
explores a specific question inside that space: what if styles composed around
|
|
8
|
-
|
|
8
|
+
components the same way props and state do?
|
|
9
9
|
|
|
10
10
|
With Fluentic, you start simple with type-safe `style(...)` and the JSX `css`
|
|
11
|
-
prop
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`combineStyle(...)` so those
|
|
11
|
+
prop in React, Preact, Solid, and compatible JSX runtimes. If your team prefers
|
|
12
|
+
utility class names, you can also create class-name style chains, including a
|
|
13
|
+
Tailwind-like preset. When a component needs variants, themes, nested parts, or
|
|
14
|
+
consumer overrides, add slots, scopes, tokens, and `combineStyle(...)` so those
|
|
15
|
+
styles stay organized around the component.
|
|
15
16
|
|
|
16
17
|
For production builds, styles are extracted into static atomic CSS output.
|
|
17
18
|
Dynamic values from props and state still work as usual.
|
|
@@ -35,7 +36,7 @@ Or with pnpm:
|
|
|
35
36
|
pnpm add @fluentic/style@beta
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
Use Fluentic in a
|
|
39
|
+
Use Fluentic in a JSX app. Add a bundler plugin later when you want production
|
|
39
40
|
extraction.
|
|
40
41
|
|
|
41
42
|
## Configure Runtime JSX
|
|
@@ -380,7 +381,7 @@ production builds. Current benchmark snapshots:
|
|
|
380
381
|
The main production checks are runtime cost and bundle size. In the production
|
|
381
382
|
path most apps use, Fluentic extracts CSS at build time and ships the extracted
|
|
382
383
|
production runtime for `css` prop composition, dynamic values, class-name
|
|
383
|
-
merging, and token resolution. That runtime entry currently reports `
|
|
384
|
+
merging, and token resolution. That runtime entry currently reports `4.92 KB`
|
|
384
385
|
min+gzip.
|
|
385
386
|
Browser and SSR benchmarks track whether style resolution stays fast in
|
|
386
387
|
app-shaped renders. See the
|
package/atomic/className.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { BuilderCallsite, ItemSelector } from '../builder/data';
|
|
2
2
|
import { CSS_CONFIG } from '../config/config/css';
|
|
3
3
|
import { DEV_CONFIG } from '../config/config/dev';
|
|
4
|
-
import type { ClassNameFormat,
|
|
4
|
+
import type { ClassNameFormat, TransformClassNameFormat } from '../config/types';
|
|
5
5
|
import { hashString } from '../utils/hash';
|
|
6
|
-
import { getDebugClassName,
|
|
6
|
+
import { getDebugClassName, getDebugSheetClassName, getDebugTransformClassName } from './debug/className';
|
|
7
7
|
import { getDebugPropertyName } from './debug/property';
|
|
8
8
|
import { getDebugAtRuleName, getDebugSelectorName } from './debug/selector';
|
|
9
|
+
export { getScopeClassName } from './scope';
|
|
9
10
|
import { getIdentifierSafeHash } from './utils/hash';
|
|
10
|
-
import { getSelectorHash, getSelectorText } from './utils/selector';
|
|
11
|
+
import { getSelectorHash, getSelectorText, hasSheetSelectorAnchor } from './utils/selector';
|
|
11
12
|
|
|
12
13
|
export function getAtomicClassName(
|
|
13
14
|
property: string,
|
|
14
15
|
priority: number | null,
|
|
16
|
+
important: boolean,
|
|
15
17
|
value: string,
|
|
16
18
|
selector: ItemSelector | null,
|
|
17
19
|
parentSelector: ItemSelector | null,
|
|
@@ -22,11 +24,13 @@ export function getAtomicClassName(
|
|
|
22
24
|
classNameFormat: ClassNameFormat | null,
|
|
23
25
|
transformClassName: string | null,
|
|
24
26
|
transformClassNameFormat: TransformClassNameFormat | null,
|
|
27
|
+
sheetClassNameFormat: ClassNameFormat | null = null,
|
|
25
28
|
hashLength: number | null = null,
|
|
26
29
|
) {
|
|
27
30
|
let hash = property;
|
|
28
31
|
|
|
29
32
|
hash += '\n' + (priority || '');
|
|
33
|
+
if (important) hash += '\nimportant';
|
|
30
34
|
hash += '\n' + value;
|
|
31
35
|
hash += '\n' + (selector ? getSelectorHash(selector) : '');
|
|
32
36
|
hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
|
|
@@ -50,8 +54,9 @@ export function getAtomicClassName(
|
|
|
50
54
|
|
|
51
55
|
const propertyName = getDebugPropertyName(property, value);
|
|
52
56
|
|
|
53
|
-
const
|
|
54
|
-
|
|
57
|
+
const isSheetClassName = hasSheetSelectorAnchor(selector);
|
|
58
|
+
const className = (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(
|
|
59
|
+
isSheetClassName ? sheetClassNameFormat : classNameFormat,
|
|
55
60
|
hash,
|
|
56
61
|
{
|
|
57
62
|
atRule: atRule
|
|
@@ -80,16 +85,10 @@ function getRuntimeClassNameHashLength(debugClassName: boolean) {
|
|
|
80
85
|
return CSS_CONFIG.hashLength ?? 7;
|
|
81
86
|
}
|
|
82
87
|
|
|
83
|
-
export function getScopeClassName(
|
|
84
|
-
className: string,
|
|
85
|
-
scopeClassNameFormat: ScopeClassNameFormat | null,
|
|
86
|
-
) {
|
|
87
|
-
return getDebugScopeClassName(scopeClassNameFormat, { className });
|
|
88
|
-
}
|
|
89
|
-
|
|
90
88
|
export function getClassNameDedupe(
|
|
91
89
|
property: string,
|
|
92
90
|
priority: number | null,
|
|
91
|
+
important: boolean,
|
|
93
92
|
selector: ItemSelector | null,
|
|
94
93
|
parentSelector: ItemSelector | null,
|
|
95
94
|
atRule: ItemSelector[] | null,
|
|
@@ -97,6 +96,7 @@ export function getClassNameDedupe(
|
|
|
97
96
|
let hash = property;
|
|
98
97
|
|
|
99
98
|
hash += '\n' + (priority || '');
|
|
99
|
+
if (important) hash += '\nimportant';
|
|
100
100
|
hash += '\n' + (selector ? getSelectorHash(selector) : '');
|
|
101
101
|
hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
|
|
102
102
|
hash += '\n' + (atRule ? atRule.map(getSelectorHash).join('\n') : '');
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ClassNameFormat,
|
|
3
3
|
ClassNameInfo,
|
|
4
|
-
ScopeClassNameFormat,
|
|
5
|
-
ScopeClassNameInfo,
|
|
6
4
|
TransformClassNameFormat,
|
|
7
5
|
TransformClassNameInfo,
|
|
8
6
|
} from '../../../config/types';
|
|
@@ -10,9 +8,9 @@ import { createNameFormatter } from '../../utils/format';
|
|
|
10
8
|
|
|
11
9
|
export const CLASS_NAME_FORMAT = '[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash';
|
|
12
10
|
|
|
13
|
-
export const
|
|
11
|
+
export const SHEET_CLASS_NAME_FORMAT = 'sheet-(property)[-(value)]--$hash';
|
|
14
12
|
|
|
15
|
-
export const
|
|
13
|
+
export const TRANSFORM_CLASS_NAME_FORMAT = '(className)--$hash';
|
|
16
14
|
|
|
17
15
|
export const formatClassName = createNameFormatter<ClassNameInfo>([
|
|
18
16
|
'atRule',
|
|
@@ -22,10 +20,6 @@ export const formatClassName = createNameFormatter<ClassNameInfo>([
|
|
|
22
20
|
'value',
|
|
23
21
|
]);
|
|
24
22
|
|
|
25
|
-
export const formatScopeClassName = createNameFormatter<ScopeClassNameInfo>([
|
|
26
|
-
'className',
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
23
|
export const formatTransformClassName = createNameFormatter<TransformClassNameInfo>([
|
|
30
24
|
'className',
|
|
31
25
|
]);
|
|
@@ -38,6 +32,14 @@ export function getDebugClassName(
|
|
|
38
32
|
return formatClassName(format || CLASS_NAME_FORMAT, hash, info);
|
|
39
33
|
}
|
|
40
34
|
|
|
35
|
+
export function getDebugSheetClassName(
|
|
36
|
+
format: ClassNameFormat | null,
|
|
37
|
+
hash: string,
|
|
38
|
+
info: ClassNameInfo,
|
|
39
|
+
) {
|
|
40
|
+
return formatClassName(format || SHEET_CLASS_NAME_FORMAT, hash, info);
|
|
41
|
+
}
|
|
42
|
+
|
|
41
43
|
export function getDebugTransformClassName(
|
|
42
44
|
format: TransformClassNameFormat | null,
|
|
43
45
|
hash: string,
|
|
@@ -45,10 +47,3 @@ export function getDebugTransformClassName(
|
|
|
45
47
|
) {
|
|
46
48
|
return formatTransformClassName(format || TRANSFORM_CLASS_NAME_FORMAT, hash, info);
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
export function getDebugScopeClassName(
|
|
50
|
-
format: ScopeClassNameFormat | null,
|
|
51
|
-
info: ScopeClassNameInfo,
|
|
52
|
-
) {
|
|
53
|
-
return formatScopeClassName(format || SCOPE_CLASS_NAME_FORMAT, null, info);
|
|
54
|
-
}
|
package/atomic/element.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSS_CONFIG } from '../config/config/css';
|
|
2
2
|
import { DEV_CONFIG } from '../config/config/dev';
|
|
3
3
|
import type { ElementClassNameFormat, ElementClassNameInfo } from '../config/types';
|
|
4
|
-
import { escapeCssIdent } from './utils/
|
|
4
|
+
import { escapeCssIdent } from './utils/cssIdent';
|
|
5
5
|
import { sanitizeDebugName } from './utils/debug';
|
|
6
6
|
import { createNameFormatter } from './utils/format';
|
|
7
7
|
import { getIdentifierSafeHash } from './utils/hash';
|
package/atomic/rule.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import type { ItemSelector } from '../builder/data/state';
|
|
2
2
|
import type { ScopeClassNameFormat } from '../config/types';
|
|
3
|
-
import { getScopeClassName } from './className';
|
|
4
3
|
import { LayerMediaPriorities, type LayerPriority, LayerSelectorPriorities } from './layer';
|
|
5
4
|
import { getCssPropertyName, getPropertyPriority } from './property';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { getScopeClassName } from './scope';
|
|
6
|
+
import { escapeCssIdent } from './utils/cssIdent';
|
|
7
|
+
import { getSelectorPriority, getSelectorText, hasSheetSelectorAnchor } from './utils/selector';
|
|
8
8
|
import { getCssPropertyValue } from './value';
|
|
9
9
|
|
|
10
10
|
export function buildAtomicRule(
|
|
11
11
|
className: string,
|
|
12
12
|
property: string,
|
|
13
13
|
value: string,
|
|
14
|
+
important: boolean,
|
|
14
15
|
selector: ItemSelector | null,
|
|
15
16
|
parentSelector: ItemSelector | null,
|
|
16
17
|
atRules: ItemSelector[] | null,
|
|
17
18
|
scopeClassNameFormat: ScopeClassNameFormat | null,
|
|
18
19
|
): string {
|
|
19
20
|
const cssProp = getCssPropertyName(property);
|
|
20
|
-
const cssValue = getCssPropertyValue(property, value);
|
|
21
|
+
const cssValue = getCssPropertyValue(property, value) + (important ? ' !important' : '');
|
|
21
22
|
const escapedClass = escapeCssIdent(className);
|
|
22
23
|
|
|
23
|
-
const classSelector =
|
|
24
|
+
const classSelector = hasSheetSelectorAnchor(selector)
|
|
25
|
+
? `:where(.${escapedClass})`
|
|
26
|
+
: '.' + escapedClass;
|
|
24
27
|
const itemSelector = selector ? getSelectorText(selector) : '';
|
|
25
28
|
|
|
26
29
|
let selectorStr = classSelector + itemSelector;
|
package/atomic/scope.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScopeClassNameFormat, ScopeClassNameInfo } from '../config/types';
|
|
2
|
+
|
|
3
|
+
export const SCOPE_CLASS_NAME_FORMAT = '-(className)';
|
|
4
|
+
|
|
5
|
+
export function getScopeClassName(
|
|
6
|
+
className: string,
|
|
7
|
+
scopeClassNameFormat: ScopeClassNameFormat | null,
|
|
8
|
+
) {
|
|
9
|
+
return formatScopeClassName(scopeClassNameFormat || SCOPE_CLASS_NAME_FORMAT, { className });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function formatScopeClassName(
|
|
13
|
+
format: ScopeClassNameFormat,
|
|
14
|
+
info: ScopeClassNameInfo,
|
|
15
|
+
) {
|
|
16
|
+
if (typeof format === 'function') return format(info);
|
|
17
|
+
|
|
18
|
+
return format.replace(/\[|\]/g, '').replace(/\(className\)/g, info.className);
|
|
19
|
+
}
|
package/atomic/theme.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { CSS_CONFIG } from '../config/config/css';
|
|
|
2
2
|
import type { ThemeNameFormat, ThemeNameInfo, TokenNameFormat } from '../config/types';
|
|
3
3
|
import type { StyleTokenOverride } from '../style/token';
|
|
4
4
|
import { getTokenOverrideValue, getTokenVarName } from './token';
|
|
5
|
-
import { escapeCssIdent
|
|
5
|
+
import { escapeCssIdent } from './utils/cssIdent';
|
|
6
|
+
import { escapeCssValue } from './utils/cssVar';
|
|
6
7
|
import { createNameFormatter } from './utils/format';
|
|
7
8
|
import { getIdentifierSafeHash } from './utils/hash';
|
|
8
9
|
|
|
@@ -18,7 +19,7 @@ export function createThemeClassName(
|
|
|
18
19
|
return formatThemeName(
|
|
19
20
|
themeNameFormat || THEME_NAME_FORMAT,
|
|
20
21
|
getIdentifierSafeHash(id, CSS_CONFIG.hashLength),
|
|
21
|
-
{ name },
|
|
22
|
+
{ name: normalizeThemeName(name) },
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -48,3 +49,41 @@ function getThemeDeclaration(
|
|
|
48
49
|
|
|
49
50
|
return name + ':' + value;
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
export function normalizeThemeName(value: string | null | undefined): string | null {
|
|
54
|
+
if (!value) return null;
|
|
55
|
+
|
|
56
|
+
value = value.trim();
|
|
57
|
+
if (!value) return null;
|
|
58
|
+
if (/^\d+$/.test(value)) return null;
|
|
59
|
+
if (isGeneratedNameHash(value)) return null;
|
|
60
|
+
|
|
61
|
+
const stableSuffix = value.match(/^(.+)-[a-z0-9]{7}$/);
|
|
62
|
+
if (stableSuffix?.[1] && isGeneratedNameHash(value.slice(-7))) {
|
|
63
|
+
return normalizeThemeName(stableSuffix[1]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
value = stripGenericThemePrefix(value);
|
|
67
|
+
if (!value) return null;
|
|
68
|
+
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function stripGenericThemePrefix(value: string) {
|
|
73
|
+
const parts = value.split('--');
|
|
74
|
+
|
|
75
|
+
while (parts[0] === 'theme' || parts[0] === 'themes') {
|
|
76
|
+
parts.shift();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
value = parts.join('--');
|
|
80
|
+
|
|
81
|
+
if (value.startsWith('theme-')) return value.slice('theme-'.length);
|
|
82
|
+
if (value.startsWith('themes-')) return value.slice('themes-'.length);
|
|
83
|
+
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function isGeneratedNameHash(value: string) {
|
|
88
|
+
return /^[a-z0-9]{7}$/.test(value) && /\d/.test(value);
|
|
89
|
+
}
|
package/atomic/token.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSS_CONFIG } from '../config/config/css';
|
|
2
2
|
import type { TokenNameFormat, TokenNameInfo } from '../config/types';
|
|
3
|
-
import { getStyleTokenId, type StyleTokenData, type StyleTokenOverride } from '../style/token';
|
|
4
|
-
import { getCssVar, getCssVarRawFallback } from './utils/
|
|
3
|
+
import { getStyleTokenId, getStyleTokenName, type StyleTokenData, type StyleTokenOverride } from '../style/token';
|
|
4
|
+
import { getCssVar, getCssVarRawFallback } from './utils/cssVar';
|
|
5
5
|
import { createNameFormatter } from './utils/format';
|
|
6
6
|
import { getIdentifierSafeHash } from './utils/hash';
|
|
7
7
|
|
|
@@ -14,11 +14,12 @@ export function getTokenVarName(
|
|
|
14
14
|
format: TokenNameFormat | null,
|
|
15
15
|
) {
|
|
16
16
|
const id = getStyleTokenId(token);
|
|
17
|
+
const debugName = getStyleTokenName(token);
|
|
17
18
|
|
|
18
19
|
const name = formatTokenName(
|
|
19
20
|
format || TOKEN_NAME_FORMAT,
|
|
20
21
|
getIdentifierSafeHash(id, CSS_CONFIG.hashLength),
|
|
21
|
-
{ name:
|
|
22
|
+
{ name: debugName },
|
|
22
23
|
);
|
|
23
24
|
|
|
24
25
|
return '--' + name;
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
export function getCssVar(varName: string, value: string) {
|
|
2
|
-
return 'var(' + varName + ', ' + escapeCssValue(value) + ')';
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function getCssVarRawFallback(varName: string, fallbackCss: string) {
|
|
6
|
-
return 'var(' + varName + ', ' + fallbackCss + ')';
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function escapeCssValue(value: string): string {
|
|
10
|
-
if (!value) return '';
|
|
11
|
-
|
|
12
|
-
return value
|
|
13
|
-
.trim()
|
|
14
|
-
// Escape existing backslashes first so we don't break them.
|
|
15
|
-
.replace(/\\/g, '\\\\')
|
|
16
|
-
.replace(/"/g, '\\"')
|
|
17
|
-
.replace(/'/g, "\\'")
|
|
18
|
-
.replace(/;/g, '\\;');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
1
|
export function escapeCssIdent(ident: string): string {
|
|
22
2
|
let result = '';
|
|
23
3
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function getCssVar(varName: string, value: string) {
|
|
2
|
+
return 'var(' + varName + ', ' + escapeCssValue(value) + ')';
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getCssVarRawFallback(varName: string, fallbackCss: string) {
|
|
6
|
+
return 'var(' + varName + ', ' + fallbackCss + ')';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function escapeCssValue(value: string): string {
|
|
10
|
+
if (!value) return '';
|
|
11
|
+
|
|
12
|
+
return value
|
|
13
|
+
.trim()
|
|
14
|
+
// Escape existing backslashes first so we don't break them.
|
|
15
|
+
.replace(/\\/g, '\\\\')
|
|
16
|
+
.replace(/"/g, '\\"')
|
|
17
|
+
.replace(/'/g, "\\'")
|
|
18
|
+
.replace(/;/g, '\\;');
|
|
19
|
+
}
|
package/atomic/utils/debug.ts
CHANGED
package/atomic/utils/selector.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { SHEET_SELECTOR_ANCHOR } from '../../builder/data/const';
|
|
1
2
|
import type { ItemSelector } from '../../builder/data/state';
|
|
2
3
|
|
|
3
4
|
export function getSelectorText(selector: ItemSelector): string {
|
|
4
|
-
|
|
5
|
+
const text = Array.isArray(selector) ? selector[0] : selector;
|
|
6
|
+
return stripSheetSelectorAnchor(text);
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
export function getSelectorHash(selector: ItemSelector): string {
|
|
@@ -12,3 +14,14 @@ export function getSelectorPriority(selector: ItemSelector | null): number {
|
|
|
12
14
|
if (!selector) return 0;
|
|
13
15
|
return Array.isArray(selector) ? selector[1] : 0;
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
export function hasSheetSelectorAnchor(selector: ItemSelector | null): boolean {
|
|
19
|
+
const text = selector ? Array.isArray(selector) ? selector[0] : selector : '';
|
|
20
|
+
return text.startsWith(SHEET_SELECTOR_ANCHOR);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function stripSheetSelectorAnchor(selector: string) {
|
|
24
|
+
return selector.startsWith(SHEET_SELECTOR_ANCHOR)
|
|
25
|
+
? selector.slice(SHEET_SELECTOR_ANCHOR.length)
|
|
26
|
+
: selector;
|
|
27
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { DEV_CONFIG } from '../../config/config/dev';
|
|
2
2
|
import type { Selector } from '../../selector';
|
|
3
|
-
import { type ClassNameTransform, classNameValue, isClassNameValue } from '../../style';
|
|
4
|
-
import
|
|
3
|
+
import { type ClassNameTransform, classNameValue, importantValue, isClassNameValue } from '../../style';
|
|
4
|
+
import { isStyleImportantValue } from '../../style/important';
|
|
5
|
+
import { isStyleWeightValue, weightValue } from '../../style/weight';
|
|
5
6
|
import { traceMarker } from '../../utils/trace';
|
|
6
7
|
import {
|
|
7
8
|
createStyleData,
|
|
@@ -21,11 +22,19 @@ import { mergeStyleData } from '../style_data';
|
|
|
21
22
|
import { createDefaultFnResult, createFns } from '../style_fns';
|
|
22
23
|
import type { SelectorsRecord } from '../types';
|
|
23
24
|
import { FnPrefixStyle, resolveCallsite } from '../utils';
|
|
24
|
-
import type {
|
|
25
|
+
import type {
|
|
26
|
+
ClassNameBuilder,
|
|
27
|
+
ClassNameFn,
|
|
28
|
+
ClassNameItem,
|
|
29
|
+
ClassNameMergeData,
|
|
30
|
+
ImportantClassName,
|
|
31
|
+
WeightedClassName,
|
|
32
|
+
} from './types';
|
|
25
33
|
|
|
26
34
|
type StyleRecord = Record<string, unknown>;
|
|
27
35
|
type FlattenedClassName<ClassName extends string> = {
|
|
28
36
|
className: ClassName;
|
|
37
|
+
important: boolean;
|
|
29
38
|
weight: number | null;
|
|
30
39
|
};
|
|
31
40
|
|
|
@@ -144,11 +153,11 @@ function createAtRuleFn<ClassName extends string>(
|
|
|
144
153
|
|
|
145
154
|
let arg: string | readonly string[];
|
|
146
155
|
let items: readonly ClassNameItem<ClassName>[];
|
|
147
|
-
let
|
|
156
|
+
let weight: number | null = null;
|
|
148
157
|
|
|
149
158
|
if (hasArg) {
|
|
150
159
|
if (isMedia && typeof withoutDebug[0] === 'number') {
|
|
151
|
-
|
|
160
|
+
weight = withoutDebug[0];
|
|
152
161
|
arg = withoutDebug[1] as string | readonly string[];
|
|
153
162
|
items = withoutDebug.slice(2) as readonly ClassNameItem<ClassName>[];
|
|
154
163
|
} else {
|
|
@@ -156,7 +165,7 @@ function createAtRuleFn<ClassName extends string>(
|
|
|
156
165
|
items = withoutDebug.slice(1) as readonly ClassNameItem<ClassName>[];
|
|
157
166
|
}
|
|
158
167
|
} else if (isMedia && typeof withoutDebug[0] === 'number') {
|
|
159
|
-
|
|
168
|
+
weight = withoutDebug[0];
|
|
160
169
|
arg = fnSelector.selector;
|
|
161
170
|
items = withoutDebug.slice(1) as readonly ClassNameItem<ClassName>[];
|
|
162
171
|
} else {
|
|
@@ -187,7 +196,7 @@ function createAtRuleFn<ClassName extends string>(
|
|
|
187
196
|
classNameStyle.style,
|
|
188
197
|
classNameStyle.debug,
|
|
189
198
|
null,
|
|
190
|
-
[
|
|
199
|
+
[weight !== null ? [selector, weight] : selector],
|
|
191
200
|
);
|
|
192
201
|
}
|
|
193
202
|
|
|
@@ -321,8 +330,9 @@ function classNameItemsToStyle<ClassName extends string>(
|
|
|
321
330
|
const weighted: StyleRecord = item.weight === null
|
|
322
331
|
? transformed
|
|
323
332
|
: applyClassNameWeight(transformed, item.weight);
|
|
333
|
+
const nextStyle = item.important ? applyClassNameImportant(weighted) : weighted;
|
|
324
334
|
|
|
325
|
-
style = style ? Object.assign({}, style,
|
|
335
|
+
style = style ? Object.assign({}, style, nextStyle) : nextStyle;
|
|
326
336
|
|
|
327
337
|
const loc = debug?.classNames?.[item.className];
|
|
328
338
|
if (loc) {
|
|
@@ -359,20 +369,29 @@ function decorateClassNameStyle<ClassName extends string>(
|
|
|
359
369
|
continue;
|
|
360
370
|
}
|
|
361
371
|
|
|
362
|
-
|
|
363
|
-
const rawValue = (value as StyleValueTuple)[1];
|
|
364
|
-
result[property] = isClassNameValue(rawValue)
|
|
365
|
-
? value
|
|
366
|
-
: [(value as StyleValueTuple)[0], classNameValue(rawValue, className)];
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
result[property] = isClassNameValue(value) ? value : classNameValue(value, className);
|
|
372
|
+
result[property] = decorateClassNameValue(value, className);
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
return result;
|
|
374
376
|
}
|
|
375
377
|
|
|
378
|
+
function decorateClassNameValue<ClassName extends string>(
|
|
379
|
+
value: unknown,
|
|
380
|
+
className: ClassName,
|
|
381
|
+
): unknown {
|
|
382
|
+
if (isClassNameValue(value)) return value;
|
|
383
|
+
|
|
384
|
+
if (isStyleImportantValue(value)) {
|
|
385
|
+
return importantValue(decorateClassNameValue(value.value, className));
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (isStyleWeightValue(value)) {
|
|
389
|
+
return weightValue(decorateClassNameValue(value.value, className), value.weight);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return classNameValue(value, className);
|
|
393
|
+
}
|
|
394
|
+
|
|
376
395
|
function flattenClassNameItems<ClassName extends string>(
|
|
377
396
|
items: readonly ClassNameItem<ClassName>[],
|
|
378
397
|
): FlattenedClassName<ClassName>[] {
|
|
@@ -392,7 +411,7 @@ function collectClassNameItem<ClassName extends string>(
|
|
|
392
411
|
if (!item) return;
|
|
393
412
|
|
|
394
413
|
if (typeof item === 'string') {
|
|
395
|
-
result.push({ className: item, weight: null });
|
|
414
|
+
result.push({ className: item, important: false, weight: null });
|
|
396
415
|
return;
|
|
397
416
|
}
|
|
398
417
|
|
|
@@ -402,7 +421,12 @@ function collectClassNameItem<ClassName extends string>(
|
|
|
402
421
|
}
|
|
403
422
|
|
|
404
423
|
if (isWeightedClassName(item)) {
|
|
405
|
-
result.push(item);
|
|
424
|
+
result.push({ ...item, important: false });
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (isImportantClassName(item)) {
|
|
429
|
+
result.push({ className: item.className, important: true, weight: null });
|
|
406
430
|
}
|
|
407
431
|
}
|
|
408
432
|
|
|
@@ -415,6 +439,15 @@ function isWeightedClassName<ClassName extends string>(
|
|
|
415
439
|
return typeof weighted.className === 'string' && typeof weighted.weight === 'number';
|
|
416
440
|
}
|
|
417
441
|
|
|
442
|
+
function isImportantClassName<ClassName extends string>(
|
|
443
|
+
item: unknown,
|
|
444
|
+
): item is ImportantClassName<ClassName> {
|
|
445
|
+
if (!item || typeof item !== 'object') return false;
|
|
446
|
+
|
|
447
|
+
const important = item as Partial<ImportantClassName<ClassName>>;
|
|
448
|
+
return typeof important.className === 'string' && important.important === true;
|
|
449
|
+
}
|
|
450
|
+
|
|
418
451
|
function applyClassNameWeight(
|
|
419
452
|
style: StyleRecord,
|
|
420
453
|
weight: number,
|
|
@@ -427,16 +460,27 @@ function applyClassNameWeight(
|
|
|
427
460
|
continue;
|
|
428
461
|
}
|
|
429
462
|
|
|
430
|
-
|
|
431
|
-
? value[1]
|
|
432
|
-
: value;
|
|
433
|
-
|
|
434
|
-
weighted[property] = [weight, rawValue];
|
|
463
|
+
weighted[property] = weightValue(value, weight);
|
|
435
464
|
}
|
|
436
465
|
|
|
437
466
|
return weighted;
|
|
438
467
|
}
|
|
439
468
|
|
|
469
|
+
function applyClassNameImportant(style: StyleRecord): StyleRecord {
|
|
470
|
+
const important: StyleRecord = {};
|
|
471
|
+
|
|
472
|
+
for (const [property, value] of Object.entries(style)) {
|
|
473
|
+
if (value === null || value === undefined) {
|
|
474
|
+
important[property] = value;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
important[property] = importantValue(value);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return important;
|
|
482
|
+
}
|
|
483
|
+
|
|
440
484
|
function splitDebug<T>(
|
|
441
485
|
params: readonly T[],
|
|
442
486
|
): [items: T[], debug: DebugData | undefined] {
|
package/builder/classname/fns.ts
CHANGED
|
@@ -29,11 +29,11 @@ type ClassNameAtRuleNoArgFn<ClassName extends string, Self> = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
type ClassNameMediaFn<ClassName extends string, Self, Arg> = ClassNameAtRuleFn<ClassName, Self, Arg> & {
|
|
32
|
-
(
|
|
32
|
+
(weight: number, selector: Arg, ...items: ClassNameItems<ClassName>): Self;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
type ClassNameMediaNoArgFn<ClassName extends string, Self> = ClassNameAtRuleNoArgFn<ClassName, Self> & {
|
|
36
|
-
(
|
|
36
|
+
(weight: number, ...items: ClassNameItems<ClassName>): Self;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
type ClassNameAtRuleArgFn<ClassName extends string, Self, Arg extends string> = ClassNameAtRuleFn<ClassName, Self, Arg>;
|