zyzz 0.0.0 → 0.0.3
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 +170 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +325 -0
- package/dist/Style.js.map +1 -0
- package/dist/Theme.d.ts +157 -0
- package/dist/Theme.d.ts.map +1 -0
- package/dist/Theme.js +273 -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 +167 -0
- package/dist/compiler/Source.d.ts.map +1 -0
- package/dist/compiler/Source.js +1012 -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 +886 -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 +607 -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 +3225 -0
- package/dist/default.d.ts.map +1 -0
- package/dist/default.js +547 -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 +50 -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/Typography.d.ts +23 -0
- package/dist/internal/Typography.d.ts.map +1 -0
- package/dist/internal/Typography.js +18 -0
- package/dist/internal/Typography.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 +691 -0
- package/src/Props.ts +8 -0
- package/src/Style.ts +812 -0
- package/src/Theme.ts +784 -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 +1579 -0
- package/src/compiler/Transform.ts +1241 -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 +860 -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 +1177 -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 +122 -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/Typography.ts +51 -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/Style.ts
ADDED
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copies typed style declarations into immutable, ordered, target-independent data.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import * as Condition from './internal/Condition.js'
|
|
6
|
+
import * as Query from './internal/Query.js'
|
|
7
|
+
import * as Binding from './internal/Binding.js'
|
|
8
|
+
import type * as Literal from './internal/Literal.js'
|
|
9
|
+
import * as Token from './internal/Token.js'
|
|
10
|
+
import * as Typography from './internal/Typography.js'
|
|
11
|
+
import * as Value from './internal/Value.js'
|
|
12
|
+
import type * as Theme from './Theme.js'
|
|
13
|
+
import * as Targets from './internal/Targets.js'
|
|
14
|
+
|
|
15
|
+
/** Validates only authored keys, recursively retaining nested token inference. */
|
|
16
|
+
export type Accepted<
|
|
17
|
+
style,
|
|
18
|
+
tokens extends Theme.Tokens = {},
|
|
19
|
+
literal extends boolean = false,
|
|
20
|
+
targets extends boolean = true,
|
|
21
|
+
> = Record<
|
|
22
|
+
Exclude<
|
|
23
|
+
Keys<style>,
|
|
24
|
+
| keyof Literal.Properties
|
|
25
|
+
| Condition.Keys<tokens, Keys<style>>
|
|
26
|
+
| 'selectors'
|
|
27
|
+
| 'targets'
|
|
28
|
+
| 'typography'
|
|
29
|
+
| 'variables'
|
|
30
|
+
>,
|
|
31
|
+
never
|
|
32
|
+
> &
|
|
33
|
+
(style extends unknown
|
|
34
|
+
? {
|
|
35
|
+
[key in keyof style]: key extends 'targets'
|
|
36
|
+
? targets extends true
|
|
37
|
+
? AcceptedTargets<style[key], tokens, literal>
|
|
38
|
+
: never
|
|
39
|
+
: key extends 'selectors'
|
|
40
|
+
? style[key] extends Record<string, unknown>
|
|
41
|
+
? {
|
|
42
|
+
[selector in keyof style[key]]: style[key][selector] extends Record<
|
|
43
|
+
string,
|
|
44
|
+
unknown
|
|
45
|
+
>
|
|
46
|
+
? Accepted<style[key][selector], tokens, literal, targets>
|
|
47
|
+
: never
|
|
48
|
+
}
|
|
49
|
+
: never
|
|
50
|
+
: key extends 'variables'
|
|
51
|
+
? style[key] extends Record<string, unknown>
|
|
52
|
+
? {
|
|
53
|
+
[name in keyof style[key]]: style[key][name] extends
|
|
54
|
+
| number
|
|
55
|
+
| string
|
|
56
|
+
? Literal.Checked<style[key][name]>
|
|
57
|
+
: never
|
|
58
|
+
}
|
|
59
|
+
: never
|
|
60
|
+
: key extends 'typography'
|
|
61
|
+
? literal extends true
|
|
62
|
+
? never
|
|
63
|
+
: Value.Atom<Typography.Names<tokens>>
|
|
64
|
+
: key extends keyof Literal.Properties
|
|
65
|
+
? Value.Accepted<
|
|
66
|
+
Pick<style, key>,
|
|
67
|
+
literal extends true
|
|
68
|
+
? LiteralDeclarations
|
|
69
|
+
: DeclarationProperties<tokens>
|
|
70
|
+
>[key] &
|
|
71
|
+
Value.Checked<Pick<style, key>, tokens>[key]
|
|
72
|
+
: key extends Condition.Keys<tokens, key>
|
|
73
|
+
? [style[key]] extends [undefined]
|
|
74
|
+
? never
|
|
75
|
+
: NonNullable<style[key]> extends Record<string, unknown>
|
|
76
|
+
?
|
|
77
|
+
| Accepted<
|
|
78
|
+
NonNullable<style[key]>,
|
|
79
|
+
tokens,
|
|
80
|
+
literal,
|
|
81
|
+
targets
|
|
82
|
+
>
|
|
83
|
+
| Extract<style[key], undefined>
|
|
84
|
+
: never
|
|
85
|
+
: never
|
|
86
|
+
}
|
|
87
|
+
: never)
|
|
88
|
+
|
|
89
|
+
type AcceptedTargets<
|
|
90
|
+
input,
|
|
91
|
+
tokens extends Theme.Tokens,
|
|
92
|
+
literal extends boolean,
|
|
93
|
+
> = input extends undefined
|
|
94
|
+
? undefined
|
|
95
|
+
: {
|
|
96
|
+
[key in keyof input]: key extends 'web'
|
|
97
|
+
?
|
|
98
|
+
| Accepted<NonNullable<input[key]>, tokens, literal, false>
|
|
99
|
+
| Extract<input[key], undefined>
|
|
100
|
+
: key extends 'android' | 'ios' | 'native'
|
|
101
|
+
? Targets.Declarations<input[key]>
|
|
102
|
+
: never
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Explicit target declarations, applied after shared declarations. */
|
|
106
|
+
export type TargetBranches<tokens extends Theme.Tokens = {}> =
|
|
107
|
+
Targets.NativeBranches & {
|
|
108
|
+
/** Web declarations retain CSS semantics and conditions. */
|
|
109
|
+
readonly web?: Properties<tokens, false> | undefined
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type Keys<value> = value extends unknown ? keyof value : never
|
|
113
|
+
|
|
114
|
+
type Exact<
|
|
115
|
+
styles extends Record<string, unknown>,
|
|
116
|
+
tokens extends Theme.Tokens,
|
|
117
|
+
> = {
|
|
118
|
+
[name in keyof styles]: Extract<
|
|
119
|
+
styles[name],
|
|
120
|
+
(...args: never[]) => unknown
|
|
121
|
+
> extends never
|
|
122
|
+
? Properties<tokens> extends styles[name]
|
|
123
|
+
? styles[name] extends Properties<tokens>
|
|
124
|
+
? styles[name] &
|
|
125
|
+
Record<Exclude<Keys<styles[name]>, keyof Properties<tokens>>, never>
|
|
126
|
+
: never
|
|
127
|
+
: DeclarationProperties<tokens> extends styles[name]
|
|
128
|
+
? styles[name] extends DeclarationProperties<tokens>
|
|
129
|
+
? styles[name] &
|
|
130
|
+
Record<
|
|
131
|
+
Exclude<
|
|
132
|
+
Keys<styles[name]>,
|
|
133
|
+
keyof DeclarationProperties<tokens>
|
|
134
|
+
>,
|
|
135
|
+
never
|
|
136
|
+
>
|
|
137
|
+
: never
|
|
138
|
+
: Accepted<styles[name], tokens>
|
|
139
|
+
: never
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const targetBranch = Symbol('zyzz.target.branch')
|
|
143
|
+
const nesting = Symbol('zyzz.style.nesting')
|
|
144
|
+
|
|
145
|
+
/** A typed declaration; order is significant for future cascade processing. */
|
|
146
|
+
export type Declaration = {
|
|
147
|
+
/** Whether this declaration overrides normal declarations in the cascade. */
|
|
148
|
+
readonly important?: boolean | undefined
|
|
149
|
+
/** Supported CSS property in camelCase. */
|
|
150
|
+
readonly property: keyof Literal.Properties
|
|
151
|
+
/** Validated primitive or immutable, domain-checked theme reference. */
|
|
152
|
+
readonly value:
|
|
153
|
+
| number
|
|
154
|
+
| string
|
|
155
|
+
| Token.Reference
|
|
156
|
+
| Token.Expression
|
|
157
|
+
| Binding.Reference
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Copies named literal and token styles into deeply frozen ordered data.
|
|
162
|
+
* CSS values are checked by TypeScript only.
|
|
163
|
+
* Preserves names, values, and JavaScript own-property enumeration order. Never
|
|
164
|
+
* evaluates accessors, mutates input, generates CSS, or reads an environment.
|
|
165
|
+
* Empty maps and empty styles are valid. See the literal subset documentation.
|
|
166
|
+
* @param styles - Plain objects containing supported primitives or typed theme references.
|
|
167
|
+
* @param options - Optional theme for shorthand names and caller-owned diagnostic source spans.
|
|
168
|
+
* @returns Immutable definitions retaining the inferred style-name union.
|
|
169
|
+
* @throws {InvalidError} If the input structure cannot represent ordered declarations.
|
|
170
|
+
*/
|
|
171
|
+
export function define<
|
|
172
|
+
const styles extends Record<string, unknown>,
|
|
173
|
+
const tokens extends Theme.Tokens,
|
|
174
|
+
>(
|
|
175
|
+
styles: styles &
|
|
176
|
+
NoInfer<Exact<styles, tokens>> & {
|
|
177
|
+
[key in keyof styles]: WithoutRelationships<styles[key]>
|
|
178
|
+
},
|
|
179
|
+
options: define.Options<tokens>,
|
|
180
|
+
): Definition<
|
|
181
|
+
`${Extract<keyof styles, number | string>}`,
|
|
182
|
+
Targets.Domains<styles>
|
|
183
|
+
>
|
|
184
|
+
export function define<const styles extends Record<string, unknown>>(
|
|
185
|
+
styles: styles &
|
|
186
|
+
NoInfer<Exact<styles, {}>> & {
|
|
187
|
+
[key in keyof styles]: WithoutRelationships<styles[key]>
|
|
188
|
+
},
|
|
189
|
+
options?: define.Options,
|
|
190
|
+
): Definition<
|
|
191
|
+
`${Extract<keyof styles, number | string>}`,
|
|
192
|
+
Targets.Domains<styles>
|
|
193
|
+
>
|
|
194
|
+
export function define(
|
|
195
|
+
styles: Record<string, unknown>,
|
|
196
|
+
options: define.Options = {},
|
|
197
|
+
): Definition {
|
|
198
|
+
if ((options[nesting] ?? 0) > 128)
|
|
199
|
+
throw new InvalidError([
|
|
200
|
+
{
|
|
201
|
+
code: 'invalid_structure',
|
|
202
|
+
path: [],
|
|
203
|
+
message: 'Nested styles exceed the depth limit.',
|
|
204
|
+
},
|
|
205
|
+
])
|
|
206
|
+
|
|
207
|
+
const diagnostics: Diagnostic[] = []
|
|
208
|
+
const output: NamedStyle[] = []
|
|
209
|
+
// One definition owns one theme; only validated references are reused within this call.
|
|
210
|
+
const references = new Map<
|
|
211
|
+
keyof Literal.Properties,
|
|
212
|
+
Map<string | number, Token.Reference>
|
|
213
|
+
>()
|
|
214
|
+
|
|
215
|
+
function report(
|
|
216
|
+
code: Diagnostic['code'],
|
|
217
|
+
path: readonly string[],
|
|
218
|
+
message: string,
|
|
219
|
+
) {
|
|
220
|
+
const span = options.locations?.find(
|
|
221
|
+
(location) =>
|
|
222
|
+
location.path.length === path.length &&
|
|
223
|
+
location.path.every((part, i) => part === path[i]),
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
const location = span
|
|
227
|
+
? Object.freeze({ ...span, path: Object.freeze([...span.path]) })
|
|
228
|
+
: undefined
|
|
229
|
+
|
|
230
|
+
diagnostics.push(
|
|
231
|
+
Object.freeze({
|
|
232
|
+
code,
|
|
233
|
+
message,
|
|
234
|
+
path: Object.freeze([...path]),
|
|
235
|
+
...(location ? { location } : {}),
|
|
236
|
+
}),
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function entries(
|
|
241
|
+
value: unknown,
|
|
242
|
+
path: readonly string[],
|
|
243
|
+
): readonly (readonly [string, unknown])[] {
|
|
244
|
+
const prototype: object | null | undefined =
|
|
245
|
+
typeof value === 'object' && value !== null
|
|
246
|
+
? Object.getPrototypeOf(value)
|
|
247
|
+
: undefined
|
|
248
|
+
// Compare the native Object constructor across realms without reading getters.
|
|
249
|
+
const constructor: unknown =
|
|
250
|
+
prototype &&
|
|
251
|
+
prototype !== Object.prototype &&
|
|
252
|
+
Object.getOwnPropertyDescriptor(prototype, 'constructor')?.value
|
|
253
|
+
|
|
254
|
+
if (
|
|
255
|
+
typeof value !== 'object' ||
|
|
256
|
+
value === null ||
|
|
257
|
+
(prototype !== null &&
|
|
258
|
+
prototype !== Object.prototype &&
|
|
259
|
+
(prototype === undefined ||
|
|
260
|
+
Object.getPrototypeOf(prototype) !== null ||
|
|
261
|
+
typeof constructor !== 'function' ||
|
|
262
|
+
Function.prototype.toString.call(constructor) !==
|
|
263
|
+
Function.prototype.toString.call(Object)))
|
|
264
|
+
) {
|
|
265
|
+
report(
|
|
266
|
+
'invalid_structure',
|
|
267
|
+
path,
|
|
268
|
+
'Expected a plain object with enumerable data properties.',
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
return []
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const result: [string, unknown][] = []
|
|
275
|
+
|
|
276
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
277
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key)
|
|
278
|
+
|
|
279
|
+
if (
|
|
280
|
+
typeof key !== 'string' ||
|
|
281
|
+
!descriptor?.enumerable ||
|
|
282
|
+
!('value' in descriptor)
|
|
283
|
+
) {
|
|
284
|
+
report(
|
|
285
|
+
'invalid_structure',
|
|
286
|
+
typeof key === 'string' ? [...path, key] : path,
|
|
287
|
+
'Only enumerable string-keyed data properties are supported; accessors and symbols are not evaluated.',
|
|
288
|
+
)
|
|
289
|
+
continue
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
result.push([key, descriptor.value])
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return result
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
for (const [name, style] of entries(styles, [])) {
|
|
299
|
+
if (name.length === 0)
|
|
300
|
+
report('invalid_structure', [name], 'Style names must not be empty.')
|
|
301
|
+
|
|
302
|
+
const mappings = options.theme?.[Token.definition].contract.shorthands
|
|
303
|
+
const authored = entries(style, [name]).filter(
|
|
304
|
+
([key, value]) => key !== 'targets' || value !== undefined,
|
|
305
|
+
)
|
|
306
|
+
const target = authored.find(([key]) => key === 'targets')
|
|
307
|
+
if (target) {
|
|
308
|
+
if (options[targetBranch]) {
|
|
309
|
+
report(
|
|
310
|
+
'invalid_structure',
|
|
311
|
+
[name, 'targets'],
|
|
312
|
+
'Target branches cannot contain nested target branches.',
|
|
313
|
+
)
|
|
314
|
+
continue
|
|
315
|
+
}
|
|
316
|
+
const targets: Record<string, unknown> = {}
|
|
317
|
+
try {
|
|
318
|
+
for (const [key, input] of entries(target[1], [name, 'targets'])) {
|
|
319
|
+
if (!['android', 'ios', 'native', 'web'].includes(key)) {
|
|
320
|
+
report(
|
|
321
|
+
'invalid_structure',
|
|
322
|
+
[name, 'targets', key],
|
|
323
|
+
'Unknown style target.',
|
|
324
|
+
)
|
|
325
|
+
continue
|
|
326
|
+
}
|
|
327
|
+
if (input === undefined) continue
|
|
328
|
+
if (key === 'web') {
|
|
329
|
+
try {
|
|
330
|
+
targets.web = define({ [name]: input } as never, {
|
|
331
|
+
...options,
|
|
332
|
+
[nesting]: (options[nesting] ?? 0) + 1,
|
|
333
|
+
[targetBranch]: true,
|
|
334
|
+
}).styles[0]
|
|
335
|
+
} catch (error) {
|
|
336
|
+
if (!(error instanceof InvalidError)) throw error
|
|
337
|
+
for (const diagnostic of error.diagnostics)
|
|
338
|
+
report(
|
|
339
|
+
diagnostic.code,
|
|
340
|
+
[name, 'targets', 'web', ...diagnostic.path.slice(1)],
|
|
341
|
+
diagnostic.message,
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
entries(input, [name, 'targets', key])
|
|
346
|
+
targets[key] = Targets.copy(input, [name, 'targets', key])
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const shared = define(
|
|
350
|
+
{
|
|
351
|
+
[name]: Object.fromEntries(
|
|
352
|
+
authored.filter(([key]) => key !== 'targets'),
|
|
353
|
+
),
|
|
354
|
+
} as never,
|
|
355
|
+
{ ...options, [nesting]: (options[nesting] ?? 0) + 1 },
|
|
356
|
+
).styles[0]!
|
|
357
|
+
output.push(
|
|
358
|
+
Object.freeze({ ...shared, targets: Object.freeze(targets) }),
|
|
359
|
+
)
|
|
360
|
+
} catch (error) {
|
|
361
|
+
if (error instanceof InvalidError)
|
|
362
|
+
diagnostics.push(...error.diagnostics)
|
|
363
|
+
else
|
|
364
|
+
report(
|
|
365
|
+
'invalid_structure',
|
|
366
|
+
[name, 'targets'],
|
|
367
|
+
(error as Error).message,
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
continue
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const properties = authored.flatMap(
|
|
374
|
+
([property, input]): readonly (readonly [string, unknown, string])[] => {
|
|
375
|
+
if (property !== 'typography')
|
|
376
|
+
return (mappings?.[property] ?? [property]).map(
|
|
377
|
+
(target) => [target, input, property] as const,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
const parsed = Value.parse(input, 'fontFamily')
|
|
381
|
+
if (parsed && 'invalid' in parsed) {
|
|
382
|
+
report(
|
|
383
|
+
'invalid_value',
|
|
384
|
+
[name, property],
|
|
385
|
+
'Importance requires the suffix " !important".',
|
|
386
|
+
)
|
|
387
|
+
return []
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const path = parsed?.value ?? input
|
|
391
|
+
const data = options.theme?.[Token.definition]
|
|
392
|
+
const fields = Typography.fields(options.theme, path)
|
|
393
|
+
if (!fields.length) {
|
|
394
|
+
report(
|
|
395
|
+
'invalid_value',
|
|
396
|
+
[name, property],
|
|
397
|
+
'Expected a named typography set from the bound theme.',
|
|
398
|
+
)
|
|
399
|
+
return []
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Explicit declarations in this block override the corresponding preset fields.
|
|
403
|
+
const explicit = new Set(
|
|
404
|
+
authored.flatMap(([property]) => mappings?.[property] ?? [property]),
|
|
405
|
+
)
|
|
406
|
+
return fields
|
|
407
|
+
.filter((field) => !explicit.has(field))
|
|
408
|
+
.map((field) => {
|
|
409
|
+
const key = `typography.${path}.${field}`
|
|
410
|
+
const reference = Token.create({
|
|
411
|
+
contract: data!.contract,
|
|
412
|
+
group: field,
|
|
413
|
+
path: key,
|
|
414
|
+
value: data!.values[key]!,
|
|
415
|
+
})
|
|
416
|
+
return [
|
|
417
|
+
field,
|
|
418
|
+
parsed?.important
|
|
419
|
+
? Token.compose([reference, ' !important'])
|
|
420
|
+
: reference,
|
|
421
|
+
property,
|
|
422
|
+
] as const
|
|
423
|
+
})
|
|
424
|
+
},
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
if (properties.some(([key]) => Condition.is(key))) {
|
|
428
|
+
const rules: Rule[] = []
|
|
429
|
+
|
|
430
|
+
const blocks = authored.flatMap(([key, input]) =>
|
|
431
|
+
key === 'typography'
|
|
432
|
+
? properties
|
|
433
|
+
.filter(([, , original]) => original === key)
|
|
434
|
+
.map(([property, value]) => [property, value] as const)
|
|
435
|
+
: [[key, input] as const],
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
for (const [key, input] of blocks) {
|
|
439
|
+
try {
|
|
440
|
+
const condition = Condition.is(key)
|
|
441
|
+
? Query.resolve(
|
|
442
|
+
key,
|
|
443
|
+
options.theme?.[Token.definition].queries ?? {
|
|
444
|
+
breakpoints: {},
|
|
445
|
+
containers: {},
|
|
446
|
+
containerNames: [],
|
|
447
|
+
},
|
|
448
|
+
)
|
|
449
|
+
: undefined
|
|
450
|
+
|
|
451
|
+
if (condition !== undefined) Condition.normalize(condition)
|
|
452
|
+
|
|
453
|
+
const nested = (
|
|
454
|
+
define as (
|
|
455
|
+
styles: Record<string, unknown>,
|
|
456
|
+
options: define.Options,
|
|
457
|
+
) => Definition
|
|
458
|
+
)(
|
|
459
|
+
{ [name]: condition === undefined ? { [key]: input } : input },
|
|
460
|
+
{
|
|
461
|
+
...options,
|
|
462
|
+
[nesting]: (options[nesting] ?? 0) + 1,
|
|
463
|
+
locations: options.locations
|
|
464
|
+
?.filter(
|
|
465
|
+
(location) =>
|
|
466
|
+
condition === undefined || location.path[1] === key,
|
|
467
|
+
)
|
|
468
|
+
.map((location) =>
|
|
469
|
+
condition === undefined
|
|
470
|
+
? location
|
|
471
|
+
: {
|
|
472
|
+
...location,
|
|
473
|
+
path: location.path.filter((_, index) => index !== 1),
|
|
474
|
+
},
|
|
475
|
+
),
|
|
476
|
+
},
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
rules.push(
|
|
480
|
+
Object.freeze({
|
|
481
|
+
...(condition === undefined
|
|
482
|
+
? {}
|
|
483
|
+
: {
|
|
484
|
+
condition: Condition.normalize(
|
|
485
|
+
condition.startsWith(':') && !Condition.nested(condition)
|
|
486
|
+
? `&${condition}`
|
|
487
|
+
: condition,
|
|
488
|
+
),
|
|
489
|
+
}),
|
|
490
|
+
style: nested.styles[0]!,
|
|
491
|
+
}),
|
|
492
|
+
)
|
|
493
|
+
} catch (error) {
|
|
494
|
+
if (error instanceof InvalidError)
|
|
495
|
+
diagnostics.push(
|
|
496
|
+
...error.diagnostics.map((diagnostic) =>
|
|
497
|
+
Condition.is(key)
|
|
498
|
+
? Object.freeze({
|
|
499
|
+
...diagnostic,
|
|
500
|
+
path: Object.freeze([
|
|
501
|
+
name,
|
|
502
|
+
key,
|
|
503
|
+
...diagnostic.path.slice(1),
|
|
504
|
+
]),
|
|
505
|
+
...(diagnostic.location
|
|
506
|
+
? {
|
|
507
|
+
location: Object.freeze({
|
|
508
|
+
...diagnostic.location,
|
|
509
|
+
path: Object.freeze([
|
|
510
|
+
name,
|
|
511
|
+
key,
|
|
512
|
+
...diagnostic.location.path.slice(1),
|
|
513
|
+
]),
|
|
514
|
+
}),
|
|
515
|
+
}
|
|
516
|
+
: {}),
|
|
517
|
+
})
|
|
518
|
+
: diagnostic,
|
|
519
|
+
),
|
|
520
|
+
)
|
|
521
|
+
else
|
|
522
|
+
report('invalid_structure', [name, key], (error as Error).message)
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
output.push(
|
|
527
|
+
Object.freeze({
|
|
528
|
+
name,
|
|
529
|
+
declarations: Object.freeze([]),
|
|
530
|
+
rules: Object.freeze(rules),
|
|
531
|
+
}),
|
|
532
|
+
)
|
|
533
|
+
continue
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const declarations: Declaration[] = []
|
|
537
|
+
|
|
538
|
+
for (const [property, input, authoredProperty] of properties) {
|
|
539
|
+
const key = property as keyof Literal.Properties
|
|
540
|
+
const inputs: unknown[] = []
|
|
541
|
+
|
|
542
|
+
if (Array.isArray(input)) {
|
|
543
|
+
if (!input.length) {
|
|
544
|
+
report(
|
|
545
|
+
'invalid_value',
|
|
546
|
+
[name, authoredProperty],
|
|
547
|
+
'Fallback arrays must be nonempty.',
|
|
548
|
+
)
|
|
549
|
+
continue
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
for (let index = 0; index < input.length; index++) {
|
|
553
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
554
|
+
input,
|
|
555
|
+
String(index),
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
if (!descriptor || !('value' in descriptor)) {
|
|
559
|
+
report(
|
|
560
|
+
'invalid_structure',
|
|
561
|
+
[name, authoredProperty, String(index)],
|
|
562
|
+
'Fallback arrays require dense data entries without accessors.',
|
|
563
|
+
)
|
|
564
|
+
continue
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
inputs.push(descriptor.value)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (inputs.length !== input.length) continue
|
|
571
|
+
} else inputs.push(input)
|
|
572
|
+
|
|
573
|
+
for (const entry of inputs) {
|
|
574
|
+
if (
|
|
575
|
+
typeof entry === 'object' &&
|
|
576
|
+
entry !== null &&
|
|
577
|
+
Object.getOwnPropertyDescriptor(entry, 'variable')?.value === true &&
|
|
578
|
+
!Binding.is(entry)
|
|
579
|
+
) {
|
|
580
|
+
report(
|
|
581
|
+
'invalid_structure',
|
|
582
|
+
[name, authoredProperty],
|
|
583
|
+
'Invalid compiler binding reference.',
|
|
584
|
+
)
|
|
585
|
+
continue
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const parsed = Value.parse(entry, key)
|
|
589
|
+
if (parsed && 'invalid' in parsed) {
|
|
590
|
+
report(
|
|
591
|
+
'invalid_value',
|
|
592
|
+
[name, authoredProperty],
|
|
593
|
+
'Importance requires the suffix " !important".',
|
|
594
|
+
)
|
|
595
|
+
continue
|
|
596
|
+
}
|
|
597
|
+
const scalar = parsed ? parsed.value : entry
|
|
598
|
+
|
|
599
|
+
const resolved = (() => {
|
|
600
|
+
if (!options.theme) return scalar
|
|
601
|
+
|
|
602
|
+
if (typeof scalar !== 'string' && typeof scalar !== 'number')
|
|
603
|
+
return scalar
|
|
604
|
+
|
|
605
|
+
const cached = references.get(key)?.get(scalar)
|
|
606
|
+
if (cached) return cached
|
|
607
|
+
|
|
608
|
+
const resolved = Token.resolve(scalar, {
|
|
609
|
+
property: key,
|
|
610
|
+
theme: options.theme,
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
if (Token.is(resolved)) {
|
|
614
|
+
let values = references.get(key)
|
|
615
|
+
|
|
616
|
+
if (!values) references.set(key, (values = new Map()))
|
|
617
|
+
|
|
618
|
+
values.set(scalar, resolved)
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return resolved
|
|
622
|
+
})()
|
|
623
|
+
|
|
624
|
+
const value = parsed && resolved === '0' ? 0 : resolved
|
|
625
|
+
|
|
626
|
+
declarations.push(
|
|
627
|
+
Object.freeze({
|
|
628
|
+
...(parsed?.important ? { important: true } : {}),
|
|
629
|
+
property: key,
|
|
630
|
+
value: value as
|
|
631
|
+
| number
|
|
632
|
+
| string
|
|
633
|
+
| Token.Reference
|
|
634
|
+
| Token.Expression
|
|
635
|
+
| Binding.Reference,
|
|
636
|
+
}),
|
|
637
|
+
)
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
output.push(
|
|
642
|
+
Object.freeze({ declarations: Object.freeze(declarations), name }),
|
|
643
|
+
)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
if (diagnostics.length) throw new InvalidError(diagnostics)
|
|
647
|
+
|
|
648
|
+
// Validated names are precisely the input's enumerable string keys.
|
|
649
|
+
return Object.freeze({
|
|
650
|
+
styles: Object.freeze(output),
|
|
651
|
+
})
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/** Options for defining styles. */
|
|
655
|
+
export declare namespace define {
|
|
656
|
+
/** Source locations are optional; pure in-memory callers need no source text. */
|
|
657
|
+
type Options<tokens extends Theme.Tokens = never> = {
|
|
658
|
+
/** Internal recursion budget, propagated only by structured authoring. */
|
|
659
|
+
readonly [targetBranch]?: boolean | undefined
|
|
660
|
+
readonly [nesting]?: number | undefined
|
|
661
|
+
/** Caller-provided spans matched by complete diagnostic path. */
|
|
662
|
+
readonly locations?: readonly SourceLocation[] | undefined
|
|
663
|
+
} & ([tokens] extends [never]
|
|
664
|
+
? {
|
|
665
|
+
/** Optional themes do not enable shorthand inference. */
|
|
666
|
+
readonly theme?: Theme.Definition | undefined
|
|
667
|
+
}
|
|
668
|
+
: {
|
|
669
|
+
/** Shorthand inference requires a defined token contract. */
|
|
670
|
+
readonly theme: Theme.Definition<tokens>
|
|
671
|
+
})
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/** Immutable data passed from authoring to later target compilation. */
|
|
675
|
+
export type Definition<name extends string = string, input = unknown> = {
|
|
676
|
+
/** Type-only declarations used to retain native component compatibility. */
|
|
677
|
+
readonly [Targets.authored]?: input
|
|
678
|
+
/** Named styles in own enumerable property order. */
|
|
679
|
+
readonly styles: readonly NamedStyle<name>[]
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/** A caller-visible validation failure at an exact input path. */
|
|
683
|
+
export type Diagnostic = {
|
|
684
|
+
/** Stable machine-readable category. */
|
|
685
|
+
readonly code: 'invalid_structure' | 'invalid_value'
|
|
686
|
+
/** Source span when a caller supplied an exact matching path. */
|
|
687
|
+
readonly location?: SourceLocation | undefined
|
|
688
|
+
/** Explanation of the supported input contract. */
|
|
689
|
+
readonly message: string
|
|
690
|
+
/** Path components, without ambiguous dot concatenation. */
|
|
691
|
+
readonly path: readonly string[]
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/** Validation error containing all failures in deterministic input order. */
|
|
695
|
+
export class InvalidError extends Error {
|
|
696
|
+
/** Creates an error from caller-visible validation diagnostics. */
|
|
697
|
+
constructor(diagnostics: readonly Diagnostic[]) {
|
|
698
|
+
super(
|
|
699
|
+
diagnostics
|
|
700
|
+
.map((item) => `${JSON.stringify(item.path)}: ${item.message}`)
|
|
701
|
+
.join('\n'),
|
|
702
|
+
)
|
|
703
|
+
this.diagnostics = Object.freeze([...diagnostics])
|
|
704
|
+
}
|
|
705
|
+
/** Frozen diagnostics, ordered by style and declaration traversal. */
|
|
706
|
+
readonly diagnostics: readonly Diagnostic[]
|
|
707
|
+
/** Stable namespaced error identifier. */
|
|
708
|
+
override name = 'Style.InvalidError'
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
type LiteralAtoms = {
|
|
712
|
+
readonly [property in keyof Literal.Properties]-?: Value.Atom<
|
|
713
|
+
| Exclude<Literal.Properties[property], undefined>
|
|
714
|
+
| Binding.Reference<'*'>
|
|
715
|
+
| {
|
|
716
|
+
[kind in Binding.Kind]: property extends Binding.Property<
|
|
717
|
+
kind,
|
|
718
|
+
property
|
|
719
|
+
>
|
|
720
|
+
? Binding.Reference<kind>
|
|
721
|
+
: never
|
|
722
|
+
}[Binding.Kind]
|
|
723
|
+
>
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** Supported primitive CSS declarations without theme references. */
|
|
727
|
+
export type LiteralDeclarations = {
|
|
728
|
+
readonly [property in keyof Literal.Properties]: Value.Fallbacks<
|
|
729
|
+
LiteralAtoms[property]
|
|
730
|
+
>
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/** A named group of ordered declarations. */
|
|
734
|
+
export type NamedStyle<name extends string = string> = {
|
|
735
|
+
/** Compiler-owned web mode inherited from the defining configuration. */
|
|
736
|
+
readonly cssOutput?: 'atomic' | 'grouped' | undefined
|
|
737
|
+
/** Ordered nested blocks, when this style contains conditions. */
|
|
738
|
+
readonly rules?: readonly Rule[] | undefined
|
|
739
|
+
/** Declarations in own enumerable property order. */
|
|
740
|
+
readonly declarations: readonly Declaration[]
|
|
741
|
+
/** Authored style name, without generated target identifiers. */
|
|
742
|
+
readonly name: name
|
|
743
|
+
/** Target-neutral branches retained through source and packed compilation. */
|
|
744
|
+
readonly targets?:
|
|
745
|
+
| (Targets.NativeBranches & { readonly web?: NamedStyle | undefined })
|
|
746
|
+
| undefined
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** Supported literal and token declarations. Unknown properties and undefined values are rejected. */
|
|
750
|
+
export type DeclarationProperties<tokens extends Theme.Tokens = {}> = {
|
|
751
|
+
readonly [property in keyof Literal.Properties]: Value.Fallbacks<
|
|
752
|
+
| LiteralAtoms[property]
|
|
753
|
+
| Value.Atom<Token.Names<tokens, property>>
|
|
754
|
+
| {
|
|
755
|
+
[group in Token.Group]: property extends Token.Properties<group>
|
|
756
|
+
? Token.Reference<group>
|
|
757
|
+
: never
|
|
758
|
+
}[Token.Group]
|
|
759
|
+
>
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/** Recursive theme-aware declaration and condition authoring. */
|
|
763
|
+
export type Properties<
|
|
764
|
+
tokens extends Theme.Tokens = {},
|
|
765
|
+
targets extends boolean = true,
|
|
766
|
+
> = DeclarationProperties<tokens> & {
|
|
767
|
+
readonly [key in Condition.Keys<tokens>]?: Properties<tokens, targets>
|
|
768
|
+
} & {
|
|
769
|
+
readonly targets?:
|
|
770
|
+
| (targets extends true ? TargetBranches<tokens> : never)
|
|
771
|
+
| undefined
|
|
772
|
+
/** Applies a named typography set. Explicit fields in the same block take precedence. */
|
|
773
|
+
readonly typography?: Value.Atom<Typography.Names<tokens>>
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/** Nested literal declarations retain exact keys at every depth. */
|
|
777
|
+
export type LiteralProperties = LiteralDeclarations & {
|
|
778
|
+
readonly [key in Condition.Keys]?: LiteralProperties
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/** Ordered nested blocks; an absent condition represents a declaration segment. */
|
|
782
|
+
export type Rule = {
|
|
783
|
+
/** Scoped selector or conditional at-rule; absent for a declaration segment. */
|
|
784
|
+
readonly condition?: string | undefined
|
|
785
|
+
/** Immutable nested declarations and ordered child rules. */
|
|
786
|
+
readonly style: NamedStyle
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/** A source span optionally attached to a diagnostic by a caller. */
|
|
790
|
+
export type SourceLocation = {
|
|
791
|
+
/** Exclusive source offset. */
|
|
792
|
+
readonly end: number
|
|
793
|
+
/** Path from the style map root to the associated input. */
|
|
794
|
+
readonly path: readonly string[]
|
|
795
|
+
/** Caller-owned source identifier, independent of filesystem paths. */
|
|
796
|
+
readonly source: string
|
|
797
|
+
/** Inclusive source offset. */
|
|
798
|
+
readonly start: number
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/** Core definitions exclude compiler-owned web relationship keys. */
|
|
802
|
+
type WithoutRelationships<value> = value extends readonly unknown[]
|
|
803
|
+
? unknown
|
|
804
|
+
: value extends object
|
|
805
|
+
? {
|
|
806
|
+
[key in keyof value]: key extends symbol | 'selectors' | 'variables'
|
|
807
|
+
? never
|
|
808
|
+
: key extends keyof Literal.Properties
|
|
809
|
+
? unknown
|
|
810
|
+
: WithoutRelationships<value[key]>
|
|
811
|
+
}
|
|
812
|
+
: unknown
|