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,846 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializes validated theme authoring data for independently compiled libraries.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import type * as Binding from '../../internal/Binding.js'
|
|
6
|
+
import * as Config from '../../Config.js'
|
|
7
|
+
import * as Configurations from './Configurations.js'
|
|
8
|
+
import * as FunctionSyntax from '../../internal/FunctionSyntax.js'
|
|
9
|
+
import * as Identifiers from './Identifiers.js'
|
|
10
|
+
import * as PackedStyles from './PackedStyles.js'
|
|
11
|
+
import * as Shorthands from '../../internal/Shorthands.js'
|
|
12
|
+
import * as Stylesheets from './Stylesheets.js'
|
|
13
|
+
import * as Theme from '../../Theme.js'
|
|
14
|
+
import type * as Themes from './Themes.js'
|
|
15
|
+
import * as Token from '../../internal/Token.js'
|
|
16
|
+
|
|
17
|
+
/** Reads versioned JSON as validated data; never evaluates package code. */
|
|
18
|
+
export function read(
|
|
19
|
+
source: string,
|
|
20
|
+
identities: Map<string, Token.Contract>,
|
|
21
|
+
moduleId = '',
|
|
22
|
+
) {
|
|
23
|
+
const data = record(JSON.parse(source))
|
|
24
|
+
if (
|
|
25
|
+
![
|
|
26
|
+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
27
|
+
22, 23,
|
|
28
|
+
].includes(data.version as number)
|
|
29
|
+
)
|
|
30
|
+
throw new Error('Unsupported Zyzz contract version.')
|
|
31
|
+
|
|
32
|
+
// Root controls arrived with version 18; older readers must treat them as absent.
|
|
33
|
+
const rootControls = (data.version as number) >= 18
|
|
34
|
+
const legacyModes = new Map<string, 'atomic' | 'grouped'>()
|
|
35
|
+
if ((data.version as number) < 17) {
|
|
36
|
+
function collect(value: unknown) {
|
|
37
|
+
const entry = record(value)
|
|
38
|
+
if (entry.options !== undefined && entry.theme !== undefined) {
|
|
39
|
+
const options = record(entry.options)
|
|
40
|
+
if (options.cssOutput !== undefined) {
|
|
41
|
+
if (options.cssOutput !== 'atomic' && options.cssOutput !== 'grouped')
|
|
42
|
+
throw new Error('Invalid packed CSS output mode.')
|
|
43
|
+
const theme = record(record(data.themes)[string(entry.theme)])
|
|
44
|
+
const identity = string(theme.identity)
|
|
45
|
+
const previous = legacyModes.get(identity)
|
|
46
|
+
if (previous !== undefined && previous !== options.cssOutput)
|
|
47
|
+
throw new Error(
|
|
48
|
+
'Conflicting packed CSS output modes for one theme identity.',
|
|
49
|
+
)
|
|
50
|
+
legacyModes.set(identity, options.cssOutput)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (const member of Object.values(record(entry.members ?? {})))
|
|
54
|
+
collect(member)
|
|
55
|
+
}
|
|
56
|
+
for (const entry of Object.values(record(data.exports))) collect(entry)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const themes: Record<string, Theme.Definition> = Object.create(null)
|
|
60
|
+
const types: Record<string, string> = Object.create(null)
|
|
61
|
+
|
|
62
|
+
for (const [name, value] of Object.entries(record(data.themes))) {
|
|
63
|
+
const entry = record(value)
|
|
64
|
+
const identity = string(entry.identity)
|
|
65
|
+
if (
|
|
66
|
+
entry.cssOutput !== undefined &&
|
|
67
|
+
entry.cssOutput !== 'atomic' &&
|
|
68
|
+
entry.cssOutput !== 'grouped'
|
|
69
|
+
)
|
|
70
|
+
throw new Error('Invalid packed CSS output mode.')
|
|
71
|
+
const cssOutput = (entry.cssOutput ?? legacyModes.get(identity)) as
|
|
72
|
+
| 'atomic'
|
|
73
|
+
| 'grouped'
|
|
74
|
+
| undefined
|
|
75
|
+
|
|
76
|
+
const shorthands =
|
|
77
|
+
entry.shorthands !== undefined
|
|
78
|
+
? Shorthands.read(entry.shorthands)
|
|
79
|
+
: undefined
|
|
80
|
+
let contract = identities.get(identity)
|
|
81
|
+
if (
|
|
82
|
+
contract &&
|
|
83
|
+
Shorthands.signature(contract.shorthands) !==
|
|
84
|
+
Shorthands.signature(shorthands)
|
|
85
|
+
)
|
|
86
|
+
throw new Error(
|
|
87
|
+
'Conflicting packed shorthand mappings for one theme identity.',
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if (
|
|
91
|
+
contract &&
|
|
92
|
+
(contract.cssOutput ?? 'atomic') !== (cssOutput ?? 'atomic')
|
|
93
|
+
)
|
|
94
|
+
throw new Error(
|
|
95
|
+
'Conflicting packed CSS output modes for one theme identity.',
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
if (!contract) {
|
|
99
|
+
contract = Object.freeze({
|
|
100
|
+
...(entry.shorthands !== undefined
|
|
101
|
+
? { shorthands: Shorthands.read(entry.shorthands) }
|
|
102
|
+
: {}),
|
|
103
|
+
...(cssOutput ? { cssOutput } : {}),
|
|
104
|
+
[Token.complete]: true,
|
|
105
|
+
[Token.identity]: identity,
|
|
106
|
+
})
|
|
107
|
+
identities.set(identity, contract)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const definition = Theme.define(record(entry.tokens) as Theme.Tokens)
|
|
111
|
+
|
|
112
|
+
themes[name] = Token.bind(definition, contract)
|
|
113
|
+
types[name] = type(input(definition))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function link(value: unknown): Themes.Link {
|
|
117
|
+
const raw = record(value)
|
|
118
|
+
// Contracts before version 19 record style authoring exports as `css`.
|
|
119
|
+
const entry =
|
|
120
|
+
raw.kind === 'css' && (data.version as number) < 19
|
|
121
|
+
? { ...raw, kind: 'style' }
|
|
122
|
+
: raw
|
|
123
|
+
|
|
124
|
+
if (entry.kind === 'variables') {
|
|
125
|
+
if ((data.version as number) < 14)
|
|
126
|
+
throw new Error(
|
|
127
|
+
'Legacy variable contracts require recompilation with variable().',
|
|
128
|
+
)
|
|
129
|
+
const names = new Set<string>()
|
|
130
|
+
|
|
131
|
+
const slots = Object.fromEntries(
|
|
132
|
+
Object.entries(record(entry.variables)).map(([key, value]) => {
|
|
133
|
+
const slot = record(value)
|
|
134
|
+
if (
|
|
135
|
+
key === 'set' ||
|
|
136
|
+
key === '__proto__' ||
|
|
137
|
+
names.has(string(slot.name)) ||
|
|
138
|
+
!/^--z-v[a-z0-9-]+$/.test(string(slot.name)) ||
|
|
139
|
+
![
|
|
140
|
+
'*',
|
|
141
|
+
'color',
|
|
142
|
+
'length',
|
|
143
|
+
'number',
|
|
144
|
+
'percentage',
|
|
145
|
+
'signedLength',
|
|
146
|
+
'signedPercentage',
|
|
147
|
+
].includes(String(slot.type))
|
|
148
|
+
)
|
|
149
|
+
throw new Error('Invalid packed variable contract.')
|
|
150
|
+
|
|
151
|
+
names.add(string(slot.name))
|
|
152
|
+
|
|
153
|
+
return [
|
|
154
|
+
key,
|
|
155
|
+
Object.freeze({
|
|
156
|
+
name: slot.name as `--${string}`,
|
|
157
|
+
type: slot.type as Binding.Domain,
|
|
158
|
+
variable: true as const,
|
|
159
|
+
}),
|
|
160
|
+
]
|
|
161
|
+
}),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const binding = string(entry.binding)
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
binding,
|
|
168
|
+
kind: 'variables',
|
|
169
|
+
...(entry.members
|
|
170
|
+
? {
|
|
171
|
+
members: Object.fromEntries(
|
|
172
|
+
Object.entries(record(entry.members)).map(([name, value]) => [
|
|
173
|
+
name,
|
|
174
|
+
link(value),
|
|
175
|
+
]),
|
|
176
|
+
),
|
|
177
|
+
}
|
|
178
|
+
: {}),
|
|
179
|
+
definition: Theme.define({}),
|
|
180
|
+
call: {
|
|
181
|
+
start: -1,
|
|
182
|
+
end: -1,
|
|
183
|
+
name: binding,
|
|
184
|
+
tokenType: '{}',
|
|
185
|
+
variables: Object.freeze(slots),
|
|
186
|
+
...(entry.source !== undefined
|
|
187
|
+
? {
|
|
188
|
+
variableOwner: Stylesheets.resolve(
|
|
189
|
+
moduleId,
|
|
190
|
+
string(entry.source),
|
|
191
|
+
),
|
|
192
|
+
}
|
|
193
|
+
: {}),
|
|
194
|
+
},
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (entry.kind === 'rule-reference') {
|
|
198
|
+
const name = string(entry.name)
|
|
199
|
+
const reference = string(entry.reference)
|
|
200
|
+
if (
|
|
201
|
+
![9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23].includes(
|
|
202
|
+
data.version as number,
|
|
203
|
+
) ||
|
|
204
|
+
![
|
|
205
|
+
'cssFunction',
|
|
206
|
+
'customMedia',
|
|
207
|
+
'colorProfile',
|
|
208
|
+
'counterStyle',
|
|
209
|
+
'fontPaletteValues',
|
|
210
|
+
'positionTry',
|
|
211
|
+
].includes(reference) ||
|
|
212
|
+
!/^(?:--)?z-[a-z0-9-]+$/.test(name) ||
|
|
213
|
+
!name.startsWith(
|
|
214
|
+
`${reference === 'counterStyle' ? '' : '--'}z-${reference.toLowerCase()}`,
|
|
215
|
+
) ||
|
|
216
|
+
entry.binding !== name
|
|
217
|
+
)
|
|
218
|
+
throw new Error('Invalid named stylesheet identity.')
|
|
219
|
+
return {
|
|
220
|
+
binding: string(entry.binding),
|
|
221
|
+
kind: 'rule-reference',
|
|
222
|
+
definition: Theme.define({}),
|
|
223
|
+
call: {
|
|
224
|
+
start: -1,
|
|
225
|
+
end: -1,
|
|
226
|
+
name,
|
|
227
|
+
tokenType: '{}',
|
|
228
|
+
reference: reference as NonNullable<Themes.Call['reference']>,
|
|
229
|
+
...(reference === 'cssFunction'
|
|
230
|
+
? { function: signature(entry.function, data.version as number) }
|
|
231
|
+
: {}),
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (entry.kind === 'animation') {
|
|
237
|
+
const name = string(entry.name)
|
|
238
|
+
if (!/^z-k[a-z0-9-]+$/.test(name))
|
|
239
|
+
throw new Error('Invalid animation identity.')
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
binding: string(entry.binding),
|
|
243
|
+
kind: 'animation',
|
|
244
|
+
definition: Theme.define({}),
|
|
245
|
+
call: { start: -1, end: -1, name, tokenType: '{}' },
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (entry.kind === 'style-reference') {
|
|
250
|
+
if (
|
|
251
|
+
entry.style !== undefined &&
|
|
252
|
+
![16, 17, 18, 19, 20, 21, 22, 23].includes(data.version as number)
|
|
253
|
+
)
|
|
254
|
+
throw new Error(
|
|
255
|
+
'Packed callable styles require contract version 16 or later.',
|
|
256
|
+
)
|
|
257
|
+
const binding = string(entry.binding)
|
|
258
|
+
if (!/^z-style-[a-z0-9_-]+$/.test(binding))
|
|
259
|
+
throw new Error('Invalid style reference identity.')
|
|
260
|
+
const members =
|
|
261
|
+
entry.members === undefined
|
|
262
|
+
? undefined
|
|
263
|
+
: Object.fromEntries(
|
|
264
|
+
Object.entries(record(entry.members)).map(([key, value]) => {
|
|
265
|
+
const member = link(value)
|
|
266
|
+
if (
|
|
267
|
+
member.kind !== 'style-reference' ||
|
|
268
|
+
(member.members && (data.version as number) < 22)
|
|
269
|
+
)
|
|
270
|
+
throw new Error('Invalid style reference member.')
|
|
271
|
+
return [key, member]
|
|
272
|
+
}),
|
|
273
|
+
)
|
|
274
|
+
return {
|
|
275
|
+
binding,
|
|
276
|
+
call: {
|
|
277
|
+
start: -1,
|
|
278
|
+
end: -1,
|
|
279
|
+
name: members ? '' : binding,
|
|
280
|
+
tokenType: '{}',
|
|
281
|
+
},
|
|
282
|
+
definition: Theme.define({}),
|
|
283
|
+
kind: 'style-reference',
|
|
284
|
+
...(entry.style === undefined
|
|
285
|
+
? {}
|
|
286
|
+
: {
|
|
287
|
+
style: PackedStyles.read(
|
|
288
|
+
entry.style,
|
|
289
|
+
themes,
|
|
290
|
+
data.version as number,
|
|
291
|
+
),
|
|
292
|
+
}),
|
|
293
|
+
...(members ? { members } : {}),
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (entry.output !== undefined && entry.output !== 'html')
|
|
298
|
+
throw new Error('Invalid theme output.')
|
|
299
|
+
|
|
300
|
+
if (
|
|
301
|
+
entry.recipe !== undefined &&
|
|
302
|
+
(entry.recipe !== true ||
|
|
303
|
+
(data.version as number) < 15 ||
|
|
304
|
+
entry.kind !== 'style')
|
|
305
|
+
)
|
|
306
|
+
throw new Error('Invalid bound recipe contract.')
|
|
307
|
+
|
|
308
|
+
const theme = string(entry.theme)
|
|
309
|
+
const definition = themes[theme]
|
|
310
|
+
if (
|
|
311
|
+
!definition ||
|
|
312
|
+
!['config', 'style', 'theme'].includes(String(entry.kind))
|
|
313
|
+
)
|
|
314
|
+
throw new Error('Invalid Zyzz contract export.')
|
|
315
|
+
|
|
316
|
+
const members =
|
|
317
|
+
entry.kind === 'config'
|
|
318
|
+
? Object.fromEntries(
|
|
319
|
+
Object.entries(record(entry.members)).map(([key, value]) => [
|
|
320
|
+
key,
|
|
321
|
+
link(value),
|
|
322
|
+
]),
|
|
323
|
+
)
|
|
324
|
+
: undefined
|
|
325
|
+
|
|
326
|
+
const options =
|
|
327
|
+
entry.options === undefined ? undefined : record(entry.options)
|
|
328
|
+
|
|
329
|
+
if (options) {
|
|
330
|
+
Config.create(options as Config.create.Options)
|
|
331
|
+
if (
|
|
332
|
+
(data.version as number) >= 17 &&
|
|
333
|
+
(options.cssOutput ?? 'atomic') !==
|
|
334
|
+
(definition[Token.definition].contract.cssOutput ?? 'atomic')
|
|
335
|
+
)
|
|
336
|
+
throw new Error(
|
|
337
|
+
'Configuration CSS output disagrees with linked theme metadata.',
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
if (
|
|
341
|
+
Shorthands.signature(options.shorthands) !==
|
|
342
|
+
Shorthands.signature(definition[Token.definition].contract.shorthands)
|
|
343
|
+
)
|
|
344
|
+
throw new Error(
|
|
345
|
+
'Configuration mappings disagree with linked theme metadata.',
|
|
346
|
+
)
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const catalogOnly =
|
|
350
|
+
!!options?.themes &&
|
|
351
|
+
((data.version as number) < 4 || entry.catalogOnly === true)
|
|
352
|
+
const fullConfigType = options
|
|
353
|
+
? `import('zyzz').Config.create.ReturnType<${Configurations.type(options)}>`
|
|
354
|
+
: ''
|
|
355
|
+
// Helpers a legacy library did not compile are hidden from its consumers' types.
|
|
356
|
+
const hidden = [
|
|
357
|
+
...(rootControls && entry.appearance === true ? [] : ["'appearance'"]),
|
|
358
|
+
...(entry.script === true ? [] : ["'script'"]),
|
|
359
|
+
]
|
|
360
|
+
const configType = hidden.length
|
|
361
|
+
? `{readonly [key in keyof ${fullConfigType} as key extends ${hidden.join(' | ')} ? never : key]:${fullConfigType}[key]}`
|
|
362
|
+
: fullConfigType
|
|
363
|
+
const outputType = catalogOnly
|
|
364
|
+
? `({readonly [key in keyof ${configType} as key extends 'themes' ? never : key]:${configType}[key]} & {readonly themes:{readonly [key in keyof ${configType}['themes']]:${configType}['themes'][key]}})`
|
|
365
|
+
: configType
|
|
366
|
+
if (entry.kind === 'config' && !options)
|
|
367
|
+
throw new Error('Missing configuration options.')
|
|
368
|
+
|
|
369
|
+
return {
|
|
370
|
+
binding: string(entry.binding),
|
|
371
|
+
call: {
|
|
372
|
+
...(entry.recipe === true ? { recipe: true } : {}),
|
|
373
|
+
...(entry.output === 'html' ? { output: 'html' as const } : {}),
|
|
374
|
+
...(catalogOnly ? { catalogOnly: true } : {}),
|
|
375
|
+
...(entry.script === true ? { script: true } : {}),
|
|
376
|
+
...(rootControls && entry.appearance === true
|
|
377
|
+
? { appearance: true }
|
|
378
|
+
: {}),
|
|
379
|
+
...(rootControls && entry.root === true ? { root: true } : {}),
|
|
380
|
+
end: -1,
|
|
381
|
+
name: theme,
|
|
382
|
+
start: -1,
|
|
383
|
+
tokenType: types[theme]!,
|
|
384
|
+
...(definition[Token.definition].contract.shorthands ||
|
|
385
|
+
entry.output === 'html'
|
|
386
|
+
? {
|
|
387
|
+
type: `import('zyzz').Config.create.ReturnType<{theme:${types[theme]!};${entry.output === 'html' ? "output:'html';" : ''}shorthands:${Configurations.type(definition[Token.definition].contract.shorthands ?? {})}}>['theme']`,
|
|
388
|
+
}
|
|
389
|
+
: {}),
|
|
390
|
+
...(entry.selection === true ? { selection: true } : {}),
|
|
391
|
+
...(entry.initialization === true ? { initialization: true } : {}),
|
|
392
|
+
...(options
|
|
393
|
+
? {
|
|
394
|
+
options,
|
|
395
|
+
type: `${outputType}${entry.initialization === true ? "['script']" : entry.root === true ? "['appearance']" : entry.selection === true ? "['themes']" : ''}`,
|
|
396
|
+
}
|
|
397
|
+
: {}),
|
|
398
|
+
...(members
|
|
399
|
+
? {
|
|
400
|
+
members: Object.fromEntries(
|
|
401
|
+
Object.entries(members).map(([key, member]) => [
|
|
402
|
+
key,
|
|
403
|
+
member.call.name,
|
|
404
|
+
]),
|
|
405
|
+
),
|
|
406
|
+
}
|
|
407
|
+
: {}),
|
|
408
|
+
},
|
|
409
|
+
definition,
|
|
410
|
+
kind: entry.kind as Themes.Link['kind'],
|
|
411
|
+
...(members ? { members } : {}),
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const links = Object.fromEntries(
|
|
416
|
+
Object.entries(record(data.exports)).map(([name, value]) => [
|
|
417
|
+
name,
|
|
418
|
+
link(value),
|
|
419
|
+
]),
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
return { links, themes, stylesheets: Stylesheets.read(data.stylesheets) }
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function record(value: unknown): Record<string, unknown> {
|
|
426
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
427
|
+
throw new Error('Expected a Zyzz contract record.')
|
|
428
|
+
|
|
429
|
+
return value as Record<string, unknown>
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function string(value: unknown): string {
|
|
433
|
+
if (typeof value !== 'string' || !value)
|
|
434
|
+
throw new Error('Expected a nonempty Zyzz contract identity.')
|
|
435
|
+
|
|
436
|
+
return value
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function input(theme: Theme.Definition) {
|
|
440
|
+
return { ...tokens(theme.tokens), ...theme[Token.definition].queries }
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function tokens(tree: Theme.References<Theme.Tokens>): Record<string, unknown> {
|
|
444
|
+
return Object.fromEntries(
|
|
445
|
+
Object.entries(tree).map(([name, value]) => [
|
|
446
|
+
name,
|
|
447
|
+
Token.is(value)
|
|
448
|
+
? value.value
|
|
449
|
+
: tokens(value as Theme.References<Theme.Tokens>),
|
|
450
|
+
]),
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
function type(value: unknown): string {
|
|
455
|
+
if (Array.isArray(value)) return `readonly [${value.map(type).join(',')}]`
|
|
456
|
+
if (!value || typeof value !== 'object') return JSON.stringify(value)
|
|
457
|
+
|
|
458
|
+
return `{${Object.entries(value)
|
|
459
|
+
.map(([key, value]) => `readonly ${JSON.stringify(key)}:${type(value)}`)
|
|
460
|
+
.join(';')}}`
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/** Emits compiler-only metadata without adding it to the runtime module. */
|
|
464
|
+
export function write(
|
|
465
|
+
links: Readonly<Record<string, Themes.Link>>,
|
|
466
|
+
themes: Readonly<Record<string, Theme.Definition>>,
|
|
467
|
+
stylesheets: readonly Stylesheets.Section[] = [],
|
|
468
|
+
moduleId = '',
|
|
469
|
+
configurations: readonly write.Configuration[] = [],
|
|
470
|
+
): string {
|
|
471
|
+
function entry(link: Themes.Link): Record<string, unknown> {
|
|
472
|
+
if (link.kind === 'variables')
|
|
473
|
+
return {
|
|
474
|
+
binding: link.binding,
|
|
475
|
+
kind: link.kind,
|
|
476
|
+
variables: link.call.variables,
|
|
477
|
+
...(link.members
|
|
478
|
+
? {
|
|
479
|
+
members: Object.fromEntries(
|
|
480
|
+
Object.entries(link.members).map(([name, member]) => [
|
|
481
|
+
name,
|
|
482
|
+
entry(member),
|
|
483
|
+
]),
|
|
484
|
+
),
|
|
485
|
+
}
|
|
486
|
+
: {}),
|
|
487
|
+
...(link.call.variableOwner
|
|
488
|
+
? { source: Stylesheets.relative(moduleId, link.call.variableOwner) }
|
|
489
|
+
: {}),
|
|
490
|
+
}
|
|
491
|
+
if (link.kind === 'rule-reference')
|
|
492
|
+
return {
|
|
493
|
+
binding: link.binding,
|
|
494
|
+
kind: link.kind,
|
|
495
|
+
name: link.call.name,
|
|
496
|
+
reference: link.call.reference,
|
|
497
|
+
...(link.call.function ? { function: link.call.function } : {}),
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (link.kind === 'animation')
|
|
501
|
+
return { binding: link.binding, kind: link.kind, name: link.call.name }
|
|
502
|
+
|
|
503
|
+
if (link.kind === 'style-reference')
|
|
504
|
+
return {
|
|
505
|
+
binding: link.binding,
|
|
506
|
+
kind: link.kind,
|
|
507
|
+
...(link.style ? { style: PackedStyles.write(link.style) } : {}),
|
|
508
|
+
...(link.members
|
|
509
|
+
? {
|
|
510
|
+
members: Object.fromEntries(
|
|
511
|
+
Object.entries(link.members).map(([name, value]) => [
|
|
512
|
+
name,
|
|
513
|
+
entry(value),
|
|
514
|
+
]),
|
|
515
|
+
),
|
|
516
|
+
}
|
|
517
|
+
: {}),
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
return {
|
|
521
|
+
...(link.call.recipe ? { recipe: true } : {}),
|
|
522
|
+
...(link.call.output ? { output: link.call.output } : {}),
|
|
523
|
+
...(link.call.script &&
|
|
524
|
+
(link.kind === 'config' || link.call.initialization)
|
|
525
|
+
? { script: true }
|
|
526
|
+
: {}),
|
|
527
|
+
...(link.call.appearance && (link.kind === 'config' || link.call.root)
|
|
528
|
+
? { appearance: true }
|
|
529
|
+
: {}),
|
|
530
|
+
binding: link.binding,
|
|
531
|
+
kind: link.kind,
|
|
532
|
+
theme: link.call.name,
|
|
533
|
+
...(link.call.catalogOnly ? { catalogOnly: true } : {}),
|
|
534
|
+
...(link.call.selection ? { selection: true } : {}),
|
|
535
|
+
...(link.call.initialization ? { initialization: true } : {}),
|
|
536
|
+
...(link.call.root ? { root: true } : {}),
|
|
537
|
+
...(link.call.options ? { options: link.call.options } : {}),
|
|
538
|
+
...(link.members
|
|
539
|
+
? {
|
|
540
|
+
members: Object.fromEntries(
|
|
541
|
+
Object.entries(link.members).map(([key, link]) => [
|
|
542
|
+
key,
|
|
543
|
+
entry(link),
|
|
544
|
+
]),
|
|
545
|
+
),
|
|
546
|
+
}
|
|
547
|
+
: {}),
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return JSON.stringify({
|
|
552
|
+
...(stylesheets.length
|
|
553
|
+
? { stylesheets: Stylesheets.write(stylesheets) }
|
|
554
|
+
: {}),
|
|
555
|
+
// Local configurations publish their catalogs so documents restore
|
|
556
|
+
// selections for modules that export styles but not the configuration.
|
|
557
|
+
...(configurations.length ? { configurations } : {}),
|
|
558
|
+
exports: Object.fromEntries(
|
|
559
|
+
Object.entries(links).map(([name, link]) => [name, entry(link)]),
|
|
560
|
+
),
|
|
561
|
+
themes: Object.fromEntries(
|
|
562
|
+
Object.entries(themes).map(([name, theme]) => [
|
|
563
|
+
name,
|
|
564
|
+
{
|
|
565
|
+
...(theme[Token.definition].contract.shorthands
|
|
566
|
+
? { shorthands: theme[Token.definition].contract.shorthands }
|
|
567
|
+
: {}),
|
|
568
|
+
...(theme[Token.definition].contract.cssOutput
|
|
569
|
+
? { cssOutput: theme[Token.definition].contract.cssOutput }
|
|
570
|
+
: {}),
|
|
571
|
+
identity: theme[Token.definition].contract[Token.identity],
|
|
572
|
+
tokens: input(theme),
|
|
573
|
+
},
|
|
574
|
+
]),
|
|
575
|
+
),
|
|
576
|
+
version: (() => {
|
|
577
|
+
function callable(link: Themes.Link): boolean {
|
|
578
|
+
return !!link.style || Object.values(link.members ?? {}).some(callable)
|
|
579
|
+
}
|
|
580
|
+
function styled(link: Themes.Link): boolean {
|
|
581
|
+
return (
|
|
582
|
+
link.kind === 'style' ||
|
|
583
|
+
Object.values(link.members ?? {}).some(styled)
|
|
584
|
+
)
|
|
585
|
+
}
|
|
586
|
+
function branches(style: import('../../Style.js').NamedStyle): boolean {
|
|
587
|
+
return (
|
|
588
|
+
!!style.targets || !!style.rules?.some((rule) => branches(rule.style))
|
|
589
|
+
)
|
|
590
|
+
}
|
|
591
|
+
function targeted(link: Themes.Link): boolean {
|
|
592
|
+
return (
|
|
593
|
+
(link.style && branches(link.style.style)) ||
|
|
594
|
+
Object.values(link.members ?? {}).some(targeted)
|
|
595
|
+
)
|
|
596
|
+
}
|
|
597
|
+
function staticRecipe(link: Themes.Link): boolean {
|
|
598
|
+
return (
|
|
599
|
+
!!link.style?.staticRecipe ||
|
|
600
|
+
Object.values(link.members ?? {}).some(staticRecipe)
|
|
601
|
+
)
|
|
602
|
+
}
|
|
603
|
+
function nested(link: Themes.Link): boolean {
|
|
604
|
+
return Object.values(link.members ?? {}).some(
|
|
605
|
+
(member) =>
|
|
606
|
+
(link.kind === 'style-reference' && !!member.members) ||
|
|
607
|
+
nested(member),
|
|
608
|
+
)
|
|
609
|
+
}
|
|
610
|
+
function dynamic(link: Themes.Link): boolean {
|
|
611
|
+
return (
|
|
612
|
+
!!link.style?.dynamic ||
|
|
613
|
+
Object.values(link.members ?? {}).some(dynamic)
|
|
614
|
+
)
|
|
615
|
+
}
|
|
616
|
+
if (Object.values(links).some(dynamic)) return 23
|
|
617
|
+
if (Object.values(links).some(nested)) return 22
|
|
618
|
+
if (Object.values(links).some(staticRecipe)) return 21
|
|
619
|
+
if (Object.values(links).some(targeted)) return 20
|
|
620
|
+
// Style authoring exports serialize as `style`; older readers only know `css`.
|
|
621
|
+
if (Object.values(links).some(styled)) return 19
|
|
622
|
+
// Root controls call a runtime helper older releases lack, and older
|
|
623
|
+
// readers reject the storageKey option, so both require readers to opt in.
|
|
624
|
+
// Local configurations emit the same helper without an exported binding.
|
|
625
|
+
if (
|
|
626
|
+
configurations.length ||
|
|
627
|
+
Object.values(links).some(
|
|
628
|
+
(link) =>
|
|
629
|
+
(link.call.appearance &&
|
|
630
|
+
(link.kind === 'config' || link.call.root)) ||
|
|
631
|
+
link.call.options?.storageKey !== undefined,
|
|
632
|
+
)
|
|
633
|
+
)
|
|
634
|
+
return 18
|
|
635
|
+
if (
|
|
636
|
+
Object.values(links).some(callable) ||
|
|
637
|
+
Object.values(themes).some(
|
|
638
|
+
(theme) => theme[Token.definition].contract.cssOutput,
|
|
639
|
+
)
|
|
640
|
+
)
|
|
641
|
+
return 17
|
|
642
|
+
if (Object.values(links).some((link) => link.call.recipe)) return 15
|
|
643
|
+
if (Object.values(links).some((link) => link.kind === 'variables'))
|
|
644
|
+
return 14
|
|
645
|
+
if (Object.values(links).some((link) => link.kind === 'style-reference'))
|
|
646
|
+
return 13
|
|
647
|
+
|
|
648
|
+
if (
|
|
649
|
+
Object.values(links).some(
|
|
650
|
+
(link) => link.call.function && extended(link.call.function),
|
|
651
|
+
)
|
|
652
|
+
)
|
|
653
|
+
return 12
|
|
654
|
+
|
|
655
|
+
if (
|
|
656
|
+
stylesheets.some((section) => section.namespaces?.length) ||
|
|
657
|
+
Object.values(links).some(
|
|
658
|
+
(link) =>
|
|
659
|
+
link.call.function &&
|
|
660
|
+
[
|
|
661
|
+
link.call.function.returns,
|
|
662
|
+
...link.call.function.parameters.map(
|
|
663
|
+
(parameter) => parameter.syntax ?? '*',
|
|
664
|
+
),
|
|
665
|
+
].some(
|
|
666
|
+
(syntax) =>
|
|
667
|
+
// Version 10 readers accepted this fixed scalar subset.
|
|
668
|
+
!(
|
|
669
|
+
[
|
|
670
|
+
'*',
|
|
671
|
+
'<angle>',
|
|
672
|
+
'<color>',
|
|
673
|
+
'<integer>',
|
|
674
|
+
'<length>',
|
|
675
|
+
'<length-percentage>',
|
|
676
|
+
'<number>',
|
|
677
|
+
'<percentage>',
|
|
678
|
+
'<time>',
|
|
679
|
+
] as readonly string[]
|
|
680
|
+
).includes(syntax),
|
|
681
|
+
),
|
|
682
|
+
)
|
|
683
|
+
)
|
|
684
|
+
return 11
|
|
685
|
+
|
|
686
|
+
if (
|
|
687
|
+
Object.values(links).some(
|
|
688
|
+
(link) =>
|
|
689
|
+
link.call.reference === 'cssFunction' ||
|
|
690
|
+
link.call.reference === 'customMedia',
|
|
691
|
+
)
|
|
692
|
+
)
|
|
693
|
+
return 10
|
|
694
|
+
|
|
695
|
+
if (Object.values(links).some((link) => link.kind === 'rule-reference'))
|
|
696
|
+
return 9
|
|
697
|
+
|
|
698
|
+
if (Object.values(links).some((link) => link.kind === 'variables'))
|
|
699
|
+
return 8
|
|
700
|
+
|
|
701
|
+
if (
|
|
702
|
+
stylesheets.length ||
|
|
703
|
+
Object.values(links).some((link) => link.kind === 'animation')
|
|
704
|
+
)
|
|
705
|
+
return 7
|
|
706
|
+
|
|
707
|
+
if (
|
|
708
|
+
Object.values(themes).some(
|
|
709
|
+
(theme) =>
|
|
710
|
+
theme[Token.definition].contract.shorthands ||
|
|
711
|
+
Object.hasOwn(theme.tokens, 'margin') ||
|
|
712
|
+
Object.hasOwn(theme.tokens, 'padding'),
|
|
713
|
+
) ||
|
|
714
|
+
Object.values(links).some(
|
|
715
|
+
(link) =>
|
|
716
|
+
link.call.output === 'html' ||
|
|
717
|
+
Object.values(link.members ?? {}).some(
|
|
718
|
+
(member) => member.call.output === 'html',
|
|
719
|
+
),
|
|
720
|
+
)
|
|
721
|
+
)
|
|
722
|
+
return 5
|
|
723
|
+
|
|
724
|
+
if (
|
|
725
|
+
stylesheets.length ||
|
|
726
|
+
Object.values(links).some(
|
|
727
|
+
(link) =>
|
|
728
|
+
link.call.selection ||
|
|
729
|
+
(link.kind === 'config' && !!link.call.options?.themes) ||
|
|
730
|
+
link.call.initialization ||
|
|
731
|
+
(link.kind === 'config' && link.call.script) ||
|
|
732
|
+
link.kind === 'animation' ||
|
|
733
|
+
link.kind === 'variables',
|
|
734
|
+
)
|
|
735
|
+
)
|
|
736
|
+
return 4
|
|
737
|
+
|
|
738
|
+
if (
|
|
739
|
+
Object.values(themes).some(
|
|
740
|
+
(theme) =>
|
|
741
|
+
theme[Token.definition].queries ||
|
|
742
|
+
Object.keys(theme.tokens).some((group) =>
|
|
743
|
+
[
|
|
744
|
+
'fontFamily',
|
|
745
|
+
'fontSize',
|
|
746
|
+
'fontWeight',
|
|
747
|
+
'lineHeight',
|
|
748
|
+
'letterSpacing',
|
|
749
|
+
].includes(group),
|
|
750
|
+
),
|
|
751
|
+
)
|
|
752
|
+
)
|
|
753
|
+
return 3
|
|
754
|
+
|
|
755
|
+
if (
|
|
756
|
+
Object.values(links).some(
|
|
757
|
+
(link) => link.kind === 'config' || link.call.type,
|
|
758
|
+
)
|
|
759
|
+
)
|
|
760
|
+
return 2
|
|
761
|
+
|
|
762
|
+
return 1
|
|
763
|
+
})(),
|
|
764
|
+
})
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/** Contract writer contracts. */
|
|
768
|
+
export declare namespace write {
|
|
769
|
+
/** Catalog of one configuration call, published whether or not the call is exported. */
|
|
770
|
+
type Configuration = {
|
|
771
|
+
/** Configuration identity that prefixes every theme scope key. */
|
|
772
|
+
readonly identity: string
|
|
773
|
+
/** localStorage key the configuration's script and root controls share. */
|
|
774
|
+
readonly storageKey?: string | undefined
|
|
775
|
+
/** Named theme keys of the configuration's catalog. */
|
|
776
|
+
readonly themes: readonly string[]
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function signature(
|
|
781
|
+
input: unknown,
|
|
782
|
+
version: number,
|
|
783
|
+
): NonNullable<Themes.Call['function']> {
|
|
784
|
+
const value = record(input)
|
|
785
|
+
if (
|
|
786
|
+
!FunctionSyntax.accepts(string(value.returns)) ||
|
|
787
|
+
!Array.isArray(value.parameters)
|
|
788
|
+
)
|
|
789
|
+
throw new Error('Invalid packed CSS function signature.')
|
|
790
|
+
if (
|
|
791
|
+
version < 12 &&
|
|
792
|
+
(/[\\\u0080-\uffff]/.test(String(value.returns)) ||
|
|
793
|
+
value.parameters.some((input) => {
|
|
794
|
+
const parameter = record(input)
|
|
795
|
+
return /[\\\u0080-\uffff]/.test(
|
|
796
|
+
string(parameter.name) + string(parameter.syntax ?? '*'),
|
|
797
|
+
)
|
|
798
|
+
}))
|
|
799
|
+
)
|
|
800
|
+
throw new Error(
|
|
801
|
+
'Extended CSS function signatures require contract version 12.',
|
|
802
|
+
)
|
|
803
|
+
const names = new Set<string>()
|
|
804
|
+
const parameters = value.parameters.map((input: unknown) => {
|
|
805
|
+
const parameter = record(input)
|
|
806
|
+
const name = string(parameter.name)
|
|
807
|
+
if (
|
|
808
|
+
!Identifiers.read(name)?.startsWith('--') ||
|
|
809
|
+
Identifiers.read(name) === '--' ||
|
|
810
|
+
names.has(Identifiers.read(name)!) ||
|
|
811
|
+
(parameter.syntax !== undefined &&
|
|
812
|
+
!FunctionSyntax.accepts(string(parameter.syntax))) ||
|
|
813
|
+
(parameter.default !== undefined &&
|
|
814
|
+
typeof parameter.default !== 'number' &&
|
|
815
|
+
typeof parameter.default !== 'string')
|
|
816
|
+
)
|
|
817
|
+
throw new Error('Invalid packed CSS function parameter.')
|
|
818
|
+
names.add(Identifiers.read(name)!)
|
|
819
|
+
return {
|
|
820
|
+
name: name as `--${string}`,
|
|
821
|
+
...(parameter.syntax !== undefined
|
|
822
|
+
? {
|
|
823
|
+
syntax: parameter.syntax as NonNullable<
|
|
824
|
+
Themes.Call['function']
|
|
825
|
+
>['returns'],
|
|
826
|
+
}
|
|
827
|
+
: {}),
|
|
828
|
+
...(parameter.default !== undefined
|
|
829
|
+
? { default: parameter.default as string | number }
|
|
830
|
+
: {}),
|
|
831
|
+
}
|
|
832
|
+
})
|
|
833
|
+
return {
|
|
834
|
+
parameters,
|
|
835
|
+
returns: value.returns as NonNullable<Themes.Call['function']>['returns'],
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
function extended(signature: NonNullable<Themes.Call['function']>): boolean {
|
|
840
|
+
return (
|
|
841
|
+
/[\\\u0080-\uffff]/.test(signature.returns) ||
|
|
842
|
+
signature.parameters.some((parameter) =>
|
|
843
|
+
/[\\\u0080-\uffff]/.test(parameter.name + (parameter.syntax ?? '*')),
|
|
844
|
+
)
|
|
845
|
+
)
|
|
846
|
+
}
|