@fluentic/style 0.1.0-beta.0
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 +32 -0
- package/LICENSE +21 -0
- package/README.md +409 -0
- package/atomic/atRule/counterStyle.ts +35 -0
- package/atomic/atRule/fontFace.ts +37 -0
- package/atomic/atRule/fontPaletteValues.ts +36 -0
- package/atomic/atRule/fontSrc.ts +13 -0
- package/atomic/atRule/keyframes.ts +43 -0
- package/atomic/atRule/positionTry.ts +73 -0
- package/atomic/atRule/property.ts +39 -0
- package/atomic/atRule/utils.ts +81 -0
- package/atomic/className.ts +93 -0
- package/atomic/debug/className/className.ts +33 -0
- package/atomic/debug/className/index.ts +1 -0
- package/atomic/debug/property/data.ts +59 -0
- package/atomic/debug/property/index.ts +1 -0
- package/atomic/debug/property/property.ts +59 -0
- package/atomic/debug/selector.ts +88 -0
- package/atomic/debug/value.ts +53 -0
- package/atomic/element.ts +29 -0
- package/atomic/layer/README.md +116 -0
- package/atomic/layer/index.ts +3 -0
- package/atomic/layer/layer.ts +95 -0
- package/atomic/layer/types.ts +37 -0
- package/atomic/layer/utils.ts +51 -0
- package/atomic/property/index.ts +2 -0
- package/atomic/property/presets.ts +34 -0
- package/atomic/property/property.ts +13 -0
- package/atomic/property/type_maps.ts +389 -0
- package/atomic/property/types.ts +7 -0
- package/atomic/rule.ts +116 -0
- package/atomic/theme.ts +48 -0
- package/atomic/token.ts +53 -0
- package/atomic/utils/css.ts +49 -0
- package/atomic/utils/debug.ts +37 -0
- package/atomic/utils/format.ts +192 -0
- package/atomic/utils/selector.ts +14 -0
- package/atomic/utils/types.ts +11 -0
- package/atomic/value/index.ts +2 -0
- package/atomic/value/unitless.ts +47 -0
- package/atomic/value/value.ts +17 -0
- package/atomic/var.ts +19 -0
- package/builder/data/check_selector.noop.ts +8 -0
- package/builder/data/check_selector.ts +30 -0
- package/builder/data/const.ts +25 -0
- package/builder/data/create.ts +96 -0
- package/builder/data/data.ts +63 -0
- package/builder/data/debug.ts +113 -0
- package/builder/data/index.ts +9 -0
- package/builder/data/is.ts +68 -0
- package/builder/data/merge/index.ts +2 -0
- package/builder/data/merge/scope.ts +300 -0
- package/builder/data/merge/style.ts +284 -0
- package/builder/data/merge/utils.ts +35 -0
- package/builder/data/selector.ts +11 -0
- package/builder/data/state.ts +134 -0
- package/builder/extract/index.ts +6 -0
- package/builder/extract/scope.ts +30 -0
- package/builder/extract/slot.ts +36 -0
- package/builder/extract/style.ts +89 -0
- package/builder/extract/theme.ts +16 -0
- package/builder/extract/token.ts +41 -0
- package/builder/extract/utils.ts +95 -0
- package/builder/extract/withTokens.ts +64 -0
- package/builder/index.ts +2 -0
- package/builder/style_builder.ts +234 -0
- package/builder/style_data.ts +81 -0
- package/builder/style_fns.ts +611 -0
- package/builder/types/alias.ts +83 -0
- package/builder/types/fns.ts +185 -0
- package/builder/types/index.ts +1 -0
- package/builder/types/types.ts +51 -0
- package/builder/utils.ts +19 -0
- package/compiler/compiler/cache.ts +155 -0
- package/compiler/compiler/compiler.ts +173 -0
- package/compiler/compiler/index.ts +3 -0
- package/compiler/compiler/types.ts +62 -0
- package/compiler/extract/collector.ts +25 -0
- package/compiler/extract/extract.ts +51 -0
- package/compiler/extract/index.ts +3 -0
- package/compiler/extract/types.ts +35 -0
- package/compiler/index.ts +2 -0
- package/compiler/transform/debug/index.ts +2 -0
- package/compiler/transform/debug/plugin.ts +1347 -0
- package/compiler/transform/debug/transform.ts +47 -0
- package/compiler/transform/debug/utils/debug_data.ts +187 -0
- package/compiler/transform/debug/utils/source_url.ts +29 -0
- package/compiler/transform/evaluator/evaluator.ts +1138 -0
- package/compiler/transform/evaluator/index.ts +3 -0
- package/compiler/transform/evaluator/tracer.ts +607 -0
- package/compiler/transform/evaluator/types.ts +22 -0
- package/compiler/transform/extract/chain/chain.ts +2343 -0
- package/compiler/transform/extract/chain/extract_chain.ts +89 -0
- package/compiler/transform/extract/chain/index.ts +3 -0
- package/compiler/transform/extract/chain/types.ts +37 -0
- package/compiler/transform/extract/index.ts +2 -0
- package/compiler/transform/extract/plugin.ts +665 -0
- package/compiler/transform/extract/transform.ts +45 -0
- package/compiler/transform/extract/utils/imports.ts +132 -0
- package/compiler/transform/extract/utils/replacement.ts +349 -0
- package/compiler/transform/extract/utils/slot.ts +186 -0
- package/compiler/transform/extract/utils/state.ts +48 -0
- package/compiler/transform/extract/utils/theme.ts +86 -0
- package/compiler/transform/extract/utils/token.ts +1 -0
- package/compiler/transform/index.ts +5 -0
- package/compiler/transform/syntax/index.ts +5 -0
- package/compiler/transform/syntax/isStaticStyleValue.ts +44 -0
- package/compiler/transform/syntax/isStyleChainCall.ts +16 -0
- package/compiler/transform/syntax/static_ids.ts +282 -0
- package/compiler/transform/syntax/types.ts +7 -0
- package/compiler/transform/syntax/utils.ts +31 -0
- package/compiler/transform/utils/babel.ts +100 -0
- package/compiler/transform/utils/import.ts +47 -0
- package/compiler/transform/utils/path.ts +13 -0
- package/compiler/transform/utils/selector.ts +252 -0
- package/compiler/utils/constants.ts +69 -0
- package/compiler/utils/file_resolver.ts +72 -0
- package/compiler/utils/import_source.ts +200 -0
- package/compiler/utils/imports.ts +24 -0
- package/compiler/utils/path.ts +40 -0
- package/compiler/utils/sourcemap.ts +61 -0
- package/config/build.ts +32 -0
- package/config/config/css.ts +32 -0
- package/config/config/css_extra.ts +22 -0
- package/config/config/debug.ts +26 -0
- package/config/config/dev.ts +145 -0
- package/config/config/runtime.ts +29 -0
- package/config/configure.ts +28 -0
- package/config/constants.ts +1 -0
- package/config/index.ts +2 -0
- package/config/types.ts +56 -0
- package/config/utils.ts +5 -0
- package/css/counterStyle.ts +20 -0
- package/css/fontFace.ts +25 -0
- package/css/fontPaletteValues.ts +20 -0
- package/css/index.ts +8 -0
- package/css/keyframes.ts +20 -0
- package/css/positionTry.ts +20 -0
- package/css/property.ts +32 -0
- package/css/utils.ts +56 -0
- package/dev/config.ts +16 -0
- package/dev/fns.ts +48 -0
- package/dev/index.ts +2 -0
- package/dev/trace.ts +413 -0
- package/dev/utils.ts +528 -0
- package/dist/assert-h_Zkqc4E.js +105 -0
- package/dist/assert-h_Zkqc4E.js.map +1 -0
- package/dist/className-C1Ht5Wvv.js +144 -0
- package/dist/className-C1Ht5Wvv.js.map +1 -0
- package/dist/className-DC2Cq8p3.js +251 -0
- package/dist/className-DC2Cq8p3.js.map +1 -0
- package/dist/compiler/index.mjs +2 -0
- package/dist/compiler-DweanHoB.mjs +6847 -0
- package/dist/compiler-DweanHoB.mjs.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config-BryWDfQX.js +25 -0
- package/dist/config-BryWDfQX.js.map +1 -0
- package/dist/config-DKHXWhe1.js +1 -0
- package/dist/config-Di2VYYKV.js +6 -0
- package/dist/config-Di2VYYKV.js.map +1 -0
- package/dist/config-DloHOG6I.js +13 -0
- package/dist/config-DloHOG6I.js.map +1 -0
- package/dist/css-BowBszUt.js +243 -0
- package/dist/css-BowBszUt.js.map +1 -0
- package/dist/css-ByOrugEX.js +805 -0
- package/dist/css-ByOrugEX.js.map +1 -0
- package/dist/css-DcazYor9.js +235 -0
- package/dist/css-DcazYor9.js.map +1 -0
- package/dist/css.js +2 -0
- package/dist/css_extra-DlOnsnR1.js +8 -0
- package/dist/css_extra-DlOnsnR1.js.map +1 -0
- package/dist/css_extra-oIi3UEPK.js +8 -0
- package/dist/css_extra-oIi3UEPK.js.map +1 -0
- package/dist/data-_te7t0M4.js +473 -0
- package/dist/data-_te7t0M4.js.map +1 -0
- package/dist/debug-BAw63qX6.js +15 -0
- package/dist/debug-BAw63qX6.js.map +1 -0
- package/dist/debug-DGki_v7g.js +15 -0
- package/dist/debug-DGki_v7g.js.map +1 -0
- package/dist/debug-n2aZQBSa.js +172 -0
- package/dist/debug-n2aZQBSa.js.map +1 -0
- package/dist/dev/rsc.js +183 -0
- package/dist/dev/rsc.js.map +1 -0
- package/dist/dev-CcphAa3R.js +376 -0
- package/dist/dev-CcphAa3R.js.map +1 -0
- package/dist/dev-DfBbuLeE.js +71 -0
- package/dist/dev-DfBbuLeE.js.map +1 -0
- package/dist/dev.js +2 -0
- package/dist/elementMarker-Bu7gDAkE.js +800 -0
- package/dist/elementMarker-Bu7gDAkE.js.map +1 -0
- package/dist/entry/dev/css.js +3 -0
- package/dist/entry/dev/jsx-dev-runtime.js +3 -0
- package/dist/entry/dev/jsx-runtime.js +3 -0
- package/dist/entry/dev.js +10 -0
- package/dist/entry/prod/css.js +3 -0
- package/dist/entry/prod/extract.js +3 -0
- package/dist/entry/prod/jsx-dev-runtime.js +3 -0
- package/dist/entry/prod/jsx-runtime.js +3 -0
- package/dist/entry/prod/runtime.js +5 -0
- package/dist/entry/prod.js +1230 -0
- package/dist/entry/prod.js.map +1 -0
- package/dist/entry/rsc-dev/css.js +3 -0
- package/dist/entry/rsc-dev/dev.js +544 -0
- package/dist/entry/rsc-dev/dev.js.map +1 -0
- package/dist/entry/rsc-dev/jsx-dev-runtime.js +12 -0
- package/dist/entry/rsc-dev/jsx-dev-runtime.js.map +1 -0
- package/dist/entry/rsc-dev/jsx-runtime.js +3 -0
- package/dist/entry/rsc-dev.js +1429 -0
- package/dist/entry/rsc-dev.js.map +1 -0
- package/dist/entry/rsc-prod/css.js +3 -0
- package/dist/entry/rsc-prod/jsx-dev-runtime.js +3 -0
- package/dist/entry/rsc-prod/jsx-runtime.js +3 -0
- package/dist/entry/rsc-prod/runtime.js +5 -0
- package/dist/entry/rsc-prod.js +10 -0
- package/dist/extract-CzWJeQi8.js +121 -0
- package/dist/extract-CzWJeQi8.js.map +1 -0
- package/dist/extract-DEwSDJ9Z.js +2 -0
- package/dist/format-3nKBE_5t.js +144 -0
- package/dist/format-3nKBE_5t.js.map +1 -0
- package/dist/getClassName-BlvXHYuf.js +260 -0
- package/dist/getClassName-BlvXHYuf.js.map +1 -0
- package/dist/global-CvfmFLsK.js +11 -0
- package/dist/global-CvfmFLsK.js.map +1 -0
- package/dist/index.js +9 -0
- package/dist/jsx/jsx-dev-runtime.js +12 -0
- package/dist/jsx/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx/jsx-dev-runtime.server.js +11 -0
- package/dist/jsx/jsx-dev-runtime.server.js.map +1 -0
- package/dist/jsx/jsx-runtime.js +13 -0
- package/dist/jsx/jsx-runtime.js.map +1 -0
- package/dist/jsx/jsx-runtime.server.js +12 -0
- package/dist/jsx/jsx-runtime.server.js.map +1 -0
- package/dist/jsx-CwTeyUxr.js +39 -0
- package/dist/jsx-CwTeyUxr.js.map +1 -0
- package/dist/jsx-D2BksHSv.js +38 -0
- package/dist/jsx-D2BksHSv.js.map +1 -0
- package/dist/jsx_dev_runtime-B6xs4by8.js +12 -0
- package/dist/jsx_dev_runtime-B6xs4by8.js.map +1 -0
- package/dist/jsx_runtime-04xfnsi7.js +13 -0
- package/dist/jsx_runtime-04xfnsi7.js.map +1 -0
- package/dist/jsx_runtime-iHLDwpcW.js +12 -0
- package/dist/jsx_runtime-iHLDwpcW.js.map +1 -0
- package/dist/layer-D1SaH07m.js +94 -0
- package/dist/layer-D1SaH07m.js.map +1 -0
- package/dist/loader-DS61nRqr.mjs +81 -0
- package/dist/loader-DS61nRqr.mjs.map +1 -0
- package/dist/misc-B9kqEb2N.mjs +360 -0
- package/dist/misc-B9kqEb2N.mjs.map +1 -0
- package/dist/plugin/farm/index.mjs +176 -0
- package/dist/plugin/farm/index.mjs.map +1 -0
- package/dist/plugin/nextjs/index.mjs +282 -0
- package/dist/plugin/nextjs/index.mjs.map +1 -0
- package/dist/plugin/nextjs/loader.mjs +162 -0
- package/dist/plugin/nextjs/loader.mjs.map +1 -0
- package/dist/plugin/parcel/index.cjs +9 -0
- package/dist/plugin/parcel/index.mjs +5 -0
- package/dist/plugin/parcel/optimizer.cjs +28 -0
- package/dist/plugin/parcel/optimizer.cjs.map +1 -0
- package/dist/plugin/parcel/optimizer.mjs +29 -0
- package/dist/plugin/parcel/optimizer.mjs.map +1 -0
- package/dist/plugin/parcel/resolver.cjs +17 -0
- package/dist/plugin/parcel/resolver.cjs.map +1 -0
- package/dist/plugin/parcel/resolver.mjs +18 -0
- package/dist/plugin/parcel/resolver.mjs.map +1 -0
- package/dist/plugin/parcel/runtime.cjs +17 -0
- package/dist/plugin/parcel/runtime.cjs.map +1 -0
- package/dist/plugin/parcel/runtime.mjs +17 -0
- package/dist/plugin/parcel/runtime.mjs.map +1 -0
- package/dist/plugin/parcel/transformer.cjs +41 -0
- package/dist/plugin/parcel/transformer.cjs.map +1 -0
- package/dist/plugin/parcel/transformer.mjs +41 -0
- package/dist/plugin/parcel/transformer.mjs.map +1 -0
- package/dist/plugin/rspack/index.mjs +11 -0
- package/dist/plugin/rspack/index.mjs.map +1 -0
- package/dist/plugin/vite/index.mjs +176 -0
- package/dist/plugin/vite/index.mjs.map +1 -0
- package/dist/plugin/webpack/index.mjs +2 -0
- package/dist/plugin/webpack/loader.mjs +19 -0
- package/dist/plugin/webpack/loader.mjs.map +1 -0
- package/dist/presets-Bye3ea2x.js +139 -0
- package/dist/presets-Bye3ea2x.js.map +1 -0
- package/dist/property-CnLFt5kx.js +406 -0
- package/dist/property-CnLFt5kx.js.map +1 -0
- package/dist/registry-CyIj8LYK.mjs +22 -0
- package/dist/registry-CyIj8LYK.mjs.map +1 -0
- package/dist/rules-9HSO1pxL.js +767 -0
- package/dist/rules-9HSO1pxL.js.map +1 -0
- package/dist/runtime-CYqNCiaM.js +53 -0
- package/dist/runtime-CYqNCiaM.js.map +1 -0
- package/dist/selector/index.js +3 -0
- package/dist/server.js +63 -0
- package/dist/server.js.map +1 -0
- package/dist/shared-BAL9peIw.cjs +7646 -0
- package/dist/shared-BAL9peIw.cjs.map +1 -0
- package/dist/shared-CCpq1zqA.mjs +132 -0
- package/dist/shared-CCpq1zqA.mjs.map +1 -0
- package/dist/sidecar-4u6GnlQG.mjs +236 -0
- package/dist/sidecar-4u6GnlQG.mjs.map +1 -0
- package/dist/style-4rFUy-zW.js +752 -0
- package/dist/style-4rFUy-zW.js.map +1 -0
- package/dist/style-B1UUqjj5.js +743 -0
- package/dist/style-B1UUqjj5.js.map +1 -0
- package/dist/style-Cw3NtvR0.js +5 -0
- package/dist/style-DNqQ6H-7.js +1255 -0
- package/dist/style-DNqQ6H-7.js.map +1 -0
- package/dist/styleStore-Dea_WVbr.js +2000 -0
- package/dist/styleStore-Dea_WVbr.js.map +1 -0
- package/dist/styleStore-DyNXBcUK.js +54 -0
- package/dist/styleStore-DyNXBcUK.js.map +1 -0
- package/dist/token-CKXUECuU.js +76 -0
- package/dist/token-CKXUECuU.js.map +1 -0
- package/dist/token-u_tM-mtg.js +204 -0
- package/dist/token-u_tM-mtg.js.map +1 -0
- package/dist/trace-Bu_qOqRy.js +245 -0
- package/dist/trace-Bu_qOqRy.js.map +1 -0
- package/dist/trace-CU0rvNYr.js +244 -0
- package/dist/trace-CU0rvNYr.js.map +1 -0
- package/dist/utils-BbehLOby.js +2415 -0
- package/dist/utils-BbehLOby.js.map +1 -0
- package/dist/utils-C7xfDxtM.mjs +97 -0
- package/dist/utils-C7xfDxtM.mjs.map +1 -0
- package/dist/utils-CWNHx4EC.js +170 -0
- package/dist/utils-CWNHx4EC.js.map +1 -0
- package/dist/utils-CdI6vZsP.js +37 -0
- package/dist/utils-CdI6vZsP.js.map +1 -0
- package/dist/utils-D7FAOyg6.js +129 -0
- package/dist/utils-D7FAOyg6.js.map +1 -0
- package/dist/utils-DMFgOOtA.mjs +49 -0
- package/dist/utils-DMFgOOtA.mjs.map +1 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/dist/value-BR4e2MKt.js +910 -0
- package/dist/value-BR4e2MKt.js.map +1 -0
- package/dist/value-E8rEv2Oe.js +136 -0
- package/dist/value-E8rEv2Oe.js.map +1 -0
- package/dist/valueRef-lshFk1Cs.js +16 -0
- package/dist/valueRef-lshFk1Cs.js.map +1 -0
- package/dist/webpack-CxS2FDYU.mjs +107 -0
- package/dist/webpack-CxS2FDYU.mjs.map +1 -0
- package/dist/withTokens-LRidu3Vc.js +95 -0
- package/dist/withTokens-LRidu3Vc.js.map +1 -0
- package/entry/dev/config.ts +2 -0
- package/entry/dev/css.ts +3 -0
- package/entry/dev/index.ts +3 -0
- package/entry/dev/jsx_dev_runtime.ts +3 -0
- package/entry/dev/jsx_runtime.ts +3 -0
- package/entry/prod/config.ts +2 -0
- package/entry/prod/css.ts +3 -0
- package/entry/prod/extract.ts +1 -0
- package/entry/prod/index.ts +3 -0
- package/entry/prod/jsx_dev_runtime.ts +3 -0
- package/entry/prod/jsx_runtime.ts +3 -0
- package/entry/prod/runtime.ts +14 -0
- package/entry/rsc_dev/config.ts +6 -0
- package/entry/rsc_dev/css.ts +3 -0
- package/entry/rsc_dev/dev.ts +5 -0
- package/entry/rsc_dev/index.ts +3 -0
- package/entry/rsc_dev/jsx_dev_runtime.ts +3 -0
- package/entry/rsc_dev/jsx_runtime.ts +3 -0
- package/entry/rsc_dev/server.ts +11 -0
- package/entry/rsc_prod/config.ts +6 -0
- package/entry/rsc_prod/css.ts +3 -0
- package/entry/rsc_prod/index.ts +3 -0
- package/entry/rsc_prod/jsx_dev_runtime.ts +3 -0
- package/entry/rsc_prod/jsx_runtime.ts +3 -0
- package/entry/rsc_prod/runtime.ts +12 -0
- package/entry/rsc_prod/server.ts +13 -0
- package/entry/shared/config.ts +5 -0
- package/entry/shared/dev.ts +19 -0
- package/entry/shared/prod.ts +4 -0
- package/index.ts +36 -0
- package/jsx/extracted/jsx_dev_runtime.ts +11 -0
- package/jsx/extracted/jsx_runtime.ts +12 -0
- package/jsx/rsc/jsx_dev_runtime.ts +11 -0
- package/jsx/rsc/jsx_runtime.ts +12 -0
- package/jsx/rsc_extracted/jsx_dev_runtime.ts +2 -0
- package/jsx/rsc_extracted/jsx_runtime.ts +2 -0
- package/jsx/runtime/jsx_dev_runtime.ts +11 -0
- package/jsx/runtime/jsx_runtime.ts +12 -0
- package/jsx/types.ts +8 -0
- package/jsx/utils.ts +59 -0
- package/package.json +298 -0
- package/plugin/bundler/farm/index.ts +1 -0
- package/plugin/bundler/farm/plugin.ts +320 -0
- package/plugin/bundler/parcel/config.json +19 -0
- package/plugin/bundler/parcel/index.ts +1 -0
- package/plugin/bundler/parcel/optimizer.ts +36 -0
- package/plugin/bundler/parcel/plugin.ts +4 -0
- package/plugin/bundler/parcel/resolver.ts +36 -0
- package/plugin/bundler/parcel/runtime.ts +23 -0
- package/plugin/bundler/parcel/shared.ts +234 -0
- package/plugin/bundler/parcel/transformer.ts +67 -0
- package/plugin/bundler/rspack/index.ts +1 -0
- package/plugin/bundler/rspack/plugin.ts +14 -0
- package/plugin/bundler/vite/index.ts +1 -0
- package/plugin/bundler/vite/plugin.ts +133 -0
- package/plugin/bundler/vite/state.ts +153 -0
- package/plugin/bundler/webpack/index.ts +1 -0
- package/plugin/bundler/webpack/loader.ts +19 -0
- package/plugin/bundler/webpack/plugin.ts +240 -0
- package/plugin/bundler/webpack/shared/index.ts +2 -0
- package/plugin/bundler/webpack/shared/loader.ts +155 -0
- package/plugin/bundler/webpack/shared/registry.ts +16 -0
- package/plugin/bundler/webpack/utils.ts +96 -0
- package/plugin/nextjs/constants.ts +7 -0
- package/plugin/nextjs/html.ts +62 -0
- package/plugin/nextjs/index.ts +2 -0
- package/plugin/nextjs/loader.ts +222 -0
- package/plugin/nextjs/plugin.ts +532 -0
- package/plugin/nextjs/types.ts +33 -0
- package/plugin/nextjs/utils.ts +210 -0
- package/plugin/utils/cache/css_cache.ts +146 -0
- package/plugin/utils/cache/file.ts +40 -0
- package/plugin/utils/cache/index.ts +2 -0
- package/plugin/utils/compiler.ts +94 -0
- package/plugin/utils/constants.ts +7 -0
- package/plugin/utils/cssMarker.ts +14 -0
- package/plugin/utils/cssOutput.ts +65 -0
- package/plugin/utils/filter.ts +98 -0
- package/plugin/utils/imports.ts +5 -0
- package/plugin/utils/index.ts +10 -0
- package/plugin/utils/injection.ts +28 -0
- package/plugin/utils/misc.ts +5 -0
- package/plugin/utils/runtimeEntry.ts +57 -0
- package/plugin/utils/sidecar/index.ts +1 -0
- package/plugin/utils/sidecar/server.ts +143 -0
- package/plugin/utils/sidecar/sidecar.ts +167 -0
- package/plugin/utils/sidecar/utils.ts +109 -0
- package/plugin/utils/sourcemap.ts +52 -0
- package/plugin/utils/virtual.ts +81 -0
- package/runtime/core/cache/combine.ts +102 -0
- package/runtime/core/cache/index.ts +5 -0
- package/runtime/core/cache/item.ts +231 -0
- package/runtime/core/cache/pool.ts +310 -0
- package/runtime/core/cache/prop.ts +283 -0
- package/runtime/core/cache/propCache.ts +62 -0
- package/runtime/core/cache/resolvedItem.ts +31 -0
- package/runtime/core/cache/result.ts +115 -0
- package/runtime/core/cache/stateItem.ts +208 -0
- package/runtime/core/cache/tokenValues.ts +150 -0
- package/runtime/core/cache/utils/tree.ts +57 -0
- package/runtime/core/cache/utils/walk.ts +24 -0
- package/runtime/core/className.ts +101 -0
- package/runtime/core/combinedStyle.ts +101 -0
- package/runtime/core/createTransformElement.ts +39 -0
- package/runtime/core/elementMarker.ts +189 -0
- package/runtime/core/elementMarkerData.ts +27 -0
- package/runtime/core/getClassName.ts +47 -0
- package/runtime/core/getSheetRules.ts +7 -0
- package/runtime/core/getToken.ts +14 -0
- package/runtime/core/index.ts +5 -0
- package/runtime/core/jsx.ts +4 -0
- package/runtime/core/resolveClassNameRuntime.ts +33 -0
- package/runtime/env.ts +7 -0
- package/runtime/extract/getClassName.ts +476 -0
- package/runtime/extract/index.ts +4 -0
- package/runtime/extract/jsx.ts +55 -0
- package/runtime/index.ts +12 -0
- package/runtime/rsc/constants.ts +6 -0
- package/runtime/rsc/dev.ts +38 -0
- package/runtime/rsc/getClassName.ts +98 -0
- package/runtime/rsc/index.ts +3 -0
- package/runtime/rsc/jsx.ts +4 -0
- package/runtime/rsc/observer.ts +238 -0
- package/runtime/rsc/styleStore.ts +82 -0
- package/runtime/sheet/element.ts +13 -0
- package/runtime/sheet/global-noop.ts +13 -0
- package/runtime/sheet/global-prod.ts +13 -0
- package/runtime/sheet/global.ts +13 -0
- package/runtime/sheet/index.ts +3 -0
- package/runtime/sheet/insert.ts +37 -0
- package/runtime/sheet/rule.ts +77 -0
- package/runtime/sheet/rules.ts +131 -0
- package/runtime/sheet/theme.ts +34 -0
- package/runtime/style/index.ts +3 -0
- package/runtime/style/scope.ts +65 -0
- package/runtime/style/style.ts +34 -0
- package/runtime/style/token.ts +1 -0
- package/runtime/types.ts +42 -0
- package/selector/assert.ts +131 -0
- package/selector/index.ts +5 -0
- package/selector/presets/default.ts +27 -0
- package/selector/presets/index.ts +3 -0
- package/selector/presets/minimal.ts +37 -0
- package/selector/presets/selectors.ts +85 -0
- package/selector/selector.ts +68 -0
- package/selector/types.ts +24 -0
- package/selector/validate.ts +91 -0
- package/sheet/dev/dev_layer.ts +151 -0
- package/sheet/dev/dev_sort.ts +249 -0
- package/sheet/dev/index.ts +129 -0
- package/sheet/dev/utils.ts +130 -0
- package/sheet/index.ts +4 -0
- package/sheet/prod.ts +109 -0
- package/sheet/sheet.ts +10 -0
- package/sheet/sourcemap.ts +70 -0
- package/sheet/types.ts +31 -0
- package/sheet/utils/dom.ts +71 -0
- package/sheet/utils/index.ts +4 -0
- package/sheet/utils/layer.ts +14 -0
- package/sheet/utils/noop.ts +11 -0
- package/sheet/utils/rule.ts +3 -0
- package/sheet/utils/sourcemap.ts +221 -0
- package/style/index.ts +9 -0
- package/style/keyframes.ts +40 -0
- package/style/style.ts +112 -0
- package/style/theme.ts +36 -0
- package/style/token.ts +101 -0
- package/style/tokens.ts +64 -0
- package/style/transform.ts +9 -0
- package/style/types.ts +32 -0
- package/style/utils/expose.ts +43 -0
- package/style/utils/index.ts +1 -0
- package/style/value.ts +103 -0
- package/style/valueRef.ts +25 -0
- package/utils/global.ts +44 -0
- package/utils/hash.ts +22 -0
- package/utils/id.ts +20 -0
- package/utils/object.ts +87 -0
- package/utils/trace.ts +211 -0
- package/utils/type.ts +22 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type SourcemapFilePathInfo = {
|
|
2
|
+
/**
|
|
3
|
+
* Absolute source file path as seen by the transform pipeline.
|
|
4
|
+
*/
|
|
5
|
+
filePath: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Alias for filePath, kept explicit for callers that prefer this name.
|
|
9
|
+
*/
|
|
10
|
+
absolutePath: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* File path relative to the plugin root/project root, normalized with forward slashes.
|
|
14
|
+
*/
|
|
15
|
+
relativePath: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Source path normalized for protocol-style URLs. Leading "../" and "./" segments
|
|
19
|
+
* are removed so callers can safely prefix values such as "webpack:///".
|
|
20
|
+
*/
|
|
21
|
+
sourcePath: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Plugin root/project root when known.
|
|
25
|
+
*/
|
|
26
|
+
projectDir: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Default browser-loadable source URL produced by an integration, when available.
|
|
30
|
+
*/
|
|
31
|
+
sourceUrl?: string | null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Customize the CSS sourcemap source path/URL for a transformed source file.
|
|
36
|
+
* Return a bundler-served path such as "/src/styles.ts", "webpack://...",
|
|
37
|
+
* or a dev-server URL. Return null/undefined to keep the integration default.
|
|
38
|
+
*/
|
|
39
|
+
export type GetSourcemapFilePathFn = (info: SourcemapFilePathInfo) => string | null | undefined;
|
|
40
|
+
|
|
41
|
+
export type DefaultSourcemapUrlInput =
|
|
42
|
+
| string
|
|
43
|
+
| Pick<SourcemapFilePathInfo, 'absolutePath' | 'relativePath' | 'sourcePath'>;
|
|
44
|
+
|
|
45
|
+
export function getDefaultSourcemapUrl(input: DefaultSourcemapUrlInput) {
|
|
46
|
+
const sourcePath = typeof input === 'string'
|
|
47
|
+
? input
|
|
48
|
+
: input.sourcePath || input.relativePath || input.absolutePath;
|
|
49
|
+
|
|
50
|
+
const resourcePath = normalizeSourcemapSourcePath(sourcePath);
|
|
51
|
+
|
|
52
|
+
return `source:///${resourcePath}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function normalizeSourcemapSourcePath(filePath: string) {
|
|
56
|
+
return filePath
|
|
57
|
+
.replace(/\\/g, '/')
|
|
58
|
+
.replace(/^(\.\.\/)+/, '')
|
|
59
|
+
.replace(/^\.?\//, '')
|
|
60
|
+
.replace(/\/+/g, '/');
|
|
61
|
+
}
|
package/config/build.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { globalData } from '../utils/global';
|
|
2
|
+
import type { ReplaceProps } from '../utils/type';
|
|
3
|
+
import { CSS_CONFIG, type CssConfig } from './config/css';
|
|
4
|
+
import type { DevRuntimeOptions } from './config/dev';
|
|
5
|
+
import { RUNTIME_CONFIG } from './config/runtime';
|
|
6
|
+
import type { CheckSelectorMode } from './types';
|
|
7
|
+
|
|
8
|
+
export type BuildCssConfig = Partial<CssConfig>;
|
|
9
|
+
|
|
10
|
+
export type BuildDevConfig = ReplaceProps<DevRuntimeOptions, {
|
|
11
|
+
checkSelector?: CheckSelectorMode;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export type BuildConfig = {
|
|
15
|
+
hoist: boolean;
|
|
16
|
+
css: BuildCssConfig;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const BUILD_CONFIG = globalData(
|
|
20
|
+
'config.build',
|
|
21
|
+
() => ({ current: null as BuildConfig | null }),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export function setBuildConfig(config: BuildConfig) {
|
|
25
|
+
BUILD_CONFIG.current = config;
|
|
26
|
+
|
|
27
|
+
RUNTIME_CONFIG.isHoist = config.hoist;
|
|
28
|
+
|
|
29
|
+
if (config.css) {
|
|
30
|
+
Object.assign(CSS_CONFIG, config.css);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { globalData } from '../../utils/global';
|
|
2
|
+
import { LayerPlaceholder } from '../constants';
|
|
3
|
+
import type {
|
|
4
|
+
ClassNameFormat,
|
|
5
|
+
ElementClassNameFormat,
|
|
6
|
+
ScopeClassNameFormat,
|
|
7
|
+
ThemeNameFormat,
|
|
8
|
+
TokenNameFormat,
|
|
9
|
+
} from '../types';
|
|
10
|
+
|
|
11
|
+
export type CssConfig = {
|
|
12
|
+
layer: boolean;
|
|
13
|
+
layers?: string[];
|
|
14
|
+
layerNamespace?: string;
|
|
15
|
+
classNameFormat?: ClassNameFormat;
|
|
16
|
+
scopeClassNameFormat?: ScopeClassNameFormat;
|
|
17
|
+
elementClassNameFormat?: ElementClassNameFormat;
|
|
18
|
+
themeNameFormat?: ThemeNameFormat;
|
|
19
|
+
tokenNameFormat?: TokenNameFormat;
|
|
20
|
+
varNameFormat?: TokenNameFormat;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const CSS_CONFIG_DEFAULT: CssConfig = {
|
|
24
|
+
layer: true,
|
|
25
|
+
layers: [LayerPlaceholder],
|
|
26
|
+
layerNamespace: 'css',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const CSS_CONFIG = globalData<CssConfig>(
|
|
30
|
+
'config.css',
|
|
31
|
+
() => ({ ...CSS_CONFIG_DEFAULT }),
|
|
32
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { globalData } from '../../utils/global';
|
|
2
|
+
import type { NamedAtRuleFormat } from '../types';
|
|
3
|
+
|
|
4
|
+
export type CssExtraConfig = {
|
|
5
|
+
namedRuleFormat: {
|
|
6
|
+
keyframes?: NamedAtRuleFormat;
|
|
7
|
+
fontFace?: NamedAtRuleFormat;
|
|
8
|
+
fontPaletteValues?: NamedAtRuleFormat;
|
|
9
|
+
counterStyle?: NamedAtRuleFormat;
|
|
10
|
+
positionTry?: NamedAtRuleFormat;
|
|
11
|
+
property?: NamedAtRuleFormat;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const CSS_EXTRA_CONFIG_DEFAULT: CssExtraConfig = {
|
|
16
|
+
namedRuleFormat: {},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const CSS_EXTRA_CONFIG = globalData<CssExtraConfig>(
|
|
20
|
+
'config.cssExtra',
|
|
21
|
+
() => ({ ...CSS_EXTRA_CONFIG_DEFAULT }),
|
|
22
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { globalData } from '../../utils/global';
|
|
2
|
+
|
|
3
|
+
export type DebugConfig = {
|
|
4
|
+
isDebugClassNameEnabled: boolean;
|
|
5
|
+
|
|
6
|
+
maxPropertyLength: number;
|
|
7
|
+
maxValueLength: number;
|
|
8
|
+
maxSelectorLength: number;
|
|
9
|
+
maxParentSelectorLength: number;
|
|
10
|
+
maxAtRuleLength: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_DEBUG_CONFIG: DebugConfig = {
|
|
14
|
+
isDebugClassNameEnabled: true,
|
|
15
|
+
|
|
16
|
+
maxPropertyLength: 24,
|
|
17
|
+
maxValueLength: 8,
|
|
18
|
+
maxSelectorLength: 8,
|
|
19
|
+
maxParentSelectorLength: 8,
|
|
20
|
+
maxAtRuleLength: 10,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const DEBUG_CONFIG = globalData<DebugConfig>(
|
|
24
|
+
'config.debug',
|
|
25
|
+
() => ({ ...DEFAULT_DEBUG_CONFIG }),
|
|
26
|
+
);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { globalData } from '../../utils/global';
|
|
2
|
+
import { unsetAll } from '../../utils/object';
|
|
3
|
+
import type { BuildDevConfig } from '../build';
|
|
4
|
+
import type { SourcemapLocationMode, StylePriorityMode } from '../types';
|
|
5
|
+
import { RUNTIME_CONFIG } from './runtime';
|
|
6
|
+
|
|
7
|
+
export type DevConfig = {
|
|
8
|
+
isDev: boolean;
|
|
9
|
+
|
|
10
|
+
isCheckSelectorEnabled: boolean;
|
|
11
|
+
isSourcemapEnabled: boolean;
|
|
12
|
+
isLocalClassNameEnabled: boolean;
|
|
13
|
+
|
|
14
|
+
sheetMaxRules: number;
|
|
15
|
+
sheetStyleTagNonce: string | null;
|
|
16
|
+
|
|
17
|
+
stylePriorityMode: StylePriorityMode;
|
|
18
|
+
sourcemapLocationMode: SourcemapLocationMode;
|
|
19
|
+
|
|
20
|
+
isElementClassNameEnabled: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const DEV_CONFIG_DEFAULT: DevConfig = {
|
|
24
|
+
isDev: false,
|
|
25
|
+
|
|
26
|
+
isCheckSelectorEnabled: true,
|
|
27
|
+
isSourcemapEnabled: true,
|
|
28
|
+
isLocalClassNameEnabled: true,
|
|
29
|
+
|
|
30
|
+
sheetMaxRules: 1000,
|
|
31
|
+
sheetStyleTagNonce: null,
|
|
32
|
+
|
|
33
|
+
stylePriorityMode: 'layer',
|
|
34
|
+
sourcemapLocationMode: 'style',
|
|
35
|
+
|
|
36
|
+
isElementClassNameEnabled: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type PartialDevConfig = {
|
|
40
|
+
config: Partial<DevConfig> | null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const IS_DEV = globalData<{ isDev: boolean; }>(
|
|
44
|
+
'config.dev.isDev',
|
|
45
|
+
() => ({ isDev: false }),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export const DEV_CONFIG = globalData<DevConfig>(
|
|
49
|
+
'config.dev',
|
|
50
|
+
() => ({ ...DEV_CONFIG_DEFAULT }),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const configPlugin = globalData<PartialDevConfig>(
|
|
54
|
+
'config.dev.plugin',
|
|
55
|
+
() => ({ config: null }),
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const configBase = globalData<PartialDevConfig>(
|
|
59
|
+
'config.dev.base',
|
|
60
|
+
() => ({ config: null }),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const configUtils = globalData<PartialDevConfig>(
|
|
64
|
+
'config.dev.utils',
|
|
65
|
+
() => ({ config: null }),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export type DevRuntimeOptions = {
|
|
69
|
+
priorityMode?: StylePriorityMode | null;
|
|
70
|
+
sourcemapMode?: SourcemapLocationMode | null;
|
|
71
|
+
elementClassName?: boolean | null;
|
|
72
|
+
checkSelector?: boolean | null;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export function getBuildDevConfig() {
|
|
76
|
+
return configPlugin.config;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function setBuildDevConfig(config: BuildDevConfig) {
|
|
80
|
+
const checkSelector = config.checkSelector === 'force' ? false : config.checkSelector;
|
|
81
|
+
|
|
82
|
+
IS_DEV.isDev = true;
|
|
83
|
+
|
|
84
|
+
setOptions(configPlugin, { ...config, checkSelector }, null);
|
|
85
|
+
rebuildDevConfig();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function setDevUtilsRuntimeOptions(options: DevRuntimeOptions | null) {
|
|
89
|
+
setOptions(configUtils, options, null);
|
|
90
|
+
rebuildDevConfig();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function setDevRuntimeOptions(options: DevRuntimeOptions | null) {
|
|
94
|
+
setOptions(configBase, options, { ...DEV_CONFIG_DEFAULT });
|
|
95
|
+
rebuildDevConfig();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function rebuildDevConfig() {
|
|
99
|
+
unsetAll(DEV_CONFIG);
|
|
100
|
+
|
|
101
|
+
Object.assign(
|
|
102
|
+
DEV_CONFIG,
|
|
103
|
+
DEV_CONFIG_DEFAULT,
|
|
104
|
+
configBase.config,
|
|
105
|
+
configPlugin.config,
|
|
106
|
+
configUtils.config,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
DEV_CONFIG.isDev = IS_DEV.isDev;
|
|
110
|
+
|
|
111
|
+
RUNTIME_CONFIG.changes += 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function setOptions(
|
|
115
|
+
partialConfig: PartialDevConfig,
|
|
116
|
+
options: DevRuntimeOptions | null,
|
|
117
|
+
defaultConfig: DevConfig | null,
|
|
118
|
+
) {
|
|
119
|
+
if (!options) {
|
|
120
|
+
partialConfig.config = defaultConfig;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!partialConfig.config) {
|
|
125
|
+
partialConfig.config = defaultConfig || {};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const config = partialConfig.config;
|
|
129
|
+
|
|
130
|
+
if (options.priorityMode) {
|
|
131
|
+
config.stylePriorityMode = options.priorityMode;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (options.sourcemapMode) {
|
|
135
|
+
config.sourcemapLocationMode = options.sourcemapMode;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (typeof options.elementClassName === 'boolean') {
|
|
139
|
+
config.isElementClassNameEnabled = options.elementClassName;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (typeof options.checkSelector === 'boolean') {
|
|
143
|
+
config.isCheckSelectorEnabled = options.checkSelector;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { globalData } from '../../utils/global';
|
|
2
|
+
import { getCacheTTL } from '../utils';
|
|
3
|
+
|
|
4
|
+
export type RuntimeConfig = {
|
|
5
|
+
changes: number;
|
|
6
|
+
|
|
7
|
+
isPlugin: boolean;
|
|
8
|
+
isHoist: boolean;
|
|
9
|
+
isExtracted: boolean;
|
|
10
|
+
isRSC: boolean;
|
|
11
|
+
|
|
12
|
+
runtimeCacheTTL: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const RUNTIME_CONFIG_DEFAULT: RuntimeConfig = {
|
|
16
|
+
changes: 0,
|
|
17
|
+
|
|
18
|
+
isPlugin: false,
|
|
19
|
+
isHoist: false,
|
|
20
|
+
isExtracted: false,
|
|
21
|
+
isRSC: false,
|
|
22
|
+
|
|
23
|
+
runtimeCacheTTL: getCacheTTL(true),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const RUNTIME_CONFIG = globalData<RuntimeConfig>(
|
|
27
|
+
'config.runtime',
|
|
28
|
+
() => ({ ...RUNTIME_CONFIG_DEFAULT }),
|
|
29
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BUILD_CONFIG } from './build';
|
|
2
|
+
import { CSS_CONFIG, type CssConfig } from './config/css';
|
|
3
|
+
import { RUNTIME_CONFIG } from './config/runtime';
|
|
4
|
+
import { getCacheTTL } from './utils';
|
|
5
|
+
|
|
6
|
+
export type RuntimeCssOptions = Partial<CssConfig>;
|
|
7
|
+
|
|
8
|
+
export type ConfigureStyleRuntimeOptions = {
|
|
9
|
+
css?: RuntimeCssOptions;
|
|
10
|
+
cacheTTL?: boolean | number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function configureStyleRuntime(options: ConfigureStyleRuntimeOptions = {}) {
|
|
14
|
+
if (options.css) {
|
|
15
|
+
checkBuildConfig('css');
|
|
16
|
+
Object.assign(CSS_CONFIG, options.css);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (options.cacheTTL !== undefined) {
|
|
20
|
+
RUNTIME_CONFIG.runtimeCacheTTL = getCacheTTL(options.cacheTTL);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function checkBuildConfig(field: string) {
|
|
25
|
+
if (!BUILD_CONFIG.current) return;
|
|
26
|
+
|
|
27
|
+
throw new Error(`Configure "${field}" via plugin options.`);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const LayerPlaceholder = '$layer';
|
package/config/index.ts
ADDED
package/config/types.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type SourcemapLocationMode = 'style' | 'value';
|
|
2
|
+
export type StylePriorityMode = 'layer' | 'sort';
|
|
3
|
+
export type CheckSelectorMode = boolean | 'force';
|
|
4
|
+
|
|
5
|
+
export type ClassNameInfo = {
|
|
6
|
+
atRule: string | null;
|
|
7
|
+
scopeSelector: string | null;
|
|
8
|
+
selector: string | null;
|
|
9
|
+
property: string;
|
|
10
|
+
value: string | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ScopeClassNameInfo = {
|
|
14
|
+
className: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ElementClassNameInfo = {
|
|
18
|
+
name: string | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type TokenNameInfo = {
|
|
22
|
+
name: string | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type ThemeNameInfo = {
|
|
26
|
+
name: string | null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type NamedAtRuleInfo = {
|
|
30
|
+
name: string | null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type VarNameInfo = {
|
|
34
|
+
name: string | null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ClassNameFormatFn = (info: ClassNameInfo) => string;
|
|
38
|
+
export type ClassNameFormat = string | ClassNameFormatFn;
|
|
39
|
+
|
|
40
|
+
export type ScopeClassNameFormatFn = (info: ScopeClassNameInfo) => string;
|
|
41
|
+
export type ScopeClassNameFormat = string | ScopeClassNameFormatFn;
|
|
42
|
+
|
|
43
|
+
export type ElementClassNameFormatFn = (info: ElementClassNameInfo) => string;
|
|
44
|
+
export type ElementClassNameFormat = string | ElementClassNameFormatFn;
|
|
45
|
+
|
|
46
|
+
export type TokenNameFormatFn = (info: TokenNameInfo) => string;
|
|
47
|
+
export type TokenNameFormat = string | TokenNameFormatFn;
|
|
48
|
+
|
|
49
|
+
export type ThemeNameFormatFn = (info: ThemeNameInfo) => string;
|
|
50
|
+
export type ThemeNameFormat = string | ThemeNameFormatFn;
|
|
51
|
+
|
|
52
|
+
export type NamedAtRuleFormatFn = (info: NamedAtRuleInfo) => string;
|
|
53
|
+
export type NamedAtRuleFormat = string | NamedAtRuleFormatFn;
|
|
54
|
+
|
|
55
|
+
export type VarNameFormatFn = (info: VarNameInfo) => string;
|
|
56
|
+
export type VarNameFormat = string | VarNameFormatFn;
|
package/config/utils.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildCounterStyleCss, type CounterStyleObject } from '../atomic/atRule/counterStyle';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export type { CounterStyleObject };
|
|
8
|
+
|
|
9
|
+
const idCounter = createIdCounter('counterStyle');
|
|
10
|
+
|
|
11
|
+
export function createCounterStyle(descriptors: CounterStyleObject): AtRuleRef;
|
|
12
|
+
export function createCounterStyle(descriptors: CounterStyleObject, stableId?: StableId): AtRuleRef {
|
|
13
|
+
return createNamedAtRuleRef({
|
|
14
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.counterStyle,
|
|
15
|
+
buildCss: buildCounterStyleCss,
|
|
16
|
+
value: descriptors,
|
|
17
|
+
idCounter,
|
|
18
|
+
stableId,
|
|
19
|
+
});
|
|
20
|
+
}
|
package/css/fontFace.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { buildFontFaceCss, type FontFaceObject } from '../atomic/atRule/fontFace';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export { fontSrc } from '../atomic/atRule/fontSrc';
|
|
8
|
+
export type { FontFaceObject };
|
|
9
|
+
|
|
10
|
+
const idCounter = createIdCounter('fontFace');
|
|
11
|
+
|
|
12
|
+
export function createFontFace(descriptors: FontFaceObject): AtRuleRef;
|
|
13
|
+
export function createFontFace(descriptors: FontFaceObject, stableId?: StableId): AtRuleRef {
|
|
14
|
+
if (typeof descriptors.src !== 'string') {
|
|
15
|
+
throw new Error('createFontFace "src" must be a static string');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return createNamedAtRuleRef({
|
|
19
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontFace,
|
|
20
|
+
buildCss: buildFontFaceCss,
|
|
21
|
+
value: descriptors,
|
|
22
|
+
idCounter,
|
|
23
|
+
stableId,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildFontPaletteValuesCss, type FontPaletteValuesObject } from '../atomic/atRule/fontPaletteValues';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export type { FontPaletteValuesObject };
|
|
8
|
+
|
|
9
|
+
const idCounter = createIdCounter('fontPaletteValues');
|
|
10
|
+
|
|
11
|
+
export function createFontPaletteValues(descriptors: FontPaletteValuesObject): AtRuleRef;
|
|
12
|
+
export function createFontPaletteValues(descriptors: FontPaletteValuesObject, stableId?: StableId): AtRuleRef {
|
|
13
|
+
return createNamedAtRuleRef({
|
|
14
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.fontPaletteValues,
|
|
15
|
+
buildCss: buildFontPaletteValuesCss,
|
|
16
|
+
value: descriptors,
|
|
17
|
+
idCounter,
|
|
18
|
+
stableId,
|
|
19
|
+
});
|
|
20
|
+
}
|
package/css/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { CSS, CSSProperties, CSSPropertyName } from '../atomic/utils/types';
|
|
2
|
+
|
|
3
|
+
export * from './counterStyle';
|
|
4
|
+
export * from './fontFace';
|
|
5
|
+
export * from './fontPaletteValues';
|
|
6
|
+
export * from './keyframes';
|
|
7
|
+
export * from './positionTry';
|
|
8
|
+
export * from './property';
|
package/css/keyframes.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildKeyframesCss, type KeyframesObject } from '../atomic/atRule/keyframes';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export type { KeyframesObject };
|
|
8
|
+
|
|
9
|
+
const idCounter = createIdCounter('keyframes');
|
|
10
|
+
|
|
11
|
+
export function createKeyframes(frames: KeyframesObject): AtRuleRef;
|
|
12
|
+
export function createKeyframes(frames: KeyframesObject, stableId?: StableId): AtRuleRef {
|
|
13
|
+
return createNamedAtRuleRef({
|
|
14
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.keyframes,
|
|
15
|
+
buildCss: buildKeyframesCss,
|
|
16
|
+
value: frames,
|
|
17
|
+
idCounter,
|
|
18
|
+
stableId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildPositionTryCss, type PositionTryObject } from '../atomic/atRule/positionTry';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export type { PositionTryObject };
|
|
8
|
+
|
|
9
|
+
const idCounter = createIdCounter('positionTry');
|
|
10
|
+
|
|
11
|
+
export function createPositionTry(descriptors: PositionTryObject): AtRuleRef;
|
|
12
|
+
export function createPositionTry(descriptors: PositionTryObject, stableId?: StableId): AtRuleRef {
|
|
13
|
+
return createNamedAtRuleRef({
|
|
14
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.positionTry,
|
|
15
|
+
buildCss: buildPositionTryCss,
|
|
16
|
+
value: descriptors,
|
|
17
|
+
idCounter,
|
|
18
|
+
stableId,
|
|
19
|
+
});
|
|
20
|
+
}
|
package/css/property.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { buildPropertyCss, type PropertyObject } from '../atomic/atRule/property';
|
|
2
|
+
import { CSS_EXTRA_CONFIG } from '../config/config/css_extra';
|
|
3
|
+
import type { AtRuleRef } from '../style/valueRef';
|
|
4
|
+
import { createIdCounter, type StableId } from '../utils/id';
|
|
5
|
+
import { createNamedAtRuleRef } from './utils';
|
|
6
|
+
|
|
7
|
+
export type { PropertyObject };
|
|
8
|
+
|
|
9
|
+
const idCounter = createIdCounter('property');
|
|
10
|
+
|
|
11
|
+
export function createProperty(descriptors: PropertyObject): AtRuleRef;
|
|
12
|
+
export function createProperty(descriptors: PropertyObject, stableId?: StableId): AtRuleRef;
|
|
13
|
+
export function createProperty(name: string, descriptors: PropertyObject): AtRuleRef;
|
|
14
|
+
export function createProperty(
|
|
15
|
+
nameOrDescriptors: string | PropertyObject,
|
|
16
|
+
descriptorsOrStableId?: PropertyObject | StableId,
|
|
17
|
+
): AtRuleRef {
|
|
18
|
+
const descriptors = typeof nameOrDescriptors === 'string'
|
|
19
|
+
? descriptorsOrStableId as PropertyObject
|
|
20
|
+
: nameOrDescriptors;
|
|
21
|
+
const stableId = typeof nameOrDescriptors === 'string'
|
|
22
|
+
? { name: nameOrDescriptors, id: nameOrDescriptors }
|
|
23
|
+
: descriptorsOrStableId as StableId | undefined;
|
|
24
|
+
|
|
25
|
+
return createNamedAtRuleRef({
|
|
26
|
+
idCounter,
|
|
27
|
+
stableId,
|
|
28
|
+
format: CSS_EXTRA_CONFIG.namedRuleFormat.property,
|
|
29
|
+
value: descriptors,
|
|
30
|
+
buildCss: buildPropertyCss,
|
|
31
|
+
});
|
|
32
|
+
}
|
package/css/utils.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CSS_CONFIG } from '../config/config/css';
|
|
2
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from '../config/types';
|
|
3
|
+
import type { StyleTokenData } from '../style/token';
|
|
4
|
+
import { type AtRuleRef, createAtRuleRef } from '../style/valueRef';
|
|
5
|
+
import { getId, type IdCounter, type StableId } from '../utils/id';
|
|
6
|
+
|
|
7
|
+
export type StableIdInput = StableId;
|
|
8
|
+
|
|
9
|
+
export type BuiltAtRuleCss = {
|
|
10
|
+
name: string;
|
|
11
|
+
css: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type BuildNamedAtRuleCss<Value> = (
|
|
15
|
+
format: NamedAtRuleFormat | null,
|
|
16
|
+
name: string | null,
|
|
17
|
+
id: string,
|
|
18
|
+
value: Value,
|
|
19
|
+
tokens: StyleTokenData[],
|
|
20
|
+
tokenLookup: Set<string>,
|
|
21
|
+
tokenNameFormat: TokenNameFormat | null,
|
|
22
|
+
) => BuiltAtRuleCss;
|
|
23
|
+
|
|
24
|
+
type CreateNamedAtRuleRefConfig<Value> = {
|
|
25
|
+
format: NamedAtRuleFormat | null | undefined;
|
|
26
|
+
value: Value;
|
|
27
|
+
buildCss: BuildNamedAtRuleCss<Value>;
|
|
28
|
+
idCounter: IdCounter;
|
|
29
|
+
stableId: StableId | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function createNamedAtRuleRef<Value>(
|
|
33
|
+
config: CreateNamedAtRuleRefConfig<Value>,
|
|
34
|
+
): AtRuleRef {
|
|
35
|
+
const { id, name } = getId(config.idCounter, config.stableId || null);
|
|
36
|
+
|
|
37
|
+
const tokens: StyleTokenData[] = [];
|
|
38
|
+
const tokenLookup = new Set<string>();
|
|
39
|
+
|
|
40
|
+
const css = config.buildCss(
|
|
41
|
+
config.format || null,
|
|
42
|
+
name,
|
|
43
|
+
id,
|
|
44
|
+
config.value,
|
|
45
|
+
tokens,
|
|
46
|
+
tokenLookup,
|
|
47
|
+
CSS_CONFIG.tokenNameFormat || null,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return createAtRuleRef({
|
|
51
|
+
key: css.name,
|
|
52
|
+
value: css.name,
|
|
53
|
+
css: css.css,
|
|
54
|
+
tokens: tokens.length ? tokens : undefined,
|
|
55
|
+
});
|
|
56
|
+
}
|
package/dev/config.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DEV_CONFIG, type DevRuntimeOptions, setDevRuntimeOptions } from '../config/config/dev';
|
|
2
|
+
import { enableStyleDevUtils, type StyleDevUtilsOptions } from './utils';
|
|
3
|
+
|
|
4
|
+
export type ConfigureStyleDevOptions = DevRuntimeOptions & {
|
|
5
|
+
utils?: StyleDevUtilsOptions;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function configureStyleDev(options: ConfigureStyleDevOptions = {}) {
|
|
9
|
+
const { utils, ...devOptions } = options;
|
|
10
|
+
|
|
11
|
+
DEV_CONFIG.isDev = true;
|
|
12
|
+
|
|
13
|
+
setDevRuntimeOptions(devOptions);
|
|
14
|
+
|
|
15
|
+
if (utils) enableStyleDevUtils(utils);
|
|
16
|
+
}
|