@gjermundgaraba-designs/plain-garden 0.7.0 → 0.9.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 (221) hide show
  1. package/DESIGN.md +8 -4
  2. package/dist/src/box/box.d.ts +1 -1
  3. package/dist/src/box/box.d.ts.map +1 -1
  4. package/dist/src/box/index.d.ts.map +1 -1
  5. package/dist/src/changes/changes.d.ts +1 -1
  6. package/dist/src/changes/changes.d.ts.map +1 -1
  7. package/dist/src/changes/index.d.ts.map +1 -1
  8. package/dist/src/{codeFigure/codeFigure.d.ts → code-figure/code-figure.d.ts} +3 -3
  9. package/dist/src/code-figure/code-figure.d.ts.map +1 -0
  10. package/dist/src/{codeFigure/codeFigure.js → code-figure/code-figure.js} +10 -5
  11. package/dist/src/code-figure/index.d.ts +3 -0
  12. package/dist/src/code-figure/index.d.ts.map +1 -0
  13. package/dist/src/code-figure/index.js +1 -0
  14. package/dist/src/copy/copy.d.ts.map +1 -1
  15. package/dist/src/copy/copy.js +1 -7
  16. package/dist/src/{copyButton/copyButton.d.ts → copy-button/copy-button.d.ts} +8 -2
  17. package/dist/src/copy-button/copy-button.d.ts.map +1 -0
  18. package/dist/src/copy-button/copy-button.js +37 -0
  19. package/dist/src/copy-button/index.d.ts +3 -0
  20. package/dist/src/copy-button/index.d.ts.map +1 -0
  21. package/dist/src/{copyButton → copy-button}/index.js +1 -1
  22. package/dist/src/diagram/diagram.d.ts +1 -1
  23. package/dist/src/diagram/diagram.d.ts.map +1 -1
  24. package/dist/src/diagram/diagram.js +10 -1
  25. package/dist/src/diagram/index.d.ts.map +1 -1
  26. package/dist/src/drawing/drawing.d.ts +3 -3
  27. package/dist/src/drawing/drawing.d.ts.map +1 -1
  28. package/dist/src/drawing/drawing.js +6 -5
  29. package/dist/src/drawing/fnv1a-utf16.d.ts +2 -0
  30. package/dist/src/drawing/fnv1a-utf16.d.ts.map +1 -0
  31. package/dist/src/drawing/fnv1a-utf16.js +8 -0
  32. package/dist/src/drawing/index.d.ts +1 -1
  33. package/dist/src/drawing/index.d.ts.map +1 -1
  34. package/dist/src/drawing/render.d.ts +4 -9
  35. package/dist/src/drawing/render.d.ts.map +1 -1
  36. package/dist/src/drawing/render.js +221 -200
  37. package/dist/src/drawing/scene.d.ts +11 -7
  38. package/dist/src/drawing/scene.d.ts.map +1 -1
  39. package/dist/src/drawing/scene.js +8 -5
  40. package/dist/src/{drawnTitle/drawnTitle.d.ts → drawn-title/drawn-title.d.ts} +3 -2
  41. package/dist/src/drawn-title/drawn-title.d.ts.map +1 -0
  42. package/dist/src/{drawnTitle/drawnTitle.js → drawn-title/drawn-title.js} +3 -3
  43. package/dist/src/drawn-title/index.d.ts +3 -0
  44. package/dist/src/drawn-title/index.d.ts.map +1 -0
  45. package/dist/src/drawn-title/index.js +1 -0
  46. package/dist/src/{figRef/figRef.d.ts → fig-ref/fig-ref.d.ts} +1 -1
  47. package/dist/src/fig-ref/fig-ref.d.ts.map +1 -0
  48. package/dist/src/{figRef/figRef.js → fig-ref/fig-ref.js} +1 -1
  49. package/dist/src/fig-ref/index.d.ts +3 -0
  50. package/dist/src/fig-ref/index.d.ts.map +1 -0
  51. package/dist/src/fig-ref/index.js +1 -0
  52. package/dist/src/figure/figure.d.ts +3 -3
  53. package/dist/src/figure/figure.d.ts.map +1 -1
  54. package/dist/src/figure/figure.js +4 -2
  55. package/dist/src/figure/figures.d.ts +0 -1
  56. package/dist/src/figure/figures.d.ts.map +1 -1
  57. package/dist/src/figure/figures.js +2 -2
  58. package/dist/src/figure/index.d.ts.map +1 -1
  59. package/dist/src/illustration/illustration.d.ts +1 -0
  60. package/dist/src/illustration/illustration.d.ts.map +1 -1
  61. package/dist/src/illustration/illustration.js +2 -2
  62. package/dist/src/illustration/index.d.ts.map +1 -1
  63. package/dist/src/index.d.ts +9 -9
  64. package/dist/src/index.d.ts.map +1 -1
  65. package/dist/src/index.js +9 -9
  66. package/dist/src/links-here/index.d.ts +3 -0
  67. package/dist/src/links-here/index.d.ts.map +1 -0
  68. package/dist/src/links-here/index.js +1 -0
  69. package/dist/src/{linksHere/linksHere.d.ts → links-here/links-here.d.ts} +2 -2
  70. package/dist/src/links-here/links-here.d.ts.map +1 -0
  71. package/dist/src/{linksHere/linksHere.js → links-here/links-here.js} +2 -2
  72. package/dist/src/margin-note/index.d.ts +3 -0
  73. package/dist/src/margin-note/index.d.ts.map +1 -0
  74. package/dist/src/margin-note/index.js +1 -0
  75. package/dist/src/{marginNote/marginNote.d.ts → margin-note/margin-note.d.ts} +2 -1
  76. package/dist/src/margin-note/margin-note.d.ts.map +1 -0
  77. package/dist/src/{marginNote/marginNote.js → margin-note/margin-note.js} +4 -1
  78. package/dist/src/masthead/index.d.ts.map +1 -1
  79. package/dist/src/masthead/masthead.d.ts +1 -1
  80. package/dist/src/masthead/masthead.d.ts.map +1 -1
  81. package/dist/src/masthead/masthead.js +1 -3
  82. package/dist/src/note-header/index.d.ts +3 -0
  83. package/dist/src/note-header/index.d.ts.map +1 -0
  84. package/dist/src/note-header/index.js +1 -0
  85. package/dist/src/{noteHeader/noteHeader.d.ts → note-header/note-header.d.ts} +2 -1
  86. package/dist/src/note-header/note-header.d.ts.map +1 -0
  87. package/dist/src/{noteHeader/noteHeader.js → note-header/note-header.js} +12 -4
  88. package/dist/src/note-list/index.d.ts +3 -0
  89. package/dist/src/note-list/index.d.ts.map +1 -0
  90. package/dist/src/note-list/index.js +1 -0
  91. package/dist/src/{noteList/noteList.d.ts → note-list/note-list.d.ts} +2 -2
  92. package/dist/src/note-list/note-list.d.ts.map +1 -0
  93. package/dist/src/{noteList/noteList.js → note-list/note-list.js} +8 -3
  94. package/dist/src/ring/index.d.ts.map +1 -1
  95. package/dist/src/ring/ring.d.ts +1 -1
  96. package/dist/src/ring/ring.d.ts.map +1 -1
  97. package/dist/src/scheme/index.d.ts +1 -1
  98. package/dist/src/scheme/index.d.ts.map +1 -1
  99. package/dist/src/scheme/index.js +1 -1
  100. package/dist/src/scheme/{schemeSwitch.d.ts → scheme-switch.d.ts} +3 -2
  101. package/dist/src/scheme/scheme-switch.d.ts.map +1 -0
  102. package/dist/src/scheme/{schemeSwitch.js → scheme-switch.js} +7 -6
  103. package/dist/src/scheme/scheme.d.ts +0 -2
  104. package/dist/src/scheme/scheme.d.ts.map +1 -1
  105. package/dist/src/scheme/scheme.js +0 -2
  106. package/dist/src/scheme/switch.d.ts.map +1 -1
  107. package/dist/src/scheme/switch.js +12 -17
  108. package/dist/src/skip-link/index.d.ts +2 -0
  109. package/dist/src/skip-link/index.d.ts.map +1 -0
  110. package/dist/src/skip-link/index.js +1 -0
  111. package/dist/src/{skipLink/skipLink.d.ts → skip-link/skip-link.d.ts} +1 -1
  112. package/dist/src/skip-link/skip-link.d.ts.map +1 -0
  113. package/dist/src/{skipLink/skipLink.js → skip-link/skip-link.js} +1 -1
  114. package/dist/src/stage/index.d.ts.map +1 -1
  115. package/dist/src/stage/stage.d.ts +0 -2
  116. package/dist/src/stage/stage.d.ts.map +1 -1
  117. package/dist/src/stage/stage.js +0 -2
  118. package/dist/src/summary/index.d.ts.map +1 -1
  119. package/dist/src/summary/summary.d.ts +1 -1
  120. package/dist/src/summary/summary.d.ts.map +1 -1
  121. package/dist/src/time/time.d.ts +0 -3
  122. package/dist/src/time/time.d.ts.map +1 -1
  123. package/dist/src/time/time.js +0 -1
  124. package/package.json +13 -13
  125. package/src/box/box.ts +6 -3
  126. package/src/box/index.ts +1 -0
  127. package/src/changes/changes.ts +10 -4
  128. package/src/changes/index.ts +1 -0
  129. package/src/{codeFigure/codeFigure.ts → code-figure/code-figure.ts} +19 -8
  130. package/src/code-figure/index.ts +3 -0
  131. package/src/copy/copy.ts +8 -17
  132. package/src/copy-button/copy-button.ts +96 -0
  133. package/src/{copyButton → copy-button}/index.ts +4 -2
  134. package/src/diagram/diagram.ts +20 -4
  135. package/src/diagram/index.ts +1 -0
  136. package/src/drawing/drawing.ts +18 -8
  137. package/src/drawing/fnv1a-utf16.ts +9 -0
  138. package/src/drawing/index.ts +11 -1
  139. package/src/drawing/render.ts +460 -270
  140. package/src/drawing/scene.ts +20 -12
  141. package/src/{drawnTitle/drawnTitle.ts → drawn-title/drawn-title.ts} +8 -3
  142. package/src/drawn-title/index.ts +3 -0
  143. package/src/{figRef/figRef.ts → fig-ref/fig-ref.ts} +4 -2
  144. package/src/fig-ref/index.ts +3 -0
  145. package/src/figure/figure.ts +21 -12
  146. package/src/figure/figures.ts +3 -2
  147. package/src/figure/index.ts +2 -0
  148. package/src/illustration/illustration.ts +9 -4
  149. package/src/illustration/index.ts +1 -0
  150. package/src/index.ts +28 -9
  151. package/src/links-here/index.ts +3 -0
  152. package/src/{linksHere/linksHere.ts → links-here/links-here.ts} +12 -5
  153. package/src/margin-note/index.ts +3 -0
  154. package/src/{marginNote/marginNote.ts → margin-note/margin-note.ts} +9 -2
  155. package/src/masthead/index.ts +1 -0
  156. package/src/masthead/masthead.ts +12 -7
  157. package/src/note-header/index.ts +3 -0
  158. package/src/{noteHeader/noteHeader.ts → note-header/note-header.ts} +24 -8
  159. package/src/note-list/index.ts +3 -0
  160. package/src/{noteList/noteList.ts → note-list/note-list.ts} +17 -9
  161. package/src/plain-garden.css +9 -87
  162. package/src/ring/index.ts +1 -0
  163. package/src/ring/ring.ts +9 -5
  164. package/src/scheme/index.ts +3 -1
  165. package/src/scheme/{schemeSwitch.ts → scheme-switch.ts} +22 -11
  166. package/src/scheme/scheme.ts +3 -4
  167. package/src/scheme/switch.ts +9 -20
  168. package/src/skip-link/index.ts +1 -0
  169. package/src/stage/index.ts +1 -0
  170. package/src/stage/stage.ts +9 -6
  171. package/src/summary/index.ts +1 -0
  172. package/src/summary/summary.ts +5 -2
  173. package/src/time/time.ts +8 -5
  174. package/src/tokens.css +14 -61
  175. package/dist/src/codeFigure/codeFigure.d.ts.map +0 -1
  176. package/dist/src/codeFigure/index.d.ts +0 -3
  177. package/dist/src/codeFigure/index.d.ts.map +0 -1
  178. package/dist/src/codeFigure/index.js +0 -1
  179. package/dist/src/copyButton/copyButton.d.ts.map +0 -1
  180. package/dist/src/copyButton/copyButton.js +0 -30
  181. package/dist/src/copyButton/index.d.ts +0 -3
  182. package/dist/src/copyButton/index.d.ts.map +0 -1
  183. package/dist/src/drawnTitle/drawnTitle.d.ts.map +0 -1
  184. package/dist/src/drawnTitle/index.d.ts +0 -3
  185. package/dist/src/drawnTitle/index.d.ts.map +0 -1
  186. package/dist/src/drawnTitle/index.js +0 -1
  187. package/dist/src/figRef/figRef.d.ts.map +0 -1
  188. package/dist/src/figRef/index.d.ts +0 -3
  189. package/dist/src/figRef/index.d.ts.map +0 -1
  190. package/dist/src/figRef/index.js +0 -1
  191. package/dist/src/linksHere/index.d.ts +0 -3
  192. package/dist/src/linksHere/index.d.ts.map +0 -1
  193. package/dist/src/linksHere/index.js +0 -1
  194. package/dist/src/linksHere/linksHere.d.ts.map +0 -1
  195. package/dist/src/marginNote/index.d.ts +0 -3
  196. package/dist/src/marginNote/index.d.ts.map +0 -1
  197. package/dist/src/marginNote/index.js +0 -1
  198. package/dist/src/marginNote/marginNote.d.ts.map +0 -1
  199. package/dist/src/noteHeader/index.d.ts +0 -3
  200. package/dist/src/noteHeader/index.d.ts.map +0 -1
  201. package/dist/src/noteHeader/index.js +0 -1
  202. package/dist/src/noteHeader/noteHeader.d.ts.map +0 -1
  203. package/dist/src/noteList/index.d.ts +0 -3
  204. package/dist/src/noteList/index.d.ts.map +0 -1
  205. package/dist/src/noteList/index.js +0 -1
  206. package/dist/src/noteList/noteList.d.ts.map +0 -1
  207. package/dist/src/scheme/schemeSwitch.d.ts.map +0 -1
  208. package/dist/src/skipLink/index.d.ts +0 -2
  209. package/dist/src/skipLink/index.d.ts.map +0 -1
  210. package/dist/src/skipLink/index.js +0 -1
  211. package/dist/src/skipLink/skipLink.d.ts.map +0 -1
  212. package/src/codeFigure/index.ts +0 -2
  213. package/src/copyButton/copyButton.ts +0 -59
  214. package/src/drawnTitle/index.ts +0 -2
  215. package/src/figRef/index.ts +0 -2
  216. package/src/linksHere/index.ts +0 -2
  217. package/src/marginNote/index.ts +0 -2
  218. package/src/noteHeader/index.ts +0 -2
  219. package/src/noteList/index.ts +0 -2
  220. package/src/skipLink/index.ts +0 -1
  221. /package/src/{skipLink/skipLink.ts → skip-link/skip-link.ts} +0 -0
