@repobit/dex-system-design 3.0.3 → 3.1.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 (150) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +35 -0
  3. package/dist/src/components/agent-endpoints/agent-endpoints.d.ts +1 -0
  4. package/dist/src/components/agent-endpoints/agent-endpoints.js +12 -12
  5. package/dist/src/components/agent-endpoints/agent-endpoints.js.map +1 -1
  6. package/dist/src/components/anchor/anchor-nav.d.ts +2 -1
  7. package/dist/src/components/anchor/anchor-nav.js +10 -10
  8. package/dist/src/components/anchor/anchor-nav.js.map +1 -1
  9. package/dist/src/components/audience-card/audience-card.css.js +1 -1
  10. package/dist/src/components/audience-card/audience-card.css.js.map +1 -1
  11. package/dist/src/components/audience-card/audience-card.d.ts +1 -0
  12. package/dist/src/components/audience-card/audience-card.js +8 -8
  13. package/dist/src/components/audience-card/audience-card.js.map +1 -1
  14. package/dist/src/components/awards/awards-flex.d.ts +3 -2
  15. package/dist/src/components/awards/awards-flex.js +16 -16
  16. package/dist/src/components/awards/awards-flex.js.map +1 -1
  17. package/dist/src/components/awards/awards-spotlight.d.ts +2 -1
  18. package/dist/src/components/awards/awards-spotlight.js +8 -8
  19. package/dist/src/components/awards/awards-spotlight.js.map +1 -1
  20. package/dist/src/components/awards/awards.d.ts +1 -1
  21. package/dist/src/components/bento-grid/bento-grid.d.ts +1 -0
  22. package/dist/src/components/bento-grid/bento-grid.js +10 -10
  23. package/dist/src/components/bento-grid/bento-grid.js.map +1 -1
  24. package/dist/src/components/bento-grid/bento-item.css.js +1 -1
  25. package/dist/src/components/bento-grid/bento-item.css.js.map +1 -1
  26. package/dist/src/components/bento-grid/bento-item.d.ts +1 -0
  27. package/dist/src/components/bento-grid/bento-item.js +9 -9
  28. package/dist/src/components/bento-grid/bento-item.js.map +1 -1
  29. package/dist/src/components/button/button.d.ts +1 -1
  30. package/dist/src/components/cards/card.d.ts +2 -2
  31. package/dist/src/components/cards/card.js +11 -11
  32. package/dist/src/components/cards/card.js.map +1 -1
  33. package/dist/src/components/carousel/carousel.d.ts +2 -2
  34. package/dist/src/components/carousel/carousel.js +6 -6
  35. package/dist/src/components/carousel/carousel.js.map +1 -1
  36. package/dist/src/components/comparison-panel/comparison-panel.d.ts +1 -0
  37. package/dist/src/components/comparison-panel/comparison-panel.js +12 -12
  38. package/dist/src/components/comparison-panel/comparison-panel.js.map +1 -1
  39. package/dist/src/components/compatibility-table/compatibility-table.d.ts +1 -0
  40. package/dist/src/components/compatibility-table/compatibility-table.js +14 -14
  41. package/dist/src/components/compatibility-table/compatibility-table.js.map +1 -1
  42. package/dist/src/components/cta-banner/cta-banner.d.ts +1 -0
  43. package/dist/src/components/cta-banner/cta-banner.js +8 -8
  44. package/dist/src/components/cta-banner/cta-banner.js.map +1 -1
  45. package/dist/src/components/grid/grid.css.js +1 -1
  46. package/dist/src/components/grid/grid.css.js.map +1 -1
  47. package/dist/src/components/grid/grid.d.ts +1 -0
  48. package/dist/src/components/grid/grid.js +4 -3
  49. package/dist/src/components/grid/grid.js.map +1 -1
  50. package/dist/src/components/header/header-code.d.ts +3 -2
  51. package/dist/src/components/header/header-code.js +13 -13
  52. package/dist/src/components/header/header-code.js.map +1 -1
  53. package/dist/src/components/heading/heading.d.ts +1 -1
  54. package/dist/src/components/heading/heading.js +5 -1
  55. package/dist/src/components/heading/heading.js.map +1 -1
  56. package/dist/src/components/hero/hero.d.ts +2 -1
  57. package/dist/src/components/hero/hero.js +9 -9
  58. package/dist/src/components/hero/hero.js.map +1 -1
  59. package/dist/src/components/install-options/install-options.d.ts +3 -2
  60. package/dist/src/components/install-options/install-options.js +17 -17
  61. package/dist/src/components/install-options/install-options.js.map +1 -1
  62. package/dist/src/components/link/link.d.ts +1 -1
  63. package/dist/src/components/list/list-item/list-item.d.ts +1 -1
  64. package/dist/src/components/logo-marquee/logo-marquee.d.ts +1 -0
  65. package/dist/src/components/logo-marquee/logo-marquee.js +5 -5
  66. package/dist/src/components/logo-marquee/logo-marquee.js.map +1 -1
  67. package/dist/src/components/motion-art/motion-art.js +1 -1
  68. package/dist/src/components/motion-art/motion-art.js.map +1 -1
  69. package/dist/src/components/overview/overview.d.ts +1 -0
  70. package/dist/src/components/overview/overview.js +7 -7
  71. package/dist/src/components/overview/overview.js.map +1 -1
  72. package/dist/src/components/page-switcher/page-switcher.d.ts +1 -0
  73. package/dist/src/components/page-switcher/page-switcher.js +5 -5
  74. package/dist/src/components/page-switcher/page-switcher.js.map +1 -1
  75. package/dist/src/components/pagination-dots/pagination-dots.d.ts +1 -1
  76. package/dist/src/components/partner-banner/partner-banner.d.ts +1 -0
  77. package/dist/src/components/partner-banner/partner-banner.js +7 -7
  78. package/dist/src/components/partner-banner/partner-banner.js.map +1 -1
  79. package/dist/src/components/post-card/post-card.d.ts +1 -0
  80. package/dist/src/components/post-card/post-card.js +5 -5
  81. package/dist/src/components/post-card/post-card.js.map +1 -1
  82. package/dist/src/components/process-steps/process-steps.d.ts +1 -0
  83. package/dist/src/components/process-steps/process-steps.js +7 -7
  84. package/dist/src/components/process-steps/process-steps.js.map +1 -1
  85. package/dist/src/components/quick-answer/quick-answer.d.ts +1 -0
  86. package/dist/src/components/quick-answer/quick-answer.js +7 -7
  87. package/dist/src/components/quick-answer/quick-answer.js.map +1 -1
  88. package/dist/src/components/review/review-grid.d.ts +1 -0
  89. package/dist/src/components/review/review-grid.js +3 -3
  90. package/dist/src/components/review/review-grid.js.map +1 -1
  91. package/dist/src/components/review/review.d.ts +1 -0
  92. package/dist/src/components/review/review.js +2 -2
  93. package/dist/src/components/review/review.js.map +1 -1
  94. package/dist/src/components/section-header/section-header.d.ts +1 -0
  95. package/dist/src/components/section-header/section-header.js +4 -4
  96. package/dist/src/components/section-header/section-header.js.map +1 -1
  97. package/dist/src/components/shared/controller.observer.d.ts +50 -0
  98. package/dist/src/components/shared/controller.observer.js +2 -0
  99. package/dist/src/components/shared/controller.observer.js.map +1 -0
  100. package/dist/src/components/spotlight-section/spotlight-section.d.ts +1 -0
  101. package/dist/src/components/spotlight-section/spotlight-section.js +7 -7
  102. package/dist/src/components/spotlight-section/spotlight-section.js.map +1 -1
  103. package/dist/src/components/stat/stat-highlight.d.ts +5 -5
  104. package/dist/src/components/stat/stat-highlight.js +2 -2
  105. package/dist/src/components/stat/stat-highlight.js.map +1 -1
  106. package/dist/src/components/stat/stat-tile.d.ts +1 -0
  107. package/dist/src/components/stat/stat-tile.js +5 -5
  108. package/dist/src/components/stat/stat-tile.js.map +1 -1
  109. package/dist/src/components/terminal/terminal-cursor.d.ts +1 -0
  110. package/dist/src/components/terminal/terminal-cursor.js +1 -1
  111. package/dist/src/components/terminal/terminal-cursor.js.map +1 -1
  112. package/dist/src/components/terminal/terminal-message.d.ts +4 -3
  113. package/dist/src/components/terminal/terminal-message.js +25 -25
  114. package/dist/src/components/terminal/terminal-message.js.map +1 -1
  115. package/dist/src/components/tooltip/tooltip.js +1 -1
  116. package/dist/src/components/tooltip/tooltip.js.map +1 -1
  117. package/dist/src/components/trust-panel/trust-panel.d.ts +1 -0
  118. package/dist/src/components/trust-panel/trust-panel.js +19 -19
  119. package/dist/src/components/trust-panel/trust-panel.js.map +1 -1
  120. package/dist/src/loader/create-loader.d.ts +13 -0
  121. package/dist/src/loader/create-loader.js +2 -0
  122. package/dist/src/loader/create-loader.js.map +1 -0
  123. package/dist/src/loader/loader.d.ts +44 -0
  124. package/dist/src/loader/loader.js +2 -0
  125. package/dist/src/loader/loader.js.map +1 -0
  126. package/dist/src/loader/registry.d.ts +2 -0
  127. package/dist/src/loader/registry.js +2 -0
  128. package/dist/src/loader/registry.js.map +1 -0
  129. package/dist/src/tokens/tokens.js +1 -1
  130. package/dist/src/tokens/tokens.js.map +1 -1
  131. package/package.json +12 -4
  132. package/schemas/component-manifest.json +8 -1
  133. package/dist/src/tokens/dark-derivation.d.ts +0 -70
  134. package/dist/src/tokens/dark-derivation.js +0 -2
  135. package/dist/src/tokens/dark-derivation.js.map +0 -1
  136. package/dist/src/tokens/dark-findings.d.ts +0 -59
  137. package/dist/src/tokens/dark-findings.js +0 -2
  138. package/dist/src/tokens/dark-findings.js.map +0 -1
  139. package/dist/src/tokens/story-chrome.d.ts +0 -72
  140. package/dist/src/tokens/story-chrome.js +0 -292
  141. package/dist/src/tokens/story-chrome.js.map +0 -1
  142. package/dist/src/tokens/token-map.d.ts +0 -114
  143. package/dist/src/tokens/token-map.js +0 -2
  144. package/dist/src/tokens/token-map.js.map +0 -1
  145. package/dist/src/tokens/token-purposes.d.ts +0 -63
  146. package/dist/src/tokens/token-purposes.js +0 -2
  147. package/dist/src/tokens/token-purposes.js.map +0 -1
  148. package/dist/src/tokens/type-ceiling-words.d.ts +0 -96
  149. package/dist/src/tokens/type-ceiling-words.js +0 -2
  150. package/dist/src/tokens/type-ceiling-words.js.map +0 -1
