zyzz 0.0.2 → 0.0.5

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.
Files changed (252) hide show
  1. package/README.md +34 -19
  2. package/dist/Config.d.ts +16 -167
  3. package/dist/Config.d.ts.map +1 -1
  4. package/dist/Config.js +7 -246
  5. package/dist/Config.js.map +1 -1
  6. package/dist/Style.d.ts +19 -13
  7. package/dist/Style.d.ts.map +1 -1
  8. package/dist/Style.js +73 -7
  9. package/dist/Style.js.map +1 -1
  10. package/dist/Vars.d.ts +114 -0
  11. package/dist/Vars.d.ts.map +1 -0
  12. package/dist/Vars.js +42 -0
  13. package/dist/Vars.js.map +1 -0
  14. package/dist/compiler/Graph.js +11 -8
  15. package/dist/compiler/Graph.js.map +1 -1
  16. package/dist/compiler/Native.d.ts +5 -5
  17. package/dist/compiler/Native.d.ts.map +1 -1
  18. package/dist/compiler/Native.js +21 -21
  19. package/dist/compiler/Native.js.map +1 -1
  20. package/dist/compiler/Source.d.ts +10 -6
  21. package/dist/compiler/Source.d.ts.map +1 -1
  22. package/dist/compiler/Source.js +66 -11
  23. package/dist/compiler/Source.js.map +1 -1
  24. package/dist/compiler/Transform.d.ts +1 -1
  25. package/dist/compiler/Transform.d.ts.map +1 -1
  26. package/dist/compiler/Transform.js +59 -21
  27. package/dist/compiler/Transform.js.map +1 -1
  28. package/dist/compiler/internal/Compositions.d.ts +5 -0
  29. package/dist/compiler/internal/Compositions.d.ts.map +1 -1
  30. package/dist/compiler/internal/Compositions.js +22 -3
  31. package/dist/compiler/internal/Compositions.js.map +1 -1
  32. package/dist/compiler/internal/Configurations.d.ts.map +1 -1
  33. package/dist/compiler/internal/Configurations.js +73 -12
  34. package/dist/compiler/internal/Configurations.js.map +1 -1
  35. package/dist/compiler/internal/Contract.d.ts +1 -1
  36. package/dist/compiler/internal/Contract.d.ts.map +1 -1
  37. package/dist/compiler/internal/Contract.js +162 -13
  38. package/dist/compiler/internal/Contract.js.map +1 -1
  39. package/dist/compiler/internal/Contributions.js +1 -1
  40. package/dist/compiler/internal/Contributions.js.map +1 -1
  41. package/dist/compiler/internal/Dynamic.js +1 -1
  42. package/dist/compiler/internal/Dynamic.js.map +1 -1
  43. package/dist/compiler/internal/Expression.d.ts +3 -0
  44. package/dist/compiler/internal/Expression.d.ts.map +1 -1
  45. package/dist/compiler/internal/Expression.js +21 -0
  46. package/dist/compiler/internal/Expression.js.map +1 -1
  47. package/dist/compiler/internal/Identifiers.d.ts +1 -1
  48. package/dist/compiler/internal/Identifiers.d.ts.map +1 -1
  49. package/dist/compiler/internal/Identifiers.js +2 -2
  50. package/dist/compiler/internal/Identifiers.js.map +1 -1
  51. package/dist/compiler/internal/NativeBindings.d.ts +1 -1
  52. package/dist/compiler/internal/NativeBindings.d.ts.map +1 -1
  53. package/dist/compiler/internal/NativeBindings.js +3 -3
  54. package/dist/compiler/internal/NativeBindings.js.map +1 -1
  55. package/dist/compiler/internal/PackedStyles.d.ts +1 -1
  56. package/dist/compiler/internal/PackedStyles.d.ts.map +1 -1
  57. package/dist/compiler/internal/PackedStyles.js +15 -25
  58. package/dist/compiler/internal/PackedStyles.js.map +1 -1
  59. package/dist/compiler/internal/Recipes.js +1 -1
  60. package/dist/compiler/internal/Recipes.js.map +1 -1
  61. package/dist/compiler/internal/Selectors.js +1 -1
  62. package/dist/compiler/internal/Selectors.js.map +1 -1
  63. package/dist/compiler/internal/Themes.d.ts +12 -3
  64. package/dist/compiler/internal/Themes.d.ts.map +1 -1
  65. package/dist/compiler/internal/Themes.js +192 -52
  66. package/dist/compiler/internal/Themes.js.map +1 -1
  67. package/dist/compiler/internal/{Variables.d.ts → Vars.d.ts} +1 -1
  68. package/dist/compiler/internal/Vars.d.ts.map +1 -0
  69. package/dist/compiler/internal/{Variables.js → Vars.js} +3 -3
  70. package/dist/compiler/internal/Vars.js.map +1 -0
  71. package/dist/default.d.ts +451 -1649
  72. package/dist/default.d.ts.map +1 -1
  73. package/dist/default.js +389 -80
  74. package/dist/default.js.map +2 -2
  75. package/dist/default.js.zyzz.json +1 -1
  76. package/dist/esbuild/index.d.ts +3 -0
  77. package/dist/esbuild/index.d.ts.map +1 -0
  78. package/dist/esbuild/index.js +5 -0
  79. package/dist/esbuild/index.js.map +1 -0
  80. package/dist/index.d.ts +4 -4
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +4 -4
  83. package/dist/index.js.map +1 -1
  84. package/dist/internal/Authoring.d.ts +1 -1
  85. package/dist/internal/Authoring.d.ts.map +1 -1
  86. package/dist/internal/Authoring.js +4 -4
  87. package/dist/internal/Authoring.js.map +1 -1
  88. package/dist/internal/Binding.d.ts +1 -1
  89. package/dist/internal/Binding.d.ts.map +1 -1
  90. package/dist/internal/Completion.d.ts +19 -0
  91. package/dist/internal/Completion.d.ts.map +1 -0
  92. package/dist/internal/Completion.js +2 -0
  93. package/dist/internal/Completion.js.map +1 -0
  94. package/dist/internal/Condition.d.ts +3 -1
  95. package/dist/internal/Condition.d.ts.map +1 -1
  96. package/dist/internal/Condition.js.map +1 -1
  97. package/dist/internal/Configuration.d.ts +248 -0
  98. package/dist/internal/Configuration.d.ts.map +1 -0
  99. package/dist/internal/Configuration.js +343 -0
  100. package/dist/internal/Configuration.js.map +1 -0
  101. package/dist/internal/Shorthands.d.ts +1 -1
  102. package/dist/internal/Shorthands.d.ts.map +1 -1
  103. package/dist/internal/Shorthands.js +1 -0
  104. package/dist/internal/Shorthands.js.map +1 -1
  105. package/dist/{Theme.d.ts → internal/Theme.d.ts} +24 -19
  106. package/dist/internal/Theme.d.ts.map +1 -0
  107. package/dist/{Theme.js → internal/Theme.js} +57 -14
  108. package/dist/internal/Theme.js.map +1 -0
  109. package/dist/internal/Token.d.ts +46 -16
  110. package/dist/internal/Token.d.ts.map +1 -1
  111. package/dist/internal/Token.js +89 -5
  112. package/dist/internal/Token.js.map +1 -1
  113. package/dist/internal/Typography.d.ts +31 -0
  114. package/dist/internal/Typography.d.ts.map +1 -0
  115. package/dist/internal/Typography.js +54 -0
  116. package/dist/internal/Typography.js.map +1 -0
  117. package/dist/internal/Value.d.ts +6 -1
  118. package/dist/internal/Value.d.ts.map +1 -1
  119. package/dist/internal/Value.js.map +1 -1
  120. package/dist/internal/VariableSets.d.ts +20 -0
  121. package/dist/internal/VariableSets.d.ts.map +1 -0
  122. package/dist/internal/VariableSets.js +317 -0
  123. package/dist/internal/VariableSets.js.map +1 -0
  124. package/dist/next/loader.js +15 -5
  125. package/dist/next/loader.js.map +1 -1
  126. package/dist/node/Host.d.ts.map +1 -1
  127. package/dist/node/Host.js +1 -1
  128. package/dist/node/Host.js.map +1 -1
  129. package/dist/react-native/Host.d.ts +2 -2
  130. package/dist/react-native/Host.d.ts.map +1 -1
  131. package/dist/react-native/Host.js +4 -4
  132. package/dist/react-native/Host.js.map +1 -1
  133. package/dist/react-native/StyleSheet.d.ts +9 -8
  134. package/dist/react-native/StyleSheet.d.ts.map +1 -1
  135. package/dist/react-native/StyleSheet.js +29 -23
  136. package/dist/react-native/StyleSheet.js.map +1 -1
  137. package/dist/react-native/Variants.d.ts +3 -3
  138. package/dist/react-native/Variants.d.ts.map +1 -1
  139. package/dist/react-native/Variants.js +2 -2
  140. package/dist/react-native/react.d.ts +1 -1
  141. package/dist/react-native/react.d.ts.map +1 -1
  142. package/dist/react-native/react.js +5 -5
  143. package/dist/react-native/react.js.map +1 -1
  144. package/dist/rollup/index.d.ts +3 -0
  145. package/dist/rollup/index.d.ts.map +1 -0
  146. package/dist/rollup/index.js +5 -0
  147. package/dist/rollup/index.js.map +1 -0
  148. package/dist/runtime/Appearance.d.ts +7 -7
  149. package/dist/runtime/Appearance.d.ts.map +1 -1
  150. package/dist/runtime/Appearance.js +15 -15
  151. package/dist/runtime/Appearance.js.map +1 -1
  152. package/dist/runtime/Dynamic.d.ts.map +1 -1
  153. package/dist/runtime/Dynamic.js +4 -1
  154. package/dist/runtime/Dynamic.js.map +1 -1
  155. package/dist/runtime/NativeContext.d.ts +4 -4
  156. package/dist/runtime/NativeContext.d.ts.map +1 -1
  157. package/dist/runtime/NativeContext.js +5 -5
  158. package/dist/runtime/NativeContext.js.map +1 -1
  159. package/dist/runtime/NativeDynamic.d.ts +1 -1
  160. package/dist/runtime/NativeDynamic.d.ts.map +1 -1
  161. package/dist/runtime/NativeDynamic.js.map +1 -1
  162. package/dist/runtime/Props.d.ts +1 -1
  163. package/dist/runtime/Props.js +3 -3
  164. package/dist/runtime/Props.js.map +1 -1
  165. package/dist/runtime/Selection.d.ts +14 -10
  166. package/dist/runtime/Selection.d.ts.map +1 -1
  167. package/dist/runtime/Selection.js +19 -18
  168. package/dist/runtime/Selection.js.map +1 -1
  169. package/dist/styleFunction.d.ts +14 -14
  170. package/dist/styleFunction.d.ts.map +1 -1
  171. package/dist/styleFunction.js.map +1 -1
  172. package/dist/unplugin/index.d.ts +20 -0
  173. package/dist/unplugin/index.d.ts.map +1 -0
  174. package/dist/unplugin/index.js +498 -0
  175. package/dist/unplugin/index.js.map +1 -0
  176. package/dist/variants.d.ts +3 -3
  177. package/dist/variants.d.ts.map +1 -1
  178. package/dist/variants.js.map +1 -1
  179. package/dist/vite/index.d.ts.map +1 -1
  180. package/dist/vite/index.js +6 -3
  181. package/dist/vite/index.js.map +1 -1
  182. package/dist/web/Css.d.ts +4 -3
  183. package/dist/web/Css.d.ts.map +1 -1
  184. package/dist/web/Css.js +4 -4
  185. package/dist/web/Css.js.map +1 -1
  186. package/dist/web/internal/Themes.d.ts +3 -2
  187. package/dist/web/internal/Themes.d.ts.map +1 -1
  188. package/dist/web/internal/Themes.js +42 -6
  189. package/dist/web/internal/Themes.js.map +1 -1
  190. package/dist/webpack/index.d.ts +3 -0
  191. package/dist/webpack/index.d.ts.map +1 -0
  192. package/dist/webpack/index.js +5 -0
  193. package/dist/webpack/index.js.map +1 -0
  194. package/package.json +23 -2
  195. package/src/Config.ts +43 -684
  196. package/src/Style.ts +167 -40
  197. package/src/Vars.ts +299 -0
  198. package/src/compiler/Graph.ts +14 -9
  199. package/src/compiler/Native.ts +29 -32
  200. package/src/compiler/Source.ts +85 -18
  201. package/src/compiler/Transform.ts +78 -22
  202. package/src/compiler/internal/Compositions.ts +36 -3
  203. package/src/compiler/internal/Configurations.ts +83 -11
  204. package/src/compiler/internal/Contract.ts +223 -17
  205. package/src/compiler/internal/Contributions.ts +1 -1
  206. package/src/compiler/internal/Dynamic.ts +1 -1
  207. package/src/compiler/internal/Expression.ts +26 -0
  208. package/src/compiler/internal/Identifiers.ts +2 -1
  209. package/src/compiler/internal/NativeBindings.ts +3 -3
  210. package/src/compiler/internal/PackedStyles.ts +22 -26
  211. package/src/compiler/internal/Recipes.ts +1 -1
  212. package/src/compiler/internal/Selectors.ts +1 -1
  213. package/src/compiler/internal/Themes.ts +266 -57
  214. package/src/compiler/internal/{Variables.ts → Vars.ts} +2 -2
  215. package/src/default.ts +868 -156
  216. package/src/esbuild/index.ts +5 -0
  217. package/src/index.ts +4 -4
  218. package/src/internal/Authoring.ts +5 -7
  219. package/src/internal/Binding.ts +1 -1
  220. package/src/internal/Completion.ts +42 -0
  221. package/src/internal/Condition.ts +31 -1
  222. package/src/internal/Configuration.ts +970 -0
  223. package/src/internal/Shorthands.ts +2 -0
  224. package/src/{Theme.ts → internal/Theme.ts} +174 -48
  225. package/src/internal/Token.ts +258 -85
  226. package/src/internal/Typography.ts +106 -0
  227. package/src/internal/Value.ts +45 -26
  228. package/src/internal/VariableSets.ts +458 -0
  229. package/src/next/loader.ts +19 -5
  230. package/src/node/Host.ts +1 -2
  231. package/src/react-native/Host.ts +6 -6
  232. package/src/react-native/StyleSheet.ts +49 -42
  233. package/src/react-native/Variants.ts +3 -3
  234. package/src/react-native/react.ts +6 -6
  235. package/src/rollup/index.ts +5 -0
  236. package/src/runtime/Appearance.ts +20 -20
  237. package/src/runtime/Dynamic.ts +4 -1
  238. package/src/runtime/NativeContext.ts +8 -8
  239. package/src/runtime/NativeDynamic.ts +2 -4
  240. package/src/runtime/Props.ts +3 -3
  241. package/src/runtime/Selection.ts +44 -33
  242. package/src/styleFunction.ts +22 -19
  243. package/src/unplugin/index.ts +600 -0
  244. package/src/variants.ts +7 -5
  245. package/src/vite/index.ts +5 -4
  246. package/src/web/Css.ts +10 -7
  247. package/src/web/internal/Themes.ts +52 -9
  248. package/src/webpack/index.ts +5 -0
  249. package/dist/Theme.d.ts.map +0 -1
  250. package/dist/Theme.js.map +0 -1
  251. package/dist/compiler/internal/Variables.d.ts.map +0 -1
  252. package/dist/compiler/internal/Variables.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ /** Exposes the Zyzz esbuild build adapter. @module */
