@m3ui-vue/m3ui-vue 1.0.1 → 1.0.3

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 (115) hide show
  1. package/dist/API.md +636 -20
  2. package/dist/MMenuItem-DFyXflk9.js +707 -0
  3. package/dist/MMenuItem-DFyXflk9.js.map +1 -0
  4. package/dist/MSlider-CdNIH7jc.js +1376 -0
  5. package/dist/MSlider-CdNIH7jc.js.map +1 -0
  6. package/dist/MTextField-B4X92vH_.js +671 -0
  7. package/dist/MTextField-B4X92vH_.js.map +1 -0
  8. package/dist/api.json +1 -1
  9. package/dist/chart.js +1 -1
  10. package/dist/chart.js.map +1 -1
  11. package/dist/code-editor.js +1 -1
  12. package/dist/components/MIconButton.vue.d.ts +1 -1
  13. package/dist/components/MMap.vue.d.ts +74 -0
  14. package/dist/components/MMapBaseLayers.vue.d.ts +15 -0
  15. package/dist/components/MMapControl.vue.d.ts +23 -0
  16. package/dist/components/MMapFeatureInfo.vue.d.ts +25 -0
  17. package/dist/components/MMapFilter.vue.d.ts +19 -0
  18. package/dist/components/MMapGeoJson.vue.d.ts +34 -0
  19. package/dist/components/MMapHover.vue.d.ts +17 -0
  20. package/dist/components/MMapIdentify.vue.d.ts +37 -0
  21. package/dist/components/MMapLayers.vue.d.ts +31 -0
  22. package/dist/components/MMapMarker.vue.d.ts +42 -0
  23. package/dist/components/MMapMeasure.vue.d.ts +43 -0
  24. package/dist/components/MMapPopup.vue.d.ts +43 -0
  25. package/dist/components/MMapSearch.vue.d.ts +28 -0
  26. package/dist/components/MShader.vue.d.ts +9 -3
  27. package/dist/components/_MMapLayerItem.vue.d.ts +25 -0
  28. package/dist/composables/_hydration.d.ts +4 -0
  29. package/dist/composables/_mapGeometry.d.ts +13 -0
  30. package/dist/composables/_ssrState.d.ts +30 -0
  31. package/dist/composables/_storageKeys.d.ts +3 -0
  32. package/dist/composables/_useThemeTokens.d.ts +7 -0
  33. package/dist/composables/mapAdapters.d.ts +111 -0
  34. package/dist/composables/mapSearch.d.ts +31 -0
  35. package/dist/composables/themeInitScript.d.ts +22 -0
  36. package/dist/composables/useColorPalette.d.ts +176 -6
  37. package/dist/composables/useLocale.d.ts +30 -0
  38. package/dist/composables/useMap.d.ts +47 -0
  39. package/dist/composables/useMapFilter.d.ts +10 -0
  40. package/dist/composables/useMapLayers.d.ts +30 -0
  41. package/dist/composables/useTheme.d.ts +2 -0
  42. package/dist/index.d.ts +4 -1
  43. package/dist/locales/index.js +217 -7
  44. package/dist/locales/index.js.map +1 -1
  45. package/dist/m3ui-vue.css +1 -1
  46. package/dist/m3ui.js +6742 -7961
  47. package/dist/m3ui.js.map +1 -1
  48. package/dist/map.d.ts +24 -0
  49. package/dist/map.js +1931 -0
  50. package/dist/map.js.map +1 -0
  51. package/dist/plugin.d.ts +25 -2
  52. package/dist/rich-text-editor.js +27 -26
  53. package/dist/rich-text-editor.js.map +1 -1
  54. package/dist/styles.css +1 -1
  55. package/dist/{useLocale-CuvWRZ1h.js → useLocale-b5-hzsL3.js} +32 -2
  56. package/dist/useLocale-b5-hzsL3.js.map +1 -0
  57. package/package.json +11 -2
  58. package/src/__tests__/MFab.test.ts +52 -6
  59. package/src/__tests__/MMap.test.ts +292 -0
  60. package/src/__tests__/MMapLayers.test.ts +257 -0
  61. package/src/__tests__/MMapTools.test.ts +233 -0
  62. package/src/__tests__/MShader.test.ts +16 -0
  63. package/src/__tests__/_fakeMaplibre.ts +158 -0
  64. package/src/__tests__/hydration.test.ts +119 -0
  65. package/src/__tests__/ssr.test.ts +171 -0
  66. package/src/__tests__/ssrState.test.ts +155 -0
  67. package/src/__tests__/themeInitScript.test.ts +122 -0
  68. package/src/components/MChart.vue +3 -2
  69. package/src/components/MFab.vue +29 -7
  70. package/src/components/MIconButton.vue +1 -1
  71. package/src/components/MLightbox.vue +10 -1
  72. package/src/components/MMap.vue +522 -0
  73. package/src/components/MMapBaseLayers.vue +67 -0
  74. package/src/components/MMapControl.vue +61 -0
  75. package/src/components/MMapFeatureInfo.vue +41 -0
  76. package/src/components/MMapFilter.vue +80 -0
  77. package/src/components/MMapGeoJson.vue +136 -0
  78. package/src/components/MMapHover.vue +131 -0
  79. package/src/components/MMapIdentify.vue +103 -0
  80. package/src/components/MMapLayers.vue +111 -0
  81. package/src/components/MMapMarker.vue +102 -0
  82. package/src/components/MMapMeasure.vue +452 -0
  83. package/src/components/MMapPopup.vue +99 -0
  84. package/src/components/MMapSearch.vue +162 -0
  85. package/src/components/MSearchBar.vue +4 -1
  86. package/src/components/MShader.vue +11 -3
  87. package/src/components/_MMapLayerItem.vue +77 -0
  88. package/src/composables/_hydration.ts +10 -0
  89. package/src/composables/_mapGeometry.ts +75 -0
  90. package/src/composables/_ssrState.ts +80 -0
  91. package/src/composables/_storageKeys.ts +6 -0
  92. package/src/composables/_useThemeTokens.ts +42 -0
  93. package/src/composables/mapAdapters.ts +208 -0
  94. package/src/composables/mapSearch.ts +56 -0
  95. package/src/composables/themeInitScript.ts +51 -0
  96. package/src/composables/useColorPalette.ts +32 -14
  97. package/src/composables/useLocale.ts +62 -0
  98. package/src/composables/useMap.ts +98 -0
  99. package/src/composables/useMapFilter.ts +45 -0
  100. package/src/composables/useMapLayers.ts +124 -0
  101. package/src/composables/useTheme.ts +18 -7
  102. package/src/composables/useWindowSizeClass.ts +23 -4
  103. package/src/index.ts +4 -1
  104. package/src/locales/de.ts +31 -1
  105. package/src/locales/es.ts +31 -1
  106. package/src/locales/fr.ts +31 -1
  107. package/src/locales/ja.ts +31 -1
  108. package/src/locales/ko.ts +31 -1
  109. package/src/locales/pt.ts +31 -1
  110. package/src/locales/zh.ts +31 -1
  111. package/src/map.ts +32 -0
  112. package/src/plugin.ts +77 -13
  113. package/dist/MTextField-BPbFeI9M.js +0 -1368
  114. package/dist/MTextField-BPbFeI9M.js.map +0 -1
  115. package/dist/useLocale-CuvWRZ1h.js.map +0 -1
