@fluentic/style 0.1.0-beta.0 → 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 +154 -0
- 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 +173 -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-DweanHoB.mjs → compiler-C3CEGGtI.mjs} +2349 -647
- 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 +634 -713
- 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-DS61nRqr.mjs → loader-_-VjzlrX.mjs} +13 -14
- package/dist/loader-_-VjzlrX.mjs.map +1 -0
- package/dist/{misc-B9kqEb2N.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/presets-DSanixJV.js +243 -0
- package/dist/presets-DSanixJV.js.map +1 -0
- package/dist/{registry-CyIj8LYK.mjs → registry-w8ET5R7v.mjs} +2 -2
- package/dist/{registry-CyIj8LYK.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 +2 -3
- package/dist/server.js +17 -11
- package/dist/server.js.map +1 -1
- package/dist/{shared-CCpq1zqA.mjs → shared-C_cYxNzz.mjs} +4 -4
- package/dist/{shared-CCpq1zqA.mjs.map → shared-C_cYxNzz.mjs.map} +1 -1
- package/dist/{shared-BAL9peIw.cjs → shared-PK52rW6T.cjs} +2352 -644
- 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-4u6GnlQG.mjs → sidecar-BhvmXYsD.mjs} +3 -3
- package/dist/{sidecar-4u6GnlQG.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-DMFgOOtA.mjs → utils-DND33M6y.mjs} +3 -3
- package/dist/{utils-DMFgOOtA.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-CxS2FDYU.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 +118 -18
- 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 +12 -7
- 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/selector/assert.ts +24 -25
- package/selector/selector.ts +6 -0
- 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-h_Zkqc4E.js +0 -105
- package/dist/assert-h_Zkqc4E.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-DweanHoB.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-_te7t0M4.js +0 -473
- package/dist/data-_te7t0M4.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-DS61nRqr.mjs.map +0 -1
- package/dist/misc-B9kqEb2N.mjs.map +0 -1
- package/dist/presets-Bye3ea2x.js +0 -139
- package/dist/presets-Bye3ea2x.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-BAL9peIw.cjs.map +0 -1
- package/dist/style-4rFUy-zW.js +0 -752
- package/dist/style-4rFUy-zW.js.map +0 -1
- package/dist/style-B1UUqjj5.js +0 -743
- package/dist/style-B1UUqjj5.js.map +0 -1
- package/dist/style-Cw3NtvR0.js +0 -5
- package/dist/style-DNqQ6H-7.js +0 -1255
- package/dist/style-DNqQ6H-7.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-C7xfDxtM.mjs +0 -97
- package/dist/utils-C7xfDxtM.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-CxS2FDYU.mjs.map +0 -1
- package/dist/withTokens-LRidu3Vc.js +0 -95
- package/dist/withTokens-LRidu3Vc.js.map +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { getNamedToken } from '../../../dialect';
|
|
2
|
+
import { classNameTransform } from '../../../style/transform';
|
|
3
|
+
import type { CSSProperties } from '../../../style/types';
|
|
4
|
+
import { TailwindSelectors } from '../selectors';
|
|
5
|
+
import { createTailwindExtendedStyleTransform, createTailwindStyleConfig } from '../style';
|
|
6
|
+
import type { TailwindScale, TailwindStyleConfig, TailwindTheme } from '../types';
|
|
7
|
+
import type { TailwindClassName, TailwindClassNameFor } from './types';
|
|
8
|
+
|
|
9
|
+
export function createTailwindClassNamePreset<const Theme extends TailwindTheme>(
|
|
10
|
+
config: TailwindStyleConfig<Theme>,
|
|
11
|
+
): {
|
|
12
|
+
selectors: typeof TailwindSelectors;
|
|
13
|
+
transform: ReturnType<typeof createTailwindClassNameTransform<Theme>>;
|
|
14
|
+
} {
|
|
15
|
+
return {
|
|
16
|
+
selectors: TailwindSelectors,
|
|
17
|
+
transform: createTailwindClassNameTransform(config),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createTailwindClassNameTransform<const Theme extends TailwindTheme = TailwindTheme>(
|
|
22
|
+
config: TailwindStyleConfig<Theme> = createTailwindStyleConfig({}),
|
|
23
|
+
) {
|
|
24
|
+
const objectTransform = createTailwindExtendedStyleTransform(config);
|
|
25
|
+
|
|
26
|
+
return classNameTransform<TailwindClassNameFor<Theme>>({
|
|
27
|
+
transform(className) {
|
|
28
|
+
return objectTransform.transform(classNameToStyle(className as TailwindClassName, config.theme) as any);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function classNameToStyle(className: TailwindClassName, theme: TailwindTheme): Record<string, unknown> {
|
|
34
|
+
const arbitrary = parseArbitraryClassName(className);
|
|
35
|
+
if (arbitrary) return arbitrary;
|
|
36
|
+
|
|
37
|
+
switch (className) {
|
|
38
|
+
case 'block':
|
|
39
|
+
case 'inline-block':
|
|
40
|
+
case 'inline-flex':
|
|
41
|
+
case 'flex':
|
|
42
|
+
case 'grid':
|
|
43
|
+
case 'hidden':
|
|
44
|
+
case 'relative':
|
|
45
|
+
case 'absolute':
|
|
46
|
+
case 'fixed':
|
|
47
|
+
case 'sticky':
|
|
48
|
+
return { [toCamelCase(className)]: true };
|
|
49
|
+
case 'items-start':
|
|
50
|
+
return { items: 'start' };
|
|
51
|
+
case 'items-end':
|
|
52
|
+
return { items: 'end' };
|
|
53
|
+
case 'items-center':
|
|
54
|
+
return { items: 'center' };
|
|
55
|
+
case 'items-baseline':
|
|
56
|
+
return { items: 'baseline' };
|
|
57
|
+
case 'items-stretch':
|
|
58
|
+
return { items: 'stretch' };
|
|
59
|
+
case 'justify-start':
|
|
60
|
+
return { justify: 'start' };
|
|
61
|
+
case 'justify-end':
|
|
62
|
+
return { justify: 'end' };
|
|
63
|
+
case 'justify-center':
|
|
64
|
+
return { justify: 'center' };
|
|
65
|
+
case 'justify-between':
|
|
66
|
+
return { justify: 'between' };
|
|
67
|
+
case 'justify-around':
|
|
68
|
+
return { justify: 'around' };
|
|
69
|
+
case 'justify-evenly':
|
|
70
|
+
return { justify: 'evenly' };
|
|
71
|
+
case 'flex-row':
|
|
72
|
+
return { direction: 'row' };
|
|
73
|
+
case 'flex-row-reverse':
|
|
74
|
+
return { direction: 'rowReverse' };
|
|
75
|
+
case 'flex-col':
|
|
76
|
+
return { direction: 'col' };
|
|
77
|
+
case 'flex-col-reverse':
|
|
78
|
+
return { direction: 'colReverse' };
|
|
79
|
+
case 'flex-wrap':
|
|
80
|
+
return { wrap: true };
|
|
81
|
+
case 'flex-wrap-reverse':
|
|
82
|
+
return { wrap: 'reverse' };
|
|
83
|
+
case 'shrink-0':
|
|
84
|
+
return { flexShrink: 0 };
|
|
85
|
+
case 'overflow-hidden':
|
|
86
|
+
return { overflow: 'hidden' };
|
|
87
|
+
case 'overflow-auto':
|
|
88
|
+
return { overflow: 'auto' };
|
|
89
|
+
case 'overflow-x-hidden':
|
|
90
|
+
return { overflowX: 'hidden' };
|
|
91
|
+
case 'overflow-x-auto':
|
|
92
|
+
return { overflowX: 'auto' };
|
|
93
|
+
case 'overflow-y-hidden':
|
|
94
|
+
return { overflowY: 'hidden' };
|
|
95
|
+
case 'overflow-y-auto':
|
|
96
|
+
return { overflowY: 'auto' };
|
|
97
|
+
case 'cursor-pointer':
|
|
98
|
+
return { cursor: 'pointer' };
|
|
99
|
+
case 'outline-none':
|
|
100
|
+
return { outline: 'none' };
|
|
101
|
+
case 'whitespace-nowrap':
|
|
102
|
+
return { whiteSpace: 'nowrap' };
|
|
103
|
+
case 'min-w-0':
|
|
104
|
+
return { minW: 0 };
|
|
105
|
+
case 'justify-self-end':
|
|
106
|
+
return { justifySelf: 'end' };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (className.startsWith('gap-x-')) return { gapX: ref(className, 'gap-x-', theme.spacing) };
|
|
110
|
+
if (className.startsWith('gap-y-')) return { gapY: ref(className, 'gap-y-', theme.spacing) };
|
|
111
|
+
if (className.startsWith('gap-')) return { gap: ref(className, 'gap-', theme.spacing) };
|
|
112
|
+
if (className.startsWith('mt-')) return { mt: ref(className, 'mt-', theme.spacing) };
|
|
113
|
+
if (className.startsWith('mx-')) return { mx: ref(className, 'mx-', theme.spacing) };
|
|
114
|
+
if (className.startsWith('my-')) return { my: ref(className, 'my-', theme.spacing) };
|
|
115
|
+
if (className.startsWith('m-')) return { m: ref(className, 'm-', theme.spacing) };
|
|
116
|
+
if (className.startsWith('px-')) return { px: ref(className, 'px-', theme.spacing) };
|
|
117
|
+
if (className.startsWith('py-')) return { py: ref(className, 'py-', theme.spacing) };
|
|
118
|
+
if (className.startsWith('pt-')) return { pt: ref(className, 'pt-', theme.spacing) };
|
|
119
|
+
if (className.startsWith('pr-')) return { pr: ref(className, 'pr-', theme.spacing) };
|
|
120
|
+
if (className.startsWith('pb-')) return { pb: ref(className, 'pb-', theme.spacing) };
|
|
121
|
+
if (className.startsWith('pl-')) return { pl: ref(className, 'pl-', theme.spacing) };
|
|
122
|
+
if (className.startsWith('p-')) return { p: ref(className, 'p-', theme.spacing) };
|
|
123
|
+
if (className.startsWith('max-w-')) return { maxW: ref(className, 'max-w-', [theme.sizes, theme.spacing]) };
|
|
124
|
+
if (className.startsWith('min-w-')) return { minW: ref(className, 'min-w-', [theme.sizes, theme.spacing]) };
|
|
125
|
+
if (className.startsWith('min-h-')) return { minH: ref(className, 'min-h-', [theme.sizes, theme.spacing]) };
|
|
126
|
+
if (className.startsWith('size-')) return { size: ref(className, 'size-', [theme.sizes, theme.spacing]) };
|
|
127
|
+
if (className.startsWith('w-')) return { w: ref(className, 'w-', [theme.sizes, theme.spacing]) };
|
|
128
|
+
if (className.startsWith('h-')) return { h: ref(className, 'h-', [theme.sizes, theme.spacing]) };
|
|
129
|
+
if (className.startsWith('bg-')) return { bg: ref(className, 'bg-', theme.colors) };
|
|
130
|
+
if (className.startsWith('text-')) return textStyle(className.slice('text-'.length), theme);
|
|
131
|
+
if (className.startsWith('font-')) return { font: ref(className, 'font-', theme.fontWeights) };
|
|
132
|
+
if (className.startsWith('leading-')) return { leading: ref(className, 'leading-', theme.lineHeights) };
|
|
133
|
+
if (className.startsWith('rounded-')) return { rounded: ref(className, 'rounded-', theme.radii) };
|
|
134
|
+
if (className.startsWith('shadow-')) return { shadow: ref(className, 'shadow-', theme.shadows) };
|
|
135
|
+
if (className.startsWith('border-')) return borderStyle(className.slice('border-'.length), theme);
|
|
136
|
+
if (className.startsWith('outline-')) return { outlineColor: ref(className, 'outline-', theme.colors) };
|
|
137
|
+
|
|
138
|
+
return {};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function ref(className: string, prefix: string, scale?: TailwindScale | (TailwindScale | undefined)[]) {
|
|
142
|
+
const value = className.slice(prefix.length);
|
|
143
|
+
if (value.startsWith('[') && value.endsWith(']')) return value.slice(1, -1).replace(/_/g, ' ');
|
|
144
|
+
if (value === 'auto') return value;
|
|
145
|
+
return scaleRef(value, scale);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function borderStyle(value: string, theme: TailwindTheme): Record<string, unknown> {
|
|
149
|
+
if (value.startsWith('[') && value.endsWith(']')) return { border: value.slice(1, -1).replace(/_/g, ' ') };
|
|
150
|
+
if (/^\d/.test(value)) return { border: value.replace(/_/g, ' ') };
|
|
151
|
+
return { borderColor: scaleRef(value, theme.colors) };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function textStyle(value: string, theme: TailwindTheme): Record<string, unknown> {
|
|
155
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
156
|
+
const arbitrary = value.slice(1, -1).replace(/_/g, ' ');
|
|
157
|
+
const hinted = parseArbitraryTextHint(arbitrary);
|
|
158
|
+
|
|
159
|
+
if (hinted) return hinted;
|
|
160
|
+
if (isLikelyFontSize(arbitrary)) return { textSize: arbitrary };
|
|
161
|
+
|
|
162
|
+
return { text: arbitrary };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return { text: scaleRef(value, [theme.fontSizes, theme.colors]) };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function parseArbitraryTextHint(value: string): Record<string, unknown> | null {
|
|
169
|
+
const splitAt = value.indexOf(':');
|
|
170
|
+
if (splitAt < 1) return null;
|
|
171
|
+
|
|
172
|
+
const hint = value.slice(0, splitAt);
|
|
173
|
+
const textValue = value.slice(splitAt + 1);
|
|
174
|
+
|
|
175
|
+
if (hint === 'length' || hint === 'size') return { textSize: textValue };
|
|
176
|
+
if (hint === 'color') return { text: textValue };
|
|
177
|
+
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function isLikelyFontSize(value: string) {
|
|
182
|
+
return /^(?:-?\d*\.?\d+(?:px|r?em|lh|vh|vw|vmin|vmax|%|ch|ex|cap|ic)|(?:calc|clamp|min|max)\()/.test(value);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function scaleRef(value: string, scale?: TailwindScale | (TailwindScale | undefined)[]) {
|
|
186
|
+
const scales = Array.isArray(scale) ? scale : [scale];
|
|
187
|
+
const path = value.replace(/-/g, '.');
|
|
188
|
+
const camelPath = toCamelCase(value);
|
|
189
|
+
const candidates = value === path
|
|
190
|
+
? value === camelPath ? [value] : [value, camelPath]
|
|
191
|
+
: camelPath === value
|
|
192
|
+
? [value, path]
|
|
193
|
+
: [value, path, camelPath];
|
|
194
|
+
|
|
195
|
+
for (let candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) {
|
|
196
|
+
const candidate = candidates[candidateIndex];
|
|
197
|
+
for (let scaleIndex = 0; scaleIndex < scales.length; scaleIndex++) {
|
|
198
|
+
const item = scales[scaleIndex];
|
|
199
|
+
if (item && hasScalePath(item, candidate)) return `$${candidate}`;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return `$${path}`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function hasScalePath(scale: TailwindScale, path: string) {
|
|
207
|
+
if (path in scale) return true;
|
|
208
|
+
if (getNamedToken(scale, `$${path}`)) return true;
|
|
209
|
+
|
|
210
|
+
const parts = path.split('.');
|
|
211
|
+
let current: unknown = scale;
|
|
212
|
+
|
|
213
|
+
for (let i = 0; i < parts.length; i++) {
|
|
214
|
+
if (!current || typeof current !== 'object') return false;
|
|
215
|
+
if (!(parts[i] in current)) return false;
|
|
216
|
+
current = (current as Record<string, unknown>)[parts[i]];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function parseArbitraryClassName(className: string): CSSProperties | null {
|
|
223
|
+
if (!className.startsWith('[') || !className.endsWith(']')) return null;
|
|
224
|
+
|
|
225
|
+
const body = className.slice(1, -1);
|
|
226
|
+
const splitAt = body.indexOf(':');
|
|
227
|
+
if (splitAt < 1) return null;
|
|
228
|
+
|
|
229
|
+
const property = toCamelCase(body.slice(0, splitAt));
|
|
230
|
+
const value = body.slice(splitAt + 1).replace(/_/g, ' ');
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
[property]: value,
|
|
234
|
+
} as CSSProperties;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function toCamelCase(value: string) {
|
|
238
|
+
return value.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());
|
|
239
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { TOKEN_ID } from '../../../style/token';
|
|
2
|
+
import type { TailwindTheme } from '../types';
|
|
3
|
+
|
|
4
|
+
type ScaleKey = string | number;
|
|
5
|
+
type ScaleLeaf = ((...args: any[]) => unknown) | { readonly [TOKEN_ID]: string; };
|
|
6
|
+
type KebabCaseRest<Value extends string> = Value extends `${infer Head}${infer Tail}`
|
|
7
|
+
? Head extends Lowercase<Head> ? `${Head}${KebabCaseRest<Tail>}` : `-${Lowercase<Head>}${KebabCaseRest<Tail>}`
|
|
8
|
+
: Value;
|
|
9
|
+
type KebabCase<Value extends string> = Value extends `${infer Head}${infer Tail}`
|
|
10
|
+
? `${Lowercase<Head>}${KebabCaseRest<Tail>}`
|
|
11
|
+
: Value;
|
|
12
|
+
type ScaleClassKey<Key extends ScaleKey> = Key extends string ? KebabCase<Key> : `${Key}`;
|
|
13
|
+
type KnownScaleKeys<Scale> = keyof NonNullable<Scale> extends infer Key
|
|
14
|
+
? Key extends ScaleKey ? string extends Key ? never
|
|
15
|
+
: number extends Key ? never
|
|
16
|
+
: Key
|
|
17
|
+
: never
|
|
18
|
+
: never;
|
|
19
|
+
type ScaleClassPath<Scale> = Scale extends unknown ? NonNullable<Scale> extends infer ResolvedScale ? {
|
|
20
|
+
[Key in Extract<KnownScaleKeys<ResolvedScale>, ScaleKey>]: ResolvedScale[Key] extends ScaleLeaf
|
|
21
|
+
? ScaleClassKey<Key>
|
|
22
|
+
: ResolvedScale[Key] extends Record<ScaleKey, unknown>
|
|
23
|
+
? `${ScaleClassKey<Key>}-${Extract<ScaleClassPath<ResolvedScale[Key]>, string>}`
|
|
24
|
+
: ScaleClassKey<Key>;
|
|
25
|
+
}[Extract<KnownScaleKeys<ResolvedScale>, ScaleKey>]
|
|
26
|
+
: never
|
|
27
|
+
: never;
|
|
28
|
+
type ScaleValue<Scale> = ScaleClassPath<Scale>;
|
|
29
|
+
type ArbitraryValue = `[${string}]`;
|
|
30
|
+
type ColorLiteral = 'transparent' | 'current' | 'black' | 'white';
|
|
31
|
+
type LengthLiteral = 'auto' | 'full' | 'screen' | 'min' | 'max' | 'fit' | '0';
|
|
32
|
+
type ArbitraryClassName = `[${string}:${string}]`;
|
|
33
|
+
|
|
34
|
+
type TailwindStaticClassName =
|
|
35
|
+
| 'block'
|
|
36
|
+
| 'inline-block'
|
|
37
|
+
| 'inline-flex'
|
|
38
|
+
| 'flex'
|
|
39
|
+
| 'grid'
|
|
40
|
+
| 'hidden'
|
|
41
|
+
| 'relative'
|
|
42
|
+
| 'absolute'
|
|
43
|
+
| 'fixed'
|
|
44
|
+
| 'sticky'
|
|
45
|
+
| 'items-start'
|
|
46
|
+
| 'items-end'
|
|
47
|
+
| 'items-center'
|
|
48
|
+
| 'items-baseline'
|
|
49
|
+
| 'items-stretch'
|
|
50
|
+
| 'justify-start'
|
|
51
|
+
| 'justify-end'
|
|
52
|
+
| 'justify-center'
|
|
53
|
+
| 'justify-between'
|
|
54
|
+
| 'justify-around'
|
|
55
|
+
| 'justify-evenly'
|
|
56
|
+
| 'flex-row'
|
|
57
|
+
| 'flex-row-reverse'
|
|
58
|
+
| 'flex-col'
|
|
59
|
+
| 'flex-col-reverse'
|
|
60
|
+
| 'flex-wrap'
|
|
61
|
+
| 'flex-wrap-reverse'
|
|
62
|
+
| 'shrink-0'
|
|
63
|
+
| 'overflow-hidden'
|
|
64
|
+
| 'overflow-auto'
|
|
65
|
+
| 'overflow-x-hidden'
|
|
66
|
+
| 'overflow-x-auto'
|
|
67
|
+
| 'overflow-y-hidden'
|
|
68
|
+
| 'overflow-y-auto'
|
|
69
|
+
| 'cursor-pointer'
|
|
70
|
+
| 'outline-none'
|
|
71
|
+
| 'whitespace-nowrap'
|
|
72
|
+
| 'min-w-0'
|
|
73
|
+
| 'justify-self-end';
|
|
74
|
+
|
|
75
|
+
type TailwindSpacingClassName<Theme extends TailwindTheme> =
|
|
76
|
+
| `gap-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
77
|
+
| `gap-x-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
78
|
+
| `gap-y-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
79
|
+
| `mt-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
80
|
+
| `m-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
81
|
+
| `mx-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
82
|
+
| `my-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
83
|
+
| `p-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
84
|
+
| `px-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
85
|
+
| `py-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
86
|
+
| `pt-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
87
|
+
| `pr-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
88
|
+
| `pb-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
89
|
+
| `pl-${ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`;
|
|
90
|
+
|
|
91
|
+
type TailwindSizeClassName<Theme extends TailwindTheme> =
|
|
92
|
+
| `w-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
93
|
+
| `max-w-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
94
|
+
| `min-w-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
95
|
+
| `min-h-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
96
|
+
| `h-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`
|
|
97
|
+
| `size-${ScaleValue<Theme['sizes']> | ScaleValue<Theme['spacing']> | ArbitraryValue | LengthLiteral}`;
|
|
98
|
+
|
|
99
|
+
type TailwindColorClassName<Theme extends TailwindTheme> =
|
|
100
|
+
| `bg-${ScaleValue<Theme['colors']> | ArbitraryValue | ColorLiteral}`
|
|
101
|
+
| `text-${ScaleValue<Theme['colors']> | ArbitraryValue | ColorLiteral}`
|
|
102
|
+
| `border-${ScaleValue<Theme['colors']> | ArbitraryValue | ColorLiteral}`
|
|
103
|
+
| `outline-${ScaleValue<Theme['colors']> | ArbitraryValue | ColorLiteral}`;
|
|
104
|
+
|
|
105
|
+
type TailwindTypographyClassName<Theme extends TailwindTheme> =
|
|
106
|
+
| `text-${ScaleValue<Theme['fontSizes']> | ArbitraryValue}`
|
|
107
|
+
| `font-${ScaleValue<Theme['fontWeights']> | ArbitraryValue}`
|
|
108
|
+
| `leading-${ScaleValue<Theme['lineHeights']> | ArbitraryValue}`;
|
|
109
|
+
|
|
110
|
+
type TailwindVisualClassName<Theme extends TailwindTheme> =
|
|
111
|
+
| `rounded-${ScaleValue<Theme['radii']> | ArbitraryValue}`
|
|
112
|
+
| `shadow-${ScaleValue<Theme['shadows']> | ArbitraryValue}`
|
|
113
|
+
| `border-${string}`;
|
|
114
|
+
|
|
115
|
+
export type TailwindClassNameFor<Theme extends TailwindTheme> =
|
|
116
|
+
| TailwindStaticClassName
|
|
117
|
+
| TailwindSpacingClassName<Theme>
|
|
118
|
+
| TailwindSizeClassName<Theme>
|
|
119
|
+
| TailwindColorClassName<Theme>
|
|
120
|
+
| TailwindTypographyClassName<Theme>
|
|
121
|
+
| TailwindVisualClassName<Theme>
|
|
122
|
+
| ArbitraryClassName;
|
|
123
|
+
|
|
124
|
+
export type TailwindClassName = TailwindClassNameFor<TailwindTheme>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { selector, selectorPriority } from '../../selector';
|
|
2
|
+
import { PrioritySelectors } from '../../selector/presets';
|
|
3
|
+
|
|
4
|
+
export const TailwindResponsiveSelectors = {
|
|
5
|
+
sm: selector('@media (min-width: 640px)', 'media'),
|
|
6
|
+
md: selector('@media (min-width: 768px)', 'media'),
|
|
7
|
+
lg: selector('@media (min-width: 1024px)', 'media'),
|
|
8
|
+
xl: selector('@media (min-width: 1280px)', 'media'),
|
|
9
|
+
xxl: selector('@media (min-width: 1536px)', 'media'),
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const TailwindDarkSelector = selector(':where(.dark, .dark *)');
|
|
13
|
+
|
|
14
|
+
export const TailwindSelectors = selectorPriority({
|
|
15
|
+
...PrioritySelectors,
|
|
16
|
+
...TailwindResponsiveSelectors,
|
|
17
|
+
dark: TailwindDarkSelector,
|
|
18
|
+
}, [
|
|
19
|
+
'link',
|
|
20
|
+
'visited',
|
|
21
|
+
'hover',
|
|
22
|
+
'focusWithin',
|
|
23
|
+
'focus',
|
|
24
|
+
'focusVisible',
|
|
25
|
+
'active',
|
|
26
|
+
'disabled',
|
|
27
|
+
]);
|