@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.
Files changed (167) hide show
  1. package/custom-elements.json +10386 -3813
  2. package/dist/accordion/item/accordion-item.d.ts +17 -16
  3. package/dist/accordion/root/accordion-root.d.ts +13 -17
  4. package/dist/announcement/root/announcement-root.d.ts +24 -31
  5. package/dist/app-header/root/app-header-root.d.ts +14 -14
  6. package/dist/area-chart/root/area-chart-root.d.ts +29 -48
  7. package/dist/avatar/group/avatar-group.d.ts +6 -8
  8. package/dist/avatar/root/avatar-root.d.ts +11 -11
  9. package/dist/badge/root/badge-root.d.ts +14 -15
  10. package/dist/bar-chart/root/bar-chart-root.d.ts +40 -44
  11. package/dist/blockquote/root/blockquote-root.d.ts +5 -7
  12. package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +25 -33
  13. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +12 -11
  14. package/dist/button/root/button-root.d.ts +16 -17
  15. package/dist/button-group/root/button-group-root.d.ts +9 -10
  16. package/dist/callout/root/callout-root.d.ts +10 -15
  17. package/dist/canvas/edge/canvas-edge.d.ts +21 -21
  18. package/dist/canvas/node/canvas-node.d.ts +43 -45
  19. package/dist/canvas/root/canvas-root.d.ts +100 -99
  20. package/dist/card/root/card-root.d.ts +10 -12
  21. package/dist/carousel/root/carousel-root.d.ts +32 -33
  22. package/dist/chat/composer/chat-composer.d.ts +24 -26
  23. package/dist/chat/message/chat-message.d.ts +30 -33
  24. package/dist/chat/root/chat-root.d.ts +63 -80
  25. package/dist/checkbox/root/checkbox-root.d.ts +30 -32
  26. package/dist/checkbox-group/root/checkbox-group-root.d.ts +25 -25
  27. package/dist/code/root/code-root.d.ts +6 -10
  28. package/dist/code-block/root/code-block-root.d.ts +35 -48
  29. package/dist/color-input/root/color-input-root.d.ts +62 -56
  30. package/dist/color-input/root/color-input-root.js +3 -0
  31. package/dist/color-picker/root/color-picker-root.d.ts +61 -49
  32. package/dist/color-picker/root/color-picker-root.js +4 -0
  33. package/dist/combobox/root/combobox-root.d.ts +52 -53
  34. package/dist/command/root/command-root.d.ts +40 -40
  35. package/dist/command/root/command-root.js +1 -0
  36. package/dist/copy-button/root/copy-button-root.d.ts +24 -26
  37. package/dist/data-table/root/data-table-root.d.ts +106 -107
  38. package/dist/date-input/root/date-input-root.d.ts +54 -53
  39. package/dist/date-picker/root/date-picker-root.d.ts +25 -21
  40. package/dist/description-list/item/description-list-item.d.ts +7 -7
  41. package/dist/description-list/root/description-list-root.d.ts +10 -15
  42. package/dist/dialog/root/dialog-root.d.ts +22 -19
  43. package/dist/divider/root/divider-root.d.ts +12 -13
  44. package/dist/donut-chart/root/donut-chart-root.d.ts +19 -20
  45. package/dist/drawer/root/drawer-root.d.ts +19 -18
  46. package/dist/drilldown/item/drilldown-item.d.ts +28 -28
  47. package/dist/drilldown/root/drilldown-root.d.ts +22 -28
  48. package/dist/element-events.generated.js +19 -1
  49. package/dist/empty/root/empty-root.d.ts +16 -19
  50. package/dist/file-input/root/file-input-root.d.ts +32 -32
  51. package/dist/filter-input/chip/filter-chip.d.ts +36 -39
  52. package/dist/filter-input/field/filter-field.d.ts +25 -31
  53. package/dist/filter-input/menu/filter-menu.d.ts +50 -47
  54. package/dist/filter-input/operator/filter-operator.d.ts +15 -20
  55. package/dist/filter-input/root/filter-input-root.d.ts +80 -98
  56. package/dist/format-date/root/format-date-root.d.ts +19 -27
  57. package/dist/heatmap/root/heatmap-root.d.ts +40 -41
  58. package/dist/icon/root/icon-root.d.ts +21 -23
  59. package/dist/icon-button/root/icon-button-root.d.ts +12 -14
  60. package/dist/image/root/image-root.d.ts +30 -30
  61. package/dist/input/root/input-root.d.ts +36 -35
  62. package/dist/kbd/root/kbd-root.d.ts +13 -15
  63. package/dist/legend/root/legend-root.d.ts +18 -16
  64. package/dist/lightbox/item/lightbox-item.d.ts +13 -15
  65. package/dist/lightbox/root/lightbox-root.d.ts +40 -41
  66. package/dist/line-chart/root/line-chart-root.d.ts +20 -29
  67. package/dist/list/item/list-item.d.ts +17 -22
  68. package/dist/list/root/list-root.d.ts +6 -7
  69. package/dist/listbox/root/listbox-root.d.ts +42 -41
  70. package/dist/loader/root/loader-root.d.ts +16 -20
  71. package/dist/map/area/map-area.d.ts +48 -0
  72. package/dist/map/area/map-area.js +40 -0
  73. package/dist/map/buildings/map-buildings.d.ts +45 -0
  74. package/dist/map/buildings/map-buildings.js +37 -0
  75. package/dist/map/contours/map-contours.d.ts +61 -0
  76. package/dist/map/contours/map-contours.js +54 -0
  77. package/dist/map/index.d.ts +14 -0
  78. package/dist/map/index.js +10 -0
  79. package/dist/map/landcover/map-landcover.d.ts +47 -0
  80. package/dist/map/landcover/map-landcover.js +37 -0
  81. package/dist/map/marker/map-marker.d.ts +120 -0
  82. package/dist/map/marker/map-marker.js +109 -0
  83. package/dist/map/points/map-points.d.ts +139 -0
  84. package/dist/map/points/map-points.js +161 -0
  85. package/dist/map/position/map-position.d.ts +70 -0
  86. package/dist/map/position/map-position.js +89 -0
  87. package/dist/map/raster/map-raster.d.ts +84 -0
  88. package/dist/map/raster/map-raster.js +96 -0
  89. package/dist/map/root/map-root.d.ts +269 -52
  90. package/dist/map/root/map-root.js +473 -5
  91. package/dist/map/route/map-route.d.ts +73 -0
  92. package/dist/map/route/map-route.js +52 -0
  93. package/dist/map/terrain/map-terrain.d.ts +68 -0
  94. package/dist/map/terrain/map-terrain.js +58 -0
  95. package/dist/megamenu/root/megamenu-root.d.ts +27 -25
  96. package/dist/menu/item/menu-item.d.ts +30 -31
  97. package/dist/menu/root/menu-root.d.ts +25 -29
  98. package/dist/meter/root/meter-root.d.ts +22 -21
  99. package/dist/navigation/root/navigation-root.d.ts +13 -16
  100. package/dist/notifications/group/notification-group.d.ts +27 -28
  101. package/dist/notifications/notification/notification.d.ts +35 -42
  102. package/dist/notifications/root/notifications-root.d.ts +22 -24
  103. package/dist/number-input/root/number-input-root.d.ts +46 -50
  104. package/dist/object-inspector/root/object-inspector-root.d.ts +46 -58
  105. package/dist/option/group/option-group.d.ts +11 -11
  106. package/dist/option/root/option-root.d.ts +28 -33
  107. package/dist/outline/root/outline-root.d.ts +18 -17
  108. package/dist/pagination/root/pagination-root.d.ts +37 -39
  109. package/dist/pagination/size/pagination-size.d.ts +37 -43
  110. package/dist/pagination/summary/pagination-summary.d.ts +12 -14
  111. package/dist/pin-input/root/pin-input-root.d.ts +32 -38
  112. package/dist/popover/root/popover-root.d.ts +16 -21
  113. package/dist/progress/root/progress-root.d.ts +16 -14
  114. package/dist/qr-code/root/qr-code-root.d.ts +22 -25
  115. package/dist/quote/root/quote-root.d.ts +5 -6
  116. package/dist/radio/group/radio-group.d.ts +26 -28
  117. package/dist/radio/root/radio-root.d.ts +24 -28
  118. package/dist/rating/root/rating-root.d.ts +27 -30
  119. package/dist/scatter-chart/root/scatter-chart-root.d.ts +43 -55
  120. package/dist/scroll-area/root/scroll-area-root.d.ts +15 -21
  121. package/dist/select/root/select-root.d.ts +41 -44
  122. package/dist/skeleton/root/skeleton-root.d.ts +7 -8
  123. package/dist/skip-link/root/skip-link-root.d.ts +21 -28
  124. package/dist/slider/root/slider-root.d.ts +36 -39
  125. package/dist/sparkline/root/sparkline-root.d.ts +22 -28
  126. package/dist/speed-dial/item/speed-dial-item.d.ts +21 -21
  127. package/dist/speed-dial/root/speed-dial-root.d.ts +25 -27
  128. package/dist/splitter/root/splitter-root.d.ts +37 -41
  129. package/dist/stat/group/stat-group.d.ts +4 -4
  130. package/dist/stat/root/stat-root.d.ts +8 -9
  131. package/dist/steps/root/steps-root.d.ts +11 -14
  132. package/dist/steps/step/step.d.ts +22 -29
  133. package/dist/switch/root/switch-root.d.ts +20 -24
  134. package/dist/table/cell/table-cell.d.ts +18 -8
  135. package/dist/table/cell/table-cell.js +5 -1
  136. package/dist/table/column/table-column.d.ts +62 -55
  137. package/dist/table/root/table-root.d.ts +16 -17
  138. package/dist/table/row/table-row.d.ts +3 -3
  139. package/dist/tabs/panel/tab-panel.d.ts +3 -3
  140. package/dist/tabs/root/tabs-root.d.ts +19 -17
  141. package/dist/tabs/tab/tab.d.ts +6 -6
  142. package/dist/tag/root/tag-root.d.ts +11 -12
  143. package/dist/textarea/root/textarea-root.d.ts +29 -32
  144. package/dist/time-input/root/time-input-root.d.ts +70 -69
  145. package/dist/time-picker/root/time-picker-root.d.ts +58 -66
  146. package/dist/timeline/item/timeline-item.d.ts +18 -24
  147. package/dist/timeline/root/timeline-root.d.ts +13 -21
  148. package/dist/toast/item/toast-item.d.ts +21 -22
  149. package/dist/toast/root/toast-root.d.ts +18 -23
  150. package/dist/toggle/group/toggle-group.d.ts +23 -25
  151. package/dist/toggle/root/toggle-root.d.ts +8 -8
  152. package/dist/toolbar/root/toolbar-root.d.ts +7 -10
  153. package/dist/tooltip/root/tooltip-root.d.ts +41 -47
  154. package/dist/tour/root/tour-root.d.ts +24 -26
  155. package/dist/tour/stop/tour-stop.d.ts +39 -48
  156. package/dist/tree/item/tree-item.d.ts +23 -25
  157. package/dist/tree/root/tree-root.d.ts +13 -12
  158. package/dist/trend/root/trend-root.d.ts +18 -19
  159. package/dist/video/root/video-root.d.ts +108 -101
  160. package/dist/video-playlist/item/video-playlist-item.d.ts +23 -28
  161. package/dist/video-playlist/menu/video-playlist-menu.d.ts +17 -21
  162. package/dist/video-playlist/root/video-playlist-root.d.ts +21 -25
  163. package/dist/virtual-list/root/virtual-list-root.d.ts +27 -26
  164. package/package.json +5 -5
  165. package/types/jsx.d.ts +14011 -11983
  166. package/types/svelte.d.ts +10 -0
  167. package/types/vue.d.ts +2143 -1497