@@ -1,292 +0,0 @@
1
- import{html as e}from"lit";function t(){let e=``;for(let t of Array.from(document.styleSheets)){let n;try{n=t.cssRules}catch{continue}for(let t of Array.from(n))e+=`${t.cssText}\n`}return e}function n(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function r(e,t){let n=/* @__PURE__ */ new Set,r=[];for(let i of e.matchAll(t)){let e=i[1];n.has(e)||(n.add(e),r.push(i))}return r}function i(e){let t=/* @__PURE__ */ new Map;for(let[,n,r]of e.matchAll(/(--[A-Za-z0-9-]+)\s*:\s*var\(\s*(--[A-Za-z0-9-]+)\s*\)/g))t.has(r)||t.set(r,/* @__PURE__ */ new Set),t.get(r).add(n);return t}var a=`#151719`,o=`#ffffff`;function s(e){let t=document.createElement(`span`);t.style.cssText=`position:absolute;visibility:hidden`,t.style.color=e,document.body.appendChild(t);let n=getComputedStyle(t).color;t.remove();let r=n.match(/-?[\d.]+/g);return r?r.slice(0,3).map(Number):[0,0,0]}function c([e,t,n]){let[r,i,a]=[e,t,n].map(e=>e/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*r+.7152*i+.0722*a}function l(e,t){let[n,r]=[c(s(e)),c(s(t))].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function u(e){return`#${s(e).map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`}function d(e){return e>=7?{label:`AAA`,pass:!0}:e>=4.5?{label:`AA`,pass:!0}:e>=3?{label:`18pt`,pass:!0}:{label:`fail`,pass:!1}}function f(t){let{label:n,pass:r}=d(t);return e`<span class="level" data-pass=${r}>${n}</span>`}var p=e`
2
- <style>
3
- /* The Storybook canvas is transparent, so it inherits the OS colour
4
- scheme. Paint an explicit surface: there are no dark-mode tokens yet. */
5
- .docs {
6
- font-family: var(--typography-fontFamily-sans);
7
- color: var(--color-neutral-900);
8
- background: var(--color-neutral-0);
9
- padding: var(--spacing-24);
10
- box-sizing: border-box;
11
- }
12
-
13
- .docs-inner {
14
- max-width: 1180px;
15
- }
16
-
17
- .docs h1 {
18
- font-size: var(--typography-fontSize-2xl);
19
- font-weight: var(--typography-fontWeight-semibold);
20
- margin: 0 0 var(--spacing-8);
21
- }
22
-
23
- .docs-lede {
24
- font-size: var(--typography-fontSize-sm);
25
- line-height: var(--typography-lineHeight-normal);
26
- color: var(--color-neutral-600);
27
- margin: 0 0 var(--spacing-16);
28
- max-width: 68ch;
29
- }
30
-
31
- .docs-note {
32
- font-size: var(--typography-fontSize-xs);
33
- line-height: var(--typography-lineHeight-normal);
34
- color: var(--color-neutral-700);
35
- background: var(--color-neutral-50);
36
- border-radius: var(--radius-md);
37
- padding: var(--spacing-12) var(--spacing-16);
38
- margin-bottom: var(--spacing-32);
39
- }
40
-
41
- .docs-note b {
42
- font-weight: var(--typography-fontWeight-semibold);
43
- color: var(--color-neutral-900);
44
- }
45
-
46
- .docs-note code,
47
- .docs-lede code {
48
- font-family: var(--typography-fontFamily-mono);
49
- font-size: var(--typography-code-inline-fontSize);
50
- }
51
-
52
- /* --- sections --- */
53
- .section {
54
- margin-bottom: var(--spacing-40);
55
- }
56
-
57
- .section-head {
58
- display: flex;
59
- align-items: baseline;
60
- gap: var(--spacing-8);
61
- margin-bottom: var(--spacing-12);
62
- }
63
-
64
- .section-name {
65
- font-size: var(--typography-fontSize-lg);
66
- font-weight: var(--typography-fontWeight-semibold);
67
- margin: 0;
68
- }
69
-
70
- .section-meta {
71
- font-size: var(--typography-fontSize-xs);
72
- font-family: var(--typography-fontFamily-mono);
73
- color: var(--color-neutral-500);
74
- }
75
-
76
- /* --- reference tables --- */
77
- /* Wide content scrolls inside its own container, never the page. */
78
- .table-scroll {
79
- overflow-x: auto;
80
- }
81
-
82
- .docs table {
83
- border-collapse: collapse;
84
- width: 100%;
85
- font-size: var(--typography-fontSize-xs);
86
- }
87
-
88
- .docs caption {
89
- /* the visible heading is .section-head; this is for screen readers */
90
- position: absolute;
91
- width: 1px;
92
- height: 1px;
93
- overflow: hidden;
94
- clip-path: inset(50%);
95
- }
96
-
97
- .docs th {
98
- text-align: left;
99
- font-weight: var(--typography-fontWeight-semibold);
100
- color: var(--color-neutral-600);
101
- font-size: var(--typography-fontSize-xxs);
102
- text-transform: uppercase;
103
- letter-spacing: var(--typography-letterSpacing-wide);
104
- padding: 0 var(--spacing-12) var(--spacing-8);
105
- border-bottom: var(--border-width-1) solid var(--color-neutral-200);
106
- white-space: nowrap;
107
- }
108
-
109
- .docs td {
110
- padding: var(--spacing-8) var(--spacing-12);
111
- border-bottom: var(--border-width-1) solid var(--color-neutral-100);
112
- vertical-align: middle;
113
- }
114
-
115
- .docs tbody tr:last-child td {
116
- border-bottom: 0;
117
- }
118
-
119
- /* --- cell primitives --- */
120
- .mono {
121
- font-family: var(--typography-fontFamily-mono);
122
- white-space: nowrap;
123
- }
124
-
125
- .num {
126
- font-family: var(--typography-fontFamily-mono);
127
- font-variant-numeric: tabular-nums;
128
- white-space: nowrap;
129
- color: var(--color-neutral-700);
130
- }
131
-
132
- /* the rendered pixel value beside a rem one, so a step is recognisable
133
- without doing the arithmetic */
134
- .px-hint {
135
- margin-left: var(--spacing-8);
136
- color: var(--color-neutral-500);
137
- font-size: var(--typography-fontSize-xxs);
138
- }
139
-
140
- .muted {
141
- color: var(--color-neutral-500);
142
- }
143
-
144
- .unused {
145
- color: var(--color-neutral-400);
146
- }
147
-
148
- .token-copy {
149
- font-family: var(--typography-fontFamily-mono);
150
- font-size: var(--typography-fontSize-xs);
151
- color: var(--color-neutral-900);
152
- background: none;
153
- border: 0;
154
- padding: 0;
155
- cursor: copy;
156
- text-align: left;
157
- white-space: nowrap;
158
- }
159
-
160
- .token-copy:hover {
161
- color: var(--color-blue-600);
162
- text-decoration: underline;
163
- }
164
-
165
- .token-copy:focus-visible {
166
- outline: var(--focus-outline-traditional);
167
- outline-offset: var(--focus-outline-offset);
168
- border-radius: var(--radius-sm);
169
- }
170
-
171
- .copied {
172
- color: var(--color-green-700);
173
- font-weight: var(--typography-fontWeight-semibold);
174
- }
175
-
176
- /* --- WCAG level badge --- */
177
- .level {
178
- display: inline-block;
179
- min-width: 3.2em;
180
- margin-left: var(--spacing-6);
181
- padding: 1px var(--spacing-6);
182
- border-radius: var(--radius-sm);
183
- font-family: var(--typography-fontFamily-sans);
184
- font-size: var(--typography-fontSize-xxs);
185
- font-weight: var(--typography-fontWeight-semibold);
186
- text-align: center;
187
- }
188
-
189
- .level[data-pass='true'] {
190
- color: var(--color-green-800);
191
- background: var(--color-green-50);
192
- }
193
-
194
- .level[data-pass='false'] {
195
- color: var(--color-red-800);
196
- background: var(--color-red-50);
197
- }
198
-
199
- /* --- usage disclosure --- */
200
- details.usage summary {
201
- cursor: pointer;
202
- white-space: nowrap;
203
- }
204
-
205
- details.usage summary:focus-visible {
206
- outline: var(--focus-outline-traditional);
207
- outline-offset: var(--focus-outline-offset);
208
- border-radius: var(--radius-sm);
209
- }
210
-
211
- details.usage ul {
212
- margin: var(--spacing-6) 0 0;
213
- padding-left: var(--spacing-16);
214
- font-family: var(--typography-fontFamily-mono);
215
- font-size: var(--typography-fontSize-xxs);
216
- color: var(--color-neutral-600);
217
- line-height: var(--typography-lineHeight-normal);
218
- }
219
-
220
- .usage-count {
221
- font-weight: var(--typography-fontWeight-semibold);
222
- color: var(--color-blue-700);
223
- }
224
-
225
- /* --- specimen frame, for stories that show rendered output --- */
226
- .specimen {
227
- background: var(--color-neutral-25);
228
- border: var(--border-width-1) solid var(--color-neutral-100);
229
- border-radius: var(--radius-md);
230
- padding: var(--spacing-16);
231
- }
232
- </style>
233
- `;function m({title:t,lede:n,note:r,children:i}){return e`
234
- ${p}
235
- <div class="docs">
236
- <div class="docs-inner">
237
- <h1>${t}</h1>
238
- ${n?e`<p class="docs-lede">${n}</p>`:``}
239
- ${r?e`<div class="docs-note">${r}</div>`:``}
240
- ${i}
241
- </div>
242
- </div>
243
- `}function h({name:t,meta:n,children:r}){return e`
244
- <section class="section">
245
- <div class="section-head">
246
- <h2 class="section-name">${t}</h2>
247
- ${n?e`<span class="section-meta">${n}</span>`:``}
248
- </div>
249
- ${r}
250
- </section>
251
- `}function g(t){return e`
252
- <button class="token-copy" @click=${async e=>{let n=e.currentTarget,r=n.textContent;try{await navigator.clipboard.writeText(`var(${t})`),n.innerHTML=`<span class="copied">copied</span>`}catch{n.innerHTML=`<span class="copied">copy blocked</span>`}setTimeout(()=>{n.textContent=r},1200)}} title="Copy var(${t})">${t}</button>
253
- `}function _(t){if(!t||!t.size)return e`<span class="unused">unused</span>`;let n=[...t].sort();return e`
254
- <details class="usage">
255
- <summary>
256
- <span class="usage-count">${n.length}</span> token${n.length===1?``:`s`}
257
- </summary>
258
- <ul>
259
- ${n.map(t=>e`<li>${t}</li>`)}
260
- </ul>
261
- </details>
262
- `}var v=e`<b>Referenced by</b> counts other
263
- <em>tokens</em> that point at this one. Component CSS lives inside shadow
264
- roots and cannot be read from this page, so a token listed as unreferenced
265
- may still be used directly in a component.`;function y({caption:t,tokens:r,consumers:i,visual:a,visualHeader:o=`Preview`,valueClass:s=`num`}){let c=r.map(e=>{let t=n(e);return{token:e,value:t,px:b(t)}}).filter(e=>e.value);return e`
266
- <div class="table-scroll">
267
- <table>
268
- <caption>${t}</caption>
269
- <thead>
270
- <tr>
271
- <th scope="col">Token</th>
272
- <th scope="col">Value</th>
273
- ${a?e`<th scope="col">${o}</th>`:``}
274
- <th scope="col">Referenced by</th>
275
- </tr>
276
- </thead>
277
- <tbody>
278
- ${c.map(({token:t,value:n,px:r})=>e`
279
- <tr>
280
- <td>${g(t)}</td>
281
- <td class=${s}>
282
- ${n}${r?e`<span class="px-hint">${r}</span>`:``}
283
- </td>
284
- ${a?e`<td>${a(t,n)}</td>`:``}
285
- <td>${_(i.get(t))}</td>
286
- </tr>
287
- `)}
288
- </tbody>
289
- </table>
290
- </div>
291
- `}function b(e){let t=String(e??``).trim();if(!/^[\d.]+rem$/.test(t))return``;let n=document.createElement(`div`);n.style.cssText=`position:absolute;visibility:hidden;height:0;width:${t}`,document.body.appendChild(n);let r=getComputedStyle(n).width;return n.remove(),r===t?``:r}function x(e,t){return r(e,RegExp(`(--${t}[A-Za-z0-9-]*)\\s*:`,`g`)).map(e=>e[1])}export{a as INK,o as PAPER,p as chromeStyles,l as contrast,g as copyToken,i as discoverConsumers,r as discoverTokens,m as docsPage,f as levelBadge,y as primitiveTable,t as readAllCssText,h as refSection,v as referenceNote,n as resolve,u as toHex,b as toPx,s as toRgb,x as tokensFor,_ as usageCell,d as wcagLevel};
292
- //# sourceMappingURL=story-chrome.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"story-chrome.js","names":["readAllCssText","text","sheet","rules","rule","resolve","token","discoverTokens","seen","found","match","cssText","pattern","discoverConsumers","consumers","referenced","INK","PAPER","toRgb","probe","value","computed","parts","luminance","r","g","b","lr","lg","lb","channel","contrast","hi","lo","a","y","x","toHex","wcagLevel","ratio","levelBadge","pass","label","chromeStyles","docsPage","title","lede","note","children","refSection","name","meta","copyToken","button","event","original","usageCell","consumerSet","names","referenceNote","primitiveTable","rows","tokens","toPx","row","caption","visual","visualHeader","valueClass","px","v","tokensFor","prefix"],"sources":["../../../src/tokens/story-chrome.ts"],"sourcesContent":["/**\n * Shared chrome for the Design Tokens stories.\n *\n * Every page in that section uses this module so they stay consistent by\n * construction rather than by five copies of the same CSS. It also carries the\n * token-discovery and contrast helpers, so a docs page never hardcodes a scale\n * that could drift from the tokens themselves.\n *\n * Not a story file: Storybook only globs *.stories.js.\n */\nimport { html } from 'lit';\n\n/* ============================================================\n Token discovery — read the real values out of the loaded CSS\n ============================================================ */\n\n/** Concatenated text of every readable stylesheet in the document. */\nexport function readAllCssText() {\n let text = '';\n for (const sheet of Array.from(document.styleSheets)) {\n let rules;\n try {\n rules = sheet.cssRules;\n } catch {\n continue; // cross-origin sheet, skip\n }\n for (const rule of Array.from(rules)) text += `${rule.cssText}\\n`;\n }\n return text;\n}\n\n/** Resolves a custom property to its computed value on :root. */\nexport function resolve(token: string) {\n return getComputedStyle(document.documentElement).getPropertyValue(token)\n .trim();\n}\n\n/**\n * Finds every custom property whose name matches `pattern`, in declaration\n * order, de-duplicated. `pattern` must have the token name as group 1.\n */\nexport function discoverTokens(cssText: string, pattern: RegExp) {\n const seen = new Set();\n const found = [];\n for (const match of cssText.matchAll(pattern)) {\n const token = match[1];\n if (seen.has(token)) continue;\n seen.add(token);\n found.push(match);\n }\n return found;\n}\n\n/** Maps each palette/primitive token to the tokens that reference it. */\nexport function discoverConsumers(cssText: string) {\n const consumers = new Map<string, Set<string>>();\n const pattern = /(--[A-Za-z0-9-]+)\\s*:\\s*var\\(\\s*(--[A-Za-z0-9-]+)\\s*\\)/g;\n for (const [, token, referenced] of cssText.matchAll(pattern)) {\n if (!consumers.has(referenced)) consumers.set(referenced, new Set());\n consumers.get(referenced)!.add(token);\n }\n return consumers;\n}\n\n/* ============================================================\n Colour maths — WCAG 2.1 relative luminance and contrast\n ============================================================ */\n\nexport const INK = '#151719'; // --color-neutral-900\nexport const PAPER = '#ffffff'; // --color-neutral-0\n\n/** Resolves any CSS colour notation to [r, g, b] via the browser. */\nexport function toRgb(value: string) {\n const probe = document.createElement('span');\n probe.style.cssText = 'position:absolute;visibility:hidden';\n probe.style.color = value;\n document.body.appendChild(probe);\n const computed = getComputedStyle(probe).color;\n probe.remove();\n const parts = computed.match(/-?[\\d.]+/g);\n return parts ? parts.slice(0, 3).map(Number) : [0, 0, 0];\n}\n\nfunction luminance([r, g, b]: number[]) {\n const [lr, lg, lb] = [r, g, b]\n .map(channel => channel / 255)\n .map(channel => (channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4));\n return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;\n}\n\nexport function contrast(a: string, b: string) {\n const [hi, lo] = [luminance(toRgb(a)), luminance(toRgb(b))].sort((x, y) => y - x);\n return (hi + 0.05) / (lo + 0.05);\n}\n\nexport function toHex(value: string) {\n return `#${toRgb(value)\n .map(channel => Math.round(channel).toString(16)\n .padStart(2, '0'))\n .join('')}`;\n}\n\n/** WCAG level reached by a contrast ratio for normal-size body text. */\nexport function wcagLevel(ratio: number) {\n if (ratio >= 7) return { label: 'AAA', pass: true };\n if (ratio >= 4.5) return { label: 'AA', pass: true };\n if (ratio >= 3) return { label: '18pt', pass: true }; // large text / UI edges only\n return { label: 'fail', pass: false };\n}\n\nexport function levelBadge(ratio: number) {\n const { label, pass } = wcagLevel(ratio);\n return html`<span class=\"level\" data-pass=${pass}>${label}</span>`;\n}\n\n/* ============================================================\n Shared styles\n ============================================================ */\n\nexport const chromeStyles = html`\n <style>\n /* The Storybook canvas is transparent, so it inherits the OS colour\n scheme. Paint an explicit surface: there are no dark-mode tokens yet. */\n .docs {\n font-family: var(--typography-fontFamily-sans);\n color: var(--color-neutral-900);\n background: var(--color-neutral-0);\n padding: var(--spacing-24);\n box-sizing: border-box;\n }\n\n .docs-inner {\n max-width: 1180px;\n }\n\n .docs h1 {\n font-size: var(--typography-fontSize-2xl);\n font-weight: var(--typography-fontWeight-semibold);\n margin: 0 0 var(--spacing-8);\n }\n\n .docs-lede {\n font-size: var(--typography-fontSize-sm);\n line-height: var(--typography-lineHeight-normal);\n color: var(--color-neutral-600);\n margin: 0 0 var(--spacing-16);\n max-width: 68ch;\n }\n\n .docs-note {\n font-size: var(--typography-fontSize-xs);\n line-height: var(--typography-lineHeight-normal);\n color: var(--color-neutral-700);\n background: var(--color-neutral-50);\n border-radius: var(--radius-md);\n padding: var(--spacing-12) var(--spacing-16);\n margin-bottom: var(--spacing-32);\n }\n\n .docs-note b {\n font-weight: var(--typography-fontWeight-semibold);\n color: var(--color-neutral-900);\n }\n\n .docs-note code,\n .docs-lede code {\n font-family: var(--typography-fontFamily-mono);\n font-size: var(--typography-code-inline-fontSize);\n }\n\n /* --- sections --- */\n .section {\n margin-bottom: var(--spacing-40);\n }\n\n .section-head {\n display: flex;\n align-items: baseline;\n gap: var(--spacing-8);\n margin-bottom: var(--spacing-12);\n }\n\n .section-name {\n font-size: var(--typography-fontSize-lg);\n font-weight: var(--typography-fontWeight-semibold);\n margin: 0;\n }\n\n .section-meta {\n font-size: var(--typography-fontSize-xs);\n font-family: var(--typography-fontFamily-mono);\n color: var(--color-neutral-500);\n }\n\n /* --- reference tables --- */\n /* Wide content scrolls inside its own container, never the page. */\n .table-scroll {\n overflow-x: auto;\n }\n\n .docs table {\n border-collapse: collapse;\n width: 100%;\n font-size: var(--typography-fontSize-xs);\n }\n\n .docs caption {\n /* the visible heading is .section-head; this is for screen readers */\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n }\n\n .docs th {\n text-align: left;\n font-weight: var(--typography-fontWeight-semibold);\n color: var(--color-neutral-600);\n font-size: var(--typography-fontSize-xxs);\n text-transform: uppercase;\n letter-spacing: var(--typography-letterSpacing-wide);\n padding: 0 var(--spacing-12) var(--spacing-8);\n border-bottom: var(--border-width-1) solid var(--color-neutral-200);\n white-space: nowrap;\n }\n\n .docs td {\n padding: var(--spacing-8) var(--spacing-12);\n border-bottom: var(--border-width-1) solid var(--color-neutral-100);\n vertical-align: middle;\n }\n\n .docs tbody tr:last-child td {\n border-bottom: 0;\n }\n\n /* --- cell primitives --- */\n .mono {\n font-family: var(--typography-fontFamily-mono);\n white-space: nowrap;\n }\n\n .num {\n font-family: var(--typography-fontFamily-mono);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n color: var(--color-neutral-700);\n }\n\n /* the rendered pixel value beside a rem one, so a step is recognisable\n without doing the arithmetic */\n .px-hint {\n margin-left: var(--spacing-8);\n color: var(--color-neutral-500);\n font-size: var(--typography-fontSize-xxs);\n }\n\n .muted {\n color: var(--color-neutral-500);\n }\n\n .unused {\n color: var(--color-neutral-400);\n }\n\n .token-copy {\n font-family: var(--typography-fontFamily-mono);\n font-size: var(--typography-fontSize-xs);\n color: var(--color-neutral-900);\n background: none;\n border: 0;\n padding: 0;\n cursor: copy;\n text-align: left;\n white-space: nowrap;\n }\n\n .token-copy:hover {\n color: var(--color-blue-600);\n text-decoration: underline;\n }\n\n .token-copy:focus-visible {\n outline: var(--focus-outline-traditional);\n outline-offset: var(--focus-outline-offset);\n border-radius: var(--radius-sm);\n }\n\n .copied {\n color: var(--color-green-700);\n font-weight: var(--typography-fontWeight-semibold);\n }\n\n /* --- WCAG level badge --- */\n .level {\n display: inline-block;\n min-width: 3.2em;\n margin-left: var(--spacing-6);\n padding: 1px var(--spacing-6);\n border-radius: var(--radius-sm);\n font-family: var(--typography-fontFamily-sans);\n font-size: var(--typography-fontSize-xxs);\n font-weight: var(--typography-fontWeight-semibold);\n text-align: center;\n }\n\n .level[data-pass='true'] {\n color: var(--color-green-800);\n background: var(--color-green-50);\n }\n\n .level[data-pass='false'] {\n color: var(--color-red-800);\n background: var(--color-red-50);\n }\n\n /* --- usage disclosure --- */\n details.usage summary {\n cursor: pointer;\n white-space: nowrap;\n }\n\n details.usage summary:focus-visible {\n outline: var(--focus-outline-traditional);\n outline-offset: var(--focus-outline-offset);\n border-radius: var(--radius-sm);\n }\n\n details.usage ul {\n margin: var(--spacing-6) 0 0;\n padding-left: var(--spacing-16);\n font-family: var(--typography-fontFamily-mono);\n font-size: var(--typography-fontSize-xxs);\n color: var(--color-neutral-600);\n line-height: var(--typography-lineHeight-normal);\n }\n\n .usage-count {\n font-weight: var(--typography-fontWeight-semibold);\n color: var(--color-blue-700);\n }\n\n /* --- specimen frame, for stories that show rendered output --- */\n .specimen {\n background: var(--color-neutral-25);\n border: var(--border-width-1) solid var(--color-neutral-100);\n border-radius: var(--radius-md);\n padding: var(--spacing-16);\n }\n </style>\n`;\n\n/* ============================================================\n Page and section shells\n ============================================================ */\n\nexport function docsPage({ title, lede, note, children }: { title: string; lede?: unknown; note?: unknown; children?: unknown }) {\n return html`\n ${chromeStyles}\n <div class=\"docs\">\n <div class=\"docs-inner\">\n <h1>${title}</h1>\n ${lede ? html`<p class=\"docs-lede\">${lede}</p>` : ''}\n ${note ? html`<div class=\"docs-note\">${note}</div>` : ''}\n ${children}\n </div>\n </div>\n `;\n}\n\nexport function refSection({ name, meta, children }: { name: string; meta?: string; children?: unknown }) {\n return html`\n <section class=\"section\">\n <div class=\"section-head\">\n <h2 class=\"section-name\">${name}</h2>\n ${meta ? html`<span class=\"section-meta\">${meta}</span>` : ''}\n </div>\n ${children}\n </section>\n `;\n}\n\n/** A token name that copies its var() reference when clicked. */\nexport function copyToken(token: string) {\n const copy = async (event: Event & { currentTarget: HTMLButtonElement }) => {\n const button = event.currentTarget;\n const original = button.textContent;\n try {\n // Rejects in an insecure context, on denied permission, or when the\n // document is not focused.\n await navigator.clipboard.writeText(`var(${token})`);\n button.innerHTML = '<span class=\"copied\">copied</span>';\n } catch {\n button.innerHTML = '<span class=\"copied\">copy blocked</span>';\n }\n setTimeout(() => {\n button.textContent = original;\n }, 1200);\n };\n\n return html`\n <button class=\"token-copy\" @click=${copy} title=\"Copy var(${token})\">${token}</button>\n `;\n}\n\n/** Lists the tokens that consume a given token, behind a disclosure. */\nexport function usageCell(consumerSet: ReadonlySet<string> | undefined) {\n if (!consumerSet || !consumerSet.size) return html`<span class=\"unused\">unused</span>`;\n const names = [...consumerSet].sort();\n return html`\n <details class=\"usage\">\n <summary>\n <span class=\"usage-count\">${names.length}</span> token${names.length === 1 ? '' : 's'}\n </summary>\n <ul>\n ${names.map(name => html`<li>${name}</li>`)}\n </ul>\n </details>\n `;\n}\n\n/**\n * Standard caveat for the \"Referenced by\" column.\n *\n * This page can only see stylesheets in the document. Component CSS lives\n * inside shadow roots and is unreachable, so the column counts token-to-token\n * references only — a primitive with no listed references may still be used\n * directly by components.\n */\nexport const referenceNote = html`<b>Referenced by</b> counts other\n <em>tokens</em> that point at this one. Component CSS lives inside shadow\n roots and cannot be read from this page, so a token listed as unreferenced\n may still be used directly in a component.`;\n\n/**\n * Token / value / optional visual / references table, shared by the primitive\n * pages. `visual` receives (token, value) and returns the cell contents.\n */\nexport function primitiveTable({ caption, tokens, consumers, visual, visualHeader = 'Preview', valueClass = 'num' }: {\n caption : string;\n tokens : readonly string[];\n consumers : ReadonlyMap<string, ReadonlySet<string>>;\n visual? : (token: string, value: string) => unknown;\n visualHeader?: string;\n valueClass? : string;\n}) {\n const rows = tokens\n .map(token => {\n const value = resolve(token);\n return { token, value, px: toPx(value) };\n })\n .filter(row => row.value);\n\n return html`\n <div class=\"table-scroll\">\n <table>\n <caption>${caption}</caption>\n <thead>\n <tr>\n <th scope=\"col\">Token</th>\n <th scope=\"col\">Value</th>\n ${visual ? html`<th scope=\"col\">${visualHeader}</th>` : ''}\n <th scope=\"col\">Referenced by</th>\n </tr>\n </thead>\n <tbody>\n ${rows.map(\n ({ token, value, px }) => html`\n <tr>\n <td>${copyToken(token)}</td>\n <td class=${valueClass}>\n ${value}${px ? html`<span class=\"px-hint\">${px}</span>` : ''}\n </td>\n ${visual ? html`<td>${visual(token, value)}</td>` : ''}\n <td>${usageCell(consumers.get(token))}</td>\n </tr>\n `\n )}\n </tbody>\n </table>\n </div>\n `;\n}\n\n/**\n * The rendered pixel value of a rem length, measured rather than assumed, so a\n * browser at a non-default root font size reports its own truth.\n *\n * rem only. An em value is relative to the element's own font size, so there\n * is no single pixel equivalent to state — quoting one would be wrong rather\n * than merely imprecise. px values, 0, unitless numbers, keywords and colours\n * are left alone too.\n */\nexport function toPx(value: string | null | undefined) {\n const v = String(value ?? '').trim();\n if (!/^[\\d.]+rem$/.test(v)) return '';\n const probe = document.createElement('div');\n probe.style.cssText = `position:absolute;visibility:hidden;height:0;width:${v}`;\n document.body.appendChild(probe);\n const px = getComputedStyle(probe).width;\n probe.remove();\n return px === v ? '' : px;\n}\n\n/** Tokens matching a prefix, in declaration order, read from the loaded CSS. */\nexport function tokensFor(cssText: string, prefix: string) {\n const pattern = new RegExp(`(--${prefix}[A-Za-z0-9-]*)\\\\s*:`, 'g');\n return discoverTokens(cssText, pattern).map(match => match[1]);\n}\n"],"mappings":"A,2BAiBA,SAAgBA,GAAiB,CAC/B,IAAIC,EAAO,GACX,IAAK,IAAMC,KAAS,MAAM,KAAK,SAAS,WAAW,EAAG,CACpD,IAAIC,EACJ,GAAI,CACF,EAAQD,EAAM,QAChB,MAAQ,CACN,QACF,CACA,IAAK,IAAME,KAAQ,MAAM,KAAKD,CAAK,EAAG,GAAQ,GAAGC,EAAK,QAAQ,GAChE,CACA,OAAOH,CACT,CAGA,SAAgBI,EAAQ,EAAe,CACrC,OAAO,iBAAiB,SAAS,eAAe,CAAC,CAAC,iBAAiBC,CAAK,CAAC,CACtE,KAAK,CACV,CAMA,SAAgBC,EAAe,EAAiB,EAAiB,CAC/D,IAAMC,kBAAO,IAAI,IACXC,EAAQ,CAAC,EACf,IAAK,IAAMC,KAASC,EAAQ,SAASC,CAAO,EAAG,CAC7C,IAAMN,EAAQI,EAAM,GAChBF,EAAK,IAAIF,CAAK,IAClBE,EAAK,IAAIF,CAAK,EACdG,EAAM,KAAKC,CAAK,EAClB,CACA,OAAOD,CACT,CAGA,SAAgBI,EAAkB,EAAiB,CACjD,IAAMC,kBAAY,IAAI,IAEtB,IAAK,GAAM,EAAGR,EAAOS,KAAeJ,EAAQ,SAAS,yDAAO,EACrDG,EAAU,IAAI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AS,cAAc,KAAK,EAC1C,EAAM,MAAM,QAAU,sDAAsDmD,IAC5E,SAAS,KAAK,YAAYnD,CAAK,EAC/B,IAAMkD,EAAK,iBAAiBlD,CAAK,CAAC,CAAC,MAEnC,OADAA,EAAM,OAAO,EACNkD,IAAOC,EAAI,GAAKD,CACzB,CAGA,SAAgBE,EAAU,EAAiB,EAAgB,CAEzD,OAAOhE,EAAeI,EADF,OAAO,MAAM6D,EAAO,qBAAsB,GAC/B,CAAO,CAAC,CAAC,IAAI,GAAS9D,EAAM,EAAE,CAC/D,C"}
@@ -1,114 +0,0 @@
1
- /**
2
- * The analysis behind Foundations/Token Map, kept free of Lit and the DOM so
3
- * the same functions run in Storybook and under Node: the page renders what
4
- * this returns, and nothing on the page is transcribed by hand.
5
- *
6
- * Inputs are text, not live objects: the generated tokens.css, the tier
7
- * registry in scripts/token-tiers.json, and the raw source of every file that
8
- * might read a token. Component CSS sits inside shadow roots, which is why the
9
- * other Foundations pages can only count token-to-token references; reading the
10
- * source is what lets this page say which component reads a token.
11
- *
12
- * Not a story file: Storybook only globs *.stories.js.
13
- */
14
- /** Blank comments, keeping offsets, so commented-out CSS is never read. */
15
- export declare const blankComments: (text: string) => string;
16
- /** name -> raw declared value, in declaration order. */
17
- export declare function declarationsFrom(cssText: string): Map<string, string>;
18
- /** Every custom property a value refers to. */
19
- export declare const refsOf: (value: string) => string[];
20
- /** A family in scripts/token-tiers.json. */
21
- export interface TokenFamily {
22
- prefix: string;
23
- tier: string;
24
- }
25
- /** The family a token belongs to: the longest matching registry prefix. */
26
- export declare function familyOf(token: string, families: readonly TokenFamily[]): TokenFamily | null;
27
- /**
28
- * The alias chain from a token down to its value. Follows the reference while
29
- * the value is exactly one var(); a value that combines references
30
- * (color-mix, a shorthand, a clamp) ends the chain and is reported as compound.
31
- */
32
- export declare function chainOf(token: string, decls: ReadonlyMap<string, string>): {
33
- hops: string[];
34
- value: string;
35
- compound: boolean;
36
- };
37
- /**
38
- * Who reads each token, from raw source text keyed by path.
39
- *
40
- * Three ways a token is read, and all three are real in this package:
41
- * var(--x) the ordinary case
42
- * '--x' a name held as data -- token-scales.ts maps
43
- * color="muted" to '--color-text-muted' this way
44
- * '--spacing-' a prefix the scale helpers complete at runtime, so a
45
- * step may be read without its full name appearing
46
- * The third is reported separately: it says a token can be reached, not that
47
- * anything reaches it.
48
- */
49
- export declare function consumersFrom(sources: Record<string, string>, ownerOf: (path: string) => string): {
50
- readers: Map<string, Set<string>>;
51
- prefixes: Map<string, Set<string>>;
52
- };
53
- /** The owner name ownerOf() should return for documentation sources. */
54
- export declare const DOCS = "stories";
55
- /** One token as the page shows it. */
56
- export interface TokenRow {
57
- name: string;
58
- value: string;
59
- family: TokenFamily | null;
60
- tier: string;
61
- chain: {
62
- hops: string[];
63
- value: string;
64
- compound: boolean;
65
- };
66
- tokenReaders: Set<string>;
67
- sourceReaders: Set<string>;
68
- reachable: Set<string>;
69
- }
70
- /**
71
- * Everything the page shows. `sources` is { path: text }; `ownerOf` turns a
72
- * path into the name shown in "read by".
73
- */
74
- export declare function analyse({ cssText, registry, sources, ownerOf }: {
75
- cssText: string;
76
- registry: {
77
- families: readonly TokenFamily[];
78
- };
79
- sources: Record<string, string>;
80
- ownerOf: (path: string) => string;
81
- }): {
82
- rows: TokenRow[];
83
- decls: Map<string, string>;
84
- flags: {
85
- tierSkips: {
86
- prefix: string;
87
- list: {
88
- row: TokenRow;
89
- target: TokenRow;
90
- }[];
91
- rolesAbove: TokenRow[];
92
- }[];
93
- inversions: {
94
- row: TokenRow;
95
- target: TokenRow;
96
- }[];
97
- unread: TokenRow[];
98
- docsOnly: TokenRow[];
99
- unreadAxes: TokenRow[];
100
- reachableOnly: TokenRow[];
101
- unreadSteps: TokenRow[];
102
- literalSemantics: TokenRow[];
103
- sameSlot: {
104
- members: string[];
105
- pattern: string;
106
- primitive: string | undefined;
107
- }[];
108
- sameRole: {
109
- a: TokenRow;
110
- b: TokenRow;
111
- primitive: string | undefined;
112
- }[];
113
- };
114
- };
@@ -1,2 +0,0 @@
1
- var e=e=>e.replace(/\/\*[\s\S]*?\*\//g,e=>e.replace(/[^\n]/g,` `));function t(t){let n=/* @__PURE__ */ new Map;for(let r of e(t).matchAll(/(?:^|[\s;{])(--[A-Za-z0-9-]+)\s*:\s*([^;]*);/g))n.has(r[1])||n.set(r[1],r[2].replace(/\s+/g,` `).trim());return n}var n=e=>[...e.matchAll(/var\(\s*(--[A-Za-z0-9-]+)/g)].map(e=>e[1]);function r(e,t){let n=null;for(let r of t)e.startsWith(r.prefix)&&(!n||r.prefix.length>n.prefix.length)&&(n=r);return n}function i(e,t){let r=[e],i=t.get(e);for(;i!==void 0;){let e=i.match(/^var\(\s*(--[A-Za-z0-9-]+)\s*\)$/);if(!e||!t.has(e[1])||r.includes(e[1]))break;r.push(e[1]),i=t.get(e[1])}let a=i!==void 0&&n(i).length>0;return{hops:r,value:i??``,compound:a}}function a(t,n){let r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=(e,t,n)=>{e.has(t)||e.set(t,/* @__PURE__ */ new Set),e.get(t).add(n)};for(let[o,s]of Object.entries(t)){let t=e(s),c=n(o);for(let e of t.matchAll(/var\(\s*(--[A-Za-z0-9-]+)/g))a(r,e[1],c);for(let e of t.matchAll(/['"`](--[A-Za-z0-9-]*[A-Za-z0-9])['"`]/g))a(r,e[1],c);if(c!==`stories`){for(let e of t.matchAll(/['"`](--[A-Za-z0-9-]+-)['"`$]/g))a(i,e[1],c);for(let e of t.matchAll(/var\(\s*(--[A-Za-z0-9-]+-)\$\{/g))a(i,e[1],c)}}return{readers:r,prefixes:i}}var o={primitive:0,semantic:1,component:2},s=`stories`;function c({cssText:e,registry:s,sources:c,ownerOf:l}){let u=t(e),d=s.families,{readers:f,prefixes:p}=a(c,l),m=/* @__PURE__ */ new Map;for(let[e,t]of u){let a=r(e,d),o=i(e,u),s=/* @__PURE__ */ new Set;for(let[t,r]of u)t!==e&&n(r).includes(e)&&s.add(t);let c=/* @__PURE__ */ new Set;for(let[t,n]of p)e.startsWith(t)&&n.forEach(e=>c.add(e));m.set(e,{name:e,value:t,family:a,tier:a?.tier??`unassigned`,chain:o,tokenReaders:s,sourceReaders:f.get(e)??/* @__PURE__ */ new Set,reachable:c})}let h=[...m.values()],g=e=>e.replace(/-[A-Za-z]+$/,``),_=/* @__PURE__ */ new Map,v=[];for(let e of h){let t=e.chain.hops[1]??n(e.value)[0],r=t&&m.get(t);if(r){if(e.tier===`component`&&r.tier===`primitive`){let t=r.family.prefix;_.has(t)||_.set(t,[]),_.get(t).push({row:e,target:r})}o[r.tier]>o[e.tier]&&v.push({row:e,target:r})}}let y=e=>h.filter(t=>t.tier===`semantic`&&t.chain.hops.slice(1).some(t=>m.get(t)?.family?.prefix===e)),b=[..._].map(([e,t])=>({prefix:e,list:t,rolesAbove:y(e)})).sort((e,t)=>t.list.length-e.list.length),x=[],S=[],C=[],w=[],T=[],E=e=>e.tokenReaders.size>0||[...e.sourceReaders].some(e=>e!==`stories`);for(let e of h)E(e)||(e.reachable.size?w.push(e):e.sourceReaders.has(`stories`)?S.push(e):e.tier===`primitive`?T.push(e):(e.tier===`semantic`&&e.name.startsWith(`--typography-`)&&h.some(t=>t!==e&&g(t.name)===g(e.name)&&E(t))?C:x).push(e));let D=h.filter(e=>e.tier===`semantic`&&n(e.value).length===0),O=/* @__PURE__ */ new Map,k=[],A=h.filter(e=>e.tier===`semantic`&&!e.chain.compound&&m.get(e.chain.hops.at(-1))?.family?.prefix?.startsWith(`--color-`)&&m.get(e.chain.hops.at(-1))?.tier===`primitive`),j=e=>e.slice(2).split(`-`);for(let e=0;e<A.length;e++)for(let t=e+1;t<A.length;t++){let n=A[e],r=A[t];if(n.family!==r.family||n.chain.hops.at(-1)!==r.chain.hops.at(-1))continue;let i=j(n.name),a=j(r.name);if(i.length!==a.length)continue;let o=i.map((e,t)=>e!==a[t]);if(o.filter(Boolean).length!==1)continue;if(o.at(-1)){k.push({a:n,b:r,primitive:n.chain.hops.at(-1)});continue}let s=o.indexOf(!0),c=`--${i.map((e,t)=>t===s?`*`:e).join(`-`)}`,l=`${c}|${n.chain.hops.at(-1)}`;O.has(l)||O.set(l,{pattern:c,primitive:n.chain.hops.at(-1),members:/* @__PURE__ */ new Set}),O.get(l).members.add(i[s]).add(a[s])}return{rows:h,decls:u,flags:{tierSkips:b,inversions:v,unread:x,docsOnly:S,unreadAxes:C,reachableOnly:w,unreadSteps:T,literalSemantics:D,sameSlot:[...O.values()].map(e=>({...e,members:[...e.members]})),sameRole:k}}}export{s as DOCS,c as analyse,e as blankComments,i as chainOf,a as consumersFrom,t as declarationsFrom,r as familyOf,n as refsOf};
2
- //# sourceMappingURL=token-map.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-map.js","names":["blankComments","text","c","declarationsFrom","out","m","cssText","refsOf","value","familyOf","best","f","families","token","chainOf","hops","decls","only","compound","consumersFrom","readers","prefixes","add","map","key","owner","path","raw","sources","ownerOf","TIER_RANK","DOCS","analyse","registry","byToken","name","family","chain","tokenReaders","other","v","reachable","prefix","owners","o","rows","roleOf","tierSkips","inversions","r","firstHop","target","rolesAbove","h","skips","list","b","a","unread","docsOnly","unreadAxes","reachableOnly","unreadSteps","productRead","literalSemantics","slots","sameRole","colour","segs","n","i","j","sa","sb","diff","s","k","pattern","g"],"sources":["../../../src/tokens/token-map.ts"],"sourcesContent":["/**\n * The analysis behind Foundations/Token Map, kept free of Lit and the DOM so\n * the same functions run in Storybook and under Node: the page renders what\n * this returns, and nothing on the page is transcribed by hand.\n *\n * Inputs are text, not live objects: the generated tokens.css, the tier\n * registry in scripts/token-tiers.json, and the raw source of every file that\n * might read a token. Component CSS sits inside shadow roots, which is why the\n * other Foundations pages can only count token-to-token references; reading the\n * source is what lets this page say which component reads a token.\n *\n * Not a story file: Storybook only globs *.stories.js.\n */\n\n/** Blank comments, keeping offsets, so commented-out CSS is never read. */\nexport const blankComments = (text: string) =>\n text.replace(/\\/\\*[\\s\\S]*?\\*\\//g, c => c.replace(/[^\\n]/g, ' '));\n\n/** name -> raw declared value, in declaration order. */\nexport function declarationsFrom(cssText: string) {\n const out = new Map<string, string>();\n for (const m of blankComments(cssText).matchAll(/(?:^|[\\s;{])(--[A-Za-z0-9-]+)\\s*:\\s*([^;]*);/g)) {\n if (!out.has(m[1])) out.set(m[1], m[2].replace(/\\s+/g, ' ').trim());\n }\n return out;\n}\n\n/** Every custom property a value refers to. */\nexport const refsOf = (value: string) => [...value.matchAll(/var\\(\\s*(--[A-Za-z0-9-]+)/g)].map(m => m[1]);\n\n/** A family in scripts/token-tiers.json. */\nexport interface TokenFamily {\n prefix: string;\n tier : string;\n}\n\n/** The family a token belongs to: the longest matching registry prefix. */\nexport function familyOf(token: string, families: readonly TokenFamily[]) {\n let best = null;\n for (const f of families) {\n if (token.startsWith(f.prefix) && (!best || f.prefix.length > best.prefix.length)) best = f;\n }\n return best;\n}\n\n/**\n * The alias chain from a token down to its value. Follows the reference while\n * the value is exactly one var(); a value that combines references\n * (color-mix, a shorthand, a clamp) ends the chain and is reported as compound.\n */\nexport function chainOf(token: string, decls: ReadonlyMap<string, string>) {\n const hops = [token];\n let value = decls.get(token);\n while (value !== undefined) {\n const only = value.match(/^var\\(\\s*(--[A-Za-z0-9-]+)\\s*\\)$/);\n if (!only || !decls.has(only[1]) || hops.includes(only[1])) break;\n hops.push(only[1]);\n value = decls.get(only[1]);\n }\n const compound = value !== undefined && refsOf(value).length > 0;\n return { hops, value: value ?? '', compound };\n}\n\n/**\n * Who reads each token, from raw source text keyed by path.\n *\n * Three ways a token is read, and all three are real in this package:\n * var(--x) the ordinary case\n * '--x' a name held as data -- token-scales.ts maps\n * color=\"muted\" to '--color-text-muted' this way\n * '--spacing-' a prefix the scale helpers complete at runtime, so a\n * step may be read without its full name appearing\n * The third is reported separately: it says a token can be reached, not that\n * anything reaches it.\n */\nexport function consumersFrom(sources: Record<string, string>, ownerOf: (path: string) => string) {\n const readers = new Map<string, Set<string>>();\n const prefixes = new Map<string, Set<string>>();\n const add = (map: Map<string, Set<string>>, key: string, owner: string) => {\n if (!map.has(key)) map.set(key, new Set());\n map.get(key)!.add(owner);\n };\n for (const [path, raw] of Object.entries(sources)) {\n const text = blankComments(raw);\n const owner = ownerOf(path);\n for (const m of text.matchAll(/var\\(\\s*(--[A-Za-z0-9-]+)/g)) add(readers, m[1], owner);\n for (const m of text.matchAll(/['\"`](--[A-Za-z0-9-]*[A-Za-z0-9])['\"`]/g)) add(readers, m[1], owner);\n /* documentation looks tokens up by prefix to list them, which is not a\n product being able to reach one */\n if (owner === DOCS) continue;\n for (const m of text.matchAll(/['\"`](--[A-Za-z0-9-]+-)['\"`$]/g)) add(prefixes, m[1], owner);\n for (const m of text.matchAll(/var\\(\\s*(--[A-Za-z0-9-]+-)\\$\\{/g)) add(prefixes, m[1], owner);\n }\n return { readers, prefixes };\n}\n\nconst TIER_RANK: Record<string, number> = { primitive: 0, semantic: 1, component: 2 };\n\n/** The owner name ownerOf() should return for documentation sources. */\nexport const DOCS = 'stories';\n\n/** One token as the page shows it. */\nexport interface TokenRow {\n name : string;\n value : string;\n family : TokenFamily | null;\n tier : string;\n chain : { hops: string[]; value: string; compound: boolean };\n tokenReaders : Set<string>;\n sourceReaders: Set<string>;\n reachable : Set<string>;\n}\n\n/**\n * Everything the page shows. `sources` is { path: text }; `ownerOf` turns a\n * path into the name shown in \"read by\".\n */\nexport function analyse({ cssText, registry, sources, ownerOf }: {\n cssText : string;\n registry: { families: readonly TokenFamily[] };\n sources : Record<string, string>;\n ownerOf : (path: string) => string;\n}) {\n const decls = declarationsFrom(cssText);\n const families = registry.families;\n const { readers, prefixes } = consumersFrom(sources, ownerOf);\n\n const byToken = new Map<string, TokenRow>();\n for (const [name, value] of decls) {\n const family = familyOf(name, families);\n const chain = chainOf(name, decls);\n const tokenReaders = new Set<string>();\n for (const [other, v] of decls) if (other !== name && refsOf(v).includes(name)) tokenReaders.add(other);\n const reachable = new Set<string>();\n for (const [prefix, owners] of prefixes) if (name.startsWith(prefix)) owners.forEach(o => reachable.add(o));\n byToken.set(name, {\n name,\n value,\n family,\n tier : family?.tier ?? 'unassigned',\n chain,\n tokenReaders,\n sourceReaders: readers.get(name) ?? new Set(),\n reachable\n });\n }\n\n const rows = [...byToken.values()];\n const roleOf = (name: string) => name.replace(/-[A-Za-z]+$/, '');\n\n /* Tier skips: a component token whose first hop is a primitive. Grouped by\n the primitive family reached, because the answer differs by family: a\n colour primitive has semantic roles above it that the token could have\n asked for, and --spacing-* has none -- its roles were deleted on purpose.\n Inversions: a token whose first hop is a HIGHER tier than itself. */\n const tierSkips = new Map<string, { row: TokenRow; target: TokenRow }[]>();\n const inversions = [];\n for (const r of rows) {\n const firstHop = r.chain.hops[1] ?? refsOf(r.value)[0];\n const target = firstHop && byToken.get(firstHop);\n if (!target) continue;\n if (r.tier === 'component' && target.tier === 'primitive') {\n const key = target.family!.prefix;\n if (!tierSkips.has(key)) tierSkips.set(key, []);\n tierSkips.get(key)!.push({ row: r, target });\n }\n if (TIER_RANK[target.tier] > TIER_RANK[r.tier]) inversions.push({ row: r, target });\n }\n /* For each skipped-to family, the semantic tokens that do sit above it --\n the roles a skipping token could have asked for instead. A count, not a\n verdict: --spacing-* has two (the card roles), and that is not a spacing\n vocabulary. */\n const rolesAbove = (prefix: string) => rows.filter(r => r.tier === 'semantic' &&\n r.chain.hops.slice(1).some(h => byToken.get(h)?.family?.prefix === prefix));\n const skips = [...tierSkips].map(([prefix, list]) => ({ prefix, list, rolesAbove: rolesAbove(prefix) }))\n .sort((a, b) => b.list.length - a.list.length);\n\n /* Unread, split by what it means:\n unread semantic or component, and nothing reads it -- the\n case that retired display-hero and two status tokens\n docsOnly read by a story and nothing else\n unreadAxes one axis of a typography role whose other axes are\n read; a role declares five and a consumer may want two\n reachableOnly nothing names it, but a scale helper can build its name\n unreadSteps a primitive step nothing reads; a scale is allowed to\n be complete */\n const unread: TokenRow[] = [];\n const docsOnly: TokenRow[] = [];\n const unreadAxes: TokenRow[] = [];\n const reachableOnly: TokenRow[] = [];\n const unreadSteps: TokenRow[] = [];\n const productRead = (r: TokenRow) => r.tokenReaders.size > 0 || [...r.sourceReaders].some(o => o !== DOCS);\n for (const r of rows) {\n if (productRead(r)) continue;\n if (r.reachable.size) { reachableOnly.push(r); continue; }\n if (r.sourceReaders.has(DOCS)) { docsOnly.push(r); continue; }\n if (r.tier === 'primitive') { unreadSteps.push(r); continue; }\n const isRoleAxis = r.tier === 'semantic' && r.name.startsWith('--typography-');\n const siblingRead = isRoleAxis && rows.some(o => o !== r && roleOf(o.name) === roleOf(r.name) && productRead(o));\n (siblingRead ? unreadAxes : unread).push(r);\n }\n\n /* semantic tokens declared as a literal: no primitive beneath them */\n const literalSemantics = rows.filter(r => r.tier === 'semantic' && refsOf(r.value).length === 0);\n\n /* Same colour, two semantic names in one family, differing in exactly one\n segment. Split by WHICH segment differs:\n sameSlot a middle segment -- --status-brand-surface and\n --status-info-surface: one slot, two tones, one colour. This\n is the kind that collided twice.\n sameRole the last segment -- --color-surface-muted and -disabled: two\n jobs that happen to share a value, which CLAUDE.md says is\n expected and must not drive a choice. Listed, not flagged. */\n const slots = new Map<string, { pattern: string; primitive: string | undefined; members: Set<string> }>();\n const sameRole = [];\n const colour = rows.filter(r => r.tier === 'semantic' && !r.chain.compound &&\n byToken.get(r.chain.hops.at(-1)!)?.family?.prefix?.startsWith('--color-') &&\n byToken.get(r.chain.hops.at(-1)!)?.tier === 'primitive');\n const segs = (n: string) => n.slice(2).split('-');\n for (let i = 0; i < colour.length; i++) {\n for (let j = i + 1; j < colour.length; j++) {\n const a = colour[i], b = colour[j];\n if (a.family !== b.family || a.chain.hops.at(-1) !== b.chain.hops.at(-1)) continue;\n const sa = segs(a.name), sb = segs(b.name);\n if (sa.length !== sb.length) continue;\n const diff = sa.map((s, k) => s !== sb[k]);\n if (diff.filter(Boolean).length !== 1) continue;\n if (diff.at(-1)) { sameRole.push({ a, b, primitive: a.chain.hops.at(-1) }); continue; }\n /* one line per slot: --status-*-surface -> blue-50: brand, info */\n const k = diff.indexOf(true);\n const pattern = `--${sa.map((s, n) => (n === k ? '*' : s)).join('-')}`;\n const key = `${pattern}|${a.chain.hops.at(-1)}`;\n if (!slots.has(key)) slots.set(key, { pattern, primitive: a.chain.hops.at(-1), members: new Set() });\n slots.get(key)!.members.add(sa[k]).add(sb[k]);\n }\n }\n const sameSlot = [...slots.values()].map(g => ({ ...g, members: [...g.members] }));\n\n return {\n rows, decls,\n flags: { tierSkips: skips, inversions, unread, docsOnly, unreadAxes, reachableOnly, unreadSteps, literalSemantics, sameSlot, sameRole }\n };\n}\n"],"mappings":"AAeA,IAAaA,EAAiB,GAC5BC,EAAK,QAAQ,oBAAqB,GAAKC,EAAE,QAAQ,SAAU,GAAG,CAAC,EAGjE,SAAgBC,EAAiB,EAAiB,CAChD,IAAMC,kBAAM,IAAI,IAChB,IAAK,IAAMC,KAAKL,EAAcM,CAAO,CAAC,CAAC,SAAS,+CAA+C,EACxFF,EAAI,IAAIC,EAAE,EAAE,GAAGD,EAAI,IAAIC,EAAE,GAAIA,EAAE,EAAE,CAAC,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,EAEpE,OAAOD,CACT,CAGA,IAAaG,EAAU,GAAkB,CAAC,GAAGC,EAAM,SAAS,4BAA4B,CAAC,CAAC,CAAC,IAAI,GAAKH,EAAE,EAAE,EASxG,SAAgBI,EAAS,EAAe,EAAkC,CACxE,IAAIC,EAAO,KACX,IAAK,IAAMC,KAAKC,EACVC,EAAM,WAAWF,EAAE,MAAM,IAAM,CAACD,GAAQC,EAAE,OAAO,OAASD,EAAK,OAAO,UAAS,EAAOC,GAE5F,OAAOD,CACT,CAOA,SAAgBI,EAAQ,EAAe,EAAoC,CACzE,IAAMC,EAAO,CAACF,CAAK,EACfL,EAAQQ,EAAM,IAAIH,CAAK,EAC3B,KAAOL,IAAU,IAAA,IAAW,CAC1B,IAAMS,EAAOT,EAAM,MAAM,kCAAkC,EAC3D,GAAI,CAACS,GAA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G,GAAGyC,EAAM,IAAIzC,EAAK,CAAE,UAAS,UAAWiC,EAAE,MAAM,KAAK,GAAG,EAAE,EAAG,wBAAS,IAAI,GAAM,CAAC,EACnGQ,EAAM,IAAIzC,CAAG,CAAC,CAAE,QAAQ,IAAIgD,EAAGI,EAAE,CAAC,CAAC,IAAIH,EAAGG,EAAE,CAC9C,CAIF,MAAO,CACL,OAAM,QACN,MAAO,CAAE,UAAWtB,EAAO,aAAY,SAAQ,WAAU,aAAY,gBAAe,cAAa,mBAAkB,SAJpG,CAAC,GAAGW,EAAM,OAAO,CAAC,CAAC,CAAC,IAAI,IAAM,CAAE,GAAGa,EAAG,QAAS,CAAC,GAAGA,EAAE,OAAO,CAAE,EAIsC,EAAU,UAAS,CACxI,CACF,C"}
@@ -1,63 +0,0 @@
1
- /**
2
- * What each semantic token is FOR, in one place.
3
- *
4
- * Roles are described by the job they do, not by the colour they currently
5
- * resolve to. The swatch on a docs page is there to recognise one on screen;
6
- * it is never the reason to choose one.
7
- *
8
- * Two readers: Foundations/Surfaces renders SURFACES and BORDERS, and
9
- * scripts/figma-variable-descriptions.mjs turns every entry here into the
10
- * description a designer sees in Figma's variable picker. Writing the
11
- * sentence once is the point -- a second hand-kept copy in Figma is how a
12
- * library goes on describing a role code has changed.
13
- *
14
- * Not a story file: Storybook only globs *.stories.js. Pure data, so it
15
- * imports under Node.
16
- */
17
- export declare const SURFACES: {
18
- token: string;
19
- purpose: string;
20
- use: string;
21
- avoid: string;
22
- relation: string;
23
- example: string;
24
- theme: string;
25
- }[];
26
- export declare const BORDERS: {
27
- token: string;
28
- purpose: string;
29
- use: string;
30
- avoid: string;
31
- }[];
32
- export declare const CARD_EDGES: {
33
- token: string;
34
- purpose: string;
35
- use: string;
36
- avoid: string;
37
- }[];
38
- export declare const TEXT: {
39
- token: string;
40
- purpose: string;
41
- avoid: string;
42
- }[];
43
- export declare const ACTION: {
44
- token: string;
45
- purpose: string;
46
- avoid: string;
47
- }[];
48
- export declare const STATUS_SLOTS: Record<string, string>;
49
- export declare const STATUS_TONES: Record<string, {
50
- label: string;
51
- note: string;
52
- }>;
53
- export declare const OTHER: {
54
- prefix: string;
55
- purpose: string;
56
- }[];
57
- export type TokenPurpose = {
58
- purpose: string;
59
- use?: string;
60
- avoid?: string;
61
- };
62
- /** { purpose, use?, avoid? } for a token, or null when nothing is written. */
63
- export declare function purposeOf(token: string): TokenPurpose | null;
@@ -1,2 +0,0 @@
1
- var e=[{token:`--color-surface-default`,purpose:`The page, canvas or component ground. The thing other things sit on.`,use:`The base of a page, a section, or a component that is not itself a distinct object.`,avoid:`A card or tile that needs to read as its own object — that is surface-container.`,relation:`The reference point. Every other surface is described by how far it sits from this one.`,example:`Page background, modal body, the ground inside a section wrapper.`,theme:`Whatever the page ground is in the active theme. On dark it is the dark ground, not white.`},{token:`--color-surface-container`,purpose:`The ground a self-contained content object sits on, one step off the page, so it reads as its own object without needing a border or a shadow. The step is real but faint: Foundations/Surfaces, A card's ground and its edge.`,use:`A card, tile, panel or bounded section that should read as a distinct object on the page.`,avoid:`The page itself (surface-default); a low-emphasis grouping wash (surface-subtle); a disabled or pressed state (surface-muted); anything on dark (surface-inverse); brand or status meaning.`,relation:`One step from default, and closer to it than subtle is. Container is the ground of an object; subtle is a wash behind a group.`,example:`Card and tile surfaces, feature panels, quote cards.`,theme:`Adjacent to but distinguishable from surface-default. On dark that means one step lighter than the page, not a fixed grey.`},{token:`--color-surface-subtle`,purpose:`A low-emphasis background that groups content without making it an object.`,use:`A band or wash behind several things that already belong together.`,avoid:`The ground of a single self-contained object — that is container.`,relation:`Further from default than container. Recedes rather than stands out.`,example:`A grouping band behind a row of items.`,theme:`A recessive wash relative to the page ground.`},{token:`--color-surface-muted`,purpose:`A state surface: the thing is present but not currently active.`,use:`Pressed, inactive or de-emphasised states.`,avoid:`Resting surfaces. If nothing is in a state, this is the wrong family.`,relation:`Shares its value with surface-disabled today; the meanings differ, so do not treat them as interchangeable.`,example:`A pressed toggle track, a de-emphasised row.`,theme:`A state step away from the surface it applies to.`},{token:`--color-surface-disabled`,purpose:`The surface of a control that cannot currently be used.`,use:`Disabled controls only.`,avoid:`Anything a user can still operate.`,relation:`Same value as muted today, different meaning. Disabled is exempt from contrast minimums; muted is not.`,example:`A disabled input or button ground.`,theme:`Reads as unavailable in the active theme.`},{token:`--color-surface-pressed`,purpose:`The ground of a control while it is held down, when surface-muted is already its hover.`,use:`The pressed state of a control whose hover is surface-muted.`,avoid:`A resting or hovered ground; a pressed action fill, which is the action ramp.`,relation:`One step further from the page than muted, the way a press follows a hover.`,example:`bd-back while pressed.`,theme:`A state step past muted in the active theme. On dark, lighter than muted, not darker.`},{token:`--color-surface-inverse`,purpose:`A ground that flips the text polarity: content on it uses the inverse text roles.`,use:`Dark panels inside a light page, tooltips, inverted sections.`,avoid:`Ordinary surfaces. Choosing this changes which text roles are legible.`,relation:`Not a step on the default-container-subtle ladder; it is the other side of it.`,example:`Tooltip body. Not a video or terminal frame: those stay dark in every theme, and read surface-media.`,theme:`Inverts with the theme: on a dark theme this is the light ground.`},{token:`--color-surface-media`,purpose:`The frame around media: a video letterbox, a terminal panel. Dark in every theme.`,use:`A ground that must stay dark because what it frames is dark. Its ink is text-on-media.`,avoid:`A dark panel that should flip with the theme, such as a tooltip: that is surface-inverse.`,relation:`Same value as surface-inverse in light; the two part ways in a dark theme, where inverse turns light and media does not.`,example:`bd-video-player and bd-video letterboxes, the bd-terminal-message panel.`,theme:`Fixed: the same near-black in every theme.`},{token:`--color-surface-brand`,purpose:`A surface whose job is to carry brand identity.`,use:`Large brand areas, such as a footer masthead band.`,avoid:`Anything blue that is not making a brand statement. An indicator, a badge, a selected row and a switch track are all blue and none of them are brand surfaces.`,relation:`A meaning, not a colour. Matching the brand primitive by eye is not evidence.`,example:`The coloured band at the top of the footer.`,theme:`Follows the brand, not the neutral ramp.`},{token:`--color-surface-info`,purpose:`The tint an informational message sits on.`,use:`Informational banners and callouts.`,avoid:`Decorative blue backgrounds with no message semantics.`,relation:`One of the four status tints, each paired with a matching text role.`,example:`An informational banner ground.`,theme:`A readable informational tint against its paired text role.`},{token:`--color-surface-success`,purpose:`The tint a success message sits on.`,use:`Confirmation and success states.`,avoid:`Decorative green.`,relation:`Paired with the matching success text role; the pair is measured together.`,example:`A success banner ground.`,theme:`A readable success tint against its paired text role.`},{token:`--color-surface-warning`,purpose:`The tint a warning message sits on.`,use:`Cautionary states.`,avoid:`Decorative yellow.`,relation:`Paired with the matching warning text role.`,example:`A warning banner ground.`,theme:`A readable warning tint against its paired text role.`},{token:`--color-surface-error`,purpose:`The tint an error message sits on.`,use:`Error and destructive-outcome states.`,avoid:`Decorative red.`,relation:`Paired with the matching error text role.`,example:`An error banner ground.`,theme:`A readable error tint against its paired text role.`}],t=[{token:`--color-border-subtle`,purpose:`A decorative hairline between things that already belong together.`,use:`Separating rows or cells inside one object.`,avoid:`The edge of anything actionable. It sits below the 3:1 that WCAG 1.4.11 asks of a UI component, on purpose.`},{token:`--color-border-default`,purpose:`The boundary of an object or control.`,use:`Inputs, bounded controls, the edge of a component.`,avoid:`Content separation inside a component — that is a divider job.`},{token:`--color-border-strong`,purpose:`A boundary that has to assert itself.`,use:`High-emphasis edges.`,avoid:`Ordinary component edges, which would flatten the emphasis.`},{token:`--color-border-brand`,purpose:`A boundary carrying brand emphasis.`,use:`Brand-emphasised edges.`,avoid:`Focus. Focus has its own tokens and must not be expressed as a border role.`},{token:`--color-border-disabled`,purpose:`The edge of a control that cannot be used.`,use:`Disabled controls.`,avoid:`Anything operable.`}],n=[{token:`--color-border-container`,purpose:`The edge of a card that sits on a tinted section.`,use:`A card on a tinted band, paired with surface-default as its ground.`,avoid:`A card on the page ground: there the surface-container step is the separation and an edge is redundant. On a surface-muted band this edge is the same colour as the band and disappears.`},{token:`--color-border-container-inverse`,purpose:`The edge of a container that sits on an inverse surface.`,use:`Bounding an object on a dark ground.`,avoid:`Light surfaces.`}],r=[{token:`--color-text-primary`,purpose:`Default ink on a light surface: headings and body copy.`,avoid:`Inverse surfaces, where text-inverse takes over.`},{token:`--color-text-secondary`,purpose:`Supporting copy under a title.`,avoid:`A disabled control: disabled is a state, not a quieter step.`},{token:`--color-text-muted`,purpose:`Metadata, captions and timestamps.`,avoid:`A disabled control: disabled is a state, not a quieter step.`},{token:`--color-text-subtle`,purpose:`The quietest readable step of the hierarchy, on the page or a card.`,avoid:`A band (surface-subtle, surface-muted) or a status tint: use text-muted there, because subtle cannot clear 4.5:1 on them. A disabled control: disabled is a state, not a quieter step.`},{token:`--color-text-disabled`,purpose:`STATE: text on a control the user cannot operate. Exempt from contrast minimums only because it is disabled.`,avoid:`Quiet content that is still usable. Loading is not disabled.`},{token:`--color-text-inverse`,purpose:`High-emphasis text on an inverse surface.`,avoid:`Light surfaces.`},{token:`--color-text-muted-inverse`,purpose:`Everything subordinate on an inverse surface. The light-side secondary, muted and subtle roles fail contrast there.`,avoid:`Light surfaces.`},{token:`--color-text-on-media`,purpose:`Ink on surface-media: a video control glyph, a terminal's command lines. White in every theme, fixed with its ground.`,avoid:`Text on an inverse surface (text-inverse), which flips in a dark theme.`},{token:`--color-text-on-media-muted`,purpose:`The quieter ink on surface-media, such as a terminal's subdued lines.`,avoid:`Subordinate text on an inverse surface: that is text-muted-inverse, which flips.`},{token:`--color-text-brand`,purpose:`Brand-coloured ink, such as a link at rest. One step darker than action-primary, because blue-500 fails on any tint.`,avoid:`The fill of an interactive element at a state: that is the action ramp.`},{token:`--color-text-brand-hover`,purpose:`Brand text under the pointer: a hovered link or citation reference.`,avoid:`A button fill. It used to be --color-action-primary-active, and a fill and a text colour part ways in a dark theme.`},{token:`--color-text-success`,purpose:`Success text, paired with surface-success. Offered as color="success" on bd-h and bd-p.`,avoid:`Feedback inside a component (a badge, tag or alert): that is status-success-text.`},{token:`--color-text-warning`,purpose:`Warning text, paired with surface-warning. Offered as color="warning" on bd-h and bd-p.`,avoid:`Feedback inside a component: that is status-warning-text.`},{token:`--color-text-error`,purpose:`Error text, paired with surface-error.`,avoid:`Feedback inside a component: that is status-error-text.`}],i=[{token:`--color-action-primary`,purpose:`The fill of a primary interactive element at rest.`,avoid:`Brand identity. Action and brand share a value at this step and diverge after it.`},{token:`--color-action-primary-hover`,purpose:`The same element, hovered.`,avoid:`Any blue that is not a hover state. There is no hover-blue role.`},{token:`--color-action-primary-active`,purpose:`The same element, pressed.`,avoid:`A selected or current item: that is an indicator.`},{token:`--color-action-accent`,purpose:`The fill of a conversion action at rest.`,avoid:`Errors and destructive outcomes, which are status-error.`},{token:`--color-action-accent-hover`,purpose:`The conversion action, hovered.`,avoid:`Anything that is not a hover state.`},{token:`--color-action-accent-active`,purpose:`The conversion action, pressed.`,avoid:`Anything that is not a pressed state.`},{token:`--color-action-secondary`,purpose:`The neutral action fill: a secondary button at rest, and a ghost button while pressed.`,avoid:`A dark ground for content (surface-inverse), or near-black ink (text-primary). Matching neutral-950 by value is not evidence.`},{token:`--color-action-secondary-hover`,purpose:`The neutral action, hovered.`,avoid:`Anything that is not a hover state.`},{token:`--color-action-secondary-active`,purpose:`The neutral action, pressed.`,avoid:`Anything that is not a pressed state.`},{token:`--color-action-on-fill`,purpose:`Ink on an action fill: a button label, a checkmark, a radio dot, a switch thumb. White in every theme.`,avoid:`Text on an inverse surface (text-inverse) or the page colour (surface-default): both happen to be white here, and both flip in a dark theme.`}],a={text:`ink on a tinted chip (badge shade, tag)`,surface:`the light tint (tag, alert). A tag sits here so its border reads`,"surface-strong":`the heavier tint a borderless badge sits on, so a badge and a tag of one tone read apart`,border:`the hairline around a tag`,accent:`the saturated step (badge dot, alert rule)`,fill:`a saturated chip (badge fill)`,"on-fill":`the ink on that saturated chip`},o={neutral:{label:`Neutral`,note:``},brand:{label:`Brand`,note:`Brand has no surface-strong: it would be info's blue-100, and a brand badge would read as info. Brand and info differ only in accent, so never choose between them by colour.`},info:{label:`Info`,note:`Info and brand differ only in accent, so never choose between them by colour.`},success:{label:`Success`,note:``},warning:{label:`Warning`,note:``},error:{label:`Error`,note:``}},s=[{prefix:`--icon-`,purpose:`The size of an icon glyph, from the scale every icon is sized from. Size only: an icon takes its colour from the text around it.`},{prefix:`--grid-container-max-`,purpose:`The page column's maximum width at this breakpoint. A section never declares its own width; it composes the ensemble column.`},{prefix:`--grid-padding-`,purpose:`The page column's gutter at the viewport edge, at this breakpoint. The column is the viewport minus twice this.`},{prefix:`--grid-gutter-`,purpose:`The space between grid columns at this breakpoint.`},{prefix:`--grid-columns`,purpose:`The number of columns in the page grid.`},{prefix:`--touch-target-size`,purpose:`The minimum comfortable hit area for a control (WCAG 2.5.8).`},{prefix:`--touch-target-spacing`,purpose:`The minimum space between two touch targets.`},{prefix:`--content-width-readable`,purpose:`A comfortable reading measure for running text.`},{prefix:`--content-width-max`,purpose:`The widest a content region may grow.`},{prefix:`--transition-duration-`,purpose:`A motion duration step. Anything animated must respect prefers-reduced-motion.`}];function c(c){let l=[...e,...t,...n,...r,...i].find(e=>e.token===c);if(l)return{purpose:l.purpose,use:l.use,avoid:l.avoid};let u=c.match(/^--status-([a-z]+)-(.+)$/);if(u&&o[u[1]]&&a[u[2]]){let e=o[u[1]],t=a[u[2]];return{purpose:`${e.label} feedback: ${t}.${e.note?` ${e.note}`:``}`,avoid:`Decoration. A status role means state; a colour that carries no message belongs to the general --color-* family.`}}let d=s.find(e=>c.startsWith(e.prefix));return d?{purpose:d.purpose}:null}export{i as ACTION,t as BORDERS,n as CARD_EDGES,s as OTHER,a as STATUS_SLOTS,o as STATUS_TONES,e as SURFACES,r as TEXT,c as purposeOf};
2
- //# sourceMappingURL=token-purposes.js.map