zyzz 0.0.3 → 0.0.6

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 (273) 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 +15 -12
  7. package/dist/Style.d.ts.map +1 -1
  8. package/dist/Style.js +51 -26
  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/babel/index.d.ts +2 -0
  15. package/dist/babel/index.d.ts.map +1 -1
  16. package/dist/babel/index.js +10 -1
  17. package/dist/babel/index.js.map +1 -1
  18. package/dist/compiler/Graph.d.ts +2 -0
  19. package/dist/compiler/Graph.d.ts.map +1 -1
  20. package/dist/compiler/Graph.js +30 -9
  21. package/dist/compiler/Graph.js.map +1 -1
  22. package/dist/compiler/Native.d.ts +5 -5
  23. package/dist/compiler/Native.d.ts.map +1 -1
  24. package/dist/compiler/Native.js +21 -21
  25. package/dist/compiler/Native.js.map +1 -1
  26. package/dist/compiler/Source.d.ts +8 -6
  27. package/dist/compiler/Source.d.ts.map +1 -1
  28. package/dist/compiler/Source.js +52 -16
  29. package/dist/compiler/Source.js.map +1 -1
  30. package/dist/compiler/Transform.d.ts +1 -1
  31. package/dist/compiler/Transform.d.ts.map +1 -1
  32. package/dist/compiler/Transform.js +58 -22
  33. package/dist/compiler/Transform.js.map +1 -1
  34. package/dist/compiler/internal/Compositions.d.ts +5 -0
  35. package/dist/compiler/internal/Compositions.d.ts.map +1 -1
  36. package/dist/compiler/internal/Compositions.js +22 -3
  37. package/dist/compiler/internal/Compositions.js.map +1 -1
  38. package/dist/compiler/internal/Configurations.d.ts.map +1 -1
  39. package/dist/compiler/internal/Configurations.js +73 -12
  40. package/dist/compiler/internal/Configurations.js.map +1 -1
  41. package/dist/compiler/internal/Contract.d.ts +1 -1
  42. package/dist/compiler/internal/Contract.d.ts.map +1 -1
  43. package/dist/compiler/internal/Contract.js +155 -13
  44. package/dist/compiler/internal/Contract.js.map +1 -1
  45. package/dist/compiler/internal/Contributions.d.ts +1 -1
  46. package/dist/compiler/internal/Contributions.d.ts.map +1 -1
  47. package/dist/compiler/internal/Contributions.js +6 -4
  48. package/dist/compiler/internal/Contributions.js.map +1 -1
  49. package/dist/compiler/internal/Dynamic.js +1 -1
  50. package/dist/compiler/internal/Dynamic.js.map +1 -1
  51. package/dist/compiler/internal/Expression.d.ts +3 -0
  52. package/dist/compiler/internal/Expression.d.ts.map +1 -1
  53. package/dist/compiler/internal/Expression.js +21 -0
  54. package/dist/compiler/internal/Expression.js.map +1 -1
  55. package/dist/compiler/internal/Identifiers.d.ts +1 -1
  56. package/dist/compiler/internal/Identifiers.d.ts.map +1 -1
  57. package/dist/compiler/internal/Identifiers.js +2 -2
  58. package/dist/compiler/internal/Identifiers.js.map +1 -1
  59. package/dist/compiler/internal/NativeBindings.d.ts +1 -1
  60. package/dist/compiler/internal/NativeBindings.d.ts.map +1 -1
  61. package/dist/compiler/internal/NativeBindings.js +3 -3
  62. package/dist/compiler/internal/NativeBindings.js.map +1 -1
  63. package/dist/compiler/internal/PackedStyles.d.ts +1 -1
  64. package/dist/compiler/internal/PackedStyles.d.ts.map +1 -1
  65. package/dist/compiler/internal/PackedStyles.js +15 -25
  66. package/dist/compiler/internal/PackedStyles.js.map +1 -1
  67. package/dist/compiler/internal/Recipes.js +1 -1
  68. package/dist/compiler/internal/Recipes.js.map +1 -1
  69. package/dist/compiler/internal/Selectors.js +1 -1
  70. package/dist/compiler/internal/Selectors.js.map +1 -1
  71. package/dist/compiler/internal/Static.d.ts.map +1 -1
  72. package/dist/compiler/internal/Static.js +2 -0
  73. package/dist/compiler/internal/Static.js.map +1 -1
  74. package/dist/compiler/internal/Themes.d.ts +12 -3
  75. package/dist/compiler/internal/Themes.d.ts.map +1 -1
  76. package/dist/compiler/internal/Themes.js +192 -52
  77. package/dist/compiler/internal/Themes.js.map +1 -1
  78. package/dist/compiler/internal/{Variables.d.ts → Vars.d.ts} +1 -1
  79. package/dist/compiler/internal/Vars.d.ts.map +1 -0
  80. package/dist/compiler/internal/{Variables.js → Vars.js} +3 -3
  81. package/dist/compiler/internal/Vars.js.map +1 -0
  82. package/dist/default.d.ts +147 -2562
  83. package/dist/default.d.ts.map +1 -1
  84. package/dist/default.js +85 -80
  85. package/dist/default.js.map +2 -2
  86. package/dist/default.js.zyzz.json +1 -1
  87. package/dist/esbuild/index.d.ts +3 -0
  88. package/dist/esbuild/index.d.ts.map +1 -0
  89. package/dist/esbuild/index.js +5 -0
  90. package/dist/esbuild/index.js.map +1 -0
  91. package/dist/index.d.ts +4 -4
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +4 -4
  94. package/dist/index.js.map +1 -1
  95. package/dist/internal/Authoring.d.ts +1 -1
  96. package/dist/internal/Authoring.d.ts.map +1 -1
  97. package/dist/internal/Authoring.js +4 -4
  98. package/dist/internal/Authoring.js.map +1 -1
  99. package/dist/internal/Binding.d.ts +1 -1
  100. package/dist/internal/Binding.d.ts.map +1 -1
  101. package/dist/internal/Completion.d.ts +19 -0
  102. package/dist/internal/Completion.d.ts.map +1 -0
  103. package/dist/internal/Completion.js +2 -0
  104. package/dist/internal/Completion.js.map +1 -0
  105. package/dist/internal/Condition.d.ts +3 -1
  106. package/dist/internal/Condition.d.ts.map +1 -1
  107. package/dist/internal/Condition.js.map +1 -1
  108. package/dist/internal/Configuration.d.ts +248 -0
  109. package/dist/internal/Configuration.d.ts.map +1 -0
  110. package/dist/internal/Configuration.js +343 -0
  111. package/dist/internal/Configuration.js.map +1 -0
  112. package/dist/{Theme.d.ts → internal/Theme.d.ts} +15 -13
  113. package/dist/internal/Theme.d.ts.map +1 -0
  114. package/dist/{Theme.js → internal/Theme.js} +39 -12
  115. package/dist/internal/Theme.js.map +1 -0
  116. package/dist/internal/Token.d.ts +46 -16
  117. package/dist/internal/Token.d.ts.map +1 -1
  118. package/dist/internal/Token.js +89 -5
  119. package/dist/internal/Token.js.map +1 -1
  120. package/dist/internal/Typography.d.ts +13 -5
  121. package/dist/internal/Typography.d.ts.map +1 -1
  122. package/dist/internal/Typography.js +42 -6
  123. package/dist/internal/Typography.js.map +1 -1
  124. package/dist/internal/Value.d.ts +6 -1
  125. package/dist/internal/Value.d.ts.map +1 -1
  126. package/dist/internal/Value.js.map +1 -1
  127. package/dist/internal/VariableSets.d.ts +20 -0
  128. package/dist/internal/VariableSets.d.ts.map +1 -0
  129. package/dist/internal/VariableSets.js +317 -0
  130. package/dist/internal/VariableSets.js.map +1 -0
  131. package/dist/next/index.d.ts +8 -3
  132. package/dist/next/index.d.ts.map +1 -1
  133. package/dist/next/index.js +21 -10
  134. package/dist/next/index.js.map +1 -1
  135. package/dist/next/loader.d.ts +1 -0
  136. package/dist/next/loader.d.ts.map +1 -1
  137. package/dist/next/loader.js +25 -6
  138. package/dist/next/loader.js.map +1 -1
  139. package/dist/node/Host.d.ts.map +1 -1
  140. package/dist/node/Host.js +1 -1
  141. package/dist/node/Host.js.map +1 -1
  142. package/dist/node/Reset.d.ts +3 -0
  143. package/dist/node/Reset.d.ts.map +1 -0
  144. package/dist/node/Reset.js +7 -0
  145. package/dist/node/Reset.js.map +1 -0
  146. package/dist/react-native/Host.d.ts +2 -2
  147. package/dist/react-native/Host.d.ts.map +1 -1
  148. package/dist/react-native/Host.js +4 -4
  149. package/dist/react-native/Host.js.map +1 -1
  150. package/dist/react-native/StyleSheet.d.ts +9 -8
  151. package/dist/react-native/StyleSheet.d.ts.map +1 -1
  152. package/dist/react-native/StyleSheet.js +29 -23
  153. package/dist/react-native/StyleSheet.js.map +1 -1
  154. package/dist/react-native/Variants.d.ts +3 -3
  155. package/dist/react-native/Variants.d.ts.map +1 -1
  156. package/dist/react-native/Variants.js +2 -2
  157. package/dist/react-native/react.d.ts +1 -1
  158. package/dist/react-native/react.d.ts.map +1 -1
  159. package/dist/react-native/react.js +5 -5
  160. package/dist/react-native/react.js.map +1 -1
  161. package/dist/rollup/index.d.ts +3 -0
  162. package/dist/rollup/index.d.ts.map +1 -0
  163. package/dist/rollup/index.js +5 -0
  164. package/dist/rollup/index.js.map +1 -0
  165. package/dist/runtime/Appearance.d.ts +7 -7
  166. package/dist/runtime/Appearance.d.ts.map +1 -1
  167. package/dist/runtime/Appearance.js +15 -15
  168. package/dist/runtime/Appearance.js.map +1 -1
  169. package/dist/runtime/Dynamic.d.ts.map +1 -1
  170. package/dist/runtime/Dynamic.js +4 -1
  171. package/dist/runtime/Dynamic.js.map +1 -1
  172. package/dist/runtime/NativeContext.d.ts +4 -4
  173. package/dist/runtime/NativeContext.d.ts.map +1 -1
  174. package/dist/runtime/NativeContext.js +5 -5
  175. package/dist/runtime/NativeContext.js.map +1 -1
  176. package/dist/runtime/NativeDynamic.d.ts +1 -1
  177. package/dist/runtime/NativeDynamic.d.ts.map +1 -1
  178. package/dist/runtime/NativeDynamic.js.map +1 -1
  179. package/dist/runtime/Props.d.ts +1 -1
  180. package/dist/runtime/Props.js +3 -3
  181. package/dist/runtime/Props.js.map +1 -1
  182. package/dist/runtime/Selection.d.ts +14 -10
  183. package/dist/runtime/Selection.d.ts.map +1 -1
  184. package/dist/runtime/Selection.js +19 -18
  185. package/dist/runtime/Selection.js.map +1 -1
  186. package/dist/styleFunction.d.ts +14 -14
  187. package/dist/styleFunction.d.ts.map +1 -1
  188. package/dist/styleFunction.js.map +1 -1
  189. package/dist/unplugin/index.d.ts +22 -0
  190. package/dist/unplugin/index.d.ts.map +1 -0
  191. package/dist/unplugin/index.js +500 -0
  192. package/dist/unplugin/index.js.map +1 -0
  193. package/dist/variants.d.ts +3 -3
  194. package/dist/variants.d.ts.map +1 -1
  195. package/dist/variants.js.map +1 -1
  196. package/dist/vite/index.d.ts +2 -0
  197. package/dist/vite/index.d.ts.map +1 -1
  198. package/dist/vite/index.js +44 -12
  199. package/dist/vite/index.js.map +1 -1
  200. package/dist/web/Css.d.ts +4 -3
  201. package/dist/web/Css.d.ts.map +1 -1
  202. package/dist/web/Css.js +4 -4
  203. package/dist/web/Css.js.map +1 -1
  204. package/dist/web/internal/Themes.d.ts +3 -2
  205. package/dist/web/internal/Themes.d.ts.map +1 -1
  206. package/dist/web/internal/Themes.js +42 -6
  207. package/dist/web/internal/Themes.js.map +1 -1
  208. package/dist/webpack/index.d.ts +3 -0
  209. package/dist/webpack/index.d.ts.map +1 -0
  210. package/dist/webpack/index.js +5 -0
  211. package/dist/webpack/index.js.map +1 -0
  212. package/package.json +23 -2
  213. package/src/Config.ts +43 -685
  214. package/src/Style.ts +97 -34
  215. package/src/Vars.ts +299 -0
  216. package/src/babel/index.ts +23 -1
  217. package/src/compiler/Graph.ts +36 -9
  218. package/src/compiler/Native.ts +29 -32
  219. package/src/compiler/Source.ts +64 -22
  220. package/src/compiler/Transform.ts +73 -23
  221. package/src/compiler/internal/Compositions.ts +36 -3
  222. package/src/compiler/internal/Configurations.ts +83 -11
  223. package/src/compiler/internal/Contract.ts +207 -15
  224. package/src/compiler/internal/Contributions.ts +6 -3
  225. package/src/compiler/internal/Dynamic.ts +1 -1
  226. package/src/compiler/internal/Expression.ts +26 -0
  227. package/src/compiler/internal/Identifiers.ts +2 -1
  228. package/src/compiler/internal/NativeBindings.ts +3 -3
  229. package/src/compiler/internal/PackedStyles.ts +22 -26
  230. package/src/compiler/internal/Recipes.ts +1 -1
  231. package/src/compiler/internal/Selectors.ts +1 -1
  232. package/src/compiler/internal/Static.ts +1 -0
  233. package/src/compiler/internal/Themes.ts +266 -57
  234. package/src/compiler/internal/{Variables.ts → Vars.ts} +2 -2
  235. package/src/default.ts +173 -154
  236. package/src/esbuild/index.ts +5 -0
  237. package/src/index.ts +4 -4
  238. package/src/internal/Authoring.ts +5 -7
  239. package/src/internal/Binding.ts +1 -1
  240. package/src/internal/Completion.ts +42 -0
  241. package/src/internal/Condition.ts +31 -1
  242. package/src/internal/Configuration.ts +970 -0
  243. package/src/{Theme.ts → internal/Theme.ts} +75 -20
  244. package/src/internal/Token.ts +258 -85
  245. package/src/internal/Typography.ts +71 -16
  246. package/src/internal/Value.ts +45 -26
  247. package/src/internal/VariableSets.ts +458 -0
  248. package/src/next/index.ts +34 -12
  249. package/src/next/loader.ts +35 -6
  250. package/src/node/Host.ts +1 -2
  251. package/src/node/Reset.ts +7 -0
  252. package/src/react-native/Host.ts +6 -6
  253. package/src/react-native/StyleSheet.ts +49 -42
  254. package/src/react-native/Variants.ts +3 -3
  255. package/src/react-native/react.ts +6 -6
  256. package/src/rollup/index.ts +5 -0
  257. package/src/runtime/Appearance.ts +20 -20
  258. package/src/runtime/Dynamic.ts +4 -1
  259. package/src/runtime/NativeContext.ts +8 -8
  260. package/src/runtime/NativeDynamic.ts +2 -4
  261. package/src/runtime/Props.ts +3 -3
  262. package/src/runtime/Selection.ts +44 -33
  263. package/src/styleFunction.ts +22 -19
  264. package/src/unplugin/index.ts +604 -0
  265. package/src/variants.ts +7 -5
  266. package/src/vite/index.ts +48 -18
  267. package/src/web/Css.ts +10 -7
  268. package/src/web/internal/Themes.ts +52 -9
  269. package/src/webpack/index.ts +5 -0
  270. package/dist/Theme.d.ts.map +0 -1
  271. package/dist/Theme.js.map +0 -1
  272. package/dist/compiler/internal/Variables.d.ts.map +0 -1
  273. package/dist/compiler/internal/Variables.js.map +0 -1
