@fusion.dev/helix-headless 0.117.0 → 0.119.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 +1169 -197
- package/dist/canvas/root/canvas-root.d.ts +14 -1
- package/dist/canvas/root/canvas-root.js +29 -3
- package/dist/element-events.generated.js +2 -0
- package/dist/graph/root/graph-root.d.ts +28 -8
- package/dist/graph/root/graph-root.js +23 -2
- package/dist/map/root/map-root.d.ts +6 -76
- package/dist/map/root/map-root.js +12 -136
- package/package.json +5 -5
- package/types/jsx.d.ts +514 -124
- package/types/vue.d.ts +153 -38
|
@@ -37,12 +37,10 @@ const TILT_STEP = 10;
|
|
|
37
37
|
const TILTED = 50;
|
|
38
38
|
const placed = (marker) => Number.isFinite(marker.lat) && Number.isFinite(marker.lng);
|
|
39
39
|
const ASK_LAPSES = 3000;
|
|
40
|
-
const HINT_SHOWS = 1600;
|
|
41
40
|
const SETTLES = 400;
|
|
42
41
|
let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement) {
|
|
43
42
|
constructor() {
|
|
44
43
|
super(...arguments);
|
|
45
|
-
this.activateHintLabel = 'Press the map to use it';
|
|
46
44
|
this.bearing = 0;
|
|
47
45
|
this.cluster = false;
|
|
48
46
|
this.faceNorthLabel = 'Face north';
|
|
@@ -65,9 +63,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
65
63
|
this.tiltedLabel = 'Tilted {degrees} degrees';
|
|
66
64
|
this.tiltLabel = 'Show in 3D';
|
|
67
65
|
this.turnedLabel = 'Facing {degrees} degrees';
|
|
68
|
-
this.twoFingerHintLabel = 'Use two fingers to move the map';
|
|
69
|
-
this.usingLabel = 'Using the map. Press Escape to scroll the page again.';
|
|
70
|
-
this.wheelHintLabel = 'Use {key} and scroll to zoom the map';
|
|
71
66
|
this.zoomedLabel = 'Zoom level {level}';
|
|
72
67
|
this.said = '';
|
|
73
68
|
this.asked = undefined;
|
|
@@ -136,61 +131,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
136
131
|
this.activate(marker);
|
|
137
132
|
}
|
|
138
133
|
};
|
|
139
|
-
this.hint = '';
|
|
140
|
-
this.taken = false;
|
|
141
|
-
this.handleWheel = (event) => {
|
|
142
|
-
if (this.gestures === 'cooperative' && !(event.ctrlKey || event.metaKey)) {
|
|
143
|
-
const mac = typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac');
|
|
144
|
-
this.showHint(fillTemplate(this.wheelHintLabel, { key: mac ? '⌘' : 'Ctrl' }), event);
|
|
145
|
-
}
|
|
146
|
-
else if (this.gestures === 'activate' && !this.taken) {
|
|
147
|
-
this.showHint(this.activateHintLabel, event);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
this.handleTouchMove = (event) => {
|
|
151
|
-
const finger = event.touches[0];
|
|
152
|
-
if (event.touches.length !== 1) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (this.gestures === 'cooperative') {
|
|
156
|
-
this.showHint(this.twoFingerHintLabel, finger);
|
|
157
|
-
}
|
|
158
|
-
else if (this.gestures === 'activate' && !this.taken) {
|
|
159
|
-
this.showHint(this.activateHintLabel, finger);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
this.handleTake = (event) => {
|
|
163
|
-
const viewport = this.partNamed('viewport');
|
|
164
|
-
if (this.gestures !== 'activate' || this.taken || !viewport) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const path = event.composedPath();
|
|
168
|
-
const onMap = path.includes(viewport) ||
|
|
169
|
-
path.some((one) => one instanceof Element && one.parentElement === this && one.slot === '');
|
|
170
|
-
if (onMap) {
|
|
171
|
-
this.taken = true;
|
|
172
|
-
this.hint = '';
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
this.handleGiveBackKey = (event) => {
|
|
176
|
-
if (event.key === 'Escape' && this.taken) {
|
|
177
|
-
this.taken = false;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
this.handleGiveBackOutside = (event) => {
|
|
181
|
-
if (!event.composedPath().includes(this)) {
|
|
182
|
-
this.taken = false;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
this.handleGiveBackBlur = () => {
|
|
186
|
-
this.taken = false;
|
|
187
|
-
};
|
|
188
|
-
this.handleLeave = (event) => {
|
|
189
|
-
this.idle.leave();
|
|
190
|
-
if (event.pointerType !== 'touch') {
|
|
191
|
-
this.taken = false;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
134
|
this.handleSlotChange = () => {
|
|
195
135
|
this.requestUpdate();
|
|
196
136
|
};
|
|
@@ -303,23 +243,16 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
303
243
|
}
|
|
304
244
|
this.dispatchEvent(new HelixActivateEvent({ value: marker.name || marker.label || '' }));
|
|
305
245
|
}
|
|
306
|
-
get
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
? { x: (at.clientX - box.left) / box.width, y: (at.clientY - box.top) / box.height }
|
|
317
|
-
: undefined;
|
|
318
|
-
this.hint = words;
|
|
319
|
-
clearTimeout(this.hinting);
|
|
320
|
-
this.hinting = setTimeout(() => {
|
|
321
|
-
this.hint = '';
|
|
322
|
-
}, HINT_SHOWS);
|
|
246
|
+
get restingGestureLabels() {
|
|
247
|
+
return {
|
|
248
|
+
activate: 'Press the map to use it',
|
|
249
|
+
twoFinger: 'Use two fingers to move the map',
|
|
250
|
+
using: 'Using the map. Press Escape to scroll the page again.',
|
|
251
|
+
wheel: 'Use {key} and scroll to zoom the map',
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
gesturesChanged() {
|
|
255
|
+
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'gestures' }));
|
|
323
256
|
}
|
|
324
257
|
connectedCallback() {
|
|
325
258
|
super.connectedCallback();
|
|
@@ -328,10 +261,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
328
261
|
this.addEventListener('focusin', this.handleFocusIn);
|
|
329
262
|
this.addEventListener('keydown', this.handleMarkerKeydown);
|
|
330
263
|
this.addEventListener('keyup', this.handleMarkerKeyup);
|
|
331
|
-
this.addEventListener('keydown', this.handleGiveBackKey);
|
|
332
|
-
this.addEventListener('pointerdown', this.handleTake);
|
|
333
|
-
this.addEventListener('touchmove', this.handleTouchMove, { passive: true });
|
|
334
|
-
this.addEventListener('wheel', this.handleWheel, { passive: true });
|
|
335
264
|
this.hiding = new MutationObserver(() => this.requestUpdate());
|
|
336
265
|
this.hiding.observe(this, { attributeFilter: ['hidden'], attributes: true, subtree: true });
|
|
337
266
|
}
|
|
@@ -346,14 +275,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
346
275
|
this.removeEventListener('focusin', this.handleFocusIn);
|
|
347
276
|
this.removeEventListener('keydown', this.handleMarkerKeydown);
|
|
348
277
|
this.removeEventListener('keyup', this.handleMarkerKeyup);
|
|
349
|
-
this.removeEventListener('keydown', this.handleGiveBackKey);
|
|
350
|
-
this.removeEventListener('pointerdown', this.handleTake);
|
|
351
|
-
this.removeEventListener('touchmove', this.handleTouchMove);
|
|
352
|
-
this.removeEventListener('wheel', this.handleWheel);
|
|
353
|
-
clearTimeout(this.hinting);
|
|
354
|
-
this.taken = false;
|
|
355
|
-
document.removeEventListener('pointerdown', this.handleGiveBackOutside);
|
|
356
|
-
window.removeEventListener('blur', this.handleGiveBackBlur);
|
|
357
278
|
}
|
|
358
279
|
firstUpdated(changed) {
|
|
359
280
|
super.firstUpdated(changed);
|
|
@@ -364,20 +285,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
364
285
|
if (changed.has('mapType')) {
|
|
365
286
|
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
|
|
366
287
|
}
|
|
367
|
-
if (changed.has('gestures') || changed.has('taken')) {
|
|
368
|
-
if (this.gestures !== 'activate' && this.taken) {
|
|
369
|
-
this.taken = false;
|
|
370
|
-
}
|
|
371
|
-
if (this.taken) {
|
|
372
|
-
document.addEventListener('pointerdown', this.handleGiveBackOutside);
|
|
373
|
-
window.addEventListener('blur', this.handleGiveBackBlur);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
document.removeEventListener('pointerdown', this.handleGiveBackOutside);
|
|
377
|
-
window.removeEventListener('blur', this.handleGiveBackBlur);
|
|
378
|
-
}
|
|
379
|
-
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'gestures' }));
|
|
380
|
-
}
|
|
381
288
|
if (changed.has('layersOpen')) {
|
|
382
289
|
if (this.layersOpen) {
|
|
383
290
|
document.addEventListener('pointerdown', this.handleOutside);
|
|
@@ -619,7 +526,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
619
526
|
hostAria(this.internals, { label: this.label });
|
|
620
527
|
this.toggleState('fullscreen', this.filled);
|
|
621
528
|
this.toggleState('idle', this.resting);
|
|
622
|
-
this.toggleState('using', this.taken);
|
|
623
529
|
}
|
|
624
530
|
renderLayers() {
|
|
625
531
|
const layers = this.layers.filter((layer) => this.shown(layer));
|
|
@@ -639,7 +545,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
639
545
|
tabindex="0"
|
|
640
546
|
@focusin=${this.idle.stir}
|
|
641
547
|
@keydown=${this.handleKeydown}
|
|
642
|
-
@pointerleave=${this.
|
|
548
|
+
@pointerleave=${this.handlePointerLeave}
|
|
643
549
|
@pointermove=${this.idle.stir}
|
|
644
550
|
>
|
|
645
551
|
<div part="header">
|
|
@@ -647,13 +553,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
647
553
|
</div>
|
|
648
554
|
<div part="viewport">
|
|
649
555
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
650
|
-
|
|
651
|
-
part="gesture-hint"
|
|
652
|
-
aria-hidden="true"
|
|
653
|
-
?hidden=${this.hint === ''}
|
|
654
|
-
style=${this.hintAt ? `--_map-hint-x: ${(this.hintAt.x * 100).toFixed(2)}%; --_map-hint-y: ${(this.hintAt.y * 100).toFixed(2)}%` : nothing}
|
|
655
|
-
>${this.hint}</div>
|
|
656
|
-
<div part="gesture-status" aria-hidden="true" ?hidden=${!this.taken}>${this.usingLabel}</div>
|
|
556
|
+
${this.renderGestures()}
|
|
657
557
|
</div>
|
|
658
558
|
${this.renderLayers()}
|
|
659
559
|
${this.renderControls()}
|
|
@@ -667,9 +567,6 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
667
567
|
</div>`;
|
|
668
568
|
}
|
|
669
569
|
};
|
|
670
|
-
__decorate([
|
|
671
|
-
property({ attribute: 'activate-hint-label' })
|
|
672
|
-
], HelixHeadlessMap.prototype, "activateHintLabel", void 0);
|
|
673
570
|
__decorate([
|
|
674
571
|
property({ type: Number })
|
|
675
572
|
], HelixHeadlessMap.prototype, "bearing", void 0);
|
|
@@ -682,9 +579,6 @@ __decorate([
|
|
|
682
579
|
__decorate([
|
|
683
580
|
property({ attribute: 'flat-label' })
|
|
684
581
|
], HelixHeadlessMap.prototype, "flatLabel", void 0);
|
|
685
|
-
__decorate([
|
|
686
|
-
property()
|
|
687
|
-
], HelixHeadlessMap.prototype, "gestures", void 0);
|
|
688
582
|
__decorate([
|
|
689
583
|
property({ attribute: 'hybrid-label' })
|
|
690
584
|
], HelixHeadlessMap.prototype, "hybridLabel", void 0);
|
|
@@ -742,15 +636,6 @@ __decorate([
|
|
|
742
636
|
__decorate([
|
|
743
637
|
property({ attribute: 'turned-label' })
|
|
744
638
|
], HelixHeadlessMap.prototype, "turnedLabel", void 0);
|
|
745
|
-
__decorate([
|
|
746
|
-
property({ attribute: 'two-finger-hint-label' })
|
|
747
|
-
], HelixHeadlessMap.prototype, "twoFingerHintLabel", void 0);
|
|
748
|
-
__decorate([
|
|
749
|
-
property({ attribute: 'using-label' })
|
|
750
|
-
], HelixHeadlessMap.prototype, "usingLabel", void 0);
|
|
751
|
-
__decorate([
|
|
752
|
-
property({ attribute: 'wheel-hint-label' })
|
|
753
|
-
], HelixHeadlessMap.prototype, "wheelHintLabel", void 0);
|
|
754
639
|
__decorate([
|
|
755
640
|
property({ attribute: 'zoomed-label' })
|
|
756
641
|
], HelixHeadlessMap.prototype, "zoomedLabel", void 0);
|
|
@@ -766,15 +651,6 @@ __decorate([
|
|
|
766
651
|
__decorate([
|
|
767
652
|
state()
|
|
768
653
|
], HelixHeadlessMap.prototype, "stop", void 0);
|
|
769
|
-
__decorate([
|
|
770
|
-
state()
|
|
771
|
-
], HelixHeadlessMap.prototype, "hint", void 0);
|
|
772
|
-
__decorate([
|
|
773
|
-
state()
|
|
774
|
-
], HelixHeadlessMap.prototype, "hintAt", void 0);
|
|
775
|
-
__decorate([
|
|
776
|
-
state()
|
|
777
|
-
], HelixHeadlessMap.prototype, "taken", void 0);
|
|
778
654
|
HelixHeadlessMap = __decorate([
|
|
779
655
|
customElement('helix-headless-map')
|
|
780
656
|
], HelixHeadlessMap);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-headless",
|
|
3
3
|
"description": "Headless component tier. Structure, accessibility, state, and form participation. No styling.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.119.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
},
|
|
47
47
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@fusion.dev/helix-core": "0.
|
|
50
|
-
"@fusion.dev/helix-icons": "0.
|
|
49
|
+
"@fusion.dev/helix-core": "0.119.0",
|
|
50
|
+
"@fusion.dev/helix-icons": "0.119.0",
|
|
51
51
|
"uqr": "^0.1.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@fusion.dev/helix-cem": "0.
|
|
55
|
-
"@fusion.dev/helix-testing": "0.
|
|
54
|
+
"@fusion.dev/helix-cem": "0.119.0",
|
|
55
|
+
"@fusion.dev/helix-testing": "0.119.0",
|
|
56
56
|
"@fusion.dev/scripts": "0.0.0-dev",
|
|
57
57
|
"@happy-dom/global-registrator": "^20.0.0",
|
|
58
58
|
"@lit-labs/ssr": "^4.1.0",
|