@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
@@ -0,0 +1,12 @@
1
+ import { SubEntityClass } from "../../framework/defineSubEntity.js";
2
+ import { EntityClass } from "../../framework/defineEntity.js";
3
+ import { StyleValue } from "./style-bag.js";
4
+ import { z } from "zod";
5
+
6
+ //#region src/entities/system/Composite.d.ts
7
+ /** A composite variant (`overlays/elevation/1`) — the style-prop bag it applies. */
8
+ declare const Composite: EntityClass<z.ZodObject<{
9
+ styles: SubEntityClass<z.ZodType<StyleValue, unknown, z.core.$ZodTypeInternals<StyleValue, unknown>>>;
10
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "composite", Record<never, never>, Record<never, never>, false>;
11
+ //#endregion
12
+ export { Composite };
@@ -0,0 +1,26 @@
1
+ import { defineEntity } from "../../framework/defineEntity.js";
2
+ import { Style, bagNameEdges, bagRewriteName, collectBag } from "./style-bag.js";
3
+ import { z } from "zod";
4
+ //#region src/entities/system/Composite.ts
5
+ /** A composite's one bag. Same shape as a component's, so the same hooks read it. */
6
+ const compositeBags = (data) => {
7
+ const body = data;
8
+ const out = [];
9
+ collectBag(body?.styles, (next) => {
10
+ if (body) body.styles = next;
11
+ }, out);
12
+ return out;
13
+ };
14
+ /** A composite variant (`overlays/elevation/1`) — the style-prop bag it applies. */
15
+ const Composite = defineEntity({
16
+ kind: "composite",
17
+ label: "Composite style",
18
+ labelPlural: "Composite styles",
19
+ fields: z.object({ styles: Style }),
20
+ subEntities: { styles: Style },
21
+ nameEdges: bagNameEdges(compositeBags),
22
+ styleBags: compositeBags,
23
+ rewriteName: bagRewriteName(compositeBags)
24
+ });
25
+ //#endregion
26
+ export { Composite };
@@ -0,0 +1,11 @@
1
+ import { EntityClass } from "../../framework/defineEntity.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/entities/system/Device.d.ts
5
+ declare const Device: EntityClass<z.ZodObject<{
6
+ width: z.ZodNumber;
7
+ height: z.ZodNumber;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "device", Record<never, never>, Record<never, never>, false>;
10
+ //#endregion
11
+ export { Device };
@@ -0,0 +1,18 @@
1
+ import { defineEntity } from "../../framework/defineEntity.js";
2
+ import { z } from "zod";
3
+ //#region src/entities/system/Device.ts
4
+ /**
5
+ * `Device` — a named viewport size (mobile / tablet / desktop / …). A SYSTEM entity, so devices
6
+ * are configurable design-system DATA, not a hardcoded constant. A design-file node's `size` can
7
+ * be `{ type: 'device', ref: Device.ref('mobile') }` to be powered by one of these.
8
+ */
9
+ const Device = defineEntity({
10
+ kind: "device",
11
+ fields: z.object({
12
+ width: z.number(),
13
+ height: z.number(),
14
+ name: z.string().optional()
15
+ })
16
+ });
17
+ //#endregion
18
+ export { Device };
@@ -0,0 +1,72 @@
1
+ import { Ref } from "../../framework/utils/refs.js";
2
+ import { SubEntityClass } from "../../framework/defineSubEntity.js";
3
+ import { EntityClass } from "../../framework/defineEntity.js";
4
+ import { ComputedInput } from "../../framework/registry.js";
5
+ import { z } from "zod";
6
+
7
+ //#region src/entities/system/File.d.ts
8
+ /** The extensions a module resolver will try, and the ones {@link isBinaryAsset} therefore counts as
9
+ * text. Exported because codegen's resolver walks the same list — two copies would drift the first
10
+ * time a runtime adds an extension, and they would drift silently. */
11
+ declare const SCRIPT_EXTENSIONS: ReadonlySet<string>;
12
+ /**
13
+ * Whether a path is bytes rather than text — the one place that is decided.
14
+ *
15
+ * An extension that is neither absent, nor `.json`, nor a script is an asset: an image, a font.
16
+ * This was Metro's rule, applied only when the graph was built for native, which made the same
17
+ * `icon.png` an asset there and a source file on web — and a restore then wrote the web one back
18
+ * through a text encoder. It is a fact about the file, so it does not get to depend on which
19
+ * platform asked, and it lives beside the kind whose path it reads rather than in the build that
20
+ * happens to call it first.
21
+ *
22
+ * Spelled out rather than taken from `node:path`, because nothing in this package imports `node:`
23
+ * — Studio runs the config in a browser. The rule is `extname`'s: the last dot in the last segment,
24
+ * and a leading dot is a dotfile (`.gitignore`) rather than an extension.
25
+ */
26
+ declare function isBinaryAsset(filePath: string): boolean;
27
+ /**
28
+ * File (`file:components/card.tsx`) — one artifact the seal owns.
29
+ *
30
+ * A component is a definition plus the React that renders it, and `config.json` cannot hold JSX, so
31
+ * some of what a system publishes travels as bytes. `uds push` bounds the source graph to the Git
32
+ * checkout and the config directory, hashes those files, and uploads them; a consumer pulls them
33
+ * down and verifies the hash. That whole lifecycle — hashed, uploaded, restored, verified — is one
34
+ * thing, and it is what this kind is for.
35
+ *
36
+ * **Sealed repo source is a `File`; anything remote stays a URL.** A `FontFile`'s `src` is something
37
+ * somebody uploaded to a cdn: there is no hash to check, no seal that owns it, and no build that
38
+ * produced it. Folding both into one kind would put two provenance models and two trust models
39
+ * behind one name.
40
+ *
41
+ * **The path is the src**, so there is no `src` field. Config-relative is the same key space the seal
42
+ * converts to, so an entry and a sealed file name the same thing with no translation and nothing to
43
+ * keep in step. The extension is part of the path deliberately: a helper authored as `.ts` is not
44
+ * JSX, and a bundler resolving `./tone` looks for what the closure actually holds.
45
+ *
46
+ * Ordinary authoring does not maintain this graph — the build derives it from the source it just
47
+ * walked, the way it derives `Package` groups from the same walk. Nobody picks a file out of a
48
+ * picker, so the kind has no group metadata and its groups stay emergent from the path.
49
+ */
50
+ declare const File: EntityClass<z.ZodObject<{
51
+ hash: z.ZodString;
52
+ imports: z.ZodOptional<SubEntityClass<z.ZodObject<{
53
+ target: z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>;
54
+ names: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ }, z.core.$strip>>>;
56
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "file", Record<never, never>, {
57
+ /**
58
+ * Bytes rather than text, so a restore knows how to write it — derived from the path, because
59
+ * the path is the only thing that decides it.
60
+ *
61
+ * Stored, it was a second copy of what the extension already says, and the two could disagree:
62
+ * an artifact could carry `binary: true` on a `.tsx` and nothing would catch it. Computed, that
63
+ * state does not exist, and a build has one less field to remember to write. It also answers
64
+ * `false` for text rather than `undefined` — the writer omitted the field, which made an honest
65
+ * boolean read as a tri-state at every call site.
66
+ */
67
+ readonly binary: ({
68
+ path
69
+ }: ComputedInput) => boolean;
70
+ }, false>;
71
+ //#endregion
72
+ export { File, SCRIPT_EXTENSIONS, isBinaryAsset };
@@ -0,0 +1,136 @@
1
+ import { defineEntity } from "../../framework/defineEntity.js";
2
+ import { defineSubEntity } from "../../framework/defineSubEntity.js";
3
+ import { Package } from "./Package.js";
4
+ import { z } from "zod";
5
+ //#region src/entities/system/File.ts
6
+ /** The extensions a module resolver will try, and the ones {@link isBinaryAsset} therefore counts as
7
+ * text. Exported because codegen's resolver walks the same list — two copies would drift the first
8
+ * time a runtime adds an extension, and they would drift silently. */
9
+ const SCRIPT_EXTENSIONS = new Set([
10
+ ".ts",
11
+ ".tsx",
12
+ ".mts",
13
+ ".cts",
14
+ ".js",
15
+ ".jsx",
16
+ ".mjs",
17
+ ".cjs"
18
+ ]);
19
+ /**
20
+ * Whether a path is bytes rather than text — the one place that is decided.
21
+ *
22
+ * An extension that is neither absent, nor `.json`, nor a script is an asset: an image, a font.
23
+ * This was Metro's rule, applied only when the graph was built for native, which made the same
24
+ * `icon.png` an asset there and a source file on web — and a restore then wrote the web one back
25
+ * through a text encoder. It is a fact about the file, so it does not get to depend on which
26
+ * platform asked, and it lives beside the kind whose path it reads rather than in the build that
27
+ * happens to call it first.
28
+ *
29
+ * Spelled out rather than taken from `node:path`, because nothing in this package imports `node:`
30
+ * — Studio runs the config in a browser. The rule is `extname`'s: the last dot in the last segment,
31
+ * and a leading dot is a dotfile (`.gitignore`) rather than an extension.
32
+ */
33
+ function isBinaryAsset(filePath) {
34
+ const base = filePath.slice(filePath.lastIndexOf("/") + 1);
35
+ const dot = base.lastIndexOf(".");
36
+ const extension = dot > 0 ? base.slice(dot).toLowerCase() : "";
37
+ return extension !== "" && extension !== ".json" && !SCRIPT_EXTENSIONS.has(extension);
38
+ }
39
+ /** What an import resolved to — a sealed sibling, or a package the consumer installs. `z.lazy` on
40
+ * `File` because it is a self-reference through the collection `File` declares; the explicit
41
+ * annotation breaks the circular type inference, the same way a token's value schema does. */
42
+ const importTarget = z.union([z.lazy(() => File), Package]);
43
+ /**
44
+ * One import — keyed by the specifier as authored (`'./tone'`, `'@/uds/hooks/use-tone'`,
45
+ * `'motion/react'`), holding what that specifier resolved to.
46
+ *
47
+ * **Both halves, because they come apart.** The specifier decides whether the target relocates when
48
+ * a module is emitted into `.uds` — a relative import has to be mirrored beside the generated
49
+ * module, an aliased one resolves through the consumer's own `paths` from anywhere — and
50
+ * `file:components/tone.ts` does not say which of the two the render wrote. The specifier is the key
51
+ * rather than a field beside one because it is the import's identity: a module imported twice is one
52
+ * edge, and storing it in both places would be one string with two homes and no rule for which wins.
53
+ *
54
+ * **One list, not two.** An import is an import; splitting it by what it happens to resolve to gives
55
+ * two lists that must be kept in step and throws away source order, which decides evaluation for a
56
+ * side-effect import. `kindOf(ref)` is the discriminator, the same one that tells every other union
57
+ * in the config apart.
58
+ */
59
+ const FileImport = defineSubEntity({
60
+ name: "import",
61
+ label: "Import",
62
+ labelPlural: "Imports",
63
+ fields: z.object({
64
+ /** A local file the seal owns, or a package the consumer provides. */
65
+ target: importTarget,
66
+ /**
67
+ * The bindings this file took from that module, as the target names them — `Card` for
68
+ * `import { Card as C }`, `default` for a default import, `*` for a namespace or `export *`.
69
+ * The local alias is a fact about this file's scope rather than about the edge, so it is not
70
+ * what is recorded.
71
+ *
72
+ * Absent for an edge with no static bindings: a side-effect import (`import './reset.css'`) and
73
+ * a dynamic `import()`/`require()`, which name a module and take nothing from it by name.
74
+ *
75
+ * Not a ref, even where the target is a `Package` whose exports are entities
76
+ * (`package:react#useState`). A `Package` member exists only for an export a render placed in
77
+ * JSX, and this records every binding the source took — including a hook, a type, and a helper
78
+ * no JSX mentions. Pointing at members would silently drop those, and minting members to
79
+ * receive them would make the group claim a render surface it never had.
80
+ */
81
+ names: z.array(z.string()).optional()
82
+ })
83
+ });
84
+ /**
85
+ * File (`file:components/card.tsx`) — one artifact the seal owns.
86
+ *
87
+ * A component is a definition plus the React that renders it, and `config.json` cannot hold JSX, so
88
+ * some of what a system publishes travels as bytes. `uds push` bounds the source graph to the Git
89
+ * checkout and the config directory, hashes those files, and uploads them; a consumer pulls them
90
+ * down and verifies the hash. That whole lifecycle — hashed, uploaded, restored, verified — is one
91
+ * thing, and it is what this kind is for.
92
+ *
93
+ * **Sealed repo source is a `File`; anything remote stays a URL.** A `FontFile`'s `src` is something
94
+ * somebody uploaded to a cdn: there is no hash to check, no seal that owns it, and no build that
95
+ * produced it. Folding both into one kind would put two provenance models and two trust models
96
+ * behind one name.
97
+ *
98
+ * **The path is the src**, so there is no `src` field. Config-relative is the same key space the seal
99
+ * converts to, so an entry and a sealed file name the same thing with no translation and nothing to
100
+ * keep in step. The extension is part of the path deliberately: a helper authored as `.ts` is not
101
+ * JSX, and a bundler resolving `./tone` looks for what the closure actually holds.
102
+ *
103
+ * Ordinary authoring does not maintain this graph — the build derives it from the source it just
104
+ * walked, the way it derives `Package` groups from the same walk. Nobody picks a file out of a
105
+ * picker, so the kind has no group metadata and its groups stay emergent from the path.
106
+ */
107
+ const File = defineEntity({
108
+ kind: "file",
109
+ label: "File",
110
+ labelPlural: "Files",
111
+ authoredRefs: false,
112
+ linkable: false,
113
+ fields: z.strictObject({
114
+ /** SHA-256 of the exact bytes — what the seal hashed, so a restore verifies rather than trusts. */
115
+ hash: z.string(),
116
+ /** What this file imports — keyed by the text the source wrote, in the order it wrote it. Every
117
+ * local edge, plus each bare specifier a `Package` group already names; one the config names
118
+ * nowhere is left out rather than pointed at a group minted to receive it. */
119
+ imports: FileImport.optional()
120
+ }),
121
+ computed: {
122
+ /**
123
+ * Bytes rather than text, so a restore knows how to write it — derived from the path, because
124
+ * the path is the only thing that decides it.
125
+ *
126
+ * Stored, it was a second copy of what the extension already says, and the two could disagree:
127
+ * an artifact could carry `binary: true` on a `.tsx` and nothing would catch it. Computed, that
128
+ * state does not exist, and a build has one less field to remember to write. It also answers
129
+ * `false` for text rather than `undefined` — the writer omitted the field, which made an honest
130
+ * boolean read as a tri-state at every call site.
131
+ */
132
+ binary: ({ path }) => isBinaryAsset(path) },
133
+ subEntities: { imports: FileImport }
134
+ });
135
+ //#endregion
136
+ export { File, SCRIPT_EXTENSIONS, isBinaryAsset };
@@ -0,0 +1,48 @@
1
+ import { SubEntityClass } from "../../framework/defineSubEntity.js";
2
+ import { EntityClass } from "../../framework/defineEntity.js";
3
+ import { z } from "zod";
4
+
5
+ //#region src/entities/system/Font.d.ts
6
+ /**
7
+ * One FILE of a font family — the unit `@font-face` needs a rule for. Named `files` rather than
8
+ * `weights` because the two don't line up: a roman and an italic at 400 are two files sharing one
9
+ * weight, and a variable font is one file covering many (`weight: '100 900'`). `weightCount` is the
10
+ * derivation over these, not their count.
11
+ *
12
+ * `postscriptName` names this exact file (`YahooSans-BoldItalic`). CSS never needs it — a stylesheet
13
+ * addresses the FAMILY and lets the browser pick by weight/style — but a native platform references
14
+ * a file directly, and it can't be derived from the family name. Optional because nothing that feeds
15
+ * a config records one today; it's author/upload-supplied.
16
+ */
17
+ declare const FontFile: SubEntityClass<z.ZodObject<{
18
+ src: z.ZodString;
19
+ format: z.ZodOptional<z.ZodString>;
20
+ weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
21
+ style: z.ZodOptional<z.ZodString>;
22
+ postscriptName: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>>;
24
+ /**
25
+ * Font (`fonts/yas`) — one family in a font library. The library (`fonts`) is an EMERGENT group from
26
+ * the path, carrying only its version; a family carries its own CSS-facing name, its files, and the
27
+ * governance/rendering flags a picker and `@font-face` emission need.
28
+ *
29
+ * A font is its own kind rather than a variant of a generic `asset` so that a `font:` ref is typed:
30
+ * only a font can be referenced where a family is expected, which is what the old config could
31
+ * only enforce by throwing at resolve time ("only font groups can be referenced as a token value").
32
+ */
33
+ declare const Font: EntityClass<z.ZodObject<{
34
+ fontFamily: z.ZodString;
35
+ files: z.ZodOptional<SubEntityClass<z.ZodObject<{
36
+ src: z.ZodString;
37
+ format: z.ZodOptional<z.ZodString>;
38
+ weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
39
+ style: z.ZodOptional<z.ZodString>;
40
+ postscriptName: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>>>;
42
+ fallbackStack: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
+ isVariableFont: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ version: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strict>, "font", Record<never, never>, Record<never, never>, false>;
47
+ //#endregion
48
+ export { Font, FontFile };
@@ -0,0 +1,56 @@
1
+ import { defineEntity } from "../../framework/defineEntity.js";
2
+ import { defineSubEntity } from "../../framework/defineSubEntity.js";
3
+ import { z } from "zod";
4
+ //#region src/entities/system/Font.ts
5
+ /**
6
+ * One FILE of a font family — the unit `@font-face` needs a rule for. Named `files` rather than
7
+ * `weights` because the two don't line up: a roman and an italic at 400 are two files sharing one
8
+ * weight, and a variable font is one file covering many (`weight: '100 900'`). `weightCount` is the
9
+ * derivation over these, not their count.
10
+ *
11
+ * `postscriptName` names this exact file (`YahooSans-BoldItalic`). CSS never needs it — a stylesheet
12
+ * addresses the FAMILY and lets the browser pick by weight/style — but a native platform references
13
+ * a file directly, and it can't be derived from the family name. Optional because nothing that feeds
14
+ * a config records one today; it's author/upload-supplied.
15
+ */
16
+ const FontFile = defineSubEntity({
17
+ name: "file",
18
+ label: "Font file",
19
+ labelPlural: "Files",
20
+ fields: z.object({
21
+ src: z.string(),
22
+ format: z.string().optional(),
23
+ /** `400`, or a RANGE (`'100 900'`) for a variable font's single file. */
24
+ weight: z.union([z.number(), z.string()]).optional(),
25
+ style: z.string().optional(),
26
+ postscriptName: z.string().optional()
27
+ })
28
+ });
29
+ /**
30
+ * Font (`fonts/yas`) — one family in a font library. The library (`fonts`) is an EMERGENT group from
31
+ * the path, carrying only its version; a family carries its own CSS-facing name, its files, and the
32
+ * governance/rendering flags a picker and `@font-face` emission need.
33
+ *
34
+ * A font is its own kind rather than a variant of a generic `asset` so that a `font:` ref is typed:
35
+ * only a font can be referenced where a family is expected, which is what the old config could
36
+ * only enforce by throwing at resolve time ("only font groups can be referenced as a token value").
37
+ */
38
+ const Font = defineEntity({
39
+ kind: "font",
40
+ label: "Font",
41
+ labelPlural: "Fonts",
42
+ fields: z.strictObject({
43
+ /** The CSS-facing family name (`'YA Sans'`) — required; a family without one can't be used. */
44
+ fontFamily: z.string(),
45
+ /** One entry per font file. */
46
+ files: FontFile.optional(),
47
+ /** Families to fall back to after this one, for a `font-family` stack. */
48
+ fallbackStack: z.array(z.string()).optional(),
49
+ /** Set explicitly; otherwise inferred from a file declaring a weight RANGE. */
50
+ isVariableFont: z.boolean().optional()
51
+ }),
52
+ groupFields: z.strictObject({ version: z.string().optional() }),
53
+ subEntities: { files: FontFile }
54
+ });
55
+ //#endregion
56
+ export { Font, FontFile };
@@ -0,0 +1,26 @@
1
+ import { EntityClass } from "../../framework/defineEntity.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/entities/system/GlobalStyle.d.ts
5
+ /** A declared value, or a nested block of them — an at-rule (`@keyframes`) and a grouped selector
6
+ * both hold rules rather than declarations, and they nest to any depth. */
7
+ type Declared = string | number | {
8
+ __ref: string;
9
+ } | {
10
+ [key: string]: Declared;
11
+ };
12
+ declare const GlobalStyle: EntityClass<z.ZodObject<{
13
+ selector: z.ZodString;
14
+ declarations: z.ZodRecord<z.ZodString, z.ZodType<Declared, unknown, z.core.$ZodTypeInternals<Declared, unknown>>>;
15
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "global-style", Record<never, never>, Record<never, never>, false>;
16
+ /**
17
+ * A stable name for a rule, from its selector — `@keyframes bounce` → `bounce`, `.prompt-editor p`
18
+ * → `promptEditorP`. Suffixed on collision, so two selectors that slug alike both land.
19
+ *
20
+ * For CONVERTING, not for authoring: an author names a rule by writing the key, and a migration has
21
+ * only the selector to go on. Exported so every converter derives the name the same way — two
22
+ * spellings of one rule is a system that can't tell they're the same one.
23
+ */
24
+ declare function globalStyleName(selector: string, taken?: ReadonlySet<string>): string;
25
+ //#endregion
26
+ export { GlobalStyle, globalStyleName };
@@ -0,0 +1,54 @@
1
+ import { refSchema } from "../../framework/utils/refs.js";
2
+ import { defineEntity } from "../../framework/defineEntity.js";
3
+ import { z } from "zod";
4
+ //#region src/entities/system/GlobalStyle.ts
5
+ /**
6
+ * `GlobalStyle` — a CSS rule a system declares outright, for the things no component owns.
7
+ *
8
+ * A design system is mostly components, and a component's styling belongs to the component. What's
9
+ * left over is real all the same: the page itself (`html, body`), a keyframe sequence, and the
10
+ * chrome around content a component can't reach into — a contenteditable's typography, which is
11
+ * styled by selector because there is no element to hand props to.
12
+ *
13
+ * v1 expressed this as `defineGlobalStyles((tokens) => ({ … }))` — a callback, because its values
14
+ * had to resolve tokens at config time and be baked to `var(…)` strings. Here a value may be a REF,
15
+ * so the dependency graph sees the edge and renaming a token cascades into the rule that uses it.
16
+ *
17
+ * The selector is a FIELD rather than the entity's path: a path's `/` means grouping, and a CSS
18
+ * selector may contain one (`[href="/home"]`). Naming each rule also reads better than a bare
19
+ * selector as a key — `page`, `bounce`, `promptEditor`.
20
+ */
21
+ const declared = z.lazy(() => z.union([
22
+ z.string(),
23
+ z.number(),
24
+ refSchema,
25
+ z.record(z.string(), declared)
26
+ ]));
27
+ const GlobalStyle = defineEntity({
28
+ kind: "global-style",
29
+ label: "Global style",
30
+ labelPlural: "Global styles",
31
+ fields: z.strictObject({
32
+ /** What the rule applies to — `html, body`, `@keyframes bounce`, `.prompt-editor p`. */
33
+ selector: z.string(),
34
+ /** Property → value, camelCase as it's authored; a nested record is a nested rule. */
35
+ declarations: z.record(z.string(), declared)
36
+ })
37
+ });
38
+ /**
39
+ * A stable name for a rule, from its selector — `@keyframes bounce` → `bounce`, `.prompt-editor p`
40
+ * → `promptEditorP`. Suffixed on collision, so two selectors that slug alike both land.
41
+ *
42
+ * For CONVERTING, not for authoring: an author names a rule by writing the key, and a migration has
43
+ * only the selector to go on. Exported so every converter derives the name the same way — two
44
+ * spellings of one rule is a system that can't tell they're the same one.
45
+ */
46
+ function globalStyleName(selector, taken = /* @__PURE__ */ new Set()) {
47
+ const words = selector.replace(/[^A-Za-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
48
+ const base = selector.startsWith("@keyframes") ? words.at(-1) ?? "rule" : words.map((word, index) => index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1)).join("") || "rule";
49
+ let name = base;
50
+ for (let n = 2; taken.has(name); n++) name = `${base}${n}`;
51
+ return name;
52
+ }
53
+ //#endregion
54
+ export { GlobalStyle, globalStyleName };
@@ -0,0 +1,85 @@
1
+ import { GuidanceLane } from "../../ai-lanes.js";
2
+ import { Ref } from "../../framework/utils/refs.js";
3
+ import { EntityClass } from "../../framework/defineEntity.js";
4
+ import { Config } from "../../framework/Config.js";
5
+ import { z } from "zod";
6
+
7
+ //#region src/entities/system/Guidance.d.ts
8
+ /**
9
+ * A `Guidance` — one piece of authoring guidance the design SYSTEM gives an AI (or a human) that
10
+ * composes with it: "use a brand variant for the primary action", "build the whole request", etc.
11
+ * It lives on the system (not hardcoded in the pipeline) so each design system can shape how it
12
+ * wants to be used, and the pipeline stays a pure transformer that just derives them into the
13
+ * prompt.
14
+ *
15
+ * Grouping is the path, not a field. A rule is filed under the topic it belongs to, so
16
+ * `semantics/typography` is a semantics rule the same way `color/brand` is a color token:
17
+ *
18
+ * ```ts
19
+ * guidance: {
20
+ * semantics: Guidance.group({
21
+ * label: 'Semantics',
22
+ * items: { typography: Guidance.item({ text: ['…'] }) },
23
+ * }),
24
+ * }
25
+ * ```
26
+ *
27
+ * The path is what makes a topic reorderable against its siblings, renameable with its rules following
28
+ * along, and addressable as `guidance:semantics/typography`.
29
+ *
30
+ * `fields` is non-strict (`z.object`) because older artifacts still store a `category` key; a
31
+ * non-strict shape drops it on load where a strict one would refuse the whole artifact.
32
+ */
33
+ /**
34
+ * One piece of a rule's text: a run of prose, or an `@mention` of a token or component stored as a
35
+ * {@link Ref}. `collectRefs`/`rewriteRefs` walk every entity's fields for the `{ __ref }` shape, so a
36
+ * mention follows renames, counts as a dependent and blocks deletes like any other ref.
37
+ */
38
+ type GuidanceSegment = string | Ref;
39
+ /**
40
+ * A rule's text flattened for display, each mention resolved to its target's current path. A mention
41
+ * whose target is missing (a source no longer attached) prints the ref's last-known path.
42
+ */
43
+ declare function guidanceTextOf(config: Config, text: readonly GuidanceSegment[]): string;
44
+ declare const Guidance: EntityClass<z.ZodObject<{
45
+ text: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
46
+ __ref: z.ZodString;
47
+ }, z.core.$strip>]>>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ label: z.ZodOptional<z.ZodString>;
50
+ description: z.ZodOptional<z.ZodString>;
51
+ appliesTo: z.ZodOptional<z.ZodArray<z.ZodEnum<{
52
+ chat: "chat";
53
+ huddle: "huddle";
54
+ "paint-style": "paint-style";
55
+ "figma-import": "figma-import";
56
+ }>>>;
57
+ }, z.core.$strict>, "guidance", Record<never, never>, Record<never, never>, false>;
58
+ /**
59
+ * A topic's effective reach, and which topic decided it. `appliesTo === undefined` means every
60
+ * lane. `declaredBy` is the topic the answer was read from, so a lane can say "inherited from
61
+ * Semantics" rather than showing an override the sub-topic never chose.
62
+ */
63
+ interface GuidanceScope {
64
+ readonly appliesTo: readonly GuidanceLane[] | undefined;
65
+ /** The topic that stored it: this topic, an ancestor, or `null` when nothing did. */
66
+ readonly declaredBy: string | null;
67
+ }
68
+ /**
69
+ * Which surfaces a topic's rules are fed to: its own `appliesTo`, else the nearest ancestor's, so
70
+ * scoping "Semantics" to chat scopes `semantics/color` too. An ungrouped rule keys on `''`, has no
71
+ * ancestor, and reaches everywhere.
72
+ */
73
+ declare function guidanceScopeOf(config: Config, topic: string): GuidanceScope;
74
+ /** Whether a topic's rules reach `lane`, inheritance included. */
75
+ declare function guidanceReaches({
76
+ config,
77
+ topic,
78
+ lane
79
+ }: {
80
+ config: Config;
81
+ topic: string;
82
+ lane: GuidanceLane;
83
+ }): boolean;
84
+ //#endregion
85
+ export { Guidance, GuidanceScope, GuidanceSegment, guidanceReaches, guidanceScopeOf, guidanceTextOf };
@@ -0,0 +1,59 @@
1
+ import { GUIDANCE_LANES } from "../../ai-lanes.js";
2
+ import { isRef, kindOf, pathOf, refSchema } from "../../framework/utils/refs.js";
3
+ import { defineEntity } from "../../framework/defineEntity.js";
4
+ import { z } from "zod";
5
+ //#region src/entities/system/Guidance.ts
6
+ /**
7
+ * A rule's text flattened for display, each mention resolved to its target's current path. A mention
8
+ * whose target is missing (a source no longer attached) prints the ref's last-known path.
9
+ */
10
+ function guidanceTextOf(config, text) {
11
+ return text.map((segment) => isRef(segment) ? config.resolve(kindOf(segment), pathOf(segment))?.path ?? pathOf(segment) : segment).join("");
12
+ }
13
+ const Guidance = defineEntity({
14
+ kind: "guidance",
15
+ label: "Guidance",
16
+ labelPlural: "Guidance",
17
+ fields: z.object({ text: z.array(z.union([z.string(), refSchema])) }),
18
+ groupFields: z.strictObject({
19
+ /** Display name for the topic; falls back to the group's own path segment. */
20
+ label: z.string().optional(),
21
+ /** What the topic covers, for the editor, not the prompt. */
22
+ description: z.string().optional(),
23
+ /**
24
+ * Which AI lanes this topic is fed to. Absent means every lane. An empty array is a topic
25
+ * turned off everywhere, which is what unchecking the last box stores.
26
+ */
27
+ appliesTo: z.array(z.enum(GUIDANCE_LANES)).optional()
28
+ })
29
+ });
30
+ /** Nothing up the chain scoped anything, so the rules reach every surface. */
31
+ const UNSCOPED = {
32
+ appliesTo: void 0,
33
+ declaredBy: null
34
+ };
35
+ /**
36
+ * Which surfaces a topic's rules are fed to: its own `appliesTo`, else the nearest ancestor's, so
37
+ * scoping "Semantics" to chat scopes `semantics/color` too. An ungrouped rule keys on `''`, has no
38
+ * ancestor, and reaches everywhere.
39
+ */
40
+ function guidanceScopeOf(config, topic) {
41
+ let current = topic;
42
+ while (current !== "") {
43
+ const appliesTo = config.groupMeta("guidance", current)?.appliesTo;
44
+ if (Array.isArray(appliesTo)) return {
45
+ appliesTo,
46
+ declaredBy: current
47
+ };
48
+ const slash = current.lastIndexOf("/");
49
+ current = slash === -1 ? "" : current.slice(0, slash);
50
+ }
51
+ return UNSCOPED;
52
+ }
53
+ /** Whether a topic's rules reach `lane`, inheritance included. */
54
+ function guidanceReaches({ config, topic, lane }) {
55
+ const { appliesTo } = guidanceScopeOf(config, topic);
56
+ return appliesTo === void 0 || appliesTo.includes(lane);
57
+ }
58
+ //#endregion
59
+ export { Guidance, guidanceReaches, guidanceScopeOf, guidanceTextOf };
@@ -0,0 +1,14 @@
1
+ import { EntityClass } from "../../framework/defineEntity.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/entities/system/GuidanceStyle.d.ts
5
+ declare const guidanceStyleFields: z.ZodObject<{
6
+ text: z.ZodString;
7
+ }, z.core.$strip>;
8
+ /** A style guide's stored body. */
9
+ type GuidanceStyleBody = z.infer<typeof guidanceStyleFields>;
10
+ declare const GuidanceStyle: EntityClass<z.ZodObject<{
11
+ text: z.ZodString;
12
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "guidance-style", Record<never, never>, Record<never, never>, false>;
13
+ //#endregion
14
+ export { GuidanceStyle, GuidanceStyleBody };
@@ -0,0 +1,8 @@
1
+ import { defineEntity } from "../../framework/defineEntity.js";
2
+ import { z } from "zod";
3
+ const GuidanceStyle = defineEntity({
4
+ kind: "guidance-style",
5
+ fields: z.object({ text: z.string() })
6
+ });
7
+ //#endregion
8
+ export { GuidanceStyle };