@yahoo/uds-create-config 2.45.0 → 3.0.1

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 (376) hide show
  1. package/README.md +129 -0
  2. package/dist/ai-lanes.d.ts +23 -0
  3. package/dist/ai-lanes.js +34 -0
  4. package/dist/authoring/define-component.d.ts +85 -0
  5. package/dist/configs/CanvasConfig.d.ts +3237 -0
  6. package/dist/configs/CanvasConfig.js +332 -0
  7. package/dist/configs/build-options.d.ts +10 -0
  8. package/dist/configs/build-options.js +68 -0
  9. package/dist/configs/platform.d.ts +15 -0
  10. package/dist/configs/platform.js +17 -0
  11. package/dist/configs/react-native-system.d.ts +3026 -0
  12. package/dist/configs/react-native-system.js +64 -0
  13. package/dist/configs/system.d.ts +2771 -0
  14. package/dist/configs/system.js +74 -0
  15. package/dist/css/properties.generated.d.ts +14 -0
  16. package/dist/css/properties.generated.js +6260 -0
  17. package/dist/css/value-type.d.ts +48 -0
  18. package/dist/css/value-type.js +131 -0
  19. package/dist/css/values.d.ts +33 -0
  20. package/dist/css/values.js +116 -0
  21. package/dist/entities/native/NativeModifier.d.ts +25 -0
  22. package/dist/entities/native/NativeModifier.js +41 -0
  23. package/dist/entities/native/NativeSettings.d.ts +44 -0
  24. package/dist/entities/native/NativeSettings.js +39 -0
  25. package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
  26. package/dist/entities/native/NativeStyleProperty.js +28 -0
  27. package/dist/entities/native/NativeToken.d.ts +31 -0
  28. package/dist/entities/native/NativeToken.js +49 -0
  29. package/dist/entities/system/CanvasRole.d.ts +34 -0
  30. package/dist/entities/system/CanvasRole.js +45 -0
  31. package/dist/entities/system/Component.d.ts +1287 -0
  32. package/dist/entities/system/Component.js +1840 -0
  33. package/dist/entities/system/Composite.d.ts +12 -0
  34. package/dist/entities/system/Composite.js +26 -0
  35. package/dist/entities/system/Device.d.ts +11 -0
  36. package/dist/entities/system/Device.js +18 -0
  37. package/dist/entities/system/File.d.ts +72 -0
  38. package/dist/entities/system/File.js +136 -0
  39. package/dist/entities/system/Font.d.ts +48 -0
  40. package/dist/entities/system/Font.js +56 -0
  41. package/dist/entities/system/GlobalStyle.d.ts +26 -0
  42. package/dist/entities/system/GlobalStyle.js +54 -0
  43. package/dist/entities/system/Guidance.d.ts +85 -0
  44. package/dist/entities/system/Guidance.js +59 -0
  45. package/dist/entities/system/GuidanceStyle.d.ts +14 -0
  46. package/dist/entities/system/GuidanceStyle.js +8 -0
  47. package/dist/entities/system/Icon.d.ts +46 -0
  48. package/dist/entities/system/Icon.js +46 -0
  49. package/dist/entities/system/LinkedSystem.d.ts +504 -0
  50. package/dist/entities/system/LinkedSystem.js +814 -0
  51. package/dist/entities/system/Modifier.d.ts +92 -0
  52. package/dist/entities/system/Modifier.js +120 -0
  53. package/dist/entities/system/Motion.d.ts +28 -0
  54. package/dist/entities/system/Motion.js +48 -0
  55. package/dist/entities/system/Operation.d.ts +100 -0
  56. package/dist/entities/system/Operation.js +236 -0
  57. package/dist/entities/system/Package.d.ts +42 -0
  58. package/dist/entities/system/Package.js +75 -0
  59. package/dist/entities/system/Settings.d.ts +94 -0
  60. package/dist/entities/system/Settings.js +166 -0
  61. package/dist/entities/system/StyleProperty.d.ts +135 -0
  62. package/dist/entities/system/StyleProperty.js +438 -0
  63. package/dist/entities/system/Token.d.ts +67 -0
  64. package/dist/entities/system/Token.js +129 -0
  65. package/dist/entities/system/Tool.d.ts +134 -0
  66. package/dist/entities/system/Tool.js +124 -0
  67. package/dist/entities/system/color.d.ts +64 -0
  68. package/dist/entities/system/color.js +123 -0
  69. package/dist/entities/system/component-module.d.ts +63 -0
  70. package/dist/entities/system/component-module.js +258 -0
  71. package/dist/entities/system/copy-plan.d.ts +98 -0
  72. package/dist/entities/system/copy-plan.js +451 -0
  73. package/dist/entities/system/defineComponent.d.ts +428 -0
  74. package/dist/entities/system/defineComponent.js +337 -0
  75. package/dist/entities/system/element.d.ts +101 -0
  76. package/dist/entities/system/element.js +171 -0
  77. package/dist/entities/system/icon-library.d.ts +64 -0
  78. package/dist/entities/system/icon-library.js +112 -0
  79. package/dist/entities/system/icon-metadata.d.ts +72 -0
  80. package/dist/entities/system/icon-metadata.js +111 -0
  81. package/dist/entities/system/link-declaration.d.ts +27 -0
  82. package/dist/entities/system/link-declaration.js +64 -0
  83. package/dist/entities/system/link-plan.d.ts +160 -0
  84. package/dist/entities/system/link-plan.js +770 -0
  85. package/dist/entities/system/runtime-modules.d.ts +25 -0
  86. package/dist/entities/system/runtime-modules.js +38 -0
  87. package/dist/entities/system/style-bag.d.ts +20 -0
  88. package/dist/entities/system/style-bag.js +246 -0
  89. package/dist/entities/system/token-index.d.ts +89 -0
  90. package/dist/entities/system/token-index.js +112 -0
  91. package/dist/framework/Config.d.ts +2472 -0
  92. package/dist/framework/Config.js +5023 -0
  93. package/dist/framework/Entity.d.ts +127 -0
  94. package/dist/framework/Entity.js +125 -0
  95. package/dist/framework/authoring.d.ts +24 -0
  96. package/dist/framework/authoring.js +7 -0
  97. package/dist/framework/change-hooks.d.ts +119 -0
  98. package/dist/framework/change-hooks.js +131 -0
  99. package/dist/framework/changes.d.ts +88 -0
  100. package/dist/framework/changes.js +246 -0
  101. package/dist/framework/class-names.d.ts +260 -0
  102. package/dist/framework/class-names.js +630 -0
  103. package/dist/framework/coalesce.d.ts +25 -0
  104. package/dist/framework/coalesce.js +60 -0
  105. package/dist/framework/config-op.d.ts +76 -0
  106. package/dist/framework/config-op.js +43 -0
  107. package/dist/framework/config-operation-kind.d.ts +14 -0
  108. package/dist/framework/config-operation-kind.js +14 -0
  109. package/dist/framework/config-ops.d.ts +34 -0
  110. package/dist/framework/config-ops.js +187 -0
  111. package/dist/framework/defineConfig.d.ts +196 -0
  112. package/dist/framework/defineConfig.js +100 -0
  113. package/dist/framework/defineDerivedEntity.d.ts +74 -0
  114. package/dist/framework/defineDerivedEntity.js +83 -0
  115. package/dist/framework/defineEntity.d.ts +318 -0
  116. package/dist/framework/defineEntity.js +183 -0
  117. package/dist/framework/defineSubEntity.d.ts +148 -0
  118. package/dist/framework/defineSubEntity.js +121 -0
  119. package/dist/framework/derived-mutations.d.ts +20 -0
  120. package/dist/framework/derived-mutations.js +38 -0
  121. package/dist/framework/entity-search.d.ts +29 -0
  122. package/dist/framework/entity-search.js +117 -0
  123. package/dist/framework/inline-sources.d.ts +49 -0
  124. package/dist/framework/inline-sources.js +388 -0
  125. package/dist/framework/layer-styles.d.ts +25 -0
  126. package/dist/framework/layer-styles.js +49 -0
  127. package/dist/framework/memo.d.ts +48 -0
  128. package/dist/framework/memo.js +84 -0
  129. package/dist/framework/overlay.d.ts +49 -0
  130. package/dist/framework/overlay.js +17 -0
  131. package/dist/framework/plan.d.ts +49 -0
  132. package/dist/framework/plan.js +73 -0
  133. package/dist/framework/projections.d.ts +480 -0
  134. package/dist/framework/projections.js +974 -0
  135. package/dist/framework/prop-surface.d.ts +132 -0
  136. package/dist/framework/prop-surface.js +278 -0
  137. package/dist/framework/ref-graph.d.ts +71 -0
  138. package/dist/framework/ref-graph.js +158 -0
  139. package/dist/framework/ref-integrity.d.ts +55 -0
  140. package/dist/framework/ref-integrity.js +171 -0
  141. package/dist/framework/registered.d.ts +95 -0
  142. package/dist/framework/registry-dir.d.ts +42 -0
  143. package/dist/framework/registry-dir.js +48 -0
  144. package/dist/framework/registry.d.ts +300 -0
  145. package/dist/framework/registry.js +104 -0
  146. package/dist/framework/rejection.d.ts +58 -0
  147. package/dist/framework/rejection.js +111 -0
  148. package/dist/framework/rename-inference.d.ts +26 -0
  149. package/dist/framework/rename-inference.js +50 -0
  150. package/dist/framework/render-spec.d.ts +296 -0
  151. package/dist/framework/render-spec.js +809 -0
  152. package/dist/framework/schema-version.d.ts +140 -0
  153. package/dist/framework/schema-version.js +214 -0
  154. package/dist/framework/schemas.d.ts +109 -0
  155. package/dist/framework/schemas.js +615 -0
  156. package/dist/framework/session.d.ts +196 -0
  157. package/dist/framework/session.js +367 -0
  158. package/dist/framework/signature.d.ts +15 -0
  159. package/dist/framework/signature.js +83 -0
  160. package/dist/framework/snapshot.d.ts +115 -0
  161. package/dist/framework/snapshot.js +277 -0
  162. package/dist/framework/source-integrity.d.ts +226 -0
  163. package/dist/framework/source-integrity.js +478 -0
  164. package/dist/framework/sources.d.ts +211 -0
  165. package/dist/framework/sources.js +89 -0
  166. package/dist/framework/utils/compiled-schema.d.ts +23 -0
  167. package/dist/framework/utils/compiled-schema.js +46 -0
  168. package/dist/framework/utils/content-key.d.ts +15 -0
  169. package/dist/framework/utils/content-key.js +33 -0
  170. package/dist/framework/utils/enumerated.d.ts +13 -0
  171. package/dist/framework/utils/enumerated.js +19 -0
  172. package/dist/framework/utils/field-path.d.ts +95 -0
  173. package/dist/framework/utils/field-path.js +136 -0
  174. package/dist/framework/utils/field-schema.d.ts +55 -0
  175. package/dist/framework/utils/field-schema.js +183 -0
  176. package/dist/framework/utils/group.d.ts +37 -0
  177. package/dist/framework/utils/group.js +13 -0
  178. package/dist/framework/utils/package-path.d.ts +37 -0
  179. package/dist/framework/utils/package-path.js +61 -0
  180. package/dist/framework/utils/refs.d.ts +194 -0
  181. package/dist/framework/utils/refs.js +403 -0
  182. package/dist/framework/validate-spec.d.ts +27 -0
  183. package/dist/framework/validate-spec.js +45 -0
  184. package/dist/framework/value-domain.d.ts +26 -0
  185. package/dist/framework/value-domain.js +202 -0
  186. package/dist/framework/views-facade.d.ts +15 -0
  187. package/dist/framework/views-facade.js +19 -0
  188. package/dist/index.d.ts +90 -42
  189. package/dist/index.js +86 -37
  190. package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
  191. package/dist/migrations/2.0.0/raw-css.js +72 -0
  192. package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
  193. package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
  194. package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
  195. package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
  196. package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
  197. package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
  198. package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
  199. package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
  200. package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
  201. package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
  202. package/dist/migrations/index.d.ts +2 -0
  203. package/dist/migrations/index.js +2 -0
  204. package/dist/react-native/style-keys.generated.d.ts +10 -0
  205. package/dist/react-native/style-keys.generated.js +167 -0
  206. package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
  207. package/dist/renderer/RendererErrorBoundary.js +59 -10
  208. package/dist/renderer/UdsRenderer.d.ts +11 -10
  209. package/dist/renderer/UdsRenderer.js +1 -1
  210. package/dist/renderer/assetEntries.d.ts +37 -0
  211. package/dist/renderer/assetEntries.js +39 -0
  212. package/dist/renderer/assetRenderable.d.ts +14 -6
  213. package/dist/renderer/assetRenderable.js +8 -2
  214. package/dist/renderer/componentEntry.d.ts +58 -0
  215. package/dist/renderer/componentEntry.js +71 -0
  216. package/dist/renderer/icon-library.d.ts +20 -0
  217. package/dist/renderer/index.d.ts +7 -7
  218. package/dist/renderer/index.js +5 -5
  219. package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
  220. package/dist/renderer/primitives/SlotRenderer.js +1 -1
  221. package/dist/renderer/runtimeComponent.d.ts +33 -0
  222. package/dist/renderer/runtimeComponent.js +113 -0
  223. package/dist/renderer/spec-content.d.ts +43 -0
  224. package/dist/renderer/spec-content.js +95 -0
  225. package/dist/renderer/wrapRegistry.d.ts +22 -37
  226. package/dist/renderer/wrapRegistry.js +10 -20
  227. package/dist/renderer/wrappers/event-bridge.js +6 -5
  228. package/dist/renderer/wrappers/hex-normalize.js +6 -5
  229. package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
  230. package/dist/renderer/wrappers/html-aliases.js +36 -19
  231. package/dist/renderer/wrappers/inline-styles.js +7 -6
  232. package/dist/spec/asset-jsx.d.ts +18 -5
  233. package/dist/spec/asset-jsx.js +27 -16
  234. package/dist/spec/collapse-text-labels.d.ts +5 -15
  235. package/dist/spec/collapse-text-labels.js +26 -19
  236. package/dist/spec/empty-node-slots.d.ts +56 -34
  237. package/dist/spec/empty-node-slots.js +87 -47
  238. package/dist/spec/index.d.ts +21 -10
  239. package/dist/spec/index.js +21 -10
  240. package/dist/spec/jsxToSpec.d.ts +14 -9
  241. package/dist/spec/jsxToSpec.js +20 -3
  242. package/dist/spec/preview-elements.d.ts +63 -0
  243. package/dist/spec/preview-elements.js +89 -0
  244. package/dist/spec/rewrite-refs.d.ts +58 -0
  245. package/dist/spec/rewrite-refs.js +250 -0
  246. package/dist/spec/specToJsx.js +18 -29
  247. package/dist/tsconfig.tsbuildinfo +1 -1
  248. package/package.json +39 -52
  249. package/dist/AssetGroup.d.ts +0 -77
  250. package/dist/AssetGroup.js +0 -125
  251. package/dist/Component.d.ts +0 -333
  252. package/dist/Component.js +0 -1061
  253. package/dist/ComponentGroup.d.ts +0 -22
  254. package/dist/ComponentGroup.js +0 -51
  255. package/dist/CompositeStyle.d.ts +0 -30
  256. package/dist/CompositeStyle.js +0 -59
  257. package/dist/Config.d.ts +0 -528
  258. package/dist/Config.js +0 -1712
  259. package/dist/Mode.d.ts +0 -41
  260. package/dist/Mode.js +0 -81
  261. package/dist/Modifier.d.ts +0 -51
  262. package/dist/Modifier.js +0 -97
  263. package/dist/MotionDef.d.ts +0 -81
  264. package/dist/MotionDef.js +0 -212
  265. package/dist/Props.d.ts +0 -332
  266. package/dist/Props.js +0 -35
  267. package/dist/Provider.d.ts +0 -20
  268. package/dist/Provider.js +0 -14
  269. package/dist/StyleProp.d.ts +0 -145
  270. package/dist/StyleProp.js +0 -239
  271. package/dist/Token.d.ts +0 -76
  272. package/dist/Token.js +0 -133
  273. package/dist/TokenGroup.d.ts +0 -33
  274. package/dist/TokenGroup.js +0 -69
  275. package/dist/asset-kind.d.ts +0 -55
  276. package/dist/asset-kind.js +0 -29
  277. package/dist/asset-value.d.ts +0 -23
  278. package/dist/asset-value.js +0 -40
  279. package/dist/brands.d.ts +0 -30
  280. package/dist/brands.js +0 -20
  281. package/dist/captureCallerPath.d.ts +0 -48
  282. package/dist/captureCallerPath.js +0 -95
  283. package/dist/colorExpressions.d.ts +0 -131
  284. package/dist/colorExpressions.js +0 -148
  285. package/dist/component-referrers.d.ts +0 -30
  286. package/dist/component-referrers.js +0 -40
  287. package/dist/config-diagnostics.d.ts +0 -21
  288. package/dist/config-diagnostics.js +0 -12
  289. package/dist/defineAssetGroup.d.ts +0 -200
  290. package/dist/defineAssetGroup.js +0 -323
  291. package/dist/defineProvider.d.ts +0 -29
  292. package/dist/defineProvider.js +0 -60
  293. package/dist/element-marker.d.ts +0 -63
  294. package/dist/element-marker.js +0 -113
  295. package/dist/entity-utils.d.ts +0 -56
  296. package/dist/entity-utils.js +0 -105
  297. package/dist/extension.d.ts +0 -55
  298. package/dist/extension.js +0 -214
  299. package/dist/factories.d.ts +0 -863
  300. package/dist/factories.js +0 -475
  301. package/dist/font-face.d.ts +0 -25
  302. package/dist/font-face.js +0 -72
  303. package/dist/foreign-component-name.d.ts +0 -21
  304. package/dist/foreign-component-name.js +0 -42
  305. package/dist/interpolate.d.ts +0 -20
  306. package/dist/interpolate.js +0 -10
  307. package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
  308. package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
  309. package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
  310. package/dist/jsx/jsx-dev-runtime.js +0 -11
  311. package/dist/jsx/jsx-runtime.d.ts +0 -48
  312. package/dist/jsx/jsx-runtime.js +0 -305
  313. package/dist/linked-system-pins.d.ts +0 -30
  314. package/dist/linked-system-pins.js +0 -45
  315. package/dist/linkedNodePrefixes.d.ts +0 -73
  316. package/dist/linkedNodePrefixes.js +0 -99
  317. package/dist/markers.d.ts +0 -235
  318. package/dist/markers.js +0 -70
  319. package/dist/motion-constants.d.ts +0 -37
  320. package/dist/motion-constants.js +0 -61
  321. package/dist/native/NativeConfig.d.ts +0 -56
  322. package/dist/native/NativeConfig.js +0 -162
  323. package/dist/native/assets.d.ts +0 -20
  324. package/dist/native/assets.js +0 -17
  325. package/dist/native/components.d.ts +0 -139
  326. package/dist/native/components.js +0 -67
  327. package/dist/native/index.d.ts +0 -18
  328. package/dist/native/index.js +0 -17
  329. package/dist/native/modes.d.ts +0 -10
  330. package/dist/native/modes.js +0 -11
  331. package/dist/native/types.d.ts +0 -95
  332. package/dist/native/types.js +0 -0
  333. package/dist/native/validation.d.ts +0 -8
  334. package/dist/native/validation.js +0 -885
  335. package/dist/native/values.d.ts +0 -7
  336. package/dist/native/values.js +0 -15
  337. package/dist/native.d.ts +0 -12
  338. package/dist/native.js +0 -10
  339. package/dist/refs.d.ts +0 -204
  340. package/dist/refs.js +0 -129
  341. package/dist/registry-aliases.d.ts +0 -33
  342. package/dist/registry-aliases.js +0 -35
  343. package/dist/registry-dir.d.ts +0 -22
  344. package/dist/registry-dir.js +0 -10
  345. package/dist/renderer/makeRegistry.d.ts +0 -34
  346. package/dist/renderer/makeRegistry.js +0 -52
  347. package/dist/renderer/makeUdsRenderer.d.ts +0 -13
  348. package/dist/renderer/makeUdsRenderer.js +0 -51
  349. package/dist/renderer/wrappers/component-slots.d.ts +0 -41
  350. package/dist/renderer/wrappers/component-slots.js +0 -66
  351. package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
  352. package/dist/renderer/wrappers/slot-resolution.js +0 -68
  353. package/dist/renderer/wrappers/void-elements.d.ts +0 -37
  354. package/dist/renderer/wrappers/void-elements.js +0 -40
  355. package/dist/spec/layer-props.d.ts +0 -52
  356. package/dist/spec/layer-props.js +0 -149
  357. package/dist/spec/preview-controls.d.ts +0 -44
  358. package/dist/spec/preview-controls.js +0 -139
  359. package/dist/spec/slot-refs.d.ts +0 -39
  360. package/dist/spec/slot-refs.js +0 -56
  361. package/dist/token-override-rows.d.ts +0 -68
  362. package/dist/token-override-rows.js +0 -233
  363. package/dist/tokenValueType.d.ts +0 -34
  364. package/dist/tokenValueType.js +0 -138
  365. package/dist/types/css-properties.d.ts +0 -233
  366. package/dist/types/css-properties.js +0 -14
  367. package/dist/types/css-property-keywords.d.ts +0 -156
  368. package/dist/types/css-property-keywords.js +0 -616
  369. package/dist/types/css-values.d.ts +0 -63
  370. package/dist/types/css-values.js +0 -16
  371. package/dist/types.d.ts +0 -1138
  372. package/dist/types.js +0 -12
  373. package/dist/units.d.ts +0 -14
  374. package/dist/units.js +0 -16
  375. package/dist/utils/index.d.ts +0 -4
  376. package/dist/utils/index.js +0 -4
