@m3ui-vue/m3ui-vue 1.0.2 → 1.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 (157) hide show
  1. package/dist/API.md +666 -12
  2. package/dist/MMenuItem-BOkcVtEe.js +809 -0
  3. package/dist/MMenuItem-BOkcVtEe.js.map +1 -0
  4. package/dist/MSlider-BXsBv0ox.js +1402 -0
  5. package/dist/MSlider-BXsBv0ox.js.map +1 -0
  6. package/dist/MTextField-rML9jnXs.js +671 -0
  7. package/dist/MTextField-rML9jnXs.js.map +1 -0
  8. package/dist/api.json +1 -1
  9. package/dist/code-editor.js +1 -1
  10. package/dist/components/MBottomSheet.vue.d.ts +20 -1
  11. package/dist/components/MDialog.vue.d.ts +17 -8
  12. package/dist/components/MDragDropList.vue.d.ts +1 -1
  13. package/dist/components/MIconButton.vue.d.ts +1 -1
  14. package/dist/components/MMap.vue.d.ts +74 -0
  15. package/dist/components/MMapBaseLayers.vue.d.ts +15 -0
  16. package/dist/components/MMapControl.vue.d.ts +40 -0
  17. package/dist/components/MMapFeatureInfo.vue.d.ts +25 -0
  18. package/dist/components/MMapFilter.vue.d.ts +19 -0
  19. package/dist/components/MMapGeoJson.vue.d.ts +34 -0
  20. package/dist/components/MMapHover.vue.d.ts +17 -0
  21. package/dist/components/MMapIdentify.vue.d.ts +37 -0
  22. package/dist/components/MMapLayers.vue.d.ts +31 -0
  23. package/dist/components/MMapMarker.vue.d.ts +45 -0
  24. package/dist/components/MMapMeasure.vue.d.ts +43 -0
  25. package/dist/components/MMapPopup.vue.d.ts +45 -0
  26. package/dist/components/MMapSearch.vue.d.ts +28 -0
  27. package/dist/components/MMenuItem.vue.d.ts +2 -2
  28. package/dist/components/MSeekBar.vue.d.ts +122 -0
  29. package/dist/components/MSplitButton.vue.d.ts +2 -2
  30. package/dist/components/_MMapAttribution.vue.d.ts +7 -0
  31. package/dist/components/_MMapLayerItem.vue.d.ts +25 -0
  32. package/dist/composables/_mapGeometry.d.ts +13 -0
  33. package/dist/composables/_mapPin.d.ts +5 -0
  34. package/dist/composables/_popupPosition.d.ts +12 -0
  35. package/dist/composables/_ssrState.d.ts +30 -0
  36. package/dist/composables/_storageKeys.d.ts +3 -0
  37. package/dist/composables/_useCalendarMonth.d.ts +24 -0
  38. package/dist/composables/_useEscapeStack.d.ts +3 -0
  39. package/dist/composables/_useScrollLock.d.ts +8 -0
  40. package/dist/composables/_useSheetMotion.d.ts +16 -1
  41. package/dist/composables/_useThemeTokens.d.ts +7 -0
  42. package/dist/composables/mapAdapters.d.ts +111 -0
  43. package/dist/composables/mapSearch.d.ts +31 -0
  44. package/dist/composables/themeInitScript.d.ts +4 -3
  45. package/dist/composables/useColorPalette.d.ts +173 -7
  46. package/dist/composables/useLocale.d.ts +38 -0
  47. package/dist/composables/useMap.d.ts +47 -0
  48. package/dist/composables/useMapFilter.d.ts +10 -0
  49. package/dist/composables/useMapLayers.d.ts +30 -0
  50. package/dist/composables/useTheme.d.ts +2 -1
  51. package/dist/index.d.ts +4 -1
  52. package/dist/locales/index.js +273 -7
  53. package/dist/locales/index.js.map +1 -1
  54. package/dist/m3ui-vue.css +1 -1
  55. package/dist/m3ui.js +7913 -8625
  56. package/dist/m3ui.js.map +1 -1
  57. package/dist/map.d.ts +24 -0
  58. package/dist/map.js +2067 -0
  59. package/dist/map.js.map +1 -0
  60. package/dist/plugin.d.ts +18 -2
  61. package/dist/rich-text-editor.js +26 -25
  62. package/dist/rich-text-editor.js.map +1 -1
  63. package/dist/styles.css +1 -1
  64. package/dist/{useLocale-CuvWRZ1h.js → useLocale-CqQrhWFl.js} +40 -2
  65. package/dist/useLocale-CqQrhWFl.js.map +1 -0
  66. package/package.json +11 -2
  67. package/src/__tests__/MDialog.test.ts +30 -0
  68. package/src/__tests__/MFab.test.ts +52 -6
  69. package/src/__tests__/MMap.test.ts +422 -0
  70. package/src/__tests__/MMapLayers.test.ts +257 -0
  71. package/src/__tests__/MMapTools.test.ts +233 -0
  72. package/src/__tests__/MSeekBar.test.ts +170 -0
  73. package/src/__tests__/MTooltip.test.ts +110 -0
  74. package/src/__tests__/_fakeMaplibre.ts +161 -0
  75. package/src/__tests__/calendarMonth.test.ts +59 -0
  76. package/src/__tests__/hydration.test.ts +33 -0
  77. package/src/__tests__/pickerModals.test.ts +128 -0
  78. package/src/__tests__/popupPosition.test.ts +224 -0
  79. package/src/__tests__/scrollLock.test.ts +110 -0
  80. package/src/__tests__/sheets.test.ts +158 -0
  81. package/src/__tests__/ssr.test.ts +63 -1
  82. package/src/__tests__/ssrState.test.ts +155 -0
  83. package/src/__tests__/themeInitScript.test.ts +18 -0
  84. package/src/components/MAutocomplete.vue +2 -4
  85. package/src/components/MBottomSheet.vue +211 -13
  86. package/src/components/MCommandPalette.vue +4 -6
  87. package/src/components/MContextMenu.vue +19 -5
  88. package/src/components/MDatePicker.vue +29 -70
  89. package/src/components/MDatePickerModal.vue +116 -172
  90. package/src/components/MDateRangePicker.vue +29 -51
  91. package/src/components/MDateRangePickerModal.vue +84 -162
  92. package/src/components/MDialog.vue +87 -63
  93. package/src/components/MFab.vue +29 -7
  94. package/src/components/MIconButton.vue +1 -1
  95. package/src/components/MLightbox.vue +12 -5
  96. package/src/components/MMap.vue +568 -0
  97. package/src/components/MMapBaseLayers.vue +67 -0
  98. package/src/components/MMapControl.vue +175 -0
  99. package/src/components/MMapFeatureInfo.vue +41 -0
  100. package/src/components/MMapFilter.vue +80 -0
  101. package/src/components/MMapGeoJson.vue +136 -0
  102. package/src/components/MMapHover.vue +131 -0
  103. package/src/components/MMapIdentify.vue +104 -0
  104. package/src/components/MMapLayers.vue +111 -0
  105. package/src/components/MMapMarker.vue +109 -0
  106. package/src/components/MMapMeasure.vue +452 -0
  107. package/src/components/MMapPopup.vue +103 -0
  108. package/src/components/MMapSearch.vue +162 -0
  109. package/src/components/MMenu.vue +31 -12
  110. package/src/components/MMenuItem.vue +21 -4
  111. package/src/components/MMultiAutocomplete.vue +2 -4
  112. package/src/components/MMultiSelect.vue +2 -4
  113. package/src/components/MNavigationDrawer.vue +2 -8
  114. package/src/components/MNavigationRail.vue +2 -3
  115. package/src/components/MSearchBar.vue +2 -5
  116. package/src/components/MSeekBar.vue +593 -0
  117. package/src/components/MSelect.vue +2 -8
  118. package/src/components/MSplitButton.vue +23 -7
  119. package/src/components/MSpotlightSearch.vue +4 -6
  120. package/src/components/MTimePicker.vue +23 -6
  121. package/src/components/MTimePickerModal.vue +213 -226
  122. package/src/components/MTooltip.vue +99 -3
  123. package/src/components/_MMapAttribution.vue +81 -0
  124. package/src/components/_MMapLayerItem.vue +77 -0
  125. package/src/composables/_mapGeometry.ts +75 -0
  126. package/src/composables/_mapPin.ts +25 -0
  127. package/src/composables/_popupPosition.ts +39 -0
  128. package/src/composables/_ssrState.ts +80 -0
  129. package/src/composables/_storageKeys.ts +6 -0
  130. package/src/composables/_useCalendarMonth.ts +74 -0
  131. package/src/composables/_useEscapeStack.ts +33 -0
  132. package/src/composables/_useScrollLock.ts +41 -0
  133. package/src/composables/_useSheetMotion.ts +82 -20
  134. package/src/composables/_useThemeTokens.ts +42 -0
  135. package/src/composables/mapAdapters.ts +208 -0
  136. package/src/composables/mapSearch.ts +56 -0
  137. package/src/composables/themeInitScript.ts +6 -4
  138. package/src/composables/useColorPalette.ts +23 -9
  139. package/src/composables/useLocale.ts +78 -0
  140. package/src/composables/useMap.ts +98 -0
  141. package/src/composables/useMapFilter.ts +45 -0
  142. package/src/composables/useMapLayers.ts +124 -0
  143. package/src/composables/useTheme.ts +8 -3
  144. package/src/composables/useWindowSizeClass.ts +14 -5
  145. package/src/index.ts +4 -1
  146. package/src/locales/de.ts +39 -1
  147. package/src/locales/es.ts +39 -1
  148. package/src/locales/fr.ts +39 -1
  149. package/src/locales/ja.ts +39 -1
  150. package/src/locales/ko.ts +39 -1
  151. package/src/locales/pt.ts +39 -1
  152. package/src/locales/zh.ts +39 -1
  153. package/src/map.ts +32 -0
  154. package/src/plugin.ts +54 -3
  155. package/dist/MTextField-BPbFeI9M.js +0 -1368
  156. package/dist/MTextField-BPbFeI9M.js.map +0 -1
  157. package/dist/useLocale-CuvWRZ1h.js.map +0 -1
