@timefoldai/viz-react 0.0.0 → 0.1.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 (288) hide show
  1. package/README.md +239 -1
  2. package/dist/THIRD-PARTY-NOTICES.txt +99 -0
  3. package/dist/a11y/AccessibleTable.d.mts +42 -0
  4. package/dist/a11y/AccessibleTable.mjs +82 -0
  5. package/dist/a11y/activation.d.mts +4 -0
  6. package/dist/a11y/activation.mjs +0 -0
  7. package/dist/analytics/AnalyticsProvider.d.mts +16 -0
  8. package/dist/analytics/AnalyticsProvider.mjs +32 -0
  9. package/dist/assets/Inter-latin-ext.woff2 +0 -0
  10. package/dist/badge/Badge.css +122 -0
  11. package/dist/badge/Badge.d.mts +50 -0
  12. package/dist/badge/Badge.mjs +145 -0
  13. package/dist/badge/Badge.module.css.mjs +15 -0
  14. package/dist/badge/BadgeFacetGroup.d.mts +23 -0
  15. package/dist/badge/BadgeFacetGroup.mjs +220 -0
  16. package/dist/badge/BadgeGroup.d.mts +13 -0
  17. package/dist/badge/BadgeGroup.mjs +53 -0
  18. package/dist/badge/BadgeList.d.mts +14 -0
  19. package/dist/badge/BadgeList.mjs +15 -0
  20. package/dist/badge/badge-facet-fit.d.mts +18 -0
  21. package/dist/badge/badge-facet-fit.mjs +50 -0
  22. package/dist/badge/badge-item.d.mts +19 -0
  23. package/dist/badge/badge-item.mjs +23 -0
  24. package/dist/button/CopyButton.d.mts +12 -0
  25. package/dist/button/CopyButton.mjs +52 -0
  26. package/dist/button/ShowAllButton.d.mts +14 -0
  27. package/dist/button/ShowAllButton.mjs +61 -0
  28. package/dist/button/ShowMoreButton.d.mts +13 -0
  29. package/dist/button/ShowMoreButton.mjs +51 -0
  30. package/dist/button/SolveButton.d.mts +16 -0
  31. package/dist/button/SolveButton.mjs +56 -0
  32. package/dist/charts/BarChart.css +59 -0
  33. package/dist/charts/BarChart.d.mts +26 -0
  34. package/dist/charts/BarChart.mjs +167 -0
  35. package/dist/charts/BarChart.module.css.mjs +10 -0
  36. package/dist/charts/ChartGrid.d.mts +8 -0
  37. package/dist/charts/ChartGrid.mjs +47 -0
  38. package/dist/charts/DistributionChart.d.mts +60 -0
  39. package/dist/charts/DistributionChart.mjs +151 -0
  40. package/dist/code/CodeBlock.d.mts +13 -0
  41. package/dist/code/CodeBlock.mjs +71 -0
  42. package/dist/composition-bar/CompositionBar.d.mts +24 -0
  43. package/dist/composition-bar/CompositionBar.mjs +124 -0
  44. package/dist/composition-bar/composition-shares.d.mts +8 -0
  45. package/dist/composition-bar/composition-shares.mjs +30 -0
  46. package/dist/data-gate/DataGate.d.mts +34 -0
  47. package/dist/data-gate/DataGate.mjs +80 -0
  48. package/dist/date-scope/DateScope.d.mts +30 -0
  49. package/dist/date-scope/DateScope.mjs +285 -0
  50. package/dist/design-system/part-props.d.mts +39 -0
  51. package/dist/design-system/part-props.mjs +0 -0
  52. package/dist/detail-panel/DetailPanel.d.mts +22 -0
  53. package/dist/detail-panel/DetailPanel.mjs +80 -0
  54. package/dist/detail-panel/DetailPanelSection.d.mts +20 -0
  55. package/dist/detail-panel/DetailPanelSection.mjs +27 -0
  56. package/dist/detail-panel/micro-label.d.mts +7 -0
  57. package/dist/detail-panel/micro-label.mjs +9 -0
  58. package/dist/env.d.mts +2 -0
  59. package/dist/env.mjs +4 -0
  60. package/dist/export/ExportCsvButton.d.mts +19 -0
  61. package/dist/export/ExportCsvButton.mjs +73 -0
  62. package/dist/export/download-csv.d.mts +5 -0
  63. package/dist/export/download-csv.mjs +11 -0
  64. package/dist/export/download-file.d.mts +11 -0
  65. package/dist/export/download-file.mjs +32 -0
  66. package/dist/export/download-json.d.mts +2 -0
  67. package/dist/export/download-json.mjs +8 -0
  68. package/dist/filter/FilterGroup.d.mts +24 -0
  69. package/dist/filter/FilterGroup.mjs +71 -0
  70. package/dist/filter/FilterGroupTitle.d.mts +3 -0
  71. package/dist/filter/FilterGroupTitle.mjs +18 -0
  72. package/dist/filter/FilterItem.d.mts +17 -0
  73. package/dist/filter/FilterItem.mjs +94 -0
  74. package/dist/filter/FilterPanel.d.mts +22 -0
  75. package/dist/filter/FilterPanel.mjs +158 -0
  76. package/dist/filter/FilterToggleButton.d.mts +15 -0
  77. package/dist/filter/FilterToggleButton.mjs +30 -0
  78. package/dist/filter/date-range.d.mts +8 -0
  79. package/dist/filter/date-range.mjs +13 -0
  80. package/dist/filter/filter-facet.d.mts +7 -0
  81. package/dist/filter/filter-facet.mjs +0 -0
  82. package/dist/heatmap/Heatmap.css +138 -0
  83. package/dist/heatmap/Heatmap.d.mts +10 -0
  84. package/dist/heatmap/Heatmap.mjs +370 -0
  85. package/dist/heatmap/Heatmap.module.css.mjs +17 -0
  86. package/dist/heatmap/HeatmapCell.d.mts +25 -0
  87. package/dist/heatmap/HeatmapCell.mjs +124 -0
  88. package/dist/heatmap/heatmap-scale.d.mts +19 -0
  89. package/dist/heatmap/heatmap-scale.mjs +43 -0
  90. package/dist/heatmap/heatmap-types.d.mts +49 -0
  91. package/dist/heatmap/heatmap-types.mjs +0 -0
  92. package/dist/hooks/use-controllable-state.d.mts +9 -0
  93. package/dist/hooks/use-controllable-state.mjs +44 -0
  94. package/dist/hooks/use-debounced-value.d.mts +1 -0
  95. package/dist/hooks/use-debounced-value.mjs +27 -0
  96. package/dist/hooks/use-detail-panel-layout.d.mts +18 -0
  97. package/dist/hooks/use-detail-panel-layout.mjs +94 -0
  98. package/dist/hooks/use-hover-card.d.mts +47 -0
  99. package/dist/hooks/use-hover-card.mjs +190 -0
  100. package/dist/hooks/use-hover-focus-card.d.mts +38 -0
  101. package/dist/hooks/use-hover-focus-card.mjs +321 -0
  102. package/dist/hooks/use-hover-intent.d.mts +6 -0
  103. package/dist/hooks/use-hover-intent.mjs +55 -0
  104. package/dist/hooks/use-merged-ref.d.mts +2 -0
  105. package/dist/hooks/use-merged-ref.mjs +36 -0
  106. package/dist/hooks/use-tracked-anchor.d.mts +14 -0
  107. package/dist/hooks/use-tracked-anchor.mjs +42 -0
  108. package/dist/index.d.mts +97 -0
  109. package/dist/index.mjs +88 -0
  110. package/dist/input/MenuButton.d.mts +47 -0
  111. package/dist/input/MenuButton.mjs +152 -0
  112. package/dist/interval-strip/IntervalStrip.css +7 -0
  113. package/dist/interval-strip/IntervalStrip.d.mts +39 -0
  114. package/dist/interval-strip/IntervalStrip.mjs +233 -0
  115. package/dist/interval-strip/IntervalStrip.module.css.mjs +4 -0
  116. package/dist/interval-strip/IntervalStripAxis.d.mts +18 -0
  117. package/dist/interval-strip/IntervalStripAxis.mjs +73 -0
  118. package/dist/interval-strip/interval-fill.d.mts +2 -0
  119. package/dist/interval-strip/interval-fill.mjs +13 -0
  120. package/dist/interval-strip/interval-layout.d.mts +33 -0
  121. package/dist/interval-strip/interval-layout.mjs +79 -0
  122. package/dist/layout/AppShell.css +103 -0
  123. package/dist/layout/AppShell.d.mts +73 -0
  124. package/dist/layout/AppShell.mjs +397 -0
  125. package/dist/layout/AppShell.module.css.mjs +16 -0
  126. package/dist/layout/ColorSchemeMenu.d.mts +14 -0
  127. package/dist/layout/ColorSchemeMenu.mjs +92 -0
  128. package/dist/layout/DemoDataPicker.d.mts +17 -0
  129. package/dist/layout/DemoDataPicker.mjs +150 -0
  130. package/dist/layout/OverflowMenu.d.mts +11 -0
  131. package/dist/layout/OverflowMenu.mjs +94 -0
  132. package/dist/layout/SidebarLayout.css +70 -0
  133. package/dist/layout/SidebarLayout.d.mts +33 -0
  134. package/dist/layout/SidebarLayout.mjs +129 -0
  135. package/dist/layout/SidebarLayout.module.css.mjs +8 -0
  136. package/dist/layout/use-date-scope-day.d.mts +23 -0
  137. package/dist/layout/use-date-scope-day.mjs +63 -0
  138. package/dist/layout/use-fill-height.d.mts +7 -0
  139. package/dist/layout/use-fill-height.mjs +50 -0
  140. package/dist/layout/use-followed-state.d.mts +5 -0
  141. package/dist/layout/use-followed-state.mjs +75 -0
  142. package/dist/layout/use-page-route.d.mts +10 -0
  143. package/dist/layout/use-page-route.mjs +65 -0
  144. package/dist/legend/Legend.d.mts +54 -0
  145. package/dist/legend/Legend.mjs +132 -0
  146. package/dist/map/MapLayersControl.d.mts +11 -0
  147. package/dist/map/MapLayersControl.mjs +157 -0
  148. package/dist/map/MapLocator.css +9 -0
  149. package/dist/map/MapLocator.d.mts +18 -0
  150. package/dist/map/MapLocator.mjs +97 -0
  151. package/dist/map/MapLocator.module.css.mjs +4 -0
  152. package/dist/map/MapMarker.d.mts +29 -0
  153. package/dist/map/MapMarker.mjs +265 -0
  154. package/dist/map/MapStops.d.mts +19 -0
  155. package/dist/map/MapStops.mjs +355 -0
  156. package/dist/map/MapView.css +24 -0
  157. package/dist/map/MapView.d.mts +11 -0
  158. package/dist/map/MapView.mjs +141 -0
  159. package/dist/map/MapWebgl.d.mts +9 -0
  160. package/dist/map/MapWebgl.mjs +727 -0
  161. package/dist/map/area-layers.d.mts +33 -0
  162. package/dist/map/area-layers.mjs +96 -0
  163. package/dist/map/control-group.d.mts +6 -0
  164. package/dist/map/control-group.mjs +12 -0
  165. package/dist/map/for-each-chunk.d.mts +4 -0
  166. package/dist/map/for-each-chunk.mjs +14 -0
  167. package/dist/map/highlight.d.mts +30 -0
  168. package/dist/map/highlight.mjs +99 -0
  169. package/dist/map/locator-tile.d.mts +24 -0
  170. package/dist/map/locator-tile.mjs +41 -0
  171. package/dist/map/map-sites.d.mts +12 -0
  172. package/dist/map/map-sites.mjs +39 -0
  173. package/dist/map/map-style.d.mts +24 -0
  174. package/dist/map/map-style.mjs +79 -0
  175. package/dist/map/marker-geometry.d.mts +5 -0
  176. package/dist/map/marker-geometry.mjs +13 -0
  177. package/dist/map/marker-icon.d.mts +26 -0
  178. package/dist/map/marker-icon.mjs +223 -0
  179. package/dist/map/observe-color-scheme.d.mts +5 -0
  180. package/dist/map/observe-color-scheme.mjs +19 -0
  181. package/dist/map/popup-placement.d.mts +20 -0
  182. package/dist/map/popup-placement.mjs +20 -0
  183. package/dist/map/route-layers.d.mts +28 -0
  184. package/dist/map/route-layers.mjs +73 -0
  185. package/dist/map/types.d.mts +97 -0
  186. package/dist/map/types.mjs +0 -0
  187. package/dist/map/use-painted-color-scheme.d.mts +6 -0
  188. package/dist/map/use-painted-color-scheme.mjs +43 -0
  189. package/dist/map/use-resolved-colors.d.mts +5 -0
  190. package/dist/map/use-resolved-colors.mjs +63 -0
  191. package/dist/pagination/paginationLabels.d.mts +6 -0
  192. package/dist/pagination/paginationLabels.mjs +8 -0
  193. package/dist/popover/Popover.css +176 -0
  194. package/dist/popover/Popover.d.mts +239 -0
  195. package/dist/popover/Popover.mjs +672 -0
  196. package/dist/popover/Popover.module.css.mjs +18 -0
  197. package/dist/popover/PopoverFacts.d.mts +24 -0
  198. package/dist/popover/PopoverFacts.mjs +63 -0
  199. package/dist/readout/Readout.d.mts +15 -0
  200. package/dist/readout/Readout.mjs +53 -0
  201. package/dist/readout/TimeZoneReadout.d.mts +11 -0
  202. package/dist/readout/TimeZoneReadout.mjs +46 -0
  203. package/dist/score-box/ScoreBox.css +62 -0
  204. package/dist/score-box/ScoreBox.d.mts +12 -0
  205. package/dist/score-box/ScoreBox.mjs +143 -0
  206. package/dist/score-box/ScoreBox.module.css.mjs +15 -0
  207. package/dist/segment-bar/Segment.d.mts +23 -0
  208. package/dist/segment-bar/Segment.mjs +27 -0
  209. package/dist/segment-bar/SegmentBar.css +44 -0
  210. package/dist/segment-bar/SegmentBar.d.mts +35 -0
  211. package/dist/segment-bar/SegmentBar.mjs +57 -0
  212. package/dist/segment-bar/SegmentBar.module.css.mjs +9 -0
  213. package/dist/segment-bar/segment-box.d.mts +10 -0
  214. package/dist/segment-bar/segment-box.mjs +30 -0
  215. package/dist/stat/Stat.d.mts +25 -0
  216. package/dist/stat/Stat.mjs +36 -0
  217. package/dist/stat/StatTile.d.mts +18 -0
  218. package/dist/stat/StatTile.mjs +37 -0
  219. package/dist/styles.css +1 -0
  220. package/dist/swatch/Swatch.d.mts +8 -0
  221. package/dist/swatch/Swatch.mjs +30 -0
  222. package/dist/swatch/legend-swatch.d.mts +3 -0
  223. package/dist/swatch/legend-swatch.mjs +0 -0
  224. package/dist/tab-bar/FilteredTabBar.d.mts +32 -0
  225. package/dist/tab-bar/FilteredTabBar.mjs +181 -0
  226. package/dist/tab-bar/TabBar.d.mts +22 -0
  227. package/dist/tab-bar/TabBar.mjs +151 -0
  228. package/dist/tab-bar/TabPanel.d.mts +9 -0
  229. package/dist/tab-bar/TabPanel.mjs +55 -0
  230. package/dist/tab-bar/assert-named-value.d.mts +4 -0
  231. package/dist/tab-bar/assert-named-value.mjs +6 -0
  232. package/dist/table/DataTable.d.mts +31 -0
  233. package/dist/table/DataTable.mjs +43 -0
  234. package/dist/theme/use-color-scheme.d.mts +14 -0
  235. package/dist/theme/use-color-scheme.mjs +92 -0
  236. package/dist/theme.css +58 -0
  237. package/dist/timeline/Timeline.d.mts +54 -0
  238. package/dist/timeline/Timeline.mjs +220 -0
  239. package/dist/timeline/TimelineBand.d.mts +18 -0
  240. package/dist/timeline/TimelineBand.mjs +30 -0
  241. package/dist/timeline/TimelineGroup.d.mts +7 -0
  242. package/dist/timeline/TimelineGroup.mjs +50 -0
  243. package/dist/timeline/TimelineItem.d.mts +19 -0
  244. package/dist/timeline/TimelineItem.mjs +64 -0
  245. package/dist/timeline/TimelineItemChip.css +153 -0
  246. package/dist/timeline/TimelineItemChip.d.mts +23 -0
  247. package/dist/timeline/TimelineItemChip.mjs +74 -0
  248. package/dist/timeline/TimelineItemChip.module.css.mjs +15 -0
  249. package/dist/timeline/TimelineItemMark.css +38 -0
  250. package/dist/timeline/TimelineItemMark.d.mts +15 -0
  251. package/dist/timeline/TimelineItemMark.mjs +129 -0
  252. package/dist/timeline/TimelineItemMark.module.css.mjs +4 -0
  253. package/dist/timeline/TimelineRoot.d.mts +19 -0
  254. package/dist/timeline/TimelineRoot.mjs +742 -0
  255. package/dist/timeline/TimelineRowHeader.d.mts +23 -0
  256. package/dist/timeline/TimelineRowHeader.mjs +244 -0
  257. package/dist/timeline/TimelineZoomHint.d.mts +9 -0
  258. package/dist/timeline/TimelineZoomHint.mjs +32 -0
  259. package/dist/timeline/axis-label.d.mts +5 -0
  260. package/dist/timeline/axis-label.mjs +53 -0
  261. package/dist/timeline/batched-dataset-writer.d.mts +29 -0
  262. package/dist/timeline/batched-dataset-writer.mjs +58 -0
  263. package/dist/timeline/row-card-side.d.mts +7 -0
  264. package/dist/timeline/row-card-side.mjs +6 -0
  265. package/dist/timeline/timeline-a11y.d.mts +33 -0
  266. package/dist/timeline/timeline-a11y.mjs +96 -0
  267. package/dist/timeline/timeline-context.d.mts +33 -0
  268. package/dist/timeline/timeline-context.mjs +40 -0
  269. package/dist/timeline/timeline-types.d.mts +126 -0
  270. package/dist/timeline/timeline-types.mjs +0 -0
  271. package/dist/timeline/timeline-utils.d.mts +52 -0
  272. package/dist/timeline/timeline-utils.mjs +130 -0
  273. package/dist/timeline/zoom-modifier.d.mts +21 -0
  274. package/dist/timeline/zoom-modifier.mjs +25 -0
  275. package/dist/toast/ToastProvider.d.mts +33 -0
  276. package/dist/toast/ToastProvider.mjs +257 -0
  277. package/dist/toast/toast-context.d.mts +2 -0
  278. package/dist/toast/toast-context.mjs +5 -0
  279. package/dist/tokens.css +1 -0
  280. package/dist/tooltip/Tooltip.d.mts +17 -0
  281. package/dist/tooltip/Tooltip.mjs +41 -0
  282. package/dist/tooltip/hover-open-delay.d.mts +2 -0
  283. package/dist/tooltip/hover-open-delay.mjs +4 -0
  284. package/dist/tooltip/is-text-cut.d.mts +1 -0
  285. package/dist/tooltip/is-text-cut.mjs +5 -0
  286. package/dist/vendor/components.d.mts +664 -0
  287. package/dist/vendor/components.mjs +2060 -0
  288. package/package.json +56 -5
