@yahoo/uds-create-config 2.45.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/README.md +129 -0
  2. package/dist/ai-lanes.d.ts +23 -0
  3. package/dist/ai-lanes.js +34 -0
  4. package/dist/authoring/define-component.d.ts +85 -0
  5. package/dist/configs/CanvasConfig.d.ts +3237 -0
  6. package/dist/configs/CanvasConfig.js +332 -0
  7. package/dist/configs/build-options.d.ts +10 -0
  8. package/dist/configs/build-options.js +68 -0
  9. package/dist/configs/platform.d.ts +15 -0
  10. package/dist/configs/platform.js +17 -0
  11. package/dist/configs/react-native-system.d.ts +3026 -0
  12. package/dist/configs/react-native-system.js +64 -0
  13. package/dist/configs/system.d.ts +2771 -0
  14. package/dist/configs/system.js +74 -0
  15. package/dist/css/properties.generated.d.ts +14 -0
  16. package/dist/css/properties.generated.js +6260 -0
  17. package/dist/css/value-type.d.ts +48 -0
  18. package/dist/css/value-type.js +131 -0
  19. package/dist/css/values.d.ts +33 -0
  20. package/dist/css/values.js +116 -0
  21. package/dist/entities/native/NativeModifier.d.ts +25 -0
  22. package/dist/entities/native/NativeModifier.js +41 -0
  23. package/dist/entities/native/NativeSettings.d.ts +44 -0
  24. package/dist/entities/native/NativeSettings.js +39 -0
  25. package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
  26. package/dist/entities/native/NativeStyleProperty.js +28 -0
  27. package/dist/entities/native/NativeToken.d.ts +31 -0
  28. package/dist/entities/native/NativeToken.js +49 -0
  29. package/dist/entities/system/CanvasRole.d.ts +34 -0
  30. package/dist/entities/system/CanvasRole.js +45 -0
  31. package/dist/entities/system/Component.d.ts +1287 -0
  32. package/dist/entities/system/Component.js +1840 -0
  33. package/dist/entities/system/Composite.d.ts +12 -0
  34. package/dist/entities/system/Composite.js +26 -0
  35. package/dist/entities/system/Device.d.ts +11 -0
  36. package/dist/entities/system/Device.js +18 -0
  37. package/dist/entities/system/File.d.ts +72 -0
  38. package/dist/entities/system/File.js +136 -0
  39. package/dist/entities/system/Font.d.ts +48 -0
  40. package/dist/entities/system/Font.js +56 -0
  41. package/dist/entities/system/GlobalStyle.d.ts +26 -0
  42. package/dist/entities/system/GlobalStyle.js +54 -0
  43. package/dist/entities/system/Guidance.d.ts +85 -0
  44. package/dist/entities/system/Guidance.js +59 -0
  45. package/dist/entities/system/GuidanceStyle.d.ts +14 -0
  46. package/dist/entities/system/GuidanceStyle.js +8 -0
  47. package/dist/entities/system/Icon.d.ts +46 -0
  48. package/dist/entities/system/Icon.js +46 -0
  49. package/dist/entities/system/LinkedSystem.d.ts +504 -0
  50. package/dist/entities/system/LinkedSystem.js +814 -0
  51. package/dist/entities/system/Modifier.d.ts +92 -0
  52. package/dist/entities/system/Modifier.js +120 -0
  53. package/dist/entities/system/Motion.d.ts +28 -0
  54. package/dist/entities/system/Motion.js +48 -0
  55. package/dist/entities/system/Operation.d.ts +100 -0
  56. package/dist/entities/system/Operation.js +236 -0
  57. package/dist/entities/system/Package.d.ts +42 -0
  58. package/dist/entities/system/Package.js +75 -0
  59. package/dist/entities/system/Settings.d.ts +94 -0
  60. package/dist/entities/system/Settings.js +166 -0
  61. package/dist/entities/system/StyleProperty.d.ts +135 -0
  62. package/dist/entities/system/StyleProperty.js +438 -0
  63. package/dist/entities/system/Token.d.ts +67 -0
  64. package/dist/entities/system/Token.js +129 -0
  65. package/dist/entities/system/Tool.d.ts +134 -0
  66. package/dist/entities/system/Tool.js +124 -0
  67. package/dist/entities/system/color.d.ts +64 -0
  68. package/dist/entities/system/color.js +123 -0
  69. package/dist/entities/system/component-module.d.ts +63 -0
  70. package/dist/entities/system/component-module.js +258 -0
  71. package/dist/entities/system/copy-plan.d.ts +98 -0
  72. package/dist/entities/system/copy-plan.js +451 -0
  73. package/dist/entities/system/defineComponent.d.ts +428 -0
  74. package/dist/entities/system/defineComponent.js +337 -0
  75. package/dist/entities/system/element.d.ts +101 -0
  76. package/dist/entities/system/element.js +171 -0
  77. package/dist/entities/system/icon-library.d.ts +64 -0
  78. package/dist/entities/system/icon-library.js +112 -0
  79. package/dist/entities/system/icon-metadata.d.ts +72 -0
  80. package/dist/entities/system/icon-metadata.js +111 -0
  81. package/dist/entities/system/link-declaration.d.ts +27 -0
  82. package/dist/entities/system/link-declaration.js +64 -0
  83. package/dist/entities/system/link-plan.d.ts +160 -0
  84. package/dist/entities/system/link-plan.js +770 -0
  85. package/dist/entities/system/runtime-modules.d.ts +25 -0
  86. package/dist/entities/system/runtime-modules.js +38 -0
  87. package/dist/entities/system/style-bag.d.ts +20 -0
  88. package/dist/entities/system/style-bag.js +246 -0
  89. package/dist/entities/system/token-index.d.ts +89 -0
  90. package/dist/entities/system/token-index.js +112 -0
  91. package/dist/framework/Config.d.ts +2472 -0
  92. package/dist/framework/Config.js +5023 -0
  93. package/dist/framework/Entity.d.ts +127 -0
  94. package/dist/framework/Entity.js +125 -0
  95. package/dist/framework/authoring.d.ts +24 -0
  96. package/dist/framework/authoring.js +7 -0
  97. package/dist/framework/change-hooks.d.ts +119 -0
  98. package/dist/framework/change-hooks.js +131 -0
  99. package/dist/framework/changes.d.ts +88 -0
  100. package/dist/framework/changes.js +246 -0
  101. package/dist/framework/class-names.d.ts +260 -0
  102. package/dist/framework/class-names.js +630 -0
  103. package/dist/framework/coalesce.d.ts +25 -0
  104. package/dist/framework/coalesce.js +60 -0
  105. package/dist/framework/config-op.d.ts +76 -0
  106. package/dist/framework/config-op.js +43 -0
  107. package/dist/framework/config-operation-kind.d.ts +14 -0
  108. package/dist/framework/config-operation-kind.js +14 -0
  109. package/dist/framework/config-ops.d.ts +34 -0
  110. package/dist/framework/config-ops.js +187 -0
  111. package/dist/framework/defineConfig.d.ts +196 -0
  112. package/dist/framework/defineConfig.js +100 -0
  113. package/dist/framework/defineDerivedEntity.d.ts +74 -0
  114. package/dist/framework/defineDerivedEntity.js +83 -0
  115. package/dist/framework/defineEntity.d.ts +318 -0
  116. package/dist/framework/defineEntity.js +183 -0
  117. package/dist/framework/defineSubEntity.d.ts +148 -0
  118. package/dist/framework/defineSubEntity.js +121 -0
  119. package/dist/framework/derived-mutations.d.ts +20 -0
  120. package/dist/framework/derived-mutations.js +38 -0
  121. package/dist/framework/entity-search.d.ts +29 -0
  122. package/dist/framework/entity-search.js +117 -0
  123. package/dist/framework/inline-sources.d.ts +49 -0
  124. package/dist/framework/inline-sources.js +388 -0
  125. package/dist/framework/layer-styles.d.ts +25 -0
  126. package/dist/framework/layer-styles.js +49 -0
  127. package/dist/framework/memo.d.ts +48 -0
  128. package/dist/framework/memo.js +84 -0
  129. package/dist/framework/overlay.d.ts +49 -0
  130. package/dist/framework/overlay.js +17 -0
  131. package/dist/framework/plan.d.ts +49 -0
  132. package/dist/framework/plan.js +73 -0
  133. package/dist/framework/projections.d.ts +480 -0
  134. package/dist/framework/projections.js +974 -0
  135. package/dist/framework/prop-surface.d.ts +132 -0
  136. package/dist/framework/prop-surface.js +278 -0
  137. package/dist/framework/ref-graph.d.ts +71 -0
  138. package/dist/framework/ref-graph.js +158 -0
  139. package/dist/framework/ref-integrity.d.ts +55 -0
  140. package/dist/framework/ref-integrity.js +171 -0
  141. package/dist/framework/registered.d.ts +95 -0
  142. package/dist/framework/registry-dir.d.ts +42 -0
  143. package/dist/framework/registry-dir.js +48 -0
  144. package/dist/framework/registry.d.ts +300 -0
  145. package/dist/framework/registry.js +104 -0
  146. package/dist/framework/rejection.d.ts +58 -0
  147. package/dist/framework/rejection.js +111 -0
  148. package/dist/framework/rename-inference.d.ts +26 -0
  149. package/dist/framework/rename-inference.js +50 -0
  150. package/dist/framework/render-spec.d.ts +296 -0
  151. package/dist/framework/render-spec.js +809 -0
  152. package/dist/framework/schema-version.d.ts +140 -0
  153. package/dist/framework/schema-version.js +214 -0
  154. package/dist/framework/schemas.d.ts +109 -0
  155. package/dist/framework/schemas.js +615 -0
  156. package/dist/framework/session.d.ts +196 -0
  157. package/dist/framework/session.js +367 -0
  158. package/dist/framework/signature.d.ts +15 -0
  159. package/dist/framework/signature.js +83 -0
  160. package/dist/framework/snapshot.d.ts +115 -0
  161. package/dist/framework/snapshot.js +277 -0
  162. package/dist/framework/source-integrity.d.ts +226 -0
  163. package/dist/framework/source-integrity.js +478 -0
  164. package/dist/framework/sources.d.ts +211 -0
  165. package/dist/framework/sources.js +89 -0
  166. package/dist/framework/utils/compiled-schema.d.ts +23 -0
  167. package/dist/framework/utils/compiled-schema.js +46 -0
  168. package/dist/framework/utils/content-key.d.ts +15 -0
  169. package/dist/framework/utils/content-key.js +33 -0
  170. package/dist/framework/utils/enumerated.d.ts +13 -0
  171. package/dist/framework/utils/enumerated.js +19 -0
  172. package/dist/framework/utils/field-path.d.ts +95 -0
  173. package/dist/framework/utils/field-path.js +136 -0
  174. package/dist/framework/utils/field-schema.d.ts +55 -0
  175. package/dist/framework/utils/field-schema.js +183 -0
  176. package/dist/framework/utils/group.d.ts +37 -0
  177. package/dist/framework/utils/group.js +13 -0
  178. package/dist/framework/utils/package-path.d.ts +37 -0
  179. package/dist/framework/utils/package-path.js +61 -0
  180. package/dist/framework/utils/refs.d.ts +194 -0
  181. package/dist/framework/utils/refs.js +403 -0
  182. package/dist/framework/validate-spec.d.ts +27 -0
  183. package/dist/framework/validate-spec.js +45 -0
  184. package/dist/framework/value-domain.d.ts +26 -0
  185. package/dist/framework/value-domain.js +202 -0
  186. package/dist/framework/views-facade.d.ts +15 -0
  187. package/dist/framework/views-facade.js +19 -0
  188. package/dist/index.d.ts +90 -42
  189. package/dist/index.js +86 -37
  190. package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
  191. package/dist/migrations/2.0.0/raw-css.js +72 -0
  192. package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
  193. package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
  194. package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
  195. package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
  196. package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
  197. package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
  198. package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
  199. package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
  200. package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
  201. package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
  202. package/dist/migrations/index.d.ts +2 -0
  203. package/dist/migrations/index.js +2 -0
  204. package/dist/react-native/style-keys.generated.d.ts +10 -0
  205. package/dist/react-native/style-keys.generated.js +167 -0
  206. package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
  207. package/dist/renderer/RendererErrorBoundary.js +59 -10
  208. package/dist/renderer/UdsRenderer.d.ts +11 -10
  209. package/dist/renderer/UdsRenderer.js +1 -1
  210. package/dist/renderer/assetEntries.d.ts +37 -0
  211. package/dist/renderer/assetEntries.js +39 -0
  212. package/dist/renderer/assetRenderable.d.ts +14 -6
  213. package/dist/renderer/assetRenderable.js +8 -2
  214. package/dist/renderer/componentEntry.d.ts +58 -0
  215. package/dist/renderer/componentEntry.js +71 -0
  216. package/dist/renderer/icon-library.d.ts +20 -0
  217. package/dist/renderer/index.d.ts +7 -7
  218. package/dist/renderer/index.js +5 -5
  219. package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
  220. package/dist/renderer/primitives/SlotRenderer.js +1 -1
  221. package/dist/renderer/runtimeComponent.d.ts +33 -0
  222. package/dist/renderer/runtimeComponent.js +113 -0
  223. package/dist/renderer/spec-content.d.ts +43 -0
  224. package/dist/renderer/spec-content.js +95 -0
  225. package/dist/renderer/wrapRegistry.d.ts +22 -37
  226. package/dist/renderer/wrapRegistry.js +10 -20
  227. package/dist/renderer/wrappers/event-bridge.js +6 -5
  228. package/dist/renderer/wrappers/hex-normalize.js +6 -5
  229. package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
  230. package/dist/renderer/wrappers/html-aliases.js +36 -19
  231. package/dist/renderer/wrappers/inline-styles.js +7 -6
  232. package/dist/spec/asset-jsx.d.ts +18 -5
  233. package/dist/spec/asset-jsx.js +27 -16
  234. package/dist/spec/collapse-text-labels.d.ts +5 -15
  235. package/dist/spec/collapse-text-labels.js +26 -19
  236. package/dist/spec/empty-node-slots.d.ts +56 -34
  237. package/dist/spec/empty-node-slots.js +87 -47
  238. package/dist/spec/index.d.ts +21 -10
  239. package/dist/spec/index.js +21 -10
  240. package/dist/spec/jsxToSpec.d.ts +14 -9
  241. package/dist/spec/jsxToSpec.js +20 -3
  242. package/dist/spec/preview-elements.d.ts +63 -0
  243. package/dist/spec/preview-elements.js +89 -0
  244. package/dist/spec/rewrite-refs.d.ts +58 -0
  245. package/dist/spec/rewrite-refs.js +250 -0
  246. package/dist/spec/specToJsx.js +18 -29
  247. package/dist/tsconfig.tsbuildinfo +1 -1
  248. package/package.json +39 -52
  249. package/dist/AssetGroup.d.ts +0 -77
  250. package/dist/AssetGroup.js +0 -125
  251. package/dist/Component.d.ts +0 -333
  252. package/dist/Component.js +0 -1061
  253. package/dist/ComponentGroup.d.ts +0 -22
  254. package/dist/ComponentGroup.js +0 -51
  255. package/dist/CompositeStyle.d.ts +0 -30
  256. package/dist/CompositeStyle.js +0 -59
  257. package/dist/Config.d.ts +0 -528
  258. package/dist/Config.js +0 -1712
  259. package/dist/Mode.d.ts +0 -41
  260. package/dist/Mode.js +0 -81
  261. package/dist/Modifier.d.ts +0 -51
  262. package/dist/Modifier.js +0 -97
  263. package/dist/MotionDef.d.ts +0 -81
  264. package/dist/MotionDef.js +0 -212
  265. package/dist/Props.d.ts +0 -332
  266. package/dist/Props.js +0 -35
  267. package/dist/Provider.d.ts +0 -20
  268. package/dist/Provider.js +0 -14
  269. package/dist/StyleProp.d.ts +0 -145
  270. package/dist/StyleProp.js +0 -239
  271. package/dist/Token.d.ts +0 -76
  272. package/dist/Token.js +0 -133
  273. package/dist/TokenGroup.d.ts +0 -33
  274. package/dist/TokenGroup.js +0 -69
  275. package/dist/asset-kind.d.ts +0 -55
  276. package/dist/asset-kind.js +0 -29
  277. package/dist/asset-value.d.ts +0 -23
  278. package/dist/asset-value.js +0 -40
  279. package/dist/brands.d.ts +0 -30
  280. package/dist/brands.js +0 -20
  281. package/dist/captureCallerPath.d.ts +0 -48
  282. package/dist/captureCallerPath.js +0 -95
  283. package/dist/colorExpressions.d.ts +0 -131
  284. package/dist/colorExpressions.js +0 -148
  285. package/dist/component-referrers.d.ts +0 -30
  286. package/dist/component-referrers.js +0 -40
  287. package/dist/config-diagnostics.d.ts +0 -21
  288. package/dist/config-diagnostics.js +0 -12
  289. package/dist/defineAssetGroup.d.ts +0 -200
  290. package/dist/defineAssetGroup.js +0 -323
  291. package/dist/defineProvider.d.ts +0 -29
  292. package/dist/defineProvider.js +0 -60
  293. package/dist/element-marker.d.ts +0 -63
  294. package/dist/element-marker.js +0 -113
  295. package/dist/entity-utils.d.ts +0 -56
  296. package/dist/entity-utils.js +0 -105
  297. package/dist/extension.d.ts +0 -55
  298. package/dist/extension.js +0 -214
  299. package/dist/factories.d.ts +0 -863
  300. package/dist/factories.js +0 -475
  301. package/dist/font-face.d.ts +0 -25
  302. package/dist/font-face.js +0 -72
  303. package/dist/foreign-component-name.d.ts +0 -21
  304. package/dist/foreign-component-name.js +0 -42
  305. package/dist/interpolate.d.ts +0 -20
  306. package/dist/interpolate.js +0 -10
  307. package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
  308. package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
  309. package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
  310. package/dist/jsx/jsx-dev-runtime.js +0 -11
  311. package/dist/jsx/jsx-runtime.d.ts +0 -48
  312. package/dist/jsx/jsx-runtime.js +0 -305
  313. package/dist/linked-system-pins.d.ts +0 -30
  314. package/dist/linked-system-pins.js +0 -45
  315. package/dist/linkedNodePrefixes.d.ts +0 -73
  316. package/dist/linkedNodePrefixes.js +0 -99
  317. package/dist/markers.d.ts +0 -235
  318. package/dist/markers.js +0 -70
  319. package/dist/motion-constants.d.ts +0 -37
  320. package/dist/motion-constants.js +0 -61
  321. package/dist/native/NativeConfig.d.ts +0 -56
  322. package/dist/native/NativeConfig.js +0 -162
  323. package/dist/native/assets.d.ts +0 -20
  324. package/dist/native/assets.js +0 -17
  325. package/dist/native/components.d.ts +0 -139
  326. package/dist/native/components.js +0 -67
  327. package/dist/native/index.d.ts +0 -18
  328. package/dist/native/index.js +0 -17
  329. package/dist/native/modes.d.ts +0 -10
  330. package/dist/native/modes.js +0 -11
  331. package/dist/native/types.d.ts +0 -95
  332. package/dist/native/types.js +0 -0
  333. package/dist/native/validation.d.ts +0 -8
  334. package/dist/native/validation.js +0 -885
  335. package/dist/native/values.d.ts +0 -7
  336. package/dist/native/values.js +0 -15
  337. package/dist/native.d.ts +0 -12
  338. package/dist/native.js +0 -10
  339. package/dist/refs.d.ts +0 -204
  340. package/dist/refs.js +0 -129
  341. package/dist/registry-aliases.d.ts +0 -33
  342. package/dist/registry-aliases.js +0 -35
  343. package/dist/registry-dir.d.ts +0 -22
  344. package/dist/registry-dir.js +0 -10
  345. package/dist/renderer/makeRegistry.d.ts +0 -34
  346. package/dist/renderer/makeRegistry.js +0 -52
  347. package/dist/renderer/makeUdsRenderer.d.ts +0 -13
  348. package/dist/renderer/makeUdsRenderer.js +0 -51
  349. package/dist/renderer/wrappers/component-slots.d.ts +0 -41
  350. package/dist/renderer/wrappers/component-slots.js +0 -66
  351. package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
  352. package/dist/renderer/wrappers/slot-resolution.js +0 -68
  353. package/dist/renderer/wrappers/void-elements.d.ts +0 -37
  354. package/dist/renderer/wrappers/void-elements.js +0 -40
  355. package/dist/spec/layer-props.d.ts +0 -52
  356. package/dist/spec/layer-props.js +0 -149
  357. package/dist/spec/preview-controls.d.ts +0 -44
  358. package/dist/spec/preview-controls.js +0 -139
  359. package/dist/spec/slot-refs.d.ts +0 -39
  360. package/dist/spec/slot-refs.js +0 -56
  361. package/dist/token-override-rows.d.ts +0 -68
  362. package/dist/token-override-rows.js +0 -233
  363. package/dist/tokenValueType.d.ts +0 -34
  364. package/dist/tokenValueType.js +0 -138
  365. package/dist/types/css-properties.d.ts +0 -233
  366. package/dist/types/css-properties.js +0 -14
  367. package/dist/types/css-property-keywords.d.ts +0 -156
  368. package/dist/types/css-property-keywords.js +0 -616
  369. package/dist/types/css-values.d.ts +0 -63
  370. package/dist/types/css-values.js +0 -16
  371. package/dist/types.d.ts +0 -1138
  372. package/dist/types.js +0 -12
  373. package/dist/units.d.ts +0 -14
  374. package/dist/units.js +0 -16
  375. package/dist/utils/index.d.ts +0 -4
  376. package/dist/utils/index.js +0 -4
