@m3ui-vue/m3ui-vue 1.6.2 → 1.8.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 (191) hide show
  1. package/dist/API.md +1224 -28
  2. package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-H8nuX0Wu.js} +3 -4
  3. package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-H8nuX0Wu.js.map} +1 -1
  4. package/dist/MDialog-B42Mhn8W.js +331 -0
  5. package/dist/MDialog-B42Mhn8W.js.map +1 -0
  6. package/dist/{MListItem-D2cNUyzP.js → MListItem-DiOAxaN7.js} +431 -325
  7. package/dist/MListItem-DiOAxaN7.js.map +1 -0
  8. package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-CuTZYFFj.js} +2 -2
  9. package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-CuTZYFFj.js.map} +1 -1
  10. package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-BCDQTx2t.js} +2 -2
  11. package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-BCDQTx2t.js.map} +1 -1
  12. package/dist/MSegmentedButton-BXzRsg1S.js +105 -0
  13. package/dist/MSegmentedButton-BXzRsg1S.js.map +1 -0
  14. package/dist/MSignaturePad-BTqGaPXA.js +313 -0
  15. package/dist/MSignaturePad-BTqGaPXA.js.map +1 -0
  16. package/dist/MSlider-D_O8J9YH.js +739 -0
  17. package/dist/MSlider-D_O8J9YH.js.map +1 -0
  18. package/dist/{MSpinner-DZkXZJpc.js → MSpinner-UCdtSOHP.js} +2 -2
  19. package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-UCdtSOHP.js.map} +1 -1
  20. package/dist/{MTextField-CNH-byir.js → MTextField-CYk9yFvi.js} +162 -115
  21. package/dist/MTextField-CYk9yFvi.js.map +1 -0
  22. package/dist/_useFieldValidation-B0B44M_t.js +191 -0
  23. package/dist/_useFieldValidation-B0B44M_t.js.map +1 -0
  24. package/dist/api.json +1 -1
  25. package/dist/code-editor.js +184 -103
  26. package/dist/code-editor.js.map +1 -1
  27. package/dist/components/MAddressField.vue.d.ts +18 -3
  28. package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
  29. package/dist/components/MAudioRecorder.vue.d.ts +2 -2
  30. package/dist/components/MAutocomplete.vue.d.ts +22 -3
  31. package/dist/components/MCheckbox.vue.d.ts +23 -1
  32. package/dist/components/MCodeEditor.vue.d.ts +23 -1
  33. package/dist/components/MColorPicker.vue.d.ts +24 -3
  34. package/dist/components/MConfirmDialog.vue.d.ts +2 -2
  35. package/dist/components/MCountrySelect.vue.d.ts +13 -2
  36. package/dist/components/MCreditCardInput.vue.d.ts +33 -0
  37. package/dist/components/MCronField.vue.d.ts +23 -1
  38. package/dist/components/MDataTable.vue.d.ts +1 -1
  39. package/dist/components/MDatePicker.vue.d.ts +24 -3
  40. package/dist/components/MDateRangePicker.vue.d.ts +24 -3
  41. package/dist/components/MFileUpload.vue.d.ts +23 -2
  42. package/dist/components/MForm.vue.d.ts +61 -0
  43. package/dist/components/MFormBuilder.vue.d.ts +22 -0
  44. package/dist/components/MFormRenderer.vue.d.ts +151 -0
  45. package/dist/components/MJsonEditor.vue.d.ts +23 -1
  46. package/dist/components/MMapRoute.vue.d.ts +176 -0
  47. package/dist/components/MMaskField.vue.d.ts +20 -2
  48. package/dist/components/MMentionField.vue.d.ts +13 -2
  49. package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
  50. package/dist/components/MMultiSelect.vue.d.ts +22 -3
  51. package/dist/components/MNavigationRail.vue.d.ts +1 -1
  52. package/dist/components/MNotificationCenter.vue.d.ts +2 -2
  53. package/dist/components/MNumberField.vue.d.ts +20 -2
  54. package/dist/components/MPdfSigner.vue.d.ts +499 -0
  55. package/dist/components/MPdfViewer.vue.d.ts +12 -0
  56. package/dist/components/MPhoneInput.vue.d.ts +19 -4
  57. package/dist/components/MPinInput.vue.d.ts +24 -3
  58. package/dist/components/MPosKeypad.vue.d.ts +3 -3
  59. package/dist/components/MRadioGroup.vue.d.ts +23 -1
  60. package/dist/components/MRating.vue.d.ts +23 -1
  61. package/dist/components/MRichTextEditor.vue.d.ts +23 -1
  62. package/dist/components/MSearchBar.vue.d.ts +1 -1
  63. package/dist/components/MSegmentedButton.vue.d.ts +23 -2
  64. package/dist/components/MSelect.vue.d.ts +22 -3
  65. package/dist/components/MSignaturePad.vue.d.ts +19 -0
  66. package/dist/components/MSlider.vue.d.ts +23 -1
  67. package/dist/components/MSpreadsheet.vue.d.ts +137 -0
  68. package/dist/components/MStack.vue.d.ts +1 -1
  69. package/dist/components/MSwitch.vue.d.ts +23 -1
  70. package/dist/components/MTable.vue.d.ts +1 -1
  71. package/dist/components/MTagInput.vue.d.ts +20 -2
  72. package/dist/components/MText.vue.d.ts +1 -1
  73. package/dist/components/MTextField.vue.d.ts +26 -3
  74. package/dist/components/MTimePicker.vue.d.ts +24 -3
  75. package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
  76. package/dist/components/MTour.vue.d.ts +2 -2
  77. package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
  78. package/dist/components/MWindow.vue.d.ts +2 -2
  79. package/dist/composables/_routeGeometry.d.ts +26 -0
  80. package/dist/composables/_useFieldValidation.d.ts +91 -0
  81. package/dist/composables/mapRouting.d.ts +35 -0
  82. package/dist/composables/pdfSign.d.ts +52 -0
  83. package/dist/composables/spreadsheetFormula.d.ts +55 -0
  84. package/dist/composables/useLocale.d.ts +177 -0
  85. package/dist/composables/validation.d.ts +82 -0
  86. package/dist/draw.js +2 -2
  87. package/dist/flow.js +1 -1
  88. package/dist/gantt.js +2 -2
  89. package/dist/index.d.ts +12 -0
  90. package/dist/locales/index.js +693 -7
  91. package/dist/locales/index.js.map +1 -1
  92. package/dist/m3ui-vue.css +1 -1
  93. package/dist/m3ui.js +15507 -12417
  94. package/dist/m3ui.js.map +1 -1
  95. package/dist/map.d.ts +4 -0
  96. package/dist/map.js +1207 -745
  97. package/dist/map.js.map +1 -1
  98. package/dist/media.js +4 -4
  99. package/dist/pdf.d.ts +3 -0
  100. package/dist/pdf.js +1228 -687
  101. package/dist/pdf.js.map +1 -1
  102. package/dist/rich-text-editor.js +188 -146
  103. package/dist/rich-text-editor.js.map +1 -1
  104. package/dist/styles.css +1 -1
  105. package/dist/{useLocale-DaVSTdm0.js → useLocale-DL96OFgr.js} +99 -1
  106. package/dist/useLocale-DL96OFgr.js.map +1 -0
  107. package/package.json +5 -1
  108. package/src/__tests__/MForm.test.ts +325 -0
  109. package/src/__tests__/MFormRenderer.test.ts +157 -0
  110. package/src/__tests__/MMapRoute.test.ts +418 -0
  111. package/src/__tests__/MPdfSigner.test.ts +175 -0
  112. package/src/__tests__/MPhoneInput.test.ts +5 -2
  113. package/src/__tests__/MRichTextEditor.test.ts +2 -1
  114. package/src/__tests__/MSpreadsheet.test.ts +223 -0
  115. package/src/__tests__/MTrackingTimeline.test.ts +66 -0
  116. package/src/__tests__/_fakeMaplibre.ts +4 -1
  117. package/src/__tests__/_osrmRoutes.ts +10 -0
  118. package/src/__tests__/attrsFallthrough.test.ts +11 -0
  119. package/src/__tests__/fieldsValidation.test.ts +229 -0
  120. package/src/__tests__/spreadsheetFormula.test.ts +77 -0
  121. package/src/__tests__/ssr.test.ts +4 -0
  122. package/src/__tests__/validation.test.ts +77 -0
  123. package/src/components/MAddressField.vue +45 -8
  124. package/src/components/MAutocomplete.vue +69 -23
  125. package/src/components/MCheckbox.vue +80 -17
  126. package/src/components/MCodeEditor.vue +59 -2
  127. package/src/components/MColorPicker.vue +65 -16
  128. package/src/components/MCountrySelect.vue +17 -3
  129. package/src/components/MCreditCardInput.vue +76 -7
  130. package/src/components/MCronField.vue +60 -10
  131. package/src/components/MDatePicker.vue +65 -16
  132. package/src/components/MDateRangePicker.vue +66 -16
  133. package/src/components/MFileUpload.vue +71 -8
  134. package/src/components/MForm.vue +208 -0
  135. package/src/components/MFormBuilder.vue +417 -0
  136. package/src/components/MFormRenderer.vue +324 -0
  137. package/src/components/MJsonEditor.vue +57 -3
  138. package/src/components/MMapRoute.vue +523 -0
  139. package/src/components/MMaskField.vue +55 -13
  140. package/src/components/MMentionField.vue +17 -2
  141. package/src/components/MMultiAutocomplete.vue +70 -23
  142. package/src/components/MMultiSelect.vue +70 -23
  143. package/src/components/MNumberField.vue +58 -16
  144. package/src/components/MPdfSigner.vue +433 -0
  145. package/src/components/MPdfViewer.vue +12 -0
  146. package/src/components/MPhoneInput.vue +60 -18
  147. package/src/components/MPinInput.vue +58 -10
  148. package/src/components/MRadioGroup.vue +65 -4
  149. package/src/components/MRating.vue +62 -6
  150. package/src/components/MRichTextEditor.vue +64 -4
  151. package/src/components/MSegmentedButton.vue +59 -2
  152. package/src/components/MSelect.vue +72 -26
  153. package/src/components/MSignaturePad.vue +71 -6
  154. package/src/components/MSlider.vue +61 -10
  155. package/src/components/MSpreadsheet.vue +992 -0
  156. package/src/components/MSwitch.vue +63 -8
  157. package/src/components/MTagInput.vue +67 -25
  158. package/src/components/MTextField.vue +68 -14
  159. package/src/components/MTimePicker.vue +65 -16
  160. package/src/components/MTimezoneSelect.vue +17 -3
  161. package/src/components/MTrackingTimeline.vue +257 -0
  162. package/src/composables/_routeGeometry.ts +140 -0
  163. package/src/composables/_useFieldValidation.ts +287 -0
  164. package/src/composables/mapRouting.ts +55 -0
  165. package/src/composables/pdfSign.ts +141 -0
  166. package/src/composables/spreadsheetFormula.ts +459 -0
  167. package/src/composables/useLocale.ts +277 -0
  168. package/src/composables/validation.ts +178 -0
  169. package/src/index.ts +12 -0
  170. package/src/locales/de.ts +98 -0
  171. package/src/locales/es.ts +105 -7
  172. package/src/locales/fr.ts +98 -0
  173. package/src/locales/ja.ts +98 -0
  174. package/src/locales/ko.ts +98 -0
  175. package/src/locales/pt.ts +98 -0
  176. package/src/locales/zh.ts +98 -0
  177. package/src/map.ts +4 -0
  178. package/src/pdf.ts +3 -0
  179. package/dist/MButton-OQ4wIERQ.js +0 -171
  180. package/dist/MButton-OQ4wIERQ.js.map +0 -1
  181. package/dist/MDialog-DYMnaBlt.js +0 -167
  182. package/dist/MDialog-DYMnaBlt.js.map +0 -1
  183. package/dist/MListItem-D2cNUyzP.js.map +0 -1
  184. package/dist/MProgressBar-BWly1UKN.js +0 -179
  185. package/dist/MProgressBar-BWly1UKN.js.map +0 -1
  186. package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
  187. package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
  188. package/dist/MSlider-BIkA6DiE.js +0 -690
  189. package/dist/MSlider-BIkA6DiE.js.map +0 -1
  190. package/dist/MTextField-CNH-byir.js.map +0 -1
  191. package/dist/useLocale-DaVSTdm0.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** Selected time (HH:MM, v-model) */
