@starci/grammar 0.2.0 → 0.4.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 (282) hide show
  1. package/README.md +54 -30
  2. package/dist/common/conformance.d.ts +31 -0
  3. package/dist/common/conformance.d.ts.map +1 -0
  4. package/dist/common/conformance.js +33 -0
  5. package/dist/common/conformance.js.map +1 -0
  6. package/dist/common/index.d.ts +5 -73
  7. package/dist/common/index.d.ts.map +1 -1
  8. package/dist/common/index.js +5 -202
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/common/registry.d.ts +79 -0
  11. package/dist/common/registry.d.ts.map +1 -0
  12. package/dist/common/registry.js +34 -0
  13. package/dist/common/registry.js.map +1 -0
  14. package/dist/common/renderers.d.ts +41 -0
  15. package/dist/common/renderers.d.ts.map +1 -0
  16. package/dist/common/renderers.js +44 -0
  17. package/dist/common/renderers.js.map +1 -0
  18. package/dist/common/rule-catalog.generated.d.ts +40 -0
  19. package/dist/common/rule-catalog.generated.d.ts.map +1 -0
  20. package/dist/common/rule-catalog.generated.js +230 -0
  21. package/dist/common/rule-catalog.generated.js.map +1 -0
  22. package/dist/common/spacing.d.ts +20 -0
  23. package/dist/common/spacing.d.ts.map +1 -0
  24. package/dist/common/spacing.js +18 -0
  25. package/dist/common/spacing.js.map +1 -0
  26. package/dist/common/state.d.ts +6 -0
  27. package/dist/common/state.d.ts.map +1 -0
  28. package/dist/common/state.js +11 -0
  29. package/dist/common/state.js.map +1 -0
  30. package/dist/common/styles.css +1566 -2
  31. package/dist/core/LeadingNumber.d.ts +12 -0
  32. package/dist/core/LeadingNumber.d.ts.map +1 -0
  33. package/dist/core/LeadingNumber.js +10 -0
  34. package/dist/core/LeadingNumber.js.map +1 -0
  35. package/dist/core/OtpInput.d.ts +12 -0
  36. package/dist/core/OtpInput.d.ts.map +1 -0
  37. package/dist/core/OtpInput.js +22 -0
  38. package/dist/core/OtpInput.js.map +1 -0
  39. package/dist/core/StateMark.d.ts +3 -5
  40. package/dist/core/StateMark.d.ts.map +1 -1
  41. package/dist/core/StateMark.js +3 -3
  42. package/dist/core/StateMark.js.map +1 -1
  43. package/dist/core/branch/MarkdownArticle/classNames.d.ts +9 -0
  44. package/dist/core/branch/MarkdownArticle/classNames.d.ts.map +1 -0
  45. package/dist/core/branch/MarkdownArticle/classNames.js +10 -0
  46. package/dist/core/branch/MarkdownArticle/classNames.js.map +1 -0
  47. package/dist/core/branch/MarkdownArticle/index.d.ts +30 -0
  48. package/dist/core/branch/MarkdownArticle/index.d.ts.map +1 -0
  49. package/dist/core/branch/MarkdownArticle/index.js +12 -0
  50. package/dist/core/branch/MarkdownArticle/index.js.map +1 -0
  51. package/dist/core/branch/Rail/classNames.d.ts +9 -0
  52. package/dist/core/branch/Rail/classNames.d.ts.map +1 -0
  53. package/dist/core/branch/Rail/classNames.js +10 -0
  54. package/dist/core/branch/Rail/classNames.js.map +1 -0
  55. package/dist/core/branch/Rail/index.d.ts +7 -6
  56. package/dist/core/branch/Rail/index.d.ts.map +1 -1
  57. package/dist/core/branch/Rail/index.js +16 -5
  58. package/dist/core/branch/Rail/index.js.map +1 -1
  59. package/dist/core/branch/Subnav/classNames.d.ts +8 -0
  60. package/dist/core/branch/Subnav/classNames.d.ts.map +1 -0
  61. package/dist/core/branch/Subnav/classNames.js +9 -0
  62. package/dist/core/branch/Subnav/classNames.js.map +1 -0
  63. package/dist/core/branch/Subnav/index.d.ts +17 -0
  64. package/dist/core/branch/Subnav/index.d.ts.map +1 -0
  65. package/dist/core/branch/Subnav/index.js +6 -0
  66. package/dist/core/branch/Subnav/index.js.map +1 -0
  67. package/dist/core/branch/SurfaceAccordionCard/classNames.d.ts +19 -0
  68. package/dist/core/branch/SurfaceAccordionCard/classNames.d.ts.map +1 -0
  69. package/dist/core/branch/SurfaceAccordionCard/classNames.js +21 -0
  70. package/dist/core/branch/SurfaceAccordionCard/classNames.js.map +1 -0
  71. package/dist/core/branch/SurfaceAccordionCard/index.d.ts +44 -0
  72. package/dist/core/branch/SurfaceAccordionCard/index.d.ts.map +1 -0
  73. package/dist/core/branch/SurfaceAccordionCard/index.js +42 -0
  74. package/dist/core/branch/SurfaceAccordionCard/index.js.map +1 -0
  75. package/dist/core/branch/SurfaceCard/classNames.d.ts +23 -0
  76. package/dist/core/branch/SurfaceCard/classNames.d.ts.map +1 -0
  77. package/dist/core/branch/SurfaceCard/classNames.js +23 -0
  78. package/dist/core/branch/SurfaceCard/classNames.js.map +1 -0
  79. package/dist/core/branch/SurfaceCard/index.d.ts +14 -7
  80. package/dist/core/branch/SurfaceCard/index.d.ts.map +1 -1
  81. package/dist/core/branch/SurfaceCard/index.js +18 -4
  82. package/dist/core/branch/SurfaceCard/index.js.map +1 -1
  83. package/dist/core/branch/SurfaceListCard/classNames.d.ts +13 -0
  84. package/dist/core/branch/SurfaceListCard/classNames.d.ts.map +1 -0
  85. package/dist/core/branch/SurfaceListCard/classNames.js +14 -0
  86. package/dist/core/branch/SurfaceListCard/classNames.js.map +1 -0
  87. package/dist/core/branch/SurfaceListCard/index.d.ts +5 -19
  88. package/dist/core/branch/SurfaceListCard/index.d.ts.map +1 -1
  89. package/dist/core/branch/SurfaceListCard/index.js +6 -8
  90. package/dist/core/branch/SurfaceListCard/index.js.map +1 -1
  91. package/dist/core/branch/Tabs/classNames.d.ts +11 -0
  92. package/dist/core/branch/Tabs/classNames.d.ts.map +1 -0
  93. package/dist/core/branch/Tabs/classNames.js +13 -0
  94. package/dist/core/branch/Tabs/classNames.js.map +1 -0
  95. package/dist/core/branch/Tabs/index.d.ts +22 -0
  96. package/dist/core/branch/Tabs/index.d.ts.map +1 -0
  97. package/dist/core/branch/Tabs/index.js +28 -0
  98. package/dist/core/branch/Tabs/index.js.map +1 -0
  99. package/dist/core/branch/Tooltip/classNames.d.ts +3 -0
  100. package/dist/core/branch/Tooltip/classNames.d.ts.map +1 -0
  101. package/dist/core/branch/Tooltip/classNames.js +4 -0
  102. package/dist/core/branch/Tooltip/classNames.js.map +1 -0
  103. package/dist/core/branch/Tooltip/index.d.ts +18 -0
  104. package/dist/core/branch/Tooltip/index.d.ts.map +1 -0
  105. package/dist/core/branch/Tooltip/index.js +14 -0
  106. package/dist/core/branch/Tooltip/index.js.map +1 -0
  107. package/dist/core/classNames.d.ts +23 -0
  108. package/dist/core/classNames.d.ts.map +1 -0
  109. package/dist/core/classNames.js +24 -0
  110. package/dist/core/classNames.js.map +1 -0
  111. package/dist/core/composite/EmptyNotice/index.d.ts +17 -0
  112. package/dist/core/composite/EmptyNotice/index.d.ts.map +1 -0
  113. package/dist/core/composite/EmptyNotice/index.js +7 -0
  114. package/dist/core/composite/EmptyNotice/index.js.map +1 -0
  115. package/dist/core/composite/HorizontalScrollRegion/index.d.ts +9 -0
  116. package/dist/core/composite/HorizontalScrollRegion/index.d.ts.map +1 -0
  117. package/dist/core/composite/HorizontalScrollRegion/index.js +10 -0
  118. package/dist/core/composite/HorizontalScrollRegion/index.js.map +1 -0
  119. package/dist/core/composite/StaticStateRow/index.d.ts +1 -5
  120. package/dist/core/composite/StaticStateRow/index.d.ts.map +1 -1
  121. package/dist/core/composite/StaticStateRow/index.js +4 -3
  122. package/dist/core/composite/StaticStateRow/index.js.map +1 -1
  123. package/dist/core/composite/VerticalScrollRegion/index.d.ts +10 -0
  124. package/dist/core/composite/VerticalScrollRegion/index.d.ts.map +1 -0
  125. package/dist/core/composite/VerticalScrollRegion/index.js +10 -0
  126. package/dist/core/composite/VerticalScrollRegion/index.js.map +1 -0
  127. package/dist/core/composition/ChatWorkspace/classNames.d.ts +30 -0
  128. package/dist/core/composition/ChatWorkspace/classNames.d.ts.map +1 -0
  129. package/dist/core/composition/ChatWorkspace/classNames.js +31 -0
  130. package/dist/core/composition/ChatWorkspace/classNames.js.map +1 -0
  131. package/dist/core/composition/ChatWorkspace/index.d.ts +48 -0
  132. package/dist/core/composition/ChatWorkspace/index.d.ts.map +1 -0
  133. package/dist/core/composition/ChatWorkspace/index.js +40 -0
  134. package/dist/core/composition/ChatWorkspace/index.js.map +1 -0
  135. package/dist/core/composition/NavigationFeatureNav/classNames.d.ts +9 -0
  136. package/dist/core/composition/NavigationFeatureNav/classNames.d.ts.map +1 -0
  137. package/dist/core/composition/NavigationFeatureNav/classNames.js +10 -0
  138. package/dist/core/composition/NavigationFeatureNav/classNames.js.map +1 -0
  139. package/dist/core/composition/NavigationFeatureNav/index.d.ts +26 -0
  140. package/dist/core/composition/NavigationFeatureNav/index.d.ts.map +1 -0
  141. package/dist/core/composition/NavigationFeatureNav/index.js +13 -0
  142. package/dist/core/composition/NavigationFeatureNav/index.js.map +1 -0
  143. package/dist/core/composition/PrimaryRailLayout/index.d.ts +14 -0
  144. package/dist/core/composition/PrimaryRailLayout/index.d.ts.map +1 -0
  145. package/dist/core/composition/PrimaryRailLayout/index.js +8 -0
  146. package/dist/core/composition/PrimaryRailLayout/index.js.map +1 -0
  147. package/dist/core/composition/Sidebar/index.d.ts +31 -0
  148. package/dist/core/composition/Sidebar/index.d.ts.map +1 -0
  149. package/dist/core/composition/Sidebar/index.js +40 -0
  150. package/dist/core/composition/Sidebar/index.js.map +1 -0
  151. package/dist/core/composition/WorkspaceShell/classNames.d.ts +11 -0
  152. package/dist/core/composition/WorkspaceShell/classNames.d.ts.map +1 -0
  153. package/dist/core/composition/WorkspaceShell/classNames.js +12 -0
  154. package/dist/core/composition/WorkspaceShell/classNames.js.map +1 -0
  155. package/dist/core/composition/WorkspaceShell/index.d.ts +67 -0
  156. package/dist/core/composition/WorkspaceShell/index.d.ts.map +1 -0
  157. package/dist/core/composition/WorkspaceShell/index.js +20 -0
  158. package/dist/core/composition/WorkspaceShell/index.js.map +1 -0
  159. package/dist/core/dna.d.ts +180 -0
  160. package/dist/core/dna.d.ts.map +1 -0
  161. package/dist/core/dna.js +175 -0
  162. package/dist/core/dna.js.map +1 -0
  163. package/dist/core/index.d.ts +59 -10
  164. package/dist/core/index.d.ts.map +1 -1
  165. package/dist/core/index.js +27 -10
  166. package/dist/core/index.js.map +1 -1
  167. package/dist/core/primitive/Badge/index.d.ts +12 -0
  168. package/dist/core/primitive/Badge/index.d.ts.map +1 -0
  169. package/dist/core/primitive/Badge/index.js +15 -0
  170. package/dist/core/primitive/Badge/index.js.map +1 -0
  171. package/dist/core/primitive/Button/index.d.ts +52 -0
  172. package/dist/core/primitive/Button/index.d.ts.map +1 -0
  173. package/dist/core/primitive/Button/index.js +26 -0
  174. package/dist/core/primitive/Button/index.js.map +1 -0
  175. package/dist/core/primitive/Divider/index.d.ts +7 -0
  176. package/dist/core/primitive/Divider/index.d.ts.map +1 -0
  177. package/dist/core/primitive/Divider/index.js +5 -0
  178. package/dist/core/primitive/Divider/index.js.map +1 -0
  179. package/dist/core/primitive/GrammarRoot/index.d.ts +10 -0
  180. package/dist/core/primitive/GrammarRoot/index.d.ts.map +1 -0
  181. package/dist/core/primitive/GrammarRoot/index.js +5 -0
  182. package/dist/core/primitive/GrammarRoot/index.js.map +1 -0
  183. package/dist/core/primitive/Heading/index.d.ts +15 -0
  184. package/dist/core/primitive/Heading/index.d.ts.map +1 -0
  185. package/dist/core/primitive/Heading/index.js +26 -0
  186. package/dist/core/primitive/Heading/index.js.map +1 -0
  187. package/dist/core/primitive/Icon/index.d.ts +31 -0
  188. package/dist/core/primitive/Icon/index.d.ts.map +1 -0
  189. package/dist/core/primitive/Icon/index.js +23 -0
  190. package/dist/core/primitive/Icon/index.js.map +1 -0
  191. package/dist/core/primitive/IconButton/index.d.ts +13 -0
  192. package/dist/core/primitive/IconButton/index.d.ts.map +1 -0
  193. package/dist/core/primitive/IconButton/index.js +9 -0
  194. package/dist/core/primitive/IconButton/index.js.map +1 -0
  195. package/dist/core/primitive/IconTile/index.d.ts +17 -0
  196. package/dist/core/primitive/IconTile/index.d.ts.map +1 -0
  197. package/dist/core/primitive/IconTile/index.js +32 -0
  198. package/dist/core/primitive/IconTile/index.js.map +1 -0
  199. package/dist/core/primitive/IncludedMark/index.d.ts +10 -0
  200. package/dist/core/primitive/IncludedMark/index.d.ts.map +1 -0
  201. package/dist/core/primitive/IncludedMark/index.js +8 -0
  202. package/dist/core/primitive/IncludedMark/index.js.map +1 -0
  203. package/dist/core/primitive/Input/index.d.ts +31 -0
  204. package/dist/core/primitive/Input/index.d.ts.map +1 -0
  205. package/dist/core/primitive/Input/index.js +27 -0
  206. package/dist/core/primitive/Input/index.js.map +1 -0
  207. package/dist/core/primitive/Label/classNames.d.ts +12 -0
  208. package/dist/core/primitive/Label/classNames.d.ts.map +1 -0
  209. package/dist/core/primitive/Label/classNames.js +13 -0
  210. package/dist/core/primitive/Label/classNames.js.map +1 -0
  211. package/dist/core/primitive/Label/index.d.ts +11 -0
  212. package/dist/core/primitive/Label/index.d.ts.map +1 -0
  213. package/dist/core/primitive/Label/index.js +14 -0
  214. package/dist/core/primitive/Label/index.js.map +1 -0
  215. package/dist/core/primitive/MediaFrame/index.d.ts +15 -0
  216. package/dist/core/primitive/MediaFrame/index.d.ts.map +1 -0
  217. package/dist/core/primitive/MediaFrame/index.js +8 -0
  218. package/dist/core/primitive/MediaFrame/index.js.map +1 -0
  219. package/dist/core/primitive/PageContainer/index.d.ts +9 -0
  220. package/dist/core/primitive/PageContainer/index.d.ts.map +1 -0
  221. package/dist/core/primitive/PageContainer/index.js +8 -0
  222. package/dist/core/primitive/PageContainer/index.js.map +1 -0
  223. package/dist/core/primitive/Progress/index.d.ts +11 -0
  224. package/dist/core/primitive/Progress/index.d.ts.map +1 -0
  225. package/dist/core/primitive/Progress/index.js +13 -0
  226. package/dist/core/primitive/Progress/index.js.map +1 -0
  227. package/dist/core/primitive/RankArtwork/index.d.ts +12 -0
  228. package/dist/core/primitive/RankArtwork/index.d.ts.map +1 -0
  229. package/dist/core/primitive/RankArtwork/index.js +14 -0
  230. package/dist/core/primitive/RankArtwork/index.js.map +1 -0
  231. package/dist/core/primitive/SectionHeader/index.d.ts +15 -0
  232. package/dist/core/primitive/SectionHeader/index.d.ts.map +1 -0
  233. package/dist/core/primitive/SectionHeader/index.js +6 -0
  234. package/dist/core/primitive/SectionHeader/index.js.map +1 -0
  235. package/dist/core/primitive/SurfaceCopyGroup/index.d.ts +7 -0
  236. package/dist/core/primitive/SurfaceCopyGroup/index.d.ts.map +1 -0
  237. package/dist/core/primitive/SurfaceCopyGroup/index.js +5 -0
  238. package/dist/core/primitive/SurfaceCopyGroup/index.js.map +1 -0
  239. package/dist/core/primitive/Text/index.d.ts +25 -0
  240. package/dist/core/primitive/Text/index.d.ts.map +1 -0
  241. package/dist/core/primitive/Text/index.js +57 -0
  242. package/dist/core/primitive/Text/index.js.map +1 -0
  243. package/dist/core/primitive/TextAction/index.d.ts +45 -0
  244. package/dist/core/primitive/TextAction/index.d.ts.map +1 -0
  245. package/dist/core/primitive/TextAction/index.js +112 -0
  246. package/dist/core/primitive/TextAction/index.js.map +1 -0
  247. package/dist/core/primitive/actionStyles.d.ts +5 -0
  248. package/dist/core/primitive/actionStyles.d.ts.map +1 -0
  249. package/dist/core/primitive/actionStyles.js +19 -0
  250. package/dist/core/primitive/actionStyles.js.map +1 -0
  251. package/dist/core/state.d.ts +4 -4
  252. package/dist/core/state.d.ts.map +1 -1
  253. package/dist/core/state.js +4 -4
  254. package/dist/core/state.js.map +1 -1
  255. package/dist/core/styles.css +152 -225
  256. package/dist/heritage/index.d.ts +27 -0
  257. package/dist/heritage/index.d.ts.map +1 -0
  258. package/dist/heritage/index.js +44 -0
  259. package/dist/heritage/index.js.map +1 -0
  260. package/dist/heritage/styles.css +165 -0
  261. package/dist/offset-pop/index.d.ts +9 -263
  262. package/dist/offset-pop/index.d.ts.map +1 -1
  263. package/dist/offset-pop/index.js +35 -63
  264. package/dist/offset-pop/index.js.map +1 -1
  265. package/dist/offset-pop/styles.css +292 -393
  266. package/package.json +78 -72
  267. package/dist/core/contracts.d.ts +0 -190
  268. package/dist/core/contracts.d.ts.map +0 -1
  269. package/dist/core/contracts.js +0 -145
  270. package/dist/core/contracts.js.map +0 -1
  271. package/dist/core/grammar.d.ts +0 -18
  272. package/dist/core/grammar.d.ts.map +0 -1
  273. package/dist/core/grammar.js +0 -27
  274. package/dist/core/grammar.js.map +0 -1
  275. package/dist/core/layout.d.ts +0 -9
  276. package/dist/core/layout.d.ts.map +0 -1
  277. package/dist/core/layout.js +0 -43
  278. package/dist/core/layout.js.map +0 -1
  279. package/dist/core/rules.d.ts +0 -63
  280. package/dist/core/rules.d.ts.map +0 -1
  281. package/dist/core/rules.js +0 -66
  282. package/dist/core/rules.js.map +0 -1
