@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
@@ -1,7 +1,7 @@
1
1
  import { RegistryDescriptor } from "./wrapRegistry.js";
2
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
3
  import { ReactNode } from "react";
3
4
  import { ComponentRegistry, JSONUIProviderProps } from "@json-render/react";
4
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import { Spec } from "@json-render/core";
6
6
 
7
7
  //#region src/renderer/UdsRenderer.d.ts
@@ -10,11 +10,11 @@ interface UdsRendererProps {
10
10
  loading?: boolean;
11
11
  /**
12
12
  * Component registry to render with. Typically the codegen-emitted
13
- * `bundleRegistry` (already composed through `makeRegistry`) —
14
- * passed in by the project's `.uds/react-renderer.tsx` shell. Hosts
15
- * can supply their own to override or extend it; we re-run the
16
- * wrapper stack so built-in primitives + slot/event/style
17
- * normalisation still apply.
13
+ * bundle registry (assembled through `defineRegistry` over the emitted
14
+ * entries) — passed in by the project's `.uds/react-renderer.tsx` shell.
15
+ * Hosts can supply their own to override or extend it; we re-run the
16
+ * wrapper stack so built-in primitives + event/style normalisation
17
+ * still apply.
18
18
  */
19
19
  registry: ComponentRegistry;
20
20
  /** Action handlers (`emit`-target name → async function). */
@@ -41,10 +41,11 @@ interface UdsRendererProps {
41
41
  /** Fallback renderer when the spec references an unknown type. */
42
42
  fallback?: ComponentRegistry[string];
43
43
  /**
44
- * Config-derived facts for the wrapper stack (void components, CSS→style-prop
45
- * map, layout/text sets). The codegen-emitted bundle registry was already
46
- * wrapped with this; only needed here when a host supplies its own `registry`
47
- * that should get the same config-aware normalisation.
44
+ * Config-derived facts for the wrapper stack (CSS→style-prop map,
45
+ * style-prop class map, layout/text sets). The codegen-emitted bundle
46
+ * registry was already wrapped with this; only needed here when a host
47
+ * supplies its own `registry` that should get the same config-aware
48
+ * normalisation.
48
49
  */
49
50
  registryDescriptor?: RegistryDescriptor;
50
51
  /**
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { wrapRegistry } from "./wrapRegistry.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
3
4
  import { useMemo } from "react";
4
5
  import { JSONUIProvider, Renderer } from "@json-render/react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { MotionConfig } from "motion/react";
7
7
  //#region src/renderer/UdsRenderer.tsx
8
8
  /**
@@ -0,0 +1,37 @@
1
+ import { IconLibrary } from "./icon-library.js";
2
+ import { AssetRenderProps } from "./assetRenderable.js";
3
+ import { ComponentEntry } from "./componentEntry.js";
4
+ import React from "react";
5
+
6
+ //#region src/renderer/assetEntries.d.ts
7
+ /** Plain, provider-free asset renderables indexed `slug → name → component`.
8
+ * Each is `makeAssetRenderable(SystemComponent, member, name)` — the SAME
9
+ * component identity the registry keys under the namespaced asset type, but
10
+ * surfaced directly so callers (e.g. the icon picker) can render a single
11
+ * glyph without standing up a json-render engine per cell. */
12
+ type AssetMembers = ReadonlyMap<string, ReadonlyMap<string, React.ComponentType<AssetRenderProps>>>;
13
+ interface AssetEntriesResult {
14
+ /** One ctx-shaped entry per placed glyph, keyed by its spec `type` (`icon:icons/Trophy`). */
15
+ entries: Record<string, ComponentEntry>;
16
+ /** @see AssetMembers — empty when the config registers no placeable assets. */
17
+ assetMembers: AssetMembers;
18
+ }
19
+ /**
20
+ * Registry entries for a config's placeable asset libraries.
21
+ *
22
+ * Each glyph keys under the member's own ref (`icon:icons/Trophy`) — a `kind:path` key can't
23
+ * collide with a `component:` or `package:` key, so the entries merge into the registry's
24
+ * component map safely. In the same pass (`libraries` may be a one-shot iterator), each member is
25
+ * indexed by slug + name so a picker can render one glyph directly.
26
+ */
27
+ declare function assetRegistryEntries({
28
+ libraries,
29
+ components
30
+ }: {
31
+ libraries: Iterable<IconLibrary>;
32
+ /** The registry's own component bindings — where a group's declared system component (its
33
+ * `Icon`, which owns the set-specific size/variant → glyph mapping) is resolved from. */
34
+ components: Record<string, React.ComponentType<any>>;
35
+ }): AssetEntriesResult;
36
+ //#endregion
37
+ export { AssetEntriesResult, AssetMembers, assetRegistryEntries };
@@ -0,0 +1,39 @@
1
+ import { makeAssetRenderable } from "./assetRenderable.js";
2
+ import { makeComponentEntry } from "./componentEntry.js";
3
+ //#region src/renderer/assetEntries.ts
4
+ /**
5
+ * Registry entries for a config's placeable asset libraries.
6
+ *
7
+ * Each glyph keys under the member's own ref (`icon:icons/Trophy`) — a `kind:path` key can't
8
+ * collide with a `component:` or `package:` key, so the entries merge into the registry's
9
+ * component map safely. In the same pass (`libraries` may be a one-shot iterator), each member is
10
+ * indexed by slug + name so a picker can render one glyph directly.
11
+ */
12
+ function assetRegistryEntries({ libraries, components }) {
13
+ const entries = {};
14
+ const assetMembers = /* @__PURE__ */ new Map();
15
+ for (const group of libraries) {
16
+ const members = group.members;
17
+ if (!members) continue;
18
+ const SystemComponent = group.component !== void 0 ? components[group.component] : void 0;
19
+ const bySlug = /* @__PURE__ */ new Map();
20
+ for (const name of group.assetNames) {
21
+ const member = members[name];
22
+ if (member === void 0) continue;
23
+ const Renderable = makeAssetRenderable(SystemComponent, member, name);
24
+ const key = group.assetType(name);
25
+ entries[key] = makeComponentEntry({
26
+ component: Renderable,
27
+ name: key
28
+ });
29
+ bySlug.set(name, Renderable);
30
+ }
31
+ assetMembers.set(group.name, bySlug);
32
+ }
33
+ return {
34
+ entries,
35
+ assetMembers
36
+ };
37
+ }
38
+ //#endregion
39
+ export { assetRegistryEntries };
@@ -3,15 +3,23 @@ import React from "react";
3
3
  //#region src/renderer/assetRenderable.d.ts
4
4
  /** Props callers pass when rendering an asset member directly (icon picker
5
5
  * grid, drag ghost). The member — or the system component it renders through —
6
- * maps these to a glyph; the registry-derived `name` always wins, and any
7
- * extra props are ignored by static glyphs. The open index lets a caller pass
8
- * a system-component prop it resolved from the config (e.g. the prop that
9
- * binds CSS `color`, so a chrome surface can make the glyph inherit its own
10
- * text color) without this contract naming any system's props. */
6
+ * maps these to a glyph; the registry-derived `name` always wins.
7
+ *
8
+ * The type is deliberately CLOSED (no index signature), so a misspelled
9
+ * `variant` or `size` at a render site is a compile error rather than a glyph
10
+ * quietly drawn with its defaults. A caller that has resolved a
11
+ * system-component prop from the config (e.g. the prop that binds CSS `color`,
12
+ * so a chrome surface can make the glyph inherit its own text color) hands it
13
+ * through `systemProps` — one named channel, so this contract never has to
14
+ * name any system's props and never has to open up to admit them. */
11
15
  type AssetRenderProps = {
12
16
  variant?: string;
13
17
  size?: string | number;
14
- [systemProp: string]: unknown;
18
+ /** Props of the system component the member renders through, resolved from
19
+ * the config by the caller and spread onto it verbatim. Ignored when no
20
+ * system component is bound: they were resolved for that component, and a
21
+ * raw glyph has no use for them. */
22
+ systemProps?: Readonly<Record<string, string>>;
15
23
  };
16
24
  //#endregion
17
25
  export { AssetRenderProps };
@@ -1,9 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  //#region src/renderer/assetRenderable.tsx
3
3
  function makeAssetRenderable(SystemComponent, member, name) {
4
- if (SystemComponent === void 0) return member;
5
- return function AssetRenderable(props) {
4
+ if (SystemComponent === void 0) {
5
+ const Member = member;
6
+ return function RawAssetRenderable({ systemProps: _, ...props }) {
7
+ return /* @__PURE__ */ jsx(Member, { ...props });
8
+ };
9
+ }
10
+ return function AssetRenderable({ systemProps, ...props }) {
6
11
  return /* @__PURE__ */ jsx(SystemComponent, {
12
+ ...systemProps,
7
13
  ...props,
8
14
  name
9
15
  });
@@ -0,0 +1,58 @@
1
+ import React from "react";
2
+ import { BaseComponentProps, ComponentRenderer } from "@json-render/react";
3
+
4
+ //#region src/renderer/componentEntry.d.ts
5
+ /**
6
+ * A ctx-shaped registry entry — the function `defineRegistry(catalog, { components })` takes.
7
+ * Codegen emits one per component (`export const ButtonEntry = makeComponentEntry({ … })`), so a
8
+ * loaded component module carries its own registry entry and the registry assembles from imports.
9
+ */
10
+ type ComponentEntry = (ctx: BaseComponentProps) => React.ReactNode;
11
+ /**
12
+ * A resolved native slot fill, as the component's prop consumes it. json-render resolves the
13
+ * element's `slots` field (`Record<string, string[]>`) to rendered children and hands each slot an
14
+ * array; a UDS component reads a fill as an ordinary prop (`props.startIcon`), where a single node
15
+ * is the expected shape — some renders clone or inspect it. An empty array is a cleared slot, and
16
+ * clears the prop with it (`[]` is truthy, so passing it through would make `{props.startIcon &&
17
+ * …}` paint an empty box).
18
+ */
19
+ declare function slotFillValue(fill: React.ReactNode): React.ReactNode;
20
+ interface MakeComponentEntryOptions {
21
+ component: React.ComponentType<any>;
22
+ /**
23
+ * The component takes no children — a void root (`img`, `input`) or no `children` slot
24
+ * (`childrenPolicy === 'none'`). Children reach a component through two channels — the rendered
25
+ * children stream and a stray authored `children` prop — and both are dropped: React throws when
26
+ * a void element receives children, and a childless render would forward them onto a nested void
27
+ * element (a `div`-rooted form control's `<input>`) and throw. Named slot fills still route —
28
+ * that is how a childless component takes an `actions`-style fill.
29
+ */
30
+ childless?: boolean;
31
+ /**
32
+ * Label for the entry's error tile — the registry key (`component:<path>`), baked in by codegen
33
+ * like `childless`. Falls back to the component's own name when absent.
34
+ */
35
+ name?: string;
36
+ }
37
+ /**
38
+ * One component's registry entry.
39
+ *
40
+ * Codegen emits the call beside the component itself, with the component's own facts baked in —
41
+ * which is what retires the name-matching wrapper stack: void-ness is an argument, not a lookup.
42
+ * The entry consumes json-render's ctx shape natively (`props`, never `element.props`), so
43
+ * `defineRegistry` adapts it without a second conversion — routing element-shaped renderers through
44
+ * that adapter produced a non-renderable object on React Native.
45
+ */
46
+ declare function makeComponentEntry({
47
+ component: Comp,
48
+ childless,
49
+ name
50
+ }: MakeComponentEntryOptions): ComponentEntry;
51
+ /**
52
+ * A ctx-shaped entry as json-render's element-shaped `ComponentRenderer` — the same adaptation
53
+ * `defineRegistry` performs, for a registry assembled one entry at a time (Studio's dynamic
54
+ * per-module registry loads an entry from its compiled module and installs it directly).
55
+ */
56
+ declare function entryRenderer(entry: ComponentEntry): ComponentRenderer;
57
+ //#endregion
58
+ export { ComponentEntry, MakeComponentEntryOptions, entryRenderer, makeComponentEntry, slotFillValue };
@@ -0,0 +1,71 @@
1
+ import { RendererErrorBoundary } from "./RendererErrorBoundary.js";
2
+ import { specContent } from "./spec-content.js";
3
+ import React from "react";
4
+ //#region src/renderer/componentEntry.tsx
5
+ /**
6
+ * A resolved native slot fill, as the component's prop consumes it. json-render resolves the
7
+ * element's `slots` field (`Record<string, string[]>`) to rendered children and hands each slot an
8
+ * array; a UDS component reads a fill as an ordinary prop (`props.startIcon`), where a single node
9
+ * is the expected shape — some renders clone or inspect it. An empty array is a cleared slot, and
10
+ * clears the prop with it (`[]` is truthy, so passing it through would make `{props.startIcon &&
11
+ * …}` paint an empty box).
12
+ */
13
+ function slotFillValue(fill) {
14
+ if (!Array.isArray(fill)) return fill;
15
+ if (fill.length === 0) return void 0;
16
+ return fill.length === 1 ? fill[0] : fill;
17
+ }
18
+ /**
19
+ * One component's registry entry.
20
+ *
21
+ * Codegen emits the call beside the component itself, with the component's own facts baked in —
22
+ * which is what retires the name-matching wrapper stack: void-ness is an argument, not a lookup.
23
+ * The entry consumes json-render's ctx shape natively (`props`, never `element.props`), so
24
+ * `defineRegistry` adapts it without a second conversion — routing element-shaped renderers through
25
+ * that adapter produced a non-renderable object on React Native.
26
+ */
27
+ function makeComponentEntry({ component: Comp, childless, name }) {
28
+ const label = name ?? Comp.displayName ?? Comp.name ?? "component";
29
+ return function ComponentEntry({ props: elementProps, children, slots }) {
30
+ let props = elementProps ?? {};
31
+ if (slots) {
32
+ const filled = { ...props };
33
+ for (const [name, fill] of Object.entries(slots)) filled[name] = slotFillValue(fill);
34
+ props = filled;
35
+ }
36
+ const { children: propChildren, ...rest } = props;
37
+ let rendered;
38
+ if (childless) rendered = React.createElement(Comp, rest);
39
+ else {
40
+ const finalChildren = specContent({
41
+ children,
42
+ propChildren
43
+ });
44
+ rendered = finalChildren !== void 0 && finalChildren !== null ? React.createElement(Comp, rest, finalChildren) : React.createElement(Comp, rest);
45
+ }
46
+ return React.createElement(RendererErrorBoundary, {
47
+ name: label,
48
+ resetKey: elementProps
49
+ }, rendered);
50
+ };
51
+ }
52
+ /**
53
+ * A ctx-shaped entry as json-render's element-shaped `ComponentRenderer` — the same adaptation
54
+ * `defineRegistry` performs, for a registry assembled one entry at a time (Studio's dynamic
55
+ * per-module registry loads an entry from its compiled module and installs it directly).
56
+ */
57
+ function entryRenderer(entry) {
58
+ return function EntryRenderer({ element, children, slots, emit, on, bindings, loading }) {
59
+ return entry({
60
+ props: element.props ?? {},
61
+ children,
62
+ slots,
63
+ emit,
64
+ on,
65
+ bindings,
66
+ loading
67
+ });
68
+ };
69
+ }
70
+ //#endregion
71
+ export { entryRenderer, makeComponentEntry, slotFillValue };
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+
3
+ //#region src/renderer/icon-library.d.ts
4
+ interface IconLibrary {
5
+ /** The slug members are indexed under — `phosphor`. */
6
+ readonly name: string;
7
+ /** The component members render THROUGH, keyed by its registry ref stored verbatim
8
+ * (`component:primitives/Icon`, not the stripped path) — a library's own `Icon`, which owns the
9
+ * set-specific size/variant → glyph mapping. Absent, a member draws itself. */
10
+ readonly component?: string;
11
+ /** The members to register, in the order they should appear. */
12
+ readonly assetNames: readonly string[];
13
+ /** Name → the component that draws it. Absent for a library rebuilt from JSON, which has names but
14
+ * nothing live to render — a browser surface draws those through the bundled registry instead. */
15
+ readonly members?: Record<string, React.ComponentType<any> | undefined>;
16
+ /** The spec `type` one member is addressed by — `icon:phosphor/StarIcon`. */
17
+ readonly assetType: (name: string) => string;
18
+ }
19
+ //#endregion
20
+ export { IconLibrary };
@@ -1,14 +1,14 @@
1
- import { RegistryDescriptor, wrapRegistry } from "./wrapRegistry.js";
2
- import { AssetMembers, MakeRegistryResult, makeRegistry } from "./makeRegistry.js";
3
- import { makeUdsRenderer } from "./makeUdsRenderer.js";
1
+ import { ComponentEntry, MakeComponentEntryOptions, entryRenderer, makeComponentEntry, slotFillValue } from "./componentEntry.js";
2
+ import { AssetEntriesResult, AssetMembers, assetRegistryEntries } from "./assetEntries.js";
4
3
  import { FragmentRenderer } from "./primitives/FragmentRenderer.js";
5
4
  import { SlotRenderer } from "./primitives/SlotRenderer.js";
6
5
  import { RendererErrorBoundary } from "./RendererErrorBoundary.js";
6
+ import { RuntimeComponentFailureContext, RuntimeComponentFailureReporter, RuntimeComponentRebuildContext, RuntimeComponentRebuildReporter, RuntimeComponentStatus, RuntimeComponentStore, RuntimeComponentStoreContext, installRuntimeComponentStore, runtimeComponent } from "./runtimeComponent.js";
7
+ import { REVEALED_LAYER_ATTR, specContent } from "./spec-content.js";
8
+ import { aliasHtmlTypes } from "./wrappers/html-aliases.js";
9
+ import { RegistryDescriptor, wrapRegistry } from "./wrapRegistry.js";
7
10
  import { UdsRenderer, UdsRendererProps } from "./UdsRenderer.js";
8
11
  import { wrapEventBridge } from "./wrappers/event-bridge.js";
9
12
  import { wrapNormalizeHex } from "./wrappers/hex-normalize.js";
10
- import { aliasHtmlTypes } from "./wrappers/html-aliases.js";
11
13
  import { wrapInlineStyleProps } from "./wrappers/inline-styles.js";
12
- import { wrapSlotResolution } from "./wrappers/slot-resolution.js";
13
- import { wrapVoidElements } from "./wrappers/void-elements.js";
14
- export { type AssetMembers, FragmentRenderer, type MakeRegistryResult, type RegistryDescriptor, RendererErrorBoundary, SlotRenderer, UdsRenderer, type UdsRendererProps, aliasHtmlTypes, makeRegistry, makeUdsRenderer, wrapEventBridge, wrapInlineStyleProps, wrapNormalizeHex, wrapRegistry, wrapSlotResolution, wrapVoidElements };
14
+ export { type AssetEntriesResult, type AssetMembers, type ComponentEntry, FragmentRenderer, type MakeComponentEntryOptions, REVEALED_LAYER_ATTR, type RegistryDescriptor, RendererErrorBoundary, RuntimeComponentFailureContext, type RuntimeComponentFailureReporter, RuntimeComponentRebuildContext, type RuntimeComponentRebuildReporter, type RuntimeComponentStatus, type RuntimeComponentStore, RuntimeComponentStoreContext, SlotRenderer, UdsRenderer, type UdsRendererProps, aliasHtmlTypes, assetRegistryEntries, entryRenderer, installRuntimeComponentStore, makeComponentEntry, runtimeComponent, slotFillValue, specContent, wrapEventBridge, wrapInlineStyleProps, wrapNormalizeHex, wrapRegistry };
@@ -1,14 +1,14 @@
1
1
  import { RendererErrorBoundary } from "./RendererErrorBoundary.js";
2
- import { makeUdsRenderer } from "./makeUdsRenderer.js";
2
+ import { REVEALED_LAYER_ATTR, specContent } from "./spec-content.js";
3
+ import { entryRenderer, makeComponentEntry, slotFillValue } from "./componentEntry.js";
4
+ import { assetRegistryEntries } from "./assetEntries.js";
3
5
  import { FragmentRenderer } from "./primitives/FragmentRenderer.js";
4
6
  import { SlotRenderer } from "./primitives/SlotRenderer.js";
7
+ import { RuntimeComponentFailureContext, RuntimeComponentRebuildContext, RuntimeComponentStoreContext, installRuntimeComponentStore, runtimeComponent } from "./runtimeComponent.js";
5
8
  import { wrapEventBridge } from "./wrappers/event-bridge.js";
6
9
  import { wrapNormalizeHex } from "./wrappers/hex-normalize.js";
7
10
  import { aliasHtmlTypes } from "./wrappers/html-aliases.js";
8
11
  import { wrapInlineStyleProps } from "./wrappers/inline-styles.js";
9
- import { wrapSlotResolution } from "./wrappers/slot-resolution.js";
10
- import { wrapVoidElements } from "./wrappers/void-elements.js";
11
12
  import { wrapRegistry } from "./wrapRegistry.js";
12
- import { makeRegistry } from "./makeRegistry.js";
13
13
  import { UdsRenderer } from "./UdsRenderer.js";
14
- export { FragmentRenderer, RendererErrorBoundary, SlotRenderer, UdsRenderer, aliasHtmlTypes, makeRegistry, makeUdsRenderer, wrapEventBridge, wrapInlineStyleProps, wrapNormalizeHex, wrapRegistry, wrapSlotResolution, wrapVoidElements };
14
+ export { FragmentRenderer, REVEALED_LAYER_ATTR, RendererErrorBoundary, RuntimeComponentFailureContext, RuntimeComponentRebuildContext, RuntimeComponentStoreContext, SlotRenderer, UdsRenderer, aliasHtmlTypes, assetRegistryEntries, entryRenderer, installRuntimeComponentStore, makeComponentEntry, runtimeComponent, slotFillValue, specContent, wrapEventBridge, wrapInlineStyleProps, wrapNormalizeHex, wrapRegistry };
@@ -13,7 +13,7 @@ import { ComponentRenderer } from "@json-render/react";
13
13
  *
14
14
  * Plain `Slot` (not `$Slot`) matches json-render's convention:
15
15
  * `$prefix` names are reserved for prop-value expressions
16
- * (`$state`, `$bindState`, `$slot`, `$template`, etc.). Element
16
+ * (`$state`, `$bindState`, `$template`, etc.). Element
17
17
  * types are plain names, like `Fragment`.
18
18
  */
19
19
  declare const SlotRenderer: ComponentRenderer;
@@ -12,7 +12,7 @@ import { Fragment, jsx } from "react/jsx-runtime";
12
12
  *
13
13
  * Plain `Slot` (not `$Slot`) matches json-render's convention:
14
14
  * `$prefix` names are reserved for prop-value expressions
15
- * (`$state`, `$bindState`, `$slot`, `$template`, etc.). Element
15
+ * (`$state`, `$bindState`, `$template`, etc.). Element
16
16
  * types are plain names, like `Fragment`.
17
17
  */
18
18
  const SlotRenderer = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+
3
+ //#region src/renderer/runtimeComponent.d.ts
4
+ type RuntimeComponentStatus = 'current' | 'loading' | 'failed';
5
+ /**
6
+ * Branch-scoped live component state consumed by component imports inside standalone modules.
7
+ * Stable refs are the API; pushed and freshly compiled React implementations remain cache data.
8
+ */
9
+ interface RuntimeComponentStore {
10
+ readonly activate: (componentRef: string) => void;
11
+ readonly component: (componentRef: string) => React.ElementType | undefined;
12
+ readonly status: (componentRef: string) => RuntimeComponentStatus;
13
+ readonly error?: (componentRef: string) => unknown;
14
+ readonly subscribe: (componentRef: string, listener: () => void) => () => void;
15
+ readonly version: (componentRef: string) => number;
16
+ }
17
+ type RuntimeComponentRebuildReporter = (componentRef: string, delta: 1 | -1) => void;
18
+ type RuntimeComponentFailureReporter = (componentRef: string, error: unknown, delta: 1 | -1) => void;
19
+ declare const RuntimeComponentRebuildContext: React.Context<RuntimeComponentRebuildReporter | null>;
20
+ declare const RuntimeComponentFailureContext: React.Context<RuntimeComponentFailureReporter | null>;
21
+ declare const RuntimeComponentStoreContext: React.Context<RuntimeComponentStore | null>;
22
+ /** Install one branch's resolver. The returned cleanup cannot remove a newer replacement. */
23
+ declare function installRuntimeComponentStore(branchId: string, store: RuntimeComponentStore): () => void;
24
+ /**
25
+ * A normal React component import whose implementation resolves through the branch's live registry.
26
+ *
27
+ * Standalone modules call this at module scope after codegen replaces a component-only source
28
+ * import. `import.meta.url` is then that module's authenticated runtime URL, which already carries
29
+ * its branch id. The optional id exists for hosts and focused tests that are not runtime modules.
30
+ */
31
+ declare function runtimeComponent<Props extends object = Record<string, unknown>>(componentRef: string, explicitBranchId?: string): React.ForwardRefExoticComponent<React.PropsWithoutRef<Props> & React.RefAttributes<unknown>>;
32
+ //#endregion
33
+ export { RuntimeComponentFailureContext, RuntimeComponentFailureReporter, RuntimeComponentRebuildContext, RuntimeComponentRebuildReporter, RuntimeComponentStatus, RuntimeComponentStore, RuntimeComponentStoreContext, installRuntimeComponentStore, runtimeComponent };
@@ -0,0 +1,113 @@
1
+ import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useSyncExternalStore } from "react";
2
+ //#region src/renderer/runtimeComponent.tsx
3
+ const STORES = Symbol.for("@yahoo/uds-create/runtime-component-stores");
4
+ const REBUILD_CONTEXT = Symbol.for("@yahoo/uds-create/runtime-component-rebuild-context");
5
+ const FAILURE_CONTEXT = Symbol.for("@yahoo/uds-create/runtime-component-failure-context");
6
+ const STORE_CONTEXT = Symbol.for("@yahoo/uds-create/runtime-component-store-context");
7
+ const globals = globalThis;
8
+ function stores() {
9
+ const current = globals[STORES];
10
+ if (current) return current;
11
+ const created = /* @__PURE__ */ new Map();
12
+ globals[STORES] = created;
13
+ return created;
14
+ }
15
+ /** Shared even when this helper is bundled into several independently loaded component modules. */
16
+ function rebuildContext() {
17
+ const current = globals[REBUILD_CONTEXT];
18
+ if (current) return current;
19
+ const created = createContext(null);
20
+ globals[REBUILD_CONTEXT] = created;
21
+ return created;
22
+ }
23
+ const RuntimeComponentRebuildContext = rebuildContext();
24
+ /** Shared separately from rebuilding so already-pushed bundles keep their existing reporter ABI. */
25
+ function failureContext() {
26
+ const current = globals[FAILURE_CONTEXT];
27
+ if (current) return current;
28
+ const created = createContext(null);
29
+ globals[FAILURE_CONTEXT] = created;
30
+ return created;
31
+ }
32
+ const RuntimeComponentFailureContext = failureContext();
33
+ /**
34
+ * The resolver owned by the current rendered registry.
35
+ *
36
+ * Studio still has two preview-bundle owners: per-branch system-editor stores and a legacy
37
+ * singleton for design canvases. Both can exist in one page, so branch id alone cannot select the
38
+ * right in-memory overlay. A registry entry provides this context around its renderer; the global
39
+ * branch map below remains the fallback for standalone hosts.
40
+ */
41
+ function storeContext() {
42
+ const current = globals[STORE_CONTEXT];
43
+ if (current) return current;
44
+ const created = createContext(null);
45
+ globals[STORE_CONTEXT] = created;
46
+ return created;
47
+ }
48
+ const RuntimeComponentStoreContext = storeContext();
49
+ /** Install one branch's resolver. The returned cleanup cannot remove a newer replacement. */
50
+ function installRuntimeComponentStore(branchId, store) {
51
+ stores().set(branchId, store);
52
+ return () => {
53
+ if (stores().get(branchId) === store) stores().delete(branchId);
54
+ };
55
+ }
56
+ function storeFor(branchId) {
57
+ return branchId ? stores().get(branchId) ?? null : null;
58
+ }
59
+ function branchIdFromModuleUrl() {
60
+ try {
61
+ return new URL(import.meta.url).searchParams.get("branchId") ?? void 0;
62
+ } catch {
63
+ return;
64
+ }
65
+ }
66
+ const noopUnsubscribe = () => {};
67
+ /**
68
+ * A normal React component import whose implementation resolves through the branch's live registry.
69
+ *
70
+ * Standalone modules call this at module scope after codegen replaces a component-only source
71
+ * import. `import.meta.url` is then that module's authenticated runtime URL, which already carries
72
+ * its branch id. The optional id exists for hosts and focused tests that are not runtime modules.
73
+ */
74
+ function runtimeComponent(componentRef, explicitBranchId) {
75
+ const branchId = explicitBranchId ?? branchIdFromModuleUrl();
76
+ const DynamicComponent = forwardRef((props, forwardedRef) => {
77
+ const store = useContext(RuntimeComponentStoreContext) ?? storeFor(branchId);
78
+ const subscribe = useCallback((listener) => store?.subscribe(componentRef, listener) ?? noopUnsubscribe, [componentRef, store]);
79
+ const snapshot = useCallback(() => store?.version(componentRef) ?? 0, [componentRef, store]);
80
+ useSyncExternalStore(subscribe, snapshot, snapshot);
81
+ const reportRebuild = useContext(RuntimeComponentRebuildContext);
82
+ const reportFailure = useContext(RuntimeComponentFailureContext);
83
+ const status = store?.status(componentRef);
84
+ const rebuilding = status === "loading";
85
+ const failed = status === "failed";
86
+ const error = failed ? store?.error?.(componentRef) : void 0;
87
+ useEffect(() => store?.activate(componentRef), [store]);
88
+ useEffect(() => {
89
+ if (!reportRebuild || !rebuilding) return;
90
+ reportRebuild(componentRef, 1);
91
+ return () => reportRebuild(componentRef, -1);
92
+ }, [reportRebuild, rebuilding]);
93
+ useEffect(() => {
94
+ if (!reportFailure || !failed) return;
95
+ reportFailure(componentRef, error, 1);
96
+ return () => reportFailure(componentRef, error, -1);
97
+ }, [
98
+ reportFailure,
99
+ failed,
100
+ error
101
+ ]);
102
+ const Paint = store?.component(componentRef);
103
+ if (!Paint) return null;
104
+ return createElement(Paint, forwardedRef == null ? props : {
105
+ ...props,
106
+ ref: forwardedRef
107
+ });
108
+ });
109
+ DynamicComponent.displayName = `RuntimeComponent(${componentRef})`;
110
+ return DynamicComponent;
111
+ }
112
+ //#endregion
113
+ export { RuntimeComponentFailureContext, RuntimeComponentRebuildContext, RuntimeComponentStoreContext, installRuntimeComponentStore, runtimeComponent };
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+
3
+ //#region src/renderer/spec-content.d.ts
4
+ /**
5
+ * The marker an editor stamps on a layer it paints although the layer's own condition hides it in
6
+ * that cell. Its value names why the layer was hidden.
7
+ */
8
+ declare const REVEALED_LAYER_ATTR = "data-uds-ghost";
9
+ /**
10
+ * The one merge of a spec element's two content channels.
11
+ *
12
+ * An element carries content twice — `element.children` holds keys json-render renders into the
13
+ * children stream, `props.children` holds an authored label — and every render path has to decide
14
+ * between them the same way, or a component paints differently through its compiled entry than
15
+ * through an expanded anatomy's intrinsic tags.
16
+ *
17
+ * Spec children win over a `props.children` label — but ONLY ones that paint. A container whose
18
+ * spec children all render nothing (see {@link rendersNothing}) is empty as far as the label is
19
+ * concerned, so the label renders first and they follow it, preserving the canvas's
20
+ * bottom-insertion affordance.
21
+ *
22
+ * A `children` label coexists with the element's own spec children rather than losing to them:
23
+ * Button's anatomy is icon-box layers as children edges PLUS the label as a string `children`
24
+ * prop, and the built module paints both at once — dropping the label made every slot fill look
25
+ * like it wiped the cell. WHERE it lands is the anatomy's to say: the content-position node marks
26
+ * it ({@link slotAnatomyIndex}), and the label splices there, before the placeholder, so an edit
27
+ * surface keeps the slot's own affordance. A spec with no marker — a stale artifact, a
28
+ * studio-created component — keeps the pre-marker behavior: spec children win. A slot fill can't
29
+ * double either way — json-render hands it through `slots`, never the child array.
30
+ *
31
+ * A revealed layer ({@link REVEALED_LAYER_ATTR}) paints, so with the marker present it takes its
32
+ * real place around the label. Without the marker it counts as painting nothing, or selecting a
33
+ * hidden layer would make the label vanish from that cell.
34
+ */
35
+ declare function specContent({
36
+ children,
37
+ propChildren
38
+ }: {
39
+ /** The rendered children stream — json-render's render of `element.children`. */children: React.ReactNode; /** The element's own `props.children` — an authored label, or a routed `children` slot fill. */
40
+ propChildren: React.ReactNode;
41
+ }): React.ReactNode;
42
+ //#endregion
43
+ export { REVEALED_LAYER_ATTR, specContent };