package/DESIGN.md CHANGED
@@ -278,7 +278,7 @@ Derived, not separate colours: the link underline is ink at 28% and the soft und
278
278
  **Label/Mono Font:** Atkinson Hyperlegible Mono (with ui-monospace, Menlo, Consolas)
279
279
  **Hand:** Architects Daughter (with Atkinson Hyperlegible Next)
280
280
 
281
- **Character:** A heavy, tight grotesque that can stand on a drawing, over a sans drawn so letters are hard to mistake for one another. The drawings letter in the Mono, in tracked capitals, like a drawing sheet; the writer's margin notes are in a draftsman's hand. All four faces are self-hosted from `fonts/` under the SIL Open Font License.
281
+ **Character:** A heavy, tight grotesque that can stand on a drawing, over a sans drawn so letters are hard to mistake for one another. The drawings letter in the Mono, in tracked capitals, like a drawing sheet; the writer's margin notes are in a draftsman's hand. All four faces are self-hosted from `fonts/` under the SIL Open Font License. The files come from Fontsource 5.3.0, Latin subset: Atkinson Hyperlegible Next 2.0 and Mono 2.0 (variable 200–800, roman and italic), Bricolage Grotesque (variable 200–800) and Architects Daughter.
282
282
 
283
283
  ### Hierarchy