package/README.md CHANGED
@@ -1,50 +1,71 @@
1
1
  # `@starci/grammar`
2
2
 
3
- Business-neutral UI contracts and versioned StarCi Grammar bundles.
3
+ `@starci/grammar` separates one shared, business-free UI contract from sibling visual families.
4
+ Common owns typed props, semantics, renderer anatomy, universal states/scales, and the family
5
+ registry. Core, Heritage, and Offset Pop implement that contract with independently scoped visual
6
+ DNA. The package contains no routes, domain entities, product decisions, or feature-named shells.
4
7
 
5
8
  ## Public entry points
6
9
 
7
- - `@starci/grammar/common` — contract kernel and runtime validation.
8
- - `@starci/grammar/core` — batteries-included, product-neutral leaves, composites, branches, layout capabilities and base contracts.
9
- - `@starci/grammar/offset-pop` — one declared visual extension of Core.
10
- - `@starci/grammar/common/styles.css`, `core/styles.css`, `offset-pop/styles.css` canonical cascade entries. Short `.css` aliases are also exported.
10
+ - `@starci/grammar/common` — shared React renderers, presentation-state helpers, and their CSS. Anonymous layout/action owners include `WorkspaceShell`, `Sidebar`, `Link`, and `TextAction`.
11
+ - `@starci/grammar/core` — the StarCi Core family, its scoped root, DNA, and compatibility aliases.
12
+ - `@starci/grammar/heritage` and `@starci/grammar/offset-pop` — sibling family roots,
13
+ conformance receipts, and scoped visual overlays.
14
+ - `@starci/grammar/common/styles.css`, `@starci/grammar/core/styles.css`,
15
+ `@starci/grammar/heritage/styles.css`, and
16
+ `@starci/grammar/offset-pop/styles.css` — package stylesheets. Short `.css` export aliases are
17
+ also available.
11
18
 