package/dist/types.d.ts DELETED
@@ -1,1138 +0,0 @@
1
- import { AssetRef, ComponentName, ComponentRef as ComponentRef$1, CompositeRef, ModeRef, TagRef, TokenGroupRef, TokenRef } from "./refs.js";
2
- import { ColorExpression } from "./colorExpressions.js";
3
- import { MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_JS_DRAG_AXES, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_TRANSITION_TYPES } from "./motion-constants.js";
4
- import { CssPropertyName, CssPropertyValues } from "./types/css-properties.js";
5
- import { IconAssetMetadata } from "./defineAssetGroup.js";
6
- import { ComponentRef, ComponentType, JSX } from "react";
7
- import { EntityKind } from "@yahoo/uds-create-types/entity";
8
-
9
- //#region src/types.d.ts
10
- /**
11
- * CSS value-type names used to tag a token. The scaffold leaves the
12
- * union open so token-type tightening (a closed CSS-value-type union)
13
- * lands as a follow-up — needs to ship with type-narrowing on
14
- * `defineStyleProp({ values: ... })` to be useful.
15
- */
16
- type TokenType = string;
17
- /**
18
- * What a token's `value` can hold:
19
- *
20
- * - A literal — `string` (`'#1167f4'`, `'1rem'`), `number`, `boolean`.
21
- * - A `token('ns/name')` marker pointing at another token.
22
- * - A structured `ColorExpression` — `mix(...)`, `alpha(...)`,
23
- * `linearGradient(...)`, `radialGradient(...)`. Codegen resolves the
24
- * expression to a CSS function call (`color-mix(...)`,
25
- * `linear-gradient(...)`) via `resolveColorExpression`.
26
- */
27
- type TokenValue = string | number | boolean | TokenRef | AssetRef | ColorExpression;
28
- type TokenModifierKey = `_${string}`;
29
- /**
30
- * Platform-neutral authored token definition. Web and native configs share
31
- * the definition envelope (value, type, link provenance, and nested modifier
32
- * overrides) while supplying their own supported value union.
33
- */
34
- type TokenDefinitionFor<TValue> = {
35
- value: TValue;
36
- type?: TokenType; /** Set when this token is linked from another system — see {@link SystemLink}. */
37
- link?: SystemLink;
38
- } & { [K in `_${string}`]?: TValue | TokenDefinitionFor<TValue> };
39
- type TokenModifierValue = TokenValue | TokenDefinition;
40
- /**
41
- * Provenance marker on an entity linked from another system: it records where
42
- * the definition came from, not what it is (the definition itself is inlined
43
- * alongside). Present only on linked entities — `undefined` means local.
44
- *
45
- * Deliberately an enumerable field rather than a non-enumerable slot like
46
- * `__sourcePath`: the marker has to survive `JSON.stringify` so a config that
47
- * round-trips through storage still knows which entities are linked, and unlike
48
- * a source path it can't be recomputed on load.
49
- *
50
- * The local key is the entity's key in its own map, so it isn't repeated here;
51
- * `sourceKey` is the key in the source system, and the two differ on rename.
52
- *
53
- * `kind` is the kind of the entity this marker sits on, which is not always the
54
- * kind of the patch that created it. The link contract is entity-to-entity, so a
55
- * group-level link is a bulk instruction: a `link-create` with
56
- * `kind: 'token-group'` spreads to a marker on every token in that group, each
57
- * carrying `kind: 'token'`. A token group therefore never holds a marker itself.
58
- */
59
- interface SystemLink {
60
- kind: EntityKind;
61
- /** Source system's database UUID — the pin's identity. */
62
- systemId: string;
63
- /** Exact published version of the source system (`'1.3.1'`). */
64
- systemVersion: string;
65
- /** The entity's key in the source system. */
66
- sourceKey: string;
67
- }
68
- /**
69
- * Sparse override applied to a linked component via `.extend(patch)` — a
70
- * recursive merge-patch (RFC 7396 semantics) over the definition's
71
- * non-structural fields. Objects merge key-by-key, scalars and arrays
72
- * replace, `null` deletes the key. `layers`, `ref`, `link`, and `extension`
73
- * are never extendable.
74
- */
75
- type ComponentExtension = Record<string, unknown>;
76
- /**
77
- * Provenance for an applied extension, stored enumerably on the definition
78
- * beside `link` so it survives serialization. `payload` is the authored
79
- * patch (intent — replayable against an updated source); `inverse` is the
80
- * merge-engine-computed patch that restores the pre-extension definition,
81
- * which is what makes post-merge update/delete possible.
82
- */
83
- interface ComponentExtensionRecord {
84
- payload: ComponentExtension;
85
- inverse: ComponentExtension;
86
- }
87
- /**
88
- * Authored shape for one token. Modifier values live as flat `_${key}`
89
- * properties on the same object — matches the doc's example
90
- * `{ value: '#1167f4', _dark: '#88bcfb' }` and the wire format.
91
- *
92
- * `Token` normalizes flat keys into a `modifiers` map at construction
93
- * time so consumers reading the class instance work with the
94
- * doc-described class shape.
95
- */
96
- type TokenDefinition = TokenDefinitionFor<TokenValue>;
97
- /**
98
- * Authored shape — the bare tokens record. Mirrors the old `@yahoo/uds-create-config`
99
- * `defineTokenGroup(tokens)` signature: input is the tokens map; group
100
- * metadata (label / description) is attached separately via the
101
- * registration call, not nested under a wrapper.
102
- */
103
- /**
104
- * A token group: a tokens record + optional Studio-facing metadata.
105
- * Mirrors main's `TokenGroupDef`. The parent record key in
106
- * `registerTokenGroups({...})` carries the namespace, so it doesn't
107
- * appear here. Tokens nest under `tokens` so a token named `'label'`
108
- * (or any meta key) can never collide with group metadata.
109
- */
110
- interface TokenGroupDefinitionFor<TDefinition> {
111
- tokens: Record<string, TDefinition>;
112
- label?: string;
113
- description?: string;
114
- }
115
- type TokenGroupDefinition = TokenGroupDefinitionFor<TokenDefinition>;
116
- /**
117
- * Alias for the on-disk wire shape — structurally identical to
118
- * `TokenGroupDefinition`. Used as the return type of
119
- * `TokenGroup.toJSON()` so the serialization intent reads at call
120
- * sites; consumers reading `config.json` see `SerializedTokenGroup`,
121
- * authors writing `registerTokenGroups` see `TokenGroupDefinition`.
122
- */
123
- type SerializedTokenGroup = TokenGroupDefinition;
124
- interface ModifierDefinition {
125
- selector?: string | CompositeRef | ModeRef;
126
- media?: string;
127
- description?: string;
128
- }
129
- interface ModeOptionDefinition {
130
- /**
131
- * Modifier the option contributes. Defaults to `_${optionName}` —
132
- * `colorMode: { options: { light: {...}, dark: {...} } }` produces
133
- * modifiers `_light` and `_dark` without restating them. Override
134
- * when the option name and the desired modifier should differ.
135
- */
136
- modifier?: TokenModifierKey;
137
- label?: string;
138
- description?: string;
139
- /**
140
- * CSS selector text the option produces — for `colorMode/dark`,
141
- * `'.dark'` so consumers can write `<html class="dark">` and have
142
- * the dark-mode tokens apply. Mirrors the old
143
- * `@yahoo/uds-create-config` `ModeOptionInput.css` field name.
144
- */
145
- css?: string;
146
- media?: string;
147
- }
148
- type ModeDefinition = Record<string, ModeOptionDefinition>;
149
- type CompositeStyleObject = Record<string, unknown>;
150
- interface CompositeStyleDefinition {
151
- label: string;
152
- description?: string;
153
- /**
154
- * Named style variants keyed by variant name. Mirrors the old
155
- * `@yahoo/uds-create-config` `defineCompositeStyle({ styles })` field name —
156
- * authors write `styles: { sm: {...}, md: {...} }`.
157
- */
158
- styles: Record<string, CompositeStyleObject>;
159
- /**
160
- * Provenance when this composite is linked from another system; `undefined`
161
- * for local ones. Sits at the composite level, not per variant: a variant
162
- * isn't a registerable entity (no `EntityKind`, no key in
163
- * `Config.compositeStyles`, no dimension in `dependentsOf`), and components
164
- * bind the whole group through one `composite()` prop — so a per-variant
165
- * marker would have no referrer or CSS expression. Contrast a token group,
166
- * which holds no marker precisely because its members ARE the entities.
167
- */
168
- link?: SystemLink;
169
- }
170
- /**
171
- * Any CSS property name `defineStyleProp` can target. Standard
172
- * property names come from the `CssPropertyValues` registry; custom
173
- * CSS properties (`--*`) are open template strings.
174
- */
175
- type StylePropProperty = CssPropertyName | `--${string}`;
176
- /**
177
- * Literal-keyword subset accepted by a CSS property. For standard
178
- * properties, falls out of `CssPropertyValues[P]`. For custom CSS
179
- * properties (`--*`), open string — narrowing happens via the
180
- * `cssType` field on the style-prop spec.
181
- */
182
- type LiteralFor<P extends StylePropProperty> = [P] extends [CssPropertyName] ? Extract<CssPropertyValues[P], string> : string;
183
- /**
184
- * Author-friendly alias for a CSS keyword. `alias` is what the JSX
185
- * value site uses (`flexDirection="col"`); `value` is the underlying
186
- * CSS the prop resolves to.
187
- *
188
- * - `string` — a single CSS keyword (`'column'`).
189
- * - `Record<string, string>` — a multi-property emission, used to
190
- * write vendor-prefixed pairs (`{ '-webkit-user-select': 'none',
191
- * 'user-select': 'none' }`) so a single utility class sets both at
192
- * once and matches Tailwind's built-in body byte-for-byte (avoids
193
- * cascade overrides).
194
- *
195
- * `value` is kept un-narrowed here — per-property narrowing via
196
- * `LiteralFor<P>` would explode the union across every CSS property
197
- * and hit TS's "too complex" limit.
198
- */
199
- interface ValueAlias {
200
- alias: string | boolean | number;
201
- value: string | Record<string, string>;
202
- }
203
- /**
204
- * A single entry in a style-prop's `values` array. Narrowed against
205
- * the chosen `cssProperty` so authoring sites like
206
- * `values: ['banana']` on a `border-color` prop error at compile time.
207
- *
208
- * - `TokenGroupRef` — pulls every token in the named namespace
209
- * into the prop's accepted value set.
210
- * - `LiteralFor<P>` — a CSS keyword the property accepts per spec
211
- * (e.g. `'transparent'` for `border-color`).
212
- * - `number` — bare numeric values where CSS itself accepts numbers
213
- * (e.g. `line-clamp: 3`).
214
- * - `boolean` — a toggle value. `true` emits the bare class prefix as a
215
- * hook (the runtime `boolAlias` path), `false` emits nothing (off);
216
- * combine with string entries for a `boolean | 'first' | 'last'`-style
217
- * surface (e.g. `nestedBorderRadius`). The accompanying `cssProperty`
218
- * is typically a custom property used only as the class carrier.
219
- * - `ValueAlias<P>` — `{ alias, value }` pair for Tailwind-style
220
- * shorthands; the alias appears at the JSX value site and resolves
221
- * to the underlying CSS keyword at emit time.
222
- */
223
- type ValuesEntry<P extends StylePropProperty = StylePropProperty> = TokenGroupRef | LiteralFor<P> | number | boolean | ValueAlias;
224
- interface ArbitrarySpec {
225
- type?: TokenType;
226
- }
227
- /**
228
- * One entry in a multi-shape `arbitrary` array. `toCss` lets the prop
229
- * coerce a runtime value into the actual CSS string (e.g. wrapping a
230
- * raw `'1px'` in `var(--...)` or stitching multi-property output). The
231
- * `regex` variant accepts any string matching a pattern instead of
232
- * binding to a named value type.
233
- */
234
- type ArbitraryEntry = {
235
- type: TokenType;
236
- toCss?: (value: unknown) => string;
237
- } | {
238
- type: 'regex';
239
- pattern: RegExp;
240
- toCss?: (value: string) => string;
241
- };
242
- /**
243
- * Author-time shape for `arbitrary`. Four forms:
244
- * - `true` — accept any bracketed value, passed through verbatim into the
245
- * prop's `cssProperty` (`arbitrary: true` → `blur="[blur(6px)]"` →
246
- * `filter: blur(6px)`). Use when the bracket already carries the full CSS
247
- * value and needs no data-type validation or transform.
248
- * - bare `TokenType` string (`arbitrary: 'length-percentage'`) —
249
- * shorthand for `{ type: ... }`.
250
- * - `ArbitrarySpec` object (`arbitrary: { type: 'color' }`).
251
- * - `ArbitraryEntry[]` for multi-shape props that accept several
252
- * value-type variants (e.g. `grid-template-rows` taking integers,
253
- * length-percentages, and full track lists).
254
- * Normalized at `StyleProp` construction time (`true` → `{}`).
255
- */
256
- type ArbitraryInput = boolean | TokenType | ArbitrarySpec | readonly ArbitraryEntry[];
257
- /**
258
- * Authored shape attached by `defineStyleProp(spec).withOpacity({...})`.
259
- * Declares a paired opacity sibling style-prop: the parent emits
260
- * `${classPrefix}-${tokenName}` for the bare value AND
261
- * `${classPrefix}-${tokenName}${separator}${opacityValue}` when the
262
- * sibling prop is set. The sibling itself is registered alongside the
263
- * parent at `registerStyleProps` time.
264
- *
265
- * `ref` (deprecated alias for `as`) is kept for back-compat with sites
266
- * that read the opacity pair as `{ ref }` — codegen's `extractClasses.ts`
267
- * checks `opacityPair.ref` directly.
268
- */
269
- interface OpacityPairSpec {
270
- /** JSX-prop name for the opacity sibling (e.g. `'bgOpacity'`). */
271
- as: string;
272
- /** Token group the opacity sibling pulls values from. */
273
- values: TokenGroupRef;
274
- /**
275
- * Class-name separator between the parent's token suffix and the
276
- * opacity value. Defaults to `'_'`. Pass `'/'` for Tailwind-flavored
277
- * output (`bg-primary/75`).
278
- */
279
- separator?: string;
280
- /** Back-compat alias of `as`. New code should use `as`. */
281
- ref?: string;
282
- }
283
- /**
284
- * Authoring metadata attached via `defineStyleProp(spec).metadata({...})`.
285
- * Consumed by codegen prompt artifacts and Studio's UI. Kept open
286
- * (`Readonly<Record<string, unknown>>`) — `label` / `description` are
287
- * the conventional fields but the slot doesn't enforce.
288
- */
289
- type StylePropMetadata = Readonly<Record<string, unknown>>;
290
- /**
291
- * Authoring metadata attached via
292
- * `defineComponent(...).config(...).metadata({...})`. `description`
293
- * shows up in codegen's AI prompt artifact next to the component name;
294
- * `events` lists React/HTML event handler names the component supports
295
- * (`'focus'`, `'press'`, etc.) — when unset, the synthesizer falls
296
- * back to the standard React event roster. `deprecated` keeps a component
297
- * out of the AI prompt artifact while leaving it registered and renderable.
298
- */
299
- interface ComponentMetadata {
300
- /**
301
- * Human-facing display name for Studio's palette. Defaults to the
302
- * component's registered name when absent. Lets two components present
303
- * the same label (e.g. both "Badge") while keeping distinct, stable
304
- * identities (`uds:Badge` vs `uds:StudioBadge`) — identity stays the
305
- * registered name, never this label.
306
- */
307
- readonly label?: string;
308
- readonly description?: string;
309
- readonly events?: readonly string[];
310
- /**
311
- * Marks the component as deprecated. Deprecated components are omitted
312
- * from codegen's AI prompt artifact so the model won't reach for them in
313
- * new work — they remain fully registered and renderable everywhere else.
314
- */
315
- readonly deprecated?: boolean;
316
- }
317
- /**
318
- * Authored shape for `defineStyleProp`. `P` is the CSS property name
319
- * (or names, when `cssProperty` is an array of side-shorthand props)
320
- * — `values` narrows against `LiteralFor<P>` so unsupported keywords
321
- * surface at the authoring site.
322
- *
323
- * No default for `P`: the wide case would force TypeScript to
324
- * materialize `Extract<CssPropertyValues[CssPropertyName], string>`
325
- * (a giant union) at every reference site. Wide-typed consumers
326
- * (`Config.styleProps`, the wire format) use `AnyStylePropDefinition`
327
- * instead.
328
- */
329
- interface StylePropDefinition<P extends StylePropProperty> {
330
- cssProperty: P | readonly P[];
331
- classPrefix: string;
332
- /**
333
- * Token-group refs + literal keywords + bare numbers the prop accepts.
334
- * Optional — `values: []` (or omitting it) is meaningful for props
335
- * that only take arbitrary `[...]` escape values (e.g. `motion`).
336
- */
337
- values?: readonly ValuesEntry<P>[];
338
- arbitrary?: ArbitraryInput;
339
- /**
340
- * Marks the prop as emitting a *negative* value: the resolved token or
341
- * arbitrary value is wrapped in `calc(<value> * -1)` at emit time, so
342
- * `offsetTop="3"` (a `negative` prop) paints
343
- * `margin-top: calc(var(--uds-spacing-3) * -1)`. This flag is the single
344
- * source of negativity — both the build-time emitter (`prepareCss`) and
345
- * the runtime injector (`renderGetStyles`) read it, replacing the old
346
- * `classPrefix.startsWith('-')` heuristic. It's also the structured signal
347
- * the MCP / AI guidance / spec lint use to identify overlap-prone props.
348
- *
349
- * Negative props conventionally still use a `-`-led `classPrefix` (`-mt`)
350
- * so the utility reads as a Tailwind negative class (`.-mt-3`) and stays
351
- * distinct from a positive sibling (`marginTop` → `.mt-3`) — but the prefix
352
- * only *names* the class; this flag *drives* the negation.
353
- */
354
- negative?: boolean;
355
- cssType?: TokenType;
356
- metadata?: StylePropMetadata;
357
- opacityPair?: OpacityPairSpec;
358
- /**
359
- * Optional value coercion the renderer applies after token resolution.
360
- * Takes the resolved value (number for bare-numeric tokens, string
361
- * otherwise) and returns the final CSS string. Lets props like
362
- * `gridTemplateColumns` accept `12` and emit
363
- * `repeat(12, minmax(0, 1fr))`.
364
- */
365
- transform?: (value: string | number) => string;
366
- }
367
- /**
368
- * Wide structural shape used by `Config.registerStyleProps` and the
369
- * `StyleProp` class storage. Any concretely-narrowed
370
- * `StylePropDefinition<P>` is assignable to this. `values` is the
371
- * un-narrowed marker/literal/number union — runtime treats every
372
- * entry uniformly, so the narrowing in `StylePropDefinition<P>` is
373
- * purely an authoring-time check.
374
- */
375
- interface AnyStylePropDefinition {
376
- cssProperty: StylePropProperty | readonly StylePropProperty[];
377
- classPrefix: string;
378
- values?: readonly (TokenGroupRef | string | number | boolean | ValueAlias)[];
379
- arbitrary?: ArbitraryInput;
380
- /** See {@link StylePropDefinition.negative} — emit `calc(<value> * -1)`. */
381
- negative?: boolean;
382
- cssType?: TokenType;
383
- metadata?: StylePropMetadata;
384
- opacityPair?: OpacityPairSpec;
385
- transform?: (value: string | number) => string;
386
- }
387
- type MotionKeyframes = Record<string, Record<string, unknown>>;
388
- /**
389
- * Author-side metadata for a registered motion preset, supplied via
390
- * `defineMotion({...}).metadata({...})`. `label` names the preset in Studio's
391
- * motion picker; `description` rides into codegen's AI prompt artifact so the
392
- * model can pick the right preset. Mirrors {@link TokenGroupMetadata}: the
393
- * `.metadata({...})` chain lands `label` / `description` as top-level fields on
394
- * the definition, which round-trip through `MotionDef.toJSON` / `fromJSON`.
395
- */
396
- interface MotionMetadata {
397
- readonly label?: string;
398
- readonly description?: string;
399
- }
400
- interface MotionTransition {
401
- /** How the value moves — {@link MOTION_JS_TRANSITION_TYPES}. */
402
- type?: (typeof MOTION_JS_TRANSITION_TYPES)[number];
403
- duration?: number | string;
404
- delay?: number | string;
405
- ease?: string | readonly number[];
406
- /** Repeat count (framer `repeat`). */
407
- repeat?: number;
408
- /** How each repeat plays — {@link MOTION_JS_REPEAT_TYPES}. */
409
- repeatType?: (typeof MOTION_JS_REPEAT_TYPES)[number];
410
- repeatDelay?: number;
411
- stiffness?: number;
412
- damping?: number;
413
- mass?: number;
414
- bounce?: number;
415
- velocity?: number;
416
- [key: string]: unknown;
417
- }
418
- interface MotionStateKeyframe {
419
- [key: string]: unknown;
420
- }
421
- /**
422
- * A time-ish CSS motion value: a raw string (`'300ms'`), a number (seconds), or
423
- * a `token('...')` ref resolved to a `var(...)` at build time — so durations and
424
- * easings stay token-aware like every other config value, not raw literals.
425
- */
426
- type MotionCssValue = string | number | TokenRef;
427
- /** Per-side box a framer drag prop accepts (`dragConstraints`/`dragElastic`). */
428
- type MotionDragBox = Partial<Record<'top' | 'right' | 'bottom' | 'left', number>>;
429
- /**
430
- * Named animation targets a JS motion can animate between, keyed by variant
431
- * name (framer's `Variants`). `initial`/`animate`/`while*` may reference a
432
- * variant by name (a `string`) instead of an inline keyframe.
433
- */
434
- type MotionVariants = Record<string, MotionStateKeyframe>;
435
- /** A JS-motion state: inline keyframes or the name of a declared variant. */
436
- type MotionState = MotionStateKeyframe | string;
437
- /** `whileInView` viewport options (framer's `ViewportOptions`). */
438
- interface MotionViewportOptions {
439
- once?: boolean;
440
- margin?: string;
441
- amount?: number | 'some' | 'all';
442
- }
443
- /**
444
- * The CSS timing/playback surface shared by a registered CSS motion
445
- * ({@link CssMotionDefinition}) and an inline CSS slot motion
446
- * ({@link CssSlotMotion}). No `keyframes` here — a definition requires them
447
- * while a slot motion doesn't, so each declares its own.
448
- */
449
- interface CssMotionFields {
450
- transition?: MotionTransition;
451
- /**
452
- * Timing / playback knobs folded into the emitted `animation: …` declaration
453
- * alongside the keyframes. No `animation` prefix — it's redundant inside a
454
- * motion def, and these are motion-def config, not registered style props.
455
- * Explicitly typed (not an open index signature) so they autocomplete, reject
456
- * typos, and accept `token(...)` refs where a value can be tokenized
457
- * (duration / timing-function / delay).
458
- */
459
- duration?: MotionCssValue;
460
- timingFunction?: string | TokenRef;
461
- delay?: MotionCssValue;
462
- iterationCount?: number | 'infinite';
463
- direction?: (typeof MOTION_CSS_DIRECTIONS)[number];
464
- fillMode?: (typeof MOTION_CSS_FILL_MODES)[number];
465
- playState?: (typeof MOTION_CSS_PLAY_STATES)[number];
466
- /** `'none'` disables the animation under `prefers-reduced-motion: reduce`. */
467
- reducedMotion?: 'none';
468
- }
469
- interface CssMotionDefinition extends CssMotionFields {
470
- runtime: 'css';
471
- keyframes: MotionKeyframes;
472
- /** Author-side label — see {@link MotionMetadata}. */
473
- label?: string;
474
- /** Author-side description — see {@link MotionMetadata}. */
475
- description?: string;
476
- }
477
- /**
478
- * The framer-motion `motion`-prop surface shared by a registered JS motion
479
- * ({@link JsMotionDefinition}) and an inline JS slot motion
480
- * ({@link JsSlotMotion}) — a preset and an inline motion accept the same
481
- * fields; they differ only in whether `runtime` is required. Typed to the
482
- * config-serializable subset of framer's API: no element `ref` constraints or
483
- * event callbacks, which can't round-trip through JSON.
484
- */
485
- interface JsMotionFields {
486
- /** Named targets `initial`/`animate`/`while*` may reference by name. */
487
- variants?: MotionVariants;
488
- initial?: MotionState | boolean;
489
- animate?: MotionState;
490
- /**
491
- * Exit keyframes — applied when the host element unmounts. Requires
492
- * the consumer to render the slot conditionally so the JS runtime
493
- * (`motion/react`'s `<AnimatePresence>`) can play the exit before the
494
- * node detaches.
495
- */
496
- exit?: MotionState;
497
- transition?: MotionTransition;
498
- /** Keyframes applied while the element is hovered. */
499
- whileHover?: MotionState;
500
- /** Keyframes applied while the element is actively pressed. */
501
- whileTap?: MotionState;
502
- /** Keyframes applied while the element holds keyboard focus. */
503
- whileFocus?: MotionState;
504
- /** Keyframes applied while the element is being dragged. */
505
- whileDrag?: MotionState;
506
- /** Keyframes applied while the element is in the viewport. */
507
- whileInView?: MotionState;
508
- viewport?: MotionViewportOptions;
509
- drag?: boolean | (typeof MOTION_JS_DRAG_AXES)[number];
510
- dragConstraints?: boolean | MotionDragBox;
511
- dragElastic?: boolean | number | MotionDragBox;
512
- dragMomentum?: boolean;
513
- dragSnapToOrigin?: boolean;
514
- dragPropagation?: boolean;
515
- dragDirectionLock?: boolean;
516
- dragTransition?: MotionTransition;
517
- layout?: boolean | (typeof MOTION_JS_LAYOUT_MODES)[number];
518
- layoutId?: string;
519
- layoutDependency?: string | number;
520
- }
521
- interface JsMotionDefinition extends JsMotionFields {
522
- runtime: 'js';
523
- /** Author-side label — see {@link MotionMetadata}. */
524
- label?: string;
525
- /** Author-side description — see {@link MotionMetadata}. */
526
- description?: string;
527
- }
528
- type MotionDefinitionInput = CssMotionDefinition | JsMotionDefinition;
529
- /**
530
- * Layer-with-overrides shape — the old `@yahoo/uds-create-config` authoring form
531
- * where a layer carries its tag and its per-layer overrides
532
- * (`defaultProps`, `base`, etc.) inline. Codegen reads `tag` to set
533
- * the layer's element and the remaining fields contribute to the
534
- * layer's emitted styles. Used in tests + legacy configs; the
535
- * structured marker forms (`tag('div')` etc.) are preferred for new
536
- * code because they round-trip cleanly through JSON.
537
- */
538
- interface LayerWithOverrides {
539
- tag: string | TagRef | ComponentRef$1;
540
- defaultProps?: Record<string, unknown>;
541
- base?: Record<string, unknown>;
542
- [key: string]: unknown;
543
- }
544
- /**
545
- * What can appear as a layer's value in `defineComponent`'s `layers`
546
- * map. Five authoring forms:
547
- *
548
- * - bare tag name string — `'div'`, `'span'`. The old `@yahoo/uds-create-config`
549
- * layer syntax; `Component` normalizes to a `TagRef` at construction.
550
- * - `TagRef` — `tag('div')` marker form (equivalent to the bare
551
- * string; both produce the same on-disk shape).
552
- * - `ComponentRef` — string-keyed reference to a registered
553
- * component (`component('Box')`).
554
- * - `ComponentDefinition` value — the registered component itself
555
- * (`{ root: Box, trigger: Pressable }`). Identity-keyed; codegen
556
- * resolves it back to a component name via its
557
- * `configToName` reverse map at type-narrowing + class-extraction
558
- * time. Permits ergonomic `.layers({ root: Box })` authoring.
559
- * - `LayerWithOverrides` — `{ tag, defaultProps?, base?, ... }`. The
560
- * old layer-with-overrides shape; `Component` lifts `tag` onto
561
- * `Layer.tag` and leaves the remaining fields on the layer entry
562
- * for codegen to read.
563
- */
564
- type LayerInput = string | TagRef | ComponentRef$1 | ComponentDefinition | LayerWithOverrides;
565
- type BaseStyles = Record<string, Record<string, unknown>>;
566
- interface CompoundPropsEntry {
567
- when: Record<string, unknown>;
568
- layers: Record<string, unknown>;
569
- }
570
- /**
571
- * JS-runtime inline slot motion — a `motion/react` config the component
572
- * carries inline and codegen spreads onto the hoisted `motion.create`
573
- * wrapper. Shares {@link JsMotionFields} with a `registerMotion({ runtime:
574
- * 'js' })` preset (identical field set); the only difference is that
575
- * `runtime` is optional here (absent ⇒ JS).
576
- */
577
- interface JsSlotMotion extends JsMotionFields {
578
- readonly runtime?: 'js';
579
- }
580
- /**
581
- * CSS-runtime inline slot motion — mirrors the timing/playback knobs of a
582
- * `registerMotion({ runtime: 'css' })` definition via the shared
583
- * {@link CssMotionFields}, so an inline CSS motion emits an `animation: …`
584
- * declaration from its own keyframes instead of pulling in `motion/react`.
585
- */
586
- interface CssSlotMotion extends CssMotionFields {
587
- readonly runtime: 'css';
588
- readonly keyframes?: MotionKeyframes;
589
- }
590
- /**
591
- * Per-layer motion spec a component carries inline, discriminated on
592
- * `runtime`. Absent/`'js'` → {@link JsSlotMotion} (framer-motion config);
593
- * `'css'` → {@link CssSlotMotion} (emitted `animation` declaration). Codegen
594
- * branches on `runtime` and passes the value through to the runtime renderer.
595
- */
596
- type SlotMotion = JsSlotMotion | CssSlotMotion;
597
- /**
598
- * Component-level motion field. Three shapes:
599
- * - `string` — alias of a `registerMotion({...})` preset.
600
- * - `{ runtime, ... }` — inline `SlotMotion` applied to the root.
601
- * - `Record<string, SlotMotion>` — per-layer record keyed by layer
602
- * name (`{ icon: {...}, menu: {...} }`); each layer animates
603
- * independently with its own framer config.
604
- */
605
- type ComponentMotionValue = string | SlotMotion | Record<string, SlotMotion>;
606
- type PropBinding = unknown;
607
- /**
608
- * Extract the literal HTML tag from a `layers` map when it can be read
609
- * statically. Returns the bare-tag literal (`'a' | 'div' | ...`) when:
610
- *
611
- * - `layers.root` is a bare tag string (`'a'`),
612
- * - `layers.root` is a `TagRef<'a'>` marker,
613
- * - `layers.root` is a `LayerWithOverrides` (`{ tag: 'a', ... }`) where
614
- * `tag` is a bare string or `TagRef`, or
615
- * - `layers.root` is a value-extend wrapper carrying its own captured
616
- * root tag (recurses one level so `defineComponent(Box)` inherits
617
- * Box's `'div'` root tag).
618
- *
619
- * Returns `undefined` when `layers.root` is a value-extend wrapper
620
- * without a captured tag, or when the field is absent. `Props<T>`
621
- * reads this and substitutes `ComponentPropsWithRef<TTag>` for the
622
- * generic `HTMLAttributes<HTMLElement>` when narrowable.
623
- */
624
- type RootTag<TLayers> = TLayers extends {
625
- root: infer R;
626
- } ? R extends string ? R : R extends {
627
- __kind: 'tag';
628
- ref: infer T extends string;
629
- } ? T : R extends {
630
- tag: infer T extends string;
631
- } ? T : R extends {
632
- tag: {
633
- __kind: 'tag';
634
- ref: infer T extends string;
635
- };
636
- } ? T : R extends {
637
- defaultProps: {
638
- as: infer A extends string;
639
- };
640
- } ? A : R extends ComponentDefinition<Record<string, LayerInput>, Record<string, PropBinding>, infer TInnerTag> ? TInnerTag : undefined : undefined;
641
- /**
642
- * Structural shape of a `defineComponent` config. Parameterized over its
643
- * `layers`, `props`, and the resolved root tag so a wrapping `Props<T>`
644
- * walker can read each piece independently without unfolding the wide
645
- * structural surface at every recursion.
646
- *
647
- * Defaults match the historic open shape so existing 70+ use sites that
648
- * write `ComponentDefinition` un-parameterized continue to typecheck —
649
- * the narrow forms only kick in when authoring chains thread literal
650
- * generics through (`defineComponent('div')` → `TTag = 'div'`).
651
- */
652
- /**
653
- * HTML or SVG tag name used to declare a component's forwarded-ref target
654
- * element via `.config({ ref: 'button' })`. Opt-in by design: a component that
655
- * omits `ref` exposes no `ref` prop at all, rather than a guessed default.
656
- *
657
- * Sourced from React's `JSX.IntrinsicElements` (not the DOM lib's
658
- * `HTMLElementTagNameMap`) so it resolves under the Bun tsconfig, whose `lib`
659
- * omits the DOM tag-name maps.
660
- */
661
- type RefTag = keyof JSX.IntrinsicElements;
662
- /**
663
- * Map a {@link RefTag} to its DOM element interface via React's `ComponentRef`
664
- * — `'div'` → `HTMLDivElement`, `'svg'` → `SVGSVGElement`. Falls back to
665
- * `HTMLElement` for anything that isn't a known intrinsic tag.
666
- */
667
- type RefElement<Tag> = Tag extends keyof JSX.IntrinsicElements ? ComponentRef<Tag> : HTMLElement;
668
- interface ComponentDefinition<TLayers extends Record<string, LayerInput> = Record<string, LayerInput>, TProps extends Record<string, PropBinding> = Record<string, PropBinding>, TTag extends string | undefined = string | undefined> {
669
- layers: TLayers;
670
- props?: TProps;
671
- base?: BaseStyles;
672
- defaultProps?: Record<string, unknown>;
673
- compoundProps?: readonly CompoundPropsEntry[];
674
- motion?: ComponentMotionValue;
675
- /**
676
- * Opt-in forwarded-ref target — an HTML/SVG tag name declaring which DOM
677
- * element a consumer `ref` lands on. Drives the typed `ref?: Ref<...>` on the
678
- * component's JSX surface and the `ref` arg handed to its render fn. Omit it
679
- * and the component exposes no `ref` prop (no guessed default element).
680
- */
681
- ref?: RefTag;
682
- /**
683
- * Set when this component is linked from another system — see
684
- * {@link SystemLink}. Distinct from `ref` above, which is a DOM tag name for
685
- * ref forwarding and unrelated to linking.
686
- */
687
- link?: SystemLink;
688
- /**
689
- * Set when a linked component carries an applied `.extend(patch)` override
690
- * — see {@link ComponentExtensionRecord}. Only valid beside `link`.
691
- */
692
- extension?: ComponentExtensionRecord;
693
- /**
694
- * Phantom slot — populated only as a type marker (never read at
695
- * runtime) so `RootTag<TLayers>` callers can fall back to this when
696
- * the layer's root is a value-extend wrapper. The value-extend chain
697
- * threads its captured `TTag` through here.
698
- */
699
- readonly __tag?: TTag;
700
- }
701
- /**
702
- * Authored shape for a component's preview block — attached via
703
- * `defineComponent({...}).preview({...})`. Carries the data Studio +
704
- * codegen need to render a component tile: `defaultProps` is the
705
- * baseline JSX prop bag; `matrix` declares the axes for the canvas
706
- * grid view. Stored verbatim on `Component.preview` and round-trips
707
- * through JSON unchanged.
708
- *
709
- * Named `PreviewDefinition` to match the package's `*Definition`
710
- * convention and avoid confusion with json-render's `spec` (the
711
- * canvas-renderable tree that lives at `ManifestPreviewEntry.spec`).
712
- *
713
- * `matrix.columns` / `matrix.rows` are typed as `unknown[]` — concrete
714
- * axis-entry shapes (prop-axis, modifier-axis) belong to the renderer
715
- * surface, not the authoring contract.
716
- */
717
- interface PreviewDefinition<TProps extends Record<string, unknown> = Record<string, unknown>> {
718
- /**
719
- * Authored — passed to `.preview({ defaultProps })`. Narrowed against
720
- * the component's resolved JSX prop shape so callback params
721
- * (`onSubmit: (event) => ...`) infer from the component's declared
722
- * `TExtra` rather than collapsing to `any`. Falls back to the wide
723
- * `Record<string, unknown>` when the call site doesn't supply a
724
- * `TProps` generic (Studio + codegen consume the loose shape).
725
- */
726
- readonly defaultProps?: Partial<TProps>;
727
- /** Authored — passed to `.preview({ matrix })`. Drives the canvas grid view.
728
- * `pinnedModifiers` is the pinned state-modifier set kept independent of
729
- * the displayed axes (a regroup that hides the state dimension drops its
730
- * markers from `rows`/`columns`; the pinned set survives here). It is NOT
731
- * the same as a `states([...])` axis entry: that one is positional — a
732
- * displayed row-chain level with `'rest'` included — while this registry
733
- * is arrangement-independent and never contains `'rest'`. */
734
- readonly matrix?: {
735
- readonly columns?: readonly unknown[];
736
- readonly rows?: readonly unknown[];
737
- readonly pinnedModifiers?: readonly string[];
738
- };
739
- /**
740
- * Codegen-extracted — parsed json-render spec from
741
- * `defaultProps.children` JSX. Studio's canvas + docs read this to
742
- * render the preview tile. Plain JSON (no functions / React elements).
743
- */
744
- readonly spec?: Readonly<Record<string, unknown>>;
745
- }
746
- /**
747
- * Wire shape for a component — what lands in `config.json`. The
748
- * authored `ComponentDefinition` plus the two enrichments that aren't
749
- * authored at the call site: `preview` (added by the `.preview()`
750
- * chain) and `sourceFilePath` (stack-walked by `captureCallerPath` at
751
- * `defineComponent` time). Kept separate from `ComponentDefinition`
752
- * so IDE completions inside `defineComponent({...})` don't suggest
753
- * fields the author can't write directly.
754
- */
755
- interface SerializedComponent extends ComponentDefinition {
756
- preview?: PreviewDefinition;
757
- /**
758
- * Path of the file that defined the component. Relative to
759
- * `meta.projectRoot` when `Config.toJSON({ projectRoot })` is used
760
- * (CLI's path) — keeps `config.json` portable across machines.
761
- * Absolute when serialized without a `projectRoot`.
762
- */
763
- sourceFilePath?: string;
764
- /**
765
- * `true` when the authored component chained `.render(fn)`. The fn itself
766
- * can't serialize; this flag preserves the codegen classification (transform
767
- * path vs inline primitive emitter) across a `toJSON`/`fromJSON` round-trip
768
- * so a hydrated single-layer `.render(fn)` component isn't downleveled as a
769
- * bare-tag primitive. Mirrors `Component.hasRenderFn`.
770
- */
771
- hasRenderFn?: boolean;
772
- /** `.renderCanvas(fn)` sibling of {@link hasRenderFn} — mirrors
773
- * `Component.hasCanvasRenderFn`. */
774
- hasCanvasRenderFn?: boolean;
775
- /**
776
- * Set on a sub-part — name of the parent that owns it. Mirrors
777
- * `Component.derived.subcomponentOf`. The authored relationship is
778
- * declared on the parent via `.subcomponents({...})`; this field is
779
- * the wire-format echo so `Config.fromJSON` can rebuild the linkage
780
- * without re-running the original `.subcomponents` chain.
781
- */
782
- subcomponentOf?: string;
783
- /**
784
- * Name of the component this one value-extends via `defineComponent(Source)`.
785
- * Mirrors `Component.extendsFrom`; lets consumers diff a child's props
786
- * against the parent's instead of re-listing the inherited surface.
787
- */
788
- extendsFrom?: string;
789
- /**
790
- * Set on a parent — child names declared via `.subcomponents({...})`.
791
- * Mirrors `Component.derived.subcomponents`.
792
- */
793
- subcomponents?: readonly string[];
794
- }
795
- /**
796
- * Authored shape for a component group — a labeled bundle of
797
- * registered components surfaced together in the Studio palette,
798
- * codegen catalog, and AI prompt.
799
- *
800
- * `components` is keyed by the registration name (same surface as
801
- * `registerComponents`); each value is a plain `ComponentDefinition`.
802
- * Registration flattens these into `Config.components` and stamps
803
- * `componentGroup` on each member's `Component.derived`.
804
- *
805
- * The serialized form (`SerializedComponentGroup`) replaces
806
- * `components: Record<string, ComponentDefinition>` with
807
- * `components: readonly string[]` — names only — because the
808
- * definitions themselves live under `config.components` on disk.
809
- */
810
- interface ComponentGroupDefinition {
811
- label: string;
812
- description?: string;
813
- /**
814
- * Slug of the parent component group this one nests under. Omitted
815
- * means the group sits at the top level of the palette tree.
816
- */
817
- parent?: string;
818
- components: Record<string, ComponentDefinition>;
819
- }
820
- interface SerializedComponentGroup {
821
- label: string;
822
- description?: string;
823
- /**
824
- * Slug of the parent component group this one nests under. Omitted
825
- * means the group sits at the top level of the palette tree.
826
- */
827
- parent?: string;
828
- components: readonly string[];
829
- }
830
- /**
831
- * One font-class asset member — a pure-JSON data record (no FC to
832
- * render), mirroring `@yahoo/uds-fonts`' `FontDeclarationConfig`. The
833
- * structural contract the font-class member guard enforces is
834
- * `fontFamily` + `declarations[]`; everything else (`fallback`,
835
- * weights/axes, `isVariableFont`, …) rides along through the open
836
- * index so the registered record stays faithful to the source map
837
- * without `@yahoo/uds-create-config` depending on the font package's types.
838
- */
839
- interface FontAssetMember {
840
- /** CSS-facing family name (`'YA Sans VF'`). */
841
- readonly fontFamily: string;
842
- /**
843
- * `@font-face` source declarations (CDN URLs, weights/axes) — pure
844
- * JSON the browser loader derives `@font-face` rules from.
845
- */
846
- readonly declarations: readonly Record<string, unknown>[];
847
- /**
848
- * Governance flag stamped at registration from the group's `deprecated`
849
- * FontID list. Deprecated fonts stay fully selectable (no hard block) —
850
- * this only lets the picker surface a badge. Rides the open index, so it
851
- * round-trips through serialization with the rest of the record.
852
- */
853
- readonly deprecated?: boolean;
854
- readonly [key: string]: unknown;
855
- }
856
- /**
857
- * Wire shape for one asset group, discriminated by `assetKind` from
858
- * day one so future asset classes extend the union without a wire
859
- * migration. The member shape is per-class:
860
- *
861
- * - `'icon'` — `members` is a member-*name* list. The React
862
- * components ship in the consumer bundle, so the serialized form
863
- * only needs names (mirrors `SerializedComponentGroup.components`).
864
- * - `'font'` — `members` is the full member-*record* map. Font
865
- * members are already plain JSON and the browser `@font-face`
866
- * loader needs the records themselves.
867
- */
868
- interface SerializedIconAssetGroup {
869
- assetKind: 'icon';
870
- label: string;
871
- description?: string;
872
- /** Source-library version shown in the Assets UI (e.g. `2.1.1`). */
873
- version?: string;
874
- /** Named size → px. The picker's size options are these keys. */
875
- sizes: Readonly<Record<string, number>>;
876
- /** Group-level variant superset (declared or harvested union). */
877
- variants: readonly string[];
878
- /**
879
- * Authoring component for code export (`'Icon'`) — lets code views
880
- * serialize a placed asset node as `<Icon name="Trophy" … />` and
881
- * round-trip it. Also the component a placed member renders through on
882
- * the canvas. Omitted for a component-less group (members render bare).
883
- */
884
- component?: string;
885
- members: readonly string[];
886
- /**
887
- * Per-member harvested metadata (each icon's own variants, category,
888
- * tags), keyed by asset name. Carried on the wire so the browser picker
889
- * can narrow ragged variants and search tags/category from the resolved
890
- * config alone — without introspecting live member components. Omitted
891
- * when no member carried metadata (e.g. a metadata-less library).
892
- */
893
- memberMetadata?: Readonly<Record<string, IconAssetMetadata>>;
894
- }
895
- interface SerializedFontAssetGroup {
896
- assetKind: 'font';
897
- label: string;
898
- description?: string;
899
- /** Source-library version shown in the Assets UI (e.g. `2.1.1`). */
900
- version?: string;
901
- members: Readonly<Record<string, FontAssetMember>>;
902
- }
903
- type SerializedAssetGroup = SerializedIconAssetGroup | SerializedFontAssetGroup;
904
- /**
905
- * The Studio canvas insert tools a component can back. `frame` drives
906
- * the frame/draw tool (Box / VStack / HStack-style containers); `text`
907
- * drives the text tool. Registered via
908
- * `config.registerCanvasRoles({...})` so the canvas resolves its
909
- * toolbar through the config instead of hardcoded component names.
910
- */
911
- type CanvasRole = 'frame' | 'text';
912
- /** One component entry backing a canvas role's tool (normalized/wire shape). */
913
- interface CanvasRoleEntry {
914
- /**
915
- * Registered component name (`'Box'`). Narrows to the registered
916
- * component names once the `RegisteredComponents` augmentation is
917
- * emitted; falls open to `string` before the first build. Existence
918
- * is enforced at registration time either way.
919
- */
920
- readonly component: ComponentName;
921
- /**
922
- * Marks the tool's preselected entry. At most one per role; when no
923
- * entry is marked, the first entry is the default.
924
- */
925
- readonly default?: boolean;
926
- /**
927
- * Initial props for the element the tool inserts, in spec prop syntax
928
- * (`width: '[200px]'`, `bg: 'primary'`). JSON-safe values only — the
929
- * record rides the wire format. Insert tools may override entries the
930
- * gesture itself determines (a drawn frame's `width`/`height`).
931
- */
932
- readonly defaultProps?: Readonly<Record<string, unknown>>;
933
- }
934
- /**
935
- * Wire shape for canvas roles — entries normalized to component *names*.
936
- * Round-trips through `Config.toJSON()` / `fromJSON()` unchanged.
937
- */
938
- type CanvasRolesDefinition = Partial<Record<CanvasRole, readonly CanvasRoleEntry[]>>;
939
- /**
940
- * Authoring-time entry for `registerCanvasRoles`. `component` may be the
941
- * registered name (`'Box'`) or the authored `defineComponent(...)` value
942
- * itself (`Box`). Passing the value types `defaultProps` against that
943
- * component's real prop surface via {@link CanvasRolesInputConstraint} —
944
- * `defaultProps: { width: 200 }` fails to compile when `width` only
945
- * accepts tokens / `[<css>]` literals.
946
- */
947
- interface CanvasRoleEntryInput {
948
- readonly component: ComponentName | ComponentDefinition;
949
- readonly default?: boolean;
950
- readonly defaultProps?: Readonly<Record<string, unknown>>;
951
- }
952
- type CanvasRolesDefinitionInput = Partial<Record<CanvasRole, readonly CanvasRoleEntryInput[]>>;
953
- /**
954
- * Per-entry `defaultProps` narrowing: when `component` is an authored
955
- * component value, its `FC<Props<T>>` call signature carries the JSX
956
- * prop surface — `defaultProps` must be a `Partial` of it. A string
957
- * component name (no call signature to infer from) leaves the entry
958
- * unconstrained beyond {@link CanvasRoleEntryInput}.
959
- */
960
- type CanvasRoleEntryConstraint<E> = E extends {
961
- readonly component: infer C;
962
- } ? C extends ((props: infer P) => unknown) ? {
963
- readonly defaultProps?: Partial<P>;
964
- } : unknown : unknown;
965
- /**
966
- * Validator generic for `registerCanvasRoles` — intersected with the
967
- * inferred input so each entry's `defaultProps` typechecks against its
968
- * own `component` value.
969
- */
970
- type CanvasRolesInputConstraint<R> = { readonly [K in keyof R]: R[K] extends readonly unknown[] ? { readonly [I in keyof R[K]]: CanvasRoleEntryConstraint<R[K][I]> } : unknown };
971
- type GlobalStylesDef = Record<string, Record<string, unknown>>;
972
- /**
973
- * Build-time knobs settable via `config.configure({ buildOptions })`. Read
974
- * by the codegen pipeline (`@yahoo/uds-create-codegen`) and the CLI to gate
975
- * artifact emission. Authored on the config instance, propagated as-is.
976
- */
977
- interface BuildOptions {
978
- skipCssVariables?: boolean;
979
- preflight?: boolean;
980
- /**
981
- * Trusted source root (relative to the project root) the push pipeline
982
- * is allowed to traverse when publishing component files and their local
983
- * dependencies. Bounds the dependency walk to this subtree so a component
984
- * can't drag in arbitrary app code, `node_modules`, or files outside the
985
- * design system. Authored via `configure({ buildOptions: { componentsDir } })`
986
- * (e.g. `'src/uds/components'`); read by the CLI at push time.
987
- */
988
- componentsDir?: string;
989
- /**
990
- * Source globs (relative to the config file's directory) scanned by
991
- * `uds build` to safelist the utility classes a consumer app's own JSX
992
- * produces (`<Box gap="6">` → `.gap-6` lands in the purged `styles.css`).
993
- * REPLACES the default scan of `src/​**​/*.{ts,tsx}` when set — an app that
994
- * also keeps JSX under `src/` must include a glob covering it. Prefer
995
- * directory-scoped globs (`app/​**​/*.{ts,tsx}`) over `./​**` so unrelated
996
- * `*.config.ts` files don't enter the component-authoring scans.
997
- */
998
- content?: string[];
999
- /**
1000
- * Where `uds pull` materializes linked-system dependencies, relative to
1001
- * the project root. Optional — defaults to `<componentsDir>/registry`
1002
- * (or `.uds-registry` when no `componentsDir` is declared). Registry
1003
- * files are consumed as sealed foreign sources: the push pipeline never
1004
- * seals them as the consumer's own components, and the loader never
1005
- * rewrites their imports.
1006
- */
1007
- registryDir?: string;
1008
- /**
1009
- * Scope every emitted CSS selector under this class name. The
1010
- * emitter's `:root` block becomes `.<cssScope>`; mode/theme blocks
1011
- * (e.g. `.dark` or `[data-theme="slate"]`) append `.<cssScope>` so
1012
- * they still apply when the attribute is on `<html>`. Utility
1013
- * classes nest under `.<cssScope>` so two UDS-powered packages on
1014
- * the same page don't collide.
1015
- */
1016
- cssScope?: string;
1017
- }
1018
- /** A json-render spec authored for a custom playground page — a plain
1019
- * `{ root, elements }` object rendered through `UdsRenderer`. */
1020
- type PlaygroundSpec = Readonly<Record<string, unknown>>;
1021
- /**
1022
- * A playground page — the default export of a file in
1023
- * `PlaygroundOptions.pagesDir`. Dispatched by shape at render time:
1024
- * - a React component (a function) rendered on the playground React engine;
1025
- * optional `Component.title` / `Component.description` statics set its nav
1026
- * label and subtitle (both fall back to the filename otherwise);
1027
- * - a json-render spec (`{ root, elements }`) rendered via `UdsRenderer`;
1028
- * - a descriptor `{ title?, description?, component }` or
1029
- * `{ title?, description?, spec }` — the same renderables with an explicit
1030
- * display title and description. Specs use this form since a plain spec
1031
- * object has nowhere to carry a title.
1032
- */
1033
- type PlaygroundPage = ComponentType | PlaygroundSpec | {
1034
- title?: string;
1035
- description?: string;
1036
- component: ComponentType;
1037
- } | {
1038
- title?: string;
1039
- description?: string;
1040
- spec: PlaygroundSpec;
1041
- };
1042
- /** Authored via `configure({ playgroundOptions })` — the playground pages
1043
- * directory plus `uds dev --playground` settings. */
1044
- interface PlaygroundOptions {
1045
- /** Directory (relative to the config file) whose files each default-export a
1046
- * {@link PlaygroundPage}. Codegen globs it at build time — every file with a
1047
- * default export becomes a page, keyed (and titled, by default) by filename.
1048
- * Files without a default export are ignored, so colocated helpers are safe. */
1049
- pagesDir?: string;
1050
- /** Port the playground dev server binds (default 4321). */
1051
- port?: number;
1052
- }
1053
- /** Serializable subset of {@link PlaygroundOptions} that lands in `config.json`.
1054
- * Only the port rides the wire — `pagesDir` is a build-time input codegen reads
1055
- * from the config source, and the pages themselves (React functions + spec
1056
- * data) are bundled as code (`playground/pages.tsx`), so the playground reads
1057
- * them from the bundle, not `config.json`. */
1058
- interface SerializedPlaygroundOptions {
1059
- port?: number;
1060
- }
1061
- /**
1062
- * One pinned source system in `registerLinkedSystems` — the version anchor
1063
- * every linked value from that system validates against. The record key (the
1064
- * source system's database UUID) is the identity; `name` is the system's
1065
- * display-name snapshot at link time, used for review surfaces and to derive
1066
- * the registry folder slug — the source system renaming itself does not
1067
- * orphan the pin.
1068
- */
1069
- interface LinkedSystemPin {
1070
- /** Display-name snapshot of the linked system at link time. Never identity. */
1071
- name: string;
1072
- /** Exact published version of the linked system (`'1.3.1'`) — no ranges. */
1073
- version: string;
1074
- }
1075
- /** Input to `registerLinkedSystems`, keyed by the linked system's UUID. */
1076
- type LinkedSystemsInput = Record<string, LinkedSystemPin>;
1077
- /**
1078
- * `Config.toJSON()` produces this shape. Mirrors authored fields exactly
1079
- * — derived data is never serialized. The `{ __kind, ref }` marker shape
1080
- * appears wherever a position can hold either a literal or a cross-ref.
1081
- */
1082
- interface SerializedConfig {
1083
- schemaVersion: number;
1084
- builtAt?: string;
1085
- prefix: string;
1086
- /** Registry namespace that prefixes component `registryKey`s
1087
- * (`<namespace>:<Component>`). Absent for un-namespaced configs.
1088
- * Declared via `configure({ namespace })`. */
1089
- namespace?: string;
1090
- preflight: boolean;
1091
- designPrinciples?: readonly string[];
1092
- globalStyles?: GlobalStylesDef;
1093
- /** Raw CSS strings included verbatim via `config.includeCss()` (e.g.
1094
- * `@font-face` blocks). Emitted after compilation, ahead of generated CSS. */
1095
- rawCss?: readonly string[];
1096
- /** Build-time knobs authored via `configure({ buildOptions })`. Serialized
1097
- * so the CLI/codegen can read them from `config.json` (e.g. the trusted
1098
- * `componentsDir` traversal root). Absent when no options are set. */
1099
- buildOptions?: BuildOptions;
1100
- modes?: Record<string, ModeDefinition>;
1101
- modifiers?: Record<string, ModifierDefinition>;
1102
- tokenGroups?: Record<string, SerializedTokenGroup>;
1103
- styleProps?: Record<string, AnyStylePropDefinition>;
1104
- compositeStyles?: Record<string, CompositeStyleDefinition>;
1105
- motion?: Record<string, MotionDefinitionInput>;
1106
- components?: Record<string, SerializedComponent>;
1107
- componentGroups?: Record<string, SerializedComponentGroup>;
1108
- /**
1109
- * Registered asset groups, keyed by slug. Optional — old
1110
- * `config.json` files without it hydrate to an empty map; no
1111
- * `schemaVersion` bump.
1112
- */
1113
- assetGroups?: Record<string, SerializedAssetGroup>;
1114
- providers?: Record<string, Record<string, never>>;
1115
- /**
1116
- * Canvas tool → component mappings from `registerCanvasRoles`.
1117
- * Optional — old `config.json` files without it hydrate to an empty
1118
- * map; no `schemaVersion` bump.
1119
- */
1120
- canvasRoles?: CanvasRolesDefinition;
1121
- /**
1122
- * Root-config playground settings from `configure({ playgroundOptions })`.
1123
- * Optional — old `config.json` files without it hydrate to empty; no
1124
- * `schemaVersion` bump. Only the serializable subset (spec pages, port) is
1125
- * here; React-component pages are emitted as bundled code by codegen.
1126
- */
1127
- playgroundOptions?: SerializedPlaygroundOptions;
1128
- /**
1129
- * Source systems pinned via `registerLinkedSystems`, keyed by the source
1130
- * system's database UUID. Every linked value in the config validates
1131
- * against its pin (systemId present, version matching). Optional — old
1132
- * `config.json` files without it hydrate to an empty map; no
1133
- * `schemaVersion` bump.
1134
- */
1135
- linkedSystems?: Record<string, LinkedSystemPin>;
1136
- }
1137
- //#endregion
1138
- export { AnyStylePropDefinition, ArbitraryEntry, ArbitrarySpec, BaseStyles, BuildOptions, CanvasRole, CanvasRoleEntry, CanvasRoleEntryInput, CanvasRolesDefinition, CanvasRolesDefinitionInput, CanvasRolesInputConstraint, ComponentDefinition, ComponentExtension, ComponentExtensionRecord, ComponentGroupDefinition, ComponentMetadata, ComponentMotionValue, CompositeStyleDefinition, CompositeStyleObject, CompoundPropsEntry, CssMotionDefinition, CssMotionFields, CssSlotMotion, FontAssetMember, GlobalStylesDef, JsMotionDefinition, JsMotionFields, JsSlotMotion, LayerInput, LinkedSystemPin, LinkedSystemsInput, LiteralFor, ModeDefinition, ModeOptionDefinition, ModifierDefinition, MotionDefinitionInput, MotionDragBox, MotionKeyframes, MotionMetadata, MotionState, MotionStateKeyframe, MotionTransition, MotionVariants, MotionViewportOptions, OpacityPairSpec, PlaygroundOptions, PlaygroundPage, PlaygroundSpec, PreviewDefinition, PropBinding, RefElement, RefTag, RootTag, SerializedAssetGroup, SerializedComponent, SerializedComponentGroup, SerializedConfig, SerializedFontAssetGroup, SerializedIconAssetGroup, SerializedPlaygroundOptions, SerializedTokenGroup, SlotMotion, StylePropDefinition, StylePropMetadata, StylePropProperty, SystemLink, TokenDefinition, TokenDefinitionFor, TokenGroupDefinition, TokenGroupDefinitionFor, TokenModifierKey, TokenModifierValue, TokenType, TokenValue, ValuesEntry };