@fusion.dev/helix-headless 0.103.3 → 0.104.1
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/custom-elements.json +9260 -880
- package/dist/announcement/root/announcement-root.d.ts +9 -2
- package/dist/announcement/root/announcement-root.js +9 -6
- package/dist/badge/root/badge-root.js +2 -3
- package/dist/canvas/edge/canvas-edge.d.ts +112 -0
- package/dist/canvas/edge/canvas-edge.js +66 -0
- package/dist/canvas/index.d.ts +4 -0
- package/dist/canvas/index.js +3 -0
- package/dist/canvas/node/canvas-node.d.ts +211 -0
- package/dist/canvas/node/canvas-node.js +148 -0
- package/dist/canvas/root/canvas-document.d.ts +215 -0
- package/dist/canvas/root/canvas-document.js +284 -0
- package/dist/canvas/root/canvas-root.d.ts +924 -0
- package/dist/canvas/root/canvas-root.js +1831 -0
- package/dist/carousel/root/carousel-root.d.ts +53 -16
- package/dist/carousel/root/carousel-root.js +46 -11
- package/dist/chat/root/chat-root.d.ts +4 -0
- package/dist/chat/root/chat-root.js +11 -7
- package/dist/checkbox/root/checkbox-root.js +1 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +10 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +5 -0
- package/dist/color-input/root/color-input-root.js +21 -5
- package/dist/color-picker/root/color-picker-root.d.ts +55 -0
- package/dist/color-picker/root/color-picker-root.js +61 -12
- package/dist/combobox/root/combobox-root.d.ts +21 -2
- package/dist/combobox/root/combobox-root.js +23 -9
- package/dist/command/root/command-root.d.ts +1 -0
- package/dist/command/root/command-root.js +1 -1
- package/dist/data-table/root/data-table-root.d.ts +43 -42
- package/dist/data-table/root/data-table-root.js +35 -34
- package/dist/date-input/root/date-input-root.d.ts +27 -0
- package/dist/date-input/root/date-input-root.js +38 -9
- package/dist/date-picker/root/date-picker-root.d.ts +28 -16
- package/dist/date-picker/root/date-picker-root.js +17 -15
- package/dist/drilldown/root/drilldown-root.d.ts +1 -0
- package/dist/drilldown/root/drilldown-root.js +5 -2
- package/dist/element-events.generated.js +15 -0
- package/dist/empty/root/empty-root.d.ts +12 -7
- package/dist/empty/root/empty-root.js +13 -10
- package/dist/file-input/root/file-input-root.d.ts +5 -1
- package/dist/file-input/root/file-input-root.js +6 -4
- package/dist/filter-input/menu/filter-menu.d.ts +1 -0
- package/dist/filter-input/menu/filter-menu.js +1 -1
- package/dist/filter-input/root/filter-input-root.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/input/root/input-root.js +1 -1
- package/dist/lightbox/root/lightbox-root.d.ts +9 -1
- package/dist/lightbox/root/lightbox-root.js +17 -7
- package/dist/listbox/root/listbox-root.d.ts +16 -14
- package/dist/listbox/root/listbox-root.js +24 -15
- package/dist/map/root/map-root.d.ts +6 -3
- package/dist/map/root/map-root.js +8 -2
- package/dist/menu/root/menu-root.d.ts +1 -0
- package/dist/menu/root/menu-root.js +1 -1
- package/dist/notifications/group/notification-group.js +5 -4
- package/dist/notifications/notification/notification.d.ts +10 -10
- package/dist/notifications/notification/notification.js +3 -3
- package/dist/notifications/root/notifications-root.d.ts +1 -0
- package/dist/notifications/root/notifications-root.js +1 -0
- package/dist/number-input/root/number-input-root.d.ts +17 -0
- package/dist/number-input/root/number-input-root.js +22 -6
- package/dist/object-inspector/root/object-inspector-root.d.ts +10 -0
- package/dist/object-inspector/root/object-inspector-root.js +10 -2
- package/dist/outline/root/outline-root.d.ts +15 -0
- package/dist/outline/root/outline-root.js +12 -7
- package/dist/pagination/root/pagination-root.d.ts +18 -18
- package/dist/pagination/root/pagination-root.js +5 -5
- package/dist/pagination/size/pagination-size.d.ts +10 -9
- package/dist/pagination/size/pagination-size.js +4 -4
- package/dist/pagination/summary/pagination-summary.js +6 -5
- package/dist/pin-input/root/pin-input-root.d.ts +5 -0
- package/dist/pin-input/root/pin-input-root.js +10 -6
- package/dist/rating/root/rating-root.js +3 -2
- package/dist/select/root/select-root.d.ts +1 -0
- package/dist/select/root/select-root.js +8 -3
- package/dist/slider/root/slider-root.d.ts +12 -0
- package/dist/slider/root/slider-root.js +13 -1
- package/dist/splitter/root/splitter-root.d.ts +44 -35
- package/dist/splitter/root/splitter-root.js +27 -22
- package/dist/switch/root/switch-root.js +1 -0
- package/dist/table/column/table-column.d.ts +17 -0
- package/dist/table/column/table-column.js +16 -4
- package/dist/table/root/table-root.d.ts +1 -0
- package/dist/table/root/table-root.js +1 -1
- package/dist/textarea/root/textarea-root.js +1 -1
- package/dist/time-input/root/time-input-root.d.ts +29 -0
- package/dist/time-input/root/time-input-root.js +31 -10
- package/dist/time-picker/root/time-picker-root.d.ts +14 -0
- package/dist/time-picker/root/time-picker-root.js +16 -14
- package/dist/toast/item/toast-item.d.ts +12 -11
- package/dist/toast/item/toast-item.js +11 -5
- package/dist/toolbar/root/toolbar-root.js +2 -16
- package/dist/tooltip/root/tooltip-root.d.ts +1 -0
- package/dist/tooltip/root/tooltip-root.js +6 -0
- package/dist/tour/root/tour-root.d.ts +10 -10
- package/dist/tour/root/tour-root.js +5 -5
- package/dist/tree/root/tree-root.d.ts +1 -0
- package/dist/tree/root/tree-root.js +1 -1
- package/dist/video/root/video-root.d.ts +84 -0
- package/dist/video/root/video-root.js +116 -41
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +4 -3
- package/package.json +5 -5
- package/types/jsx.d.ts +5419 -716
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1607 -213
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
import { type CanvasView, HelixElement, type ViewportPanDetail, type ViewportWay, type ViewportZoomDetail } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import { type CanvasDocument } from './canvas-document.js';
|
|
4
|
+
export type { CanvasDocument, CanvasEdge, CanvasEdgeProps, CanvasEnd, CanvasNode, CanvasNodeProps, CanvasPath, CanvasSide, CanvasTone, } from './canvas-document.js';
|
|
5
|
+
export { fromJsonCanvas } from './canvas-document.js';
|
|
6
|
+
declare const HelixHeadlessCanvas_base: (new (...args: any[]) => import("@fusion.dev/helix-core").ViewportElement) & typeof HelixElement;
|
|
7
|
+
/**
|
|
8
|
+
* @summary A board of cards and the connections between them, which a reader can walk, rearrange and connect.
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* **The first of these surfaces Helix draws itself**, and the reason is where
|
|
12
|
+
* the positions come from. On a canvas **position is data**: somebody placed
|
|
13
|
+
* every card and the placement carries the meaning, so there is no layout to
|
|
14
|
+
* compute and drawing is arithmetic over rectangles. A map is somebody else's
|
|
15
|
+
* tiles and a graph view's positions are computed, which is why `Map` takes a
|
|
16
|
+
* slotted map and this takes a document.
|
|
17
|
+
*
|
|
18
|
+
* **The format is open.** [JSON Canvas](https://jsoncanvas.org) gives each node
|
|
19
|
+
* an `x`, `y`, `width`, `height` and a type, and each edge the two nodes it
|
|
20
|
+
* joins and the sides it leaves and arrives on. A card belongs to a group when
|
|
21
|
+
* it sits inside the group's bounds, which the format leaves to the geometry.
|
|
22
|
+
*
|
|
23
|
+
* **Accessibility is the design work, not the drawing.** The cards are text in
|
|
24
|
+
* the DOM, so they are readable already; what space does not supply is an order
|
|
25
|
+
* and the connections. So the family chooses an order, walks the cards in it,
|
|
26
|
+
* and says every card's links as text. `order` takes `spatial`, which bands the
|
|
27
|
+
* cards into rows, and `edges`, which follows the arrows from the cards nothing
|
|
28
|
+
* points to.
|
|
29
|
+
*
|
|
30
|
+
* **Cards move by default, the way a form control takes input by default.**
|
|
31
|
+
* The board writes the new `x` and `y` onto the card itself, as an input writes
|
|
32
|
+
* its own value, and says so twice: `helix-before-move` for every step, which a
|
|
33
|
+
* consumer holding the positions in their own state refuses and applies
|
|
34
|
+
* themselves, and `helix-move` once the move is finished. A resize is the same
|
|
35
|
+
* pair with a size in it. `readonly` keeps every card where it is, for a board
|
|
36
|
+
* that is published rather than worked on, and `readonly` on one card or
|
|
37
|
+
* connection keeps that one.
|
|
38
|
+
*
|
|
39
|
+
* **The cards are the way around it.** One of them holds the board's tab stop,
|
|
40
|
+
* arrow keys walk them in reading order, and the one a reader lands on is
|
|
41
|
+
* brought into view with what it connects to read out beside it. Shift with an
|
|
42
|
+
* arrow moves it, which is the keyboard's way to do what a drag does. The
|
|
43
|
+
* connections leaving a card are stops of their own, straight after it, and
|
|
44
|
+
* Enter on one goes to the card it arrives at.
|
|
45
|
+
*
|
|
46
|
+
* **Every drag can be done with clicks instead**, which WCAG 2.5.7 asks of a
|
|
47
|
+
* pointer that cannot hold a button down. A click on a selected card's move
|
|
48
|
+
* handle, a corner, a card's connection point or the end of a selected
|
|
49
|
+
* connection picks the thing up; it follows the pointer with no button held,
|
|
50
|
+
* and the next click puts it down wherever a drag let go there would have. On
|
|
51
|
+
* touch, the next tap is where it lands. Escape, or a press off the board,
|
|
52
|
+
* puts it back.
|
|
53
|
+
*
|
|
54
|
+
* **Connecting and removing are requests, and the page acts on them.** Drawing
|
|
55
|
+
* from a card's handle to another card, or pressing C on one and Enter on
|
|
56
|
+
* another, sends `helix-connect`; Delete on a card or a connection sends
|
|
57
|
+
* `helix-remove`, naming every connection a removed card would strand. A move
|
|
58
|
+
* can be applied by the board because the card is already there. A connection
|
|
59
|
+
* is a new element, and one a board added to markup React renders would be
|
|
60
|
+
* thrown away on the next render, so the board asks and the page writes it.
|
|
61
|
+
*
|
|
62
|
+
* **Markup rather than a `src` or a document property.** Nothing in this
|
|
63
|
+
* library fetches, and an array handed to an element is missing from the first
|
|
64
|
+
* paint of every server-rendered React page. The cards and connections are
|
|
65
|
+
* `helix-canvas-node` and `helix-canvas-edge` elements, in the served markup
|
|
66
|
+
* whichever renderer wrote them; `fromJsonCanvas` turns a JSON Canvas document
|
|
67
|
+
* into their props and `toJsonCanvas()` writes a board back out.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.100.0
|
|
70
|
+
* @status experimental
|
|
71
|
+
* @category media
|
|
72
|
+
* @aliases Board, JSON Canvas, Whiteboard
|
|
73
|
+
* @documentation https://fusion.dev/helix/components/canvas
|
|
74
|
+
*
|
|
75
|
+
* @slot empty - What to show where the document has no nodes.
|
|
76
|
+
* @slot footer - Chrome below the board.
|
|
77
|
+
* @slot header - Chrome above the board.
|
|
78
|
+
*
|
|
79
|
+
* @event {HelixBeforeMoveEvent} helix-before-move - Cards are about to move. Refuse it to keep the positions in your own state.
|
|
80
|
+
* @event {HelixBeforeReconnectEvent} helix-before-reconnect - A connection's end is about to move to another card or side. Refuse it to keep connections in your own state.
|
|
81
|
+
* @event {HelixBeforeRelabelEvent} helix-before-relabel - A connection's label or a group's name is about to change. Refuse it to keep labels in your own state.
|
|
82
|
+
* @event {HelixCanvasEditEvent} helix-canvas-edit - The reader asked to edit a card: a double-click, or Enter or F2. Open your own editor for it.
|
|
83
|
+
* @event {HelixCanvasPanEvent} helix-canvas-pan - The board was moved a step, by its controls or the arrow keys: a fact rather than a request. A drag says so through `helix-canvas-view`.
|
|
84
|
+
* @event {HelixCanvasViewEvent} helix-canvas-view - Where the board is looking changed, however it changed. The detail is the new view.
|
|
85
|
+
* @event {HelixCanvasZoomEvent} helix-canvas-zoom - The board zoomed a step, by its controls or the keys. A wheel or a pinch says so through `helix-canvas-view`.
|
|
86
|
+
* @event {HelixConnectEvent} helix-connect - A reader asked for two cards to be joined. Add the `helix-canvas-edge` to do it.
|
|
87
|
+
* @event {HelixMoveEvent} helix-move - Cards moved and the move is finished: a drag let go, a click that put a card down, or a key pressed.
|
|
88
|
+
* @event {HelixReconnectEvent} helix-reconnect - A connection's end moved, and the move is finished.
|
|
89
|
+
* @event {HelixRelabelEvent} helix-relabel - A connection's label or a group's name changed.
|
|
90
|
+
* @event {HelixRemoveEvent} helix-remove - A reader asked for cards or connections to go. Remove the elements it names.
|
|
91
|
+
* @event {HelixSelectEvent} helix-select - The selection changed. The detail's `value` is the names, comma separated, empty for none. Cancelable: refusing it keeps the selection where it was.
|
|
92
|
+
*
|
|
93
|
+
* @csspart arrow - The head an edge carries at an end that has one.
|
|
94
|
+
* @csspart board - The plane the cards are placed on, which is what pans and zooms.
|
|
95
|
+
* @csspart controls - The group the pan and zoom buttons sit in.
|
|
96
|
+
* @csspart draft - The connection being drawn, before it is asked for.
|
|
97
|
+
* @csspart edge - One connector between two cards.
|
|
98
|
+
* @csspart edge-end - An end of a selected connection, which a press picks up, a click as well as a drag.
|
|
99
|
+
* @csspart edge-target - The wider, unpainted line over a connector that a reader focuses and presses.
|
|
100
|
+
* @csspart edges - The layer the connectors are drawn in.
|
|
101
|
+
* @csspart footer - The strip below the board.
|
|
102
|
+
* @csspart fullscreen - The button that fills the screen.
|
|
103
|
+
* @csspart header - The strip above the board.
|
|
104
|
+
* @csspart label - The label on a connector.
|
|
105
|
+
* @csspart label-editor - The field a connection's label or a group's name is edited in, where it sits.
|
|
106
|
+
* @csspart live - What the board says while a connection is being made, for a screen reader.
|
|
107
|
+
* @csspart marquee - The box a Shift-drag across the empty board draws, which selects the cards it touches.
|
|
108
|
+
* @csspart pan-down - The button that moves the board down.
|
|
109
|
+
* @csspart pan-end - The button that moves the board the way the text ends.
|
|
110
|
+
* @csspart pan-start - The button that moves the board the way the text starts.
|
|
111
|
+
* @csspart pan-up - The button that moves the board up.
|
|
112
|
+
* @csspart region - The named region the board is drawn in.
|
|
113
|
+
* @csspart viewport - The box the board is drawn inside.
|
|
114
|
+
* @csspart zoom-in - The button that zooms in.
|
|
115
|
+
* @csspart zoom-out - The button that zooms out.
|
|
116
|
+
*
|
|
117
|
+
* @cssstate connecting - While a reader is drawing a connection.
|
|
118
|
+
* @cssstate direct - While the board moves without easing: under the reader's hand, or settling into its box.
|
|
119
|
+
* @cssstate empty - While the document has no nodes.
|
|
120
|
+
* @cssstate fullscreen - While the board fills the screen.
|
|
121
|
+
* @cssstate holding - While something a click picked up follows the pointer, until the next press puts it down.
|
|
122
|
+
* @cssstate idle - While the reader has been still long enough to hide the chrome.
|
|
123
|
+
* @cssstate pressing - While a press on the board, its cards or its connections is under way.
|
|
124
|
+
*/
|
|
125
|
+
export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
126
|
+
/** How a card says where its connections come from, with `{cards}`. */
|
|
127
|
+
comesFromLabel: string;
|
|
128
|
+
/** What it says when a connection is asked for, with `{from}` and `{to}`. */
|
|
129
|
+
connectedLabel: string;
|
|
130
|
+
/**
|
|
131
|
+
* What the live region says when a reader starts a connection, with `{from}`
|
|
132
|
+
* filled in.
|
|
133
|
+
*
|
|
134
|
+
* **Every sentence this board speaks is a property**, the rule the pan
|
|
135
|
+
* controls already kept with `pan-up-label` and its three: a board on a page in another
|
|
136
|
+
* language otherwise read its connections out in English.
|
|
137
|
+
*/
|
|
138
|
+
connectingLabel: string;
|
|
139
|
+
/**
|
|
140
|
+
* What a connection is called, with `{from}` and `{to}`.
|
|
141
|
+
*
|
|
142
|
+
* Its own label, where it has one, is its description rather than part of
|
|
143
|
+
* this, so a reader hears the ends first and what the line says after.
|
|
144
|
+
*/
|
|
145
|
+
connectionLabel: string;
|
|
146
|
+
/**
|
|
147
|
+
* Accessible name for the board, which is the one thing a consumer must write.
|
|
148
|
+
*
|
|
149
|
+
* A document has no name of its own in the format, and "Canvas" names the
|
|
150
|
+
* widget rather than the thinking on it.
|
|
151
|
+
*/
|
|
152
|
+
label: string;
|
|
153
|
+
/**
|
|
154
|
+
* What the field a label is edited in is called, with `{name}` for what it
|
|
155
|
+
* labels.
|
|
156
|
+
*/
|
|
157
|
+
labelEditorLabel: string;
|
|
158
|
+
/**
|
|
159
|
+
* How a card says where its connections go, with `{cards}` as the list.
|
|
160
|
+
*
|
|
161
|
+
* The list is joined the way the page's language joins one, "Second and
|
|
162
|
+
* Third", rather than with a comma this component chose.
|
|
163
|
+
*/
|
|
164
|
+
leadsToLabel: string;
|
|
165
|
+
/**
|
|
166
|
+
* The order a reader meets the cards in.
|
|
167
|
+
*
|
|
168
|
+
* `spatial` bands them into rows and reads each row across, which is how a
|
|
169
|
+
* person reads a board laid out on a grid and is a heuristic a loose board
|
|
170
|
+
* defeats. `edges` follows the arrows from the cards nothing points to, which
|
|
171
|
+
* on a board that is a flow is the order its author meant.
|
|
172
|
+
*
|
|
173
|
+
* Absent is spatial, a resting value being an attribute's absence: a default
|
|
174
|
+
* that reflected would write a choice onto every host that no server sent.
|
|
175
|
+
*/
|
|
176
|
+
order?: 'spatial' | 'edges';
|
|
177
|
+
/**
|
|
178
|
+
* How every connection travels, where it does not say: `straight`, or `step`
|
|
179
|
+
* for right angles.
|
|
180
|
+
*
|
|
181
|
+
* Absent is a curve. A flowchart wants `step` on all of its edges, and
|
|
182
|
+
* writing it once here rather than on each is the reason this exists; an
|
|
183
|
+
* edge's own `path` still wins.
|
|
184
|
+
*/
|
|
185
|
+
path?: 'straight' | 'step';
|
|
186
|
+
/**
|
|
187
|
+
* Keeps every card where its author put it.
|
|
188
|
+
*
|
|
189
|
+
* **The attribute is `readonly`, which is the platform's spelling**, and the
|
|
190
|
+
* reverse of an `editable` switch on purpose: a form control takes input
|
|
191
|
+
* unless it is told not to, and a board a reader can rearrange is the same
|
|
192
|
+
* kind of thing. A drag on a card pans the board instead, and the keys still
|
|
193
|
+
* walk the cards.
|
|
194
|
+
*/
|
|
195
|
+
readOnly: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* What the live region says when a reader picks up a connection's end, with
|
|
198
|
+
* `{from}` and `{to}`.
|
|
199
|
+
*/
|
|
200
|
+
reconnectingLabel: string;
|
|
201
|
+
/**
|
|
202
|
+
* The cards and connections the reader selected, by name, comma separated,
|
|
203
|
+
* and empty for none.
|
|
204
|
+
*
|
|
205
|
+
* **Comma separated, the way `Listbox` writes a multiple value**, so a page
|
|
206
|
+
* reads one selection the same way wherever it comes from. A click, or a key
|
|
207
|
+
* that lands on one, selects it alone; Shift, Command or Control with a click
|
|
208
|
+
* adds or takes one away, and so does Space; Command or Control with A
|
|
209
|
+
* selects everything; Shift and a drag across the empty board selects the
|
|
210
|
+
* cards the box touches. A click on the empty board, or Escape, selects
|
|
211
|
+
* nothing. Dragging, Shift with an arrow, and Delete act on the whole
|
|
212
|
+
* selection.
|
|
213
|
+
*
|
|
214
|
+
* **Kept apart from focus**, so it stays when focus leaves: a reader who
|
|
215
|
+
* selects cards and clicks a button beside the board to act on them has not
|
|
216
|
+
* cleared what the button acts on by clicking. A connection with no name is
|
|
217
|
+
* called by its ends, `from->to`, which is also why a name has to be unique
|
|
218
|
+
* on its board across cards and connections both, and may not hold a comma.
|
|
219
|
+
*
|
|
220
|
+
* Written to select from outside, and read to act on the selection.
|
|
221
|
+
*/
|
|
222
|
+
selected: string;
|
|
223
|
+
/**
|
|
224
|
+
* A label being edited in place: whose, and what it said before.
|
|
225
|
+
*/
|
|
226
|
+
private editing;
|
|
227
|
+
/** What it says when a reader stops connecting without asking. */
|
|
228
|
+
stoppedLabel: string;
|
|
229
|
+
/** The card or connection that holds the board's one tab stop, by its key. */
|
|
230
|
+
private stop;
|
|
231
|
+
/**
|
|
232
|
+
* A connection being made: the card it starts from, the side where a pointer
|
|
233
|
+
* started it, and where the pointer is, in the document's own units.
|
|
234
|
+
*/
|
|
235
|
+
private linking;
|
|
236
|
+
/** What the live region says, which is only ever about a connection being made. */
|
|
237
|
+
private said;
|
|
238
|
+
/**
|
|
239
|
+
* Where focus goes once something a reader removed has gone.
|
|
240
|
+
*
|
|
241
|
+
* **Held until the page acts**, because the board only asks: React removes the
|
|
242
|
+
* element on its next render rather than inside the listener, so moving focus
|
|
243
|
+
* at the moment of asking would move it off an element that is still there,
|
|
244
|
+
* or, for a page that declines, off one that stays.
|
|
245
|
+
*/
|
|
246
|
+
private refocus;
|
|
247
|
+
/**
|
|
248
|
+
* Where the plane's corner was on the last render, in the document's units.
|
|
249
|
+
*
|
|
250
|
+
* **A card moved past the edge of the board moves the corner**, since the
|
|
251
|
+
* plane is sized to what it holds, and every card is placed from that corner:
|
|
252
|
+
* without holding the view against it, dragging one card left slid every
|
|
253
|
+
* other card right by the same distance.
|
|
254
|
+
*/
|
|
255
|
+
private origin?;
|
|
256
|
+
/** Where the board sits, in board coordinates, and how far it is zoomed. */
|
|
257
|
+
private at;
|
|
258
|
+
/**
|
|
259
|
+
* Whether the move under way should land rather than glide: the reader's own
|
|
260
|
+
* hand, or the board settling into its box.
|
|
261
|
+
*
|
|
262
|
+
* **A drag must not be eased, and that is what made it feel like it snapped.**
|
|
263
|
+
* The plane carries a transition so a press on the pad glides rather than
|
|
264
|
+
* jumping, and a drag writes a new transform on every pointer move: each one
|
|
265
|
+
* was then animated toward the last, so the board chased the pointer a
|
|
266
|
+
* fraction behind and arrived in steps. Continuous input is direct and
|
|
267
|
+
* discrete input is eased, which is the rule a map or an editor follows.
|
|
268
|
+
*/
|
|
269
|
+
private direct;
|
|
270
|
+
/**
|
|
271
|
+
* Whether the reader has moved the board, which is what stops it re-fitting.
|
|
272
|
+
*
|
|
273
|
+
* A board opens showing all of itself, and keeps doing so while the box it is
|
|
274
|
+
* drawn in settles: a list wraps to a second row, a panel opens, a container
|
|
275
|
+
* resizes. The moment a reader pans or zooms they have chosen a view, and a
|
|
276
|
+
* later resize must not take it away from them.
|
|
277
|
+
*/
|
|
278
|
+
private touched;
|
|
279
|
+
/** Watches the box, because the fit is a fraction of a measurement. */
|
|
280
|
+
private sizes?;
|
|
281
|
+
/** The element the observer is on, so a render does not observe it again. */
|
|
282
|
+
private watched;
|
|
283
|
+
/**
|
|
284
|
+
* Hears what the cards and connections change that no property of theirs
|
|
285
|
+
* says: the words in a card, and a color written into an element's `style`.
|
|
286
|
+
*
|
|
287
|
+
* Both are read into what is drawn, a card's words into every connection's
|
|
288
|
+
* name and the sentence saying where it leads, and neither reaches the board
|
|
289
|
+
* otherwise: a card whose text a page rewrote was read out under its old
|
|
290
|
+
* words for the life of the board.
|
|
291
|
+
*/
|
|
292
|
+
private words?;
|
|
293
|
+
/** The custom color each card and connection was last drawn in. */
|
|
294
|
+
private readonly painted;
|
|
295
|
+
/** Where each card was last written to be, so one that did not move is left alone. */
|
|
296
|
+
private readonly placed;
|
|
297
|
+
/** The box as the observer last measured it, so a resize knows what it gained. */
|
|
298
|
+
private measured?;
|
|
299
|
+
/**
|
|
300
|
+
* The box the board is drawn in, which is not the host.
|
|
301
|
+
*
|
|
302
|
+
* **The host measures nothing**: it draws no box of its own, so `clientWidth`
|
|
303
|
+
* on it is zero and every sum against it is zero too. The viewport inside the
|
|
304
|
+
* shadow root is the thing with a size, and it is what a fit, a pan step and a
|
|
305
|
+
* card brought to the middle are all fractions of.
|
|
306
|
+
*/
|
|
307
|
+
private get box();
|
|
308
|
+
/**
|
|
309
|
+
* The cards, read from the light DOM.
|
|
310
|
+
*
|
|
311
|
+
* **`children` and not a slot**, which is what every family here that reads
|
|
312
|
+
* its own contents does, and it is undefined on the server: a board cannot
|
|
313
|
+
* count its cards while it is being rendered, so the plane, the connectors and
|
|
314
|
+
* the reading list are assembled on hydration and the cards themselves are in
|
|
315
|
+
* the served markup because the consumer wrote them there.
|
|
316
|
+
*/
|
|
317
|
+
private get cards();
|
|
318
|
+
/** A card by its name, looked up rather than searched for. */
|
|
319
|
+
private get byName();
|
|
320
|
+
/** A card's geometry by its name. */
|
|
321
|
+
private get byId();
|
|
322
|
+
/** The groups alone, which is all a card's group is chosen from. */
|
|
323
|
+
private get groups();
|
|
324
|
+
/**
|
|
325
|
+
* What the board reads from its children, kept for the rest of the turn.
|
|
326
|
+
*
|
|
327
|
+
* **Read once rather than on every question.** A render asked for the cards,
|
|
328
|
+
* the connections and the reading order a dozen times over, and the
|
|
329
|
+
* selection asked for the reading order once per name in it: every step of a
|
|
330
|
+
* drag rebuilt all of them from the DOM that many times. Cleared when an
|
|
331
|
+
* update is asked for, which every change the board makes or hears about
|
|
332
|
+
* does, and at the end of the turn, so a question asked later reads again.
|
|
333
|
+
*/
|
|
334
|
+
private cache;
|
|
335
|
+
private remember;
|
|
336
|
+
/**
|
|
337
|
+
* @internal Forgets what the board read from its children, then asks for an
|
|
338
|
+
* update as Lit does: every change the board makes or hears about asks for
|
|
339
|
+
* one, which makes this the one place the reading goes stale.
|
|
340
|
+
*/
|
|
341
|
+
requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: Parameters<HelixElement['requestUpdate']>[2]): void;
|
|
342
|
+
/** The same, as the shape the geometry works in. */
|
|
343
|
+
private get nodes();
|
|
344
|
+
private readNodes;
|
|
345
|
+
/** A custom color written on an element, remembered as the one drawn. */
|
|
346
|
+
private paint;
|
|
347
|
+
/** The connectors a consumer declared, which draw nothing themselves. */
|
|
348
|
+
private get edges();
|
|
349
|
+
/**
|
|
350
|
+
* The sides each connection was first drawn from and to, where it names none.
|
|
351
|
+
*
|
|
352
|
+
* **Chosen once, and kept while the cards move.** A connection that names no
|
|
353
|
+
* side takes the ones facing the other card, and that was asked on every
|
|
354
|
+
* draw: a card dragged past the diagonal between the two flipped the answer,
|
|
355
|
+
* and the connection jumped from one point to another under the reader's
|
|
356
|
+
* hand. So the first answer is remembered for as long as the connection joins
|
|
357
|
+
* the same two cards, and a side the page writes still wins. Keyed on the two
|
|
358
|
+
* cards as well as the connection, so a reconnected one chooses again.
|
|
359
|
+
*/
|
|
360
|
+
private readonly sides;
|
|
361
|
+
private readEdges;
|
|
362
|
+
/** The events this family names for itself, the surface being shared. */
|
|
363
|
+
protected panEvent(detail: ViewportPanDetail): Event;
|
|
364
|
+
protected zoomEvent(detail: ViewportZoomDetail): Event;
|
|
365
|
+
protected get restingControlsLabel(): string;
|
|
366
|
+
/**
|
|
367
|
+
* Zoom and fullscreen, without the pad.
|
|
368
|
+
*
|
|
369
|
+
* A board is dragged, and its cards walked with the arrow keys, so the four
|
|
370
|
+
* pan buttons were a third way to do what two others already did, and they
|
|
371
|
+
* took a third of the frame's corner. `controls="pan zoom fullscreen"` puts
|
|
372
|
+
* them back.
|
|
373
|
+
*/
|
|
374
|
+
protected get restingControls(): string;
|
|
375
|
+
/**
|
|
376
|
+
* Moves the board, and says so.
|
|
377
|
+
*
|
|
378
|
+
* **`Map` asks and this tells.** The mixin's `pan` announces a request, which
|
|
379
|
+
* is all a frame around somebody else's map can do; here the board is drawn
|
|
380
|
+
* from a document this component holds, so the same press moves it. The event
|
|
381
|
+
* still goes out, because a consumer keeping a minimap or a scroll position in
|
|
382
|
+
* step needs to hear it, and it is not cancelable for the same reason: it
|
|
383
|
+
* reports rather than asks.
|
|
384
|
+
*/
|
|
385
|
+
pan(to: ViewportWay): void;
|
|
386
|
+
/**
|
|
387
|
+
* Zooms the board about the middle of the view, and says so.
|
|
388
|
+
*
|
|
389
|
+
* **The middle, not the corner, and the difference is whether zooming is
|
|
390
|
+
* usable.** The plane scales from its own origin, so leaving the offset alone
|
|
391
|
+
* grows the board away from the top-left: what a reader was looking at slides
|
|
392
|
+
* out of the box and they have to pan it back after every press. Holding the
|
|
393
|
+
* center point still is two lines of arithmetic and it is what every canvas
|
|
394
|
+
* does.
|
|
395
|
+
*
|
|
396
|
+
* Held between a tenth and eight times, which is far enough out to see a
|
|
397
|
+
* large board whole and far enough in to read what a small card holds.
|
|
398
|
+
*/
|
|
399
|
+
zoom(by: number): void;
|
|
400
|
+
/**
|
|
401
|
+
* Brings a card, by name, to the middle of the viewport.
|
|
402
|
+
*
|
|
403
|
+
* What a reader landing on a card off the edge of the view gets, and what a
|
|
404
|
+
* page's own search or outline can call to take a reader to one.
|
|
405
|
+
*/
|
|
406
|
+
show(name: string): void;
|
|
407
|
+
/**
|
|
408
|
+
* Whether a press on the board is under way, a drag of the board, a card or
|
|
409
|
+
* a connection, so a stylesheet can stop the press selecting text while it
|
|
410
|
+
* lasts and only then: a board that never let its text be selected also
|
|
411
|
+
* never let a page's own editor type into a card.
|
|
412
|
+
*/
|
|
413
|
+
private pressing;
|
|
414
|
+
/**
|
|
415
|
+
* Whether the press under way began on a card or a connection, so the focus
|
|
416
|
+
* it moves is not also read as a keyboard landing, which selects.
|
|
417
|
+
*/
|
|
418
|
+
private pointing;
|
|
419
|
+
/** A box being drawn across the empty board, in the document's units. */
|
|
420
|
+
private marquee;
|
|
421
|
+
/** A card being resized from a corner, with the box it started from. */
|
|
422
|
+
private sizing;
|
|
423
|
+
/** Where a drag started, and where the board was when it did. */
|
|
424
|
+
private dragging;
|
|
425
|
+
/**
|
|
426
|
+
* A press on a card that may become a move, with where everything it carries
|
|
427
|
+
* started. `moved` is what the last step settled on, which the drop reports.
|
|
428
|
+
*/
|
|
429
|
+
private carrying;
|
|
430
|
+
/**
|
|
431
|
+
* Every stop in the order the arrows walk them: each card in reading order,
|
|
432
|
+
* then the connections leaving it.
|
|
433
|
+
*/
|
|
434
|
+
private get walk();
|
|
435
|
+
private readWalk;
|
|
436
|
+
/** Focuses a stop, a card by its own method and a connection by its target. */
|
|
437
|
+
private focusStop;
|
|
438
|
+
/** The connection an event came from, where it came from one. */
|
|
439
|
+
private edgeOf;
|
|
440
|
+
/** A point on screen, in the document's own units. */
|
|
441
|
+
private toDocument;
|
|
442
|
+
/**
|
|
443
|
+
* The card under a point, the smallest where they overlap, so a card inside
|
|
444
|
+
* a group is found before the group around it.
|
|
445
|
+
*/
|
|
446
|
+
private cardAt;
|
|
447
|
+
/** What a card is called, by id, for what the live region says. */
|
|
448
|
+
private nameOf;
|
|
449
|
+
/** Starts a connection from a card, from the keyboard. */
|
|
450
|
+
private startLinking;
|
|
451
|
+
/**
|
|
452
|
+
* A card a connection could arrive at, or nothing: not the card it started
|
|
453
|
+
* from, and not one that is held.
|
|
454
|
+
*/
|
|
455
|
+
private arrival;
|
|
456
|
+
/**
|
|
457
|
+
* Whether a connection is being drawn, which a press on a connection is not
|
|
458
|
+
* until it moves.
|
|
459
|
+
*
|
|
460
|
+
* **A click on a connection is a click.** The press picks up the nearer end
|
|
461
|
+
* so a drag can start from it, and every card lit up its handles for as long
|
|
462
|
+
* as the button was down: a reader selecting a line watched the whole board
|
|
463
|
+
* flash as though they had started connecting.
|
|
464
|
+
*/
|
|
465
|
+
private get drawing();
|
|
466
|
+
/** Ends a connection, asking for it where it has somewhere to go. */
|
|
467
|
+
private finishLinking;
|
|
468
|
+
/**
|
|
469
|
+
* Picks up one end of a connection, from the keyboard or a drag.
|
|
470
|
+
*
|
|
471
|
+
* The end in hand is the one a drag started nearer, and `to` from the
|
|
472
|
+
* keyboard, where there is no nearer; the other end stays where it is,
|
|
473
|
+
* side and all.
|
|
474
|
+
*/
|
|
475
|
+
private startReconnect;
|
|
476
|
+
/**
|
|
477
|
+
* Lets go of a connection's end: onto a card, which moves it there; or onto
|
|
478
|
+
* nothing, which asks for the connection to go.
|
|
479
|
+
*
|
|
480
|
+
* **Dropped on nothing is a disconnect**, which is what a reader pulling a
|
|
481
|
+
* line off a card means, and what every editor with draggable ends does. It
|
|
482
|
+
* is a request like Delete, because the element is the page's to remove.
|
|
483
|
+
*/
|
|
484
|
+
private finishReconnect;
|
|
485
|
+
/**
|
|
486
|
+
* Carries the selection and the tab stop from a connection's old key to its
|
|
487
|
+
* new one.
|
|
488
|
+
*
|
|
489
|
+
* **A connection with no `name` is known by its two cards**, so moving an end
|
|
490
|
+
* gives it a new key: the selection went on naming one that no longer
|
|
491
|
+
* existed, so the connection just moved was selected and drawn as not, and
|
|
492
|
+
* the tab stop pointed at nothing. A named connection keeps its key, and
|
|
493
|
+
* nothing moves.
|
|
494
|
+
*/
|
|
495
|
+
private rekey;
|
|
496
|
+
/**
|
|
497
|
+
* Asks for a card or a connection to go, and moves focus on once it has.
|
|
498
|
+
*
|
|
499
|
+
* A card takes every connection touching it, which would otherwise stop being
|
|
500
|
+
* drawn and stay behind in the page's markup as an element joining nothing.
|
|
501
|
+
*/
|
|
502
|
+
private requestRemove;
|
|
503
|
+
/**
|
|
504
|
+
* A click on a card or a connection: it alone, or with a modifier, added or
|
|
505
|
+
* taken away.
|
|
506
|
+
*/
|
|
507
|
+
private clicked;
|
|
508
|
+
/**
|
|
509
|
+
* The cards a box touches, by name, and the groups it holds whole.
|
|
510
|
+
*
|
|
511
|
+
* **A group only when the box takes all of it.** A box drawn to select the
|
|
512
|
+
* cards inside a group starts and ends inside the group, and touching was
|
|
513
|
+
* enough to select the group too, so a box could not select a group's cards
|
|
514
|
+
* without its box coming along.
|
|
515
|
+
*/
|
|
516
|
+
private within;
|
|
517
|
+
/**
|
|
518
|
+
* The line a connection is drawn along on the plane, and its middle, where
|
|
519
|
+
* both its cards are on the board; nothing where either is not.
|
|
520
|
+
*/
|
|
521
|
+
private geometryOf;
|
|
522
|
+
/** The card an event came from, wherever inside it the event began. */
|
|
523
|
+
private cardOf;
|
|
524
|
+
/**
|
|
525
|
+
* The card and everything a move of it carries.
|
|
526
|
+
*
|
|
527
|
+
* A group carries every card inside its bounds, groups inside it included,
|
|
528
|
+
* which is what the format means by a group and what every board does.
|
|
529
|
+
*/
|
|
530
|
+
private carried;
|
|
531
|
+
/**
|
|
532
|
+
* Everything a move of a card carries, and of every other selected card with
|
|
533
|
+
* it where it is one of the selection: each card's group contents too, and
|
|
534
|
+
* each card once however many ways it is reached.
|
|
535
|
+
*/
|
|
536
|
+
private carriedAll;
|
|
537
|
+
/**
|
|
538
|
+
* The box a resize from a corner draws, held to a least size so a card
|
|
539
|
+
* cannot be dragged inside out.
|
|
540
|
+
*/
|
|
541
|
+
private resized;
|
|
542
|
+
/**
|
|
543
|
+
* Whether a card is held where it is, by its own switch or the board's.
|
|
544
|
+
*
|
|
545
|
+
* A read-only card is not moved, connected from, connected to, or removed,
|
|
546
|
+
* and a read-only board holds every card whatever each one says.
|
|
547
|
+
*/
|
|
548
|
+
private fixed;
|
|
549
|
+
/** The element behind a connection's key, for what only the element knows. */
|
|
550
|
+
private edgeElement;
|
|
551
|
+
/** The connections declared, in the order they were written. */
|
|
552
|
+
private get edgeElements();
|
|
553
|
+
/**
|
|
554
|
+
* What a connection is called in the walk and on the tab stop.
|
|
555
|
+
*
|
|
556
|
+
* Its element's id where it has one, and its two ends where it does not: a
|
|
557
|
+
* page that writes edges without ids still gets one stop per connection.
|
|
558
|
+
* **And a count where two share both ends**, the second `a->b#2`: under one
|
|
559
|
+
* key the walk found the first every time and never reached the card after.
|
|
560
|
+
*/
|
|
561
|
+
private keyOfElement;
|
|
562
|
+
/** The key of a connection as the board read it, which is its element's. */
|
|
563
|
+
private keyOf;
|
|
564
|
+
/** Each connection read, and the key of the element it was read from. */
|
|
565
|
+
private edgeKeys;
|
|
566
|
+
/** A stop's key as the name a page sees: a card's name, a connection's name or ends. */
|
|
567
|
+
private publicName;
|
|
568
|
+
/** The stop a public name means, where it means one. */
|
|
569
|
+
private keyNamed;
|
|
570
|
+
/** The selection, as the keys of the stops in it. */
|
|
571
|
+
private get picked();
|
|
572
|
+
/**
|
|
573
|
+
* Selects stops, or nothing, and says so: `helix-select`, which a page can
|
|
574
|
+
* refuse, with the names as its value.
|
|
575
|
+
*/
|
|
576
|
+
private choose;
|
|
577
|
+
/** Adds a stop to the selection, or takes it out where it was in. */
|
|
578
|
+
private toggle;
|
|
579
|
+
/** The cards in the selection. */
|
|
580
|
+
private get pickedCards();
|
|
581
|
+
/** A card by name. */
|
|
582
|
+
private cardNamed;
|
|
583
|
+
/**
|
|
584
|
+
* Moves cards, having asked first.
|
|
585
|
+
*
|
|
586
|
+
* **The same contract as `open` on a dialog.** The request goes out before
|
|
587
|
+
* anything moves; refused, nothing does, because the consumer is holding the
|
|
588
|
+
* positions and will render them. Unrefused, the board writes them onto the
|
|
589
|
+
* cards, which is the uncontrolled board a consumer gets by doing nothing.
|
|
590
|
+
* Returns whether it applied, so a caller knows whether to report a finish.
|
|
591
|
+
*/
|
|
592
|
+
private requestMove;
|
|
593
|
+
/**
|
|
594
|
+
* Drag to move the board, which is the gesture a canvas is reached for with.
|
|
595
|
+
*
|
|
596
|
+
* **Here rather than in the surface, because a map handles its own.** What
|
|
597
|
+
* `Map` frames is somebody else's renderer, and MapLibre and Leaflet both
|
|
598
|
+
* drag their own view: a frame that dragged too would move the map twice. A
|
|
599
|
+
* board is drawn here, so the drag is this family's.
|
|
600
|
+
*
|
|
601
|
+
* The capture is an enhancement and the drag survives losing it, which is what
|
|
602
|
+
* `capturePointer` is for: a pointer that leaves the box mid-drag keeps
|
|
603
|
+
* moving the board rather than sticking.
|
|
604
|
+
*
|
|
605
|
+
* **Heard on the host rather than on the viewport**, and the cards are why.
|
|
606
|
+
* A card is the consumer's element, slotted in, so what happens on one
|
|
607
|
+
* reaches the host whatever else it passes on the way; a listener in the
|
|
608
|
+
* shadow root depends on the event being routed through the slot, which a
|
|
609
|
+
* browser does and a DOM implementation a consumer's tests run in need not.
|
|
610
|
+
* So the host listens, and the path says what was pressed.
|
|
611
|
+
*/
|
|
612
|
+
private readonly handlePointerDown;
|
|
613
|
+
private readonly handlePointerMove;
|
|
614
|
+
private readonly handlePointerUp;
|
|
615
|
+
/**
|
|
616
|
+
* Whether a release picks up what its press took hold of, rather than
|
|
617
|
+
* putting it down.
|
|
618
|
+
*
|
|
619
|
+
* **Moving without dragging, which WCAG 2.5.7 asks every drag to offer.** A
|
|
620
|
+
* press on a corner, a handle, a connection's end or a card's move handle
|
|
621
|
+
* that is let go where it was pressed is a click, and a click picks the thing
|
|
622
|
+
* up: the box, the line or the card then follows the pointer with no button
|
|
623
|
+
* held, and the next press puts it down wherever a drag let go there would
|
|
624
|
+
* have. On touch, where nothing follows a finger that is not down, the next
|
|
625
|
+
* tap is where it lands. Escape, or a press off the board, puts it back.
|
|
626
|
+
*
|
|
627
|
+
* Not while putting down, or the press that puts a thing down where it was
|
|
628
|
+
* picked up would pick it up again.
|
|
629
|
+
*/
|
|
630
|
+
private picksUp;
|
|
631
|
+
/** Whether something a click picked up is being carried to the next press. */
|
|
632
|
+
private get held();
|
|
633
|
+
/** Whether the document is being listened to for the end of a hold. */
|
|
634
|
+
private holding;
|
|
635
|
+
/** Whether the press putting something down is being handled, which picks nothing up. */
|
|
636
|
+
private putting;
|
|
637
|
+
/** When something was last put down, which a double click that follows is not. */
|
|
638
|
+
private putAt;
|
|
639
|
+
/**
|
|
640
|
+
* Puts down what a click picked up, where this press is: the step a drag
|
|
641
|
+
* would take to here, then its release.
|
|
642
|
+
*/
|
|
643
|
+
private putDown;
|
|
644
|
+
/**
|
|
645
|
+
* Puts back what a click picked up, as though it had never been.
|
|
646
|
+
*
|
|
647
|
+
* A card and a corner go back to where they started, asked for like any
|
|
648
|
+
* move so a board whose page holds the positions is told; a line is dropped.
|
|
649
|
+
* Nothing is announced as moved, because nothing did.
|
|
650
|
+
*/
|
|
651
|
+
private putBack;
|
|
652
|
+
/** Stops listening for the press or the key that ends a hold. */
|
|
653
|
+
private letGo;
|
|
654
|
+
private readonly handleHeldKey;
|
|
655
|
+
/** A press off the board while something is held, which puts it back. */
|
|
656
|
+
private readonly handleHeldOutside;
|
|
657
|
+
/**
|
|
658
|
+
* A pinch, which zooms, and the wheel, which pans only once the board fills
|
|
659
|
+
* the screen.
|
|
660
|
+
*
|
|
661
|
+
* **`ctrlKey` is a pinch as well as a control press**, which is the platform's
|
|
662
|
+
* own convention rather than this component's: a trackpad pinch arrives as a
|
|
663
|
+
* wheel event with `ctrlKey` set, on every browser, and a component that
|
|
664
|
+
* ignored it would be the one thing on the page a pinch does not work on.
|
|
665
|
+
*
|
|
666
|
+
* **A plain wheel belongs to the page while the board is part of one.** Taking
|
|
667
|
+
* it trapped the reader: a board is most of a screen tall, so scrolling down a
|
|
668
|
+
* page stopped the moment the pointer crossed one and panned it instead, with
|
|
669
|
+
* no way on but to move the pointer off it first. Measured on the examples
|
|
670
|
+
* page, where the second board could not be scrolled to. A drag is how an
|
|
671
|
+
* embedded board moves, which is the bargain an embedded map makes too; once
|
|
672
|
+
* the reader has filled the screen with it there is no page left to scroll, so
|
|
673
|
+
* the wheel is the board's.
|
|
674
|
+
*/
|
|
675
|
+
private readonly handleWheel;
|
|
676
|
+
/**
|
|
677
|
+
* The keys on a card or a connection.
|
|
678
|
+
*
|
|
679
|
+
* **Only from the stop itself**, not from inside what a card holds: a card may
|
|
680
|
+
* hold a link, a field or a chart that answers the arrows itself, and a press
|
|
681
|
+
* taken from under one of those walked the board instead of the chart.
|
|
682
|
+
*
|
|
683
|
+
* **Arrows walk in reading order rather than in space.** The next card in the
|
|
684
|
+
* order is the one a reader who cannot see the board needs, and the spatial
|
|
685
|
+
* neighbor is a guess about where they think they are. Right and down go on,
|
|
686
|
+
* left and up go back, Home and End go to the ends, and Escape goes back out
|
|
687
|
+
* to the board, where the arrows pan it again.
|
|
688
|
+
*
|
|
689
|
+
* On a card, Shift with an arrow moves it, C starts a connection and Delete
|
|
690
|
+
* asks for it to go. On a connection, Enter goes to the card it arrives at and
|
|
691
|
+
* Delete asks for it to go. While a connection is being made, Enter on a card
|
|
692
|
+
* asks for it and Escape stops.
|
|
693
|
+
*/
|
|
694
|
+
private readonly handleStopKeydown;
|
|
695
|
+
/**
|
|
696
|
+
* A stop a reader landed on becomes the tab stop, and a card comes into view.
|
|
697
|
+
*
|
|
698
|
+
* Into view rather than to the middle: a reader walking a row of cards that
|
|
699
|
+
* are all on screen should see the focus ring move along it, not the board
|
|
700
|
+
* lurch under every press.
|
|
701
|
+
*/
|
|
702
|
+
private readonly handleFocusIn;
|
|
703
|
+
/**
|
|
704
|
+
* A connection being made from the keyboard ends when the reader leaves
|
|
705
|
+
* the board, as Escape ends it.
|
|
706
|
+
*
|
|
707
|
+
* Otherwise the board went on showing every card as somewhere to land, and
|
|
708
|
+
* a reader who came back and pressed Enter on a card connected something
|
|
709
|
+
* they had long since walked away from. Only for somewhere else on the
|
|
710
|
+
* page: a window losing focus names nothing, and the reader switching away
|
|
711
|
+
* and back is still in the middle of it. A pointer's connection is its
|
|
712
|
+
* own, ended by its release.
|
|
713
|
+
*/
|
|
714
|
+
private readonly handleFocusOut;
|
|
715
|
+
/** Brings a card into view, where it is not already whole in it. */
|
|
716
|
+
private reveal;
|
|
717
|
+
/**
|
|
718
|
+
* Edits a stop: a connection's label or a group's name in place, which the
|
|
719
|
+
* board draws; a card's content by asking, which the board does not.
|
|
720
|
+
*/
|
|
721
|
+
private editStop;
|
|
722
|
+
/** A double-click on a card or a connection edits it, the pointer's F2. */
|
|
723
|
+
private readonly handleDoubleClick;
|
|
724
|
+
/**
|
|
725
|
+
* Finishes editing a label: asks, writes it where the page did not refuse,
|
|
726
|
+
* and says it did. The same value is no change and asks nothing.
|
|
727
|
+
*/
|
|
728
|
+
private finishEditing;
|
|
729
|
+
/**
|
|
730
|
+
* The keys in a label being edited, which are the field's: Enter keeps,
|
|
731
|
+
* Escape puts it back, and nothing reaches the board, whose arrows would
|
|
732
|
+
* otherwise pan it out from under the caret.
|
|
733
|
+
*/
|
|
734
|
+
private readonly handleEditorKeydown;
|
|
735
|
+
private readonly handleEditorBlur;
|
|
736
|
+
/** The field a label is edited in, where the label is, while one is. */
|
|
737
|
+
private renderEditor;
|
|
738
|
+
/** The box a Shift-drag is drawing, on the plane, while it is. */
|
|
739
|
+
private renderMarquee;
|
|
740
|
+
/** Scales about a point in the box, which is what both the buttons and a pinch want. */
|
|
741
|
+
private zoomAbout;
|
|
742
|
+
/** What one card says in the reading list, its links included. */
|
|
743
|
+
private linksOf;
|
|
744
|
+
/**
|
|
745
|
+
* Every card's sentence at once: one pass over the connections, and one
|
|
746
|
+
* list formatter, rather than both again for every card.
|
|
747
|
+
*/
|
|
748
|
+
private readLinks;
|
|
749
|
+
/** What a node is called, whichever kind it is. */
|
|
750
|
+
private textOf;
|
|
751
|
+
/**
|
|
752
|
+
* The part of the box a fit may use, which is the box less the controls.
|
|
753
|
+
*
|
|
754
|
+
* **The controls are chrome, not free space.** They float over the board in
|
|
755
|
+
* a corner, and a fit that used the whole box put the nearest card under
|
|
756
|
+
* them: the opening view of a board hid part of the board behind the buttons
|
|
757
|
+
* that move it. A map can let its controls sit over the tiles because a map
|
|
758
|
+
* is continuous; a card is not, and one half-covered reads as a broken layout.
|
|
759
|
+
*
|
|
760
|
+
* **A band or a column, whichever costs less.** The cluster sits in a corner,
|
|
761
|
+
* so keeping the board clear of it takes either a band across the edge it sits
|
|
762
|
+
* on or a column down the side it sits on, and either alone is enough. The
|
|
763
|
+
* cheaper wins, measured rather than guessed from the shape: a wide short box
|
|
764
|
+
* loses less to a column and a tall narrow one less to a band. Never more than
|
|
765
|
+
* half the box, or a small frame would fit its board into nothing.
|
|
766
|
+
*
|
|
767
|
+
* Measured rather than computed from `controls` and `controls-placement`, so
|
|
768
|
+
* a consumer who restyles the cluster, moves it with a part rule, or hides it
|
|
769
|
+
* with `controls="none"` gets a fit that follows what is actually there.
|
|
770
|
+
*/
|
|
771
|
+
private get free();
|
|
772
|
+
/**
|
|
773
|
+
* Where the board is looking: the document's point at the middle of the view,
|
|
774
|
+
* and the zoom.
|
|
775
|
+
*
|
|
776
|
+
* **Read to save a view and written to restore one**, which a consumer keeping
|
|
777
|
+
* a minimap in step, or putting a reader back where they were, had no way to
|
|
778
|
+
* do: where the board sat was private, and the events said only which way a
|
|
779
|
+
* control had moved it. The middle rather than a corner, so a view saved in
|
|
780
|
+
* one box shows the same thing in the middle of a box of another size.
|
|
781
|
+
* Writing one counts as the reader choosing a view, so a later resize keeps
|
|
782
|
+
* it rather than fitting the board again.
|
|
783
|
+
*/
|
|
784
|
+
get view(): CanvasView;
|
|
785
|
+
set view(next: CanvasView);
|
|
786
|
+
/** The view last reported, so a render that did not move the board says nothing. */
|
|
787
|
+
private reported?;
|
|
788
|
+
/**
|
|
789
|
+
* The board as a JSON Canvas document, for saving it.
|
|
790
|
+
*
|
|
791
|
+
* What each card holds is the consumer's DOM, so a card comes back as a card
|
|
792
|
+
* of text holding what it says; a file or a link the consumer drew inside one
|
|
793
|
+
* is theirs to write back, which `fromJsonCanvas` handed them on the way in.
|
|
794
|
+
*/
|
|
795
|
+
toJsonCanvas(): CanvasDocument;
|
|
796
|
+
/**
|
|
797
|
+
* Fits the whole board into the box, centered, and never magnified past its
|
|
798
|
+
* own size.
|
|
799
|
+
*
|
|
800
|
+
* **Automatic while nobody has touched the board, and public for when they
|
|
801
|
+
* have.** The document carries every rectangle, so the extent is arithmetic
|
|
802
|
+
* rather than a guess, and a board that opened cropped would be one a reader
|
|
803
|
+
* has to go looking for. Never magnified past its own size: a four-card board
|
|
804
|
+
* blown up to fill a screen is a worse first view than a small one in the
|
|
805
|
+
* middle.
|
|
806
|
+
*/
|
|
807
|
+
fit(): void;
|
|
808
|
+
/**
|
|
809
|
+
* The fit, gliding or landing.
|
|
810
|
+
*
|
|
811
|
+
* **A fit the board makes for itself lands; one a consumer asks for glides.**
|
|
812
|
+
* The automatic fit runs as the page loads and whenever the box resizes, and
|
|
813
|
+
* easing it made the board visibly drift into place after everything else had
|
|
814
|
+
* settled, and trail a container being resized by a fraction of a second.
|
|
815
|
+
* It also left Chrome's screenshot of the SVG labels rastered at the scale the
|
|
816
|
+
* glide started from, which is how it was found: the two twins of an example
|
|
817
|
+
* matched to the attribute and differed on every label. A consumer's own
|
|
818
|
+
* `fit()` is a press on a button of theirs, and glides like the pad.
|
|
819
|
+
*/
|
|
820
|
+
private fitInto;
|
|
821
|
+
/**
|
|
822
|
+
* Asks for the render a hydration put off, so the cards get read.
|
|
823
|
+
*
|
|
824
|
+
* The mixin starts the idle wait here, and this adds the half a board needs:
|
|
825
|
+
* the update that hydrated the server's markup could not look at the children,
|
|
826
|
+
* so the one after it does.
|
|
827
|
+
*/
|
|
828
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
829
|
+
/** A card added or taken away is a board of a different size. */
|
|
830
|
+
private readonly handleSlotChange;
|
|
831
|
+
protected updated(changed: PropertyValues): void;
|
|
832
|
+
/**
|
|
833
|
+
* Watches the cards' words and the colors written onto the elements.
|
|
834
|
+
*
|
|
835
|
+
* A `style` change redraws only where the color it carries moved, because
|
|
836
|
+
* the board writes each card's place into the same attribute on every
|
|
837
|
+
* render, and answering that would be a render asking for the next one.
|
|
838
|
+
*/
|
|
839
|
+
private watchWords;
|
|
840
|
+
private redraws;
|
|
841
|
+
/**
|
|
842
|
+
* Keeps one observer on the box, so a fit follows a resize that has not
|
|
843
|
+
* happened yet.
|
|
844
|
+
*
|
|
845
|
+
* **Observed once, not on every render**, which is what threw "ResizeObserver
|
|
846
|
+
* loop completed with undelivered notifications" in every example that
|
|
847
|
+
* resized. A resize fits the board, the fit renders, and the render ran inside
|
|
848
|
+
* the browser's pass over the observers: re-observing there queues a first
|
|
849
|
+
* notification for the viewport at a depth the pass has already delivered,
|
|
850
|
+
* so the browser gives up on it and says so. The viewport is the same element
|
|
851
|
+
* from the first render on, so there is nothing to re-observe.
|
|
852
|
+
*/
|
|
853
|
+
private watchBox;
|
|
854
|
+
/**
|
|
855
|
+
* Watches again after a move, which a disconnect would otherwise end.
|
|
856
|
+
*
|
|
857
|
+
* A reorder is a disconnect and a connect with no render between them, so an
|
|
858
|
+
* observer torn down on the way out and rebuilt only on the next update is one
|
|
859
|
+
* that watches nothing until something else happens to change.
|
|
860
|
+
*/
|
|
861
|
+
connectedCallback(): void;
|
|
862
|
+
disconnectedCallback(): void;
|
|
863
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
864
|
+
/**
|
|
865
|
+
* Places the cards, which is writing onto elements somebody else wrote.
|
|
866
|
+
*
|
|
867
|
+
* **The board positions its children rather than drawing them**, the way
|
|
868
|
+
* `Tabs` marks its panels: the card is the consumer's element, holding the
|
|
869
|
+
* consumer's DOM, and what this knows that they do not is where the extent
|
|
870
|
+
* starts and therefore what their coordinates come to on this plane. Written
|
|
871
|
+
* as custom properties so the styled tier decides what placement looks like.
|
|
872
|
+
*/
|
|
873
|
+
private place;
|
|
874
|
+
/**
|
|
875
|
+
* The two ends of each selected connection, which a press picks up.
|
|
876
|
+
*
|
|
877
|
+
* **The pointer's way to move an end without dragging**: a click on one
|
|
878
|
+
* picks it up and the next puts it down, where pressing the line and
|
|
879
|
+
* dragging picks up the nearer end as before. Only on a connection the
|
|
880
|
+
* reader selected, so a board is not dotted with them, and never on one the
|
|
881
|
+
* board or the connection holds. Hidden from assistive technology, which
|
|
882
|
+
* moves an end with the keyboard.
|
|
883
|
+
*
|
|
884
|
+
* **Over the cards, not with the lines.** An end sits exactly on the point
|
|
885
|
+
* of the card it arrives at, and the cards are drawn over the lines, so an
|
|
886
|
+
* end drawn with them was always under that point: a click on it drew a new
|
|
887
|
+
* connection from the card instead.
|
|
888
|
+
*/
|
|
889
|
+
private renderEnds;
|
|
890
|
+
/**
|
|
891
|
+
* The connectors, in one layer under the cards.
|
|
892
|
+
*
|
|
893
|
+
* **The arrowhead is measured in the board's own units, not in multiples of
|
|
894
|
+
* the line's width.** `markerUnits="strokeWidth"` multiplies by the stroke, so
|
|
895
|
+
* an eight-unit head on a two-pixel line drew a sixteen-pixel triangle that
|
|
896
|
+
* read as a shape of its own rather than as a direction. In user space it is
|
|
897
|
+
* eight units of the document, which is what the cards are measured in, and it
|
|
898
|
+
* grows with the zoom like everything else.
|
|
899
|
+
*/
|
|
900
|
+
private renderEdges;
|
|
901
|
+
/**
|
|
902
|
+
* The connections' labels, as text on the plane over the lines.
|
|
903
|
+
*
|
|
904
|
+
* **HTML and not SVG text, which is the whole of the fix.** Drawn in the
|
|
905
|
+
* SVG, a label's ground was a filter flooding the text's box, and Chrome
|
|
906
|
+
* kept the filter's first picture: a label drawn before the page's font had
|
|
907
|
+
* loaded kept its ground and lost its words, on every board a server had not
|
|
908
|
+
* rendered first. Measured as a box with nothing in it on the examples page.
|
|
909
|
+
* A box of text with a background is what HTML has always done, as wide as
|
|
910
|
+
* its words, spaces and all, and drawn again whenever the font changes.
|
|
911
|
+
*/
|
|
912
|
+
private renderLabels;
|
|
913
|
+
/**
|
|
914
|
+
* The connection being made, drawn from where it starts to the pointer, or to
|
|
915
|
+
* the card a keyboard reader is on.
|
|
916
|
+
*/
|
|
917
|
+
private renderDraft;
|
|
918
|
+
protected render(): TemplateResult;
|
|
919
|
+
}
|
|
920
|
+
declare global {
|
|
921
|
+
interface HTMLElementTagNameMap {
|
|
922
|
+
'helix-headless-canvas': HelixHeadlessCanvas;
|
|
923
|
+
}
|
|
924
|
+
}
|