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
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** Lowers target-neutral callback declarations to ordered native binding data. @module */
|
|
2
|
+
import type * as Recipe from '../../internal/Recipe.js'
|
|
3
|
+
import * as Binding from '../../internal/Binding.js'
|
|
4
|
+
import * as Token from '../../internal/Token.js'
|
|
5
|
+
import type * as Style from '../../Style.js'
|
|
6
|
+
import * as StyleSheet from '../../react-native/StyleSheet.js'
|
|
7
|
+
import * as Scalar from '../../react-native/internal/Scalar.js'
|
|
8
|
+
import type * as Runtime from '../../runtime/NativeDynamic.js'
|
|
9
|
+
import type * as Native from '../Native.js'
|
|
10
|
+
import type * as Source from '../Source.js'
|
|
11
|
+
|
|
12
|
+
/** Compiles static fragments and retains scalar assignments in authored order. */
|
|
13
|
+
export function compile(
|
|
14
|
+
recipe: Recipe.Definition,
|
|
15
|
+
call: Pick<Source.Call, 'slots' | 'recipe'>,
|
|
16
|
+
options: Native.compile.Options,
|
|
17
|
+
prepared = prepare(recipe, call, options),
|
|
18
|
+
): Runtime.create.Options {
|
|
19
|
+
return {
|
|
20
|
+
...prepared,
|
|
21
|
+
styles: StyleSheet.select(prepared.styles, {
|
|
22
|
+
theme: options.theme ?? 'default',
|
|
23
|
+
colorScheme: options.colorScheme,
|
|
24
|
+
}),
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Prepares immutable programs and all theme/scheme tables before selection. */
|
|
29
|
+
export function prepare(
|
|
30
|
+
recipe: Recipe.Definition,
|
|
31
|
+
call: Pick<Source.Call, 'slots' | 'recipe'>,
|
|
32
|
+
options: Native.compile.Options,
|
|
33
|
+
) {
|
|
34
|
+
const slots = Object.fromEntries(
|
|
35
|
+
Object.entries(call.slots ?? {}).map(([name, slot]) => [name, slot.name]),
|
|
36
|
+
)
|
|
37
|
+
const available = new Set([
|
|
38
|
+
...Object.values(slots),
|
|
39
|
+
...(call.recipe?.payloads ?? []).flatMap((payload) =>
|
|
40
|
+
Object.values(payload.slots[0]!),
|
|
41
|
+
),
|
|
42
|
+
])
|
|
43
|
+
const fragments: Style.NamedStyle[] = []
|
|
44
|
+
const rules: Runtime.Program['rules'][number][] = []
|
|
45
|
+
let count = 1
|
|
46
|
+
for (const choices of Object.values(recipe.axes)) count *= choices.length + 1
|
|
47
|
+
if (count > 256)
|
|
48
|
+
throw new Error(
|
|
49
|
+
'Native recipes support at most 256 selections, including null choices.',
|
|
50
|
+
)
|
|
51
|
+
for (const rule of recipe.rules) {
|
|
52
|
+
const steps: Runtime.Program['rules'][number]['steps'][number][] = []
|
|
53
|
+
function fragment(style: Style.NamedStyle) {
|
|
54
|
+
const name = String(fragments.length)
|
|
55
|
+
fragments.push({ ...style, name })
|
|
56
|
+
steps.push({ style: name })
|
|
57
|
+
}
|
|
58
|
+
function visit(style: Style.NamedStyle) {
|
|
59
|
+
const declared = new Set<string>()
|
|
60
|
+
let declarations: Style.Declaration[] = []
|
|
61
|
+
function flush() {
|
|
62
|
+
if (!declarations.length) return
|
|
63
|
+
fragment({ name: style.name, declarations })
|
|
64
|
+
declarations = []
|
|
65
|
+
}
|
|
66
|
+
for (const declaration of style.declarations) {
|
|
67
|
+
if (declaration.important || declared.has(declaration.property))
|
|
68
|
+
throw new Error(
|
|
69
|
+
'Importance and fallback declarations are not supported on native.',
|
|
70
|
+
)
|
|
71
|
+
declared.add(declaration.property)
|
|
72
|
+
const parts = Token.isExpression(declaration.value)
|
|
73
|
+
? declaration.value.parts
|
|
74
|
+
: [declaration.value]
|
|
75
|
+
const dynamic = parts.some((part) => Binding.is(part))
|
|
76
|
+
if (!dynamic && declaration.property !== 'lineHeight') {
|
|
77
|
+
declarations.push(declaration)
|
|
78
|
+
continue
|
|
79
|
+
}
|
|
80
|
+
flush()
|
|
81
|
+
const property = declaration.property as keyof typeof Scalar.properties
|
|
82
|
+
if (
|
|
83
|
+
!Object.hasOwn(Scalar.properties, property) ||
|
|
84
|
+
[
|
|
85
|
+
'transform',
|
|
86
|
+
'origin',
|
|
87
|
+
'shadow',
|
|
88
|
+
'textShadow',
|
|
89
|
+
'fontVariant',
|
|
90
|
+
].includes(String(Scalar.properties[property]))
|
|
91
|
+
)
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Dynamic native property is unsupported: ${property}.`,
|
|
94
|
+
)
|
|
95
|
+
const values = parts.map((part) => {
|
|
96
|
+
if (typeof part === 'string' || typeof part === 'number') return part
|
|
97
|
+
if (!Binding.is(part) || !available.has(part.name))
|
|
98
|
+
throw new Error(
|
|
99
|
+
'Native bindings require declared runtime scalar fields.',
|
|
100
|
+
)
|
|
101
|
+
return { slot: part.name }
|
|
102
|
+
})
|
|
103
|
+
if (
|
|
104
|
+
values.length > 1 &&
|
|
105
|
+
!(
|
|
106
|
+
values.length === 2 &&
|
|
107
|
+
typeof values[0] === 'object' &&
|
|
108
|
+
['px', 'rem', '%'].includes(String(values[1]))
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
throw new Error(
|
|
112
|
+
'Native dynamic expressions support a scalar with a px, rem, or percent suffix.',
|
|
113
|
+
)
|
|
114
|
+
steps.push({ property, parts: values })
|
|
115
|
+
}
|
|
116
|
+
flush()
|
|
117
|
+
if (style.targets)
|
|
118
|
+
fragment({ name: style.name, declarations: [], targets: style.targets })
|
|
119
|
+
for (const rule of style.rules ?? []) {
|
|
120
|
+
if (rule.condition !== undefined)
|
|
121
|
+
throw new Error(
|
|
122
|
+
'Selectors, queries, and nested rules are not supported on native.',
|
|
123
|
+
)
|
|
124
|
+
visit(rule.style)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (const style of rule.value.styles) visit(style)
|
|
128
|
+
rules.push({ matches: rule.matches, steps })
|
|
129
|
+
}
|
|
130
|
+
const compiled = StyleSheet.compile({
|
|
131
|
+
styles: { styles: fragments },
|
|
132
|
+
fonts: options.fonts,
|
|
133
|
+
platform: options.platform,
|
|
134
|
+
themes: options.themes,
|
|
135
|
+
units: options.units,
|
|
136
|
+
})
|
|
137
|
+
return {
|
|
138
|
+
axes: recipe.axes,
|
|
139
|
+
defaults: recipe.defaults,
|
|
140
|
+
...(call.recipe?.payloads
|
|
141
|
+
? {
|
|
142
|
+
payloads: call.recipe.payloads,
|
|
143
|
+
defaultPayloads: call.recipe.defaultPayloads,
|
|
144
|
+
}
|
|
145
|
+
: {}),
|
|
146
|
+
fonts: options.fonts,
|
|
147
|
+
units: options.units,
|
|
148
|
+
program: { slots, rules },
|
|
149
|
+
styles: compiled.styles,
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
/** Preserves ordered style bodies and runtime ownership across package boundaries. @module */
|
|
2
|
+
import type * as Recipe from '../../internal/Recipe.js'
|
|
3
|
+
import type * as RuntimeRecipe from '../../runtime/Recipe.js'
|
|
4
|
+
import * as Targets from '../../internal/Targets.js'
|
|
5
|
+
import * as Binding from '../../internal/Binding.js'
|
|
6
|
+
import * as Condition from '../../internal/Condition.js'
|
|
7
|
+
import * as ConditionalRecipe from '../../runtime/ConditionalRecipe.js'
|
|
8
|
+
import * as Literal from '../../internal/Literal.js'
|
|
9
|
+
import type * as Source from '../Source.js'
|
|
10
|
+
import type * as Style from '../../Style.js'
|
|
11
|
+
import type * as Theme from '../../Theme.js'
|
|
12
|
+
import * as Token from '../../internal/Token.js'
|
|
13
|
+
|
|
14
|
+
/** Portable composition inputs; selection behavior remains in the compiled callable. */
|
|
15
|
+
export type Definition = {
|
|
16
|
+
/** Runtime scalar slots retained without executable callback bodies. */
|
|
17
|
+
readonly dynamic?:
|
|
18
|
+
| {
|
|
19
|
+
readonly recipe: Recipe.Definition
|
|
20
|
+
readonly slots: NonNullable<Source.Call['slots']>
|
|
21
|
+
readonly payloads?: RuntimeRecipe.Definition['payloads']
|
|
22
|
+
readonly defaultPayloads?: RuntimeRecipe.Definition['defaultPayloads']
|
|
23
|
+
}
|
|
24
|
+
| undefined
|
|
25
|
+
/** Exact published classes replaced by a composition. Filled by graph emission. */
|
|
26
|
+
readonly className?: string | undefined
|
|
27
|
+
/** Attributes owned by the callable, including conditional selections. */
|
|
28
|
+
readonly attributes: readonly string[]
|
|
29
|
+
/** Native HTML output; React props are the default. */
|
|
30
|
+
readonly output?: 'html' | undefined
|
|
31
|
+
/** Private dynamic custom properties owned by the callable. */
|
|
32
|
+
readonly slots: readonly string[]
|
|
33
|
+
/** Target-neutral finite recipe retained for native consumers. */
|
|
34
|
+
readonly staticRecipe?: Recipe.Definition | undefined
|
|
35
|
+
/** Complete finite alternatives in authored cascade order. */
|
|
36
|
+
readonly style: Style.NamedStyle
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Captures ownership without retaining source ASTs or executable expressions. */
|
|
40
|
+
export function create(call: Source.Call, style: Style.NamedStyle): Definition {
|
|
41
|
+
return {
|
|
42
|
+
...(call.slots || call.dynamicRecipe
|
|
43
|
+
? {
|
|
44
|
+
dynamic: {
|
|
45
|
+
recipe: call.dynamicRecipe ?? {
|
|
46
|
+
axes: {},
|
|
47
|
+
defaults: {},
|
|
48
|
+
rules: [{ matches: [], value: { styles: [style] } }],
|
|
49
|
+
},
|
|
50
|
+
slots: call.slots ?? {},
|
|
51
|
+
payloads: call.recipe?.payloads,
|
|
52
|
+
defaultPayloads: call.recipe?.defaultPayloads,
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
: {}),
|
|
56
|
+
attributes: Object.keys(call.recipe?.axes ?? {}).flatMap((axis) => [
|
|
57
|
+
`data-${axis}`,
|
|
58
|
+
...(call.recipe?.conditions ?? []).map((_, condition) =>
|
|
59
|
+
ConditionalRecipe.attribute({ axis, condition }),
|
|
60
|
+
),
|
|
61
|
+
]),
|
|
62
|
+
...(call.output ? { output: call.output } : {}),
|
|
63
|
+
slots: [
|
|
64
|
+
...Object.values(call.slots ?? {}).map((slot) => slot.name),
|
|
65
|
+
...(call.recipe?.payloads ?? []).flatMap((payload) =>
|
|
66
|
+
payload.slots.flatMap((slots) => Object.values(slots)),
|
|
67
|
+
),
|
|
68
|
+
],
|
|
69
|
+
staticRecipe:
|
|
70
|
+
call.staticRecipe ??
|
|
71
|
+
(!call.slots && !call.recipe && call.output !== 'html'
|
|
72
|
+
? {
|
|
73
|
+
axes: {},
|
|
74
|
+
defaults: {},
|
|
75
|
+
rules: [{ matches: [], value: { styles: [style] } }],
|
|
76
|
+
}
|
|
77
|
+
: undefined),
|
|
78
|
+
style,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Validates compiler data and restores live theme references without executing package code. */
|
|
83
|
+
export function read(
|
|
84
|
+
value: unknown,
|
|
85
|
+
themes: Readonly<Record<string, Theme.Definition>>,
|
|
86
|
+
version = 17,
|
|
87
|
+
): Definition {
|
|
88
|
+
const tokens = new Map<string, Token.Reference>()
|
|
89
|
+
function collect(value: unknown) {
|
|
90
|
+
if (Token.is(value)) {
|
|
91
|
+
tokens.set(
|
|
92
|
+
JSON.stringify([value.contract[Token.identity], value.path]),
|
|
93
|
+
value,
|
|
94
|
+
)
|
|
95
|
+
// Catalog themes share identities and paths but retain distinct fallback values.
|
|
96
|
+
tokens.set(
|
|
97
|
+
JSON.stringify([
|
|
98
|
+
value.contract[Token.identity],
|
|
99
|
+
value.path,
|
|
100
|
+
value.value,
|
|
101
|
+
]),
|
|
102
|
+
value,
|
|
103
|
+
)
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
if (value && typeof value === 'object')
|
|
107
|
+
for (const child of Object.values(value)) collect(child)
|
|
108
|
+
}
|
|
109
|
+
for (const theme of Object.values(themes)) collect(theme.tokens)
|
|
110
|
+
|
|
111
|
+
function scalar(value: unknown, depth = 0): Style.Declaration['value'] {
|
|
112
|
+
if (depth > 64)
|
|
113
|
+
throw new Error('Packed style expression exceeds 64 levels.')
|
|
114
|
+
|
|
115
|
+
if (
|
|
116
|
+
typeof value === 'string' ||
|
|
117
|
+
(typeof value === 'number' && Number.isFinite(value))
|
|
118
|
+
)
|
|
119
|
+
return value
|
|
120
|
+
const item = object(value)
|
|
121
|
+
if (item.kind === 'token') {
|
|
122
|
+
const token = tokens.get(
|
|
123
|
+
JSON.stringify([
|
|
124
|
+
item.identity,
|
|
125
|
+
item.path,
|
|
126
|
+
...(Object.hasOwn(item, 'value') ? [item.value] : []),
|
|
127
|
+
]),
|
|
128
|
+
)
|
|
129
|
+
if (!token) throw new Error('Unknown packed style token.')
|
|
130
|
+
return token
|
|
131
|
+
}
|
|
132
|
+
if (item.kind === 'expression') {
|
|
133
|
+
const parts = array(item.parts).map((part) => scalar(part, depth + 1))
|
|
134
|
+
if (
|
|
135
|
+
parts.some(
|
|
136
|
+
(part) => typeof part === 'number' || Token.isExpression(part),
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
throw new Error('Invalid packed style expression.')
|
|
140
|
+
return Token.compose(
|
|
141
|
+
parts as readonly (string | Token.Reference | Binding.Reference)[],
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
const binding = Object.freeze(item)
|
|
145
|
+
if (Binding.is(binding) && /^--z-[a-zA-Z0-9_-]+$/.test(binding.name))
|
|
146
|
+
return binding
|
|
147
|
+
throw new Error('Invalid packed style value.')
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function style(value: unknown, depth = 0): Style.NamedStyle {
|
|
151
|
+
if (depth > 64) throw new Error('Packed style nesting exceeds 64 levels.')
|
|
152
|
+
const item = object(value)
|
|
153
|
+
if (item.targets !== undefined && version < 20)
|
|
154
|
+
throw new Error('Target branches require contract version 20 or later.')
|
|
155
|
+
if (
|
|
156
|
+
item.cssOutput !== undefined &&
|
|
157
|
+
item.cssOutput !== 'atomic' &&
|
|
158
|
+
item.cssOutput !== 'grouped'
|
|
159
|
+
)
|
|
160
|
+
throw new Error('Invalid packed style CSS output mode.')
|
|
161
|
+
return {
|
|
162
|
+
...(item.cssOutput
|
|
163
|
+
? { cssOutput: item.cssOutput as 'atomic' | 'grouped' }
|
|
164
|
+
: {}),
|
|
165
|
+
declarations: array(item.declarations).map((value) => {
|
|
166
|
+
const declaration = object(value)
|
|
167
|
+
const property = string(declaration.property)
|
|
168
|
+
if (
|
|
169
|
+
!Object.hasOwn(Literal.rules, property) &&
|
|
170
|
+
!property.startsWith('--')
|
|
171
|
+
)
|
|
172
|
+
throw new Error('Invalid packed style property.')
|
|
173
|
+
if (
|
|
174
|
+
declaration.important !== undefined &&
|
|
175
|
+
typeof declaration.important !== 'boolean'
|
|
176
|
+
)
|
|
177
|
+
throw new Error('Invalid packed style importance.')
|
|
178
|
+
return {
|
|
179
|
+
important: declaration.important,
|
|
180
|
+
property,
|
|
181
|
+
value: scalar(declaration.value),
|
|
182
|
+
} as Style.Declaration
|
|
183
|
+
}),
|
|
184
|
+
name: string(item.name),
|
|
185
|
+
...(item.targets === undefined
|
|
186
|
+
? {}
|
|
187
|
+
: {
|
|
188
|
+
targets: (() => {
|
|
189
|
+
const targets = object(item.targets)
|
|
190
|
+
if (
|
|
191
|
+
Object.keys(targets).some(
|
|
192
|
+
(key) => !['android', 'ios', 'native', 'web'].includes(key),
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
throw new Error('Unknown packed style target.')
|
|
196
|
+
return {
|
|
197
|
+
...(targets.android === undefined
|
|
198
|
+
? {}
|
|
199
|
+
: {
|
|
200
|
+
android: Targets.copy(
|
|
201
|
+
object(targets.android),
|
|
202
|
+
) as NonNullable<Style.NamedStyle['targets']>['android'],
|
|
203
|
+
}),
|
|
204
|
+
...(targets.ios === undefined
|
|
205
|
+
? {}
|
|
206
|
+
: {
|
|
207
|
+
ios: Targets.copy(object(targets.ios)) as NonNullable<
|
|
208
|
+
Style.NamedStyle['targets']
|
|
209
|
+
>['ios'],
|
|
210
|
+
}),
|
|
211
|
+
...(targets.native === undefined
|
|
212
|
+
? {}
|
|
213
|
+
: {
|
|
214
|
+
native: Targets.copy(
|
|
215
|
+
object(targets.native),
|
|
216
|
+
) as NonNullable<Style.NamedStyle['targets']>['native'],
|
|
217
|
+
}),
|
|
218
|
+
...(targets.web === undefined
|
|
219
|
+
? {}
|
|
220
|
+
: { web: style(targets.web, depth + 1) }),
|
|
221
|
+
}
|
|
222
|
+
})(),
|
|
223
|
+
}),
|
|
224
|
+
...(item.rules === undefined
|
|
225
|
+
? {}
|
|
226
|
+
: {
|
|
227
|
+
rules: array(item.rules).map((value) => {
|
|
228
|
+
const rule = object(value)
|
|
229
|
+
const condition =
|
|
230
|
+
rule.condition === undefined
|
|
231
|
+
? undefined
|
|
232
|
+
: string(rule.condition)
|
|
233
|
+
if (
|
|
234
|
+
condition !== undefined &&
|
|
235
|
+
!condition.startsWith('@') &&
|
|
236
|
+
!Condition.nested(condition)
|
|
237
|
+
)
|
|
238
|
+
throw new Error('Invalid packed style condition.')
|
|
239
|
+
return {
|
|
240
|
+
...(condition ? { condition } : {}),
|
|
241
|
+
style: style(rule.style, depth + 1),
|
|
242
|
+
}
|
|
243
|
+
}),
|
|
244
|
+
}),
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const item = object(value)
|
|
249
|
+
if (version >= 17 && object(item.style).cssOutput === undefined)
|
|
250
|
+
throw new Error('Missing packed style CSS output mode.')
|
|
251
|
+
const attributes = array(item.attributes).map(string)
|
|
252
|
+
const slots = array(item.slots).map(string)
|
|
253
|
+
if (
|
|
254
|
+
attributes.some((name) => !/^data-[a-zA-Z0-9_-]+$/.test(name)) ||
|
|
255
|
+
slots.some((name) => !/^--z-[a-zA-Z0-9_-]+$/.test(name)) ||
|
|
256
|
+
(item.output !== undefined && item.output !== 'html')
|
|
257
|
+
)
|
|
258
|
+
throw new Error('Invalid packed style ownership.')
|
|
259
|
+
function readRecipe(input: unknown) {
|
|
260
|
+
if (input === undefined) return undefined
|
|
261
|
+
if (version < 21)
|
|
262
|
+
throw new Error('Static recipes require contract version 21 or later.')
|
|
263
|
+
const recipe = object(input)
|
|
264
|
+
const axes = Object.fromEntries(
|
|
265
|
+
Object.entries(object(recipe.axes)).map(([name, value]) => {
|
|
266
|
+
const choices = array(value).map(string)
|
|
267
|
+
if (
|
|
268
|
+
!name ||
|
|
269
|
+
new Set(choices).size !== choices.length ||
|
|
270
|
+
!choices.length
|
|
271
|
+
)
|
|
272
|
+
throw new Error('Invalid packed recipe axis.')
|
|
273
|
+
return [name, choices]
|
|
274
|
+
}),
|
|
275
|
+
)
|
|
276
|
+
const defaults = Object.fromEntries(
|
|
277
|
+
Object.entries(object(recipe.defaults)).map(([axis, choice]) => {
|
|
278
|
+
if (
|
|
279
|
+
!Object.hasOwn(axes, axis) ||
|
|
280
|
+
(choice !== null && !axes[axis]!.includes(string(choice)))
|
|
281
|
+
)
|
|
282
|
+
throw new Error('Invalid packed recipe default.')
|
|
283
|
+
return [axis, choice === null ? null : string(choice)]
|
|
284
|
+
}),
|
|
285
|
+
)
|
|
286
|
+
const rules = array(recipe.rules).map((value) => {
|
|
287
|
+
const rule = object(value)
|
|
288
|
+
return {
|
|
289
|
+
matches: array(rule.matches).map((value) => {
|
|
290
|
+
const match = array(value)
|
|
291
|
+
const axis = string(match[0])
|
|
292
|
+
const choices = array(match[1]).map(string)
|
|
293
|
+
if (
|
|
294
|
+
match.length !== 2 ||
|
|
295
|
+
!Object.hasOwn(axes, axis) ||
|
|
296
|
+
!choices.length ||
|
|
297
|
+
choices.some((choice) => !axes[axis]!.includes(choice))
|
|
298
|
+
)
|
|
299
|
+
throw new Error('Invalid packed recipe match.')
|
|
300
|
+
return [axis, choices] as const
|
|
301
|
+
}),
|
|
302
|
+
value: {
|
|
303
|
+
styles: array(object(rule.value).styles).map((value) => style(value)),
|
|
304
|
+
},
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
return { axes, defaults, rules }
|
|
308
|
+
}
|
|
309
|
+
const staticRecipe = readRecipe(item.staticRecipe)
|
|
310
|
+
const dynamic = (() => {
|
|
311
|
+
if (item.dynamic === undefined) return undefined
|
|
312
|
+
if (version < 23)
|
|
313
|
+
throw new Error('Dynamic native contracts require version 23 or later.')
|
|
314
|
+
const entry = object(item.dynamic)
|
|
315
|
+
const recipe = readRecipe(entry.recipe)
|
|
316
|
+
if (!recipe) throw new Error('Missing packed dynamic recipe.')
|
|
317
|
+
function fields(value: unknown): Record<string, string> {
|
|
318
|
+
return Object.fromEntries(
|
|
319
|
+
Object.entries(object(value)).map(([field, value]) => {
|
|
320
|
+
const name = string(value)
|
|
321
|
+
if (
|
|
322
|
+
!field ||
|
|
323
|
+
[
|
|
324
|
+
'__proto__',
|
|
325
|
+
'style',
|
|
326
|
+
'className',
|
|
327
|
+
'variables',
|
|
328
|
+
'key',
|
|
329
|
+
'ref',
|
|
330
|
+
].includes(field) ||
|
|
331
|
+
!slots.includes(name)
|
|
332
|
+
)
|
|
333
|
+
throw new Error('Invalid packed dynamic slot.')
|
|
334
|
+
return [field, name]
|
|
335
|
+
}),
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
const inputs = Object.fromEntries(
|
|
339
|
+
Object.entries(object(entry.slots)).map(([field, value]) => {
|
|
340
|
+
const reference = scalar(value)
|
|
341
|
+
if (
|
|
342
|
+
!Binding.is(reference) ||
|
|
343
|
+
!['number', 'length'].includes(reference.type)
|
|
344
|
+
)
|
|
345
|
+
throw new Error('Invalid packed dynamic scalar.')
|
|
346
|
+
fields({ [field]: reference.name })
|
|
347
|
+
return [field, reference]
|
|
348
|
+
}),
|
|
349
|
+
)
|
|
350
|
+
const seen = new Set<string>()
|
|
351
|
+
const payloads =
|
|
352
|
+
entry.payloads === undefined
|
|
353
|
+
? undefined
|
|
354
|
+
: array(entry.payloads).map((value) => {
|
|
355
|
+
const payload = object(value)
|
|
356
|
+
const axis = string(payload.axis)
|
|
357
|
+
const choice = string(payload.choice)
|
|
358
|
+
const identity = JSON.stringify([axis, choice])
|
|
359
|
+
if (!recipe.axes[axis]?.includes(choice) || seen.has(identity))
|
|
360
|
+
throw new Error('Invalid packed dynamic choice.')
|
|
361
|
+
seen.add(identity)
|
|
362
|
+
return {
|
|
363
|
+
axis,
|
|
364
|
+
choice,
|
|
365
|
+
slots: array(payload.slots).map(
|
|
366
|
+
(value) => fields(value) as Record<string, `--${string}`>,
|
|
367
|
+
),
|
|
368
|
+
}
|
|
369
|
+
})
|
|
370
|
+
if (payloads?.some((payload) => payload.slots.length !== 1))
|
|
371
|
+
throw new Error('Native payloads require one unconditional slot map.')
|
|
372
|
+
const defaultPayloads =
|
|
373
|
+
entry.defaultPayloads === undefined
|
|
374
|
+
? undefined
|
|
375
|
+
: Object.fromEntries(
|
|
376
|
+
Object.entries(object(entry.defaultPayloads)).map(
|
|
377
|
+
([axis, value]) => {
|
|
378
|
+
const payload = payloads?.find(
|
|
379
|
+
(payload) =>
|
|
380
|
+
payload.axis === axis &&
|
|
381
|
+
payload.choice === recipe.defaults[axis],
|
|
382
|
+
)
|
|
383
|
+
if (!payload) throw new Error('Invalid packed dynamic default.')
|
|
384
|
+
const defaults = object(value)
|
|
385
|
+
const expected = Object.keys(payload.slots[0]!)
|
|
386
|
+
if (
|
|
387
|
+
Object.keys(defaults).length !== expected.length ||
|
|
388
|
+
expected.some((field) => !Object.hasOwn(defaults, field))
|
|
389
|
+
)
|
|
390
|
+
throw new Error('Incomplete packed dynamic default.')
|
|
391
|
+
return [
|
|
392
|
+
axis,
|
|
393
|
+
Object.fromEntries(
|
|
394
|
+
Object.entries(defaults).map(([field, value]) => {
|
|
395
|
+
if (
|
|
396
|
+
typeof value !== 'string' &&
|
|
397
|
+
(typeof value !== 'number' || !Number.isFinite(value))
|
|
398
|
+
)
|
|
399
|
+
throw new Error(
|
|
400
|
+
'Invalid packed dynamic default scalar.',
|
|
401
|
+
)
|
|
402
|
+
return [field, value]
|
|
403
|
+
}),
|
|
404
|
+
),
|
|
405
|
+
]
|
|
406
|
+
},
|
|
407
|
+
),
|
|
408
|
+
)
|
|
409
|
+
return { recipe, slots: inputs, payloads, defaultPayloads }
|
|
410
|
+
})()
|
|
411
|
+
return {
|
|
412
|
+
...(dynamic ? { dynamic } : {}),
|
|
413
|
+
attributes,
|
|
414
|
+
className: string(item.className),
|
|
415
|
+
...(item.output ? { output: 'html' } : {}),
|
|
416
|
+
slots,
|
|
417
|
+
staticRecipe,
|
|
418
|
+
style: style(item.style),
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** Encodes references as data while preserving declaration and condition order. */
|
|
423
|
+
export function write(definition: Definition): unknown {
|
|
424
|
+
return JSON.parse(
|
|
425
|
+
JSON.stringify(
|
|
426
|
+
{
|
|
427
|
+
...definition,
|
|
428
|
+
style: {
|
|
429
|
+
...definition.style,
|
|
430
|
+
cssOutput: definition.style.cssOutput ?? 'atomic',
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
(_, value: unknown) => {
|
|
434
|
+
if (Token.is(value))
|
|
435
|
+
return {
|
|
436
|
+
identity: value.contract[Token.identity],
|
|
437
|
+
kind: 'token',
|
|
438
|
+
path: value.path,
|
|
439
|
+
value: value.value,
|
|
440
|
+
}
|
|
441
|
+
if (Token.isExpression(value))
|
|
442
|
+
return { kind: 'expression', parts: value.parts }
|
|
443
|
+
return value
|
|
444
|
+
},
|
|
445
|
+
),
|
|
446
|
+
)
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function array(value: unknown): unknown[] {
|
|
450
|
+
if (!Array.isArray(value)) throw new Error('Expected a packed style array.')
|
|
451
|
+
return value
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function object(value: unknown): Record<string, unknown> {
|
|
455
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
456
|
+
throw new Error('Expected a packed style object.')
|
|
457
|
+
return value as Record<string, unknown>
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function string(value: unknown): string {
|
|
461
|
+
if (typeof value !== 'string')
|
|
462
|
+
throw new Error('Expected a packed style string.')
|
|
463
|
+
return value
|
|
464
|
+
}
|