2
+ import { zyzz as unplugin } from '../unplugin/index.js'
3
+
4
+ /** Compiles project sources and emits `zyzz.css` into the bundler output directory. */
5
+ export const zyzz = unplugin.esbuild
package/src/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Exposes token-free authoring, ordered style definitions, and theme contracts.
2
+ * Exposes token-free authoring, ordered style definitions, and variable contracts.
3
3
  * @module
4
4
  */
5
- /** Explicit theme and layer authoring contracts. */
5
+ /** Explicit variable and layer authoring contracts. */
6
6
  export * as Config from './Config.js'
7
7
  /** Token-free literal authoring; requires a compile-time source transform. */
8
8
  export { style } from './styleFunction.js'
@@ -12,9 +12,9 @@ export { cx } from './cx.js'
12
12
  export type * as Props from './Props.js'
13
13
  /** Typed literal style definitions and validation diagnostics. */
14
14
  export * as Style from './Style.js'
15
- /** Typed theme contracts and compatible token overrides. */
16
- export * as Theme from './Theme.js'
17
15
  /** Typed CSS variable declarations and inline assignments. */
18
16
  export { variable } from './variable.js'
17
+ /** Immutable shared values, conditions, and compatible variable sets. */
18
+ export * as Vars from './Vars.js'
19
19
  /** Single-element finite recipes compiled ahead of time. */