12
- Install this workspace package while it is under development. Published consumers must pin one
13
- exact version rather than a range:
19
+ Install the workspace package while developing locally:
14
20
 
15
21
  ```sh
16
22
  npm install ./packages/grammar
17
- # after publication: npm install --save-exact @starci/grammar@0.2.0
18
23
  ```
19
24
 
20
- ```ts
21
- import { createContractRegistry } from "@starci/grammar/common"
22
- import { CORE_COMPONENT_CONTRACTS } from "@starci/grammar/core"
23
- import { offsetPopGrammar } from "@starci/grammar/offset-pop"
24
- ```
25
+ Import components from the focused entry point:
25
26
 
26
- ```css
27
- @import "@starci/grammar/common/styles.css";
28
- @import "@starci/grammar/core/styles.css";
29
- @import "@starci/grammar/offset-pop/styles.css";
30
- ```
27
+ ```tsx
28
+ import {
29
+ PageContainer,
30
+ PrimaryRailLayout,
31
+ SurfaceCard,
32
+ } from "@starci/grammar/common"
33
+ import { CoreGrammarRoot } from "@starci/grammar/core"
34
+ import "@starci/grammar/core/styles.css"
31
35
 
32
- `common` contains no React, Next.js, business entity, operation or domain state. A Product Block translates domain state into `PresentationState`; Grammar consumes only that neutral state.
36
+ export const ProductSurface = () => (
37
+ <CoreGrammarRoot>
38
+ <PageContainer>
39
+ <PrimaryRailLayout
40
+ primary={<SurfaceCard ariaLabel="Main">...</SurfaceCard>}
41
+ rail={<SurfaceCard ariaLabel="Progress">...</SurfaceCard>}
42
+ />
43
+ </PageContainer>
44
+ </CoreGrammarRoot>
45
+ )
46
+ ```
33
47
 
