@harmonics/lattice-ui 0.6.0 → 0.8.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,22 @@
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.8.0
7
+
8
+ - `<lattice-icon>` draws three more marks: `name` (a pencil), `split` (the Sierpinski step) and
9
+ `search` (a hexagon lens). Every line upright or at 30°, as the others. Additive: nothing in
10
+ 0.7.0 changes.
11
+
12
+ ## 0.7.0
13
+
14
+ - `<lattice-shape pressable>`: a button shaped like itself, in the tab order, named by its
15
+ `label`; a click on its faces, Enter or Space fires `press`. `pressed` makes it a toggle the page
16
+ sets; `disabled` stops it. It lifts under the pointer and sinks while pressed, and its focus ring
17
+ runs round its outline. Without `pressable`, a shape is what it was.
18
+ - `<lattice-icon>` draws five more marks: `note`, and the board's actions `turn`, `glue`, `apart`
19
+ and `bin`. Each path is a part, named in the README.
20
+ - Additive: nothing in 0.6.0 changes.
21
+
6
22
  ## 0.6.0
7
23
 
8
24
  - `<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,26 @@ 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
+ | `name` | a pencil rising at 30°, a triangle for its point | `name-body`, `name-point`, `name-band` |
156
+ | `split` | a triangle with its middle turned over, the Sierpinski step | `split-whole`, `split-hole` |
157
+ | `search` | a hexagon lens, a strip for its handle | `search-lens`, `search-handle` |
158
+
159
+ `turn`, `glue`, `apart` and `bin` are `<lattice-board>`'s keyboard actions, for a page that gives
160
+ each a button; `name`, `split` and `bin` are the Harmonics grid's own controls.
124
161
 
125
162
  ## Board
126
163
 
@@ -197,9 +234,9 @@ The ones the elements use:
197
234
  | `--space-tree-2`, `--space-tree-4` | how far a face sinks; an icon's size |
198
235
 
199
236
  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)`.
237
+ `::part(trail)`, `::part(icon)`, `::part(board)`, and a shape's focus ring `::part(ring)`. A
238
+ mark's own paths are parts too (see `<lattice-icon>`), for a hover that recolours them:
239
+ `lattice-icon::part(done-cell)`.
203
240
 
204
241
  ## Frameworks
205
242