@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/Mode.d.ts DELETED
@@ -1,41 +0,0 @@
1
- import { ModeDefinition, ModeOptionDefinition, TokenModifierKey } from "./types.js";
2
-
3
- //#region src/Mode.d.ts
4
- declare class ModeOption {
5
- readonly name: string;
6
- readonly modifier: TokenModifierKey;
7
- readonly label?: string;
8
- readonly description?: string;
9
- readonly css?: string;
10
- readonly media?: string;
11
- constructor(args: {
12
- name: string;
13
- definition: ModeOptionDefinition;
14
- });
15
- /**
16
- * Human description for when this option surfaces as a style modifier
17
- * (`_dark`, `_lg`). Distinguishes appearance/theme modes ("in dark mode")
18
- * from responsive breakpoints ("at the lg breakpoint"), inferred from
19
- * whether the option activates via `css` or `media`. Prefers the authored
20
- * `label`, falling back to the option `name`.
21
- */
22
- describeAsModifier(): string;
23
- toJSON(): ModeOptionDefinition & {
24
- name: string;
25
- };
26
- }
27
- declare class Mode {
28
- readonly name: string;
29
- readonly options: ReadonlyMap<string, ModeOption>;
30
- private _derived?;
31
- constructor(args: {
32
- name: string;
33
- definition: ModeDefinition;
34
- });
35
- get derived(): {
36
- readonly modifierNames: readonly TokenModifierKey[];
37
- };
38
- toJSON(): ModeDefinition;
39
- }
40
- //#endregion
41
- export { Mode, ModeOption };
package/dist/Mode.js DELETED
@@ -1,81 +0,0 @@
1
- import { compact } from "./entity-utils.js";
2
- //#region src/Mode.ts
3
- /**
4
- * `Mode` — a set of mutually-exclusive options each contributing a
5
- * modifier (`colorMode: { light, dark }` → `_light`, `_dark`).
6
- *
7
- * Owns its options and exposes the derived modifier names produced by
8
- * the option set.
9
- */
10
- var ModeOption = class {
11
- name;
12
- modifier;
13
- label;
14
- description;
15
- css;
16
- media;
17
- constructor(args) {
18
- this.name = args.name;
19
- this.modifier = args.definition.modifier ?? `_${args.name}`;
20
- this.label = args.definition.label;
21
- this.description = args.definition.description;
22
- this.css = args.definition.css;
23
- this.media = args.definition.media;
24
- }
25
- /**
26
- * Human description for when this option surfaces as a style modifier
27
- * (`_dark`, `_lg`). Distinguishes appearance/theme modes ("in dark mode")
28
- * from responsive breakpoints ("at the lg breakpoint"), inferred from
29
- * whether the option activates via `css` or `media`. Prefers the authored
30
- * `label`, falling back to the option `name`.
31
- */
32
- describeAsModifier() {
33
- const display = this.label ?? this.name;
34
- if (this.media) return `Conditionally apply styles at the ${display} breakpoint`;
35
- return `Conditionally apply styles in ${display} mode`;
36
- }
37
- toJSON() {
38
- return {
39
- name: this.name,
40
- modifier: this.modifier,
41
- ...compact({
42
- label: this.label,
43
- description: this.description,
44
- css: this.css,
45
- media: this.media
46
- })
47
- };
48
- }
49
- };
50
- var Mode = class {
51
- name;
52
- options;
53
- _derived;
54
- constructor(args) {
55
- this.name = args.name;
56
- const options = /* @__PURE__ */ new Map();
57
- for (const [optName, optDef] of Object.entries(args.definition)) options.set(optName, new ModeOption({
58
- name: optName,
59
- definition: optDef
60
- }));
61
- this.options = options;
62
- }
63
- get derived() {
64
- if (!this._derived) {
65
- const modifierNames = [];
66
- for (const option of this.options.values()) modifierNames.push(option.modifier);
67
- this._derived = { modifierNames };
68
- }
69
- return this._derived;
70
- }
71
- toJSON() {
72
- const out = {};
73
- for (const [name, option] of this.options) {
74
- const { name: _omit, ...rest } = option.toJSON();
75
- out[name] = rest;
76
- }
77
- return out;
78
- }
79
- };
80
- //#endregion
81
- export { Mode, ModeOption };
@@ -1,51 +0,0 @@
1
- import { CompositeRef, ModeRef } from "./refs.js";
2
- import { ModifierDefinition, TokenModifierKey } from "./types.js";
3
- import { CssSelector } from "./brands.js";
4
-
5
- //#region src/Modifier.d.ts
6
- type CompositeSelectorLookup = (ref: string) => string | undefined;
7
- type ModeSelectorLookup = (ref: string) => string | undefined;
8
- declare class Modifier {
9
- #private;
10
- readonly name: TokenModifierKey;
11
- readonly selector?: string | CompositeRef | ModeRef;
12
- readonly media?: string;
13
- readonly description?: string;
14
- /**
15
- * Tailwind variant prefix a modifier name maps to. Strip the leading
16
- * underscore, kebab-case the remainder, append `:`. `_focusVisible` →
17
- * `focus-visible:`, `_hover` → `hover:`. Static so callers that only
18
- * have the modifier name string (codegen `prepareModifierProps`,
19
- * className builders) can derive it without spinning up a Modifier.
20
- *
21
- * Loader and runtime must agree byte-for-byte on this output — the
22
- * single source of truth lives here.
23
- */
24
- static tailwindPrefix(modifierName: string): string;
25
- /**
26
- * Auto-generate a human-readable description from a modifier name —
27
- * strip the leading `_`, split on camelCase boundaries and digit
28
- * groups, lowercase. `_onElevation1` → `on elevation 1`. Static so
29
- * callers with just the name string (and no `Modifier` instance) can
30
- * reach the same wording; the instance getter
31
- * `derived.description` uses it as the fallback when the authored
32
- * `description` is missing.
33
- */
34
- static autoDescription(modifierName: string): string;
35
- constructor(args: {
36
- name: TokenModifierKey;
37
- definition: ModifierDefinition;
38
- compositeLookup: CompositeSelectorLookup;
39
- modeLookup: ModeSelectorLookup;
40
- });
41
- get derived(): {
42
- readonly cssSelector: CssSelector;
43
- readonly tailwindPrefix: string;
44
- readonly description: string;
45
- };
46
- toJSON(): ModifierDefinition & {
47
- name: TokenModifierKey;
48
- };
49
- }
50
- //#endregion
51
- export { Modifier };
package/dist/Modifier.js DELETED
@@ -1,97 +0,0 @@
1
- import { cssSelector } from "./brands.js";
2
- import { compact, kebabCase } from "./entity-utils.js";
3
- import { isCompositeRef, isModeRef } from "./refs.js";
4
- //#region src/Modifier.ts
5
- /**
6
- * `Modifier` — a state or structural variation (`_hover`, `_dark`).
7
- *
8
- * Stores the authored `selector` (string, `composite()` marker, or
9
- * `mode()` marker) and resolves it to a CSS selector on demand via
10
- * the parent Config's lookup callables.
11
- *
12
- * `derived.cssSelector` recomputes on access — the resolved value
13
- * depends on the Config's composite/mode tables, which can grow after
14
- * the Modifier is constructed.
15
- */
16
- var Modifier = class Modifier {
17
- name;
18
- selector;
19
- media;
20
- description;
21
- #compositeLookup;
22
- #modeLookup;
23
- #derived;
24
- /**
25
- * Tailwind variant prefix a modifier name maps to. Strip the leading
26
- * underscore, kebab-case the remainder, append `:`. `_focusVisible` →
27
- * `focus-visible:`, `_hover` → `hover:`. Static so callers that only
28
- * have the modifier name string (codegen `prepareModifierProps`,
29
- * className builders) can derive it without spinning up a Modifier.
30
- *
31
- * Loader and runtime must agree byte-for-byte on this output — the
32
- * single source of truth lives here.
33
- */
34
- static tailwindPrefix(modifierName) {
35
- return `${kebabCase(modifierName.slice(1))}:`;
36
- }
37
- /**
38
- * Auto-generate a human-readable description from a modifier name —
39
- * strip the leading `_`, split on camelCase boundaries and digit
40
- * groups, lowercase. `_onElevation1` → `on elevation 1`. Static so
41
- * callers with just the name string (and no `Modifier` instance) can
42
- * reach the same wording; the instance getter
43
- * `derived.description` uses it as the fallback when the authored
44
- * `description` is missing.
45
- */
46
- static autoDescription(modifierName) {
47
- return `Conditionally apply styles ${modifierName.replace(/^_/, "").replace(/([A-Z])/g, " $1").replace(/(\d+)/g, " $1").trim().toLowerCase()}`;
48
- }
49
- constructor(args) {
50
- this.name = args.name;
51
- this.selector = args.definition.selector;
52
- this.media = args.definition.media;
53
- this.description = args.definition.description;
54
- this.#compositeLookup = args.compositeLookup;
55
- this.#modeLookup = args.modeLookup;
56
- }
57
- get derived() {
58
- if (!this.#derived) {
59
- const selector = this.selector;
60
- const name = this.name;
61
- const authoredDescription = this.description;
62
- const compositeLookup = this.#compositeLookup;
63
- const modeLookup = this.#modeLookup;
64
- this.#derived = {
65
- get cssSelector() {
66
- return cssSelector(resolveSelector(selector, compositeLookup, modeLookup));
67
- },
68
- get tailwindPrefix() {
69
- return Modifier.tailwindPrefix(name);
70
- },
71
- get description() {
72
- return authoredDescription ?? Modifier.autoDescription(name);
73
- }
74
- };
75
- }
76
- return this.#derived;
77
- }
78
- toJSON() {
79
- return {
80
- name: this.name,
81
- ...compact({
82
- selector: this.selector,
83
- media: this.media,
84
- description: this.description
85
- })
86
- };
87
- }
88
- };
89
- function resolveSelector(selector, compositeLookup, modeLookup) {
90
- if (selector === void 0) return "";
91
- if (typeof selector === "string") return selector;
92
- if (isCompositeRef(selector)) return compositeLookup(selector.ref) ?? "";
93
- if (isModeRef(selector)) return modeLookup(selector.ref) ?? "";
94
- return "";
95
- }
96
- //#endregion
97
- export { Modifier };
@@ -1,81 +0,0 @@
1
- import { CssMotionDefinition, JsMotionDefinition, MotionKeyframes, MotionTransition } from "./types.js";
2
- import { CssClassName } from "./brands.js";
3
-
4
- //#region src/MotionDef.d.ts
5
- declare class CssMotionDef {
6
- #private;
7
- readonly runtime: "css";
8
- readonly name: string;
9
- readonly keyframes: MotionKeyframes;
10
- readonly transition?: MotionTransition;
11
- readonly duration?: CssMotionDefinition['duration'];
12
- readonly timingFunction?: CssMotionDefinition['timingFunction'];
13
- readonly delay?: CssMotionDefinition['delay'];
14
- readonly iterationCount?: CssMotionDefinition['iterationCount'];
15
- readonly direction?: CssMotionDefinition['direction'];
16
- readonly fillMode?: CssMotionDefinition['fillMode'];
17
- readonly playState?: CssMotionDefinition['playState'];
18
- readonly reducedMotion?: 'none';
19
- readonly label?: string;
20
- readonly description?: string;
21
- constructor(args: {
22
- name: string;
23
- definition: CssMotionDefinition;
24
- });
25
- get derived(): {
26
- readonly cssClassName: CssClassName;
27
- };
28
- toJSON(): CssMotionDefinition & {
29
- name: string;
30
- };
31
- }
32
- declare class JsMotionDef {
33
- readonly runtime: "js";
34
- readonly name: string;
35
- readonly variants?: JsMotionDefinition['variants'];
36
- readonly initial?: JsMotionDefinition['initial'];
37
- readonly animate?: JsMotionDefinition['animate'];
38
- readonly exit?: JsMotionDefinition['exit'];
39
- readonly transition?: MotionTransition;
40
- readonly whileHover?: JsMotionDefinition['whileHover'];
41
- readonly whileTap?: JsMotionDefinition['whileTap'];
42
- readonly whileFocus?: JsMotionDefinition['whileFocus'];
43
- readonly whileDrag?: JsMotionDefinition['whileDrag'];
44
- readonly whileInView?: JsMotionDefinition['whileInView'];
45
- readonly viewport?: JsMotionDefinition['viewport'];
46
- readonly drag?: JsMotionDefinition['drag'];
47
- readonly dragConstraints?: JsMotionDefinition['dragConstraints'];
48
- readonly dragElastic?: JsMotionDefinition['dragElastic'];
49
- readonly dragMomentum?: JsMotionDefinition['dragMomentum'];
50
- readonly dragSnapToOrigin?: JsMotionDefinition['dragSnapToOrigin'];
51
- readonly dragPropagation?: JsMotionDefinition['dragPropagation'];
52
- readonly dragDirectionLock?: JsMotionDefinition['dragDirectionLock'];
53
- readonly dragTransition?: JsMotionDefinition['dragTransition'];
54
- readonly layout?: JsMotionDefinition['layout'];
55
- readonly layoutId?: JsMotionDefinition['layoutId'];
56
- readonly layoutDependency?: JsMotionDefinition['layoutDependency'];
57
- readonly label?: string;
58
- readonly description?: string;
59
- constructor(args: {
60
- name: string;
61
- definition: JsMotionDefinition;
62
- });
63
- toJSON(): JsMotionDefinition & {
64
- name: string;
65
- };
66
- }
67
- type MotionDef = CssMotionDef | JsMotionDef;
68
- /** Fields a `runtime: 'js'` motion preset may carry (`JsMotionDefinition`). */
69
- declare const MOTION_JS_DEFINITION_KEYS: (keyof JsMotionDefinition)[];
70
- /**
71
- * JS motion field names minus the `runtime` discriminant and the author-side
72
- * `label` / `description` — the props codegen spreads onto the `motion.create`
73
- * wrapper. All three are excluded because they're config metadata, not framer
74
- * `motion` props (spreading them would leak stray attributes onto the DOM
75
- * element).
76
- */
77
- declare const MOTION_JS_FIELD_KEYS: ("initial" | "transition" | "animate" | "variants" | "exit" | "whileHover" | "whileTap" | "whileFocus" | "whileDrag" | "whileInView" | "viewport" | "drag" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragSnapToOrigin" | "dragPropagation" | "dragDirectionLock" | "dragTransition" | "layout" | "layoutId" | "layoutDependency")[];
78
- /** Fields a `runtime: 'css'` motion preset may carry (`CssMotionDefinition`). */
79
- declare const MOTION_CSS_DEFINITION_KEYS: (keyof CssMotionDefinition)[];
80
- //#endregion
81
- export { CssMotionDef, JsMotionDef, MOTION_CSS_DEFINITION_KEYS, MOTION_JS_DEFINITION_KEYS, MOTION_JS_FIELD_KEYS, MotionDef };
package/dist/MotionDef.js DELETED
@@ -1,212 +0,0 @@
1
- import { cssClassName } from "./brands.js";
2
- import { compact, kebabCase } from "./entity-utils.js";
3
- //#region src/MotionDef.ts
4
- /**
5
- * `MotionDef` — animation presets, discriminated by `runtime`.
6
- *
7
- * `CssMotionDef` carries the CSS keyframes + transition for the CSS
8
- * runtime and exposes a derived CSS class name. `JsMotionDef` carries
9
- * raw keyframe state for a JS animation library (motion-one / framer)
10
- * and has no `.derived` — the consumer reads authored state directly.
11
- */
12
- var CssMotionDef = class {
13
- runtime = "css";
14
- name;
15
- keyframes;
16
- transition;
17
- duration;
18
- timingFunction;
19
- delay;
20
- iterationCount;
21
- direction;
22
- fillMode;
23
- playState;
24
- reducedMotion;
25
- label;
26
- description;
27
- #derived;
28
- constructor(args) {
29
- const d = args.definition;
30
- this.name = args.name;
31
- this.keyframes = d.keyframes;
32
- this.transition = d.transition;
33
- this.duration = d.duration;
34
- this.timingFunction = d.timingFunction;
35
- this.delay = d.delay;
36
- this.iterationCount = d.iterationCount;
37
- this.direction = d.direction;
38
- this.fillMode = d.fillMode;
39
- this.playState = d.playState;
40
- this.reducedMotion = d.reducedMotion === "none" ? "none" : void 0;
41
- this.label = d.label;
42
- this.description = d.description;
43
- }
44
- get derived() {
45
- if (!this.#derived) this.#derived = { cssClassName: cssClassName(`motion-${kebabCase(this.name)}`) };
46
- return this.#derived;
47
- }
48
- toJSON() {
49
- return {
50
- name: this.name,
51
- runtime: "css",
52
- keyframes: this.keyframes,
53
- ...compact({
54
- transition: this.transition,
55
- duration: this.duration,
56
- timingFunction: this.timingFunction,
57
- delay: this.delay,
58
- iterationCount: this.iterationCount,
59
- direction: this.direction,
60
- fillMode: this.fillMode,
61
- playState: this.playState,
62
- reducedMotion: this.reducedMotion,
63
- label: this.label,
64
- description: this.description
65
- })
66
- };
67
- }
68
- };
69
- var JsMotionDef = class {
70
- runtime = "js";
71
- name;
72
- variants;
73
- initial;
74
- animate;
75
- exit;
76
- transition;
77
- whileHover;
78
- whileTap;
79
- whileFocus;
80
- whileDrag;
81
- whileInView;
82
- viewport;
83
- drag;
84
- dragConstraints;
85
- dragElastic;
86
- dragMomentum;
87
- dragSnapToOrigin;
88
- dragPropagation;
89
- dragDirectionLock;
90
- dragTransition;
91
- layout;
92
- layoutId;
93
- layoutDependency;
94
- label;
95
- description;
96
- constructor(args) {
97
- const d = args.definition;
98
- this.name = args.name;
99
- this.variants = d.variants;
100
- this.initial = d.initial;
101
- this.animate = d.animate;
102
- this.exit = d.exit;
103
- this.transition = d.transition;
104
- this.whileHover = d.whileHover;
105
- this.whileTap = d.whileTap;
106
- this.whileFocus = d.whileFocus;
107
- this.whileDrag = d.whileDrag;
108
- this.whileInView = d.whileInView;
109
- this.viewport = d.viewport;
110
- this.drag = d.drag;
111
- this.dragConstraints = d.dragConstraints;
112
- this.dragElastic = d.dragElastic;
113
- this.dragMomentum = d.dragMomentum;
114
- this.dragSnapToOrigin = d.dragSnapToOrigin;
115
- this.dragPropagation = d.dragPropagation;
116
- this.dragDirectionLock = d.dragDirectionLock;
117
- this.dragTransition = d.dragTransition;
118
- this.layout = d.layout;
119
- this.layoutId = d.layoutId;
120
- this.layoutDependency = d.layoutDependency;
121
- this.label = d.label;
122
- this.description = d.description;
123
- }
124
- toJSON() {
125
- return {
126
- name: this.name,
127
- runtime: "js",
128
- ...compact({
129
- variants: this.variants,
130
- initial: this.initial,
131
- animate: this.animate,
132
- exit: this.exit,
133
- transition: this.transition,
134
- whileHover: this.whileHover,
135
- whileTap: this.whileTap,
136
- whileFocus: this.whileFocus,
137
- whileDrag: this.whileDrag,
138
- whileInView: this.whileInView,
139
- viewport: this.viewport,
140
- drag: this.drag,
141
- dragConstraints: this.dragConstraints,
142
- dragElastic: this.dragElastic,
143
- dragMomentum: this.dragMomentum,
144
- dragSnapToOrigin: this.dragSnapToOrigin,
145
- dragPropagation: this.dragPropagation,
146
- dragDirectionLock: this.dragDirectionLock,
147
- dragTransition: this.dragTransition,
148
- layout: this.layout,
149
- layoutId: this.layoutId,
150
- layoutDependency: this.layoutDependency,
151
- label: this.label,
152
- description: this.description
153
- })
154
- };
155
- }
156
- };
157
- const JS_MOTION_DEFINITION_KEY_PRESENCE = {
158
- runtime: true,
159
- variants: true,
160
- initial: true,
161
- animate: true,
162
- exit: true,
163
- transition: true,
164
- whileHover: true,
165
- whileTap: true,
166
- whileFocus: true,
167
- whileDrag: true,
168
- whileInView: true,
169
- viewport: true,
170
- drag: true,
171
- dragConstraints: true,
172
- dragElastic: true,
173
- dragMomentum: true,
174
- dragSnapToOrigin: true,
175
- dragPropagation: true,
176
- dragDirectionLock: true,
177
- dragTransition: true,
178
- layout: true,
179
- layoutId: true,
180
- layoutDependency: true,
181
- label: true,
182
- description: true
183
- };
184
- const CSS_MOTION_DEFINITION_KEY_PRESENCE = {
185
- runtime: true,
186
- keyframes: true,
187
- transition: true,
188
- duration: true,
189
- timingFunction: true,
190
- delay: true,
191
- iterationCount: true,
192
- direction: true,
193
- fillMode: true,
194
- playState: true,
195
- reducedMotion: true,
196
- label: true,
197
- description: true
198
- };
199
- /** Fields a `runtime: 'js'` motion preset may carry (`JsMotionDefinition`). */
200
- const MOTION_JS_DEFINITION_KEYS = Object.keys(JS_MOTION_DEFINITION_KEY_PRESENCE);
201
- /**
202
- * JS motion field names minus the `runtime` discriminant and the author-side
203
- * `label` / `description` — the props codegen spreads onto the `motion.create`
204
- * wrapper. All three are excluded because they're config metadata, not framer
205
- * `motion` props (spreading them would leak stray attributes onto the DOM
206
- * element).
207
- */
208
- const MOTION_JS_FIELD_KEYS = MOTION_JS_DEFINITION_KEYS.filter((k) => k !== "runtime" && k !== "label" && k !== "description");
209
- /** Fields a `runtime: 'css'` motion preset may carry (`CssMotionDefinition`). */
210
- const MOTION_CSS_DEFINITION_KEYS = Object.keys(CSS_MOTION_DEFINITION_KEY_PRESENCE);
211
- //#endregion
212
- export { CssMotionDef, JsMotionDef, MOTION_CSS_DEFINITION_KEYS, MOTION_JS_DEFINITION_KEYS, MOTION_JS_FIELD_KEYS };