package/dist/API.md CHANGED
@@ -1,4 +1,4 @@
1
- # @m3ui-vue/m3ui-vue 1.0.2 — API reference
1
+ # @m3ui-vue/m3ui-vue 1.1.0 — API reference
2
2
 
3
3
  Material Design 3 components for Vue 3 + Tailwind CSS v4. Generated from the source by
4
4
  `scripts/generate-api.mjs`; full docs with live demos at https://m3ui.dev.
@@ -24,7 +24,7 @@ app.use(createM3UI({ palette: 'blue', locale: esLocale }))
24
24
  - Icons use the Material Symbols Outlined font (load it yourself, e.g. from Google Fonts); `icon` props take a
25
25
  Material Symbols name such as `'home'`.
26
26
  - Import components by name: `import { MButton, MDialog } from '@m3ui-vue/m3ui-vue'`. Components with heavy optional peer
27
- dependencies live in their own entry points (noted on each one): `@m3ui-vue/m3ui-vue/chart`, `@m3ui-vue/m3ui-vue/code-editor`, `@m3ui-vue/m3ui-vue/markdown`, `@m3ui-vue/m3ui-vue/rich-text-editor`, `@m3ui-vue/m3ui-vue/terminal`, `@m3ui-vue/m3ui-vue/qrcode`, `@m3ui-vue/m3ui-vue/barcode`.
27
+ dependencies live in their own entry points (noted on each one): `@m3ui-vue/m3ui-vue/chart`, `@m3ui-vue/m3ui-vue/code-editor`, `@m3ui-vue/m3ui-vue/markdown`, `@m3ui-vue/m3ui-vue/rich-text-editor`, `@m3ui-vue/m3ui-vue/terminal`, `@m3ui-vue/m3ui-vue/qrcode`, `@m3ui-vue/m3ui-vue/barcode`, `@m3ui-vue/m3ui-vue/map`.
28
28
  - Dark mode is the `dark` class on `<html>` (`useTheme()` manages it); palettes are `data-palette="<id>"` on `<html>`
29
29
  (`useColorPalette()`, or a scheme generated from any color with `setSeed()` / `createM3UI({ seed })`); contrast levels
30
30
  are `data-contrast="medium|high"` (`setContrast()` / `createM3UI({ contrast })`, needs the `palettes-contrast` import).
@@ -273,15 +273,20 @@ Slots:
273
273
 
274
274
  ### MBottomSheet
275
275
 
276
- A sheet that slides up from the bottom of the screen, capped at a 640px max width and rounded top corners. Supports drag-to-dismiss via the handle bar, or tapping the scrim.
276
+ A sheet that slides up from the bottom of the screen, capped at a 640px max width and rounded top corners. Supports drag-to-dismiss via the handle bar, or tapping the scrim. With `partial`, a sheet taller than that share of the screen opens partially expanded and is dragged (handle or content) up to its full height, after Compose's ModalBottomSheet.
277
277
 
278
278
  Props:
279
279
  - `modelValue: boolean` (v-model) — Open/closed state (v-model)
280
280
  - `title?: string` — Sheet header title
281
- - `fullHeight?: boolean = false` — Use max-h-[92vh] instead of the default max-h-[60vh]
281
+ - `maxHeight?: string` — Tallest the sheet gets, as a CSS length (`'480px'`, `'70dvh'`); past it the content scrolls. Default 60vh, or the whole screen with `partial`
282
+ - `fullHeight?: boolean = false`
283
+ - `partial?: number | boolean = false` — Opens a sheet taller than this share of the screen partially expanded (`true` = half, or a ratio like 0.4); dragging the handle or the content up expands it fully
284
+ - `expanded?: boolean = false` (v-model:expanded) — Fully (true) or partially (false) expanded, with `partial` (v-model:expanded)
285
+ - `squareCornersWhenFull?: boolean = false` — Squares the top corners while the expanded sheet fills the screen, as Android's views sheet does
282
286
 
283
287
  Events:
284
288
  - `update:modelValue(boolean)` — Emitted when the sheet closes (scrim click, drag-to-dismiss, or the close button) — powers v-model
289
+ - `update:expanded(boolean)` — Emitted when the sheet moves between partially and fully expanded (or closes) — powers v-model:expanded
285
290
 
286
291
  Slots:
287
292
  - `#default` — Sheet body content (scrollable)
@@ -923,14 +928,15 @@ Props:
923
928
  - `fullscreen?: boolean = false` — Full-screen variant — slides up from the bottom, covers the entire viewport
924
929
  - `closeLabel?: string` — Aria label for the close (X) button — falls back to the locale string when omitted
925
930
  - `closable?: boolean = true` — Show the header close (X) button — a library addition, not part of the M3 AlertDialog spec, so it can be turned off
931
+ - `bare?: boolean = false` — Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves (the date and time pickers). `title` then only names it for assistive technology
926
932
 
927
933
  Events:
928
934
  - `update:modelValue(boolean)` — Emitted when the dialog should open/close — powers v-model
929
935
 
930
936
  Slots:
937
+ - `#default` — Dialog body content — scrolls independently when taller than maxHeight. With `bare`, the whole dialog: it fills the box (no title, padding, close button or actions row)
931
938
  - `#icon` — M3 AlertDialog's optional icon (Secondary color, 24dp expected). Its presence also centers the title, per spec.
932
939
  - `#title` — Overrides the title prop with custom markup
933
- - `#default` — Dialog body content — scrolls independently when taller than maxHeight
934
940
  - `#actions` — Row of action buttons — wraps to a new line instead of overflowing when labels are long
935
941
 
936
942
  ### MDivider
@@ -1281,7 +1287,7 @@ A button that shows only an icon — four visual styles, the same 5-tier express
1281
1287
 
1282
1288
  Props:
1283
1289
  - `icon: string` — Material Symbol icon name
1284
- - `label?: string` — Accessible label (aria-label and title)
1290
+ - `label?: string` — Accessible label (its aria-label; no visible tooltip: wrap it in MTooltip for one)
1285
1291
  - `variant?: "filled" | "outlined" | "tonal" | "standard" = "standard"` — Visual style
