@yahoo/uds-create-config 2.44.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/README.md +129 -0
  2. package/dist/ai-lanes.d.ts +23 -0
  3. package/dist/ai-lanes.js +34 -0
  4. package/dist/authoring/define-component.d.ts +85 -0
  5. package/dist/configs/CanvasConfig.d.ts +3237 -0
  6. package/dist/configs/CanvasConfig.js +332 -0
  7. package/dist/configs/build-options.d.ts +10 -0
  8. package/dist/configs/build-options.js +68 -0
  9. package/dist/configs/platform.d.ts +15 -0
  10. package/dist/configs/platform.js +17 -0
  11. package/dist/configs/react-native-system.d.ts +3026 -0
  12. package/dist/configs/react-native-system.js +64 -0
  13. package/dist/configs/system.d.ts +2771 -0
  14. package/dist/configs/system.js +74 -0
  15. package/dist/css/properties.generated.d.ts +14 -0
  16. package/dist/css/properties.generated.js +6260 -0
  17. package/dist/css/value-type.d.ts +48 -0
  18. package/dist/css/value-type.js +131 -0
  19. package/dist/css/values.d.ts +33 -0
  20. package/dist/css/values.js +116 -0
  21. package/dist/entities/native/NativeModifier.d.ts +25 -0
  22. package/dist/entities/native/NativeModifier.js +41 -0
  23. package/dist/entities/native/NativeSettings.d.ts +44 -0
  24. package/dist/entities/native/NativeSettings.js +39 -0
  25. package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
  26. package/dist/entities/native/NativeStyleProperty.js +28 -0
  27. package/dist/entities/native/NativeToken.d.ts +31 -0
  28. package/dist/entities/native/NativeToken.js +49 -0
  29. package/dist/entities/system/CanvasRole.d.ts +34 -0
  30. package/dist/entities/system/CanvasRole.js +45 -0
  31. package/dist/entities/system/Component.d.ts +1287 -0
  32. package/dist/entities/system/Component.js +1840 -0
  33. package/dist/entities/system/Composite.d.ts +12 -0
  34. package/dist/entities/system/Composite.js +26 -0
  35. package/dist/entities/system/Device.d.ts +11 -0
  36. package/dist/entities/system/Device.js +18 -0
  37. package/dist/entities/system/File.d.ts +72 -0
  38. package/dist/entities/system/File.js +136 -0
  39. package/dist/entities/system/Font.d.ts +48 -0
  40. package/dist/entities/system/Font.js +56 -0
  41. package/dist/entities/system/GlobalStyle.d.ts +26 -0
  42. package/dist/entities/system/GlobalStyle.js +54 -0
  43. package/dist/entities/system/Guidance.d.ts +85 -0
  44. package/dist/entities/system/Guidance.js +59 -0
  45. package/dist/entities/system/GuidanceStyle.d.ts +14 -0
  46. package/dist/entities/system/GuidanceStyle.js +8 -0
  47. package/dist/entities/system/Icon.d.ts +46 -0
  48. package/dist/entities/system/Icon.js +46 -0
  49. package/dist/entities/system/LinkedSystem.d.ts +504 -0
  50. package/dist/entities/system/LinkedSystem.js +814 -0
  51. package/dist/entities/system/Modifier.d.ts +92 -0
  52. package/dist/entities/system/Modifier.js +120 -0
  53. package/dist/entities/system/Motion.d.ts +28 -0
  54. package/dist/entities/system/Motion.js +48 -0
  55. package/dist/entities/system/Operation.d.ts +100 -0
  56. package/dist/entities/system/Operation.js +236 -0
  57. package/dist/entities/system/Package.d.ts +42 -0
  58. package/dist/entities/system/Package.js +75 -0
  59. package/dist/entities/system/Settings.d.ts +94 -0
  60. package/dist/entities/system/Settings.js +166 -0
  61. package/dist/entities/system/StyleProperty.d.ts +135 -0
  62. package/dist/entities/system/StyleProperty.js +438 -0
  63. package/dist/entities/system/Token.d.ts +67 -0
  64. package/dist/entities/system/Token.js +129 -0
  65. package/dist/entities/system/Tool.d.ts +134 -0
  66. package/dist/entities/system/Tool.js +124 -0
  67. package/dist/entities/system/color.d.ts +64 -0
  68. package/dist/entities/system/color.js +123 -0
  69. package/dist/entities/system/component-module.d.ts +63 -0
  70. package/dist/entities/system/component-module.js +258 -0
  71. package/dist/entities/system/copy-plan.d.ts +98 -0
  72. package/dist/entities/system/copy-plan.js +451 -0
  73. package/dist/entities/system/defineComponent.d.ts +428 -0
  74. package/dist/entities/system/defineComponent.js +337 -0
  75. package/dist/entities/system/element.d.ts +101 -0
  76. package/dist/entities/system/element.js +171 -0
  77. package/dist/entities/system/icon-library.d.ts +64 -0
  78. package/dist/entities/system/icon-library.js +112 -0
  79. package/dist/entities/system/icon-metadata.d.ts +72 -0
  80. package/dist/entities/system/icon-metadata.js +111 -0
  81. package/dist/entities/system/link-declaration.d.ts +27 -0
  82. package/dist/entities/system/link-declaration.js +64 -0
  83. package/dist/entities/system/link-plan.d.ts +160 -0
  84. package/dist/entities/system/link-plan.js +770 -0
  85. package/dist/entities/system/runtime-modules.d.ts +25 -0
  86. package/dist/entities/system/runtime-modules.js +38 -0
  87. package/dist/entities/system/style-bag.d.ts +20 -0
  88. package/dist/entities/system/style-bag.js +246 -0
  89. package/dist/entities/system/token-index.d.ts +89 -0
  90. package/dist/entities/system/token-index.js +112 -0
  91. package/dist/framework/Config.d.ts +2472 -0
  92. package/dist/framework/Config.js +5023 -0
  93. package/dist/framework/Entity.d.ts +127 -0
  94. package/dist/framework/Entity.js +125 -0
  95. package/dist/framework/authoring.d.ts +24 -0
  96. package/dist/framework/authoring.js +7 -0
  97. package/dist/framework/change-hooks.d.ts +119 -0
  98. package/dist/framework/change-hooks.js +131 -0
  99. package/dist/framework/changes.d.ts +88 -0
  100. package/dist/framework/changes.js +246 -0
  101. package/dist/framework/class-names.d.ts +260 -0
  102. package/dist/framework/class-names.js +630 -0
  103. package/dist/framework/coalesce.d.ts +25 -0
  104. package/dist/framework/coalesce.js +60 -0
  105. package/dist/framework/config-op.d.ts +76 -0
  106. package/dist/framework/config-op.js +43 -0
  107. package/dist/framework/config-operation-kind.d.ts +14 -0
  108. package/dist/framework/config-operation-kind.js +14 -0
  109. package/dist/framework/config-ops.d.ts +34 -0
  110. package/dist/framework/config-ops.js +187 -0
  111. package/dist/framework/defineConfig.d.ts +196 -0
  112. package/dist/framework/defineConfig.js +100 -0
  113. package/dist/framework/defineDerivedEntity.d.ts +74 -0
  114. package/dist/framework/defineDerivedEntity.js +83 -0
  115. package/dist/framework/defineEntity.d.ts +318 -0
  116. package/dist/framework/defineEntity.js +183 -0
  117. package/dist/framework/defineSubEntity.d.ts +148 -0
  118. package/dist/framework/defineSubEntity.js +121 -0
  119. package/dist/framework/derived-mutations.d.ts +20 -0
  120. package/dist/framework/derived-mutations.js +38 -0
  121. package/dist/framework/entity-search.d.ts +29 -0
  122. package/dist/framework/entity-search.js +117 -0
  123. package/dist/framework/inline-sources.d.ts +49 -0
  124. package/dist/framework/inline-sources.js +388 -0
  125. package/dist/framework/layer-styles.d.ts +25 -0
  126. package/dist/framework/layer-styles.js +49 -0
  127. package/dist/framework/memo.d.ts +48 -0
  128. package/dist/framework/memo.js +84 -0
  129. package/dist/framework/overlay.d.ts +49 -0
  130. package/dist/framework/overlay.js +17 -0
  131. package/dist/framework/plan.d.ts +49 -0
  132. package/dist/framework/plan.js +73 -0
  133. package/dist/framework/projections.d.ts +480 -0
  134. package/dist/framework/projections.js +974 -0
  135. package/dist/framework/prop-surface.d.ts +132 -0
  136. package/dist/framework/prop-surface.js +278 -0
  137. package/dist/framework/ref-graph.d.ts +71 -0
  138. package/dist/framework/ref-graph.js +158 -0
  139. package/dist/framework/ref-integrity.d.ts +55 -0
  140. package/dist/framework/ref-integrity.js +171 -0
  141. package/dist/framework/registered.d.ts +95 -0
  142. package/dist/framework/registry-dir.d.ts +42 -0
  143. package/dist/framework/registry-dir.js +48 -0
  144. package/dist/framework/registry.d.ts +300 -0
  145. package/dist/framework/registry.js +104 -0
  146. package/dist/framework/rejection.d.ts +58 -0
  147. package/dist/framework/rejection.js +111 -0
  148. package/dist/framework/rename-inference.d.ts +26 -0
  149. package/dist/framework/rename-inference.js +50 -0
  150. package/dist/framework/render-spec.d.ts +296 -0
  151. package/dist/framework/render-spec.js +809 -0
  152. package/dist/framework/schema-version.d.ts +140 -0
  153. package/dist/framework/schema-version.js +214 -0
  154. package/dist/framework/schemas.d.ts +109 -0
  155. package/dist/framework/schemas.js +615 -0
  156. package/dist/framework/session.d.ts +196 -0
  157. package/dist/framework/session.js +367 -0
  158. package/dist/framework/signature.d.ts +15 -0
  159. package/dist/framework/signature.js +83 -0
  160. package/dist/framework/snapshot.d.ts +115 -0
  161. package/dist/framework/snapshot.js +277 -0
  162. package/dist/framework/source-integrity.d.ts +226 -0
  163. package/dist/framework/source-integrity.js +478 -0
  164. package/dist/framework/sources.d.ts +211 -0
  165. package/dist/framework/sources.js +89 -0
  166. package/dist/framework/utils/compiled-schema.d.ts +23 -0
  167. package/dist/framework/utils/compiled-schema.js +46 -0
  168. package/dist/framework/utils/content-key.d.ts +15 -0
  169. package/dist/framework/utils/content-key.js +33 -0
  170. package/dist/framework/utils/enumerated.d.ts +13 -0
  171. package/dist/framework/utils/enumerated.js +19 -0
  172. package/dist/framework/utils/field-path.d.ts +95 -0
  173. package/dist/framework/utils/field-path.js +136 -0
  174. package/dist/framework/utils/field-schema.d.ts +55 -0
  175. package/dist/framework/utils/field-schema.js +183 -0
  176. package/dist/framework/utils/group.d.ts +37 -0
  177. package/dist/framework/utils/group.js +13 -0
  178. package/dist/framework/utils/package-path.d.ts +37 -0
  179. package/dist/framework/utils/package-path.js +61 -0
  180. package/dist/framework/utils/refs.d.ts +194 -0
  181. package/dist/framework/utils/refs.js +403 -0
  182. package/dist/framework/validate-spec.d.ts +27 -0
  183. package/dist/framework/validate-spec.js +45 -0
  184. package/dist/framework/value-domain.d.ts +26 -0
  185. package/dist/framework/value-domain.js +202 -0
  186. package/dist/framework/views-facade.d.ts +15 -0
  187. package/dist/framework/views-facade.js +19 -0
  188. package/dist/index.d.ts +90 -42
  189. package/dist/index.js +86 -37
  190. package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
  191. package/dist/migrations/2.0.0/raw-css.js +72 -0
  192. package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
  193. package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
  194. package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
  195. package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
  196. package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
  197. package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
  198. package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
  199. package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
  200. package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
  201. package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
  202. package/dist/migrations/index.d.ts +2 -0
  203. package/dist/migrations/index.js +2 -0
  204. package/dist/react-native/style-keys.generated.d.ts +10 -0
  205. package/dist/react-native/style-keys.generated.js +167 -0
  206. package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
  207. package/dist/renderer/RendererErrorBoundary.js +59 -10
  208. package/dist/renderer/UdsRenderer.d.ts +11 -10
  209. package/dist/renderer/UdsRenderer.js +1 -1
  210. package/dist/renderer/assetEntries.d.ts +37 -0
  211. package/dist/renderer/assetEntries.js +39 -0
  212. package/dist/renderer/assetRenderable.d.ts +14 -6
  213. package/dist/renderer/assetRenderable.js +8 -2
  214. package/dist/renderer/componentEntry.d.ts +58 -0
  215. package/dist/renderer/componentEntry.js +71 -0
  216. package/dist/renderer/icon-library.d.ts +20 -0
  217. package/dist/renderer/index.d.ts +7 -7
  218. package/dist/renderer/index.js +5 -5
  219. package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
  220. package/dist/renderer/primitives/SlotRenderer.js +1 -1
  221. package/dist/renderer/runtimeComponent.d.ts +33 -0
  222. package/dist/renderer/runtimeComponent.js +113 -0
  223. package/dist/renderer/spec-content.d.ts +43 -0
  224. package/dist/renderer/spec-content.js +95 -0
  225. package/dist/renderer/wrapRegistry.d.ts +22 -37
  226. package/dist/renderer/wrapRegistry.js +10 -20
  227. package/dist/renderer/wrappers/event-bridge.js +6 -5
  228. package/dist/renderer/wrappers/hex-normalize.js +6 -5
  229. package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
  230. package/dist/renderer/wrappers/html-aliases.js +36 -19
  231. package/dist/renderer/wrappers/inline-styles.js +7 -6
  232. package/dist/spec/asset-jsx.d.ts +18 -5
  233. package/dist/spec/asset-jsx.js +27 -16
  234. package/dist/spec/collapse-text-labels.d.ts +5 -15
  235. package/dist/spec/collapse-text-labels.js +26 -19
  236. package/dist/spec/empty-node-slots.d.ts +56 -34
  237. package/dist/spec/empty-node-slots.js +87 -47
  238. package/dist/spec/index.d.ts +21 -10
  239. package/dist/spec/index.js +21 -10
  240. package/dist/spec/jsxToSpec.d.ts +14 -9
  241. package/dist/spec/jsxToSpec.js +20 -3
  242. package/dist/spec/preview-elements.d.ts +63 -0
  243. package/dist/spec/preview-elements.js +89 -0
  244. package/dist/spec/rewrite-refs.d.ts +58 -0
  245. package/dist/spec/rewrite-refs.js +250 -0
  246. package/dist/spec/specToJsx.js +18 -29
  247. package/dist/tsconfig.tsbuildinfo +1 -1
  248. package/package.json +39 -52
  249. package/dist/AssetGroup.d.ts +0 -77
  250. package/dist/AssetGroup.js +0 -125
  251. package/dist/Component.d.ts +0 -333
  252. package/dist/Component.js +0 -1061
  253. package/dist/ComponentGroup.d.ts +0 -22
  254. package/dist/ComponentGroup.js +0 -51
  255. package/dist/CompositeStyle.d.ts +0 -30
  256. package/dist/CompositeStyle.js +0 -59
  257. package/dist/Config.d.ts +0 -528
  258. package/dist/Config.js +0 -1712
  259. package/dist/Mode.d.ts +0 -41
  260. package/dist/Mode.js +0 -81
  261. package/dist/Modifier.d.ts +0 -51
  262. package/dist/Modifier.js +0 -97
  263. package/dist/MotionDef.d.ts +0 -81
  264. package/dist/MotionDef.js +0 -212
  265. package/dist/Props.d.ts +0 -332
  266. package/dist/Props.js +0 -35
  267. package/dist/Provider.d.ts +0 -20
  268. package/dist/Provider.js +0 -14
  269. package/dist/StyleProp.d.ts +0 -145
  270. package/dist/StyleProp.js +0 -239
  271. package/dist/Token.d.ts +0 -76
  272. package/dist/Token.js +0 -133
  273. package/dist/TokenGroup.d.ts +0 -33
  274. package/dist/TokenGroup.js +0 -69
  275. package/dist/asset-kind.d.ts +0 -55
  276. package/dist/asset-kind.js +0 -29
  277. package/dist/asset-value.d.ts +0 -23
  278. package/dist/asset-value.js +0 -40
  279. package/dist/brands.d.ts +0 -30
  280. package/dist/brands.js +0 -20
  281. package/dist/captureCallerPath.d.ts +0 -48
  282. package/dist/captureCallerPath.js +0 -95
  283. package/dist/colorExpressions.d.ts +0 -131
  284. package/dist/colorExpressions.js +0 -148
  285. package/dist/component-referrers.d.ts +0 -30
  286. package/dist/component-referrers.js +0 -40
  287. package/dist/config-diagnostics.d.ts +0 -21
  288. package/dist/config-diagnostics.js +0 -12
  289. package/dist/defineAssetGroup.d.ts +0 -200
  290. package/dist/defineAssetGroup.js +0 -323
  291. package/dist/defineProvider.d.ts +0 -29
  292. package/dist/defineProvider.js +0 -60
  293. package/dist/element-marker.d.ts +0 -63
  294. package/dist/element-marker.js +0 -113
  295. package/dist/entity-utils.d.ts +0 -56
  296. package/dist/entity-utils.js +0 -105
  297. package/dist/extension.d.ts +0 -55
  298. package/dist/extension.js +0 -214
  299. package/dist/factories.d.ts +0 -863
  300. package/dist/factories.js +0 -475
  301. package/dist/font-face.d.ts +0 -25
  302. package/dist/font-face.js +0 -72
  303. package/dist/foreign-component-name.d.ts +0 -21
  304. package/dist/foreign-component-name.js +0 -42
  305. package/dist/interpolate.d.ts +0 -20
  306. package/dist/interpolate.js +0 -10
  307. package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
  308. package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
  309. package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
  310. package/dist/jsx/jsx-dev-runtime.js +0 -11
  311. package/dist/jsx/jsx-runtime.d.ts +0 -48
  312. package/dist/jsx/jsx-runtime.js +0 -305
  313. package/dist/linked-system-pins.d.ts +0 -30
  314. package/dist/linked-system-pins.js +0 -45
  315. package/dist/linkedNodePrefixes.d.ts +0 -73
  316. package/dist/linkedNodePrefixes.js +0 -99
  317. package/dist/markers.d.ts +0 -235
  318. package/dist/markers.js +0 -70
  319. package/dist/motion-constants.d.ts +0 -37
  320. package/dist/motion-constants.js +0 -61
  321. package/dist/native/NativeConfig.d.ts +0 -56
  322. package/dist/native/NativeConfig.js +0 -162
  323. package/dist/native/assets.d.ts +0 -20
  324. package/dist/native/assets.js +0 -17
  325. package/dist/native/components.d.ts +0 -139
  326. package/dist/native/components.js +0 -67
  327. package/dist/native/index.d.ts +0 -18
  328. package/dist/native/index.js +0 -17
  329. package/dist/native/modes.d.ts +0 -10
  330. package/dist/native/modes.js +0 -11
  331. package/dist/native/types.d.ts +0 -95
  332. package/dist/native/types.js +0 -0
  333. package/dist/native/validation.d.ts +0 -8
  334. package/dist/native/validation.js +0 -885
  335. package/dist/native/values.d.ts +0 -7
  336. package/dist/native/values.js +0 -15
  337. package/dist/native.d.ts +0 -12
  338. package/dist/native.js +0 -10
  339. package/dist/refs.d.ts +0 -204
  340. package/dist/refs.js +0 -129
  341. package/dist/registry-aliases.d.ts +0 -33
  342. package/dist/registry-aliases.js +0 -35
  343. package/dist/registry-dir.d.ts +0 -22
  344. package/dist/registry-dir.js +0 -10
  345. package/dist/renderer/makeRegistry.d.ts +0 -34
  346. package/dist/renderer/makeRegistry.js +0 -52
  347. package/dist/renderer/makeUdsRenderer.d.ts +0 -13
  348. package/dist/renderer/makeUdsRenderer.js +0 -51
  349. package/dist/renderer/wrappers/component-slots.d.ts +0 -41
  350. package/dist/renderer/wrappers/component-slots.js +0 -66
  351. package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
  352. package/dist/renderer/wrappers/slot-resolution.js +0 -68
  353. package/dist/renderer/wrappers/void-elements.d.ts +0 -37
  354. package/dist/renderer/wrappers/void-elements.js +0 -40
  355. package/dist/spec/layer-props.d.ts +0 -52
  356. package/dist/spec/layer-props.js +0 -149
  357. package/dist/spec/preview-controls.d.ts +0 -44
  358. package/dist/spec/preview-controls.js +0 -139
  359. package/dist/spec/slot-refs.d.ts +0 -39
  360. package/dist/spec/slot-refs.js +0 -56
  361. package/dist/token-override-rows.d.ts +0 -68
  362. package/dist/token-override-rows.js +0 -233
  363. package/dist/tokenValueType.d.ts +0 -34
  364. package/dist/tokenValueType.js +0 -138
  365. package/dist/types/css-properties.d.ts +0 -233
  366. package/dist/types/css-properties.js +0 -14
  367. package/dist/types/css-property-keywords.d.ts +0 -156
  368. package/dist/types/css-property-keywords.js +0 -616
  369. package/dist/types/css-values.d.ts +0 -63
  370. package/dist/types/css-values.js +0 -16
  371. package/dist/types.d.ts +0 -1138
  372. package/dist/types.js +0 -12
  373. package/dist/units.d.ts +0 -14
  374. package/dist/units.js +0 -16
  375. package/dist/utils/index.d.ts +0 -4
  376. package/dist/utils/index.js +0 -4