34
- Core owners expose additive, business-neutral capabilities without opening their anatomy:
48
+ `GrammarRoot` from Common is neutral. `CoreGrammarRoot` applies `data-grammar-family="core"` and
49
+ the Core stylesheet imports Common anatomy before adding StarCi light, dark, system, forced-colour,
50
+ and HeroUI-compatible tokens. `STARCI_CORE_DNA` exposes the immutable
51
+ design values, `STARCI_CORE_SPACING_SCALE` exposes the canonical 4px spacing steps,
52
+ `STARCI_CORE_TOKEN_NAMES` exposes their CSS adaptation contract, and
53
+ `STARCI_CORE_TOKEN_DEFAULTS` / `STARCI_CORE_DARK_TOKEN_DEFAULTS` expose the exact packaged values.
35
54
 
36
- - `StateMark` is a Core leaf for neutral presentation-state marks.
37
- - `StaticStateRow` is a Core composite for one non-interactive row in a Core-owned collection.
38
- - `SurfaceCard` supports bounded/frameless frames, page/contained scrolling and one label-end slot.
39
- - `SurfaceListCard` supports Core-owned static rows or a content-owned interactive collection, an accessible hidden label and one footer.
40
- - `Rail` supports a Core-owned complementary landmark or one content-owned navigation landmark, plus expanded/collapsed and motion/reduced-motion declarations.
55
+ Heritage and Offset Pop replace only the neutral family root; every other Common renderer and prop
56
+ contract is inherited. Each family stylesheet imports Common anatomy directly and never imports a
57
+ sibling family stylesheet.
41
58
 
42
- `CORE_LAYOUT_CLASS_NAMES` is the closed product-neutral layout vocabulary. Product breakpoints,
43
- token names and selectors remain in the consuming application's contract registry.
44
-
45
- Adapters must bind directly to the `core.*` contract identity and emit the canonical `data-grammar-*` anatomy. A product-prefixed contract with no resolved Core axis is not a substitute for conformance.
59
+ `IncludedMark` is the purpose-named 20px outlined circle-check for included offering content; it
60
+ inherits foreground and never claims completion. `SurfaceCopyGroup` packages Core's compact `0.5rem`
61
+ title/explanation rhythm. A `SurfaceCard` without `wholeAction` identifies itself as `static`, which
62
+ is the appropriate comparison surface when its short facts must remain visible together.
46
63
 
47
- Contracts are immutable. Extensions may resolve only axes explicitly opened by the base contract. They cannot replace anatomy, mutate a closed invariant, substitute the owner or silently replace a duplicate registry key.
64
+ Common components accept ordinary typed React props and keep semantic DOM and accessibility behavior.
65
+ The application translates business data into those props; a family changes presentation only.
66
+ `MediaFrame` presents an already selected asset and never decides whether to generate one. The
67
+ machine-checkable `COMMON_UI_RULE_IDS`/`defineGrammarRuleConformance` boundary verifies that each
68
+ family accounts for the canonical UI X-n catalog without copying the laws into package code.
48
69
 
49
70
  ## Package checks
50
71
 
@@ -53,3 +74,6 @@ npm run typecheck
53
74
  npm test
54
75
  npm pack --dry-run
