@fluentic/style 0.1.0-beta.10 → 0.1.0-beta.12
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 +12 -0
- package/compiler/compiler/compiler.ts +8 -4
- package/compiler/utils/file_resolver.ts +2 -1
- package/dist/compiler/index.mjs +1 -1
- package/dist/{compiler-C3CEGGtI.mjs → compiler-mCfMhtX4.mjs} +2 -3
- package/dist/{compiler-C3CEGGtI.mjs.map → compiler-mCfMhtX4.mjs.map} +1 -1
- package/dist/{loader-_-VjzlrX.mjs → loader-DUS2i9Zb.mjs} +3 -3
- package/dist/loader-DUS2i9Zb.mjs.map +1 -0
- package/dist/{misc-B76PUnWe.mjs → misc-vGtt_SX7.mjs} +2 -2
- package/dist/{misc-B76PUnWe.mjs.map → misc-vGtt_SX7.mjs.map} +1 -1
- package/dist/plugin/farm/index.mjs +3 -3
- package/dist/plugin/nextjs/index.mjs +34 -18
- package/dist/plugin/nextjs/index.mjs.map +1 -1
- package/dist/plugin/nextjs/loader.mjs +4 -4
- package/dist/plugin/parcel/index.cjs +1 -1
- package/dist/plugin/parcel/index.mjs +2 -2
- package/dist/plugin/parcel/optimizer.cjs +1 -1
- package/dist/plugin/parcel/optimizer.mjs +2 -2
- 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 +2 -2
- package/dist/plugin/vite/index.mjs +3 -3
- package/dist/plugin/webpack/index.mjs +2 -2
- package/dist/plugin/webpack/loader.mjs +2 -2
- package/dist/{registry-w8ET5R7v.mjs → registry-BJqMbdMu.mjs} +2 -2
- package/dist/{registry-w8ET5R7v.mjs.map → registry-BJqMbdMu.mjs.map} +1 -1
- package/dist/{shared-PK52rW6T.cjs → shared-BRUPuZdH.cjs} +2 -3
- package/dist/{shared-PK52rW6T.cjs.map → shared-BRUPuZdH.cjs.map} +1 -1
- package/dist/{shared-C_cYxNzz.mjs → shared-DDzZd0tM.mjs} +4 -4
- package/dist/{shared-C_cYxNzz.mjs.map → shared-DDzZd0tM.mjs.map} +1 -1
- package/dist/{sidecar-BhvmXYsD.mjs → sidecar-BTT0veLU.mjs} +3 -3
- package/dist/{sidecar-BhvmXYsD.mjs.map → sidecar-BTT0veLU.mjs.map} +1 -1
- package/dist/types/adapter/preact.d.ts +1 -0
- package/dist/types/adapter/react.d.ts +1 -0
- package/dist/types/adapter/solid.d.ts +1 -0
- package/dist/types/atomic/atRule/counterStyle.d.ts +10 -0
- package/dist/types/atomic/atRule/fontFace.d.ts +10 -0
- package/dist/types/atomic/atRule/fontPaletteValues.d.ts +10 -0
- package/dist/types/atomic/atRule/fontSrc.d.ts +1 -0
- package/dist/types/atomic/atRule/keyframes.d.ts +13 -0
- package/dist/types/atomic/atRule/positionTry.d.ts +13 -0
- package/dist/types/atomic/atRule/property.d.ts +13 -0
- package/dist/types/atomic/atRule/utils.d.ts +5 -0
- package/dist/types/atomic/className.d.ts +11 -0
- package/dist/types/atomic/debug/className/className.d.ts +9 -0
- package/dist/types/atomic/debug/className/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/data.d.ts +3 -0
- package/dist/types/atomic/debug/property/index.d.ts +1 -0
- package/dist/types/atomic/debug/property/property.d.ts +5 -0
- package/dist/types/atomic/debug/selector.d.ts +2 -0
- package/dist/types/atomic/debug/value.d.ts +5 -0
- package/dist/types/atomic/element.d.ts +5 -0
- package/dist/types/atomic/layer/index.d.ts +3 -0
- package/dist/types/atomic/layer/layer.d.ts +12 -0
- package/dist/types/atomic/layer/types.d.ts +30 -0
- package/dist/types/atomic/layer/utils.d.ts +4 -0
- package/dist/types/atomic/property/index.d.ts +2 -0
- package/dist/types/atomic/property/presets.d.ts +4 -0
- package/dist/types/atomic/property/property.d.ts +3 -0
- package/dist/types/atomic/property/type_maps.d.ts +31 -0
- package/dist/types/atomic/property/types.d.ts +4 -0
- package/dist/types/atomic/rule.d.ts +5 -0
- package/dist/types/atomic/scope.d.ts +3 -0
- package/dist/types/atomic/theme.d.ts +7 -0
- package/dist/types/atomic/token.d.ts +7 -0
- package/dist/types/atomic/utils/cssIdent.d.ts +2 -0
- package/dist/types/atomic/utils/cssVar.d.ts +3 -0
- package/dist/types/atomic/utils/debug.d.ts +4 -0
- package/dist/types/atomic/utils/format.d.ts +5 -0
- package/dist/types/atomic/utils/hash.d.ts +1 -0
- package/dist/types/atomic/utils/selector.d.ts +6 -0
- package/dist/types/atomic/utils/types.d.ts +7 -0
- package/dist/types/atomic/value/index.d.ts +2 -0
- package/dist/types/atomic/value/unitless.d.ts +1 -0
- package/dist/types/atomic/value/value.d.ts +2 -0
- package/dist/types/atomic/var.d.ts +4 -0
- package/dist/types/builder/classname/class_name_builder.d.ts +4 -0
- package/dist/types/builder/classname/fns.d.ts +48 -0
- package/dist/types/builder/classname/index.d.ts +3 -0
- package/dist/types/builder/classname/types.d.ts +18 -0
- package/dist/types/builder/data/check_selector.d.ts +2 -0
- package/dist/types/builder/data/const.d.ts +26 -0
- package/dist/types/builder/data/create.d.ts +13 -0
- package/dist/types/builder/data/data.d.ts +44 -0
- package/dist/types/builder/data/debug.d.ts +38 -0
- package/dist/types/builder/data/index.d.ts +8 -0
- package/dist/types/builder/data/is.d.ts +16 -0
- package/dist/types/builder/data/merge/index.d.ts +2 -0
- package/dist/types/builder/data/merge/scope.d.ts +7 -0
- package/dist/types/builder/data/merge/style.d.ts +6 -0
- package/dist/types/builder/data/merge/utils.d.ts +5 -0
- package/dist/types/builder/data/selector.d.ts +8 -0
- package/dist/types/builder/data/state.d.ts +85 -0
- package/dist/types/builder/extract/index.d.ts +7 -0
- package/dist/types/builder/extract/scope.d.ts +14 -0
- package/dist/types/builder/extract/sheet.d.ts +10 -0
- package/dist/types/builder/extract/slot.d.ts +9 -0
- package/dist/types/builder/extract/style.d.ts +11 -0
- package/dist/types/builder/extract/theme.d.ts +2 -0
- package/dist/types/builder/extract/token.d.ts +7 -0
- package/dist/types/builder/extract/utils.d.ts +28 -0
- package/dist/types/builder/extract/withTokens.d.ts +10 -0
- package/dist/types/builder/index.d.ts +2 -0
- package/dist/types/builder/selector_override.d.ts +5 -0
- package/dist/types/builder/selector_override_core.d.ts +6 -0
- package/dist/types/builder/style_builder.d.ts +15 -0
- package/dist/types/builder/style_data.d.ts +8 -0
- package/dist/types/builder/style_fns.d.ts +14 -0
- package/dist/types/builder/token/data.d.ts +10 -0
- package/dist/types/builder/token/name.d.ts +3 -0
- package/dist/types/builder/token/symbols.d.ts +4 -0
- package/dist/types/builder/types/alias.d.ts +59 -0
- package/dist/types/builder/types/fns.d.ts +115 -0
- package/dist/types/builder/types/index.d.ts +1 -0
- package/dist/types/builder/types/types.d.ts +22 -0
- package/dist/types/builder/utils.d.ts +9 -0
- package/dist/types/compiler/compiler/cache.d.ts +24 -0
- package/dist/types/compiler/compiler/compiler.d.ts +28 -0
- package/dist/types/compiler/compiler/constants.d.ts +6 -0
- package/dist/types/compiler/compiler/index.d.ts +4 -0
- package/dist/types/compiler/compiler/types.d.ts +53 -0
- package/dist/types/compiler/cssProp.d.ts +8 -0
- package/dist/types/compiler/extract/collector.d.ts +8 -0
- package/dist/types/compiler/extract/extract.d.ts +6 -0
- package/dist/types/compiler/extract/index.d.ts +3 -0
- package/dist/types/compiler/extract/types.d.ts +22 -0
- package/dist/types/compiler/index.d.ts +3 -0
- package/dist/types/compiler/transform/cssProp/index.d.ts +1 -0
- package/dist/types/compiler/transform/cssProp/plugin.d.ts +13 -0
- package/dist/types/compiler/transform/debug/index.d.ts +2 -0
- package/dist/types/compiler/transform/debug/plugin.d.ts +34 -0
- package/dist/types/compiler/transform/debug/transform.d.ts +7 -0
- package/dist/types/compiler/transform/debug/utils/debug_data.d.ts +11 -0
- package/dist/types/compiler/transform/debug/utils/source_url.d.ts +2 -0
- package/dist/types/compiler/transform/evaluator/evaluator.d.ts +41 -0
- package/dist/types/compiler/transform/evaluator/index.d.ts +3 -0
- package/dist/types/compiler/transform/evaluator/tracer.d.ts +8 -0
- package/dist/types/compiler/transform/evaluator/types.d.ts +21 -0
- package/dist/types/compiler/transform/extract/chain/chain.d.ts +18 -0
- package/dist/types/compiler/transform/extract/chain/extract_chain.d.ts +19 -0
- package/dist/types/compiler/transform/extract/chain/index.d.ts +3 -0
- package/dist/types/compiler/transform/extract/chain/types.d.ts +32 -0
- package/dist/types/compiler/transform/extract/index.d.ts +2 -0
- package/dist/types/compiler/transform/extract/plugin.d.ts +20 -0
- package/dist/types/compiler/transform/extract/transform.d.ts +10 -0
- package/dist/types/compiler/transform/extract/utils/imports.d.ts +3 -0
- package/dist/types/compiler/transform/extract/utils/replacement.d.ts +9 -0
- package/dist/types/compiler/transform/extract/utils/slot.d.ts +4 -0
- package/dist/types/compiler/transform/extract/utils/state.d.ts +34 -0
- package/dist/types/compiler/transform/extract/utils/theme.d.ts +9 -0
- package/dist/types/compiler/transform/extract/utils/token.d.ts +1 -0
- package/dist/types/compiler/transform/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/index.d.ts +5 -0
- package/dist/types/compiler/transform/syntax/isStaticStyleValue.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/isStyleChainCall.d.ts +2 -0
- package/dist/types/compiler/transform/syntax/static_ids.d.ts +16 -0
- package/dist/types/compiler/transform/syntax/types.d.ts +4 -0
- package/dist/types/compiler/transform/syntax/utils.d.ts +5 -0
- package/dist/types/compiler/transform/utils/babel.d.ts +21 -0
- package/dist/types/compiler/transform/utils/import.d.ts +2 -0
- package/dist/types/compiler/transform/utils/path.d.ts +1 -0
- package/dist/types/compiler/transform/utils/selector.d.ts +18 -0
- package/dist/types/compiler/utils/constants.d.ts +68 -0
- package/dist/types/compiler/utils/file_resolver.d.ts +12 -0
- package/dist/types/compiler/utils/import_source.d.ts +28 -0
- package/dist/types/compiler/utils/imports.d.ts +6 -0
- package/dist/types/compiler/utils/path.d.ts +4 -0
- package/dist/types/compiler/utils/sourcemap.d.ts +36 -0
- package/dist/types/config/build.d.ts +20 -0
- package/dist/types/config/config/check.d.ts +11 -0
- package/dist/types/config/config/css.d.ts +23 -0
- package/dist/types/config/config/css_extra.d.ts +13 -0
- package/dist/types/config/config/debug.d.ts +14 -0
- package/dist/types/config/config/dev.d.ts +36 -0
- package/dist/types/config/config/runtime.d.ts +10 -0
- package/dist/types/config/configure.d.ts +12 -0
- package/dist/types/config/constants.d.ts +1 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/types.d.ts +47 -0
- package/dist/types/config/utils.d.ts +2 -0
- package/dist/types/css/counterStyle.d.ts +4 -0
- package/dist/types/css/fontFace.d.ts +5 -0
- package/dist/types/css/fontPaletteValues.d.ts +4 -0
- package/dist/types/css/index.d.ts +9 -0
- package/dist/types/css/keyframes.d.ts +4 -0
- package/dist/types/css/positionTry.d.ts +4 -0
- package/dist/types/css/property.d.ts +7 -0
- package/dist/types/css/sheet.d.ts +7 -0
- package/dist/types/css/styleTarget.d.ts +9 -0
- package/dist/types/css/utils.d.ts +19 -0
- package/dist/types/dev/config.d.ts +6 -0
- package/dist/types/dev/fns.d.ts +14 -0
- package/dist/types/dev/index.d.ts +2 -0
- package/dist/types/dev/trace.d.ts +8 -0
- package/dist/types/dev/utils.d.ts +5 -0
- package/dist/types/dialect/extracted/index.d.ts +1 -0
- package/dist/types/dialect/index.d.ts +1 -0
- package/dist/types/dialect/namedTokens.d.ts +9 -0
- package/dist/types/entry/dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/dev/config.d.ts +2 -0
- package/dist/types/entry/dev/css.d.ts +2 -0
- package/dist/types/entry/dev/index.d.ts +3 -0
- package/dist/types/entry/dev/jsx_dev_runtime.d.ts +3 -0
- package/dist/types/entry/dev/sheet.d.ts +1 -0
- package/dist/types/entry/prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/prod/config.d.ts +2 -0
- package/dist/types/entry/prod/config_debug.d.ts +2 -0
- package/dist/types/entry/prod/css.d.ts +2 -0
- package/dist/types/entry/prod/extract.d.ts +1 -0
- package/dist/types/entry/prod/index.d.ts +2 -0
- package/dist/types/entry/prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/prod/runtime.d.ts +8 -0
- package/dist/types/entry/rsc_dev/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_dev/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_dev/config.d.ts +2 -0
- package/dist/types/entry/rsc_dev/css.d.ts +2 -0
- package/dist/types/entry/rsc_dev/index.d.ts +2 -0
- package/dist/types/entry/rsc_dev/server.d.ts +10 -0
- package/dist/types/entry/rsc_prod/adapter/preact.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/react.d.ts +1 -0
- package/dist/types/entry/rsc_prod/adapter/solid.d.ts +1 -0
- package/dist/types/entry/rsc_prod/config.d.ts +2 -0
- package/dist/types/entry/rsc_prod/config_debug.d.ts +2 -0
- package/dist/types/entry/rsc_prod/css.d.ts +2 -0
- package/dist/types/entry/rsc_prod/index.d.ts +2 -0
- package/dist/types/entry/rsc_prod/jsx_runtime.d.ts +2 -0
- package/dist/types/entry/rsc_prod/runtime.d.ts +4 -0
- package/dist/types/entry/rsc_prod/server.d.ts +6 -0
- package/dist/types/entry/shared/config.d.ts +1 -0
- package/dist/types/entry/shared/config_debug.d.ts +1 -0
- package/dist/types/entry/shared/config_dev.d.ts +1 -0
- package/dist/types/entry/shared/dev.d.ts +1 -0
- package/dist/types/entry/shared/prod.d.ts +1 -0
- package/dist/types/entry/shared/utils.d.ts +2 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/jsx/extracted/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/rsc_extracted/jsx_runtime.d.ts +2 -0
- package/dist/types/jsx/runtime/jsx_dev_runtime.d.ts +6 -0
- package/dist/types/jsx/runtime/jsx_runtime.d.ts +7 -0
- package/dist/types/jsx/types/index.d.ts +1 -0
- package/dist/types/jsx/types/preact.d.ts +12 -0
- package/dist/types/jsx/types/react.d.ts +10 -0
- package/dist/types/jsx/types/solid.d.ts +12 -0
- package/dist/types/jsx/utils.d.ts +19 -0
- package/dist/types/plugin/bundler/farm/index.d.ts +1 -0
- package/dist/types/plugin/bundler/farm/plugin.d.ts +91 -0
- package/dist/types/plugin/bundler/parcel/index.d.ts +1 -0
- package/dist/types/plugin/bundler/parcel/optimizer.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/parcel/resolver.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/runtime.d.ts +3 -0
- package/dist/types/plugin/bundler/parcel/shared.d.ts +37 -0
- package/dist/types/plugin/bundler/parcel/transformer.d.ts +3 -0
- package/dist/types/plugin/bundler/rspack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/rspack/plugin.d.ts +7 -0
- package/dist/types/plugin/bundler/vite/index.d.ts +1 -0
- package/dist/types/plugin/bundler/vite/plugin.d.ts +6 -0
- package/dist/types/plugin/bundler/vite/state.d.ts +55 -0
- package/dist/types/plugin/bundler/webpack/index.d.ts +1 -0
- package/dist/types/plugin/bundler/webpack/loader.d.ts +2 -0
- package/dist/types/plugin/bundler/webpack/plugin.d.ts +11 -0
- package/dist/types/plugin/bundler/webpack/shared/loader.d.ts +31 -0
- package/dist/types/plugin/bundler/webpack/shared/registry.d.ts +4 -0
- package/dist/types/plugin/bundler/webpack/utils.d.ts +18 -0
- package/dist/types/plugin/nextjs/constants.d.ts +3 -0
- package/dist/types/plugin/nextjs/html.d.ts +1 -0
- package/dist/types/plugin/nextjs/index.d.ts +2 -0
- package/dist/types/plugin/nextjs/loader.d.ts +3 -0
- package/dist/types/plugin/nextjs/plugin.d.ts +5 -0
- package/dist/types/plugin/nextjs/types.d.ts +21 -0
- package/dist/types/plugin/nextjs/utils.d.ts +59 -0
- package/dist/types/plugin/utils/cache/css_cache.d.ts +34 -0
- package/dist/types/plugin/utils/cache/file.d.ts +4 -0
- package/dist/types/plugin/utils/cache/index.d.ts +2 -0
- package/dist/types/plugin/utils/compiler.d.ts +40 -0
- package/dist/types/plugin/utils/constants.d.ts +4 -0
- package/dist/types/plugin/utils/cssMarker.d.ts +4 -0
- package/dist/types/plugin/utils/cssOutput.d.ts +10 -0
- package/dist/types/plugin/utils/filter.d.ts +14 -0
- package/dist/types/plugin/utils/imports.d.ts +3 -0
- package/dist/types/plugin/utils/index.d.ts +10 -0
- package/dist/types/plugin/utils/injection.d.ts +3 -0
- package/dist/types/plugin/utils/misc.d.ts +1 -0
- package/dist/types/plugin/utils/runtimeEntry.d.ts +8 -0
- package/dist/types/plugin/utils/sidecar/index.d.ts +1 -0
- package/dist/types/plugin/utils/sidecar/server.d.ts +19 -0
- package/dist/types/plugin/utils/sidecar/sidecar.d.ts +17 -0
- package/dist/types/plugin/utils/sidecar/utils.d.ts +33 -0
- package/dist/types/plugin/utils/sourcemap.d.ts +9 -0
- package/dist/types/plugin/utils/virtual.d.ts +12 -0
- package/dist/types/presets/tailwind/classname/index.d.ts +2 -0
- package/dist/types/presets/tailwind/classname/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/classname/types.d.ts +27 -0
- package/dist/types/presets/tailwind/index.d.ts +5 -0
- package/dist/types/presets/tailwind/selectors.d.ts +68 -0
- package/dist/types/presets/tailwind/style/index.d.ts +2 -0
- package/dist/types/presets/tailwind/style/transform.d.ts +8 -0
- package/dist/types/presets/tailwind/style/types.d.ts +149 -0
- package/dist/types/presets/tailwind/theme.d.ts +477 -0
- package/dist/types/presets/tailwind/types.d.ts +53 -0
- package/dist/types/runtime/adapter/utils.d.ts +12 -0
- package/dist/types/runtime/core/cache/combine.d.ts +6 -0
- package/dist/types/runtime/core/cache/combineRuntime.d.ts +1 -0
- package/dist/types/runtime/core/cache/item.d.ts +15 -0
- package/dist/types/runtime/core/cache/itemWithResolver.d.ts +4 -0
- package/dist/types/runtime/core/cache/pool.d.ts +16 -0
- package/dist/types/runtime/core/cache/prop.d.ts +19 -0
- package/dist/types/runtime/core/cache/propCache.d.ts +12 -0
- package/dist/types/runtime/core/cache/resolvedItem.d.ts +5 -0
- package/dist/types/runtime/core/cache/result.d.ts +9 -0
- package/dist/types/runtime/core/cache/stateItem.d.ts +8 -0
- package/dist/types/runtime/core/cache/token.d.ts +2 -0
- package/dist/types/runtime/core/cache/tokenValues.d.ts +26 -0
- package/dist/types/runtime/core/cache/utils/tree.d.ts +12 -0
- package/dist/types/runtime/core/cache/utils/walk.d.ts +1 -0
- package/dist/types/runtime/core/className.d.ts +18 -0
- package/dist/types/runtime/core/combinedStyle.d.ts +20 -0
- package/dist/types/runtime/core/createTransformElement.d.ts +4 -0
- package/dist/types/runtime/core/elementMarker.d.ts +12 -0
- package/dist/types/runtime/core/elementMarkerData.d.ts +7 -0
- package/dist/types/runtime/core/getClassName.d.ts +4 -0
- package/dist/types/runtime/core/getSheetRules.d.ts +3 -0
- package/dist/types/runtime/core/getToken.d.ts +3 -0
- package/dist/types/runtime/core/index.d.ts +5 -0
- package/dist/types/runtime/core/jsx.d.ts +1 -0
- package/dist/types/runtime/core/resolveClassNameRuntime.d.ts +8 -0
- package/dist/types/runtime/env.d.ts +2 -0
- package/dist/types/runtime/extract/combineStyle.d.ts +27 -0
- package/dist/types/runtime/extract/getClassName.d.ts +10 -0
- package/dist/types/runtime/extract/index.d.ts +6 -0
- package/dist/types/runtime/extract/jsx.d.ts +10 -0
- package/dist/types/runtime/extract/token.d.ts +5 -0
- package/dist/types/runtime/extract/tokenResolver.d.ts +2 -0
- package/dist/types/runtime/rsc/constants.d.ts +4 -0
- package/dist/types/runtime/rsc/dev.d.ts +6 -0
- package/dist/types/runtime/rsc/getClassName.d.ts +24 -0
- package/dist/types/runtime/rsc/index.d.ts +1 -0
- package/dist/types/runtime/rsc/jsx.d.ts +1 -0
- package/dist/types/runtime/rsc/observer.d.ts +5 -0
- package/dist/types/runtime/rsc/styleStore.d.ts +5 -0
- package/dist/types/runtime/sheet/element.d.ts +2 -0
- package/dist/types/runtime/sheet/global.d.ts +3 -0
- package/dist/types/runtime/sheet/index.d.ts +3 -0
- package/dist/types/runtime/sheet/insert.d.ts +5 -0
- package/dist/types/runtime/sheet/rule.d.ts +8 -0
- package/dist/types/runtime/sheet/rules.d.ts +10 -0
- package/dist/types/runtime/sheet/theme.d.ts +5 -0
- package/dist/types/runtime/style/index.d.ts +3 -0
- package/dist/types/runtime/style/scope.d.ts +4 -0
- package/dist/types/runtime/style/style.d.ts +27 -0
- package/dist/types/runtime/style/token.d.ts +1 -0
- package/dist/types/runtime/types.d.ts +28 -0
- package/dist/types/selector/assert.d.ts +13 -0
- package/dist/types/selector/index.d.ts +5 -0
- package/dist/types/selector/presets/default.d.ts +108 -0
- package/dist/types/selector/presets/index.d.ts +3 -0
- package/dist/types/selector/presets/minimal.d.ts +46 -0
- package/dist/types/selector/presets/selectors.d.ts +62 -0
- package/dist/types/selector/selector.d.ts +12 -0
- package/dist/types/selector/types.d.ts +12 -0
- package/dist/types/selector/validate.d.ts +5 -0
- package/dist/types/sheet/dev/dev_layer.d.ts +4 -0
- package/dist/types/sheet/dev/dev_sort.d.ts +2 -0
- package/dist/types/sheet/dev/index.d.ts +5 -0
- package/dist/types/sheet/dev/utils.d.ts +26 -0
- package/dist/types/sheet/index.d.ts +4 -0
- package/dist/types/sheet/prod.d.ts +2 -0
- package/dist/types/sheet/sheet.d.ts +2 -0
- package/dist/types/sheet/sourcemap.d.ts +11 -0
- package/dist/types/sheet/types.d.ts +29 -0
- package/dist/types/sheet/utils/dom.d.ts +5 -0
- package/dist/types/sheet/utils/index.d.ts +4 -0
- package/dist/types/sheet/utils/layer.d.ts +10 -0
- package/dist/types/sheet/utils/noop.d.ts +2 -0
- package/dist/types/sheet/utils/rule.d.ts +3 -0
- package/dist/types/sheet/utils/sourcemap.d.ts +12 -0
- package/dist/types/style/classname.d.ts +15 -0
- package/dist/types/style/important.d.ts +8 -0
- package/dist/types/style/index.d.ts +12 -0
- package/dist/types/style/keyframes.d.ts +10 -0
- package/dist/types/style/style.d.ts +426 -0
- package/dist/types/style/theme.d.ts +5 -0
- package/dist/types/style/token.d.ts +29 -0
- package/dist/types/style/tokens.d.ts +10 -0
- package/dist/types/style/transform.d.ts +21 -0
- package/dist/types/style/types.d.ts +22 -0
- package/dist/types/style/utils/expose.d.ts +8 -0
- package/dist/types/style/utils/index.d.ts +1 -0
- package/dist/types/style/value.d.ts +12 -0
- package/dist/types/style/valueRef.d.ts +13 -0
- package/dist/types/style/weight.d.ts +9 -0
- package/dist/types/utils/global.d.ts +4 -0
- package/dist/types/utils/hash.d.ts +3 -0
- package/dist/types/utils/id.d.ts +12 -0
- package/dist/types/utils/object.d.ts +10 -0
- package/dist/types/utils/symbol.d.ts +1 -0
- package/dist/types/utils/trace.d.ts +21 -0
- package/dist/types/utils/type.d.ts +11 -0
- package/dist/{utils-DND33M6y.mjs → utils-D4UympcZ.mjs} +3 -3
- package/dist/{utils-DND33M6y.mjs.map → utils-D4UympcZ.mjs.map} +1 -1
- package/dist/{utils-NdisireF.mjs → utils-D75HPJWv.mjs} +4 -4
- package/dist/{utils-NdisireF.mjs.map → utils-D75HPJWv.mjs.map} +1 -1
- package/dist/{webpack-D7QO0bKN.mjs → webpack-_BpgAUEy.mjs} +5 -5
- package/dist/{webpack-D7QO0bKN.mjs.map → webpack-_BpgAUEy.mjs.map} +1 -1
- package/jsx/types/solid.ts +8 -25
- package/package.json +76 -72
- package/plugin/bundler/webpack/shared/loader.ts +4 -0
- package/plugin/nextjs/plugin.ts +48 -28
- package/dist/loader-_-VjzlrX.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as normalizePath } from "./compiler-
|
|
2
|
-
import { C as createPluginCompiler, I as writePluginCacheFile, L as createFileCssCache, M as EXTRACTED_CSS_MARKER, R as createFileCssConfigHash, _ as getStyleRuntimeMode, d as resolvePluginSourcemapFilePath, g as getStyleEntryDefines, h as getPluginBuildDevConfig, m as getPluginBuildConfig, t as formatError, w as getPluginCacheDir } from "./misc-
|
|
3
|
-
import { t as getSourcemapSidecar } from "./sidecar-
|
|
1
|
+
import { s as normalizePath } from "./compiler-mCfMhtX4.mjs";
|
|
2
|
+
import { C as createPluginCompiler, I as writePluginCacheFile, L as createFileCssCache, M as EXTRACTED_CSS_MARKER, R as createFileCssConfigHash, _ as getStyleRuntimeMode, d as resolvePluginSourcemapFilePath, g as getStyleEntryDefines, h as getPluginBuildDevConfig, m as getPluginBuildConfig, t as formatError, w as getPluginCacheDir } from "./misc-vGtt_SX7.mjs";
|
|
3
|
+
import { t as getSourcemapSidecar } from "./sidecar-BTT0veLU.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { Optimizer, Resolver, Runtime, Transformer } from "@parcel/plugin";
|
|
6
6
|
//#region plugin/bundler/parcel/shared.ts
|
|
@@ -129,4 +129,4 @@ function createParcelError(error) {
|
|
|
129
129
|
//#endregion
|
|
130
130
|
export { createParcelError as a, getParcelExtractedCss as c, prependParcelRuntimeImport as d, replaceParcelDefines as f, writeParcelVirtualRuntimeFile as h, Transformer as i, getParcelState as l, writeParcelRuntimeFile as m, Resolver as n, createParcelRuntimeModuleSource as o, writeParcelCssFile as p, Runtime as r, ensureParcelSidecarStarted as s, Optimizer as t, isParcelGeneratedRuntimeFile as u };
|
|
131
131
|
|
|
132
|
-
//# sourceMappingURL=shared-
|
|
132
|
+
//# sourceMappingURL=shared-DDzZd0tM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-DDzZd0tM.mjs","names":[],"sources":["../plugin/bundler/parcel/shared.ts"],"sourcesContent":["import { Optimizer, Resolver, Runtime, Transformer } from '@parcel/plugin';\nimport path from 'node:path';\nimport { normalizePath } from '../../../compiler/utils/path';\nimport type { BuildCssConfig } from '../../../config/build';\nimport {\n createFileCssCache,\n createFileCssConfigHash,\n createPluginCompiler,\n EXTRACTED_CSS_MARKER,\n type FileCssCache,\n getPluginBuildConfig,\n getPluginBuildDevConfig,\n getPluginCacheDir,\n type PluginCompiler,\n type PluginCssOutputOptions,\n type PluginOptions,\n resolvePluginSourcemapFilePath,\n writePluginCacheFile,\n} from '../../utils';\nimport { formatError } from '../../utils/misc';\nimport { getStyleEntryDefines, getStyleRuntimeMode } from '../../utils/runtimeEntry';\nimport { getSourcemapSidecar, type SourcemapSidecar } from '../../utils/sidecar';\n\nexport const PARCEL_RUNTIME_FILE = 'parcel-runtime.js';\nexport const PARCEL_VIRTUAL_RUNTIME_FILE = 'parcel-virtual-runtime.js';\nexport const PARCEL_CSS_FILE = 'parcel-style.css';\n\ntype ParcelPluginOptions = {\n mode?: string;\n projectRoot?: string;\n packageManager?: {\n resolve: (\n id: string,\n from: string,\n options?: Record<string, unknown> | null,\n ) => Promise<{ resolved: string; }>;\n };\n};\n\nexport type ParcelState = PluginCompiler & {\n entryDefines: Record<string, string>;\n cssCache: FileCssCache;\n cssConfig: BuildCssConfig;\n cssConfigHash: string;\n cssOutput: PluginCssOutputOptions | undefined;\n sidecar: SourcemapSidecar | null;\n};\n\nlet state: ParcelState | null = null;\nlet stateKey = '';\n\nexport { Optimizer, Resolver, Runtime, Transformer };\n\nexport function getParcelState(options: ParcelPluginOptions, pluginOptions: PluginOptions = {}) {\n const projectDir = options.projectRoot ?? process.cwd();\n const dev = options.mode !== 'production';\n const cacheDir = getPluginCacheDir(projectDir, pluginOptions.cacheDir);\n const key = JSON.stringify({ projectDir, dev, cacheDir });\n\n if (state && stateKey === key) return state;\n\n const devSourcemap = pluginOptions.devSourcemap ?? (dev ? 'sourceContent' : 'sourceUrl');\n\n const sidecar = devSourcemap === 'sidecarServer'\n ? getSourcemapSidecar({ projectDir, cacheDir })\n : null;\n\n const buildConfig = getPluginBuildConfig(pluginOptions);\n const buildDevConfig = getPluginBuildDevConfig(pluginOptions);\n const cssConfigHash = createFileCssConfigHash(buildConfig.css);\n\n const current = createPluginCompiler({\n projectDir,\n cacheDir,\n dev,\n options: {\n ...pluginOptions,\n devSourcemap,\n getSourcemapFilePath: resolvePluginSourcemapFilePath(\n pluginOptions.getSourcemapFilePath,\n sidecar,\n ),\n },\n runtimeMode: getStyleRuntimeMode(dev),\n });\n\n const cssCache = createFileCssCache({\n cacheDir,\n cacheSubdir: 'parcel-css',\n });\n\n state = {\n ...current,\n cssCache,\n cssConfig: buildConfig.css,\n cssConfigHash,\n cssOutput: pluginOptions.cssOutput,\n sidecar,\n entryDefines: getStyleEntryDefines(\n buildConfig,\n buildDevConfig,\n sidecar?.getBaseUrl() || null,\n ),\n };\n stateKey = key;\n\n return state;\n}\n\nexport async function ensureParcelSidecarStarted(current: ParcelState) {\n await current.sidecar?.ensureStarted();\n\n if (current.sidecar) {\n Object.assign(\n current.entryDefines,\n getStyleEntryDefines(\n getPluginBuildConfig({}),\n getPluginBuildDevConfig({}),\n current.sidecar.getBaseUrl(),\n ),\n );\n }\n}\n\nexport function replaceParcelDefines(code: string, current: ParcelState) {\n let next = code;\n\n for (const [key, value] of Object.entries(current.entryDefines)) {\n next = next.replace(new RegExp(`^\\\\s*declare\\\\s+const\\\\s+${key}\\\\s*:\\\\s*string\\\\s*;\\\\s*\\\\n?`, 'gm'), '');\n next = next.split(key).join(value);\n }\n\n return next;\n}\n\nexport function writeParcelRuntimeFile(current: ParcelState, source: string) {\n return writePluginCacheFile(current, PARCEL_RUNTIME_FILE, source);\n}\n\nexport function writeParcelVirtualRuntimeFile(current: ParcelState, source: string) {\n return writePluginCacheFile(current, PARCEL_VIRTUAL_RUNTIME_FILE, source);\n}\n\nexport function writeParcelCssFile(current: ParcelState) {\n return writePluginCacheFile(current, PARCEL_CSS_FILE, EXTRACTED_CSS_MARKER);\n}\n\nexport function createParcelRuntimeModuleSource(current: ParcelState) {\n const cssFilePath = !current.dev ? writeParcelCssFile(current) : null;\n\n return [\n cssFilePath && `import ${\n JSON.stringify(toParcelImportPath(path.relative(\n current.cacheDir,\n cssFilePath,\n )))\n };`,\n '',\n ].filter(Boolean).join('\\n');\n}\n\nexport function prependParcelRuntimeImport(\n code: string,\n current: ParcelState,\n sourceFilePath: string,\n) {\n const runtimeFilePath = writeParcelVirtualRuntimeFile(\n current,\n createParcelRuntimeModuleSource(current),\n );\n const runtimeImportPath = toParcelImportPath(path.relative(\n path.dirname(sourceFilePath),\n runtimeFilePath,\n ));\n\n if (code.includes(runtimeImportPath)) return code;\n\n return `import ${JSON.stringify(runtimeImportPath)};\\n${code}`;\n}\n\nexport function isParcelGeneratedRuntimeFile(current: ParcelState, filePath: string) {\n const normalized = normalizePath(filePath);\n\n return normalized === normalizePath(resolveParcelCacheFile(current, PARCEL_RUNTIME_FILE)) ||\n normalized === normalizePath(resolveParcelCacheFile(current, PARCEL_VIRTUAL_RUNTIME_FILE));\n}\n\nexport function getParcelExtractedCss(current: ParcelState) {\n const localCss = current.cssCache.getCss({\n ...current.cssConfig,\n configHash: current.cssConfigHash,\n });\n\n if (localCss) return localCss;\n\n let dir = current.projectDir;\n const seen = new Set([current.cacheDir]);\n\n while (true) {\n const cacheDir = getPluginCacheDir(dir);\n\n if (!seen.has(cacheDir)) {\n const css = createFileCssCache({\n cacheDir,\n cacheSubdir: 'parcel-css',\n }).getCss({\n ...current.cssConfig,\n configHash: current.cssConfigHash,\n });\n\n if (css) return css;\n seen.add(cacheDir);\n }\n\n const next = path.dirname(dir);\n if (next === dir) return '';\n dir = next;\n }\n}\n\nexport function resolveParcelCacheFile(current: ParcelState, fileName: string) {\n return path.join(current.cacheDir, fileName);\n}\n\nfunction toParcelImportPath(filePath: string) {\n const normalized = normalizePath(filePath);\n\n return normalized.startsWith('.') ? normalized : `./${normalized}`;\n}\n\nexport function createParcelError(error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n return new Error(formatError(message));\n}\n"],"mappings":";;;;;;AAuBA,MAAa,sBAAsB;AACnC,MAAa,8BAA8B;AAC3C,MAAa,kBAAkB;AAuB/B,IAAI,QAA4B;AAChC,IAAI,WAAW;AAIf,SAAgB,eAAe,SAA8B,gBAA+B,CAAC,GAAG;CAC9F,MAAM,aAAa,QAAQ,eAAe,QAAQ,IAAI;CACtD,MAAM,MAAM,QAAQ,SAAS;CAC7B,MAAM,WAAW,kBAAkB,YAAY,cAAc,QAAQ;CACrE,MAAM,MAAM,KAAK,UAAU;EAAE;EAAY;EAAK;CAAS,CAAC;CAExD,IAAI,SAAS,aAAa,KAAK,OAAO;CAEtC,MAAM,eAAe,cAAc,iBAAiB,MAAM,kBAAkB;CAE5E,MAAM,UAAU,iBAAiB,kBAC7B,oBAAoB;EAAE;EAAY;CAAS,CAAC,IAC5C;CAEJ,MAAM,cAAc,qBAAqB,aAAa;CACtD,MAAM,iBAAiB,wBAAwB,aAAa;CAC5D,MAAM,gBAAgB,wBAAwB,YAAY,GAAG;CAE7D,MAAM,UAAU,qBAAqB;EACnC;EACA;EACA;EACA,SAAS;GACP,GAAG;GACH;GACA,sBAAsB,+BACpB,cAAc,sBACd,OACF;EACF;EACA,aAAa,oBAAoB,GAAG;CACtC,CAAC;CAED,MAAM,WAAW,mBAAmB;EAClC;EACA,aAAa;CACf,CAAC;CAED,QAAQ;EACN,GAAG;EACH;EACA,WAAW,YAAY;EACvB;EACA,WAAW,cAAc;EACzB;EACA,cAAc,qBACZ,aACA,gBACA,SAAS,WAAW,KAAK,IAC3B;CACF;CACA,WAAW;CAEX,OAAO;AACT;AAEA,eAAsB,2BAA2B,SAAsB;CACrE,MAAM,QAAQ,SAAS,cAAc;CAErC,IAAI,QAAQ,SACV,OAAO,OACL,QAAQ,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mBAA4B,CAAC,KACtF,eAAe,cAAc,uBAAuB,SAAA,2BAAoC,CAAC;AAC7F;AAEA,SAAgB,sBAAsB,SAAsB;CAC1D,MAAM,WAAW,QAAQ,SAAS,OAAO;EACvC,GAAG,QAAQ;EACX,YAAY,QAAQ;CACtB,CAAC;CAED,IAAI,UAAU,OAAO;CAErB,IAAI,MAAM,QAAQ;CAClB,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,QAAQ,CAAC;CAEvC,OAAO,MAAM;EACX,MAAM,WAAW,kBAAkB,GAAG;EAEtC,IAAI,CAAC,KAAK,IAAI,QAAQ,GAAG;GACvB,MAAM,MAAM,mBAAmB;IAC7B;IACA,aAAa;GACf,CAAC,EAAE,OAAO;IACR,GAAG,QAAQ;IACX,YAAY,QAAQ;GACtB,CAAC;GAED,IAAI,KAAK,OAAO;GAChB,KAAK,IAAI,QAAQ;EACnB;EAEA,MAAM,OAAO,KAAK,QAAQ,GAAG;EAC7B,IAAI,SAAS,KAAK,OAAO;EACzB,MAAM;CACR;AACF;AAEA,SAAgB,uBAAuB,SAAsB,UAAkB;CAC7E,OAAO,KAAK,KAAK,QAAQ,UAAU,QAAQ;AAC7C;AAEA,SAAS,mBAAmB,UAAkB;CAC5C,MAAM,aAAa,cAAc,QAAQ;CAEzC,OAAO,WAAW,WAAW,GAAG,IAAI,aAAa,KAAK;AACxD;AAEA,SAAgB,kBAAkB,OAAgB;CAChD,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACrE,OAAO,IAAI,MAAM,YAAY,OAAO,CAAC;AACvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as globalData } from "./compiler-
|
|
2
|
-
import { t as formatError } from "./misc-
|
|
1
|
+
import { h as globalData } from "./compiler-mCfMhtX4.mjs";
|
|
2
|
+
import { t as formatError } from "./misc-vGtt_SX7.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { createServer } from "node:http";
|
|
@@ -233,4 +233,4 @@ async function startServer(state) {
|
|
|
233
233
|
//#endregion
|
|
234
234
|
export { getSourcemapSidecar as t };
|
|
235
235
|
|
|
236
|
-
//# sourceMappingURL=sidecar-
|
|
236
|
+
//# sourceMappingURL=sidecar-BTT0veLU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidecar-BhvmXYsD.mjs","names":[],"sources":["../plugin/utils/sidecar/utils.ts","../plugin/utils/sidecar/server.ts","../plugin/utils/sidecar/sidecar.ts"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\n\nexport type GetPortFilePathArgs = {\n cacheDir: string;\n};\n\nexport type GetRoutePathArgs = {\n filePath: string;\n projectDir: string;\n relativePath?: string | null;\n};\n\nexport type CreateSourceUrlArgs = {\n baseUrl: string;\n routePath: string;\n};\n\nexport type NormalizeRoutePathArgs = {\n routePath: string;\n};\n\nexport type ReadCachedPortArgs = {\n filePath: string;\n};\n\nexport type WriteCachedPortArgs = {\n filePath: string;\n port: number;\n};\n\nexport type IsPortUnavailableErrorArgs = {\n error: unknown;\n};\n\nexport function getPortFilePath(args: GetPortFilePathArgs) {\n return path.join(args.cacheDir, 'sidecar', 'port.json');\n}\n\nexport function getRoutePath(args: GetRoutePathArgs) {\n const routePath = normalizeRoutePath(\n args.relativePath || path.relative(args.projectDir, args.filePath),\n );\n\n return routePath || '/' + path.basename(args.filePath);\n}\n\nexport function normalizeSidecarRoutePath(args: NormalizeRoutePathArgs) {\n if (args.routePath.startsWith('source://@')) {\n return normalizeRoutePath(args.routePath.slice('source://'.length));\n }\n\n try {\n const url = new URL(args.routePath, 'http://127.0.0.1');\n return normalizeRoutePath(url.pathname);\n } catch {\n return normalizeRoutePath(args.routePath);\n }\n}\n\nexport function createSourceUrl(args: CreateSourceUrlArgs) {\n return `${args.baseUrl.replace(/\\/+$/, '')}${encodeURI(args.routePath)}`;\n}\n\nexport function getRequestPathname(url: string | undefined) {\n if (!url) return null;\n\n try {\n return decodeURI(new URL(url, 'http://127.0.0.1').pathname);\n } catch {\n return null;\n }\n}\n\nexport function readCachedPort(args: ReadCachedPortArgs) {\n try {\n const file = JSON.parse(readFileSync(args.filePath, 'utf8')) as { port?: unknown; };\n const port = file.port;\n return typeof port === 'number' && Number.isInteger(port) && port > 0 ? port : null;\n } catch {\n return null;\n }\n}\n\nexport function writeCachedPort(args: WriteCachedPortArgs) {\n try {\n mkdirSync(path.dirname(args.filePath), { recursive: true });\n writeFileSync(args.filePath, JSON.stringify({ port: args.port }), 'utf8');\n } catch {\n // The sidecar still works if the sticky-port cache cannot be written.\n }\n}\n\nexport function isPortUnavailableError(args: IsPortUnavailableErrorArgs) {\n if (!(args.error instanceof Error)) return false;\n\n const code = (args.error as NodeJS.ErrnoException).code;\n return code === 'EADDRINUSE' || code === 'EACCES';\n}\n\nfunction normalizeRoutePath(filePath: string) {\n const normalized = filePath\n .replace(/\\\\/g, '/')\n .replace(/^(\\.\\.\\/)+/, '')\n .replace(/^\\.?\\//, '')\n .replace(/\\/+/g, '/');\n\n return normalized ? `/${normalized}` : '';\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { createServer, type Server } from 'node:http';\nimport path from 'node:path';\nimport { formatError } from '../misc';\nimport { getRequestPathname, isPortUnavailableError, readCachedPort, writeCachedPort } from './utils';\n\nexport const SIDECAR_HOST = '127.0.0.1';\n\nexport type CreateSidecarServerArgs = {\n projectDir: string;\n routes: Map<string, string>;\n handlers?: Map<string, SidecarRouteHandler>;\n};\n\nexport type SidecarRouteResponse = {\n body: string | Buffer;\n contentType?: string;\n};\n\nexport type SidecarRouteHandler = () => SidecarRouteResponse | null | Promise<SidecarRouteResponse | null>;\n\nexport type StartSidecarServerArgs = {\n host?: string;\n portFilePath: string;\n server: Server;\n};\n\nexport function createSidecarServer(args: CreateSidecarServerArgs) {\n return createServer(async (req, res) => {\n const pathname = getRequestPathname(req.url);\n const handler = pathname ? args.handlers?.get(pathname) : null;\n\n if (handler) {\n const response = await handler();\n\n if (!response) {\n res.statusCode = 404;\n res.end('Not found');\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Content-Type', response.contentType ?? 'text/plain; charset=utf-8');\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n res.statusCode = 200;\n res.end(response.body);\n return;\n }\n\n const filePath = pathname\n ? args.routes.get(pathname) ?? getProjectSourcePath(args.projectDir, pathname)\n : null;\n\n if (!filePath || !existsSync(filePath)) {\n res.statusCode = 404;\n res.end('Not found');\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Content-Type', 'text/plain; charset=utf-8');\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n res.statusCode = 200;\n res.end(readFileSync(filePath, 'utf8'));\n });\n}\n\nfunction getProjectSourcePath(projectDir: string, pathname: string) {\n const sourcePath = pathname\n .replace(/^\\/+/, '')\n .replace(/^@\\/?/, '');\n\n if (!sourcePath || sourcePath.startsWith('..')) return null;\n\n const filePath = path.resolve(projectDir, sourcePath);\n const projectPath = path.resolve(projectDir);\n\n return filePath === projectPath || filePath.startsWith(projectPath + path.sep)\n ? filePath\n : null;\n}\n\nexport async function startSidecarServer(args: StartSidecarServerArgs) {\n const host = args.host ?? SIDECAR_HOST;\n const cachedPort = readCachedPort({ filePath: args.portFilePath });\n\n if (cachedPort !== null) {\n try {\n return await listen({ server: args.server, host, port: cachedPort });\n } catch (error) {\n if (!isPortUnavailableError({ error })) throw error;\n }\n }\n\n const port = await listen({ server: args.server, host, port: 0 });\n\n writeCachedPort({ filePath: args.portFilePath, port });\n\n return port;\n}\n\ntype ListenArgs = {\n host: string;\n port: number;\n server: Server;\n};\n\nfunction listen(args: ListenArgs) {\n return new Promise<number>((resolve, reject) => {\n const cleanup = () => {\n args.server.off('error', onError);\n args.server.off('listening', onListening);\n };\n\n const onError = (error: Error) => {\n cleanup();\n reject(error);\n };\n\n const onListening = () => {\n cleanup();\n\n const address = args.server.address();\n\n if (\n !address ||\n typeof address !== 'object' ||\n typeof address.port !== 'number'\n ) {\n reject(new Error(formatError('Sourcemap sidecar server started without a TCP port.')));\n return;\n }\n\n resolve(address.port);\n };\n\n args.server.once('error', onError);\n args.server.once('listening', onListening);\n args.server.listen(args.port, args.host);\n });\n}\n","import type { Server } from 'node:http';\nimport path from 'node:path';\nimport { globalData } from '../../../utils/global';\nimport { formatError } from '../misc';\nimport { createSidecarServer, SIDECAR_HOST, type SidecarRouteHandler, startSidecarServer } from './server';\nimport { createSourceUrl, getPortFilePath, getRoutePath, normalizeSidecarRoutePath } from './utils';\n\ntype SidecarServer = {\n cacheDir: string;\n handlers: Map<string, SidecarRouteHandler>;\n projectDir: string;\n port: number | null;\n portFilePath: string;\n routes: Map<string, string>;\n server: Server;\n startError: Error | null;\n startPromise: Promise<void>;\n};\n\nexport type SourcemapSidecar = {\n cacheDir: string;\n projectDir: string;\n ensureStarted(): Promise<void>;\n getBaseUrl(): string | null;\n getRouteUrl(routePath: string): string;\n getSourceUrl(filePath: string, relativePath?: string | null): string;\n registerSource(filePath: string, routePath: string): string;\n registerRoute(routePath: string, handler: SidecarRouteHandler): string;\n};\n\nexport type SourcemapSidecarArgs = {\n cacheDir: string;\n projectDir: string;\n routes?: Record<string, SidecarRouteHandler>;\n};\n\nconst sidecarServers = globalData(\n 'plugin.sidecar.servers',\n () => new Map<string, SidecarServer>(),\n);\n\nexport function getSourcemapSidecar(args: SourcemapSidecarArgs): SourcemapSidecar {\n const normalizedProjectDir = path.resolve(args.projectDir);\n const normalizedCacheDir = path.resolve(args.cacheDir);\n const state = getOrCreateServer(normalizedProjectDir, normalizedCacheDir);\n\n if (args.routes) {\n for (const [routePath, handler] of Object.entries(args.routes)) {\n state.handlers.set(normalizeSidecarRoutePath({ routePath }), handler);\n }\n }\n\n return {\n cacheDir: normalizedCacheDir,\n projectDir: normalizedProjectDir,\n ensureStarted() {\n return state.startPromise;\n },\n getBaseUrl() {\n return createSidecarBaseUrl(state);\n },\n getRouteUrl(routePath) {\n return createSidecarSourceUrl(\n state,\n normalizeSidecarRoutePath({ routePath }),\n );\n },\n getSourceUrl(filePath, relativePath) {\n return createSidecarSourceUrl(\n state,\n getRoutePath({\n filePath,\n projectDir: normalizedProjectDir,\n relativePath,\n }),\n );\n },\n registerSource(filePath, routePath) {\n routePath = normalizeSidecarRoutePath({ routePath });\n\n state.routes.set(routePath, path.resolve(filePath));\n\n return createSidecarSourceUrl(state, routePath);\n },\n registerRoute(routePath, handler) {\n routePath = normalizeSidecarRoutePath({ routePath });\n\n state.handlers.set(routePath, handler);\n\n return createSidecarSourceUrl(state, routePath);\n },\n };\n}\n\nfunction createSidecarBaseUrl(state: SidecarServer) {\n if (state.startError || state.port === null) return null;\n\n return `http://${SIDECAR_HOST}:${state.port}`;\n}\n\nfunction createSidecarSourceUrl(state: SidecarServer, routePath: string) {\n if (state.startError) {\n throw new Error(formatError(\n `The sourcemap dev server could not start: ${state.startError.message}`,\n ));\n }\n\n if (state.port === null) {\n throw new Error(formatError(\n 'The sourcemap dev server is not ready yet. Try rebuilding after the dev server finishes starting.',\n ));\n }\n\n const baseUrl = createSidecarBaseUrl(state);\n\n if (baseUrl === null) {\n throw new Error(formatError(\n 'The sourcemap dev server is not ready yet. Try rebuilding after the dev server finishes starting.',\n ));\n }\n\n return createSourceUrl({\n baseUrl,\n routePath,\n });\n}\n\nfunction getOrCreateServer(projectDir: string, cacheDir: string) {\n const servers = sidecarServers;\n\n const existing = servers.get(cacheDir);\n if (existing) return existing;\n\n const routes = new Map<string, string>();\n const handlers = new Map<string, SidecarRouteHandler>();\n\n const state: SidecarServer = {\n cacheDir,\n handlers,\n projectDir,\n port: null,\n portFilePath: getPortFilePath({ cacheDir }),\n routes,\n server: createSidecarServer({ projectDir, routes, handlers }),\n startError: null,\n startPromise: Promise.resolve(),\n };\n\n state.startPromise = startServer(state).catch((error: Error) => {\n state.startError = error;\n throw error;\n });\n\n state.startPromise.catch(() => {});\n state.server.unref();\n servers.set(cacheDir, state);\n\n return state;\n}\n\nasync function startServer(state: SidecarServer) {\n state.port = await startSidecarServer({\n host: SIDECAR_HOST,\n portFilePath: state.portFilePath,\n server: state.server,\n });\n}\n"],"mappings":";;;;;;AAmCA,SAAgB,gBAAgB,MAA2B;CACzD,OAAO,KAAK,KAAK,KAAK,UAAU,WAAW,WAAW;AACxD;AAEA,SAAgB,aAAa,MAAwB;CAKnD,OAJkB,mBAChB,KAAK,gBAAgB,KAAK,SAAS,KAAK,YAAY,KAAK,QAAQ,CAGpD,KAAK,MAAM,KAAK,SAAS,KAAK,QAAQ;AACvD;AAEA,SAAgB,0BAA0B,MAA8B;CACtE,IAAI,KAAK,UAAU,WAAW,YAAY,GACxC,OAAO,mBAAmB,KAAK,UAAU,MAAM,CAAkB,CAAC;CAGpE,IAAI;EAEF,OAAO,mBAAmB,IADV,IAAI,KAAK,WAAW,kBACR,EAAE,QAAQ;CACxC,QAAQ;EACN,OAAO,mBAAmB,KAAK,SAAS;CAC1C;AACF;AAEA,SAAgB,gBAAgB,MAA2B;CACzD,OAAO,GAAG,KAAK,QAAQ,QAAQ,QAAQ,EAAE,IAAI,UAAU,KAAK,SAAS;AACvE;AAEA,SAAgB,mBAAmB,KAAyB;CAC1D,IAAI,CAAC,KAAK,OAAO;CAEjB,IAAI;EACF,OAAO,UAAU,IAAI,IAAI,KAAK,kBAAkB,EAAE,QAAQ;CAC5D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,eAAe,MAA0B;CACvD,IAAI;EAEF,MAAM,OADO,KAAK,MAAM,aAAa,KAAK,UAAU,MAAM,CAC1C,EAAE;EAClB,OAAO,OAAO,SAAS,YAAY,OAAO,UAAU,IAAI,KAAK,OAAO,IAAI,OAAO;CACjF,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,gBAAgB,MAA2B;CACzD,IAAI;EACF,UAAU,KAAK,QAAQ,KAAK,QAAQ,G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;CAEpD,OAAO,UAAU,aAAa,GAAG,MAAM;AACzC;AAEA,SAAS,uBAAuB,OAAsB,WAAmB;CACvE,IAAI,MAAM,YACR,MAAM,IAAI,MAAM,YACd,6CAA6C,MAAM,WAAW,SAChE,CAAC;CAGH,IAAI,MAAM,SAAS,MACjB,MAAM,IAAI,MAAM,YACd,mGACF,CAAC;CAGH,MAAM,UAAU,qBAAqB,KAAK;CAE1C,IAAI,YAAY,MACd,MAAM,IAAI,MAAM,YACd,mGACF,CAAC;CAGH,OAAO,gBAAgB;EACrB;EACA;CACF,CAAC;AACH;AAEA,SAAS,kBAAkB,YAAoB,UAAkB;CAC/D,MAAM,UAAU;CAEhB,MAAM,WAAW,QAAQ,IAAI,QAAQ;CACrC,IAAI,UAAU,OAAO;CAErB,MAAM,yBAAS,IAAI,IAAoB;CACvC,MAAM,2BAAW,IAAI,IAAiC;CAEtD,MAAM,QAAuB;EAC3B;EACA;EACA;EACA,MAAM;EACN,cAAc,gBAAgB,EAAE,SAAS,CAAC;EAC1C;EACA,QAAQ,oBAAoB;GAAE;GAAY;GAAQ;EAAS,CAAC;EAC5D,YAAY;EACZ,cAAc,QAAQ,QAAQ;CAChC;CAEA,MAAM,eAAe,YAAY,KAAK,EAAE,OAAO,UAAiB;EAC9D,MAAM,aAAa;EACnB,MAAM;CACR,CAAC;CAED,MAAM,aAAa,YAAY,CAAC,CAAC;CACjC,MAAM,OAAO,MAAM;CACnB,QAAQ,IAAI,UAAU,KAAK;CAE3B,OAAO;AACT;AAEA,eAAe,YAAY,OAAsB;CAC/C,MAAM,OAAO,MAAM,mBAAmB;EACpC,MAAM;EACN,cAAc,MAAM;EACpB,QAAQ,MAAM;CAChB,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"sidecar-BTT0veLU.mjs","names":[],"sources":["../plugin/utils/sidecar/utils.ts","../plugin/utils/sidecar/server.ts","../plugin/utils/sidecar/sidecar.ts"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\n\nexport type GetPortFilePathArgs = {\n cacheDir: string;\n};\n\nexport type GetRoutePathArgs = {\n filePath: string;\n projectDir: string;\n relativePath?: string | null;\n};\n\nexport type CreateSourceUrlArgs = {\n baseUrl: string;\n routePath: string;\n};\n\nexport type NormalizeRoutePathArgs = {\n routePath: string;\n};\n\nexport type ReadCachedPortArgs = {\n filePath: string;\n};\n\nexport type WriteCachedPortArgs = {\n filePath: string;\n port: number;\n};\n\nexport type IsPortUnavailableErrorArgs = {\n error: unknown;\n};\n\nexport function getPortFilePath(args: GetPortFilePathArgs) {\n return path.join(args.cacheDir, 'sidecar', 'port.json');\n}\n\nexport function getRoutePath(args: GetRoutePathArgs) {\n const routePath = normalizeRoutePath(\n args.relativePath || path.relative(args.projectDir, args.filePath),\n );\n\n return routePath || '/' + path.basename(args.filePath);\n}\n\nexport function normalizeSidecarRoutePath(args: NormalizeRoutePathArgs) {\n if (args.routePath.startsWith('source://@')) {\n return normalizeRoutePath(args.routePath.slice('source://'.length));\n }\n\n try {\n const url = new URL(args.routePath, 'http://127.0.0.1');\n return normalizeRoutePath(url.pathname);\n } catch {\n return normalizeRoutePath(args.routePath);\n }\n}\n\nexport function createSourceUrl(args: CreateSourceUrlArgs) {\n return `${args.baseUrl.replace(/\\/+$/, '')}${encodeURI(args.routePath)}`;\n}\n\nexport function getRequestPathname(url: string | undefined) {\n if (!url) return null;\n\n try {\n return decodeURI(new URL(url, 'http://127.0.0.1').pathname);\n } catch {\n return null;\n }\n}\n\nexport function readCachedPort(args: ReadCachedPortArgs) {\n try {\n const file = JSON.parse(readFileSync(args.filePath, 'utf8')) as { port?: unknown; };\n const port = file.port;\n return typeof port === 'number' && Number.isInteger(port) && port > 0 ? port : null;\n } catch {\n return null;\n }\n}\n\nexport function writeCachedPort(args: WriteCachedPortArgs) {\n try {\n mkdirSync(path.dirname(args.filePath), { recursive: true });\n writeFileSync(args.filePath, JSON.stringify({ port: args.port }), 'utf8');\n } catch {\n // The sidecar still works if the sticky-port cache cannot be written.\n }\n}\n\nexport function isPortUnavailableError(args: IsPortUnavailableErrorArgs) {\n if (!(args.error instanceof Error)) return false;\n\n const code = (args.error as NodeJS.ErrnoException).code;\n return code === 'EADDRINUSE' || code === 'EACCES';\n}\n\nfunction normalizeRoutePath(filePath: string) {\n const normalized = filePath\n .replace(/\\\\/g, '/')\n .replace(/^(\\.\\.\\/)+/, '')\n .replace(/^\\.?\\//, '')\n .replace(/\\/+/g, '/');\n\n return normalized ? `/${normalized}` : '';\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { createServer, type Server } from 'node:http';\nimport path from 'node:path';\nimport { formatError } from '../misc';\nimport { getRequestPathname, isPortUnavailableError, readCachedPort, writeCachedPort } from './utils';\n\nexport const SIDECAR_HOST = '127.0.0.1';\n\nexport type CreateSidecarServerArgs = {\n projectDir: string;\n routes: Map<string, string>;\n handlers?: Map<string, SidecarRouteHandler>;\n};\n\nexport type SidecarRouteResponse = {\n body: string | Buffer;\n contentType?: string;\n};\n\nexport type SidecarRouteHandler = () => SidecarRouteResponse | null | Promise<SidecarRouteResponse | null>;\n\nexport type StartSidecarServerArgs = {\n host?: string;\n portFilePath: string;\n server: Server;\n};\n\nexport function createSidecarServer(args: CreateSidecarServerArgs) {\n return createServer(async (req, res) => {\n const pathname = getRequestPathname(req.url);\n const handler = pathname ? args.handlers?.get(pathname) : null;\n\n if (handler) {\n const response = await handler();\n\n if (!response) {\n res.statusCode = 404;\n res.end('Not found');\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Content-Type', response.contentType ?? 'text/plain; charset=utf-8');\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n res.statusCode = 200;\n res.end(response.body);\n return;\n }\n\n const filePath = pathname\n ? args.routes.get(pathname) ?? getProjectSourcePath(args.projectDir, pathname)\n : null;\n\n if (!filePath || !existsSync(filePath)) {\n res.statusCode = 404;\n res.end('Not found');\n return;\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Content-Type', 'text/plain; charset=utf-8');\n res.setHeader('X-Content-Type-Options', 'nosniff');\n\n res.statusCode = 200;\n res.end(readFileSync(filePath, 'utf8'));\n });\n}\n\nfunction getProjectSourcePath(projectDir: string, pathname: string) {\n const sourcePath = pathname\n .replace(/^\\/+/, '')\n .replace(/^@\\/?/, '');\n\n if (!sourcePath || sourcePath.startsWith('..')) return null;\n\n const filePath = path.resolve(projectDir, sourcePath);\n const projectPath = path.resolve(projectDir);\n\n return filePath === projectPath || filePath.startsWith(projectPath + path.sep)\n ? filePath\n : null;\n}\n\nexport async function startSidecarServer(args: StartSidecarServerArgs) {\n const host = args.host ?? SIDECAR_HOST;\n const cachedPort = readCachedPort({ filePath: args.portFilePath });\n\n if (cachedPort !== null) {\n try {\n return await listen({ server: args.server, host, port: cachedPort });\n } catch (error) {\n if (!isPortUnavailableError({ error })) throw error;\n }\n }\n\n const port = await listen({ server: args.server, host, port: 0 });\n\n writeCachedPort({ filePath: args.portFilePath, port });\n\n return port;\n}\n\ntype ListenArgs = {\n host: string;\n port: number;\n server: Server;\n};\n\nfunction listen(args: ListenArgs) {\n return new Promise<number>((resolve, reject) => {\n const cleanup = () => {\n args.server.off('error', onError);\n args.server.off('listening', onListening);\n };\n\n const onError = (error: Error) => {\n cleanup();\n reject(error);\n };\n\n const onListening = () => {\n cleanup();\n\n const address = args.server.address();\n\n if (\n !address ||\n typeof address !== 'object' ||\n typeof address.port !== 'number'\n ) {\n reject(new Error(formatError('Sourcemap sidecar server started without a TCP port.')));\n return;\n }\n\n resolve(address.port);\n };\n\n args.server.once('error', onError);\n args.server.once('listening', onListening);\n args.server.listen(args.port, args.host);\n });\n}\n","import type { Server } from 'node:http';\nimport path from 'node:path';\nimport { globalData } from '../../../utils/global';\nimport { formatError } from '../misc';\nimport { createSidecarServer, SIDECAR_HOST, type SidecarRouteHandler, startSidecarServer } from './server';\nimport { createSourceUrl, getPortFilePath, getRoutePath, normalizeSidecarRoutePath } from './utils';\n\ntype SidecarServer = {\n cacheDir: string;\n handlers: Map<string, SidecarRouteHandler>;\n projectDir: string;\n port: number | null;\n portFilePath: string;\n routes: Map<string, string>;\n server: Server;\n startError: Error | null;\n startPromise: Promise<void>;\n};\n\nexport type SourcemapSidecar = {\n cacheDir: string;\n projectDir: string;\n ensureStarted(): Promise<void>;\n getBaseUrl(): string | null;\n getRouteUrl(routePath: string): string;\n getSourceUrl(filePath: string, relativePath?: string | null): string;\n registerSource(filePath: string, routePath: string): string;\n registerRoute(routePath: string, handler: SidecarRouteHandler): string;\n};\n\nexport type SourcemapSidecarArgs = {\n cacheDir: string;\n projectDir: string;\n routes?: Record<string, SidecarRouteHandler>;\n};\n\nconst sidecarServers = globalData(\n 'plugin.sidecar.servers',\n () => new Map<string, SidecarServer>(),\n);\n\nexport function getSourcemapSidecar(args: SourcemapSidecarArgs): SourcemapSidecar {\n const normalizedProjectDir = path.resolve(args.projectDir);\n const normalizedCacheDir = path.resolve(args.cacheDir);\n const state = getOrCreateServer(normalizedProjectDir, normalizedCacheDir);\n\n if (args.routes) {\n for (const [routePath, handler] of Object.entries(args.routes)) {\n state.handlers.set(normalizeSidecarRoutePath({ routePath }), handler);\n }\n }\n\n return {\n cacheDir: normalizedCacheDir,\n projectDir: normalizedProjectDir,\n ensureStarted() {\n return state.startPromise;\n },\n getBaseUrl() {\n return createSidecarBaseUrl(state);\n },\n getRouteUrl(routePath) {\n return createSidecarSourceUrl(\n state,\n normalizeSidecarRoutePath({ routePath }),\n );\n },\n getSourceUrl(filePath, relativePath) {\n return createSidecarSourceUrl(\n state,\n getRoutePath({\n filePath,\n projectDir: normalizedProjectDir,\n relativePath,\n }),\n );\n },\n registerSource(filePath, routePath) {\n routePath = normalizeSidecarRoutePath({ routePath });\n\n state.routes.set(routePath, path.resolve(filePath));\n\n return createSidecarSourceUrl(state, routePath);\n },\n registerRoute(routePath, handler) {\n routePath = normalizeSidecarRoutePath({ routePath });\n\n state.handlers.set(routePath, handler);\n\n return createSidecarSourceUrl(state, routePath);\n },\n };\n}\n\nfunction createSidecarBaseUrl(state: SidecarServer) {\n if (state.startError || state.port === null) return null;\n\n return `http://${SIDECAR_HOST}:${state.port}`;\n}\n\nfunction createSidecarSourceUrl(state: SidecarServer, routePath: string) {\n if (state.startError) {\n throw new Error(formatError(\n `The sourcemap dev server could not start: ${state.startError.message}`,\n ));\n }\n\n if (state.port === null) {\n throw new Error(formatError(\n 'The sourcemap dev server is not ready yet. Try rebuilding after the dev server finishes starting.',\n ));\n }\n\n const baseUrl = createSidecarBaseUrl(state);\n\n if (baseUrl === null) {\n throw new Error(formatError(\n 'The sourcemap dev server is not ready yet. Try rebuilding after the dev server finishes starting.',\n ));\n }\n\n return createSourceUrl({\n baseUrl,\n routePath,\n });\n}\n\nfunction getOrCreateServer(projectDir: string, cacheDir: string) {\n const servers = sidecarServers;\n\n const existing = servers.get(cacheDir);\n if (existing) return existing;\n\n const routes = new Map<string, string>();\n const handlers = new Map<string, SidecarRouteHandler>();\n\n const state: SidecarServer = {\n cacheDir,\n handlers,\n projectDir,\n port: null,\n portFilePath: getPortFilePath({ cacheDir }),\n routes,\n server: createSidecarServer({ projectDir, routes, handlers }),\n startError: null,\n startPromise: Promise.resolve(),\n };\n\n state.startPromise = startServer(state).catch((error: Error) => {\n state.startError = error;\n throw error;\n });\n\n state.startPromise.catch(() => {});\n state.server.unref();\n servers.set(cacheDir, state);\n\n return state;\n}\n\nasync function startServer(state: SidecarServer) {\n state.port = await startSidecarServer({\n host: SIDECAR_HOST,\n portFilePath: state.portFilePath,\n server: state.server,\n });\n}\n"],"mappings":";;;;;;AAmCA,SAAgB,gBAAgB,MAA2B;CACzD,OAAO,KAAK,KAAK,KAAK,UAAU,WAAW,WAAW;AACxD;AAEA,SAAgB,aAAa,MAAwB;CAKnD,OAJkB,mBAChB,KAAK,gBAAgB,KAAK,SAAS,KAAK,YAAY,KAAK,QAAQ,CAGpD,KAAK,MAAM,KAAK,SAAS,KAAK,QAAQ;AACvD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AEhB,MAAM,WAAW,QAAQ,IAAI,QAAQ;CACrC,IAAI,UAAU,OAAO;CAErB,MAAM,yBAAS,IAAI,IAAoB;CACvC,MAAM,2BAAW,IAAI,IAAiC;CAEtD,MAAM,QAAuB;EAC3B;EACA;EACA;EACA,MAAM;EACN,cAAc,gBAAgB,EAAE,SAAS,CAAC;EAC1C;EACA,QAAQ,oBAAoB;GAAE;GAAY;GAAQ;EAAS,CAAC;EAC5D,YAAY;EACZ,cAAc,QAAQ,QAAQ;CAChC;CAEA,MAAM,eAAe,YAAY,KAAK,EAAE,OAAO,UAAiB;EAC9D,MAAM,aAAa;EACnB,MAAM;CACR,CAAC;CAED,MAAM,aAAa,YAAY,CAAC,CAAC;CACjC,MAAM,OAAO,MAAM;CACnB,QAAQ,IAAI,UAAU,KAAK;CAE3B,OAAO;AACT;AAEA,eAAe,YAAY,OAAsB;CAC/C,MAAM,OAAO,MAAM,mBAAmB;EACpC,MAAM;EACN,cAAc,MAAM;EACpB,QAAQ,MAAM;CAChB,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mergeJsxProps } from "../entry/dev/adapter/preact.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mergeJsxProps } from "../entry/dev/adapter/react.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { mergeJsxProps } from "../entry/dev/adapter/solid.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
3
|
+
import type { CSS } from "../utils/types.js";
|
|
4
|
+
export type CounterStyleObject = CSS.AtRule.CounterStyle;
|
|
5
|
+
export declare const COUNTER_STYLE_AT_RULE = "counter-style";
|
|
6
|
+
export declare const formatCounterStyleName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
7
|
+
export declare function buildCounterStyleCss(format: NamedAtRuleFormat | null, name: string | null, id: string, descriptors: CounterStyleObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
8
|
+
name: string;
|
|
9
|
+
css: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
3
|
+
import type { CSS } from "../utils/types.js";
|
|
4
|
+
export type FontFaceObject = CSS.AtRule.FontFace;
|
|
5
|
+
export declare const FONT_FACE_AT_RULE = "font-face";
|
|
6
|
+
export declare const formatFontFaceName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
7
|
+
export declare function buildFontFaceCss(format: NamedAtRuleFormat | null, name: string | null, id: string, descriptors: FontFaceObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
8
|
+
name: string;
|
|
9
|
+
css: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
3
|
+
import type { CSS } from "../utils/types.js";
|
|
4
|
+
export type FontPaletteValuesObject = CSS.AtRule.FontPaletteValues;
|
|
5
|
+
export declare const FONT_PALETTE_VALUES_AT_RULE = "font-palette-values";
|
|
6
|
+
export declare const formatFontPaletteValuesName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
7
|
+
export declare function buildFontPaletteValuesCss(format: NamedAtRuleFormat | null, name: string | null, id: string, descriptors: FontPaletteValuesObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
8
|
+
name: string;
|
|
9
|
+
css: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fontSrc(url: string, format?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
3
|
+
import type { AtRuleStyleObject, CSSProperties } from "../../style/types.js";
|
|
4
|
+
export type KeyframeSelector = 'from' | 'to' | `${number}%` | (string & {});
|
|
5
|
+
export type KeyframesObject<Style = CSSProperties> = {
|
|
6
|
+
[Selector in KeyframeSelector]?: AtRuleStyleObject<Style>;
|
|
7
|
+
};
|
|
8
|
+
export declare const KEYFRAMES_AT_RULE = "keyframes";
|
|
9
|
+
export declare const formatKeyFramesName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
10
|
+
export declare function buildKeyframesCss(format: NamedAtRuleFormat | null, name: string | null, id: string, frames: KeyframesObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
11
|
+
name: string;
|
|
12
|
+
css: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { AtRuleStyleObject } from "../../style/index.js";
|
|
3
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
4
|
+
import type { CSSProperties } from "../utils/types.js";
|
|
5
|
+
type Properties = Pick<CSSProperties, 'positionArea' | 'insetArea' | 'top' | 'right' | 'bottom' | 'left' | 'inset' | 'insetBlock' | 'insetBlockStart' | 'insetBlockEnd' | 'insetInline' | 'insetInlineStart' | 'insetInlineEnd' | 'width' | 'minWidth' | 'maxWidth' | 'height' | 'minHeight' | 'maxHeight' | 'blockSize' | 'minBlockSize' | 'maxBlockSize' | 'inlineSize' | 'minInlineSize' | 'maxInlineSize' | 'margin' | 'marginBlock' | 'marginBlockStart' | 'marginBlockEnd' | 'marginInline' | 'marginInlineStart' | 'marginInlineEnd'>;
|
|
6
|
+
export type PositionTryObject = AtRuleStyleObject<Properties>;
|
|
7
|
+
export declare const POSITION_TRY_AT_RULE = "position-try";
|
|
8
|
+
export declare const formatPositionTryName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
9
|
+
export declare function buildPositionTryCss(format: NamedAtRuleFormat | null, name: string | null, id: string, descriptors: PositionTryObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
10
|
+
name: string;
|
|
11
|
+
css: string;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NamedAtRuleFormat, TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import type { StyleTokenData } from "../../style/token.js";
|
|
3
|
+
export type PropertyObject = {
|
|
4
|
+
syntax: string;
|
|
5
|
+
inherits: boolean;
|
|
6
|
+
initialValue: string | number;
|
|
7
|
+
};
|
|
8
|
+
export declare const PROPERTY_AT_RULE = "property";
|
|
9
|
+
export declare const formatPropertyName: (format: NamedAtRuleFormat | null, id: string, info: import("../../config/types.js").NamedAtRuleInfo) => string;
|
|
10
|
+
export declare function buildPropertyCss(format: NamedAtRuleFormat | null, name: string | null, id: string, descriptors: PropertyObject, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): {
|
|
11
|
+
css: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type NamedAtRuleFormat, type NamedAtRuleInfo, type TokenNameFormat } from "../../config/types.js";
|
|
2
|
+
import { type StyleTokenData } from "../../style/token.js";
|
|
3
|
+
export declare function createAtRuleNameFormatter(defaultFormat: NamedAtRuleFormat, prefix?: string): (format: NamedAtRuleFormat | null, id: string, info: NamedAtRuleInfo) => string;
|
|
4
|
+
export declare function buildNamedAtRuleCss(atRule: string, name: string, descriptors: object, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null): string;
|
|
5
|
+
export declare function buildAtRuleDeclarationCss(style: Record<string, any>, tokens: StyleTokenData[], tokenLookup: Set<string>, tokenNameFormat: TokenNameFormat | null, rawValue: boolean, shouldInclude?: (property: string) => boolean): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BuilderCallsite, ItemSelector } from "../builder/data/index.js";
|
|
2
|
+
import type { ClassNameFormat, TransformClassNameFormat } from "../config/types.js";
|
|
3
|
+
export { getScopeClassName } from "./scope.js";
|
|
4
|
+
export declare function getAtomicClassName(property: string, priority: number | null, important: boolean, value: string, selector: ItemSelector | null, parentSelector: ItemSelector | null, atRule: ItemSelector[] | null, callsite: BuilderCallsite | null, localClassName: boolean, debugClassName: boolean, classNameFormat: ClassNameFormat | null, transformClassName: string | null, transformClassNameFormat: TransformClassNameFormat | null, sheetClassNameFormat?: ClassNameFormat | null, hashLength?: number | null): string;
|
|
5
|
+
export declare function getClassNameHashLength(options: {
|
|
6
|
+
debugClassName: boolean;
|
|
7
|
+
isDev: boolean;
|
|
8
|
+
devHashLength?: number | null;
|
|
9
|
+
cssHashLength?: number | null;
|
|
10
|
+
}): number;
|
|
11
|
+
export declare function getClassNameDedupe(property: string, priority: number | null, important: boolean, selector: ItemSelector | null, parentSelector: ItemSelector | null, atRule: ItemSelector[] | null): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClassNameFormat, ClassNameInfo, TransformClassNameFormat, TransformClassNameInfo } from "../../../config/types.js";
|
|
2
|
+
export declare const CLASS_NAME_FORMAT = "[(atRule)-][(scopeSelector)-](property)[-(selector)][-(value)]--$hash";
|
|
3
|
+
export declare const SHEET_CLASS_NAME_FORMAT = "sheet-(property)[-(value)]--$hash";
|
|
4
|
+
export declare const TRANSFORM_CLASS_NAME_FORMAT = "(className)--$hash";
|
|
5
|
+
export declare const formatClassName: (format: string | ((info: ClassNameInfo) => string), hash: string | null, info: ClassNameInfo) => string;
|
|
6
|
+
export declare const formatTransformClassName: (format: string | ((info: TransformClassNameInfo) => string), hash: string | null, info: TransformClassNameInfo) => string;
|
|
7
|
+
export declare function getDebugClassName(format: ClassNameFormat | null, hash: string, info: ClassNameInfo): string;
|
|
8
|
+
export declare function getDebugSheetClassName(format: ClassNameFormat | null, hash: string, info: ClassNameInfo): string;
|
|
9
|
+
export declare function getDebugTransformClassName(format: TransformClassNameFormat | null, hash: string, info: TransformClassNameInfo): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./className.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./property.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ElementClassNameFormat, ElementClassNameInfo } from "../config/types.js";
|
|
2
|
+
export declare const ELEMENT_CLASS_NAME_FORMAT = "@(name)";
|
|
3
|
+
export declare const formatElementClassName: (format: string | ((info: ElementClassNameInfo) => string), hash: string | null, info: ElementClassNameInfo) => string;
|
|
4
|
+
export declare function getElementClassName(label: string | undefined, id: string, elementClassNameFormat: ElementClassNameFormat | null): string;
|
|
5
|
+
export declare function getElementMarkerRuleCss(className: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LayerPriority } from "./types.js";
|
|
2
|
+
export declare function compareLayerPriority(p1: LayerPriority, p2: LayerPriority): number;
|
|
3
|
+
export declare function createLayerNamePool(): {
|
|
4
|
+
getLayerName: (layerNamespace: string, priority: LayerPriority) => string;
|
|
5
|
+
getLayerId: (priority: LayerPriority) => string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createLayerPool(layerNamespace: string): {
|
|
8
|
+
getName: (priority: LayerPriority) => string;
|
|
9
|
+
getNames: () => string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function ensureLayerPlaceholder(layers: string[]): string[];
|
|
12
|
+
export declare function flattenCssLayers(layers: readonly string[], layerNames: string | readonly string[]): string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LayerPlaceholder } from "../../config/index.js";
|
|
2
|
+
export { LayerPlaceholder };
|
|
3
|
+
export declare const LayerDefaultLayers: string[];
|
|
4
|
+
export declare const LayerDefaultNamespace = "css";
|
|
5
|
+
export declare const LayerDefaultPriority: LayerPriority;
|
|
6
|
+
export declare const LayerMediaPriorities: {
|
|
7
|
+
base: number;
|
|
8
|
+
media: number;
|
|
9
|
+
priorityMedia: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const LayerSelectorPriorities: {
|
|
12
|
+
base: number;
|
|
13
|
+
parentSelector: number;
|
|
14
|
+
selector: number;
|
|
15
|
+
prioritySelector: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const LayerPropertyPriorities: {
|
|
18
|
+
shorthand: number;
|
|
19
|
+
intermediate: number;
|
|
20
|
+
longhand: number;
|
|
21
|
+
};
|
|
22
|
+
export type LayerPriority = readonly [
|
|
23
|
+
value: number,
|
|
24
|
+
selector: number,
|
|
25
|
+
parentSelector: number,
|
|
26
|
+
media: number,
|
|
27
|
+
atRule: number,
|
|
28
|
+
origin: number,
|
|
29
|
+
property: number
|
|
30
|
+
];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getLayerOrderCss(layers: readonly string[], layerNames: string | readonly string[]): string;
|
|
2
|
+
export declare function getLayerBlockCss(layerName: string, css: string): string;
|
|
3
|
+
export declare function getLayerBundleCss(layers: readonly string[], layerName: string, css: readonly string[]): string;
|
|
4
|
+
export declare function joinLayerCss(layerOrderCss: string, css: readonly string[]): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CSSPropertyName } from "../utils/types.js";
|
|
2
|
+
import { type PropertyTypeRecord } from "./types.js";
|
|
3
|
+
type TypeMap = PropertyTypeRecord<CSSPropertyName>;
|
|
4
|
+
export declare const animation: TypeMap;
|
|
5
|
+
export declare const background: TypeMap;
|
|
6
|
+
export declare const border: TypeMap;
|
|
7
|
+
export declare const columns: TypeMap;
|
|
8
|
+
export declare const containIntrinsicSize: TypeMap;
|
|
9
|
+
export declare const container: TypeMap;
|
|
10
|
+
export declare const flex: TypeMap;
|
|
11
|
+
export declare const font: TypeMap;
|
|
12
|
+
export declare const gap: TypeMap;
|
|
13
|
+
export declare const grid: TypeMap;
|
|
14
|
+
export declare const inset: TypeMap;
|
|
15
|
+
export declare const listStyle: TypeMap;
|
|
16
|
+
export declare const margin: TypeMap;
|
|
17
|
+
export declare const mask: TypeMap;
|
|
18
|
+
export declare const offset: TypeMap;
|
|
19
|
+
export declare const outline: TypeMap;
|
|
20
|
+
export declare const overflow: TypeMap;
|
|
21
|
+
export declare const overscrollBehavior: TypeMap;
|
|
22
|
+
export declare const padding: TypeMap;
|
|
23
|
+
export declare const place: TypeMap;
|
|
24
|
+
export declare const scrollMargin: TypeMap;
|
|
25
|
+
export declare const scrollPadding: TypeMap;
|
|
26
|
+
export declare const scrollTimeline: TypeMap;
|
|
27
|
+
export declare const text: TypeMap;
|
|
28
|
+
export declare const transition: TypeMap;
|
|
29
|
+
export declare const viewTimeline: TypeMap;
|
|
30
|
+
export declare const whiteSpace: TypeMap;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ItemSelector } from "../builder/data/state.js";
|
|
2
|
+
import type { ScopeClassNameFormat } from "../config/types.js";
|
|
3
|
+
import { type LayerPriority } from "./layer/index.js";
|
|
4
|
+
export declare function buildAtomicRule(className: string, property: string, value: string, important: boolean, selector: ItemSelector | null, parentSelector: ItemSelector | null, atRules: ItemSelector[] | null, scopeClassNameFormat: ScopeClassNameFormat | null): string;
|
|
5
|
+
export declare function getAtomicRuleLayerPriority(property: string, priority: number | null, selector: ItemSelector | null, parentSelector: ItemSelector | null, atRules: ItemSelector[] | null, isScopeRule?: boolean): LayerPriority;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThemeNameFormat, ThemeNameInfo, TokenNameFormat } from "../config/types.js";
|
|
2
|
+
import type { StyleTokenOverride } from "../style/token.js";
|
|
3
|
+
export declare const THEME_NAME_FORMAT = "theme[-(name)]-$hash";
|
|
4
|
+
export declare const formatThemeName: (format: string | ((info: ThemeNameInfo) => string), hash: string | null, info: ThemeNameInfo) => string;
|
|
5
|
+
export declare function createThemeClassName(name: string | null, id: string, themeNameFormat: ThemeNameFormat | null): string;
|
|
6
|
+
export declare function getThemeRuleCss(className: string, tokens: readonly StyleTokenOverride[], tokenNameFormat: TokenNameFormat | null): string;
|
|
7
|
+
export declare function normalizeThemeName(value: string | null | undefined): string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TokenNameFormat, TokenNameInfo } from "../config/types.js";
|
|
2
|
+
import { type StyleTokenData, type StyleTokenOverride } from "../style/token.js";
|
|
3
|
+
export declare const TOKEN_NAME_FORMAT = "token[-(name)]-$hash";
|
|
4
|
+
export declare const formatTokenName: (format: string | ((info: TokenNameInfo) => string), hash: string | null, info: TokenNameInfo) => string;
|
|
5
|
+
export declare function getTokenVarName(token: StyleTokenData | StyleTokenOverride, format: TokenNameFormat | null): string;
|
|
6
|
+
export declare function getTokenVar(token: StyleTokenData, format: TokenNameFormat | null): string;
|
|
7
|
+
export declare function getTokenOverrideValue(token: StyleTokenOverride, format: TokenNameFormat | null): unknown;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function normalizeDebugKeywordValue(value: string): string | null;
|
|
2
|
+
export declare function sanitizeDebugName(value: string | undefined): string;
|
|
3
|
+
export declare function normalizePropertyName(property: string): string;
|
|
4
|
+
export declare function sanitizeDebugPropertyName(property: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type NameFormatFn<Info> = (info: Info) => string;
|
|
2
|
+
type NameFormat<Info> = string | NameFormatFn<Info>;
|
|
3
|
+
export type NameFormatter<Info extends object> = ReturnType<typeof createNameFormatter<Info>>;
|
|
4
|
+
export declare function createNameFormatter<Info extends object>(keys: readonly (keyof Info & string)[]): (format: NameFormat<Info>, hash: string | null, info: Info) => string;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getIdentifierSafeHash(value: string, startLength?: number): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ItemSelector } from "../../builder/data/state.js";
|
|
2
|
+
export declare function getSelectorText(selector: ItemSelector): string;
|
|
3
|
+
export declare function getSelectorHash(selector: ItemSelector): string;
|
|
4
|
+
export declare function getSelectorPriority(selector: ItemSelector | null): number;
|
|
5
|
+
export declare function hasSheetSelectorAnchor(selector: ItemSelector | null): boolean;
|
|
6
|
+
export declare function getSheetSelectorWeight(selector: ItemSelector | null): number | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as CSS from 'csstype';
|
|
2
|
+
export type * as CSS from 'csstype';
|
|
3
|
+
export type CSSValueExclude = '-moz-initial';
|
|
4
|
+
export type CSSProperties = {
|
|
5
|
+
[P in keyof CSS.Properties<string | number>]: Exclude<CSS.Properties<string | number>[P], CSSValueExclude>;
|
|
6
|
+
};
|
|
7
|
+
export type CSSPropertyName = keyof CSS.Properties<string | number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const UnitlessProperties: string[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VarNameFormat, VarNameInfo } from "../config/types.js";
|
|
2
|
+
export declare const VAR_NAME_FORMAT = "var[-(name)]-$hash";
|
|
3
|
+
export declare const formatVarName: (format: string | ((info: VarNameInfo) => string), hash: string | null, info: VarNameInfo) => string;
|
|
4
|
+
export declare function getLocalVarName(filePath: string, line: number, column: number, format: VarNameFormat | null | undefined): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ClassNameTransform } from "../../style/index.js";
|
|
2
|
+
import type { SelectorsRecord } from "../types/index.js";
|
|
3
|
+
import type { ClassNameFn } from "./types.js";
|
|
4
|
+
export declare function createClassNameBuilder<ClassName extends string, Selectors extends SelectorsRecord>(selectors: Selectors, transform: ClassNameTransform<ClassName>): ClassNameFn<ClassName, Selectors>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Collapse } from "../../utils/type.js";
|
|
2
|
+
import type { GetSelectorFn, SelectorArg, SelectorString } from "../types/fns.js";
|
|
3
|
+
import type { ClassNameBuilder, ClassNameItem, ClassNameMergeData } from "./types.js";
|
|
4
|
+
type ClassNameItems<ClassName extends string> = readonly ClassNameItem<ClassName>[];
|
|
5
|
+
type ClassNameFn<ClassName extends string, Self> = {
|
|
6
|
+
(...items: ClassNameItems<ClassName>): Self;
|
|
7
|
+
};
|
|
8
|
+
type ClassNameArgFn<ClassName extends string, Self, Arg extends string> = {
|
|
9
|
+
(selector: Arg, ...items: ClassNameItems<ClassName>): Self;
|
|
10
|
+
};
|
|
11
|
+
type ClassNameArgsFn<ClassName extends string, Self, Arg extends string> = {
|
|
12
|
+
(selector: Arg | readonly Arg[], ...items: ClassNameItems<ClassName>): Self;
|
|
13
|
+
};
|
|
14
|
+
type ClassNameMergeFn<ClassName extends string, Self> = {
|
|
15
|
+
(...styles: ClassNameMergeData<ClassName>[]): Self;
|
|
16
|
+
};
|
|
17
|
+
type ClassNameAtRuleFn<ClassName extends string, Self, Arg> = {
|
|
18
|
+
(selector: Arg, ...items: ClassNameItems<ClassName>): Self;
|
|
19
|
+
};
|
|
20
|
+
type ClassNameAtRuleNoArgFn<ClassName extends string, Self> = {
|
|
21
|
+
(...items: ClassNameItems<ClassName>): Self;
|
|
22
|
+
};
|
|
23
|
+
type ClassNameMediaFn<ClassName extends string, Self, Arg> = ClassNameAtRuleFn<ClassName, Self, Arg> & {
|
|
24
|
+
(weight: number, selector: Arg, ...items: ClassNameItems<ClassName>): Self;
|
|
25
|
+
};
|
|
26
|
+
type ClassNameMediaNoArgFn<ClassName extends string, Self> = ClassNameAtRuleNoArgFn<ClassName, Self> & {
|
|
27
|
+
(weight: number, ...items: ClassNameItems<ClassName>): Self;
|
|
28
|
+
};
|
|
29
|
+
type ClassNameAtRuleArgFn<ClassName extends string, Self, Arg extends string> = ClassNameAtRuleFn<ClassName, Self, Arg>;
|
|
30
|
+
type ClassNameAtRuleArgsFn<ClassName extends string, Self, Arg extends string> = ClassNameAtRuleFn<ClassName, Self, Arg | readonly Arg[]>;
|
|
31
|
+
type ClassNameMediaArgFn<ClassName extends string, Self, Arg extends string> = ClassNameMediaFn<ClassName, Self, Arg>;
|
|
32
|
+
type ClassNameMediaArgsFn<ClassName extends string, Self, Arg extends string> = ClassNameMediaFn<ClassName, Self, Arg | readonly Arg[]>;
|
|
33
|
+
type GetClassNameFn<Selector, ClassName extends string, Self> = SelectorString<Selector> extends '...' ? ClassNameMergeFn<ClassName, Self> : GetSelectorFn<SelectorString<Selector>, {
|
|
34
|
+
MediaNoArg: ClassNameMediaNoArgFn<ClassName, Self>;
|
|
35
|
+
MediaArgs: ClassNameMediaArgsFn<ClassName, Self, SelectorArg<Selector>>;
|
|
36
|
+
MediaArg: ClassNameMediaArgFn<ClassName, Self, SelectorArg<Selector>>;
|
|
37
|
+
AtRuleNoArg: ClassNameAtRuleNoArgFn<ClassName, Self>;
|
|
38
|
+
AtRuleArgs: ClassNameAtRuleArgsFn<ClassName, Self, SelectorArg<Selector>>;
|
|
39
|
+
AtRuleArg: ClassNameAtRuleArgFn<ClassName, Self, SelectorArg<Selector>>;
|
|
40
|
+
Args: ClassNameArgsFn<ClassName, Self, SelectorArg<Selector>>;
|
|
41
|
+
Arg: ClassNameArgFn<ClassName, Self, SelectorArg<Selector>>;
|
|
42
|
+
Default: ClassNameFn<ClassName, Self>;
|
|
43
|
+
}>;
|
|
44
|
+
export type ClassNameSelfFn<ClassName extends string, Selectors> = (...items: ClassNameItems<ClassName>) => ClassNameBuilder<ClassName, Selectors> & Collapse;
|
|
45
|
+
export type ClassNameSelectorFns<ClassName extends string, Selectors> = {
|
|
46
|
+
[P in keyof Selectors]: GetClassNameFn<Selectors[P], ClassName, ClassNameBuilder<ClassName, Selectors> & Collapse>;
|
|
47
|
+
};
|
|
48
|
+
export {};
|