@fluentic/style 0.1.0-beta.1 → 0.1.0-beta.10
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 +150 -2
- package/README.md +181 -49
- package/atomic/atRule/utils.ts +3 -2
- package/atomic/className.ts +50 -12
- package/atomic/debug/className/className.ts +24 -8
- package/atomic/element.ts +5 -2
- package/atomic/rule.ts +11 -5
- package/atomic/scope.ts +19 -0
- package/atomic/theme.ts +44 -3
- package/atomic/token.ts +7 -4
- package/atomic/utils/cssIdent.ts +54 -0
- package/atomic/utils/cssVar.ts +19 -0
- package/atomic/utils/debug.ts +1 -1
- package/atomic/utils/format.ts +1 -1
- package/atomic/utils/hash.ts +14 -0
- package/atomic/utils/selector.ts +31 -1
- package/atomic/var.ts +3 -2
- package/builder/classname/class_name_builder.ts +491 -0
- package/builder/classname/fns.ts +77 -0
- package/builder/classname/index.ts +3 -0
- package/builder/classname/types.ts +41 -0
- package/builder/data/const.ts +8 -1
- package/builder/data/create.ts +52 -6
- package/builder/data/data.ts +33 -8
- package/builder/data/debug.ts +1 -0
- package/builder/data/index.ts +0 -1
- package/builder/data/is.ts +26 -3
- package/builder/data/merge/scope.ts +38 -38
- package/builder/data/merge/style.ts +115 -20
- package/builder/data/state.ts +17 -2
- package/builder/extract/index.ts +1 -0
- package/builder/extract/sheet.ts +30 -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 +31 -0
- package/builder/selector_override_core.ts +79 -0
- package/builder/style_builder.ts +144 -20
- package/builder/style_data.ts +25 -0
- package/builder/style_fns.ts +57 -57
- 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 +44 -16
- package/builder/types/fns.ts +24 -16
- package/builder/types/types.ts +37 -7
- package/builder/utils.ts +1 -0
- package/compiler/compiler/compiler.ts +88 -14
- package/compiler/compiler/constants.ts +6 -0
- package/compiler/compiler/index.ts +1 -0
- package/compiler/compiler/types.ts +4 -1
- package/compiler/cssProp.ts +21 -0
- package/compiler/extract/extract.ts +42 -14
- package/compiler/extract/types.ts +2 -0
- package/compiler/index.ts +1 -0
- package/compiler/transform/cssProp/index.ts +1 -0
- package/compiler/transform/cssProp/plugin.ts +161 -0
- package/compiler/transform/debug/plugin.ts +93 -4
- package/compiler/transform/debug/transform.ts +2 -1
- package/compiler/transform/debug/utils/debug_data.ts +73 -0
- package/compiler/transform/evaluator/evaluator.ts +169 -32
- package/compiler/transform/evaluator/tracer.ts +48 -11
- package/compiler/transform/extract/chain/chain.ts +1370 -162
- package/compiler/transform/extract/chain/extract_chain.ts +12 -4
- package/compiler/transform/extract/chain/types.ts +3 -1
- package/compiler/transform/extract/plugin.ts +64 -6
- package/compiler/transform/extract/transform.ts +2 -1
- package/compiler/transform/extract/utils/replacement.ts +72 -2
- package/compiler/transform/extract/utils/state.ts +3 -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 +12 -5
- package/compiler/utils/file_resolver.ts +2 -0
- package/compiler/utils/import_source.ts +19 -8
- package/compiler/utils/imports.ts +11 -1
- package/config/build.ts +9 -2
- package/config/config/check.ts +25 -0
- package/config/config/css.ts +18 -1
- package/config/config/debug.ts +24 -1
- package/config/config/dev.ts +17 -1
- package/config/configure.ts +19 -2
- package/config/types.ts +7 -0
- package/css/index.ts +2 -0
- package/css/sheet.ts +152 -0
- package/css/styleTarget.ts +251 -0
- package/dev/config.ts +2 -3
- package/dev/utils.ts +3 -3
- package/dialect/extracted/index.ts +5 -0
- package/dialect/index.ts +1 -0
- package/dialect/namedTokens.ts +153 -0
- package/dist/adapter/preact.js +2 -0
- package/dist/adapter/react.js +2 -0
- package/dist/adapter/solid.js +2 -0
- package/dist/className-yhJCGT0F.js +304 -0
- package/dist/className-yhJCGT0F.js.map +1 -0
- package/dist/combine-Bww7VnSr.js +1254 -0
- package/dist/combine-Bww7VnSr.js.map +1 -0
- package/dist/compiler/index.mjs +2 -2
- package/dist/{compiler-DENc3a2R.mjs → compiler-C3CEGGtI.mjs} +2335 -638
- package/dist/compiler-C3CEGGtI.mjs.map +1 -0
- package/dist/config/index.js +2 -2
- package/dist/config-BAEzRmSJ.js +6 -0
- package/dist/{config-Di2VYYKV.js.map → config-BAEzRmSJ.js.map} +1 -1
- package/dist/config-BKP5LOkt.js +35 -0
- package/dist/config-BKP5LOkt.js.map +1 -0
- package/dist/config-C5VWvTav.js +34 -0
- package/dist/config-C5VWvTav.js.map +1 -0
- package/dist/config-CB4lm2tM.js +1 -0
- package/dist/config-CDjbHwb-.js +6 -0
- package/dist/config-CDjbHwb-.js.map +1 -0
- package/dist/config-DNEnHEf3.js +36 -0
- package/dist/config-DNEnHEf3.js.map +1 -0
- package/dist/createTransformElement-D8fXZ3wA.js +34 -0
- package/dist/createTransformElement-D8fXZ3wA.js.map +1 -0
- package/dist/css-BDn0epJ8.js +1339 -0
- package/dist/css-BDn0epJ8.js.map +1 -0
- package/dist/css-CFxNrYt3.js +4040 -0
- package/dist/css-CFxNrYt3.js.map +1 -0
- package/dist/css-DEYgrj76.js +524 -0
- package/dist/css-DEYgrj76.js.map +1 -0
- package/dist/{runtime-CYqNCiaM.js → css-DWBWsyxZ.js} +16 -19
- package/dist/css-DWBWsyxZ.js.map +1 -0
- package/dist/css.js +2 -2
- package/dist/{css_extra-oIi3UEPK.js → css_extra-nTq_Gw0E.js} +2 -2
- package/dist/{css_extra-DlOnsnR1.js.map → css_extra-nTq_Gw0E.js.map} +1 -1
- package/dist/data-CDrS1Bq4.js +785 -0
- package/dist/data-CDrS1Bq4.js.map +1 -0
- package/dist/debug-BkVbf0Cz.js +52 -0
- package/dist/debug-BkVbf0Cz.js.map +1 -0
- package/dist/{debug-n2aZQBSa.js → debug-YuhEIQVO.js} +80 -4
- package/dist/debug-YuhEIQVO.js.map +1 -0
- package/dist/dev/rsc.js +10 -9
- package/dist/dev/rsc.js.map +1 -1
- package/dist/{dev-CcphAa3R.js → dev-0imWmSVb.js} +10 -10
- package/dist/dev-0imWmSVb.js.map +1 -0
- package/dist/dev.js +1 -1
- package/dist/dialect/extracted/index.js +2 -0
- package/dist/dialect/index.js +2 -0
- package/dist/{elementMarker-Bu7gDAkE.js → elementMarker-kvpMjB49.js} +164 -30
- package/dist/elementMarker-kvpMjB49.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 -1
- package/dist/entry/dev/jsx-runtime.js +2 -1
- package/dist/entry/dev.js +13 -9
- 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 +242 -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 +84 -1201
- package/dist/entry/prod.js.map +1 -1
- package/dist/entry/rsc-dev/adapter/preact.js +13 -0
- package/dist/entry/rsc-dev/adapter/preact.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/react.js +13 -0
- package/dist/entry/rsc-dev/adapter/react.js.map +1 -0
- package/dist/entry/rsc-dev/adapter/solid.js +13 -0
- package/dist/entry/rsc-dev/adapter/solid.js.map +1 -0
- package/dist/entry/rsc-dev/css.js +3 -3
- package/dist/entry/rsc-dev/dev.js +11 -13
- 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 +582 -664
- 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 +242 -10
- package/dist/entry/rsc-prod.js.map +1 -0
- package/dist/{styleStore-Dea_WVbr.js → env-Cz8frh6e.js} +1335 -372
- package/dist/env-Cz8frh6e.js.map +1 -0
- package/dist/getClassName-9CsXbNls.js +545 -0
- package/dist/getClassName-9CsXbNls.js.map +1 -0
- package/dist/{utils-D7FAOyg6.js → getClassName-DGm-VNDo.js} +28 -65
- package/dist/getClassName-DGm-VNDo.js.map +1 -0
- package/dist/getClassName-Dtc4yyYI.js +47 -0
- package/dist/getClassName-Dtc4yyYI.js.map +1 -0
- package/dist/{getClassName-BlvXHYuf.js → getClassName-DtkplEIt.js} +56 -14
- package/dist/getClassName-DtkplEIt.js.map +1 -0
- package/dist/global-CAc9OjKx.js +14 -0
- package/dist/global-CAc9OjKx.js.map +1 -0
- package/dist/{format-3nKBE_5t.js → hash-Cr-LCWDt.js} +51 -29
- package/dist/hash-Cr-LCWDt.js.map +1 -0
- package/dist/index.js +10 -8
- 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-CVxpkS04.js +39 -0
- package/dist/jsx-CVxpkS04.js.map +1 -0
- package/dist/{jsx_dev_runtime-B6xs4by8.js → jsx_dev_runtime-D068tAsT.js} +2 -3
- package/dist/{jsx_dev_runtime-B6xs4by8.js.map → jsx_dev_runtime-D068tAsT.js.map} +1 -1
- package/dist/{jsx_runtime-iHLDwpcW.js → jsx_runtime-6Qa1lmz2.js} +2 -2
- package/dist/{jsx_runtime-iHLDwpcW.js.map → jsx_runtime-6Qa1lmz2.js.map} +1 -1
- package/dist/{jsx_runtime-04xfnsi7.js → jsx_runtime-DT1Tr9cH.js} +2 -3
- package/dist/{jsx_runtime-04xfnsi7.js.map → jsx_runtime-DT1Tr9cH.js.map} +1 -1
- package/dist/{loader-B5Kw0DD-.mjs → loader-_-VjzlrX.mjs} +13 -14
- package/dist/loader-_-VjzlrX.mjs.map +1 -0
- package/dist/{misc-DCdYYyhK.mjs → misc-B76PUnWe.mjs} +11 -6
- package/dist/misc-B76PUnWe.mjs.map +1 -0
- package/dist/namedTokens-5AayGokX.js +85 -0
- package/dist/namedTokens-5AayGokX.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 +121 -17
- package/dist/plugin/nextjs/index.mjs.map +1 -1
- package/dist/plugin/nextjs/loader.mjs +4 -4
- package/dist/plugin/parcel/index.cjs +2 -0
- package/dist/plugin/parcel/index.mjs +3 -1
- package/dist/plugin/parcel/optimizer.cjs +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 +13 -10
- 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 +995 -0
- package/dist/presets/tailwind/index.js.map +1 -0
- package/dist/{assert-BGdigdr5.js → presets-DSanixJV.js} +106 -2
- package/dist/presets-DSanixJV.js.map +1 -0
- package/dist/{registry-yHLRxyoo.mjs → registry-w8ET5R7v.mjs} +2 -2
- package/dist/{registry-yHLRxyoo.mjs.map → registry-w8ET5R7v.mjs.map} +1 -1
- package/dist/resolveClassNameRuntime-CJjlUP93.js +63 -0
- package/dist/resolveClassNameRuntime-CJjlUP93.js.map +1 -0
- package/dist/{rules-9HSO1pxL.js → rules-DaMaMHgb.js} +618 -138
- package/dist/rules-DaMaMHgb.js.map +1 -0
- package/dist/scope-CZdGAnl_.js +601 -0
- package/dist/scope-CZdGAnl_.js.map +1 -0
- package/dist/selector/index.js +1 -2
- package/dist/server.js +17 -11
- package/dist/server.js.map +1 -1
- package/dist/{shared-CxbHR89f.mjs → shared-C_cYxNzz.mjs} +4 -4
- package/dist/{shared-CxbHR89f.mjs.map → shared-C_cYxNzz.mjs.map} +1 -1
- package/dist/{shared-CBArHB9-.cjs → shared-PK52rW6T.cjs} +2338 -635
- package/dist/shared-PK52rW6T.cjs.map +1 -0
- package/dist/sheet-CxkO1Hwt.js +7 -0
- package/dist/sheet-CxkO1Hwt.js.map +1 -0
- package/dist/{sidecar-BFakLl0X.mjs → sidecar-BhvmXYsD.mjs} +3 -3
- package/dist/{sidecar-BFakLl0X.mjs.map → sidecar-BhvmXYsD.mjs.map} +1 -1
- package/dist/style-CAhAnRni.js +1129 -0
- package/dist/style-CAhAnRni.js.map +1 -0
- package/dist/{styleStore-DyNXBcUK.js → styleStore-BzLZwpwy.js} +8 -7
- package/dist/styleStore-BzLZwpwy.js.map +1 -0
- package/dist/styleStore-DaIJ4OPV.js +58 -0
- package/dist/styleStore-DaIJ4OPV.js.map +1 -0
- package/dist/token-D33mKTka.js +138 -0
- package/dist/token-D33mKTka.js.map +1 -0
- package/dist/{trace-Bu_qOqRy.js → trace-B3dpTRJp.js} +3 -3
- package/dist/{trace-Bu_qOqRy.js.map → trace-B3dpTRJp.js.map} +1 -1
- package/dist/{trace-CU0rvNYr.js → trace-c2WmBbmX.js} +2 -2
- package/dist/{trace-CU0rvNYr.js.map → trace-c2WmBbmX.js.map} +1 -1
- package/dist/transform-DSpimwwC.js +23 -0
- package/dist/transform-DSpimwwC.js.map +1 -0
- package/dist/{utils-Bdbqn0f8.mjs → utils-DND33M6y.mjs} +3 -3
- package/dist/{utils-Bdbqn0f8.mjs.map → utils-DND33M6y.mjs.map} +1 -1
- package/dist/utils-DZK0mfmY.js +42 -0
- package/dist/utils-DZK0mfmY.js.map +1 -0
- package/dist/utils-D_XgtMtn.js +72 -0
- package/dist/utils-D_XgtMtn.js.map +1 -0
- package/dist/utils-DxCpyV2E.js +62 -0
- package/dist/utils-DxCpyV2E.js.map +1 -0
- package/dist/{utils-BbehLOby.js → utils-H1VInWpd.js} +407 -234
- package/dist/utils-H1VInWpd.js.map +1 -0
- package/dist/utils-NdisireF.mjs +182 -0
- package/dist/utils-NdisireF.mjs.map +1 -0
- package/dist/utils.js +4 -4
- package/dist/utils.js.map +1 -1
- package/dist/value-CK0-Xbov.js +160 -0
- package/dist/value-CK0-Xbov.js.map +1 -0
- package/dist/{webpack-Dh6lox2l.mjs → webpack-D7QO0bKN.mjs} +5 -5
- package/dist/webpack-D7QO0bKN.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/dev/config.ts +1 -1
- package/entry/dev/index.ts +1 -0
- package/entry/dev/jsx_dev_runtime.ts +1 -0
- package/entry/dev/jsx_runtime.ts +1 -0
- package/entry/dev/sheet.ts +4 -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 +4 -2
- package/entry/rsc_dev/adapter/preact.ts +9 -0
- package/entry/rsc_dev/adapter/react.ts +9 -0
- package/entry/rsc_dev/adapter/solid.ts +9 -0
- package/entry/rsc_dev/config.ts +1 -1
- package/entry/rsc_dev/server.ts +1 -1
- 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/rsc_prod/runtime.ts +1 -1
- package/entry/rsc_prod/server.ts +1 -1
- package/entry/shared/config_debug.ts +9 -0
- package/entry/shared/config_dev.ts +14 -0
- package/entry/shared/dev.ts +11 -2
- package/entry/shared/utils.ts +28 -0
- package/jsx/types/index.ts +1 -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 +110 -8
- 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 +5 -9
- package/plugin/bundler/vite/state.ts +11 -6
- package/plugin/bundler/webpack/plugin.ts +2 -1
- package/plugin/bundler/webpack/shared/loader.ts +9 -7
- package/plugin/nextjs/plugin.ts +208 -15
- package/plugin/nextjs/types.ts +1 -2
- package/plugin/nextjs/utils.ts +121 -0
- package/plugin/utils/compiler.ts +2 -0
- package/plugin/utils/runtimeEntry.ts +15 -2
- package/presets/tailwind/classname/index.ts +2 -0
- package/presets/tailwind/classname/transform.ts +239 -0
- package/presets/tailwind/classname/types.ts +124 -0
- package/presets/tailwind/index.ts +5 -0
- package/presets/tailwind/selectors.ts +27 -0
- package/presets/tailwind/style/index.ts +2 -0
- package/presets/tailwind/style/transform.ts +436 -0
- package/presets/tailwind/style/types.ts +346 -0
- package/presets/tailwind/theme.ts +479 -0
- package/presets/tailwind/types.ts +147 -0
- package/runtime/adapter/utils.ts +120 -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 +16 -31
- 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 +55 -23
- package/runtime/extract/index.ts +4 -2
- package/runtime/extract/token.ts +41 -0
- package/runtime/extract/tokenResolver.ts +17 -0
- package/runtime/index.ts +8 -1
- package/runtime/rsc/getClassName.ts +4 -0
- package/runtime/rsc/observer.ts +4 -0
- package/runtime/rsc/styleStore.ts +18 -7
- package/runtime/sheet/rule.ts +16 -12
- package/runtime/sheet/rules.ts +8 -3
- package/runtime/style/scope.ts +0 -24
- package/runtime/style/style.ts +181 -6
- package/runtime/types.ts +6 -4
- package/sheet/dev/dev_layer.ts +18 -7
- package/sheet/dev/dev_sort.ts +45 -11
- package/sheet/prod.ts +18 -7
- package/sheet/types.ts +2 -0
- package/sheet/utils/layer.ts +33 -0
- package/style/classname.ts +47 -0
- package/style/important.ts +19 -0
- package/style/index.ts +3 -0
- package/style/style.ts +47 -16
- package/style/theme.ts +4 -3
- package/style/token.ts +26 -21
- package/style/tokens.ts +18 -12
- package/style/transform.ts +41 -2
- 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/hash.ts +4 -0
- package/utils/symbol.ts +3 -0
- package/atomic/layer/README.md +0 -116
- package/atomic/utils/css.ts +0 -49
- package/dist/assert-BGdigdr5.js.map +0 -1
- package/dist/className-C1Ht5Wvv.js +0 -144
- package/dist/className-C1Ht5Wvv.js.map +0 -1
- package/dist/className-DC2Cq8p3.js +0 -251
- package/dist/className-DC2Cq8p3.js.map +0 -1
- package/dist/compiler-DENc3a2R.mjs.map +0 -1
- package/dist/config-BryWDfQX.js +0 -25
- package/dist/config-BryWDfQX.js.map +0 -1
- package/dist/config-DKHXWhe1.js +0 -1
- package/dist/config-Di2VYYKV.js +0 -6
- package/dist/config-DloHOG6I.js +0 -13
- package/dist/config-DloHOG6I.js.map +0 -1
- package/dist/css-BowBszUt.js +0 -243
- package/dist/css-BowBszUt.js.map +0 -1
- package/dist/css-ByOrugEX.js +0 -805
- package/dist/css-ByOrugEX.js.map +0 -1
- package/dist/css-DcazYor9.js +0 -235
- package/dist/css-DcazYor9.js.map +0 -1
- package/dist/css_extra-DlOnsnR1.js +0 -8
- package/dist/css_extra-oIi3UEPK.js.map +0 -1
- package/dist/data-BsqOa5br.js +0 -473
- package/dist/data-BsqOa5br.js.map +0 -1
- package/dist/debug-BAw63qX6.js +0 -15
- package/dist/debug-BAw63qX6.js.map +0 -1
- package/dist/debug-DGki_v7g.js +0 -15
- package/dist/debug-DGki_v7g.js.map +0 -1
- package/dist/debug-n2aZQBSa.js.map +0 -1
- package/dist/dev-CcphAa3R.js.map +0 -1
- package/dist/dev-DfBbuLeE.js +0 -71
- package/dist/dev-DfBbuLeE.js.map +0 -1
- package/dist/elementMarker-Bu7gDAkE.js.map +0 -1
- package/dist/extract-CzWJeQi8.js +0 -121
- package/dist/extract-CzWJeQi8.js.map +0 -1
- package/dist/extract-DEwSDJ9Z.js +0 -2
- package/dist/format-3nKBE_5t.js.map +0 -1
- package/dist/getClassName-BlvXHYuf.js.map +0 -1
- package/dist/global-CvfmFLsK.js +0 -11
- package/dist/global-CvfmFLsK.js.map +0 -1
- package/dist/jsx-CwTeyUxr.js +0 -39
- package/dist/jsx-CwTeyUxr.js.map +0 -1
- package/dist/jsx-D2BksHSv.js +0 -38
- package/dist/jsx-D2BksHSv.js.map +0 -1
- package/dist/layer-D1SaH07m.js +0 -94
- package/dist/layer-D1SaH07m.js.map +0 -1
- package/dist/loader-B5Kw0DD-.mjs.map +0 -1
- package/dist/misc-DCdYYyhK.mjs.map +0 -1
- package/dist/presets-BhXa232U.js +0 -108
- package/dist/presets-BhXa232U.js.map +0 -1
- package/dist/property-CnLFt5kx.js +0 -406
- package/dist/property-CnLFt5kx.js.map +0 -1
- package/dist/rules-9HSO1pxL.js.map +0 -1
- package/dist/runtime-CYqNCiaM.js.map +0 -1
- package/dist/shared-CBArHB9-.cjs.map +0 -1
- package/dist/style-B-6jHipw.js +0 -5
- package/dist/style-B1UUqjj5.js +0 -743
- package/dist/style-B1UUqjj5.js.map +0 -1
- package/dist/style-DgHbdbdF.js +0 -752
- package/dist/style-DgHbdbdF.js.map +0 -1
- package/dist/style-v2bf70TZ.js +0 -1269
- package/dist/style-v2bf70TZ.js.map +0 -1
- package/dist/styleStore-Dea_WVbr.js.map +0 -1
- package/dist/styleStore-DyNXBcUK.js.map +0 -1
- package/dist/token-CKXUECuU.js +0 -76
- package/dist/token-CKXUECuU.js.map +0 -1
- package/dist/token-u_tM-mtg.js +0 -204
- package/dist/token-u_tM-mtg.js.map +0 -1
- package/dist/utils-BbehLOby.js.map +0 -1
- package/dist/utils-CEaq_c-A.mjs +0 -97
- package/dist/utils-CEaq_c-A.mjs.map +0 -1
- package/dist/utils-CWNHx4EC.js +0 -170
- package/dist/utils-CWNHx4EC.js.map +0 -1
- package/dist/utils-D7FAOyg6.js.map +0 -1
- package/dist/value-BR4e2MKt.js +0 -910
- package/dist/value-BR4e2MKt.js.map +0 -1
- package/dist/value-E8rEv2Oe.js +0 -136
- package/dist/value-E8rEv2Oe.js.map +0 -1
- package/dist/valueRef-lshFk1Cs.js +0 -16
- package/dist/valueRef-lshFk1Cs.js.map +0 -1
- package/dist/webpack-Dh6lox2l.mjs.map +0 -1
- package/dist/withTokens-LRidu3Vc.js +0 -95
- package/dist/withTokens-LRidu3Vc.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,158 @@
|
|
|
1
1
|
# @fluentic/style
|
|
2
2
|
|
|
3
|
-
## 0.1.0-beta.
|
|
3
|
+
## 0.1.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Improve selector-sheet cascade control and important-value guidance.
|
|
8
|
+
|
|
9
|
+
- Keep `createSheet(...)` output unlayered by default so selector sheets can override unlayered third-party CSS, while allowing global `css.layer.sheet` and per-sheet `layer` opt-in through the derived `<layerNamespace>.sheet` layer.
|
|
10
|
+
- Add `createSheet({ layer, weight }, items)` so individual sheets can override layer participation and deliberately increase their generated anchor specificity.
|
|
11
|
+
- Preserve Fluentic's intended rule priority for `style.important(...)` when cascade layers reverse important declaration order.
|
|
12
|
+
- Add opt-in `check.important.rawValue` and `check.important.outsideSheet` compiler/runtime checks with `warn` and `error` modes.
|
|
13
|
+
|
|
14
|
+
## 0.1.0-beta.9
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 0309b3b: Resolve TypeScript path aliases when statically extracting imported theme
|
|
19
|
+
values. Imported `createValues(...)` palettes referenced through `tsconfig`
|
|
20
|
+
paths now extract correctly, including in React Server Component production
|
|
21
|
+
builds.
|
|
22
|
+
|
|
23
|
+
## 0.1.0-beta.8
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Improve Next.js RSC development CSS stability.
|
|
28
|
+
|
|
29
|
+
- Include imported `createValues(...)` and named-token `getToken(...)` values
|
|
30
|
+
in RSC dev precollected CSS so initial server styles match the dev
|
|
31
|
+
stylesheet.
|
|
32
|
+
- Use stable project-relative callsites for RSC dev local CSS variables,
|
|
33
|
+
including values imported from shared theme modules.
|
|
34
|
+
- Include the installed package identity in the Next.js cache key so local
|
|
35
|
+
tarball/package changes invalidate dev CSS caches.
|
|
36
|
+
- Increase the default dev/debug hash suffix from 3 to 5 characters to avoid
|
|
37
|
+
readable class-name collisions in large debug stylesheets while preserving
|
|
38
|
+
explicit `hashLength` configuration.
|
|
39
|
+
|
|
40
|
+
## 0.1.0-beta.7
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Keep Preact and SolidJS JSX type augmentations opt-in so React projects using
|
|
45
|
+
`@fluentic/style/plugin/jsx` no longer need optional framework peers installed.
|
|
46
|
+
|
|
47
|
+
- Keep React JSX `css` prop types in the default package type bundle.
|
|
48
|
+
- Add explicit `@fluentic/style/types/preact` and
|
|
49
|
+
`@fluentic/style/types/solid` type entrypoints for Preact and SolidJS
|
|
50
|
+
projects.
|
|
51
|
+
- Document the required project-level declaration-file import and update the
|
|
52
|
+
Preact and SolidJS examples.
|
|
53
|
+
|
|
54
|
+
## 0.1.0-beta.6
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- 2bff82f: Improve css-prop adapters, class-name extraction, and Next.js build stability.
|
|
59
|
+
|
|
60
|
+
- Preserve normal JSX prop precedence when compiling intrinsic `css` props through React, Preact, and Solid adapters.
|
|
61
|
+
- Keep React `key` props outside generated css-prop spreads so list identity is preserved.
|
|
62
|
+
- Improve React Server Component development handling for css-prop adapter imports, including client components.
|
|
63
|
+
- Make class-name extraction produce stable debug hashes and better source locations for class-name utilities.
|
|
64
|
+
- Add Tailwind class-name support for arbitrary text values such as `text-[13px]`, `text-[length:13px]`, and `text-[color:purple]`.
|
|
65
|
+
- Improve Next.js integration for dev CSS delivery, Turbopack loader options, and production CSS precollection.
|
|
66
|
+
- Add default export conditions for common package entry points.
|
|
67
|
+
|
|
68
|
+
## 0.1.0-beta.5
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Add attachable selector sheets for styling fixed third-party class names
|
|
73
|
+
without emitting global CSS.
|
|
74
|
+
|
|
75
|
+
- Add `style.selector(...)` selector targets and `createSheet(...)` from
|
|
76
|
+
`@fluentic/style/css` for manual selector rules that still attach through
|
|
77
|
+
generated Fluentic classes.
|
|
78
|
+
- Support selector overrides and token overrides inside sheets so component
|
|
79
|
+
wrappers can expose local third-party themes with the same shape as
|
|
80
|
+
scoped style composition.
|
|
81
|
+
- Add `&` and `&?` selector handling for attached-element and portal-friendly
|
|
82
|
+
selector rules. Comma-separated selector strings are rejected; pass an
|
|
83
|
+
array when a rule should target multiple selectors.
|
|
84
|
+
- Add `createStyleTarget(...)` for applying style props to explicit DOM
|
|
85
|
+
targets such as `document.body`, with shared-target reference counting for
|
|
86
|
+
overlapping portal users.
|
|
87
|
+
- Make `combineStyle(...)` compose sheets directly, and add
|
|
88
|
+
`combineStyle.with(...)` plus array-only `combineStyle.multi(...)` for
|
|
89
|
+
cache-friendly style and sheet composition.
|
|
90
|
+
- Support selector sheet extraction, local token overrides, debug class
|
|
91
|
+
names, source tracing, and sourcemap data across runtime and extracted
|
|
92
|
+
builds.
|
|
93
|
+
- Add Preact css-prop support with a `CssPropPresets.Preact` compiler
|
|
94
|
+
preset, runtime adapters, JSX types, and a Vite example.
|
|
95
|
+
- Keep plugin css-prop configuration focused on `CssPropPresets` instead of
|
|
96
|
+
exporting each framework preset as a separate top-level plugin API.
|
|
97
|
+
- Add `style.important(...)` and `className.important(...)` for interop cases
|
|
98
|
+
that need emitted `!important` declarations, especially selector sheets
|
|
99
|
+
wrapping third-party CSS.
|
|
100
|
+
- Add `style.weight(...)` as the style-object counterpart to
|
|
101
|
+
`className.weight(...)`.
|
|
102
|
+
- Keep the extracted production runtime below 5 KB minified and gzipped with
|
|
103
|
+
`combineStyle` included, and keep selector parsing helpers out of the
|
|
104
|
+
extracted production entry.
|
|
105
|
+
- Add a React Select third-party selectors example, Preact integration docs,
|
|
106
|
+
and a clearer third-party styling guide for selector sheets, style targets,
|
|
107
|
+
portal menus, and the new `combineStyle` helpers.
|
|
108
|
+
|
|
109
|
+
## 0.1.0-beta.4
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Slim the extracted production runtime token path and fix named token refs in token-bound extracted styles.
|
|
114
|
+
|
|
115
|
+
- Keep token symbols, guards, naming, and extracted token helpers in builder/runtime internals instead of the public style token surface.
|
|
116
|
+
- Split extracted combine, token resolution, CSS variable, scope, and debug config helpers so extracted builds retain less eager runtime code.
|
|
117
|
+
- Make named tokens carry their extracted CSS variable name so production token bindings can reference named token values without compiler metadata errors.
|
|
118
|
+
- Hide manual stable ids from the public token and theme factory types while preserving internal compiler-provided identities.
|
|
119
|
+
- Add snapshot and runtime contract coverage for createToken, createTokens, createValues, createTheme, scopes, bindScope, combineStyle, and named-token refs in extracted output.
|
|
120
|
+
- 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.
|
|
121
|
+
|
|
122
|
+
## 0.1.0-beta.3
|
|
4
123
|
|
|
5
124
|
### Patch Changes
|
|
6
125
|
|
|
7
|
-
-
|
|
126
|
+
- fd4a705: Make production class names globally dedupe extracted rules by deriving callsite-local hashing from dev mode only. Keep debug class names configurable from plugin and runtime CSS options, with dev defaulting to readable names and production defaulting to compact hashes.
|
|
127
|
+
|
|
128
|
+
## 0.1.0-beta.2
|
|
129
|
+
|
|
130
|
+
This beta adds class-name style chains, Tailwind presets, and compiler support
|
|
131
|
+
for transform-driven styling.
|
|
132
|
+
|
|
133
|
+
### Highlights
|
|
134
|
+
|
|
135
|
+
- Add `createClassNameFn` for class-name-driven style builders.
|
|
136
|
+
- Support nested class-name values, conditional falsy entries, weighted
|
|
137
|
+
class-name tokens, selector chaining, at-rules, and merges.
|
|
138
|
+
- Add compiler extraction for class-name style chains.
|
|
139
|
+
- Add Tailwind presets for both style-object and class-name authoring.
|
|
140
|
+
- Add `classNameTransform`, `classNameValue`, and transform metadata for
|
|
141
|
+
preserving source class labels in emitted rules.
|
|
142
|
+
- Add named token compiler support for static extraction and theme override
|
|
143
|
+
identity.
|
|
144
|
+
- Add configurable transform class-name formatting and hash length behavior for
|
|
145
|
+
debug output.
|
|
146
|
+
|
|
147
|
+
## 0.1.0-beta.1
|
|
148
|
+
|
|
149
|
+
This patch beta improves typed selector authoring and documentation.
|
|
150
|
+
|
|
151
|
+
### Changes
|
|
152
|
+
|
|
153
|
+
- Add `createSelectorAssert` for typed custom selector validators.
|
|
154
|
+
- Keep the public beta API moving with small usability refinements after
|
|
155
|
+
`0.1.0-beta.0`.
|
|
8
156
|
|
|
9
157
|
## 0.1.0-beta.0
|
|
10
158
|
|
package/README.md
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
# Fluentic Style
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build your own styling language on top of a stable component styling model.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Styling UI 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
|
-
|
|
9
|
-
|
|
10
|
-
With Fluentic, you start simple with type-safe `style(...)` and
|
|
11
|
-
prop
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
components the same way props, state, and themes do?
|
|
9
|
+
|
|
10
|
+
With Fluentic, you start simple with type-safe `style(...)` values and attach
|
|
11
|
+
them through a JSX `css` prop or a framework adapter. React, Preact, and SolidJS
|
|
12
|
+
are supported today, with the core style data model designed to keep expanding
|
|
13
|
+
across JSX runtimes, compiler-backed frameworks, and server-rendered UI stacks.
|
|
14
|
+
If your team prefers utility class names, you can also create class-name style
|
|
15
|
+
chains, including a Tailwind-like preset.
|
|
16
|
+
|
|
17
|
+
When a component needs variants, themes, nested parts, or consumer overrides,
|
|
18
|
+
add slots, scopes, tokens, values, and `combineStyle(...)` so those styles stay
|
|
19
|
+
organized around the component instead of leaking through class names or private
|
|
20
|
+
DOM structure. For production builds, Fluentic extracts static styles into
|
|
21
|
+
atomic CSS output while dynamic values from props, state, signals, or request
|
|
22
|
+
data still work at runtime.
|
|
17
23
|
|
|
18
24
|
[Docs](https://fluenticstack.com/style) |
|
|
19
|
-
[
|
|
25
|
+
[Start here](https://fluenticstack.com/style/docs/learn/start-here/) |
|
|
20
26
|
[Playground](https://fluenticstack.com/style/playground/) |
|
|
21
27
|
[npm](https://www.npmjs.com/package/@fluentic/style)
|
|
22
28
|
|
|
@@ -34,13 +40,35 @@ Or with pnpm:
|
|
|
34
40
|
pnpm add @fluentic/style@beta
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
Use Fluentic in a
|
|
38
|
-
extraction.
|
|
43
|
+
Use Fluentic in a JSX app. Add a bundler or framework plugin when you want
|
|
44
|
+
production extraction.
|
|
45
|
+
|
|
46
|
+
## What Fluentic Supports
|
|
47
|
+
|
|
48
|
+
Fluentic is not tied to one styling vocabulary or one framework runtime. The
|
|
49
|
+
same style model powers CSS-like objects, custom design-system fields,
|
|
50
|
+
Tailwind-like object fields, class-name chains, slots, scopes, themes, tokens,
|
|
51
|
+
runtime values, static extraction, and development traces.
|
|
52
|
+
|
|
53
|
+
| Area | Support |
|
|
54
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| Core styling model | [`style(...)`](https://fluenticstack.com/style/docs/reference/style/), [`style.slot(...)`](https://fluenticstack.com/style/docs/reference/style-slot/), [`style.scope(...)`](https://fluenticstack.com/style/docs/reference/style-scope/), [`combineStyle(...)`](https://fluenticstack.com/style/docs/reference/combine-style/), themes, tokens, values, selectors, at-rules, keyframes, and font faces. |
|
|
56
|
+
| Authoring vocabularies | CSS-like object styles, custom style functions, custom selectors, custom properties, Tailwind-like object fields, and Tailwind-like class-name chains. |
|
|
57
|
+
| Runtime paths | Runtime-only JSX setup for quick adoption, compiler-backed extracted runtime for production, and framework css-prop adapters that keep the framework's normal JSX transform. |
|
|
58
|
+
| Frameworks today | React, Next.js App Router, Preact, and SolidJS. |
|
|
59
|
+
| Bundlers today | Vite, Webpack, Rspack, Farm, Parcel 2, Babel/custom compiler use, and the Next.js integration for App Router projects. |
|
|
60
|
+
| Development tools | Readable debug class names, source traces, JSX element markers, sourcemaps, priority inspection, and React Server Component development support for Next.js. |
|
|
61
|
+
|
|
62
|
+
See the [integration overview](https://fluenticstack.com/style/docs/integrations/overview/)
|
|
63
|
+
for setup guides and the
|
|
64
|
+
[reference overview](https://fluenticstack.com/style/docs/reference/overview/)
|
|
65
|
+
for the API surface.
|
|
39
66
|
|
|
40
67
|
## Configure Runtime JSX
|
|
41
68
|
|
|
42
69
|
Enable the runtime JSX import source so DOM and SVG elements accept the `css`
|
|
43
|
-
prop. This path works without a Fluentic bundler plugin
|
|
70
|
+
prop. This path works without a Fluentic bundler plugin and is the quickest
|
|
71
|
+
React setup path.
|
|
44
72
|
|
|
45
73
|
```jsonc
|
|
46
74
|
/* tsconfig.json */
|
|
@@ -52,10 +80,14 @@ prop. This path works without a Fluentic bundler plugin.
|
|
|
52
80
|
}
|
|
53
81
|
```
|
|
54
82
|
|
|
83
|
+
For SolidJS and Preact, keep the framework's normal JSX configuration and use
|
|
84
|
+
the Vite css-prop adapter instead:
|
|
85
|
+
[SolidJS](https://fluenticstack.com/style/docs/integrations/solidjs/) and
|
|
86
|
+
[PreactJS](https://fluenticstack.com/style/docs/integrations/preact/).
|
|
87
|
+
|
|
55
88
|
## Why Another Style Library?
|
|
56
89
|
|
|
57
|
-
Component
|
|
58
|
-
need:
|
|
90
|
+
Component systems need more than a way to attach styles to elements. They need:
|
|
59
91
|
|
|
60
92
|
- base styles owned by the component;
|
|
61
93
|
- state styles for hover, focus, active, disabled, media, and container queries;
|
|
@@ -97,12 +129,60 @@ export function Card() {
|
|
|
97
129
|
}
|
|
98
130
|
```
|
|
99
131
|
|
|
100
|
-
That is the smallest version of Fluentic Style: type-safe styles, selectors,
|
|
101
|
-
a
|
|
132
|
+
That is the smallest version of Fluentic Style: type-safe styles, selectors,
|
|
133
|
+
and a component-owned style value attached to JSX. The example uses React-style
|
|
134
|
+
syntax, but the same style data can be lowered through framework adapters.
|
|
135
|
+
|
|
136
|
+
## Class Name Chains
|
|
137
|
+
|
|
138
|
+
Fluentic's default authoring path is object style chains, but class-name chains
|
|
139
|
+
are supported too. A class-name chain still produces Fluentic style data, so it
|
|
140
|
+
can use the same `css` prop, selector methods, slots, scopes, debugging, runtime
|
|
141
|
+
resolution, and production extraction path.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { createClassNameFn } from '@fluentic/style';
|
|
145
|
+
import {
|
|
146
|
+
createTailwindClassNamePreset,
|
|
147
|
+
defaultTailwindTheme,
|
|
148
|
+
} from '@fluentic/style/presets/tailwind';
|
|
149
|
+
|
|
150
|
+
const tailwind = createTailwindClassNamePreset({
|
|
151
|
+
theme: defaultTailwindTheme,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export const { className: cx } = createClassNameFn({
|
|
155
|
+
selectors: tailwind.selectors,
|
|
156
|
+
transform: tailwind.transform,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const button = cx(
|
|
160
|
+
'inline-flex',
|
|
161
|
+
'items-center',
|
|
162
|
+
'gap-2',
|
|
163
|
+
'rounded-md',
|
|
164
|
+
'bg-blue-600',
|
|
165
|
+
'px-4',
|
|
166
|
+
'py-2',
|
|
167
|
+
'text-white',
|
|
168
|
+
)
|
|
169
|
+
.hover('bg-blue-700')
|
|
170
|
+
.md('px-6');
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Class names get their meaning from a user-land transform or a preset. See
|
|
174
|
+
[Class Name Style Chains](https://fluenticstack.com/style/docs/beyond-the-basics/class-name-style-chains/)
|
|
175
|
+
for the generic API, or
|
|
176
|
+
[Tailwind Class Name Preset](https://fluenticstack.com/style/docs/presets/tailwind/class-name/)
|
|
177
|
+
for the built-in Tailwind-like class-name vocabulary.
|
|
102
178
|
|
|
103
179
|
## Scale Into Components
|
|
104
180
|
|
|
105
|
-
When a component becomes reusable, give its styles component structure.
|
|
181
|
+
When a component becomes reusable, give its styles component structure. This
|
|
182
|
+
section uses React component types for the example, but the important part is
|
|
183
|
+
the framework-independent style model: slots name public styling targets, scopes
|
|
184
|
+
describe changes to those targets, and the component decides where resolved
|
|
185
|
+
styles attach.
|
|
106
186
|
|
|
107
187
|
```tsx
|
|
108
188
|
/* tokens.ts */
|
|
@@ -285,15 +365,24 @@ priority with layers or sorted output.
|
|
|
285
365
|
|
|
286
366
|
## Add Production Extraction
|
|
287
367
|
|
|
288
|
-
Fluentic Style works without a compiler. In runtime mode, the JSX `css`
|
|
289
|
-
resolves class names and inserts atomic CSS rules as needed.
|
|
368
|
+
Fluentic Style works without a compiler. In runtime-only mode, the JSX `css`
|
|
369
|
+
prop resolves class names and inserts atomic CSS rules as needed. That is useful
|
|
370
|
+
for trying the API, custom environments, and incremental adoption.
|
|
371
|
+
|
|
372
|
+
For production builds, add a bundler or framework plugin. Static styles are
|
|
373
|
+
extracted into ordered atomic CSS output. Runtime composition stays available
|
|
374
|
+
for values that still depend on props, state, signals, request data, user input,
|
|
375
|
+
or incoming themes.
|
|
290
376
|
|
|
291
|
-
|
|
292
|
-
atomic CSS output. Dynamic values from props, state, or user input still work as
|
|
293
|
-
usual.
|
|
377
|
+
There are two integration shapes:
|
|
294
378
|
|
|
295
|
-
|
|
296
|
-
`@fluentic/style/jsx` to `@fluentic/style/plugin/jsx
|
|
379
|
+
- React apps can use Fluentic's JSX runtime import source, switching from
|
|
380
|
+
`@fluentic/style/jsx` to `@fluentic/style/plugin/jsx` after adding a plugin.
|
|
381
|
+
- React, Preact, and SolidJS can also use a compiler css-prop adapter, letting
|
|
382
|
+
the framework keep its normal JSX runtime while Fluentic compiles
|
|
383
|
+
`css={...}` before the framework JSX transform runs.
|
|
384
|
+
|
|
385
|
+
The React JSX-runtime setup looks like this:
|
|
297
386
|
|
|
298
387
|
```jsonc
|
|
299
388
|
/* tsconfig.json */
|
|
@@ -325,15 +414,57 @@ export default defineConfig({
|
|
|
325
414
|
development sourcemaps, and extracted CSS output. See
|
|
326
415
|
[Plugin Options](https://fluenticstack.com/style/docs/reference/plugin-options/).
|
|
327
416
|
|
|
328
|
-
|
|
329
|
-
|
|
417
|
+
The framework-adapter setup passes a css-prop preset to the plugin. This is the
|
|
418
|
+
normal path for SolidJS and Preact, and an optional path for React:
|
|
419
|
+
|
|
420
|
+
```ts
|
|
421
|
+
/* vite.config.ts */
|
|
422
|
+
import { CssPropPresets, plugin as stylePlugin } from '@fluentic/style/plugin/vite';
|
|
423
|
+
import { defineConfig } from 'vite';
|
|
424
|
+
|
|
425
|
+
export default defineConfig({
|
|
426
|
+
plugins: [
|
|
427
|
+
stylePlugin({
|
|
428
|
+
cssProp: CssPropPresets.Solid,
|
|
429
|
+
}),
|
|
430
|
+
// then the framework JSX plugin, such as vite-plugin-solid
|
|
431
|
+
],
|
|
432
|
+
});
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
For framework and bundler-specific setup, see:
|
|
436
|
+
|
|
437
|
+
| Environment | Guide |
|
|
438
|
+
| -------------------------- | ----------------------------------------------------------------------------------------- |
|
|
439
|
+
| Next.js App Router | [Next.js](https://fluenticstack.com/style/docs/integrations/nextjs/) |
|
|
440
|
+
| Vite + React | [Vite](https://fluenticstack.com/style/docs/integrations/vite/) |
|
|
441
|
+
| Vite + SolidJS | [SolidJS](https://fluenticstack.com/style/docs/integrations/solidjs/) |
|
|
442
|
+
| Vite + Preact | [PreactJS](https://fluenticstack.com/style/docs/integrations/preact/) |
|
|
443
|
+
| Webpack | [Webpack](https://fluenticstack.com/style/docs/integrations/webpack/) |
|
|
444
|
+
| Rspack | [Rspack](https://fluenticstack.com/style/docs/integrations/rspack/) |
|
|
445
|
+
| Farm | [Farm](https://fluenticstack.com/style/docs/integrations/farm/) |
|
|
446
|
+
| Parcel 2 | [Parcel](https://fluenticstack.com/style/docs/integrations/parcel/) |
|
|
447
|
+
| Runtime-only | [Runtime-Only Mode](https://fluenticstack.com/style/docs/integrations/runtime-only-mode/) |
|
|
448
|
+
| Custom compiler or bundler | [Custom Compiler](https://fluenticstack.com/style/docs/integrations/custom-compiler/) |
|
|
330
449
|
|
|
331
450
|
## Benchmarks
|
|
332
451
|
|
|
333
452
|
Benchmarks live in the repository's `benchmark/` folder and run against
|
|
334
453
|
production builds. Current benchmark snapshots:
|
|
335
454
|
|
|
336
|
-
|
|
455
|
+
The main production checks are runtime cost and bundle size. In the production
|
|
456
|
+
path most apps use, Fluentic extracts CSS at build time and ships the extracted
|
|
457
|
+
production runtime for `css` prop composition, dynamic values, class-name
|
|
458
|
+
merging, and token resolution. That runtime entry currently reports `4.92 KB`
|
|
459
|
+
min+gzip.
|
|
460
|
+
Browser and SSR benchmarks track whether style resolution stays fast in
|
|
461
|
+
app-shaped renders. See the
|
|
462
|
+
[Bundle Size](https://fluenticstack.com/style/docs/benchmark/bundle-size/),
|
|
463
|
+
[React App](https://fluenticstack.com/style/docs/benchmark/react-app/), and
|
|
464
|
+
[SSR Style](https://fluenticstack.com/style/docs/benchmark/ssr-style/) reports
|
|
465
|
+
for what each number measures and how to rerun it.
|
|
466
|
+
|
|
467
|
+
[React app](https://fluenticstack.com/style/docs/benchmark/react-app/), 1500-row dashboard:
|
|
337
468
|
|
|
338
469
|
| Case | Mount | Style Update |
|
|
339
470
|
| -------------------------- | ---------- | ------------ |
|
|
@@ -347,7 +478,7 @@ React app, 1500-row dashboard:
|
|
|
347
478
|
| vanilla-extract DOM | `39.85 ms` | `17.65 ms` |
|
|
348
479
|
| CSS Modules DOM | `40.35 ms` | `17.75 ms` |
|
|
349
480
|
|
|
350
|
-
SSR render-only, 500 rows:
|
|
481
|
+
[SSR render-only](https://fluenticstack.com/style/docs/benchmark/ssr-style/), 500 rows:
|
|
351
482
|
|
|
352
483
|
| Case | Dashboard Mean | Composition Mean |
|
|
353
484
|
| --------------- | -------------- | ---------------- |
|
|
@@ -357,7 +488,7 @@ SSR render-only, 500 rows:
|
|
|
357
488
|
| Fluentic token | `7.667 ms` | `8.253 ms` |
|
|
358
489
|
| StyleX | `6.826 ms` | `8.059 ms` |
|
|
359
490
|
|
|
360
|
-
Compiler transform, 100 files per corpus:
|
|
491
|
+
[Compiler transform](https://fluenticstack.com/style/docs/benchmark/compiler/), 100 files per corpus:
|
|
361
492
|
|
|
362
493
|
| Corpus | Fluentic Warm | StyleX Babel |
|
|
363
494
|
| ------------- | ------------- | ------------ |
|
|
@@ -371,23 +502,24 @@ and the public suite list.
|
|
|
371
502
|
|
|
372
503
|
## Package Exports
|
|
373
504
|
|
|
374
|
-
| Import
|
|
375
|
-
|
|
|
376
|
-
| `@fluentic/style`
|
|
377
|
-
| `@fluentic/style/css`
|
|
378
|
-
| `@fluentic/style/selector`
|
|
379
|
-
| `@fluentic/style/config`
|
|
380
|
-
| `@fluentic/style/compiler`
|
|
381
|
-
| `@fluentic/style/
|
|
382
|
-
| `@fluentic/style/dev
|
|
383
|
-
| `@fluentic/style/
|
|
384
|
-
| `@fluentic/style/
|
|
385
|
-
| `@fluentic/style/plugin/
|
|
386
|
-
| `@fluentic/style/plugin/
|
|
387
|
-
| `@fluentic/style/plugin/
|
|
388
|
-
| `@fluentic/style/plugin/
|
|
389
|
-
| `@fluentic/style/plugin/
|
|
390
|
-
| `@fluentic/style/plugin/
|
|
505
|
+
| Import | Purpose |
|
|
506
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
507
|
+
| `@fluentic/style` | Runtime API, style builders, hooks, tokens, themes, and types. |
|
|
508
|
+
| `@fluentic/style/css` | CSS helper APIs for keyframes, font faces, and at-rules. |
|
|
509
|
+
| `@fluentic/style/selector` | Selector constructors, validators, presets, and priority helpers. |
|
|
510
|
+
| `@fluentic/style/config` | Runtime configuration helpers. |
|
|
511
|
+
| `@fluentic/style/compiler` | Node-only compiler entry used by build integrations and compiler benchmarks. |
|
|
512
|
+
| `@fluentic/style/presets/tailwind` | [Tailwind-like object fields and class-name chains](https://fluenticstack.com/style/docs/presets/tailwind/). |
|
|
513
|
+
| `@fluentic/style/dev` | Development utilities. |
|
|
514
|
+
| `@fluentic/style/dev/rsc` | React Server Component dev client boundary. |
|
|
515
|
+
| `@fluentic/style/jsx` | [JSX import source without a bundler plugin](https://fluenticstack.com/style/docs/integrations/runtime-only-mode/). |
|
|
516
|
+
| `@fluentic/style/plugin/jsx` | [JSX import source after adding a bundler plugin](https://fluenticstack.com/style/docs/integrations/jsx-runtime-setup/). |
|
|
517
|
+
| `@fluentic/style/plugin/nextjs` | [Next.js App Router integration](https://fluenticstack.com/style/docs/integrations/nextjs/). |
|
|
518
|
+
| `@fluentic/style/plugin/vite` | [Vite plugin](https://fluenticstack.com/style/docs/integrations/vite/). |
|
|
519
|
+
| `@fluentic/style/plugin/webpack` | [Webpack plugin](https://fluenticstack.com/style/docs/integrations/webpack/). |
|
|
520
|
+
| `@fluentic/style/plugin/rspack` | [Rspack plugin](https://fluenticstack.com/style/docs/integrations/rspack/). |
|
|
521
|
+
| `@fluentic/style/plugin/farm` | [Farm plugin](https://fluenticstack.com/style/docs/integrations/farm/). |
|
|
522
|
+
| `@fluentic/style/plugin/parcel` | [Parcel plugin](https://fluenticstack.com/style/docs/integrations/parcel/). |
|
|
391
523
|
|
|
392
524
|
## Repository Guide
|
|
393
525
|
|
package/atomic/atRule/utils.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { CSS_CONFIG } from '../../config/config/css';
|
|
1
2
|
import { type NamedAtRuleFormat, type NamedAtRuleInfo, type TokenNameFormat } from '../../config/types';
|
|
2
3
|
import { getStyleTokenId, isStyleTokenData, type StyleTokenData } from '../../style/token';
|
|
3
4
|
import { getCssPropertyName } from '../property';
|
|
4
5
|
import { getTokenVar } from '../token';
|
|
5
|
-
import { getIdentifierSafeHash } from '../utils/css';
|
|
6
6
|
import { createNameFormatter } from '../utils/format';
|
|
7
|
+
import { getIdentifierSafeHash } from '../utils/hash';
|
|
7
8
|
import { getCssPropertyValue } from '../value';
|
|
8
9
|
|
|
9
10
|
export function createAtRuleNameFormatter(defaultFormat: NamedAtRuleFormat, prefix?: string) {
|
|
@@ -14,7 +15,7 @@ export function createAtRuleNameFormatter(defaultFormat: NamedAtRuleFormat, pref
|
|
|
14
15
|
id: string,
|
|
15
16
|
info: NamedAtRuleInfo,
|
|
16
17
|
) => {
|
|
17
|
-
const hash = getIdentifierSafeHash(id);
|
|
18
|
+
const hash = getIdentifierSafeHash(id, CSS_CONFIG.hashLength);
|
|
18
19
|
const name = formatter(format || defaultFormat, hash, info);
|
|
19
20
|
|
|
20
21
|
if (!prefix) return name;
|
package/atomic/className.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { BuilderCallsite, ItemSelector } from '../builder/data';
|
|
2
|
-
import
|
|
2
|
+
import { CSS_CONFIG } from '../config/config/css';
|
|
3
|
+
import { DEV_CONFIG } from '../config/config/dev';
|
|
4
|
+
import type { ClassNameFormat, TransformClassNameFormat } from '../config/types';
|
|
3
5
|
import { hashString } from '../utils/hash';
|
|
4
|
-
import { getDebugClassName,
|
|
6
|
+
import { getDebugClassName, getDebugSheetClassName, getDebugTransformClassName } from './debug/className';
|
|
5
7
|
import { getDebugPropertyName } from './debug/property';
|
|
6
8
|
import { getDebugAtRuleName, getDebugSelectorName } from './debug/selector';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
+
export { getScopeClassName } from './scope';
|
|
10
|
+
import { getIdentifierSafeHash } from './utils/hash';
|
|
11
|
+
import { getSelectorHash, getSelectorText, hasSheetSelectorAnchor } from './utils/selector';
|
|
9
12
|
|
|
10
13
|
export function getAtomicClassName(
|
|
11
14
|
property: string,
|
|
12
15
|
priority: number | null,
|
|
16
|
+
important: boolean,
|
|
13
17
|
value: string,
|
|
14
18
|
selector: ItemSelector | null,
|
|
15
19
|
parentSelector: ItemSelector | null,
|
|
@@ -18,24 +22,41 @@ export function getAtomicClassName(
|
|
|
18
22
|
localClassName: boolean,
|
|
19
23
|
debugClassName: boolean,
|
|
20
24
|
classNameFormat: ClassNameFormat | null,
|
|
25
|
+
transformClassName: string | null,
|
|
26
|
+
transformClassNameFormat: TransformClassNameFormat | null,
|
|
27
|
+
sheetClassNameFormat: ClassNameFormat | null = null,
|
|
28
|
+
hashLength: number | null = null,
|
|
21
29
|
) {
|
|
22
30
|
let hash = property;
|
|
23
31
|
|
|
24
32
|
hash += '\n' + (priority || '');
|
|
33
|
+
if (important) hash += '\nimportant';
|
|
25
34
|
hash += '\n' + value;
|
|
26
35
|
hash += '\n' + (selector ? getSelectorHash(selector) : '');
|
|
27
36
|
hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
|
|
28
37
|
hash += '\n' + (atRule ? atRule.map(getSelectorHash).join('\n') : '');
|
|
29
38
|
hash += '\n' + getCallsiteHash(callsite, localClassName);
|
|
30
39
|
|
|
31
|
-
hash = getIdentifierSafeHash(
|
|
40
|
+
hash = getIdentifierSafeHash(
|
|
41
|
+
hash,
|
|
42
|
+
hashLength ?? getRuntimeClassNameHashLength(debugClassName),
|
|
43
|
+
);
|
|
32
44
|
|
|
33
45
|
if (!debugClassName) return hash;
|
|
34
46
|
|
|
47
|
+
if (transformClassName) {
|
|
48
|
+
return getDebugTransformClassName(
|
|
49
|
+
transformClassNameFormat,
|
|
50
|
+
hash,
|
|
51
|
+
{ className: transformClassName },
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
const propertyName = getDebugPropertyName(property, value);
|
|
36
56
|
|
|
37
|
-
const
|
|
38
|
-
|
|
57
|
+
const isSheetClassName = hasSheetSelectorAnchor(selector);
|
|
58
|
+
const className = (isSheetClassName ? getDebugSheetClassName : getDebugClassName)(
|
|
59
|
+
isSheetClassName ? sheetClassNameFormat : classNameFormat,
|
|
39
60
|
hash,
|
|
40
61
|
{
|
|
41
62
|
atRule: atRule
|
|
@@ -59,16 +80,32 @@ export function getAtomicClassName(
|
|
|
59
80
|
return className;
|
|
60
81
|
}
|
|
61
82
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
function getRuntimeClassNameHashLength(debugClassName: boolean) {
|
|
84
|
+
return getClassNameHashLength({
|
|
85
|
+
debugClassName,
|
|
86
|
+
isDev: DEV_CONFIG.isDev,
|
|
87
|
+
devHashLength: DEV_CONFIG.hashLength,
|
|
88
|
+
cssHashLength: CSS_CONFIG.hashLength,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getClassNameHashLength(options: {
|
|
93
|
+
debugClassName: boolean;
|
|
94
|
+
isDev: boolean;
|
|
95
|
+
devHashLength?: number | null;
|
|
96
|
+
cssHashLength?: number | null;
|
|
97
|
+
}) {
|
|
98
|
+
if (options.debugClassName && options.isDev) {
|
|
99
|
+
return options.devHashLength ?? options.cssHashLength ?? 5;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return options.cssHashLength ?? 7;
|
|
67
103
|
}
|
|
68
104
|
|
|
69
105
|
export function getClassNameDedupe(
|
|
70
106
|
property: string,
|
|
71
107
|
priority: number | null,
|
|
108
|
+
important: boolean,
|
|
72
109
|
selector: ItemSelector | null,
|
|
73
110
|
parentSelector: ItemSelector | null,
|
|
74
111
|
atRule: ItemSelector[] | null,
|
|
@@ -76,6 +113,7 @@ export function getClassNameDedupe(
|
|
|
76
113
|
let hash = property;
|
|
77
114
|
|
|
78
115
|
hash += '\n' + (priority || '');
|
|
116
|
+
if (important) hash += '\nimportant';
|
|
79
117
|
hash += '\n' + (selector ? getSelectorHash(selector) : '');
|
|
80
118
|
hash += '\n' + (parentSelector ? getSelectorHash(parentSelector) : '');
|
|
81
119
|
hash += '\n' + (atRule ? atRule.map(getSelectorHash).join('\n') : '');
|