zyzz 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +380 -0
- package/dist/Config.d.ts +170 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +249 -0
- package/dist/Config.js.map +1 -0
- package/dist/Props.d.ts +7 -0
- package/dist/Props.d.ts.map +1 -0
- package/dist/Props.js +3 -0
- package/dist/Props.js.map +1 -0
- package/dist/Style.d.ts +167 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +284 -0
- package/dist/Style.js.map +1 -0
- package/dist/Theme.d.ts +154 -0
- package/dist/Theme.d.ts.map +1 -0
- package/dist/Theme.js +257 -0
- package/dist/Theme.js.map +1 -0
- package/dist/babel/NativeEdits.d.ts +8 -0
- package/dist/babel/NativeEdits.d.ts.map +1 -0
- package/dist/babel/NativeEdits.js +233 -0
- package/dist/babel/NativeEdits.js.map +1 -0
- package/dist/babel/NativeJsx.d.ts +10 -0
- package/dist/babel/NativeJsx.d.ts.map +1 -0
- package/dist/babel/NativeJsx.js +204 -0
- package/dist/babel/NativeJsx.js.map +1 -0
- package/dist/babel/index.d.ts +51 -0
- package/dist/babel/index.d.ts.map +1 -0
- package/dist/babel/index.js +220 -0
- package/dist/babel/index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +178 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/compiler/Graph.d.ts +64 -0
- package/dist/compiler/Graph.d.ts.map +1 -0
- package/dist/compiler/Graph.js +1111 -0
- package/dist/compiler/Graph.js.map +1 -0
- package/dist/compiler/Native.d.ts +53 -0
- package/dist/compiler/Native.d.ts.map +1 -0
- package/dist/compiler/Native.js +617 -0
- package/dist/compiler/Native.js.map +1 -0
- package/dist/compiler/Source.d.ts +165 -0
- package/dist/compiler/Source.d.ts.map +1 -0
- package/dist/compiler/Source.js +990 -0
- package/dist/compiler/Source.js.map +1 -0
- package/dist/compiler/Transform.d.ts +57 -0
- package/dist/compiler/Transform.d.ts.map +1 -0
- package/dist/compiler/Transform.js +884 -0
- package/dist/compiler/Transform.js.map +1 -0
- package/dist/compiler/index.d.ts +13 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +13 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/internal/Applications.d.ts +35 -0
- package/dist/compiler/internal/Applications.d.ts.map +1 -0
- package/dist/compiler/internal/Applications.js +248 -0
- package/dist/compiler/internal/Applications.js.map +1 -0
- package/dist/compiler/internal/AtRules.d.ts +8 -0
- package/dist/compiler/internal/AtRules.d.ts.map +1 -0
- package/dist/compiler/internal/AtRules.js +180 -0
- package/dist/compiler/internal/AtRules.js.map +1 -0
- package/dist/compiler/internal/Catalogs.d.ts +19 -0
- package/dist/compiler/internal/Catalogs.d.ts.map +1 -0
- package/dist/compiler/internal/Catalogs.js +68 -0
- package/dist/compiler/internal/Catalogs.js.map +1 -0
- package/dist/compiler/internal/ColorProfiles.d.ts +3 -0
- package/dist/compiler/internal/ColorProfiles.d.ts.map +1 -0
- package/dist/compiler/internal/ColorProfiles.js +84 -0
- package/dist/compiler/internal/ColorProfiles.js.map +1 -0
- package/dist/compiler/internal/CompositionBindings.d.ts +16 -0
- package/dist/compiler/internal/CompositionBindings.d.ts.map +1 -0
- package/dist/compiler/internal/CompositionBindings.js +89 -0
- package/dist/compiler/internal/CompositionBindings.js.map +1 -0
- package/dist/compiler/internal/Compositions.d.ts +32 -0
- package/dist/compiler/internal/Compositions.d.ts.map +1 -0
- package/dist/compiler/internal/Compositions.js +464 -0
- package/dist/compiler/internal/Compositions.js.map +1 -0
- package/dist/compiler/internal/Configurations.d.ts +21 -0
- package/dist/compiler/internal/Configurations.d.ts.map +1 -0
- package/dist/compiler/internal/Configurations.js +171 -0
- package/dist/compiler/internal/Configurations.js.map +1 -0
- package/dist/compiler/internal/Contract.d.ts +27 -0
- package/dist/compiler/internal/Contract.d.ts.map +1 -0
- package/dist/compiler/internal/Contract.js +600 -0
- package/dist/compiler/internal/Contract.js.map +1 -0
- package/dist/compiler/internal/Contributions.d.ts +54 -0
- package/dist/compiler/internal/Contributions.d.ts.map +1 -0
- package/dist/compiler/internal/Contributions.js +1109 -0
- package/dist/compiler/internal/Contributions.js.map +1 -0
- package/dist/compiler/internal/Descriptors.d.ts +15 -0
- package/dist/compiler/internal/Descriptors.d.ts.map +1 -0
- package/dist/compiler/internal/Descriptors.js +183 -0
- package/dist/compiler/internal/Descriptors.js.map +1 -0
- package/dist/compiler/internal/Dynamic.d.ts +14 -0
- package/dist/compiler/internal/Dynamic.d.ts.map +1 -0
- package/dist/compiler/internal/Dynamic.js +172 -0
- package/dist/compiler/internal/Dynamic.js.map +1 -0
- package/dist/compiler/internal/Edits.d.ts +12 -0
- package/dist/compiler/internal/Edits.d.ts.map +1 -0
- package/dist/compiler/internal/Edits.js +5 -0
- package/dist/compiler/internal/Edits.js.map +1 -0
- package/dist/compiler/internal/Expression.d.ts +12 -0
- package/dist/compiler/internal/Expression.d.ts.map +1 -0
- package/dist/compiler/internal/Expression.js +98 -0
- package/dist/compiler/internal/Expression.js.map +1 -0
- package/dist/compiler/internal/Functions.d.ts +5 -0
- package/dist/compiler/internal/Functions.d.ts.map +1 -0
- package/dist/compiler/internal/Functions.js +191 -0
- package/dist/compiler/internal/Functions.js.map +1 -0
- package/dist/compiler/internal/Identifiers.d.ts +9 -0
- package/dist/compiler/internal/Identifiers.d.ts.map +1 -0
- package/dist/compiler/internal/Identifiers.js +106 -0
- package/dist/compiler/internal/Identifiers.js.map +1 -0
- package/dist/compiler/internal/Keyframes.d.ts +5 -0
- package/dist/compiler/internal/Keyframes.d.ts.map +1 -0
- package/dist/compiler/internal/Keyframes.js +51 -0
- package/dist/compiler/internal/Keyframes.js.map +1 -0
- package/dist/compiler/internal/Namespaces.d.ts +17 -0
- package/dist/compiler/internal/Namespaces.d.ts.map +1 -0
- package/dist/compiler/internal/Namespaces.js +265 -0
- package/dist/compiler/internal/Namespaces.js.map +1 -0
- package/dist/compiler/internal/NativeBindings.d.ts +74 -0
- package/dist/compiler/internal/NativeBindings.d.ts.map +1 -0
- package/dist/compiler/internal/NativeBindings.js +117 -0
- package/dist/compiler/internal/NativeBindings.js.map +1 -0
- package/dist/compiler/internal/PackedStyles.d.ts +35 -0
- package/dist/compiler/internal/PackedStyles.d.ts.map +1 -0
- package/dist/compiler/internal/PackedStyles.js +345 -0
- package/dist/compiler/internal/PackedStyles.js.map +1 -0
- package/dist/compiler/internal/Properties.d.ts +5 -0
- package/dist/compiler/internal/Properties.d.ts.map +1 -0
- package/dist/compiler/internal/Properties.js +82 -0
- package/dist/compiler/internal/Properties.js.map +1 -0
- package/dist/compiler/internal/RecipeConditions.d.ts +41 -0
- package/dist/compiler/internal/RecipeConditions.d.ts.map +1 -0
- package/dist/compiler/internal/RecipeConditions.js +82 -0
- package/dist/compiler/internal/RecipeConditions.js.map +1 -0
- package/dist/compiler/internal/RecipePayloads.d.ts +31 -0
- package/dist/compiler/internal/RecipePayloads.d.ts.map +1 -0
- package/dist/compiler/internal/RecipePayloads.js +99 -0
- package/dist/compiler/internal/RecipePayloads.js.map +1 -0
- package/dist/compiler/internal/Recipes.d.ts +32 -0
- package/dist/compiler/internal/Recipes.d.ts.map +1 -0
- package/dist/compiler/internal/Recipes.js +339 -0
- package/dist/compiler/internal/Recipes.js.map +1 -0
- package/dist/compiler/internal/Relative.d.ts +19 -0
- package/dist/compiler/internal/Relative.d.ts.map +1 -0
- package/dist/compiler/internal/Relative.js +62 -0
- package/dist/compiler/internal/Relative.js.map +1 -0
- package/dist/compiler/internal/Scope.d.ts +10 -0
- package/dist/compiler/internal/Scope.d.ts.map +1 -0
- package/dist/compiler/internal/Scope.js +28 -0
- package/dist/compiler/internal/Scope.js.map +1 -0
- package/dist/compiler/internal/Selectors.d.ts +12 -0
- package/dist/compiler/internal/Selectors.d.ts.map +1 -0
- package/dist/compiler/internal/Selectors.js +265 -0
- package/dist/compiler/internal/Selectors.js.map +1 -0
- package/dist/compiler/internal/Static.d.ts +39 -0
- package/dist/compiler/internal/Static.d.ts.map +1 -0
- package/dist/compiler/internal/Static.js +532 -0
- package/dist/compiler/internal/Static.js.map +1 -0
- package/dist/compiler/internal/Stylesheets.d.ts +47 -0
- package/dist/compiler/internal/Stylesheets.d.ts.map +1 -0
- package/dist/compiler/internal/Stylesheets.js +272 -0
- package/dist/compiler/internal/Stylesheets.js.map +1 -0
- package/dist/compiler/internal/Syntax.d.ts +17 -0
- package/dist/compiler/internal/Syntax.d.ts.map +1 -0
- package/dist/compiler/internal/Syntax.js +19 -0
- package/dist/compiler/internal/Syntax.js.map +1 -0
- package/dist/compiler/internal/Themes.d.ts +158 -0
- package/dist/compiler/internal/Themes.d.ts.map +1 -0
- package/dist/compiler/internal/Themes.js +1169 -0
- package/dist/compiler/internal/Themes.js.map +1 -0
- package/dist/compiler/internal/Variables.d.ts +31 -0
- package/dist/compiler/internal/Variables.d.ts.map +1 -0
- package/dist/compiler/internal/Variables.js +376 -0
- package/dist/compiler/internal/Variables.js.map +1 -0
- package/dist/compiler/internal/ViewTransitions.d.ts +3 -0
- package/dist/compiler/internal/ViewTransitions.d.ts.map +1 -0
- package/dist/compiler/internal/ViewTransitions.js +68 -0
- package/dist/compiler/internal/ViewTransitions.js.map +1 -0
- package/dist/cx.d.ts +18 -0
- package/dist/cx.d.ts.map +1 -0
- package/dist/cx.js +60 -0
- package/dist/cx.js.map +1 -0
- package/dist/default.d.ts +2008 -0
- package/dist/default.d.ts.map +1 -0
- package/dist/default.js +243 -0
- package/dist/default.js.map +7 -0
- package/dist/default.js.zyzz.json +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/Authoring.d.ts +26 -0
- package/dist/internal/Authoring.d.ts.map +1 -0
- package/dist/internal/Authoring.js +134 -0
- package/dist/internal/Authoring.js.map +1 -0
- package/dist/internal/Binding.d.ts +64 -0
- package/dist/internal/Binding.d.ts.map +1 -0
- package/dist/internal/Binding.js +27 -0
- package/dist/internal/Binding.js.map +1 -0
- package/dist/internal/BindingDomains.d.ts +11 -0
- package/dist/internal/BindingDomains.d.ts.map +1 -0
- package/dist/internal/BindingDomains.js +459 -0
- package/dist/internal/BindingDomains.js.map +1 -0
- package/dist/internal/Cascade.d.ts +45 -0
- package/dist/internal/Cascade.d.ts.map +1 -0
- package/dist/internal/Cascade.js +165 -0
- package/dist/internal/Cascade.js.map +1 -0
- package/dist/internal/Compound.d.ts +132 -0
- package/dist/internal/Compound.d.ts.map +1 -0
- package/dist/internal/Compound.js +2 -0
- package/dist/internal/Compound.js.map +1 -0
- package/dist/internal/Condition.d.ts +33 -0
- package/dist/internal/Condition.d.ts.map +1 -0
- package/dist/internal/Condition.js +180 -0
- package/dist/internal/Condition.js.map +1 -0
- package/dist/internal/Corner.d.ts +9 -0
- package/dist/internal/Corner.d.ts.map +1 -0
- package/dist/internal/Corner.js +14 -0
- package/dist/internal/Corner.js.map +1 -0
- package/dist/internal/FunctionSyntax.d.ts +27 -0
- package/dist/internal/FunctionSyntax.d.ts.map +1 -0
- package/dist/internal/FunctionSyntax.js +91 -0
- package/dist/internal/FunctionSyntax.js.map +1 -0
- package/dist/internal/FunctionValue.d.ts +19 -0
- package/dist/internal/FunctionValue.d.ts.map +1 -0
- package/dist/internal/FunctionValue.js +2 -0
- package/dist/internal/FunctionValue.js.map +1 -0
- package/dist/internal/Geometry.d.ts +8 -0
- package/dist/internal/Geometry.d.ts.map +1 -0
- package/dist/internal/Geometry.js +2 -0
- package/dist/internal/Geometry.js.map +1 -0
- package/dist/internal/Grid.d.ts +15 -0
- package/dist/internal/Grid.d.ts.map +1 -0
- package/dist/internal/Grid.js +2 -0
- package/dist/internal/Grid.js.map +1 -0
- package/dist/internal/Identifier.d.ts +15 -0
- package/dist/internal/Identifier.d.ts.map +1 -0
- package/dist/internal/Identifier.js +2 -0
- package/dist/internal/Identifier.js.map +1 -0
- package/dist/internal/Identity.d.ts +16 -0
- package/dist/internal/Identity.d.ts.map +1 -0
- package/dist/internal/Identity.js +78 -0
- package/dist/internal/Identity.js.map +1 -0
- package/dist/internal/Lexical.d.ts +89 -0
- package/dist/internal/Lexical.d.ts.map +1 -0
- package/dist/internal/Lexical.js +15 -0
- package/dist/internal/Lexical.js.map +1 -0
- package/dist/internal/Literal.d.ts +3459 -0
- package/dist/internal/Literal.d.ts.map +1 -0
- package/dist/internal/Literal.js +3371 -0
- package/dist/internal/Literal.js.map +1 -0
- package/dist/internal/NativeProperties.d.ts +596 -0
- package/dist/internal/NativeProperties.d.ts.map +1 -0
- package/dist/internal/NativeProperties.js +2 -0
- package/dist/internal/NativeProperties.js.map +1 -0
- package/dist/internal/Numeric.d.ts +23 -0
- package/dist/internal/Numeric.d.ts.map +1 -0
- package/dist/internal/Numeric.js +2 -0
- package/dist/internal/Numeric.js.map +1 -0
- package/dist/internal/Query.d.ts +15 -0
- package/dist/internal/Query.d.ts.map +1 -0
- package/dist/internal/Query.js +58 -0
- package/dist/internal/Query.js.map +1 -0
- package/dist/internal/Recipe.d.ts +17 -0
- package/dist/internal/Recipe.d.ts.map +1 -0
- package/dist/internal/Recipe.js +2 -0
- package/dist/internal/Recipe.js.map +1 -0
- package/dist/internal/RuleReference.d.ts +23 -0
- package/dist/internal/RuleReference.d.ts.map +1 -0
- package/dist/internal/RuleReference.js +65 -0
- package/dist/internal/RuleReference.js.map +1 -0
- package/dist/internal/Scheme.d.ts +12 -0
- package/dist/internal/Scheme.d.ts.map +1 -0
- package/dist/internal/Scheme.js +16 -0
- package/dist/internal/Scheme.js.map +1 -0
- package/dist/internal/Shorthands.d.ts +20 -0
- package/dist/internal/Shorthands.d.ts.map +1 -0
- package/dist/internal/Shorthands.js +49 -0
- package/dist/internal/Shorthands.js.map +1 -0
- package/dist/internal/Targets.d.ts +43 -0
- package/dist/internal/Targets.d.ts.map +1 -0
- package/dist/internal/Targets.js +60 -0
- package/dist/internal/Targets.js.map +1 -0
- package/dist/internal/Token.d.ts +104 -0
- package/dist/internal/Token.d.ts.map +1 -0
- package/dist/internal/Token.js +162 -0
- package/dist/internal/Token.js.map +1 -0
- package/dist/internal/Tuple.d.ts +23 -0
- package/dist/internal/Tuple.d.ts.map +1 -0
- package/dist/internal/Tuple.js +2 -0
- package/dist/internal/Tuple.js.map +1 -0
- package/dist/internal/Value.d.ts +74 -0
- package/dist/internal/Value.d.ts.map +1 -0
- package/dist/internal/Value.js +60 -0
- package/dist/internal/Value.js.map +1 -0
- package/dist/metro/Graph.d.ts +8 -0
- package/dist/metro/Graph.d.ts.map +1 -0
- package/dist/metro/Graph.js +63 -0
- package/dist/metro/Graph.js.map +1 -0
- package/dist/metro/Watch.d.ts +21 -0
- package/dist/metro/Watch.d.ts.map +1 -0
- package/dist/metro/Watch.js +51 -0
- package/dist/metro/Watch.js.map +1 -0
- package/dist/metro/index.d.ts +30 -0
- package/dist/metro/index.d.ts.map +1 -0
- package/dist/metro/index.js +52 -0
- package/dist/metro/index.js.map +1 -0
- package/dist/metro/transformer.d.ts +21 -0
- package/dist/metro/transformer.d.ts.map +1 -0
- package/dist/metro/transformer.js +71 -0
- package/dist/metro/transformer.js.map +1 -0
- package/dist/next/index.d.ts +18 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +92 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/loader.d.ts +16 -0
- package/dist/next/loader.d.ts.map +1 -0
- package/dist/next/loader.js +282 -0
- package/dist/next/loader.js.map +1 -0
- package/dist/node/Host.d.ts +80 -0
- package/dist/node/Host.d.ts.map +1 -0
- package/dist/node/Host.js +882 -0
- package/dist/node/Host.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +7 -0
- package/dist/node/index.js.map +1 -0
- package/dist/react-native/Host.d.ts +76 -0
- package/dist/react-native/Host.d.ts.map +1 -0
- package/dist/react-native/Host.js +209 -0
- package/dist/react-native/Host.js.map +1 -0
- package/dist/react-native/StyleSheet.d.ts +226 -0
- package/dist/react-native/StyleSheet.d.ts.map +1 -0
- package/dist/react-native/StyleSheet.js +606 -0
- package/dist/react-native/StyleSheet.js.map +1 -0
- package/dist/react-native/Variants.d.ts +38 -0
- package/dist/react-native/Variants.d.ts.map +1 -0
- package/dist/react-native/Variants.js +66 -0
- package/dist/react-native/Variants.js.map +1 -0
- package/dist/react-native/index.d.ts +8 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +8 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/internal/Color.d.ts +7 -0
- package/dist/react-native/internal/Color.d.ts.map +1 -0
- package/dist/react-native/internal/Color.js +93 -0
- package/dist/react-native/internal/Color.js.map +1 -0
- package/dist/react-native/internal/NativeSchema.d.ts +5138 -0
- package/dist/react-native/internal/NativeSchema.d.ts.map +1 -0
- package/dist/react-native/internal/NativeSchema.js +3097 -0
- package/dist/react-native/internal/NativeSchema.js.map +1 -0
- package/dist/react-native/internal/Scalar.d.ts +95 -0
- package/dist/react-native/internal/Scalar.d.ts.map +1 -0
- package/dist/react-native/internal/Scalar.js +199 -0
- package/dist/react-native/internal/Scalar.js.map +1 -0
- package/dist/react-native/internal/Values.d.ts +5 -0
- package/dist/react-native/internal/Values.d.ts.map +1 -0
- package/dist/react-native/internal/Values.js +65 -0
- package/dist/react-native/internal/Values.js.map +1 -0
- package/dist/react-native/react.d.ts +22 -0
- package/dist/react-native/react.d.ts.map +1 -0
- package/dist/react-native/react.js +26 -0
- package/dist/react-native/react.js.map +1 -0
- package/dist/reset.css +244 -0
- package/dist/runtime/Appearance.d.ts +55 -0
- package/dist/runtime/Appearance.d.ts.map +1 -0
- package/dist/runtime/Appearance.js +84 -0
- package/dist/runtime/Appearance.js.map +1 -0
- package/dist/runtime/Composition.d.ts +46 -0
- package/dist/runtime/Composition.d.ts.map +1 -0
- package/dist/runtime/Composition.js +52 -0
- package/dist/runtime/Composition.js.map +1 -0
- package/dist/runtime/CompositionHtml.d.ts +15 -0
- package/dist/runtime/CompositionHtml.d.ts.map +1 -0
- package/dist/runtime/CompositionHtml.js +20 -0
- package/dist/runtime/CompositionHtml.js.map +1 -0
- package/dist/runtime/ConditionalRecipe.d.ts +30 -0
- package/dist/runtime/ConditionalRecipe.d.ts.map +1 -0
- package/dist/runtime/ConditionalRecipe.js +39 -0
- package/dist/runtime/ConditionalRecipe.js.map +1 -0
- package/dist/runtime/Dynamic.d.ts +19 -0
- package/dist/runtime/Dynamic.d.ts.map +1 -0
- package/dist/runtime/Dynamic.js +22 -0
- package/dist/runtime/Dynamic.js.map +1 -0
- package/dist/runtime/Html.d.ts +32 -0
- package/dist/runtime/Html.d.ts.map +1 -0
- package/dist/runtime/Html.js +63 -0
- package/dist/runtime/Html.js.map +1 -0
- package/dist/runtime/Native.d.ts +48 -0
- package/dist/runtime/Native.d.ts.map +1 -0
- package/dist/runtime/Native.js +78 -0
- package/dist/runtime/Native.js.map +1 -0
- package/dist/runtime/NativeContext.d.ts +17 -0
- package/dist/runtime/NativeContext.d.ts.map +1 -0
- package/dist/runtime/NativeContext.js +47 -0
- package/dist/runtime/NativeContext.js.map +1 -0
- package/dist/runtime/NativeDynamic.d.ts +47 -0
- package/dist/runtime/NativeDynamic.d.ts.map +1 -0
- package/dist/runtime/NativeDynamic.js +141 -0
- package/dist/runtime/NativeDynamic.js.map +1 -0
- package/dist/runtime/PayloadRecipe.d.ts +22 -0
- package/dist/runtime/PayloadRecipe.d.ts.map +1 -0
- package/dist/runtime/PayloadRecipe.js +59 -0
- package/dist/runtime/PayloadRecipe.js.map +1 -0
- package/dist/runtime/Props.d.ts +21 -0
- package/dist/runtime/Props.d.ts.map +1 -0
- package/dist/runtime/Props.js +17 -0
- package/dist/runtime/Props.js.map +1 -0
- package/dist/runtime/Recipe.d.ts +52 -0
- package/dist/runtime/Recipe.d.ts.map +1 -0
- package/dist/runtime/Recipe.js +30 -0
- package/dist/runtime/Recipe.js.map +1 -0
- package/dist/runtime/Selection.d.ts +31 -0
- package/dist/runtime/Selection.d.ts.map +1 -0
- package/dist/runtime/Selection.js +30 -0
- package/dist/runtime/Selection.js.map +1 -0
- package/dist/runtime/Variable.d.ts +6 -0
- package/dist/runtime/Variable.d.ts.map +1 -0
- package/dist/runtime/Variable.js +10 -0
- package/dist/runtime/Variable.js.map +1 -0
- package/dist/runtime/index.d.ts +33 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +33 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/styleFunction.d.ts +72 -0
- package/dist/styleFunction.d.ts.map +1 -0
- package/dist/styleFunction.js +18 -0
- package/dist/styleFunction.js.map +1 -0
- package/dist/themes/LICENSE.tailwind +21 -0
- package/dist/variable.d.ts +50 -0
- package/dist/variable.d.ts.map +1 -0
- package/dist/variable.js +20 -0
- package/dist/variable.js.map +1 -0
- package/dist/variants.d.ts +84 -0
- package/dist/variants.d.ts.map +1 -0
- package/dist/variants.js +21 -0
- package/dist/variants.js.map +1 -0
- package/dist/vite/index.d.ts +24 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +1089 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/web/Css.d.ts +81 -0
- package/dist/web/Css.d.ts.map +1 -0
- package/dist/web/Css.js +593 -0
- package/dist/web/Css.js.map +1 -0
- package/dist/web/colorProfile.d.ts +28 -0
- package/dist/web/colorProfile.d.ts.map +1 -0
- package/dist/web/colorProfile.js +8 -0
- package/dist/web/colorProfile.js.map +1 -0
- package/dist/web/counterStyle.d.ts +48 -0
- package/dist/web/counterStyle.d.ts.map +1 -0
- package/dist/web/counterStyle.js +8 -0
- package/dist/web/counterStyle.js.map +1 -0
- package/dist/web/cssFunction.d.ts +80 -0
- package/dist/web/cssFunction.d.ts.map +1 -0
- package/dist/web/cssFunction.js +18 -0
- package/dist/web/cssFunction.js.map +1 -0
- package/dist/web/customMedia.d.ts +12 -0
- package/dist/web/customMedia.d.ts.map +1 -0
- package/dist/web/customMedia.js +7 -0
- package/dist/web/customMedia.js.map +1 -0
- package/dist/web/fontFace.d.ts +26 -0
- package/dist/web/fontFace.d.ts.map +1 -0
- package/dist/web/fontFace.js +7 -0
- package/dist/web/fontFace.js.map +1 -0
- package/dist/web/fontFeatureValues.d.ts +40 -0
- package/dist/web/fontFeatureValues.d.ts.map +1 -0
- package/dist/web/fontFeatureValues.js +7 -0
- package/dist/web/fontFeatureValues.js.map +1 -0
- package/dist/web/fontPaletteValues.d.ts +21 -0
- package/dist/web/fontPaletteValues.d.ts.map +1 -0
- package/dist/web/fontPaletteValues.js +9 -0
- package/dist/web/fontPaletteValues.js.map +1 -0
- package/dist/web/global.d.ts +19 -0
- package/dist/web/global.d.ts.map +1 -0
- package/dist/web/global.js +6 -0
- package/dist/web/global.js.map +1 -0
- package/dist/web/importCss.d.ts +18 -0
- package/dist/web/importCss.d.ts.map +1 -0
- package/dist/web/importCss.js +7 -0
- package/dist/web/importCss.js.map +1 -0
- package/dist/web/index.d.ts +22 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +22 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/internal/Block.d.ts +18 -0
- package/dist/web/internal/Block.d.ts.map +1 -0
- package/dist/web/internal/Block.js +13 -0
- package/dist/web/internal/Block.js.map +1 -0
- package/dist/web/internal/ClassName.d.ts +19 -0
- package/dist/web/internal/ClassName.d.ts.map +1 -0
- package/dist/web/internal/ClassName.js +77 -0
- package/dist/web/internal/ClassName.js.map +1 -0
- package/dist/web/internal/Context.d.ts +11 -0
- package/dist/web/internal/Context.d.ts.map +1 -0
- package/dist/web/internal/Context.js +2 -0
- package/dist/web/internal/Context.js.map +1 -0
- package/dist/web/internal/Contributions.d.ts +70 -0
- package/dist/web/internal/Contributions.d.ts.map +1 -0
- package/dist/web/internal/Contributions.js +109 -0
- package/dist/web/internal/Contributions.js.map +1 -0
- package/dist/web/internal/Namespace.d.ts +13 -0
- package/dist/web/internal/Namespace.d.ts.map +1 -0
- package/dist/web/internal/Namespace.js +13 -0
- package/dist/web/internal/Namespace.js.map +1 -0
- package/dist/web/internal/Themes.d.ts +13 -0
- package/dist/web/internal/Themes.d.ts.map +1 -0
- package/dist/web/internal/Themes.js +96 -0
- package/dist/web/internal/Themes.js.map +1 -0
- package/dist/web/keyframes.d.ts +14 -0
- package/dist/web/keyframes.d.ts.map +1 -0
- package/dist/web/keyframes.js +8 -0
- package/dist/web/keyframes.js.map +1 -0
- package/dist/web/layers.d.ts +4 -0
- package/dist/web/layers.d.ts.map +1 -0
- package/dist/web/layers.js +7 -0
- package/dist/web/layers.js.map +1 -0
- package/dist/web/namespace.d.ts +14 -0
- package/dist/web/namespace.d.ts.map +1 -0
- package/dist/web/namespace.js +7 -0
- package/dist/web/namespace.js.map +1 -0
- package/dist/web/page.d.ts +38 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +7 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/positionTry.d.ts +14 -0
- package/dist/web/positionTry.d.ts.map +1 -0
- package/dist/web/positionTry.js +9 -0
- package/dist/web/positionTry.js.map +1 -0
- package/dist/web/property.d.ts +24 -0
- package/dist/web/property.d.ts.map +1 -0
- package/dist/web/property.js +7 -0
- package/dist/web/property.js.map +1 -0
- package/dist/web/viewTransition.d.ts +29 -0
- package/dist/web/viewTransition.d.ts.map +1 -0
- package/dist/web/viewTransition.js +7 -0
- package/dist/web/viewTransition.js.map +1 -0
- package/package.json +136 -10
- package/src/Config.ts +690 -0
- package/src/Props.ts +8 -0
- package/src/Style.ts +748 -0
- package/src/Theme.ts +713 -0
- package/src/babel/NativeEdits.ts +273 -0
- package/src/babel/NativeJsx.ts +260 -0
- package/src/babel/index.ts +332 -0
- package/src/cli/index.ts +196 -0
- package/src/compiler/Graph.ts +1586 -0
- package/src/compiler/Native.ts +801 -0
- package/src/compiler/Source.ts +1550 -0
- package/src/compiler/Transform.ts +1235 -0
- package/src/compiler/index.ts +12 -0
- package/src/compiler/internal/Applications.ts +378 -0
- package/src/compiler/internal/AtRules.ts +202 -0
- package/src/compiler/internal/Catalogs.ts +114 -0
- package/src/compiler/internal/ColorProfiles.ts +93 -0
- package/src/compiler/internal/CompositionBindings.ts +120 -0
- package/src/compiler/internal/Compositions.ts +629 -0
- package/src/compiler/internal/Configurations.ts +244 -0
- package/src/compiler/internal/Contract.ts +846 -0
- package/src/compiler/internal/Contributions.ts +1507 -0
- package/src/compiler/internal/Descriptors.ts +238 -0
- package/src/compiler/internal/Dynamic.ts +266 -0
- package/src/compiler/internal/Edits.ts +13 -0
- package/src/compiler/internal/Expression.ts +135 -0
- package/src/compiler/internal/Functions.ts +206 -0
- package/src/compiler/internal/Identifiers.ts +124 -0
- package/src/compiler/internal/Keyframes.ts +62 -0
- package/src/compiler/internal/Namespaces.ts +296 -0
- package/src/compiler/internal/NativeBindings.ts +151 -0
- package/src/compiler/internal/PackedStyles.ts +464 -0
- package/src/compiler/internal/Properties.ts +121 -0
- package/src/compiler/internal/RecipeConditions.ts +139 -0
- package/src/compiler/internal/RecipePayloads.ts +132 -0
- package/src/compiler/internal/Recipes.ts +531 -0
- package/src/compiler/internal/Relative.ts +87 -0
- package/src/compiler/internal/Scope.ts +36 -0
- package/src/compiler/internal/Selectors.ts +334 -0
- package/src/compiler/internal/Static.ts +783 -0
- package/src/compiler/internal/Stylesheets.ts +361 -0
- package/src/compiler/internal/Syntax.ts +31 -0
- package/src/compiler/internal/Themes.ts +1794 -0
- package/src/compiler/internal/Variables.ts +497 -0
- package/src/compiler/internal/ViewTransitions.ts +82 -0
- package/src/cx.ts +98 -0
- package/src/default.ts +484 -0
- package/src/index.ts +20 -0
- package/src/internal/Authoring.ts +199 -0
- package/src/internal/Binding.ts +187 -0
- package/src/internal/BindingDomains.ts +458 -0
- package/src/internal/Cascade.ts +165 -0
- package/src/internal/Compound.ts +522 -0
- package/src/internal/Condition.ts +283 -0
- package/src/internal/Corner.ts +17 -0
- package/src/internal/FunctionSyntax.ts +271 -0
- package/src/internal/FunctionValue.ts +96 -0
- package/src/internal/Geometry.ts +30 -0
- package/src/internal/Grid.ts +67 -0
- package/src/internal/Identifier.ts +14 -0
- package/src/internal/Identity.ts +89 -0
- package/src/internal/Lexical.ts +202 -0
- package/src/internal/Literal.ts +3820 -0
- package/src/internal/NativeProperties.ts +936 -0
- package/src/internal/Numeric.ts +77 -0
- package/src/internal/Query.ts +87 -0
- package/src/internal/Recipe.ts +17 -0
- package/src/internal/RuleReference.ts +102 -0
- package/src/internal/Scheme.ts +20 -0
- package/src/internal/Shorthands.ts +120 -0
- package/src/internal/Targets.ts +162 -0
- package/src/internal/Token.ts +380 -0
- package/src/internal/Tuple.ts +29 -0
- package/src/internal/Value.ts +320 -0
- package/src/metro/Graph.ts +78 -0
- package/src/metro/Watch.ts +88 -0
- package/src/metro/index.ts +99 -0
- package/src/metro/transformer.ts +97 -0
- package/src/next/index.ts +114 -0
- package/src/next/loader.ts +369 -0
- package/src/node/Host.ts +1204 -0
- package/src/node/index.ts +6 -0
- package/src/react-native/Host.ts +289 -0
- package/src/react-native/StyleSheet.ts +1084 -0
- package/src/react-native/Variants.ts +122 -0
- package/src/react-native/index.ts +7 -0
- package/src/react-native/internal/Color.ts +110 -0
- package/src/react-native/internal/NativeSchema.ts +3096 -0
- package/src/react-native/internal/Scalar.ts +253 -0
- package/src/react-native/internal/Values.ts +87 -0
- package/src/react-native/react.ts +47 -0
- package/src/reset.css +244 -0
- package/src/runtime/Appearance.ts +155 -0
- package/src/runtime/Composition.ts +87 -0
- package/src/runtime/CompositionHtml.ts +38 -0
- package/src/runtime/ConditionalRecipe.ts +70 -0
- package/src/runtime/Dynamic.ts +51 -0
- package/src/runtime/Html.ts +91 -0
- package/src/runtime/Native.ts +144 -0
- package/src/runtime/NativeContext.ts +74 -0
- package/src/runtime/NativeDynamic.ts +246 -0
- package/src/runtime/PayloadRecipe.ts +96 -0
- package/src/runtime/Props.ts +33 -0
- package/src/runtime/Recipe.ts +74 -0
- package/src/runtime/Selection.ts +82 -0
- package/src/runtime/Variable.ts +15 -0
- package/src/runtime/index.ts +45 -0
- package/src/styleFunction.ts +138 -0
- package/src/themes/LICENSE.tailwind +21 -0
- package/src/variable.ts +105 -0
- package/src/variants.ts +218 -0
- package/src/vite/index.ts +1473 -0
- package/src/web/Css.ts +801 -0
- package/src/web/colorProfile.ts +60 -0
- package/src/web/counterStyle.ts +82 -0
- package/src/web/cssFunction.ts +181 -0
- package/src/web/customMedia.ts +16 -0
- package/src/web/fontFace.ts +41 -0
- package/src/web/fontFeatureValues.ts +79 -0
- package/src/web/fontPaletteValues.ts +42 -0
- package/src/web/global.ts +39 -0
- package/src/web/importCss.ts +23 -0
- package/src/web/index.ts +22 -0
- package/src/web/internal/Block.ts +29 -0
- package/src/web/internal/ClassName.ts +112 -0
- package/src/web/internal/Context.ts +16 -0
- package/src/web/internal/Contributions.ts +219 -0
- package/src/web/internal/Namespace.ts +21 -0
- package/src/web/internal/Themes.ts +133 -0
- package/src/web/keyframes.ts +43 -0
- package/src/web/layers.ts +6 -0
- package/src/web/namespace.ts +19 -0
- package/src/web/page.ts +140 -0
- package/src/web/positionTry.ts +71 -0
- package/src/web/property.ts +35 -0
- package/src/web/viewTransition.ts +89 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/** Binds authored style data to extracted stylesheets without inserting CSS. @module */
|
|
2
|
+
import type { style } from '../styleFunction.js'
|
|
3
|
+
import * as Html from '../runtime/CompositionHtml.js'
|
|
4
|
+
import * as Identity from './Identity.js'
|
|
5
|
+
import * as Props from '../runtime/Props.js'
|
|
6
|
+
import * as Style from '../Style.js'
|
|
7
|
+
import type * as Theme from '../Theme.js'
|
|
8
|
+
|
|
9
|
+
/** Private ownership used by uncompiled composition; never spread onto DOM props. */
|
|
10
|
+
export const metadata = Symbol.for('zyzz.authoring')
|
|
11
|
+
|
|
12
|
+
/** Identity and replaceable attribute/slot ownership for an applied definition. */
|
|
13
|
+
export type Owner = {
|
|
14
|
+
readonly name: string
|
|
15
|
+
readonly attributes: readonly string[]
|
|
16
|
+
readonly slots: readonly string[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Attaches authoring ownership without adding enumerable props. */
|
|
20
|
+
export function bind<value extends object>(
|
|
21
|
+
value: value,
|
|
22
|
+
owners: readonly Owner[],
|
|
23
|
+
): value {
|
|
24
|
+
Object.defineProperty(value, metadata, { value: owners })
|
|
25
|
+
return value
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Authoring identity, output convention, and optional token context. */
|
|
29
|
+
export type Options = {
|
|
30
|
+
readonly id?: string | undefined
|
|
31
|
+
readonly output?: style.Output | undefined
|
|
32
|
+
readonly theme?: Theme.Definition | undefined
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Expands selector and variable containers without changing declaration order. */
|
|
36
|
+
export function body(input: Record<string, unknown>): Record<string, unknown> {
|
|
37
|
+
return Object.fromEntries(
|
|
38
|
+
Object.entries(input).flatMap(([key, value]) => {
|
|
39
|
+
if (key === 'targets') {
|
|
40
|
+
if (!value || typeof value !== 'object') return [[key, value]]
|
|
41
|
+
const descriptors = Object.getOwnPropertyDescriptors(value)
|
|
42
|
+
const web = descriptors.web
|
|
43
|
+
if (web && 'value' in web && web.value && typeof web.value === 'object')
|
|
44
|
+
descriptors.web = { ...web, value: body(web.value) }
|
|
45
|
+
return [[key, Object.create(Object.getPrototypeOf(value), descriptors)]]
|
|
46
|
+
}
|
|
47
|
+
if (key === 'selectors' || key === 'variables')
|
|
48
|
+
return Object.entries(value as Record<string, unknown>).map(
|
|
49
|
+
([name, entry]) => [
|
|
50
|
+
name,
|
|
51
|
+
key === 'selectors'
|
|
52
|
+
? body(entry as Record<string, unknown>)
|
|
53
|
+
: entry,
|
|
54
|
+
],
|
|
55
|
+
)
|
|
56
|
+
if (key.startsWith('@') || key.startsWith(':') || key.includes('&'))
|
|
57
|
+
return [[key, body(value as Record<string, unknown>)]]
|
|
58
|
+
return [[key, value]]
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Creates spreadable props using content identities or an explicit definition identity. */
|
|
64
|
+
export function create(
|
|
65
|
+
input: unknown = {},
|
|
66
|
+
options: Options = {},
|
|
67
|
+
): style.ReturnType {
|
|
68
|
+
const dynamic = typeof input === 'function'
|
|
69
|
+
const id =
|
|
70
|
+
options.id === undefined
|
|
71
|
+
? undefined
|
|
72
|
+
: Identity.requireId(options.id, 'style')
|
|
73
|
+
if (dynamic && !id) Identity.requireId(undefined, 'Dynamic style')
|
|
74
|
+
if (!dynamic && !id && Object.keys(input as object).length === 0)
|
|
75
|
+
Identity.requireId(undefined, 'Empty style')
|
|
76
|
+
|
|
77
|
+
const className = id
|
|
78
|
+
? `z-style-${id}`
|
|
79
|
+
: Identity.style(
|
|
80
|
+
(
|
|
81
|
+
Style.define as (
|
|
82
|
+
input: Record<string, unknown>,
|
|
83
|
+
options: Style.define.Options,
|
|
84
|
+
) => Style.Definition
|
|
85
|
+
)(
|
|
86
|
+
{ style: body(input as Record<string, unknown>) },
|
|
87
|
+
{ theme: options.theme },
|
|
88
|
+
).styles[0]!,
|
|
89
|
+
)
|
|
90
|
+
const props = Props.create({ className })
|
|
91
|
+
const apply = (values?: style.Options & Record<string, unknown>) => {
|
|
92
|
+
let result = props(values as style.Options)
|
|
93
|
+
if (dynamic) {
|
|
94
|
+
const style: Record<string, string | number | undefined> = {
|
|
95
|
+
...result.style,
|
|
96
|
+
}
|
|
97
|
+
for (const [field, value] of Object.entries(values ?? {})) {
|
|
98
|
+
if (['className', 'style', 'variables'].includes(field)) continue
|
|
99
|
+
style[Identity.slot(id!, field)] =
|
|
100
|
+
value === '' ? ' ' : (value as string | number)
|
|
101
|
+
}
|
|
102
|
+
result = { ...result, style }
|
|
103
|
+
}
|
|
104
|
+
return bind(options.output === 'html' ? Html.from(result) : result, [
|
|
105
|
+
{
|
|
106
|
+
name: className,
|
|
107
|
+
attributes: [],
|
|
108
|
+
slots: dynamic
|
|
109
|
+
? Object.keys(values ?? {})
|
|
110
|
+
.filter(
|
|
111
|
+
(key) => !['className', 'style', 'variables'].includes(key),
|
|
112
|
+
)
|
|
113
|
+
.map((key) => Identity.slot(id!, key))
|
|
114
|
+
: [],
|
|
115
|
+
},
|
|
116
|
+
])
|
|
117
|
+
}
|
|
118
|
+
Object.defineProperty(apply, Symbol.toPrimitive, {
|
|
119
|
+
value: () => `.${className}`,
|
|
120
|
+
})
|
|
121
|
+
return apply as style.ReturnType
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Selects finite variants and binds dynamic payloads using explicit identities. */
|
|
125
|
+
export function variants(
|
|
126
|
+
input: Record<string, unknown>,
|
|
127
|
+
options: Options = {},
|
|
128
|
+
): unknown {
|
|
129
|
+
const id = Identity.requireId(options.id, 'variants')
|
|
130
|
+
const className = `z-style-${id}`
|
|
131
|
+
const axes = Object.entries(
|
|
132
|
+
(input.variants ?? {}) as Record<string, Record<string, unknown>>,
|
|
133
|
+
)
|
|
134
|
+
const conditions = Object.keys((input.conditions ?? {}) as object)
|
|
135
|
+
const defaults = (input.defaultVariants ?? {}) as Record<string, unknown>
|
|
136
|
+
const props = Props.create({ className })
|
|
137
|
+
|
|
138
|
+
return (values: Record<string, unknown> & style.Options = {}) => {
|
|
139
|
+
const result = { ...props(values as style.Options) } as {
|
|
140
|
+
className: string
|
|
141
|
+
style?: style.Props['style']
|
|
142
|
+
[key: `data-${string}`]: string | undefined
|
|
143
|
+
}
|
|
144
|
+
const bindings: Record<string, string | number> = {}
|
|
145
|
+
function select(axis: string, value: unknown, context: number): unknown {
|
|
146
|
+
if (!value || typeof value !== 'object') return value
|
|
147
|
+
const choice = Object.keys(value)[0]!
|
|
148
|
+
const payload = (
|
|
149
|
+
value as Record<string, Record<string, string | number>>
|
|
150
|
+
)[choice]!
|
|
151
|
+
const axisIndex = axes.findIndex(([name]) => name === axis)
|
|
152
|
+
const choiceIndex = Object.keys(axes[axisIndex]![1]).indexOf(choice)
|
|
153
|
+
for (const [field, value] of Object.entries(payload))
|
|
154
|
+
bindings[
|
|
155
|
+
Identity.slot(
|
|
156
|
+
`${id}-${axisIndex + 1}-${choiceIndex}-${context}`,
|
|
157
|
+
field,
|
|
158
|
+
)
|
|
159
|
+
] = value === '' ? ' ' : value
|
|
160
|
+
return choice
|
|
161
|
+
}
|
|
162
|
+
for (const [axis] of axes) {
|
|
163
|
+
const value = select(
|
|
164
|
+
axis,
|
|
165
|
+
values[axis] === undefined ? defaults[axis] : values[axis],
|
|
166
|
+
0,
|
|
167
|
+
)
|
|
168
|
+
if (value !== undefined && value !== null)
|
|
169
|
+
result[`data-${axis}`] = String(value)
|
|
170
|
+
}
|
|
171
|
+
const selected = values.conditions as
|
|
172
|
+
| Record<string, Record<string, unknown>>
|
|
173
|
+
| undefined
|
|
174
|
+
for (const [index, name] of conditions.entries()) {
|
|
175
|
+
const context = selected?.[name]
|
|
176
|
+
if (!context) continue
|
|
177
|
+
for (const [axis] of axes) {
|
|
178
|
+
const value = select(axis, context[axis], index + 1)
|
|
179
|
+
if (value !== undefined)
|
|
180
|
+
result[`data-zyzz-condition-${index}-${axis}`] =
|
|
181
|
+
value === null ? 'n' : `s${value}`
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (Object.keys(bindings).length)
|
|
185
|
+
result.style = { ...result.style, ...bindings }
|
|
186
|
+
return bind(options.output === 'html' ? Html.from(result) : result, [
|
|
187
|
+
{
|
|
188
|
+
name: className,
|
|
189
|
+
attributes: axes.flatMap(([axis]) => [
|
|
190
|
+
`data-${axis}`,
|
|
191
|
+
...conditions.map(
|
|
192
|
+
(_, index) => `data-zyzz-condition-${index}-${axis}`,
|
|
193
|
+
),
|
|
194
|
+
]),
|
|
195
|
+
slots: Object.keys(bindings),
|
|
196
|
+
},
|
|
197
|
+
])
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/** Describes fixed custom-property slots shared by explicit and callback bindings. @module */
|
|
2
|
+
import type * as Literal from './Literal.js'
|
|
3
|
+
import type * as Token from './Token.js'
|
|
4
|
+
import * as BindingDomains from './BindingDomains.js'
|
|
5
|
+
|
|
6
|
+
/** Explicit scalar domains or an unconstrained custom property. */
|
|
7
|
+
export type Domain = Kind | '*'
|
|
8
|
+
|
|
9
|
+
/** Supported runtime scalar domains. */
|
|
10
|
+
export type Kind =
|
|
11
|
+
| 'color'
|
|
12
|
+
| 'length'
|
|
13
|
+
| 'number'
|
|
14
|
+
| 'percentage'
|
|
15
|
+
| 'signedLength'
|
|
16
|
+
| 'signedPercentage'
|
|
17
|
+
|
|
18
|
+
/** A compiler-assigned web custom property with its scalar domain. */
|
|
19
|
+
export type Reference<kind extends Domain = Domain> = {
|
|
20
|
+
/** Fixed CSS custom-property name. */
|
|
21
|
+
readonly name: `--${string}`
|
|
22
|
+
/** Scalar domain used by authoring types and runtime primitive checks. */
|
|
23
|
+
readonly type: kind
|
|
24
|
+
/** Distinguishes slots from theme references. */
|
|
25
|
+
readonly variable: true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Scalar inputs accepted by a slot. CSS semantics remain statically checked. */
|
|
29
|
+
export type Value<kind extends Domain> = kind extends '*'
|
|
30
|
+
? string | number
|
|
31
|
+
: kind extends 'number'
|
|
32
|
+
? number
|
|
33
|
+
: kind extends 'color'
|
|
34
|
+
? Literal.Color
|
|
35
|
+
: kind extends 'signedPercentage'
|
|
36
|
+
? `${number}%`
|
|
37
|
+
: kind extends 'signedLength'
|
|
38
|
+
? Exclude<Literal.Length, `${number}%`>
|
|
39
|
+
: kind extends 'percentage'
|
|
40
|
+
? `${number}%` & NonNegative
|
|
41
|
+
: Exclude<Literal.Length, `${number}%`> & (NonNegative | 0)
|
|
42
|
+
|
|
43
|
+
type NonNegative =
|
|
44
|
+
`${'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '.' | '+'}${string}`
|
|
45
|
+
|
|
46
|
+
/** Property domains that accept each scalar reference. */
|
|
47
|
+
export type Properties<kind extends Kind> = {
|
|
48
|
+
[property in keyof Literal.Properties]: Property<kind, property>
|
|
49
|
+
}[keyof Literal.Properties]
|
|
50
|
+
|
|
51
|
+
/** Checks one property's binding domain without enumerating every CSS grammar. */
|
|
52
|
+
export type Property<
|
|
53
|
+
kind extends Kind,
|
|
54
|
+
property extends keyof Literal.Properties,
|
|
55
|
+
> = property extends `--${string}`
|
|
56
|
+
? property
|
|
57
|
+
: property extends keyof typeof Literal.rules
|
|
58
|
+
? (typeof Literal.rules)[property] extends { kind: 'compound' }
|
|
59
|
+
? never
|
|
60
|
+
: kind extends 'percentage' | 'signedPercentage'
|
|
61
|
+
? (typeof Literal.rules)[property] extends { kind: 'number' }
|
|
62
|
+
? (typeof Literal.rules)[property] extends { percentage: true }
|
|
63
|
+
? Compatible<kind, property>
|
|
64
|
+
: never
|
|
65
|
+
: Compatible<kind, property>
|
|
66
|
+
: Compatible<kind, property>
|
|
67
|
+
: never
|
|
68
|
+
|
|
69
|
+
type Compatible<
|
|
70
|
+
kind extends Kind,
|
|
71
|
+
property extends keyof Literal.Properties,
|
|
72
|
+
> = kind extends 'color'
|
|
73
|
+
? property extends Token.Properties<'color'>
|
|
74
|
+
? property
|
|
75
|
+
: never
|
|
76
|
+
: kind extends 'number'
|
|
77
|
+
? number extends Literal.Properties[property]
|
|
78
|
+
? property extends keyof typeof Literal.rules
|
|
79
|
+
? property extends
|
|
80
|
+
| 'opacity'
|
|
81
|
+
| 'fillOpacity'
|
|
82
|
+
| 'floodOpacity'
|
|
83
|
+
| 'stopOpacity'
|
|
84
|
+
| 'strokeOpacity'
|
|
85
|
+
? property
|
|
86
|
+
: (typeof Literal.rules)[property] extends
|
|
87
|
+
| { kind: 'grid-line' | 'ratio' }
|
|
88
|
+
| { integer: true }
|
|
89
|
+
| { min: number }
|
|
90
|
+
| { max: number }
|
|
91
|
+
| { negative: false }
|
|
92
|
+
? never
|
|
93
|
+
: property
|
|
94
|
+
: property
|
|
95
|
+
: never
|
|
96
|
+
: Extract<
|
|
97
|
+
Literal.Properties[property],
|
|
98
|
+
kind extends 'percentage' | 'signedPercentage'
|
|
99
|
+
? `${number}%`
|
|
100
|
+
: `${number}px`
|
|
101
|
+
> extends never
|
|
102
|
+
? never
|
|
103
|
+
: kind extends 'signedLength' | 'signedPercentage'
|
|
104
|
+
? property extends keyof typeof Literal.rules
|
|
105
|
+
? (typeof Literal.rules)[property] extends
|
|
106
|
+
| { negative: false }
|
|
107
|
+
| { kind: 'line' | 'grid-tracks' }
|
|
108
|
+
| { min: number }
|
|
109
|
+
| { max: number }
|
|
110
|
+
? never
|
|
111
|
+
: property
|
|
112
|
+
: property
|
|
113
|
+
: property
|
|
114
|
+
|
|
115
|
+
/** Rejects broad numeric callback values where a property requires a narrower domain. */
|
|
116
|
+
export type Checked<style> = {
|
|
117
|
+
[property in keyof style]: property extends 'targets'
|
|
118
|
+
? never
|
|
119
|
+
: property extends keyof Literal.Properties
|
|
120
|
+
? number extends style[property]
|
|
121
|
+
? property extends Property<'number', property>
|
|
122
|
+
? unknown
|
|
123
|
+
: never
|
|
124
|
+
: unknown
|
|
125
|
+
: style[property] extends Record<string, unknown>
|
|
126
|
+
? Checked<style[property]>
|
|
127
|
+
: unknown
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Rejects reserved callback field names and importance-bearing value domains. */
|
|
131
|
+
export type Inputs<values> = {
|
|
132
|
+
[key in keyof values]: key extends
|
|
133
|
+
| 'class'
|
|
134
|
+
| 'className'
|
|
135
|
+
| 'key'
|
|
136
|
+
| 'ref'
|
|
137
|
+
| 'style'
|
|
138
|
+
| 'variables'
|
|
139
|
+
| '__proto__'
|
|
140
|
+
? never
|
|
141
|
+
: Extract<values[key], `${string}!${string}`> extends never
|
|
142
|
+
? Extract<
|
|
143
|
+
Lowercase<Extract<values[key], string>>,
|
|
144
|
+
'initial' | 'inherit' | 'unset' | 'revert' | 'revert-layer'
|
|
145
|
+
> extends never
|
|
146
|
+
? values[key]
|
|
147
|
+
: never
|
|
148
|
+
: never
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Recognizes fixed slot data without invoking consumer accessors. */
|
|
152
|
+
export function is(value: unknown): value is Reference {
|
|
153
|
+
if (typeof value !== 'object' || value === null || !Object.isFrozen(value))
|
|
154
|
+
return false
|
|
155
|
+
|
|
156
|
+
const fields = Object.getOwnPropertyDescriptors(value)
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
['name', 'type', 'variable'].every(
|
|
160
|
+
(key) => fields[key] && 'value' in fields[key]!,
|
|
161
|
+
) &&
|
|
162
|
+
fields.variable!.value === true &&
|
|
163
|
+
typeof fields.name!.value === 'string' &&
|
|
164
|
+
/^--[a-zA-Z0-9_-]+$/.test(fields.name!.value) &&
|
|
165
|
+
[
|
|
166
|
+
'*',
|
|
167
|
+
'color',
|
|
168
|
+
'length',
|
|
169
|
+
'number',
|
|
170
|
+
'percentage',
|
|
171
|
+
'signedLength',
|
|
172
|
+
'signedPercentage',
|
|
173
|
+
].includes(fields.type!.value)
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Checks template reference domains against declaration shapes. */
|
|
178
|
+
export function accepts(
|
|
179
|
+
kind: Domain,
|
|
180
|
+
property: keyof Literal.Properties,
|
|
181
|
+
): boolean {
|
|
182
|
+
if (kind === '*' || property.startsWith('--')) return true
|
|
183
|
+
|
|
184
|
+
return (BindingDomains.properties[kind] as readonly string[]).includes(
|
|
185
|
+
property,
|
|
186
|
+
)
|
|
187
|
+
}
|