@fusion.dev/helix-headless 0.147.0 → 0.148.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/custom-elements.json +4512 -790
- package/dist/accordion/item/accordion-item.d.ts +5 -2
- package/dist/accordion/item/accordion-item.js +11 -7
- package/dist/accordion/root/accordion-root.js +4 -6
- package/dist/announcement/root/announcement-root.d.ts +56 -5
- package/dist/announcement/root/announcement-root.js +124 -21
- package/dist/area-chart/root/area-chart-root.js +3 -4
- package/dist/badge/count.d.ts +14 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.js +8 -22
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
- package/dist/button-group/arrows.d.ts +14 -0
- package/dist/button-group/arrows.js +10 -0
- package/dist/button-group/root/button-group-root.d.ts +141 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +6 -2
- package/dist/canvas/root/canvas-document.d.ts +10 -0
- package/dist/canvas/root/canvas-document.js +1 -0
- package/dist/canvas/root/canvas-root.d.ts +107 -5
- package/dist/canvas/root/canvas-root.js +140 -36
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/carousel/root/carousel-root.d.ts +4 -3
- package/dist/carousel/root/carousel-root.js +2 -6
- package/dist/chat/root/chat-root.d.ts +13 -3
- package/dist/chat/root/chat-root.js +2 -6
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +13 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +18 -10
- package/dist/checkbox-group/select-all.d.ts +11 -0
- package/dist/checkbox-group/select-all.js +5 -0
- package/dist/code-block/root/code-block-root.d.ts +8 -6
- package/dist/code-block/root/code-block-root.js +4 -3
- package/dist/color-picker/root/color-picker-root.js +6 -12
- package/dist/color-picker/wheel.d.ts +11 -0
- package/dist/color-picker/wheel.js +9 -0
- package/dist/combobox/root/combobox-root.d.ts +70 -11
- package/dist/combobox/root/combobox-root.js +68 -18
- package/dist/command/root/command-root.d.ts +4 -3
- package/dist/data-table/root/data-table-root.js +17 -44
- package/dist/description-list/item/description-list-item.d.ts +4 -0
- package/dist/description-list/item/description-list-item.js +7 -1
- package/dist/divider/root/divider-root.d.ts +45 -16
- package/dist/divider/root/divider-root.js +28 -4
- package/dist/drilldown/item/drilldown-item.js +3 -4
- package/dist/element-events.generated.js +1 -0
- package/dist/empty/root/empty-root.d.ts +17 -3
- package/dist/empty/root/empty-root.js +29 -5
- package/dist/file-input/root/file-input-root.js +3 -4
- package/dist/file-input/status.js +2 -1
- package/dist/filter-input/chip/filter-chip.js +2 -3
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +2 -1
- package/dist/format-date/options.js +9 -38
- package/dist/format-date/root/format-date-root.d.ts +35 -3
- package/dist/format-date/root/format-date-root.js +24 -32
- package/dist/graph/root/graph-root.d.ts +23 -5
- package/dist/graph/root/graph-root.js +17 -20
- package/dist/heatmap/root/heatmap-root.d.ts +12 -0
- package/dist/heatmap/root/heatmap-root.js +26 -11
- package/dist/image/root/image-root.d.ts +11 -0
- package/dist/kbd/root/kbd-root.js +1 -2
- package/dist/legend/root/legend-root.js +4 -17
- package/dist/list/root/list-root.js +8 -22
- package/dist/listbox/root/listbox-root.d.ts +119 -24
- package/dist/listbox/root/listbox-root.js +130 -132
- package/dist/map/marker/map-marker.d.ts +2 -1
- package/dist/map/root/map-root.d.ts +40 -2
- package/dist/map/root/map-root.js +64 -23
- package/dist/megamenu/root/megamenu-root.js +4 -11
- package/dist/menu/root/menu-root.d.ts +2 -2
- package/dist/navigation/root/navigation-root.js +5 -8
- package/dist/notifications/group/notification-group.d.ts +8 -1
- package/dist/notifications/group/notification-group.js +12 -6
- package/dist/notifications/notification/notification.d.ts +12 -1
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +41 -5
- package/dist/notifications/root/notifications-root.js +27 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +5 -1
- package/dist/object-inspector/root/object-inspector-root.js +21 -11
- package/dist/pagination/size/pagination-size.d.ts +1 -0
- package/dist/pagination/size/pagination-size.js +1 -1
- package/dist/pin-input/code.d.ts +23 -0
- package/dist/pin-input/code.js +25 -0
- package/dist/pin-input/root/pin-input-root.js +9 -23
- package/dist/qr-code/root/qr-code-root.d.ts +14 -3
- package/dist/qr-code/root/qr-code-root.js +19 -5
- package/dist/scatter-chart/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +2 -6
- package/dist/scatter-chart/root/scatter-chart-root.js +6 -19
- package/dist/select/root/select-root.d.ts +56 -8
- package/dist/select/root/select-root.js +33 -9
- package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
- package/dist/speed-dial/group/speed-dial-group.js +43 -0
- package/dist/speed-dial/index.d.ts +1 -0
- package/dist/speed-dial/index.js +1 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +26 -1
- package/dist/speed-dial/item/speed-dial-item.js +41 -3
- package/dist/speed-dial/long-press.d.ts +50 -0
- package/dist/speed-dial/long-press.js +48 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +80 -1
- package/dist/speed-dial/root/speed-dial-root.js +114 -5
- package/dist/splitter/root/splitter-root.d.ts +7 -3
- package/dist/splitter/root/splitter-root.js +16 -3
- package/dist/table/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/grid-controller.d.ts +117 -0
- package/dist/table/grid-controller.js +293 -0
- package/dist/table/root/table-root.d.ts +47 -3
- package/dist/table/root/table-root.js +81 -24
- package/dist/table/row/table-row.d.ts +13 -1
- package/dist/table/row/table-row.js +20 -6
- package/dist/tag/group/tag-group.js +6 -15
- package/dist/time-picker/root/time-picker-root.d.ts +1 -0
- package/dist/time-picker/root/time-picker-root.js +3 -0
- package/dist/toast/item/toast-item.d.ts +6 -3
- package/dist/toast/item/toast-item.js +1 -0
- package/dist/toast/root/toast-root.d.ts +13 -1
- package/dist/toast/root/toast-root.js +20 -14
- package/dist/toggle/group/toggle-group.js +3 -5
- package/dist/toolbar/root/toolbar-root.d.ts +31 -0
- package/dist/toolbar/root/toolbar-root.js +39 -8
- package/dist/tooltip/root/tooltip-root.js +1 -2
- package/dist/video/root/video-root.d.ts +11 -0
- package/dist/video/root/video-root.js +15 -1
- package/dist/virtual-list/root/virtual-list-root.js +6 -18
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +2005 -266
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +338 -62
- package/dist/kbd/keys.d.ts +0 -29
- package/dist/kbd/keys.js +0 -52
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -33,6 +33,7 @@ let HelixHeadlessCanvasNode = class HelixHeadlessCanvasNode extends HelixElement
|
|
|
33
33
|
this.links = '';
|
|
34
34
|
this.meaning = '';
|
|
35
35
|
this.readOnly = false;
|
|
36
|
+
this.status = '';
|
|
36
37
|
this.selected = false;
|
|
37
38
|
this.movable = false;
|
|
38
39
|
this.resizable = false;
|
|
@@ -72,7 +73,7 @@ let HelixHeadlessCanvasNode = class HelixHeadlessCanvasNode extends HelixElement
|
|
|
72
73
|
</svg>`
|
|
73
74
|
: nothing}<div
|
|
74
75
|
part="node"
|
|
75
|
-
aria-describedby=${this.meaning || this.links ? 'about' : nothing}
|
|
76
|
+
aria-describedby=${this.status || this.meaning || this.links ? 'about' : nothing}
|
|
76
77
|
aria-label=${this.label || nothing}
|
|
77
78
|
aria-labelledby=${this.label || this.group ? nothing : 'content'}
|
|
78
79
|
aria-keyshortcuts=${this.connectable ? 'Enter F2 Space Shift+ArrowRight Shift+ArrowDown Alt+ArrowRight Alt+ArrowDown C Delete' : nothing}
|
|
@@ -81,7 +82,7 @@ let HelixHeadlessCanvasNode = class HelixHeadlessCanvasNode extends HelixElement
|
|
|
81
82
|
>
|
|
82
83
|
<slot id="content"></slot>
|
|
83
84
|
<slot name="description"></slot>
|
|
84
|
-
<span id="about" hidden>${[this.meaning, this.links].filter(Boolean).join(', ')}</span>
|
|
85
|
+
<span id="about" hidden>${[this.status, this.meaning, this.links].filter(Boolean).join(', ')}</span>
|
|
85
86
|
</div>
|
|
86
87
|
${this.connectable
|
|
87
88
|
? html `<span part="handle handle-top" aria-hidden="true" data-side="top"></span>
|
|
@@ -131,6 +132,9 @@ __decorate([
|
|
|
131
132
|
__decorate([
|
|
132
133
|
property({ reflect: true })
|
|
133
134
|
], HelixHeadlessCanvasNode.prototype, "shape", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
state()
|
|
137
|
+
], HelixHeadlessCanvasNode.prototype, "status", void 0);
|
|
134
138
|
__decorate([
|
|
135
139
|
state()
|
|
136
140
|
], HelixHeadlessCanvasNode.prototype, "selected", void 0);
|
|
@@ -127,6 +127,16 @@ export declare const ends: (edge: CanvasEdge, from: CanvasNode, to: CanvasNode)
|
|
|
127
127
|
fromSide: CanvasSide;
|
|
128
128
|
toSide: CanvasSide;
|
|
129
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* How far a point is from a card's box, in the document's units: nothing
|
|
132
|
+
* inside it, and the shortest way to its edge outside.
|
|
133
|
+
*/
|
|
134
|
+
export declare const distanceTo: (node: {
|
|
135
|
+
x: number;
|
|
136
|
+
y: number;
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
}, point: Point) => number;
|
|
130
140
|
/**
|
|
131
141
|
* The side of a card nearest a point, which is where a connection a reader is
|
|
132
142
|
* holding arrives.
|
|
@@ -175,6 +175,7 @@ export const ends = (edge, from, to) => {
|
|
|
175
175
|
const toSide = edge.toSide ?? fallbackTo;
|
|
176
176
|
return { end: port(to, toSide), fromSide, start: port(from, fromSide), toSide };
|
|
177
177
|
};
|
|
178
|
+
export const distanceTo = (node, point) => Math.hypot(Math.max(node.x - point.x, 0, point.x - (node.x + node.width)), Math.max(node.y - point.y, 0, point.y - (node.y + node.height)));
|
|
178
179
|
export const sideNear = (node, point) => ['top', 'right', 'bottom', 'left']
|
|
179
180
|
.map((side) => {
|
|
180
181
|
const at = port(node, side);
|
|
@@ -34,20 +34,34 @@ declare const HelixHeadlessCanvas_base: (new (...args: any[]) => import("@fusion
|
|
|
34
34
|
* keep every card in place, such as on a published board. Set `readonly` on one
|
|
35
35
|
* card or connection to keep only that one in place.
|
|
36
36
|
*
|
|
37
|
+
* Set `snap` to a length in the document's units, such as `32`, and a card
|
|
38
|
+
* that is moved or resized lands on a multiple of it. Carrying a card, a
|
|
39
|
+
* corner, a connection, or the selection box near the edge of the board moves
|
|
40
|
+
* the board under it, so a card can be taken to a place off screen in one
|
|
41
|
+
* drag. A connection let go within 20 pixels of a card arrives at it. A
|
|
42
|
+
* double click on the empty board zooms in about that point, and Shift with a
|
|
43
|
+
* double click zooms out.
|
|
44
|
+
*
|
|
37
45
|
* Keyboard behavior:
|
|
38
46
|
* - One card holds the board's tab stop.
|
|
39
47
|
* - The arrow keys move through the cards in reading order. The card you land
|
|
40
48
|
* on scrolls into view, and its connections are announced with it.
|
|
41
|
-
* - Shift with an arrow key moves the card
|
|
49
|
+
* - Shift with an arrow key moves the card: by 16 units, or to the next
|
|
50
|
+
* multiple of `snap` where it is set. Alt with an arrow key resizes it from
|
|
51
|
+
* its bottom right corner the same way.
|
|
42
52
|
* - The connections leaving a card are stops of their own, straight after it.
|
|
43
53
|
* Enter on one moves to the card it arrives at.
|
|
54
|
+
* - What a key changes that a reader cannot see is said: where a card moved
|
|
55
|
+
* to, its new size, how many cards are selected, and the zoom. A selected
|
|
56
|
+
* card or connection says so when a reader arrives on it.
|
|
44
57
|
*
|
|
45
58
|
* Every drag also works with clicks, as WCAG 2.5.7 requires for a pointer that
|
|
46
59
|
* cannot hold a button down. Click a selected card's move handle, a corner, a
|
|
47
60
|
* card's connection point, or the end of a selected connection to pick it up.
|
|
48
61
|
* It follows the pointer with no button held, and the next click puts it down
|
|
49
62
|
* where a drag would have. On touch, the next tap sets where it lands. Escape,
|
|
50
|
-
* or a press outside the board, puts it back.
|
|
63
|
+
* or a press outside the board, puts it back. So a finger connects two cards
|
|
64
|
+
* with three taps: the card, one of its points, and the card to connect to.
|
|
51
65
|
*
|
|
52
66
|
* Connecting and removing dispatch requests, and your code applies them:
|
|
53
67
|
* - Drawing from a card's handle to another card, or pressing C on one card and
|
|
@@ -75,7 +89,14 @@ declare const HelixHeadlessCanvas_base: (new (...args: any[]) => import("@fusion
|
|
|
75
89
|
* @slot - The board's `helix-canvas-node` and `helix-canvas-edge` elements, drawn on the plane.
|
|
76
90
|
* @slot empty - Content shown when the document has no nodes.
|
|
77
91
|
* @slot footer - Content below the board.
|
|
92
|
+
* @slot fullscreen-icon - Replaces the glyph inside the fullscreen button.
|
|
78
93
|
* @slot header - Content above the board.
|
|
94
|
+
* @slot pan-down-icon - Replaces the glyph inside the pan down button.
|
|
95
|
+
* @slot pan-end-icon - Replaces the glyph inside the button that pans toward the end of a line of text.
|
|
96
|
+
* @slot pan-start-icon - Replaces the glyph inside the button that pans toward the start of a line of text.
|
|
97
|
+
* @slot pan-up-icon - Replaces the glyph inside the pan up button.
|
|
98
|
+
* @slot zoom-in-icon - Replaces the glyph inside the zoom-in button.
|
|
99
|
+
* @slot zoom-out-icon - Replaces the glyph inside the zoom-out button.
|
|
79
100
|
*
|
|
80
101
|
* @event {HelixBeforeMoveEvent} helix-before-move - Cards are about to move. Cancelable: cancel it to keep the positions in your own state.
|
|
81
102
|
* @event {HelixBeforeReconnectEvent} helix-before-reconnect - A connection's end is about to move to another card or side. Cancelable: cancel it to keep connections in your own state.
|
|
@@ -171,6 +192,15 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
171
192
|
* Third", rather than with a comma this component chose.
|
|
172
193
|
*/
|
|
173
194
|
leadsToLabel: string;
|
|
195
|
+
/**
|
|
196
|
+
* What screen readers hear after a key moves a card, with `{name}` for the
|
|
197
|
+
* card and `{x}` and `{y}` for where it now is, in the document's units.
|
|
198
|
+
*
|
|
199
|
+
* **A move a reader cannot see has to be said.** Shift with an arrow moved
|
|
200
|
+
* the card and said nothing, so a reader moving one by keys could not tell
|
|
201
|
+
* whether it had moved, or how far.
|
|
202
|
+
*/
|
|
203
|
+
movedLabel: string;
|
|
174
204
|
/**
|
|
175
205
|
* The order the arrow keys and screen readers move through the cards:
|
|
176
206
|
* `spatial` or `edges`.
|
|
@@ -208,6 +238,12 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
208
238
|
* `{to}`.
|
|
209
239
|
*/
|
|
210
240
|
reconnectingLabel: string;
|
|
241
|
+
/**
|
|
242
|
+
* What screen readers hear after a key resizes a card, with `{name}` for the
|
|
243
|
+
* card and `{width}` and `{height}` for its new size, in the document's
|
|
244
|
+
* units.
|
|
245
|
+
*/
|
|
246
|
+
resizedLabel: string;
|
|
211
247
|
/**
|
|
212
248
|
* The names of the selected cards and connections, comma separated. Empty
|
|
213
249
|
* when nothing is selected.
|
|
@@ -230,6 +266,35 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
230
266
|
* Written to select from outside, and read to act on the selection.
|
|
231
267
|
*/
|
|
232
268
|
selected: string;
|
|
269
|
+
/**
|
|
270
|
+
* What a selected card or connection adds to what screen readers hear on
|
|
271
|
+
* it, before its tone and its connections. Empty adds nothing.
|
|
272
|
+
*
|
|
273
|
+
* A card is an article and a connection a button, and neither has a selected
|
|
274
|
+
* state for `aria-selected` to carry, so the state is said in words.
|
|
275
|
+
*/
|
|
276
|
+
selectedLabel: string;
|
|
277
|
+
/**
|
|
278
|
+
* What screen readers hear after the selection grows or shrinks, with
|
|
279
|
+
* `{count}` for how many cards and connections are selected: by Space, a
|
|
280
|
+
* click with Shift, Command or Control, Command or Control with A, a box
|
|
281
|
+
* drawn across the board, or Escape.
|
|
282
|
+
*
|
|
283
|
+
* A selection of one made by arriving on a card or clicking it is not said,
|
|
284
|
+
* since the card is.
|
|
285
|
+
*/
|
|
286
|
+
selectionLabel: string;
|
|
287
|
+
/**
|
|
288
|
+
* Snaps the cards a reader moves or resizes to a multiple of this many of the
|
|
289
|
+
* document's units, such as `32` to land on the lines `grid` draws.
|
|
290
|
+
*
|
|
291
|
+
* **A drag lets go on the nearest line and a key goes to the next one.**
|
|
292
|
+
* Shift with an arrow moves a card to the next line that way, rather than
|
|
293
|
+
* by its step of 16, and Alt with an arrow moves its bottom right corner
|
|
294
|
+
* the same way. A group moves with what it carries, so a card inside one
|
|
295
|
+
* keeps its place in it. Absent, cards land where they are let go.
|
|
296
|
+
*/
|
|
297
|
+
snap?: number;
|
|
233
298
|
/**
|
|
234
299
|
* A label being edited in place: whose, and what it said before.
|
|
235
300
|
*/
|
|
@@ -247,6 +312,11 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
247
312
|
* told the same. A tone left out is not read.
|
|
248
313
|
*/
|
|
249
314
|
toneLabels: Partial<Record<CanvasTone, string>>;
|
|
315
|
+
/**
|
|
316
|
+
* What screen readers hear after a zoom button or key, with `{zoom}` for the
|
|
317
|
+
* zoom as a percentage, written the way the page's language writes one.
|
|
318
|
+
*/
|
|
319
|
+
zoomedLabel: string;
|
|
250
320
|
/** The card or connection that holds the board's one tab stop, by its key. */
|
|
251
321
|
private stop;
|
|
252
322
|
/**
|
|
@@ -254,8 +324,20 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
254
324
|
* started it, and where the pointer is, in the document's own units.
|
|
255
325
|
*/
|
|
256
326
|
private linking;
|
|
257
|
-
/**
|
|
327
|
+
/**
|
|
328
|
+
* What the live region says: a connection being made, and what a key did
|
|
329
|
+
* that a reader cannot see, a move, a resize, the selection, the zoom.
|
|
330
|
+
*/
|
|
258
331
|
private said;
|
|
332
|
+
/**
|
|
333
|
+
* Says something in the live region.
|
|
334
|
+
*
|
|
335
|
+
* The same words twice would change nothing in the region and be heard
|
|
336
|
+
* once, so a second "2 selected" differs by a space no reader says.
|
|
337
|
+
*/
|
|
338
|
+
private say;
|
|
339
|
+
/** Numbers as the page's language writes them. */
|
|
340
|
+
private get numbers();
|
|
259
341
|
/**
|
|
260
342
|
* Where focus goes once something a reader removed has gone.
|
|
261
343
|
*
|
|
@@ -469,7 +551,8 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
469
551
|
private toDocument;
|
|
470
552
|
/**
|
|
471
553
|
* The card under a point, the smallest where they overlap, so a card inside
|
|
472
|
-
* a group is found before the group around it.
|
|
554
|
+
* a group is found before the group around it. Where none is, the nearest
|
|
555
|
+
* within `reach`, in the document's units.
|
|
473
556
|
*/
|
|
474
557
|
private cardAt;
|
|
475
558
|
/** What a card is called, by id, for what the live region says. */
|
|
@@ -631,6 +714,22 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
631
714
|
* Returns whether it applied, so a caller knows whether to report a finish.
|
|
632
715
|
*/
|
|
633
716
|
private requestMove;
|
|
717
|
+
/**
|
|
718
|
+
* Moves the view while a pointer carries something near its edge, and
|
|
719
|
+
* carries it along: a card, a corner, a connection being drawn, the box that
|
|
720
|
+
* selects.
|
|
721
|
+
*/
|
|
722
|
+
private readonly edgePan;
|
|
723
|
+
/** The last pointer move of a carry, which a frame of `edgePan` moves on from. */
|
|
724
|
+
private carryPointer;
|
|
725
|
+
/**
|
|
726
|
+
* One frame of moving the view under something carried to its edge: the
|
|
727
|
+
* board moves by `by` and what is in hand stays under the pointer, so a card
|
|
728
|
+
* goes on moving over the board while the hand is still.
|
|
729
|
+
*/
|
|
730
|
+
private panCarrying;
|
|
731
|
+
/** Follows a pointer carrying something, which moves the view at an edge. */
|
|
732
|
+
private carryOn;
|
|
634
733
|
/**
|
|
635
734
|
* Drag to move the board, which is the gesture a canvas is reached for with.
|
|
636
735
|
*
|
|
@@ -767,7 +866,10 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
767
866
|
* board draws; a card's content by asking, which the board does not.
|
|
768
867
|
*/
|
|
769
868
|
private editStop;
|
|
770
|
-
/**
|
|
869
|
+
/**
|
|
870
|
+
* A double-click on a card or a connection edits it, the pointer's F2, and
|
|
871
|
+
* one on the empty board zooms in about where it landed.
|
|
872
|
+
*/
|
|
771
873
|
private readonly handleDoubleClick;
|
|
772
874
|
/**
|
|
773
875
|
* Finishes editing a label: asks, writes it where the page did not refuse,
|
|
@@ -4,12 +4,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { capturePointer, customElement, fillTemplate, HelixBeforeMoveEvent, HelixBeforeReconnectEvent, HelixBeforeRelabelEvent, HelixCanvasEditEvent, HelixCanvasPanEvent, HelixCanvasViewEvent, HelixCanvasZoomEvent, HelixConnectEvent, HelixElement, HelixMoveEvent, HelixReconnectEvent, HelixRelabelEvent, HelixRemoveEvent, HelixSelectEvent, hostAria, inlineStep, isRtl, MixinViewport, wordsConverter, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { assignSlots, capturePointer, customElement, fillTemplate, formatNumbers, HelixBeforeMoveEvent, HelixBeforeReconnectEvent, HelixBeforeRelabelEvent, HelixCanvasEditEvent, HelixCanvasPanEvent, HelixCanvasViewEvent, HelixCanvasZoomEvent, HelixConnectEvent, HelixElement, HelixMoveEvent, HelixReconnectEvent, HelixRelabelEvent, HelixRemoveEvent, HelixSelectEvent, hostAria, inlineStep, isRtl, MixinViewport, wordsConverter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessCanvasEdge } from '../edge/canvas-edge.js';
|
|
11
|
+
import { EdgePan } from '../edge-pan.js';
|
|
11
12
|
import { HelixHeadlessCanvasNode } from '../node/canvas-node.js';
|
|
12
|
-
import {
|
|
13
|
+
import { snapBox, snapTo, stepTo } from '../snap.js';
|
|
14
|
+
import { colorOf, connector, distanceTo, ends, extent, inside, port, reading, sideNear, } from './canvas-document.js';
|
|
13
15
|
export { fromJsonCanvas } from './canvas-document.js';
|
|
14
16
|
const MARGIN = 32;
|
|
15
17
|
const ARROW = 'canvas-arrow';
|
|
@@ -20,6 +22,7 @@ const ZOOM_MIN = 0.1;
|
|
|
20
22
|
const ZOOM_MAX = 8;
|
|
21
23
|
const ruling = (zoom) => zoom >= 0.5 ? zoom : zoom * 2 ** Math.ceil(Math.log2(0.5 / zoom));
|
|
22
24
|
const SLOP = 3;
|
|
25
|
+
const REACH = 20;
|
|
23
26
|
const heads = (edge) => ({
|
|
24
27
|
end: (edge.toEnd ?? 'arrow') === 'arrow',
|
|
25
28
|
start: edge.fromEnd === 'arrow',
|
|
@@ -44,11 +47,16 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
44
47
|
this.label = '';
|
|
45
48
|
this.labelEditorLabel = 'Label for {name}';
|
|
46
49
|
this.leadsToLabel = 'leads to {cards}';
|
|
50
|
+
this.movedLabel = '{name} moved to {x}, {y}';
|
|
47
51
|
this.readOnly = false;
|
|
48
52
|
this.reconnectingLabel = 'Moving the end of the connection from {from} to {to}. Move to a card and press Enter, or Escape to stop.';
|
|
53
|
+
this.resizedLabel = '{name} resized to {width} by {height}';
|
|
49
54
|
this.selected = '';
|
|
55
|
+
this.selectedLabel = 'selected';
|
|
56
|
+
this.selectionLabel = '{count} selected';
|
|
50
57
|
this.stoppedLabel = 'Stopped connecting.';
|
|
51
58
|
this.toneLabels = {};
|
|
59
|
+
this.zoomedLabel = 'Zoom {zoom}';
|
|
52
60
|
this.said = '';
|
|
53
61
|
this.at = { x: 0, y: 0, zoom: 1 };
|
|
54
62
|
this.direct = false;
|
|
@@ -62,6 +70,11 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
62
70
|
this.fingers = new Map();
|
|
63
71
|
this.keying = undefined;
|
|
64
72
|
this.edgeKeys = new WeakMap();
|
|
73
|
+
this.edgePan = new EdgePan(() => this.partNamed('viewport')?.getBoundingClientRect(), (by) => this.panCarrying(by), () => {
|
|
74
|
+
if (!this.dragging) {
|
|
75
|
+
this.direct = false;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
65
78
|
this.handlePointerDown = (event) => {
|
|
66
79
|
if (!this.gestureAllowed(event)) {
|
|
67
80
|
return;
|
|
@@ -212,17 +225,19 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
212
225
|
}
|
|
213
226
|
const sizing = this.sizing;
|
|
214
227
|
if (sizing && (sizing.held || sizing.pointer === event.pointerId)) {
|
|
215
|
-
const box = this.resized(sizing.start, sizing.corner, (event.clientX - sizing.from.x) / this.at.zoom, (event.clientY - sizing.from.y) / this.at.zoom);
|
|
228
|
+
const box = snapBox(this.resized(sizing.start, sizing.corner, (event.clientX - sizing.from.x) / this.at.zoom, (event.clientY - sizing.from.y) / this.at.zoom), sizing.start, sizing.corner, this.snap, { height: MIN_HEIGHT, width: MIN_WIDTH });
|
|
216
229
|
const detail = { nodes: [{ name: sizing.card.name, ...box }] };
|
|
217
230
|
this.touched = true;
|
|
218
231
|
sizing.asked = true;
|
|
219
232
|
if (this.requestMove(detail)) {
|
|
220
233
|
sizing.moved = detail;
|
|
221
234
|
}
|
|
235
|
+
this.carryOn(event);
|
|
222
236
|
return;
|
|
223
237
|
}
|
|
224
238
|
if (this.marquee?.pointer === event.pointerId) {
|
|
225
239
|
this.marquee = { ...this.marquee, to: this.toDocument(event) };
|
|
240
|
+
this.carryOn(event);
|
|
226
241
|
return;
|
|
227
242
|
}
|
|
228
243
|
if (this.linking && (this.linking.held || this.linking.pointer === event.pointerId)) {
|
|
@@ -234,7 +249,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
234
249
|
capturePointer(this, event.pointerId);
|
|
235
250
|
}
|
|
236
251
|
const at = this.toDocument(event);
|
|
237
|
-
const over = this.cardAt(at);
|
|
252
|
+
const over = this.cardAt(at, REACH / this.at.zoom);
|
|
238
253
|
const to = this.arrival(over?.id);
|
|
239
254
|
this.linking = {
|
|
240
255
|
...this.linking,
|
|
@@ -244,6 +259,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
244
259
|
to,
|
|
245
260
|
toSide: to !== undefined && over ? sideNear(over, at) : undefined,
|
|
246
261
|
};
|
|
262
|
+
this.carryOn(event);
|
|
247
263
|
return;
|
|
248
264
|
}
|
|
249
265
|
const carry = this.carrying;
|
|
@@ -258,17 +274,22 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
258
274
|
}
|
|
259
275
|
carry.started = true;
|
|
260
276
|
this.touched = true;
|
|
277
|
+
const lead = carry.cards.find(({ card }) => card.name === carry.pressed) ?? carry.cards[0];
|
|
278
|
+
const shift = (from, by) => from === undefined ? by : snapTo(from + by, this.snap) - from;
|
|
279
|
+
const right = shift(lead?.x, across / this.at.zoom);
|
|
280
|
+
const lower = shift(lead?.y, down / this.at.zoom);
|
|
261
281
|
const detail = {
|
|
262
282
|
nodes: carry.cards.map(({ card, x, y }) => ({
|
|
263
283
|
name: card.name,
|
|
264
|
-
x: Math.round(x +
|
|
265
|
-
y: Math.round(y +
|
|
284
|
+
x: Math.round(x + right),
|
|
285
|
+
y: Math.round(y + lower),
|
|
266
286
|
})),
|
|
267
287
|
};
|
|
268
288
|
carry.asked = true;
|
|
269
289
|
if (this.requestMove(detail)) {
|
|
270
290
|
carry.moved = detail;
|
|
271
291
|
}
|
|
292
|
+
this.carryOn(event);
|
|
272
293
|
return;
|
|
273
294
|
}
|
|
274
295
|
const drag = this.dragging;
|
|
@@ -303,6 +324,8 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
303
324
|
if (finger && !owner && this.fingers.size > 0) {
|
|
304
325
|
return;
|
|
305
326
|
}
|
|
327
|
+
this.edgePan.stop();
|
|
328
|
+
this.carryPointer = undefined;
|
|
306
329
|
this.pressing = false;
|
|
307
330
|
const pointing = this.pointing;
|
|
308
331
|
this.pointing = false;
|
|
@@ -322,7 +345,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
322
345
|
if (marquee?.pointer === event.pointerId) {
|
|
323
346
|
this.marquee = undefined;
|
|
324
347
|
if (event.type !== 'pointercancel') {
|
|
325
|
-
this.choose([...marquee.base, ...this.within(marquee)]);
|
|
348
|
+
this.choose([...marquee.base, ...this.within(marquee)], true);
|
|
326
349
|
}
|
|
327
350
|
return;
|
|
328
351
|
}
|
|
@@ -433,15 +456,23 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
433
456
|
if (this.fixed(card)) {
|
|
434
457
|
return;
|
|
435
458
|
}
|
|
459
|
+
const step = this.snap;
|
|
460
|
+
const right = step ? stepTo(card.x, along, step) - card.x : along * NUDGE;
|
|
461
|
+
const lower = step ? stepTo(card.y, down, step) - card.y : down * NUDGE;
|
|
436
462
|
const detail = {
|
|
437
463
|
nodes: this.carriedAll(card).map((one) => ({
|
|
438
464
|
name: one.name,
|
|
439
|
-
x: one.x +
|
|
440
|
-
y: one.y +
|
|
465
|
+
x: one.x + right,
|
|
466
|
+
y: one.y + lower,
|
|
441
467
|
})),
|
|
442
468
|
};
|
|
443
469
|
if (this.requestMove(detail)) {
|
|
444
470
|
this.dispatchEvent(new HelixMoveEvent(detail));
|
|
471
|
+
this.say(fillTemplate(this.movedLabel, {
|
|
472
|
+
name: this.nameOf(card.name),
|
|
473
|
+
x: this.numbers(card.x),
|
|
474
|
+
y: this.numbers(card.y),
|
|
475
|
+
}));
|
|
445
476
|
}
|
|
446
477
|
void this.updateComplete.then(() => this.reveal(card.name));
|
|
447
478
|
return;
|
|
@@ -451,10 +482,17 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
451
482
|
if (this.fixed(card)) {
|
|
452
483
|
return;
|
|
453
484
|
}
|
|
454
|
-
const
|
|
485
|
+
const step = this.snap;
|
|
486
|
+
const edge = { x: card.x + card.width, y: card.y + card.height };
|
|
487
|
+
const box = this.resized({ height: card.height, width: card.width, x: card.x, y: card.y }, 'bottom-right', step ? stepTo(edge.x, along, step) - edge.x : along * NUDGE, step ? stepTo(edge.y, down, step) - edge.y : down * NUDGE);
|
|
455
488
|
const detail = { nodes: [{ name: card.name, ...box }] };
|
|
456
489
|
if (this.requestMove(detail)) {
|
|
457
490
|
this.dispatchEvent(new HelixMoveEvent(detail));
|
|
491
|
+
this.say(fillTemplate(this.resizedLabel, {
|
|
492
|
+
height: this.numbers(box.height),
|
|
493
|
+
name: this.nameOf(card.name),
|
|
494
|
+
width: this.numbers(box.width),
|
|
495
|
+
}));
|
|
458
496
|
}
|
|
459
497
|
return;
|
|
460
498
|
}
|
|
@@ -465,7 +503,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
465
503
|
}
|
|
466
504
|
if ((event.metaKey || event.ctrlKey) && (event.key === 'a' || event.key === 'A')) {
|
|
467
505
|
event.preventDefault();
|
|
468
|
-
this.choose(this.walk.map((one) => one.key));
|
|
506
|
+
this.choose(this.walk.map((one) => one.key), true);
|
|
469
507
|
return;
|
|
470
508
|
}
|
|
471
509
|
if (event.key === 'Escape') {
|
|
@@ -477,7 +515,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
477
515
|
this.focusStop(back);
|
|
478
516
|
return;
|
|
479
517
|
}
|
|
480
|
-
this.choose(undefined);
|
|
518
|
+
this.choose(undefined, true);
|
|
481
519
|
this.partNamed('region')?.focus();
|
|
482
520
|
return;
|
|
483
521
|
}
|
|
@@ -593,7 +631,28 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
593
631
|
if (key !== undefined) {
|
|
594
632
|
event.preventDefault();
|
|
595
633
|
this.editStop(key);
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const viewport = this.partNamed('viewport');
|
|
637
|
+
if (!viewport || !this.gestureAllowed(event)) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const box = viewport.getBoundingClientRect();
|
|
641
|
+
const inside = event.clientX >= box.left &&
|
|
642
|
+
event.clientX <= box.right &&
|
|
643
|
+
event.clientY >= box.top &&
|
|
644
|
+
event.clientY <= box.bottom;
|
|
645
|
+
const onControls = path.some((one) => one instanceof Element && (one.getAttribute('part') ?? '').split(' ').includes('controls'));
|
|
646
|
+
if (!inside || onControls) {
|
|
647
|
+
return;
|
|
596
648
|
}
|
|
649
|
+
event.preventDefault();
|
|
650
|
+
this.touched = true;
|
|
651
|
+
this.direct = false;
|
|
652
|
+
this.zoomAbout(event.shiftKey ? 1 / 2 : 2, {
|
|
653
|
+
x: event.clientX - box.left,
|
|
654
|
+
y: event.clientY - box.top,
|
|
655
|
+
});
|
|
597
656
|
};
|
|
598
657
|
this.handleEditorKeydown = (event) => {
|
|
599
658
|
event.stopPropagation();
|
|
@@ -614,6 +673,12 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
614
673
|
...HelixElement.shadowRootOptions,
|
|
615
674
|
slotAssignment: 'manual',
|
|
616
675
|
}; }
|
|
676
|
+
say(words) {
|
|
677
|
+
this.said = words !== '' && words === this.said ? `${words}\u00a0` : words;
|
|
678
|
+
}
|
|
679
|
+
get numbers() {
|
|
680
|
+
return formatNumbers(this.closest('[lang]')?.getAttribute('lang') ?? '');
|
|
681
|
+
}
|
|
617
682
|
get box() {
|
|
618
683
|
const viewport = this.renderRoot?.querySelector('[part="viewport"]');
|
|
619
684
|
return {
|
|
@@ -752,6 +817,10 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
752
817
|
this.direct = false;
|
|
753
818
|
this.touched = true;
|
|
754
819
|
this.zoomAbout(by > 0 ? 1.25 : 1 / 1.25, { x: this.box.width / 2, y: this.box.height / 2 });
|
|
820
|
+
const lang = this.closest('[lang]')?.getAttribute('lang') || undefined;
|
|
821
|
+
this.say(fillTemplate(this.zoomedLabel, {
|
|
822
|
+
zoom: new Intl.NumberFormat(lang, { maximumFractionDigits: 0, style: 'percent' }).format(this.at.zoom),
|
|
823
|
+
}));
|
|
755
824
|
super.zoom(by);
|
|
756
825
|
}
|
|
757
826
|
show(name) {
|
|
@@ -815,13 +884,20 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
815
884
|
y: origin.y + (event.clientY - (box?.top ?? 0) - this.at.y) / this.at.zoom,
|
|
816
885
|
};
|
|
817
886
|
}
|
|
818
|
-
cardAt(point) {
|
|
819
|
-
|
|
887
|
+
cardAt(point, reach = 0) {
|
|
888
|
+
const under = this.nodes
|
|
820
889
|
.filter((one) => point.x >= one.x &&
|
|
821
890
|
point.x <= one.x + one.width &&
|
|
822
891
|
point.y >= one.y &&
|
|
823
892
|
point.y <= one.y + one.height)
|
|
824
893
|
.sort((a, b) => a.width * a.height - b.width * b.height)[0];
|
|
894
|
+
if (under || reach <= 0) {
|
|
895
|
+
return under;
|
|
896
|
+
}
|
|
897
|
+
return this.nodes
|
|
898
|
+
.map((one) => ({ away: distanceTo(one, point), one }))
|
|
899
|
+
.filter(({ away }) => away <= reach)
|
|
900
|
+
.sort((a, b) => a.away - b.away)[0]?.one;
|
|
825
901
|
}
|
|
826
902
|
nameOf(id) {
|
|
827
903
|
const node = this.byId.get(id);
|
|
@@ -1099,7 +1175,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1099
1175
|
.map((one) => this.keyNamed(one.trim()))
|
|
1100
1176
|
.filter((one) => one !== undefined));
|
|
1101
1177
|
}
|
|
1102
|
-
choose(keys) {
|
|
1178
|
+
choose(keys, said = false) {
|
|
1103
1179
|
const list = keys === undefined ? [] : typeof keys === 'string' ? [keys] : [...new Set(keys)];
|
|
1104
1180
|
const value = list.map((one) => this.publicName(one)).join(',');
|
|
1105
1181
|
if (value === this.selected) {
|
|
@@ -1107,11 +1183,14 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1107
1183
|
}
|
|
1108
1184
|
if (this.dispatchEvent(new HelixSelectEvent({ value }))) {
|
|
1109
1185
|
this.selected = value;
|
|
1186
|
+
if (said) {
|
|
1187
|
+
this.say(fillTemplate(this.selectionLabel, { count: this.numbers(list.length) }));
|
|
1188
|
+
}
|
|
1110
1189
|
}
|
|
1111
1190
|
}
|
|
1112
1191
|
toggle(key) {
|
|
1113
1192
|
const picked = this.picked;
|
|
1114
|
-
this.choose(picked.includes(key) ? picked.filter((one) => one !== key) : [...picked, key]);
|
|
1193
|
+
this.choose(picked.includes(key) ? picked.filter((one) => one !== key) : [...picked, key], true);
|
|
1115
1194
|
}
|
|
1116
1195
|
get pickedCards() {
|
|
1117
1196
|
const picked = new Set(this.picked);
|
|
@@ -1138,6 +1217,26 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1138
1217
|
this.requestUpdate();
|
|
1139
1218
|
return true;
|
|
1140
1219
|
}
|
|
1220
|
+
panCarrying(by) {
|
|
1221
|
+
const last = this.carryPointer;
|
|
1222
|
+
if (!last) {
|
|
1223
|
+
this.edgePan.stop();
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
this.touched = true;
|
|
1227
|
+
this.direct = true;
|
|
1228
|
+
this.at = { ...this.at, x: this.at.x - by.x, y: this.at.y - by.y };
|
|
1229
|
+
for (const gesture of [this.carrying, this.sizing]) {
|
|
1230
|
+
if (gesture) {
|
|
1231
|
+
gesture.from = { x: gesture.from.x - by.x, y: gesture.from.y - by.y };
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
this.handlePointerMove(last);
|
|
1235
|
+
}
|
|
1236
|
+
carryOn(event) {
|
|
1237
|
+
this.carryPointer = event;
|
|
1238
|
+
this.edgePan.follow({ x: event.clientX, y: event.clientY });
|
|
1239
|
+
}
|
|
1141
1240
|
picksUp(gesture, event, from) {
|
|
1142
1241
|
if (gesture.held || this.putting || event.type === 'pointercancel') {
|
|
1143
1242
|
return false;
|
|
@@ -1200,6 +1299,8 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1200
1299
|
this.letGo();
|
|
1201
1300
|
}
|
|
1202
1301
|
letGo() {
|
|
1302
|
+
this.edgePan.stop();
|
|
1303
|
+
this.carryPointer = undefined;
|
|
1203
1304
|
this.holding = false;
|
|
1204
1305
|
this.toggleState('holding', false);
|
|
1205
1306
|
document.removeEventListener('keydown', this.handleHeldKey, true);
|
|
@@ -1655,6 +1756,8 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1655
1756
|
if (this.held) {
|
|
1656
1757
|
this.putBack();
|
|
1657
1758
|
}
|
|
1759
|
+
this.edgePan.stop();
|
|
1760
|
+
this.carryPointer = undefined;
|
|
1658
1761
|
this.sizes?.disconnect();
|
|
1659
1762
|
this.watched = undefined;
|
|
1660
1763
|
this.words?.disconnect();
|
|
@@ -1719,6 +1822,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1719
1822
|
card.meaning = card.tone ? (this.toneLabels[card.tone] ?? '') : '';
|
|
1720
1823
|
card.current = card.name === stop;
|
|
1721
1824
|
card.selected = picked.has(card.name);
|
|
1825
|
+
card.status = card.selected ? this.selectedLabel : '';
|
|
1722
1826
|
card.resizable = alone === card.name && !this.fixed(card);
|
|
1723
1827
|
card.movable = picked.has(card.name) && !this.fixed(card);
|
|
1724
1828
|
card.connectable = !this.fixed(card);
|
|
@@ -1807,7 +1911,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1807
1911
|
const ends = heads(edge);
|
|
1808
1912
|
return svg `<path
|
|
1809
1913
|
part="edge-target"
|
|
1810
|
-
aria-description=${[element?.tone ? this.toneLabels[element.tone] : undefined, edge.label].filter(Boolean).join(', ') || nothing}
|
|
1914
|
+
aria-description=${[pickedKeys.has(key) ? this.selectedLabel : undefined, element?.tone ? this.toneLabels[element.tone] : undefined, edge.label].filter(Boolean).join(', ') || nothing}
|
|
1811
1915
|
aria-label=${fillTemplate(this.connectionLabel, { from: this.textOf(from), to: this.textOf(to) })}
|
|
1812
1916
|
d=${drawn.d}
|
|
1813
1917
|
data-edge=${key}
|
|
@@ -1855,25 +1959,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1855
1959
|
}
|
|
1856
1960
|
return;
|
|
1857
1961
|
}
|
|
1858
|
-
|
|
1859
|
-
const rest = [];
|
|
1860
|
-
const named = new Map();
|
|
1861
|
-
for (const child of this.knownChildren) {
|
|
1862
|
-
const name = placed.get(child) ?? child.getAttribute('slot') ?? undefined;
|
|
1863
|
-
if (name === undefined) {
|
|
1864
|
-
rest.push(child);
|
|
1865
|
-
}
|
|
1866
|
-
else {
|
|
1867
|
-
named.set(name, [...(named.get(name) ?? []), child]);
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
for (const slot of root?.querySelectorAll?.('slot') ?? []) {
|
|
1871
|
-
const wanted = slot.name === '' ? rest : (named.get(slot.name) ?? []);
|
|
1872
|
-
const had = slot.assignedNodes();
|
|
1873
|
-
if (had.length !== wanted.length || had.some((one, at) => one !== wanted[at])) {
|
|
1874
|
-
slot.assign?.(...wanted);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1962
|
+
assignSlots(this.renderRoot, this.knownChildren, (child) => placed.get(child));
|
|
1877
1963
|
}
|
|
1878
1964
|
renderLabels(origin) {
|
|
1879
1965
|
return this.edges.map((edge) => {
|
|
@@ -2021,6 +2107,9 @@ __decorate([
|
|
|
2021
2107
|
__decorate([
|
|
2022
2108
|
property({ attribute: 'leads-to-label' })
|
|
2023
2109
|
], HelixHeadlessCanvas.prototype, "leadsToLabel", void 0);
|
|
2110
|
+
__decorate([
|
|
2111
|
+
property({ attribute: 'moved-label' })
|
|
2112
|
+
], HelixHeadlessCanvas.prototype, "movedLabel", void 0);
|
|
2024
2113
|
__decorate([
|
|
2025
2114
|
property({ reflect: true })
|
|
2026
2115
|
], HelixHeadlessCanvas.prototype, "order", void 0);
|
|
@@ -2033,9 +2122,21 @@ __decorate([
|
|
|
2033
2122
|
__decorate([
|
|
2034
2123
|
property({ attribute: 'reconnecting-label' })
|
|
2035
2124
|
], HelixHeadlessCanvas.prototype, "reconnectingLabel", void 0);
|
|
2125
|
+
__decorate([
|
|
2126
|
+
property({ attribute: 'resized-label' })
|
|
2127
|
+
], HelixHeadlessCanvas.prototype, "resizedLabel", void 0);
|
|
2036
2128
|
__decorate([
|
|
2037
2129
|
property()
|
|
2038
2130
|
], HelixHeadlessCanvas.prototype, "selected", void 0);
|
|
2131
|
+
__decorate([
|
|
2132
|
+
property({ attribute: 'selected-label' })
|
|
2133
|
+
], HelixHeadlessCanvas.prototype, "selectedLabel", void 0);
|
|
2134
|
+
__decorate([
|
|
2135
|
+
property({ attribute: 'selection-label' })
|
|
2136
|
+
], HelixHeadlessCanvas.prototype, "selectionLabel", void 0);
|
|
2137
|
+
__decorate([
|
|
2138
|
+
property({ type: Number })
|
|
2139
|
+
], HelixHeadlessCanvas.prototype, "snap", void 0);
|
|
2039
2140
|
__decorate([
|
|
2040
2141
|
state()
|
|
2041
2142
|
], HelixHeadlessCanvas.prototype, "editing", void 0);
|
|
@@ -2045,6 +2146,9 @@ __decorate([
|
|
|
2045
2146
|
__decorate([
|
|
2046
2147
|
property({ attribute: 'tone-labels', converter: wordsConverter })
|
|
2047
2148
|
], HelixHeadlessCanvas.prototype, "toneLabels", void 0);
|
|
2149
|
+
__decorate([
|
|
2150
|
+
property({ attribute: 'zoomed-label' })
|
|
2151
|
+
], HelixHeadlessCanvas.prototype, "zoomedLabel", void 0);
|
|
2048
2152
|
__decorate([
|
|
2049
2153
|
state()
|
|
2050
2154
|
], HelixHeadlessCanvas.prototype, "stop", void 0);
|