package/dist/API.md CHANGED
@@ -1,4 +1,4 @@
1
- # @m3ui-vue/m3ui-vue 1.0.1 — API reference
1
+ # @m3ui-vue/m3ui-vue 1.0.3 — 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).
@@ -169,7 +169,7 @@ Props:
169
169
  - `clearable?: boolean = false` — Show a clear button
170
170
  - `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
171
171
  - `noResultsText?: string` — Text when no options match
172
- - `debounce?: number = 0` — Delay (ms) before filtering and firing
172
+ - `debounce?: number = 0` — Delay (ms) before filtering and firing @debounced. Selection is always instant
173
173
 
174
174
  Events:
175
175
  - `update:modelValue(unknown)` — Emitted on selection — powers v-model
@@ -1281,7 +1281,7 @@ A button that shows only an icon — four visual styles, the same 5-tier express
1281
1281
 
1282
1282
  Props:
1283
1283
  - `icon: string` — Material Symbol icon name
1284
- - `label?: string` — Accessible label (aria-label and title)
1284
+ - `label?: string` — Accessible label (its aria-label; no visible tooltip: wrap it in MTooltip for one)
1285
1285
  - `variant?: "filled" | "outlined" | "tonal" | "standard" = "standard"` — Visual style
1286
1286
  - `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
1287
  - `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
@@ -1496,7 +1496,7 @@ Props:
1496
1496
  - `value?: string | number` — Selection value — compared against the parent MList selected prop
1497
1497
  - `active?: boolean = false` — Force the active/highlighted state regardless of parent list selection
1498
1498
  - `disabled?: boolean = false` — Disabled state (38% opacity, blocks interaction)
1499
- - `clickable?: boolean` — Force interactive styling/behavior (auto-true when href, to,
1499
+ - `clickable?: boolean` — Force interactive styling/behavior (auto-true when href, to, @click, selectable, or expandable apply)
1500
1500
  - `href?: string` — Link URL — renders the item as an `<a>`
1501
1501
  - `to?: string | object` — Vue Router destination — renders the item as a router-link
1502
1502
  - `expandable?: boolean = false` — Show an expand/collapse chevron revealing the #children slot
@@ -1557,6 +1557,259 @@ Slots:
1557
1557
  - `#default` — Extra content shown below the spinner/text, in either mode
1558
1558
  - `#content` — The content the overlay is layered on top of (only used when fullscreen is false)
1559
1559
 
