@fusion.dev/helix-headless 0.104.1 → 0.106.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 +10386 -3813
- package/dist/accordion/item/accordion-item.d.ts +17 -16
- package/dist/accordion/root/accordion-root.d.ts +13 -17
- package/dist/announcement/root/announcement-root.d.ts +24 -31
- package/dist/app-header/root/app-header-root.d.ts +14 -14
- package/dist/area-chart/root/area-chart-root.d.ts +29 -48
- package/dist/avatar/group/avatar-group.d.ts +6 -8
- package/dist/avatar/root/avatar-root.d.ts +11 -11
- package/dist/badge/root/badge-root.d.ts +14 -15
- package/dist/bar-chart/root/bar-chart-root.d.ts +40 -44
- package/dist/blockquote/root/blockquote-root.d.ts +5 -7
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +25 -33
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +12 -11
- package/dist/button/root/button-root.d.ts +16 -17
- package/dist/button-group/root/button-group-root.d.ts +9 -10
- package/dist/callout/root/callout-root.d.ts +10 -15
- package/dist/canvas/edge/canvas-edge.d.ts +21 -21
- package/dist/canvas/node/canvas-node.d.ts +43 -45
- package/dist/canvas/root/canvas-root.d.ts +100 -99
- package/dist/card/root/card-root.d.ts +10 -12
- package/dist/carousel/root/carousel-root.d.ts +32 -33
- package/dist/chat/composer/chat-composer.d.ts +24 -26
- package/dist/chat/message/chat-message.d.ts +30 -33
- package/dist/chat/root/chat-root.d.ts +63 -80
- package/dist/checkbox/root/checkbox-root.d.ts +30 -32
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +25 -25
- package/dist/code/root/code-root.d.ts +6 -10
- package/dist/code-block/root/code-block-root.d.ts +35 -48
- package/dist/color-input/root/color-input-root.d.ts +62 -56
- package/dist/color-input/root/color-input-root.js +3 -0
- package/dist/color-picker/root/color-picker-root.d.ts +61 -49
- package/dist/color-picker/root/color-picker-root.js +4 -0
- package/dist/combobox/root/combobox-root.d.ts +52 -53
- package/dist/command/root/command-root.d.ts +40 -40
- package/dist/command/root/command-root.js +1 -0
- package/dist/copy-button/root/copy-button-root.d.ts +24 -26
- package/dist/data-table/root/data-table-root.d.ts +106 -107
- package/dist/date-input/root/date-input-root.d.ts +54 -53
- package/dist/date-picker/root/date-picker-root.d.ts +25 -21
- package/dist/description-list/item/description-list-item.d.ts +7 -7
- package/dist/description-list/root/description-list-root.d.ts +10 -15
- package/dist/dialog/root/dialog-root.d.ts +22 -19
- package/dist/divider/root/divider-root.d.ts +12 -13
- package/dist/donut-chart/root/donut-chart-root.d.ts +19 -20
- package/dist/drawer/root/drawer-root.d.ts +19 -18
- package/dist/drilldown/item/drilldown-item.d.ts +28 -28
- package/dist/drilldown/root/drilldown-root.d.ts +22 -28
- package/dist/element-events.generated.js +19 -1
- package/dist/empty/root/empty-root.d.ts +16 -19
- package/dist/file-input/root/file-input-root.d.ts +32 -32
- package/dist/filter-input/chip/filter-chip.d.ts +36 -39
- package/dist/filter-input/field/filter-field.d.ts +25 -31
- package/dist/filter-input/menu/filter-menu.d.ts +50 -47
- package/dist/filter-input/operator/filter-operator.d.ts +15 -20
- package/dist/filter-input/root/filter-input-root.d.ts +80 -98
- package/dist/format-date/root/format-date-root.d.ts +19 -27
- package/dist/heatmap/root/heatmap-root.d.ts +40 -41
- package/dist/icon/root/icon-root.d.ts +21 -23
- package/dist/icon-button/root/icon-button-root.d.ts +12 -14
- package/dist/image/root/image-root.d.ts +30 -30
- package/dist/input/root/input-root.d.ts +36 -35
- package/dist/kbd/root/kbd-root.d.ts +13 -15
- package/dist/legend/root/legend-root.d.ts +18 -16
- package/dist/lightbox/item/lightbox-item.d.ts +13 -15
- package/dist/lightbox/root/lightbox-root.d.ts +40 -41
- package/dist/line-chart/root/line-chart-root.d.ts +20 -29
- package/dist/list/item/list-item.d.ts +17 -22
- package/dist/list/root/list-root.d.ts +6 -7
- package/dist/listbox/root/listbox-root.d.ts +42 -41
- package/dist/loader/root/loader-root.d.ts +16 -20
- package/dist/map/area/map-area.d.ts +48 -0
- package/dist/map/area/map-area.js +40 -0
- package/dist/map/buildings/map-buildings.d.ts +45 -0
- package/dist/map/buildings/map-buildings.js +37 -0
- package/dist/map/contours/map-contours.d.ts +61 -0
- package/dist/map/contours/map-contours.js +54 -0
- package/dist/map/index.d.ts +14 -0
- package/dist/map/index.js +10 -0
- package/dist/map/landcover/map-landcover.d.ts +47 -0
- package/dist/map/landcover/map-landcover.js +37 -0
- package/dist/map/marker/map-marker.d.ts +120 -0
- package/dist/map/marker/map-marker.js +109 -0
- package/dist/map/points/map-points.d.ts +139 -0
- package/dist/map/points/map-points.js +161 -0
- package/dist/map/position/map-position.d.ts +70 -0
- package/dist/map/position/map-position.js +89 -0
- package/dist/map/raster/map-raster.d.ts +84 -0
- package/dist/map/raster/map-raster.js +96 -0
- package/dist/map/root/map-root.d.ts +269 -52
- package/dist/map/root/map-root.js +473 -5
- package/dist/map/route/map-route.d.ts +73 -0
- package/dist/map/route/map-route.js +52 -0
- package/dist/map/terrain/map-terrain.d.ts +68 -0
- package/dist/map/terrain/map-terrain.js +58 -0
- package/dist/megamenu/root/megamenu-root.d.ts +27 -25
- package/dist/menu/item/menu-item.d.ts +30 -31
- package/dist/menu/root/menu-root.d.ts +25 -29
- package/dist/meter/root/meter-root.d.ts +22 -21
- package/dist/navigation/root/navigation-root.d.ts +13 -16
- package/dist/notifications/group/notification-group.d.ts +27 -28
- package/dist/notifications/notification/notification.d.ts +35 -42
- package/dist/notifications/root/notifications-root.d.ts +22 -24
- package/dist/number-input/root/number-input-root.d.ts +46 -50
- package/dist/object-inspector/root/object-inspector-root.d.ts +46 -58
- package/dist/option/group/option-group.d.ts +11 -11
- package/dist/option/root/option-root.d.ts +28 -33
- package/dist/outline/root/outline-root.d.ts +18 -17
- package/dist/pagination/root/pagination-root.d.ts +37 -39
- package/dist/pagination/size/pagination-size.d.ts +37 -43
- package/dist/pagination/summary/pagination-summary.d.ts +12 -14
- package/dist/pin-input/root/pin-input-root.d.ts +32 -38
- package/dist/popover/root/popover-root.d.ts +16 -21
- package/dist/progress/root/progress-root.d.ts +16 -14
- package/dist/qr-code/root/qr-code-root.d.ts +22 -25
- package/dist/quote/root/quote-root.d.ts +5 -6
- package/dist/radio/group/radio-group.d.ts +26 -28
- package/dist/radio/root/radio-root.d.ts +24 -28
- package/dist/rating/root/rating-root.d.ts +27 -30
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +43 -55
- package/dist/scroll-area/root/scroll-area-root.d.ts +15 -21
- package/dist/select/root/select-root.d.ts +41 -44
- package/dist/skeleton/root/skeleton-root.d.ts +7 -8
- package/dist/skip-link/root/skip-link-root.d.ts +21 -28
- package/dist/slider/root/slider-root.d.ts +36 -39
- package/dist/sparkline/root/sparkline-root.d.ts +22 -28
- package/dist/speed-dial/item/speed-dial-item.d.ts +21 -21
- package/dist/speed-dial/root/speed-dial-root.d.ts +25 -27
- package/dist/splitter/root/splitter-root.d.ts +37 -41
- package/dist/stat/group/stat-group.d.ts +4 -4
- package/dist/stat/root/stat-root.d.ts +8 -9
- package/dist/steps/root/steps-root.d.ts +11 -14
- package/dist/steps/step/step.d.ts +22 -29
- package/dist/switch/root/switch-root.d.ts +20 -24
- package/dist/table/cell/table-cell.d.ts +18 -8
- package/dist/table/cell/table-cell.js +5 -1
- package/dist/table/column/table-column.d.ts +62 -55
- package/dist/table/root/table-root.d.ts +16 -17
- package/dist/table/row/table-row.d.ts +3 -3
- package/dist/tabs/panel/tab-panel.d.ts +3 -3
- package/dist/tabs/root/tabs-root.d.ts +19 -17
- package/dist/tabs/tab/tab.d.ts +6 -6
- package/dist/tag/root/tag-root.d.ts +11 -12
- package/dist/textarea/root/textarea-root.d.ts +29 -32
- package/dist/time-input/root/time-input-root.d.ts +70 -69
- package/dist/time-picker/root/time-picker-root.d.ts +58 -66
- package/dist/timeline/item/timeline-item.d.ts +18 -24
- package/dist/timeline/root/timeline-root.d.ts +13 -21
- package/dist/toast/item/toast-item.d.ts +21 -22
- package/dist/toast/root/toast-root.d.ts +18 -23
- package/dist/toggle/group/toggle-group.d.ts +23 -25
- package/dist/toggle/root/toggle-root.d.ts +8 -8
- package/dist/toolbar/root/toolbar-root.d.ts +7 -10
- package/dist/tooltip/root/tooltip-root.d.ts +41 -47
- package/dist/tour/root/tour-root.d.ts +24 -26
- package/dist/tour/stop/tour-stop.d.ts +39 -48
- package/dist/tree/item/tree-item.d.ts +23 -25
- package/dist/tree/root/tree-root.d.ts +13 -12
- package/dist/trend/root/trend-root.d.ts +18 -19
- package/dist/video/root/video-root.d.ts +108 -101
- package/dist/video-playlist/item/video-playlist-item.d.ts +23 -28
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +17 -21
- package/dist/video-playlist/root/video-playlist-root.d.ts +21 -25
- package/dist/virtual-list/root/virtual-list-root.d.ts +27 -26
- package/package.json +5 -5
- package/types/jsx.d.ts +14011 -11983
- package/types/svelte.d.ts +10 -0
- package/types/vue.d.ts +2143 -1497
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* @summary A moving point on a map, such as a vehicle or a person.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* `lat` and `lng` set where it is, `heading` points it in a direction, in
|
|
8
|
+
* degrees clockwise from north, and `accuracy` draws a ring with a radius of
|
|
9
|
+
* that many meters. `connectMap` positions it and resizes the ring as the map
|
|
10
|
+
* zooms.
|
|
11
|
+
*
|
|
12
|
+
* Screen readers announce its `description` when it changes, at most once
|
|
13
|
+
* every `announce-every` milliseconds. Its movement is not announced. Set the
|
|
14
|
+
* description when something worth hearing happens, such as "Two stops away".
|
|
15
|
+
*
|
|
16
|
+
* @since 0.105.0
|
|
17
|
+
* @status experimental
|
|
18
|
+
* @category media
|
|
19
|
+
* @aliases Current location, Live position, Tracker, You are here
|
|
20
|
+
* @documentation https://fusion.dev/helix/components/map
|
|
21
|
+
*
|
|
22
|
+
* @event {HelixMapPartChangeEvent} helix-map-part-change - It moved, turned, or its accuracy changed. Used by `connectMap`; pages do not need to listen for it.
|
|
23
|
+
*
|
|
24
|
+
* @csspart accuracy - The ring that shows how accurate the position is.
|
|
25
|
+
* @csspart arrow - The arrow shown when the position has a heading.
|
|
26
|
+
* @csspart dot - The point shown when the position has no heading.
|
|
27
|
+
* @csspart heading - The cone that shows its direction.
|
|
28
|
+
* @csspart position - The image of the position, named by its label.
|
|
29
|
+
* @csspart pulse - A ring that spreads out from the point, showing that the position is live.
|
|
30
|
+
* @csspart status - The description, announced when it changes.
|
|
31
|
+
*/
|
|
32
|
+
export declare class HelixHeadlessMapPosition extends HelixElement {
|
|
33
|
+
/** How accurate the position is, in meters. Drawn as a ring with this radius. */
|
|
34
|
+
accuracy?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The least time between announcements, in milliseconds. A change during the
|
|
37
|
+
* wait is announced when the wait ends.
|
|
38
|
+
*/
|
|
39
|
+
announceEvery: number;
|
|
40
|
+
/** What screen readers announce when it changes, such as "Two stops away". */
|
|
41
|
+
description?: string;
|
|
42
|
+
/** The direction it faces, in degrees clockwise from north. Shows an arrow. */
|
|
43
|
+
heading?: number;
|
|
44
|
+
/** Marks this as a position for the connector, whatever its tag. */
|
|
45
|
+
readonly isMapPosition = true;
|
|
46
|
+
/** What it is, such as "Van 12". Read by screen readers. */
|
|
47
|
+
label?: string;
|
|
48
|
+
/** Latitude, in degrees. */
|
|
49
|
+
lat?: number;
|
|
50
|
+
/** Longitude, in degrees. */
|
|
51
|
+
lng?: number;
|
|
52
|
+
/** The words last spoken, which is what the status holds. */
|
|
53
|
+
private spoken;
|
|
54
|
+
/** When they were spoken, for the interval. */
|
|
55
|
+
private spokenAt;
|
|
56
|
+
/** The latest words, waiting out the interval. */
|
|
57
|
+
private waiting;
|
|
58
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
59
|
+
/** Tells the connector it moved, turned or grew less sure: not what it said, which is its own. */
|
|
60
|
+
protected updated(changed: PropertyValues): void;
|
|
61
|
+
/** Puts the latest words in the status, which is what makes them heard. */
|
|
62
|
+
private speak;
|
|
63
|
+
disconnectedCallback(): void;
|
|
64
|
+
protected render(): TemplateResult;
|
|
65
|
+
}
|
|
66
|
+
declare global {
|
|
67
|
+
interface HTMLElementTagNameMap {
|
|
68
|
+
'helix-headless-map-position': HelixHeadlessMapPosition;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, HelixElement, HelixMapPartChangeEvent } from '@fusion.dev/helix-core';
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
|
+
let HelixHeadlessMapPosition = class HelixHeadlessMapPosition extends HelixElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.announceEvery = 5000;
|
|
14
|
+
this.isMapPosition = true;
|
|
15
|
+
this.spoken = '';
|
|
16
|
+
this.spokenAt = Number.NEGATIVE_INFINITY;
|
|
17
|
+
}
|
|
18
|
+
willUpdate(changed) {
|
|
19
|
+
super.willUpdate(changed);
|
|
20
|
+
if (!changed.has('description') || !this.hasUpdated) {
|
|
21
|
+
if (!this.hasUpdated) {
|
|
22
|
+
this.spoken = this.description ?? '';
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const wait = this.spokenAt + this.announceEvery - Date.now();
|
|
27
|
+
if (wait <= 0) {
|
|
28
|
+
this.speak();
|
|
29
|
+
}
|
|
30
|
+
else if (this.waiting === undefined) {
|
|
31
|
+
this.waiting = setTimeout(() => this.speak(), wait);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
updated(changed) {
|
|
35
|
+
super.updated(changed);
|
|
36
|
+
if ([...changed.keys()].some((key) => key !== 'spoken' && key !== 'announceEvery')) {
|
|
37
|
+
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'place' }));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
speak() {
|
|
41
|
+
clearTimeout(this.waiting);
|
|
42
|
+
this.waiting = undefined;
|
|
43
|
+
this.spokenAt = Date.now();
|
|
44
|
+
this.spoken = this.description ?? '';
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
clearTimeout(this.waiting);
|
|
49
|
+
this.waiting = undefined;
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return html `<span part="position" role="img" aria-label=${this.label ?? ''}>
|
|
53
|
+
<span part="accuracy"></span>
|
|
54
|
+
<span part="heading"></span>
|
|
55
|
+
<span part="pulse"></span>
|
|
56
|
+
<span part="dot"></span>
|
|
57
|
+
<svg part="arrow" viewBox="0 0 24 24"><path d="M12 2.5 20.5 20.5 12 16.5 3.5 20.5Z"></path></svg>
|
|
58
|
+
</span>
|
|
59
|
+
<span part="status" role="status">${this.spoken}</span>`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
property({ type: Number })
|
|
64
|
+
], HelixHeadlessMapPosition.prototype, "accuracy", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ attribute: 'announce-every', type: Number })
|
|
67
|
+
], HelixHeadlessMapPosition.prototype, "announceEvery", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property()
|
|
70
|
+
], HelixHeadlessMapPosition.prototype, "description", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
property({ reflect: true, type: Number })
|
|
73
|
+
], HelixHeadlessMapPosition.prototype, "heading", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
property()
|
|
76
|
+
], HelixHeadlessMapPosition.prototype, "label", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
property({ type: Number })
|
|
79
|
+
], HelixHeadlessMapPosition.prototype, "lat", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: Number })
|
|
82
|
+
], HelixHeadlessMapPosition.prototype, "lng", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
state()
|
|
85
|
+
], HelixHeadlessMapPosition.prototype, "spoken", void 0);
|
|
86
|
+
HelixHeadlessMapPosition = __decorate([
|
|
87
|
+
customElement('helix-headless-map-position')
|
|
88
|
+
], HelixHeadlessMapPosition);
|
|
89
|
+
export { HelixHeadlessMapPosition };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { nothing, type PropertyValues } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Map tiles laid over a map, such as weather radar.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* `connectMap` draws the tiles over the map's land and roads, and under its
|
|
8
|
+
* routes, areas, and place names. Set `ground` to draw them under the roads
|
|
9
|
+
* as well, for imagery of the ground, such as satellite or aerial photographs.
|
|
10
|
+
* Set `max-zoom` to the deepest zoom the provider has tiles for, and the map
|
|
11
|
+
* enlarges those tiles past it. Set `src` to one tile URL with `{z}`, `{x}`,
|
|
12
|
+
* and `{y}` in it, or set `frames` to several, such as the last hour of radar.
|
|
13
|
+
* While `playing` is set, the layer shows the frames in order, `interval`
|
|
14
|
+
* milliseconds each, and starts again from the first.
|
|
15
|
+
*
|
|
16
|
+
* The frames do not play while the user has asked for reduced motion, and the
|
|
17
|
+
* layer shows its last frame. Content that moves for more than five seconds
|
|
18
|
+
* needs a way to pause it, so give `playing` a control on your page.
|
|
19
|
+
*
|
|
20
|
+
* Put the tile provider's credit in `attribution`. The frame shows it beside
|
|
21
|
+
* the map's own credit.
|
|
22
|
+
*
|
|
23
|
+
* @since 0.105.0
|
|
24
|
+
* @status experimental
|
|
25
|
+
* @category media
|
|
26
|
+
* @aliases Weather radar, Tile overlay, Raster layer
|
|
27
|
+
* @documentation https://fusion.dev/helix/components/map
|
|
28
|
+
*
|
|
29
|
+
* @event {HelixMapPartChangeEvent} helix-map-part-change - The tiles, the frame shown, the opacity, or where the tiles are drawn changed. Used by `connectMap`; pages do not need to listen for it.
|
|
30
|
+
*/
|
|
31
|
+
export declare class HelixHeadlessMapRaster extends HelixElement {
|
|
32
|
+
/** The tile provider's credit, shown in the frame's footer. Links in it stay links. */
|
|
33
|
+
attribution?: string;
|
|
34
|
+
/** More about the layer. Read after the label in the frame's list. */
|
|
35
|
+
description?: string;
|
|
36
|
+
/** Which of `frames` shows, counting from `0`. Starts at the last frame. */
|
|
37
|
+
frame?: number;
|
|
38
|
+
/** Tile URLs to show in order, one per frame, as a list separated by spaces. */
|
|
39
|
+
frames?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Draws the tiles as the ground, under the map's roads and place names, for
|
|
42
|
+
* imagery such as satellite photographs.
|
|
43
|
+
*/
|
|
44
|
+
ground: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A name this layer shares with other layers, such as a route and its
|
|
47
|
+
* dotted legs. The layers menu shows layers in the same group as one entry,
|
|
48
|
+
* named by the first of them, and its checkbox shows or hides them all.
|
|
49
|
+
*/
|
|
50
|
+
group?: string;
|
|
51
|
+
/** How long each frame shows while `playing`, in milliseconds. */
|
|
52
|
+
interval: number;
|
|
53
|
+
/** Marks this as a layer for the frame and the connector, whatever its tag. */
|
|
54
|
+
readonly isMapLayer = true;
|
|
55
|
+
/** @internal Which kind of layer, which is how the connector draws it. */
|
|
56
|
+
readonly layerKind: 'raster';
|
|
57
|
+
/** The layer's name in the frame's list. */
|
|
58
|
+
label?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The deepest zoom the provider has tiles for. The map enlarges those tiles
|
|
61
|
+
* at deeper zooms, where it would otherwise ask for tiles that do not exist.
|
|
62
|
+
*/
|
|
63
|
+
maxZoom?: number;
|
|
64
|
+
/** How opaque the tiles are, from `0` to `1`. */
|
|
65
|
+
opacity: number;
|
|
66
|
+
/** Whether the frames play in order. Has no effect with one frame, or under reduced motion. */
|
|
67
|
+
playing: boolean;
|
|
68
|
+
/** One tile URL with `{z}`, `{x}`, and `{y}` in it, for a layer of one frame. */
|
|
69
|
+
src?: string;
|
|
70
|
+
/** The timer that moves to the next frame while playing. */
|
|
71
|
+
private timer;
|
|
72
|
+
disconnectedCallback(): void;
|
|
73
|
+
private stopTimer;
|
|
74
|
+
/** Starts or stops the timer when the frames, the interval, or `playing` change. */
|
|
75
|
+
private schedule;
|
|
76
|
+
/** Tells the frame and the connector the layer changed, and keeps the timer in step. */
|
|
77
|
+
protected updated(changed: PropertyValues): void;
|
|
78
|
+
protected render(): typeof nothing;
|
|
79
|
+
}
|
|
80
|
+
declare global {
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
'helix-headless-map-raster': HelixHeadlessMapRaster;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, HelixElement, HelixMapPartChangeEvent } from '@fusion.dev/helix-core';
|
|
8
|
+
import { nothing } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
const framesConverter = {
|
|
11
|
+
fromAttribute: (value) => value === null ? undefined : value.split(/\s+/).filter((one) => one !== ''),
|
|
12
|
+
toAttribute: (value) => value?.join(' ') ?? null,
|
|
13
|
+
};
|
|
14
|
+
let HelixHeadlessMapRaster = class HelixHeadlessMapRaster extends HelixElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.ground = false;
|
|
18
|
+
this.interval = 600;
|
|
19
|
+
this.isMapLayer = true;
|
|
20
|
+
this.layerKind = 'raster';
|
|
21
|
+
this.opacity = 0.7;
|
|
22
|
+
this.playing = false;
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
super.disconnectedCallback();
|
|
26
|
+
this.stopTimer();
|
|
27
|
+
}
|
|
28
|
+
stopTimer() {
|
|
29
|
+
if (this.timer !== undefined) {
|
|
30
|
+
clearInterval(this.timer);
|
|
31
|
+
this.timer = undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
schedule() {
|
|
35
|
+
this.stopTimer();
|
|
36
|
+
const count = this.frames?.length ?? 0;
|
|
37
|
+
const reduced = globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
38
|
+
if (!this.playing || count < 2 || reduced) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.timer = setInterval(() => {
|
|
42
|
+
const at = this.frame ?? count - 1;
|
|
43
|
+
this.frame = (at + 1) % count;
|
|
44
|
+
}, Math.max(100, this.interval));
|
|
45
|
+
}
|
|
46
|
+
updated(changed) {
|
|
47
|
+
super.updated(changed);
|
|
48
|
+
if (changed.has('playing') || changed.has('frames') || changed.has('interval')) {
|
|
49
|
+
this.schedule();
|
|
50
|
+
}
|
|
51
|
+
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
return nothing;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
__decorate([
|
|
58
|
+
property()
|
|
59
|
+
], HelixHeadlessMapRaster.prototype, "attribution", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property()
|
|
62
|
+
], HelixHeadlessMapRaster.prototype, "description", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Number })
|
|
65
|
+
], HelixHeadlessMapRaster.prototype, "frame", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ converter: framesConverter })
|
|
68
|
+
], HelixHeadlessMapRaster.prototype, "frames", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Boolean })
|
|
71
|
+
], HelixHeadlessMapRaster.prototype, "ground", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property()
|
|
74
|
+
], HelixHeadlessMapRaster.prototype, "group", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: Number })
|
|
77
|
+
], HelixHeadlessMapRaster.prototype, "interval", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
property()
|
|
80
|
+
], HelixHeadlessMapRaster.prototype, "label", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ attribute: 'max-zoom', type: Number })
|
|
83
|
+
], HelixHeadlessMapRaster.prototype, "maxZoom", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Number })
|
|
86
|
+
], HelixHeadlessMapRaster.prototype, "opacity", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Boolean })
|
|
89
|
+
], HelixHeadlessMapRaster.prototype, "playing", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property()
|
|
92
|
+
], HelixHeadlessMapRaster.prototype, "src", void 0);
|
|
93
|
+
HelixHeadlessMapRaster = __decorate([
|
|
94
|
+
customElement('helix-headless-map-raster')
|
|
95
|
+
], HelixHeadlessMapRaster);
|
|
96
|
+
export { HelixHeadlessMapRaster };
|