@cagov/ca-ds 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +4 -2
  2. package/THIRD-PARTY-LICENSES.txt +690 -0
  3. package/ca-ds.js +48337 -0
  4. package/package.json +5 -31
  5. package/bin/ca-ds.js +0 -5
  6. package/src/cli/add.js +0 -134
  7. package/src/cli/build.js +0 -15
  8. package/src/cli/diff.js +0 -39
  9. package/src/cli/eject.js +0 -112
  10. package/src/cli/exit.js +0 -22
  11. package/src/cli/format.js +0 -52
  12. package/src/cli/init.js +0 -148
  13. package/src/cli/install.js +0 -178
  14. package/src/cli/items.js +0 -10
  15. package/src/cli/login.js +0 -331
  16. package/src/cli/main.js +0 -108
  17. package/src/cli/new.js +0 -230
  18. package/src/cli/outdated.js +0 -74
  19. package/src/cli/pack.js +0 -75
  20. package/src/cli/preview.js +0 -31
  21. package/src/cli/publish.js +0 -295
  22. package/src/cli/pull.js +0 -208
  23. package/src/cli/remote.js +0 -52
  24. package/src/cli/remove.js +0 -69
  25. package/src/cli/update.js +0 -223
  26. package/src/cli/validate.js +0 -131
  27. package/src/lib/browser.js +0 -12
  28. package/src/lib/build.js +0 -249
  29. package/src/lib/bundle.js +0 -148
  30. package/src/lib/catalog.js +0 -44
  31. package/src/lib/checks.js +0 -31
  32. package/src/lib/collection.js +0 -65
  33. package/src/lib/emblem.js +0 -29
  34. package/src/lib/fixtures.js +0 -59
  35. package/src/lib/floor.js +0 -79
  36. package/src/lib/glyph.js +0 -148
  37. package/src/lib/image.js +0 -138
  38. package/src/lib/json-text.js +0 -213
  39. package/src/lib/keys.js +0 -322
  40. package/src/lib/links.js +0 -321
  41. package/src/lib/markdown.js +0 -408
  42. package/src/lib/merge.js +0 -93
  43. package/src/lib/pack.js +0 -30
  44. package/src/lib/page-schema.js +0 -368
  45. package/src/lib/page.js +0 -372
  46. package/src/lib/patch.js +0 -9
  47. package/src/lib/regions.js +0 -173
  48. package/src/lib/registry.js +0 -371
  49. package/src/lib/release.js +0 -119
  50. package/src/lib/repoints.js +0 -120
  51. package/src/lib/resolve.js +0 -32
  52. package/src/lib/schema.js +0 -28
  53. package/src/lib/serial.js +0 -4
  54. package/src/lib/serialize.js +0 -444
  55. package/src/lib/structured.js +0 -72
  56. package/src/lib/system.js +0 -13
  57. package/src/lib/targets.js +0 -85
  58. package/src/lib/terms.js +0 -11
  59. package/src/lib/token-view.js +0 -289
  60. package/src/lib/tokens.js +0 -247
  61. package/src/lib/version.js +0 -34
  62. package/src/preview/frame.js +0 -75
  63. package/src/preview/pages.js +0 -128
  64. package/src/preview/screenshots.js +0 -72
  65. package/src/preview/server.js +0 -378
  66. package/src/preview/shell.js +0 -153
  67. package/src/schema/a11y.schema.json +0 -56
  68. package/src/schema/collection.lock.schema.json +0 -58
  69. package/src/schema/collection.schema.json +0 -65
  70. package/src/schema/composition.schema.json +0 -98
  71. package/src/schema/contract.schema.json +0 -116
  72. package/src/schema/interface.schema.json +0 -257
  73. package/src/schema/item.schema.json +0 -362
  74. package/src/schema/release.schema.json +0 -39
  75. package/src/schema/system.schema.json +0 -75
  76. package/src/schema/variants.schema.json +0 -60
  77. package/src/validate/collection.js +0 -19
  78. package/src/validate/collisions.js +0 -124
  79. package/src/validate/context.js +0 -357
  80. package/src/validate/facts.js +0 -253
  81. package/src/validate/files.js +0 -103
  82. package/src/validate/findings.js +0 -19
  83. package/src/validate/glyphs.js +0 -126
  84. package/src/validate/html.js +0 -215
  85. package/src/validate/imports.js +0 -29
  86. package/src/validate/index.js +0 -75
  87. package/src/validate/item.js +0 -47
  88. package/src/validate/links.js +0 -113
  89. package/src/validate/manifest.js +0 -147
  90. package/src/validate/media.js +0 -65
  91. package/src/validate/page.js +0 -74
  92. package/src/validate/prefixes.js +0 -58
  93. package/src/validate/relations.js +0 -310
  94. package/src/validate/release.js +0 -109
  95. package/src/validate/skill.js +0 -122
  96. package/src/validate/structured.js +0 -335
  97. package/src/validate/tasc.js +0 -80
  98. package/src/validate/template.js +0 -129
  99. package/src/validate/tokens.js +0 -154
  100. package/src/validate/zip.js +0 -40
  101. /package/{src/preview/preview.css → preview.css} +0 -0