284
284
 
@@ -386,7 +386,7 @@ Summary: a plain `h2` ("In short") and an `ol`.
386
386
 
387
387
  ### Drawing (signature)
388
388
 
389
- `<svg class="drawing" viewBox="0 0 W H">` holding the scene's marks; with a label it is `role="img"` and `aria-label`, without one `aria-hidden`. The renderer writes classes and the stylesheet colours them from tokens: `pen` (a pencil stroke, a filled shape), `ln` (a ruled line), `solid` (an arrowhead, a dot, an ink fill), `paper` (hides), `faint` (construction lines at 0.45), `hatch` (the line of a hatching pattern, its colour set on it as `--hatch: var(--draw-<colour>)`), `tech` (lettering). Hatching is one `<pattern>` per colour in the drawing's `<defs>`, paper with a line every 4.5 units at 45°, 1.2 thick in the sketch and 1 in the drafting, its id the drawing's own; a hatched shape is a single path filled `url(#…)` with it, under its outline. The sketch's hatching is as regular as the drafting's: the hand is in the outlines. Given a figure number, each named group is a `<g id="fig-N-<name>">`; while a note points at it, its lines are drawn heavier.
389
+ `<svg id="…" class="drawing" viewBox="0 0 W H">` holding the scene's marks; with a label it is `role="img"` and `aria-label`, without one `aria-hidden`. The renderer writes classes and the stylesheet colours them from tokens: `pen` (a pencil stroke, a filled shape), `ln` (a ruled line), `solid` (an arrowhead, a dot, an ink fill), `paper` (hides), `faint` (construction lines at 0.45), `hatch` (the line of a hatching pattern, its colour set on it as `--hatch: var(--draw-<colour>)`), `tech` (lettering). Hatching is one `<pattern>` per colour in the drawing's `<defs>`, paper with a line every 4.5 units at 45°, 1.2 thick in the sketch and 1 in the drafting, its id `<drawing id>-<colour>`; a hatched shape is a single path filled `url(#…)` with it, under its outline. The sketch's hatching is as regular as the drafting's: the hand is in the outlines. Given a figure number, each named group is a `<g id="fig-N-<name>">`; while a note points at it, its lines are drawn heavier.
390
390
 