20
20
  export { variants } from './variants.js'
@@ -4,7 +4,7 @@ import * as Html from '../runtime/CompositionHtml.js'
4
4
  import * as Identity from './Identity.js'
5
5
  import * as Props from '../runtime/Props.js'
6
6
  import * as Style from '../Style.js'
7
- import type * as Theme from '../Theme.js'
7
+ import type * as Theme from './Theme.js'
8
8
 
9
9
  /** Private ownership used by uncompiled composition; never spread onto DOM props. */
10
10
  export const metadata = Symbol.for('zyzz.authoring')
@@ -44,7 +44,7 @@ export function body(input: Record<string, unknown>): Record<string, unknown> {
44
44
  descriptors.web = { ...web, value: body(web.value) }
45
45
  return [[key, Object.create(Object.getPrototypeOf(value), descriptors)]]
46
46
  }
47
- if (key === 'selectors' || key === 'variables')
47
+ if (key === 'selectors' || key === 'vars')
48
48
  return Object.entries(value as Record<string, unknown>).map(
49
49
  ([name, entry]) => [
50
50
  name,
@@ -84,7 +84,7 @@ export function create(
84
84
  ) => Style.Definition
85
85
  )(
86
86
  { style: body(input as Record<string, unknown>) },
87
- { theme: options.theme },
87
+ { vars: options.theme },
88
88
  ).styles[0]!,
89
89
  )
