@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
@@ -1,15 +0,0 @@
1
- import { Fragment, jsx } from "./jsx-runtime.js";
2
- import { Spec } from "@json-render/core";
3
-
4
- //#region src/jsx/jsx-dev-runtime.d.ts
5
- interface JsxDevProps {
6
- readonly children?: unknown;
7
- readonly [key: string]: unknown;
8
- }
9
- /**
10
- * Dev-variant of `jsx`. Accepts the React-style dev arguments but ignores
11
- * them — spec output is identical to the production runtime.
12
- */
13
- declare function jsxDEV(type: Parameters<typeof jsx>[0], props: JsxDevProps, _key?: unknown, _isStaticChildren?: boolean, _source?: unknown, _self?: unknown): Spec;
14
- //#endregion
15
- export { Fragment, jsxDEV };
@@ -1,11 +0,0 @@
1
- import { Fragment, jsx } from "./jsx-runtime.js";
2
- //#region src/jsx/jsx-dev-runtime.ts
3
- /**
4
- * Dev-variant of `jsx`. Accepts the React-style dev arguments but ignores
5
- * them — spec output is identical to the production runtime.
6
- */
7
- function jsxDEV(type, props, _key, _isStaticChildren, _source, _self) {
8
- return jsx(type, props);
9
- }
10
- //#endregion
11
- export { Fragment, jsxDEV };
@@ -1,48 +0,0 @@
1
- import { Spec } from "@json-render/core";
2
-
3
- //#region src/jsx/jsx-runtime.d.ts
4
- declare const Fragment: unique symbol;
5
- declare function setConfigContext(config: unknown): void;
6
- declare function getConfigContext(): unknown;
7
- type JsxType = string | symbol | {
8
- readonly __componentName?: string;
9
- readonly displayName?: string;
10
- readonly name?: string;
11
- };
12
- interface JsxProps {
13
- readonly children?: unknown;
14
- readonly [key: string]: unknown;
15
- }
16
- /**
17
- * Scope subsequent wrapper-type resolution to `componentName` (or clear it
18
- * with `null`). Resets the per-component wrapper index so stamped names are
19
- * stable across runs regardless of global element-key state.
20
- */
21
- declare function setRenderExtractionContext(componentName: string | null): void;
22
- /**
23
- * Reset all module-level state — element key counter, pending-ref
24
- * registry, ref counter, and render-extraction scope. Called by tests
25
- * asserting specific keys and by the extractor before each top-level
26
- * evaluation.
27
- */
28
- declare function __resetKeyCounterForTesting(): void;
29
- /**
30
- * Drain and return the pending-ref registry. Called by the extractor
31
- * after `import()`-ing a bundle to rewrite `__udsRef_N` placeholders to
32
- * the component names that `registerComponents` has now stamped onto
33
- * each builder.
34
- */
35
- declare function __drainPendingRefs(): Map<string, unknown>;
36
- /**
37
- * JSX automatic-runtime entry for a single static child. Compilers pick
38
- * this signature when the JSX expression has zero or one child.
39
- */
40
- declare function jsx(type: JsxType, props: JsxProps): Spec;
41
- /**
42
- * JSX automatic-runtime entry for static children — same semantics as
43
- * `jsx`, the distinction is purely a compiler hint that `props.children`
44
- * is an array literal.
45
- */
46
- declare function jsxs(type: JsxType, props: JsxProps): Spec;
47
- //#endregion
48
- export { Fragment, __drainPendingRefs, __resetKeyCounterForTesting, getConfigContext, jsx, jsxs, setConfigContext, setRenderExtractionContext };
@@ -1,305 +0,0 @@
1
- import { foreignComponentName } from "../foreign-component-name.js";
2
- //#region src/jsx/jsx-runtime.ts
3
- const Fragment = Symbol.for("react.fragment");
4
- let configContext = null;
5
- function setConfigContext(config) {
6
- configContext = config;
7
- }
8
- function getConfigContext() {
9
- return configContext;
10
- }
11
- let counter = 0;
12
- function nextKey() {
13
- return `el${counter++}`;
14
- }
15
- const pendingRefs = /* @__PURE__ */ new Map();
16
- let refCounter = 0;
17
- function nextRefId() {
18
- return `__udsRef_${refCounter++}`;
19
- }
20
- let renderScope = null;
21
- let wrapperCounter = 0;
22
- const TRANSPARENT_WRAPPERS = new Set([
23
- "AnimatePresence",
24
- "MotionConfig",
25
- "LazyMotion"
26
- ]);
27
- /**
28
- * Scope subsequent wrapper-type resolution to `componentName` (or clear it
29
- * with `null`). Resets the per-component wrapper index so stamped names are
30
- * stable across runs regardless of global element-key state.
31
- */
32
- function setRenderExtractionContext(componentName) {
33
- renderScope = componentName;
34
- wrapperCounter = 0;
35
- }
36
- /**
37
- * Reset all module-level state — element key counter, pending-ref
38
- * registry, ref counter, and render-extraction scope. Called by tests
39
- * asserting specific keys and by the extractor before each top-level
40
- * evaluation.
41
- */
42
- function __resetKeyCounterForTesting() {
43
- counter = 0;
44
- pendingRefs.clear();
45
- refCounter = 0;
46
- renderScope = null;
47
- wrapperCounter = 0;
48
- }
49
- /**
50
- * Drain and return the pending-ref registry. Called by the extractor
51
- * after `import()`-ing a bundle to rewrite `__udsRef_N` placeholders to
52
- * the component names that `registerComponents` has now stamped onto
53
- * each builder.
54
- */
55
- function __drainPendingRefs() {
56
- const drained = new Map(pendingRefs);
57
- pendingRefs.clear();
58
- refCounter = 0;
59
- return drained;
60
- }
61
- /**
62
- * JSX automatic-runtime entry for a single static child. Compilers pick
63
- * this signature when the JSX expression has zero or one child.
64
- */
65
- function jsx(type, props) {
66
- return buildSpec(type, props);
67
- }
68
- /**
69
- * JSX automatic-runtime entry for static children — same semantics as
70
- * `jsx`, the distinction is purely a compiler hint that `props.children`
71
- * is an array literal.
72
- */
73
- function jsxs(type, props) {
74
- return buildSpec(type, props);
75
- }
76
- function collectChildren(childList, parentTypeName) {
77
- const mergedElements = {};
78
- const childKeys = [];
79
- let textBuffer = "";
80
- let hasText = false;
81
- let hasElementChildren = false;
82
- for (const child of childList) {
83
- if (child === null || child === void 0 || typeof child === "boolean") continue;
84
- if (typeof child === "string") {
85
- textBuffer += child;
86
- hasText = true;
87
- } else if (typeof child === "number") {
88
- textBuffer += String(child);
89
- hasText = true;
90
- } else if (isSpec(child)) {
91
- const inlineText = parentTypeName === "Text" ? plainTextContent(child) : null;
92
- if (inlineText !== null) {
93
- textBuffer += inlineText;
94
- hasText = true;
95
- } else {
96
- for (const [k, el] of Object.entries(child.elements)) mergedElements[k] = el;
97
- childKeys.push(child.root);
98
- hasElementChildren = true;
99
- }
100
- }
101
- }
102
- return {
103
- mergedElements,
104
- childKeys,
105
- textBuffer,
106
- hasText,
107
- hasElementChildren
108
- };
109
- }
110
- /**
111
- * True when `type` is a third-party composition wrapper to elide from a
112
- * captured render spec. A UDS component (carries `__componentName`), a
113
- * `Fragment`, and an intrinsic tag (passed as a string) are real anatomy and
114
- * never elided. Among the rest, a node with a `render` target (the
115
- * ariakit/Radix `asChild` pattern) or with meaningful children is plumbing
116
- * that wraps real content; a node with neither is a genuine visual leaf (an
117
- * icon) and stays. Caller gates this on render-extraction scope.
118
- */
119
- function isElidableWrapper(type, restProps, childList) {
120
- if (type === Fragment) return false;
121
- if (typeof type !== "object" && typeof type !== "function") return false;
122
- if (typeof type.__componentName === "string") return false;
123
- const hasRenderTarget = isSpec(restProps.render);
124
- const hasMeaningfulChildren = childList.some((c) => c !== null && c !== void 0 && typeof c !== "boolean");
125
- return hasRenderTarget || hasMeaningfulChildren;
126
- }
127
- /**
128
- * Collapse an elided wrapper into its real content. With a `render` target
129
- * (ariakit/Radix `asChild`), the wrapper renders *as* that UDS element, so we
130
- * surface the target as the node and fold the wrapper's own children into it —
131
- * faithful to how those libraries compose. Without one (a pure context
132
- * provider like ariakit's `MenuProvider`), it collapses to a `Fragment` so its
133
- * children render through. Either way no foreign type reaches the spec.
134
- */
135
- function elideWrapper(renderValue, childList) {
136
- const { mergedElements, childKeys, textBuffer, hasText, hasElementChildren } = collectChildren(childList, "");
137
- if (isSpec(renderValue)) {
138
- const elements = {
139
- ...renderValue.elements,
140
- ...mergedElements
141
- };
142
- const target = elements[renderValue.root];
143
- const foldedChildren = [...target.children ?? [], ...childKeys];
144
- const updated = { ...target };
145
- if (foldedChildren.length > 0) updated.children = foldedChildren;
146
- if (hasText && !hasElementChildren) updated.props = {
147
- ...target.props,
148
- children: textBuffer
149
- };
150
- elements[renderValue.root] = updated;
151
- return {
152
- root: renderValue.root,
153
- elements
154
- };
155
- }
156
- const element = {
157
- type: "Fragment",
158
- props: {}
159
- };
160
- if (hasElementChildren) element.children = childKeys;
161
- if (hasText && !hasElementChildren) element.props = { children: textBuffer };
162
- const key = nextKey();
163
- mergedElements[key] = element;
164
- return {
165
- root: key,
166
- elements: mergedElements
167
- };
168
- }
169
- /**
170
- * Inline a dynamically-resolved leaf component into a captured render spec.
171
- * Icon's `.render()` picks a glyph by name (`const Glyph = UdsIcons[name]`) and
172
- * mounts `<Glyph .../>`; the glyph is a plain function component, so it would
173
- * otherwise be stamped a synthetic `<scope>:<base>:<n>` type nothing resolves —
174
- * it isn't registered, and a dynamic namespace lookup can't be traced to a
175
- * `foreign:` import. Invoking it here (it returns a `Spec` through this same
176
- * runtime, since the captured module is compiled against it) splices its real
177
- * output — the `<path>` subtree — into the spec, so the Internals view paints
178
- * the actual glyph instead of a blank node.
179
- *
180
- * Render-extraction only (gated by the caller on `renderScope`), and
181
- * best-effort: a function that throws when invoked outside React (hooks,
182
- * context) or returns a non-`Spec` (a context provider returning `null`, a
183
- * glyph with no matching variant) yields `null`, and the caller falls back to
184
- * the synthetic type — no worse than today.
185
- */
186
- function tryInlineDynamicLeaf(type, props) {
187
- if (typeof type !== "function") return null;
188
- const named = type;
189
- if (typeof named.__componentName === "string") return null;
190
- let base = "";
191
- if (typeof named.displayName === "string" && named.displayName.length > 0) base = named.displayName;
192
- else if (typeof named.name === "string" && named.name.length > 0) base = named.name;
193
- if (TRANSPARENT_WRAPPERS.has(base)) return null;
194
- try {
195
- const result = type(props);
196
- return isSpec(result) ? result : null;
197
- } catch {
198
- return null;
199
- }
200
- }
201
- function buildSpec(type, props) {
202
- const { children, ...restProps } = props;
203
- const childList = normalizeChildren(children);
204
- if (renderScope !== null && isElidableWrapper(type, restProps, childList)) return elideWrapper(restProps.render, childList);
205
- if (renderScope !== null) {
206
- const inlined = tryInlineDynamicLeaf(type, props);
207
- if (inlined) return inlined;
208
- }
209
- const typeName = resolveTypeName(type);
210
- const collected = collectChildren(childList, typeName);
211
- const { mergedElements } = collected;
212
- const { childKeys, textBuffer, hasText } = collected;
213
- let { hasElementChildren } = collected;
214
- const elementProps = { ...restProps };
215
- if (hasText && !hasElementChildren) elementProps.children = textBuffer;
216
- for (const [propName, value] of Object.entries(elementProps)) {
217
- if (isSpec(value)) {
218
- for (const [k, el] of Object.entries(value.elements)) mergedElements[k] = el;
219
- childKeys.push(value.root);
220
- hasElementChildren = true;
221
- elementProps[propName] = { $slot: value.root };
222
- continue;
223
- }
224
- if (Array.isArray(value) && value.length > 0 && value.every(isSpec)) {
225
- const refs = [];
226
- for (const spec of value) {
227
- for (const [k, el] of Object.entries(spec.elements)) mergedElements[k] = el;
228
- childKeys.push(spec.root);
229
- refs.push(spec.root);
230
- }
231
- hasElementChildren = true;
232
- elementProps[propName] = { $slot: refs };
233
- }
234
- }
235
- if (childKeys.length === 1 && mergedElements[childKeys[0]]?.type === "Slot") elementProps.children = { $slot: childKeys[0] };
236
- const element = {
237
- type: typeName,
238
- props: elementProps
239
- };
240
- if (hasElementChildren) element.children = childKeys;
241
- const key = nextKey();
242
- mergedElements[key] = element;
243
- return {
244
- root: key,
245
- elements: mergedElements
246
- };
247
- }
248
- function normalizeChildren(children) {
249
- if (children === void 0 || children === null) return [];
250
- if (Array.isArray(children)) return children.flat(Number.POSITIVE_INFINITY);
251
- return [children];
252
- }
253
- function resolveTypeName(type) {
254
- if (type === Fragment) return "Fragment";
255
- if (typeof type === "string") return type;
256
- const isObjectOrFn = type !== null && (typeof type === "object" || typeof type === "function");
257
- if (isObjectOrFn) {
258
- const named = type;
259
- if (typeof named.__componentName === "string") return named.__componentName;
260
- }
261
- const foreign = foreignComponentName(type);
262
- if (foreign !== null) return `foreign:${foreign}`;
263
- if (typeof type === "function") {
264
- const fn = type;
265
- let base = null;
266
- if (typeof fn.displayName === "string" && fn.displayName.length > 0) base = fn.displayName;
267
- else if (typeof fn.name === "string" && fn.name.length > 0) base = fn.name;
268
- if (base !== null) {
269
- if (TRANSPARENT_WRAPPERS.has(base)) return "Fragment";
270
- if (renderScope === null) return base;
271
- return `${renderScope}:${base}:${wrapperCounter++}`;
272
- }
273
- }
274
- if (isObjectOrFn) {
275
- const id = nextRefId();
276
- pendingRefs.set(id, type);
277
- return id;
278
- }
279
- return "Unknown";
280
- }
281
- function isSpec(value) {
282
- if (typeof value !== "object" || value === null) return false;
283
- const candidate = value;
284
- return typeof candidate.root === "string" && typeof candidate.elements === "object" && candidate.elements !== null;
285
- }
286
- /**
287
- * If `spec` is a self-contained `Text` node carrying only string content,
288
- * return that string; otherwise `null`. This is the shape the extractor
289
- * synthesises for a string/number slot default. A real authored text layer
290
- * carries `data-uds-layer` (and is never collapsed); the synthetic slot node
291
- * never does, so absence of that marker — plus a single element whose only
292
- * prop is the string `children` — identifies it precisely.
293
- */
294
- function plainTextContent(spec) {
295
- if (Object.keys(spec.elements).length !== 1) return null;
296
- const el = spec.elements[spec.root];
297
- if (el?.type !== "Text") return null;
298
- if (el.children && el.children.length > 0) return null;
299
- const props = el.props ?? {};
300
- if (typeof props.children !== "string") return null;
301
- if (Object.keys(props).some((k) => k !== "children")) return null;
302
- return props.children;
303
- }
304
- //#endregion
305
- export { Fragment, __drainPendingRefs, __resetKeyCounterForTesting, getConfigContext, jsx, jsxs, setConfigContext, setRenderExtractionContext };
@@ -1,30 +0,0 @@
1
- /**
2
- * Linked-system pin gates shared by the web `Config` and `NativeConfig`.
3
- * Both platforms pin source systems identically (`registerLinkedSystems`),
4
- * and both validate link-marked tokens against those pins at registration —
5
- * one implementation keeps the error contract byte-identical across
6
- * platforms.
7
- */
8
- import type { LinkedSystemPin, SystemLink } from './types';
9
- /** Canonical 8-4-4-4-12 hex UUID, case-insensitive. */
10
- export declare const UUID_RE: RegExp;
11
- /** Exact `major.minor.patch` with optional prerelease/build — no ranges. */
12
- export declare const EXACT_SEMVER_RE: RegExp;
13
- /**
14
- * Validate one `registerLinkedSystems` entry against the pins already
15
- * registered. `owner` names the throwing class in the error label.
16
- */
17
- export declare function validateLinkedSystemPin(systemId: string, pin: LinkedSystemPin, existing: ReadonlyMap<string, LinkedSystemPin>, owner?: string): void;
18
- /**
19
- * Pin-consistency gate for a link-marked value entering a registry.
20
- * Catches hand-forged markers (unpinned system), stale registry barrels
21
- * (version mismatch), and mis-kinded markers before they poison lookups.
22
- * `label` names the offending entry in the error (`Config.registerTokenGroups:
23
- * token "color/brand"`).
24
- */
25
- export declare function assertLinkedValuePinned(expectedKind: SystemLink['kind'], label: string, link: SystemLink | undefined, pins: ReadonlyMap<string, LinkedSystemPin>): void;
26
- /**
27
- * Token-kind gate — the historical entry point; delegates to
28
- * {@link assertLinkedValuePinned} with the token error contract.
29
- */
30
- export declare function assertLinkedTokenPinned(groupName: string, tokenName: string, link: SystemLink | undefined, pins: ReadonlyMap<string, LinkedSystemPin>, owner?: string): void;
@@ -1,45 +0,0 @@
1
- //#region src/linked-system-pins.ts
2
- /** Canonical 8-4-4-4-12 hex UUID, case-insensitive. */
3
- const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4
- /** Exact `major.minor.patch` with optional prerelease/build — no ranges. */
5
- const EXACT_SEMVER_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
6
- /**
7
- * Validate one `registerLinkedSystems` entry against the pins already
8
- * registered. `owner` names the throwing class in the error label.
9
- */
10
- function validateLinkedSystemPin(systemId, pin, existing, owner = "Config") {
11
- const label = `${owner}.registerLinkedSystems: system id "${systemId}"`;
12
- if (!UUID_RE.test(systemId)) throw new Error(`${label} must be a UUID — pins are keyed by the source system's database id, not its slug or name.`);
13
- if (existing.has(systemId)) {
14
- const prior = existing.get(systemId);
15
- throw new Error(`${label} is already pinned ("${prior?.name}" @ ${prior?.version}) — a config pins one version per system; update the existing pin instead of re-pinning.`);
16
- }
17
- if (pin.name.trim().length === 0) throw new Error(`${label}: name must be non-empty — it's the system's display-name snapshot at link time and feeds the registry folder slug.`);
18
- if (!EXACT_SEMVER_RE.test(pin.version)) throw new Error(`${label}: version "${pin.version}" must be an exact semver literal (e.g. "1.3.1") — ranges and tags are not supported.`);
19
- }
20
- /**
21
- * Pin-consistency gate for a link-marked value entering a registry.
22
- * Catches hand-forged markers (unpinned system), stale registry barrels
23
- * (version mismatch), and mis-kinded markers before they poison lookups.
24
- * `label` names the offending entry in the error (`Config.registerTokenGroups:
25
- * token "color/brand"`).
26
- */
27
- function assertLinkedValuePinned(expectedKind, label, link, pins) {
28
- if (!link) return;
29
- if (link.kind !== expectedKind) {
30
- const spread = expectedKind === "token" ? " (a token-group link spreads to per-token markers)" : "";
31
- throw new Error(`${label} carries a "${link.kind}" link marker — this entry can only carry kind "${expectedKind}"${spread}.`);
32
- }
33
- const pin = pins.get(link.systemId);
34
- if (!pin) throw new Error(`${label} is linked from system "${link.systemId}", which has no registerLinkedSystems pin — pin the system (name + exact version) before registering values linked from it.`);
35
- if (pin.version !== link.systemVersion) throw new Error(`${label} is linked at version "${link.systemVersion}" but system "${pin.name}" is pinned at "${pin.version}" — the registry barrel is stale; re-run \`uds pull\`.`);
36
- }
37
- /**
38
- * Token-kind gate — the historical entry point; delegates to
39
- * {@link assertLinkedValuePinned} with the token error contract.
40
- */
41
- function assertLinkedTokenPinned(groupName, tokenName, link, pins, owner = "Config") {
42
- assertLinkedValuePinned("token", `${owner}.registerTokenGroups: token "${groupName}/${tokenName}"`, link, pins);
43
- }
44
- //#endregion
45
- export { EXACT_SEMVER_RE, UUID_RE, assertLinkedTokenPinned, assertLinkedValuePinned, validateLinkedSystemPin };
@@ -1,73 +0,0 @@
1
- //#region src/linkedNodePrefixes.d.ts
2
- /**
3
- * Node-scoped CSS-prefix assignment for materialized linked systems.
4
- *
5
- * Every linked node (`{systemId}@{version}`) regenerates its CSS at consumer
6
- * build time from its sealed `config.json`, with its `prefix` overridden to a
7
- * composed, collision-free identity: `<consumerPrefix>-linked-<slug>`. One
8
- * prefix per NODE (not per link path) — the module graph resolves each node's
9
- * files once, so its lowered class names can only carry one prefix; sharing a
10
- * node between parents shares byte-identical sealed content, so sharing the
11
- * prefix is correct.
12
- *
13
- * The assignment must be identical everywhere it's consumed (pull-time shim
14
- * generation, `uds build` CSS regeneration, the bundler loaders), so every
15
- * consumer derives it from the same inputs with the same pure functions:
16
- * node identities from the registry tree, display names from the declaring
17
- * configs' `registerLinkedSystems` entries ({@link resolveDeclaredNames}),
18
- * and the consumer's own prefix. Nothing is persisted — the registry tree is
19
- * the source of truth.
20
- */
21
- /** Identity of one linked node, as pulled from the server closure. */
22
- interface LinkedNodeIdentity {
23
- systemId: string;
24
- version: string;
25
- /** Display-name snapshot captured at link time (from the consumer's
26
- * `registerLinkedSystems` entry / the server's system record). */
27
- name: string;
28
- }
29
- /** Assigned naming for one node. */
30
- interface LinkedNodePrefix {
31
- /** Filesystem/import-safe slug of the node's display name. */
32
- slug: string;
33
- /** The node's composed CSS identity — every var and class name of its
34
- * regenerated CSS derives from this. */
35
- cssPrefix: string;
36
- }
37
- /**
38
- * Assign each node in a linked closure its slug + composed CSS prefix,
39
- * keyed by `{systemId}@{version}`.
40
- *
41
- * Deterministic and input-order independent: nodes are processed sorted by
42
- * `(systemId, version)`. Within a slug-collision group the first sorted node
43
- * keeps the bare slug; a different system appends `-x<systemId[0..8]>`; the
44
- * same system at another version appends `-v<version>` — so every node in
45
- * the closure gets a unique, stable prefix.
46
- *
47
- * `consumerPrefix` is the consuming system's own `Config.prefix`. An empty
48
- * prefix is disallowed as a base (a bare `linked-…` could collide with the
49
- * consumer's unprefixed classes) — the node's own uuid fragment substitutes.
50
- */
51
- declare function assignLinkedNodePrefixes(nodes: LinkedNodeIdentity[], consumerPrefix: string): Map<string, LinkedNodePrefix>;
52
- /** One `registerLinkedSystems` declaration observed while walking a
53
- * closure: `declarerKey` is the declaring node's `{systemId}@{version}` pair
54
- * (empty string for the consumer's own config). */
55
- interface LinkedNameDeclaration {
56
- /** The declared child's `{systemId}@{version}` pair key. */
57
- key: string;
58
- /** The declarer's display-name snapshot for the child. */
59
- name: string;
60
- /** The declaring node's pair key; `''` = the consumer root config. */
61
- declarerKey: string;
62
- }
63
- /**
64
- * Resolve each node's display name from the closure's declarations. A node
65
- * can be declared by several parents under different name snapshots; the
66
- * winner is the declaration with the lowest `declarerKey` in sort order (the
67
- * consumer's own declarations sort first as `''`), so every tool that walks
68
- * the same closure derives the same names — and therefore the same slugs and
69
- * CSS prefixes — without any persisted mapping.
70
- */
71
- declare function resolveDeclaredNames(declarations: LinkedNameDeclaration[]): Map<string, string>;
72
- //#endregion
73
- export { LinkedNameDeclaration, LinkedNodeIdentity, LinkedNodePrefix, assignLinkedNodePrefixes, resolveDeclaredNames };
@@ -1,99 +0,0 @@
1
- import { slugifyLinkedName } from "./registry-aliases.js";
2
- //#region src/linkedNodePrefixes.ts
3
- /**
4
- * Node-scoped CSS-prefix assignment for materialized linked systems.
5
- *
6
- * Every linked node (`{systemId}@{version}`) regenerates its CSS at consumer
7
- * build time from its sealed `config.json`, with its `prefix` overridden to a
8
- * composed, collision-free identity: `<consumerPrefix>-linked-<slug>`. One
9
- * prefix per NODE (not per link path) — the module graph resolves each node's
10
- * files once, so its lowered class names can only carry one prefix; sharing a
11
- * node between parents shares byte-identical sealed content, so sharing the
12
- * prefix is correct.
13
- *
14
- * The assignment must be identical everywhere it's consumed (pull-time shim
15
- * generation, `uds build` CSS regeneration, the bundler loaders), so every
16
- * consumer derives it from the same inputs with the same pure functions:
17
- * node identities from the registry tree, display names from the declaring
18
- * configs' `registerLinkedSystems` entries ({@link resolveDeclaredNames}),
19
- * and the consumer's own prefix. Nothing is persisted — the registry tree is
20
- * the source of truth.
21
- */
22
- /** CSS identifiers can't start with a digit (or a hyphen-digit pair) —
23
- * prepend a letter sentinel when a candidate would. */
24
- function ensureCssIdentStart(candidate) {
25
- return /^[a-zA-Z_]/.test(candidate) ? candidate : `x${candidate}`;
26
- }
27
- /** `1.5.0` → `v1-5-0` — a CSS-safe version fragment. */
28
- function versionFragment(version) {
29
- return `v${version.replace(/[^a-zA-Z0-9]+/g, "-")}`;
30
- }
31
- function nodeKey(node) {
32
- return `${node.systemId}@${node.version}`;
33
- }
34
- /**
35
- * Assign each node in a linked closure its slug + composed CSS prefix,
36
- * keyed by `{systemId}@{version}`.
37
- *
38
- * Deterministic and input-order independent: nodes are processed sorted by
39
- * `(systemId, version)`. Within a slug-collision group the first sorted node
40
- * keeps the bare slug; a different system appends `-x<systemId[0..8]>`; the
41
- * same system at another version appends `-v<version>` — so every node in
42
- * the closure gets a unique, stable prefix.
43
- *
44
- * `consumerPrefix` is the consuming system's own `Config.prefix`. An empty
45
- * prefix is disallowed as a base (a bare `linked-…` could collide with the
46
- * consumer's unprefixed classes) — the node's own uuid fragment substitutes.
47
- */
48
- function assignLinkedNodePrefixes(nodes, consumerPrefix) {
49
- const sorted = [...nodes].sort((a, b) => a.systemId.localeCompare(b.systemId) || a.version.localeCompare(b.version));
50
- const byslug = /* @__PURE__ */ new Map();
51
- for (const node of sorted) {
52
- const slug = slugifyLinkedName(node.name);
53
- const group = byslug.get(slug);
54
- if (group) group.push(node);
55
- else byslug.set(slug, [node]);
56
- }
57
- const out = /* @__PURE__ */ new Map();
58
- const usedSlugs = /* @__PURE__ */ new Set();
59
- for (const [slug, group] of byslug) {
60
- const systemsInOrder = [];
61
- for (const node of group) if (!systemsInOrder.includes(node.systemId)) systemsInOrder.push(node.systemId);
62
- for (const node of group) {
63
- const systemRank = systemsInOrder.indexOf(node.systemId);
64
- const versionsOfSystem = group.filter((n) => n.systemId === node.systemId);
65
- let finalSlug = slug;
66
- if (systemRank > 0) finalSlug += `-x${node.systemId.slice(0, 8)}`;
67
- if (versionsOfSystem.length > 1 && versionsOfSystem.indexOf(node) > 0) finalSlug += `-${versionFragment(node.version)}`;
68
- const collisionBase = finalSlug;
69
- let collisionIndex = 2;
70
- while (usedSlugs.has(finalSlug)) {
71
- finalSlug = `${collisionBase}-${collisionIndex}`;
72
- collisionIndex++;
73
- }
74
- usedSlugs.add(finalSlug);
75
- const base = ensureCssIdentStart(consumerPrefix === "" ? `x${node.systemId.slice(0, 8)}` : consumerPrefix);
76
- out.set(nodeKey(node), {
77
- slug: finalSlug,
78
- cssPrefix: `${base}-linked-${finalSlug}`
79
- });
80
- }
81
- }
82
- return out;
83
- }
84
- /**
85
- * Resolve each node's display name from the closure's declarations. A node
86
- * can be declared by several parents under different name snapshots; the
87
- * winner is the declaration with the lowest `declarerKey` in sort order (the
88
- * consumer's own declarations sort first as `''`), so every tool that walks
89
- * the same closure derives the same names — and therefore the same slugs and
90
- * CSS prefixes — without any persisted mapping.
91
- */
92
- function resolveDeclaredNames(declarations) {
93
- const sorted = [...declarations].sort((a, b) => a.key.localeCompare(b.key) || a.declarerKey.localeCompare(b.declarerKey));
94
- const names = /* @__PURE__ */ new Map();
95
- for (const decl of sorted) if (!names.has(decl.key)) names.set(decl.key, decl.name);
96
- return names;
97
- }
98
- //#endregion
99
- export { assignLinkedNodePrefixes, resolveDeclaredNames };