package/dist/Props.d.ts DELETED
@@ -1,332 +0,0 @@
1
- import { MotionName, RegisteredCompositeStyles, RegisteredModifiers, RegisteredStyleProps, TagRef } from "./refs.js";
2
- import { ColorExpression } from "./colorExpressions.js";
3
- import { ComponentDefinition, LayerInput, PropBinding, RefElement, RootTag, SlotMotion } from "./types.js";
4
- import { ComponentPropsWithRef, ElementType, HTMLAttributes, JSX, ReactNode, Ref } from "react";
5
-
6
- //#region src/Props.d.ts
7
- /**
8
- * Resolve the native HTML-attribute surface for the definition's root tag.
9
- *
10
- * - When `TTag` is a known `JSX.IntrinsicElements` key (`'a'`, `'div'`,
11
- * `'button'`, …), use `ComponentPropsWithRef<TTag>` so element-
12
- * specific attrs *and* the React 19 `ref` prop both land in the prop
13
- * type (`href` on `'a'`, `disabled` on `'button'`, `ref` on every
14
- * intrinsic).
15
- * - Otherwise (no tag captured — e.g. the root is a `ComponentRef`
16
- * or composed-layer), fall back to the generic
17
- * `HTMLAttributes<HTMLElement>`.
18
- */
19
- type ElementProps<TTag extends string | undefined> = TTag extends keyof JSX.IntrinsicElements ? ComponentPropsWithRef<TTag> : HTMLAttributes<HTMLElement>;
20
- /**
21
- * Props inherited from the wrapped component when the root layer is a
22
- * registered `ComponentDefinition` value (e.g. `layers: { root: Box }`).
23
- * Returns the wrapped component's own resolved `Props<...>` shape so
24
- * a wrapper's JSX surface inherits everything the wrapped component
25
- * accepts. Returns `{}` when the root isn't composed.
26
- *
27
- * Recursion terminates because the inner `TInner` is constrained to
28
- * `ComponentDefinition<infer L, infer P, infer T>` — three concrete
29
- * inferred type variables, not the bare wide `ComponentDefinition`. TS
30
- * unfolds one step at a time and the recursive `Props<TInner>` works
31
- * on the already-narrowed shape rather than the open structural
32
- * interface.
33
- *
34
- * The outer `[TLayers] extends [Record<string, LayerInput>]` guard
35
- * (and the corresponding wide-`R` short-circuit below) prevent the
36
- * type from blowing the complexity budget when `TLayers` is the bare
37
- * structural default (`Record<string, LayerInput>`) — at that point
38
- * `R` is the full `LayerInput` union, and recursing through it would
39
- * try to enumerate every wrapped-component shape the union admits.
40
- */
41
- /**
42
- * One-level prop-shape extraction for a composed root layer. Mirrors
43
- * `Props<TInner>` without re-invoking `Props` recursively — the
44
- * recursion was the main culprit behind TS2590 "union too complex"
45
- * during codegen typechecks, where dozens of `defineComponent` call
46
- * sites with overlapping prop shapes pushed the inference budget
47
- * over. One level of prop inheritance covers every real wrapper
48
- * shape (Box → HStack, Box → Pressable, Box → Input); a deeper
49
- * chain (Pressable → Button) still picks up Box's surface via the
50
- * already-flattened intermediate, because each step's `props` field
51
- * already carries the merged-and-flattened bindings from the chain
52
- * methods' `MergeChainConfig`.
53
- */
54
- type ComposedRootShape<TLayers extends Record<string, LayerInput>, TProps extends Record<string, PropBinding>, TTag extends string | undefined> = PropsFromBindings<TProps, TLayers> & Omit<ElementProps<EffectiveTagPlain<TTag, TLayers>>, keyof TProps> & DataAttrs;
55
- /**
56
- * Plain tag computation for `ComposedRootShape` — no `defaultProps.as`
57
- * override (the inner def's own `defaultProps.as` doesn't influence
58
- * the outer JSX surface; only its layers + props + captured TTag do).
59
- */
60
- type EffectiveTagPlain<TTag, TLayers> = string extends TTag ? RootTag<TLayers> : [TTag] extends [undefined] ? RootTag<TLayers> : TTag extends string ? TTag : RootTag<TLayers>;
61
- type ComposedRootProps<TLayers> = TLayers extends {
62
- root: infer R;
63
- } ? LayerInput extends R ? {} : R extends ComponentDefinition<infer InnerLayers, infer InnerProps, infer InnerTag> ? ComposedRootShape<InnerLayers, InnerProps, InnerTag> : {} : {};
64
- /**
65
- * Resolve the allowed-value union for one registered style prop.
66
- * Falls back to `string` when the prop registered no tokens (codegen
67
- * emits `never` for that case). Always widened with `ColorExpression`
68
- * so the sanctioned `mix(...)` / `darken(...)` / `lighten(...)` color
69
- * helpers type-check at every style-prop position.
70
- */
71
- type StylePropValue<K extends keyof RegisteredStyleProps> = [RegisteredStyleProps[K]] extends [never] ? string | ColorExpression : RegisteredStyleProps[K] | ColorExpression;
72
- /**
73
- * Extract the registered style-prop name from a `StylePropRef` binding —
74
- * `{ __kind: 'styleProp', ref: 'bg', layer? }` → `'bg'`. Returns `never`
75
- * for non-matching forms.
76
- */
77
- type StylePropRefName<TBinding> = TBinding extends {
78
- readonly __kind: 'styleProp';
79
- readonly ref: infer N;
80
- } ? N extends keyof RegisteredStyleProps & string ? N : never : never;
81
- /**
82
- * Extract the registered composite-group name from a `CompositeRef`
83
- * binding — `{ __kind: 'composite', ref: 'textVariant' }` → `'textVariant'`.
84
- * Returns `never` for non-matching forms.
85
- */
86
- type CompositeRefName<TBinding> = TBinding extends {
87
- readonly __kind: 'composite';
88
- readonly ref: infer N;
89
- } ? N extends keyof RegisteredCompositeStyles & string ? N : never : never;
90
- /**
91
- * Resolve the allowed-value union for a registered composite group —
92
- * the union of `styles` keys. Falls back to `string` when the
93
- * registry isn't populated (e.g. inside `@yahoo/uds-create-config`'s own
94
- * tests where codegen-emitted augmentation isn't loaded).
95
- */
96
- type CompositeValue<K extends keyof RegisteredCompositeStyles> = RegisteredCompositeStyles[K] extends {
97
- styles: infer S;
98
- } ? keyof S & string : string;
99
- /**
100
- * Resolve the JSX-value type for a slot ref by looking up the target
101
- * layer's prop. Mirrors main's `SlotPropValue` but reads
102
- * `layerProp` instead of `prop` (the config slot ref carries
103
- * `layerProp` as the target prop name).
104
- *
105
- * - **Composed-component layer** — read
106
- * `Props<TInnerDef>[layerProp]`, so `slot('button/onClick')` types
107
- * as the click-handler the wrapped component declares.
108
- * - **HTML-tag layer** (bare-tag `'div'`, `TagRef<'a'>`, or
109
- * `{ tag: 'a', attrs }`) — read
110
- * `ComponentPropsWithRef<tag>[layerProp]`, so `slot('link/href')`
111
- * types as `string | undefined`.
112
- * - Unknown layer / unknown prop falls back to `ReactNode`.
113
- */
114
- type SlotTargetKey<A> = [A] extends [string] ? A : 'children';
115
- /** Resolve a layer's HTML tag literal (`'a' | 'div' | ...`) when statically readable. */
116
- type LayerTag<L> = L extends string ? L : L extends TagRef<infer T> ? T : L extends {
117
- tag: infer T extends string;
118
- } ? T : L extends {
119
- tag: TagRef<infer T>;
120
- } ? T : never;
121
- /**
122
- * Read prop `K` off `T` if present, else fall back to `ReactNode`. Used
123
- * to look up a slot's target-layer prop without crashing on
124
- * mismatched keys.
125
- */
126
- type ReadOrNode<T, K> = K extends keyof T ? T[K] : ReactNode;
127
- type SlotPropValue<TBinding, TLayers> = TBinding extends {
128
- readonly __kind: 'slot';
129
- readonly layer: infer L extends keyof TLayers & string;
130
- readonly layerProp?: infer A;
131
- } ? TLayers[L] extends ((props: infer P) => unknown) ? ReadOrNode<P, SlotTargetKey<A>> : TLayers[L] extends ComponentDefinition<infer InnerLayers, infer InnerProps, infer InnerTag> ? ReadOrNode<ComposedRootShape<InnerLayers, InnerProps, InnerTag>, SlotTargetKey<A>> : LayerTag<TLayers[L]> extends infer TT extends keyof JSX.IntrinsicElements ? ReadOrNode<ComponentPropsWithRef<TT>, SlotTargetKey<A>> : ReactNode : ReactNode;
132
- type IsSlotMarker<TBinding> = TBinding extends {
133
- readonly __kind: 'slot';
134
- } ? true : false;
135
- /**
136
- * Resolve the JSX value type for one prop binding. Pulled out so
137
- * `PropsFromBindings` can apply it twice — once for required keys
138
- * (no `?`) and once for optional keys.
139
- */
140
- type ResolveBindingValue<TBinding, TLayers> = TBinding extends {
141
- readonly __transformOut: infer Out;
142
- } ? (value: Out) => void : IsSlotMarker<TBinding> extends true ? SlotPropValue<TBinding, TLayers> : StylePropRefName<TBinding> extends never ? CompositeRefName<TBinding> extends never ? TBinding extends {
143
- readonly __kind: 'boolean';
144
- } ? boolean : TBinding extends {
145
- readonly __kind: 'string';
146
- } ? string : TBinding extends {
147
- readonly __kind: 'number';
148
- } ? number : TBinding extends {
149
- readonly __kind: 'motion';
150
- } ? SlotMotion | MotionName : TBinding extends {
151
- readonly __kind: 'variant';
152
- readonly values: infer V;
153
- } ? V extends readonly (string | number)[] ? V[number] : keyof V & string : unknown : CompositeValue<Extract<CompositeRefName<TBinding>, keyof RegisteredCompositeStyles>> : StylePropValue<Extract<StylePropRefName<TBinding>, keyof RegisteredStyleProps>>;
154
- /**
155
- * Keys of `TProps` whose binding carries `__required: true` — these
156
- * surface on the JSX side without the trailing `?` so callers must
157
- * pass a value.
158
- */
159
- type RequiredBindingKeys<TProps> = { [K in keyof TProps]: TProps[K] extends {
160
- readonly __required: true;
161
- } ? K : never }[keyof TProps];
162
- /**
163
- * Style-prop names bound by the definition — the `ref` of every
164
- * `styleProp(...)` entry in the `props` block (`never` for non-style
165
- * bindings, which drop out of the union).
166
- */
167
- type BoundStylePropNames<TProps> = { [K in keyof TProps]: StylePropRefName<TProps[K]> }[keyof TProps] & string;
168
- /**
169
- * Opacity companions for the bound color props. `defineStyleProp(...)
170
- * .withOpacity({ as })` registers a `${base}Opacity` sibling in
171
- * `RegisteredStyleProps` that pairs with its base color prop at the same
172
- * style position (`borderColor` → `borderColorOpacity`). A component that
173
- * binds the base prop should accept the companion too — both on its JSX
174
- * surface and inside modifier bodies (`_hover: { borderColorOpacity }`),
175
- * which read their key set from this binding-derived bag rather than from
176
- * the full `RegisteredStyleProps` map that tag layers get.
177
- *
178
- * The `& keyof RegisteredStyleProps` intersection keeps only siblings that
179
- * were actually registered, so a bound base prop without a `.withOpacity()`
180
- * pair (e.g. `borderTopColor`) contributes nothing.
181
- */
182
- type OpacityCompanionProps<TProps> = { [O in `${BoundStylePropNames<TProps>}Opacity` & keyof RegisteredStyleProps]?: StylePropValue<O> };
183
- /**
184
- * Walk the definition's `props` block and produce a JSX prop per entry.
185
- * Bindings carry `__required: true` when the author chained
186
- * `.required()`; those keys land in the required half of the resulting
187
- * prop bag. Every other key stays optional. The opacity companions of any
188
- * bound color prop ride along via `OpacityCompanionProps`.
189
- */
190
- type PropsFromBindings<TProps, TLayers> = { [K in keyof TProps as K extends RequiredBindingKeys<TProps> ? K : never]: ResolveBindingValue<TProps[K], TLayers> } & { [K in keyof TProps as K extends RequiredBindingKeys<TProps> ? never : K]?: ResolveBindingValue<TProps[K], TLayers> } & OpacityCompanionProps<TProps>;
191
- /**
192
- * Force TypeScript to fully evaluate a mapped/conditional type so the
193
- * hover display shows the resolved shape (`bg?: 'brand' | 'accent'`)
194
- * instead of the unevaluated type expression.
195
- */
196
- type Prettify<T> = { [K in keyof T]: T[K] } & {};
197
- /**
198
- * Standard `data-*` attributes are valid on every HTML element by spec.
199
- * React 19's bundled types don't carry an index signature for them, so
200
- * we add one here — keeps `<Box data-test="x" />` valid without forcing
201
- * authors to register every test attribute as a config-declared prop.
202
- */
203
- interface DataAttrs {
204
- [key: `data-${string}`]: unknown;
205
- }
206
- /**
207
- * `layerProps={{ root: { bg: '...' }, ... }}` — per-layer JSX prop
208
- * overrides. Same shape main exposes: each value is the layer
209
- * component's own `Props<...>` (when the layer is a composed
210
- * component) or a wide style+attr bag (when the layer is a bare HTML
211
- * tag).
212
- */
213
- type LayerPropsValue<TLayer> = TLayer extends ComponentDefinition<infer InnerLayers, infer InnerProps, infer InnerTag> ? Partial<Props<ComponentDefinition<InnerLayers, InnerProps, InnerTag>>> : Partial<HTMLAttributes<HTMLElement>> & { [K in keyof RegisteredStyleProps]?: StylePropValue<K> };
214
- type LayerPropsMap<TLayers extends Record<string, LayerInput>> = { [K in keyof TLayers]?: LayerPropsValue<TLayers[K]> };
215
- /**
216
- * Per-layer `base` styles. Same target-narrowing as `LayerPropsValue`
217
- * but adds `_<modifier>` keys for tag layers — `base: { root: { _hover:
218
- * {...} } }` is a common authoring pattern and modifiers aren't part
219
- * of the JSX `layerProps` shape, so we expose them here only.
220
- *
221
- * Composed-component layers already carry modifiers via `Props<...>`
222
- * (see `PropsBase`'s wrapping `RegisteredModifiers`), so that branch
223
- * passes through unchanged.
224
- */
225
- /**
226
- * Per-tag-layer styles bag. Combines:
227
- * - HTML attrs valid on every element
228
- * - Each registered style prop with its token-union value (plus
229
- * `[bracket]` literals and an open-string escape so unregistered
230
- * runtime values still typecheck — autocomplete still shows the
231
- * token union via the `string & {}` hint pattern)
232
- * - Each registered composite-style binding (e.g. `variant`,
233
- * `elevation`) so layers that wrap a composite-bound component
234
- * can set the composite value
235
- * - A `Record<string, unknown>` index signature that only kicks in
236
- * when the augmentable registries are empty (consumer tests in
237
- * `@yahoo/uds-create-config` / `@yahoo/uds-create-codegen` run without codegen-emitted
238
- * augmentation). Detected via the `[keyof X] extends [never]`
239
- * "empty registry" probe; in real consumer apps the registries
240
- * are populated and the open index signature drops out.
241
- */
242
- type TagLayerStylesBag = [keyof RegisteredStyleProps] extends [never] ? Record<string, unknown> : Partial<HTMLAttributes<HTMLElement>> & { [K in keyof RegisteredStyleProps]?: StylePropValue<K> | `[${string}]` | (string & {}) } & { [K in keyof RegisteredCompositeStyles]?: CompositeValue<K> };
243
- type BaseLayerStyles<TLayer> = TLayer extends ComponentDefinition<infer InnerLayers, infer InnerProps, infer InnerTag> ? Partial<Props<ComponentDefinition<InnerLayers, InnerProps, InnerTag>>> : TagLayerStylesBag & RegisteredModifiers<TagLayerStylesBag>;
244
- /**
245
- * Component prop surface without modifiers — the "base" type that
246
- * `Props<TDef>` wraps with `RegisteredModifiers<PropsBase<TDef>>`.
247
- *
248
- * Splitting the modifier layer out breaks a self-reference cycle: TS
249
- * can resolve `RegisteredModifiers<PropsBase<TDef>>` because
250
- * PropsBase doesn't reference itself, but
251
- * `RegisteredModifiers<Props<TDef>>` directly inside `Props<TDef>`
252
- * leaves TS unable to materialize the recursive shape and the
253
- * modifier keys collapse to nothing at consumer call sites.
254
- */
255
- /**
256
- * Effective root tag for `PropsBase`. Resolution order:
257
- *
258
- * 1. `defaultProps.as` — value-extend chains thread the polymorphic
259
- * tag here (`defineComponent(Box).config({ defaultProps: { as:
260
- * 'input' } })` makes `Input`'s JSX surface `<input>`-shaped).
261
- * 2. Explicit `TTag` from the def's third generic — set when a chain
262
- * captures the tag literal directly into the synthesized
263
- * `ComponentDefinition<..., ..., TTag>`. Falls back when the def's
264
- * `TTag` is the wide default `string | undefined`.
265
- * 3. `RootTag<TLayers>` — derived from the root layer (bare-tag string
266
- * `'div'`, `TagRef<'a'>`, `{ tag: 'a', ... }`, or an inner
267
- * definition's captured tag).
268
- */
269
- type EffectiveTag<TDef, TTag, TLayers> = TDef extends {
270
- defaultProps: {
271
- as: infer A extends keyof JSX.IntrinsicElements;
272
- };
273
- } ? A : string extends TTag ? RootTag<TLayers> : [TTag] extends [undefined] ? RootTag<TLayers> : TTag extends string ? TTag : RootTag<TLayers>;
274
- type PropsBase<TDef extends ComponentDefinition<Record<string, LayerInput>, Record<string, PropBinding>, string | undefined>> = TDef extends ComponentDefinition<infer TLayers extends Record<string, LayerInput>, infer TProps extends Record<string, PropBinding>, infer TTag extends string | undefined> ? PropsFromBindings<TProps, TLayers> & Omit<ComposedRootProps<TLayers>, keyof TProps | 'children'> & Omit<ElementProps<EffectiveTag<TDef, TTag, TLayers>>, keyof TProps | keyof ComposedRootProps<TLayers>> & DataAttrs & {
275
- as?: ElementType;
276
- layerProps?: LayerPropsMap<TLayers>;
277
- } : never;
278
- /**
279
- * Public derived-props type.
280
- *
281
- * Layers:
282
- * 1. `PropsFromBindings<TProps, TLayers>` — config-declared props.
283
- * 2. `ComposedRootProps<TLayers>` — the wrapped component's prop
284
- * surface when the root layer is a `ComponentDefinition` value,
285
- * minus `children` (a multi-layer component must declare its own
286
- * content slot rather than inherit the root's).
287
- * 3. `ElementProps<TTag>` — native HTML attrs narrowed to the root
288
- * tag (or the wrapper's `defaultProps.as` for value-extends).
289
- * Anything colliding with (1) or (2) is stripped out.
290
- * 4. `DataAttrs` — permissive `data-*` index signature.
291
- * 5. `RegisteredModifiers<PropsBase<TDef>>` — narrowed `_<modifier>`
292
- * keys with `Partial<...>` values. Augmented by codegen.
293
- * 6. Polymorphic `as` prop.
294
- *
295
- * The first conditional short-circuits to a permissive shape when
296
- * `TDef` is too wide (no concrete `layers` map yet). Without this,
297
- * the eagerly-evaluated `ComponentBuilder<{layers: L}>` at the
298
- * `defineComponent.layers` static-method declaration sometimes
299
- * pushes the TS inference budget over the "union too complex" wall
300
- * during package-wide typechecks (`@yahoo/uds-create-codegen` builds saw this
301
- * at `factories.ts:853`).
302
- */
303
- /**
304
- * Opt-in forwarded-ref prop. A component declares its ref target via
305
- * `.config({ ref: 'button' })`; that tag is captured on the definition's `ref`
306
- * field and mapped here to `ref?: Ref<HTMLButtonElement>`. When declared and
307
- * resolvable, it *overrides* the element's natural ref (see `Props`, which omits
308
- * exactly `keyof RefProp` before re-adding this). When it can't resolve to a
309
- * tag, it contributes nothing and the natural ref is left intact.
310
- */
311
- type RefProp<TDef> = TDef extends {
312
- ref: infer Tag extends string;
313
- } ? {
314
- ref?: Ref<RefElement<Tag>>;
315
- } : Record<never, never>;
316
- type Props<TDef extends ComponentDefinition<Record<string, LayerInput>, Record<string, PropBinding>, string | undefined>> = TDef extends {
317
- layers: Record<string, LayerInput>;
318
- } ? Record<string, LayerInput> extends TDef['layers'] ? PermissiveProps : Prettify<Omit<PropsBase<TDef> & RegisteredModifiers<PropsBase<TDef>>, keyof RefProp<TDef>> & RefProp<TDef>> : PermissiveProps;
319
- /**
320
- * Permissive prop bag used as the bail-out shape when `Props<TDef>`
321
- * can't narrow against a concrete `layers` map (mirrors the
322
- * `FC<any>` slot the pre-Props builder used to carry).
323
- */
324
- type PermissiveProps = HTMLAttributes<HTMLElement> & DataAttrs & Record<string, any> & {
325
- as?: ElementType;
326
- };
327
- /**
328
- * `Props<typeof boxConfig>` for the common 'use the definition's inferred
329
- * type' invocation. Keeps consumers from having to repeat the generic.
330
- */
331
- //#endregion
332
- export { BaseLayerStyles, DataAttrs, LayerPropsMap, LayerTag, Props, PropsFromBindings, SlotPropValue };
package/dist/Props.js DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * `Props<TDef>` — derive a React component's prop type from a
3
- * `defineComponent(...)` definition.
4
- *
5
- * Walks the definition's `props` block. For each entry:
6
- *
7
- * - `styleProp(ref)` marker (`StylePropRef`) → JSX-prop name is the
8
- * entry key; value type is `RegisteredStyleProps[ref]` (the allowed
9
- * token-name union for that registered style prop). When the
10
- * registered union is `never` (the prop registered no tokens —
11
- * arbitrary-only), the value type widens to `string`.
12
- *
13
- * - `boolean()` / `string()` markers → `boolean` / `string`.
14
- *
15
- * - `variant({...})` marker → string-literal union of the declared keys.
16
- *
17
- * - `composite(ref)` marker (`CompositeRef`) → keys of the registered
18
- * composite group's `styles` map.
19
- *
20
- * - `slot(...)` marker / ref → `ReactNode` (or the resolved layer-prop
21
- * type when the slot targets a specific `layer/prop`).
22
- *
23
- * Plus the standard React affordances, with the native `HTMLAttributes`
24
- * surface narrowed to omit any key that collides with a config-declared
25
- * prop — so a config-declared `color` prop with a token-name union
26
- * doesn't get widened to `string` by `HTMLAttributes`' own
27
- * `color?: string`.
28
- *
29
- * Port of `@yahoo/uds-create-config`'s `Props.ts`, adapted to config's marker
30
- * + ref naming:
31
- * - Slot's target layer-prop name is `layerProp` (was `prop`).
32
- * - Composite registry is `RegisteredCompositeStyles` (was
33
- * `RegisteredComposites`).
34
- * - `RegisteredModifiers<T>` matches main's generic form.
35
- */
@@ -1,20 +0,0 @@
1
- import { FC, ReactNode } from "react";
2
-
3
- //#region src/Provider.d.ts
4
- declare class Provider {
5
- readonly name: string;
6
- readonly component: FC<{
7
- children: ReactNode;
8
- }>;
9
- constructor(args: {
10
- name: string;
11
- component: FC<{
12
- children: ReactNode;
13
- }>;
14
- });
15
- toJSON(): {
16
- name: string;
17
- };
18
- }
19
- //#endregion
20
- export { Provider };
package/dist/Provider.js DELETED
@@ -1,14 +0,0 @@
1
- //#region src/Provider.ts
2
- var Provider = class {
3
- name;
4
- component;
5
- constructor(args) {
6
- this.name = args.name;
7
- this.component = args.component;
8
- }
9
- toJSON() {
10
- return { name: this.name };
11
- }
12
- };
13
- //#endregion
14
- export { Provider };
@@ -1,145 +0,0 @@
1
- import { AnyStylePropDefinition, ArbitraryEntry, ArbitrarySpec, OpacityPairSpec, StylePropMetadata, StylePropProperty, TokenType } from "./types.js";
2
- import { Token } from "./Token.js";
3
-
4
- //#region src/StyleProp.d.ts
5
- type StorageValuesEntry = NonNullable<AnyStylePropDefinition['values']>[number];
6
- type StyleTokenLookup = (groupName: string) => Iterable<Token>;
7
- /**
8
- * Whether a raw CSS value is safe to feed through {@link StyleProp.classNameFor}
9
- * and get back a syntactically valid class-name body. `classNameFor`'s own
10
- * substitution only escapes `.` and `/` — anything else (parens, commas,
11
- * spaces) passes through unchanged and would produce an invalid CSS selector.
12
- *
13
- * Not every `{ alias, value }` entry's `value` is meant to be authored
14
- * directly at a JSX/spec site: a short alias (`in-out`) can resolve to a
15
- * multi-argument function expression (`transitionTiming`'s
16
- * `cubic-bezier(0.4, 0, 0.2, 1)`) that no one would ever type as a raw prop
17
- * value and that can never form a valid class name. A resolved keyword like
18
- * `justifyContent`'s `space-between`, by contrast, is exactly the kind of
19
- * value a design element can (and does) carry directly. Callers that derive
20
- * an *additional* class keyed by the resolved value (rather than the alias)
21
- * must gate on this first.
22
- */
23
- declare function isSafeClassNameValue(value: string): boolean;
24
- declare class StyleProp {
25
- #private;
26
- readonly name: string;
27
- readonly cssProperty: StylePropProperty | readonly StylePropProperty[];
28
- readonly classPrefix: string;
29
- readonly values: readonly StorageValuesEntry[];
30
- readonly arbitrary?: ArbitrarySpec | readonly ArbitraryEntry[];
31
- /**
32
- * When true, the prop emits its value negated (`calc(<value> * -1)`) — the
33
- * single source of negativity, read by the emitter, the runtime injector,
34
- * and the MCP/guidance/lint. See {@link StylePropDefinition.negative}.
35
- */
36
- readonly negative: boolean;
37
- readonly cssType?: TokenType;
38
- readonly metadata: StylePropMetadata;
39
- readonly opacityPair?: OpacityPairSpec;
40
- /**
41
- * Optional value→CSS adapter (`gridTemplateColumns`'s `4` →
42
- * `repeat(4, minmax(0, 1fr))`). Applied to enumerated `values` when deriving
43
- * the utility-class body, so the native emitter produces real CSS without a
44
- * Tailwind built-in. Keyword strings (`'none'`) pass through unchanged.
45
- */
46
- readonly transform?: (value: string | number) => string;
47
- /**
48
- * Build the utility-class name a style prop emits for a given
49
- * JSX-level value. Single source of truth shared by codegen
50
- * (`@utility` emission), loader (build-time class derivation), and
51
- * the runtime renderer — all three must agree byte-for-byte.
52
- *
53
- * Conventions (the `prefix` namespaces the whole utility body the same
54
- * way component classes and CSS variables are namespaced; empty prefix
55
- * yields the bare form):
56
- * - `classPrefix === ''` → the value IS the class body (`display="block"`
57
- * → `.yos-block`).
58
- * - Boolean `true` → bare `classPrefix` body (`<Box border>` →
59
- * `.yos-border`, never `.border-true`). Falsy → `undefined` (caller
60
- * omits the class).
61
- * - Bracketed arbitrary values (`'[#abc]'`) pass through verbatim.
62
- * - Otherwise `${classPrefix}-${safeTokenName(value)}` where
63
- * safeTokenName maps `.` → `_` and `/` → `-`.
64
- *
65
- * Static so callers without a StyleProp instance (loader's
66
- * className builder, codegen's safelist scanner) can derive a class
67
- * from just the prefix + value pair. Instance callers reach
68
- * `styleProp.classNameFor(value)`, which supplies the owning Config's
69
- * prefix automatically.
70
- */
71
- static classNameFor(styleProp: {
72
- classPrefix: string;
73
- }, value: unknown, prefix?: string): string | undefined;
74
- /** Instance form of {@link StyleProp.classNameFor} — supplies the owning
75
- * Config's class-name prefix, and canonicalizes a resolved CSS keyword back
76
- * to its authored alias ({@link canonicalKeyword}) so a spec that carries
77
- * either spelling resolves to the one class the alias declared. Without
78
- * this, a no-prefix prop's resolved spelling collides across props —
79
- * `textTransform: 'none'` (alias `normal-case`) and `display: 'none'` both
80
- * produced `.uds-none`, and whichever the CSS emitter wrote last silently
81
- * redefined the other's rule, leaving `display="none"` painting
82
- * `text-transform: none` (UDS-2708). */
83
- classNameFor(value: unknown): string | undefined;
84
- /**
85
- * Map a resolved CSS keyword back to the alias that authors it, when the
86
- * value isn't directly writable itself. A value that IS a keyword key
87
- * (passthrough or alias key) is already canonical and passes through; only
88
- * a value reachable solely as some alias's resolved form (`'none'` on a
89
- * prop authored `{ alias: 'normal-case', value: 'none' }`) rewrites to that
90
- * alias. Non-keyword values (tokens, brackets) pass through untouched.
91
- */
92
- canonicalKeyword(value: unknown): unknown;
93
- /** The `classPrefix` namespaced with the owning Config's prefix
94
- * (`bg` → `yos-bg`). The wildcard `@utility` emitter needs the
95
- * prefixed stem (`yos-bg-*`) since it has no concrete value to run
96
- * through {@link classNameFor}. Empty when this prop has no class
97
- * prefix (value-as-class props emit no wildcard utility). */
98
- get prefixedClassPrefix(): string;
99
- constructor(args: {
100
- name: string;
101
- definition: AnyStylePropDefinition;
102
- tokenLookup: StyleTokenLookup;
103
- prefixGetter?: () => string;
104
- });
105
- get derived(): {
106
- readonly keywords: ReadonlyMap<string | number | boolean, string | Record<string, string>>;
107
- readonly tokens: readonly Token[];
108
- };
109
- /**
110
- * Token-group namespaces this prop consumes. Used by
111
- * `TokenGroup.derived.styleProperties` to answer the reverse question.
112
- */
113
- consumedTokenGroups(): readonly string[];
114
- /**
115
- * The values this prop accepts, split by how each is written at the JSX site:
116
- * - `tokens` — token names from the prop's token groups (`gap="2"`).
117
- * - `keywords` — literal CSS keywords written verbatim (`display="flex"`).
118
- * - `aliases` — short keys resolving to a CSS keyword (`flexDirection="col"`
119
- * → `column`).
120
- * A bracketed `[...]` arbitrary literal is governed by `this.arbitrary`, not
121
- * enumerated here. Rendered by `uds_get_style_prop` / `uds_list_style_props`;
122
- * `accepts()` validates against the same set.
123
- */
124
- allowedValues(): {
125
- tokens: readonly string[];
126
- keywords: readonly string[];
127
- aliases: readonly {
128
- alias: string;
129
- value: string;
130
- }[];
131
- };
132
- /**
133
- * Whether a JSX-site value is accepted: a token name, a literal keyword, an
134
- * alias key, or a bracketed `[...]` literal when the prop enables `arbitrary`
135
- * values. The validation primitive behind `uds_validate_props` — a non-token
136
- * keyword prop (`display`) and an arbitrary-only prop (`fontSize`) both work,
137
- * not just token-group props.
138
- */
139
- accepts(value: string): boolean;
140
- toJSON(): AnyStylePropDefinition & {
141
- name: string;
142
- };
143
- }
144
- //#endregion
145
- export { StyleProp, isSafeClassNameValue };