90
90
  const props = Props.create({ className })
@@ -95,7 +95,7 @@ export function create(
95
95
  ...result.style,
96
96
  }
97
97
  for (const [field, value] of Object.entries(values ?? {})) {
98
- if (['className', 'style', 'variables'].includes(field)) continue
98
+ if (['className', 'style', 'vars'].includes(field)) continue
99
99
  style[Identity.slot(id!, field)] =
100
100
  value === '' ? ' ' : (value as string | number)
101
101
  }
@@ -107,9 +107,7 @@ export function create(
107
107
  attributes: [],
108
108
  slots: dynamic
109
109
  ? Object.keys(values ?? {})
110
- .filter(
111
- (key) => !['className', 'style', 'variables'].includes(key),
112
- )
110
+ .filter((key) => !['className', 'style', 'vars'].includes(key))
113
111
  .map((key) => Identity.slot(id!, key))
114
112
  : [],
115
113
  },
@@ -135,7 +135,7 @@ export type Inputs<values> = {
135
135
  | 'key'
136
136
  | 'ref'
137
137
  | 'style'
138
- | 'variables'
138
+ | 'vars'
139
139
  | '__proto__'
140
140
  ? never
141
141
  : Extract<values[key], `${string}!${string}`> extends never
@@ -0,0 +1,42 @@
1
+ /** Supplies editor hints independently of inferred declaration validation. @module */
2
+ import type * as Theme from './Theme.js'
3
+ import type * as Condition from './Condition.js'
4
+ import type * as Literal from './Literal.js'
5
+ import type * as Token from './Token.js'
6
+ import type * as Typography from './Typography.js'
7
+
8
+ /** Recursive hints do not determine which authored declarations are accepted. */
9
+ export type Properties<
10
+ tokens extends Theme.Tokens = {},
11
+ styles = Record<string, unknown>,
12
+ > = {
13
+ readonly [property in keyof Literal.Properties & keyof styles]?:
14
+ | (string extends Literal.Properties[property]
15
+ ? never
16
+ : Literal.Properties[property])
17
+ | Token.Names<tokens, property>
18
+ | (string & {})
19
+ | number
20
+ | object
21
+ } & {
22
+ // Escaped custom-property names can contain nesting characters.
23
+ readonly [key in (`@${string}` | `:${string}` | `${string}&${string}`) &
24
+ keyof styles]?:
25
+ | Nested<tokens>
26
+ | (key extends `${string}&${string}` ? string | number : never)
27
+ } & {
28
+ readonly [key in (
29
+ | Condition.Suggestions
30
+ | Exclude<Condition.Keys<tokens>, Condition.Raw>
31
+ ) &
32
+ keyof styles]?: Nested<tokens>
33
+ } & {
34
+ readonly [property in (Typography.Names<tokens> extends never
35
+ ? never
36
+ : 'typography') &
37
+ keyof styles]?: Typography.Names<tokens> | (string & {})
38
+ }
39
+
40
+ // Inferred validation checks extra fields, including vars and configured shorthands.
41
+ type Nested<tokens extends Theme.Tokens> = Properties<tokens> &
42
+ Readonly<Record<string, unknown>>
@@ -1,5 +1,35 @@
1
1
  /** Typed nested selector and condition keys without a general string index. @module */
2
- import type * as Theme from '../Theme.js'
2
+ import type * as Theme from './Theme.js'
3
+
4
+ /** Concrete suggestions supplement open selector and query patterns. */
5
+ export type Suggestions =
6
+ | '::after'
7
+ | '::backdrop'
8
+ | '::before'
9
+ | '::first-letter'
10
+ | '::first-line'
11
+ | '::marker'
12
+ | '::placeholder'
13
+ | '::selection'
14
+ | ':active'
15
+ | ':checked'
16
+ | ':disabled'
17
+ | ':empty'
18
+ | ':enabled'
19
+ | ':first-child'
20
+ | ':focus'
21
+ | ':focus-visible'
22
+ | ':focus-within'
23
+ | ':hover'
24
+ | ':last-child'
25
+ | ':only-child'
26
+ | ':visited'
27
+ | '@container'
28
+ | '@layer'
29
+ | '@media'
30
+ | '@scope'
31
+ | '@starting-style'
32
+ | '@supports'
3
33
 
4
34
  type Case<text extends string> = text extends `${infer first}${infer rest}`
5
35
  ? `${Lowercase<first> | Uppercase<first>}${Case<rest>}`