1560
+ ### MMap
1561
+
1562
+ Import from `@m3ui-vue/m3ui-vue/map`.
1563
+
1564
+ 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.
1565
+
1566
+ Props:
1567
+ - `mapStyle: string | maplibregl.StyleSpecification` — The map's style: a style JSON URL or a style object (MapLibre's `StyleSpecification`). Changing it reloads the style
1568
+ - `center?: [number, number]` (v-model:center) — `[lng, lat]` (v-model). When left out, the style's (or the remembered view's)
1569
+ - `zoom?: number` (v-model:zoom) — Zoom level (v-model)
1570
+ - `bearing?: number` (v-model:bearing) — Rotation in degrees (v-model)
1571
+ - `pitch?: number` (v-model:pitch) — Tilt in degrees (v-model)
1572
+ - `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)
1573
+ - `navigation?: boolean | MapControlPosition = true` — Zoom and compass buttons: `false`, or a corner (`true` is top-right)
1574
+ - `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)
1575
+ - `fullscreen?: boolean | MapControlPosition = false` — A fullscreen button: `false`, or a corner (`true` is top-right)
1576
+ - `scale?: boolean | MapControlPosition = true` — A metric scale bar: `false`, or a corner (`true` is bottom-left)
1577
+ - `attribution?: boolean | MapControlPosition = true` — The style's attribution, compact: `false`, or a corner (`true` is bottom-right). Most tile providers require it
1578
+ - `options?: Partial<Omit<maplibregl.MapOptions, "container" | "style">>` — Anything else for MapLibre's `Map` constructor (`maxZoom`, `maxBounds`, `cooperativeGestures`…)
1579
+ - `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
1580
+
1581
+ Events:
1582
+ - `click(event: maplibregl.MapMouseEvent)` — A click on the map (MapLibre's `MapMouseEvent`: `lngLat`, `point`)
1583
+ - `ready(map: maplibregl.Map)` — The map loaded (with its style), with the MapLibre `Map`
1584
+ - `update:center(center: [number, number])` — The view moved (on `moveend`): `[lng, lat]`
1585
+ - `update:zoom(zoom: number)` — The zoom changed (on `moveend`)
1586
+ - `update:bearing(bearing: number)` — The rotation changed (on `moveend`)
1587
+ - `update:pitch(pitch: number)` — The tilt changed (on `moveend`)
1588
+
1589
+ Slots:
1590
+ - `#default` — Map components (`MMapMarker`, `MMapPopup`, `MMapGeoJson`, `MMapControl`) and anything to show over the map, rendered once the map exists
1591
+
1592
+ Exposed (template ref):
1593
+ - `map: maplibregl.Map | undefined` — The MapLibre map, once loaded
1594
+
1595
+ ```ts
1596
+ export type MapControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
1597
+ ```
1598
+
1599
+ ### MMapBaseLayers
1600
+
1601
+ Import from `@m3ui-vue/m3ui-vue/map`.
1602
+
1603
+ 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.
1604
+
1605
+ Props:
1606
+ - `imageBase?: string = ""` — Prefix for the thumbnails' paths (e.g. `/images/`); full URLs are used as they are
1607
+ - `none?: boolean = true` — Offer "no base layer"
1608
+ - `vertical?: boolean = false` — Lay them out in a column
1609
+
1610
+ ### MMapControl
1611
+
1612
+ Import from `@m3ui-vue/m3ui-vue/map`.
1613
+
1614
+ 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). Available from the `/map` entry point.
1615
+
1616
+ Props:
1617
+ - `position?: MapControlPosition = "top-right"` — The corner
1618
+ - `group?: boolean = true` — Draw it as a control group (a surface with dividers between buttons), like MapLibre's zoom buttons
1619
+
1620
+ Slots:
1621
+ - `#default` — The control's content
1622
+
1623
+ ### MMapFeatureInfo
1624
+
1625
+ Import from `@m3ui-vue/m3ui-vue/map`.
1626
+
1627
+ 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.
1628
+
1629
+ Props:
1630
+ - `results: MapIdentifyResult[]` — What was found
1631
+
1632
+ Slots:
1633
+ - `#value { field: { key: string; label: string; value: string; }; result: MapIdentifyResult; }` — A property's value (scope: `{ field, result }`), e.g. to turn URLs into links
1634
+
1635
+ ### MMapFilter
1636
+
1637
+ Import from `@m3ui-vue/m3ui-vue/map`.
1638
+
1639
+ 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.
1640
+
1641
+ Props:
1642
+ - `layer: string` — The layer's id
1643
+ - `property: string` — The property to filter by
1644
+ - `values?: (string | number)[]` — The values to offer (labels in `labels`); by default the ones found in the layer's loaded features
1645
+ - `labels?: Record<string, string>` — Labels for the values, by value
1646
+ - `modelValue?: (string | number)[]` (v-model) — The selected values (v-model)
1647
+
1648
+ Events:
1649
+ - `update:modelValue(values: (string | number)[])`
1650
+
1651
+ ### MMapGeoJson
1652
+
1653
+ Import from `@m3ui-vue/m3ui-vue/map`.
1654
+
1655
+ 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.
1656
+
1657
+ Props:
1658
+ - `data: any` — A GeoJSON object, or the URL of one
1659
+ - `id?: string` — The source's id (and the prefix of its layers' made-up ids). Unique on the map; generated when left out
1660
+ - `layers?: MapGeoJsonLayer[]` — How to draw it: MapLibre layers without `source`. Defaults to theme-colored fill, outline, line and circle layers
1661
+ - `before?: string` — Insert the layers below this layer id (e.g. under the style's labels)
1662
+ - `interactive?: boolean = false` — Show a pointer over its features (set it when you handle `click`)
1663
+ - `sourceOptions?: Partial<Omit<maplibregl.GeoJSONSourceSpecification, "type" | "data">>` — More options for the GeoJSON source (`cluster`, `promoteId`, `tolerance`…)
1664
+
1665
+ Events:
1666
+ - `click(event: maplibregl.MapLayerMouseEvent)` — A click on one of its features (MapLibre's `MapLayerMouseEvent`: `e.features` holds them)
1667
+
1668
+ Exposed (template ref):
1669
+ - `sourceId: string` — The source's id
1670
+ - `layerIds: () => string[]` — The ids of its layers on the map
1671
+
1672
+ ```ts
1673
+ /** A layer of `MMapGeoJson`: any MapLibre layer without its `source` (and `id`, made up when left out). */
1674
+ export type MapGeoJsonLayer = DistributiveOmit<Exclude<Maplibre.LayerSpecification, Maplibre.BackgroundLayerSpecification>, 'id' | 'source'> & { id?: string }
1675
+ ```
1676
+
1677
+ ### MMapHover
1678
+
1679
+ Import from `@m3ui-vue/m3ui-vue/map`.
1680
+
1681
+ 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.
1682
+
1683
+ Props:
1684
+ - `modelValue?: boolean = false` (v-model) — On (v-model)
1685
+ - `control?: boolean | MapControlPosition = true` — Its on/off button: `false`, or a corner (`true` is top-right)
1686
+
1687
+ Events:
1688
+ - `update:modelValue(on: boolean)` — Turned on or off with its button
1689
+
1690
+ ### MMapIdentify
1691
+
1692
+ Import from `@m3ui-vue/m3ui-vue/map`.
1693
+
1694
+ 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.
1695
+
1696
+ Props:
1697
+ - `enabled?: boolean = true` — Listen to clicks. It also pauses by itself while another tool owns them (`MMapMeasure` measuring)
1698
+ - `popup?: boolean = true` — Show the results in a popup at the click
1699
+ - `marker?: boolean = true` — Mark where the user clicked while there are results
1700
+
1701
+ Events:
1702
+ - `identify(results: MapIdentifyResult[], lngLat: [number, number])` — The user clicked the map: what was found there (empty when nothing) and where (`[lng, lat]`)
1703
+
1704
+ Slots:
1705
+ - `#default { results: MapIdentifyResult[]; lngLat: [number, number]; close: () => void; }` — The popup's content instead of `MMapFeatureInfo` (scope: `{ results, lngLat, close }`)
1706
+
1707
+ Exposed (template ref):
1708
+ - `close: () => void`
1709
+
1710
+ ### MMapLayers
1711
+
1712
+ Import from `@m3ui-vue/m3ui-vue/map`.
1713
+
1714
+ 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.
1715
+
1716
+ Props:
1717
+ - `search?: boolean = true` — Show the search field
1718
+ - `collapsed?: boolean = false` — Groups start collapsed
1719
+
1720
+ Slots:
1721
+ - `#actions { layer: MapLayerInfo; visible: boolean; }` — Extra actions in an expanded layer (scope: `{ layer, visible }`)
1722
+
1723
+ ### MMapMarker
1724
+
1725
+ Import from `@m3ui-vue/m3ui-vue/map`.
1726
+
1727
+ 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.
1728
+
1729
+ Props:
1730
+ - `lngLat: [number, number]` (v-model:lngLat) — Position, `[lng, lat]` (v-model with `draggable`)
1731
+ - `color?: string` — The pin's color (any CSS color). Defaults to the theme's primary; ignored with custom content
1732
+ - `draggable?: boolean = false` — Let the user drag it
1733
+ - `anchor?: maplibregl.PositionAnchor` — Which part of the marker sits on `lngLat`. Defaults to `bottom` for the pin, `center` for custom content
1734
+ - `offset?: [number, number]` — Offset in pixels, `[x, y]`
1735
+ - `rotation?: number = 0` — Rotation in degrees
1736
+
1737
+ Events:
1738
+ - `click(event: MouseEvent)` — The marker was clicked
1739
+ - `update:lngLat(lngLat: [number, number])` — Dragged to a new position (`draggable`): `[lng, lat]`
1740
+
1741
+ Slots:
1742
+ - `#default` — The marker itself, instead of the pin (any element, anchored by `anchor`)
1743
+ - `#popup` — Content of a popup that opens when the marker is clicked
1744
+
1745
+ Exposed (template ref):
1746
+ - `marker: () => maplibregl.Marker | undefined` — The MapLibre marker
1747
+
1748
+ ### MMapMeasure
1749
+
1750
+ Import from `@m3ui-vue/m3ui-vue/map`.
1751
+
1752
+ 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.
1753
+
1754
+ Props:
1755
+ - `modelValue?: Mode | null = null` (v-model) — The measuring mode (v-model): `'distance'`, `'area'`, or null. Set it to start measuring from outside
1756
+ - `control?: boolean | MapControlPosition = true` — Its buttons: `false` (drive it with v-model), or a corner (`true` is top-right)
1757
+
1758
+ Events:
1759
+ - `update:modelValue(mode: Mode | null)` — The measuring mode changed (`'distance'`, `'area'`, or null when it finished)
1760
+ - `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²
1761
+
1762
+ Exposed (template ref):
1763
+ - `start: (next: Mode) => void`
1764
+ - `finish: (byEscape?: boolean) => void`
1765
+ - `clear: () => void`
1766
+ - `remove: (index: number) => void`
1767
+
1768
+ ```ts
1769
+ type Mode = 'distance' | 'area'
1770
+ ```
1771
+
1772
+ ### MMapPopup
1773
+
1774
+ Import from `@m3ui-vue/m3ui-vue/map`.
1775
+
1776
+ 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.
1777
+
1778
+ Props:
1779
+ - `lngLat: [number, number]` — Position, `[lng, lat]`
1780
+ - `open?: boolean = true` (v-model:open) — Shown (v-model)
1781
+ - `closeButton?: boolean = true` — Show a close button
1782
+ - `closeOnClick?: boolean = true` — Close it when the map is clicked
1783
+ - `anchor?: maplibregl.PositionAnchor` — Where the popup sits relative to `lngLat`. By default MapLibre picks the side with room
1784
+ - `offset?: number = 8` — Offset in pixels from `lngLat`
1785
+ - `maxWidth?: string = "320px"` — Maximum width (CSS)
1786
+
1787
+ Events:
1788
+ - `update:open(open: boolean)` — Closed by its close button or a click on the map (`closeOnClick`)
1789
+
1790
+ Slots:
1791
+ - `#default` — The popup's content
1792
+
1793
+ Exposed (template ref):
1794
+ - `popup: () => maplibregl.Popup | undefined` — The MapLibre popup
1795
+
1796
+ ### MMapSearch
1797
+
1798
+ Import from `@m3ui-vue/m3ui-vue/map`.
1799
+
1800
+ 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.
1801
+
1802
+ Props:
1803
+ - `provider?: MapSearchProvider` — Where to search: `nominatimProvider(options)` by default, or your own function
1804
+ - `position?: MapControlPosition = "top-left"` — The corner
1805
+ - `placeholder?: string` — The field's placeholder (the locale's "Search places" by default)
1806
+ - `zoom?: number = 17` — The zoom to fly to for a result without an extent
1807
+ - `marker?: boolean = true` — Mark the picked result
1808
+ - `instant?: boolean = false` — Search while typing (debounced), for providers that allow it; Nominatim's public server doesn't
1809
+
1810
+ Events:
1811
+ - `select(result: MapSearchResult)` — A result was picked
1812
+
1560
1813
  ### MMarkdown
1561
1814
 
1562
1815
  Import from `@m3ui-vue/m3ui-vue/markdown`.
@@ -1585,7 +1838,7 @@ Props:
1585
1838
  - `leadingIcon?: string` — Material Symbol icon
1586
1839
  - `clearable?: boolean = false` — Show clear button
1587
1840
  - `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
1588
- - `debounce?: number = 0` — Delay (ms) before firing the
1841
+ - `debounce?: number = 0` — Delay (ms) before firing the @debounced event
1589
1842
 
1590
1843
  Events:
1591
1844
  - `update:modelValue(string)` — Emitted on every keystroke — powers v-model
@@ -1678,7 +1931,7 @@ Props:
1678
1931
  - `maxChips?: number = 3` — Max visible chips before "+N"
1679
1932
  - `noResultsText?: string` — Text when no options match
1680
1933
  - `hideSelected?: boolean = false` — Remove already-selected options from the dropdown
1681
- - `debounce?: number = 0` — Delay (ms) before filtering and firing
1934
+ - `debounce?: number = 0` — Delay (ms) before filtering and firing @debounced. Selection is always instant
1682
1935
 
1683
1936
  Events:
1684
1937
  - `update:modelValue(unknown[])` — Emitted on selection change — powers v-model
@@ -1881,7 +2134,7 @@ Props:
1881
2134
  - `leadingIcon?: string` — Material Symbol icon
1882
2135
  - `stepper?: boolean = true` — Show +/- buttons
1883
2136
  - `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
1884
- - `debounce?: number = 0` — Delay (ms) before firing the
2137
+ - `debounce?: number = 0` — Delay (ms) before firing the @debounced event
1885
2138
 
1886
2139
  Events:
1887
2140
  - `update:modelValue(number | null)` — Emitted on every change — typing, stepper clicks, or arrow keys — powers v-model
@@ -1976,7 +2229,7 @@ Props:
1976
2229
  Wraps its own scrollable container and fires a refresh event when the user pulls past a threshold at the very top of the scroll.
1977
2230
 
1978
2231
  Props:
1979
- - `refreshing?: boolean = false` — Controlled loading state — set it to true in your
2232
+ - `refreshing?: boolean = false` — Controlled loading state — set it to true in your @refresh handler and back to false once the fetch resolves; the indicator settles and releases accordingly, same pattern as MInfiniteScroll's loading prop
1980
2233
  - `disabled?: boolean = false` — Disables the pull gesture
1981
2234
  - `threshold?: number = 64` — Pull distance in px required to trigger a refresh on release
1982
2235
  - `size?: number = 36` — Indicator size in px
@@ -2233,7 +2486,7 @@ Slots:
2233
2486
 
2234
2487
  ### MSearchBar
2235
2488
 
2236
- A collapsed search field that expands into a docked panel or a fullscreen overlay, with results shown below the input.
2489
+ A collapsed search field that expands into a docked panel or a fullscreen overlay, with results shown below the input. The expanded panel is teleported to `<body>`; `class`, `style` and other attributes you pass land on the collapsed bar. So with a fullscreen variant you can hide the bar (e.g. `class="hidden"` on phones) and open search from your own icon button through `v-model:expanded`. The docked panel is placed under the bar, so it needs the bar visible.
2237
2490
 
2238
2491
  Props:
2239
2492
  - `modelValue?: string = ""` (v-model) — Search query (v-model)
@@ -2334,12 +2587,12 @@ export interface SelectOption {
2334
2587
  A canvas container for hand-written shaders. Give it a GLSL fragment shader (Shadertoy-style — it runs on WebGL2 and works everywhere) and, optionally, a WGSL fragment shader that runs on WebGPU when the browser supports it. `renderer="auto"` picks WebGPU whenever both a `wgsl` source and browser support are present, otherwise it falls back to WebGL2 — so the same component works as a drop-in on old and new browsers alike.
2335
2588
 
2336
2589
  Props:
2337
- - `code: string` — GLSL fragment shader body (Shadertoy-style): must define `mainImage(out vec4 fragColor, in vec2 fragCoord)`. Runs on WebGL2. Always required as the compatible baseline.
2338
- - `wgsl?: string` — Optional WGSL fragment shader module, e.g. `@fragment fn fs_main(@builtin(position) pos: vec4f) ->
2590
+ - `code: string` — GLSL fragment shader body (Shadertoy-style): must define `mainImage(out vec4 fragColor, in vec2 fragCoord)`. Runs on WebGL2. Always required as the compatible baseline. Don't write the `#version`, the precision or any uniform: the component puts them in front of your code, with Shadertoy's `iTime` (seconds, stops while paused), `iResolution` (canvas size in device pixels), `iMouse` and `iFrame`, plus one per `uniforms` key.
2591
+ - `wgsl?: string` — Optional WGSL fragment shader module, e.g. `@fragment fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f`. Runs on WebGPU when available. Must declare its own bindings — see docs for the required uniform buffer layout.
2339
2592
  - `renderer?: ShaderRenderer = "auto"` — Which backend to use. 'auto' picks WebGPU when `wgsl` is set and supported, else WebGL2.
2340
- - `uniforms?: Record<string, number | number[]>` — Custom uniforms. Keys/shape are locked in at mount time; only values are reactive per frame.
2593
+ - `uniforms?: Record<string, number | number[]>` — Custom uniforms, read every frame. In GLSL each key is declared for you, as a `float` for a number or a `vec2`–`vec4` for an array; in WGSL they're binding 1, one `vec4f` per key in this order. Keys and shapes are fixed when the shader compiles (on mount, or when `code`/`wgsl`/`renderer` change); values can change freely, e.g. to drive the shader from your own clock instead of `iTime`.
2341
2594
  - `paused?: boolean` — Freezes the render loop and the shader clock
2342
- - `pixelRatio?: number` — Device pixel ratio to render at. Defaults to devicePixelRatio, capped at 2 for performance.
2595
+ - `pixelRatio?: number` — Device pixels per CSS pixel to render at. Defaults to devicePixelRatio, capped at 2 for performance. Lower it to render fewer pixels (a "quality" setting); the canvas is resized when it changes.
2343
2596
 
2344
2597
  Events:
2345
2598
  - `error(message: string)` — Emitted on a shader compile/link error, or a WebGPU runtime error
@@ -2844,7 +3097,7 @@ Props:
2844
3097
  - `maxTags?: number` — Max number of tags allowed
2845
3098
  - `duplicates?: boolean = false` — Allow duplicate tags
2846
3099
  - `clearable?: boolean = false` — Show a clear-all button
2847
- - `debounce?: number = 0` — Delay (ms) before firing the
3100
+ - `debounce?: number = 0` — Delay (ms) before firing the @debounced event
2848
3101
 
2849
3102
  Events:
2850
3103
  - `update:modelValue(string[])` — Emitted whenever a tag is added or removed — powers v-model
@@ -2917,7 +3170,7 @@ Props:
2917
3170
  - `leadingIcon?: string` — Material Symbol shown before the input
2918
3171
  - `clearable?: boolean = false` — Show a clear button when the field has a value
2919
3172
  - `fieldBg?: string` — Overrides the auto-detected background color used to cut the floating label out of the outlined border
2920
- - `debounce?: number = 0` — Delay (ms) before firing the
3173
+ - `debounce?: number = 0` — Delay (ms) before firing the @debounced event. v-model always updates immediately
2921
3174
 
2922
3175
  Events:
2923
3176
  - `update:modelValue(string)` — Emitted on every keystroke — powers v-model
@@ -3296,6 +3549,121 @@ Exposed (template ref):
3296
3549
 
3297
3550
  ## Composables and functions
3298
3551
 
3552
+ ### useMap
3553
+
3554
+ Import from `@m3ui-vue/m3ui-vue/map`.
3555
+
3556
+ 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)) ```
3557
+
3558
+ ```ts
3559
+ useMap(): {
3560
+ map: ComputedRef<Map$1 | undefined>
3561
+ 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>
3562
+ styleVersion: ComputedRef<number>
3563
+ activeTool: Ref<string | null>
3564
+ onReady: (fn: (map: Maplibre.Map, maplibre: MaplibreModule) => void) => void
3565
+ on: (type: T, listener: (e: Maplibre.MapEventType[T] & object) => void) => void
3566
+ onLayer: (type: T, layerId: string, listener: (e: Maplibre.MapLayerEventType[T] & object) => void) => void
3567
+ }
3568
+ ```
3569
+
3570
+ ### useMapLayers
3571
+
3572
+ Import from `@m3ui-vue/m3ui-vue/map`.
3573
+
3574
+ 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.
3575
+
3576
+ ```ts
3577
+ useMapLayers(): {
3578
+ model: ComputedRef<MapLayerModel | undefined>
3579
+ layers: ComputedRef<MapLayerInfo[]>
3580
+ isVisible: (id: string) => boolean
3581
+ setVisible: (id: string, visible: boolean) => void
3582
+ toggle: (id: string) => void
3583
+ opacityOf: (id: string) => number
3584
+ setOpacity: (id: string, opacity: number) => void
3585
+ layersOf: (group: string | null) => MapLayerInfo[]
3586
+ groupState: (group: string) => "visible" | "hidden" | "partial"
3587
+ setGroupVisible: (group: string, visible: boolean) => void
3588
+ baseLayers: ComputedRef<MapLayerInfo[]>
3589
+ baseLayer: ComputedRef<string | null>
3590
+ setBaseLayer: (id: string | null) => void
3591
+ }
3592
+ ```
3593
+
3594
+ ### genericAdapter
3595
+
3596
+ Import from `@m3ui-vue/m3ui-vue/map`.
3597
+
3598
+ 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.
3599
+
3600
+ ```ts
3601
+ genericAdapter(style: Maplibre.StyleSpecification, context: MapAdapterContext): MapLayerModel
3602
+ ```
3603
+
3604
+ ### orvianAdapter
3605
+
3606
+ Import from `@m3ui-vue/m3ui-vue/map`.
3607
+
3608
+ 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).
3609
+
3610
+ ```ts
3611
+ orvianAdapter(options: OrvianAdapterOptions = {}): MapAdapter
3612
+ ```
3613
+
3614
+ ### identifyFeatures
3615
+
3616
+ Import from `@m3ui-vue/m3ui-vue/map`.
3617
+
3618
+ 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.
3619
+
3620
+ ```ts
3621
+ identifyFeatures(map: Maplibre.Map, point: Maplibre.PointLike, model: MapLayerModel | undefined): MapIdentifyResult[]
3622
+ ```
3623
+
3624
+ ### formatFieldValue
3625
+
3626
+ Import from `@m3ui-vue/m3ui-vue/map`.
3627
+
3628
+ A property's value as text: numbers through `mask` (in the page's language, `<html lang>`), then `prefix` and `suffix`. Empty values give ''.
3629
+
3630
+ ```ts
3631
+ formatFieldValue(raw: unknown, format?: MapFieldFormat): string
3632
+ ```
3633
+
3634
+ ### fieldLabel
3635
+
3636
+ Import from `@m3ui-vue/m3ui-vue/map`.
3637
+
3638
+ A property's label: its format's, or the key with a capital first letter.
3639
+
3640
+ ```ts
3641
+ fieldLabel(key: string, format?: MapFieldFormat): string
3642
+ ```
3643
+
3644
+ ### useMapFilter
3645
+
3646
+ Import from `@m3ui-vue/m3ui-vue/map`.
3647
+
3648
+ 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…).
3649
+
3650
+ ```ts
3651
+ useMapFilter(): {
3652
+ setFilter: (layerId: string, filter: Maplibre.FilterSpecification | null) => void
3653
+ valuesOf: (layerId: string, property: string) => (string | number)[]
3654
+ }
3655
+ ```
3656
+
3657
+ ### nominatimProvider
3658
+
3659
+ Import from `@m3ui-vue/m3ui-vue/map`.
3660
+
3661
+ OpenStreetMap's Nominatim geocoder. Its public server allows one search per second and no search-as-you-type: `MMapSearch` searches on Enter.
3662
+
3663
+ ```ts
3664
+ nominatimProvider(options: NominatimOptions = {}): MapSearchProvider
3665
+ ```
3666
+
3299
3667
  ### shapeNames
3300
3668
 
3301
3669
  ```ts
