@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
package/style/transform.ts
CHANGED
|
@@ -1,9 +1,48 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { symbol } from '../utils/symbol';
|
|
2
|
+
import type { CSSProperties, StyleObject, StyleValue } from './types';
|
|
3
|
+
|
|
4
|
+
const CLASS_NAME_VALUE: unique symbol = symbol('transform.classNameValue');
|
|
5
|
+
|
|
6
|
+
export type ClassNameValue<Value = unknown> = {
|
|
7
|
+
readonly [CLASS_NAME_VALUE]: true;
|
|
8
|
+
readonly value: Value;
|
|
9
|
+
readonly className: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type TransformStyleObject<Style = unknown> = {
|
|
13
|
+
[P in keyof Style]: StyleValue<Style[P] | ClassNameValue<Style[P]>>;
|
|
14
|
+
};
|
|
2
15
|
|
|
3
16
|
export type StyleTransform<Style = unknown> = {
|
|
4
|
-
transform(style: StyleObject<Style>):
|
|
17
|
+
transform(style: StyleObject<Style>): TransformStyleObject<CSSProperties>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ClassNameTransform<ClassName extends string = string> = {
|
|
21
|
+
transform(className: ClassName): TransformStyleObject<CSSProperties>;
|
|
5
22
|
};
|
|
6
23
|
|
|
24
|
+
export function classNameValue<const Value>(
|
|
25
|
+
value: Value,
|
|
26
|
+
className: string,
|
|
27
|
+
): ClassNameValue<Value> {
|
|
28
|
+
return {
|
|
29
|
+
[CLASS_NAME_VALUE]: true,
|
|
30
|
+
value,
|
|
31
|
+
className,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isClassNameValue(value: unknown): value is ClassNameValue {
|
|
36
|
+
return !!value &&
|
|
37
|
+
typeof value === 'object' &&
|
|
38
|
+
(value as ClassNameValue)[CLASS_NAME_VALUE] === true &&
|
|
39
|
+
typeof (value as ClassNameValue).className === 'string';
|
|
40
|
+
}
|
|
41
|
+
|
|
7
42
|
export function styleTransform<Style>(options: StyleTransform<Style>) {
|
|
8
43
|
return options;
|
|
9
44
|
}
|
|
45
|
+
|
|
46
|
+
export function classNameTransform<ClassName extends string>(options: ClassNameTransform<ClassName>) {
|
|
47
|
+
return options;
|
|
48
|
+
}
|
package/style/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CSSProperties } from '../atomic/utils/types';
|
|
2
|
+
import type { StyleImportantValue } from './important';
|
|
2
3
|
import type { StyleTokenData } from './token';
|
|
3
4
|
import type { AtRuleRef } from './valueRef';
|
|
5
|
+
import type { StyleWeightValue } from './weight';
|
|
4
6
|
|
|
5
7
|
export type { CSSProperties };
|
|
6
8
|
|
|
@@ -10,10 +12,10 @@ type StyleTokenize<T> = Exclude<
|
|
|
10
12
|
StyleTokenData<undefined>
|
|
11
13
|
>;
|
|
12
14
|
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type Important<T> = StyleImportantValue<Exclude<T, null | undefined>>;
|
|
16
|
+
type Weight<T> = StyleWeightValue<Exclude<T, null | undefined>>;
|
|
17
|
+
type Value<T> = T | Weight<T> | Important<T>;
|
|
18
|
+
type PlainValue<T> = T | Weight<T> | Important<T>;
|
|
17
19
|
|
|
18
20
|
export type StyleValue<T> = Value<T | StyleTokenize<T> | AtRuleRef>;
|
|
19
21
|
|
package/style/utils/expose.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { AnyBuilderData, SlotData } from '../../builder/data';
|
|
2
|
-
import { isSlotData } from '../../builder/data';
|
|
1
|
+
import type { AnyBuilderData, SelectorData, SlotData } from '../../builder/data';
|
|
2
|
+
import { isSelectorData, isSlotData } from '../../builder/data';
|
|
3
3
|
import { isStyleTokenData, type StyleTokenData } from '../token';
|
|
4
4
|
|
|
5
5
|
type ExposedStyleItem<T> = T extends StyleTokenData ? T
|
|
6
6
|
: T extends SlotData ? T
|
|
7
|
+
: T extends SelectorData ? T
|
|
7
8
|
: T extends AnyBuilderData ? never
|
|
8
9
|
: T extends readonly unknown[] ? never
|
|
9
10
|
: T extends object ? ExposedStyle<T>
|
|
@@ -34,7 +35,7 @@ function exposeStyleObject(source: object) {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
function exposeStyleValue(value: unknown): unknown {
|
|
37
|
-
if (isStyleTokenData(value) || isSlotData(value)) return value;
|
|
38
|
+
if (isStyleTokenData(value) || isSlotData(value) || isSelectorData(value)) return value;
|
|
38
39
|
|
|
39
40
|
if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined;
|
|
40
41
|
|
package/style/value.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DebugData } from '../builder/data/debug';
|
|
2
|
+
import { getChildStyleTokenName } from '../builder/token/name';
|
|
2
3
|
import { hashString } from '../utils/hash';
|
|
3
4
|
import { createStyleToken, type StyleToken, type StyleTokenOverride } from './token';
|
|
4
5
|
|
|
@@ -11,29 +12,28 @@ export type StyleValueFn<T extends ValueBase, Value extends ValueBase> = {
|
|
|
11
12
|
(value: T, provide: Value | StyleToken<Value>, debug: DebugData): StyleTokenOverride<Value>;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
export function createToken<T>(value: T | StyleToken<T
|
|
15
|
-
|
|
15
|
+
export function createToken<T>(value: T | StyleToken<T>): StyleToken<T>;
|
|
16
|
+
export function createToken<T>(value: T | StyleToken<T>, stableId?: string) {
|
|
17
|
+
return createStyleToken(value, stableId);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export function createValues<const T extends ValueBase>(
|
|
19
21
|
values: readonly T[],
|
|
20
|
-
debugId?: string,
|
|
21
22
|
): StyleValueFn<T, InferValue<T>>;
|
|
22
23
|
export function createValues<const T extends ValueBase>(
|
|
23
24
|
type: NumberConstructor,
|
|
24
25
|
values: readonly T[],
|
|
25
|
-
debugId?: string,
|
|
26
26
|
): StyleValueFn<T, number>;
|
|
27
27
|
export function createValues(
|
|
28
28
|
...args: [NumberConstructor, readonly ValueBase[], string?] | [readonly ValueBase[], string?]
|
|
29
29
|
): StyleValueFn<any, any> {
|
|
30
30
|
let values: readonly ValueBase[] = args[0] as readonly ValueBase[];
|
|
31
31
|
let isNumber = false;
|
|
32
|
-
let
|
|
32
|
+
let stableId = args[1] as string | undefined;
|
|
33
33
|
|
|
34
34
|
if (args[0] === Number) {
|
|
35
35
|
values = args[1] as readonly ValueBase[];
|
|
36
|
-
|
|
36
|
+
stableId = args[2] as string | undefined;
|
|
37
37
|
isNumber = true;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -46,9 +46,10 @@ export function createValues(
|
|
|
46
46
|
for (let value of values) {
|
|
47
47
|
tokens.set(
|
|
48
48
|
value,
|
|
49
|
-
|
|
49
|
+
createStyleToken(
|
|
50
50
|
parseValue(value, isNumber),
|
|
51
|
-
|
|
51
|
+
getChildStableId(stableId, hashString(String(value))),
|
|
52
|
+
getChildStyleTokenName(stableId ?? null, getValueDebugName(value)),
|
|
52
53
|
),
|
|
53
54
|
);
|
|
54
55
|
}
|
|
@@ -79,11 +80,25 @@ export function createValues(
|
|
|
79
80
|
return fn;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
function
|
|
83
|
-
|
|
83
|
+
function getChildStableId(
|
|
84
|
+
stableId: string | undefined,
|
|
84
85
|
child: string,
|
|
85
86
|
) {
|
|
86
|
-
return
|
|
87
|
+
return stableId ? stableId + '--' + child : undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getValueDebugName(value: ValueBase) {
|
|
91
|
+
if (typeof value === 'number') return String(value);
|
|
92
|
+
|
|
93
|
+
const parts = String(value).split(/[;|]/);
|
|
94
|
+
const label = parts[1]?.trim();
|
|
95
|
+
if (label) return sanitizeDebugName(label);
|
|
96
|
+
|
|
97
|
+
return sanitizeDebugName(parts[0]?.trim() ?? '');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function sanitizeDebugName(value: string) {
|
|
101
|
+
return value.replace(/[^a-zA-Z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || null;
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
function parseValue(value: ValueBase, isNumber: boolean) {
|
package/style/valueRef.ts
CHANGED
package/style/weight.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { symbol } from '../utils/symbol';
|
|
2
|
+
|
|
3
|
+
const STYLE_WEIGHT: unique symbol = symbol('style.weight');
|
|
4
|
+
|
|
5
|
+
export type StyleWeightValue<T = unknown> = {
|
|
6
|
+
readonly [STYLE_WEIGHT]: true;
|
|
7
|
+
readonly value: T;
|
|
8
|
+
readonly weight: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function weightValue<T>(value: T, weight: number): StyleWeightValue<T> {
|
|
12
|
+
return {
|
|
13
|
+
[STYLE_WEIGHT]: true,
|
|
14
|
+
value,
|
|
15
|
+
weight,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function isStyleWeightValue(value: unknown): value is StyleWeightValue {
|
|
20
|
+
return !!value && typeof value === 'object' && (value as StyleWeightValue)[STYLE_WEIGHT] === true;
|
|
21
|
+
}
|
package/utils/global.ts
CHANGED
package/utils/hash.ts
CHANGED
package/utils/symbol.ts
ADDED
package/atomic/layer/README.md
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Layer priority
|
|
2
|
-
|
|
3
|
-
Layer priority is a nested cascade model. It is not a flat score.
|
|
4
|
-
|
|
5
|
-
Lower items are emitted first. Higher items win later in the cascade.
|
|
6
|
-
|
|
7
|
-
```txt
|
|
8
|
-
value weight
|
|
9
|
-
└─ direct selector bucket
|
|
10
|
-
└─ parent selector bucket
|
|
11
|
-
└─ media bucket
|
|
12
|
-
└─ property bucket
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Order
|
|
16
|
-
|
|
17
|
-
```txt
|
|
18
|
-
value weight 0
|
|
19
|
-
base
|
|
20
|
-
base media
|
|
21
|
-
base weighted media
|
|
22
|
-
|
|
23
|
-
parent selector
|
|
24
|
-
parent selector media
|
|
25
|
-
parent selector weighted media
|
|
26
|
-
|
|
27
|
-
direct selector
|
|
28
|
-
direct selector media
|
|
29
|
-
direct selector weighted media
|
|
30
|
-
|
|
31
|
-
parent + direct selector
|
|
32
|
-
parent + direct selector media
|
|
33
|
-
parent + direct selector weighted media
|
|
34
|
-
|
|
35
|
-
priority direct selector
|
|
36
|
-
priority direct selector media
|
|
37
|
-
priority direct selector weighted media
|
|
38
|
-
|
|
39
|
-
value weight 1
|
|
40
|
-
...same expansion...
|
|
41
|
-
|
|
42
|
-
value weight 2
|
|
43
|
-
...same expansion...
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Rules
|
|
47
|
-
|
|
48
|
-
- Explicit value weight is the outermost override. A higher value weight wins over every lower value weight.
|
|
49
|
-
- Equal value weights still fall through to selector, parent selector, media, and property ordering.
|
|
50
|
-
- Media is only a convenience override inside the same selector bucket.
|
|
51
|
-
- Weighted media beats unweighted media only inside the same selector and parent-selector bucket.
|
|
52
|
-
- Base media cannot beat a direct selector.
|
|
53
|
-
- Parent selector, even with priority, cannot beat a direct selector bucket.
|
|
54
|
-
- Direct selector media cannot beat a priority direct selector.
|
|
55
|
-
- Parent + direct selector beats direct selector alone, but still cannot beat a higher direct selector priority bucket.
|
|
56
|
-
- Property order is always the innermost bucket: shorthand < intermediate < longhand.
|
|
57
|
-
|
|
58
|
-
## Tuple
|
|
59
|
-
|
|
60
|
-
`LayerPriority` stores the model as:
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
[
|
|
64
|
-
value,
|
|
65
|
-
selector,
|
|
66
|
-
parentSelector,
|
|
67
|
-
media,
|
|
68
|
-
atRule,
|
|
69
|
-
origin,
|
|
70
|
-
property,
|
|
71
|
-
];
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
The comparator reads that tuple in order. Do not move media before selector:
|
|
75
|
-
that would let media cross selector buckets, which breaks the intended model.
|
|
76
|
-
|
|
77
|
-
## Examples
|
|
78
|
-
|
|
79
|
-
```txt
|
|
80
|
-
base color
|
|
81
|
-
base media color
|
|
82
|
-
direct hover color
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The media rule wins over base, but it does not win over hover.
|
|
86
|
-
|
|
87
|
-
```txt
|
|
88
|
-
hover color
|
|
89
|
-
hover media color
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
The media rule wins because it is inside the same direct selector bucket.
|
|
93
|
-
|
|
94
|
-
```txt
|
|
95
|
-
parent hover color
|
|
96
|
-
direct hover color
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
The direct selector wins. Parent selector is context, not a stronger direct
|
|
100
|
-
state.
|
|
101
|
-
|
|
102
|
-
```txt
|
|
103
|
-
direct hover color
|
|
104
|
-
parent hover + direct hover color
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
The combined parent + direct selector wins because it is a narrower context
|
|
108
|
-
inside the same direct selector bucket.
|
|
109
|
-
|
|
110
|
-
```txt
|
|
111
|
-
value weight 1 base color
|
|
112
|
-
value weight 2 parent + priority selector media color
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
The value weight 2 rule wins. Different explicit value weights are resolved
|
|
116
|
-
before any selector or media bucket is considered.
|
package/atomic/utils/css.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { hashString } from '../../utils/hash';
|
|
2
|
-
|
|
3
|
-
export function getCssVar(varName: string, value: string) {
|
|
4
|
-
return 'var(' + varName + ', ' + escapeCssValue(value) + ')';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function getCssVarRawFallback(varName: string, fallbackCss: string) {
|
|
8
|
-
return 'var(' + varName + ', ' + fallbackCss + ')';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function escapeCssValue(value: string): string {
|
|
12
|
-
if (!value) return '';
|
|
13
|
-
|
|
14
|
-
return value
|
|
15
|
-
.trim()
|
|
16
|
-
// Escape existing backslashes first so we don't break them.
|
|
17
|
-
.replace(/\\/g, '\\\\')
|
|
18
|
-
.replace(/"/g, '\\"')
|
|
19
|
-
.replace(/'/g, "\\'")
|
|
20
|
-
.replace(/;/g, '\\;');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function escapeCssIdent(ident: string): string {
|
|
24
|
-
const escaped = ident.replace(/([[\]():.#,>+~*=!|^$@])/g, '\\$1');
|
|
25
|
-
|
|
26
|
-
if (/^[0-9]/.test(escaped)) {
|
|
27
|
-
return '\\3' + escaped[0] + ' ' + escaped.slice(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (/^-[0-9]/.test(escaped)) {
|
|
31
|
-
return '-\\3' + escaped[1] + ' ' + escaped.slice(2);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return escaped;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function sanitizeCssIdentName(value: string, fallback: string = '') {
|
|
38
|
-
return value.replace(/[^a-zA-Z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || fallback;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function getIdentifierSafeHash(value: string) {
|
|
42
|
-
const hash = hashString(value);
|
|
43
|
-
|
|
44
|
-
const first = hash.charCodeAt(0);
|
|
45
|
-
|
|
46
|
-
if (first < 48 || first > 57) return hash;
|
|
47
|
-
|
|
48
|
-
return String.fromCharCode(97 + first - 48) + hash.slice(1);
|
|
49
|
-
}
|
package/dist/assert-h_Zkqc4E.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { SelectorType, parse } from "css-what";
|
|
2
|
-
//#region selector/validate.ts
|
|
3
|
-
function isLocalSelector(selector) {
|
|
4
|
-
const groups = parseSelector(selector);
|
|
5
|
-
if (!groups || groups.length !== 1) return false;
|
|
6
|
-
return isSelectorGroupsSelf(groups, false);
|
|
7
|
-
}
|
|
8
|
-
function isPseudoArgSelector(selector) {
|
|
9
|
-
const groups = parseSelector(selector);
|
|
10
|
-
if (!groups || groups.length !== 1) return false;
|
|
11
|
-
return isSelectorGroupsSelf(groups, true);
|
|
12
|
-
}
|
|
13
|
-
function isTagSelector(selector) {
|
|
14
|
-
const groups = parseSelector(selector);
|
|
15
|
-
if (!groups || groups.length !== 1) return false;
|
|
16
|
-
const group = groups[0];
|
|
17
|
-
return group.length === 1 && group[0].type === SelectorType.Tag;
|
|
18
|
-
}
|
|
19
|
-
function isAttrArg(value) {
|
|
20
|
-
if (!value) return false;
|
|
21
|
-
if (value.includes("[") || value.includes("]")) return false;
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
function isRawValue(value) {
|
|
25
|
-
if (!value) return false;
|
|
26
|
-
if (value.includes("{") || value.includes("}")) return false;
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
function parseSelector(selector) {
|
|
30
|
-
try {
|
|
31
|
-
return parse(selector);
|
|
32
|
-
} catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function isSelectorGroupsSelf(groups, allowTag) {
|
|
37
|
-
for (let i = 0; i < groups.length; i++) {
|
|
38
|
-
const group = groups[i];
|
|
39
|
-
for (let j = 0; j < group.length; j++) {
|
|
40
|
-
const token = group[j];
|
|
41
|
-
if (!isAllowedSelectorType(token.type, allowTag)) return false;
|
|
42
|
-
if (token.type === SelectorType.Pseudo && Array.isArray(token.data) && !isSelectorGroupsSelf(token.data, allowTag)) return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
function isAllowedSelectorType(type, allowTag) {
|
|
48
|
-
return type === SelectorType.Attribute || type === SelectorType.Pseudo || type === SelectorType.PseudoElement || allowTag && type === SelectorType.Tag;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region selector/assert.ts
|
|
52
|
-
function assertSelector(type, value) {
|
|
53
|
-
assertSelectorNotEmpty(value);
|
|
54
|
-
if (!type) return;
|
|
55
|
-
if (typeof type === "function") return type(value);
|
|
56
|
-
switch (type) {
|
|
57
|
-
case "local": return assertLocalSelector(value);
|
|
58
|
-
case "arg": return assertPseudoArgSelector(value);
|
|
59
|
-
case "tag": return assertTagSelector(value);
|
|
60
|
-
case "attr": return assertAttrSelector(value);
|
|
61
|
-
case "value": return assertRawValue(value);
|
|
62
|
-
case "media": return assertMediaQuery(value);
|
|
63
|
-
case "supports": return assertSupportsQuery(value);
|
|
64
|
-
case "container": return assertContainerQuery(value);
|
|
65
|
-
default: throw new Error("unsupported selector type: " + value);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function assertEnumSelector(...input) {
|
|
69
|
-
const values = Array.isArray(input[0]) ? input[0] : input;
|
|
70
|
-
const fn = (arg) => {
|
|
71
|
-
if (!values.includes(arg)) throw new Error(`value must be one of: ${values.join(", ")}`);
|
|
72
|
-
};
|
|
73
|
-
return fn;
|
|
74
|
-
}
|
|
75
|
-
function assertSelectorNotEmpty(value) {
|
|
76
|
-
if (!value) throw new Error("selector cannot be empty");
|
|
77
|
-
}
|
|
78
|
-
function assertLocalSelector(value) {
|
|
79
|
-
if (!isLocalSelector(value)) throw new Error("selector must target the current element only and cannot contain tags, combinators, or multiple selectors");
|
|
80
|
-
}
|
|
81
|
-
function assertPseudoArgSelector(value) {
|
|
82
|
-
if (!isPseudoArgSelector(value)) throw new Error("pseudo selector argument must contain only tags or selectors targeting the current element");
|
|
83
|
-
}
|
|
84
|
-
function assertTagSelector(value) {
|
|
85
|
-
if (!isTagSelector(value)) throw new Error("selector must be a single tag selector");
|
|
86
|
-
}
|
|
87
|
-
function assertAttrSelector(value) {
|
|
88
|
-
if (!isAttrArg(value)) throw new Error("attribute selector value must not include \"[\" or \"]\"");
|
|
89
|
-
}
|
|
90
|
-
function assertRawValue(value) {
|
|
91
|
-
if (!isRawValue(value)) throw new Error("value must not contain \"{\" or \"}\"");
|
|
92
|
-
}
|
|
93
|
-
function assertMediaQuery(value) {
|
|
94
|
-
if (!isRawValue(value)) throw new Error("media query must not contain \"{\" or \"}\"");
|
|
95
|
-
}
|
|
96
|
-
function assertSupportsQuery(value) {
|
|
97
|
-
if (!isRawValue(value)) throw new Error("supports query must not contain \"{\" or \"}\"");
|
|
98
|
-
}
|
|
99
|
-
function assertContainerQuery(value) {
|
|
100
|
-
if (!isRawValue(value)) throw new Error("container query must not contain \"{\" or \"}\"");
|
|
101
|
-
}
|
|
102
|
-
//#endregion
|
|
103
|
-
export { assertMediaQuery as a, assertSelector as c, assertTagSelector as d, isAttrArg as f, isTagSelector as g, isRawValue as h, assertLocalSelector as i, assertSelectorNotEmpty as l, isPseudoArgSelector as m, assertContainerQuery as n, assertPseudoArgSelector as o, isLocalSelector as p, assertEnumSelector as r, assertRawValue as s, assertAttrSelector as t, assertSupportsQuery as u };
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=assert-h_Zkqc4E.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert-h_Zkqc4E.js","names":[],"sources":["../selector/validate.ts","../selector/assert.ts"],"sourcesContent":["import { parse, SelectorType } from 'css-what';\nimport type { Selector } from 'css-what';\n\ntype SelectorGroup = Selector[];\ntype SelectorGroups = SelectorGroup[];\n\nexport function isLocalSelector(selector: string) {\n const groups = parseSelector(selector);\n\n if (!groups || groups.length !== 1) return false;\n\n return isSelectorGroupsSelf(groups, false);\n}\n\nexport function isPseudoArgSelector(selector: string) {\n const groups = parseSelector(selector);\n\n if (!groups || groups.length !== 1) return false;\n\n return isSelectorGroupsSelf(groups, true);\n}\n\nexport function isTagSelector(selector: string) {\n const groups = parseSelector(selector);\n\n if (!groups || groups.length !== 1) return false;\n\n const group = groups[0];\n\n return group.length === 1 && group[0].type === SelectorType.Tag;\n}\n\nexport function isAttrArg(value: string) {\n if (!value) return false;\n\n // reject already wrapped attrs: attr('data-x'), not attr('[data-x]')\n if (value.includes('[') || value.includes(']')) return false;\n\n // cheap sanity only\n return true;\n}\n\nexport function isRawValue(value: string) {\n if (!value) return false;\n\n // avoid accidentally accepting whole rules\n if (value.includes('{') || value.includes('}')) return false;\n\n return true;\n}\n\nfunction parseSelector(selector: string): SelectorGroups | undefined {\n try {\n return parse(selector);\n } catch {\n return undefined;\n }\n}\n\nfunction isSelectorGroupsSelf(groups: SelectorGroups, allowTag: boolean) {\n for (let i = 0; i < groups.length; i++) {\n const group = groups[i];\n\n for (let j = 0; j < group.length; j++) {\n const token = group[j];\n\n if (!isAllowedSelectorType(token.type, allowTag)) {\n return false;\n }\n\n if (\n token.type === SelectorType.Pseudo &&\n Array.isArray(token.data) &&\n !isSelectorGroupsSelf(token.data, allowTag)\n ) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction isAllowedSelectorType(type: SelectorType, allowTag: boolean) {\n return (\n type === SelectorType.Attribute ||\n type === SelectorType.Pseudo ||\n type === SelectorType.PseudoElement ||\n (allowTag && type === SelectorType.Tag)\n );\n}\n","import type { SelectorAssert, SelectorAssertFn } from './types';\nimport { isAttrArg, isLocalSelector, isPseudoArgSelector, isRawValue, isTagSelector } from './validate';\n\nexport function assertSelector(type: SelectorAssert | null, value: string) {\n assertSelectorNotEmpty(value);\n\n if (!type) return;\n\n if (typeof type === 'function') {\n return type(value);\n }\n\n switch (type) {\n case 'local':\n return assertLocalSelector(value);\n\n case 'arg':\n return assertPseudoArgSelector(value);\n\n case 'tag':\n return assertTagSelector(value);\n\n case 'attr':\n return assertAttrSelector(value);\n\n case 'value':\n return assertRawValue(value);\n\n case 'media':\n return assertMediaQuery(value);\n\n case 'supports':\n return assertSupportsQuery(value);\n\n case 'container':\n return assertContainerQuery(value);\n\n default:\n throw new Error('unsupported selector type: ' + value);\n }\n}\n\nexport function assertEnumSelector<const Values extends readonly string[]>(\n values: Values,\n): SelectorAssertFn<Values[number]>;\nexport function assertEnumSelector<const Values extends readonly string[]>(\n ...values: Values\n): SelectorAssertFn<Values[number]>;\nexport function assertEnumSelector(\n ...input: [readonly string[]] | string[]\n) {\n const values = Array.isArray(input[0]) ? input[0] : input;\n\n const fn = (arg: string) => {\n if (!values.includes(arg)) {\n throw new Error(`value must be one of: ${values.join(', ')}`);\n }\n };\n\n return fn as SelectorAssertFn<string>;\n}\n\nexport function assertSelectorNotEmpty(value: string) {\n if (!value) {\n throw new Error('selector cannot be empty');\n }\n}\n\nexport function assertLocalSelector(value: string) {\n if (!isLocalSelector(value)) {\n throw new Error(\n 'selector must target the current element only and cannot contain tags, combinators, or multiple selectors',\n );\n }\n}\n\nexport function assertPseudoArgSelector(value: string) {\n if (!isPseudoArgSelector(value)) {\n throw new Error(\n 'pseudo selector argument must contain only tags or selectors targeting the current element',\n );\n }\n}\n\nexport function assertTagSelector(value: string) {\n if (!isTagSelector(value)) {\n throw new Error(\n 'selector must be a single tag selector',\n );\n }\n}\n\nexport function assertAttrSelector(value: string) {\n if (!isAttrArg(value)) {\n throw new Error(\n 'attribute selector value must not include \"[\" or \"]\"',\n );\n }\n}\n\nexport function assertRawValue(value: string) {\n if (!isRawValue(value)) {\n throw new Error(\n 'value must not contain \"{\" or \"}\"',\n );\n }\n}\n\nexport function assertMediaQuery(value: string) {\n if (!isRawValue(value)) {\n throw new Error(\n 'media query must not contain \"{\" or \"}\"',\n );\n }\n}\n\nexport function assertSupportsQuery(value: string) {\n if (!isRawValue(value)) {\n throw new Error(\n 'supports query must not contain \"{\" or \"}\"',\n );\n }\n}\n\nexport function assertContainerQuery(value: string) {\n if (!isRawValue(value)) {\n throw new Error(\n 'container query must not contain \"{\" or \"}\"',\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { d as globalData } from "./token-CKXUECuU.js";
|
|
2
|
-
import { f as RUNTIME_CONFIG } from "./token-u_tM-mtg.js";
|
|
3
|
-
//#region utils/object.ts
|
|
4
|
-
function hasOwn(target, field) {
|
|
5
|
-
return Object.prototype.hasOwnProperty.call(target, field);
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region runtime/core/cache/resolvedItem.ts
|
|
9
|
-
const resolvedStyleItems = globalData("runtime.resolvedStyleItems", () => /* @__PURE__ */ new WeakSet());
|
|
10
|
-
const resolvedStyleItemTokenValues = globalData("runtime.styleItemTokenValues", () => /* @__PURE__ */ new WeakMap());
|
|
11
|
-
function markResolvedStyleItem(item) {
|
|
12
|
-
resolvedStyleItems.add(item);
|
|
13
|
-
}
|
|
14
|
-
function isResolvedStyleItem(value) {
|
|
15
|
-
return !!value && typeof value === "object" && resolvedStyleItems.has(value);
|
|
16
|
-
}
|
|
17
|
-
function setResolvedStyleItemTokenValues(item, tokens) {
|
|
18
|
-
resolvedStyleItemTokenValues.set(item, tokens);
|
|
19
|
-
}
|
|
20
|
-
function getResolvedStyleItemTokenValues(item) {
|
|
21
|
-
return resolvedStyleItemTokenValues.get(item) ?? null;
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region runtime/core/cache/utils/tree.ts
|
|
25
|
-
function createCacheTreeNode(value) {
|
|
26
|
-
return {
|
|
27
|
-
children: /* @__PURE__ */ new Map(),
|
|
28
|
-
value
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function getCacheTreeChild(node, key, createValue) {
|
|
32
|
-
let child = node.children.get(key);
|
|
33
|
-
if (!child) {
|
|
34
|
-
child = createCacheTreeNode(createValue());
|
|
35
|
-
node.children.set(key, child);
|
|
36
|
-
}
|
|
37
|
-
return child;
|
|
38
|
-
}
|
|
39
|
-
function createWeakCacheTreeNode(value) {
|
|
40
|
-
return {
|
|
41
|
-
children: /* @__PURE__ */ new WeakMap(),
|
|
42
|
-
value
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function getWeakCacheTreeChild(node, key, createValue) {
|
|
46
|
-
let child = node.children.get(key);
|
|
47
|
-
if (!child) {
|
|
48
|
-
child = createWeakCacheTreeNode(createValue());
|
|
49
|
-
node.children.set(key, child);
|
|
50
|
-
}
|
|
51
|
-
return child;
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region runtime/core/cache/propCache.ts
|
|
55
|
-
const root = createWeakCacheTreeNode(createCacheValue());
|
|
56
|
-
function getStylePropCacheValue(styleProp, walk, onUnsupported) {
|
|
57
|
-
let node = root;
|
|
58
|
-
let hasItem = false;
|
|
59
|
-
let canCache = true;
|
|
60
|
-
walk(styleProp, (item) => {
|
|
61
|
-
hasItem = true;
|
|
62
|
-
node = getWeakCacheTreeChild(node, item, createCacheValue);
|
|
63
|
-
}, () => {
|
|
64
|
-
canCache = false;
|
|
65
|
-
onUnsupported?.();
|
|
66
|
-
});
|
|
67
|
-
if (!hasItem || !canCache) return null;
|
|
68
|
-
const value = node.value;
|
|
69
|
-
if (value.c !== RUNTIME_CONFIG.changes) {
|
|
70
|
-
value.d = null;
|
|
71
|
-
value.c = RUNTIME_CONFIG.changes;
|
|
72
|
-
}
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
function createCacheValue() {
|
|
76
|
-
return {
|
|
77
|
-
d: null,
|
|
78
|
-
c: RUNTIME_CONFIG.changes
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region runtime/core/cache/utils/walk.ts
|
|
83
|
-
function walkRecursiveItems(root, fn) {
|
|
84
|
-
if (!root) return;
|
|
85
|
-
const stack = [root];
|
|
86
|
-
while (stack.length > 0) {
|
|
87
|
-
const item = stack.pop();
|
|
88
|
-
if (!item) continue;
|
|
89
|
-
if (Array.isArray(item)) {
|
|
90
|
-
for (let i = item.length - 1; i >= 0; i--) stack.push(item[i]);
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
fn(item);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region runtime/core/className.ts
|
|
98
|
-
function mergeClassName(className) {
|
|
99
|
-
if (!className) return void 0;
|
|
100
|
-
if (!Array.isArray(className)) return className;
|
|
101
|
-
let nextClassName = "";
|
|
102
|
-
const stack = [className];
|
|
103
|
-
while (stack.length) {
|
|
104
|
-
const item = stack.pop();
|
|
105
|
-
if (!item) continue;
|
|
106
|
-
if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
|
|
107
|
-
else nextClassName = nextClassName ? `${nextClassName} ${item}` : item;
|
|
108
|
-
}
|
|
109
|
-
return nextClassName || void 0;
|
|
110
|
-
}
|
|
111
|
-
function mergeStyle(style) {
|
|
112
|
-
if (!style) return void 0;
|
|
113
|
-
if (!Array.isArray(style)) return style;
|
|
114
|
-
const nextStyle = {};
|
|
115
|
-
const stack = [style];
|
|
116
|
-
while (stack.length) {
|
|
117
|
-
const item = stack.pop();
|
|
118
|
-
if (!item) continue;
|
|
119
|
-
if (Array.isArray(item)) for (let index = item.length - 1; index >= 0; index--) stack.push(item[index]);
|
|
120
|
-
else Object.assign(nextStyle, item);
|
|
121
|
-
}
|
|
122
|
-
return nextStyle;
|
|
123
|
-
}
|
|
124
|
-
function mergeResolvedClassName(result, resolvedClassName) {
|
|
125
|
-
if (!resolvedClassName) return;
|
|
126
|
-
result.className = result.className ? result.className + " " + resolvedClassName : resolvedClassName;
|
|
127
|
-
}
|
|
128
|
-
function mergeResolvedStyle(result, resolvedStyle) {
|
|
129
|
-
if (!resolvedStyle) return;
|
|
130
|
-
result.style = result.style ? Object.assign({}, resolvedStyle, result.style) : resolvedStyle;
|
|
131
|
-
}
|
|
132
|
-
function createClassNameResult(props = {}) {
|
|
133
|
-
return {
|
|
134
|
-
className: props.className ? mergeClassName(props.className) : void 0,
|
|
135
|
-
style: props.style ? mergeStyle(props.style) : void 0
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function finishClassNameResult(result) {
|
|
139
|
-
return result.className || result.style ? result : {};
|
|
140
|
-
}
|
|
141
|
-
//#endregion
|
|
142
|
-
export { mergeResolvedStyle as a, getStylePropCacheValue as c, getResolvedStyleItemTokenValues as d, isResolvedStyleItem as f, hasOwn as h, mergeResolvedClassName as i, createCacheTreeNode as l, setResolvedStyleItemTokenValues as m, finishClassNameResult as n, mergeStyle as o, markResolvedStyleItem as p, mergeClassName as r, walkRecursiveItems as s, createClassNameResult as t, getCacheTreeChild as u };
|
|
143
|
-
|
|
144
|
-
//# sourceMappingURL=className-C1Ht5Wvv.js.map
|