@@ -1 +1,15 @@
1
+ export { HelixHeadlessMapArea } from './area/map-area.js';
2
+ export { HelixHeadlessMapBuildings } from './buildings/map-buildings.js';
3
+ export { HelixHeadlessMapContours } from './contours/map-contours.js';
4
+ export { HelixHeadlessMapLandcover } from './landcover/map-landcover.js';
5
+ export { HelixHeadlessMapMarker } from './marker/map-marker.js';
6
+ export type { MapPointsCollection, MapPointsInView, MapPointsPlace, } from './points/map-points.js';
7
+ export { HelixHeadlessMapPoints } from './points/map-points.js';
8
+ export { HelixHeadlessMapPosition } from './position/map-position.js';
9
+ export { HelixHeadlessMapRaster } from './raster/map-raster.js';
10
+ export type { MapType } from './root/map-root.js';
1
11
  export { HelixHeadlessMap } from './root/map-root.js';
12
+ export type { MapPoint } from './route/map-route.js';
13
+ export { HelixHeadlessMapRoute } from './route/map-route.js';
14
+ export type { MapTerrainEncoding } from './terrain/map-terrain.js';
15
+ export { HelixHeadlessMapTerrain } from './terrain/map-terrain.js';
package/dist/map/index.js CHANGED
@@ -1 +1,11 @@
1
+ export { HelixHeadlessMapArea } from './area/map-area.js';
2
+ export { HelixHeadlessMapBuildings } from './buildings/map-buildings.js';
3
+ export { HelixHeadlessMapContours } from './contours/map-contours.js';
4
+ export { HelixHeadlessMapLandcover } from './landcover/map-landcover.js';
5
+ export { HelixHeadlessMapMarker } from './marker/map-marker.js';
6
+ export { HelixHeadlessMapPoints } from './points/map-points.js';
7
+ export { HelixHeadlessMapPosition } from './position/map-position.js';
8
+ export { HelixHeadlessMapRaster } from './raster/map-raster.js';
1
9
  export { HelixHeadlessMap } from './root/map-root.js';