@@ -3325,11 +3693,11 @@ useTheme(): {
3325
3693
  useColorPalette(): {
3326
3694
  palette: Ref<string>
3327
3695
  palettes: Palette[]
3328
- set: (id: string) => void
3696
+ set: (id: PaletteId | (string & {})) => void
3329
3697
  seed: Readonly<Ref<{ readonly seed: string; readonly variant?: SchemeVariant; readonly contrast?: number; } | null>>
3330
3698
  setSeed: (seed: string, options?: SeedOptions) => Promise<void>
3331
3699
  contrast: Readonly<Ref<ContrastLevel>>
3332
- activeContrast: ComputedRef<Exclude<ContrastLevel, 'system'>>
3700
+ activeContrast: Ref<"standard" | "medium" | "high">
3333
3701
  setContrast: (level: ContrastLevel) => void
3334
3702
  persistPalette: Ref<boolean>
3335
3703
  setPersistPalette: (enabled: boolean) => void
@@ -3338,6 +3706,8 @@ useColorPalette(): {
3338
3706
 
3339
3707
  ### palettes
3340
3708
 
3709
+ Every palette: the built-in ones, plus `createM3UI({ customPalettes })`.
3710
+
3341
3711
  ```ts
3342
3712
  palettes: Palette[]
3343
3713
  ```
@@ -3350,6 +3720,14 @@ The palette id used while a seed color is active (`useColorPalette().setSeed()`)
3350
3720
  SEED_PALETTE: "seed"
3351
3721
  ```
3352
3722
 
3723
+ ### themeInitScript
3724
+
3725
+ 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' }) }] }) ```
3726
+
3727
+ ```ts
3728
+ themeInitScript(options: ThemeInitOptions = {}): string
3729
+ ```
3730
+
3353
3731
  ### generateScheme
3354
3732
 
3355
3733
  Generates the light and dark schemes for a seed color (`#rrggbb`).
@@ -3573,9 +3951,167 @@ skinTones: readonly ["🏻", "🏼", "🏽", "🏾", "🏿"]
3573
3951
 
3574
3952
  ## Types
3575
3953
 
3954
+ ```ts
3955
+ /** What `MMap` provides to everything inside it. */
3956
+ export interface MapContext {
3957
+ /** The MapLibre map, once created (never on the server) */
3958
+ map: ShallowRef<Maplibre.Map | undefined>
3959
+ /** The `maplibre-gl` module, loaded with the map (so nothing imports it on the server) */
3960
+ maplibre: ShallowRef<MaplibreModule | undefined>
3961
+ /** Bumped on every `style.load`: sources and layers added by components are re-added after a style change */
3962
+ styleVersion: Ref<number>
3963
+ /** The style as `MMap`'s `adapter` reads it (undefined without one) */
3964
+ model: ShallowRef<MapLayerModel | undefined>
3965
+ /** Visibility and opacity of the model's layers */
3966
+ layerState: MapLayerState
3967
+ /**
3968
+ * The tool that owns the map's clicks right now (`'measure'` while measuring), or null: `MMapIdentify` stays quiet
3969
+ * meanwhile. Set it from tools of your own the same way
3970
+ */
3971
+ activeTool: Ref<string | null>
3972
+ }
3973
+ ```
3974
+
3975
+ ```ts
3976
+ /** The `maplibre-gl` module (its classes: `Map`, `Marker`, `Popup`…) */
3977
+ export type MaplibreModule = typeof import('maplibre-gl')
3978
+ ```
3979
+
3980
+ ```ts
3981
+ /** Visibility and opacity of the model's layers, shared by everything inside one `MMap`. */
3982
+ export interface MapLayerState {
3983
+ visible: Record<string, boolean>
3984
+ opacity: Record<string, number>
3985
+ }
3986
+ ```
3987
+
3988
+ ```ts
3989
+ /** Reads a style's conventions (usually its `metadata`) into the model the map's UI components use. */
3990
+ export type MapAdapter = (style: Maplibre.StyleSpecification, context: MapAdapterContext) => MapLayerModel
3991
+ ```
3992
+
3993
+ ```ts
3994
+ /** What an adapter gets besides the style. */
3995
+ export interface MapAdapterContext {
3996
+ /** The style's URL, when `MMap`'s `mapStyle` is one */
3997
+ styleUrl?: string
3998
+ }
3999
+ ```
4000
+
4001
+ ```ts
4002
+ /** How to show one property of a feature. */
4003
+ export interface MapFieldFormat {
4004
+ /** The label (the key, capitalized, by default) */
4005
+ label?: string
4006
+ /** Text before the value */
4007
+ prefix?: string
4008
+ /** Text after the value */
4009
+ suffix?: string
4010
+ /** A number mask: its decimals set the fraction digits (`#.00` → 2) and a comma turns on grouping (`#,###`) */
4011
+ mask?: string
4012
+ /** Leave it out */
4013
+ hidden?: boolean
4014
+ }
4015
+ ```
4016
+
4017
+ ```ts
4018
+ /** What `MMapIdentify` found on one layer at a point. */
4019
+ export interface MapIdentifyResult {
4020
+ layer: MapLayerInfo
4021
+ feature: Maplibre.MapGeoJSONFeature
4022
+ /** Its properties as the layer's `identify` shows them, formatted */
4023
+ fields: { key: string; label: string; value: string }[]
4024
+ }
4025
+ ```
4026
+
4027
+ ```ts
4028
+ /** One layer of the style, as the map's UI components see it. */
4029
+ export interface MapLayerInfo {
4030
+ /** The style layer's id */
4031
+ id: string
4032
+ /** Its name in the UI */
4033
+ title: string
4034
+ description?: string
4035
+ /** The `name` of its group in `MapLayerModel.groups` */
4036
+ group?: string
4037
+ /** Shown in `MMapLayers` */
4038
+ listed: boolean
4039
+ /** A base layer: `MMapBaseLayers` shows one of them at a time, with this thumbnail */
4040
+ base?: { image?: string }
4041
+ /** Layer ids shown, hidden and faded along with it */
4042
+ children: string[]
4043
+ /** Listed by `MMapIdentify` on click: every property, formatted by `format`, minus `exclude` */
4044
+ identify: false | { format: Record<string, MapFieldFormat>; exclude: string[] }
4045
+ /** Shown by `MMapHover` under the pointer: these properties, in order */
4046
+ hover: false | { fields: (MapFieldFormat & { key: string })[] }
4047
+ /** A legend image URL (an SVG, typically) */
4048
+ legend?: string
4049
+ /** A download URL for its data */
4050
+ download?: string
4051
+ }
4052
+ ```
4053
+
4054
+ ```ts
4055
+ /** The style as the map's UI components see it: layers with names, groups, base layers, what to identify. */
4056
+ export interface MapLayerModel {
4057
+ /** The style's name */
4058
+ title?: string
4059
+ /** Groups, in order */
4060
+ groups: { name: string; title: string }[]
4061
+ /** Layers, in the style's order (bottom to top) */
4062
+ layers: MapLayerInfo[]
4063
+ }
4064
+ ```
4065
+
4066
+ ```ts
4067
+ export interface OrvianAdapterOptions {
4068
+ /**
4069
+ * A layer's legend image. By default, for a style served by mvt-rs (`…/services/styles/<style>`), its legend service
4070
+ * (`…/services/legends/<style>?layer_id=<id>`), unless the layer's `metadata.legend.show` is false;
4071
+ * `metadata.legend.wmslegend` overrides it
4072
+ */
4073
+ legend?: (layer: Maplibre.LayerSpecification, styleUrl?: string) => string | undefined
4074
+ }
4075
+ ```
4076
+
4077
+ ```ts
4078
+ /** Finds places for `MMapSearch`: the text in, results out. `signal` aborts a search the user replaced. */
4079
+ export type MapSearchProvider = (query: string, signal: AbortSignal) => Promise<MapSearchResult[]>
4080
+ ```
4081
+
4082
+ ```ts
4083
+ /** A place found by a `MapSearchProvider`. */
4084
+ export interface MapSearchResult {
4085
+ /** What to show */
4086
+ label: string
4087
+ /** Where it is */
4088
+ lngLat: [number, number]
4089
+ /** Its extent, `[west, south, east, north]`: the map fits it instead of zooming to the point */
4090
+ bbox?: [number, number, number, number]
4091
+ /** Its kind (`city`, `road`, `park`, `restaurant`…), for the icon */
4092
+ type?: string
4093
+ }
4094
+ ```
4095
+
4096
+ ```ts
4097
+ export interface NominatimOptions {
4098
+ /** The Nominatim server (`https://nominatim.openstreetmap.org` by default; mind its usage policy, or run your own) */
4099
+ url?: string
4100
+ /** How many results (6) */
4101
+ limit?: number
4102
+ /** The results' language (`es`, `en`…); by default the page's (`<html lang>`) */
4103
+ language?: string
4104
+ /** Only these countries (ISO codes: `['ar']`) */
4105
+ countryCodes?: string[]
4106
+ /** Prefer (or with `bounded`, only) this area: `[west, south, east, north]` */
4107
+ viewbox?: [number, number, number, number]
4108
+ bounded?: boolean
4109
+ }
4110
+ ```
4111
+
3576
4112
  ```ts
3577
4113
  export interface M3UIOptions {
3578
- palette?: string
4114
+ palette?: PaletteId | (string & {})
3579
4115
  /**
3580
4116
  * Set to `false` to make `palette` a hard default that always wins on boot, ignoring
3581
4117
  * whatever is already stored in localStorage, and to stop future `useColorPalette().set()`
@@ -3616,6 +4152,39 @@ export interface M3UIOptions {
3616
4152
  * mode (they keep their own dark bar); installed apps (PWA) still get it.
3617
4153
  */
3618
4154
  themeColor?: 'surface' | 'surface-container' | 'primary' | (string & {})
4155
+ /**
4156
+ * Server-side rendering: tells the components whether the app is still hydrating the server's HTML (Nuxt's
4157
+ * `() => nuxtApp.isHydrating`, which `@m3ui-vue/nuxt` passes). The adaptive layouts (`MNavigationSuite`,
4158
+ * `MListDetail`, `MSupportingPane`) and `useWindowSizeClass()` then render their first frame at the server's size
4159
+ * (compact: it has no window) so it matches the HTML, and adapt once mounted.
4160
+ */
4161
+ isHydrating?: () => boolean
4162
+ /**
4163
+ * Also keep the theme, the palette and the contrast level in cookies (`m3-theme`, `m3-palette`, `m3-contrast`,
4164
+ * a year, `SameSite=Lax`), and the window's size (`m3-viewport`, `<width>x<height>`), so a server can read them
4165
+ * and render with the user's choice and for their screen through `initialState`.
4166
+ */
4167
+ cookies?: boolean
4168
+ /**
4169
+ * Server-side rendering: the user's theme, palette and contrast as the server knows them (from the cookies that
4170
+ * `cookies` writes), on the server and on the client alike. `useTheme()` and `useColorPalette()` report them on
4171
+ * the server, and on the client while hydrating (with `isHydrating`), so what's rendered from them matches the
4172
+ * server's HTML. What's missing falls back to this plugin's defaults, like a first visit. With `viewport`, the
4173
+ * adaptive layouts (`MNavigationSuite`, `MListDetail`, `MSupportingPane`) and `useWindowSizeClass()` render for
4174
+ * that window size instead of compact.
4175
+ */
4176
+ initialState?: M3InitialState
4177
+ }
4178
+ ```
4179
+
4180
+ ```ts
4181
+ /** The user's theme choices as a server knows them (from cookies), for server-side rendering. */
4182
+ export interface M3InitialState {
4183
+ theme?: Theme
4184
+ palette?: string
4185
+ contrast?: ContrastLevel
4186
+ /** The browser window's size: the adaptive layouts and `useWindowSizeClass()` render for it instead of compact. */
4187
+ viewport?: { width: number; height: number }
3619
4188
  }
3620
4189
  ```
3621
4190
 
@@ -3635,6 +4204,11 @@ export interface Palette {
3635
4204
  }
3636
4205
  ```
3637
4206
 
4207
+ ```ts
4208
+ /** The id of a palette that ships with the library (`palettes.css`, plus the `purple` baseline). */
4209
+ export type PaletteId = (typeof builtInPalettes)[number]['id']
4210
+ ```
4211
+
3638
4212
  ```ts
3639
4213
  export interface ActiveSeed extends SeedOptions {
3640
4214
  seed: string
@@ -3650,6 +4224,17 @@ export interface ActiveSeed extends SeedOptions {
3650
4224
  export type ContrastLevel = 'standard' | 'medium' | 'high' | 'system'
3651
4225
  ```
3652
4226
 
4227
+ ```ts
4228
+ export interface ThemeInitOptions {
4229
+ /** `createM3UI`'s `palette`: the first-visit default, or forced with `persistPalette: false`. */
4230
+ palette?: PaletteId | (string & {})
4231
+ /** `createM3UI`'s `contrast`, with the same rules as `palette`. */
4232
+ contrast?: ContrastLevel
4233
+ /** `createM3UI`'s `persistPalette`. */
4234
+ persistPalette?: boolean
4235
+ }
4236
+ ```
4237
+
3653
4238
  ```ts
3654
4239
  // Dynamic color: a full M3 color scheme (light and dark) generated from one seed color with Google's
3655
4240
  // material-color-utilities (HCT, DynamicScheme). The package is loaded with a dynamic import, so apps that
@@ -3911,6 +4496,37 @@ export interface M3Locale {
3911
4496
  nextPage: string
3912
4497
  carousel: string
3913
4498
  carouselItem: string
4499
+ // MMap (maplibre controls)
4500
+ mapTitle: string
4501
+ mapMarker: string
4502
+ mapZoomIn: string
4503
+ mapZoomOut: string
4504
+ mapResetBearing: string
4505
+ mapFindMyLocation: string
4506
+ mapLocationNotAvailable: string
4507
+ mapEnterFullscreen: string
4508
+ mapExitFullscreen: string
4509
+ mapToggleAttribution: string
4510
+ mapFeedback: string
4511
+ mapCtrlScroll: string
4512
+ mapCmdScroll: string
4513
+ mapTwoFingers: string
4514
+ mapLayers: string
4515
+ mapSearchLayers: string
4516
+ mapNoLayers: string
4517
+ mapShowLayer: string
4518
+ mapHideLayer: string
4519
+ mapOpacity: string
4520
+ mapDownload: string
4521
+ mapNoBaseLayer: string
4522
+ mapHoverInfo: string
4523
+ mapNoValue: string
4524
+ mapMeasureDistance: string
4525
+ mapMeasureArea: string
4526
+ mapClearMeasurements: string
4527
+ mapDeleteMeasurement: string
4528
+ mapTotal: string
4529
+ mapSearchPlaces: string
3914
4530
  }
3915
4531
  ```
3916
4532
 
@@ -4013,7 +4629,7 @@ export interface EmojiCategory {
4013
4629
  `M3Locale` keys (pass a partial object to `createM3UI({ locale })`; presets from `@m3ui-vue/m3ui-vue/locales`:
4014
4630
  `esLocale`, `frLocale`, `ptLocale`, `deLocale`, `jaLocale`, `zhLocale`, `koLocale`):
4015
4631
 
4016
- 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
4632
+ 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, 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
4017
4633
 
4018
4634
  ## Theme tokens
4019
4635