@@ -0,0 +1,265 @@
1
+ "use client";
2
+ import { stopPillViewBoxWidth } from "./marker-geometry.mjs";
3
+ import { c } from "react/compiler-runtime";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { TbCoffee, TbMapPinOff, TbTruckOff } from "react-icons/tb";
6
+ // src/map/MapMarker.tsx
7
+ const UNMET_PLATE_SIZE = 12;
8
+ const UNMET_GLYPH_SIZE = 8;
9
+ const UNMET_GLYPH_STEP = 9;
10
+ function StruckGlyph(t0) {
11
+ const $ = c(12);
12
+ const { icon: Icon, x, ink, halo } = t0;
13
+ let t1;
14
+ if ($[0] !== Icon || $[1] !== ink) {
15
+ t1 = /* @__PURE__ */ jsx(Icon, {
16
+ size: 24,
17
+ color: ink
18
+ });
19
+ $[0] = Icon;
20
+ $[1] = ink;
21
+ $[2] = t1;
22
+ } else t1 = $[2];
23
+ let t2;
24
+ if ($[3] !== halo) {
25
+ t2 = /* @__PURE__ */ jsx("path", {
26
+ d: "M3 3l18 18",
27
+ stroke: halo,
28
+ strokeWidth: "5"
29
+ });
30
+ $[3] = halo;
31
+ $[4] = t2;
32
+ } else t2 = $[4];
33
+ let t3;
34
+ if ($[5] !== ink) {
35
+ t3 = /* @__PURE__ */ jsx("path", {
36
+ d: "M3 3l18 18",
37
+ stroke: ink,
38
+ strokeWidth: "2"
39
+ });
40
+ $[5] = ink;
41
+ $[6] = t3;
42
+ } else t3 = $[6];
43
+ let t4;
44
+ if ($[7] !== t1 || $[8] !== t2 || $[9] !== t3 || $[10] !== x) {
45
+ t4 = /* @__PURE__ */ jsxs("svg", {
46
+ "data-slot": "map-marker-struck-glyph",
47
+ x,
48
+ y: 2,
49
+ width: UNMET_GLYPH_SIZE,
50
+ height: UNMET_GLYPH_SIZE,
51
+ viewBox: "0 0 24 24",
52
+ fill: "none",
53
+ strokeLinecap: "round",
54
+ children: [
55
+ t1,
56
+ t2,
57
+ t3
58
+ ]
59
+ });
60
+ $[7] = t1;
61
+ $[8] = t2;
62
+ $[9] = t3;
63
+ $[10] = x;
64
+ $[11] = t4;
65
+ } else t4 = $[11];
66
+ return t4;
67
+ }
68
+ /** The plate listing what a marker's assignment fails, each requirement's glyph struck through.
69
+ * @remarks `ink` is the word of its token `--viz-map-unmet-ink`, not a marker's `textColor`. */
70
+ function UnmetPlate({ unmet, x, y, fill = "var(--viz-map-unmet)", ink = "var(--viz-map-unmet-ink)", border = "var(--tf-color-background)" }) {
71
+ const width = 12 + (unmet.length - 1) * UNMET_GLYPH_STEP;
72
+ return /* @__PURE__ */ jsxs("svg", {
73
+ "data-slot": "map-marker-unmet",
74
+ x,
75
+ y,
76
+ width,
77
+ height: 12,
78
+ viewBox: `0 0 ${width} 12`,
79
+ "aria-hidden": "true",
80
+ children: [/* @__PURE__ */ jsx("rect", {
81
+ x: "0.5",
82
+ y: "0.5",
83
+ width: width - 1,
84
+ height: 11,
85
+ rx: "2",
86
+ fill,
87
+ stroke: border
88
+ }), unmet.map((requirement, index) => /* @__PURE__ */ jsx(StruckGlyph, {
89
+ icon: requirement.icon,
90
+ x: 2 + index * UNMET_GLYPH_STEP,
91
+ ink,
92
+ halo: fill
93
+ }, requirement.key))]
94
+ });
95
+ }
96
+ const SHIFT_LOCATION_GLYPHS = {
97
+ startLocation: "M6 11 L11 6.5 L16 11 L16 16 L12.6 16 L12.6 12.6 L9.4 12.6 L9.4 16 L6 16 Z",
98
+ endLocation: "M7 5.5 H8.4 V16.5 H7 Z M8.4 6 H15.5 L13.6 8.6 L15.5 11.2 H8.4 Z"
99
+ };
100
+ /** The SVG glyph of one marker kind; the map's GL layer draws it with resolved colours, a DOM marker with CSS ones. */
101
+ function MarkerGlyph({ kind, sequence, fill = "currentColor", textColor = "var(--tf-neutral-000)", halo = "var(--tf-neutral-000)" }) {
102
+ switch (kind) {
103
+ case "startLocation":
104
+ case "endLocation": return /* @__PURE__ */ jsxs("svg", {
105
+ viewBox: "0 0 22 22",
106
+ width: "22",
107
+ height: "22",
108
+ "aria-hidden": "true",
109
+ children: [/* @__PURE__ */ jsx("rect", {
110
+ x: "1",
111
+ y: "1",
112
+ width: "20",
113
+ height: "20",
114
+ rx: "5",
115
+ fill,
116
+ stroke: halo,
117
+ strokeWidth: "2"
118
+ }), /* @__PURE__ */ jsx("path", {
119
+ d: SHIFT_LOCATION_GLYPHS[kind],
120
+ fill: textColor
121
+ })]
122
+ });
123
+ case "break": return /* @__PURE__ */ jsxs("svg", {
124
+ viewBox: "0 0 22 22",
125
+ width: "20",
126
+ height: "20",
127
+ "aria-hidden": "true",
128
+ children: [/* @__PURE__ */ jsx("circle", {
129
+ cx: "11",
130
+ cy: "11",
131
+ r: "9",
132
+ fill,
133
+ stroke: halo,
134
+ strokeWidth: "2"
135
+ }), /* @__PURE__ */ jsx(TbCoffee, {
136
+ x: "5",
137
+ y: "5",
138
+ size: "12",
139
+ color: textColor
140
+ })]
141
+ });
142
+ case "unassigned": return /* @__PURE__ */ jsxs("svg", {
143
+ viewBox: "0 0 22 22",
144
+ width: "22",
145
+ height: "22",
146
+ "aria-hidden": "true",
147
+ children: [/* @__PURE__ */ jsx("path", {
148
+ d: "M11 1.5 L20.5 11 L11 20.5 L1.5 11 Z",
149
+ fill,
150
+ stroke: halo,
151
+ strokeWidth: "1.5",
152
+ strokeLinejoin: "round"
153
+ }), /* @__PURE__ */ jsx(TbTruckOff, {
154
+ x: "5.5",
155
+ y: "5.5",
156
+ size: "11",
157
+ color: textColor
158
+ })]
159
+ });
160
+ case "bead": return /* @__PURE__ */ jsxs("svg", {
161
+ viewBox: "0 0 14 14",
162
+ width: "14",
163
+ height: "14",
164
+ "aria-hidden": "true",
165
+ children: [/* @__PURE__ */ jsx("circle", {
166
+ cx: "7",
167
+ cy: "7",
168
+ r: "6.25",
169
+ fill: halo
170
+ }), /* @__PURE__ */ jsx("circle", {
171
+ cx: "7",
172
+ cy: "7",
173
+ r: "4.25",
174
+ fill: halo,
175
+ stroke: fill,
176
+ strokeWidth: "2.5"
177
+ })]
178
+ });
179
+ case "point": return /* @__PURE__ */ jsx("svg", {
180
+ viewBox: "0 0 22 22",
181
+ width: "16",
182
+ height: "16",
183
+ "aria-hidden": "true",
184
+ children: /* @__PURE__ */ jsx("circle", {
185
+ cx: "11",
186
+ cy: "11",
187
+ r: "6",
188
+ fill,
189
+ stroke: halo,
190
+ strokeWidth: "2"
191
+ })
192
+ });
193
+ default: {
194
+ const text = sequence === void 0 ? void 0 : String(sequence);
195
+ const width = stopPillViewBoxWidth(sequence);
196
+ return /* @__PURE__ */ jsxs("svg", {
197
+ viewBox: `0 0 ${width} 24`,
198
+ width: width * 22 / 24,
199
+ height: "22",
200
+ "aria-hidden": "true",
201
+ children: [/* @__PURE__ */ jsx("rect", {
202
+ x: "2",
203
+ y: "2",
204
+ width: width - 4,
205
+ height: "20",
206
+ rx: "10",
207
+ fill,
208
+ stroke: halo,
209
+ strokeWidth: "2.2"
210
+ }), text !== void 0 && /* @__PURE__ */ jsx("text", {
211
+ x: width / 2,
212
+ y: "15.6",
213
+ textAnchor: "middle",
214
+ fontSize: "11",
215
+ fontWeight: "600",
216
+ fill: textColor,
217
+ children: text
218
+ })]
219
+ });
220
+ }
221
+ }
222
+ }
223
+ function UnreachableOverlay() {
224
+ const $ = c(1);
225
+ let t0;
226
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
227
+ t0 = /* @__PURE__ */ jsx("span", {
228
+ "data-slot": "map-marker-unreachable",
229
+ "aria-hidden": "true",
230
+ className: "absolute -top-1 -right-1 flex items-center justify-center rounded-[2px] border border-[var(--tf-color-background)] bg-[var(--viz-map-unreachable)] p-[1.5px]",
231
+ children: /* @__PURE__ */ jsx(TbMapPinOff, { className: "block size-[7px] text-[var(--tf-color-background)]" })
232
+ });
233
+ $[0] = t0;
234
+ } else t0 = $[0];
235
+ return t0;
236
+ }
237
+ /**
238
+ * The visual content of a single map marker, coloured via `currentColor`. Presentational
239
+ * only (`aria-hidden`); the `<button>` MapView wraps it in is the interactive element.
240
+ */
241
+ function MapMarker({ marker, selected = false, dimmed = false }) {
242
+ const kind = marker.kind ?? "point";
243
+ return /* @__PURE__ */ jsxs("span", {
244
+ "data-slot": "map-marker",
245
+ "data-kind": kind,
246
+ "data-state": selected ? "selected" : void 0,
247
+ "data-dimmed": dimmed ? "" : void 0,
248
+ className: "relative block cursor-pointer leading-[0] text-(--viz-map-marker-color) transition-opacity duration-150 data-dimmed:opacity-30 data-[state=selected]:scale-115 data-[state=selected]:drop-shadow-[0_0_0_var(--tf-color-ring)]",
249
+ style: { "--viz-map-marker-color": marker.color },
250
+ "aria-hidden": "true",
251
+ children: [
252
+ marker.content ?? /* @__PURE__ */ jsx(MarkerGlyph, {
253
+ kind,
254
+ sequence: marker.sequence,
255
+ textColor: marker.textColor
256
+ }),
257
+ marker.unreachable && /* @__PURE__ */ jsx(UnreachableOverlay, {}),
258
+ marker.unmet && marker.unmet.length > 0 && /* @__PURE__ */ jsx("span", {
259
+ className: "absolute -bottom-1 -left-1 leading-[0]",
260
+ children: /* @__PURE__ */ jsx(UnmetPlate, { unmet: marker.unmet })
261
+ })
262
+ ]
263
+ });
264
+ }
265
+ export { MarkerGlyph, UNMET_PLATE_SIZE, UnmetPlate, MapMarker as default };
@@ -0,0 +1,19 @@
1
+ import { MapHighlight } from "./highlight.mjs";
2
+ import { MapSite } from "./map-sites.mjs";
3
+ import { MarkerIconPalette } from "./marker-icon.mjs";
4
+ import { MapMarkerData } from "./types.mjs";
5
+ export declare const STOP_DOT_LAYER_ID = "stops-dot";
6
+ export declare const STOP_GLYPH_LAYER_ID = "stops-glyph";
7
+ /** A marker drawn in the stop layers, whose colour and text colour the map has already defaulted. */
8
+ export type StopMarker = MapMarkerData & {
9
+ color: string;
10
+ textColor: string;
11
+ };
12
+ /** Every stop of the map as GL layers: a dot in its colour at every zoom, and its glyph wherever it has room. */
13
+ export default function MapStops({ sites, colors, palette, highlight, onShown }: {
14
+ sites: readonly MapSite<StopMarker>[];
15
+ colors: Readonly<Record<string, string>>;
16
+ palette: MarkerIconPalette;
17
+ highlight: MapHighlight;
18
+ onShown?: () => void;
19
+ }): import("react").JSX.Element;
@@ -0,0 +1,355 @@
1
+ "use client";
2
+ import { forEachChunk } from "./for-each-chunk.mjs";
3
+ import { stopEmphasis } from "./highlight.mjs";
4
+ import { markerIconKey, markerIconMarkup, rasteriseIcon } from "./marker-icon.mjs";
5
+ import { c } from "react/compiler-runtime";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useEffect, useRef } from "react";
8
+ import { Layer, Source, useMap } from "react-map-gl/maplibre";
9
+ // src/map/MapStops.tsx
10
+ const STOP_DOT_LAYER_ID = "stops-dot";
11
+ const STOP_GLYPH_LAYER_ID = "stops-glyph";
12
+ const STOPS_SOURCE_ID = "stops";
13
+ const EMPTY_IMAGE = {
14
+ width: 1,
15
+ height: 1,
16
+ data: /* @__PURE__ */ new Uint8Array(4)
17
+ };
18
+ const ICONS_PER_TASK = 32;
19
+ function dotLayer(highlight, halo) {
20
+ const opacity = stopEmphasis(highlight);
21
+ return {
22
+ id: STOP_DOT_LAYER_ID,
23
+ type: "circle",
24
+ paint: {
25
+ "circle-color": ["get", "fill"],
26
+ "circle-radius": [
27
+ "interpolate",
28
+ ["linear"],
29
+ ["zoom"],
30
+ 5,
31
+ 2,
32
+ 10,
33
+ 3.5,
34
+ 13,
35
+ 5
36
+ ],
37
+ "circle-stroke-color": halo,
38
+ "circle-stroke-width": [
39
+ "interpolate",
40
+ ["linear"],
41
+ ["zoom"],
42
+ 5,
43
+ .5,
44
+ 12,
45
+ 1.5
46
+ ],
47
+ "circle-opacity": opacity,
48
+ "circle-stroke-opacity": opacity
49
+ }
50
+ };
51
+ }
52
+ function glyphLayer(highlight) {
53
+ return {
54
+ id: STOP_GLYPH_LAYER_ID,
55
+ type: "symbol",
56
+ layout: {
57
+ "icon-image": ["get", "icon"],
58
+ "icon-overlap": "always",
59
+ "symbol-sort-key": [
60
+ "-",
61
+ 0,
62
+ ["get", "rank"]
63
+ ]
64
+ },
65
+ paint: { "icon-opacity": stopEmphasis(highlight) }
66
+ };
67
+ }
68
+ function useIconImages(entries, palette) {
69
+ const $ = c(13);
70
+ const { current: mapRef } = useMap();
71
+ let t0;
72
+ if ($[0] !== entries || $[1] !== palette) {
73
+ t0 = {
74
+ entries,
75
+ palette
76
+ };
77
+ $[0] = entries;
78
+ $[1] = palette;
79
+ $[2] = t0;
80
+ } else t0 = $[2];
81
+ const latest = useRef(t0);
82
+ const drawer = useRef(null);
83
+ let t1;
84
+ let t2;
85
+ if ($[3] !== entries || $[4] !== palette) {
86
+ t1 = () => {
87
+ latest.current = {
88
+ entries,
89
+ palette
90
+ };
91
+ };
92
+ t2 = [entries, palette];
93
+ $[3] = entries;
94
+ $[4] = palette;
95
+ $[5] = t1;
96
+ $[6] = t2;
97
+ } else {
98
+ t1 = $[5];
99
+ t2 = $[6];
100
+ }
101
+ useEffect(t1, t2);
102
+ let t3;
103
+ let t4;
104
+ if ($[7] !== mapRef) {
105
+ t3 = () => {
106
+ const map = mapRef?.getMap();
107
+ if (!map) return;
108
+ const pending = /* @__PURE__ */ new Set();
109
+ const placeholders = /* @__PURE__ */ new Set();
110
+ const drawn = /* @__PURE__ */ new Set();
111
+ const failed = /* @__PURE__ */ new Set();
112
+ let scheduled = false;
113
+ let disposed = false;
114
+ const drawPending = async () => {
115
+ scheduled = false;
116
+ const { entries: current, palette: colours } = latest.current;
117
+ const drawable = [...pending].flatMap((id) => {
118
+ const entry = current.get(id);
119
+ return entry ? [{
120
+ id,
121
+ ...entry
122
+ }] : [];
123
+ });
124
+ pending.clear();
125
+ await forEachChunk(drawable, ICONS_PER_TASK, async (chunk) => {
126
+ const images = await Promise.allSettled(markerIconMarkup(chunk, colours).map(rasteriseIcon));
127
+ if (disposed || !map.style) return "stop";
128
+ addIcons(chunk, images);
129
+ });
130
+ };
131
+ const addIcons = (icons, images_0) => {
132
+ icons.forEach((t5, index) => {
133
+ const { id: id_0 } = t5;
134
+ const image = images_0[index];
135
+ placeholders.delete(id_0);
136
+ if (map.hasImage(id_0)) map.removeImage(id_0);
137
+ if (image?.status !== "fulfilled") {
138
+ failed.add(id_0);
139
+ console.error(`Could not draw the map icon "${id_0}"`, image?.reason);
140
+ return;
141
+ }
142
+ map.addImage(id_0, image.value, { pixelRatio: 2 });
143
+ drawn.add(id_0);
144
+ });
145
+ };
146
+ const request = (ids) => {
147
+ if (!map.style) return;
148
+ for (const id_1 of ids) {
149
+ if (!latest.current.entries.has(id_1) || failed.has(id_1) || pending.has(id_1) || map.hasImage(id_1)) continue;
150
+ map.addImage(id_1, EMPTY_IMAGE);
151
+ placeholders.add(id_1);
152
+ pending.add(id_1);
153
+ }
154
+ if (scheduled || pending.size === 0) return;
155
+ scheduled = true;
156
+ queueMicrotask(() => void drawPending());
157
+ };
158
+ const onImageMissing = (t6) => {
159
+ const { id: id_2 } = t6;
160
+ return request([id_2]);
161
+ };
162
+ const removeUnused = () => {
163
+ if (!map.style) return;
164
+ for (const id_3 of drawn) {
165
+ if (latest.current.entries.has(id_3)) continue;
166
+ drawn.delete(id_3);
167
+ if (map.hasImage(id_3)) map.removeImage(id_3);
168
+ }
169
+ };
170
+ drawer.current = { request };
171
+ map.on("styleimagemissing", onImageMissing);
172
+ map.on("idle", removeUnused);
173
+ return () => {
174
+ disposed = true;
175
+ drawer.current = null;
176
+ if (map.style) {
177
+ for (const id_4 of placeholders) if (map.hasImage(id_4)) map.removeImage(id_4);
178
+ }
179
+ map.off("styleimagemissing", onImageMissing);
180
+ map.off("idle", removeUnused);
181
+ };
182
+ };
183
+ t4 = [mapRef];
184
+ $[7] = mapRef;
185
+ $[8] = t3;
186
+ $[9] = t4;
187
+ } else {
188
+ t3 = $[8];
189
+ t4 = $[9];
190
+ }
191
+ useEffect(t3, t4);
192
+ let t5;
193
+ let t6;
194
+ if ($[10] !== entries) {
195
+ t5 = () => {
196
+ drawer.current?.request(entries.keys());
197
+ };
198
+ t6 = [entries];
199
+ $[10] = entries;
200
+ $[11] = t5;
201
+ $[12] = t6;
202
+ } else {
203
+ t5 = $[11];
204
+ t6 = $[12];
205
+ }
206
+ useEffect(t5, t6);
207
+ }
208
+ function stopFeatures(sites, colors, palette) {
209
+ const icons = /* @__PURE__ */ new Map();
210
+ return {
211
+ entries: icons,
212
+ features: {
213
+ type: "FeatureCollection",
214
+ features: sites.flatMap((site) => {
215
+ const fill = colors[site.marker.color];
216
+ const textColor = colors[site.marker.textColor];
217
+ if (!fill || !textColor) return [];
218
+ const icon = markerIconKey({
219
+ site,
220
+ fill,
221
+ textColor
222
+ }, palette);
223
+ icons.set(icon, {
224
+ site,
225
+ fill,
226
+ textColor
227
+ });
228
+ return [{
229
+ type: "Feature",
230
+ properties: {
231
+ siteKey: site.key,
232
+ markerId: site.marker.id,
233
+ group: site.marker.group ?? null,
234
+ fill,
235
+ muted: site.members.every((member) => member.muted === true),
236
+ icon,
237
+ rank: site.rank
238
+ },
239
+ geometry: {
240
+ type: "Point",
241
+ coordinates: site.marker.position
242
+ }
243
+ }];
244
+ })
245
+ }
246
+ };
247
+ }
248
+ function sameStops(shown, next) {
249
+ return shown !== null && shown.features.length === next.features.length && shown.features.every((feature, index) => {
250
+ const other = next.features[index];
251
+ return other !== void 0 && feature.properties.siteKey === other.properties.siteKey && feature.properties.icon === other.properties.icon && feature.properties.fill === other.properties.fill && feature.properties.muted === other.properties.muted && feature.properties.rank === other.properties.rank && feature.geometry.coordinates.join() === other.geometry.coordinates.join();
252
+ });
253
+ }
254
+ function useStopsShown(features, onShown) {
255
+ const $ = c(5);
256
+ const { current: mapRef } = useMap();
257
+ const shownFeatures = useRef(null);
258
+ let t0;
259
+ let t1;
260
+ if ($[0] !== features || $[1] !== mapRef || $[2] !== onShown) {
261
+ t0 = () => {
262
+ const map = mapRef?.getMap();
263
+ if (!map || !onShown || features.features.length === 0) return;
264
+ const report = () => {
265
+ shownFeatures.current = features;
266
+ onShown();
267
+ };
268
+ const afterNextFrame = () => {
269
+ map.once("render", report);
270
+ map.triggerRepaint();
271
+ };
272
+ const whenLoaded = (event) => {
273
+ if (event.sourceId !== STOPS_SOURCE_ID || !event.isSourceLoaded) return;
274
+ map.off("sourcedata", whenLoaded);
275
+ afterNextFrame();
276
+ };
277
+ if (sameStops(shownFeatures.current, features)) afterNextFrame();
278
+ else map.on("sourcedata", whenLoaded);
279
+ return () => {
280
+ map.off("sourcedata", whenLoaded);
281
+ map.off("render", report);
282
+ };
283
+ };
284
+ t1 = [
285
+ mapRef,
286
+ features,
287
+ onShown
288
+ ];
289
+ $[0] = features;
290
+ $[1] = mapRef;
291
+ $[2] = onShown;
292
+ $[3] = t0;
293
+ $[4] = t1;
294
+ } else {
295
+ t0 = $[3];
296
+ t1 = $[4];
297
+ }
298
+ useEffect(t0, t1);
299
+ }
300
+ /** Every stop of the map as GL layers: a dot in its colour at every zoom, and its glyph wherever it has room. */
301
+ function MapStops(t0) {
302
+ const $ = c(17);
303
+ const { sites, colors, palette, highlight, onShown } = t0;
304
+ let t1;
305
+ if ($[0] !== colors || $[1] !== palette || $[2] !== sites) {
306
+ t1 = stopFeatures(sites, colors, palette);
307
+ $[0] = colors;
308
+ $[1] = palette;
309
+ $[2] = sites;
310
+ $[3] = t1;
311
+ } else t1 = $[3];
312
+ const { entries, features } = t1;
313
+ useIconImages(entries, palette);
314
+ useStopsShown(features, onShown);
315
+ let t2;
316
+ if ($[4] !== highlight || $[5] !== palette.halo) {
317
+ t2 = dotLayer(highlight, palette.halo);
318
+ $[4] = highlight;
319
+ $[5] = palette.halo;
320
+ $[6] = t2;
321
+ } else t2 = $[6];
322
+ let t3;
323
+ if ($[7] !== t2) {
324
+ t3 = /* @__PURE__ */ jsx(Layer, { ...t2 });
325
+ $[7] = t2;
326
+ $[8] = t3;
327
+ } else t3 = $[8];
328
+ let t4;
329
+ if ($[9] !== highlight) {
330
+ t4 = glyphLayer(highlight);
331
+ $[9] = highlight;
332
+ $[10] = t4;
333
+ } else t4 = $[10];
334
+ let t5;
335
+ if ($[11] !== t4) {
336
+ t5 = /* @__PURE__ */ jsx(Layer, { ...t4 });
337
+ $[11] = t4;
338
+ $[12] = t5;
339
+ } else t5 = $[12];
340
+ let t6;
341
+ if ($[13] !== features || $[14] !== t3 || $[15] !== t5) {
342
+ t6 = /* @__PURE__ */ jsxs(Source, {
343
+ id: STOPS_SOURCE_ID,
344
+ type: "geojson",
345
+ data: features,
346
+ children: [t3, t5]
347
+ });
348
+ $[13] = features;
349
+ $[14] = t3;
350
+ $[15] = t5;
351
+ $[16] = t6;
352
+ } else t6 = $[16];
353
+ return t6;
354
+ }
355
+ export { STOP_DOT_LAYER_ID, STOP_GLYPH_LAYER_ID, MapStops as default };
@@ -0,0 +1,24 @@
1
+ .maplibregl-popup.viz-map-popup {
2
+ z-index: 7;
3
+ }
4
+
5
+ .maplibregl-popup.viz-map-popup .maplibregl-popup-content {
6
+ box-shadow: none;
7
+ background: none;
8
+ border: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ .maplibregl-popup.viz-map-popup .maplibregl-popup-tip {
13
+ display: none;
14
+ }
15
+
16
+ .maplibregl-map:has( > .maplibregl-popup.viz-map-popup) {
17
+ overflow: visible;
18
+ }
19
+
20
+ .maplibregl-map:has( > .maplibregl-popup.viz-map-popup) > .maplibregl-canvas-container {
21
+ position: absolute;
22
+ inset: 0;
23
+ overflow: hidden;
24
+ }
@@ -0,0 +1,11 @@
1
+ import { MapMarkerData, MapViewProps } from "./types.mjs";
2
+ /**
3
+ * A generic, model-agnostic map: stops and routes as GL layers, with popups, auto fit-bounds, a progress chip and an
4
+ * always-present accessible table whose rows are the keyboard path to each stop. A `content` marker stays in the DOM.
5
+ *
6
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/table/
7
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
8
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
9
+ * @category Map
10
+ */
11
+ export default function MapView<TMarker extends MapMarkerData>({ markers, routes, areas, areaLayers: areaLayerRows, mapStyle, fitKey, refitKey, onUserMove, onMarkersShown, renderPopover, selectedMarkerId, onSelectedMarkerIdChange, highlightedGroup, onHighlightedGroupChange, lockedGroup, onLockedGroupChange, accessibleTable, progressLabel, className, style, ref }: MapViewProps<TMarker>): import("react").JSX.Element;