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,497 @@
|
|
|
1
|
+
/** Resolves individual CSS variables across lexical scopes and packed libraries. @module */
|
|
2
|
+
import type * as Ast from '@oxc-project/types'
|
|
3
|
+
import * as Walker from 'oxc-walker'
|
|
4
|
+
import type * as Binding from '../../internal/Binding.js'
|
|
5
|
+
import * as Theme from '../../Theme.js'
|
|
6
|
+
import type * as Css from '../../web/Css.js'
|
|
7
|
+
import * as Identity from '../../internal/Identity.js'
|
|
8
|
+
import * as Expression from './Expression.js'
|
|
9
|
+
import type * as Scope from './Scope.js'
|
|
10
|
+
import type * as Themes from './Themes.js'
|
|
11
|
+
import { InvalidError } from './Themes.js'
|
|
12
|
+
|
|
13
|
+
/** One authoring call replaced with immutable compiler-assigned slot data. */
|
|
14
|
+
export type Call = {
|
|
15
|
+
/** Exclusive source offset. */
|
|
16
|
+
readonly end: number
|
|
17
|
+
/** Fixed scalar reference retained in portable metadata. */
|
|
18
|
+
readonly slots: Readonly<Record<string, Binding.Reference>>
|
|
19
|
+
/** Inclusive source offset. */
|
|
20
|
+
readonly start: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Collects module-owned declarations without executing application code. */
|
|
24
|
+
export function collect(
|
|
25
|
+
program: Ast.Program,
|
|
26
|
+
namespace: string,
|
|
27
|
+
scope: Scope.Tracker,
|
|
28
|
+
links: Readonly<Record<string, Themes.Link>> = {},
|
|
29
|
+
moduleId = namespace,
|
|
30
|
+
) {
|
|
31
|
+
const imports = new Set<number>()
|
|
32
|
+
const external = new Map<number, Themes.Link>()
|
|
33
|
+
for (const statement of program.body) {
|
|
34
|
+
if (
|
|
35
|
+
statement.type !== 'ImportDeclaration' ||
|
|
36
|
+
statement.importKind === 'type'
|
|
37
|
+
)
|
|
38
|
+
continue
|
|
39
|
+
for (const specifier of statement.specifiers) {
|
|
40
|
+
if (
|
|
41
|
+
specifier.type === 'ImportSpecifier' &&
|
|
42
|
+
specifier.importKind === 'type'
|
|
43
|
+
)
|
|
44
|
+
continue
|
|
45
|
+
if (links[specifier.local.name]?.kind === 'variables')
|
|
46
|
+
external.set(specifier.start, links[specifier.local.name]!)
|
|
47
|
+
if (
|
|
48
|
+
statement.source.value === 'zyzz' &&
|
|
49
|
+
specifier.type === 'ImportSpecifier' &&
|
|
50
|
+
(specifier.imported.type === 'Identifier'
|
|
51
|
+
? specifier.imported.name
|
|
52
|
+
: specifier.imported.value) === 'variable'
|
|
53
|
+
)
|
|
54
|
+
imports.add(specifier.start)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!imports.size && !external.size)
|
|
59
|
+
return {
|
|
60
|
+
calls: [] as Call[],
|
|
61
|
+
exports: {} as Record<string, Themes.Link>,
|
|
62
|
+
reference: () => false,
|
|
63
|
+
references: new Map<
|
|
64
|
+
number,
|
|
65
|
+
{ end: number; reference: Binding.Reference }
|
|
66
|
+
>(),
|
|
67
|
+
registrations: [] as Css.Contribution[],
|
|
68
|
+
registrationStarts: [] as number[],
|
|
69
|
+
registrationLocations: [] as Ast.Node[],
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const declarations = new Map<number, number>()
|
|
73
|
+
const bindings = new Map<number, Ast.Expression>()
|
|
74
|
+
const namespaces = new Map<number, Map<string, Ast.Expression>>()
|
|
75
|
+
const factories: Ast.CallExpression[] = []
|
|
76
|
+
const undefinedValues = new Set<number>()
|
|
77
|
+
const ancestors: Ast.Node[] = []
|
|
78
|
+
|
|
79
|
+
function members(node: Ast.TSModuleDeclaration | Ast.TSGlobalDeclaration) {
|
|
80
|
+
const result = new Map<string, Ast.Expression>()
|
|
81
|
+
if (node.body?.type !== 'TSModuleBlock') return result
|
|
82
|
+
for (const statement of node.body.body) {
|
|
83
|
+
if (
|
|
84
|
+
statement.type !== 'ExportNamedDeclaration' ||
|
|
85
|
+
statement.declaration?.type !== 'VariableDeclaration' ||
|
|
86
|
+
statement.declaration.kind !== 'const'
|
|
87
|
+
)
|
|
88
|
+
continue
|
|
89
|
+
for (const declaration of statement.declaration.declarations)
|
|
90
|
+
if (declaration.id.type === 'Identifier' && declaration.init)
|
|
91
|
+
result.set(declaration.id.name, declaration.init)
|
|
92
|
+
}
|
|
93
|
+
return result
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Walker.walk(program, {
|
|
97
|
+
scopeTracker: scope,
|
|
98
|
+
enter(node, parent) {
|
|
99
|
+
if (node.type === 'Identifier') {
|
|
100
|
+
const declaration = scope.getDeclaration(node.name)
|
|
101
|
+
if (declaration) declarations.set(node.start, declaration.node.start)
|
|
102
|
+
else if (node.name === 'undefined') undefinedValues.add(node.start)
|
|
103
|
+
if (
|
|
104
|
+
declaration?.type === 'Import' &&
|
|
105
|
+
imports.has(declaration.node.start) &&
|
|
106
|
+
Walker.isReferenceIdentifier(node, parent!)
|
|
107
|
+
) {
|
|
108
|
+
if (
|
|
109
|
+
parent?.type !== 'CallExpression' ||
|
|
110
|
+
parent.callee !== node ||
|
|
111
|
+
parent.optional
|
|
112
|
+
)
|
|
113
|
+
throw new InvalidError(
|
|
114
|
+
'variable must be called directly in a module-level constant.',
|
|
115
|
+
node,
|
|
116
|
+
)
|
|
117
|
+
if (
|
|
118
|
+
!ancestors.some(
|
|
119
|
+
(entry) =>
|
|
120
|
+
entry.type === 'VariableDeclaration' && entry.kind === 'const',
|
|
121
|
+
) ||
|
|
122
|
+
ancestors.some((entry) =>
|
|
123
|
+
[
|
|
124
|
+
'ArrowFunctionExpression',
|
|
125
|
+
'FunctionExpression',
|
|
126
|
+
'FunctionDeclaration',
|
|
127
|
+
'BlockStatement',
|
|
128
|
+
].includes(entry.type),
|
|
129
|
+
)
|
|
130
|
+
)
|
|
131
|
+
throw new InvalidError(
|
|
132
|
+
'variable requires a module-level constant.',
|
|
133
|
+
parent,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
let initializer: Ast.Node = parent
|
|
137
|
+
for (let index = ancestors.length - 2; index >= 0; index--) {
|
|
138
|
+
const ancestor = ancestors[index]!
|
|
139
|
+
if (ancestor.type === 'VariableDeclarator') {
|
|
140
|
+
if (
|
|
141
|
+
ancestor.id.type === 'Identifier' &&
|
|
142
|
+
ancestor.init === initializer
|
|
143
|
+
)
|
|
144
|
+
break
|
|
145
|
+
} else if (
|
|
146
|
+
Expression.unwrap(ancestor) === Expression.unwrap(initializer)
|
|
147
|
+
) {
|
|
148
|
+
initializer = ancestor
|
|
149
|
+
continue
|
|
150
|
+
} else if (
|
|
151
|
+
ancestor.type === 'Property' &&
|
|
152
|
+
!ancestor.computed &&
|
|
153
|
+
ancestor.kind === 'init' &&
|
|
154
|
+
!ancestor.method &&
|
|
155
|
+
ancestor.value === initializer
|
|
156
|
+
) {
|
|
157
|
+
initializer = ancestor
|
|
158
|
+
continue
|
|
159
|
+
} else if (
|
|
160
|
+
ancestor.type === 'ObjectExpression' &&
|
|
161
|
+
ancestor.properties.some((property) => property === initializer)
|
|
162
|
+
) {
|
|
163
|
+
initializer = ancestor
|
|
164
|
+
continue
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
throw new InvalidError(
|
|
168
|
+
'variable requires a direct constant or object-group initializer.',
|
|
169
|
+
parent,
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
factories.push(parent)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (node.type === 'VariableDeclaration' && node.kind === 'const')
|
|
177
|
+
for (const declaration of node.declarations)
|
|
178
|
+
if (declaration.id.type === 'Identifier' && declaration.init)
|
|
179
|
+
bindings.set(declaration.start, declaration.init)
|
|
180
|
+
if (node.type === 'TSModuleDeclaration' && node.id.type === 'Identifier')
|
|
181
|
+
namespaces.set(node.id.start, members(node))
|
|
182
|
+
ancestors.push(node)
|
|
183
|
+
},
|
|
184
|
+
leave() {
|
|
185
|
+
ancestors.pop()
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
const calls: Call[] = []
|
|
190
|
+
const definitions = new Map<number, Themes.Link>()
|
|
191
|
+
const registrations: Css.Contribution[] = []
|
|
192
|
+
const registrationStarts: number[] = []
|
|
193
|
+
const registrationLocations: Ast.Node[] = []
|
|
194
|
+
for (const call of factories) {
|
|
195
|
+
const domain = call.arguments[0] && Expression.unwrap(call.arguments[0])
|
|
196
|
+
const value =
|
|
197
|
+
domain?.type === 'ObjectExpression'
|
|
198
|
+
? domain
|
|
199
|
+
: call.arguments[1] && Expression.unwrap(call.arguments[1])
|
|
200
|
+
const kind = (() => {
|
|
201
|
+
if (call.arguments.length === 0 || domain?.type === 'ObjectExpression')
|
|
202
|
+
return '*'
|
|
203
|
+
if (domain?.type === 'Literal') return domain.value
|
|
204
|
+
return undefined
|
|
205
|
+
})()
|
|
206
|
+
|
|
207
|
+
if (
|
|
208
|
+
(kind !== '*' &&
|
|
209
|
+
![
|
|
210
|
+
'color',
|
|
211
|
+
'length',
|
|
212
|
+
'number',
|
|
213
|
+
'percentage',
|
|
214
|
+
'signedLength',
|
|
215
|
+
'signedPercentage',
|
|
216
|
+
].includes(String(kind))) ||
|
|
217
|
+
call.arguments.length > 2 ||
|
|
218
|
+
(value && value.type !== 'ObjectExpression')
|
|
219
|
+
)
|
|
220
|
+
throw new InvalidError(
|
|
221
|
+
'variable requires a scalar domain and optional literal registration options.',
|
|
222
|
+
call,
|
|
223
|
+
)
|
|
224
|
+
const descriptor: Record<string, string | number | boolean> =
|
|
225
|
+
Object.create(null)
|
|
226
|
+
|
|
227
|
+
if (value?.type === 'ObjectExpression')
|
|
228
|
+
for (const entry of value.properties) {
|
|
229
|
+
if (
|
|
230
|
+
entry.type !== 'Property' ||
|
|
231
|
+
entry.computed ||
|
|
232
|
+
entry.method ||
|
|
233
|
+
entry.kind !== 'init'
|
|
234
|
+
)
|
|
235
|
+
throw new InvalidError(
|
|
236
|
+
'Variable registrations require literal descriptors.',
|
|
237
|
+
value,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
const key =
|
|
241
|
+
entry.key.type === 'Identifier'
|
|
242
|
+
? entry.key.name
|
|
243
|
+
: entry.key.type === 'Literal'
|
|
244
|
+
? String(entry.key.value)
|
|
245
|
+
: ''
|
|
246
|
+
|
|
247
|
+
const input = Expression.unwrap(entry.value)
|
|
248
|
+
if (
|
|
249
|
+
key === 'syntax' &&
|
|
250
|
+
input.type === 'Identifier' &&
|
|
251
|
+
input.name === 'undefined' &&
|
|
252
|
+
undefinedValues.has(input.start)
|
|
253
|
+
)
|
|
254
|
+
continue
|
|
255
|
+
|
|
256
|
+
const literal =
|
|
257
|
+
input.type === 'Literal'
|
|
258
|
+
? input.value
|
|
259
|
+
: input.type === 'UnaryExpression' &&
|
|
260
|
+
['+', '-'].includes(input.operator) &&
|
|
261
|
+
input.argument.type === 'Literal' &&
|
|
262
|
+
typeof input.argument.value === 'number'
|
|
263
|
+
? (input.operator === '-' ? -1 : 1) * input.argument.value
|
|
264
|
+
: undefined
|
|
265
|
+
if (
|
|
266
|
+
!['id', 'syntax', 'inherits', 'initialValue'].includes(key) ||
|
|
267
|
+
Object.hasOwn(descriptor, key) ||
|
|
268
|
+
!['string', 'number', 'boolean'].includes(typeof literal)
|
|
269
|
+
)
|
|
270
|
+
throw new InvalidError(
|
|
271
|
+
'Invalid variable registration descriptor.',
|
|
272
|
+
entry,
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
descriptor[key] = literal as string | number | boolean
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const name =
|
|
279
|
+
`--z-v${descriptor.id === undefined ? `${namespace}-${call.start}` : Identity.requireId(typeof descriptor.id === 'string' ? descriptor.id : undefined, 'variable')}` as const
|
|
280
|
+
if (value && Object.keys(descriptor).some((key) => key !== 'id')) {
|
|
281
|
+
const syntax =
|
|
282
|
+
kind === 'signedLength'
|
|
283
|
+
? '<length>'
|
|
284
|
+
: kind === 'signedPercentage'
|
|
285
|
+
? '<percentage>'
|
|
286
|
+
: `<${kind}>`
|
|
287
|
+
if (
|
|
288
|
+
typeof descriptor.inherits !== 'boolean' ||
|
|
289
|
+
!['string', 'number'].includes(typeof descriptor.initialValue) ||
|
|
290
|
+
(descriptor.syntax !== undefined && descriptor.syntax !== syntax)
|
|
291
|
+
)
|
|
292
|
+
throw new InvalidError(
|
|
293
|
+
'Registration requires matching syntax, inherits, and an independent initialValue.',
|
|
294
|
+
value,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
if (kind === 'length' || kind === 'percentage') {
|
|
298
|
+
const initialValue = String(descriptor.initialValue)
|
|
299
|
+
const literal =
|
|
300
|
+
kind === 'length'
|
|
301
|
+
? /^(?:0|\+?(?:\d*\.\d+|\d+)(?:[eE][+-]?\d+)?(?:px|in|cm|mm|q|pt|pc))$/
|
|
302
|
+
: /^\+?(?:\d*\.\d+|\d+)(?:[eE][+-]?\d+)?%$/
|
|
303
|
+
|
|
304
|
+
if (!literal.test(initialValue))
|
|
305
|
+
throw new InvalidError(
|
|
306
|
+
'Unsigned variable registrations require a nonnegative literal initialValue.',
|
|
307
|
+
value,
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
registrationStarts.push(call.start)
|
|
312
|
+
registrationLocations.push(call)
|
|
313
|
+
registrations.push({
|
|
314
|
+
kind: 'property',
|
|
315
|
+
name,
|
|
316
|
+
syntax,
|
|
317
|
+
inherits: descriptor.inherits,
|
|
318
|
+
initialValue: descriptor.initialValue as string | number,
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const slot = Object.freeze({
|
|
323
|
+
name,
|
|
324
|
+
type: kind as Binding.Domain,
|
|
325
|
+
variable: true as const,
|
|
326
|
+
})
|
|
327
|
+
const entry = Object.freeze({
|
|
328
|
+
start: call.start,
|
|
329
|
+
end: call.end,
|
|
330
|
+
slots: Object.freeze({ value: slot }),
|
|
331
|
+
})
|
|
332
|
+
calls.push(entry)
|
|
333
|
+
definitions.set(call.start, {
|
|
334
|
+
binding: name,
|
|
335
|
+
kind: 'variables',
|
|
336
|
+
definition: Theme.define({}),
|
|
337
|
+
call: {
|
|
338
|
+
start: call.start,
|
|
339
|
+
end: call.end,
|
|
340
|
+
name,
|
|
341
|
+
tokenType: '{}',
|
|
342
|
+
variables: entry.slots,
|
|
343
|
+
variableOwner: moduleId.replace(/\.[cm]?[jt]sx?$/, ''),
|
|
344
|
+
},
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function group(
|
|
349
|
+
values: Map<string, Ast.Expression>,
|
|
350
|
+
start: number,
|
|
351
|
+
seen: Set<Ast.Node>,
|
|
352
|
+
): Themes.Link | undefined {
|
|
353
|
+
const members: Record<string, Themes.Link> = Object.create(null)
|
|
354
|
+
for (const [name, value] of values) {
|
|
355
|
+
const member = resolve(value, new Set(seen))
|
|
356
|
+
if (member) members[name] = member
|
|
357
|
+
}
|
|
358
|
+
if (!Object.keys(members).length) return undefined
|
|
359
|
+
return {
|
|
360
|
+
binding: `z-v${namespace}-${start}`,
|
|
361
|
+
kind: 'variables',
|
|
362
|
+
definition: Theme.define({}),
|
|
363
|
+
call: { start: -1, end: -1, name: '', tokenType: '{}', variables: {} },
|
|
364
|
+
members,
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function resolve(
|
|
369
|
+
input: Ast.Node,
|
|
370
|
+
seen = new Set<Ast.Node>(),
|
|
371
|
+
): Themes.Link | undefined {
|
|
372
|
+
const node = Expression.unwrap(input)
|
|
373
|
+
if (seen.has(node)) return undefined
|
|
374
|
+
seen.add(node)
|
|
375
|
+
if (node.type === 'CallExpression') return definitions.get(node.start)
|
|
376
|
+
if (node.type === 'Identifier') {
|
|
377
|
+
const declaration = declarations.get(node.start)
|
|
378
|
+
if (declaration === undefined) return undefined
|
|
379
|
+
const imported = external.get(declaration)
|
|
380
|
+
if (imported) return imported
|
|
381
|
+
const values = namespaces.get(declaration)
|
|
382
|
+
if (values) return group(values, declaration, seen)
|
|
383
|
+
const value = bindings.get(declaration)
|
|
384
|
+
return value ? resolve(value, seen) : undefined
|
|
385
|
+
}
|
|
386
|
+
if (node.type === 'MemberExpression' && !node.optional) {
|
|
387
|
+
const key =
|
|
388
|
+
!node.computed && node.property.type === 'Identifier'
|
|
389
|
+
? node.property.name
|
|
390
|
+
: node.property.type === 'Literal'
|
|
391
|
+
? String(node.property.value)
|
|
392
|
+
: undefined
|
|
393
|
+
if (key === undefined) return undefined
|
|
394
|
+
return resolve(node.object, seen)?.members?.[key]
|
|
395
|
+
}
|
|
396
|
+
if (node.type === 'ObjectExpression') {
|
|
397
|
+
const values = new Map<string, Ast.Expression>()
|
|
398
|
+
for (const property of node.properties) {
|
|
399
|
+
if (
|
|
400
|
+
property.type !== 'Property' ||
|
|
401
|
+
property.method ||
|
|
402
|
+
property.kind !== 'init' ||
|
|
403
|
+
property.computed
|
|
404
|
+
)
|
|
405
|
+
return undefined
|
|
406
|
+
const key =
|
|
407
|
+
property.key.type === 'Identifier'
|
|
408
|
+
? property.key.name
|
|
409
|
+
: property.key.type === 'Literal'
|
|
410
|
+
? String(property.key.value)
|
|
411
|
+
: undefined
|
|
412
|
+
if (key !== undefined) values.set(key, property.value)
|
|
413
|
+
}
|
|
414
|
+
return group(values, node.start, seen)
|
|
415
|
+
}
|
|
416
|
+
return undefined
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const references = new Map<
|
|
420
|
+
number,
|
|
421
|
+
{ end: number; reference: Binding.Reference }
|
|
422
|
+
>()
|
|
423
|
+
Walker.walk(program, {
|
|
424
|
+
enter(node) {
|
|
425
|
+
if (node.type !== 'Identifier' && node.type !== 'MemberExpression') return
|
|
426
|
+
const resolved = resolve(node)
|
|
427
|
+
const reference = resolved?.call.variables?.value
|
|
428
|
+
if (reference) references.set(node.start, { end: node.end, reference })
|
|
429
|
+
},
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
const exports: Record<string, Themes.Link> = Object.create(null)
|
|
433
|
+
for (const statement of program.body) {
|
|
434
|
+
if (statement.type === 'ExportDefaultDeclaration') {
|
|
435
|
+
const link = resolve(statement.declaration)
|
|
436
|
+
if (link) exports.default = link
|
|
437
|
+
}
|
|
438
|
+
if (
|
|
439
|
+
statement.type !== 'ExportNamedDeclaration' ||
|
|
440
|
+
statement.exportKind === 'type'
|
|
441
|
+
)
|
|
442
|
+
continue
|
|
443
|
+
const declaration = statement.declaration
|
|
444
|
+
if (declaration?.type === 'VariableDeclaration')
|
|
445
|
+
for (const variable of declaration.declarations) {
|
|
446
|
+
if (variable.id.type !== 'Identifier' || !variable.init) continue
|
|
447
|
+
const link = resolve(variable.init)
|
|
448
|
+
if (link) exports[variable.id.name] = link
|
|
449
|
+
}
|
|
450
|
+
if (
|
|
451
|
+
declaration?.type === 'TSModuleDeclaration' &&
|
|
452
|
+
declaration.id.type === 'Identifier'
|
|
453
|
+
) {
|
|
454
|
+
const link = group(members(declaration), declaration.start, new Set())
|
|
455
|
+
if (link) exports[declaration.id.name] = link
|
|
456
|
+
}
|
|
457
|
+
for (const specifier of statement.specifiers) {
|
|
458
|
+
if (specifier.exportKind === 'type') continue
|
|
459
|
+
const link = resolve(specifier.local)
|
|
460
|
+
if (link)
|
|
461
|
+
exports[
|
|
462
|
+
specifier.exported.type === 'Identifier'
|
|
463
|
+
? specifier.exported.name
|
|
464
|
+
: specifier.exported.value
|
|
465
|
+
] = link
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function reference(
|
|
470
|
+
node: Extract<Ast.Node, { type: 'Identifier' | 'JSXIdentifier' }>,
|
|
471
|
+
parent: Ast.Node,
|
|
472
|
+
binding: Walker.ScopeTrackerNode | null,
|
|
473
|
+
) {
|
|
474
|
+
if (binding?.type === 'Import' && imports.has(binding.node.start))
|
|
475
|
+
return true
|
|
476
|
+
const link =
|
|
477
|
+
resolve(
|
|
478
|
+
parent.type === 'MemberExpression' && parent.object === node
|
|
479
|
+
? parent
|
|
480
|
+
: node,
|
|
481
|
+
) ?? resolve(node)
|
|
482
|
+
if (!link) return false
|
|
483
|
+
if (link.call.start >= 0 && node.start < link.call.end)
|
|
484
|
+
throw new InvalidError('Variables must be declared before use.', node)
|
|
485
|
+
return true
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return {
|
|
489
|
+
calls,
|
|
490
|
+
exports,
|
|
491
|
+
reference,
|
|
492
|
+
references,
|
|
493
|
+
registrations,
|
|
494
|
+
registrationStarts,
|
|
495
|
+
registrationLocations,
|
|
496
|
+
}
|
|
497
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** Validates view-transition descriptors before a parser can discard invalid values. @module */
|
|
2
|
+
import * as Lightning from 'lightningcss'
|
|
3
|
+
|
|
4
|
+
/** Checks a token-preserving spelling of view-transition rules from source or packed CSS. */
|
|
5
|
+
export function validate(source: string, marker: string): void {
|
|
6
|
+
Lightning.transform({
|
|
7
|
+
filename: 'view-transitions.css',
|
|
8
|
+
code: new TextEncoder().encode(source),
|
|
9
|
+
visitor: {
|
|
10
|
+
Rule(rule) {
|
|
11
|
+
if (rule.type !== 'unknown' || rule.value.name !== marker) return
|
|
12
|
+
if (rule.value.prelude.length || !rule.value.block)
|
|
13
|
+
throw new Error(
|
|
14
|
+
'View-transition rules require a descriptor block and no prelude.',
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
let declaration: Lightning.TokenOrValue[] = []
|
|
18
|
+
const flush = () => {
|
|
19
|
+
if (!declaration.length) return
|
|
20
|
+
const [name, colon, ...values] = declaration
|
|
21
|
+
if (
|
|
22
|
+
name?.type !== 'token' ||
|
|
23
|
+
name.value.type !== 'ident' ||
|
|
24
|
+
colon?.type !== 'token' ||
|
|
25
|
+
colon.value.type !== 'colon' ||
|
|
26
|
+
!values.length ||
|
|
27
|
+
values.some(
|
|
28
|
+
(value) =>
|
|
29
|
+
value.type !== 'dashed-ident' &&
|
|
30
|
+
(value.type !== 'token' || value.value.type !== 'ident'),
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
throw new Error('Invalid view-transition descriptor.')
|
|
34
|
+
|
|
35
|
+
const names = values.map((value) =>
|
|
36
|
+
value.type === 'dashed-ident'
|
|
37
|
+
? value.value
|
|
38
|
+
: value.type === 'token' && value.value.type === 'ident'
|
|
39
|
+
? value.value.value
|
|
40
|
+
: '',
|
|
41
|
+
)
|
|
42
|
+
const key = name.value.value.toLowerCase()
|
|
43
|
+
if (key === 'navigation') {
|
|
44
|
+
if (
|
|
45
|
+
names.length !== 1 ||
|
|
46
|
+
!['auto', 'none'].includes(names[0]!.toLowerCase())
|
|
47
|
+
)
|
|
48
|
+
throw new Error('Invalid view-transition navigation.')
|
|
49
|
+
} else if (key === 'types') {
|
|
50
|
+
if (
|
|
51
|
+
names.some(
|
|
52
|
+
(name) =>
|
|
53
|
+
[
|
|
54
|
+
'default',
|
|
55
|
+
'inherit',
|
|
56
|
+
'initial',
|
|
57
|
+
'revert',
|
|
58
|
+
'revert-layer',
|
|
59
|
+
'unset',
|
|
60
|
+
].includes(name.toLowerCase()) ||
|
|
61
|
+
(name.toLowerCase() === 'none' && names.length !== 1),
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
throw new Error('Invalid view-transition types.')
|
|
65
|
+
} else throw new Error('Unknown view-transition descriptor.')
|
|
66
|
+
declaration = []
|
|
67
|
+
}
|
|
68
|
+
for (const token of rule.value.block) {
|
|
69
|
+
if (
|
|
70
|
+
token.type === 'token' &&
|
|
71
|
+
['white-space', 'comment'].includes(token.value.type)
|
|
72
|
+
)
|
|
73
|
+
continue
|
|
74
|
+
if (token.type === 'token' && token.value.type === 'semicolon')
|
|
75
|
+
flush()
|
|
76
|
+
else declaration.push(token)
|
|
77
|
+
}
|
|
78
|
+
flush()
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
}
|
package/src/cx.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** Declares ordered props composition for ahead-of-time resolution. @module */
|
|
2
|
+
import type { style } from './styleFunction.js'
|
|
3
|
+
import * as Authoring from './internal/Authoring.js'
|
|
4
|
+
import * as Html from './runtime/CompositionHtml.js'
|
|
5
|
+
import * as Identity from './internal/Identity.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Combines applied styles in argument order, preserving CSS importance and conditions.
|
|
9
|
+
* Static applications fold to props; runtime applications select precompiled presence groups and merge bindings.
|
|
10
|
+
* @param entries - Applied styling props or omitted conditional entries.
|
|
11
|
+
* @returns One spreadable props object.
|
|
12
|
+
*/
|
|
13
|
+
export function cx<
|
|
14
|
+
const entries extends readonly (
|
|
15
|
+
| style.Props<style.Output>
|
|
16
|
+
| false
|
|
17
|
+
| null
|
|
18
|
+
| undefined
|
|
19
|
+
)[],
|
|
20
|
+
>(
|
|
21
|
+
...entries: entries &
|
|
22
|
+
(Extract<entries[number], { class: string }> extends never
|
|
23
|
+
? unknown
|
|
24
|
+
: Extract<entries[number], { className: string }> extends never
|
|
25
|
+
? unknown
|
|
26
|
+
: never) & {
|
|
27
|
+
readonly [index in keyof entries]: entries[index] extends object
|
|
28
|
+
? Record<
|
|
29
|
+
Exclude<
|
|
30
|
+
keyof entries[index],
|
|
31
|
+
'class' | 'className' | 'style' | `data-${string}`
|
|
32
|
+
>,
|
|
33
|
+
never
|
|
34
|
+
>
|
|
35
|
+
: unknown
|
|
36
|
+
}
|
|
37
|
+
): Extract<entries[number], { class: string }> extends never
|
|
38
|
+
? style.Props
|
|
39
|
+
: style.Props<'html'> {
|
|
40
|
+
const selected = entries.filter(
|
|
41
|
+
(entry) => !!entry,
|
|
42
|
+
) as readonly (style.Props & {
|
|
43
|
+
readonly [Authoring.metadata]?: readonly Authoring.Owner[]
|
|
44
|
+
})[]
|
|
45
|
+
const html = selected.some((entry) => 'class' in entry)
|
|
46
|
+
const owners = selected.flatMap((entry) => entry[Authoring.metadata] ?? [])
|
|
47
|
+
const names = owners.map((owner) => owner.name)
|
|
48
|
+
const result: Record<string, unknown> = {}
|
|
49
|
+
const style: Record<string, string | number | undefined> = {}
|
|
50
|
+
const external: string[] = []
|
|
51
|
+
const previous = new Map<string, Authoring.Owner>()
|
|
52
|
+
for (const source of selected) {
|
|
53
|
+
const entry = html
|
|
54
|
+
? (source as unknown as Record<symbol, style.Props>)[
|
|
55
|
+
Symbol.for('zyzz.composition.input.v1')
|
|
56
|
+
]!
|
|
57
|
+
: source
|
|
58
|
+
const owned = source[Authoring.metadata] ?? []
|
|
59
|
+
for (const owner of owned) {
|
|
60
|
+
for (const attribute of owner.attributes) delete result[attribute]
|
|
61
|
+
for (const slot of previous.get(owner.name)?.slots ?? [])
|
|
62
|
+
delete style[slot]
|
|
63
|
+
for (const slot of owner.slots) delete style[slot]
|
|
64
|
+
previous.set(owner.name, owner)
|
|
65
|
+
}
|
|
66
|
+
for (const name of entry.className.split(/\s+/))
|
|
67
|
+
if (
|
|
68
|
+
name &&
|
|
69
|
+
!owned.some((owner) => owner.name === name) &&
|
|
70
|
+
!name.startsWith('z-compose-')
|
|
71
|
+
)
|
|
72
|
+
external.push(name)
|
|
73
|
+
for (const [key, value] of Object.entries(entry))
|
|
74
|
+
if (key.startsWith('data-')) result[key] = value
|
|
75
|
+
for (const [key, value] of Object.entries(entry.style ?? {})) {
|
|
76
|
+
delete style[key]
|
|
77
|
+
style[key] = value
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const className = [
|
|
81
|
+
Identity.composition(names),
|
|
82
|
+
...new Set(names.filter((name) => name.startsWith('z-style-id-'))),
|
|
83
|
+
...external,
|
|
84
|
+
]
|
|
85
|
+
.filter(Boolean)
|
|
86
|
+
.join(' ')
|
|
87
|
+
const props = {
|
|
88
|
+
...result,
|
|
89
|
+
className,
|
|
90
|
+
...(Object.keys(style).length ? { style } : {}),
|
|
91
|
+
}
|
|
92
|
+
return Authoring.bind(html ? Html.from(props) : props, owners) as Extract<
|
|
93
|
+
entries[number],
|
|
94
|
+
{ class: string }
|
|
95
|
+
> extends never
|
|
96
|
+
? style.Props
|
|
97
|
+
: style.Props<'html'>
|
|
98
|
+
}
|