@tempoxyz/ds 0.3.15 → 0.3.17

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 (130) hide show
  1. package/dist/docs/AGENTS.md +10 -6
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/marketing.md +703 -4
  4. package/dist/docs/product/components/actions.md +53 -1
  5. package/dist/docs/product/components/blockchain.md +147 -3
  6. package/dist/docs/product/components/feedback-and-status.md +137 -7
  7. package/dist/docs/product/components/navigation.md +1 -1
  8. package/dist/docs/product/documents.md +225 -0
  9. package/dist/docs/product/foundations.md +2 -1
  10. package/dist/docs/product/patterns.md +3 -22
  11. package/dist/document/Document.d.ts +46 -0
  12. package/dist/document/Document.d.ts.map +1 -0
  13. package/dist/document/Document.js +190 -0
  14. package/dist/document/Document.js.map +1 -0
  15. package/dist/document/Enhance.d.ts +13 -0
  16. package/dist/document/Enhance.d.ts.map +1 -0
  17. package/dist/document/Enhance.js +421 -0
  18. package/dist/document/Enhance.js.map +1 -0
  19. package/dist/document/bin.d.ts +3 -0
  20. package/dist/document/bin.d.ts.map +1 -0
  21. package/dist/document/bin.js +38 -0
  22. package/dist/document/bin.js.map +1 -0
  23. package/dist/document/document.css +373 -0
  24. package/dist/document/index.d.ts +3 -0
  25. package/dist/document/index.d.ts.map +1 -0
  26. package/dist/document/index.js +3 -0
  27. package/dist/document/index.js.map +1 -0
  28. package/dist/document/internal/Cli.d.ts +43 -0
  29. package/dist/document/internal/Cli.d.ts.map +1 -0
  30. package/dist/document/internal/Cli.js +87 -0
  31. package/dist/document/internal/Cli.js.map +1 -0
  32. package/dist/document/internal/Template.d.ts +21 -0
  33. package/dist/document/internal/Template.d.ts.map +1 -0
  34. package/dist/document/internal/Template.js +15 -0
  35. package/dist/document/internal/Template.js.map +1 -0
  36. package/dist/document/script.d.ts +2 -0
  37. package/dist/document/script.d.ts.map +1 -0
  38. package/dist/document/script.js +379 -0
  39. package/dist/document/templates/brief.html +96 -0
  40. package/dist/document/templates/essay.html +70 -0
  41. package/dist/document/templates/post.html +69 -0
  42. package/dist/marketing/index.js.zyzz.json +1 -1
  43. package/dist/marketing/vars.d.ts +618 -758
  44. package/dist/marketing/vars.d.ts.map +1 -1
  45. package/dist/marketing/vars.js +8 -5
  46. package/dist/marketing/vars.js.map +1 -1
  47. package/dist/marketing/vars.js.zyzz.json +1 -1
  48. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  49. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  50. package/dist/marketing/zyzz.config.js +1 -1
  51. package/dist/marketing/zyzz.config.js.map +1 -1
  52. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  53. package/dist/mobile/components/Button.d.ts +115 -15
  54. package/dist/mobile/components/Button.d.ts.map +1 -1
  55. package/dist/mobile/components/Button.js +85 -14
  56. package/dist/mobile/components/Button.js.map +1 -1
  57. package/dist/mobile/components/IconButton.d.ts +129 -40
  58. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  59. package/dist/mobile/components/IconButton.js +97 -28
  60. package/dist/mobile/components/IconButton.js.map +1 -1
  61. package/dist/mobile/components/TextInput.d.ts +132 -11
  62. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  63. package/dist/mobile/components/TextInput.js +115 -14
  64. package/dist/mobile/components/TextInput.js.map +1 -1
  65. package/dist/mobile/index.d.ts +1 -0
  66. package/dist/mobile/index.d.ts.map +1 -1
  67. package/dist/mobile/index.js +1 -0
  68. package/dist/mobile/index.js.map +1 -1
  69. package/dist/mobile/vars.d.ts +103 -0
  70. package/dist/mobile/vars.d.ts.map +1 -1
  71. package/dist/mobile/vars.js +74 -0
  72. package/dist/mobile/vars.js.map +1 -1
  73. package/dist/mobile/zyzz.config.d.ts +408 -0
  74. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  75. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  76. package/dist/web/components/Amount.css +1 -1
  77. package/dist/web/components/Amount.d.ts +9 -0
  78. package/dist/web/components/Amount.d.ts.map +1 -1
  79. package/dist/web/components/Amount.js +8 -5
  80. package/dist/web/components/Amount.js.map +1 -1
  81. package/dist/web/components/Amount.js.zyzz.json +1 -1
  82. package/dist/web/components/CopyButton.d.ts +6 -0
  83. package/dist/web/components/CopyButton.d.ts.map +1 -1
  84. package/dist/web/components/CopyButton.js +4 -1
  85. package/dist/web/components/CopyButton.js.map +1 -1
  86. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  87. package/dist/web/components/Hex.css +1 -1
  88. package/dist/web/components/Hex.d.ts +84 -3
  89. package/dist/web/components/Hex.d.ts.map +1 -1
  90. package/dist/web/components/Hex.js +20 -13
  91. package/dist/web/components/Hex.js.map +1 -1
  92. package/dist/web/components/Hex.js.zyzz.json +1 -1
  93. package/dist/web/components/Progress.css +1 -1
  94. package/dist/web/components/Progress.d.ts +12 -2
  95. package/dist/web/components/Progress.d.ts.map +1 -1
  96. package/dist/web/components/Progress.js +9 -5
  97. package/dist/web/components/Progress.js.map +1 -1
  98. package/dist/web/components/Progress.js.zyzz.json +1 -1
  99. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  100. package/dist/web/components/SidebarMenu.d.ts +4 -4
  101. package/dist/web/components/SidebarMenu.js +6 -6
  102. package/dist/web/components/SidebarMenu.js.map +1 -1
  103. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  104. package/dist/web/index.js.zyzz.json +1 -1
  105. package/package.json +19 -1
  106. package/src/document/Document.ts +277 -0
  107. package/src/document/Enhance.ts +434 -0
  108. package/src/document/bin.ts +38 -0
  109. package/src/document/document.css +373 -0
  110. package/src/document/index.ts +2 -0
  111. package/src/document/internal/Cli.ts +132 -0
  112. package/src/document/internal/Template.ts +25 -0
  113. package/src/document/script.ts +8 -0
  114. package/src/document/templates/brief.html +96 -0
  115. package/src/document/templates/essay.html +70 -0
  116. package/src/document/templates/post.html +69 -0
  117. package/src/marketing/README.md +1 -1
  118. package/src/marketing/vars.ts +526 -604
  119. package/src/marketing/zyzz.config.ts +5 -4
  120. package/src/mobile/README.md +19 -6
  121. package/src/mobile/components/Button.tsx +94 -17
  122. package/src/mobile/components/IconButton.tsx +122 -30
  123. package/src/mobile/components/TextInput.tsx +139 -24
  124. package/src/mobile/index.ts +1 -0
  125. package/src/mobile/vars.ts +74 -0
  126. package/src/web/components/Amount.tsx +37 -3
  127. package/src/web/components/CopyButton.tsx +8 -0
  128. package/src/web/components/Hex.tsx +79 -13
  129. package/src/web/components/Progress.tsx +8 -2
  130. package/src/web/components/SidebarMenu.tsx +6 -6