55
76
  ```
77
+
78
+ The package requires Node.js 20 or newer and has peer dependencies on React 18+ and
79
+ `@heroui/react` 3.2+.
@@ -0,0 +1,31 @@
1
+ import { RULE_FAMILY_COUNTS } from "./rule-catalog.generated.js";
2
+ /**
3
+ * The catalog is GENERATED, not transcribed.
4
+ *
5
+ * The table that used to live here was a hand-typed copy of the knowledge tree's family list, and
6
+ * a copy is only correct on the day it is typed. By the time anyone looked, `accessibility` had
7
+ * renamed its ids from `ACCESSIBILITY-n` to `A11Y-n`, `render-truth` published `TRUTH-n`,
8
+ * `text-flow` published `FLOW-n`, and MEASURE, OVERFLOW and TONE had appeared - none of which the
9
+ * table knew, while three of its families named rules that no longer existed anywhere. Every
10
+ * conformance check went on passing against the wrong catalog, which is the worst outcome a check
11
+ * can have.
12
+ *
13
+ * Regenerate with `node scripts/generate-rule-catalog.mjs [knowledgeDir]` from the package root.
14
+ */
15
+ export { RULE_FAMILY_COUNTS };
16
+ /** Every canonical Common UI rule id, exactly as the knowledge tree spells it. */
17
+ export declare const COMMON_UI_RULE_IDS: readonly string[];
18
+ export type GrammarRuleConformance = {
19
+ readonly familyId: string;
20
+ readonly inheritedCommonRules: ReadonlyArray<string>;
21
+ readonly familyEvidence: Readonly<Record<string, ReadonlyArray<string>>>;
22
+ };
23
+ /** Machine-checkable family coverage against the canonical knowledge/ui X-n catalog. */
24
+ export declare const defineGrammarRuleConformance: (definition: GrammarRuleConformance) => Readonly<{
25
+ familyId: string;
26
+ inheritedCommonRules: readonly string[];
27
+ familyEvidence: Readonly<{
28
+ [x: string]: readonly string[];
29
+ }>;
30
+ }>;
31
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/common/conformance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEpF;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,mBAAqB,CAAA;AAEpD,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpD,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;CAC3E,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,4BAA4B,GAAI,YAAY,sBAAsB;;;;;;EAa9E,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { CANONICAL_RULE_IDS, RULE_FAMILY_COUNTS } from "./rule-catalog.generated.js";
2
+ /**
3
+ * The catalog is GENERATED, not transcribed.
4
+ *
5
+ * The table that used to live here was a hand-typed copy of the knowledge tree's family list, and
6
+ * a copy is only correct on the day it is typed. By the time anyone looked, `accessibility` had
7
+ * renamed its ids from `ACCESSIBILITY-n` to `A11Y-n`, `render-truth` published `TRUTH-n`,
8
+ * `text-flow` published `FLOW-n`, and MEASURE, OVERFLOW and TONE had appeared - none of which the
9
+ * table knew, while three of its families named rules that no longer existed anywhere. Every
10
+ * conformance check went on passing against the wrong catalog, which is the worst outcome a check
11
+ * can have.
12
+ *
13
+ * Regenerate with `node scripts/generate-rule-catalog.mjs [knowledgeDir]` from the package root.
14
+ */
15
+ export { RULE_FAMILY_COUNTS };
16
+ /** Every canonical Common UI rule id, exactly as the knowledge tree spells it. */
17
+ export const COMMON_UI_RULE_IDS = CANONICAL_RULE_IDS;
18
+ /** Machine-checkable family coverage against the canonical knowledge/ui X-n catalog. */
19
+ export const defineGrammarRuleConformance = (definition) => {
20
+ const inherited = new Set(definition.inheritedCommonRules);
21
+ const evidence = new Set(Object.keys(definition.familyEvidence));
22
+ const missing = COMMON_UI_RULE_IDS.filter((rule) => !inherited.has(rule) && !evidence.has(rule));
23
+ const unknown = [...inherited, ...evidence].filter((rule) => !COMMON_UI_RULE_IDS.includes(rule));
24
+ if (missing.length > 0 || unknown.length > 0) {
25
+ throw new TypeError(`Invalid ${definition.familyId} Grammar conformance: missing=[${missing.join(", ")}], unknown=[${unknown.join(", ")}]`);
26
+ }
27
+ return Object.freeze({
28
+ familyId: definition.familyId,
29
+ inheritedCommonRules: Object.freeze([...definition.inheritedCommonRules]),
30
+ familyEvidence: Object.freeze({ ...definition.familyEvidence }),
31
+ });
32
+ };
33
+ //# sourceMappingURL=conformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/common/conformance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEpF;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAE7B,kFAAkF;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AAQpD,wFAAwF;AACxF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,UAAkC,EAAE,EAAE;IAC/E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAC1D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAA;IAChE,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IAChG,MAAM,OAAO,GAAG,CAAC,GAAG,SAAS,EAAE,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IAChG,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,SAAS,CAAC,WAAW,UAAU,CAAC,QAAQ,kCAAkC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/I,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACzE,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;KAClE,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -1,74 +1,6 @@
1
- /** Render-neutral states accepted by Grammar contracts. Product Blocks own every domain mapping. */
2
- export declare const PRESENTATION_STATES: readonly ["neutral", "informative", "affirmative", "cautionary", "negative", "pending", "unavailable"];
3
- export type PresentationState = (typeof PRESENTATION_STATES)[number];
4
- export declare const isPresentationState: (value: unknown) => value is PresentationState;
5
- export declare const assertPresentationState: (value: unknown) => asserts value is PresentationState;
6
- /** Package-owned component tiers. The spelling matches the public export topology. */
7
- export type GrammarLayer = "leaves" | "branch" | "composites";
8
- /** Contract boundaries that an extension can never reopen. */
9
- export type ClosedContractChange = "anatomy" | "closed-invariant" | "owner-substitution";
10
- /** The only dimensions on which a derived Grammar may supply values. */
11
- export type GrammarExtensionPolicy<Axis extends string = string> = Readonly<{
12
- allowedAxes: ReadonlyArray<Axis>;
13
- forbiddenChanges: ReadonlyArray<ClosedContractChange>;
14
- }>;
15
- /** Business-neutral reusable owner contract. Additional package metadata must remain data-only. */
16
- export type GrammarContractSpec<Axis extends string = string> = Readonly<{
17
- version: string;
18
- layer: GrammarLayer;
19
- slots: ReadonlyArray<string>;
20
- stateInputs: ReadonlyArray<string>;
21
- variableAxes: ReadonlyArray<Axis>;
22
- extensionPolicy: GrammarExtensionPolicy<Axis>;
23
- closedInvariants: ReadonlyArray<string>;
24
- }>;
25
- /** One declared derivation. Every value key must have a matching requested axis. */
26
- export type GrammarContractExtension<Axis extends string = string> = Readonly<{
27
- id: string;
28
- version: string;
29
- base: Readonly<{
30
- key: string;
31
- version: string;
32
- }>;
33
- axes: ReadonlyArray<Axis>;
34
- values: Readonly<Record<Axis, unknown>>;
35
- }>;
36
- /** Immutable provenance for a contract derived from another contract. */
37
- export type GrammarContractBase = Readonly<{
38
- key: string;
39
- version: string;
40
- rootKey: string;
41
- rootVersion: string;
42
- }>;
43
- /** A closed, runtime-validated contract value. */
44
- export type GrammarContract<Key extends string = string, Spec extends GrammarContractSpec = GrammarContractSpec> = Readonly<{
45
- key: Key;
46
- version: string;
47
- spec: Readonly<Spec>;
48
- base: GrammarContractBase | null;
49
- resolvedAxes: Readonly<Record<string, unknown>>;
50
- }>;
51
- /** Stable refusal identities for callers and tests. */
52
- export type GrammarContractErrorCode = "invalid-key" | "invalid-version" | "invalid-spec" | "duplicate-entry" | "allowed-axis-not-variable" | "duplicate-contract-key" | "missing-base-contract" | "same-extension-key" | "extension-id-mismatch" | "extension-base-mismatch" | "axis-not-allowed" | "axis-already-resolved" | "missing-axis-value" | "undeclared-axis-value" | "cyclic-value" | "unsupported-value";
53
- /** Fail-closed error emitted by every runtime guard in this module. */
54
- export declare class GrammarContractError extends Error {
55
- readonly code: GrammarContractErrorCode;
56
- constructor(code: GrammarContractErrorCode, message: string);
57
- }
58
- /** Define one immutable base contract after validating its closed boundaries. */
59
- export declare const defineGrammarContract: <const Key extends string, const Spec extends GrammarContractSpec>(key: Key, spec: Spec) => GrammarContract<Key, Spec>;
60
- /** Derive a contract by resolving declared axes without changing its base anatomy or invariants. */
61
- export declare const extendGrammarContract: <const Key extends string, Spec extends GrammarContractSpec, Axis extends string>(key: Key, base: GrammarContract<string, Spec>, extension: GrammarContractExtension<Axis>) => GrammarContract<Key, Spec>;
62
- /** Typed in-memory registry used by each Grammar bundle while it assembles its public contracts. */
63
- export type GrammarContractRegistry<Spec extends GrammarContractSpec> = Readonly<{
64
- define: <const Key extends string, const Input extends Spec>(key: Key, spec: Input) => GrammarContract<Key, Input>;
65
- extend: <const Key extends string, Axis extends string>(key: Key, baseKey: string, extension: GrammarContractExtension<Axis>) => GrammarContract<Key, Spec>;
66
- register: <const Key extends string, const Input extends Spec>(contract: GrammarContract<Key, Input>) => GrammarContract<Key, Input>;
67
- get: (key: string) => GrammarContract<string, Spec> | undefined;
68
- require: (key: string) => GrammarContract<string, Spec>;
69
- has: (key: string) => boolean;
70
- entries: () => ReadonlyArray<GrammarContract<string, Spec>>;
71
- }>;
72
- /** Create an isolated fail-closed registry. Duplicate keys never replace an earlier contract. */
73
- export declare const createContractRegistry: <Spec extends GrammarContractSpec>() => GrammarContractRegistry<Spec>;
1
+ export { PRESENTATION_STATES, assertPresentationState, isPresentationState, type PresentationState } from "./state.js";
2
+ export { COMMON_SPACING_SCALE, COMMON_SPACING_TOKENS, type CommonSpacingStep, type CommonSpacingValue } from "./spacing.js";
3
+ export { COMMON_UI_RULE_IDS, defineGrammarRuleConformance, type GrammarRuleConformance } from "./conformance.js";
4
+ export * from "./renderers.js";
5
+ export { COMMON_GRAMMAR_COMPONENTS, defineGrammarFamily, type CommonGrammarComponentName, type GrammarComponentRenderer, type GrammarFamilyContract, type GrammarFamilyStyles, } from "./registry.js";
74
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,wGAQtB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAIpE,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,iBAE7D,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,CAAC,KAAK,EAAE,O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IAC7B,OAAO,EAAE,MAAM,aAAa,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;CAC9D,CAAC,CAAA;AAEF,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,GAAI,IAAI,SAAS,mBAAmB,OAAK,uBAAuB,CAAC,IAAI,CAkCvG,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACtH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC3H,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAChH,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EACH,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GAC3B,MAAM,eAAe,CAAA"}
@@ -1,203 +1,6 @@
1
- /** Render-neutral states accepted by Grammar contracts. Product Blocks own every domain mapping. */
2
- export const PRESENTATION_STATES = [
3
- "neutral",
4
- "informative",
5
- "affirmative",
6
- "cautionary",
7
- "negative",
8
- "pending",
9
- "unavailable",
10
- ];
11
- const presentationStateSet = new Set(PRESENTATION_STATES);
12
- export const isPresentationState = (value) => (typeof value === "string" && presentationStateSet.has(value));
13
- export const assertPresentationState = (value) => {
14
- if (!isPresentationState(value))
15
- throw new TypeError(`Unknown neutral presentation state: ${JSON.stringify(value)}`);
16
- };
17
- /** Fail-closed error emitted by every runtime guard in this module. */
18
- export class GrammarContractError extends Error {
19
- code;
20
- constructor(code, message) {
21
- super(message);
22
- this.name = "GrammarContractError";
23
- this.code = code;
24
- }
25
- }
26
- const stableKeyPattern = /^[a-z0-9]+(?:[./-][a-z0-9]+)*$/;
27
- const exactVersionPattern = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?$/;
28
- const requiredForbiddenChanges = [
29
- "anatomy",
30
- "closed-invariant",
31
- "owner-substitution",
32
- ];
33
- const fail = (code, message) => {
34
- throw new GrammarContractError(code, message);
35
- };
36
- const validateStableKey = (value, label) => {
37
- if (!stableKeyPattern.test(value))
38
- fail("invalid-key", `${label} must be a stable lowercase key: ${value}`);
39
- };
40
- const validateExactVersion = (value, label) => {
41
- if (!exactVersionPattern.test(value)) {
42
- fail("invalid-version", `${label} must be one exact semantic version: ${value}`);
43
- }
44
- };
45
- const validateStringSet = (values, label) => {
46
- if (!Array.isArray(values))
47
- fail("invalid-spec", `${label} must be an array`);
48
- const seen = new Set();
49
- for (const value of values) {
50
- if (typeof value !== "string" || value.length === 0 || value.trim() !== value) {
51
- fail("invalid-spec", `${label} contains an empty or untrimmed value`);
52
- }
53
- validateStableKey(value, label);
54
- if (seen.has(value))
55
- fail("duplicate-entry", `${label} contains duplicate value: ${value}`);
56
- seen.add(value);
57
- }
58
- };
59
- const cloneClosed = (value, path, ancestors) => {
60
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean")
61
- return value;
62
- if (Array.isArray(value)) {
63
- if (ancestors.has(value))
64
- fail("cyclic-value", `${path} contains a cycle`);
65
- ancestors.add(value);
66
- const copy = value.map((item, index) => cloneClosed(item, `${path}[${index}]`, ancestors));
67
- ancestors.delete(value);
68
- return Object.freeze(copy);
69
- }
70
- if (typeof value === "object") {
71
- if (ancestors.has(value))
72
- fail("cyclic-value", `${path} contains a cycle`);
73
- const prototype = Object.getPrototypeOf(value);
74
- if (prototype !== Object.prototype && prototype !== null) {
75
- fail("unsupported-value", `${path} must contain only plain data`);
76
- }
77
- ancestors.add(value);
78
- const copy = {};
79
- for (const [key, child] of Object.entries(value))
80
- copy[key] = cloneClosed(child, `${path}.${key}`, ancestors);
81
- ancestors.delete(value);
82
- return Object.freeze(copy);
83
- }
84
- return fail("unsupported-value", `${path} contains unsupported ${typeof value}`);
85
- };
86
- const closedCopy = (value, path) => cloneClosed(value, path, new WeakSet());
87
- const validateSpec = (spec) => {
88
- if (spec === null || typeof spec !== "object")
89
- fail("invalid-spec", "contract spec must be an object");
90
- validateExactVersion(spec.version, "contract version");
91
- if (!["leaves", "branch", "composites"].includes(spec.layer)) {
92
- fail("invalid-spec", `unsupported Grammar layer: ${String(spec.layer)}`);
93
- }
94
- validateStringSet(spec.slots, "slots");
95
- validateStringSet(spec.stateInputs, "stateInputs");
96
- validateStringSet(spec.variableAxes, "variableAxes");
97
- if (spec.extensionPolicy === null || typeof spec.extensionPolicy !== "object") {
98
- fail("invalid-spec", "extensionPolicy must be an object");
99
- }
100
- validateStringSet(spec.extensionPolicy.allowedAxes, "extensionPolicy.allowedAxes");
101
- validateStringSet(spec.extensionPolicy.forbiddenChanges, "extensionPolicy.forbiddenChanges");
102
- validateStringSet(spec.closedInvariants, "closedInvariants");
103
- const variableAxes = new Set(spec.variableAxes);
104
- for (const axis of spec.extensionPolicy.allowedAxes) {
105
- if (!variableAxes.has(axis)) {
106
- fail("allowed-axis-not-variable", `allowed extension axis is not a variable axis: ${axis}`);
107
- }
108
- }
109
- for (const change of requiredForbiddenChanges) {
110
- if (!spec.extensionPolicy.forbiddenChanges.includes(change)) {
111
- fail("invalid-spec", `extensionPolicy.forbiddenChanges must include ${change}`);
112
- }
113
- }
114
- };
115
- /** Define one immutable base contract after validating its closed boundaries. */
116
- export const defineGrammarContract = (key, spec) => {
117
- validateStableKey(key, "contract key");
118
- validateSpec(spec);
119
- return Object.freeze({
120
- key,
121
- version: spec.version,
122
- spec: closedCopy(spec, `contract ${key}`),
123
- base: null,
124
- resolvedAxes: Object.freeze({}),
125
- });
126
- };
127
- /** Derive a contract by resolving declared axes without changing its base anatomy or invariants. */
128
- export const extendGrammarContract = (key, base, extension) => {
129
- validateStableKey(key, "extension key");
130
- validateStableKey(extension.id, "extension id");
131
- validateExactVersion(extension.version, "extension version");
132
- validateStableKey(extension.base.key, "extension base key");
133
- validateExactVersion(extension.base.version, "extension base version");
134
- if (key === base.key)
135
- fail("same-extension-key", `extension key must differ from base key: ${key}`);
136
- if (extension.id !== key) {
137
- fail("extension-id-mismatch", `extension id ${extension.id} does not match registered key ${key}`);
138
- }
139
- if (extension.base.key !== base.key || extension.base.version !== base.version) {
140
- fail("extension-base-mismatch", `extension base ${extension.base.key}@${extension.base.version} does not match ${base.key}@${base.version}`);
141
- }
142
- validateStringSet(extension.axes, "extension.axes");
143
- if (extension.values === null || typeof extension.values !== "object" || Array.isArray(extension.values)) {
144
- fail("invalid-spec", "extension.values must be an object");
145
- }
146
- const requested = new Set(extension.axes);
147
- const allowed = new Set(base.spec.extensionPolicy.allowedAxes);
148
- for (const axis of extension.axes) {
149
- if (!allowed.has(axis))
150
- fail("axis-not-allowed", `extension axis is closed: ${axis}`);
151
- if (Object.hasOwn(base.resolvedAxes, axis)) {
152
- fail("axis-already-resolved", `extension axis is already resolved: ${axis}`);
153
- }
154
- if (!Object.hasOwn(extension.values, axis))
155
- fail("missing-axis-value", `extension axis has no value: ${axis}`);
156
- }
157
- for (const axis of Object.keys(extension.values)) {
158
- if (!requested.has(axis))
159
- fail("undeclared-axis-value", `extension value has no declared axis: ${axis}`);
160
- }
161
- const values = closedCopy(extension.values, `extension ${key}`);
162
- const baseRef = Object.freeze({
163
- key: base.key,
164
- version: base.version,
165
- rootKey: base.base?.rootKey ?? base.key,
166
- rootVersion: base.base?.rootVersion ?? base.version,
167
- });
168
- return Object.freeze({
169
- key,
170
- version: extension.version,
171
- spec: base.spec,
172
- base: baseRef,
173
- resolvedAxes: Object.freeze({ ...base.resolvedAxes, ...values }),
174
- });
175
- };
176
- /** Create an isolated fail-closed registry. Duplicate keys never replace an earlier contract. */
177
- export const createContractRegistry = () => {
178
- const contracts = new Map();
179
- const register = (contract) => {
180
- if (contracts.has(contract.key)) {
181
- fail("duplicate-contract-key", `contract key is already registered: ${contract.key}`);
182
- }
183
- contracts.set(contract.key, contract);
184
- return contract;
185
- };
186
- const requireContract = (key) => {
187
- const contract = contracts.get(key);
188
- if (contract === undefined) {
189
- return fail("missing-base-contract", `contract key is not registered: ${key}`);
190
- }
191
- return contract;
192
- };
193
- return Object.freeze({
194
- define: (key, spec) => (register(defineGrammarContract(key, spec))),
195
- extend: (key, baseKey, extension) => register(extendGrammarContract(key, requireContract(baseKey), extension)),
196
- register,
197
- get: (key) => contracts.get(key),
198
- require: requireContract,
199
- has: (key) => contracts.has(key),
200
- entries: () => Object.freeze(Array.from(contracts.values())),
201
- });
202
- };
1
+ export { PRESENTATION_STATES, assertPresentationState, isPresentationState } from "./state.js";
2
+ export { COMMON_SPACING_SCALE, COMMON_SPACING_TOKENS } from "./spacing.js";
3
+ export { COMMON_UI_RULE_IDS, defineGrammarRuleConformance } from "./conformance.js";
4
+ export * from "./renderers.js";
5
+ export { COMMON_GRAMMAR_COMPONENTS, defineGrammarFamily, } from "./registry.js";
203
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,SAAS;IACT,aAAa;IACb,aAAa;IACb,YAAY;IACZ,UAAU;IACV,SAAS;IACT,aAAa;CACP,CAAA;AAIV,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAA8B,EAAE,CAAC,CAC/E,OAAO,KAAK,KAAK,QAAQ,IAAI,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAC/D,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAA2D,CAAC,KAAK,EAAE,EAAE;IAC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AAC,MAAM,EAAE,CAAC,CAAC;KAC/D,CAAC,CAAA;AACN,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,mBAAmB,EAA0B,MAAM,YAAY,CAAA;AACtH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAmD,MAAM,cAAc,CAAA;AAC3H,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAA+B,MAAM,kBAAkB,CAAA;AAChH,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EACH,yBAAyB,EACzB,mBAAmB,GAKtB,MAAM,eAAe,CAAA"}
@@ -0,0 +1,79 @@
1
+ import type { ComponentProps, ComponentType, ElementType } from "react";
2
+ export type GrammarComponentRenderer<Props> = ComponentType<Props>;
3
+ type GrammarRendererRegistry = Readonly<Record<string, ElementType>>;
4
+ type CompatibleReplacements<Common extends GrammarRendererRegistry> = {
5
+ readonly [Name in keyof Common]?: GrammarComponentRenderer<ComponentProps<Common[Name]>>;
6
+ };
7
+ type ExtensionWithoutCommonCollisions<Common extends GrammarRendererRegistry, Extensions extends GrammarRendererRegistry> = Extensions & {
8
+ readonly [Name in Extract<keyof Extensions, keyof Common>]: never;
9
+ };
10
+ export declare const COMMON_GRAMMAR_COMPONENTS: Readonly<{
11
+ readonly Badge: ({ children, startContent, tone, isSkeleton }: import("./renderers.js").BadgeProps) => import("react").JSX.Element;
12
+ readonly Button: (props: import("./renderers.js").ButtonProps) => import("react").JSX.Element;
13
+ readonly ChatWorkspace: (props: import("./renderers.js").ChatWorkspaceProps) => import("react").JSX.Element;
14
+ readonly Divider: ({ label }: import("./renderers.js").DividerProps) => import("react").JSX.Element;
15
+ readonly EmptyNotice: ({ message, description, iconSource, actionLabel, actionStartContent, actionVariant, isActionPending, onAction, }: import("./renderers.js").EmptyNoticeProps) => import("react").JSX.Element;
16
+ readonly FencedCodeBlock: (props: import("./renderers.js").FencedCodeBlockProps) => import("react").JSX.Element;
17
+ readonly GrammarRoot: ({ className, theme, ...props }: import("./renderers.js").GrammarRootProps) => import("react").JSX.Element;
18
+ readonly Heading: ({ children, level, scale, isSkeleton, isVisuallyHidden, }: import("./renderers.js").HeadingProps) => import("react").JSX.Element;
19
+ readonly HorizontalScrollRegion: import("react").ForwardRefExoticComponent<Omit<import("./renderers.js").HorizontalScrollRegionProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
20
+ readonly Icon: ({ source: Source, usage, ariaLabel, isSkeleton }: import("./renderers.js").IconProps) => import("react").JSX.Element;
21
+ readonly IconButton: ({ source, label, isActive, isDisabled, isSkeleton, onPress, }: import("./renderers.js").IconButtonProps) => import("react").JSX.Element;
22
+ readonly IconTile: ({ source, artwork, ariaLabel, tone, size, isSkeleton, }: import("./renderers.js").IconTileProps) => import("react").JSX.Element;
23
+ readonly IncludedMark: ({ className, label, ...props }: import("./renderers.js").IncludedMarkProps) => import("react").JSX.Element;
24
+ readonly Input: ({ id, name, label, kind: kindName, variant, placeholder, defaultValue, value, hint, errorMessage, isError, isDisabled, isRequired, isSkeleton, revealLabel, hideLabel, revealIcon: RevealIcon, hideIcon: HideIcon, onValueChange, }: import("./renderers.js").InputProps) => import("react").JSX.Element;
25
+ readonly Label: ({ id, children, depth, as }: import("./renderers.js").LabelProps) => import("react").JSX.Element;
26
+ readonly LeadingNumber: (props: import("./renderers.js").LeadingNumberProps) => import("react").JSX.Element;
27
+ readonly MarkdownArticle: (props: import("./renderers.js").MarkdownArticleProps) => import("react").JSX.Element;
28
+ readonly MarkdownTableFrame: (props: import("./renderers.js").MarkdownTableFrameProps) => import("react").JSX.Element;
29
+ readonly MediaFrame: ({ children, caption, aspect, fit, treatment, className, }: import("./renderers.js").MediaFrameProps) => import("react").JSX.Element;
30
+ readonly NavigationFeatureNav: ({ identity, navigation, navigationLabel, compactNavigationTrigger, compactNavigationTriggerLabel, actions, actionsLabel, featureNavigation, featureNavigationLabel, measure, position, className, ...headerProps }: import("./renderers.js").NavigationFeatureNavProps) => import("react").JSX.Element;
31
+ readonly OtpInput: (props: import("./renderers.js").OtpInputProps) => import("react").JSX.Element;
32
+ readonly PageContainer: ({ className, measure, ...props }: import("./renderers.js").PageContainerProps) => import("react").JSX.Element;
33
+ readonly PrimaryRailLayout: ({ primary, rail, railWidth, align, className, }: import("./renderers.js").PrimaryRailLayoutProps) => import("react").JSX.Element;
34
+ readonly Progress: ({ label, value, isSkeleton }: import("./renderers.js").ProgressProps) => import("react").JSX.Element;
35
+ readonly Rail: (props: import("./renderers.js").RailProps) => import("react").JSX.Element;
36
+ readonly RankArtwork: ({ className, kind, label, ...props }: import("./renderers.js").RankArtworkProps) => import("react").JSX.Element;
37
+ readonly SectionHeader: ({ title, description, eyebrow, action, level, className, id, composition, }: import("./renderers.js").SectionHeaderProps) => import("react").JSX.Element;
38
+ readonly Sidebar: ({ label, groups, selectedKey, presentation, isCollapsed, collapseLabel, expandLabel, toggleSource, header, footer, onAction, onCollapsedChange, }: import("./renderers.js").SidebarProps) => import("react").JSX.Element;
39
+ readonly StateMark: (props: import("./renderers.js").StateMarkProps) => import("react").JSX.Element | null;
40
+ readonly StaticStateRow: (props: import("./renderers.js").StaticStateRowProps) => import("react").JSX.Element;
41
+ readonly Subnav: ({ label, title, leading, menuIcon, openMenuLabel, closeMenuLabel, isMenuOpen, onMenuOpenChange, position, visibility, className, ...navProps }: import("./renderers.js").SubnavProps) => import("react").JSX.Element;
42
+ readonly SurfaceAccordionCard: <Summary, Body>(props: import("./renderers.js").SurfaceAccordionCardProps<Summary, Body>) => import("react").JSX.Element;
43
+ readonly SurfaceCard: (props: import("./renderers.js").SurfaceCardProps) => import("react").JSX.Element;
44
+ readonly SurfaceCopyGroup: ({ className, density, ...props }: import("./renderers.js").SurfaceCopyGroupProps) => import("react").JSX.Element;
45
+ readonly SurfaceListCard: (props: import("./renderers.js").SurfaceListCardProps) => import("react").JSX.Element;
46
+ readonly Tabs: (props: import("./renderers.js").TabsProps) => import("react").JSX.Element;
47
+ readonly Text: ({ as: Element, id, children, startContent, size, tone, weight, live, isSkeleton, isSuperseded, parentEmphasis, }: import("./renderers.js").TextProps) => import("react").JSX.Element;
48
+ readonly TextAction: (props: import("./renderers.js").TextActionProps) => import("react").JSX.Element;
49
+ readonly Tooltip: ({ content, children, placement, }: import("./renderers.js").TooltipProps) => import("react").JSX.Element;
50
+ readonly VerticalScrollRegion: (props: import("./renderers.js").VerticalScrollRegionProps) => import("react").JSX.Element;
51
+ readonly WorkspaceShell: (props: import("./renderers.js").WorkspaceShellProps) => import("react").JSX.Element;
52
+ }>;
53
+ export type CommonGrammarComponentName = keyof typeof COMMON_GRAMMAR_COMPONENTS;
54
+ export type GrammarFamilyStyles<FamilyId extends string> = {
55
+ readonly entrypoint: `@starci/grammar/${string}/styles.css`;
56
+ readonly scope: {
57
+ readonly attribute: "data-grammar-family";
58
+ readonly value: FamilyId;
59
+ };
60
+ };
61
+ export type GrammarFamilyContract<FamilyId extends string, Extensions extends GrammarRendererRegistry> = {
62
+ readonly id: FamilyId;
63
+ readonly styles: GrammarFamilyStyles<FamilyId>;
64
+ readonly components: Readonly<typeof COMMON_GRAMMAR_COMPONENTS & Extensions>;
65
+ readonly scopeProps: Readonly<{
66
+ "data-grammar-family": FamilyId;
67
+ }>;
68
+ };
69
+ /** Define one visual family over the stable Common semantic contract. */
70
+ export declare const defineGrammarFamily: <const FamilyId extends string, const Replacements extends CompatibleReplacements<typeof COMMON_GRAMMAR_COMPONENTS>, const Extensions extends GrammarRendererRegistry>(definition: {
71
+ readonly id: FamilyId;
72
+ readonly styles: GrammarFamilyStyles<FamilyId>;
73
+ readonly components: {
74
+ readonly replacements: Replacements;
75
+ readonly extensions: ExtensionWithoutCommonCollisions<typeof COMMON_GRAMMAR_COMPONENTS, Extensions>;
76
+ };
77
+ }) => GrammarFamilyContract<FamilyId, Extensions>;
78
+ export {};
79
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +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