zyzz 0.0.0 → 0.0.2
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/LICENSE +21 -0
- package/README.md +380 -0
- package/dist/Config.d.ts +170 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +249 -0
- package/dist/Config.js.map +1 -0
- package/dist/Props.d.ts +7 -0
- package/dist/Props.d.ts.map +1 -0
- package/dist/Props.js +3 -0
- package/dist/Props.js.map +1 -0
- package/dist/Style.d.ts +167 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +284 -0
- package/dist/Style.js.map +1 -0
- package/dist/Theme.d.ts +154 -0
- package/dist/Theme.d.ts.map +1 -0
- package/dist/Theme.js +257 -0
- package/dist/Theme.js.map +1 -0
- package/dist/babel/NativeEdits.d.ts +8 -0
- package/dist/babel/NativeEdits.d.ts.map +1 -0
- package/dist/babel/NativeEdits.js +233 -0
- package/dist/babel/NativeEdits.js.map +1 -0
- package/dist/babel/NativeJsx.d.ts +10 -0
- package/dist/babel/NativeJsx.d.ts.map +1 -0
- package/dist/babel/NativeJsx.js +204 -0
- package/dist/babel/NativeJsx.js.map +1 -0
- package/dist/babel/index.d.ts +51 -0
- package/dist/babel/index.d.ts.map +1 -0
- package/dist/babel/index.js +220 -0
- package/dist/babel/index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +178 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compiler/Graph.d.ts +64 -0
- package/dist/compiler/Graph.d.ts.map +1 -0
- package/dist/compiler/Graph.js +1111 -0
- package/dist/compiler/Graph.js.map +1 -0
- package/dist/compiler/Native.d.ts +53 -0
- package/dist/compiler/Native.d.ts.map +1 -0
- package/dist/compiler/Native.js +617 -0
- package/dist/compiler/Native.js.map +1 -0
- package/dist/compiler/Source.d.ts +165 -0
- package/dist/compiler/Source.d.ts.map +1 -0
- package/dist/compiler/Source.js +990 -0
- package/dist/compiler/Source.js.map +1 -0
- package/dist/compiler/Transform.d.ts +57 -0
- package/dist/compiler/Transform.d.ts.map +1 -0
- package/dist/compiler/Transform.js +884 -0
- package/dist/compiler/Transform.js.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +13 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/internal/Applications.d.ts +35 -0
- package/dist/compiler/internal/Applications.d.ts.map +1 -0
- package/dist/compiler/internal/Applications.js +248 -0
- package/dist/compiler/internal/Applications.js.map +1 -0
- package/dist/compiler/internal/AtRules.d.ts +8 -0
- package/dist/compiler/internal/AtRules.d.ts.map +1 -0
- package/dist/compiler/internal/AtRules.js +180 -0
- package/dist/compiler/internal/AtRules.js.map +1 -0
- package/dist/compiler/internal/Catalogs.d.ts +19 -0
- package/dist/compiler/internal/Catalogs.d.ts.map +1 -0
- package/dist/compiler/internal/Catalogs.js +68 -0
- package/dist/compiler/internal/Catalogs.js.map +1 -0
- package/dist/compiler/internal/ColorProfiles.d.ts +3 -0
- package/dist/compiler/internal/ColorProfiles.d.ts.map +1 -0
- package/dist/compiler/internal/ColorProfiles.js +84 -0
- package/dist/compiler/internal/ColorProfiles.js.map +1 -0
- package/dist/compiler/internal/CompositionBindings.d.ts +16 -0
- package/dist/compiler/internal/CompositionBindings.d.ts.map +1 -0
- package/dist/compiler/internal/CompositionBindings.js +89 -0
- package/dist/compiler/internal/CompositionBindings.js.map +1 -0
- package/dist/compiler/internal/Compositions.d.ts +32 -0
- package/dist/compiler/internal/Compositions.d.ts.map +1 -0
- package/dist/compiler/internal/Compositions.js +464 -0
- package/dist/compiler/internal/Compositions.js.map +1 -0
- package/dist/compiler/internal/Configurations.d.ts +21 -0
- package/dist/compiler/internal/Configurations.d.ts.map +1 -0
- package/dist/compiler/internal/Configurations.js +171 -0
- package/dist/compiler/internal/Configurations.js.map +1 -0
- package/dist/compiler/internal/Contract.d.ts +27 -0
- package/dist/compiler/internal/Contract.d.ts.map +1 -0
- package/dist/compiler/internal/Contract.js +600 -0
- package/dist/compiler/internal/Contract.js.map +1 -0
- package/dist/compiler/internal/Contributions.d.ts +54 -0
- package/dist/compiler/internal/Contributions.d.ts.map +1 -0
- package/dist/compiler/internal/Contributions.js +1109 -0
- package/dist/compiler/internal/Contributions.js.map +1 -0
- package/dist/compiler/internal/Descriptors.d.ts +15 -0
- package/dist/compiler/internal/Descriptors.d.ts.map +1 -0
- package/dist/compiler/internal/Descriptors.js +183 -0
- package/dist/compiler/internal/Descriptors.js.map +1 -0
- package/dist/compiler/internal/Dynamic.d.ts +14 -0
- package/dist/compiler/internal/Dynamic.d.ts.map +1 -0
- package/dist/compiler/internal/Dynamic.js +172 -0
- package/dist/compiler/internal/Dynamic.js.map +1 -0
- package/dist/compiler/internal/Edits.d.ts +12 -0
- package/dist/compiler/internal/Edits.d.ts.map +1 -0
- package/dist/compiler/internal/Edits.js +5 -0
- package/dist/compiler/internal/Edits.js.map +1 -0
- package/dist/compiler/internal/Expression.d.ts +12 -0
- package/dist/compiler/internal/Expression.d.ts.map +1 -0
- package/dist/compiler/internal/Expression.js +98 -0
- package/dist/compiler/internal/Expression.js.map +1 -0
- package/dist/compiler/internal/Functions.d.ts +5 -0
- package/dist/compiler/internal/Functions.d.ts.map +1 -0
- package/dist/compiler/internal/Functions.js +191 -0
- package/dist/compiler/internal/Functions.js.map +1 -0
- package/dist/compiler/internal/Identifiers.d.ts +9 -0
- package/dist/compiler/internal/Identifiers.d.ts.map +1 -0
- package/dist/compiler/internal/Identifiers.js +106 -0
- package/dist/compiler/internal/Identifiers.js.map +1 -0
- package/dist/compiler/internal/Keyframes.d.ts +5 -0
- package/dist/compiler/internal/Keyframes.d.ts.map +1 -0
- package/dist/compiler/internal/Keyframes.js +51 -0
- package/dist/compiler/internal/Keyframes.js.map +1 -0
- package/dist/compiler/internal/Namespaces.d.ts +17 -0
- package/dist/compiler/internal/Namespaces.d.ts.map +1 -0
- package/dist/compiler/internal/Namespaces.js +265 -0
- package/dist/compiler/internal/Namespaces.js.map +1 -0
- package/dist/compiler/internal/NativeBindings.d.ts +74 -0
- package/dist/compiler/internal/NativeBindings.d.ts.map +1 -0
- package/dist/compiler/internal/NativeBindings.js +117 -0
- package/dist/compiler/internal/NativeBindings.js.map +1 -0
- package/dist/compiler/internal/PackedStyles.d.ts +35 -0
- package/dist/compiler/internal/PackedStyles.d.ts.map +1 -0
- package/dist/compiler/internal/PackedStyles.js +345 -0
- package/dist/compiler/internal/PackedStyles.js.map +1 -0
- package/dist/compiler/internal/Properties.d.ts +5 -0
- package/dist/compiler/internal/Properties.d.ts.map +1 -0
- package/dist/compiler/internal/Properties.js +82 -0
- package/dist/compiler/internal/Properties.js.map +1 -0
- package/dist/compiler/internal/RecipeConditions.d.ts +41 -0
- package/dist/compiler/internal/RecipeConditions.d.ts.map +1 -0
- package/dist/compiler/internal/RecipeConditions.js +82 -0
- package/dist/compiler/internal/RecipeConditions.js.map +1 -0
- package/dist/compiler/internal/RecipePayloads.d.ts +31 -0
- package/dist/compiler/internal/RecipePayloads.d.ts.map +1 -0
- package/dist/compiler/internal/RecipePayloads.js +99 -0
- package/dist/compiler/internal/RecipePayloads.js.map +1 -0
- package/dist/compiler/internal/Recipes.d.ts +32 -0
- package/dist/compiler/internal/Recipes.d.ts.map +1 -0
- package/dist/compiler/internal/Recipes.js +339 -0
- package/dist/compiler/internal/Recipes.js.map +1 -0
- package/dist/compiler/internal/Relative.d.ts +19 -0
- package/dist/compiler/internal/Relative.d.ts.map +1 -0
- package/dist/compiler/internal/Relative.js +62 -0
- package/dist/compiler/internal/Relative.js.map +1 -0
- package/dist/compiler/internal/Scope.d.ts +10 -0
- package/dist/compiler/internal/Scope.d.ts.map +1 -0
- package/dist/compiler/internal/Scope.js +28 -0
- package/dist/compiler/internal/Scope.js.map +1 -0
- package/dist/compiler/internal/Selectors.d.ts +12 -0
- package/dist/compiler/internal/Selectors.d.ts.map +1 -0
- package/dist/compiler/internal/Selectors.js +265 -0
- package/dist/compiler/internal/Selectors.js.map +1 -0
- package/dist/compiler/internal/Static.d.ts +39 -0
- package/dist/compiler/internal/Static.d.ts.map +1 -0
- package/dist/compiler/internal/Static.js +532 -0
- package/dist/compiler/internal/Static.js.map +1 -0
- package/dist/compiler/internal/Stylesheets.d.ts +47 -0
- package/dist/compiler/internal/Stylesheets.d.ts.map +1 -0
- package/dist/compiler/internal/Stylesheets.js +272 -0
- package/dist/compiler/internal/Stylesheets.js.map +1 -0
- package/dist/compiler/internal/Syntax.d.ts +17 -0
- package/dist/compiler/internal/Syntax.d.ts.map +1 -0
- package/dist/compiler/internal/Syntax.js +19 -0
- package/dist/compiler/internal/Syntax.js.map +1 -0
- package/dist/compiler/internal/Themes.d.ts +158 -0
- package/dist/compiler/internal/Themes.d.ts.map +1 -0
- package/dist/compiler/internal/Themes.js +1169 -0
- package/dist/compiler/internal/Themes.js.map +1 -0
- package/dist/compiler/internal/Variables.d.ts +31 -0
- package/dist/compiler/internal/Variables.d.ts.map +1 -0
- package/dist/compiler/internal/Variables.js +376 -0
- package/dist/compiler/internal/Variables.js.map +1 -0
- package/dist/compiler/internal/ViewTransitions.d.ts +3 -0
- package/dist/compiler/internal/ViewTransitions.d.ts.map +1 -0
- package/dist/compiler/internal/ViewTransitions.js +68 -0
- package/dist/compiler/internal/ViewTransitions.js.map +1 -0
- package/dist/cx.d.ts +18 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +60 -0
- package/dist/cx.js.map +1 -0
- package/dist/default.d.ts +2008 -0
- package/dist/default.d.ts.map +1 -0
- package/dist/default.js +243 -0
- package/dist/default.js.map +7 -0
- package/dist/default.js.zyzz.json +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Authoring.d.ts +26 -0
- package/dist/internal/Authoring.d.ts.map +1 -0
- package/dist/internal/Authoring.js +134 -0
- package/dist/internal/Authoring.js.map +1 -0
- package/dist/internal/Binding.d.ts +64 -0
- package/dist/internal/Binding.d.ts.map +1 -0
- package/dist/internal/Binding.js +27 -0
- package/dist/internal/Binding.js.map +1 -0
- package/dist/internal/BindingDomains.d.ts +11 -0
- package/dist/internal/BindingDomains.d.ts.map +1 -0
- package/dist/internal/BindingDomains.js +459 -0
- package/dist/internal/BindingDomains.js.map +1 -0
- package/dist/internal/Cascade.d.ts +45 -0
- package/dist/internal/Cascade.d.ts.map +1 -0
- package/dist/internal/Cascade.js +165 -0
- package/dist/internal/Cascade.js.map +1 -0
- package/dist/internal/Compound.d.ts +132 -0
- package/dist/internal/Compound.d.ts.map +1 -0
- package/dist/internal/Compound.js +2 -0
- package/dist/internal/Compound.js.map +1 -0
- package/dist/internal/Condition.d.ts +33 -0
- package/dist/internal/Condition.d.ts.map +1 -0
- package/dist/internal/Condition.js +180 -0
- package/dist/internal/Condition.js.map +1 -0
- package/dist/internal/Corner.d.ts +9 -0
- package/dist/internal/Corner.d.ts.map +1 -0
- package/dist/internal/Corner.js +14 -0
- package/dist/internal/Corner.js.map +1 -0
- package/dist/internal/FunctionSyntax.d.ts +27 -0
- package/dist/internal/FunctionSyntax.d.ts.map +1 -0
- package/dist/internal/FunctionSyntax.js +91 -0
- package/dist/internal/FunctionSyntax.js.map +1 -0
- package/dist/internal/FunctionValue.d.ts +19 -0
- package/dist/internal/FunctionValue.d.ts.map +1 -0
- package/dist/internal/FunctionValue.js +2 -0
- package/dist/internal/FunctionValue.js.map +1 -0
- package/dist/internal/Geometry.d.ts +8 -0
- package/dist/internal/Geometry.d.ts.map +1 -0
- package/dist/internal/Geometry.js +2 -0
- package/dist/internal/Geometry.js.map +1 -0
- package/dist/internal/Grid.d.ts +15 -0
- package/dist/internal/Grid.d.ts.map +1 -0
- package/dist/internal/Grid.js +2 -0
- package/dist/internal/Grid.js.map +1 -0
- package/dist/internal/Identifier.d.ts +15 -0
- package/dist/internal/Identifier.d.ts.map +1 -0
- package/dist/internal/Identifier.js +2 -0
- package/dist/internal/Identifier.js.map +1 -0
- package/dist/internal/Identity.d.ts +16 -0
- package/dist/internal/Identity.d.ts.map +1 -0
- package/dist/internal/Identity.js +78 -0
- package/dist/internal/Identity.js.map +1 -0
- package/dist/internal/Lexical.d.ts +89 -0
- package/dist/internal/Lexical.d.ts.map +1 -0
- package/dist/internal/Lexical.js +15 -0
- package/dist/internal/Lexical.js.map +1 -0
- package/dist/internal/Literal.d.ts +3459 -0
- package/dist/internal/Literal.d.ts.map +1 -0
- package/dist/internal/Literal.js +3371 -0
- package/dist/internal/Literal.js.map +1 -0
- package/dist/internal/NativeProperties.d.ts +596 -0
- package/dist/internal/NativeProperties.d.ts.map +1 -0
- package/dist/internal/NativeProperties.js +2 -0
- package/dist/internal/NativeProperties.js.map +1 -0
- package/dist/internal/Numeric.d.ts +23 -0
- package/dist/internal/Numeric.d.ts.map +1 -0
- package/dist/internal/Numeric.js +2 -0
- package/dist/internal/Numeric.js.map +1 -0
- package/dist/internal/Query.d.ts +15 -0
- package/dist/internal/Query.d.ts.map +1 -0
- package/dist/internal/Query.js +58 -0
- package/dist/internal/Query.js.map +1 -0
- package/dist/internal/Recipe.d.ts +17 -0
- package/dist/internal/Recipe.d.ts.map +1 -0
- package/dist/internal/Recipe.js +2 -0
- package/dist/internal/Recipe.js.map +1 -0
- package/dist/internal/RuleReference.d.ts +23 -0
- package/dist/internal/RuleReference.d.ts.map +1 -0
- package/dist/internal/RuleReference.js +65 -0
- package/dist/internal/RuleReference.js.map +1 -0
- package/dist/internal/Scheme.d.ts +12 -0
- package/dist/internal/Scheme.d.ts.map +1 -0
- package/dist/internal/Scheme.js +16 -0
- package/dist/internal/Scheme.js.map +1 -0
- package/dist/internal/Shorthands.d.ts +20 -0
- package/dist/internal/Shorthands.d.ts.map +1 -0
- package/dist/internal/Shorthands.js +49 -0
- package/dist/internal/Shorthands.js.map +1 -0
- package/dist/internal/Targets.d.ts +43 -0
- package/dist/internal/Targets.d.ts.map +1 -0
- package/dist/internal/Targets.js +60 -0
- package/dist/internal/Targets.js.map +1 -0
- package/dist/internal/Token.d.ts +104 -0
- package/dist/internal/Token.d.ts.map +1 -0
- package/dist/internal/Token.js +162 -0
- package/dist/internal/Token.js.map +1 -0
- package/dist/internal/Tuple.d.ts +23 -0
- package/dist/internal/Tuple.d.ts.map +1 -0
- package/dist/internal/Tuple.js +2 -0
- package/dist/internal/Tuple.js.map +1 -0
- package/dist/internal/Value.d.ts +74 -0
- package/dist/internal/Value.d.ts.map +1 -0
- package/dist/internal/Value.js +60 -0
- package/dist/internal/Value.js.map +1 -0
- package/dist/metro/Graph.d.ts +8 -0
- package/dist/metro/Graph.d.ts.map +1 -0
- package/dist/metro/Graph.js +63 -0
- package/dist/metro/Graph.js.map +1 -0
- package/dist/metro/Watch.d.ts +21 -0
- package/dist/metro/Watch.d.ts.map +1 -0
- package/dist/metro/Watch.js +51 -0
- package/dist/metro/Watch.js.map +1 -0
- package/dist/metro/index.d.ts +30 -0
- package/dist/metro/index.d.ts.map +1 -0
- package/dist/metro/index.js +52 -0
- package/dist/metro/index.js.map +1 -0
- package/dist/metro/transformer.d.ts +21 -0
- package/dist/metro/transformer.d.ts.map +1 -0
- package/dist/metro/transformer.js +71 -0
- package/dist/metro/transformer.js.map +1 -0
- package/dist/next/index.d.ts +18 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +92 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/loader.d.ts +16 -0
- package/dist/next/loader.d.ts.map +1 -0
- package/dist/next/loader.js +282 -0
- package/dist/next/loader.js.map +1 -0
- package/dist/node/Host.d.ts +80 -0
- package/dist/node/Host.d.ts.map +1 -0
- package/dist/node/Host.js +882 -0
- package/dist/node/Host.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +7 -0
- package/dist/node/index.js.map +1 -0
- package/dist/react-native/Host.d.ts +76 -0
- package/dist/react-native/Host.d.ts.map +1 -0
- package/dist/react-native/Host.js +209 -0
- package/dist/react-native/Host.js.map +1 -0
- package/dist/react-native/StyleSheet.d.ts +226 -0
- package/dist/react-native/StyleSheet.d.ts.map +1 -0
- package/dist/react-native/StyleSheet.js +606 -0
- package/dist/react-native/StyleSheet.js.map +1 -0
- package/dist/react-native/Variants.d.ts +38 -0
- package/dist/react-native/Variants.d.ts.map +1 -0
- package/dist/react-native/Variants.js +66 -0
- package/dist/react-native/Variants.js.map +1 -0
- package/dist/react-native/index.d.ts +8 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +8 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/internal/Color.d.ts +7 -0
- package/dist/react-native/internal/Color.d.ts.map +1 -0
- package/dist/react-native/internal/Color.js +93 -0
- package/dist/react-native/internal/Color.js.map +1 -0
- package/dist/react-native/internal/NativeSchema.d.ts +5138 -0
- package/dist/react-native/internal/NativeSchema.d.ts.map +1 -0
- package/dist/react-native/internal/NativeSchema.js +3097 -0
- package/dist/react-native/internal/NativeSchema.js.map +1 -0
- package/dist/react-native/internal/Scalar.d.ts +95 -0
- package/dist/react-native/internal/Scalar.d.ts.map +1 -0
- package/dist/react-native/internal/Scalar.js +199 -0
- package/dist/react-native/internal/Scalar.js.map +1 -0
- package/dist/react-native/internal/Values.d.ts +5 -0
- package/dist/react-native/internal/Values.d.ts.map +1 -0
- package/dist/react-native/internal/Values.js +65 -0
- package/dist/react-native/internal/Values.js.map +1 -0
- package/dist/react-native/react.d.ts +22 -0
- package/dist/react-native/react.d.ts.map +1 -0
- package/dist/react-native/react.js +26 -0
- package/dist/react-native/react.js.map +1 -0
- package/dist/reset.css +244 -0
- package/dist/runtime/Appearance.d.ts +55 -0
- package/dist/runtime/Appearance.d.ts.map +1 -0
- package/dist/runtime/Appearance.js +84 -0
- package/dist/runtime/Appearance.js.map +1 -0
- package/dist/runtime/Composition.d.ts +46 -0
- package/dist/runtime/Composition.d.ts.map +1 -0
- package/dist/runtime/Composition.js +52 -0
- package/dist/runtime/Composition.js.map +1 -0
- package/dist/runtime/CompositionHtml.d.ts +15 -0
- package/dist/runtime/CompositionHtml.d.ts.map +1 -0
- package/dist/runtime/CompositionHtml.js +20 -0
- package/dist/runtime/CompositionHtml.js.map +1 -0
- package/dist/runtime/ConditionalRecipe.d.ts +30 -0
- package/dist/runtime/ConditionalRecipe.d.ts.map +1 -0
- package/dist/runtime/ConditionalRecipe.js +39 -0
- package/dist/runtime/ConditionalRecipe.js.map +1 -0
- package/dist/runtime/Dynamic.d.ts +19 -0
- package/dist/runtime/Dynamic.d.ts.map +1 -0
- package/dist/runtime/Dynamic.js +22 -0
- package/dist/runtime/Dynamic.js.map +1 -0
- package/dist/runtime/Html.d.ts +32 -0
- package/dist/runtime/Html.d.ts.map +1 -0
- package/dist/runtime/Html.js +63 -0
- package/dist/runtime/Html.js.map +1 -0
- package/dist/runtime/Native.d.ts +48 -0
- package/dist/runtime/Native.d.ts.map +1 -0
- package/dist/runtime/Native.js +78 -0
- package/dist/runtime/Native.js.map +1 -0
- package/dist/runtime/NativeContext.d.ts +17 -0
- package/dist/runtime/NativeContext.d.ts.map +1 -0
- package/dist/runtime/NativeContext.js +47 -0
- package/dist/runtime/NativeContext.js.map +1 -0
- package/dist/runtime/NativeDynamic.d.ts +47 -0
- package/dist/runtime/NativeDynamic.d.ts.map +1 -0
- package/dist/runtime/NativeDynamic.js +141 -0
- package/dist/runtime/NativeDynamic.js.map +1 -0
- package/dist/runtime/PayloadRecipe.d.ts +22 -0
- package/dist/runtime/PayloadRecipe.d.ts.map +1 -0
- package/dist/runtime/PayloadRecipe.js +59 -0
- package/dist/runtime/PayloadRecipe.js.map +1 -0
- package/dist/runtime/Props.d.ts +21 -0
- package/dist/runtime/Props.d.ts.map +1 -0
- package/dist/runtime/Props.js +17 -0
- package/dist/runtime/Props.js.map +1 -0
- package/dist/runtime/Recipe.d.ts +52 -0
- package/dist/runtime/Recipe.d.ts.map +1 -0
- package/dist/runtime/Recipe.js +30 -0
- package/dist/runtime/Recipe.js.map +1 -0
- package/dist/runtime/Selection.d.ts +31 -0
- package/dist/runtime/Selection.d.ts.map +1 -0
- package/dist/runtime/Selection.js +30 -0
- package/dist/runtime/Selection.js.map +1 -0
- package/dist/runtime/Variable.d.ts +6 -0
- package/dist/runtime/Variable.d.ts.map +1 -0
- package/dist/runtime/Variable.js +10 -0
- package/dist/runtime/Variable.js.map +1 -0
- package/dist/runtime/index.d.ts +33 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +33 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/styleFunction.d.ts +72 -0
- package/dist/styleFunction.d.ts.map +1 -0
- package/dist/styleFunction.js +18 -0
- package/dist/styleFunction.js.map +1 -0
- package/dist/themes/LICENSE.tailwind +21 -0
- package/dist/variable.d.ts +50 -0
- package/dist/variable.d.ts.map +1 -0
- package/dist/variable.js +20 -0
- package/dist/variable.js.map +1 -0
- package/dist/variants.d.ts +84 -0
- package/dist/variants.d.ts.map +1 -0
- package/dist/variants.js +21 -0
- package/dist/variants.js.map +1 -0
- package/dist/vite/index.d.ts +24 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +1089 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/web/Css.d.ts +81 -0
- package/dist/web/Css.d.ts.map +1 -0
- package/dist/web/Css.js +593 -0
- package/dist/web/Css.js.map +1 -0
- package/dist/web/colorProfile.d.ts +28 -0
- package/dist/web/colorProfile.d.ts.map +1 -0
- package/dist/web/colorProfile.js +8 -0
- package/dist/web/colorProfile.js.map +1 -0
- package/dist/web/counterStyle.d.ts +48 -0
- package/dist/web/counterStyle.d.ts.map +1 -0
- package/dist/web/counterStyle.js +8 -0
- package/dist/web/counterStyle.js.map +1 -0
- package/dist/web/cssFunction.d.ts +80 -0
- package/dist/web/cssFunction.d.ts.map +1 -0
- package/dist/web/cssFunction.js +18 -0
- package/dist/web/cssFunction.js.map +1 -0
- package/dist/web/customMedia.d.ts +12 -0
- package/dist/web/customMedia.d.ts.map +1 -0
- package/dist/web/customMedia.js +7 -0
- package/dist/web/customMedia.js.map +1 -0
- package/dist/web/fontFace.d.ts +26 -0
- package/dist/web/fontFace.d.ts.map +1 -0
- package/dist/web/fontFace.js +7 -0
- package/dist/web/fontFace.js.map +1 -0
- package/dist/web/fontFeatureValues.d.ts +40 -0
- package/dist/web/fontFeatureValues.d.ts.map +1 -0
- package/dist/web/fontFeatureValues.js +7 -0
- package/dist/web/fontFeatureValues.js.map +1 -0
- package/dist/web/fontPaletteValues.d.ts +21 -0
- package/dist/web/fontPaletteValues.d.ts.map +1 -0
- package/dist/web/fontPaletteValues.js +9 -0
- package/dist/web/fontPaletteValues.js.map +1 -0
- package/dist/web/global.d.ts +19 -0
- package/dist/web/global.d.ts.map +1 -0
- package/dist/web/global.js +6 -0
- package/dist/web/global.js.map +1 -0
- package/dist/web/importCss.d.ts +18 -0
- package/dist/web/importCss.d.ts.map +1 -0
- package/dist/web/importCss.js +7 -0
- package/dist/web/importCss.js.map +1 -0
- package/dist/web/index.d.ts +22 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +22 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/internal/Block.d.ts +18 -0
- package/dist/web/internal/Block.d.ts.map +1 -0
- package/dist/web/internal/Block.js +13 -0
- package/dist/web/internal/Block.js.map +1 -0
- package/dist/web/internal/ClassName.d.ts +19 -0
- package/dist/web/internal/ClassName.d.ts.map +1 -0
- package/dist/web/internal/ClassName.js +77 -0
- package/dist/web/internal/ClassName.js.map +1 -0
- package/dist/web/internal/Context.d.ts +11 -0
- package/dist/web/internal/Context.d.ts.map +1 -0
- package/dist/web/internal/Context.js +2 -0
- package/dist/web/internal/Context.js.map +1 -0
- package/dist/web/internal/Contributions.d.ts +70 -0
- package/dist/web/internal/Contributions.d.ts.map +1 -0
- package/dist/web/internal/Contributions.js +109 -0
- package/dist/web/internal/Contributions.js.map +1 -0
- package/dist/web/internal/Namespace.d.ts +13 -0
- package/dist/web/internal/Namespace.d.ts.map +1 -0
- package/dist/web/internal/Namespace.js +13 -0
- package/dist/web/internal/Namespace.js.map +1 -0
- package/dist/web/internal/Themes.d.ts +13 -0
- package/dist/web/internal/Themes.d.ts.map +1 -0
- package/dist/web/internal/Themes.js +96 -0
- package/dist/web/internal/Themes.js.map +1 -0
- package/dist/web/keyframes.d.ts +14 -0
- package/dist/web/keyframes.d.ts.map +1 -0
- package/dist/web/keyframes.js +8 -0
- package/dist/web/keyframes.js.map +1 -0
- package/dist/web/layers.d.ts +4 -0
- package/dist/web/layers.d.ts.map +1 -0
- package/dist/web/layers.js +7 -0
- package/dist/web/layers.js.map +1 -0
- package/dist/web/namespace.d.ts +14 -0
- package/dist/web/namespace.d.ts.map +1 -0
- package/dist/web/namespace.js +7 -0
- package/dist/web/namespace.js.map +1 -0
- package/dist/web/page.d.ts +38 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +7 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/positionTry.d.ts +14 -0
- package/dist/web/positionTry.d.ts.map +1 -0
- package/dist/web/positionTry.js +9 -0
- package/dist/web/positionTry.js.map +1 -0
- package/dist/web/property.d.ts +24 -0
- package/dist/web/property.d.ts.map +1 -0
- package/dist/web/property.js +7 -0
- package/dist/web/property.js.map +1 -0
- package/dist/web/viewTransition.d.ts +29 -0
- package/dist/web/viewTransition.d.ts.map +1 -0
- package/dist/web/viewTransition.js +7 -0
- package/dist/web/viewTransition.js.map +1 -0
- package/package.json +136 -10
- package/src/Config.ts +690 -0
- package/src/Props.ts +8 -0
- package/src/Style.ts +748 -0
- package/src/Theme.ts +713 -0
- package/src/babel/NativeEdits.ts +273 -0
- package/src/babel/NativeJsx.ts +260 -0
- package/src/babel/index.ts +332 -0
- package/src/cli/index.ts +196 -0
- package/src/compiler/Graph.ts +1586 -0
- package/src/compiler/Native.ts +801 -0
- package/src/compiler/Source.ts +1550 -0
- package/src/compiler/Transform.ts +1235 -0
- package/src/compiler/index.ts +12 -0
- package/src/compiler/internal/Applications.ts +378 -0
- package/src/compiler/internal/AtRules.ts +202 -0
- package/src/compiler/internal/Catalogs.ts +114 -0
- package/src/compiler/internal/ColorProfiles.ts +93 -0
- package/src/compiler/internal/CompositionBindings.ts +120 -0
- package/src/compiler/internal/Compositions.ts +629 -0
- package/src/compiler/internal/Configurations.ts +244 -0
- package/src/compiler/internal/Contract.ts +846 -0
- package/src/compiler/internal/Contributions.ts +1507 -0
- package/src/compiler/internal/Descriptors.ts +238 -0
- package/src/compiler/internal/Dynamic.ts +266 -0
- package/src/compiler/internal/Edits.ts +13 -0
- package/src/compiler/internal/Expression.ts +135 -0
- package/src/compiler/internal/Functions.ts +206 -0
- package/src/compiler/internal/Identifiers.ts +124 -0
- package/src/compiler/internal/Keyframes.ts +62 -0
- package/src/compiler/internal/Namespaces.ts +296 -0
- package/src/compiler/internal/NativeBindings.ts +151 -0
- package/src/compiler/internal/PackedStyles.ts +464 -0
- package/src/compiler/internal/Properties.ts +121 -0
- package/src/compiler/internal/RecipeConditions.ts +139 -0
- package/src/compiler/internal/RecipePayloads.ts +132 -0
- package/src/compiler/internal/Recipes.ts +531 -0
- package/src/compiler/internal/Relative.ts +87 -0
- package/src/compiler/internal/Scope.ts +36 -0
- package/src/compiler/internal/Selectors.ts +334 -0
- package/src/compiler/internal/Static.ts +783 -0
- package/src/compiler/internal/Stylesheets.ts +361 -0
- package/src/compiler/internal/Syntax.ts +31 -0
- package/src/compiler/internal/Themes.ts +1794 -0
- package/src/compiler/internal/Variables.ts +497 -0
- package/src/compiler/internal/ViewTransitions.ts +82 -0
- package/src/cx.ts +98 -0
- package/src/default.ts +484 -0
- package/src/index.ts +20 -0
- package/src/internal/Authoring.ts +199 -0
- package/src/internal/Binding.ts +187 -0
- package/src/internal/BindingDomains.ts +458 -0
- package/src/internal/Cascade.ts +165 -0
- package/src/internal/Compound.ts +522 -0
- package/src/internal/Condition.ts +283 -0
- package/src/internal/Corner.ts +17 -0
- package/src/internal/FunctionSyntax.ts +271 -0
- package/src/internal/FunctionValue.ts +96 -0
- package/src/internal/Geometry.ts +30 -0
- package/src/internal/Grid.ts +67 -0
- package/src/internal/Identifier.ts +14 -0
- package/src/internal/Identity.ts +89 -0
- package/src/internal/Lexical.ts +202 -0
- package/src/internal/Literal.ts +3820 -0
- package/src/internal/NativeProperties.ts +936 -0
- package/src/internal/Numeric.ts +77 -0
- package/src/internal/Query.ts +87 -0
- package/src/internal/Recipe.ts +17 -0
- package/src/internal/RuleReference.ts +102 -0
- package/src/internal/Scheme.ts +20 -0
- package/src/internal/Shorthands.ts +120 -0
- package/src/internal/Targets.ts +162 -0
- package/src/internal/Token.ts +380 -0
- package/src/internal/Tuple.ts +29 -0
- package/src/internal/Value.ts +320 -0
- package/src/metro/Graph.ts +78 -0
- package/src/metro/Watch.ts +88 -0
- package/src/metro/index.ts +99 -0
- package/src/metro/transformer.ts +97 -0
- package/src/next/index.ts +114 -0
- package/src/next/loader.ts +369 -0
- package/src/node/Host.ts +1204 -0
- package/src/node/index.ts +6 -0
- package/src/react-native/Host.ts +289 -0
- package/src/react-native/StyleSheet.ts +1084 -0
- package/src/react-native/Variants.ts +122 -0
- package/src/react-native/index.ts +7 -0
- package/src/react-native/internal/Color.ts +110 -0
- package/src/react-native/internal/NativeSchema.ts +3096 -0
- package/src/react-native/internal/Scalar.ts +253 -0
- package/src/react-native/internal/Values.ts +87 -0
- package/src/react-native/react.ts +47 -0
- package/src/reset.css +244 -0
- package/src/runtime/Appearance.ts +155 -0
- package/src/runtime/Composition.ts +87 -0
- package/src/runtime/CompositionHtml.ts +38 -0
- package/src/runtime/ConditionalRecipe.ts +70 -0
- package/src/runtime/Dynamic.ts +51 -0
- package/src/runtime/Html.ts +91 -0
- package/src/runtime/Native.ts +144 -0
- package/src/runtime/NativeContext.ts +74 -0
- package/src/runtime/NativeDynamic.ts +246 -0
- package/src/runtime/PayloadRecipe.ts +96 -0
- package/src/runtime/Props.ts +33 -0
- package/src/runtime/Recipe.ts +74 -0
- package/src/runtime/Selection.ts +82 -0
- package/src/runtime/Variable.ts +15 -0
- package/src/runtime/index.ts +45 -0
- package/src/styleFunction.ts +138 -0
- package/src/themes/LICENSE.tailwind +21 -0
- package/src/variable.ts +105 -0
- package/src/variants.ts +218 -0
- package/src/vite/index.ts +1473 -0
- package/src/web/Css.ts +801 -0
- package/src/web/colorProfile.ts +60 -0
- package/src/web/counterStyle.ts +82 -0
- package/src/web/cssFunction.ts +181 -0
- package/src/web/customMedia.ts +16 -0
- package/src/web/fontFace.ts +41 -0
- package/src/web/fontFeatureValues.ts +79 -0
- package/src/web/fontPaletteValues.ts +42 -0
- package/src/web/global.ts +39 -0
- package/src/web/importCss.ts +23 -0
- package/src/web/index.ts +22 -0
- package/src/web/internal/Block.ts +29 -0
- package/src/web/internal/ClassName.ts +112 -0
- package/src/web/internal/Context.ts +16 -0
- package/src/web/internal/Contributions.ts +219 -0
- package/src/web/internal/Namespace.ts +21 -0
- package/src/web/internal/Themes.ts +133 -0
- package/src/web/keyframes.ts +43 -0
- package/src/web/layers.ts +6 -0
- package/src/web/namespace.ts +19 -0
- package/src/web/page.ts +140 -0
- package/src/web/positionTry.ts +71 -0
- package/src/web/property.ts +35 -0
- package/src/web/viewTransition.ts +89 -0
package/src/web/Css.ts
ADDED
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits deterministic CSS, class mappings, and live theme scopes from ordered styles.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import * as Targets from '../internal/Targets.js'
|
|
6
|
+
import * as ClassName from './internal/ClassName.js'
|
|
7
|
+
import * as Contributions from './internal/Contributions.js'
|
|
8
|
+
import * as Binding from '../internal/Binding.js'
|
|
9
|
+
import * as Cascade from '../internal/Cascade.js'
|
|
10
|
+
import * as Literal from '../internal/Literal.js'
|
|
11
|
+
import * as Token from '../internal/Token.js'
|
|
12
|
+
import type * as Style from '../Style.js'
|
|
13
|
+
import type * as Theme from '../Theme.js'
|
|
14
|
+
import * as Themes from './internal/Themes.js'
|
|
15
|
+
|
|
16
|
+
/** Explicit ordered stylesheet contribution data. */
|
|
17
|
+
export type Contribution = Contributions.Definition
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Emits atomic or grouped CSS without reading files or generating runtime code.
|
|
21
|
+
* Shares only nonconflicting declaration domains; conflicting rules retain authored
|
|
22
|
+
* order by default. Independent composition deduplicates complete applications.
|
|
23
|
+
* Class lists are scoped to the complete compilation input. Empty styles
|
|
24
|
+
* return an empty class list and no rule.
|
|
25
|
+
* @param options - Validated, ordered definitions from Style.define.
|
|
26
|
+
* @returns Frozen class and theme maps alongside stylesheet text.
|
|
27
|
+
* @throws {CompileError} If declarations or themes are invalid, or class identities collide.
|
|
28
|
+
*/
|
|
29
|
+
export function compile<
|
|
30
|
+
const name extends string,
|
|
31
|
+
const themeName extends string = never,
|
|
32
|
+
>(
|
|
33
|
+
options: compile.Options<name, themeName>,
|
|
34
|
+
): compile.ReturnType<name, themeName> {
|
|
35
|
+
options = {
|
|
36
|
+
...options,
|
|
37
|
+
styles: { styles: options.styles.styles.map(Targets.web) },
|
|
38
|
+
}
|
|
39
|
+
let theme: ReturnType<typeof Themes.create> | undefined
|
|
40
|
+
|
|
41
|
+
const references = new Map<object, boolean>()
|
|
42
|
+
|
|
43
|
+
function isReference(value: unknown): value is Token.Reference {
|
|
44
|
+
if (typeof value !== 'object' || value === null) return false
|
|
45
|
+
|
|
46
|
+
const previous = references.get(value)
|
|
47
|
+
if (previous !== undefined) return previous
|
|
48
|
+
|
|
49
|
+
const result = Token.is(value)
|
|
50
|
+
|
|
51
|
+
references.set(value, result)
|
|
52
|
+
|
|
53
|
+
return result
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Only primitive declaration lists can be interned without erasing token identity.
|
|
57
|
+
const repeated = new Map<string, Style.NamedStyle>()
|
|
58
|
+
|
|
59
|
+
const canonicalStyles = options.styles.styles.map((style) => {
|
|
60
|
+
if (
|
|
61
|
+
'rules' in style ||
|
|
62
|
+
style.declarations.some(
|
|
63
|
+
(declaration) => typeof declaration.value === 'object',
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
return style
|
|
67
|
+
|
|
68
|
+
const key = JSON.stringify(
|
|
69
|
+
style.declarations.map(({ important, property, value }) => [
|
|
70
|
+
property,
|
|
71
|
+
value,
|
|
72
|
+
important,
|
|
73
|
+
]),
|
|
74
|
+
)
|
|
75
|
+
const previous = repeated.get(key)
|
|
76
|
+
if (previous) return previous
|
|
77
|
+
|
|
78
|
+
repeated.set(key, style)
|
|
79
|
+
|
|
80
|
+
return style
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const analyzed = [...new Set(canonicalStyles)]
|
|
84
|
+
const classes = Object.create(null) as Record<name, string>
|
|
85
|
+
const diagnostics: Diagnostic[] = []
|
|
86
|
+
const groups = new Map<string, false | string>()
|
|
87
|
+
const nestedComposition = options.styles.styles.some((style) => style.rules)
|
|
88
|
+
|
|
89
|
+
const properties = new Set<Style.Declaration['property']>()
|
|
90
|
+
for (const style of analyzed)
|
|
91
|
+
for (const { property } of style.declarations) properties.add(property)
|
|
92
|
+
|
|
93
|
+
// Logical dimensions may alias either physical axis in inherited writing modes.
|
|
94
|
+
// Preserve physical-only factoring when no logical dimension is authored.
|
|
95
|
+
const logicalSizing = [...properties].some((property) =>
|
|
96
|
+
/^(min|max)?(blockSize|inlineSize)$/i.test(property),
|
|
97
|
+
)
|
|
98
|
+
const resets = properties.has('all')
|
|
99
|
+
const combinedLines = new Set<string>()
|
|
100
|
+
|
|
101
|
+
for (const property of properties)
|
|
102
|
+
if (Literal.rule(property)?.kind === 'line') {
|
|
103
|
+
const name = canonical(property)
|
|
104
|
+
combinedLines.add(name.startsWith('border') ? 'border' : name)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function canonical(property: string): string {
|
|
108
|
+
return property in Literal.aliases
|
|
109
|
+
? Literal.aliases[property as keyof typeof Literal.aliases]
|
|
110
|
+
: property
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function domain(property: string): string {
|
|
114
|
+
if (
|
|
115
|
+
resets &&
|
|
116
|
+
!property.startsWith('--') &&
|
|
117
|
+
property !== 'direction' &&
|
|
118
|
+
property !== 'unicodeBidi'
|
|
119
|
+
)
|
|
120
|
+
return 'all'
|
|
121
|
+
|
|
122
|
+
if (/^marker(?:Start|Mid|End)?$/.test(property)) return 'marker'
|
|
123
|
+
if (property.startsWith('corner')) return 'cornerShape'
|
|
124
|
+
if (property.startsWith('containIntrinsic')) return 'containIntrinsicSize'
|
|
125
|
+
if (property.startsWith('interestDelay')) return 'interestDelay'
|
|
126
|
+
if (property.startsWith('backgroundPosition')) return 'backgroundPosition'
|
|
127
|
+
|
|
128
|
+
if (combinedLines.has('columnRule') && property.startsWith('columnRule'))
|
|
129
|
+
return 'columnRule'
|
|
130
|
+
|
|
131
|
+
if (combinedLines.has('outline') && property.startsWith('outline'))
|
|
132
|
+
return 'outline'
|
|
133
|
+
|
|
134
|
+
if (property.startsWith('borderImage')) return 'borderImage'
|
|
135
|
+
|
|
136
|
+
if (property.startsWith('border')) {
|
|
137
|
+
if (combinedLines.has('border')) return 'border'
|
|
138
|
+
|
|
139
|
+
if (property.endsWith('Color')) {
|
|
140
|
+
return 'borderColor'
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (property.endsWith('Style')) {
|
|
144
|
+
return 'borderStyle'
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (property.endsWith('Width')) {
|
|
148
|
+
return 'borderWidth'
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return 'borderRadius'
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (['flexDirection', 'flexFlow', 'flexWrap'].includes(property))
|
|
155
|
+
return 'flexFlow'
|
|
156
|
+
|
|
157
|
+
if (/^(pageBreak|break)(After|Before|Inside)$/.test(property))
|
|
158
|
+
return property.replace('pageBreak', 'break')
|
|
159
|
+
|
|
160
|
+
if (['fontStretch', 'fontWidth'].includes(property)) return 'fontWidth'
|
|
161
|
+
if (property.startsWith('fontSynthesis')) return 'fontSynthesis'
|
|
162
|
+
|
|
163
|
+
if (
|
|
164
|
+
[
|
|
165
|
+
'whiteSpace',
|
|
166
|
+
'whiteSpaceCollapse',
|
|
167
|
+
'textWrap',
|
|
168
|
+
'textWrapMode',
|
|
169
|
+
'textWrapStyle',
|
|
170
|
+
].includes(property)
|
|
171
|
+
)
|
|
172
|
+
return 'whiteSpace'
|
|
173
|
+
|
|
174
|
+
if (['wordWrap', 'overflowWrap'].includes(property)) return 'overflowWrap'
|
|
175
|
+
|
|
176
|
+
if (property.startsWith('margin')) {
|
|
177
|
+
return 'margin'
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (property.startsWith('padding')) {
|
|
181
|
+
return 'padding'
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (
|
|
185
|
+
property === 'overflow' ||
|
|
186
|
+
property === 'overflowX' ||
|
|
187
|
+
property === 'overflowY' ||
|
|
188
|
+
property === 'overflowBlock' ||
|
|
189
|
+
property === 'overflowInline'
|
|
190
|
+
) {
|
|
191
|
+
return 'overflow'
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (property.startsWith('overscrollBehavior')) {
|
|
195
|
+
return 'overscrollBehavior'
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (property.startsWith('scrollMargin')) {
|
|
199
|
+
return 'scrollMargin'
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (property.startsWith('scrollPadding')) {
|
|
203
|
+
return 'scrollPadding'
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (['columnGap', 'gap', 'rowGap'].includes(property)) {
|
|
207
|
+
return 'gap'
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (/^(inset|top$|right$|bottom$|left$)/.test(property)) {
|
|
211
|
+
return 'inset'
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (
|
|
215
|
+
logicalSizing &&
|
|
216
|
+
/^(min|max)?(width|height|blockSize|inlineSize)$/i.test(property)
|
|
217
|
+
) {
|
|
218
|
+
if (property.startsWith('min')) {
|
|
219
|
+
return 'min-size'
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (property.startsWith('max')) {
|
|
223
|
+
return 'max-size'
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return 'size'
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return property
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const parents = new Map<string, string>()
|
|
233
|
+
|
|
234
|
+
function root(domain: string): string {
|
|
235
|
+
const parent = parents.get(domain)
|
|
236
|
+
if (!parent) return domain
|
|
237
|
+
|
|
238
|
+
const result = root(parent)
|
|
239
|
+
|
|
240
|
+
parents.set(domain, result)
|
|
241
|
+
|
|
242
|
+
return result
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Union only authored shorthands. Unrelated axes retain their original factoring.
|
|
246
|
+
// Recursion includes nested and reset-only shorthands without parsing CSS values.
|
|
247
|
+
function join(property: string, target: string, visited = new Set<string>()) {
|
|
248
|
+
if (visited.has(property)) return
|
|
249
|
+
|
|
250
|
+
visited.add(property)
|
|
251
|
+
|
|
252
|
+
const current = root(domain(canonical(property)))
|
|
253
|
+
const group = root(target)
|
|
254
|
+
|
|
255
|
+
if (current !== group) parents.set(current, group)
|
|
256
|
+
|
|
257
|
+
if (Object.hasOwn(Cascade.shorthands, property))
|
|
258
|
+
for (const child of Cascade.shorthands[
|
|
259
|
+
property as keyof typeof Cascade.shorthands
|
|
260
|
+
])
|
|
261
|
+
join(child, target, visited)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
for (const property of new Set([...properties].map(canonical)))
|
|
265
|
+
if (Object.hasOwn(Cascade.shorthands, property))
|
|
266
|
+
join(property, domain(property))
|
|
267
|
+
|
|
268
|
+
const serialized = new Map<object, string>()
|
|
269
|
+
|
|
270
|
+
function serialize(input: Style.Declaration['value']): number | string {
|
|
271
|
+
if (typeof input !== 'object' || input === null) return input
|
|
272
|
+
|
|
273
|
+
const cached = serialized.get(input)
|
|
274
|
+
if (cached !== undefined) return cached
|
|
275
|
+
|
|
276
|
+
const value = serializeReference(input)
|
|
277
|
+
|
|
278
|
+
if (typeof value === 'string') serialized.set(input, value)
|
|
279
|
+
|
|
280
|
+
return value
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function serializeReference(
|
|
284
|
+
input: Style.Declaration['value'],
|
|
285
|
+
): number | string {
|
|
286
|
+
if (Binding.is(input)) return `var(${input.name})`
|
|
287
|
+
if (isReference(input)) return (theme ??= Themes.create()).serialize(input)
|
|
288
|
+
|
|
289
|
+
if (Token.isExpression(input))
|
|
290
|
+
return input.parts
|
|
291
|
+
.map((part) => (typeof part === 'string' ? part : serialize(part)))
|
|
292
|
+
.join('')
|
|
293
|
+
|
|
294
|
+
return input as number | string
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const declarations = new Map<Style.Declaration, string>()
|
|
298
|
+
const propertyNames = new Map<string, string>()
|
|
299
|
+
|
|
300
|
+
function declarationBody(declaration: Style.Declaration): string {
|
|
301
|
+
const previous = declarations.get(declaration)
|
|
302
|
+
if (previous !== undefined) return previous
|
|
303
|
+
const { important, property, value } = declaration
|
|
304
|
+
const name = propertyNames.get(property) ?? Literal.name(property)
|
|
305
|
+
propertyNames.set(property, name)
|
|
306
|
+
const body = `${name}:${serialize(value)}${important ? '!important' : ''};`
|
|
307
|
+
declarations.set(declaration, body)
|
|
308
|
+
return body
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const bodies = new Map<Style.NamedStyle, string>()
|
|
312
|
+
|
|
313
|
+
function nested(style: Style.NamedStyle): string {
|
|
314
|
+
const previous = bodies.get(style)
|
|
315
|
+
if (previous !== undefined) return previous
|
|
316
|
+
const body = renderNested(style)
|
|
317
|
+
bodies.set(style, body)
|
|
318
|
+
return body
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function renderNested(style: Style.NamedStyle): string {
|
|
322
|
+
if (style.rules)
|
|
323
|
+
return style.rules
|
|
324
|
+
.map((rule) => {
|
|
325
|
+
const body = nested(rule.style)
|
|
326
|
+
|
|
327
|
+
return rule.condition === undefined
|
|
328
|
+
? body
|
|
329
|
+
: `${rule.condition}{${body}}`
|
|
330
|
+
})
|
|
331
|
+
.join('')
|
|
332
|
+
|
|
333
|
+
return style.declarations.map(declarationBody).join('')
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const domainsByProperty = new Map<string, string>()
|
|
337
|
+
function conflict(property: string): string {
|
|
338
|
+
const previous = domainsByProperty.get(property)
|
|
339
|
+
if (previous !== undefined) return previous
|
|
340
|
+
const value = root(domain(canonical(property)))
|
|
341
|
+
domainsByProperty.set(property, value)
|
|
342
|
+
return value
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Sharing is safe only when every use of a conflict domain has the same
|
|
346
|
+
// declaration sequence. Conditions conservatively retain contextual identities.
|
|
347
|
+
for (const style of analyzed) {
|
|
348
|
+
const domains = new Map<string, { body: string; property: string }>()
|
|
349
|
+
|
|
350
|
+
for (const item of style.declarations) {
|
|
351
|
+
const property = item.property
|
|
352
|
+
const key = conflict(property)
|
|
353
|
+
const declaration = declarationBody(item)
|
|
354
|
+
if (groups.get(key) === false) continue
|
|
355
|
+
const entry = domains.get(key) ?? {
|
|
356
|
+
body: '',
|
|
357
|
+
property,
|
|
358
|
+
}
|
|
359
|
+
entry.body += declaration
|
|
360
|
+
if (entry.property !== property) groups.set(key, false)
|
|
361
|
+
domains.set(key, entry)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
for (const [key, entry] of domains) {
|
|
365
|
+
const value = entry.body
|
|
366
|
+
|
|
367
|
+
const previous = groups.get(key)
|
|
368
|
+
groups.set(
|
|
369
|
+
key,
|
|
370
|
+
previous === undefined || previous === value ? value : false,
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const defaultMode = options.cssOutput ?? 'atomic'
|
|
376
|
+
if (defaultMode !== 'atomic' && defaultMode !== 'grouped')
|
|
377
|
+
throw new CompileError([
|
|
378
|
+
{
|
|
379
|
+
code: 'invalid_output',
|
|
380
|
+
message: 'cssOutput must be atomic or grouped.',
|
|
381
|
+
path: ['cssOutput'],
|
|
382
|
+
},
|
|
383
|
+
])
|
|
384
|
+
|
|
385
|
+
function outputMode(style: Style.NamedStyle) {
|
|
386
|
+
return Object.getOwnPropertyDescriptor(style, 'cssOutput')?.value as
|
|
387
|
+
| 'atomic'
|
|
388
|
+
| 'grouped'
|
|
389
|
+
| undefined
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function representation(style: Style.NamedStyle): unknown {
|
|
393
|
+
return [
|
|
394
|
+
outputMode(style),
|
|
395
|
+
style.rules?.map((rule) => representation(rule.style)),
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function validate(style: Style.NamedStyle) {
|
|
400
|
+
if (
|
|
401
|
+
outputMode(style) !== undefined &&
|
|
402
|
+
outputMode(style) !== 'atomic' &&
|
|
403
|
+
outputMode(style) !== 'grouped'
|
|
404
|
+
)
|
|
405
|
+
throw new CompileError([
|
|
406
|
+
{
|
|
407
|
+
code: 'invalid_output',
|
|
408
|
+
message: 'cssOutput must be atomic or grouped.',
|
|
409
|
+
path: [style.name, 'cssOutput'],
|
|
410
|
+
},
|
|
411
|
+
])
|
|
412
|
+
for (const rule of style.rules ?? []) validate(rule.style)
|
|
413
|
+
}
|
|
414
|
+
for (const style of options.styles.styles) validate(style)
|
|
415
|
+
|
|
416
|
+
const identities = new Map<string, string>()
|
|
417
|
+
const rules = new Map<string, string>()
|
|
418
|
+
const identical = new Map<string, string>()
|
|
419
|
+
const explicitBodies = new Map<string, string>()
|
|
420
|
+
const selectors = new Map<string, string>()
|
|
421
|
+
const explicitModes = new Set<string>()
|
|
422
|
+
const applications = new Map<string, string>()
|
|
423
|
+
const occurrences = new Map<string, number>()
|
|
424
|
+
for (const style of options.styles.styles)
|
|
425
|
+
for (const declaration of style.declarations) {
|
|
426
|
+
const key = conflict(declaration.property)
|
|
427
|
+
occurrences.set(key, (occurrences.get(key) ?? 0) + 1)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
for (const [styleIndex, style] of options.styles.styles.entries()) {
|
|
431
|
+
const mode = outputMode(style) ?? defaultMode
|
|
432
|
+
if (!style.name || Object.hasOwn(classes, style.name)) {
|
|
433
|
+
diagnostics.push({
|
|
434
|
+
code: 'invalid_name',
|
|
435
|
+
message: 'Style names must be nonempty and unique.',
|
|
436
|
+
path: [style.name],
|
|
437
|
+
})
|
|
438
|
+
continue
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const explicit = options.names?.[style.name]
|
|
442
|
+
if (explicit !== undefined) {
|
|
443
|
+
const body = nested(style)
|
|
444
|
+
const previous = explicitBodies.get(explicit)
|
|
445
|
+
if (previous !== undefined && previous !== body)
|
|
446
|
+
diagnostics.push({
|
|
447
|
+
code: 'identity_collision',
|
|
448
|
+
message: 'An explicit id is used for different styles.',
|
|
449
|
+
path: [style.name],
|
|
450
|
+
})
|
|
451
|
+
explicitBodies.set(explicit, body)
|
|
452
|
+
classes[style.name] = explicit
|
|
453
|
+
const key = `${explicit}:${mode}`
|
|
454
|
+
if (explicitModes.has(key)) continue
|
|
455
|
+
explicitModes.add(key)
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const application =
|
|
459
|
+
explicit === undefined &&
|
|
460
|
+
options.composition === 'independent' &&
|
|
461
|
+
!options.development
|
|
462
|
+
? `${mode}:${JSON.stringify(representation(style))}:${nested(canonicalStyles[styleIndex]!)}`
|
|
463
|
+
: undefined
|
|
464
|
+
if (application !== undefined && applications.has(application)) {
|
|
465
|
+
classes[style.name] = applications.get(application)!
|
|
466
|
+
continue
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const names: string[] = explicit === undefined ? [] : [explicit]
|
|
470
|
+
let ordinal = 0
|
|
471
|
+
const slots = new Map<string, number>()
|
|
472
|
+
const developmentName = options.scope
|
|
473
|
+
? `definition-${styleIndex}`
|
|
474
|
+
: style.name
|
|
475
|
+
|
|
476
|
+
function emit(body: string, label: string, shared: boolean, output = mode) {
|
|
477
|
+
if (!body) return
|
|
478
|
+
|
|
479
|
+
const independent =
|
|
480
|
+
mode === 'grouped' &&
|
|
481
|
+
!options.development &&
|
|
482
|
+
output === mode &&
|
|
483
|
+
options.composition === 'independent'
|
|
484
|
+
const key = `${output}:${body}`
|
|
485
|
+
// Development slots belong to each style even when their initial values match.
|
|
486
|
+
const reusable =
|
|
487
|
+
explicit === undefined &&
|
|
488
|
+
!options.development &&
|
|
489
|
+
(shared || independent)
|
|
490
|
+
const previous = reusable ? identical.get(key) : undefined
|
|
491
|
+
if (previous && !names.includes(previous)) {
|
|
492
|
+
names.push(previous)
|
|
493
|
+
return
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (previous) shared = false
|
|
497
|
+
|
|
498
|
+
// Contextual slots preserve authored ordering; development names survive value edits.
|
|
499
|
+
const ordinalSlot = ordinal++
|
|
500
|
+
const slot = options.development ? (slots.get(label) ?? 0) : ordinalSlot
|
|
501
|
+
slots.set(label, slot + 1)
|
|
502
|
+
const identity = (() => {
|
|
503
|
+
if (explicit !== undefined)
|
|
504
|
+
return `${explicit}-${mode}-${encode(label)}-${slot}`
|
|
505
|
+
if (
|
|
506
|
+
output === 'grouped' &&
|
|
507
|
+
mode === 'grouped' &&
|
|
508
|
+
!options.development &&
|
|
509
|
+
options.composition === 'independent'
|
|
510
|
+
)
|
|
511
|
+
return `g_${rules.size.toString(36)}`
|
|
512
|
+
if (output === 'grouped' && mode === 'grouped') {
|
|
513
|
+
const name = options.development ? developmentName : style.name
|
|
514
|
+
const scope =
|
|
515
|
+
options.development && options.scope
|
|
516
|
+
? `_m${encode(options.scope)}`
|
|
517
|
+
: ''
|
|
518
|
+
return `g-${encode(name)}${scope}${slot ? `_s${slot}` : ''}`
|
|
519
|
+
}
|
|
520
|
+
return ClassName.create({
|
|
521
|
+
body,
|
|
522
|
+
context:
|
|
523
|
+
!shared || options.development
|
|
524
|
+
? JSON.stringify([
|
|
525
|
+
options.scope,
|
|
526
|
+
mode,
|
|
527
|
+
options.development ? developmentName : style.name,
|
|
528
|
+
])
|
|
529
|
+
: options.scope,
|
|
530
|
+
property: label,
|
|
531
|
+
slot: !shared || options.development ? slot : undefined,
|
|
532
|
+
stable: options.development,
|
|
533
|
+
})
|
|
534
|
+
})()
|
|
535
|
+
const owner = mode === 'atomic' ? `${style.name}:${slot}` : undefined
|
|
536
|
+
if (
|
|
537
|
+
(rules.has(identity) && rules.get(identity) !== body) ||
|
|
538
|
+
(owner !== undefined &&
|
|
539
|
+
identities.has(identity) &&
|
|
540
|
+
identities.get(identity) !== owner)
|
|
541
|
+
)
|
|
542
|
+
diagnostics.push({
|
|
543
|
+
code: 'identity_collision',
|
|
544
|
+
message: 'Distinct rules produced the same class identifier.',
|
|
545
|
+
path: [style.name],
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
if (owner !== undefined) identities.set(identity, owner)
|
|
549
|
+
rules.set(identity, body)
|
|
550
|
+
if (explicit !== undefined) selectors.set(identity, explicit)
|
|
551
|
+
else {
|
|
552
|
+
if (reusable) identical.set(key, identity)
|
|
553
|
+
names.push(identity)
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function atoms(
|
|
558
|
+
style: Style.NamedStyle,
|
|
559
|
+
conditions: readonly string[] = [],
|
|
560
|
+
) {
|
|
561
|
+
if (outputMode(style) === 'grouped') {
|
|
562
|
+
const body = conditions.reduceRight(
|
|
563
|
+
(body, condition) => `${condition}{${body}}`,
|
|
564
|
+
nested(style),
|
|
565
|
+
)
|
|
566
|
+
emit(body, 'style', false, 'grouped')
|
|
567
|
+
return
|
|
568
|
+
}
|
|
569
|
+
if (style.rules) {
|
|
570
|
+
for (const rule of style.rules) {
|
|
571
|
+
if (rule.condition?.trim() === '@layer') {
|
|
572
|
+
// Repeating an anonymous layer would change cascade precedence.
|
|
573
|
+
const body = [...conditions, rule.condition].reduceRight(
|
|
574
|
+
(body, condition) => `${condition}{${body}}`,
|
|
575
|
+
nested(rule.style),
|
|
576
|
+
)
|
|
577
|
+
emit(body, 'layer', false)
|
|
578
|
+
continue
|
|
579
|
+
}
|
|
580
|
+
atoms(
|
|
581
|
+
rule.style,
|
|
582
|
+
rule.condition === undefined
|
|
583
|
+
? conditions
|
|
584
|
+
: [...conditions, rule.condition],
|
|
585
|
+
)
|
|
586
|
+
}
|
|
587
|
+
return
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
for (let index = 0; index < style.declarations.length; ) {
|
|
591
|
+
const declaration = style.declarations[index++]!
|
|
592
|
+
const property = declaration.property
|
|
593
|
+
const values = [declaration]
|
|
594
|
+
// Keep same-property fallbacks ordered; they form one semantic value.
|
|
595
|
+
while (style.declarations[index]?.property === property)
|
|
596
|
+
values.push(style.declarations[index++]!)
|
|
597
|
+
|
|
598
|
+
const value = values
|
|
599
|
+
.map(
|
|
600
|
+
({ important, value }) =>
|
|
601
|
+
`${Literal.name(property)}:${serialize(value)}${important ? '!important' : ''};`,
|
|
602
|
+
)
|
|
603
|
+
.join('')
|
|
604
|
+
const body = conditions.reduceRight(
|
|
605
|
+
(body, condition) => `${condition}{${body}}`,
|
|
606
|
+
value,
|
|
607
|
+
)
|
|
608
|
+
const shared =
|
|
609
|
+
!nestedComposition &&
|
|
610
|
+
!conditions.length &&
|
|
611
|
+
groups.get(conflict(property)) !== false
|
|
612
|
+
emit(body, property, shared)
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
try {
|
|
617
|
+
if (mode === 'grouped') {
|
|
618
|
+
const shared: Style.Declaration[] = []
|
|
619
|
+
const local: Style.Declaration[] = []
|
|
620
|
+
for (const declaration of style.declarations) {
|
|
621
|
+
const key = conflict(declaration.property)
|
|
622
|
+
const reusable =
|
|
623
|
+
!style.rules &&
|
|
624
|
+
options.composition === 'independent' &&
|
|
625
|
+
groups.get(key) !== false &&
|
|
626
|
+
(occurrences.get(key) ?? 0) > 1
|
|
627
|
+
if (reusable) shared.push(declaration)
|
|
628
|
+
else local.push(declaration)
|
|
629
|
+
}
|
|
630
|
+
if (shared.length && local.length) {
|
|
631
|
+
emit(shared.map(declarationBody).join(''), 'shared', false)
|
|
632
|
+
emit(local.map(declarationBody).join(''), 'style', false)
|
|
633
|
+
} else emit(nested(style), 'style', false)
|
|
634
|
+
} else atoms(style)
|
|
635
|
+
} catch (error) {
|
|
636
|
+
diagnostics.push({
|
|
637
|
+
code: 'invalid_declaration',
|
|
638
|
+
message: (error as Error).message,
|
|
639
|
+
path: [style.name],
|
|
640
|
+
})
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
classes[style.name] = [...new Set(names)].join(' ')
|
|
644
|
+
if (application !== undefined)
|
|
645
|
+
applications.set(application, classes[style.name])
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (diagnostics.length) throw new CompileError(diagnostics)
|
|
649
|
+
|
|
650
|
+
const contributionCss = (() => {
|
|
651
|
+
try {
|
|
652
|
+
return Contributions.render(options.contributions ?? [], nested)
|
|
653
|
+
} catch (error) {
|
|
654
|
+
throw new CompileError([
|
|
655
|
+
{
|
|
656
|
+
code: 'invalid_declaration',
|
|
657
|
+
message: (error as Error).message,
|
|
658
|
+
path: ['contributions'],
|
|
659
|
+
},
|
|
660
|
+
])
|
|
661
|
+
}
|
|
662
|
+
})()
|
|
663
|
+
|
|
664
|
+
let scopes: ReturnType<NonNullable<typeof theme>['emit']>
|
|
665
|
+
|
|
666
|
+
try {
|
|
667
|
+
scopes =
|
|
668
|
+
theme || options.themes || options.schemes
|
|
669
|
+
? (theme ??= Themes.create()).emit(
|
|
670
|
+
options.themes ?? {},
|
|
671
|
+
options.schemes ?? false,
|
|
672
|
+
)
|
|
673
|
+
: { classes: Object.freeze({}), css: '' }
|
|
674
|
+
} catch (error) {
|
|
675
|
+
throw new CompileError([
|
|
676
|
+
{
|
|
677
|
+
code: 'invalid_theme',
|
|
678
|
+
message: (error as Error).message,
|
|
679
|
+
path: ['themes'],
|
|
680
|
+
},
|
|
681
|
+
])
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const scopedCss = [
|
|
685
|
+
scopes.css,
|
|
686
|
+
...[...rules].map(
|
|
687
|
+
([name, body]) => `.${selectors.get(name) ?? name}{${body}}`,
|
|
688
|
+
),
|
|
689
|
+
]
|
|
690
|
+
.filter(Boolean)
|
|
691
|
+
.join('\n')
|
|
692
|
+
|
|
693
|
+
return Object.freeze({
|
|
694
|
+
...(contributionCss ? { contributionCss, scopedCss } : {}),
|
|
695
|
+
classes: Object.freeze(classes),
|
|
696
|
+
css: [contributionCss, scopedCss].filter(Boolean).join('\n'),
|
|
697
|
+
themes: scopes.classes as Readonly<Record<themeName, string>>,
|
|
698
|
+
})
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** Input and output contracts for literal compilation. */
|
|
702
|
+
export declare namespace compile {
|
|
703
|
+
/** Structured failure returned by literal compilation. */
|
|
704
|
+
type ErrorType = CompileError
|
|
705
|
+
|
|
706
|
+
/** Environment-independent compiler input. */
|
|
707
|
+
type Options<
|
|
708
|
+
name extends string = string,
|
|
709
|
+
themeName extends string = string,
|
|
710
|
+
> = {
|
|
711
|
+
/** Fixed class identities used by CSS-only consumers. */
|
|
712
|
+
readonly names?: Readonly<Record<string, string>> | undefined
|
|
713
|
+
/**
|
|
714
|
+
* Defaults to ordered, preserving stylesheet precedence across combined class lists.
|
|
715
|
+
* Independent deduplicates complete applications; its class lists must not be
|
|
716
|
+
* combined with each other. Resolve composition before compiling in this mode.
|
|
717
|
+
*/
|
|
718
|
+
/** Eager module-level stylesheet contributions, supplied as static data. */
|
|
719
|
+
readonly contributions?: readonly Contribution[] | undefined
|
|
720
|
+
/** CSS representation; atomic declarations are the default. */
|
|
721
|
+
readonly cssOutput?: 'atomic' | 'grouped' | undefined
|
|
722
|
+
readonly composition?: 'independent' | 'ordered' | undefined
|
|
723
|
+
/** Stable declaration names for CSS-only development updates. */
|
|
724
|
+
readonly development?: boolean | undefined
|
|
725
|
+
/**
|
|
726
|
+
* Emit the `color-scheme` selection classes. Set by modules whose runtime
|
|
727
|
+
* helpers can apply a scheme, so lowered `light-dark()` resolves there.
|
|
728
|
+
*/
|
|
729
|
+
readonly schemes?: boolean | undefined
|
|
730
|
+
/** Optional module scope for independently delivered stylesheets. */
|
|
731
|
+
readonly scope?: string | undefined
|
|
732
|
+
/** Ordered definitions; no themes or source adapter is required. */
|
|
733
|
+
readonly styles: Style.Definition<name>
|
|
734
|
+
/** Named scopes; only variables referenced by these styles are emitted. */
|
|
735
|
+
readonly themes?: Readonly<Record<themeName, Theme.Definition>> | undefined
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** Static web artifacts with precisely inferred authored names. */
|
|
739
|
+
type ReturnType<
|
|
740
|
+
name extends string = string,
|
|
741
|
+
themeName extends string = string,
|
|
742
|
+
> = {
|
|
743
|
+
/** Contribution text separated for graph-wide hoisting. */
|
|
744
|
+
readonly contributionCss?: string | undefined
|
|
745
|
+
/** Ordinary scope and style rules when contributions were supplied. */
|
|
746
|
+
readonly scopedCss?: string | undefined
|
|
747
|
+
/** Readable space-separated class identifiers per authored style. */
|
|
748
|
+
readonly classes: Readonly<Record<name, string>>
|
|
749
|
+
/** Factored CSS preserving cascade behavior, without reset or layers. */
|
|
750
|
+
readonly css: string
|
|
751
|
+
/** Scope classes keyed by the supplied theme labels. */
|
|
752
|
+
readonly themes: Readonly<Record<themeName, string>>
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** Aggregated literal compilation diagnostics in authored traversal order. */
|
|
757
|
+
export class CompileError extends Error {
|
|
758
|
+
/** Copies diagnostic paths and freezes all caller-visible diagnostic data. */
|
|
759
|
+
constructor(diagnostics: readonly Diagnostic[]) {
|
|
760
|
+
super(
|
|
761
|
+
diagnostics
|
|
762
|
+
.map((item) => `${JSON.stringify(item.path)}: ${item.message}`)
|
|
763
|
+
.join('\n'),
|
|
764
|
+
)
|
|
765
|
+
this.diagnostics = Object.freeze(
|
|
766
|
+
diagnostics.map((item) =>
|
|
767
|
+
Object.freeze({
|
|
768
|
+
...item,
|
|
769
|
+
path: Object.freeze([...item.path]),
|
|
770
|
+
}),
|
|
771
|
+
),
|
|
772
|
+
)
|
|
773
|
+
}
|
|
774
|
+
/** Frozen failures with unambiguous component paths. */
|
|
775
|
+
readonly diagnostics: readonly Diagnostic[]
|
|
776
|
+
/** Stable namespaced error identifier. */
|
|
777
|
+
override name = 'Css.CompileError'
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/** A literal compilation failure. */
|
|
781
|
+
export type Diagnostic = {
|
|
782
|
+
/** Stable failure category. */
|
|
783
|
+
readonly code:
|
|
784
|
+
| 'identity_collision'
|
|
785
|
+
| 'invalid_declaration'
|
|
786
|
+
| 'invalid_name'
|
|
787
|
+
| 'invalid_output'
|
|
788
|
+
| 'invalid_theme'
|
|
789
|
+
/** Explanation of the unsupported input. */
|
|
790
|
+
readonly message: string
|
|
791
|
+
/** Authored style name, followed by a property when applicable. */
|
|
792
|
+
readonly path: readonly string[]
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// Encoding underscores and delimiters makes the value form injective.
|
|
796
|
+
function encode(value: string): string {
|
|
797
|
+
return value.replace(
|
|
798
|
+
/[^a-zA-Z0-9-]/g,
|
|
799
|
+
(character) => `_${character.charCodeAt(0).toString(16)}_`,
|
|
800
|
+
)
|
|
801
|
+
}
|