3
4
  modelValue: string | null;
@@ -7,10 +8,23 @@ type __VLS_Props = {
7
8
  placeholder?: string;
8
9
  /** Disables the picker */
9
10
  disabled?: boolean;
10
- /** Error state */
11
- error?: boolean;
11
+ /** Error state. A string is also the message (`:error="errors.x"`) */
12
+ error?: boolean | string;
12
13
  /** Error message shown when error is true */
13
14
  errorLabel?: string;
15
+ /** Marks as required — adds a red asterisk after the label; inside an `MForm` or with `rules`, also validates it */
16
+ required?: boolean;
17
+ /**
18
+ * Validation rules: functions `(value, ctx) => true | 'message'` (may be async; see the built-in `required`,
19
+ * `email`, `minLength`…) or a Standard Schema (zod, valibot…). Checked in order; the first failure is shown
20
+ */
21
+ rules?: ValidationRule | ValidationRule[];
22
+ /** When the rules are checked and shown: on leaving the field (default; live after that), while typing, or only on submit (`MForm`) */
23
+ validateOn?: ValidateOn;
24
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
25
+ validateDebounce?: number;
26
+ /** The key of this field in its `MForm`'s values, errors and schema */
27
+ name?: string;
14
28
  /** Hint text below the field */
15
29
  hint?: string;
16
30
  /** Minute increment step */
@@ -20,9 +34,16 @@ type __VLS_Props = {
20
34
  /** Overrides the auto-detected background color used to cut the floating label out of the border */
21
35
  fieldBg?: string;
22
36
  };
23
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
38
+ /** Checks its rules and shows the result; resolves to whether they pass */
39
+ validate: () => Promise<boolean>;
40
+ /** Hides its validation error (until the next check) */
41
+ resetValidation: () => void;
42
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
+ blur: () => any;
24
44
  "update:modelValue": (args_0: string | null) => any;
25
45
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
46
+ onBlur?: (() => any) | undefined;
26
47
  "onUpdate:modelValue"?: ((args_0: string | null) => any) | undefined;
27
48
  }>, {
28
49
  minuteStep: number;
@@ -1,3 +1,4 @@
1
+ import type { ValidateOn, ValidationRule } from '../composables/validation';
1
2
  type __VLS_Props = {
2
3
  /** The IANA time zone name (v-model), or null */
3
4
  modelValue?: string | null;
@@ -15,18 +16,28 @@ type __VLS_Props = {
15
16
  clearable?: boolean;
16
17
  /** Helper text below the field */
17
18
  hint?: string;
18
- /** Error state */
19
- error?: boolean;
19
+ /** Error state. A string is also the message */
20
+ error?: boolean | string;
20
21
  /** Error message shown when `error` is true */
21
22
  errorLabel?: string;
23
+ /** Validation rules (functions or a Standard Schema); see `MForm` */
24
+ rules?: ValidationRule | ValidationRule[];
25
+ /** When the rules are checked and shown: on leaving the field (default), while typing, or only on submit */
26
+ validateOn?: ValidateOn;
27
+ /** Wait this long (ms) after the value stops changing before re-checking (one request for an async rule, not one per key). Defaults to its `MForm`'s */
28
+ validateDebounce?: number;
29
+ /** The key of this field in its `MForm` */
30
+ name?: string;
22
31
  /** Marks it as required */
23
32
  required?: boolean;
24
33
  /** Disables the field */
25
34
  disabled?: boolean;
26
35
  };
27
36
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
+ blur: () => any;
28
38
  "update:modelValue": (zone: string | null) => any;
29
39
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
40
+ onBlur?: (() => any) | undefined;
30
41
  "onUpdate:modelValue"?: ((zone: string | null) => any) | undefined;
31
42
  }>, {
32
43
  mode: "docked" | "modal";
@@ -61,12 +61,12 @@ declare const __VLS_template: () => {
61
61
  };
62
62
  type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
63
63
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
64
- "update:modelValue": (args_0: boolean) => any;
65
64
  finish: () => any;
65
+ "update:modelValue": (args_0: boolean) => any;
66
66
  "update:step": (args_0: number) => any;
67
67
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
68
- "onUpdate:modelValue"?: ((args_0: boolean) => any) | undefined;
69
68
  onFinish?: (() => any) | undefined;
69
+ "onUpdate:modelValue"?: ((args_0: boolean) => any) | undefined;
70
70
  "onUpdate:step"?: ((args_0: number) => any) | undefined;
71
71
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
72
72
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -0,0 +1,75 @@
1
+ /** A stage of an `MTrackingTimeline`: Order placed, Preparing, On the way, Delivered… */
2
+ export interface TrackingStep {
3
+ /** Its name */
4
+ label: string;
5
+ /** A line under it in the details (who, where) */
6
+ description?: string;
7
+ /** A Material Symbol for its dot */
8
+ icon?: string;
9
+ /** When it happened (or is expected): shown as a time in the details */
10
+ time?: string | number | Date;
11
+ }
12
+ /** Where the order stands besides its step: on time, running late, or called off */
13
+ export type TrackingStatus = 'active' | 'delayed' | 'canceled';
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
17
+ /** The stages, in order */
18
+ steps: TrackingStep[];
19
+ /** The stage it's at (0-based): earlier ones are done. `steps.length` (or more) means all done */
20
+ current: number;
21
+ /** How far along the current stage's leg it is, 0–1 (the bar fills toward the next stage) */
22
+ stepProgress?: number;
23
+ /** The expected arrival: shows the minutes left and the time, and updates by itself */
24
+ eta?: string | number | Date;
25
+ /** On time (`active`), running late (`delayed`) or called off (`canceled`) */
26
+ status?: TrackingStatus;
27
+ /** The title, instead of the current stage's name */
28
+ title?: string;
29
+ /** A line under the title ("Your courier is 2 blocks away") */
30
+ message?: string;
31
+ /** Offer the stages with their times in a list that opens below */
32
+ details?: boolean;
33
+ /** Whether the details are open (v-model:expanded) */
34
+ expanded?: boolean;
35
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
+ "update:expanded": (open: boolean) => any;
37
+ }, string, import("vue").PublicProps, Readonly<{
38
+ /** The stages, in order */
39
+ steps: TrackingStep[];
40
+ /** The stage it's at (0-based): earlier ones are done. `steps.length` (or more) means all done */
41
+ current: number;
42
+ /** How far along the current stage's leg it is, 0–1 (the bar fills toward the next stage) */
43
+ stepProgress?: number;
44
+ /** The expected arrival: shows the minutes left and the time, and updates by itself */
45
+ eta?: string | number | Date;
46
+ /** On time (`active`), running late (`delayed`) or called off (`canceled`) */
47
+ status?: TrackingStatus;
48
+ /** The title, instead of the current stage's name */
49
+ title?: string;
50
+ /** A line under the title ("Your courier is 2 blocks away") */
51
+ message?: string;
52
+ /** Offer the stages with their times in a list that opens below */
53
+ details?: boolean;
54
+ /** Whether the details are open (v-model:expanded) */
55
+ expanded?: boolean;
56
+ }> & Readonly<{
57
+ "onUpdate:expanded"?: ((open: boolean) => any) | undefined;
58
+ }>, {
59
+ details: boolean;
60
+ status: TrackingStatus;
61
+ expanded: boolean;
62
+ stepProgress: number;
63
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
64
+ title?: (props: {
65
+ step: TrackingStep | undefined;
66
+ index: number;
67
+ }) => any;
68
+ } & {
69
+ extra?: (props: {}) => any;
70
+ }>;
71
+ type __VLS_WithSlots<T, S> = T & {
72
+ new (): {
73
+ $slots: S;
74
+ };
75
+ };
@@ -52,8 +52,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
52
52
  toggleMaximize: () => void;
53
53
  toggleMinimize: () => void;
54
54
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
55
- "update:modelValue": (value: boolean) => any;
56
55
  close: () => any;
56
+ "update:modelValue": (value: boolean) => any;
57
57
  focus: () => any;
58
58
  minimize: () => any;
59
59
  maximize: (maximized: boolean) => any;
@@ -104,8 +104,8 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
104
104
  /** Reset position, size, and state when the window is closed */
105
105
  resetPosition?: boolean;
106
106
  }> & Readonly<{
107
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
108
107
  onClose?: (() => any) | undefined;
108
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
109
109
  onFocus?: (() => any) | undefined;
110
110
  onMinimize?: (() => any) | undefined;
111
111
  onMaximize?: ((maximized: boolean) => any) | undefined;
@@ -0,0 +1,26 @@
1
+ import { type LngLat } from './_mapGeometry';
2
+ /** Distance from the start to each point of the path, in meters (`[0, …, total]`). */
3
+ export declare function cumulative(path: LngLat[]): number[];
4
+ /** Initial bearing from a to b, degrees clockwise from north (0–360). */
5
+ export declare function bearing(a: LngLat, b: LngLat): number;
6
+ /** The point `d` meters along the path, and the heading there. Clamped to the path's ends. */
7
+ export declare function pointAlong(path: LngLat[], cum: number[], d: number): {
8
+ lngLat: LngLat;
9
+ bearing: number;
10
+ };
11
+ /** The part of the path between two distances along it. */
12
+ export declare function slicePath(path: LngLat[], cum: number[], from: number, to: number): LngLat[];
13
+ /**
14
+ * How far along the path (meters) the point nearest to `p` is: where a GPS position, slightly off the road, falls on
15
+ * the route. Projects onto each segment in a local flat approximation (fine at street scale).
16
+ */
17
+ export declare function project(path: LngLat[], cum: number[], p: LngLat): number;
18
+ /**
19
+ * Like `project`, but for something that moves forward along the route (a vehicle's GPS fixes, the stops in order):
20
+ * only the part from `from` on is considered (minus `back` meters of slack for jitter), and points further ahead
21
+ * cost a little more, so a route that passes the same place twice (out and back on one avenue, a loop, two close
22
+ * parallel streets) doesn't snap a fix to the wrong pass. Never returns less than `from`.
23
+ */
24
+ export declare function projectForward(path: LngLat[], cum: number[], p: LngLat, from: number, back?: number): number;
25
+ /** The bounding box of points, `[[west, south], [east, north]]`. */
26
+ export declare function bounds(points: LngLat[]): [LngLat, LngLat];
@@ -0,0 +1,91 @@
1
+ import { type InjectionKey } from 'vue';
2
+ import { type ValidateOn, type ValidationRule } from './validation';
3
+ /** @internal What a field registers with its `MForm` */
4
+ export interface FormField {
5
+ name: () => string | undefined;
6
+ value: () => unknown;
7
+ /** Checks the rules, shows the result, resolves to whether its own rules pass */
8
+ validate: () => Promise<boolean>;
9
+ resetValidation: () => void;
10
+ reset: () => Promise<void>;
11
+ focus: () => void;
12
+ el: () => Element | null | undefined;
13
+ /** The message on display, if any */
14
+ error: () => string | null;
15
+ /** Whether its rules pass right now (checked silently, whether or not it's shown yet) */
16
+ valid: () => boolean;
17
+ pending: () => boolean;
18
+ }
19
+ /** @internal Provided by `MForm` */
20
+ export interface FormContext {
21
+ register: (field: FormField) => () => void;
22
+ /** Every named field's value, by name */
23
+ values: () => Record<string, unknown>;
24
+ /** An error given from outside (`MForm`'s `errors` prop) */
25
+ externalError: (name: string) => string | null;
26
+ hasSchema: () => boolean;
27
+ /** The form schema's first issue for this field */
28
+ schemaError: (name: string) => Promise<string | null>;
29
+ validateOn: () => ValidateOn | undefined;
30
+ /** Default debounce (ms) for re-checks while the value changes */
31
+ validateDebounce: () => number | undefined;
32
+ /** The `errors` object itself: a new one (a new server response) shows its errors again */
33
+ externalErrorsKey: () => unknown;
34
+ /** Keep an outside error after its field changes, instead of hiding it */
35
+ keepErrors: () => boolean;
36
+ disabled: () => boolean;
37
+ }
38
+ /** @internal */
39
+ export declare const FORM_KEY: InjectionKey<FormContext>;
40
+ /**
41
+ * @internal "Blur" for a field made of several focusable parts (stepper buttons, chips, a popup panel): calls
42
+ * `onLeave` once focus has left `root` for good, not while it moves between its parts or while `open` (its
43
+ * teleported panel, which sits outside `root` in the DOM) is showing. Closing the panel with focus outside
44
+ * counts as leaving. Bind the returned handler to the root's `@focusout`.
45
+ */
46
+ export declare function useFocusLeave(root: () => Element | null | undefined, onLeave: () => void, open?: () => boolean): () => void;
47
+ export interface FieldValidationOptions {
48
+ value: () => unknown;
49
+ rules: () => ValidationRule | ValidationRule[] | undefined;
50
+ required: () => boolean | undefined;
51
+ error: () => boolean | string | undefined;
52
+ errorLabel: () => string | undefined;
53
+ name: () => string | undefined;
54
+ validateOn: () => ValidateOn | undefined;
55
+ /** Wait this long (ms) after the value stops changing before re-checking (async rules: one request, not one per key) */
56
+ validateDebounce?: () => number | undefined;
57
+ disabled: () => boolean | undefined;
58
+ focus: () => void;
59
+ el: () => Element | null | undefined;
60
+ /** Writes a value back through v-model (used by `MForm`'s `reset()`) */
61
+ setValue?: (value: unknown) => void;
62
+ /** What "not filled in" means for `required`, when `isEmpty` isn't it (a date range needs both ends) */
63
+ isEmpty?: (value: unknown) => boolean;
64
+ /** Called when the field is validated on demand (`validate()`, an `MForm` submit), to reveal sub-parts' own errors */
65
+ onValidate?: () => void;
66
+ }
67
+ /**
68
+ * @internal The validation every form field shares: its own `rules` (plus `required` inside an `MForm` or
69
+ * next to other rules), errors from outside (the `error` prop, `MForm`'s `errors`, its `schema`), when to show
70
+ * them (`validateOn`), and registration with the surrounding `MForm`.
71
+ *
72
+ * Priority of what's shown: a string `error` → `error: true` with `errorLabel` → `MForm`'s `errors[name]`
73
+ * → the field's own rules.
74
+ */
75
+ export declare function useFieldValidation(opts: FieldValidationOptions): {
76
+ /** Error state (red border/label) */
77
+ hasError: import("vue").ComputedRef<boolean>;
78
+ /** Message under the field, or null */
79
+ message: import("vue").ComputedRef<string | null>;
80
+ /** id for the message element, to point `aria-describedby` at */
81
+ messageId: string;
82
+ /** Whether async rules are still running */
83
+ pending: import("vue").Ref<boolean, boolean>;
84
+ /** The field's own disabled state merged with its `MForm`'s */
85
+ disabled: import("vue").ComputedRef<boolean>;
86
+ /** Call from the field's blur */
87
+ onBlur: () => void;
88
+ validate: () => Promise<boolean>;
89
+ resetValidation: () => void;
90
+ reset: () => Promise<void>;
91
+ };
@@ -0,0 +1,35 @@
1
+ import type { LngLat } from './_mapGeometry';
2
+ /** A route between waypoints, as a routing service returns it. */
3
+ export interface MapRouteResult {
4
+ /** The road to follow, `[lng, lat][]`: the streets' real shape (curves, roundabouts), one-way streets respected */
5
+ path: LngLat[];
6
+ /** Length in meters */
7
+ distance: number;
8
+ /** Expected travel time in seconds */
9
+ duration: number;
10
+ }
11
+ /**
12
+ * Where `MMapRoute` gets its road from when you give it `stops` but no `path`: any function from waypoints to a route.
13
+ * `osrmRouteProvider()` ships; GraphHopper, Valhalla, OpenRouteService, Mapbox Directions or your own backend fit
14
+ * the same shape. Gets an `AbortSignal`: a newer request cancels the older one.
15
+ */
16
+ export type MapRouteProvider = (waypoints: LngLat[], options: {
17
+ signal?: AbortSignal;
18
+ }) => Promise<MapRouteResult>;
19
+ export interface OsrmRouteOptions {
20
+ /**
21
+ * The OSRM server. Defaults to the project's public demo server, which is meant for light use only (see its usage
22
+ * policy): run your own (`osrm-backend` in Docker) or use a hosted one in production
23
+ */
24
+ url?: string;
25
+ /** The routing profile in the URL: `driving` (the demo server has only this one), `cycling`, `walking`, or your server's own */
26
+ profile?: string;
27
+ /** More query parameters for OSRM (`exclude=toll`, `alternatives`…) */
28
+ params?: Record<string, string>;
29
+ }
30
+ /**
31
+ * Routes through an OSRM server (Open Source Routing Machine, on OpenStreetMap data): the path follows the streets
32
+ * as they are, and the car profile respects one-way streets and turn restrictions. Available from the `/map` entry
33
+ * point.
34
+ */
35
+ export declare function osrmRouteProvider(options?: OsrmRouteOptions): MapRouteProvider;
@@ -0,0 +1,52 @@
1
+ /** A field placed on a page to sign or fill */
2
+ export interface PdfSignField {
3
+ id: string;
4
+ type: 'signature' | 'initials' | 'name' | 'date' | 'text' | 'checkbox';
5
+ /** 1-based page */
6
+ page: number;
7
+ /** Where it is, as fractions (0–1) of the page as shown (its own rotation included): left, top, width, height */
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ /** What it asks for (shown in the empty field, and to screen readers) */
13
+ label?: string;
14
+ /** Must be filled before the document is complete. Default true for signature fields */
15
+ required?: boolean;
16
+ /** Who fills it, for documents several people sign; `signer` on MPdfSigner picks whose fields are active */
17
+ signer?: string;
18
+ /** What it holds: a PNG data URL for a signature or initials, text otherwise, `'true'` for a ticked checkbox */
19
+ value?: string;
20
+ }
21
+ /** Whether a field needs filling and is empty */
22
+ export declare const fieldMissing: (f: PdfSignField) => boolean;
23
+ type Rect = {
24
+ x: number;
25
+ y: number;
26
+ width: number;
27
+ height: number;
28
+ };
29
+ /**
30
+ * A rectangle on the page as shown (top-left origin, y down, in points) to PDF user space (bottom-left origin):
31
+ * where to anchor something drawn upright on screen, and the rotation to draw it with, for a page with its own
32
+ * `/Rotate` and a crop box. `box` is the crop box, `rotate` the page's rotation in degrees
33
+ */
34
+ export declare function shownToUser(r: Rect, box: Rect, rotate: number): {
35
+ x: number;
36
+ y: number;
37
+ rotate: number;
38
+ };
39
+ export interface SignPdfOptions {
40
+ /** The font for text fields (a CSS font list). Default the page's sans-serif */
41
+ font?: string;
42
+ /** Written into the document's metadata */
43
+ producer?: string;
44
+ }
45
+ /**
46
+ * Writes the filled fields into a copy of the PDF and returns its bytes: signatures and initials as the images
47
+ * drawn, text, dates and ticks drawn the same way. A visual signature (what an e-signature flow shows and prints),
48
+ * not a cryptographic one: for a certificate-based digital signature (PAdES), sign the result on your server.
49
+ * Needs the `pdf-lib` package
50
+ */
51
+ export declare function signPdf(pdf: ArrayBuffer | Uint8Array, fields: PdfSignField[], options?: SignPdfOptions): Promise<Uint8Array>;
52
+ export {};
@@ -0,0 +1,55 @@
1
+ /** What a cell holds: what was typed. A string starting with `=` is a formula */
2
+ export type SpreadsheetCell = string | number | boolean | null;
3
+ /** A formula error, shown in the cell as its code (`#DIV/0!`, `#REF!`…) */
4
+ export declare class FormulaError {
5
+ code: '#DIV/0!' | '#REF!' | '#NAME?' | '#VALUE!' | '#CIRC!' | '#ERROR!' | '#N/A';
6
+ constructor(code: '#DIV/0!' | '#REF!' | '#NAME?' | '#VALUE!' | '#CIRC!' | '#ERROR!' | '#N/A');
7
+ toString(): "#DIV/0!" | "#REF!" | "#NAME?" | "#VALUE!" | "#CIRC!" | "#ERROR!" | "#N/A";
8
+ }
9
+ /** What a cell shows once its formula is worked out */
10
+ export type SpreadsheetValue = number | string | boolean | null | FormulaError;
11
+ /** `0 → A`, `25 → Z`, `26 → AA` */
12
+ export declare function columnName(index: number): string;
13
+ /** `A → 0`, `AA → 26` */
14
+ export declare function columnIndex(name: string): number;
15
+ /** `{ row: 0, col: 0 } → A1` */
16
+ export declare function cellName(row: number, col: number): string;
17
+ /** `B3 → { row: 2, col: 1 }`, or null if it isn't a reference */
18
+ export declare function parseCellName(ref: string): {
19
+ row: number;
20
+ col: number;
21
+ } | null;
22
+ type Val = SpreadsheetValue;
23
+ type Arg = Val | Val[];
24
+ /** The functions a formula can call. Add your own with `functions` on MSpreadsheet */
25
+ export type SpreadsheetFunction = (args: Arg[]) => Val;
26
+ export declare const spreadsheetFunctions: Record<string, SpreadsheetFunction>;
27
+ /** Where a formula reads cells from: their values (formulas already worked out) */
28
+ export interface FormulaContext {
29
+ get(row: number, col: number): Val;
30
+ functions?: Record<string, SpreadsheetFunction>;
31
+ /** Rows and columns the sheet has: a reference outside them is `#REF!` */
32
+ rows?: number;
33
+ cols?: number;
34
+ }
35
+ /** Works out a formula (without its leading `=`). Errors come back as a `FormulaError`, never thrown */
36
+ export declare function evaluateFormula(formula: string, ctx: FormulaContext): SpreadsheetValue;
37
+ /**
38
+ * Evaluates a whole sheet lazily: `value(row, col)` works a cell out the first time it's asked for (and whatever it
39
+ * reads), then remembers it. Circular references come out as `#CIRC!`. Make a new one when the cells change.
40
+ */
41
+ export declare function createSheetEvaluator(cells: SpreadsheetCell[][], options?: {
42
+ functions?: Record<string, SpreadsheetFunction>;
43
+ rows?: number;
44
+ cols?: number;
45
+ }): {
46
+ value(row: number, col: number): SpreadsheetValue;
47
+ };
48
+ /**
49
+ * The formula moved by some rows and columns, as when it's copied or filled into another cell: relative references
50
+ * move, `$`-locked parts stay. A reference pushed off the sheet becomes `#REF!`.
51
+ */
52
+ export declare function shiftFormula(formula: string, dRow: number, dCol: number): string;
53
+ /** A number as a cell shows it: no float noise (`0.1 + 0.2` shows 0.3) */
54
+ export declare function formatNumber(n: number): string;
55
+ export {};
@@ -221,6 +221,171 @@ export interface M3Locale {
221
221
  mapPressEnterToSearch: string;
222
222
  mapSearching: string;
223
223
  mapNoPlaces: string;
224
+ /** MMapRoute: a stop's name when it has no label (followed by its number) */
225
+ mapRouteStop: string;
226
+ /** MMapRoute: the vehicle marker's accessible name */
227
+ mapRouteVehicle: string;
228
+ /** MSpreadsheet: the grid's accessible name */
229
+ spreadsheet: string;
230
+ /** MSpreadsheet: the formula bar's input */
231
+ spreadsheetFormula: string;
232
+ /** MSpreadsheet: the box showing the selected cell's name (B3, A1:C4) */
233
+ spreadsheetName: string;
234
+ /** MFormRenderer: the submit button */
235
+ formSubmit: string;
236
+ /** MFormBuilder: the editing view */
237
+ formBuilderEdit: string;
238
+ /** MFormBuilder: the form as it will look */
239
+ formBuilderPreview: string;
240
+ /** MFormBuilder: the schema as JSON */
241
+ formBuilderJson: string;
242
+ /** MFormBuilder: the field palette */
243
+ formBuilderAddField: string;
244
+ /** MFormBuilder: an empty form */
245
+ formBuilderEmpty: string;
246
+ /** MFormBuilder: the form settings */
247
+ formBuilderForm: string;
248
+ /** MFormBuilder */
249
+ formBuilderTitle: string;
250
+ /** MFormBuilder */
251
+ formBuilderDescription: string;
252
+ /** MFormBuilder */
253
+ formBuilderSubmitLabel: string;
254
+ /** MFormBuilder */
255
+ formBuilderLabel: string;
256
+ /** MFormBuilder: the value key */
257
+ formBuilderName: string;
258
+ /** MFormBuilder */
259
+ formBuilderPlaceholder: string;
260
+ /** MFormBuilder */
261
+ formBuilderHint: string;
262
+ /** MFormBuilder */
263
+ formBuilderRequired: string;
264
+ /** MFormBuilder */
265
+ formBuilderWidth: string;
266
+ /** MFormBuilder */
267
+ formBuilderWidthFull: string;
268
+ /** MFormBuilder */
269
+ formBuilderWidthHalf: string;
270
+ /** MFormBuilder */
271
+ formBuilderWidthThird: string;
272
+ /** MFormBuilder */
273
+ formBuilderWidthTwoThirds: string;
274
+ /** MFormBuilder */
275
+ formBuilderOptions: string;
276
+ /** MFormBuilder */
277
+ formBuilderMin: string;
278
+ /** MFormBuilder */
279
+ formBuilderMax: string;
280
+ /** MFormBuilder */
281
+ formBuilderStep: string;
282
+ /** MFormBuilder */
283
+ formBuilderMinLength: string;
284
+ /** MFormBuilder */
285
+ formBuilderMaxLength: string;
286
+ /** MFormBuilder */
287
+ formBuilderPattern: string;
288
+ /** MFormBuilder */
289
+ formBuilderPatternMessage: string;
290
+ /** MFormBuilder: textarea lines */
291
+ formBuilderRows: string;
292
+ /** MFormBuilder: conditional field */
293
+ formBuilderShowWhen: string;
294
+ /** MFormBuilder: no condition */
295
+ formBuilderAlways: string;
296
+ /** MFormBuilder: the condition value */
297
+ formBuilderEquals: string;
298
+ /** MFormBuilder */
299
+ formBuilderDuplicate: string;
300
+ /** MFormBuilder */
301
+ formBuilderDelete: string;
302
+ /** MFormBuilder: copy the JSON */
303
+ formBuilderCopy: string;
304
+ /** MFormBuilder */
305
+ formBuilderCopied: string;
306
+ /** MFormBuilder: what the preview submitted */
307
+ formBuilderSubmitted: string;
308
+ /** MFormBuilder: the inspector with nothing selected */
309
+ formBuilderSelectField: string;
310
+ /** MFormBuilder: field type */
311
+ formFieldText: string;
312
+ /** MFormBuilder: field type */
313
+ formFieldEmail: string;
314
+ /** MFormBuilder: field type */
315
+ formFieldPassword: string;
316
+ /** MFormBuilder: field type */
317
+ formFieldTel: string;
318
+ /** MFormBuilder: field type */
319
+ formFieldUrl: string;
320
+ /** MFormBuilder: field type */
321
+ formFieldTextarea: string;
322
+ /** MFormBuilder: field type */
323
+ formFieldNumber: string;
324
+ /** MFormBuilder: field type */
325
+ formFieldSelect: string;
326
+ /** MFormBuilder: field type */
327
+ formFieldAutocomplete: string;
328
+ /** MFormBuilder: field type */
329
+ formFieldRadio: string;
330
+ /** MFormBuilder: field type */
331
+ formFieldCheckbox: string;
332
+ /** MFormBuilder: field type */
333
+ formFieldSwitch: string;
334
+ /** MFormBuilder: field type */
335
+ formFieldDate: string;
336
+ /** MFormBuilder: field type */
337
+ formFieldTime: string;
338
+ /** MFormBuilder: field type */
339
+ formFieldSlider: string;
340
+ /** MFormBuilder: field type */
341
+ formFieldRating: string;
342
+ /** MFormBuilder: field type */
343
+ formFieldPhone: string;
344
+ /** MFormBuilder: field type */
345
+ formFieldHeading: string;
346
+ /** MFormBuilder: field type */
347
+ formFieldDivider: string;
348
+ /** MPdfSigner: field type */
349
+ pdfSignSignature: string;
350
+ /** MPdfSigner: field type */
351
+ pdfSignInitials: string;
352
+ /** MPdfSigner: field type */
353
+ pdfSignName: string;
354
+ /** MPdfSigner: field type */
355
+ pdfSignDate: string;
356
+ /** MPdfSigner: field type */
357
+ pdfSignText: string;
358
+ /** MPdfSigner: field type */
359
+ pdfSignCheckbox: string;
360
+ /** MPdfSigner: an empty signature field */
361
+ pdfSignHere: string;
362
+ /** MPdfSigner: go to the next empty field */
363
+ pdfSignNext: string;
364
+ /** MPdfSigner: done signing */
365
+ pdfSignFinish: string;
366
+ /** MPdfSigner: {done} and {total} are replaced */
367
+ pdfSignProgress: string;
368
+ /** MPdfSigner: draw a signature */
369
+ pdfSignDraw: string;
370
+ /** MPdfSigner: type a signature */
371
+ pdfSignTypeIt: string;
372
+ /** MPdfSigner: use this signature */
373
+ pdfSignAdopt: string;
374
+ /** MPdfSigner: the field palette */
375
+ pdfSignAddField: string;
376
+ /** MPdfSigner */
377
+ pdfSignRequired: string;
378
+ /** MPdfSigner */
379
+ pdfSignDelete: string;
380
+ /** MPdfSigner: every field is filled */
381
+ pdfSignComplete: string;
382
+ trackingArrives: string;
383
+ trackingArrivingNow: string;
384
+ trackingDelivered: string;
385
+ trackingDelayed: string;
386
+ trackingCanceled: string;
387
+ trackingShowDetails: string;
388
+ trackingHideDetails: string;
224
389
  filterMatchAll: string;
225
390
  filterMatchAny: string;
226
391
  filterAddCondition: string;
@@ -548,6 +713,18 @@ export interface M3Locale {
548
713
  cardInvalidNumber: string;
549
714
  cardInvalidExpiry: string;
550
715
  cardInvalidCvc: string;
716
+ validationRequired: string;
717
+ validationInvalid: string;
718
+ validationEmail: string;
719
+ validationUrl: string;
720
+ validationMinLength: string;
721
+ validationMaxLength: string;
722
+ validationMinItems: string;
723
+ validationMaxItems: string;
724
+ validationMin: string;
725
+ validationMax: string;
726
+ validationPattern: string;
727
+ validationSameAs: string;
551
728
  keypadDelete: string;
552
729
  keypadClear: string;
553
730
  keypadChange: string;