package/dist/markers.d.ts DELETED
@@ -1,235 +0,0 @@
1
- import { AssetGroupRef } from "./refs.js";
2
- import { ComponentDefinition } from "./types.js";
3
-
4
- //#region src/markers.d.ts
5
- /**
6
- * A slot's `.accepts(...)` argument: a registered component definition, or a
7
- * placeable asset group returned by `defineAssetGroup(...).config(...)` (it
8
- * carries the `AssetGroupRef` tag). The two are kept distinct downstream —
9
- * component names land on `SlotInfo.accepts`, the asset-group slug on
10
- * `SlotInfo.acceptsAssetGroup` — so the designer panel can pick the right
11
- * picker. Non-placeable groups (fonts) are admitted by the type but rejected
12
- * at config load.
13
- */
14
- type SlotAccepts = ComponentDefinition | AssetGroupRef;
15
- /**
16
- * Brand applied to a marker by `.required()`. Lives alongside the
17
- * marker interfaces so the slot factories (whose `.required()`
18
- * implementation is co-located with `.accepts()` rather than going
19
- * through `attachRequired`) can return the brand-narrowed type via
20
- * the interface signature.
21
- *
22
- * `RenderPropsFromConfig` reads this brand to decide whether a render-
23
- * fn destructure entry is optional (`T | undefined`) or non-optional
24
- * (`T`). Distinct from `__required?: boolean` on the marker bodies —
25
- * that field is the runtime flag codegen reads; the brand is the
26
- * compile-time signal the render-arg type-flow keys on.
27
- */
28
- type RequiredBrand = {
29
- __required: true;
30
- };
31
- /**
32
- * Author-declared slot value kind. A slot holds renderable content; the only
33
- * explicit kind is text:
34
- *
35
- * - `'string'` — plain text content (e.g. Button's `children` label).
36
- *
37
- * An open `slot()` is a node container (`ReactNode`) by default — it accepts
38
- * dropped layers and is narrowed to specific components via `.accepts(...)`;
39
- * `'string'` instead marks a text surface, so tools like the Studio canvas
40
- * inline-edit it rather than treat it as a reparent target. Scalars like
41
- * boolean and number are *not* slots — use the dedicated `bool()` / `number()`
42
- * markers. (A `'string'` slot still *resolves* to `SlotValueKind: 'ReactNode'`,
43
- * since a string is a valid `ReactNode`; `authoredType` records the intent.)
44
- *
45
- * - `'component'` — the slot resolves to a `FunctionComponent`, not rendered
46
- * content. Used by the aliased `Icon` pattern (`name: slot({ type:
47
- * 'component' }).accepts(icons)`), where the render fn receives the icon
48
- * component itself (`({ name: SvgIcon }) => <SvgIcon … />`) and the saved
49
- * value is the inline asset-name string (`"Trophy"`), not a `$slot` ref.
50
- * A `'component'` slot *requires* an asset-group `.accepts(...)` — config
51
- * load throws otherwise.
52
- */
53
- type SlotValueType = 'string' | 'component';
54
- /**
55
- * Open-slot marker — `slot()` with no arguments. Codegen treats it as
56
- * `ReactNode` accepted at the component's own children. Carries no
57
- * cross-reference; `__accepts` / `__required` may still be set via the
58
- * chain methods to constrain the slot's children or mark it required.
59
- * `__valueType` records an explicit `slot({ type })` override (absent ⇒
60
- * the default `ReactNode`).
61
- */
62
- interface SlotMarker {
63
- readonly __kind: 'slot';
64
- readonly __required?: boolean;
65
- readonly __accepts?: readonly SlotAccepts[];
66
- readonly __valueType?: SlotValueType;
67
- /**
68
- * Stamp `__required: true` on the marker. Codegen reads this per-prop
69
- * and emits the JSX prop without a trailing `?`, so the slot becomes
70
- * mandatory at call sites. The return type also intersects
71
- * `RequiredBrand` so `RenderPropsFromConfig` narrows the render-fn
72
- * destructure entry to non-optional.
73
- */
74
- required(): SlotMarker & RequiredBrand;
75
- /**
76
- * Constrain the slot's accepted children to one or more registered
77
- * components, or to a placeable asset group (`slot().accepts(icons)`).
78
- */
79
- accepts(component: SlotAccepts | readonly SlotAccepts[]): SlotMarker;
80
- }
81
- /**
82
- * A `slot({ type: 'component' })` marker — the aliased `Icon` pattern. Carries
83
- * the literal `__valueType: 'component'` so `ResolveMarker` resolves the prop
84
- * to a `ComponentType` (the render fn receives the icon component itself), and
85
- * narrows `.accepts(...)` to asset groups only (a component-typed slot must
86
- * accept an asset group). The chained `.accepts(...)` preserves this type so
87
- * the literal survives to the render-fn inference.
88
- */
89
- interface ComponentSlotMarker extends SlotMarker {
90
- readonly __valueType: 'component';
91
- accepts(group: AssetGroupRef | readonly AssetGroupRef[]): ComponentSlotMarker;
92
- }
93
- /**
94
- * Layer-targeting slot ref — `slot('layer')`, `slot('layer/prop')`, or
95
- * `slot('layer', { prop })`. Routes a JSX prop into the named layer's
96
- * `layerProp` (defaults to `'children'` when only a layer is given).
97
- * The `layer` field is the cross-reference — that's what makes this a
98
- * Ref rather than a Marker.
99
- */
100
- interface SlotRef<TLayer extends string = string, TAs extends string = string> {
101
- readonly __kind: 'slot';
102
- readonly layer: TLayer;
103
- readonly layerProp: TAs;
104
- readonly __required?: boolean;
105
- readonly __accepts?: readonly SlotAccepts[];
106
- /** Output adapter set via `.transform(fn)` — codegen wraps the
107
- * layer's prop so the consumer-facing handler receives `fn(arg)`
108
- * instead of the raw layer value (e.g. an input event → its
109
- * string value). Must be self-contained (no closure over outer
110
- * scope) since codegen lifts it into the generated module. */
111
- readonly __transform?: (arg: never) => unknown;
112
- readonly __valueType?: SlotValueType;
113
- required(): SlotRef<TLayer, TAs> & RequiredBrand;
114
- accepts(component: SlotAccepts | readonly SlotAccepts[]): SlotRef<TLayer, TAs>;
115
- transform<Out>(fn: (arg: unknown) => Out): SlotRef<TLayer, TAs> & {
116
- readonly __transformOut: Out;
117
- };
118
- }
119
- /**
120
- * Runtime guard for any slot binding (open marker or layered ref).
121
- * Callers that need to distinguish the two forms narrow further by
122
- * checking for the `layer` field — `'layer' in value`.
123
- */
124
- declare function isSlotMarker(value: unknown): value is SlotMarker | SlotRef;
125
- interface BooleanMarker {
126
- readonly __kind: 'boolean';
127
- readonly __required?: boolean;
128
- readonly values?: {
129
- true?: Record<string, Record<string, unknown>>;
130
- false?: Record<string, Record<string, unknown>>;
131
- };
132
- }
133
- declare function isBoolMarker(value: unknown): value is BooleanMarker;
134
- interface VariantMarkerObject<V extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> {
135
- readonly __kind: 'variant';
136
- readonly __required?: boolean;
137
- readonly values: V;
138
- readonly default?: keyof V & string;
139
- }
140
- interface VariantMarkerArray<V extends readonly (string | number)[] = readonly (string | number)[]> {
141
- readonly __kind: 'variant';
142
- readonly __required?: boolean;
143
- readonly values: V;
144
- readonly default?: V[number];
145
- }
146
- type VariantMarker<V = unknown> = V extends readonly (string | number)[] ? VariantMarkerArray<V> : V extends Record<string, Record<string, unknown>> ? VariantMarkerObject<V> : VariantMarkerObject | VariantMarkerArray;
147
- declare function isVariantMarker(value: unknown): value is VariantMarker;
148
- /**
149
- * Distinguish the two variant forms. `Array.isArray(marker.values)` is the
150
- * single source of truth — every downstream consumer that branches on
151
- * the form goes through this helper rather than duplicating the check.
152
- */
153
- declare function isVariantArrayMarker(value: VariantMarker): value is VariantMarkerArray;
154
- interface StringMarker {
155
- readonly __kind: 'string';
156
- readonly __required?: boolean;
157
- /** Set via `string().toggle()` — editors render the prop as an on/off
158
- * switch with a nested text field; off unsets it. */
159
- readonly __toggle?: boolean;
160
- }
161
- interface NumberMarker {
162
- readonly __kind: 'number';
163
- readonly __required?: boolean;
164
- }
165
- declare function isStringMarker(value: unknown): value is StringMarker;
166
- declare function isNumberMarker(value: unknown): value is NumberMarker;
167
- interface MotionMarker {
168
- readonly __kind: 'motion';
169
- readonly __required?: boolean;
170
- }
171
- declare function isMotionMarker(value: unknown): value is MotionMarker;
172
- interface LayerMarker {
173
- readonly __kind: 'layer';
174
- readonly layer: string;
175
- readonly styles: Record<string, unknown>;
176
- }
177
- declare function isLayerMarker(value: unknown): value is LayerMarker;
178
- /**
179
- * One conditional override for a `props` axis: apply `props` to the cell
180
- * when every key in `when` matches the cell's other-axis values. A rule
181
- * with no `when` always applies (the base). Later matching rules win.
182
- */
183
- interface PreviewPropsRule {
184
- readonly when?: Readonly<Record<string, unknown>>;
185
- readonly props: Readonly<Record<string, unknown>>;
186
- }
187
- /**
188
- * Synthetic discriminator state a `props` axis compiles to, per axis side.
189
- * The entry's label is the value. Codegen keys the merged spec's `$cond`
190
- * on this, and the studio seeds it per cell — both derive it here so they
191
- * never drift. (`columns`/`rows` entries are concatenated as sibling
192
- * values of one dimension, so one key per side suffices.)
193
- */
194
- declare const PREVIEW_SEED_KEY: {
195
- readonly row: "__previewSeedRow";
196
- readonly column: "__previewSeedCol";
197
- };
198
- /** True when every key in `when` equals the cell coordinate's value. */
199
- declare function matchesPreviewWhen(when: Readonly<Record<string, unknown>> | undefined, coord: Readonly<Record<string, unknown>>): boolean;
200
- /**
201
- * Merge the `props` of every rule whose `when` matches `coord` (in order,
202
- * so later matching rules win). Shared by codegen's combo enumeration and
203
- * the studio's cell assembly so a `props` axis resolves identically.
204
- */
205
- declare function resolvePreviewRules(rules: readonly PreviewPropsRule[], coord: Readonly<Record<string, unknown>>): Record<string, unknown>;
206
- interface PreviewAxisMarker {
207
- readonly __kind: 'previewAxis';
208
- /** Axis name — either a prop name or a `_${string}` modifier. */
209
- readonly prop?: string;
210
- readonly modifier?: string;
211
- /**
212
- * `props` axis rules — per-cell prop-override bags, optionally guarded
213
- * by `when` against the other axes' values. Lets a preview vary
214
- * render-extra data per cell (e.g. sample `value`) without declaring a
215
- * config prop. Resolved against the cell coordinate by the studio and
216
- * by codegen's combo enumeration.
217
- */
218
- readonly rules?: readonly PreviewPropsRule[];
219
- readonly kind: 'prop' | 'modifier' | 'props' | 'stateAxis';
220
- /**
221
- * When `kind === 'stateAxis'` — the whole interaction-state dimension at
222
- * one chain level, in display order: `'rest'` means "no modifier forced";
223
- * every other entry is a registered `_${name}` modifier. Unlike labeled
224
- * `modifier` columns this can sit anywhere in a nested chain (including
225
- * rows) — a `rest` baseline has no marker to nest under otherwise. Values
226
- * pass through verbatim (no `'rest'` auto-prepending). Emitted to source
227
- * as a `states([...])` helper call.
228
- */
229
- readonly states?: readonly string[];
230
- readonly nested?: PreviewAxisMarker;
231
- nest(child: PreviewAxisMarker): PreviewAxisMarker;
232
- }
233
- declare function isPreviewAxisMarker(value: unknown): value is PreviewAxisMarker;
234
- //#endregion
235
- export { BooleanMarker, ComponentSlotMarker, LayerMarker, MotionMarker, NumberMarker, PREVIEW_SEED_KEY, PreviewAxisMarker, PreviewPropsRule, RequiredBrand, SlotMarker, SlotRef, SlotValueType, StringMarker, VariantMarker, VariantMarkerArray, VariantMarkerObject, isBoolMarker, isLayerMarker, isMotionMarker, isNumberMarker, isPreviewAxisMarker, isSlotMarker, isStringMarker, isVariantArrayMarker, isVariantMarker, matchesPreviewWhen, resolvePreviewRules };
package/dist/markers.js DELETED
@@ -1,70 +0,0 @@
1
- //#region src/markers.ts
2
- /**
3
- * Runtime guard for any slot binding (open marker or layered ref).
4
- * Callers that need to distinguish the two forms narrow further by
5
- * checking for the `layer` field — `'layer' in value`.
6
- */
7
- function isSlotMarker(value) {
8
- return typeof value === "object" && value !== null && value.__kind === "slot";
9
- }
10
- function isBoolMarker(value) {
11
- return typeof value === "object" && value !== null && value.__kind === "boolean";
12
- }
13
- function isVariantMarker(value) {
14
- if (typeof value !== "object" || value === null) return false;
15
- const v = value;
16
- if (v.__kind !== "variant") return false;
17
- return Array.isArray(v.values) || typeof v.values === "object";
18
- }
19
- /**
20
- * Distinguish the two variant forms. `Array.isArray(marker.values)` is the
21
- * single source of truth — every downstream consumer that branches on
22
- * the form goes through this helper rather than duplicating the check.
23
- */
24
- function isVariantArrayMarker(value) {
25
- return Array.isArray(value.values);
26
- }
27
- function isStringMarker(value) {
28
- return typeof value === "object" && value !== null && value.__kind === "string";
29
- }
30
- function isNumberMarker(value) {
31
- return typeof value === "object" && value !== null && value.__kind === "number";
32
- }
33
- function isMotionMarker(value) {
34
- return typeof value === "object" && value !== null && value.__kind === "motion";
35
- }
36
- function isLayerMarker(value) {
37
- return typeof value === "object" && value !== null && value.__kind === "layer";
38
- }
39
- /**
40
- * Synthetic discriminator state a `props` axis compiles to, per axis side.
41
- * The entry's label is the value. Codegen keys the merged spec's `$cond`
42
- * on this, and the studio seeds it per cell — both derive it here so they
43
- * never drift. (`columns`/`rows` entries are concatenated as sibling
44
- * values of one dimension, so one key per side suffices.)
45
- */
46
- const PREVIEW_SEED_KEY = {
47
- row: "__previewSeedRow",
48
- column: "__previewSeedCol"
49
- };
50
- /** True when every key in `when` equals the cell coordinate's value. */
51
- function matchesPreviewWhen(when, coord) {
52
- if (!when) return true;
53
- for (const key of Object.keys(when)) if (coord[key] !== when[key]) return false;
54
- return true;
55
- }
56
- /**
57
- * Merge the `props` of every rule whose `when` matches `coord` (in order,
58
- * so later matching rules win). Shared by codegen's combo enumeration and
59
- * the studio's cell assembly so a `props` axis resolves identically.
60
- */
61
- function resolvePreviewRules(rules, coord) {
62
- const out = {};
63
- for (const rule of rules) if (matchesPreviewWhen(rule.when, coord)) Object.assign(out, rule.props);
64
- return out;
65
- }
66
- function isPreviewAxisMarker(value) {
67
- return typeof value === "object" && value !== null && value.__kind === "previewAxis";
68
- }
69
- //#endregion
70
- export { PREVIEW_SEED_KEY, isBoolMarker, isLayerMarker, isMotionMarker, isNumberMarker, isPreviewAxisMarker, isSlotMarker, isStringMarker, isVariantArrayMarker, isVariantMarker, matchesPreviewWhen, resolvePreviewRules };
@@ -1,37 +0,0 @@
1
- //#region src/motion-constants.d.ts
2
- /** framer-motion transition `type` values. */
3
- declare const MOTION_JS_TRANSITION_TYPES: readonly ["tween", "spring", "inertia"];
4
- /** framer-motion `repeatType` values. */
5
- declare const MOTION_JS_REPEAT_TYPES: readonly ["loop", "reverse", "mirror"];
6
- /** Numeric knobs specific to a `type: 'spring'` transition. */
7
- declare const MOTION_JS_SPRING_FIELDS: readonly ["stiffness", "damping", "mass", "bounce", "velocity"];
8
- /** Knobs specific to a `type: 'tween'` transition (beyond shared `delay`). */
9
- declare const MOTION_JS_TWEEN_FIELDS: readonly ["duration", "ease"];
10
- /** Non-boolean axis values for the `drag` field. */
11
- declare const MOTION_JS_DRAG_AXES: readonly ["x", "y"];
12
- /** Non-boolean mode values for the `layout` field. */
13
- declare const MOTION_JS_LAYOUT_MODES: readonly ["position", "size"];
14
- /** CSS `animation-direction` values. */
15
- declare const MOTION_CSS_DIRECTIONS: readonly ["normal", "reverse", "alternate", "alternate-reverse"];
16
- /** CSS `animation-fill-mode` values. */
17
- declare const MOTION_CSS_FILL_MODES: readonly ["none", "forwards", "backwards", "both"];
18
- /** CSS `animation-play-state` values. */
19
- declare const MOTION_CSS_PLAY_STATES: readonly ["running", "paused"];
20
- /**
21
- * CSS property families whose style props are the tokenized, lightweight
22
- * alternative to the full motion system — a style prop mapped to any of these
23
- * is what an author reaches for when they want a simple transition/animation
24
- * without a `defineMotion` preset. Matched as a prefix so a shorthand and its
25
- * longhands all qualify (`transition`, `transition-duration`, `animation`,
26
- * `animation-timing-function`, …).
27
- *
28
- * Scoped to motion *drivers* — properties that produce motion over time on
29
- * their own. It is NOT the full set of motion-*related* CSS properties: the
30
- * transform family (`transform`/`translate`/`rotate`/`scale`) and motion-path
31
- * (`offset-*`) are animation *targets* (static without a driver), and
32
- * `will-change` is a hint — none belong here, so don't add them. Prefix
33
- * matching also keeps the `text-transform` false positive out for free.
34
- */
35
- declare const MOTION_CSS_PROPERTY_PREFIXES: readonly ["animation", "transition"];
36
- //#endregion
37
- export { MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DRAG_AXES, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS };
@@ -1,61 +0,0 @@
1
- //#region src/motion-constants.ts
2
- /** framer-motion transition `type` values. */
3
- const MOTION_JS_TRANSITION_TYPES = [
4
- "tween",
5
- "spring",
6
- "inertia"
7
- ];
8
- /** framer-motion `repeatType` values. */
9
- const MOTION_JS_REPEAT_TYPES = [
10
- "loop",
11
- "reverse",
12
- "mirror"
13
- ];
14
- /** Numeric knobs specific to a `type: 'spring'` transition. */
15
- const MOTION_JS_SPRING_FIELDS = [
16
- "stiffness",
17
- "damping",
18
- "mass",
19
- "bounce",
20
- "velocity"
21
- ];
22
- /** Knobs specific to a `type: 'tween'` transition (beyond shared `delay`). */
23
- const MOTION_JS_TWEEN_FIELDS = ["duration", "ease"];
24
- /** Non-boolean axis values for the `drag` field. */
25
- const MOTION_JS_DRAG_AXES = ["x", "y"];
26
- /** Non-boolean mode values for the `layout` field. */
27
- const MOTION_JS_LAYOUT_MODES = ["position", "size"];
28
- /** CSS `animation-direction` values. */
29
- const MOTION_CSS_DIRECTIONS = [
30
- "normal",
31
- "reverse",
32
- "alternate",
33
- "alternate-reverse"
34
- ];
35
- /** CSS `animation-fill-mode` values. */
36
- const MOTION_CSS_FILL_MODES = [
37
- "none",
38
- "forwards",
39
- "backwards",
40
- "both"
41
- ];
42
- /** CSS `animation-play-state` values. */
43
- const MOTION_CSS_PLAY_STATES = ["running", "paused"];
44
- /**
45
- * CSS property families whose style props are the tokenized, lightweight
46
- * alternative to the full motion system — a style prop mapped to any of these
47
- * is what an author reaches for when they want a simple transition/animation
48
- * without a `defineMotion` preset. Matched as a prefix so a shorthand and its
49
- * longhands all qualify (`transition`, `transition-duration`, `animation`,
50
- * `animation-timing-function`, …).
51
- *
52
- * Scoped to motion *drivers* — properties that produce motion over time on
53
- * their own. It is NOT the full set of motion-*related* CSS properties: the
54
- * transform family (`transform`/`translate`/`rotate`/`scale`) and motion-path
55
- * (`offset-*`) are animation *targets* (static without a driver), and
56
- * `will-change` is a hint — none belong here, so don't add them. Prefix
57
- * matching also keeps the `text-transform` false positive out for free.
58
- */
59
- const MOTION_CSS_PROPERTY_PREFIXES = ["animation", "transition"];
60
- //#endregion
61
- export { MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DRAG_AXES, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS };
@@ -1,56 +0,0 @@
1
- import { LinkedSystemPin, LinkedSystemsInput } from "../types.js";
2
- import { ConfigValidationError } from "../config-diagnostics.js";
3
- import { NativeComponentDefinition, NativeComponentGroupDefinition, NativeComponentPropMarker, NativeComponentPropsFromMarkers, NativeComponentStyles, NativeLayerDefinition, NativeLayerKind, SerializedNativeComponentGroup } from "./components.js";
4
- import { NativeAssetGroupDefinition, NativeBuildOptions, NativeDefaultModes, NativeDependencyPolicy, NativeFontAssetGroupDefinition, NativeModeDefinition, NativeStyleEngine, NativeTokenGroupDefinition, SerializedNativeConfig } from "./types.js";
5
- import { NativeConfigDiagnostic } from "./validation.js";
6
-
7
- //#region src/native/NativeConfig.d.ts
8
- declare class NativeConfigValidationError extends ConfigValidationError<NativeConfigDiagnostic> {
9
- constructor(diagnostics: readonly NativeConfigDiagnostic[]);
10
- }
11
- declare class NativeConfig {
12
- #private;
13
- static readonly SCHEMA_VERSION = 4;
14
- readonly platform: "native";
15
- namespace?: string;
16
- styleEngine?: NativeStyleEngine;
17
- buildOptions?: NativeBuildOptions;
18
- dependencyPolicy?: NativeDependencyPolicy;
19
- defaultModes?: NativeDefaultModes;
20
- readonly modes: Map<string, NativeModeDefinition>;
21
- readonly tokenGroups: Map<string, NativeTokenGroupDefinition>;
22
- readonly assetGroups: Map<string, NativeFontAssetGroupDefinition>;
23
- readonly components: Map<string, NativeComponentDefinition<string, Record<string, NativeLayerDefinition<NativeLayerKind, string | undefined>>, Record<string, NativeComponentPropMarker>, Partial<NativeComponentPropsFromMarkers<Record<string, NativeComponentPropMarker>>>, NativeComponentStyles<Record<string, NativeLayerDefinition<NativeLayerKind, string | undefined>>>>>;
24
- readonly componentGroups: Map<string, SerializedNativeComponentGroup>;
25
- /** Source systems pinned via {@link registerLinkedSystems} — same
26
- * contract as the web `Config`: one exact version per system UUID. */
27
- readonly linkedSystems: Map<string, LinkedSystemPin>;
28
- /** Build-only source pointers. They are intentionally absent from JSON. */
29
- readonly componentSources: Map<string, {
30
- definitionPath?: string;
31
- renderPath: string;
32
- }>;
33
- configure(options: {
34
- namespace?: string;
35
- styleEngine?: NativeStyleEngine;
36
- buildOptions?: NativeBuildOptions;
37
- dependencyPolicy?: NativeDependencyPolicy;
38
- defaultModes?: NativeDefaultModes;
39
- }): this;
40
- registerModes(modes: Record<string, NativeModeDefinition>): this;
41
- /**
42
- * Pin source systems this config links values from. Pins must appear before
43
- * the `register*` calls that use them.
44
- */
45
- registerLinkedSystems(input: LinkedSystemsInput): this;
46
- registerTokenGroups(groups: Record<string, NativeTokenGroupDefinition>): this;
47
- registerAssetGroups(groups: Record<string, NativeAssetGroupDefinition>): this;
48
- registerComponentGroups(groups: Record<string, NativeComponentGroupDefinition>): this;
49
- validate(): NativeConfigDiagnostic[];
50
- toJSON(meta?: {
51
- builtAt?: string;
52
- }): SerializedNativeConfig;
53
- static fromJSON(input: unknown): NativeConfig;
54
- }
55
- //#endregion
56
- export { NativeConfig, NativeConfigValidationError };
@@ -1,162 +0,0 @@
1
- import { readSourcePath } from "../captureCallerPath.js";
2
- import { assertLinkedTokenPinned, validateLinkedSystemPin } from "../linked-system-pins.js";
3
- import { ConfigValidationError } from "../config-diagnostics.js";
4
- import { validateSerializedNativeConfig } from "./validation.js";
5
- //#region src/native/NativeConfig.ts
6
- var NativeConfigValidationError = class extends ConfigValidationError {
7
- constructor(diagnostics) {
8
- super(diagnostics, "Invalid native config");
9
- this.name = "NativeConfigValidationError";
10
- }
11
- };
12
- var NativeConfig = class NativeConfig {
13
- static SCHEMA_VERSION = 4;
14
- platform = "native";
15
- namespace;
16
- styleEngine;
17
- buildOptions;
18
- dependencyPolicy;
19
- defaultModes;
20
- modes = /* @__PURE__ */ new Map();
21
- tokenGroups = /* @__PURE__ */ new Map();
22
- assetGroups = /* @__PURE__ */ new Map();
23
- components = /* @__PURE__ */ new Map();
24
- componentGroups = /* @__PURE__ */ new Map();
25
- /** Source systems pinned via {@link registerLinkedSystems} — same
26
- * contract as the web `Config`: one exact version per system UUID. */
27
- linkedSystems = /* @__PURE__ */ new Map();
28
- /** Build-only source pointers. They are intentionally absent from JSON. */
29
- componentSources = /* @__PURE__ */ new Map();
30
- configure(options) {
31
- if (options.namespace !== void 0) {
32
- const diagnostics = validateSerializedNativeConfig({
33
- schemaVersion: NativeConfig.SCHEMA_VERSION,
34
- platform: "native",
35
- namespace: options.namespace
36
- });
37
- if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
38
- this.namespace = options.namespace;
39
- }
40
- if (options.styleEngine !== void 0) {
41
- const diagnostics = validateSerializedNativeConfig({
42
- schemaVersion: NativeConfig.SCHEMA_VERSION,
43
- platform: "native",
44
- styleEngine: options.styleEngine
45
- });
46
- if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
47
- this.styleEngine = options.styleEngine;
48
- }
49
- if (options.buildOptions !== void 0) this.buildOptions = { ...options.buildOptions };
50
- if (options.dependencyPolicy !== void 0) {
51
- const diagnostics = validateSerializedNativeConfig({
52
- schemaVersion: NativeConfig.SCHEMA_VERSION,
53
- platform: "native",
54
- dependencyPolicy: options.dependencyPolicy
55
- });
56
- if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
57
- this.dependencyPolicy = Object.fromEntries(Object.entries(options.dependencyPolicy).map(([name, policy]) => [name, { ...policy }]));
58
- }
59
- if (options.defaultModes !== void 0) this.defaultModes = { ...options.defaultModes };
60
- return this;
61
- }
62
- registerModes(modes) {
63
- for (const [name, definition] of Object.entries(modes)) this.modes.set(name, definition);
64
- return this;
65
- }
66
- /**
67
- * Pin source systems this config links values from. Pins must appear before
68
- * the `register*` calls that use them.
69
- */
70
- registerLinkedSystems(input) {
71
- for (const [systemId, pin] of Object.entries(input)) {
72
- validateLinkedSystemPin(systemId, pin, this.linkedSystems, "NativeConfig");
73
- this.linkedSystems.set(systemId, {
74
- name: pin.name,
75
- version: pin.version
76
- });
77
- }
78
- return this;
79
- }
80
- registerTokenGroups(groups) {
81
- for (const [name, definition] of Object.entries(groups)) {
82
- for (const [tokenName, tokenDef] of Object.entries(definition.tokens ?? {})) assertLinkedTokenPinned(name, tokenName, tokenDef.link, this.linkedSystems, "NativeConfig");
83
- this.tokenGroups.set(name, definition);
84
- }
85
- return this;
86
- }
87
- registerAssetGroups(groups) {
88
- for (const [name, definition] of Object.entries(groups)) this.assetGroups.set(name, definition);
89
- return this;
90
- }
91
- registerComponentGroups(groups) {
92
- for (const [groupName, group] of Object.entries(groups)) {
93
- const componentNames = [];
94
- for (const [componentName, component] of Object.entries(group.components)) {
95
- const existing = this.components.get(componentName);
96
- if (existing !== void 0 && existing !== component) throw new Error(`Native component "${componentName}" is registered more than once.`);
97
- const duplicateId = [...this.components].find(([name, value]) => name !== componentName && value.id === component.id);
98
- if (duplicateId !== void 0) throw new Error(`Native component id "${component.id}" is already used by "${duplicateId[0]}".`);
99
- this.components.set(componentName, component);
100
- this.componentSources.set(componentName, {
101
- definitionPath: readSourcePath(component),
102
- renderPath: component.__renderPath
103
- });
104
- componentNames.push(componentName);
105
- }
106
- this.componentGroups.set(groupName, {
107
- components: componentNames,
108
- ...group.label !== void 0 ? { label: group.label } : {},
109
- ...group.description !== void 0 ? { description: group.description } : {}
110
- });
111
- }
112
- return this;
113
- }
114
- validate() {
115
- return validateSerializedNativeConfig(this.#serialize());
116
- }
117
- toJSON(meta) {
118
- const out = this.#serialize(meta);
119
- const diagnostics = validateSerializedNativeConfig(out);
120
- if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
121
- return out;
122
- }
123
- static fromJSON(input) {
124
- const diagnostics = validateSerializedNativeConfig(input, NativeConfig.SCHEMA_VERSION);
125
- if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
126
- const json = input;
127
- const config = new NativeConfig();
128
- config.namespace = json.namespace;
129
- config.styleEngine = json.styleEngine;
130
- config.buildOptions = json.buildOptions ? { ...json.buildOptions } : void 0;
131
- config.dependencyPolicy = json.dependencyPolicy ? Object.fromEntries(Object.entries(json.dependencyPolicy).map(([name, policy]) => [name, { ...policy }])) : void 0;
132
- config.defaultModes = json.defaultModes ? { ...json.defaultModes } : void 0;
133
- for (const [name, mode] of Object.entries(json.modes ?? {})) config.modes.set(name, mode);
134
- for (const [name, group] of Object.entries(json.tokenGroups ?? {})) config.tokenGroups.set(name, group);
135
- for (const [name, group] of Object.entries(json.assetGroups ?? {})) config.assetGroups.set(name, group);
136
- for (const [name, component] of Object.entries(json.components ?? {})) config.components.set(name, component);
137
- for (const [name, group] of Object.entries(json.componentGroups ?? {})) config.componentGroups.set(name, group);
138
- for (const [systemId, pin] of Object.entries(json.linkedSystems ?? {})) config.linkedSystems.set(systemId, { ...pin });
139
- return config;
140
- }
141
- #serialize(meta) {
142
- const out = {
143
- schemaVersion: NativeConfig.SCHEMA_VERSION,
144
- platform: "native"
145
- };
146
- if (meta?.builtAt !== void 0) out.builtAt = meta.builtAt;
147
- if (this.namespace !== void 0) out.namespace = this.namespace;
148
- if (this.styleEngine !== void 0) out.styleEngine = this.styleEngine;
149
- if (this.buildOptions !== void 0) out.buildOptions = { ...this.buildOptions };
150
- if (this.dependencyPolicy !== void 0) out.dependencyPolicy = Object.fromEntries(Object.entries(this.dependencyPolicy).map(([name, policy]) => [name, { ...policy }]));
151
- if (this.defaultModes !== void 0) out.defaultModes = { ...this.defaultModes };
152
- if (this.modes.size > 0) out.modes = Object.fromEntries(this.modes);
153
- if (this.tokenGroups.size > 0) out.tokenGroups = Object.fromEntries(this.tokenGroups);
154
- if (this.assetGroups.size > 0) out.assetGroups = Object.fromEntries(this.assetGroups);
155
- if (this.components.size > 0) out.components = Object.fromEntries(this.components);
156
- if (this.componentGroups.size > 0) out.componentGroups = Object.fromEntries(this.componentGroups);
157
- if (this.linkedSystems.size > 0) out.linkedSystems = Object.fromEntries([...this.linkedSystems].map(([id, pin]) => [id, { ...pin }]));
158
- return out;
159
- }
160
- };
161
- //#endregion
162
- export { NativeConfig, NativeConfigValidationError };
@@ -1,20 +0,0 @@
1
- import { NativeFontAssetGroupDefinition, NativeFontAssetMember } from "./types.js";
2
-
3
- //#region src/native/assets.d.ts
4
- interface NativeFontAssetGroupConfig {
5
- readonly type: 'font';
6
- readonly label?: string;
7
- readonly description?: string;
8
- }
9
- interface NativeAssetGroupBuilder<T extends Record<string, NativeFontAssetMember>> {
10
- config(config: NativeFontAssetGroupConfig): NativeFontAssetGroupDefinition & {
11
- members: T;
12
- };
13
- }
14
- /**
15
- * Native counterpart to the web asset-group factory. The registration and ref
16
- * model are shared; only the platform member payload differs.
17
- */
18
- declare function defineAssetGroup<const T extends Record<string, NativeFontAssetMember>>(members: T): NativeAssetGroupBuilder<T>;
19
- //#endregion
20
- export { NativeAssetGroupBuilder, NativeFontAssetGroupConfig, defineAssetGroup };
@@ -1,17 +0,0 @@
1
- //#region src/native/assets.ts
2
- /**
3
- * Native counterpart to the web asset-group factory. The registration and ref
4
- * model are shared; only the platform member payload differs.
5
- */
6
- function defineAssetGroup(members) {
7
- return { config(config) {
8
- return {
9
- assetKind: "font",
10
- members,
11
- ...config.label !== void 0 ? { label: config.label } : {},
12
- ...config.description !== void 0 ? { description: config.description } : {}
13
- };
14
- } };
15
- }
16
- //#endregion
17
- export { defineAssetGroup };