@yahoo/uds-create-config 2.45.0 → 3.0.0

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
@@ -0,0 +1,332 @@
1
+ import { AI_LANES } from "../ai-lanes.js";
2
+ import { defineEntity } from "../framework/defineEntity.js";
3
+ import { Package } from "../entities/system/Package.js";
4
+ import { Component } from "../entities/system/Component.js";
5
+ import { Device } from "../entities/system/Device.js";
6
+ import { Icon } from "../entities/system/Icon.js";
7
+ import { Operation } from "../entities/system/Operation.js";
8
+ import { Tool } from "../entities/system/Tool.js";
9
+ import { defineConfig } from "../framework/defineConfig.js";
10
+ import { System } from "./system.js";
11
+ import { z } from "zod";
12
+ //#region src/configs/CanvasConfig.ts
13
+ /**
14
+ * The canvas config — a design file as its own config TYPE, and every entity it owns, co-located in
15
+ * one home (the same shape `../design-file.ts` keeps, which this supersedes).
16
+ *
17
+ * `Node` is the ONE kind, flat: every element is its own node row. A PLACED node — the thing
18
+ * react-flow wraps — additionally carries `page` + geometry; its subtree nodes carry none and nest
19
+ * under its id (`n1/badge` is part of `n1`, the same occupied-prefix containment `Card/Header`
20
+ * uses), with `children`/`slots` as real node refs. Flat rather than an embedded keyed tree
21
+ * because an embedded tree is the old `spec` jsonb blob again: one Yjs key per node means two
22
+ * people editing different subtree elements conflict as whole-blob writes, and every edit re-ships
23
+ * the tree. One row per element is the collaboration and write granularity. An instance is one
24
+ * placed node, a generation placeholder is a placed node with no `type` yet.
25
+ *
26
+ * AI provenance is the chain node → `AiGeneration` → `AiFlow` → `AiMessage` → `AiChat`, every hop a
27
+ * real ref. The system arrives WHOLE through `SystemSource` — never `LinkedSystem`'s partial-borrow
28
+ * apparatus, which a canvas has no use for. See `docs/config-v2-spec-renderer-model.md`, "Where an
29
+ * entity-shaped Spec lives".
30
+ *
31
+ * Lives in config-v2 (not studio) so every consumer can hold one: the derived `operation`/`tool`
32
+ * catalog means the compact agent tools serve canvas CRUD the same way they serve the system's —
33
+ * the MCP/CLI surface derives from the config type, and a studio-only home would fence
34
+ * that off. Studio keeps the runtime halves (row mapping, Yjs session, dynamic registry), which
35
+ * genuinely are app concerns.
36
+ */
37
+ /**
38
+ * `SystemSource` — this canvas's pointer at the ONE system it belongs to, in full. `LinkedSystem` is
39
+ * the wrong mechanism here: it exists for a design system partially borrowing PIECES of another
40
+ * (`link`, per-entity `options`, override/extend), and a canvas never does that — a node's `type`
41
+ * always resolves against the whole of exactly one system.
42
+ *
43
+ * The source is attached under the system config's own `name`, which is `system-config` for a web
44
+ * system and `react-native-system` for a native one, so a node ref the canvas mints
45
+ * (`component:actions/Button@system-config`) means "the attached system". The system itself resolves
46
+ * that ref as its own, through `Config.configFor`'s own-name rule.
47
+ */
48
+ const SystemSource = defineEntity({
49
+ kind: "system-source",
50
+ fields: z.object({
51
+ /** Which system this is, for display and identity-change detection — not resolution itself,
52
+ * which happens through `registerSources`/`Config.load` the same way every source kind works. */
53
+ systemId: z.string().optional() }),
54
+ sourceIdentity: ["systemId"],
55
+ sourceResolution: {
56
+ resolved: z.object({ systemId: z.string().optional() }),
57
+ unavailable: z.object({
58
+ code: z.literal("not-found"),
59
+ systemId: z.string().optional()
60
+ })
61
+ },
62
+ linkable: false
63
+ });
64
+ /**
65
+ * `Canvas` — a surface in a design file (a design file has one or more). Pages belong to a canvas,
66
+ * nodes belong to a page (flat, ref-related, matching the real tables' `canvasId`/`pageId` columns).
67
+ */
68
+ const Canvas = defineEntity({
69
+ kind: "canvas",
70
+ fields: z.object({ name: z.string().optional() })
71
+ });
72
+ /**
73
+ * `Page` — a page within a `Canvas`. Field-for-field the `canvas_pages` table (id → path,
74
+ * `canvasId` → the ref, timestamps DB-owned).
75
+ */
76
+ const Page = defineEntity({
77
+ kind: "page",
78
+ fields: z.object({
79
+ canvas: Canvas,
80
+ name: z.string().optional(),
81
+ /** The page's URL segment — unique per canvas, the DB's `url_key`. */
82
+ urlKey: z.string().optional(),
83
+ /** No zod default — it would re-apply on any update that omits the field (see `Node.x`). */
84
+ sortOrder: z.number().optional()
85
+ })
86
+ });
87
+ /**
88
+ * `AiChat` — one conversation. Deliberately minimal: the transcript is the `AiMessage` rows that
89
+ * ref it (flat rows pointing at their owner, never an embedded array nothing can ref into).
90
+ */
91
+ const AiChat = defineEntity({
92
+ kind: "ai-chat",
93
+ fields: z.object({ title: z.string().optional() }),
94
+ label: "AI chat",
95
+ linkable: false
96
+ });
97
+ /** `AiMessage` — one turn in an `AiChat`. */
98
+ const AiMessage = defineEntity({
99
+ kind: "ai-message",
100
+ fields: z.object({
101
+ chat: AiChat,
102
+ role: z.enum(["user", "assistant"]),
103
+ content: z.string(),
104
+ /** Which model produced this turn — assistant messages only; a user turn has none. Per message
105
+ * rather than per chat, because a conversation can switch models between turns. */
106
+ modelId: z.string().optional(),
107
+ /** Epoch ms — ordering within the chat. */
108
+ sentAt: z.number().optional()
109
+ }),
110
+ label: "AI message",
111
+ linkable: false
112
+ });
113
+ /**
114
+ * `AiFlow` — the invocation that produced one or more generations: which surface it started from,
115
+ * which model ran, how the agents were arranged, and — when it began as a chat turn — the message
116
+ * that kicked it off. One flow can produce several nodes (a fanout literally does), so it is its
117
+ * own entity rather than columns repeated per node.
118
+ */
119
+ const aiFlowOrigin = z.enum([
120
+ "chat",
121
+ "comment",
122
+ "sidebar",
123
+ "paste",
124
+ "figma-paste",
125
+ "duplicate",
126
+ "mcp"
127
+ ]);
128
+ const aiMultiAgentMode = z.enum([
129
+ "single",
130
+ "huddle",
131
+ "fanout"
132
+ ]);
133
+ const AiFlow = defineEntity({
134
+ kind: "ai-flow",
135
+ fields: z.object({
136
+ origin: aiFlowOrigin,
137
+ lane: z.enum(AI_LANES).optional(),
138
+ modelId: z.string().optional(),
139
+ multiAgentMode: aiMultiAgentMode.optional(),
140
+ agentCount: z.number().optional(),
141
+ agentNames: z.array(z.string()).optional(),
142
+ /** The chat turn this flow answered, when `origin` is a conversation surface. */
143
+ message: AiMessage.optional()
144
+ }),
145
+ label: "AI flow",
146
+ linkable: false
147
+ });
148
+ /**
149
+ * `AiGeneration` — how one node came to exist: the flow that produced it, and — for an iteration —
150
+ * the lineage it varied from, as a real graph edge. Replaces the `canvas_nodes` table's
151
+ * `generation_*` and `iteration_meta` columns, which all describe this one event.
152
+ */
153
+ const AiGeneration = defineEntity({
154
+ kind: "ai-generation",
155
+ fields: z.object({
156
+ flow: AiFlow.optional(),
157
+ /** Iteration lineage — the node this generation varied from. Spelled as the ref shape rather
158
+ * than the `Node` entity class, which is defined below this and would be a forward cycle. */
159
+ parentNode: z.object({ __ref: z.string().startsWith("node:") }).optional(),
160
+ iterationNumber: z.number().optional(),
161
+ description: z.string().optional(),
162
+ instructions: z.string().optional(),
163
+ generatedAt: z.number().optional()
164
+ }),
165
+ label: "AI generation",
166
+ linkable: false
167
+ });
168
+ /**
169
+ * What a node or subtree element renders — a union of the kinds a spec `type` may name, each typed
170
+ * by its own entity class (an entity class IS its kind's ref schema), never a bare string. Two arms
171
+ * have no entity behind them yet, so the ref spells the grammar alone:
172
+ *
173
+ * - `html:` — an intrinsic tag (`html:div`); a real kind is deferred (design doc, Platform).
174
+ * - `spec:` — the spec format's own renderer primitives, `spec:Slot` (a content hole — the
175
+ * placeholder a slot-fill drop creates, `shown` as a plain prop) and `spec:Fragment`. These are
176
+ * json-render/UDS-renderer supplied (`wrapRegistry` seeds both), never a system's vocabulary.
177
+ *
178
+ * json-render's remaining `UIElement` surface (`on`/`repeat`/`watch`) is deliberately absent — the
179
+ * data-binding extension the design doc scopes as not started.
180
+ */
181
+ const elementType = z.union([
182
+ Component,
183
+ Icon,
184
+ Package,
185
+ z.object({ __ref: z.string().startsWith("html:") }),
186
+ z.object({ __ref: z.enum(["spec:Slot", "spec:Fragment"]) })
187
+ ]);
188
+ /** A ref to another node. `z.lazy` because `Node` is a SELF-reference — it isn't defined until the
189
+ * `defineEntity` call below returns, and the explicit annotation breaks the circular type
190
+ * inference (same pattern `Token`'s self-referencing value uses). */
191
+ const nodeRef = z.lazy(() => Node);
192
+ /** A placed node's frame size — freeform, or powered by a system device. */
193
+ const Size = z.discriminatedUnion("type", [z.object({
194
+ type: z.literal("custom"),
195
+ width: z.number(),
196
+ height: z.number()
197
+ }), z.object({
198
+ type: z.literal("device"),
199
+ ref: Device
200
+ })]);
201
+ /**
202
+ * `Node` — the unit of a canvas: one element, one record, one row. FLAT — a subtree node is its own
203
+ * item nested under its placed root's id (`n1/badge`), and `children`/`slots` hold real node refs,
204
+ * so `dependents()`, delete-refusal and rename-cascade come from the framework instead of
205
+ * `reKeySlotRefs` (UDS-3526) / `gcUnreachableElements` (UDS-3557) hand-rolling them per gesture.
206
+ *
207
+ * Placement fields are present on a PLACED node (`page` is the discriminant — what the canvas lists
208
+ * and react-flow wraps) and absent on subtree nodes. `type` is optional for exactly one reason: a
209
+ * placed node awaiting its first generation (today's skeleton / pending placeholder) exists before
210
+ * anyone knows what it renders.
211
+ */
212
+ const Node = defineEntity({
213
+ kind: "node",
214
+ fields: z.object({
215
+ /** A real ref, never a bare name — dependents()/rename-cascade need a real edge, and a bare
216
+ * `kind:path` string the framework never walks gives neither. Absent only on a placeholder
217
+ * awaiting generation. */
218
+ type: elementType.optional(),
219
+ props: z.record(z.string(), z.unknown()).optional(),
220
+ /** The default slot's fill — refs to this node's subtree nodes. */
221
+ children: z.array(nodeRef).describe("Refs to this node's subtree nodes. A child's path nests under this node's root path, such as \"card/title\" under \"card\".").optional(),
222
+ /** Named slots — never folded into `props`; see symptom 5 in the design doc for why. */
223
+ slots: z.record(z.string(), z.array(nodeRef)).describe("Named slot fills, each a list of refs to this node's subtree nodes. A fill's path nests under this node's root path, such as \"card/footer-badge\" under \"card\".").optional(),
224
+ /** json-render's own visibility grammar, borrowed rather than reinvented. */
225
+ visible: z.unknown().optional(),
226
+ /** json-render's repeat grammar — carried opaquely; the data-binding extension the design doc
227
+ * scopes as not started would give its refs real edges. */
228
+ repeat: z.unknown().optional(),
229
+ /** An element-level linked reference (studio's `ElementRef`): this element follows an element
230
+ * of another node, diverging only by its overrides. Opaque here — its `sourceId`/`sourceKey`
231
+ * are resolved by the canvas's linked-copy machinery, not the ref graph; modeling them as real
232
+ * refs is an open follow-up. */
233
+ ref: z.unknown().optional(),
234
+ /** The layers rail's lock on this element: the canvas stops hit-testing it and everything
235
+ * beneath it, while the rail can still select it to unlock. */
236
+ locked: z.boolean().optional(),
237
+ /** The element's name in the layers rail. On a placed node it is the node's own name, which the
238
+ * rename gesture writes and a spec write leaves alone; on a subtree node it travels with the
239
+ * element. */
240
+ label: z.string().optional(),
241
+ page: Page.optional(),
242
+ /** The placed node this one nests inside on the CANVAS (react-flow parent/grouping) — a
243
+ * different relation from `children`, which is render containment. */
244
+ parent: nodeRef.optional(),
245
+ size: Size.optional(),
246
+ x: z.number().optional(),
247
+ y: z.number().optional(),
248
+ collapsed: z.boolean().optional(),
249
+ /** Stacking rank among the page's frames (the legacy `spec.order`). Placed nodes only. */
250
+ order: z.number().optional(),
251
+ /** A node-level linked-copy descriptor (studio's `LinkedSource`): this node renders another
252
+ * node's subtree with overrides. Opaque, same reasoning as `ref`. */
253
+ linkedSource: z.unknown().optional(),
254
+ /** The spec's state model (`spec.state`) — the data-binding surface, carried opaquely until
255
+ * config-v2 models state paths. Placed nodes only. */
256
+ state: z.record(z.string(), z.unknown()).optional(),
257
+ /** The spec's own `meta` bag. Placed nodes only. */
258
+ meta: z.record(z.string(), z.unknown()).optional(),
259
+ /** How this node came to exist, when AI produced it. */
260
+ generation: AiGeneration.optional(),
261
+ /** The placed node this one was duplicated from, when it lives on the same canvas. */
262
+ duplicatedFrom: nodeRef.optional()
263
+ }),
264
+ computed: {
265
+ /**
266
+ * What a layers rail (or any listing) calls this node: its authored
267
+ * `label`, else what its `type` names — the component's own display label,
268
+ * resolved through the same path everything else resolves refs by, so a
269
+ * `kind:` marker never reaches a person. A placeholder awaiting generation
270
+ * (no `type` yet) and a linked copy (a descriptor, no `type` of its own)
271
+ * have no name here; the surface falls back to what it can resolve.
272
+ *
273
+ * The read type intersects this with the base `Entity.displayLabel`, which
274
+ * is never `undefined`, so the intersection reads as `string`. The canvas
275
+ * node view re-types the field optional at its seam.
276
+ */
277
+ displayLabel: ({ member, config }) => {
278
+ const label = member.label;
279
+ if (typeof label === "string" && label.trim().length > 0) return label;
280
+ if (member.linkedSource != null) return void 0;
281
+ const type = member.type;
282
+ return type ? config.displayLabelOf(type) : void 0;
283
+ } }
284
+ });
285
+ /**
286
+ * `CanvasConfig` — the design-file config TYPE. Owns placement, content, and AI provenance (flat,
287
+ * ref-related), DRAWS ON a system, and derives the same agent-tool catalog (`operation`/`tool`) as
288
+ * the system so its design-file CRUD tools project from it.
289
+ *
290
+ * A source, not a read-through window onto every one of the system's kinds. A node's `type` carries
291
+ * the source it points into (`component:actions/Button@<slug>`), so one resolution path serves both
292
+ * and nothing has to know that THIS config borrows a whole kind. Read-only stays read-only: a
293
+ * source's items resolve through their own config, so there is no local collection to offer CRUD
294
+ * over.
295
+ */
296
+ const CanvasConfig = defineConfig({
297
+ name: "canvas",
298
+ entities: {
299
+ canvases: Canvas,
300
+ pages: Page,
301
+ nodes: Node,
302
+ chats: AiChat,
303
+ messages: AiMessage,
304
+ flows: AiFlow,
305
+ generations: AiGeneration,
306
+ systems: SystemSource
307
+ },
308
+ sources: { systems: () => System },
309
+ derivedEntities: {
310
+ operations: Operation,
311
+ tools: Tool
312
+ }
313
+ });
314
+ /**
315
+ * Build a plain (in-memory) canvas target: borrows the system read-only, under its own `name` as the
316
+ * slug, and seeds the canvas + page it starts with. Enough to project tools or run an eval; the
317
+ * live form is the studio session (`apps/studio/src/configs/canvas/canvas-session.ts`).
318
+ */
319
+ function createCanvasConfig(system) {
320
+ return new CanvasConfig().register({
321
+ canvases: { main: {} },
322
+ pages: { home: { canvas: Canvas.ref("main") } },
323
+ nodes: {},
324
+ chats: {},
325
+ messages: {},
326
+ flows: {},
327
+ generations: {},
328
+ systems: { [system.name]: {} }
329
+ }).registerSources({ systems: { [system.name]: system } });
330
+ }
331
+ //#endregion
332
+ export { AiChat, AiFlow, AiGeneration, AiMessage, Canvas, CanvasConfig, Node, Page, SystemSource, createCanvasConfig };
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/configs/build-options.d.ts
4
+ /** The section as a config that set nothing reads it, spelled once. */
5
+ declare const BUILD_DEFAULTS: {
6
+ readonly outDir: ".uds";
7
+ readonly registryDir: ".uds-registry";
8
+ };
9
+ //#endregion
10
+ export { BUILD_DEFAULTS };
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+ //#region src/configs/build-options.ts
3
+ /**
4
+ * The `build` section's fields — where a repo keeps a system's sources, where the build writes, and
5
+ * where linked systems are materialised. Shared by the web and the native config type.
6
+ *
7
+ * Every field is optional and none carries a schema default. A stored body is exactly what was
8
+ * authored, so a default that changes later reaches every system that never set the field. The
9
+ * defaults live in {@link BUILD_DEFAULTS}, which the directory resolvers read.
10
+ */
11
+ /**
12
+ * A directory INSIDE the project, refused at the point it is written.
13
+ *
14
+ * `outDir` is handed to `rmSync(dir, { recursive: true })` before every build, because a build
15
+ * cleans its own output. So a value that names the project root deletes the project, and one with a
16
+ * `..` in it deletes whatever is up there — from a field in a checked-in config file, which is a very
17
+ * different exposure from a `--output-dir` somebody typed.
18
+ *
19
+ * Refused here rather than at the delete, so a config carrying one never loads at all and the message
20
+ * names the field. The build keeps a second check anyway: this schema only sees a config that came
21
+ * through it, and an artifact can arrive from elsewhere.
22
+ */
23
+ const insideProject = (field) => z.string().min(1).refine((value) => !value.startsWith("/") && !/^[A-Za-z]:/.test(value), { message: `\`${field}\` has to be relative to the config, not an absolute path.` }).refine((value) => {
24
+ const segments = value.replace(/\\/g, "/").split("/").filter((part) => part !== "");
25
+ return segments.length > 0 && !segments.every((part) => part === ".") && !segments.includes("..");
26
+ }, { message: `\`${field}\` has to name a directory inside the project — not \`.\`, and not one that climbs out with \`..\`.` });
27
+ /** The section as a config that set nothing reads it, spelled once. */
28
+ const BUILD_DEFAULTS = {
29
+ outDir: ".uds",
30
+ registryDir: ".uds-registry"
31
+ };
32
+ const buildFields = z.strictObject({
33
+ /**
34
+ * The directory every file this system seals must live under, relative to the config.
35
+ *
36
+ * Declared rather than inferred. Without it the boundary is guessed per file from the
37
+ * conventional `uds/components/` anchor, and a component that reaches a helper beside it —
38
+ * `../../shared/tone` from `src/uds/components`, an ordinary app layout — climbs out of a root
39
+ * nobody chose and cannot be mirrored into the output at all.
40
+ *
41
+ * Setting it also fixes the emitted layout: a module and the files it imports are both written
42
+ * relative to THIS directory, so the tree beneath it survives the move into {@link outDir} and a
43
+ * relative specifier still resolves. That is what makes reaching outside it the real error, rather
44
+ * than a guess about where the components root probably was.
45
+ *
46
+ * No default, and that is the answer rather than a missing one: unset, the anchor convention stands
47
+ * and the output layout is unchanged.
48
+ */
49
+ inputDir: insideProject("inputDir").meta({
50
+ title: "Input directory",
51
+ description: "The directory every sealed component file lives under, relative to the config. Emitted modules keep the layout beneath it. Unset, the `uds/components/` folder convention applies."
52
+ }).optional(),
53
+ /** Where `uds build` writes. A CLI `--output-dir` still wins, because a one-off build into a
54
+ * scratch directory is not a property of the system. */
55
+ outDir: insideProject("outDir").meta({
56
+ title: "Output directory",
57
+ description: `Where \`uds build\` writes, relative to the config. The build cleans it before writing, so it has to stay inside the project. Unset, \`${BUILD_DEFAULTS.outDir}\`.`,
58
+ default: BUILD_DEFAULTS.outDir
59
+ }).optional(),
60
+ /** Where `uds pull` materializes linked-system sources — see `resolveRegistryDir`. */
61
+ registryDir: z.string().min(1).meta({
62
+ title: "Registry directory",
63
+ description: `Where \`uds pull\` places the sources of linked systems, relative to the config. Unset, \`${BUILD_DEFAULTS.registryDir}\`.`,
64
+ default: BUILD_DEFAULTS.registryDir
65
+ }).optional()
66
+ });
67
+ //#endregion
68
+ export { BUILD_DEFAULTS, buildFields };
@@ -0,0 +1,15 @@
1
+ import { Config } from "../framework/Config.js";
2
+ import { ReactNativeSystemConfig } from "./react-native-system.js";
3
+ import { SystemConfig } from "./system.js";
4
+
5
+ //#region src/configs/platform.d.ts
6
+ /**
7
+ * A design system of either platform — what a holder declares when it draws on a system and has no
8
+ * reason to care which platform it is: the canvas, a session, a pipeline step.
9
+ */
10
+ type AnySystemConfig = SystemConfig | ReactNativeSystemConfig;
11
+ declare function isNativeConfig(config: Config): boolean;
12
+ /** Whether a config is a design system at all, of either platform. A canvas config is not. */
13
+ declare function isSystemConfig(config: Config): config is AnySystemConfig;
14
+ //#endregion
15
+ export { AnySystemConfig, isNativeConfig, isSystemConfig };
@@ -0,0 +1,17 @@
1
+ //#region src/configs/platform.ts
2
+ /**
3
+ * The names `System` and `ReactNativeSystem` declare themselves under. Held here rather than read
4
+ * off the classes so this module imports nothing at runtime: an entity module can ask which platform
5
+ * a config is without pulling in the config type that registers it, which would close an import cycle.
6
+ */
7
+ const WEB_CONFIG_NAME = "system-config";
8
+ const NATIVE_CONFIG_NAME = "react-native-system";
9
+ function isNativeConfig(config) {
10
+ return config.name === NATIVE_CONFIG_NAME;
11
+ }
12
+ /** Whether a config is a design system at all, of either platform. A canvas config is not. */
13
+ function isSystemConfig(config) {
14
+ return config.name === "system-config" || config.name === "react-native-system";
15
+ }
16
+ //#endregion
17
+ export { NATIVE_CONFIG_NAME, WEB_CONFIG_NAME, isNativeConfig, isSystemConfig };