1286
1292
  - `shape?: "rounded" | "squared" = "rounded"` — Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md, 28px lg/xl)
1287
1293
  - `size?: number | "xs" | "sm" | "md" | "lg" | "xl" = "sm"` — M3's 5-tier icon button sizing (xs:32, sm:40, md:56, lg:96, xl:136), or a custom pixel value
@@ -1557,6 +1563,265 @@ Slots:
1557
1563
  - `#default` — Extra content shown below the spinner/text, in either mode
1558
1564
  - `#content` — The content the overlay is layered on top of (only used when fullscreen is false)
1559
1565
 
1566
+ ### MMap
1567
+
1568
+ Import from `@m3ui-vue/m3ui-vue/map`.
1569
+
1570
+ A MapLibre GL map, for any style: a style URL (from an MVT server like mvt-rs, MapTiler, OpenFreeMap…) or a style object. Its controls take the M3 look and the app's locale, the view can be a v-model and remembered between visits, and markers, popups, GeoJSON layers and your own controls go inside it as components. For anything else, the MapLibre map itself is the `ready` event's argument and the `map` of `useMap()` in components placed inside. Available from the `/map` entry point; needs `maplibre-gl` installed and its CSS imported (`maplibre-gl/dist/maplibre-gl.css`). Give it a height. Server-side rendering renders the empty container: MapLibre loads in the browser.
1571
+
1572
+ Props:
1573
+ - `mapStyle: string | maplibregl.StyleSpecification` — The map's style: a style JSON URL or a style object (MapLibre's `StyleSpecification`). Changing it reloads the style
1574
+ - `center?: [number, number]` (v-model:center) — `[lng, lat]` (v-model). When left out, the style's (or the remembered view's)
1575
+ - `zoom?: number` (v-model:zoom) — Zoom level (v-model)
1576
+ - `bearing?: number` (v-model:bearing) — Rotation in degrees (v-model)
1577
+ - `pitch?: number` (v-model:pitch) — Tilt in degrees (v-model)
1578
+ - `persist?: string | boolean = false` — Remember the view (center, zoom, bearing, pitch) in localStorage and start from it on the next visit: `true` under `m3-map-view`, or your own key (one per map)
1579
+ - `navigation?: boolean | MapControlPosition = true` — Zoom and compass buttons: `false`, or a corner (`true` is top-right)
1580
+ - `geolocate?: boolean | MapControlPosition = false` — A button that centers the map on the user's location and follows it: `false`, or a corner (`true` is top-right)
1581
+ - `fullscreen?: boolean | MapControlPosition = false` — A fullscreen button: `false`, or a corner (`true` is top-right)
1582
+ - `scale?: boolean | MapControlPosition = true` — A metric scale bar: `false`, or a corner (`true` is bottom-left)
1583
+ - `attribution?: boolean | MapControlPosition = true` — The credits of the style's sources, an info button that opens into a pill: `false`, or a corner (`true` is bottom-right). Most tile providers require it
1584
+ - `options?: Partial<Omit<maplibregl.MapOptions, "container" | "style">>` — Anything else for MapLibre's `Map` constructor (`maxZoom`, `maxBounds`, `cooperativeGestures`…)
1585
+ - `adapter?: MapAdapter` — Reads the style's conventions (layer names, groups, base layers, what to identify or show on hover) for `MMapLayers`, `MMapBaseLayers`, `MMapIdentify` and `MMapHover`: `genericAdapter`, `orvianAdapter()`, or your own
1586
+
1587
+ Events:
1588
+ - `click(event: maplibregl.MapMouseEvent)` — A click on the map (MapLibre's `MapMouseEvent`: `lngLat`, `point`)
1589
+ - `ready(map: maplibregl.Map)` — The map loaded (with its style), with the MapLibre `Map`
1590
+ - `update:center(center: [number, number])` — The view moved (on `moveend`): `[lng, lat]`
1591
+ - `update:zoom(zoom: number)` — The zoom changed (on `moveend`)
1592
+ - `update:bearing(bearing: number)` — The rotation changed (on `moveend`)
1593
+ - `update:pitch(pitch: number)` — The tilt changed (on `moveend`)
1594
+
1595
+ Slots:
1596
+ - `#default` — Map components (`MMapMarker`, `MMapPopup`, `MMapGeoJson`, `MMapControl`) and anything to show over the map, rendered once the map exists
1597
+
1598
+ Exposed (template ref):
1599
+ - `map: maplibregl.Map | undefined` — The MapLibre map, once loaded
1600
+
1601
+ ```ts
1602
+ export type MapControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
1603
+ ```
1604
+
1605
+ ### MMapBaseLayers
1606
+
1607
+ Import from `@m3ui-vue/m3ui-vue/map`.
1608
+
1609
+ The base layer switcher of an `MMap` with an `adapter`: a round thumbnail per base layer (the adapter's `image`, after `imageBase`), one shown at a time, plus "no base layer". Only the thumbnails: put them in an `MMapControl` (`:group="false"`), an `MFab`'s `#content` or a panel. Available from the `/map` entry point.
1610
+
1611
+ Props:
1612
+ - `imageBase?: string = ""` — Prefix for the thumbnails' paths (e.g. `/images/`); full URLs are used as they are
1613
+ - `none?: boolean = true` — Offer "no base layer"
1614
+ - `vertical?: boolean = false` — Lay them out in a column
1615
+
1616
+ ### MMapControl
1617
+
1618
+ Import from `@m3ui-vue/m3ui-vue/map`.
1619
+
1620
+ Your own control in a corner of an `MMap`, stacked with MapLibre's (zoom, geolocate…) in that corner. With `group` (the default) it's a control group like the zoom buttons: put `<button>`s with a Material Symbols icon in it and they get the same M3 look. Without it, anything goes (an `MFab`, an `MSearchBar`, a card). With a `#panel` slot it expands in place: a button in it calls `toggle` and the control grows into a panel with your content (a layer picker, filters, a legend), and back. Its size springs whenever its content changes size, so the other controls in the corner move along instead of jumping. Available from the `/map` entry point.
1621
+
1622
+ Props:
1623
+ - `position?: MapControlPosition = "top-right"` — The corner
1624
+ - `group?: boolean = true` — Draw it as a control group (a surface with dividers between buttons), like MapLibre's zoom buttons
1625
+ - `expanded?: boolean = false` (v-model:expanded) — Expanded into its `#panel` (v-model:expanded)
1626
+ - `animate?: boolean = true` — Springs the control's size when its content changes size (expanding, or anything else)
1627
+
1628
+ Events:
1629
+ - `update:expanded(boolean)` — Emitted when the panel opens or closes — powers v-model:expanded
1630
+
1631
+ Slots:
1632
+ - `#panel { close: () => void; }` — What the control expands into (`v-model:expanded`); `{ close }`. Escape or a press outside it closes it
1633
+ - `#default { expanded: boolean; toggle: () => void; }` — The control's content; `{ expanded, toggle }` when it has a `#panel`
1634
+
1635
+ ### MMapFeatureInfo
1636
+
1637
+ Import from `@m3ui-vue/m3ui-vue/map`.
1638
+
1639
+ Identify results (from `MMapIdentify`'s `identify` event, or `identifyFeatures()`): a card per feature with its layer's name and its formatted properties. `MMapIdentify` shows it in a popup; use it in a panel of your own (an `MWindow`, an `MSideSheet`) the same way. Values are shown as text. Available from the `/map` entry point.
1640
+
1641
+ Props:
1642
+ - `results: MapIdentifyResult[]` — What was found
1643
+
1644
+ Slots:
1645
+ - `#value { field: { key: string; label: string; value: string; }; result: MapIdentifyResult; }` — A property's value (scope: `{ field, result }`), e.g. to turn URLs into links
1646
+
1647
+ ### MMapFilter
1648
+
1649
+ Import from `@m3ui-vue/m3ui-vue/map`.
1650
+
1651
+ A simple filter for one layer of an `MMap`: chips for the values of one of its properties; the layer shows only the features with the selected ones (all of them with none selected). The values are `values`, or else the distinct ones among the layer's features loaded in the map. The style's own filter on the layer stays. For anything more involved, build your own on `useMapFilter()`. Available from the `/map` entry point.
1652
+
1653
+ Props:
1654
+ - `layer: string` — The layer's id
1655
+ - `property: string` — The property to filter by
1656
+ - `values?: (string | number)[]` — The values to offer (labels in `labels`); by default the ones found in the layer's loaded features
1657
+ - `labels?: Record<string, string>` — Labels for the values, by value
1658
+ - `modelValue?: (string | number)[]` (v-model) — The selected values (v-model)
1659
+
1660
+ Events:
1661
+ - `update:modelValue(values: (string | number)[])`
1662
+
1663
+ ### MMapGeoJson
1664
+
1665
+ Import from `@m3ui-vue/m3ui-vue/map`.
1666
+
1667
+ GeoJSON on an `MMap`: a source from `data` (an object, or a URL MapLibre fetches) drawn with `layers`. Without `layers` it draws every geometry in the theme's primary, following palette and dark mode: polygons filled with an outline, lines, and points as circles. Replace `data` (a new object) to update it. It's added again after a style change. Available from the `/map` entry point.
1668
+
1669
+ Props:
1670
+ - `data: any` — A GeoJSON object, or the URL of one
1671
+ - `id?: string` — The source's id (and the prefix of its layers' made-up ids). Unique on the map; generated when left out
1672
+ - `layers?: MapGeoJsonLayer[]` — How to draw it: MapLibre layers without `source`. Defaults to theme-colored fill, outline, line and circle layers
1673
+ - `before?: string` — Insert the layers below this layer id (e.g. under the style's labels)
1674
+ - `interactive?: boolean = false` — Show a pointer over its features (set it when you handle `click`)
1675
+ - `sourceOptions?: Partial<Omit<maplibregl.GeoJSONSourceSpecification, "type" | "data">>` — More options for the GeoJSON source (`cluster`, `promoteId`, `tolerance`…)
1676
+
1677
+ Events:
1678
+ - `click(event: maplibregl.MapLayerMouseEvent)` — A click on one of its features (MapLibre's `MapLayerMouseEvent`: `e.features` holds them)
1679
+
1680
+ Exposed (template ref):
1681
+ - `sourceId: string` — The source's id
1682
+ - `layerIds: () => string[]` — The ids of its layers on the map
1683
+
1684
+ ```ts
1685
+ /** A layer of `MMapGeoJson`: any MapLibre layer without its `source` (and `id`, made up when left out). */
1686
+ export type MapGeoJsonLayer = DistributiveOmit<Exclude<Maplibre.LayerSpecification, Maplibre.BackgroundLayerSpecification>, 'id' | 'source'> & { id?: string }
1687
+ ```
1688
+
1689
+ ### MMapHover
1690
+
1691
+ Import from `@m3ui-vue/m3ui-vue/map`.
1692
+
1693
+ Hover info for an `MMap` with an `adapter`: while on (v-model), the layers with `hover` fields show them for the feature under the pointer, in a small popup that follows it. With `control` (on by default) it adds its own on/off button to the map's controls. Pointer devices only: touch has no hover. Available from the `/map` entry point.
1694
+
1695
+ Props:
1696
+ - `modelValue?: boolean = false` (v-model) — On (v-model)
1697
+ - `control?: boolean | MapControlPosition = true` — Its on/off button: `false`, or a corner (`true` is top-right)
1698
+
1699
+ Events:
1700
+ - `update:modelValue(on: boolean)` — Turned on or off with its button
1701
+
1702
+ ### MMapIdentify
1703
+
1704
+ Import from `@m3ui-vue/m3ui-vue/map`.
1705
+
1706
+ Click-to-identify for an `MMap` with an `adapter`: a click on the map lists the features of the layers marked to identify under it (with their formatted properties) in a popup, with a marker where the user clicked. The pointer turns into a hand over those layers. The `identify` event carries the results, to show them in a panel of your own instead (`:popup="false"`, then `MMapFeatureInfo` in an `MWindow`). Available from the `/map` entry point.
1707
+
1708
+ Props:
1709
+ - `enabled?: boolean = true` — Listen to clicks. It also pauses by itself while another tool owns them (`MMapMeasure` measuring)
1710
+ - `popup?: boolean = true` — Show the results in a popup at the click
1711
+ - `marker?: boolean = true` — Mark where the user clicked while there are results
1712
+
1713
+ Events:
1714
+ - `identify(results: MapIdentifyResult[], lngLat: [number, number])` — The user clicked the map: what was found there (empty when nothing) and where (`[lng, lat]`)
1715
+
1716
+ Slots:
1717
+ - `#default { results: MapIdentifyResult[]; lngLat: [number, number]; close: () => void; }` — The popup's content instead of `MMapFeatureInfo` (scope: `{ results, lngLat, close }`)
1718
+
1719
+ Exposed (template ref):
1720
+ - `close: () => void`
1721
+
1722
+ ### MMapLayers
1723
+
1724
+ Import from `@m3ui-vue/m3ui-vue/map`.
1725
+
1726
+ The layer list of an `MMap` with an `adapter`: a search field, the style's groups (collapsible, with a visibility toggle for the whole group and a count) and its layers, each with a visibility toggle and, expanded, its description, an opacity slider, its legend and a download link. Only the content: put it in an `MWindow`, an `MSideSheet`, an `MBottomSheet` or an `MMapControl`. Available from the `/map` entry point.
1727
+
1728
+ Props:
1729
+ - `search?: boolean = true` — Show the search field
1730
+ - `collapsed?: boolean = false` — Groups start collapsed
1731
+
1732
+ Slots:
1733
+ - `#actions { layer: MapLayerInfo; visible: boolean; }` — Extra actions in an expanded layer (scope: `{ layer, visible }`)
1734
+
1735
+ ### MMapMarker
1736
+
1737
+ Import from `@m3ui-vue/m3ui-vue/map`.
1738
+
1739
+ A marker on an `MMap`, at `lngLat`: MapLibre's pin in the theme's primary (or `color`), or your own content from the default slot. With `draggable`, `lngLat` is a v-model. Content in `#popup` opens in a popup when the marker is clicked. Available from the `/map` entry point.
1740
+
1741
+ Props:
1742
+ - `lngLat: [number, number]` (v-model:lngLat) — Position, `[lng, lat]` (v-model with `draggable`)
1743
+ - `color?: string` — The pin's color (any CSS color). Defaults to the theme's primary; ignored with custom content
1744
+ - `draggable?: boolean = false` — Let the user drag it
1745
+ - `anchor?: maplibregl.PositionAnchor` — Which part of the marker sits on `lngLat`. By default the pin's tip (MapLibre's placement: its center, offset `[0, -14]`), and the center of custom content
1746
+ - `offset?: [number, number]` — Offset in pixels, `[x, y]`. The pin's default is MapLibre's `[0, -14]`, which puts its tip on `lngLat`
1747
+ - `rotation?: number = 0` — Rotation in degrees
1748
+
1749
+ Events:
1750
+ - `click(event: MouseEvent)` — The marker was clicked
1751
+ - `update:lngLat(lngLat: [number, number])` — Dragged to a new position (`draggable`): `[lng, lat]`
1752
+
1753
+ Slots:
1754
+ - `#default` — The marker itself, instead of the pin (any element, anchored by `anchor`)
1755
+ - `#popup` — Content of a popup that opens when the marker is clicked
1756
+
1757
+ Exposed (template ref):
1758
+ - `marker: () => maplibregl.Marker | undefined` — The MapLibre marker
1759
+
1760
+ ### MMapMeasure
1761
+
1762
+ Import from `@m3ui-vue/m3ui-vue/map`.
1763
+
1764
+ Distance and area measuring on an `MMap`, with its own control (distance, area, clear). Click to add points (a preview follows the pointer), double-click, Enter or Escape to finish, click the first point to close the shape, or press the active button again (in fullscreen, Escape finishes it too where the browser allows: Chromium). Finished measurements stay editable: drag a vertex, or a midpoint to add one; the ✕ on a total or area deletes that one. Labels show each segment, the total and the area; everything follows the theme. While measuring it owns the map's clicks (`MMapIdentify` waits). Geodesic numbers, the same as turf's. Available from the `/map` entry point.
1765
+
1766
+ Props:
1767
+ - `modelValue?: Mode | null = null` (v-model) — The measuring mode (v-model): `'distance'`, `'area'`, or null. Set it to start measuring from outside
1768
+ - `control?: boolean | MapControlPosition = true` — Its buttons: `false` (drive it with v-model), or a corner (`true` is top-right)
1769
+
1770
+ Events:
1771
+ - `update:modelValue(mode: Mode | null)` — The measuring mode changed (`'distance'`, `'area'`, or null when it finished)
1772
+ - `change(measurements: { mode: Mode; points: LngLat[]; closed: boolean; length: number; area?: number | undefined; }[])` — The measurements changed (added, edited, cleared): each one's points, length in meters and area in m²
1773
+
1774
+ Exposed (template ref):
1775
+ - `start: (next: Mode) => void`
1776
+ - `finish: (byEscape?: boolean) => void`
1777
+ - `clear: () => void`
1778
+ - `remove: (index: number) => void`
1779
+
1780
+ ```ts
1781
+ type Mode = 'distance' | 'area'
1782
+ ```
1783
+
1784
+ ### MMapPopup
1785
+
1786
+ Import from `@m3ui-vue/m3ui-vue/map`.
1787
+
1788
+ A popup on an `MMap` at `lngLat`, shown while `open` (v-model): e.g. what the user clicked on. Its content is the default slot, styled as an M3 surface. For a popup that opens from a marker, use `MMapMarker`'s `#popup` slot. Available from the `/map` entry point.
1789
+
1790
+ Props:
1791
+ - `lngLat: [number, number]` — Position, `[lng, lat]`
1792
+ - `open?: boolean = true` (v-model:open) — Shown (v-model)
1793
+ - `closeButton?: boolean = true` — Show a close button
1794
+ - `closeOnClick?: boolean = true` — Close it when the map is clicked
1795
+ - `anchor?: maplibregl.PositionAnchor` — Where the popup sits relative to `lngLat`. By default MapLibre picks the side with room
1796
+ - `offset?: maplibregl.Offset` — Offset from `lngLat`: pixels, `[x, y]`, or one per side (`{ bottom: [0, -38], … }`, MapLibre's `Offset`). By default none: its tip touches the point
1797
+ - `maxWidth?: string = "320px"` — Maximum width (CSS)
1798
+
1799
+ Events:
1800
+ - `update:open(open: boolean)` — Closed by its close button or a click on the map (`closeOnClick`)
1801
+
1802
+ Slots:
1803
+ - `#default` — The popup's content
1804
+
1805
+ Exposed (template ref):
1806
+ - `popup: () => maplibregl.Popup | undefined` — The MapLibre popup
1807
+
1808
+ ### MMapSearch
1809
+
1810
+ Import from `@m3ui-vue/m3ui-vue/map`.
1811
+
1812
+ A place search on an `MMap`: a search card in a corner. Enter searches through `provider` (OpenStreetMap's Nominatim by default, or any function returning places); picking a result flies there (or fits its extent) and marks it. Available from the `/map` entry point.
1813
+
1814
+ Props:
1815
+ - `provider?: MapSearchProvider` — Where to search: `nominatimProvider(options)` by default, or your own function
1816
+ - `position?: MapControlPosition = "top-left"` — The corner
1817
+ - `placeholder?: string` — The field's placeholder (the locale's "Search places" by default)
1818
+ - `zoom?: number = 17` — The zoom to fly to for a result without an extent
1819
+ - `marker?: boolean = true` — Mark the picked result
1820
+ - `instant?: boolean = false` — Search while typing (debounced), for providers that allow it; Nominatim's public server doesn't
1821
+
1822
+ Events:
1823
+ - `select(result: MapSearchResult)` — A result was picked
1824
+
1560
1825
  ### MMarkdown
1561
1826
 
1562
1827
  Import from `@m3ui-vue/m3ui-vue/markdown`.
@@ -2274,6 +2539,50 @@ Slots:
2274
2539
  - `#actions` — Action buttons displayed in the header row
2275
2540
  - `#default` — Main section content
2276
2541
 
2542
+ ### MSeekBar
2543
+
2544
+ A media seek bar (not an M3 spec component; Media3's ProgressSlider is a plain M3 Slider, which this follows in its default look): the playback position on a track with the buffered part, optional chapters, elapsed and total (or remaining) time, and a preview of the time under the pointer. Dragging scrubs locally and seeks once on release (or live, with `live`); a tap or click seeks to that point. While `playing`, it advances on its own between `modelValue` updates, so a 4Hz `timeupdate` still moves it smoothly.
2545
+
2546
+ Props:
2547
+ - `modelValue: number` (v-model) — Playback position in seconds (v-model)
2548
+ - `duration: number` — Media length in seconds; 0, NaN or Infinity (not loaded yet, a live stream) disables seeking
2549
+ - `buffered?: number | [number, number][]` — How much is loaded: up to a time, or time ranges (`[[start, end], …]`, like a media element's `buffered`)
2550
+ - `chapters?: SeekBarChapter[]` — Chapter starts, drawn as gaps in the track; their titles show in the preview
2551
+ - `playing?: boolean = false` — The media is playing: the bar moves on its own between updates, and the wavy line waves
2552
+ - `playbackRate?: number = 1` — Playback speed, for that motion between updates
2553
+ - `live?: boolean = false` — Updates the v-model continuously while dragging (the media follows the thumb), not only on release
2554
+ - `variant?: "line" | "wavy" | "slider" = "slider"` — `slider`: the M3 slider (bar thumb with a gap around it). `line`: a plain line with a round thumb. `wavy`: the played part waves while playing
2555
+ - `size?: "xs" | "sm" | "md" = "md"` — Track thickness: `md` (16px, the smallest M3 slider), `sm` (8px) or `xs` (4px, over a video)
2556
+ - `time?: "none" | "below" | "sides" = "below"` — Where the elapsed and total time go
2557
+ - `remaining?: boolean = false` (v-model:remaining) — The end label shows the remaining time (`-1:23`) instead of the total; clicking it switches (v-model:remaining)
2558
+ - `format?: ((seconds: number) => string)` — Formats a time in seconds. Default `m:ss`, or `h:mm:ss` for media an hour or longer
2559
+ - `keyStep?: number = 5` — Seconds the arrow keys move; Page Up/Down move 10%
2560
+ - `preview?: boolean = true` — Shows the time (and chapter) above the pointer while hovering or dragging
2561
+ - `color?: string = "primary"` — Played part and thumb: an M3 role (`primary`, `secondary`, `tertiary`, `error`) or any CSS color
2562
+ - `trackColor?: string` — Unplayed track: an M3 role or any CSS color. Default secondary-container
2563
+ - `timeColor?: string` — The time labels' color, as a CSS color (white over a video, say). Default on-surface-variant
2564
+ - `disabled?: boolean = false` — Disables seeking
2565
+ - `label?: string` — Accessible name. Default the locale's `seekBar`
2566
+
2567
+ Events:
2568
+ - `update:modelValue(number)` — Emitted on a seek (and continuously while dragging with `live`) — powers v-model
2569
+ - `seek(number)` — Emitted once per seek with its time: on release of a drag, a tap or click, or a key press
2570
+ - `scrub-start(number)` — Emitted when a drag starts, with its time
2571
+ - `scrub(number)` — Emitted while dragging, with the time under the pointer
2572
+ - `update:remaining(boolean)` — Emitted when the end label is clicked to switch between total and remaining time
2573
+
2574
+ Slots:
2575
+ - `#preview { time: number; formatted: string; chapter: SeekBarChapter | null; }` — Replaces the bubble shown above the pointer while hovering or dragging (a frame preview, say). Props: `{ time, formatted, chapter }`
2576
+
2577
+ ```ts
2578
+ export interface SeekBarChapter {
2579
+ /** Where the chapter starts, in seconds */
2580
+ start: number
2581
+ /** Shown in the preview while the pointer is over it */
2582
+ title?: string
2583
+ }
2584
+ ```
2585
+
2277
2586
  ### MSegmentedButton
2278
2587
 
2279
2588
  A row of joined segments for choosing between a small set of related options — single or multi select.
@@ -3296,6 +3605,121 @@ Exposed (template ref):
3296
3605
 
3297
3606
  ## Composables and functions
3298
3607
 
3608
+ ### useMap
3609
+
3610
+ Import from `@m3ui-vue/m3ui-vue/map`.
3611
+
3612
+ The map of the enclosing `MMap`, for your own controls, layers and handlers (call it in a component inside `MMap`). Listeners added through it are removed when the component unmounts. ```ts const { map, onLayer } = useMap() onLayer('click', 'parcels-fill', (e) => console.log(e.features?.[0]?.properties)) ```
3613
+
3614
+ ```ts
3615
+ useMap(): {
3616
+ map: ComputedRef<Map$1 | undefined>
3617
+ maplibre: ComputedRef<typeof import("/home/runner/work/m3ui-vue/m3ui-vue/node_modules/.pnpm/maplibre-gl@5.24.0/node_modules/maplibre-gl/dist/maplibre-gl") | undefined>
3618
+ styleVersion: ComputedRef<number>
3619
+ activeTool: Ref<string | null>
3620
+ onReady: (fn: (map: Maplibre.Map, maplibre: MaplibreModule) => void) => void
3621
+ on: (type: T, listener: (e: Maplibre.MapEventType[T] & object) => void) => void
3622
+ onLayer: (type: T, layerId: string, listener: (e: Maplibre.MapLayerEventType[T] & object) => void) => void
3623
+ }
3624
+ ```
3625
+
3626
+ ### useMapLayers
3627
+
3628
+ Import from `@m3ui-vue/m3ui-vue/map`.
3629
+
3630
+ The layers of the enclosing `MMap`'s style as its `adapter` describes them, with their visibility and opacity, for a layer panel or a base layer switcher of your own (`MMapLayers` and `MMapBaseLayers` are built on it). Changes go to the map and to every component using it; a layer's `children` follow it.
3631
+
3632
+ ```ts
3633
+ useMapLayers(): {
3634
+ model: ComputedRef<MapLayerModel | undefined>
3635
+ layers: ComputedRef<MapLayerInfo[]>
3636
+ isVisible: (id: string) => boolean
3637
+ setVisible: (id: string, visible: boolean) => void
3638
+ toggle: (id: string) => void
3639
+ opacityOf: (id: string) => number
3640
+ setOpacity: (id: string, opacity: number) => void
3641
+ layersOf: (group: string | null) => MapLayerInfo[]
3642
+ groupState: (group: string) => "visible" | "hidden" | "partial"
3643
+ setGroupVisible: (group: string, visible: boolean) => void
3644
+ baseLayers: ComputedRef<MapLayerInfo[]>
3645
+ baseLayer: ComputedRef<string | null>
3646
+ setBaseLayer: (id: string | null) => void
3647
+ }
3648
+ ```
3649
+
3650
+ ### genericAdapter
3651
+
3652
+ Import from `@m3ui-vue/m3ui-vue/map`.
3653
+
3654
+ Any style: every layer but the background is listed under its id (or `metadata.title`), vector layers identify all their properties, and nothing is a base layer or shows on hover.
3655
+
3656
+ ```ts
3657
+ genericAdapter(style: Maplibre.StyleSpecification, context: MapAdapterContext): MapLayerModel
3658
+ ```
3659
+
3660
+ ### orvianAdapter
3661
+
3662
+ Import from `@m3ui-vue/m3ui-vue/map`.
3663
+
3664
+ The Orvian viewers' conventions in the style's `metadata`. On each layer: `alias`, `description`, `group`, `show_in_layerlist` (false hides it from the list), `isbaselayer` with `image` (raster base layers), `childs` (layer ids toggled with it), `identify` (true lists its properties on click), `fields` (per property: `alias`, `prefix`, `suffix`, `mask`, `show: false`; plus `exclude`, a list of properties to leave out), `hover` (`enable` and `fields`, a list of `{ <property>: { alias, prefix, suffix, mask } }`), `legend` (`show`, `wmslegend`) and `download`. On the style: `groups` (`{ name, alias }`, in order).
3665
+
3666
+ ```ts
3667
+ orvianAdapter(options: OrvianAdapterOptions = {}): MapAdapter
3668
+ ```
3669
+
3670
+ ### identifyFeatures
3671
+
3672
+ Import from `@m3ui-vue/m3ui-vue/map`.
3673
+
3674
+ The features of the model's identify layers at a point (topmost first), with their properties formatted: what `MMapIdentify` lists on click, for a UI of your own.
3675
+
3676
+ ```ts
3677
+ identifyFeatures(map: Maplibre.Map, point: Maplibre.PointLike, model: MapLayerModel | undefined): MapIdentifyResult[]
3678
+ ```
3679
+
3680
+ ### formatFieldValue
3681
+
3682
+ Import from `@m3ui-vue/m3ui-vue/map`.
3683
+
3684
+ A property's value as text: numbers through `mask` (in the page's language, `<html lang>`), then `prefix` and `suffix`. Empty values give ''.
3685
+
3686
+ ```ts
3687
+ formatFieldValue(raw: unknown, format?: MapFieldFormat): string
3688
+ ```
3689
+
3690
+ ### fieldLabel
3691
+
3692
+ Import from `@m3ui-vue/m3ui-vue/map`.
3693
+
3694
+ A property's label: its format's, or the key with a capital first letter.
3695
+
3696
+ ```ts
3697
+ fieldLabel(key: string, format?: MapFieldFormat): string
3698
+ ```
3699
+
3700
+ ### useMapFilter
3701
+
3702
+ Import from `@m3ui-vue/m3ui-vue/map`.
3703
+
3704
+ Filters for the layers of the enclosing `MMap`, on top of the filters their style already has (a layer that only draws parks keeps doing so): `setFilter(layer, expression)` combines both, `setFilter(layer, null)` brings the style's back. `MMapFilter` is built on it; use it for filters of your own (a range slider, a date, a search…).
3705
+
3706
+ ```ts
3707
+ useMapFilter(): {
3708
+ setFilter: (layerId: string, filter: Maplibre.FilterSpecification | null) => void
3709
+ valuesOf: (layerId: string, property: string) => (string | number)[]
3710
+ }
3711
+ ```
3712
+
3713
+ ### nominatimProvider
3714
+
3715
+ Import from `@m3ui-vue/m3ui-vue/map`.
3716
+
3717
+ OpenStreetMap's Nominatim geocoder. Its public server allows one search per second and no search-as-you-type: `MMapSearch` searches on Enter.
3718
+
3719
+ ```ts
3720
+ nominatimProvider(options: NominatimOptions = {}): MapSearchProvider
3721
+ ```
3722
+
3299
3723
  ### shapeNames
3300
3724
 
3301
3725
  ```ts
@@ -3325,11 +3749,11 @@ useTheme(): {
3325
3749
  useColorPalette(): {
3326
3750
  palette: Ref<string>
3327
3751
  palettes: Palette[]
3328
- set: (id: string) => void
3752
+ set: (id: PaletteId | (string & {})) => void
3329
3753
  seed: Readonly<Ref<{ readonly seed: string; readonly variant?: SchemeVariant; readonly contrast?: number; } | null>>
3330
3754
  setSeed: (seed: string, options?: SeedOptions) => Promise<void>
3331
3755
  contrast: Readonly<Ref<ContrastLevel>>
3332
- activeContrast: ComputedRef<Exclude<ContrastLevel, 'system'>>
3756
+ activeContrast: Ref<"standard" | "medium" | "high">
3333
3757
  setContrast: (level: ContrastLevel) => void
3334
3758
  persistPalette: Ref<boolean>
3335
3759
  setPersistPalette: (enabled: boolean) => void
@@ -3338,6 +3762,8 @@ useColorPalette(): {
3338
3762
 
3339
3763
  ### palettes
3340
3764
 
3765
+ Every palette: the built-in ones, plus `createM3UI({ customPalettes })`.
3766
+
3341
3767
  ```ts
3342
3768
  palettes: Palette[]
3343
3769
  ```
@@ -3352,7 +3778,7 @@ SEED_PALETTE: "seed"
3352
3778
 
3353
3779
  ### themeInitScript
3354
3780
 
3355
- A script to inline in `<head>` of a server-rendered page (Nuxt, Vite SSR), so dark mode, the palette and the contrast level are on `<html>` before the first paint instead of when the app's JS loads. It does what `useTheme` and `useColorPalette` do when they load in the browser (the stored choice, or the given `createM3UI` defaults), so pass it the same options as the plugin. A `seed` default can't be generated this early: its first visit still shows the baseline until the app loads (later visits use the cached CSS). ```ts useHead({ script: [{ innerHTML: themeInitScript({ palette: 'red' }) }] }) ```
3781
+ A script to inline in `<head>` of a server-rendered page (Nuxt, Vite SSR), so dark mode, the palette and the contrast level are on `<html>` before the first paint instead of when the app's JS loads. It does what `useTheme` and `useColorPalette` do when they load in the browser (the stored choice, or the given `createM3UI` defaults; a choice only in a cookie, from `createM3UI({ cookies })`, counts too), so pass it the same options as the plugin. A `seed` default can't be generated this early: its first visit still shows the baseline until the app loads (later visits use the cached CSS). ```ts useHead({ script: [{ innerHTML: themeInitScript({ palette: 'red' }) }] }) ```
3356
3782
 
3357
3783
  ```ts
3358
3784
  themeInitScript(options: ThemeInitOptions = {}): string
@@ -3581,9 +4007,167 @@ skinTones: readonly ["🏻", "🏼", "🏽", "🏾", "🏿"]
3581
4007
 
3582
4008
  ## Types
3583
4009
 
4010
+ ```ts
4011
+ /** What `MMap` provides to everything inside it. */
4012
+ export interface MapContext {
4013
+ /** The MapLibre map, once created (never on the server) */
4014
+ map: ShallowRef<Maplibre.Map | undefined>
4015
+ /** The `maplibre-gl` module, loaded with the map (so nothing imports it on the server) */
4016
+ maplibre: ShallowRef<MaplibreModule | undefined>
4017
+ /** Bumped on every `style.load`: sources and layers added by components are re-added after a style change */
4018
+ styleVersion: Ref<number>
4019
+ /** The style as `MMap`'s `adapter` reads it (undefined without one) */
4020
+ model: ShallowRef<MapLayerModel | undefined>
4021
+ /** Visibility and opacity of the model's layers */
4022
+ layerState: MapLayerState
4023
+ /**
4024
+ * The tool that owns the map's clicks right now (`'measure'` while measuring), or null: `MMapIdentify` stays quiet
4025
+ * meanwhile. Set it from tools of your own the same way
4026
+ */
4027
+ activeTool: Ref<string | null>
4028
+ }
4029
+ ```
4030
+
4031
+ ```ts
4032
+ /** The `maplibre-gl` module (its classes: `Map`, `Marker`, `Popup`…) */
4033
+ export type MaplibreModule = typeof import('maplibre-gl')
4034
+ ```
4035
+
4036
+ ```ts
4037
+ /** Visibility and opacity of the model's layers, shared by everything inside one `MMap`. */
4038
+ export interface MapLayerState {
4039
+ visible: Record<string, boolean>
4040
+ opacity: Record<string, number>
4041
+ }
4042
+ ```
4043
+
4044
+ ```ts
4045
+ /** Reads a style's conventions (usually its `metadata`) into the model the map's UI components use. */
4046
+ export type MapAdapter = (style: Maplibre.StyleSpecification, context: MapAdapterContext) => MapLayerModel
4047
+ ```
4048
+
4049
+ ```ts
4050
+ /** What an adapter gets besides the style. */
4051
+ export interface MapAdapterContext {
4052
+ /** The style's URL, when `MMap`'s `mapStyle` is one */
4053
+ styleUrl?: string
4054
+ }
4055
+ ```
4056
+
4057
+ ```ts
4058
+ /** How to show one property of a feature. */
4059
+ export interface MapFieldFormat {
4060
+ /** The label (the key, capitalized, by default) */
4061
+ label?: string
4062
+ /** Text before the value */
4063
+ prefix?: string
4064
+ /** Text after the value */
4065
+ suffix?: string
4066
+ /** A number mask: its decimals set the fraction digits (`#.00` → 2) and a comma turns on grouping (`#,###`) */
4067
+ mask?: string
4068
+ /** Leave it out */
4069
+ hidden?: boolean
4070
+ }
4071
+ ```
4072
+
4073
+ ```ts
4074
+ /** What `MMapIdentify` found on one layer at a point. */
4075
+ export interface MapIdentifyResult {
4076
+ layer: MapLayerInfo
4077
+ feature: Maplibre.MapGeoJSONFeature
4078
+ /** Its properties as the layer's `identify` shows them, formatted */
4079
+ fields: { key: string; label: string; value: string }[]
4080
+ }
4081
+ ```
4082
+
4083
+ ```ts
4084
+ /** One layer of the style, as the map's UI components see it. */
4085
+ export interface MapLayerInfo {
4086
+ /** The style layer's id */
4087
+ id: string
4088
+ /** Its name in the UI */
4089
+ title: string
4090
+ description?: string
4091
+ /** The `name` of its group in `MapLayerModel.groups` */
4092
+ group?: string
4093
+ /** Shown in `MMapLayers` */
4094
+ listed: boolean
4095
+ /** A base layer: `MMapBaseLayers` shows one of them at a time, with this thumbnail */
4096
+ base?: { image?: string }
4097
+ /** Layer ids shown, hidden and faded along with it */
4098
+ children: string[]
4099
+ /** Listed by `MMapIdentify` on click: every property, formatted by `format`, minus `exclude` */
4100
+ identify: false | { format: Record<string, MapFieldFormat>; exclude: string[] }
4101
+ /** Shown by `MMapHover` under the pointer: these properties, in order */
4102
+ hover: false | { fields: (MapFieldFormat & { key: string })[] }
4103
+ /** A legend image URL (an SVG, typically) */
4104
+ legend?: string
4105
+ /** A download URL for its data */
4106
+ download?: string
4107
+ }
4108
+ ```
4109
+
4110
+ ```ts
4111
+ /** The style as the map's UI components see it: layers with names, groups, base layers, what to identify. */
4112
+ export interface MapLayerModel {
4113
+ /** The style's name */
4114
+ title?: string
4115
+ /** Groups, in order */
4116
+ groups: { name: string; title: string }[]
4117
+ /** Layers, in the style's order (bottom to top) */
4118
+ layers: MapLayerInfo[]
4119
+ }
4120
+ ```
4121
+
4122
+ ```ts
4123
+ export interface OrvianAdapterOptions {
4124
+ /**
4125
+ * A layer's legend image. By default, for a style served by mvt-rs (`…/services/styles/<style>`), its legend service
4126
+ * (`…/services/legends/<style>?layer_id=<id>`), unless the layer's `metadata.legend.show` is false;
4127
+ * `metadata.legend.wmslegend` overrides it
4128
+ */
4129
+ legend?: (layer: Maplibre.LayerSpecification, styleUrl?: string) => string | undefined
4130
+ }
4131
+ ```
4132
+
4133
+ ```ts
4134
+ /** Finds places for `MMapSearch`: the text in, results out. `signal` aborts a search the user replaced. */
4135
+ export type MapSearchProvider = (query: string, signal: AbortSignal) => Promise<MapSearchResult[]>
4136
+ ```
4137
+
4138
+ ```ts
4139
+ /** A place found by a `MapSearchProvider`. */
4140
+ export interface MapSearchResult {
4141
+ /** What to show */
4142
+ label: string
4143
+ /** Where it is */
4144
+ lngLat: [number, number]
4145
+ /** Its extent, `[west, south, east, north]`: the map fits it instead of zooming to the point */
4146
+ bbox?: [number, number, number, number]
4147
+ /** Its kind (`city`, `road`, `park`, `restaurant`…), for the icon */
4148
+ type?: string
4149
+ }
4150
+ ```
4151
+
4152
+ ```ts
4153
+ export interface NominatimOptions {
4154
+ /** The Nominatim server (`https://nominatim.openstreetmap.org` by default; mind its usage policy, or run your own) */
4155
+ url?: string
4156
+ /** How many results (6) */
4157
+ limit?: number
4158
+ /** The results' language (`es`, `en`…); by default the page's (`<html lang>`) */
4159
+ language?: string
4160
+ /** Only these countries (ISO codes: `['ar']`) */
4161
+ countryCodes?: string[]
4162
+ /** Prefer (or with `bounded`, only) this area: `[west, south, east, north]` */
4163
+ viewbox?: [number, number, number, number]
4164
+ bounded?: boolean
4165
+ }
4166
+ ```
4167
+
3584
4168
  ```ts
3585
4169
  export interface M3UIOptions {
3586
- palette?: string
4170
+ palette?: PaletteId | (string & {})
3587
4171
  /**
3588
4172
  * Set to `false` to make `palette` a hard default that always wins on boot, ignoring
3589
4173
  * whatever is already stored in localStorage, and to stop future `useColorPalette().set()`
@@ -3631,6 +4215,32 @@ export interface M3UIOptions {
3631
4215
  * (compact: it has no window) so it matches the HTML, and adapt once mounted.
3632
4216
  */
3633
4217
  isHydrating?: () => boolean
4218
+ /**
4219
+ * Also keep the theme, the palette and the contrast level in cookies (`m3-theme`, `m3-palette`, `m3-contrast`,
4220
+ * a year, `SameSite=Lax`), and the window's size (`m3-viewport`, `<width>x<height>`), so a server can read them
4221
+ * and render with the user's choice and for their screen through `initialState`.
4222
+ */
4223
+ cookies?: boolean
4224
+ /**
4225
+ * Server-side rendering: the user's theme, palette and contrast as the server knows them (from the cookies that
4226
+ * `cookies` writes), on the server and on the client alike. `useTheme()` and `useColorPalette()` report them on
4227
+ * the server, and on the client while hydrating (with `isHydrating`), so what's rendered from them matches the
4228
+ * server's HTML. What's missing falls back to this plugin's defaults, like a first visit. With `viewport`, the
4229
+ * adaptive layouts (`MNavigationSuite`, `MListDetail`, `MSupportingPane`) and `useWindowSizeClass()` render for
4230
+ * that window size instead of compact.
4231
+ */
4232
+ initialState?: M3InitialState
4233
+ }
4234
+ ```
4235
+
4236
+ ```ts
4237
+ /** The user's theme choices as a server knows them (from cookies), for server-side rendering. */
4238
+ export interface M3InitialState {
4239
+ theme?: Theme
4240
+ palette?: string
4241
+ contrast?: ContrastLevel
4242
+ /** The browser window's size: the adaptive layouts and `useWindowSizeClass()` render for it instead of compact. */
4243
+ viewport?: { width: number; height: number }
3634
4244
  }
3635
4245
  ```
3636
4246
 
@@ -3650,6 +4260,11 @@ export interface Palette {
3650
4260
  }
3651
4261
  ```
3652
4262
 
4263
+ ```ts
4264
+ /** The id of a palette that ships with the library (`palettes.css`, plus the `purple` baseline). */
4265
+ export type PaletteId = (typeof builtInPalettes)[number]['id']
4266
+ ```
4267
+
3653
4268
  ```ts
3654
4269
  export interface ActiveSeed extends SeedOptions {
3655
4270
  seed: string
@@ -3668,7 +4283,7 @@ export type ContrastLevel = 'standard' | 'medium' | 'high' | 'system'
3668
4283
  ```ts
3669
4284
  export interface ThemeInitOptions {
3670
4285
  /** `createM3UI`'s `palette`: the first-visit default, or forced with `persistPalette: false`. */
3671
- palette?: string
4286
+ palette?: PaletteId | (string & {})
3672
4287
  /** `createM3UI`'s `contrast`, with the same rules as `palette`. */
3673
4288
  contrast?: ContrastLevel
3674
4289
  /** `createM3UI`'s `persistPalette`. */
@@ -3788,6 +4403,10 @@ export interface M3Locale {
3788
4403
 
3789
4404
  // Pickers
3790
4405
  selectDate: string
4406
+ ok: string
4407
+ dateToggleInput: string
4408
+ dateToggleCalendar: string
4409
+ dateInputLabel: string
3791
4410
  selectTime: string
3792
4411
  timeHourSelection: string
3793
4412
  timeMinuteSelection: string
@@ -3798,6 +4417,10 @@ export interface M3Locale {
3798
4417
  sheetExpand: string
3799
4418
  sheetCollapse: string
3800
4419
  sheetDismiss: string
4420
+ seekBar: string
4421
+ seekBarValue: string
4422
+ seekBarShowRemaining: string
4423
+ seekBarShowDuration: string
3801
4424
  selectRange: string
3802
4425
  pickStart: string
3803
4426
  pickEnd: string
@@ -3937,6 +4560,37 @@ export interface M3Locale {
3937
4560
  nextPage: string
3938
4561
  carousel: string
3939
4562
  carouselItem: string
4563
+ // MMap (maplibre controls)
4564
+ mapTitle: string
4565
+ mapMarker: string
4566
+ mapZoomIn: string
4567
+ mapZoomOut: string
4568
+ mapResetBearing: string
4569
+ mapFindMyLocation: string
4570
+ mapLocationNotAvailable: string
4571
+ mapEnterFullscreen: string
4572
+ mapExitFullscreen: string
4573
+ mapToggleAttribution: string
4574
+ mapFeedback: string
4575
+ mapCtrlScroll: string
4576
+ mapCmdScroll: string
4577
+ mapTwoFingers: string
4578
+ mapLayers: string
4579
+ mapSearchLayers: string
4580
+ mapNoLayers: string
4581
+ mapShowLayer: string
4582
+ mapHideLayer: string
4583
+ mapOpacity: string
4584
+ mapDownload: string
4585
+ mapNoBaseLayer: string
4586
+ mapHoverInfo: string
4587
+ mapNoValue: string
4588
+ mapMeasureDistance: string
4589
+ mapMeasureArea: string
4590
+ mapClearMeasurements: string
4591
+ mapDeleteMeasurement: string
4592
+ mapTotal: string
4593
+ mapSearchPlaces: string
3940
4594
  }
3941
4595
  ```
3942
4596
 
@@ -4039,7 +4693,7 @@ export interface EmojiCategory {
4039
4693
  `M3Locale` keys (pass a partial object to `createM3UI({ locale })`; presets from `@m3ui-vue/m3ui-vue/locales`:
4040
4694
  `esLocale`, `frLocale`, `ptLocale`, `deLocale`, `jaLocale`, `zhLocale`, `koLocale`):
4041
4695
 
4042
- lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem
4696
+ lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, ok, dateToggleInput, dateToggleCalendar, dateInputLabel, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, seekBar, seekBarValue, seekBarShowRemaining, seekBarShowDuration, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem, mapTitle, mapMarker, mapZoomIn, mapZoomOut, mapResetBearing, mapFindMyLocation, mapLocationNotAvailable, mapEnterFullscreen, mapExitFullscreen, mapToggleAttribution, mapFeedback, mapCtrlScroll, mapCmdScroll, mapTwoFingers, mapLayers, mapSearchLayers, mapNoLayers, mapShowLayer, mapHideLayer, mapOpacity, mapDownload, mapNoBaseLayer, mapHoverInfo, mapNoValue, mapMeasureDistance, mapMeasureArea, mapClearMeasurements, mapDeleteMeasurement, mapTotal, mapSearchPlaces
4043
4697
 
4044
4698
  ## Theme tokens
4045
4699