391
391
  ### Drawn title
392
392
 
@@ -487,10 +487,13 @@ Writers never draw. A writer says what they want ("a bucket with a tap dripping
487
487
 
488
488
  **13. Which component.**
489
489
 
490
- - **DrawnTitle.view**: a page's title standing on its drawing; two elements (the title on its drawing, the parts list), spread into the page. The front page uses it directly; a note passes `drawing: { scene, label }` to NoteHeader and the note's stage draws it.
490
+ - **DrawnTitle.view**: a page's title standing on its drawing; two elements (the title on its drawing, the parts list), spread into the page. The front page uses it directly; a note passes `drawing: { id, scene, label }` to NoteHeader and the note's stage draws it.
491
491
  - **Illustration.view**: a drawing inside the text, at the note's stage; full measure, or `isSmall` floated right. Put a small one in the section it belongs to (every `h2` clears right floats).
492
492
  - **MarginNote.view**: the writer's pencil; place it immediately before the paragraph it points at. Its words are `words`; the sketch is decorative.
493
493
  - **Drawing.view**: the bare SVG, for anything else. Give it a label saying what it shows; leave the label out only when it decorates.
494
+
495
+ Each takes an `id`, unique in the document, which names the drawing's SVG and its hatching; Diagram's is `drawing-fig-N`, from its number.
496
+
494
497
  - **Diagram.view**: a figure the prose reasons about, always drawn settled. Put each part a note names, with its words and arrows, in a group with that `name`; the note's `at` is the name. About 520 units wide, so its lettering stays readable when a phone scales it down.
495
498
 
496
499
  **14. Labels for readers.** Every DrawnTitle, Illustration and labelled Drawing needs an `aria-label`-ready sentence saying what the drawing shows, not how it looks ("A bucket of tokens with a tap near its base, dripping into a cup."). Sample drawings start with "Sample drawing:".
@@ -609,6 +612,7 @@ export const bucketTapCup: Drawing.Scene = {
609
612
  ```ts
610
613
  Illustration.view(
611
614
  {
615
+ id: "bucket",
612
616
  scene: bucketTapCup,
613
617
  stage, // the note's own stage
614
618
  label: "A bucket of water on a block, its tap dripping into a cup.",
@@ -624,7 +628,7 @@ Why it is built so: the water polygon's top corners sit on the bucket's walls an
624
628
 
625
629
  How a component in this package is made. The components follow these rules, and a new one follows them too; a review finding against one of them is a defect, not a style note.
626
630
 
627
- **The two kinds.** A **View** is a stateless render helper, `X.view(config, h)`: the caller owns any state and passes its Messages in the config. Copy `src/ring/` (a plain one), `src/figure/` (a container with a `body` slot and `tools`) or `src/drawnTitle/` (a View over the drawing renderer). A **Submodel** has a Model, Message, `init`, `update` and a `view` made with `defineView`, embedded with `h.submodel`: `src/scheme/` (`switch.ts` holds the Model, Messages, update and the Commands from `init` and `update` that read and pin the scheme on the page; `schemeSwitch.ts` adds the view) and `src/copyButton/` (Commands that write the clipboard and wait out a beat).
631
+ **The two kinds.** A **View** is a stateless render helper, `X.view(config, h)`: the caller owns any state and passes its Messages in the config. Copy `src/ring/` (a plain one), `src/figure/` (a container with a `body` slot and `tools`) or `src/drawn-title/` (a View over the drawing renderer). A **Submodel** has a Model, Message, `init`, `update` and a `view` made with `defineView`, embedded with `h.submodel`: `src/scheme/` (`switch.ts` holds the Model, Messages, update and the Commands from `init` and `update` that read and pin the scheme on the page; `scheme-switch.ts` adds the view) and `src/copy-button/` (Commands that write the clipboard and wait out a beat).
628
632
 
629
633
  Each component is `src/<name>/<name>.ts` with an explicit `index.ts` (its public surface: what a page uses, a Submodel's Model, Message, `init`, `update`, `view`, Commands and accessors, and the config types), a colocated `<name>.test.ts` (a Story for update, a Scene for view), an `export * as` line in `src/index.ts`, a section with an example file on the specimen's components page (`site/src/example/`; the page shows its source and the markup it renders) and an entry in this document. Only `src/index.ts` reaches an `index.ts`: inside `src/` a file, tests included, imports the file that defines what it needs (`../stage/stage.ts`). What only other components use has no `index.ts` and is not exported (`src/time/`, the written-out date in a note header and What's new).
630
634
 
@@ -4,7 +4,7 @@ export type ViewConfig = Readonly<{
4
4
  /** The heading's id, which names the box; unique in the document. */
5
5
  id: string;
6
6
  heading: string;
7
- body: ReadonlyArray<Html>;
7
+ body: readonly Html[];
8
8
  }>;
9
9
  /** A set-apart group under a hairline and a small heading: What's new, the pages that
10
10
  link here. */
@@ -1 +1 @@
1
- {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/box/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC,CAAC;AAEH;iBACiB;AACjB,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAIzE,CAAC"}
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/box/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;CACvB,CAAC,CAAC;AAEH;iBACiB;AACjB,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,KACf,WAAW,CAAC,OAAO,CAAC,KACtB,IAIA,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
@@ -6,7 +6,7 @@ export type Change = Readonly<{
6
6
  }>;
7
7
  /** Configuration for rendering the changes with `view`. */
8
8
  export type ViewConfig = Readonly<{
9
- changes: ReadonlyArray<Change>;
9
+ changes: readonly Change[];
10
10
  }>;
11
11
  /** What's new: what changed in the garden, a date and a line each. Newest first is the
12
12
  writer's call; the list keeps the order it is given. */
@@ -1 +1 @@
1
- {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../src/changes/changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC5B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAAC;AAEtE;2DAC2D;AAC3D,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAMzE,CAAC"}
1
+ {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../src/changes/changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAItD,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC5B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAElE;2DAC2D;AAC3D,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,KACf,WAAW,CAAC,OAAO,CAAC,KACtB,IASA,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/changes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/changes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import type { Html, HtmlBuilder } from "foldkit/html";
2
- import type { ViewInputs as CopyInputs } from "../copyButton/copyButton.ts";
2
+ import type { ViewInputs as CopyInputs } from "../copy-button/copy-button.ts";
3
3
  import * as Figure from "../figure/figure.ts";
4
4
  /** Configuration for rendering a code figure with `view`. */
5
5
  export type ViewConfig = Readonly<{
6
6
  number: number;
7
7
  caption: string;
8
8
  code: string;
9
- notes?: ReadonlyArray<Figure.Note> | undefined;
9
+ notes?: readonly Figure.Note[] | undefined;
10
10
  /** The Copy button: the page's `CopyButton`, rendered with what the figure gives it (its
11
11
  name and its code). Without one the caption is just the caption. */
12
12
  copy?: ((inputs: CopyInputs) => Html) | undefined;
13
13
  }>;
14
14
  /** Code with numbered lines, a caption, Copy, and notes that link to single lines. */
15
15
  export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
16
- //# sourceMappingURL=codeFigure.d.ts.map
16
+ //# sourceMappingURL=code-figure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-figure.d.ts","sourceRoot":"","sources":["../../../src/code-figure/code-figure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,IAAI,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAG9C,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;IAC3C;2EACuE;IACvE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACnD,CAAC,CAAC;AAEH,sFAAsF;AACtF,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,KACf,WAAW,CAAC,OAAO,CAAC,KACtB,IAgCF,CAAC"}
@@ -9,15 +9,20 @@ export const view = (config, h) => {
9
9
  .flatMap((line, index) => __foldkitBrandViewResult(([
10
10
  ...(index > 0 ? ["\n"] : []),
11
11
  h.span([h.Class("line"), h.Id(noteId(number, index + 1))], [line]),
12
- ]), "@gjermundgaraba-designs/plain-garden/src/codeFigure/codeFigure.js#anonymous"));
12
+ ]), "@gjermundgaraba-designs/plain-garden/src/code-figure/code-figure.js#anonymous"));
13
13
  return __foldkitBrandViewResult((Figure.view({
14
14
  number,
15
15
  caption,
16
16
  notes,
17
- tools: copy === undefined ? [] : [copy({ name: `Fig. ${number}`, text: code })],
18
- // A scrolling region the keyboard can reach.
17
+ tools: copy === undefined
18
+ ? []
19
+ : [copy({ name: `Fig. ${number}`, text: code })],
19
20
  body: [
20
- h.pre([h.Tabindex(0), h.Role("region"), h.AriaLabel(`Fig. ${number}, code`)], [h.code([], lines)]),
21
+ h.pre([
22
+ h.Tabindex(0),
23
+ h.Role("region"),
24
+ h.AriaLabel(`Fig. ${number}, code`),
25
+ ], [h.code([], lines)]),
21
26
  ],
22
- }, h)), "@gjermundgaraba-designs/plain-garden/src/codeFigure/codeFigure.js#view");
27
+ }, h)), "@gjermundgaraba-designs/plain-garden/src/code-figure/code-figure.js#view");
23
28
  };
@@ -0,0 +1,3 @@
1
+ export { view } from "./code-figure.ts";
2
+ export type { ViewConfig } from "./code-figure.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-figure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export { view } from "./code-figure.js";
@@ -1 +1 @@
1
- {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/copy/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAI3C,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAM9C,4FAA4F;AAC5F,eAAO,MAAM,SAAS;;;;;EAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAE9C,2DAA2D;AAC3D,eAAO,MAAM,KAAK;;;;;;;;EAGhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAItC,wDAAwD;AACxD,eAAO,MAAM,OAAO;;QACH,IAAI;;;;;EAInB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAI1C,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElD,sDAAsD;AACtD,eAAO,MAAM,IAAI,WAAY,UAAU,KAAG,KAGxC,CAAC;AAIH,gDAAgD;AAChD,eAAO,MAAM,EAAE,UAAW,KAAK,KAAG,MAAkB,CAAC;AAOrD;0FAC0F;AAC1F,eAAO,MAAM,QAAQ;;;;;;+BASnB,CAAC;AAEH,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB;;iBAG7B,CAAC;AAWH;;mCAEmC;AACnC,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAcjD,CAAC"}
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/copy/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAY,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAI3C,OAAO,KAAK,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAE9C,4FAA4F;AAC5F,eAAO,MAAM,SAAS;;;;;EAKpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAE9C,2DAA2D;AAC3D,eAAO,MAAM,KAAK;;;;;;;;EAGhB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC;AAEtC,wDAAwD;AACxD,eAAO,MAAM,OAAO;;QACH,IAAI;;;;;EAInB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElD,sDAAsD;AACtD,eAAO,MAAM,IAAI,WAAY,UAAU,KAAG,KAGxC,CAAC;AAEH,gDAAgD;AAChD,eAAO,MAAM,EAAE,UAAW,KAAK,KAAG,MAAkB,CAAC;AAIrD;0FAC0F;AAC1F,eAAO,MAAM,QAAQ;;;;;;+BAUnB,CAAC;AAEH,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB;;iBAK7B,CAAC;AASH;;mCAEmC;AACnC,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAcjD,CAAC"}
@@ -5,8 +5,6 @@ import * as Command from "foldkit/command";
5
5
  import { defineMessageUnion } from "foldkit/message";
6
6
  import { defineTaggedUnion } from "foldkit/schema";
7
7
  import { modifyFields } from "foldkit/struct";
8
- // A copy to the clipboard, without its view: the system's own control renders it.
9
- // MODEL
10
8
  /** Where a copy is: nothing yet, writing to the clipboard, just copied, or just refused. */
11
9
  export const CopyState = defineTaggedUnion({
12
10
  Idle: {},
@@ -19,7 +17,6 @@ export const Model = Schema.Struct({
19
17
  id: Schema.String,
20
18
  state: CopyState,
21
19
  });
22
- // MESSAGE
23
20
  /** Union of all Messages a copy control can produce. */
24
21
  export const Message = defineMessageUnion({
25
22
  ClickedCopy: { text: Schema.String },
@@ -32,11 +29,8 @@ export const init = (config) => (__foldkitBrandViewResult(({
32
29
  id: config.id,
33
30
  state: CopyState.Idle(),
34
31
  }), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#init"));
35
- // ACCESSORS
36
32
  /** The control's id, unique in the document. */
37
33
  export const id = (model) => __foldkitBrandViewResult((model.id), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#id");
38
- // COMMAND
39
- /** How long the control answers for: that it copied, or that the copy failed. */
40
34
  const WORD_BEAT = Duration.millis(1600);
41
35
  /** Writes the text to the clipboard through Effect's `Clipboard` port. Provide
42
36
  `Clipboard.layer` from `@effect/platform-browser` in the application's `resources`. */
@@ -47,7 +41,7 @@ export const CopyText = Command.define("CopyText", {
47
41
  const clipboard = yield* Clipboard.Clipboard;
48
42
  yield* clipboard.writeString(text);
49
43
  return __foldkitBrandViewResult((Message.SucceededCopyText()), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#anonymous");
50
- }).pipe(Effect.catch(() => __foldkitBrandViewResult((Effect.succeed(Message.FailedCopyText())), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#anonymous~2")))), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#execute"),
44
+ }).pipe(Effect.orElseSucceed(() => __foldkitBrandViewResult((Message.FailedCopyText()), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#anonymous~2")))), "@gjermundgaraba-designs/plain-garden/src/copy/copy.js#execute"),
51
45
  });
52
46
  /** Waits out the beat the answer shows for. */
53
47
  export const WaitBeforeSettling = Command.define("WaitBeforeSettling", {
@@ -1,4 +1,7 @@
1
- export * from "../copy/copy.ts";
1
+ import type { Html, HtmlBuilder } from "foldkit/html";
2
+ import { CopyState } from "../copy/copy.ts";
3
+ export { CopyState, CopyText, Message, Model, WaitBeforeSettling, id, init, update, } from "../copy/copy.ts";
4
+ export type { InitConfig } from "../copy/copy.ts";
2
5
  /** Per-render inputs passed to `view` through `h.submodel`'s `viewInputs`. */
3
6
  export type ViewInputs = Readonly<{
4
7
  /** What is copied: the figure's name ("Fig. 4"), for the button's name and what is said. */
@@ -37,4 +40,7 @@ export declare const view: import("foldkit/submodel").View<{
37
40
  /** What goes on the clipboard. */
38
41
  text: string;
39
42
  }>>;
40
- //# sourceMappingURL=copyButton.d.ts.map
43
+ /** The button as it prints in one state, inert: a picture for a specimen, with no Model and
44
+ nothing to press or announce. */
45
+ export declare const stateView: <ParentMessage>(state: CopyState, h: HtmlBuilder<ParentMessage>) => Html;
46
+ //# sourceMappingURL=copy-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../../src/copy-button/copy-button.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAW,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,EACL,kBAAkB,EAClB,EAAE,EACF,IAAI,EACJ,MAAM,GACP,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,8EAA8E;AAC9E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAsCH;;;;8FAI8F;AAC9F,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;IA/Cf,4FAA4F;UACtF,MAAM;IACZ,kCAAkC;UAC5B,MAAM;GA+Db,CAAC;AAEF;oCACoC;AACpC,eAAO,MAAM,SAAS,GAAI,aAAa,SAC9B,SAAS,KACb,WAAW,CAAC,aAAa,CAAC,KAC5B,IAA6D,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ import { Button as UiButton } from "@foldkit/ui";
3
+ import { defineView } from "foldkit/submodel";
4
+ import { CopyState, Message } from "../copy/copy.js";
5
+ export { CopyState, CopyText, Message, Model, WaitBeforeSettling, id, init, update, } from "../copy/copy.js";
6
+ const word = (state) => __foldkitBrandViewResult((CopyState.match(state, {
7
+ Idle: () => __foldkitBrandViewResult(("Copy"), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Idle"),
8
+ Copying: () => __foldkitBrandViewResult(("Copy"), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Copying"),
9
+ Copied: () => __foldkitBrandViewResult(("Copied"), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Copied"),
10
+ Failed: () => __foldkitBrandViewResult(("Copy"), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Failed"),
11
+ })), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#word");
12
+ const said = (state, name) => __foldkitBrandViewResult((CopyState.match(state, {
13
+ Idle: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Idle~2"),
14
+ Copying: () => __foldkitBrandViewResult((""), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Copying~2"),
15
+ Copied: () => __foldkitBrandViewResult((`${name} copied`), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Copied~2"),
16
+ Failed: () => __foldkitBrandViewResult(("copy failed"), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#Failed~2"),
17
+ })), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#said");
18
+ const buttonView = (state, { attributes, ...press }, h) => __foldkitBrandViewResult((UiButton.view({
19
+ ...press,
20
+ isDisabled: !CopyState.guards.Idle(state),
21
+ toView: ({ button }) => __foldkitBrandViewResult((h.button([...button, h.Class("copy"), ...attributes], [word(state)])), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#toView"),
22
+ }, h)), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#buttonView");
23
+ /** Copy, a button built on `@foldkit/ui`'s Button and dressed as a link, that reads Copied
24
+ in ink for a beat and says so to screen readers; held while it does. Where the clipboard
25
+ is refused it still reads Copy, held for the same beat, and the status says "copy failed".
26
+ Its `CopyText` Command needs `Clipboard.layer` in the application's resources. Spread it
27
+ into a figure's `tools`: a button, then the status region that is announced, not shown. */
28
+ export const view = defineView((model, { name, text }, h) => __foldkitBrandViewResult((h.span([h.Id(model.id)], [
29
+ buttonView(model.state, {
30
+ attributes: [h.AriaLabel(`Copy ${name}`)],
31
+ onClick: Message.ClickedCopy({ text }),
32
+ }, h),
33
+ h.span([h.Class("sr-only"), h.Role("status")], [said(model.state, name)]),
34
+ ])), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#anonymous"));
35
+ /** The button as it prints in one state, inert: a picture for a specimen, with no Model and
36
+ nothing to press or announce. */
37
+ export const stateView = (state, h) => __foldkitBrandViewResult((buttonView(state, { attributes: [h.Inert(true)] }, h)), "@gjermundgaraba-designs/plain-garden/src/copy-button/copy-button.js#stateView");
@@ -0,0 +1,3 @@
1
+ export { CopyState, CopyText, Message, Model, WaitBeforeSettling, id, init, stateView, update, view, } from "./copy-button.ts";
2
+ export type { InitConfig, ViewInputs } from "./copy-button.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copy-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,EACL,kBAAkB,EAClB,EAAE,EACF,IAAI,EACJ,SAAS,EACT,MAAM,EACN,IAAI,GACL,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- export { CopyState, CopyText, Message, Model, WaitBeforeSettling, id, init, update, view, } from "./copyButton.js";
1
+ export { CopyState, CopyText, Message, Model, WaitBeforeSettling, id, init, stateView, update, view, } from "./copy-button.js";
@@ -5,7 +5,7 @@ import * as Figure from "../figure/figure.ts";
5
5
  export type ViewConfig = Readonly<{
6
6
  number: number;
7
7
  caption: string;
8
- notes?: ReadonlyArray<Figure.Note> | undefined;
8
+ notes?: readonly Figure.Note[] | undefined;
9
9
  scene: Scene;
10
10
  label: string;
11
11
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"diagram.d.ts","sourceRoot":"","sources":["../../../src/diagram/diagram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH;;mDAEmD;AACnD,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAW3E,CAAC"}
1
+ {"version":3,"file":"diagram.d.ts","sourceRoot":"","sources":["../../../src/diagram/diagram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAG9C,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH;;mDAEmD;AACnD,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,KACf,WAAW,CAAC,OAAO,CAAC,KACtB,IAuBF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
2
  import * as Drawing from "../drawing/drawing.js";
3
3
  import * as Figure from "../figure/figure.js";
4
+ import { figureId } from "../figure/figures.js";
4
5
  /** A figure the prose reasons about: a numbered Figure holding the scene, drawn settled, so
5
6
  it reads as exact whatever the note's stage. Each note's `at` names a group in the scene;
6
7
  following the note draws that group heavier. */
@@ -10,6 +11,14 @@ export const view = (config, h) => {
10
11
  number,
11
12
  caption,
12
13
  notes,
13
- body: [Drawing.view({ scene, stage: "settled", label, figure: number }, h)],
14
+ body: [
15
+ Drawing.view({
16
+ id: `drawing-${figureId(number)}`,
17
+ scene,
18
+ stage: "settled",
19
+ label,
20
+ figure: number,
21
+ }, h),
22
+ ],
14
23
  }, h)), "@gjermundgaraba-designs/plain-garden/src/diagram/diagram.js#view");
15
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diagram/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diagram/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -3,6 +3,8 @@ import type { StageName } from "../stage/stage.ts";
3
3
  import type { Scene } from "./scene.ts";
4
4
  /** Configuration for rendering a drawing with `view`. */
5
5
  export type ViewConfig = Readonly<{
6
+ /** The drawing's id, unique in the document; its hatching patterns are named from it. */
7
+ id: string;
6
8
  scene: Scene;
7
9
  stage: StageName;
8
10
  /** What the drawing shows; without one it only decorates, and is hidden. */
@@ -16,7 +18,5 @@ export type ViewConfig = Readonly<{
16
18
  label saying what it shows; leave the label out only when it decorates. The marks come
17
19
  from the renderer, the same on the server and in the browser. */
18
20
  export declare const view: <Message>(config: ViewConfig, h: HtmlBuilder<Message>) => Html;
19
- /** The scene's numbered parts, named in order, as on a drawing sheet; nothing when it
20
- numbers none. */
21
- export declare const partsView: <Message>(scene: Scene, h: HtmlBuilder<Message>) => ReadonlyArray<Html>;
21
+ export declare const partsView: <Message>(scene: Scene, h: HtmlBuilder<Message>) => readonly Html[];
22
22
  //# sourceMappingURL=drawing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../../src/drawing/drawing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;mCAC+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;oEAGoE;AACpE,eAAO,MAAM,IAAI,GAAI,OAAO,UAAU,UAAU,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAQ3E,CAAC;AAEF;oBACoB;AACpB,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,aAAa,CAAC,IAAI,CASzF,CAAC"}
1
+ {"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../../src/drawing/drawing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,yFAAyF;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;mCAC+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;oEAGoE;AACpE,eAAO,MAAM,IAAI,GAAI,OAAO,UAClB,UAAU,KACf,WAAW,CAAC,OAAO,CAAC,KACtB,IAYF,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,SACxB,KAAK,KACT,WAAW,CAAC,OAAO,CAAC,KACtB,SAAS,IAAI,EASZ,CAAC"}
@@ -6,16 +6,17 @@ import { drawingMarks, partNames } from "./render.js";
6
6
  label saying what it shows; leave the label out only when it decorates. The marks come
7
7
  from the renderer, the same on the server and in the browser. */
8
8
  export const view = (config, h) => {
9
- const { scene, stage, label, figure } = config;
9
+ const { id, scene, stage, label, figure } = config;
10
10
  return __foldkitBrandViewResult((h.svg([
11
+ h.Id(id),
11
12
  h.Class("drawing"),
12
13
  h.ViewBox(`0 0 ${scene.width} ${scene.height}`),
13
- ...(label ? [h.Role("img"), h.AriaLabel(label)] : [h.AriaHidden(true)]),
14
- h.InnerHTML(drawingMarks(scene, stage, figure)),
14
+ ...(label !== undefined && label !== ""
15
+ ? [h.Role("img"), h.AriaLabel(label)]
16
+ : [h.AriaHidden(true)]),
17
+ h.InnerHTML(drawingMarks(scene, stage, id, figure)),
15
18
  ])), "@gjermundgaraba-designs/plain-garden/src/drawing/drawing.js#view");
16
19
  };
17
- /** The scene's numbered parts, named in order, as on a drawing sheet; nothing when it
18
- numbers none. */
19
20
  export const partsView = (scene, h) => __foldkitBrandViewResult((Array.match(partNames(scene), {
20
21
  onEmpty: () => __foldkitBrandViewResult(([]), "@gjermundgaraba-designs/plain-garden/src/drawing/drawing.js#onEmpty"),
21
22
  onNonEmpty: (parts) => __foldkitBrandViewResult(([
@@ -0,0 +1,2 @@
1
+ export declare const fnv1aUtf16: (text: string) => number;
2
+ //# sourceMappingURL=fnv1a-utf16.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fnv1a-utf16.d.ts","sourceRoot":"","sources":["../../../src/drawing/fnv1a-utf16.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,MAQzC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
+ export const fnv1aUtf16 = (text) => {
3
+ let h = 2_166_136_261;
4
+ for (let i = 0; i < text.length; i += 1) {
5
+ h = Math.imul(h ^ text.charCodeAt(i), 16_777_619);
6
+ }
7
+ return __foldkitBrandViewResult((h >>> 0), "@gjermundgaraba-designs/plain-garden/src/drawing/fnv1a-utf16.js#fnv1aUtf16");
8
+ };
@@ -1,4 +1,4 @@
1
1
  export { view } from "./drawing.ts";
2
2
  export type { ViewConfig } from "./drawing.ts";
3
- export type { Colour, Hatch, Look, Mark, Point, Scene, Shape } from "./scene.ts";
3
+ export type { Colour, Hatch, Look, Mark, Point, Scene, Shape, } from "./scene.ts";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,YAAY,EACV,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC"}
@@ -1,11 +1,6 @@
1
1
  import type { StageName } from "../stage/stage.ts";
2
- import { type Scene } from "./scene.ts";
3
- /** The marks inside a drawing's <svg viewBox="0 0 width height">, as the stage draws them.
4
- With a figure number, each named group is a <g> a note in that figure can point at. */
5
- export declare function drawingMarks(scene: Scene, stage: StageName, figure?: number): string;
6
- /** Where a DrawnTitle's title stands (--ground, up from the drawing's foot) and how a phone
7
- crops the drawing to the scene's focus (--focus-width, --focus-start). */
8
- export declare function titlePlacement(scene: Scene): Readonly<Record<`--${string}`, string>>;
9
- /** The names of the scene's numbered parts, in their numbers' order. */
10
- export declare function partNames(scene: Scene): ReadonlyArray<string>;
2
+ import type { Scene } from "./scene.ts";
3
+ export declare const drawingMarks: (scene: Scene, stage: StageName, id: string, figure?: number) => string;
4
+ export declare const titlePlacement: (scene: Scene) => Readonly<Record<`--${string}`, string>>;
5
+ export declare const partNames: (scene: Scene) => readonly string[];
11
6
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/drawing/render.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAOL,KAAK,KAAK,EAEX,MAAM,YAAY,CAAC;AA2kBpB;0FAC0F;AAC1F,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CA+IpF;AAED;6EAC6E;AAC7E,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CASpF;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAI7D"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/drawing/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAMV,KAAK,EAEN,MAAM,YAAY,CAAC;AAyuBpB,eAAO,MAAM,YAAY,UAChB,KAAK,SACL,SAAS,MACZ,MAAM,WACD,MAAM,KACd,MA6KF,CAAC;AAIF,eAAO,MAAM,cAAc,UAClB,KAAK,KACX,QAAQ,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,CASxC,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,KAAK,KAAG,SAAS,MAAM,EAKvD,CAAC"}