@harmonics/lattice-ui 0.6.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  `@harmonics/lattice-ui` follows semantic versioning; while it is `0.x`, a minor version may change
4
4
  an element's inputs, events or tokens, and says so here.
5
5
 
6
+ ## 0.7.0
7
+
8
+ - `<lattice-shape pressable>`: a button shaped like itself, in the tab order, named by its
9
+ `label`; a click on its faces, Enter or Space fires `press`. `pressed` makes it a toggle the page
10
+ sets; `disabled` stops it. It lifts under the pointer and sinks while pressed, and its focus ring
11
+ runs round its outline. Without `pressable`, a shape is what it was.
12
+ - `<lattice-icon>` draws five more marks: `note`, and the board's actions `turn`, `glue`, `apart`
13
+ and `bin`. Each path is a part, named in the README.
14
+ - Additive: nothing in 0.6.0 changes.
15
+
6
16
  ## 0.6.0
7
17
 
8
18
  - `<lattice-board>`, in `@harmonics/lattice-ui/board`: a surface of lattice pieces a person drags,
package/README.md CHANGED
@@ -71,7 +71,10 @@ of the tree's woods.
71
71
  | `tone` | 0–7 | `0` | 0–4 the tree's woods, 5 good fruit, 6 bitter, 7 untasted |
72
72
  | `lift` | number | `8` | How high it stands, in lattice units |
73
73
  | `scale` | number | `1` | 1 is the tree's own size: a cell 76 pixels across |
74
- | `label` | string | | Without one it is hidden from screen readers |
74
+ | `label` | string | | Without one it is hidden from screen readers; when pressable, its name |
75
+ | `pressable` | boolean | `false` | A button shaped like itself (below) |
76
+ | `pressed` | boolean | unset | Makes a pressable shape a toggle (`aria-pressed`); the page sets it |
77
+ | `disabled` | boolean | `false` | A pressable shape that cannot be pressed, out of the tab order |
75
78
 
76
79
  A part is a cell `{ kind: "cell", at: { q, r } }` on the axial hex grid, or a triangle
77
80
  `{ kind: "tri", at: { i, j, k } }` (corner `i, j` of the triangle grid, `k` 0 pointing right, 1
@@ -84,6 +87,22 @@ shape.parts = [
84
87
  ];
85
88
  ```
86
89
 
90
+ With `pressable` it is a button shaped like itself, for a palette of woods, a picker of shapes or
91
+ a button that is a shape. It is in the tab order with `role="button"` and its `label` as its name
92
+ (one without a label warns in the console). A click on its faces, Enter, or Space (on release)
93
+ fires `press`, `{ shape, parts }`. Only its faces take the pointer: a press in the gap round a
94
+ hexagon's corner goes to whatever is under it. It stands a little higher under the pointer and
95
+ sinks to half its lift while pressed, or while `pressed`; the keyboard's ring runs round its own
96
+ outline, and a `pressed` one keeps a quiet ring, so a palette shows which is picked by more than
97
+ its depth. The shape never presses itself: keep one `pressed` in a palette from `press`.
98
+
99
+ ```js
100
+ for (const swatch of swatches)
101
+ swatch.addEventListener("press", () => {
102
+ for (const s of swatches) s.pressed = s === swatch;
103
+ });
104
+ ```
105
+
87
106
  ### `<hex-sky>`
88
107
 
89
108
  The tree's sky, its hexagon lattice drawn faint over it, filling the element. Size it as any block.
@@ -119,8 +138,22 @@ see [Cutting](#cutting).
119
138
 
120
139
  ### `<lattice-icon>`
121
140
 
122
- `name="shears"` or `name="done"`, in the text's colour, a step square
123
- (`--lattice-icon-size` to change it). Hidden from screen readers unless it has a `label`.
141
+ One of the tree's marks (`ICON_NAMES`), in the text's colour, a step square
142
+ (`--lattice-icon-size` to change it). Hidden from screen readers unless it has a `label`. Every
143
+ mark is drawn from the lattice's pieces: hexagons, triangles and diamonds, every line upright or
144
+ at 30°.
145
+
146
+ | `name` | | Parts |
147
+ |---|---|---|
148
+ | `shears` (default) | two hexagon handles, two diamond blades crossing | `shears-handle`, `shears-blade` |
149
+ | `done` | a check in a hexagon | `done-cell`, `done-check` |
150
+ | `note` | a hexagon with two lines of writing | `note-cell`, `note-line` |
151
+ | `turn` | a hexagon open at one side, a triangle pointing on round (R) | `turn-path`, `turn-arrow` |
152
+ | `glue` | two cells sharing a heavy side (G) | `glue-cell`, `glue-seam` |
153
+ | `apart` | two cells with a gap (Shift+G) | `apart-cell` |
154
+ | `bin` | a cup under a diamond lid (Delete) | `bin-can`, `bin-rib`, `bin-lid` |
155
+
156
+ The last four are `<lattice-board>`'s keyboard actions, for a page that gives each a button.
124
157
 
125
158
  ## Board
126
159
 
@@ -197,9 +230,9 @@ The ones the elements use:
197
230
  | `--space-tree-2`, `--space-tree-4` | how far a face sinks; an icon's size |
198
231
 
199
232
  Each element also exposes its drawing as a part: `::part(face)`, `::part(shape)`, `::part(sky)`,
200
- `::part(trail)`, `::part(icon)`. A mark's own paths are parts too, for a hover that recolours
201
- them: `lattice-icon::part(done-cell)`, `::part(done-check)`, `::part(shears-blade)`,
202
- `::part(shears-handle)`.
233
+ `::part(trail)`, `::part(icon)`, `::part(board)`, and a shape's focus ring `::part(ring)`. A
234
+ mark's own paths are parts too (see `<lattice-icon>`), for a hover that recolours them:
235
+ `lattice-icon::part(done-cell)`.
203
236
 
204
237
  ## Frameworks
205
238