@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.
- package/dist/API.md +666 -12
- package/dist/MMenuItem-BOkcVtEe.js +809 -0
- package/dist/MMenuItem-BOkcVtEe.js.map +1 -0
- package/dist/MSlider-BXsBv0ox.js +1402 -0
- package/dist/MSlider-BXsBv0ox.js.map +1 -0
- package/dist/MTextField-rML9jnXs.js +671 -0
- package/dist/MTextField-rML9jnXs.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MBottomSheet.vue.d.ts +20 -1
- package/dist/components/MDialog.vue.d.ts +17 -8
- package/dist/components/MDragDropList.vue.d.ts +1 -1
- package/dist/components/MIconButton.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +74 -0
- package/dist/components/MMapBaseLayers.vue.d.ts +15 -0
- package/dist/components/MMapControl.vue.d.ts +40 -0
- package/dist/components/MMapFeatureInfo.vue.d.ts +25 -0
- package/dist/components/MMapFilter.vue.d.ts +19 -0
- package/dist/components/MMapGeoJson.vue.d.ts +34 -0
- package/dist/components/MMapHover.vue.d.ts +17 -0
- package/dist/components/MMapIdentify.vue.d.ts +37 -0
- package/dist/components/MMapLayers.vue.d.ts +31 -0
- package/dist/components/MMapMarker.vue.d.ts +45 -0
- package/dist/components/MMapMeasure.vue.d.ts +43 -0
- package/dist/components/MMapPopup.vue.d.ts +45 -0
- package/dist/components/MMapSearch.vue.d.ts +28 -0
- package/dist/components/MMenuItem.vue.d.ts +2 -2
- package/dist/components/MSeekBar.vue.d.ts +122 -0
- package/dist/components/MSplitButton.vue.d.ts +2 -2
- package/dist/components/_MMapAttribution.vue.d.ts +7 -0
- package/dist/components/_MMapLayerItem.vue.d.ts +25 -0
- package/dist/composables/_mapGeometry.d.ts +13 -0
- package/dist/composables/_mapPin.d.ts +5 -0
- package/dist/composables/_popupPosition.d.ts +12 -0
- package/dist/composables/_ssrState.d.ts +30 -0
- package/dist/composables/_storageKeys.d.ts +3 -0
- package/dist/composables/_useCalendarMonth.d.ts +24 -0
- package/dist/composables/_useEscapeStack.d.ts +3 -0
- package/dist/composables/_useScrollLock.d.ts +8 -0
- package/dist/composables/_useSheetMotion.d.ts +16 -1
- package/dist/composables/_useThemeTokens.d.ts +7 -0
- package/dist/composables/mapAdapters.d.ts +111 -0
- package/dist/composables/mapSearch.d.ts +31 -0
- package/dist/composables/themeInitScript.d.ts +4 -3
- package/dist/composables/useColorPalette.d.ts +173 -7
- package/dist/composables/useLocale.d.ts +38 -0
- package/dist/composables/useMap.d.ts +47 -0
- package/dist/composables/useMapFilter.d.ts +10 -0
- package/dist/composables/useMapLayers.d.ts +30 -0
- package/dist/composables/useTheme.d.ts +2 -1
- package/dist/index.d.ts +4 -1
- package/dist/locales/index.js +273 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7913 -8625
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +24 -0
- package/dist/map.js +2067 -0
- package/dist/map.js.map +1 -0
- package/dist/plugin.d.ts +18 -2
- package/dist/rich-text-editor.js +26 -25
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-CuvWRZ1h.js → useLocale-CqQrhWFl.js} +40 -2
- package/dist/useLocale-CqQrhWFl.js.map +1 -0
- package/package.json +11 -2
- package/src/__tests__/MDialog.test.ts +30 -0
- package/src/__tests__/MFab.test.ts +52 -6
- package/src/__tests__/MMap.test.ts +422 -0
- package/src/__tests__/MMapLayers.test.ts +257 -0
- package/src/__tests__/MMapTools.test.ts +233 -0
- package/src/__tests__/MSeekBar.test.ts +170 -0
- package/src/__tests__/MTooltip.test.ts +110 -0
- package/src/__tests__/_fakeMaplibre.ts +161 -0
- package/src/__tests__/calendarMonth.test.ts +59 -0
- package/src/__tests__/hydration.test.ts +33 -0
- package/src/__tests__/pickerModals.test.ts +128 -0
- package/src/__tests__/popupPosition.test.ts +224 -0
- package/src/__tests__/scrollLock.test.ts +110 -0
- package/src/__tests__/sheets.test.ts +158 -0
- package/src/__tests__/ssr.test.ts +63 -1
- package/src/__tests__/ssrState.test.ts +155 -0
- package/src/__tests__/themeInitScript.test.ts +18 -0
- package/src/components/MAutocomplete.vue +2 -4
- package/src/components/MBottomSheet.vue +211 -13
- package/src/components/MCommandPalette.vue +4 -6
- package/src/components/MContextMenu.vue +19 -5
- package/src/components/MDatePicker.vue +29 -70
- package/src/components/MDatePickerModal.vue +116 -172
- package/src/components/MDateRangePicker.vue +29 -51
- package/src/components/MDateRangePickerModal.vue +84 -162
- package/src/components/MDialog.vue +87 -63
- package/src/components/MFab.vue +29 -7
- package/src/components/MIconButton.vue +1 -1
- package/src/components/MLightbox.vue +12 -5
- package/src/components/MMap.vue +568 -0
- package/src/components/MMapBaseLayers.vue +67 -0
- package/src/components/MMapControl.vue +175 -0
- package/src/components/MMapFeatureInfo.vue +41 -0
- package/src/components/MMapFilter.vue +80 -0
- package/src/components/MMapGeoJson.vue +136 -0
- package/src/components/MMapHover.vue +131 -0
- package/src/components/MMapIdentify.vue +104 -0
- package/src/components/MMapLayers.vue +111 -0
- package/src/components/MMapMarker.vue +109 -0
- package/src/components/MMapMeasure.vue +452 -0
- package/src/components/MMapPopup.vue +103 -0
- package/src/components/MMapSearch.vue +162 -0
- package/src/components/MMenu.vue +31 -12
- package/src/components/MMenuItem.vue +21 -4
- package/src/components/MMultiAutocomplete.vue +2 -4
- package/src/components/MMultiSelect.vue +2 -4
- package/src/components/MNavigationDrawer.vue +2 -8
- package/src/components/MNavigationRail.vue +2 -3
- package/src/components/MSearchBar.vue +2 -5
- package/src/components/MSeekBar.vue +593 -0
- package/src/components/MSelect.vue +2 -8
- package/src/components/MSplitButton.vue +23 -7
- package/src/components/MSpotlightSearch.vue +4 -6
- package/src/components/MTimePicker.vue +23 -6
- package/src/components/MTimePickerModal.vue +213 -226
- package/src/components/MTooltip.vue +99 -3
- package/src/components/_MMapAttribution.vue +81 -0
- package/src/components/_MMapLayerItem.vue +77 -0
- package/src/composables/_mapGeometry.ts +75 -0
- package/src/composables/_mapPin.ts +25 -0
- package/src/composables/_popupPosition.ts +39 -0
- package/src/composables/_ssrState.ts +80 -0
- package/src/composables/_storageKeys.ts +6 -0
- package/src/composables/_useCalendarMonth.ts +74 -0
- package/src/composables/_useEscapeStack.ts +33 -0
- package/src/composables/_useScrollLock.ts +41 -0
- package/src/composables/_useSheetMotion.ts +82 -20
- package/src/composables/_useThemeTokens.ts +42 -0
- package/src/composables/mapAdapters.ts +208 -0
- package/src/composables/mapSearch.ts +56 -0
- package/src/composables/themeInitScript.ts +6 -4
- package/src/composables/useColorPalette.ts +23 -9
- package/src/composables/useLocale.ts +78 -0
- package/src/composables/useMap.ts +98 -0
- package/src/composables/useMapFilter.ts +45 -0
- package/src/composables/useMapLayers.ts +124 -0
- package/src/composables/useTheme.ts +8 -3
- package/src/composables/useWindowSizeClass.ts +14 -5
- package/src/index.ts +4 -1
- package/src/locales/de.ts +39 -1
- package/src/locales/es.ts +39 -1
- package/src/locales/fr.ts +39 -1
- package/src/locales/ja.ts +39 -1
- package/src/locales/ko.ts +39 -1
- package/src/locales/pt.ts +39 -1
- package/src/locales/zh.ts +39 -1
- package/src/map.ts +32 -0
- package/src/plugin.ts +54 -3
- package/dist/MTextField-BPbFeI9M.js +0 -1368
- package/dist/MTextField-BPbFeI9M.js.map +0 -1
- package/dist/useLocale-CuvWRZ1h.js.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export interface SeekBarChapter {
|
|
2
|
+
/** Where the chapter starts, in seconds */
|
|
3
|
+
start: number;
|
|
4
|
+
/** Shown in the preview while the pointer is over it */
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
10
|
+
/** Playback position in seconds (v-model) */
|
|
11
|
+
modelValue: number;
|
|
12
|
+
/** Media length in seconds; 0, NaN or Infinity (not loaded yet, a live stream) disables seeking */
|
|
13
|
+
duration: number;
|
|
14
|
+
/** How much is loaded: up to a time, or time ranges (`[[start, end], …]`, like a media element's `buffered`) */
|
|
15
|
+
buffered?: number | [number, number][];
|
|
16
|
+
/** Chapter starts, drawn as gaps in the track; their titles show in the preview */
|
|
17
|
+
chapters?: SeekBarChapter[];
|
|
18
|
+
/** The media is playing: the bar moves on its own between updates, and the wavy line waves */
|
|
19
|
+
playing?: boolean;
|
|
20
|
+
/** Playback speed, for that motion between updates */
|
|
21
|
+
playbackRate?: number;
|
|
22
|
+
/** Updates the v-model continuously while dragging (the media follows the thumb), not only on release */
|
|
23
|
+
live?: boolean;
|
|
24
|
+
/** `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 */
|
|
25
|
+
variant?: "slider" | "line" | "wavy";
|
|
26
|
+
/** Track thickness: `md` (16px, the smallest M3 slider), `sm` (8px) or `xs` (4px, over a video) */
|
|
27
|
+
size?: "xs" | "sm" | "md";
|
|
28
|
+
/** Where the elapsed and total time go */
|
|
29
|
+
time?: "below" | "sides" | "none";
|
|
30
|
+
/** The end label shows the remaining time (`-1:23`) instead of the total; clicking it switches (v-model:remaining) */
|
|
31
|
+
remaining?: boolean;
|
|
32
|
+
/** Formats a time in seconds. Default `m:ss`, or `h:mm:ss` for media an hour or longer */
|
|
33
|
+
format?: (seconds: number) => string;
|
|
34
|
+
/** Seconds the arrow keys move; Page Up/Down move 10% */
|
|
35
|
+
keyStep?: number;
|
|
36
|
+
/** Shows the time (and chapter) above the pointer while hovering or dragging */
|
|
37
|
+
preview?: boolean;
|
|
38
|
+
/** Played part and thumb: an M3 role (`primary`, `secondary`, `tertiary`, `error`) or any CSS color */
|
|
39
|
+
color?: string;
|
|
40
|
+
/** Unplayed track: an M3 role or any CSS color. Default secondary-container */
|
|
41
|
+
trackColor?: string;
|
|
42
|
+
/** The time labels' color, as a CSS color (white over a video, say). Default on-surface-variant */
|
|
43
|
+
timeColor?: string;
|
|
44
|
+
/** Disables seeking */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Accessible name. Default the locale's `seekBar` */
|
|
47
|
+
label?: string;
|
|
48
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
49
|
+
"update:modelValue": (args_0: number) => any;
|
|
50
|
+
seek: (args_0: number) => any;
|
|
51
|
+
"scrub-start": (args_0: number) => any;
|
|
52
|
+
scrub: (args_0: number) => any;
|
|
53
|
+
"update:remaining": (args_0: boolean) => any;
|
|
54
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
55
|
+
/** Playback position in seconds (v-model) */
|
|
56
|
+
modelValue: number;
|
|
57
|
+
/** Media length in seconds; 0, NaN or Infinity (not loaded yet, a live stream) disables seeking */
|
|
58
|
+
duration: number;
|
|
59
|
+
/** How much is loaded: up to a time, or time ranges (`[[start, end], …]`, like a media element's `buffered`) */
|
|
60
|
+
buffered?: number | [number, number][];
|
|
61
|
+
/** Chapter starts, drawn as gaps in the track; their titles show in the preview */
|
|
62
|
+
chapters?: SeekBarChapter[];
|
|
63
|
+
/** The media is playing: the bar moves on its own between updates, and the wavy line waves */
|
|
64
|
+
playing?: boolean;
|
|
65
|
+
/** Playback speed, for that motion between updates */
|
|
66
|
+
playbackRate?: number;
|
|
67
|
+
/** Updates the v-model continuously while dragging (the media follows the thumb), not only on release */
|
|
68
|
+
live?: boolean;
|
|
69
|
+
/** `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 */
|
|
70
|
+
variant?: "slider" | "line" | "wavy";
|
|
71
|
+
/** Track thickness: `md` (16px, the smallest M3 slider), `sm` (8px) or `xs` (4px, over a video) */
|
|
72
|
+
size?: "xs" | "sm" | "md";
|
|
73
|
+
/** Where the elapsed and total time go */
|
|
74
|
+
time?: "below" | "sides" | "none";
|
|
75
|
+
/** The end label shows the remaining time (`-1:23`) instead of the total; clicking it switches (v-model:remaining) */
|
|
76
|
+
remaining?: boolean;
|
|
77
|
+
/** Formats a time in seconds. Default `m:ss`, or `h:mm:ss` for media an hour or longer */
|
|
78
|
+
format?: (seconds: number) => string;
|
|
79
|
+
/** Seconds the arrow keys move; Page Up/Down move 10% */
|
|
80
|
+
keyStep?: number;
|
|
81
|
+
/** Shows the time (and chapter) above the pointer while hovering or dragging */
|
|
82
|
+
preview?: boolean;
|
|
83
|
+
/** Played part and thumb: an M3 role (`primary`, `secondary`, `tertiary`, `error`) or any CSS color */
|
|
84
|
+
color?: string;
|
|
85
|
+
/** Unplayed track: an M3 role or any CSS color. Default secondary-container */
|
|
86
|
+
trackColor?: string;
|
|
87
|
+
/** The time labels' color, as a CSS color (white over a video, say). Default on-surface-variant */
|
|
88
|
+
timeColor?: string;
|
|
89
|
+
/** Disables seeking */
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
/** Accessible name. Default the locale's `seekBar` */
|
|
92
|
+
label?: string;
|
|
93
|
+
}> & Readonly<{
|
|
94
|
+
"onUpdate:modelValue"?: ((args_0: number) => any) | undefined;
|
|
95
|
+
onSeek?: ((args_0: number) => any) | undefined;
|
|
96
|
+
"onScrub-start"?: ((args_0: number) => any) | undefined;
|
|
97
|
+
onScrub?: ((args_0: number) => any) | undefined;
|
|
98
|
+
"onUpdate:remaining"?: ((args_0: boolean) => any) | undefined;
|
|
99
|
+
}>, {
|
|
100
|
+
color: string;
|
|
101
|
+
time: "below" | "sides" | "none";
|
|
102
|
+
size: "xs" | "sm" | "md";
|
|
103
|
+
playing: boolean;
|
|
104
|
+
variant: "slider" | "line" | "wavy";
|
|
105
|
+
disabled: boolean;
|
|
106
|
+
preview: boolean;
|
|
107
|
+
playbackRate: number;
|
|
108
|
+
live: boolean;
|
|
109
|
+
remaining: boolean;
|
|
110
|
+
keyStep: number;
|
|
111
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
112
|
+
preview?: (props: {
|
|
113
|
+
time: number;
|
|
114
|
+
formatted: string;
|
|
115
|
+
chapter: SeekBarChapter | null;
|
|
116
|
+
}) => any;
|
|
117
|
+
}>;
|
|
118
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
119
|
+
new (): {
|
|
120
|
+
$slots: S;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
@@ -22,11 +22,11 @@ type __VLS_Props = {
|
|
|
22
22
|
/** Any CSS color for the press ripple; defaults to the button's content color */
|
|
23
23
|
rippleColor?: string;
|
|
24
24
|
};
|
|
25
|
-
declare var
|
|
25
|
+
declare var __VLS_38: {
|
|
26
26
|
close: () => boolean;
|
|
27
27
|
};
|
|
28
28
|
type __VLS_Slots = {} & {
|
|
29
|
-
menu?: (props: typeof
|
|
29
|
+
menu?: (props: typeof __VLS_38) => any;
|
|
30
30
|
};
|
|
31
31
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
32
|
click: (args_0: MouseEvent) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MapControlPosition } from './MMap.vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
position: MapControlPosition;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MapLayerInfo } from '../composables/mapAdapters';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
layer: MapLayerInfo;
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_28: {
|
|
7
|
+
layer: MapLayerInfo;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
actions?: (props: typeof __VLS_28) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
"toggle-expanded": () => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
"onToggle-expanded"?: (() => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type LngLat = [number, number];
|
|
2
|
+
/** Great-circle distance between two points, in meters (haversine). */
|
|
3
|
+
export declare function distance(a: LngLat, b: LngLat): number;
|
|
4
|
+
/** The length of a path, in meters. */
|
|
5
|
+
export declare function pathLength(points: LngLat[]): number;
|
|
6
|
+
/** The point halfway along the great circle between two points. */
|
|
7
|
+
export declare function midpoint(a: LngLat, b: LngLat): LngLat;
|
|
8
|
+
/** The area of a ring (closed or not), in square meters, on the sphere (@turf/area's formula). */
|
|
9
|
+
export declare function ringArea(points: LngLat[]): number;
|
|
10
|
+
/** The ring with its first point repeated at the end. */
|
|
11
|
+
export declare function closeRing(points: LngLat[]): LngLat[];
|
|
12
|
+
/** Where to label a polygon: its area centroid (in degrees, fine at a measuring scale), or the vertices' mean. */
|
|
13
|
+
export declare function centroid(points: LngLat[]): LngLat;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as Maplibre from 'maplibre-gl';
|
|
2
|
+
/** The default pin's offset with its default (center) anchor */
|
|
3
|
+
export declare const PIN_OFFSET: [number, number];
|
|
4
|
+
/** Offsets for a popup at a pin's point, per side, as MapLibre's Marker.setPopup gives them */
|
|
5
|
+
export declare const PIN_POPUP_OFFSET: Record<Maplibre.PositionAnchor, [number, number]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Compose's MenuHorizontalMargin (8dp). */
|
|
2
|
+
export declare const POPUP_MARGIN = 8;
|
|
3
|
+
/** The first candidate start position that keeps `size` inside `viewport`, else centered or clamped. */
|
|
4
|
+
export declare function fitPopup(candidates: number[], size: number, viewport: number, margin?: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* A dropdown's left edge: aligned with the anchor's start or end edge (`align` picks which is tried first), else
|
|
7
|
+
* against the window edge on the anchor's side (MenuAnchorPosition.Below's xCandidates).
|
|
8
|
+
*/
|
|
9
|
+
export declare function dropdownX(anchor: {
|
|
10
|
+
left: number;
|
|
11
|
+
right: number;
|
|
12
|
+
}, width: number, viewport: number, align: 'start' | 'end', margin?: number): number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { Theme } from './useTheme';
|
|
3
|
+
import type { ContrastLevel } from './useColorPalette';
|
|
4
|
+
/** The user's theme choices as a server knows them (from cookies), for server-side rendering. */
|
|
5
|
+
export interface M3InitialState {
|
|
6
|
+
theme?: Theme;
|
|
7
|
+
palette?: string;
|
|
8
|
+
contrast?: ContrastLevel;
|
|
9
|
+
/** The browser window's size: the adaptive layouts and `useWindowSizeClass()` render for it instead of compact. */
|
|
10
|
+
viewport?: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** `initialState` with the plugin's defaults filled in (the viewport stays optional: there's no default for it). */
|
|
16
|
+
export type ResolvedInitialState = Required<Omit<M3InitialState, 'viewport'>> & Pick<M3InitialState, 'viewport'>;
|
|
17
|
+
export declare const M3_INITIAL_STATE_KEY: InjectionKey<ResolvedInitialState>;
|
|
18
|
+
export declare function initialState(): ResolvedInitialState | null;
|
|
19
|
+
/**
|
|
20
|
+
* What a composable reports for a stored choice. On the server: the initial state (the module-level refs are shared
|
|
21
|
+
* by every request and hold nothing there). On the client while hydrating: the initial state too, so the first
|
|
22
|
+
* render matches the server's HTML, then the live value once mounted. Otherwise the live ref itself.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ssrValue<T>(live: Ref<T>, initial: T | undefined): Ref<T>;
|
|
25
|
+
export declare function enableCookies(): void;
|
|
26
|
+
/** Keeps the window's size in a cookie, for the server to render the adaptive layouts at it. */
|
|
27
|
+
export declare function trackViewport(): void;
|
|
28
|
+
/** A cookie's value: the stored choice when localStorage has none (cleared storage, or a server that set it). */
|
|
29
|
+
export declare function readCookie(key: string): string | null;
|
|
30
|
+
export declare function writeCookie(key: string, value: string | null): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export interface CalendarDay {
|
|
3
|
+
/** Day of the month */
|
|
4
|
+
date: number;
|
|
5
|
+
/** In the month shown (not the neighbors' days filling its first and last week) */
|
|
6
|
+
current: boolean;
|
|
7
|
+
iso: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** YYYY-MM-DD for a year, a 0-based month and a day; months and days past their range roll over, as Date does */
|
|
11
|
+
export declare function isoDate(y: number, m: number, d: number): string;
|
|
12
|
+
export declare function useCalendarMonth(viewDate: Ref<Date>, opts: {
|
|
13
|
+
locale: () => string;
|
|
14
|
+
min: () => string | undefined;
|
|
15
|
+
max: () => string | undefined;
|
|
16
|
+
}): {
|
|
17
|
+
weekdays: import("vue").ComputedRef<string[]>;
|
|
18
|
+
monthLabel: import("vue").ComputedRef<string>;
|
|
19
|
+
days: import("vue").ComputedRef<CalendarDay[]>;
|
|
20
|
+
isOutOfRange: (iso: string) => boolean;
|
|
21
|
+
isToday: (iso: string) => boolean;
|
|
22
|
+
prevMonth: () => void;
|
|
23
|
+
nextMonth: () => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type WatchSource } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Locks the page's scroll while `active` is true (from the start too: a dialog mounted open locks it), and releases
|
|
4
|
+
* it when it turns false or the component unmounts. Without `active`, drive it with the returned `set`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useScrollLock(active?: WatchSource<boolean>): {
|
|
7
|
+
set: (on: boolean) => void;
|
|
8
|
+
};
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface SheetMotionOptions {
|
|
2
|
+
/** Resting offsets while open, as fractions of the panel's size (0 = fully open). Default [0]. */
|
|
3
|
+
anchors?: (panel: HTMLElement) => number[];
|
|
4
|
+
/** The anchor an open lands on. Default 0. */
|
|
5
|
+
openAt?: (panel: HTMLElement) => number;
|
|
6
|
+
/** The sheet is heading for this resting anchor (on open, a drag release or snapTo). */
|
|
7
|
+
onAnchor?: (anchor: number, panel: HTMLElement | null) => void;
|
|
8
|
+
/** A drag took over the panel (true) or let go (false). */
|
|
9
|
+
onDrag?: (active: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useSheetMotion(axis: 'x' | 'y', onDismiss: () => void, opts?: SheetMotionOptions): {
|
|
2
12
|
onEnter: (el: Element, done: () => void) => void;
|
|
3
13
|
onLeave: (el: Element, done: () => void) => void;
|
|
4
14
|
onDragStart: (e: PointerEvent) => void;
|
|
5
15
|
onDragMove: (e: PointerEvent) => void;
|
|
6
16
|
onDragEnd: () => void;
|
|
17
|
+
dragStart: (from: Element, pos: number) => void;
|
|
18
|
+
dragMove: (pos: number) => number;
|
|
19
|
+
dragEnd: () => void;
|
|
20
|
+
snapTo: (anchor: number) => void;
|
|
21
|
+
target: () => number;
|
|
7
22
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The current values of some color tokens (`['primary', 'surface']` → `--color-primary`…), kept up to date across
|
|
4
|
+
* theme, palette and contrast changes: for what can't use CSS variables (a MapLibre layer's paint, a canvas). Empty
|
|
5
|
+
* strings on the server.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useThemeTokens<T extends string>(names: readonly T[]): Ref<Record<T, string>>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type * as Maplibre from 'maplibre-gl';
|
|
2
|
+
/** How to show one property of a feature. */
|
|
3
|
+
export interface MapFieldFormat {
|
|
4
|
+
/** The label (the key, capitalized, by default) */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Text before the value */
|
|
7
|
+
prefix?: string;
|
|
8
|
+
/** Text after the value */
|
|
9
|
+
suffix?: string;
|
|
10
|
+
/** A number mask: its decimals set the fraction digits (`#.00` → 2) and a comma turns on grouping (`#,###`) */
|
|
11
|
+
mask?: string;
|
|
12
|
+
/** Leave it out */
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** One layer of the style, as the map's UI components see it. */
|
|
16
|
+
export interface MapLayerInfo {
|
|
17
|
+
/** The style layer's id */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Its name in the UI */
|
|
20
|
+
title: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
/** The `name` of its group in `MapLayerModel.groups` */
|
|
23
|
+
group?: string;
|
|
24
|
+
/** Shown in `MMapLayers` */
|
|
25
|
+
listed: boolean;
|
|
26
|
+
/** A base layer: `MMapBaseLayers` shows one of them at a time, with this thumbnail */
|
|
27
|
+
base?: {
|
|
28
|
+
image?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Layer ids shown, hidden and faded along with it */
|
|
31
|
+
children: string[];
|
|
32
|
+
/** Listed by `MMapIdentify` on click: every property, formatted by `format`, minus `exclude` */
|
|
33
|
+
identify: false | {
|
|
34
|
+
format: Record<string, MapFieldFormat>;
|
|
35
|
+
exclude: string[];
|
|
36
|
+
};
|
|
37
|
+
/** Shown by `MMapHover` under the pointer: these properties, in order */
|
|
38
|
+
hover: false | {
|
|
39
|
+
fields: (MapFieldFormat & {
|
|
40
|
+
key: string;
|
|
41
|
+
})[];
|
|
42
|
+
};
|
|
43
|
+
/** A legend image URL (an SVG, typically) */
|
|
44
|
+
legend?: string;
|
|
45
|
+
/** A download URL for its data */
|
|
46
|
+
download?: string;
|
|
47
|
+
}
|
|
48
|
+
/** The style as the map's UI components see it: layers with names, groups, base layers, what to identify. */
|
|
49
|
+
export interface MapLayerModel {
|
|
50
|
+
/** The style's name */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** Groups, in order */
|
|
53
|
+
groups: {
|
|
54
|
+
name: string;
|
|
55
|
+
title: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** Layers, in the style's order (bottom to top) */
|
|
58
|
+
layers: MapLayerInfo[];
|
|
59
|
+
}
|
|
60
|
+
/** What an adapter gets besides the style. */
|
|
61
|
+
export interface MapAdapterContext {
|
|
62
|
+
/** The style's URL, when `MMap`'s `mapStyle` is one */
|
|
63
|
+
styleUrl?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Reads a style's conventions (usually its `metadata`) into the model the map's UI components use. */
|
|
66
|
+
export type MapAdapter = (style: Maplibre.StyleSpecification, context: MapAdapterContext) => MapLayerModel;
|
|
67
|
+
/**
|
|
68
|
+
* Any style: every layer but the background is listed under its id (or `metadata.title`), vector layers identify all
|
|
69
|
+
* their properties, and nothing is a base layer or shows on hover.
|
|
70
|
+
*/
|
|
71
|
+
export declare const genericAdapter: MapAdapter;
|
|
72
|
+
export interface OrvianAdapterOptions {
|
|
73
|
+
/**
|
|
74
|
+
* A layer's legend image. By default, for a style served by mvt-rs (`…/services/styles/<style>`), its legend service
|
|
75
|
+
* (`…/services/legends/<style>?layer_id=<id>`), unless the layer's `metadata.legend.show` is false;
|
|
76
|
+
* `metadata.legend.wmslegend` overrides it
|
|
77
|
+
*/
|
|
78
|
+
legend?: (layer: Maplibre.LayerSpecification, styleUrl?: string) => string | undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The Orvian viewers' conventions in the style's `metadata`. On each layer: `alias`, `description`, `group`,
|
|
82
|
+
* `show_in_layerlist` (false hides it from the list), `isbaselayer` with `image` (raster base layers), `childs` (layer
|
|
83
|
+
* ids toggled with it), `identify` (true lists its properties on click), `fields` (per property: `alias`, `prefix`,
|
|
84
|
+
* `suffix`, `mask`, `show: false`; plus `exclude`, a list of properties to leave out), `hover` (`enable` and `fields`,
|
|
85
|
+
* a list of `{ <property>: { alias, prefix, suffix, mask } }`), `legend` (`show`, `wmslegend`) and `download`. On the
|
|
86
|
+
* style: `groups` (`{ name, alias }`, in order).
|
|
87
|
+
*/
|
|
88
|
+
export declare function orvianAdapter(options?: OrvianAdapterOptions): MapAdapter;
|
|
89
|
+
/** A property's label: its format's, or the key with a capital first letter. */
|
|
90
|
+
export declare function fieldLabel(key: string, format?: MapFieldFormat): string;
|
|
91
|
+
/**
|
|
92
|
+
* A property's value as text: numbers through `mask` (in the page's language, `<html lang>`), then `prefix` and
|
|
93
|
+
* `suffix`. Empty values give ''.
|
|
94
|
+
*/
|
|
95
|
+
export declare function formatFieldValue(raw: unknown, format?: MapFieldFormat): string;
|
|
96
|
+
/** What `MMapIdentify` found on one layer at a point. */
|
|
97
|
+
export interface MapIdentifyResult {
|
|
98
|
+
layer: MapLayerInfo;
|
|
99
|
+
feature: Maplibre.MapGeoJSONFeature;
|
|
100
|
+
/** Its properties as the layer's `identify` shows them, formatted */
|
|
101
|
+
fields: {
|
|
102
|
+
key: string;
|
|
103
|
+
label: string;
|
|
104
|
+
value: string;
|
|
105
|
+
}[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The features of the model's identify layers at a point (topmost first), with their properties formatted: what
|
|
109
|
+
* `MMapIdentify` lists on click, for a UI of your own.
|
|
110
|
+
*/
|
|
111
|
+
export declare function identifyFeatures(map: Maplibre.Map, point: Maplibre.PointLike, model: MapLayerModel | undefined): MapIdentifyResult[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** A place found by a `MapSearchProvider`. */
|
|
2
|
+
export interface MapSearchResult {
|
|
3
|
+
/** What to show */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Where it is */
|
|
6
|
+
lngLat: [number, number];
|
|
7
|
+
/** Its extent, `[west, south, east, north]`: the map fits it instead of zooming to the point */
|
|
8
|
+
bbox?: [number, number, number, number];
|
|
9
|
+
/** Its kind (`city`, `road`, `park`, `restaurant`…), for the icon */
|
|
10
|
+
type?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Finds places for `MMapSearch`: the text in, results out. `signal` aborts a search the user replaced. */
|
|
13
|
+
export type MapSearchProvider = (query: string, signal: AbortSignal) => Promise<MapSearchResult[]>;
|
|
14
|
+
export interface NominatimOptions {
|
|
15
|
+
/** The Nominatim server (`https://nominatim.openstreetmap.org` by default; mind its usage policy, or run your own) */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** How many results (6) */
|
|
18
|
+
limit?: number;
|
|
19
|
+
/** The results' language (`es`, `en`…); by default the page's (`<html lang>`) */
|
|
20
|
+
language?: string;
|
|
21
|
+
/** Only these countries (ISO codes: `['ar']`) */
|
|
22
|
+
countryCodes?: string[];
|
|
23
|
+
/** Prefer (or with `bounded`, only) this area: `[west, south, east, north]` */
|
|
24
|
+
viewbox?: [number, number, number, number];
|
|
25
|
+
bounded?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* OpenStreetMap's Nominatim geocoder. Its public server allows one search per second and no search-as-you-type:
|
|
29
|
+
* `MMapSearch` searches on Enter.
|
|
30
|
+
*/
|
|
31
|
+
export declare function nominatimProvider(options?: NominatimOptions): MapSearchProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ContrastLevel } from './useColorPalette';
|
|
1
|
+
import { type ContrastLevel, type PaletteId } from './useColorPalette';
|
|
2
2
|
export interface ThemeInitOptions {
|
|
3
3
|
/** `createM3UI`'s `palette`: the first-visit default, or forced with `persistPalette: false`. */
|
|
4
|
-
palette?: string;
|
|
4
|
+
palette?: PaletteId | (string & {});
|
|
5
5
|
/** `createM3UI`'s `contrast`, with the same rules as `palette`. */
|
|
6
6
|
contrast?: ContrastLevel;
|
|
7
7
|
/** `createM3UI`'s `persistPalette`. */
|
|
@@ -11,7 +11,8 @@ export interface ThemeInitOptions {
|
|
|
11
11
|
* A script to inline in `<head>` of a server-rendered page (Nuxt, Vite SSR), so dark mode, the palette and the
|
|
12
12
|
* contrast level are on `<html>` before the first paint instead of when the app's JS loads. It does what
|
|
13
13
|
* `useTheme` and `useColorPalette` do when they load in the browser (the stored choice, or the given
|
|
14
|
-
* `createM3UI` defaults
|
|
14
|
+
* `createM3UI` defaults; a choice only in a cookie, from `createM3UI({ cookies })`, counts too), so pass it the same
|
|
15
|
+
* options as the plugin. A `seed` default can't be generated this
|
|
15
16
|
* early: its first visit still shows the baseline until the app loads (later visits use the cached CSS).
|
|
16
17
|
*
|
|
17
18
|
* ```ts
|