@@ -3,12 +3,12 @@ import type * as Native from './Native.js'
3
3
 
4
4
  const binding = Symbol('zyzz.native.context')
5
5
 
6
- /** Render-local theme and resolved appearance. */
6
+ /** Render-local set and resolved appearance. */
7
7
  export type Context = {
8
8
  /** Resolved system appearance or an explicit override. */
9
9
  readonly colorScheme: 'dark' | 'light'
10
- /** Named compiled theme; omission uses each configuration default. */
11
- readonly theme?: string | undefined
10
+ /** Named compiled set; omission uses each configuration default. */
11
+ readonly set?: string | undefined
12
12
  }
13
13
 
14
14
  type Callable = (input: never) => Native.Props<object>
@@ -19,17 +19,17 @@ type Tables = Readonly<
19
19
  /** Retains compiled alternatives without selecting a device context at module evaluation. */
20
20
  export function create<const tables extends Tables>(
21
21
  tables: tables,
22
- defaultTheme: keyof tables & string,
22
+ defaultVars: keyof tables & string,
23
23
  ): tables[keyof tables]['light'] {
24
24
  const fallback =
25
- Object.keys(tables).length === 1 && defaultTheme === 'default'
25
+ Object.keys(tables).length === 1 && defaultVars === 'default'
26
26
  ? tables.default
27
27
  : undefined
28
28
 
29
29
  function select(context: Context, input?: never) {
30
- const theme = context.theme ?? defaultTheme
31
- const table = tables[theme] ?? fallback
32
- if (!table) throw new Error(`Unknown native theme: ${theme}.`)
30
+ const set = context.set ?? defaultVars
31
+ const table = tables[set] ?? fallback
32
+ if (!table) throw new Error(`Unknown native set: ${set}.`)
33
33
  return table[context.colorScheme](input!).style
34
34
  }
35
35
  function props(input?: never) {
@@ -27,10 +27,8 @@ export type RecipeCallable<input> = <
27
27
  /** Adapts a published web callable's payload to native styling overrides. */
28
28
  export type From<fn> = fn extends (...args: infer args) => unknown
29
29
  ? [] extends args
30
- ? RecipeCallable<
31
- Omit<NonNullable<args[0]>, 'style' | 'className' | 'variables'>
32
- >
33
- : Callable<Omit<NonNullable<args[0]>, 'style' | 'className' | 'variables'>>
30
+ ? RecipeCallable<Omit<NonNullable<args[0]>, 'style' | 'className' | 'vars'>>
31
+ : Callable<Omit<NonNullable<args[0]>, 'style' | 'className' | 'vars'>>
34
32
  : never
35
33
 
36
34
  /** Ordered static and dynamic assignments selected by finite recipe choices. */
@@ -8,14 +8,14 @@ import type { style } from '../styleFunction.js'
8
8
  * Binds compiled classes to the web styling override contract.
9
9
  * Returns fresh props; without variable assignments, inline styles retain their identity.
10
10
  * Never generates rules or changes the supplied overrides.
11
- * @returns A callable accepting className, style, and variables.
11
+ * @returns A callable accepting className, style, and vars.
12
12
  */
13
13
  export function create({ className }: create.Options): style.ReturnType {
14
14
  return ((overrides?: style.Options) => {
15
15
  if (!overrides) return { className }
16
16
 
17
- const { className: external, style, variables } = overrides
18
- const inline = variables ? { ...variables, ...style } : style
17
+ const { className: external, style, vars } = overrides
18
+ const inline = vars ? { ...vars, ...style } : style
19
19
  const merged =
20
20
  className && external ? `${className} ${external}` : external || className
21
21
 
@@ -1,75 +1,86 @@
1
- /** Selects compiler-owned theme classes without evaluating authoring code. @module */
1
+ /** Selects compiler-owned variable scope classes without evaluating authoring code. @module */
2
2
  import * as Scheme from '../internal/Scheme.js'
3
+ import * as Html from './CompositionHtml.js'
3
4
 
4
5
  /**
5
- * Creates a validated selector with the compatible named theme catalog.
6
+ * Creates a validated selector with the compatible named set catalog.
6
7
  * A selected scheme adds its stylesheet class beside the scope class and an inline `color-scheme`.
7
- * @param entries Compatible theme names paired with compiler-owned scope classes.
8
+ * @param entries Compatible set names paired with compiler-owned scope classes.
8
9
  * @param html Whether selection returns HTML class/serialized-style props. Defaults to false (React className/object-style props).
9
- * @returns A callable selector with catalog members exposing their scope class names.
10
+ * @returns A callable selector returning scope props.
10
11
  * @throws {TypeError} When selection names, schemes, or option keys are invalid.
11
12
  */
12
13
  export function create<
13
14
  const entries extends readonly (readonly [string, string])[],
14
15
  const html extends boolean = false,
15
16
  >(entries: entries, html?: html): create.ReturnType<entries[number][0], html>
17
+ export function create(
18
+ entries: readonly (readonly [string, string])[],
19
+ html: boolean,
20
+ key: 'set',
21
+ defaultSet?: string,
22
+ ): (input?: { set?: string | undefined; colorScheme?: string | undefined }) => {
23
+ className?: string
24
+ class?: string
25
+ style?: unknown
26
+ }
16
27
  export function create(
17
28
  entries: readonly (readonly [string, string])[],
18
29
  html = false,
19
- ) {
30
+ key: 'set' = 'set',
31
+ defaultSet?: string,
32
+ ): unknown {
20
33
  const catalog = Object.fromEntries(entries)
21
34
 
22
- const select = (input: { theme: string; colorScheme?: string }) => {
35
+ const select = (
36
+ input: {
37
+ set?: string | undefined
38
+ colorScheme?: string | undefined
39
+ } = {},
40
+ ) => {
41
+ const selected =
42
+ input && typeof input === 'object'
43
+ ? (input[key] ?? defaultSet)
44
+ : undefined
23
45
  if (
24
46
  !input ||
25
47
  typeof input !== 'object' ||
26
48
  Array.isArray(input) ||
27
- !Object.hasOwn(input, 'theme') ||
28
- typeof input.theme !== 'string' ||
29
- !Object.hasOwn(catalog, input.theme) ||
49
+ (!Object.hasOwn(input, key) && defaultSet === undefined) ||
50
+ typeof selected !== 'string' ||
51
+ !Object.hasOwn(catalog, selected!) ||
30
52
  Object.keys(input).some(
31
- (key) => key !== 'theme' && key !== 'colorScheme',
53
+ (field) => field !== key && field !== 'colorScheme',
32
54
  ) ||
33
55
  (input.colorScheme !== undefined &&
34
56
  !['light', 'dark', 'light dark'].includes(input.colorScheme))
35
57
  )
36
- throw new TypeError('Invalid theme selection.')
58
+ throw new TypeError('Invalid variable selection.')
37
59
 
38
60
  const scheme = input.colorScheme as Scheme.Name | undefined
39
61
 
40
- return {
41
- [html ? 'class' : 'className']: scheme
42
- ? `${catalog[input.theme]} ${Scheme.classes[scheme]}`
43
- : catalog[input.theme],
44
- ...(scheme
45
- ? {
46
- style: html ? `color-scheme:${scheme}` : { colorScheme: scheme },
47
- }
48
- : {}),
62
+ const props = {
63
+ className: scheme
64
+ ? `${catalog[selected!]} ${Scheme.classes[scheme]}`
65
+ : catalog[selected!]!,
66
+ ...(scheme ? { style: { colorScheme: scheme } } : {}),
49
67
  }
68
+ return html ? Html.from(props) : props
50
69
  }
51
70
 
52
- return Object.defineProperties(
53
- select,
54
- Object.getOwnPropertyDescriptors(
55
- Object.fromEntries(
56
- entries.map(([name, className]) => [name, { className }]),
57
- ),
58
- ),
59
- ) as unknown as create.ReturnType<string, boolean>
71
+ return select as create.ReturnType<string, boolean>
60
72
  }
61
73
 
62
- /** Typed compiler-owned selection and compatible catalog members. */
74
+ /** Typed compiler-owned scope selection. */
63
75
  export declare namespace create {
64
76
  type ReturnType<name extends string, html extends boolean = false> = {
65
77
  <
66
78
  const input extends {
67
- readonly theme: name
79
+ readonly set: name
68
80
  readonly colorScheme?: 'light' | 'dark' | 'light dark' | undefined
69
81
  },
70
82
  >(
71
- input: input &
72
- Record<Exclude<keyof input, 'theme' | 'colorScheme'>, never>,
83
+ input: input & Record<Exclude<keyof input, 'set' | 'colorScheme'>, never>,
73
84
  ): html extends true
74
85
  ? { readonly class: string; readonly style?: string | undefined }
75
86
  : {
@@ -78,5 +89,5 @@ export declare namespace create {
78
89
  | { readonly colorScheme: 'light' | 'dark' | 'light dark' }
79
90
  | undefined
80
91
  }
81
- } & { readonly [key in name]: { readonly className: string } }
92
+ }
82
93
  }
@@ -4,25 +4,22 @@
4
4
  */
5
5
  import * as Authoring from './internal/Authoring.js'
6
6
  import type * as Binding from './internal/Binding.js'
7
+ import type * as Completion from './internal/Completion.js'
7
8
  import type * as Literal from './internal/Literal.js'
8
9
  import type * as Style from './Style.js'
9
10
 
10
- /** Restricts callback hints to inferred declarations instead of expanding every property grammar. */
11
- type CompletionProperties<styles = Record<string, unknown>> = {
12
- readonly [property in keyof typeof Literal.rules & keyof styles]?:
13
- | Literal.Properties[property]
14
- | (string & {})
15
- | number
16
- | object
17
- }
18
-
19
11
  type Keys<value> = value extends unknown ? keyof value : never
20
12
 
13
+ // Keep named and custom-property instantiations separate so framework interfaces need no index signature.
14
+ type InlineProperties<properties extends string> = {
15
+ readonly [property in properties]?: string | number | undefined
16
+ }
17
+
21
18
  type VariableOptions<input> = input extends {
22
- readonly variables: infer variables
19
+ readonly vars: infer variables
23
20
  }
24
21
  ? {
25
- readonly variables: {
22
+ readonly vars: {
26
23
  readonly [key in keyof variables]: string extends key
27
24
  ? variables[key]
28
25
  : key extends `--${string}`
@@ -49,7 +46,7 @@ export function style<
49
46
  values: values,
50
47
  ) => styles &
51
48
  NoInfer<Style.Accepted<styles, {}, true> & Binding.Checked<styles>>) &
52
- CompletionProperties<NoInfer<styles>>,
49
+ Completion.Properties<{}, NoInfer<styles>>,
53
50
  // Exclude invalid callbacks by arity so they cannot mask object-property diagnostics.
54
51
  ...options: Parameters<callback> extends [Record<string, string | number>]
55
52
  ? values extends Binding.Inputs<values>
@@ -60,7 +57,7 @@ export function style<
60
57
  export function style<const styles extends Record<string, unknown>>(
61
58
  styles: styles &
62
59
  NoInfer<Style.Accepted<styles, {}, true>> &
63
- CompletionProperties,
60
+ Completion.Properties,
64
61
  options?: style.DefinitionOptions,
65
62
  ): style.ReturnType
66
63
  export function style(
@@ -80,7 +77,7 @@ export declare namespace style {
80
77
  type DefinitionOptions = { readonly id?: string | undefined }
81
78
  /** Callable compiled bindings with required scalar inputs and styling overrides. */
82
79
  type Dynamic<values, output extends Output = 'react'> = Reference &
83
- (<const input extends values & Options>(
80
+ (<const input extends values & Options<output>>(
84
81
  input: input &
85
82
  VariableOptions<input> &
86
83
  Record<Exclude<keyof input, keyof values | keyof Options>, never>,
@@ -90,13 +87,19 @@ export declare namespace style {
90
87
  type ErrorType = Error
91
88
 
92
89
  /** Styling overrides consumed by a transformed definition. */
93
- type Options = {
90
+ type Options<output extends Output = 'react'> = {
94
91
  /** External class names appended to the generated classes. */
95
92
  readonly className?: string | undefined
96
- /** Literal inline styling overrides. */
97
- readonly style?: Literal.Properties | undefined
93
+ /** Inline overrides. React accepts scalar values, while HTML requires CSS units. */
94
+ readonly style?:
95
+ | (output extends 'html'
96
+ ? Literal.Properties
97
+ :
98
+ | InlineProperties<keyof typeof Literal.rules>
99
+ | InlineProperties<keyof Literal.Properties>)
100
+ | undefined
98
101
  /** Inline custom-property assignments, merged before explicit style overrides. */
99
- readonly variables?:
102
+ readonly vars?:
100
103
  | Readonly<Record<`--${string}`, string | number | undefined>>
101
104
  | undefined
102
105
  }
@@ -118,7 +121,7 @@ export declare namespace style {
118
121
 
119
122
  /** Callable definition; source rewriting supplies its implementation. */
120
123
  type ReturnType<output extends Output = 'react'> = Reference &
121
- (<const options extends Options = Options>(
124
+ (<const options extends Options<output> = Options<output>>(
122
125
  options?: options &
123
126
  VariableOptions<options> &
124
127
  Record<Exclude<Keys<options>, keyof Options>, never>,