@@ -0,0 +1,225 @@
1
+ # Documents
2
+
3
+ Each section below is one page of the documentation at ds.tehq.dev.
4
+
5
+ ## Contents
6
+
7
+ - [Documents](#documents): Plain HTML documents that agents write, styled by one stylesheet and script.
8
+
9
+ ## Documents
10
+
11
+ Plain HTML documents that agents write, styled by one stylesheet and script.
12
+
13
+ ### Overview
14
+
15
+ Document mode styles long documents that an agent writes as plain HTML, such as essays, briefs, and posts. A document links the stylesheet and the script from the package and uses semantic elements with a few classes. It needs no React and no Zyzz compiler, so it is the one place the package ships a stylesheet. The stylesheet is generated from the Web variables, so its colors, type, radius, shadow, and easing match the Product system in the light and dark schemes.
16
+
17
+ The text sits in one 40rem column. Figures and tables can spread wider in four symmetric widths. A document reads in full without the script, which adds footnote popovers, heading links, copy buttons on code, and each template's navigation.
18
+
19
+ ### Write a Document
20
+
21
+ Start from a template, fill it in, and publish it once the lint passes.
22
+
23
+ 1. Write a starter template. Pick `essay`, `brief`, or `post`, and pass a path to name the file. Init does not overwrite a file. The package also ships the templates in `dist/document/templates/`.
24
+
25
+ ```sh
26
+ npx -p @tempoxyz/ds@latest tempo-document init brief
27
+ ```
28
+
29
+ 2. Replace the content that each comment marks. Keep the structure, and use the templates, widths, and blocks below.
30
+
31
+ 3. Run the lint, and fix each line that it prints. It prints `file:line: rule message` for each problem and exits with 1, or exits with 0 when the document is clean.
32
+
33
+ ```sh
34
+ npx -p @tempoxyz/ds@latest tempo-document lint brief.html
35
+ ```
36
+
37
+ 4. Publish the HTML file as is, for example on Slate. It loads the stylesheet, the script, and the fonts from jsDelivr.
38
+
39
+ #### Link the Files
40
+
41
+ A template links the stylesheet and the script on jsDelivr at the exact version that wrote it, so a published page does not change when the package does. `VERSION` stands for that version, such as `0.3.17`.
42
+
43
+ ```html title="document.html"
44
+ <link
45
+ rel="stylesheet"
46
+ href="https://cdn.jsdelivr.net/npm/@tempoxyz/ds@VERSION/dist/document/document.css"
47
+ />
48
+ <script
49
+ defer
50
+ src="https://cdn.jsdelivr.net/npm/@tempoxyz/ds@VERSION/dist/document/script.js"
51
+ ></script>
52
+ ```
53
+
54
+ The script is one classic script with no imports, so a document also runs when you open the file directly. In an app that installs the package, link the same files from `node_modules/@tempoxyz/ds/dist/document/`, or import `@tempoxyz/ds/document.css` and `@tempoxyz/ds/document.js` through a bundler. Keep the `fonts` folder beside `document` when you copy the files, because the stylesheet loads Inter, Pilat, and JetBrains Mono from `../fonts/`.
55
+
56
+ To check a document in code, call the lint with `page` to include the head links.
57
+
58
+ ```ts title="check.ts"
59
+ import { Document } from '@tempoxyz/ds/document'
60
+
61
+ const diagnostics = Document.lint(html, { page: true })
62
+ ```
63
+
64
+ ### Templates
65
+
66
+ Set the template with `data-template` on `article.doc`.
67
+
68
+ #### Essay
69
+
70
+ One column for arguments and write-ups read from top to bottom. Add `data-rail` for a reading progress rail with a tick for each H2. On a phone the rail becomes a thin bar at the top.
71
+
72
+ #### Brief
73
+
74
+ A column with a sticky summary on the right, for plans, reviews, and status. Wrap the page in `div.brief` with a `header`, the `article.doc`, and an `aside.summary` that holds a `dl.facts` and a `nav` of section links. The script marks the section in view. On a phone the summary moves above the text and the links hide.
75
+
76
+ ```html title="brief.html"
77
+ <div class="brief">
78
+ <header>
79
+ <h1>Title</h1>
80
+ <p class="dek">What was decided.</p>
81
+ </header>
82
+ <article class="doc" data-template="brief">…</article>
83
+ <aside class="summary">
84
+ <dl class="facts">
85
+ <div>
86
+ <dt>Owner</dt>
87
+ <dd>Design Systems</dd>
88
+ </div>
89
+ </dl>
90
+ <nav aria-label="Contents">
91
+ <h2>Contents</h2>
92
+ <ol>
93
+ <li><a href="#plan">Plan</a></li>
94
+ </ol>
95
+ </nav>
96
+ </aside>
97
+ </div>
98
+ ```
99
+
100
+ #### Post
101
+
102
+ One plain column with a byline, for blog posts and guides. Number steps with `ol.steps`.
103
+
104
+ ### Values
105
+
106
+ | Part | Style |
107
+ | --------------------------- | -------------------------------- |
108
+ | Title, `h1` | heading.h2, Pilat |
109
+ | Section, `h2` | heading.h3, Pilat |
110
+ | Subsection, `h3` | body.b2Strong, Inter 14px medium |
111
+ | Lead, `.dek` | body.b1 |
112
+ | Body text and table cells | body.b2, 14px on a 22px line |
113
+ | Captions, notes, and labels | body.b3, 12px on a 16px line |
114
+ | Byline and code | mono.m1, JetBrains Mono |
115
+ | Text column | 40rem |
116
+
117
+ #### Widths
118
+
119
+ Every block sits in the body column unless a class spreads it. The widths are symmetric around the column.
120
+
121
+ | Class | Width |
122
+ | ---------- | -------------------------------------- |
123
+ | `l-body` | The 40rem column. This is the default. |
124
+ | `l-outset` | The column and 3rem on each side. |
125
+ | `l-page` | The column and 6rem on each side. |
126
+ | `l-screen` | The full width of the window. |
127
+
128
+ ### Blocks
129
+
130
+ Write each block from semantic HTML. The stylesheet styles the elements, so most blocks need no class.
131
+
132
+ | Block | Markup |
133
+ | ------------- | --------------------------------------------------------------------------------------------------- |
134
+ | Figure | `figure` with an image or inline `svg`, and a `figcaption` that states the takeaway |
135
+ | Diagram | Inline `svg` with `ink`, `hair`, `label`, `meta`, `fill-ink`, `fill-quiet`, and `fill-line` |
136
+ | Chart | `figure.chart` with an optional `ul.chart-key`, and a `div.chart-scroll` around a `div.chart-plot` |
137
+ | Table | `table` with `thead`, `tbody`, and an optional `caption`. Mark number cells `n`. |
138
+ | Scope table | `table.kv` with a `th scope="row"` per row |
139
+ | Results table | `table.results` with a `td.outcome` per row |
140
+ | Quote | `blockquote` with an optional `footer`. Use `blockquote.input` with `data-label` to quote an input. |
141
+ | Big numbers | `dl.figures` with two to four `div`s of `dt` and `dd` |
142
+ | Code | `pre > code`. The script adds a copy button. |
143
+ | Note | `span.sn > small` after the words it explains |
144
+ | Chronology | `ol.chronology` with a `time` and a `p` per item |
145
+ | Axis | `ol.axis` with `data-start` and `data-end`, and items marked `phase` or `minor` |
146
+ | Aside | `p.note` between two rules |
147
+
148
+ #### Notes
149
+
150
+ A note is a footnote. The script numbers it, opens it in a popover on hover, tap, or Enter, and lists every note at the end. Escape closes the popover and returns focus to the number. Without the script a note reads inline, in parentheses.
151
+
152
+ ```html
153
+ <p>
154
+ The widths follow Distill.<span class="sn"
155
+ ><small>Distill names them l-body, l-page, and l-screen.</small></span
156
+ >
157
+ </p>
158
+ ```
159
+
160
+ #### Code
161
+
162
+ The script adds a Copy button to the top right of each `pre`, named Copy code for assistive technology. It copies the code's text, shows Copied, announces it, and then reverts. The block keeps room on the right so the button never covers the first line, and long lines still scroll.
163
+
164
+ #### Charts
165
+
166
+ A chart stays inside its block and never breaks the grid. Bars shrink with the block down to a minimum width. Past that, the plot scrolls inside its block. Set `--bars` on the plot to the number of bars, and name the scroll region.
167
+
168
+ ```html
169
+ <figure class="chart l-page" data-series="2">
170
+ <ul class="chart-key">
171
+ <li><span class="swatch" aria-hidden="true"></span>Publishes</li>
172
+ <li><span class="swatch fill-quiet" aria-hidden="true"></span>Releases</li>
173
+ </ul>
174
+ <div class="chart-scroll" role="region" tabindex="0" aria-label="Publishes per day">
175
+ <div class="chart-plot" style="--bars: 42">
176
+ <svg viewBox="0 0 1260 120" preserveAspectRatio="none" role="img" aria-label="…">…</svg>
177
+ </div>
178
+ </div>
179
+ <figcaption>Publishes peaked at 214 on Oct 21.</figcaption>
180
+ </figure>
181
+ ```
182
+
183
+ ### Guidelines
184
+
185
+ #### When to Use
186
+
187
+ Use document mode for a document an agent writes as a standalone HTML page, such as a proposal, a brief, a review, or a post.
188
+
189
+ #### When Not to Use
190
+
191
+ Do not use it for app screens or pages that present Tempo. Build an app screen with the components on [Getting Started](foundations.md#getting-started), and a marketing page with the [Marketing](../marketing.md#getting-started) system.
192
+
193
+ #### State the Takeaway in Each Caption
194
+
195
+ Write each `figcaption` as the conclusion a reader should draw, followed by the source in parentheses.
196
+
197
+ #### Keep Charts in the Grid
198
+
199
+ Give a chart `l-body`, `l-outset`, or `l-page`, never `l-screen`. Give a chart with more than one series a `ul.chart-key` and set `data-series` on the figure.
200
+
201
+ #### Write Text, Not Interface
202
+
203
+ Do not use chips, badges, cards, tabs, `details`, colored callouts, or headings below H3. Write a status as a word in a table cell, and a set of options as a list.
204
+
205
+ #### Run the Lint
206
+
207
+ `Document.lint` and `tempo-document lint` return a diagnostic for each H4 to H6, class outside the contract, figure without a caption, chart at screen width, chart with several series and no key, unnamed chart scroll region, and chip, badge, card, tab, or `details` markup. The command also reports a head that does not link the stylesheet and the script. It reads tags with a small scanner, so it does not see markup that a script builds at runtime.
208
+
209
+ ### Accessibility
210
+
211
+ The script names every control it adds. Footnote numbers are buttons named Note 1, Note 2, and so on, and Escape closes an open note. Heading links are named Copy link to the heading. Copy buttons are named Copy code and announce Copied in a live region. The stylesheet removes transitions and the press scale when the reader prefers reduced motion. Give each `svg` a `role="img"` and a name, and each chart scroll region `role="region"`, `tabindex="0"`, and a name, so a keyboard can scroll it.
212
+
213
+ ### Related
214
+
215
+ [Typography](foundations.md#typography)
216
+
217
+ Covers the type sets that documents use.
218
+
219
+ [Color](foundations.md#color)
220
+
221
+ Covers the light and dark tokens that the stylesheet reads.
222
+
223
+ [Agents](foundations.md#agents)
224
+
225
+ Covers the rules that coding agents follow.
@@ -4481,7 +4481,7 @@ Web components render DOM elements and compile with a Zyzz bundler plugin. Mobil
4481
4481
 
4482
4482
  #### Do I Need to Import a Stylesheet?
4483
4483
 
4484
- No. The library publishes no stylesheet.
4484
+ No. An app imports no stylesheet. The library publishes one only for [Documents](documents.md#documents), plain HTML pages that have no build.
4485
4485
 
4486
4486
  * **Vite:** The [Vite plugin](#setup) emits the variables, the Inter, Pilat, and JetBrains Mono fonts, and keyframes once. Each component emits its own rules, so a build carries only the styles it uses.
4487
4487
  * **Rollup, Webpack, and esbuild:** The adapters emit a generated `/zyzz.css` that you load once.
@@ -4572,6 +4572,7 @@ The Figma files define every variable, icon, and component:
4572
4572
 
4573
4573
  * [TPDS 1.0 Platform](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs/TPDS-1.0-Platform) for Web variables and components
4574
4574
  * [TDS Platform](https://www.figma.com/design/pcO4NIuw8wx9U2nGJOcjzE) for Web icons
4575
+ * [DS Marketing](https://www.figma.com/design/EzqxuHd13VX6h1pGsch9hu/DS-Marketing) for Marketing variables
4575
4576
  * [TDS App](https://www.figma.com/design/8iu5856rBEI3pnZ6YaIBgw) for Mobile, whose families the mobile components implement
4576
4577
 
4577
4578
  ### Docs
@@ -493,16 +493,6 @@ const balances = [
493
493
  ['USDT0', '0x20c00000000000000000000014f22ca97301eb73', '12.25'],
494
494
  ] as const
495
495
 
496
- // One fixed mask for every amount, so hidden values reveal neither their size nor their digits.
497
- function Hidden() {
498
- return (
499
- <span>
500
- <span aria-hidden="true">••••••</span>
501
- <span {...styles.hidden()}>Hidden</span>
502
- </span>
503
- )
504
- }
505
-
506
496
  export function Demo() {
507
497
  const [hidden, setHidden] = useState(false)
508
498
 
@@ -522,14 +512,14 @@ export function Demo() {
522
512
  </Button>
523
513
  </Surface.Header>
524
514
  <div {...styles.total()}>
525
- {hidden ? <Hidden /> : <Amount currency="USD" size="xl" value="2097.75" />}
515
+ <Amount currency="USD" masked={hidden} size="xl" value="2097.75" />
526
516
  </div>
527
517
  <ul {...styles.list()}>
528
518
  {balances.map(([symbol, address, value]) => (
529
519
  <li key={symbol} {...styles.item()}>
530
520
  <TokenLogo address={address} />
531
521
  <span {...styles.symbol()}>{symbol}</span>
532
- {hidden ? <Hidden /> : <Amount symbol={symbol} value={value} />}
522
+ <Amount masked={hidden} symbol={symbol} value={value} />
533
523
  </li>
534
524
  ))}
535
525
  </ul>
@@ -545,15 +535,6 @@ namespace styles {
545
535
  width: '100% !custom',
546
536
  })
547
537
 
548
- export const hidden = style({
549
- clipPath: 'inset(50%) !custom',
550
- height: '1px !custom',
551
- overflow: 'hidden',
552
- position: 'absolute',
553
- whiteSpace: 'nowrap',
554
- width: '1px !custom',
555
- })
556
-
557
538
  export const item = style({
558
539
  alignItems: 'center',
559
540
  columnGap: '12',
@@ -579,7 +560,7 @@ namespace styles {
579
560
 
580
561
  * **Toggle:** Use an icon [Button](components/actions.md#button) with the eye icons, named Hide amounts, that reports its pressed state.
581
562
  * **Everywhere:** Hide every amount, including totals, activity, and charts.
582
- * **Out of the page:** Render the mask in place of the value, not a blur, so the value is absent from the page. Expose the word Hidden to screen readers instead of the dots.
563
+ * **Out of the page:** Set `masked` on [Amount](components/blockchain.md#amount), which renders the mask in place of the value, not a blur, so the value is absent from the page. Screen readers read Hidden instead of the dots.
583
564
  * **Remembered:** Keep the choice on the device, so amounts stay hidden on the next launch.
584
565
 
585
566
  **Do:** Use the same fixed mask for every hidden amount.
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Document mode: the markup contract for agent-written HTML documents, and a lint that checks a
3
+ * document against it. Documents link `@tempoxyz/ds/document.css` and `@tempoxyz/ds/document.js`,
4
+ * or the same files at `dist/document/document.css` and `dist/document/script.js` on a CDN.
5
+ * @module
6
+ */
7
+ /** Classes an author may write. Anything else is outside the contract. */
8
+ export declare const classes: readonly ['brief', 'byline', 'chart', 'chart-key', 'chart-plot', 'chart-scroll', 'axis', 'chronology', 'dek', 'doc', 'facts', 'figures', 'fill-ink', 'fill-line', 'fill-quiet', 'input', 'kv', 'l-body', 'l-outset', 'l-page', 'l-screen', 'minor', 'n', 'note', 'outcome', 'phase', 'results', 'sn', 'steps', 'summary', 'swatch'];
9
+ /** Classes allowed inside inline SVG diagrams and charts. */
10
+ export declare const svgClasses: readonly ['fill-ink', 'fill-line', 'fill-quiet', 'hair', 'ink', 'label', 'meta'];
11
+ /** The templates an `article.doc` can name in `data-template`. */
12
+ export declare const templates: readonly ['brief', 'essay', 'post'];
13
+ /**
14
+ * Checks an HTML document against the document mode contract and returns its diagnostics in
15
+ * line order. An empty array means the document passes.
16
+ *
17
+ * The check reads tags with a small scanner rather than a full HTML parser: it skips comments, text,
18
+ * and the contents of `<script>` and `<style>`, and it pairs `<figure>` tags by nesting. Markup built
19
+ * at runtime is not seen.
20
+ *
21
+ * With `page`, the lint also checks that the tags before `<body>` link the document stylesheet and
22
+ * load the document script with `defer`, as one classic script.
23
+ *
24
+ * @example
25
+ * Document.lint('<article class="doc" data-template="post"><h4>Steps</h4></article>')
26
+ * // [{ line: 1, message: '<h4> is not allowed. Use h2 for sections and h3 below them.', rule: 'heading-depth' }]
27
+ */
28
+ export declare function lint(html: string, options?: lint.Options): lint.Diagnostic[];
29
+ export declare namespace lint {
30
+ /** One problem in a document, at the line of the tag that causes it. */
31
+ type Diagnostic = {
32
+ line: number;
33
+ message: string;
34
+ rule: Rule;
35
+ };
36
+ type Options = {
37
+ /**
38
+ * Whether the HTML is a whole page, whose head must link the document stylesheet and load the
39
+ * document script with `defer`. Defaults to false, which checks a fragment.
40
+ */
41
+ page?: boolean | undefined;
42
+ };
43
+ /** The checks the lint runs. */
44
+ type Rule = 'chart-key' | 'chart-scroll' | 'chart-width' | 'figure-caption' | 'heading-depth' | 'no-disclosure' | 'no-ui' | 'script' | 'stylesheet' | 'template' | 'unknown-class';
45
+ }
46
+ //# sourceMappingURL=Document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../src/document/Document.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,OAAO,YAClB,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,YAAY,EACZ,cAAc,EACd,MAAM,EACN,YAAY,EACZ,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,GAAG,EACH,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,CACA,CAAA;AAEV,6DAA6D;AAC7D,eAAO,MAAM,UAAU,YACrB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,CACE,CAAA;AAEV,kEAAkE;AAClE,eAAO,MAAM,SAAS,YAAI,OAAO,EAAE,OAAO,EAAE,MAAM,CAAU,CAAA;AAS5D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,IAAI,CAAC,OAAY,GAAG,IAAI,CAAC,UAAU,EAAE,CA2IhF;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,wEAAwE;IACxE,KAAK,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAA;IAE/D,KAAK,OAAO,GAAG;QACb;;;WAGG;QACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAC3B,CAAA;IAED,gCAAgC;IAChC,KAAK,IAAI,GACL,WAAW,GACX,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,OAAO,GACP,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,eAAe,CAAA;CACpB"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Document mode: the markup contract for agent-written HTML documents, and a lint that checks a
3
+ * document against it. Documents link `@tempoxyz/ds/document.css` and `@tempoxyz/ds/document.js`,
4
+ * or the same files at `dist/document/document.css` and `dist/document/script.js` on a CDN.
5
+ * @module
6
+ */
7
+ /** Classes an author may write. Anything else is outside the contract. */
8
+ export const classes = [
9
+ 'brief',
10
+ 'byline',
11
+ 'chart',
12
+ 'chart-key',
13
+ 'chart-plot',
14
+ 'chart-scroll',
15
+ 'axis',
16
+ 'chronology',
17
+ 'dek',
18
+ 'doc',
19
+ 'facts',
20
+ 'figures',
21
+ 'fill-ink',
22
+ 'fill-line',
23
+ 'fill-quiet',
24
+ 'input',
25
+ 'kv',
26
+ 'l-body',
27
+ 'l-outset',
28
+ 'l-page',
29
+ 'l-screen',
30
+ 'minor',
31
+ 'n',
32
+ 'note',
33
+ 'outcome',
34
+ 'phase',
35
+ 'results',
36
+ 'sn',
37
+ 'steps',
38
+ 'summary',
39
+ 'swatch',
40
+ ];
41
+ /** Classes allowed inside inline SVG diagrams and charts. */
42
+ export const svgClasses = [
43
+ 'fill-ink',
44
+ 'fill-line',
45
+ 'fill-quiet',
46
+ 'hair',
47
+ 'ink',
48
+ 'label',
49
+ 'meta',
50
+ ];
51
+ /** The templates an `article.doc` can name in `data-template`. */
52
+ export const templates = ['brief', 'essay', 'post'];
53
+ // Patterns that read as UI rather than a document. Matched against whole class names.
54
+ const banned = /^(?:badge|badges|callout|card|cards|chip|chips|pill|pills|tab|tabs|tag|tags)$/;
55
+ // The built script and stylesheet, by package path or by the export names a copied file keeps.
56
+ const script = /(?:^|\/)(?:document\.js|document\/script\.js)(?:[?#]|$)/;
57
+ const stylesheet = /(?:^|\/)document\.css(?:[?#]|$)/;
58
+ /**
59
+ * Checks an HTML document against the document mode contract and returns its diagnostics in
60
+ * line order. An empty array means the document passes.
61
+ *
62
+ * The check reads tags with a small scanner rather than a full HTML parser: it skips comments, text,
63
+ * and the contents of `<script>` and `<style>`, and it pairs `<figure>` tags by nesting. Markup built
64
+ * at runtime is not seen.
65
+ *
66
+ * With `page`, the lint also checks that the tags before `<body>` link the document stylesheet and
67
+ * load the document script with `defer`, as one classic script.
68
+ *
69
+ * @example
70
+ * Document.lint('<article class="doc" data-template="post"><h4>Steps</h4></article>')
71
+ * // [{ line: 1, message: '<h4> is not allowed. Use h2 for sections and h3 below them.', rule: 'heading-depth' }]
72
+ */
73
+ export function lint(html, options = {}) {
74
+ const { page = false } = options;
75
+ const diagnostics = [];
76
+ const report = (index, rule, message) => diagnostics.push({ line: html.slice(0, index).split('\n').length, message, rule });
77
+ const figures = [];
78
+ const head = { index: 0, open: true, script: false, stylesheet: false };
79
+ let svg = 0;
80
+ for (const tag of scan(html)) {
81
+ if (tag.name === 'body' || tag.name === 'article' || (tag.name === 'head' && tag.closing))
82
+ head.open = false;
83
+ if (tag.name === 'head' && !tag.closing)
84
+ head.index = tag.index;
85
+ if (head.open && !tag.closing) {
86
+ const href = attribute(tag.attributes, 'href') ?? '';
87
+ const src = attribute(tag.attributes, 'src') ?? '';
88
+ if (tag.name === 'link' &&
89
+ attribute(tag.attributes, 'rel')?.toLowerCase() === 'stylesheet' &&
90
+ stylesheet.test(href))
91
+ head.stylesheet = true;
92
+ if (tag.name === 'script' &&
93
+ attribute(tag.attributes, 'defer') !== undefined &&
94
+ attribute(tag.attributes, 'type') === undefined &&
95
+ script.test(src))
96
+ head.script = true;
97
+ }
98
+ if (tag.name === 'svg' && !tag.selfClosing)
99
+ svg += tag.closing ? -1 : 1;
100
+ if (tag.closing) {
101
+ if (tag.name !== 'figure')
102
+ continue;
103
+ const figure = figures.pop();
104
+ if (!figure)
105
+ continue;
106
+ if (!figure.caption)
107
+ report(figure.index, 'figure-caption', 'A <figure> needs a <figcaption> that states its takeaway.');
108
+ if (figure.chart && figure.series > 1 && !figure.key)
109
+ report(figure.index, 'chart-key', 'A chart with more than one series needs a ul.chart-key.');
110
+ continue;
111
+ }
112
+ const names = (attribute(tag.attributes, 'class') ?? '').split(/\s+/).filter(Boolean);
113
+ const inSvg = svg > 0 || tag.name === 'svg';
114
+ if (/^h[4-6]$/.test(tag.name))
115
+ report(tag.index, 'heading-depth', `<${tag.name}> is not allowed. Use h2 for sections and h3 below them.`);
116
+ if (tag.name === 'details')
117
+ report(tag.index, 'no-disclosure', `<${tag.name}> is not allowed. A document shows everything it says.`);
118
+ const role = attribute(tag.attributes, 'role');
119
+ if (role === 'tab' || role === 'tablist')
120
+ report(tag.index, 'no-ui', `role="${role}" is not allowed. A document has no tabs.`);
121
+ for (const name of names) {
122
+ if (banned.test(name) || /^(?:badge|card|chip|pill|tab)-/.test(name))
123
+ report(tag.index, 'no-ui', `.${name} reads as UI. Write it as text, a table, or a list.`);
124
+ else if (!(inSvg ? svgClasses : classes).includes(name))
125
+ report(tag.index, 'unknown-class', `.${name} is not in the document mode contract.`);
126
+ }
127
+ if (tag.name === 'article' && names.includes('doc')) {
128
+ const template = attribute(tag.attributes, 'data-template');
129
+ if (!templates.includes(template))
130
+ report(tag.index, 'template', 'An article.doc needs data-template="essay", "brief", or "post".');
131
+ }
132
+ if (tag.name === 'figure') {
133
+ const chart = names.includes('chart');
134
+ if (chart && names.includes('l-screen'))
135
+ report(tag.index, 'chart-width', 'A chart stays inside the page. Use l-body, l-outset, or l-page.');
136
+ figures.push({
137
+ caption: false,
138
+ chart,
139
+ index: tag.index,
140
+ key: false,
141
+ series: Number(attribute(tag.attributes, 'data-series') ?? 1),
142
+ });
143
+ }
144
+ const figure = figures.at(-1);
145
+ if (figure && tag.name === 'figcaption')
146
+ figure.caption = true;
147
+ if (figure && names.includes('chart-key'))
148
+ figure.key = true;
149
+ if (names.includes('chart-scroll')) {
150
+ const named = attribute(tag.attributes, 'aria-label') ?? attribute(tag.attributes, 'aria-labelledby');
151
+ if (attribute(tag.attributes, 'role') !== 'region' ||
152
+ attribute(tag.attributes, 'tabindex') !== '0' ||
153
+ !named)
154
+ report(tag.index, 'chart-scroll', '.chart-scroll needs role="region", tabindex="0", and an accessible name.');
155
+ }
156
+ }
157
+ if (page && !head.stylesheet)
158
+ report(head.index, 'stylesheet', 'The <head> needs <link rel="stylesheet"> to the document stylesheet, dist/document/document.css.');
159
+ if (page && !head.script)
160
+ report(head.index, 'script', 'The <head> needs <script defer src> with the document script, dist/document/script.js, and no type.');
161
+ return diagnostics.sort((a, b) => a.line - b.line);
162
+ }
163
+ /** Returns an attribute's value, or undefined when the tag does not have it. */
164
+ function attribute(attributes, name) {
165
+ const pattern = new RegExp(`(?:^|\\s)${name}(?:\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+)))?(?=\\s|$)`, 'i');
166
+ const match = pattern.exec(attributes);
167
+ if (!match)
168
+ return undefined;
169
+ return match[1] ?? match[2] ?? match[3] ?? '';
170
+ }
171
+ /**
172
+ * Yields each tag in source order, skipping comments. A raw text element, such as `<script>`, yields
173
+ * its start tag and skips its contents and end tag.
174
+ */
175
+ function* scan(html) {
176
+ const pattern = /<!--[\s\S]*?-->|<(script|style|textarea)\b((?:[^>"']|"[^"]*"|'[^']*')*)>[\s\S]*?<\/\1\s*>|<(\/?)([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
177
+ for (const match of html.matchAll(pattern)) {
178
+ if (match[0].startsWith('<!--'))
179
+ continue;
180
+ const attributes = (match[1] ? match[2] : match[5])?.trim() ?? '';
181
+ yield {
182
+ attributes: attributes.replace(/\/$/, ''),
183
+ closing: match[3] === '/',
184
+ index: match.index,
185
+ name: (match[1] ?? match[4] ?? '').toLowerCase(),
186
+ selfClosing: attributes.endsWith('/'),
187
+ };
188
+ }
189
+ }
190
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../src/document/Document.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO;IACP,QAAQ;IACR,OAAO;IACP,WAAW;IACX,YAAY;IACZ,cAAc;IACd,MAAM;IACN,YAAY;IACZ,KAAK;IACL,KAAK;IACL,OAAO;IACP,SAAS;IACT,UAAU;IACV,WAAW;IACX,YAAY;IACZ,OAAO;IACP,IAAI;IACJ,QAAQ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note popovers and the list of notes, heading
3
+ * copy-link anchors, copy buttons on code blocks, Essay's reading rail, Brief's contents highlight,
4
+ * and Axis placement. A document reads in full without it. @module
5
+ */
6
+ /**
7
+ * Enhances every document on a page. Safe to call once per page, after the document is parsed.
8
+ *
9
+ * @example
10
+ * Enhance.run(document)
11
+ */
12
+ export declare function run(page: Document): void;
13
+ //# sourceMappingURL=Enhance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Enhance.d.ts","sourceRoot":"","sources":["../../src/document/Enhance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAqBxC"}