@@ -1,368 +0,0 @@
1
- // Resolved data, never read from the interfaces, so the package reads no item. A package test holds each
2
- // entry to a subset of its item's interface. An entry left out on purpose names the rule or reason.
3
- //
4
- // A NODES entry: tag, slot, match (identity class), group, content (inline|text|empty|block|list-item, or
5
- // parts [{ nodes|group, min = 1, max = 1, null for no limit }]), except, attrs [{ name, kind, required }]
6
- // (kind: an array of values, or boolean|text|id|integer|url|media|blank), classes (groups, one class each),
7
- // item, atom, viewOnly, mark, site.
8
- // viewOnly attributes render as data-* in the editor's view, since the real one would change the view while
9
- // it's edited.
10
-
11
- const ROLES = [
12
- 'ca-text-default',
13
- 'ca-text-heading-0',
14
- 'ca-text-heading-1',
15
- 'ca-text-heading-2',
16
- 'ca-text-heading-3',
17
- 'ca-text-heading-4',
18
- 'ca-text-heading-5',
19
- 'ca-text-heading-6',
20
- 'ca-text-content-large',
21
- 'ca-text-content-default',
22
- 'ca-text-content-small',
23
- 'ca-text-caption-large',
24
- 'ca-text-caption-default',
25
- 'ca-text-caption-small',
26
- 'ca-text-label-default',
27
- 'ca-text-label-small',
28
- ];
29
- const ALIGN = ['ca-text-align-start', 'ca-text-align-center', 'ca-text-align-end', 'ca-text-align-justify'];
30
- const TEXT_CLASSES = [ROLES, ['ca-lede'], ['ca-font-sans'], ['ca-font-weight-regular', 'ca-font-weight-medium', 'ca-font-weight-semibold'], ALIGN];
31
-
32
- const WRAPPER_CLASSES = [['ca-prose'], ALIGN];
33
-
34
- const BUTTON_CLASSES = [['ca-button-ghost', 'ca-button-subtle', 'ca-button-outline'], ['ca-button-soft']];
35
-
36
- // icon.css's glyphs alone: a page carries no stylesheet to register another Material Symbols id.
37
- const GLYPHS = [
38
- 'menu',
39
- 'menu_open',
40
- 'search',
41
- 'person',
42
- 'expand_more',
43
- 'vertical_align_top',
44
- 'info',
45
- 'check_circle',
46
- 'warning',
47
- 'report',
48
- 'expand_circle_right',
49
- 'close',
50
- 'unfold_more',
51
- 'arrow_upward',
52
- 'arrow_downward',
53
- 'arrow_forward',
54
- 'chevron_left',
55
- 'chevron_right',
56
- 'first_page',
57
- 'last_page',
58
- 'account_balance',
59
- 'lock',
60
- ];
61
-
62
- const integers = (from, to) => Array.from({ length: to - from + 1 }, (_, i) => String(from + i));
63
-
64
- const CONTAINER_ATTRS = [
65
- { name: 'align', kind: ['start', 'center', 'end'] },
66
- { name: 'size', kind: ['small', 'medium', 'large', 'full'] },
67
- { name: 'columns', kind: integers(1, 5) },
68
- { name: 'grid', kind: 'boolean' },
69
- { name: 'gap', kind: integers(0, 10) },
70
- { name: 'gap-x', kind: integers(0, 10) },
71
- { name: 'gap-y', kind: integers(0, 10) },
72
- { name: 'bleed', kind: 'boolean' },
73
- ];
74
-
75
- const HEADING = (level) => ({ tag: `h${level}`, group: 'block', content: 'inline', attrs: [{ name: 'id', kind: 'id' }], classes: TEXT_CLASSES });
76
- const WRAPPER = (tag) => ({ tag, group: 'block', content: 'block', classes: WRAPPER_CLASSES });
77
-
78
- // Rendered by the docs site at request time, as text alone.
79
- export const SERVER_VALUE = 'cads-value';
80
- export const SERVER_VALUE_NAMES = ['component-count', 'tokens-count', 'template-count', 'guidance-count', 'skill-count', 'media-count', 'latest-release'];
81
-
82
- export const SITE_ICONS = ['components', 'tokens', 'templates', 'guidance', 'skills', 'media', 'releases', 'bundles'].map((name) => `/icons/${name}.svg`);
83
-
84
- export const NODES = {
85
- // Marks, outermost first, so a link never splits.
86
- link: {
87
- tag: 'a',
88
- group: 'inline',
89
- mark: true,
90
- content: 'inline',
91
- attrs: [
92
- { name: 'href', kind: 'url', required: true },
93
- { name: 'data-card-target', kind: 'boolean' },
94
- ],
95
- },
96
- strong: { tag: 'strong', group: 'inline', mark: true, content: 'inline' },
97
- em: { tag: 'em', group: 'inline', mark: true, content: 'inline' },
98
- code: { tag: 'code', group: 'inline', mark: true, content: 'inline' },
99
- break: { tag: 'br', group: 'inline', content: 'empty' },
100
-
101
- paragraph: { tag: 'p', group: 'block', content: 'inline', classes: TEXT_CLASSES },
102
- h1: HEADING(1),
103
- h2: HEADING(2),
104
- h3: HEADING(3),
105
- h4: HEADING(4),
106
- h5: HEADING(5),
107
- h6: HEADING(6),
108
- 'bullet-list': { tag: 'ul', group: 'block', content: [{ nodes: ['list-item'], max: null }], attrs: [{ name: 'role', kind: ['list'] }] },
109
- 'ordered-list': { tag: 'ol', group: 'block', content: [{ nodes: ['list-item'], max: null }], attrs: [{ name: 'start', kind: 'integer' }] },
110
- 'list-item': { tag: 'li', content: 'list-item' },
111
- blockquote: { tag: 'blockquote', group: 'block', content: 'block' },
112
- div: WRAPPER('div'),
113
- section: WRAPPER('section'),
114
- article: WRAPPER('article'),
115
- aside: WRAPPER('aside'),
116
-
117
- // No srcset, so the page checklist's bare-image-sizes rule holds.
118
- image: {
119
- tag: 'img',
120
- group: 'block',
121
- content: 'empty',
122
- atom: true,
123
- attrs: [
124
- { name: 'src', kind: 'media', required: true },
125
- { name: 'alt', kind: 'text', required: true },
126
- { name: 'width', kind: 'integer' },
127
- { name: 'height', kind: 'integer' },
128
- ],
129
- },
130
- figure: { tag: 'figure', group: 'block', content: [{ nodes: ['image'] }, { nodes: ['figcaption'], min: 0 }] },
131
- figcaption: { tag: 'figcaption', content: 'inline', classes: TEXT_CLASSES },
132
-
133
- divider: { tag: 'hr', group: 'block', content: 'empty', atom: true },
134
-
135
- icon: {
136
- tag: 'ca-icon',
137
- group: 'inline',
138
- content: 'empty',
139
- atom: true,
140
- item: 'standard/icon',
141
- attrs: [
142
- { name: 'name', kind: GLYPHS },
143
- { name: 'size', kind: ['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'] },
144
- { name: 'trim', kind: 'boolean' },
145
- { name: 'role', kind: ['img'] },
146
- { name: 'aria-label', kind: 'text' },
147
- ],
148
- },
149
-
150
- // No disabled link, since a page's button links navigate: link-has-destination.
151
- 'button-link': {
152
- tag: 'a',
153
- match: 'ca-button',
154
- group: 'block',
155
- content: 'inline',
156
- except: ['link'],
157
- item: 'standard/button',
158
- attrs: [{ name: 'href', kind: 'url', required: true }],
159
- classes: BUTTON_CLASSES,
160
- },
161
-
162
- // Inline presentations alone (sitewide-in-alert-row), no multiple or miscellaneous intent
163
- // (multiple-sitewide-only, intent-settled), and no revealed, which the script sets.
164
- alert: {
165
- tag: 'ca-alert',
166
- group: 'block',
167
- item: 'standard/alert',
168
- attrs: [
169
- { name: 'presentation', kind: ['inline-content', 'inline-form'], required: true },
170
- { name: 'intent', kind: ['information', 'success', 'warning', 'error'], required: true },
171
- { name: 'dismissible', kind: 'boolean' },
172
- { name: 'data-alert-key', kind: 'text' },
173
- { name: 'id', kind: 'id' },
174
- ],
175
- // A dismissible alert starts hidden, and the script would add its button to the view.
176
- viewOnly: ['dismissible'],
177
- content: [{ nodes: ['alert-icon'] }, { nodes: ['alert-title'] }, { nodes: ['alert-body-paragraph', 'alert-body-list'], min: 0 }, { nodes: ['alert-dismiss'], min: 0 }],
178
- },
179
- 'alert-icon': { tag: 'ca-icon', slot: 'alert-icon', content: 'empty', atom: true, item: 'standard/icon' },
180
- 'alert-title': { tag: 'p', slot: 'alert-title', content: 'inline', item: 'standard/alert' },
181
- 'alert-body-paragraph': { tag: 'p', slot: 'alert-body', content: 'inline', item: 'standard/alert' },
182
- 'alert-body-list': { tag: 'ul', slot: 'alert-body', content: [{ nodes: ['list-item'], max: null }], item: 'standard/alert' },
183
- 'alert-dismiss': {
184
- tag: 'button',
185
- slot: 'alert-dismiss',
186
- atom: true,
187
- item: 'standard/alert',
188
- attrs: [{ name: 'type', kind: ['button'], required: true }],
189
- content: [{ nodes: ['dismiss-icon'] }, { nodes: ['hidden-label'] }],
190
- },
191
- 'dismiss-icon': { tag: 'ca-icon', content: 'empty', item: 'standard/icon', attrs: [{ name: 'name', kind: ['close'], required: true }] },
192
- 'hidden-label': { tag: 'span', match: 'ca-visually-hidden', content: 'text', item: 'standard/visually-hidden' },
193
-
194
- accordion: {
195
- tag: 'ca-accordion',
196
- group: 'block',
197
- item: 'standard/accordion',
198
- attrs: [{ name: 'surface', kind: ['outlined', 'shaded'] }],
199
- content: [{ nodes: ['accordion-item'], max: null }],
200
- },
201
- 'accordion-item': {
202
- tag: 'details',
203
- item: 'standard/accordion',
204
- attrs: [
205
- { name: 'name', kind: 'text' },
206
- { name: 'open', kind: 'boolean' },
207
- ],
208
- // A named group closes its siblings, so the view holds every item open.
209
- viewOnly: ['name', 'open'],
210
- content: [{ nodes: ['accordion-summary'] }, { group: 'block', max: null, except: ['accordion'] }],
211
- },
212
- 'accordion-summary': { tag: 'summary', content: 'text', item: 'standard/accordion' },
213
-
214
- card: {
215
- tag: 'ca-card',
216
- group: 'block',
217
- item: 'standard/card',
218
- attrs: [
219
- { name: 'surface', kind: ['tinted', 'outlined', 'bare', 'promo', 'promo-inverse'] },
220
- { name: 'elevated', kind: 'boolean' },
221
- { name: 'orientation', kind: ['vertical', 'horizontal'] },
222
- { name: 'media', kind: ['bleed', 'inset'] },
223
- { name: 'media-fit', kind: ['cover', 'contain', 'fill'] },
224
- { name: 'interactive', kind: 'boolean' },
225
- ],
226
- content: [{ nodes: ['card-media'], min: 0 }, { nodes: ['card-content'] }, { nodes: ['card-footer-link', 'card-footer-button', 'card-footer-indicator'], min: 0 }],
227
- },
228
- 'card-media': {
229
- tag: 'img',
230
- slot: 'card-media',
231
- content: 'empty',
232
- atom: true,
233
- item: 'standard/card',
234
- attrs: [
235
- { name: 'src', kind: 'media', required: true },
236
- { name: 'alt', kind: 'text', required: true },
237
- ],
238
- },
239
- 'card-content': { tag: 'div', slot: 'card-content', content: [{ nodes: ['site-icon'], min: 0 }, { group: 'block', max: null, except: ['card'] }], item: 'standard/card' },
240
- // Decorative, since the card's title names the thing.
241
- 'site-icon': {
242
- tag: 'img',
243
- match: 'card-icon',
244
- content: 'empty',
245
- atom: true,
246
- site: true,
247
- attrs: [
248
- { name: 'src', kind: SITE_ICONS, required: true },
249
- { name: 'width', kind: 'integer' },
250
- { name: 'height', kind: 'integer' },
251
- { name: 'alt', kind: 'blank', required: true },
252
- ],
253
- },
254
- 'card-footer-link': { tag: 'a', slot: 'card-footer', content: 'inline', except: ['link'], item: 'standard/card', attrs: [{ name: 'href', kind: 'url', required: true }] },
255
- 'card-footer-button': {
256
- tag: 'a',
257
- slot: 'card-footer',
258
- match: 'ca-button',
259
- content: 'inline',
260
- except: ['link'],
261
- item: 'standard/button',
262
- attrs: [{ name: 'href', kind: 'url', required: true }],
263
- classes: BUTTON_CLASSES,
264
- },
265
- 'card-footer-indicator': { tag: 'div', slot: 'card-footer', atom: true, item: 'standard/card', content: [{ nodes: ['indicator-icon'] }, { nodes: ['indicator-label'], min: 0 }] },
266
- 'indicator-icon': { tag: 'ca-icon', content: 'empty', item: 'standard/icon' },
267
- 'indicator-label': { tag: 'span', content: 'text', item: 'standard/card' },
268
-
269
- // No .ca-table-stacked, which needs a role on every part and a data-label on every cell, and no
270
- // <ca-enhanced-table>, which sorts and expands by script.
271
- 'table-scroll': {
272
- tag: 'ca-table-scroll',
273
- group: 'block',
274
- item: 'standard/table',
275
- attrs: [{ name: 'sticky-header', kind: 'boolean' }],
276
- content: [{ nodes: ['table'] }],
277
- },
278
- table: {
279
- tag: 'table',
280
- group: 'block',
281
- classes: [['ca-table-banded'], ['ca-table-divided'], ['ca-table-bordered'], ['ca-table-hover']],
282
- content: [{ nodes: ['caption'] }, { nodes: ['table-head'], min: 0 }, { nodes: ['table-body'], max: null }, { nodes: ['table-foot'], min: 0 }],
283
- },
284
- caption: { tag: 'caption', content: 'inline' },
285
- 'table-head': { tag: 'thead', content: [{ nodes: ['row'], max: null }] },
286
- 'table-body': { tag: 'tbody', content: [{ nodes: ['row'], max: null }] },
287
- 'table-foot': { tag: 'tfoot', content: [{ nodes: ['row'], max: null }] },
288
- row: { tag: 'tr', content: [{ nodes: ['header-cell', 'cell'], max: null }] },
289
- 'header-cell': {
290
- tag: 'th',
291
- content: 'inline',
292
- classes: [ALIGN],
293
- attrs: [
294
- { name: 'scope', kind: ['col', 'colgroup', 'row', 'rowgroup'], required: true },
295
- { name: 'colspan', kind: 'integer' },
296
- { name: 'rowspan', kind: 'integer' },
297
- ],
298
- },
299
- cell: {
300
- tag: 'td',
301
- content: 'inline',
302
- classes: [ALIGN],
303
- attrs: [
304
- { name: 'colspan', kind: 'integer' },
305
- { name: 'rowspan', kind: 'integer' },
306
- ],
307
- },
308
-
309
- container: {
310
- tag: 'ca-container',
311
- group: 'block',
312
- item: 'standard/container',
313
- attrs: CONTAINER_ATTRS,
314
- content: 'block',
315
- },
316
-
317
- // No group, since TOP alone holds it. No untreated overlay, whose rule asks for a contrast measurement.
318
- hero: {
319
- tag: 'ca-hero',
320
- item: 'standard/hero',
321
- attrs: [
322
- { name: 'treatment', kind: ['plain', 'image', 'split'] },
323
- { name: 'overlay', kind: ['scrim', 'box', 'glass', 'glass-inverse'] },
324
- ],
325
- content: [{ nodes: ['hero-image'], min: 0 }, { nodes: ['hero-content'] }],
326
- },
327
- 'hero-image': {
328
- tag: 'img',
329
- slot: 'hero-image',
330
- content: 'empty',
331
- atom: true,
332
- item: 'standard/hero',
333
- attrs: [
334
- { name: 'src', kind: 'media', required: true },
335
- { name: 'alt', kind: 'blank', required: true },
336
- ],
337
- },
338
- 'hero-content': {
339
- tag: 'div',
340
- slot: 'hero-content',
341
- item: 'standard/hero',
342
- classes: [['ca-prose']],
343
- content: [{ nodes: ['h1'] }, { nodes: ['paragraph'], min: 0 }, { nodes: ['button-link'], min: 0 }],
344
- },
345
-
346
- // The shell keeps the footer's branding and attribution line.
347
- 'footer-links': {
348
- tag: 'nav',
349
- match: 'ca-footer-links',
350
- group: 'block',
351
- item: 'standard/footer',
352
- attrs: [{ name: 'aria-label', kind: 'text', required: true }],
353
- content: 'block',
354
- },
355
- 'footer-group': { tag: 'div', match: 'ca-footer-group', group: 'block', item: 'standard/footer', content: 'block' },
356
- 'footer-legal': { tag: 'div', match: 'ca-footer-legal', group: 'block', item: 'standard/footer', content: 'block' },
357
-
358
- 'server-value': {
359
- tag: SERVER_VALUE,
360
- group: 'inline',
361
- content: 'empty',
362
- atom: true,
363
- site: true,
364
- attrs: [{ name: 'name', kind: SERVER_VALUE_NAMES, required: true }],
365
- },
366
- };
367
-
368
- export const TOP = [{ nodes: ['hero'], min: 0 }, { group: 'block', min: 0, max: null }];