10
+ export { HelixHeadlessMapRoute } from './route/map-route.js';
11
+ export { HelixHeadlessMapTerrain } from './terrain/map-terrain.js';
@@ -0,0 +1,47 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { nothing, type PropertyValues } from 'lit';
3
+ /**
4
+ * @summary What covers the ground on a map: forest, grass, farmland, wetland, sand, rock, and ice.
5
+ *
6
+ * @description
7
+ * `connectMap` colors the ground by what covers it, from the land cover in
8
+ * the map's own tiles: forest and grass in greens, farmland in wheat,
9
+ * wetland in teal, sand in tan, rock in gray, and ice in pale blue. Each is
10
+ * mixed into the map's land color, so the colors sit in a light or a dark
11
+ * theme. It draws over the map's parks, and under its water and roads.
12
+ *
13
+ * MapLibre draws it, from tiles in the OpenMapTiles schema. The frame lists
14
+ * the layer by its `label` for screen readers.
15
+ *
16
+ * @since 0.105.0
17
+ * @status experimental
18
+ * @category media
19
+ * @aliases Land cover, Land use, Vegetation, Ground cover
20
+ * @documentation https://fusion.dev/helix/components/map
21
+ *
22
+ * @event {HelixMapPartChangeEvent} helix-map-part-change - The layer's name or color changed. Used by `connectMap`; pages do not need to listen for it.
23
+ */
24
+ export declare class HelixHeadlessMapLandcover extends HelixElement {
25
+ /** More about the land cover. Read after the label in the frame's list. */
26
+ description?: string;
27
+ /**
28
+ * A name this layer shares with other layers, such as a route and its
29
+ * dotted legs. The layers menu shows layers in the same group as one entry,
30
+ * named by the first of them, and its checkbox shows or hides them all.
31
+ */
32
+ group?: string;
33
+ /** Marks this as a layer for the frame and the connector, whatever its tag. */
34
+ readonly isMapLayer = true;
35
+ /** @internal Which kind of layer, which is how the connector draws it. */
36
+ readonly layerKind: 'landcover';
37
+ /** The layer's name in the frame's list. */
38
+ label: string;
39
+ /** Tells the frame and the connector the layer was renamed or recolored. */
40
+ protected updated(changed: PropertyValues): void;
41
+ protected render(): typeof nothing;
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ 'helix-headless-map-landcover': HelixHeadlessMapLandcover;
46
+ }
47
+ }
@@ -0,0 +1,37 @@
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
+ let HelixHeadlessMapLandcover = class HelixHeadlessMapLandcover extends HelixElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.isMapLayer = true;
14
+ this.layerKind = 'landcover';
15
+ this.label = 'Land cover';
16
+ }
17
+ updated(changed) {
18
+ super.updated(changed);
19
+ this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
20
+ }
21
+ render() {
22
+ return nothing;
23
+ }
24
+ };
25
+ __decorate([
26
+ property()
27
+ ], HelixHeadlessMapLandcover.prototype, "description", void 0);
28
+ __decorate([
29
+ property()
30
+ ], HelixHeadlessMapLandcover.prototype, "group", void 0);
31
+ __decorate([
32
+ property()
33
+ ], HelixHeadlessMapLandcover.prototype, "label", void 0);
34
+ HelixHeadlessMapLandcover = __decorate([
35
+ customElement('helix-headless-map-landcover')
36
+ ], HelixHeadlessMapLandcover);
37
+ export { HelixHeadlessMapLandcover };
@@ -0,0 +1,120 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { type PropertyValues, type TemplateResult } from 'lit';
3
+ /**
4
+ * @summary A named place on a map.
5
+ *
6
+ * @description
7
+ * A button placed at a latitude and longitude. `connectMap` positions it on
8
+ * the map and moves it as the map moves. Its name shows beside it on hover
9
+ * and focus.
10
+ *
11
+ * Pressing a marker sends `helix-activate` from the frame with the marker's
12
+ * `name`, or its `label` if it has no name.
13
+ *
14
+ * All the markers in a map share one tab stop. The arrow keys move between
15
+ * them in the order they are written.
16
+ *
17
+ * @since 0.105.0
18
+ * @status experimental
19
+ * @category media
20
+ * @aliases Map pin, Place, Point of interest
21
+ * @documentation https://fusion.dev/helix/components/map
22
+ *
23
+ * @slot icon - A letter, number, or icon shown in the point, such as a stop's order. Screen readers read the marker's label only.
24
+ *
25
+ * @event {HelixMapClusterEvent} helix-map-cluster - This marker shows a cluster and was pressed. `connectMap` zooms in to its places.
26
+ * @event {HelixMapPartChangeEvent} helix-map-part-change - The marker moved or was renamed. Used by `connectMap`; pages do not need to listen for it.
27
+ *
28
+ * @csspart label - The place's name, next to the point.
29
+ * @csspart marker - The button, holding the point and the name.
30
+ * @csspart point - The dot on the place, holding the icon if there is one.
31
+ *
32
+ * @cssstate behind - On the far side of a globe, out of sight until the globe turns it into view.
33
+ * @cssstate cluster - Shows several markers as one count.
34
+ * @cssstate clustered - Hidden inside another marker's cluster.
35
+ * @cssstate current - Holds the map's tab stop.
36
+ * @cssstate fanned - Spread out from a location it shares with other markers, after their cluster was pressed.
37
+ * @cssstate icon - Has content in the icon slot.
38
+ * @cssstate passed - Marked as passed.
39
+ * @cssstate start - Shows its name before the point, because there was no room after it.
40
+ */
41
+ export declare class HelixHeadlessMapMarker extends HelixElement {
42
+ /**
43
+ * @internal Whether the map's one tab stop is on this marker, written by the
44
+ * frame. Not a consumer's to set: the frame keeps exactly one.
45
+ */
46
+ current: boolean;
47
+ /**
48
+ * @internal The names of the places this stands for, its own first, written
49
+ * by the connector while it gathers markers that would draw over each other.
50
+ * Empty while it stands only for itself.
51
+ */
52
+ gathered: string[];
53
+ /**
54
+ * @internal Whether the place is on the far side of a globe, written by the
55
+ * connector. It is hidden meanwhile, and stays in the frame's walk, so a
56
+ * reader reaching it turns the globe to show it.
57
+ */
58
+ behind: boolean;
59
+ /**
60
+ * @internal Whether this stands fanned out from a spot it shares with
61
+ * other places, written by the connector when their cluster is pressed and
62
+ * no zoom would draw them apart.
63
+ */
64
+ fanned: boolean;
65
+ /**
66
+ * @internal The marker standing for this one while they are gathered,
67
+ * written by the connector. This one is hidden meanwhile, and the frame's
68
+ * walk and tab stop go to the one standing for it.
69
+ */
70
+ gatheredBy: HelixHeadlessMapMarker | undefined;
71
+ /**
72
+ * Marks the element as a map marker. The frame and the connector find
73
+ * markers among the frame's children by this flag, so they treat a styled
74
+ * marker and a headless one the same way.
75
+ */
76
+ readonly isMapMarker = true;
77
+ /** The place's name. Shown next to the marker and read by screen readers. */
78
+ label?: string;
79
+ /** Latitude, in degrees. A marker without both `lat` and `lng` is not shown. */
80
+ lat?: number;
81
+ /** Longitude, in degrees. */
82
+ lng?: number;
83
+ /**
84
+ * @internal Which side of the point the name sits on, in reading order,
85
+ * written by the connector from the room either side of the place. After
86
+ * the point unless the view's edge would cut the name off there.
87
+ */
88
+ side: 'end' | 'start';
89
+ /** The value `helix-activate` reports. Defaults to the label. */
90
+ name: string;
91
+ /**
92
+ * Marks the place as passed, such as a stop already visited. The marker is
93
+ * drawn muted, and its name is followed by `passed-label`.
94
+ */
95
+ passed: boolean;
96
+ /** The word added after a passed place's name. Defaults to "passed". */
97
+ passedLabel: string;
98
+ protected willUpdate(changed: PropertyValues): void;
99
+ /**
100
+ * Tells the connector the place moved or was renamed, which moves the point
101
+ * or changes how far the name reaches, and the frame that it was gathered
102
+ * or let go, which moves its tab stop. Not for the rest of the frame's own
103
+ * bookkeeping, `current` and `side`, which the frame and the connector wrote.
104
+ */
105
+ protected updated(changed: PropertyValues): void;
106
+ /**
107
+ * How far the marker reaches from its point along the line, name included,
108
+ * in CSS pixels: the button's width, which is laid out even while its name is
109
+ * faded, so the connector can ask before the name is ever shown.
110
+ */
111
+ extent(): number;
112
+ /** Focuses the marker's button. The host draws no box of its own. */
113
+ focus(options?: FocusOptions): void;
114
+ protected render(): TemplateResult;
115
+ }
116
+ declare global {
117
+ interface HTMLElementTagNameMap {
118
+ 'helix-headless-map-marker': HelixHeadlessMapMarker;
119
+ }
120
+ }
@@ -0,0 +1,109 @@
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, nothing } from 'lit';
9
+ import { property, state } from 'lit/decorators.js';
10
+ const BOOKKEEPING = new Set([
11
+ 'behind',
12
+ 'current',
13
+ 'fanned',
14
+ 'gathered',
15
+ 'gatheredBy',
16
+ 'side',
17
+ ]);
18
+ let HelixHeadlessMapMarker = class HelixHeadlessMapMarker extends HelixElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.current = false;
22
+ this.gathered = [];
23
+ this.behind = false;
24
+ this.fanned = false;
25
+ this.gatheredBy = undefined;
26
+ this.isMapMarker = true;
27
+ this.side = 'end';
28
+ this.name = '';
29
+ this.passed = false;
30
+ this.passedLabel = 'passed';
31
+ }
32
+ willUpdate(changed) {
33
+ super.willUpdate(changed);
34
+ this.toggleState('behind', this.behind);
35
+ this.toggleState('cluster', this.gathered.length > 1);
36
+ this.toggleState('clustered', this.gatheredBy !== undefined);
37
+ this.toggleState('current', this.current);
38
+ this.toggleState('fanned', this.fanned);
39
+ this.toggleState('passed', this.passed);
40
+ this.toggleState('start', this.side === 'start');
41
+ if (this.childrenKnown) {
42
+ this.toggleState('icon', this.knownChildren.some((child) => child.slot === 'icon'));
43
+ }
44
+ }
45
+ updated(changed) {
46
+ super.updated(changed);
47
+ const keys = [...changed.keys()];
48
+ if (keys.some((key) => key === 'gathered' || key === 'gatheredBy')) {
49
+ this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'cluster' }));
50
+ }
51
+ if (keys.some((key) => !BOOKKEEPING.has(key))) {
52
+ this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'place' }));
53
+ }
54
+ }
55
+ extent() {
56
+ return this.partNamed('marker')?.getBoundingClientRect().width ?? 0;
57
+ }
58
+ focus(options) {
59
+ this.partNamed('marker')?.focus(options);
60
+ }
61
+ render() {
62
+ const cluster = this.gathered.length > 1;
63
+ const lang = cluster ? this.closest('[lang]')?.getAttribute('lang') || undefined : undefined;
64
+ return html `<span part="marker" role="button" tabindex=${this.current ? '0' : '-1'} ?hidden=${this.gatheredBy !== undefined}>
65
+ <span part="point" aria-hidden="true">${cluster ? new Intl.NumberFormat(lang).format(this.gathered.length) : nothing}<slot name="icon" ?hidden=${cluster} @slotchange=${() => this.requestUpdate()}></slot></span>
66
+ <span part="label">${cluster ? new Intl.ListFormat(lang, { type: 'conjunction' }).format(this.gathered) : this.passed ? `${this.label ?? ''}, ${this.passedLabel}` : (this.label ?? '')}</span>
67
+ </span>`;
68
+ }
69
+ };
70
+ __decorate([
71
+ state()
72
+ ], HelixHeadlessMapMarker.prototype, "current", void 0);
73
+ __decorate([
74
+ state()
75
+ ], HelixHeadlessMapMarker.prototype, "gathered", void 0);
76
+ __decorate([
77
+ state()
78
+ ], HelixHeadlessMapMarker.prototype, "behind", void 0);
79
+ __decorate([
80
+ state()
81
+ ], HelixHeadlessMapMarker.prototype, "fanned", void 0);
82
+ __decorate([
83
+ state()
84
+ ], HelixHeadlessMapMarker.prototype, "gatheredBy", void 0);
85
+ __decorate([
86
+ property()
87
+ ], HelixHeadlessMapMarker.prototype, "label", void 0);
88
+ __decorate([
89
+ property({ type: Number })
90
+ ], HelixHeadlessMapMarker.prototype, "lat", void 0);
91
+ __decorate([
92
+ property({ type: Number })
93
+ ], HelixHeadlessMapMarker.prototype, "lng", void 0);
94
+ __decorate([
95
+ state()
96
+ ], HelixHeadlessMapMarker.prototype, "side", void 0);
97
+ __decorate([
98
+ property()
99
+ ], HelixHeadlessMapMarker.prototype, "name", void 0);
100
+ __decorate([
101
+ property({ type: Boolean })
102
+ ], HelixHeadlessMapMarker.prototype, "passed", void 0);
103
+ __decorate([
104
+ property({ attribute: 'passed-label' })
105
+ ], HelixHeadlessMapMarker.prototype, "passedLabel", void 0);
106
+ HelixHeadlessMapMarker = __decorate([
107
+ customElement('helix-headless-map-marker')
108
+ ], HelixHeadlessMapMarker);
109
+ export { HelixHeadlessMapMarker };
@@ -0,0 +1,139 @@
1
+ import { HelixElement } from '@fusion.dev/helix-core';
2
+ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
3
+ /** A place in a points layer, written as an object with coordinates and an optional name. */
4
+ export interface MapPointsPlace {
5
+ /** What pressing it reports, where it is not its label. */
6
+ id?: string | number | undefined;
7
+ /** Its name. */
8
+ label?: string | undefined;
9
+ lat: number;
10
+ lng: number;
11
+ }
12
+ /**
13
+ * A point or a count the renderer drew in view, as the connector found it and
14
+ * stood it on the screen, in pixels from the map's top left.
15
+ */
16
+ export interface MapPointsInView {
17
+ /** How many places it stands for, where it is a count. */
18
+ count?: number | undefined;
19
+ /** Which it is, as the connector keys it: the same point or count keeps it while it stays in view. */
20
+ key: string;
21
+ /** Its name, where it is a point that has one. */
22
+ label?: string | undefined;
23
+ /** What pressing it reports, where it is a point. */
24
+ value?: string | undefined;
25
+ x: number;
26
+ y: number;
27
+ }
28
+ /** A GeoJSON collection of points, longitude first as GeoJSON writes it. */
29
+ export interface MapPointsCollection {
30
+ features: {
31
+ geometry: {
32
+ coordinates: number[];
33
+ type: string;
34
+ } | null;
35
+ id?: string | number | undefined;
36
+ properties?: Record<string, unknown> | null;
37
+ type: 'Feature';
38
+ }[];
39
+ type: 'FeatureCollection';
40
+ }
41
+ /**
42
+ * @summary Thousands of places on a map, loaded from data.
43
+ *
44
+ * @description
45
+ * Use a points layer for more places than markers can handle, such as every
46
+ * café in a city. `connectMap` draws the points as one layer of the map. Set
47
+ * `src` to a GeoJSON file, or set `data` to a GeoJSON collection or a list of
48
+ * places. With `cluster`, nearby points combine into counts.
49
+ *
50
+ * Pressing a point sends `helix-activate` from this element with the point's
51
+ * id, or its name if it has no id. Each point is named by its `name`
52
+ * property, or by the property set in `name-key`.
53
+ *
54
+ * The points and counts in view share one tab stop. The arrow keys, Home, and
55
+ * End move between them from top to bottom and along each line. Enter on a
56
+ * count zooms in to it.
57
+ *
58
+ * @since 0.105.0
59
+ * @status experimental
60
+ * @category media
61
+ * @aliases Data layer, GeoJSON layer, Point cloud, Point layer
62
+ * @documentation https://fusion.dev/helix/components/map
63
+ *
64
+ * @event {HelixActivateEvent} helix-activate - A point in view was pressed. The value is its id, or its name if it has no id.
65
+ * @event {HelixMapClusterEvent} helix-map-cluster - A count in view was pressed from the keyboard. `connectMap` zooms in to it.
66
+ * @event {HelixMapPartChangeEvent} helix-map-part-change - The points, name, or color changed. Used by `connectMap`; pages do not need to listen for it.
67
+ *
68
+ * @csspart count - The button on a count, which is also a `place`.
69
+ * @csspart label - The name of the focused point or count.
70
+ * @csspart place - The button on a point or count in view.
71
+ * @csspart places - The group of buttons, named by the layer's label.
72
+ */
73
+ export declare class HelixHeadlessMapPoints extends HelixElement {
74
+ /** Combines nearby points into counts. Pressing a count zooms in to it. */
75
+ cluster: boolean;
76
+ /**
77
+ * The name read for a count. `{count}` is replaced by the number of places.
78
+ * Defaults to "{count} places".
79
+ */
80
+ countLabel: string;
81
+ /**
82
+ * The points, as a GeoJSON collection or a list of `{ lat, lng, label, id }`
83
+ * places.
84
+ */
85
+ data?: MapPointsCollection | readonly MapPointsPlace[];
86
+ /**
87
+ * More about the points, such as how many there are. Read after the label in
88
+ * the frame's list.
89
+ */
90
+ description?: string;
91
+ /**
92
+ * A name this layer shares with other layers, such as a route and its
93
+ * dotted legs. The layers menu shows layers in the same group as one entry,
94
+ * named by the first of them, and its checkbox shows or hides them all.
95
+ */
96
+ group?: string;
97
+ /** Marks this as a layer for the frame and the connector, whatever its tag. */
98
+ readonly isMapLayer = true;
99
+ /** The layer's name, used in the frame's list. */
100
+ label?: string;
101
+ /** @internal Which kind of layer, which is how the connector draws it. */
102
+ readonly layerKind: 'points';
103
+ /** The GeoJSON property each point is named by. Defaults to `name`. */
104
+ nameKey: string;
105
+ /** A GeoJSON file of points to load. Ignored when `data` is set. */
106
+ src?: string;
107
+ /**
108
+ * @internal The points and counts in view, in reading order and stood on
109
+ * the screen, written by the connector as the view moves and settles.
110
+ */
111
+ walk: MapPointsInView[];
112
+ /** The one the layer's tab stop is on, by its key: the first until a reader moves it. */
113
+ private stop;
114
+ /** Where focus was when the walk changed, so it can go to what stands nearest there. */
115
+ private held;
116
+ /** What a point or a count in view is called. */
117
+ private nameOf;
118
+ /** The button standing on one, where it is drawn. */
119
+ private buttonOf;
120
+ /** Moves the tab stop and the focus to one. */
121
+ private reach;
122
+ /** Presses one: a point is the page's, a count the connector's to zoom in to. */
123
+ private press;
124
+ private readonly handleKeydown;
125
+ private readonly handleKeyup;
126
+ private readonly handleFocusin;
127
+ protected willUpdate(changed: PropertyValues): void;
128
+ /**
129
+ * Tells the frame and the connector the points changed, were renamed or were
130
+ * retoned; not the walk, which the connector wrote, nor where it stands.
131
+ */
132
+ protected updated(changed: PropertyValues): void;
133
+ protected render(): TemplateResult | typeof nothing;
134
+ }
135
+ declare global {
136
+ interface HTMLElementTagNameMap {
137
+ 'helix-headless-map-points': HelixHeadlessMapPoints;
138
+ }
139
+ }
@@ -0,0 +1,161 @@
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, HelixActivateEvent, HelixElement, HelixMapClusterEvent, HelixMapPartChangeEvent, isRtl, } from '@fusion.dev/helix-core';
8
+ import { html, nothing } from 'lit';
9
+ import { property, state } from 'lit/decorators.js';
10
+ import { repeat } from 'lit/directives/repeat.js';
11
+ let HelixHeadlessMapPoints = class HelixHeadlessMapPoints extends HelixElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.cluster = false;
15
+ this.countLabel = '{count} places';
16
+ this.isMapLayer = true;
17
+ this.layerKind = 'points';
18
+ this.nameKey = 'name';
19
+ this.walk = [];
20
+ this.handleKeydown = (event) => {
21
+ const key = event.composedPath()[0]?.dataset?.key;
22
+ const at = this.walk.findIndex((one) => one.key === key);
23
+ const here = this.walk[at];
24
+ if (!here) {
25
+ return;
26
+ }
27
+ const forward = isRtl(this) ? 'ArrowLeft' : 'ArrowRight';
28
+ const back = isRtl(this) ? 'ArrowRight' : 'ArrowLeft';
29
+ const last = this.walk.length - 1;
30
+ const to = event.key === forward || event.key === 'ArrowDown'
31
+ ? Math.min(at + 1, last)
32
+ : event.key === back || event.key === 'ArrowUp'
33
+ ? Math.max(at - 1, 0)
34
+ : event.key === 'Home'
35
+ ? 0
36
+ : event.key === 'End'
37
+ ? last
38
+ : undefined;
39
+ if (to !== undefined) {
40
+ event.preventDefault();
41
+ this.reach(this.walk[to]);
42
+ return;
43
+ }
44
+ if (event.key === 'Enter' || event.key === ' ') {
45
+ event.preventDefault();
46
+ if (event.key === 'Enter' && !event.repeat) {
47
+ this.press(here);
48
+ }
49
+ }
50
+ };
51
+ this.handleKeyup = (event) => {
52
+ const key = event.composedPath()[0]?.dataset?.key;
53
+ const here = this.walk.find((one) => one.key === key);
54
+ if (here && event.key === ' ') {
55
+ event.preventDefault();
56
+ this.press(here);
57
+ }
58
+ };
59
+ this.handleFocusin = (event) => {
60
+ const key = event.composedPath()[0]?.dataset?.key;
61
+ if (key !== undefined) {
62
+ this.stop = key;
63
+ }
64
+ };
65
+ }
66
+ nameOf(one) {
67
+ if (one.count !== undefined) {
68
+ const lang = this.closest('[lang]')?.getAttribute('lang') || undefined;
69
+ return this.countLabel.replace('{count}', new Intl.NumberFormat(lang).format(one.count));
70
+ }
71
+ return one.label || one.value || '';
72
+ }
73
+ buttonOf(key) {
74
+ return key === undefined
75
+ ? null
76
+ : (this.renderRoot.querySelector(`[data-key="${CSS.escape(key)}"]`) ?? null);
77
+ }
78
+ reach(one) {
79
+ if (!one) {
80
+ return;
81
+ }
82
+ this.stop = one.key;
83
+ void this.updateComplete.then(() => this.buttonOf(one.key)?.focus());
84
+ }
85
+ press(one) {
86
+ if (one.count !== undefined) {
87
+ this.dispatchEvent(new HelixMapClusterEvent({ key: one.key, labels: [] }));
88
+ }
89
+ else {
90
+ this.dispatchEvent(new HelixActivateEvent({ value: one.value || one.label || '' }));
91
+ }
92
+ }
93
+ willUpdate(changed) {
94
+ super.willUpdate(changed);
95
+ if (changed.has('walk')) {
96
+ const key = this.shadowRoot?.activeElement?.dataset?.key;
97
+ const was = changed.get('walk') ?? [];
98
+ this.held = was.find((one) => one.key === key);
99
+ }
100
+ }
101
+ updated(changed) {
102
+ super.updated(changed);
103
+ const held = this.held;
104
+ this.held = undefined;
105
+ if (held && !this.walk.some((one) => one.key === held.key)) {
106
+ const nearest = [...this.walk].sort((a, b) => Math.hypot(a.x - held.x, a.y - held.y) - Math.hypot(b.x - held.x, b.y - held.y))[0];
107
+ this.reach(nearest);
108
+ }
109
+ if ([...changed.keys()].some((key) => key !== 'walk' && key !== 'stop')) {
110
+ this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
111
+ }
112
+ }
113
+ render() {
114
+ if (this.walk.length === 0) {
115
+ return nothing;
116
+ }
117
+ const stop = this.walk.some((one) => one.key === this.stop) ? this.stop : this.walk[0]?.key;
118
+ return html `<span part="places" role="group" aria-label=${this.label ?? ''} @focusin=${this.handleFocusin} @keydown=${this.handleKeydown} @keyup=${this.handleKeyup}>${repeat(this.walk, (one) => one.key, (one) => {
119
+ const tabindex = one.key === stop ? '0' : '-1';
120
+ const at = `--_map-place-x: ${one.x}px; --_map-place-y: ${one.y}px`;
121
+ const name = html `<span part="label">${this.nameOf(one)}</span>`;
122
+ return one.count === undefined
123
+ ? html `<span part="place" role="button" data-key=${one.key} tabindex=${tabindex} style=${at}>${name}</span>`
124
+ : html `<span part="place count" role="button" data-key=${one.key} tabindex=${tabindex} style=${at}>${name}</span>`;
125
+ })}</span>`;
126
+ }
127
+ };
128
+ __decorate([
129
+ property({ type: Boolean })
130
+ ], HelixHeadlessMapPoints.prototype, "cluster", void 0);
131
+ __decorate([
132
+ property({ attribute: 'count-label' })
133
+ ], HelixHeadlessMapPoints.prototype, "countLabel", void 0);
134
+ __decorate([
135
+ property({ attribute: false })
136
+ ], HelixHeadlessMapPoints.prototype, "data", void 0);
137
+ __decorate([
138
+ property()
139
+ ], HelixHeadlessMapPoints.prototype, "description", void 0);
140
+ __decorate([
141
+ property()
142
+ ], HelixHeadlessMapPoints.prototype, "group", void 0);
143
+ __decorate([
144
+ property()
145
+ ], HelixHeadlessMapPoints.prototype, "label", void 0);
146
+ __decorate([
147
+ property({ attribute: 'name-key' })
148
+ ], HelixHeadlessMapPoints.prototype, "nameKey", void 0);
149
+ __decorate([
150
+ property()
151
+ ], HelixHeadlessMapPoints.prototype, "src", void 0);
152
+ __decorate([
153
+ state()
154
+ ], HelixHeadlessMapPoints.prototype, "walk", void 0);
155
+ __decorate([
156
+ state()
157
+ ], HelixHeadlessMapPoints.prototype, "stop", void 0);
158
+ HelixHeadlessMapPoints = __decorate([
159
+ customElement('helix-headless-map-points')
160
+ ], HelixHeadlessMapPoints);
161
+ export { HelixHeadlessMapPoints };