@fusion.dev/helix-headless 0.249.0 → 0.249.2
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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/element-events.generated.js +1 -0
- package/dist/map/events/index.d.ts +3 -1
- package/dist/map/events/index.js +3 -1
- package/dist/map/events/map-error.d.ts +15 -0
- package/dist/map/events/map-error.js +6 -0
- package/dist/map/root/map-root.d.ts +21 -0
- package/dist/map/root/map-root.js +27 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +20 -1
- package/types/vue.d.ts +9 -1
- package/types/words.d.ts +6 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HelixMapClusterEvent } from './map-cluster.js';
|
|
2
|
+
import { HelixMapErrorEvent } from './map-error.js';
|
|
2
3
|
import { HelixMapPanEvent } from './map-pan.js';
|
|
3
4
|
import { HelixMapPartChangeEvent } from './map-part-change.js';
|
|
4
5
|
import { HelixMapReadyEvent } from './map-ready.js';
|
|
@@ -6,9 +7,10 @@ import { HelixMapRotateEvent } from './map-rotate.js';
|
|
|
6
7
|
import { HelixMapTiltEvent } from './map-tilt.js';
|
|
7
8
|
import { HelixMapZoomEvent } from './map-zoom.js';
|
|
8
9
|
export type { MapClusterDetail, MapPanDetail, MapPartChangeDetail, MapRotateDetail, MapTiltDetail, MapZoomDetail, } from './details.js';
|
|
9
|
-
export { HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, };
|
|
10
|
+
export { HelixMapClusterEvent, HelixMapErrorEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, };
|
|
10
11
|
declare const registry: {
|
|
11
12
|
readonly HelixMapClusterEvent: typeof HelixMapClusterEvent;
|
|
13
|
+
readonly HelixMapErrorEvent: typeof HelixMapErrorEvent;
|
|
12
14
|
readonly HelixMapPanEvent: typeof HelixMapPanEvent;
|
|
13
15
|
readonly HelixMapPartChangeEvent: typeof HelixMapPartChangeEvent;
|
|
14
16
|
readonly HelixMapReadyEvent: typeof HelixMapReadyEvent;
|
package/dist/map/events/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { registerEventNames } from '@fusion.dev/helix-core';
|
|
2
2
|
import { HelixMapClusterEvent } from './map-cluster.js';
|
|
3
|
+
import { HelixMapErrorEvent } from './map-error.js';
|
|
3
4
|
import { HelixMapPanEvent } from './map-pan.js';
|
|
4
5
|
import { HelixMapPartChangeEvent } from './map-part-change.js';
|
|
5
6
|
import { HelixMapReadyEvent } from './map-ready.js';
|
|
6
7
|
import { HelixMapRotateEvent } from './map-rotate.js';
|
|
7
8
|
import { HelixMapTiltEvent } from './map-tilt.js';
|
|
8
9
|
import { HelixMapZoomEvent } from './map-zoom.js';
|
|
9
|
-
export { HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, };
|
|
10
|
+
export { HelixMapClusterEvent, HelixMapErrorEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, };
|
|
10
11
|
const registry = {
|
|
11
12
|
HelixMapClusterEvent,
|
|
13
|
+
HelixMapErrorEvent,
|
|
12
14
|
HelixMapPanEvent,
|
|
13
15
|
HelixMapPartChangeEvent,
|
|
14
16
|
HelixMapReadyEvent,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The map's tile source could not be reached: the request for its TileJSON or
|
|
3
|
+
* its tiles got no answer, whether the source is down, its address is wrong,
|
|
4
|
+
* the network is gone or something in the browser canceled it. Sent from the
|
|
5
|
+
* frame, which then matches `:state(failed)` and says so in a line over the
|
|
6
|
+
* map.
|
|
7
|
+
*
|
|
8
|
+
* **What a page handles to say more or to draw its own fallback**, since the
|
|
9
|
+
* frame can only say that the tiles did not load, not why. The state ends
|
|
10
|
+
* when the map is drawn whole.
|
|
11
|
+
*/
|
|
12
|
+
export declare class HelixMapErrorEvent extends Event {
|
|
13
|
+
static readonly eventName = "helix-map-error";
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
@@ -113,6 +113,7 @@ declare const HelixHeadlessMap_base: (new (...args: any[]) => import("@fusion.de
|
|
|
113
113
|
* @event {HelixBeforeCheckEvent} helix-before-check - A layer's tile in the layers menu was pressed. Sent from the layer, with `checked` true when it is to be shown. Cancelable: cancel it to keep the layer as it is.
|
|
114
114
|
* @event {HelixCheckEvent} helix-check - A layer's tile in the layers menu showed or hid it. Sent from the layer once its `hidden` attribute holds the choice, with `checked` true when it is shown.
|
|
115
115
|
* @event {HelixMapClusterEvent} helix-map-cluster - A cluster was pressed. Sent from the marker that shows the cluster, with the names of its places.
|
|
116
|
+
* @event {HelixMapErrorEvent} helix-map-error - The map's tile source could not be reached: the request for its TileJSON or its tiles got no answer. The frame says so in a line over the map and matches `:state(failed)` until the map is drawn whole.
|
|
116
117
|
* @event {HelixMapPanEvent} helix-map-pan - A pan button or arrow key was pressed. Move your map in response.
|
|
117
118
|
* @event {HelixMapPartChangeEvent} helix-map-part-change - Clustering was turned on or off. Used by `connectMap`; pages do not need to listen for it.
|
|
118
119
|
* @event {HelixMapReadyEvent} helix-map-ready - The map has been drawn whole: its style, every tile the view needs, and the ground where it has terrain. Sent once per connection. Show a map that is finished on it, where it would otherwise draw in stages.
|
|
@@ -155,6 +156,7 @@ declare const HelixHeadlessMap_base: (new (...args: any[]) => import("@fusion.de
|
|
|
155
156
|
* @csspart map-type-preview - The picture of the map on a map type's card.
|
|
156
157
|
* @csspart map-types - The map-type cards at the top of the layers menu, where the map has imagery.
|
|
157
158
|
* @csspart needle - The compass needle, turned to point north.
|
|
159
|
+
* @csspart notice - The line over the map that says its tiles could not load, shown while `:state(failed)`.
|
|
158
160
|
* @csspart pan-down - The button that pans the map down.
|
|
159
161
|
* @csspart pan-down-button - `pan-down`'s inner button.
|
|
160
162
|
* @csspart pan-down-live - `pan-down`'s live region, which speaks while it is pending.
|
|
@@ -215,6 +217,7 @@ declare const HelixHeadlessMap_base: (new (...args: any[]) => import("@fusion.de
|
|
|
215
217
|
*
|
|
216
218
|
* @cssproperty --map-needle-turn - How far the needle turns to point north, as an angle. The frame writes it from `bearing`.
|
|
217
219
|
*
|
|
220
|
+
* @cssstate failed - The map's tile source could not be reached, after `helix-map-error`.
|
|
218
221
|
* @cssstate fullscreen - The map fills the screen.
|
|
219
222
|
* @cssstate idle - The user has been still long enough for the header and footer to fade.
|
|
220
223
|
* @cssstate layers-open - The layers menu is open.
|
|
@@ -252,6 +255,8 @@ export declare class HelixHeadlessMap extends HelixHeadlessMap_base {
|
|
|
252
255
|
controlsLabel: string;
|
|
253
256
|
/** The Face north button's label. */
|
|
254
257
|
faceNorthLabel: string;
|
|
258
|
+
/** What the map says when its tiles could not load. */
|
|
259
|
+
failedLabel: string;
|
|
255
260
|
/** The map's name where `label` is empty and the host has no `aria-label`. */
|
|
256
261
|
fallbackLabel: string;
|
|
257
262
|
/** What screen readers hear when the map is tilted back to looking straight down. */
|
|
@@ -367,6 +372,22 @@ export declare class HelixHeadlessMap extends HelixHeadlessMap_base {
|
|
|
367
372
|
* connects after `helix-map-ready` has been sent, and missed it.
|
|
368
373
|
*/
|
|
369
374
|
get ready(): boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Whether the map's tile source could not be reached, which `fail()` says.
|
|
377
|
+
* For a page that connects after `helix-map-error` has been sent.
|
|
378
|
+
*/
|
|
379
|
+
get failed(): boolean;
|
|
380
|
+
/** What `failed` reads, and what draws the notice. */
|
|
381
|
+
private unreached;
|
|
382
|
+
/**
|
|
383
|
+
* Says the map's tiles could not load, or with `false`, that they can again.
|
|
384
|
+
*
|
|
385
|
+
* **Called by whatever draws the map**, as `connectMap` does when its
|
|
386
|
+
* driver reports a source it could not reach, and with `false` once the map
|
|
387
|
+
* is drawn whole. The first call sends `helix-map-error`, turns on
|
|
388
|
+
* `:state(failed)` and shows the notice.
|
|
389
|
+
*/
|
|
390
|
+
fail(unreached?: boolean): void;
|
|
370
391
|
/** What `ready` reads, written by `drawn()`. */
|
|
371
392
|
private whole;
|
|
372
393
|
/**
|
|
@@ -4,7 +4,7 @@ import { arrowClockwise, arrowCounterClockwise, buildings, cloudRain, dotsNine,
|
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { html as staticHtml } from 'lit/static-html.js';
|
|
7
|
-
import { HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, } from '../events/index.js';
|
|
7
|
+
import { HelixMapClusterEvent, HelixMapErrorEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, } from '../events/index.js';
|
|
8
8
|
import '../../icon-button/index.js';
|
|
9
9
|
import '../../tooltip/index.js';
|
|
10
10
|
import { live } from 'lit/directives/live.js';
|
|
@@ -46,6 +46,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
46
46
|
this.cluster = false;
|
|
47
47
|
this.controlsLabel = 'Map controls';
|
|
48
48
|
this.faceNorthLabel = 'Face north';
|
|
49
|
+
this.failedLabel = 'Map tiles could not load.';
|
|
49
50
|
this.fallbackLabel = 'Map';
|
|
50
51
|
this.flatLabel = 'Looking straight down';
|
|
51
52
|
this.hybridLabel = 'Hybrid';
|
|
@@ -74,6 +75,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
74
75
|
this.said = '';
|
|
75
76
|
this.asked = undefined;
|
|
76
77
|
this.settling = undefined;
|
|
78
|
+
this.unreached = false;
|
|
77
79
|
this.whole = false;
|
|
78
80
|
this.layersOpen = false;
|
|
79
81
|
this.handleOutside = (event) => {
|
|
@@ -188,11 +190,27 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
188
190
|
get ready() {
|
|
189
191
|
return this.whole;
|
|
190
192
|
}
|
|
193
|
+
get failed() {
|
|
194
|
+
return this.unreached;
|
|
195
|
+
}
|
|
196
|
+
fail(unreached = true) {
|
|
197
|
+
if (unreached === this.unreached) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this.unreached = unreached;
|
|
201
|
+
this.toggleState('failed', unreached);
|
|
202
|
+
if (unreached) {
|
|
203
|
+
this.dispatchEvent(new HelixMapErrorEvent());
|
|
204
|
+
}
|
|
205
|
+
}
|
|
191
206
|
drawn(whole = true) {
|
|
192
207
|
if (whole === this.whole) {
|
|
193
208
|
return;
|
|
194
209
|
}
|
|
195
210
|
this.whole = whole;
|
|
211
|
+
if (whole) {
|
|
212
|
+
this.fail(false);
|
|
213
|
+
}
|
|
196
214
|
this.toggleState('ready', whole);
|
|
197
215
|
if (whole) {
|
|
198
216
|
this.dispatchEvent(new HelixMapReadyEvent());
|
|
@@ -766,6 +784,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
766
784
|
<div part="viewport">
|
|
767
785
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
768
786
|
${this.renderGestures()}
|
|
787
|
+
${this.unreached ? html `<span part="notice" role="status">${this.failedLabel}</span>` : nothing}
|
|
769
788
|
</div>
|
|
770
789
|
${this.renderLayers()}
|
|
771
790
|
${this.renderControls()}
|
|
@@ -797,6 +816,10 @@ __decorate([
|
|
|
797
816
|
words,
|
|
798
817
|
property({ attribute: 'face-north-label' })
|
|
799
818
|
], HelixHeadlessMap.prototype, "faceNorthLabel", void 0);
|
|
819
|
+
__decorate([
|
|
820
|
+
words,
|
|
821
|
+
property({ attribute: 'failed-label' })
|
|
822
|
+
], HelixHeadlessMap.prototype, "failedLabel", void 0);
|
|
800
823
|
__decorate([
|
|
801
824
|
words,
|
|
802
825
|
property({ attribute: 'fallback-label' })
|
|
@@ -903,6 +926,9 @@ __decorate([
|
|
|
903
926
|
__decorate([
|
|
904
927
|
state()
|
|
905
928
|
], HelixHeadlessMap.prototype, "said", void 0);
|
|
929
|
+
__decorate([
|
|
930
|
+
state()
|
|
931
|
+
], HelixHeadlessMap.prototype, "unreached", void 0);
|
|
906
932
|
__decorate([
|
|
907
933
|
state()
|
|
908
934
|
], HelixHeadlessMap.prototype, "layersOpen", void 0);
|