@fastkit/vui-wysiwyg 8.2.0 → 8.3.0-next.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 (118) hide show
  1. package/dist/pm/changeset.d.mts +1 -0
  2. package/dist/pm/changeset.mjs +3 -3
  3. package/dist/pm/collab.d.mts +1 -0
  4. package/dist/pm/collab.mjs +3 -3
  5. package/dist/pm/commands.d.mts +1 -0
  6. package/dist/pm/commands.mjs +3 -3
  7. package/dist/pm/dropcursor.d.mts +1 -0
  8. package/dist/pm/dropcursor.mjs +3 -3
  9. package/dist/pm/gapcursor.d.mts +1 -0
  10. package/dist/pm/gapcursor.mjs +3 -3
  11. package/dist/pm/history.d.mts +1 -0
  12. package/dist/pm/history.mjs +3 -3
  13. package/dist/pm/inputrules.d.mts +1 -0
  14. package/dist/pm/inputrules.mjs +3 -3
  15. package/dist/pm/keymap.d.mts +1 -0
  16. package/dist/pm/keymap.mjs +3 -3
  17. package/dist/pm/markdown.d.mts +1 -0
  18. package/dist/pm/markdown.mjs +3 -3
  19. package/dist/pm/menu.d.mts +1 -0
  20. package/dist/pm/menu.mjs +3 -3
  21. package/dist/pm/model.d.mts +1 -0
  22. package/dist/pm/model.mjs +3 -3
  23. package/dist/pm/schema-basic.d.mts +1 -0
  24. package/dist/pm/schema-basic.mjs +3 -3
  25. package/dist/pm/schema-list.d.mts +1 -0
  26. package/dist/pm/schema-list.mjs +3 -3
  27. package/dist/pm/state.d.mts +1 -0
  28. package/dist/pm/state.mjs +3 -3
  29. package/dist/pm/tables.d.mts +1 -0
  30. package/dist/pm/tables.mjs +3 -3
  31. package/dist/pm/trailing-node.d.mts +1 -0
  32. package/dist/pm/trailing-node.mjs +3 -3
  33. package/dist/pm/transform.d.mts +1 -0
  34. package/dist/pm/transform.mjs +3 -3
  35. package/dist/pm/view.d.mts +1 -0
  36. package/dist/pm/view.mjs +3 -3
  37. package/dist/tiptap/core.d.mts +1 -0
  38. package/dist/tiptap/core.mjs +3 -3
  39. package/dist/tiptap/extensions/bold.d.mts +1 -0
  40. package/dist/tiptap/extensions/bold.mjs +3 -3
  41. package/dist/tiptap/extensions/bullet-list.d.mts +1 -0
  42. package/dist/tiptap/extensions/bullet-list.mjs +3 -3
  43. package/dist/tiptap/extensions/history.d.mts +1 -0
  44. package/dist/tiptap/extensions/history.mjs +3 -3
  45. package/dist/tiptap/extensions/italic.d.mts +1 -0
  46. package/dist/tiptap/extensions/italic.mjs +3 -3
  47. package/dist/tiptap/extensions/link.d.mts +1 -0
  48. package/dist/tiptap/extensions/link.mjs +3 -3
  49. package/dist/tiptap/extensions/ordered-list.d.mts +1 -0
  50. package/dist/tiptap/extensions/ordered-list.mjs +3 -3
  51. package/dist/tiptap/extensions/text-align.d.mts +1 -0
  52. package/dist/tiptap/extensions/text-align.mjs +3 -3
  53. package/dist/tiptap/extensions/text-style.d.mts +1 -0
  54. package/dist/tiptap/extensions/text-style.mjs +3 -3
  55. package/dist/tiptap/extensions/underline.d.mts +1 -0
  56. package/dist/tiptap/extensions/underline.mjs +3 -3
  57. package/dist/vui-wysiwyg.css +105 -104
  58. package/dist/vui-wysiwyg.d.mts +3576 -0
  59. package/dist/vui-wysiwyg.mjs +857 -979
  60. package/dist/vui-wysiwyg.mjs.map +1 -1
  61. package/package.json +70 -70
  62. package/dist/pm/changeset.d.ts +0 -1
  63. package/dist/pm/changeset.mjs.map +0 -1
  64. package/dist/pm/collab.d.ts +0 -1
  65. package/dist/pm/collab.mjs.map +0 -1
  66. package/dist/pm/commands.d.ts +0 -1
  67. package/dist/pm/commands.mjs.map +0 -1
  68. package/dist/pm/dropcursor.d.ts +0 -1
  69. package/dist/pm/dropcursor.mjs.map +0 -1
  70. package/dist/pm/gapcursor.d.ts +0 -1
  71. package/dist/pm/gapcursor.mjs.map +0 -1
  72. package/dist/pm/history.d.ts +0 -1
  73. package/dist/pm/history.mjs.map +0 -1
  74. package/dist/pm/inputrules.d.ts +0 -1
  75. package/dist/pm/inputrules.mjs.map +0 -1
  76. package/dist/pm/keymap.d.ts +0 -1
  77. package/dist/pm/keymap.mjs.map +0 -1
  78. package/dist/pm/markdown.d.ts +0 -1
  79. package/dist/pm/markdown.mjs.map +0 -1
  80. package/dist/pm/menu.d.ts +0 -1
  81. package/dist/pm/menu.mjs.map +0 -1
  82. package/dist/pm/model.d.ts +0 -1
  83. package/dist/pm/model.mjs.map +0 -1
  84. package/dist/pm/schema-basic.d.ts +0 -1
  85. package/dist/pm/schema-basic.mjs.map +0 -1
  86. package/dist/pm/schema-list.d.ts +0 -1
  87. package/dist/pm/schema-list.mjs.map +0 -1
  88. package/dist/pm/state.d.ts +0 -1
  89. package/dist/pm/state.mjs.map +0 -1
  90. package/dist/pm/tables.d.ts +0 -1
  91. package/dist/pm/tables.mjs.map +0 -1
  92. package/dist/pm/trailing-node.d.ts +0 -1
  93. package/dist/pm/trailing-node.mjs.map +0 -1
  94. package/dist/pm/transform.d.ts +0 -1
  95. package/dist/pm/transform.mjs.map +0 -1
  96. package/dist/pm/view.d.ts +0 -28
  97. package/dist/pm/view.mjs.map +0 -1
  98. package/dist/tiptap/core.d.ts +0 -1
  99. package/dist/tiptap/core.mjs.map +0 -1
  100. package/dist/tiptap/extensions/bold.d.ts +0 -1
  101. package/dist/tiptap/extensions/bold.mjs.map +0 -1
  102. package/dist/tiptap/extensions/bullet-list.d.ts +0 -1
  103. package/dist/tiptap/extensions/bullet-list.mjs.map +0 -1
  104. package/dist/tiptap/extensions/history.d.ts +0 -1
  105. package/dist/tiptap/extensions/history.mjs.map +0 -1
  106. package/dist/tiptap/extensions/italic.d.ts +0 -1
  107. package/dist/tiptap/extensions/italic.mjs.map +0 -1
  108. package/dist/tiptap/extensions/link.d.ts +0 -1
  109. package/dist/tiptap/extensions/link.mjs.map +0 -1
  110. package/dist/tiptap/extensions/ordered-list.d.ts +0 -1
  111. package/dist/tiptap/extensions/ordered-list.mjs.map +0 -1
  112. package/dist/tiptap/extensions/text-align.d.ts +0 -1
  113. package/dist/tiptap/extensions/text-align.mjs.map +0 -1
  114. package/dist/tiptap/extensions/text-style.d.ts +0 -1
  115. package/dist/tiptap/extensions/text-style.mjs.map +0 -1
  116. package/dist/tiptap/extensions/underline.d.ts +0 -1
  117. package/dist/tiptap/extensions/underline.mjs.map +0 -1
  118. package/dist/vui-wysiwyg.d.ts +0 -511
@@ -0,0 +1,3576 @@
1
+ import * as vue2 from "vue";
2
+ import { AllowedComponentProps, App, Component, ComponentCustomProps, ComponentInternalInstance, ComponentPublicInstance, ComputedRef, DefineComponent, ExtractPropTypes, MaybeRef, Prop, PropType, Ref, SetupContext, SlotsType, UnwrapRef, VNode, VNodeArrayChildren, VNodeChild, VNodeProps, WritableComputedRef } from "vue";
3
+ import { AnyExtension, Editor, EditorOptions, Extension, Extensions, Mark, Node } from "@tiptap/vue-3";
4
+ import { EditorView } from "@tiptap/pm/view";
5
+ import "@tiptap/extension-text-style";
6
+ import { BulletListOptions } from "@tiptap/extension-bullet-list";
7
+ import { BoldOptions } from "@tiptap/extension-bold";
8
+ import { ItalicOptions } from "@tiptap/extension-italic";
9
+ import { UnderlineOptions } from "@tiptap/extension-underline";
10
+ import { HistoryOptions } from "@tiptap/extension-history";
11
+ import { LinkOptions } from "@tiptap/extension-link";
12
+ import * as _fastkit_vui0 from "@fastkit/vui";
13
+ import { IconName, TextableControl, VuiService } from "@fastkit/vui";
14
+ import { OrderedListOptions } from "@tiptap/extension-ordered-list";
15
+ import { TextAlignOptions } from "@tiptap/extension-text-align";
16
+ import { Node as Node$1 } from "@tiptap/pm/model";
17
+ import * as vue_jsx_runtime0 from "vue/jsx-runtime";
18
+
19
+ //#region src/schemes.d.ts
20
+ declare const EDITOR_EVENTS: readonly ["beforeCreate", "create", "update", "selectionUpdate", "transaction", "focus", "blur", "destroy"];
21
+ type PrefixedEventName<S extends string> = `on${Capitalize<S>}`;
22
+ type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];
23
+ type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;
24
+ interface WysiwygEditorEventsOptions extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}
25
+ type WysiwygEditorEventsBucket = { [EV in WysiwygEditorEvent]: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>[] };
26
+ declare class WysiwygEditorInitializeContext {
27
+ readonly listeners: WysiwygEditorEventsBucket;
28
+ private readonly _vui;
29
+ get vui(): VuiService;
30
+ constructor(vuiGetter: () => VuiService, opts?: WysiwygEditorEventsOptions);
31
+ on<EV extends WysiwygEditorEvent>(ev: EV, handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>): () => void;
32
+ off<EV extends WysiwygEditorEvent>(ev: EV, handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>): void;
33
+ editorOptions(): WysiwygEditorEventsOptions;
34
+ }
35
+ interface WysiwygEditorContext {
36
+ editor: Editor;
37
+ vui: VuiService;
38
+ }
39
+ type WysiwygExtensionFactory<Options = any, Storage = any> = (ctx: WysiwygEditorInitializeContext) => Extension<Options, Storage> | Node<Options, Storage> | Mark<Options, Storage>;
40
+ interface CreatedWysiwygExtension<Options = any, Storage = any> {
41
+ __isCreatedWysiwygExtension: true;
42
+ _configs: Partial<Options>[];
43
+ configure(options?: Partial<Options>): CreatedWysiwygExtension<Options, Storage>;
44
+ raw: WysiwygExtensionSource<Options, Storage>;
45
+ }
46
+ type WysiwygExtensionSource<Options = any, Storage = any> = Extension<Options, Storage> | Node<Options, Storage> | Mark<Options, Storage> | WysiwygExtensionFactory<Options, Storage>;
47
+ type RawWysiwygExtension<Options = any, Storage = any> = WysiwygExtensionSource<Options, Storage> | CreatedWysiwygExtension<Options, Storage>;
48
+ declare function createWysiwygExtension<Options = any, Storage = any>(extension: WysiwygExtensionSource<Options, Storage>): CreatedWysiwygExtension<Options, Storage>;
49
+ declare function resolveRawWysiwygExtensions(raws: RawWysiwygExtension[], ctx: WysiwygEditorInitializeContext): AnyExtension[];
50
+ type WysiwygEditorToolIcon = IconName | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild) | undefined);
51
+ /**
52
+ * Tool Configuration
53
+ */
54
+ interface WysiwygEditorTool {
55
+ /**
56
+ * Tool Key
57
+ *
58
+ * Must be unique to identify the tool
59
+ */
60
+ key: string;
61
+ /** Icons to be displayed on the toolbar */
62
+ icon: WysiwygEditorToolIcon;
63
+ /** Conditions for displaying the icon as active */
64
+ active?: boolean | ((ctx: WysiwygEditorContext) => boolean);
65
+ /** Conditions for deactivating the icon */
66
+ disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);
67
+ /** Handler when mark text is clicked */
68
+ onClick: (ctx: WysiwygEditorContext, ev: PointerEvent) => any;
69
+ /** Whether to display tools in floating menu or not */
70
+ floating?: boolean;
71
+ /** Extensions that the tool depends on */
72
+ extensions?: Extensions;
73
+ }
74
+ type WysiwygEditorToolFactory<Options = void> = (vui: VuiService, options?: Options) => WysiwygEditorTool | WysiwygEditorTool[];
75
+ type RawWysiwygEditorTool = WysiwygEditorTool | WysiwygEditorToolFactory<any>;
76
+ interface ResolvedWysiwygEditorSettings {
77
+ tools: WysiwygEditorTool[];
78
+ extensions: Extensions;
79
+ }
80
+ declare function resolveRawWysiwygEditorTools(rawTools: RawWysiwygEditorTool[], vui: VuiService): ResolvedWysiwygEditorSettings;
81
+ //#endregion
82
+ //#region src/injections.d.ts
83
+ declare const VUI_WYSIWYG_EDITOR_SYMBOL = "vui-wysiwyg-editor";
84
+ //#endregion
85
+ //#region src/extensions/linter/LinterPlugin.d.ts
86
+ type WysiwygLinterFixFn = (view: EditorView, issue: WysiwygLinterResult) => any;
87
+ type WysiwygLinterFixMessage = string | (() => VNodeChild);
88
+ interface WysiwygLinterFixer {
89
+ message: WysiwygLinterFixMessage;
90
+ handler: WysiwygLinterFixFn;
91
+ }
92
+ type WysiwygLinterResultLevel = 'warning' | 'error';
93
+ interface WysiwygLinterResult {
94
+ id: string;
95
+ icon: boolean;
96
+ level: WysiwygLinterResultLevel;
97
+ message: WysiwygLinterFixMessage;
98
+ from: number;
99
+ to: number;
100
+ fix: WysiwygLinterFixer[];
101
+ }
102
+ interface RawLinterResult extends Omit<WysiwygLinterResult, 'level' | 'fix' | 'id' | 'icon'> {
103
+ level?: WysiwygLinterResultLevel;
104
+ icon?: boolean;
105
+ fix?: WysiwygLinterFixer | WysiwygLinterFixer[];
106
+ }
107
+ declare class WysiwygLinterPlugin {
108
+ protected doc: Node$1;
109
+ private results;
110
+ constructor(doc: Node$1);
111
+ record(result: RawLinterResult): void;
112
+ scan(): this;
113
+ getResults(): WysiwygLinterResult[];
114
+ }
115
+ //#endregion
116
+ //#region src/extensions/linter/Linter.d.ts
117
+ interface WysiwygLinterOptions {
118
+ plugins: Array<typeof WysiwygLinterPlugin>;
119
+ }
120
+ interface WysiwygLinterStorage {
121
+ issues: WysiwygLinterResult[];
122
+ }
123
+ declare const WysiwygLinter: CreatedWysiwygExtension<WysiwygLinterOptions, WysiwygLinterStorage>;
124
+ //#endregion
125
+ //#region src/extensions/linter/plugins/BadWords.d.ts
126
+ declare function WysiwygLinterBadWords(words: string[]): typeof WysiwygLinterPlugin;
127
+ //#endregion
128
+ //#region src/extensions/linter/plugins/HeadingLevel.d.ts
129
+ declare class WysiwygLinterHeadingLevel extends WysiwygLinterPlugin {
130
+ fixHeader(level: number): ({
131
+ state,
132
+ dispatch
133
+ }: EditorView, issue: WysiwygLinterResult) => void;
134
+ scan(): this;
135
+ }
136
+ //#endregion
137
+ //#region src/extensions/linter/plugins/Punctuation.d.ts
138
+ declare class WysiwygLinterPunctuation extends WysiwygLinterPlugin {
139
+ regex: RegExp;
140
+ fix(replacement: any): ({
141
+ state,
142
+ dispatch
143
+ }: EditorView, issue: WysiwygLinterResult) => void;
144
+ scan(): this;
145
+ }
146
+ //#endregion
147
+ //#region src/extensions/color.d.ts
148
+ type WysiwygColorOptions = {
149
+ types: string[];
150
+ };
151
+ declare module '@tiptap/vue-3' {
152
+ interface Commands<ReturnType> {
153
+ color: {
154
+ /**
155
+ * Set the text color
156
+ */
157
+ setColor: (color: string) => ReturnType;
158
+ /**
159
+ * Unset the text color
160
+ */
161
+ unsetColor: () => ReturnType;
162
+ };
163
+ }
164
+ }
165
+ declare const WysiwygColorExtension: Extension<WysiwygColorOptions, any>;
166
+ //#endregion
167
+ //#region src/extensions/custom-tag.d.ts
168
+ type WysiwygCustomTagSettings = {
169
+ /**
170
+ * tag name
171
+ *
172
+ * Either the html default tag name or a custom tag name is acceptable
173
+ *
174
+ * @default "span"
175
+ */
176
+ tag: string;
177
+ /**
178
+ * HTML Attributes
179
+ *
180
+ * Attributes to be assigned to tags such as `class`, `data-xxx`, etc.
181
+ */
182
+ attrs?: Record<any, string>;
183
+ };
184
+ declare module '@tiptap/vue-3' {
185
+ interface Commands<ReturnType> {
186
+ customTag: {
187
+ /**
188
+ * Set the custom tag
189
+ */
190
+ setCustomTag: (markName: string) => ReturnType;
191
+ /**
192
+ * Toggle the custom tag
193
+ */
194
+ toggleCustomTag: (markName: string) => ReturnType;
195
+ /**
196
+ * Unset the custom tag
197
+ */
198
+ unsetCustomTag: (markName: string) => ReturnType;
199
+ };
200
+ }
201
+ }
202
+ declare function createWysiwygCustomTagMark(name: string, settings: Partial<WysiwygCustomTagSettings>): Mark<WysiwygCustomTagSettings, any>;
203
+ declare const WysiwygCustomTagExtension: Extension<WysiwygCustomTagSettings, any>;
204
+ //#endregion
205
+ //#region src/tools/bullet-list.d.ts
206
+ declare const WysiwygBulletListTool: WysiwygEditorToolFactory<BulletListOptions>;
207
+ //#endregion
208
+ //#region src/tools/format-bold.d.ts
209
+ declare const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions>;
210
+ //#endregion
211
+ //#region src/tools/format-italic.d.ts
212
+ declare const WysiwygFormatItalicTool: WysiwygEditorToolFactory<ItalicOptions>;
213
+ //#endregion
214
+ //#region src/tools/format-underline.d.ts
215
+ declare const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<UnderlineOptions>;
216
+ //#endregion
217
+ //#region src/tools/history.d.ts
218
+ declare const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions>;
219
+ //#endregion
220
+ //#region src/tools/link.d.ts
221
+ declare const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions>;
222
+ //#endregion
223
+ //#region src/tools/ordered-list.d.ts
224
+ declare const WysiwygOrderedListTool: WysiwygEditorToolFactory<OrderedListOptions>;
225
+ //#endregion
226
+ //#region src/tools/color.d.ts
227
+ interface WysiwygColorItem {
228
+ key?: string | number;
229
+ name?: VNodeChild | ((vui: VuiService) => VNodeChild);
230
+ color: string | null;
231
+ }
232
+ interface CreateWysiwygColorToolOptions {
233
+ items: WysiwygColorItem[];
234
+ withLabel?: boolean;
235
+ }
236
+ declare function createWysiwygColorTool(opts: CreateWysiwygColorToolOptions): WysiwygEditorToolFactory;
237
+ //#endregion
238
+ //#region src/tools/text-align.d.ts
239
+ /**
240
+ * A list of available options for the text align attribute.
241
+ * @remarks
242
+ * `"justify"` has not yet been adopted because of ambiguity in browser support.
243
+ */
244
+ declare const WYSIWYG_TEXT_ALIGN_VALUES: readonly ["left", "center", "right"];
245
+ /** Text align value */
246
+ type WysiwygTextAlignValue = (typeof WYSIWYG_TEXT_ALIGN_VALUES)[number];
247
+ interface WysiwygTextAlignOptions {
248
+ /**
249
+ * A list of nodes where the text align attribute should be applied to. Usually something like `['heading', 'paragraph']`
250
+ * @default DEFAULT_TYPES
251
+ * @see {@link DEFAULT_TYPES}
252
+ */
253
+ types?: TextAlignOptions['types'];
254
+ /**
255
+ * A list of available options for the text align attribute.
256
+ * @default WYSIWYG_TEXT_ALIGN_VALUES
257
+ * @see {@link WYSIWYG_TEXT_ALIGN_VALUES}
258
+ */
259
+ alignments?: WysiwygTextAlignValue[];
260
+ /**
261
+ * The default text align.
262
+ * @default left
263
+ */
264
+ defaultAlignment: WysiwygTextAlignValue;
265
+ }
266
+ declare const WysiwygTextAlignTool: WysiwygEditorToolFactory<WysiwygTextAlignOptions>;
267
+ //#endregion
268
+ //#region src/tools/custom-tag.d.ts
269
+ interface WysiwygCustomTagToolSettings extends Pick<WysiwygEditorTool, 'icon' | 'floating'>, Partial<WysiwygCustomTagSettings> {}
270
+ /**
271
+ * Generate Custom Tag Tool
272
+ *
273
+ * @param markName - Mark name
274
+ * @param settings - Tool Configuration
275
+ * @returns Generated Tool
276
+ */
277
+ declare function createWysiwygCustomTagTool(markName: string, settings: WysiwygCustomTagToolSettings): WysiwygEditorToolFactory;
278
+ //#endregion
279
+ //#region ../ts-type-utils/types/types.d.ts
280
+ /**
281
+ * Recursive Arrays
282
+ */
283
+ type RecursiveArray<T> = T | RecursiveArray<T>[];
284
+ //#endregion
285
+ //#region ../helpers/dist/helpers.d.mts
286
+ type Mixin<T extends object, U extends object> = Omit<T, keyof U> & U;
287
+ /**
288
+ * Returns a Proxy instance that mixes in the specified trait object for the given base object
289
+ *
290
+ * @param base - Base object
291
+ * @param trait - trait object
292
+ * @returns Mixed-in Proxy
293
+ */
294
+ //#endregion
295
+ //#region ../rules/dist/rules.d.mts
296
+ //#endregion
297
+ //#region src/schemes.d.ts
298
+ /**
299
+ * Symbol indicating a validation error.
300
+ */
301
+ declare const VALIDATION_ERROR_SYMBOL = "ValidationError";
302
+ /**
303
+ * Validation error.
304
+ */
305
+ interface ValidationError {
306
+ /**
307
+ * Symbol indicating a validation error.
308
+ *
309
+ * @see {@link VALIDATION_ERROR_SYMBOL}
310
+ */
311
+ $$symbol: typeof VALIDATION_ERROR_SYMBOL;
312
+ /** Failed validation rule name. */
313
+ name: string;
314
+ /** Prefix for the path during object enumeration. */
315
+ eachPrefix?: string;
316
+ /** Property name during object enumeration. */
317
+ path?: string | number;
318
+ /** Full path to the property during object enumeration. */
319
+ fullPath?: string;
320
+ /** Error message. */
321
+ message: string;
322
+ /** Failed validation value. */
323
+ value?: any;
324
+ /** List of errors for descendant properties if it's an error for an object. */
325
+ children?: ValidationError[];
326
+ /** Constraints set in the rule. */
327
+ constraints?: any;
328
+ }
329
+ /**
330
+ * Check if the specified value is a validation error.
331
+ *
332
+ * @param source - Value to be checked.
333
+ * @returns `true` if it is a validation error.
334
+ */
335
+ /**
336
+ * Symbol indicating validation cancellation.
337
+ */
338
+ declare const VALIDATE_CANCEL_SYMBOL = "__VALIDATE_CANCEL_SYMBOL__";
339
+ /**
340
+ * Check if the specified value is a symbol for validation cancellation.
341
+ *
342
+ * @param source - Value to be checked.
343
+ * @returns `true` if it is a symbol for cancellation.
344
+ */
345
+ //#endregion
346
+ //#region src/factories/rule.d.ts
347
+ /**
348
+ * Execution result of the rule.
349
+ */
350
+ type RuleResult = Promise<void | typeof VALIDATE_CANCEL_SYMBOL | ValidationError>;
351
+ /**
352
+ * Validation options for the rule.
353
+ */
354
+ interface RuleValidationOptions {
355
+ /**
356
+ * Property name during object enumeration.
357
+ *
358
+ * This is typically not specified from the application and is intended for internal use.
359
+ *
360
+ * @internal
361
+ */
362
+ path?: string | number;
363
+ /**
364
+ * Prefix for the path during object enumeration.
365
+ *
366
+ * This is typically not specified from the application and is intended for internal use.
367
+ *
368
+ * @internal
369
+ */
370
+ eachPrefix?: string;
371
+ }
372
+ /**
373
+ * Result of rule validation.
374
+ */
375
+ type RuleValidationResultValue = /** When it passes verification */true /** When verification fails */ | false /** When the verification is considered successful and the subsequent verifications are skipped */ | typeof VALIDATE_CANCEL_SYMBOL /** When verification fails */ | string /** When there is a nested validation result object */ | ValidationError[];
376
+ /**
377
+ * Result of rule validation or its Promise instance.
378
+ */
379
+ type RuleValidationResult = RuleValidationResultValue | Promise<RuleValidationResultValue>;
380
+ /**
381
+ * Message specification for the rule.
382
+ */
383
+ type RuleMessageSpec<C = any> = string | ((value: any, ctx: RuleValidateContext<C>) => string);
384
+ /** Basic settings for the rule. */
385
+ interface RuleBasicSettings<C = any> {
386
+ /** Rule name. */
387
+ name: string;
388
+ /**
389
+ * Message specification for the rule.
390
+ *
391
+ * @see {@link RuleMessageSpec}
392
+ */
393
+ message?: RuleMessageSpec<C>;
394
+ }
395
+ /**
396
+ * Rule settings.
397
+ */
398
+ type RuleSettings<C = any> = (RuleBasicSettings<C> & {
399
+ /**
400
+ * Validation function.
401
+ *
402
+ * @param value - Value to be validated.
403
+ * @param constraints - Constraints.
404
+ * @returns Result of rule validation or its Promise instance.
405
+ */
406
+ validate: (value: any, constraints: C) => RuleValidationResult;
407
+ /**
408
+ * Constraints.
409
+ *
410
+ * Passed as the second argument to the validation function, this value can be customized through rule forking.
411
+ */
412
+ constraints: C;
413
+ }) | (RuleBasicSettings<C> & {
414
+ /**
415
+ * Validation function.
416
+ *
417
+ * @param value - Value to be validated.
418
+ * @returns Result of rule validation or its Promise instance.
419
+ */
420
+ validate: (value: any) => RuleValidationResult;
421
+ constraints?: any;
422
+ });
423
+ /**
424
+ * Context object for rule validation.
425
+ */
426
+ interface RuleValidateContext<C = any> {
427
+ /** Rule name. */
428
+ name: string;
429
+ /** Value to be validated. */
430
+ value: any;
431
+ /** Constraints. */
432
+ constraints: C;
433
+ /** Prefix for the path during object enumeration. */
434
+ eachPrefix?: string;
435
+ /** Property name during object enumeration. */
436
+ path?: string | number;
437
+ /** Full path to the property during object enumeration. */
438
+ fullPath?: string;
439
+ /**
440
+ * Message specification for the rule.
441
+ *
442
+ * @see {@link RuleMessageSpec}
443
+ */
444
+ message?: RuleMessageSpec<C>;
445
+ /** Exception that occurred during rule validation. */
446
+ exception?: any;
447
+ }
448
+ /**
449
+ * Fork settings for the rule.
450
+ */
451
+ interface RuleForkSettings<C = any> {
452
+ /** New rule name. */
453
+ name?: string;
454
+ /** New constraints. */
455
+ constraints?: C;
456
+ /**
457
+ * New message specification.
458
+ *
459
+ * @see {@link RuleMessageSpec}
460
+ */
461
+ message?: RuleMessageSpec<C>;
462
+ }
463
+ /**
464
+ * Rule interface.
465
+ */
466
+ interface Rule<C = any> {
467
+ <EC extends C = C>(constraints: Partial<EC>, overRides?: string | Partial<RuleSettings<EC>>): Rule<EC>;
468
+ /** Rule name. */
469
+ $name: string;
470
+ /**
471
+ * Validate the specified value.
472
+ *
473
+ * @param value - Value to be validated.
474
+ * @param options Validation options for the rule.
475
+ * @returns Execution result of the rule.
476
+ */
477
+ validate: (value: any, options?: RuleValidationOptions) => RuleResult;
478
+ /**
479
+ * Message specification for the rule.
480
+ *
481
+ * @see {@link RuleMessageSpec}
482
+ */
483
+ message: RuleMessageSpec<C>;
484
+ /**
485
+ * Constraints.
486
+ *
487
+ * Passed as the second argument to the validation function, this value can be customized through rule forking.
488
+ */
489
+ constraints: C;
490
+ /**
491
+ * Fork this rule to create a new rule.
492
+ *
493
+ * Used when creating a new rule with customized name, constraints, and message specifications.
494
+ *
495
+ * @param settings - RuleForkSettings
496
+ */
497
+ fork(settings: RuleForkSettings): Rule<C>;
498
+ /**
499
+ * Validation function.
500
+ *
501
+ * @internal
502
+ */
503
+ _validate: ((value: any, constraints: C) => RuleValidationResult) | ((value: any) => RuleValidationResult);
504
+ /**
505
+ * Options used in the most recent validation.
506
+ *
507
+ * @see {@link RuleValidationOptions}
508
+ */
509
+ _lastValidationOptions: RuleValidationOptions;
510
+ /**
511
+ * Retrieve the rule as JSON.
512
+ */
513
+ toJSON(): {
514
+ /** Rule name. */name: string; /** Constraints. */
515
+ constraints: C;
516
+ };
517
+ }
518
+ /**
519
+ * Create a rule.
520
+ *
521
+ * @param settings - Rule settings.
522
+ * @returns Rule interface.
523
+ *
524
+ * @see {@link RuleSettings}
525
+ */
526
+ /**
527
+ * Interface available for validation rule.
528
+ */
529
+ interface VerifiableRule extends Pick<Rule, 'validate' | 'message' | '$name'> {}
530
+ /**
531
+ * Verifiable function type.
532
+ *
533
+ * - Treats it as an error if it returns `string` or `false`.
534
+ * - If it returns `string`, it is considered as an error message.
535
+ */
536
+ type VerifiableFn = (value: any) => string | boolean | undefined | void | Promise<string | boolean | undefined | void>;
537
+ /**
538
+ * Rule or function available for validation.
539
+ */
540
+ type VerifiableRuleOrFn = VerifiableRule | VerifiableFn;
541
+ /**
542
+ * Create a validation interface from a function.
543
+ *
544
+ * @param fn - Verifiable function type.
545
+ * @returns Interface available for validation rule.
546
+ *
547
+ * @see {@link VerifiableFn}
548
+ * @see {@link VerifiableRule}
549
+ */
550
+ //#endregion
551
+ //#region ../../node_modules/.pnpm/vue-router@4.5.1_vue@3.5.22_typescript@5.9.3_/node_modules/vue-router/dist/vue-router.d.ts
552
+ declare type Awaitable<T> = T | Promise<T>;
553
+ /**
554
+ * Maybe a promise maybe not
555
+ * @internal
556
+ */
557
+ declare type _Awaitable<T> = T | PromiseLike<T>;
558
+ /**
559
+ * Internal type to define an ErrorHandler
560
+ *
561
+ * @param error - error thrown
562
+ * @param to - location we were navigating to when the error happened
563
+ * @param from - location we were navigating from when the error happened
564
+ * @internal
565
+ */
566
+ declare interface _ErrorListener {
567
+ (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
568
+ }
569
+ /**
570
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
571
+ * {@link NavigationFailureType}.
572
+ *
573
+ * @internal
574
+ */
575
+ declare const enum ErrorTypes {
576
+ MATCHER_NOT_FOUND = 1,
577
+ NAVIGATION_GUARD_REDIRECT = 2,
578
+ NAVIGATION_ABORTED = 4,
579
+ NAVIGATION_CANCELLED = 8,
580
+ NAVIGATION_DUPLICATED = 16
581
+ }
582
+ declare type HistoryLocation = string;
583
+ /**
584
+ * Allowed HTML history.state
585
+ */
586
+ declare interface HistoryState {
587
+ [x: number]: HistoryStateValue;
588
+ [x: string]: HistoryStateValue;
589
+ }
590
+ /**
591
+ * Allowed arrays for history.state.
592
+ *
593
+ * @internal
594
+ */
595
+ declare interface HistoryStateArray extends Array<HistoryStateValue> {}
596
+ /**
597
+ * Allowed variables in HTML5 history state. Note that pushState clones the state
598
+ * passed and does not accept everything: e.g.: it doesn't accept symbols, nor
599
+ * functions as values. It also ignores Symbols as keys.
600
+ *
601
+ * @internal
602
+ */
603
+ declare type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
604
+ /**
605
+ * Check if an object is a {@link NavigationFailure}.
606
+ *
607
+ * @param error - possible {@link NavigationFailure}
608
+ * @param type - optional types to check for
609
+ *
610
+ * @example
611
+ * ```js
612
+ * import { isNavigationFailure, NavigationFailureType } from 'vue-router'
613
+ *
614
+ * router.afterEach((to, from, failure) => {
615
+ * // Any kind of navigation failure
616
+ * if (isNavigationFailure(failure)) {
617
+ * // ...
618
+ * }
619
+ * // Only duplicated navigations
620
+ * if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
621
+ * // ...
622
+ * }
623
+ * // Aborted or canceled navigations
624
+ * if (isNavigationFailure(failure, NavigationFailureType.aborted | NavigationFailureType.canceled)) {
625
+ * // ...
626
+ * }
627
+ * })
628
+ * ```
629
+ */
630
+ declare type Lazy<T> = () => Promise<T>;
631
+ /**
632
+ * Creates a union type that still allows autocompletion for strings.
633
+ * @internal
634
+ */
635
+ declare type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
636
+ /**
637
+ * Ensures a route is loaded, so it can be passed as o prop to `<RouterView>`.
638
+ *
639
+ * @param route - resolved route to load
640
+ */
641
+ /**
642
+ * Normalized query object that appears in {@link RouteLocationNormalized}
643
+ *
644
+ * @public
645
+ */
646
+ declare type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
647
+ /**
648
+ * Loose {@link LocationQuery} object that can be passed to functions like
649
+ * {@link Router.push} and {@link Router.replace} or anywhere when creating a
650
+ * {@link RouteLocationRaw}
651
+ *
652
+ * @public
653
+ */
654
+ declare type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
655
+ /**
656
+ * Possible values in normalized {@link LocationQuery}. `null` renders the query
657
+ * param but without an `=`.
658
+ *
659
+ * @example
660
+ * ```
661
+ * ?isNull&isEmpty=&other=other
662
+ * gives
663
+ * `{ isNull: null, isEmpty: '', other: 'other' }`.
664
+ * ```
665
+ *
666
+ * @internal
667
+ */
668
+ declare type LocationQueryValue = string | null;
669
+ /**
670
+ * Possible values when defining a query.
671
+ *
672
+ * @internal
673
+ */
674
+ declare type LocationQueryValueRaw = LocationQueryValue | number | undefined;
675
+ /**
676
+ * Normalized/resolved Route location that returned by the matcher.
677
+ */
678
+ declare interface MatcherLocation {
679
+ /**
680
+ * Name of the matched record
681
+ */
682
+ name: RouteRecordNameGeneric | null | undefined;
683
+ /**
684
+ * Percentage encoded pathname section of the URL.
685
+ */
686
+ path: string;
687
+ /**
688
+ * Object of decoded params extracted from the `path`.
689
+ */
690
+ params: RouteParamsGeneric;
691
+ /**
692
+ * Merged `meta` properties from all the matched route records.
693
+ */
694
+ meta: RouteMeta;
695
+ /**
696
+ * Array of {@link RouteRecord} containing components as they were
697
+ * passed when adding records. It can also contain redirect records. This
698
+ * can't be used directly
699
+ */
700
+ matched: RouteRecord[];
701
+ }
702
+ declare interface NavigationCallback {
703
+ (to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
704
+ }
705
+ declare enum NavigationDirection {
706
+ back = "back",
707
+ forward = "forward",
708
+ unknown = ""
709
+ }
710
+ /**
711
+ * Extended Error that contains extra information regarding a failed navigation.
712
+ */
713
+ declare interface NavigationFailure extends Error {
714
+ /**
715
+ * Type of the navigation. One of {@link NavigationFailureType}
716
+ */
717
+ type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
718
+ /**
719
+ * Route location we were navigating from
720
+ */
721
+ from: RouteLocationNormalized;
722
+ /**
723
+ * Route location we were navigating to
724
+ */
725
+ to: RouteLocationNormalized;
726
+ }
727
+ /**
728
+ * Navigation Guard.
729
+ */
730
+ declare interface NavigationGuard {
731
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
732
+ }
733
+ /**
734
+ * `next()` callback passed to navigation guards.
735
+ */
736
+ declare interface NavigationGuardNext {
737
+ (): void;
738
+ (error: Error): void;
739
+ (location: RouteLocationRaw): void;
740
+ (valid: boolean | undefined): void;
741
+ (cb: NavigationGuardNextCallback): void;
742
+ }
743
+ /**
744
+ * Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
745
+ */
746
+ declare type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown;
747
+ /**
748
+ * Return types for a Navigation Guard. Based on `TypesConfig`
749
+ *
750
+ * @see {@link TypesConfig}
751
+ */
752
+ declare type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
753
+ /**
754
+ * Navigation Guard with a type parameter for `this`.
755
+ * @see {@link TypesConfig}
756
+ */
757
+ declare interface NavigationGuardWithThis<T> {
758
+ (this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
759
+ }
760
+ /**
761
+ * Navigation hook triggered after a navigation is settled.
762
+ */
763
+ declare interface NavigationHookAfter {
764
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
765
+ }
766
+ declare interface NavigationInformation {
767
+ type: NavigationType;
768
+ direction: NavigationDirection;
769
+ delta: number;
770
+ }
771
+ /**
772
+ * Internal error used to detect a redirection.
773
+ *
774
+ * @internal
775
+ */
776
+ declare enum NavigationType {
777
+ pop = "pop",
778
+ push = "push"
779
+ }
780
+ /**
781
+ * Add a navigation guard that triggers whenever the component for the current
782
+ * location is about to be left. Similar to {@link beforeRouteLeave} but can be
783
+ * used in any component. The guard is removed when the component is unmounted.
784
+ *
785
+ * @param leaveGuard - {@link NavigationGuard}
786
+ */
787
+ /**
788
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
789
+ * version with the leading `?` and without Should work as URLSearchParams
790
+
791
+ * @internal
792
+ *
793
+ * @param search - search string to parse
794
+ * @returns a query object
795
+ */
796
+ declare function parseQuery(search: string): LocationQuery;
797
+ declare type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>;
798
+ /**
799
+ * @internal
800
+ */
801
+ declare interface _PathParserOptions {
802
+ /**
803
+ * Makes the RegExp case-sensitive.
804
+ *
805
+ * @defaultValue `false`
806
+ */
807
+ sensitive?: boolean;
808
+ /**
809
+ * Whether to disallow a trailing slash or not.
810
+ *
811
+ * @defaultValue `false`
812
+ */
813
+ strict?: boolean;
814
+ /**
815
+ * Should the RegExp match from the beginning by prepending a `^` to it.
816
+ * @internal
817
+ *
818
+ * @defaultValue `true`
819
+ */
820
+ start?: boolean;
821
+ /**
822
+ * Should the RegExp match until the end by appending a `$` to it.
823
+ *
824
+ * @defaultValue `true`
825
+ */
826
+ end?: boolean;
827
+ }
828
+ /**
829
+ * Allowed Component definitions in route records provided by the user
830
+ */
831
+ declare type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
832
+ /**
833
+ * Allowed Component in {@link RouteLocationMatched}
834
+ */
835
+ declare type RouteComponent = Component | DefineComponent;
836
+ /**
837
+ * Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
838
+ */
839
+ /**
840
+ * {@link RouteLocationRaw} resolved using the matcher
841
+ */
842
+ declare type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
843
+ /**
844
+ * Route location as an object with a `path` property.
845
+ */
846
+ declare type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
847
+ /**
848
+ * Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
849
+ */
850
+ declare interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
851
+ /**
852
+ * Percentage encoded pathname section of the URL.
853
+ */
854
+ path: string;
855
+ }
856
+ /**
857
+ * Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
858
+ */
859
+ declare interface RouteLocationAsPathTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsPathGeneric {
860
+ path: _LiteralUnion<RouteMap[Name]['path']>;
861
+ }
862
+ /**
863
+ * List of all possible {@link RouteLocationAsPath} indexed by the route name.
864
+ * @internal
865
+ */
866
+ declare type RouteLocationAsPathTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsPathTyped<RouteMap, N> };
867
+ /**
868
+ * Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
869
+ * `hash` to conveniently change them.
870
+ */
871
+ declare type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
872
+ /**
873
+ * Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
874
+ */
875
+ declare interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
876
+ name?: RouteRecordNameGeneric;
877
+ params?: RouteParamsRawGeneric;
878
+ /**
879
+ * A relative path to the current location. This property should be removed
880
+ */
881
+ path?: undefined;
882
+ }
883
+ /**
884
+ * Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
885
+ */
886
+ declare interface RouteLocationAsRelativeTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsRelativeGeneric {
887
+ name?: Extract<Name, string | symbol>;
888
+ params?: RouteMap[Name]['paramsRaw'];
889
+ }
890
+ /**
891
+ * List of all possible {@link RouteLocationAsRelative} indexed by the route name.
892
+ * @internal
893
+ */
894
+ declare type RouteLocationAsRelativeTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsRelativeTyped<RouteMap, N> };
895
+ /**
896
+ * Same as {@link RouteLocationAsPath} but as a string literal.
897
+ */
898
+ declare type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
899
+ /**
900
+ * Helper to generate a type safe version of the {@link RouteLocationAsString} type.
901
+ */
902
+ declare type RouteLocationAsStringTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['path'];
903
+ /**
904
+ * List of all possible {@link RouteLocationAsString} indexed by the route name.
905
+ * @internal
906
+ */
907
+ declare type RouteLocationAsStringTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsStringTyped<RouteMap, N> };
908
+ /**
909
+ * Base properties for a normalized route location.
910
+ *
911
+ * @internal
912
+ */
913
+ declare interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
914
+ /**
915
+ * The whole location including the `search` and `hash`. This string is
916
+ * percentage encoded.
917
+ */
918
+ fullPath: string;
919
+ /**
920
+ * Object representation of the `search` property of the current location.
921
+ */
922
+ query: LocationQuery;
923
+ /**
924
+ * Hash of the current location. If present, starts with a `#`.
925
+ */
926
+ hash: string;
927
+ /**
928
+ * Contains the location we were initially trying to access before ending up
929
+ * on the current location.
930
+ */
931
+ redirectedFrom: RouteLocation | undefined;
932
+ }
933
+ /**
934
+ * Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
935
+ */
936
+ declare interface RouteLocationGeneric extends _RouteLocationBase {
937
+ /**
938
+ * Array of {@link RouteRecord} containing components as they were
939
+ * passed when adding records. It can also contain redirect records. This
940
+ * can't be used directly. **This property is non-enumerable**.
941
+ */
942
+ matched: RouteRecord[];
943
+ }
944
+ declare interface RouteLocationMatched extends RouteRecordNormalized {
945
+ components: Record<string, RouteComponent> | null | undefined;
946
+ }
947
+ /**
948
+ * Similar to {@link RouteLocation} but its
949
+ * {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
950
+ */
951
+ declare type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
952
+ /**
953
+ * Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
954
+ */
955
+ declare interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
956
+ name: RouteRecordNameGeneric;
957
+ params: RouteParamsGeneric;
958
+ /**
959
+ * Array of {@link RouteRecordNormalized}
960
+ */
961
+ matched: RouteRecordNormalized[];
962
+ }
963
+ /**
964
+ * Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
965
+ * In other words, it's ready to be rendered by `<RouterView>`.
966
+ */
967
+ declare type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
968
+ /**
969
+ * Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
970
+ */
971
+ declare interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
972
+ /**
973
+ * Array of {@link RouteLocationMatched} containing only plain components (any
974
+ * lazy-loaded components have been loaded and were replaced inside the
975
+ * `components` object) so it can be directly used to display routes. It
976
+ * cannot contain redirect records either. **This property is non-enumerable**.
977
+ */
978
+ matched: RouteLocationMatched[];
979
+ }
980
+ /**
981
+ * Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
982
+ */
983
+ declare interface RouteLocationNormalizedLoadedTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedLoadedGeneric {
984
+ name: Extract<Name, string | symbol>;
985
+ params: RouteMap[Name]['params'];
986
+ }
987
+ /**
988
+ * List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
989
+ * @internal
990
+ */
991
+ declare type RouteLocationNormalizedLoadedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedLoadedTyped<RouteMap, N> };
992
+ /**
993
+ * Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
994
+ */
995
+ declare interface RouteLocationNormalizedTyped<RouteMap extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedGeneric {
996
+ name: Extract<Name, string | symbol>;
997
+ params: RouteMap[Name]['params'];
998
+ /**
999
+ * Array of {@link RouteRecordNormalized}
1000
+ */
1001
+ matched: RouteRecordNormalized[];
1002
+ }
1003
+ /**
1004
+ * List of all possible {@link RouteLocationNormalized} indexed by the route name.
1005
+ * @internal
1006
+ */
1007
+ declare type RouteLocationNormalizedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedTyped<RouteMap, N> };
1008
+ /**
1009
+ * Common options for all navigation methods.
1010
+ */
1011
+ declare interface RouteLocationOptions {
1012
+ /**
1013
+ * Replace the entry in the history instead of pushing a new entry
1014
+ */
1015
+ replace?: boolean;
1016
+ /**
1017
+ * Triggers the navigation even if the location is the same as the current one.
1018
+ * Note this will also add a new entry to the history unless `replace: true`
1019
+ * is passed.
1020
+ */
1021
+ force?: boolean;
1022
+ /**
1023
+ * State to save using the History API. This cannot contain any reactive
1024
+ * values and some primitives like Symbols are forbidden. More info at
1025
+ * https://developer.mozilla.org/en-US/docs/Web/API/History/state
1026
+ */
1027
+ state?: HistoryState;
1028
+ }
1029
+ /**
1030
+ * Route location that can be passed to `router.push()` and other user-facing APIs.
1031
+ */
1032
+ declare type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name];
1033
+ /**
1034
+ * Route location resolved with {@link Router | `router.resolve()`}.
1035
+ */
1036
+ declare type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
1037
+ /**
1038
+ * Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
1039
+ */
1040
+ declare interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
1041
+ /**
1042
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
1043
+ */
1044
+ href: string;
1045
+ }
1046
+ /**
1047
+ * Helper to generate a type safe version of the {@link RouteLocationResolved} type.
1048
+ */
1049
+ declare interface RouteLocationResolvedTyped<RouteMap extends RouteMapGeneric, Name extends keyof RouteMap> extends RouteLocationTyped<RouteMap, Name> {
1050
+ /**
1051
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
1052
+ */
1053
+ href: string;
1054
+ }
1055
+ /**
1056
+ * List of all possible {@link RouteLocationResolved} indexed by the route name.
1057
+ * @internal
1058
+ */
1059
+ declare type RouteLocationResolvedTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationResolvedTyped<RouteMap, N> };
1060
+ /**
1061
+ * Helper to generate a type safe version of the {@link RouteLocation} type.
1062
+ */
1063
+ declare interface RouteLocationTyped<RouteMap extends RouteMapGeneric, Name extends keyof RouteMap> extends RouteLocationGeneric {
1064
+ name: Extract<Name, string | symbol>;
1065
+ params: RouteMap[Name]['params'];
1066
+ }
1067
+ /**
1068
+ * List of all possible {@link RouteLocation} indexed by the route name.
1069
+ * @internal
1070
+ */
1071
+ declare type RouteLocationTypedList<RouteMap extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationTyped<RouteMap, N> };
1072
+ /**
1073
+ * Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
1074
+ */
1075
+ declare type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
1076
+ /**
1077
+ * Generic version of the `RouteMap`.
1078
+ */
1079
+ declare type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>;
1080
+ /**
1081
+ * Interface to type `meta` fields in route records.
1082
+ *
1083
+ * @example
1084
+ *
1085
+ * ```ts
1086
+ * // typings.d.ts or router.ts
1087
+ * import 'vue-router';
1088
+ *
1089
+ * declare module 'vue-router' {
1090
+ * interface RouteMeta {
1091
+ * requiresAuth?: boolean
1092
+ * }
1093
+ * }
1094
+ * ```
1095
+ */
1096
+ declare interface RouteMeta extends Record<PropertyKey, unknown> {}
1097
+ declare type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
1098
+ declare type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
1099
+ /**
1100
+ * @internal
1101
+ */
1102
+ declare type RouteParamValue = string;
1103
+ /**
1104
+ * @internal
1105
+ */
1106
+ declare type RouteParamValueRaw = RouteParamValue | number | null | undefined;
1107
+ /**
1108
+ * @internal
1109
+ */
1110
+ declare interface RouteQueryAndHash {
1111
+ query?: LocationQueryRaw;
1112
+ hash?: string;
1113
+ }
1114
+ /**
1115
+ * Router instance.
1116
+ */
1117
+ declare interface Router {
1118
+ /**
1119
+ * @internal
1120
+ */
1121
+ /**
1122
+ * Current {@link RouteLocationNormalized}
1123
+ */
1124
+ readonly currentRoute: Ref<RouteLocationNormalizedLoaded>;
1125
+ /**
1126
+ * Original options object passed to create the Router
1127
+ */
1128
+ readonly options: RouterOptions;
1129
+ /**
1130
+ * Allows turning off the listening of history events. This is a low level api for micro-frontend.
1131
+ */
1132
+ listening: boolean;
1133
+ /**
1134
+ * Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
1135
+ *
1136
+ * @param parentName - Parent Route Record where `route` should be appended at
1137
+ * @param route - Route Record to add
1138
+ */
1139
+ addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
1140
+ /**
1141
+ * Add a new {@link RouteRecordRaw | route record} to the router.
1142
+ *
1143
+ * @param route - Route Record to add
1144
+ */
1145
+ addRoute(route: RouteRecordRaw): () => void;
1146
+ /**
1147
+ * Remove an existing route by its name.
1148
+ *
1149
+ * @param name - Name of the route to remove
1150
+ */
1151
+ removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
1152
+ /**
1153
+ * Checks if a route with a given name exists
1154
+ *
1155
+ * @param name - Name of the route to check
1156
+ */
1157
+ hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
1158
+ /**
1159
+ * Get a full list of all the {@link RouteRecord | route records}.
1160
+ */
1161
+ getRoutes(): RouteRecord[];
1162
+ /**
1163
+ * Delete all routes from the router matcher.
1164
+ */
1165
+ clearRoutes(): void;
1166
+ /**
1167
+ * Returns the {@link RouteLocation | normalized version} of a
1168
+ * {@link RouteLocationRaw | route location}. Also includes an `href` property
1169
+ * that includes any existing `base`. By default, the `currentLocation` used is
1170
+ * `router.currentRoute` and should only be overridden in advanced use cases.
1171
+ *
1172
+ * @param to - Raw route location to resolve
1173
+ * @param currentLocation - Optional current location to resolve against
1174
+ */
1175
+ resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
1176
+ resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
1177
+ /**
1178
+ * Programmatically navigate to a new URL by pushing an entry in the history
1179
+ * stack.
1180
+ *
1181
+ * @param to - Route location to navigate to
1182
+ */
1183
+ push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1184
+ /**
1185
+ * Programmatically navigate to a new URL by replacing the current entry in
1186
+ * the history stack.
1187
+ *
1188
+ * @param to - Route location to navigate to
1189
+ */
1190
+ replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1191
+ /**
1192
+ * Go back in history if possible by calling `history.back()`. Equivalent to
1193
+ * `router.go(-1)`.
1194
+ */
1195
+ back(): ReturnType<Router['go']>;
1196
+ /**
1197
+ * Go forward in history if possible by calling `history.forward()`.
1198
+ * Equivalent to `router.go(1)`.
1199
+ */
1200
+ forward(): ReturnType<Router['go']>;
1201
+ /**
1202
+ * Allows you to move forward or backward through the history. Calls
1203
+ * `history.go()`.
1204
+ *
1205
+ * @param delta - The position in the history to which you want to move,
1206
+ * relative to the current page
1207
+ */
1208
+ go(delta: number): void;
1209
+ /**
1210
+ * Add a navigation guard that executes before any navigation. Returns a
1211
+ * function that removes the registered guard.
1212
+ *
1213
+ * @param guard - navigation guard to add
1214
+ */
1215
+ beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
1216
+ /**
1217
+ * Add a navigation guard that executes before navigation is about to be
1218
+ * resolved. At this state all component have been fetched and other
1219
+ * navigation guards have been successful. Returns a function that removes the
1220
+ * registered guard.
1221
+ *
1222
+ * @param guard - navigation guard to add
1223
+ * @returns a function that removes the registered guard
1224
+ *
1225
+ * @example
1226
+ * ```js
1227
+ * router.beforeResolve(to => {
1228
+ * if (to.meta.requiresAuth && !isAuthenticated) return false
1229
+ * })
1230
+ * ```
1231
+ *
1232
+ */
1233
+ beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
1234
+ /**
1235
+ * Add a navigation hook that is executed after every navigation. Returns a
1236
+ * function that removes the registered hook.
1237
+ *
1238
+ * @param guard - navigation hook to add
1239
+ * @returns a function that removes the registered hook
1240
+ *
1241
+ * @example
1242
+ * ```js
1243
+ * router.afterEach((to, from, failure) => {
1244
+ * if (isNavigationFailure(failure)) {
1245
+ * console.log('failed navigation', failure)
1246
+ * }
1247
+ * })
1248
+ * ```
1249
+ */
1250
+ afterEach(guard: NavigationHookAfter): () => void;
1251
+ /**
1252
+ * Adds an error handler that is called every time a non caught error happens
1253
+ * during navigation. This includes errors thrown synchronously and
1254
+ * asynchronously, errors returned or passed to `next` in any navigation
1255
+ * guard, and errors occurred when trying to resolve an async component that
1256
+ * is required to render a route.
1257
+ *
1258
+ * @param handler - error handler to register
1259
+ */
1260
+ onError(handler: _ErrorListener): () => void;
1261
+ /**
1262
+ * Returns a Promise that resolves when the router has completed the initial
1263
+ * navigation, which means it has resolved all async enter hooks and async
1264
+ * components that are associated with the initial route. If the initial
1265
+ * navigation already happened, the promise resolves immediately.
1266
+ *
1267
+ * This is useful in server-side rendering to ensure consistent output on both
1268
+ * the server and the client. Note that on server side, you need to manually
1269
+ * push the initial location while on client side, the router automatically
1270
+ * picks it up from the URL.
1271
+ */
1272
+ isReady(): Promise<void>;
1273
+ /**
1274
+ * Called automatically by `app.use(router)`. Should not be called manually by
1275
+ * the user. This will trigger the initial navigation when on client side.
1276
+ *
1277
+ * @internal
1278
+ * @param app - Application that uses the router
1279
+ */
1280
+ install(app: App): void;
1281
+ }
1282
+ /**
1283
+ * {@inheritDoc RouteRecordNormalized}
1284
+ */
1285
+ declare type RouteRecord = RouteRecordNormalized;
1286
+ /**
1287
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
1288
+ */
1289
+ declare interface _RouteRecordBase extends PathParserOptions {
1290
+ /**
1291
+ * Path of the record. Should start with `/` unless the record is the child of
1292
+ * another record.
1293
+ *
1294
+ * @example `/users/:id` matches `/users/1` as well as `/users/posva`.
1295
+ */
1296
+ path: string;
1297
+ /**
1298
+ * Where to redirect if the route is directly matched. The redirection happens
1299
+ * before any navigation guard and triggers a new navigation with the new
1300
+ * target location.
1301
+ */
1302
+ redirect?: RouteRecordRedirectOption;
1303
+ /**
1304
+ * Aliases for the record. Allows defining extra paths that will behave like a
1305
+ * copy of the record. Allows having paths shorthands like `/users/:id` and
1306
+ * `/u/:id`. All `alias` and `path` values must share the same params.
1307
+ */
1308
+ alias?: string | string[];
1309
+ /**
1310
+ * Name for the route record. Must be unique.
1311
+ */
1312
+ name?: RouteRecordNameGeneric;
1313
+ /**
1314
+ * Before Enter guard specific to this record. Note `beforeEnter` has no
1315
+ * effect if the record has a `redirect` property.
1316
+ */
1317
+ beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
1318
+ /**
1319
+ * Arbitrary data attached to the record.
1320
+ */
1321
+ meta?: RouteMeta;
1322
+ /**
1323
+ * Array of nested routes.
1324
+ */
1325
+ children?: RouteRecordRaw[];
1326
+ /**
1327
+ * Allow passing down params as props to the component rendered by `router-view`.
1328
+ */
1329
+ props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
1330
+ }
1331
+ /**
1332
+ * Helper type to define a Typed `RouteRecord`
1333
+ * @see {@link RouteRecord}
1334
+ */
1335
+ declare interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
1336
+ name: Name;
1337
+ path: Path;
1338
+ paramsRaw: ParamsRaw;
1339
+ params: Params;
1340
+ childrenNames: ChildrenNames;
1341
+ }
1342
+ declare type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
1343
+ /**
1344
+ * Route Record defining multiple named components with the `components` option.
1345
+ */
1346
+ declare interface RouteRecordMultipleViews extends _RouteRecordBase {
1347
+ /**
1348
+ * Components to display when the URL matches this route. Allow using named views.
1349
+ */
1350
+ components: Record<string, RawRouteComponent>;
1351
+ component?: never;
1352
+ children?: never;
1353
+ redirect?: never;
1354
+ /**
1355
+ * Allow passing down params as props to the component rendered by
1356
+ * `router-view`. Should be an object with the same keys as `components` or a
1357
+ * boolean to be applied to every component.
1358
+ */
1359
+ props?: Record<string, _RouteRecordProps> | boolean;
1360
+ }
1361
+ /**
1362
+ * Route Record defining multiple named components with the `components` option and children.
1363
+ */
1364
+ declare interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
1365
+ /**
1366
+ * Components to display when the URL matches this route. Allow using named views.
1367
+ */
1368
+ components?: Record<string, RawRouteComponent> | null | undefined;
1369
+ component?: never;
1370
+ children: RouteRecordRaw[];
1371
+ /**
1372
+ * Allow passing down params as props to the component rendered by
1373
+ * `router-view`. Should be an object with the same keys as `components` or a
1374
+ * boolean to be applied to every component.
1375
+ */
1376
+ props?: Record<string, _RouteRecordProps> | boolean;
1377
+ }
1378
+ /**
1379
+ * Generic version of {@link RouteRecordName}.
1380
+ */
1381
+ declare type RouteRecordNameGeneric = string | symbol | undefined;
1382
+ /**
1383
+ * Normalized version of a {@link RouteRecord | route record}.
1384
+ */
1385
+ declare interface RouteRecordNormalized {
1386
+ /**
1387
+ * {@inheritDoc _RouteRecordBase.path}
1388
+ */
1389
+ path: _RouteRecordBase['path'];
1390
+ /**
1391
+ * {@inheritDoc _RouteRecordBase.redirect}
1392
+ */
1393
+ redirect: _RouteRecordBase['redirect'] | undefined;
1394
+ /**
1395
+ * {@inheritDoc _RouteRecordBase.name}
1396
+ */
1397
+ name: _RouteRecordBase['name'];
1398
+ /**
1399
+ * {@inheritDoc RouteRecordMultipleViews.components}
1400
+ */
1401
+ components: RouteRecordMultipleViews['components'] | null | undefined;
1402
+ /**
1403
+ * Contains the original modules for lazy loaded components.
1404
+ * @internal
1405
+ */
1406
+ mods: Record<string, unknown>;
1407
+ /**
1408
+ * Nested route records.
1409
+ */
1410
+ children: RouteRecordRaw[];
1411
+ /**
1412
+ * {@inheritDoc _RouteRecordBase.meta}
1413
+ */
1414
+ meta: Exclude<_RouteRecordBase['meta'], void>;
1415
+ /**
1416
+ * {@inheritDoc RouteRecordMultipleViews.props}
1417
+ */
1418
+ props: Record<string, _RouteRecordProps>;
1419
+ /**
1420
+ * Registered beforeEnter guards
1421
+ */
1422
+ beforeEnter: _RouteRecordBase['beforeEnter'];
1423
+ /**
1424
+ * Registered leave guards
1425
+ *
1426
+ * @internal
1427
+ */
1428
+ leaveGuards: Set<NavigationGuard>;
1429
+ /**
1430
+ * Registered update guards
1431
+ *
1432
+ * @internal
1433
+ */
1434
+ updateGuards: Set<NavigationGuard>;
1435
+ /**
1436
+ * Registered beforeRouteEnter callbacks passed to `next` or returned in guards
1437
+ *
1438
+ * @internal
1439
+ */
1440
+ enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
1441
+ /**
1442
+ * Mounted route component instances
1443
+ * Having the instances on the record mean beforeRouteUpdate and
1444
+ * beforeRouteLeave guards can only be invoked with the latest mounted app
1445
+ * instance if there are multiple application instances rendering the same
1446
+ * view, basically duplicating the content on the page, which shouldn't happen
1447
+ * in practice. It will work if multiple apps are rendering different named
1448
+ * views.
1449
+ */
1450
+ instances: Record<string, ComponentPublicInstance | undefined | null>;
1451
+ /**
1452
+ * Defines if this record is the alias of another one. This property is
1453
+ * `undefined` if the record is the original one.
1454
+ */
1455
+ aliasOf: RouteRecordNormalized | undefined;
1456
+ }
1457
+ /**
1458
+ * @internal
1459
+ */
1460
+ declare type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>);
1461
+ declare type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
1462
+ /**
1463
+ * Route Record that defines a redirect. Cannot have `component` or `components`
1464
+ * as it is never rendered.
1465
+ */
1466
+ declare interface RouteRecordRedirect extends _RouteRecordBase {
1467
+ redirect: RouteRecordRedirectOption;
1468
+ component?: never;
1469
+ components?: never;
1470
+ props?: never;
1471
+ }
1472
+ /**
1473
+ * @internal
1474
+ */
1475
+ declare type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation) => RouteLocationRaw);
1476
+ /**
1477
+ * Route Record defining one single component with the `component` option.
1478
+ */
1479
+ declare interface RouteRecordSingleView extends _RouteRecordBase {
1480
+ /**
1481
+ * Component to display when the URL matches this route.
1482
+ */
1483
+ component: RawRouteComponent;
1484
+ components?: never;
1485
+ children?: never;
1486
+ redirect?: never;
1487
+ /**
1488
+ * Allow passing down params as props to the component rendered by `router-view`.
1489
+ */
1490
+ props?: _RouteRecordProps;
1491
+ }
1492
+ /**
1493
+ * Route Record defining one single component with a nested view.
1494
+ */
1495
+ declare interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
1496
+ /**
1497
+ * Component to display when the URL matches this route.
1498
+ */
1499
+ component?: RawRouteComponent | null | undefined;
1500
+ components?: never;
1501
+ children: RouteRecordRaw[];
1502
+ /**
1503
+ * Allow passing down params as props to the component rendered by `router-view`.
1504
+ */
1505
+ props?: _RouteRecordProps;
1506
+ }
1507
+ /**
1508
+ * Interface implemented by History implementations that can be passed to the
1509
+ * router as {@link Router.history}
1510
+ *
1511
+ * @alpha
1512
+ */
1513
+ declare interface RouterHistory {
1514
+ /**
1515
+ * Base path that is prepended to every url. This allows hosting an SPA at a
1516
+ * sub-folder of a domain like `example.com/sub-folder` by having a `base` of
1517
+ * `/sub-folder`
1518
+ */
1519
+ readonly base: string;
1520
+ /**
1521
+ * Current History location
1522
+ */
1523
+ readonly location: HistoryLocation;
1524
+ /**
1525
+ * Current History state
1526
+ */
1527
+ readonly state: HistoryState;
1528
+ /**
1529
+ * Navigates to a location. In the case of an HTML5 History implementation,
1530
+ * this will call `history.pushState` to effectively change the URL.
1531
+ *
1532
+ * @param to - location to push
1533
+ * @param data - optional {@link HistoryState} to be associated with the
1534
+ * navigation entry
1535
+ */
1536
+ push(to: HistoryLocation, data?: HistoryState): void;
1537
+ /**
1538
+ * Same as {@link RouterHistory.push} but performs a `history.replaceState`
1539
+ * instead of `history.pushState`
1540
+ *
1541
+ * @param to - location to set
1542
+ * @param data - optional {@link HistoryState} to be associated with the
1543
+ * navigation entry
1544
+ */
1545
+ replace(to: HistoryLocation, data?: HistoryState): void;
1546
+ /**
1547
+ * Traverses history in a given direction.
1548
+ *
1549
+ * @example
1550
+ * ```js
1551
+ * myHistory.go(-1) // equivalent to window.history.back()
1552
+ * myHistory.go(1) // equivalent to window.history.forward()
1553
+ * ```
1554
+ *
1555
+ * @param delta - distance to travel. If delta is \< 0, it will go back,
1556
+ * if it's \> 0, it will go forward by that amount of entries.
1557
+ * @param triggerListeners - whether this should trigger listeners attached to
1558
+ * the history
1559
+ */
1560
+ go(delta: number, triggerListeners?: boolean): void;
1561
+ /**
1562
+ * Attach a listener to the History implementation that is triggered when the
1563
+ * navigation is triggered from outside (like the Browser back and forward
1564
+ * buttons) or when passing `true` to {@link RouterHistory.back} and
1565
+ * {@link RouterHistory.forward}
1566
+ *
1567
+ * @param callback - listener to attach
1568
+ * @returns a callback to remove the listener
1569
+ */
1570
+ listen(callback: NavigationCallback): () => void;
1571
+ /**
1572
+ * Generates the corresponding href to be used in an anchor tag.
1573
+ *
1574
+ * @param location - history location that should create an href
1575
+ */
1576
+ createHref(location: HistoryLocation): string;
1577
+ /**
1578
+ * Clears any event listener attached by the history implementation.
1579
+ */
1580
+ destroy(): void;
1581
+ }
1582
+ /**
1583
+ * Component to render a link that triggers a navigation on click.
1584
+ */
1585
+ declare const RouterLink: _RouterLinkI;
1586
+ /**
1587
+ * Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
1588
+ * automatically for JSX.
1589
+ *
1590
+ * @internal
1591
+ */
1592
+ declare interface _RouterLinkI {
1593
+ new (): {
1594
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
1595
+ $slots: {
1596
+ default?: ({
1597
+ route,
1598
+ href,
1599
+ isActive,
1600
+ isExactActive,
1601
+ navigate
1602
+ }: UnwrapRef<UseLinkReturn>) => VNode[];
1603
+ };
1604
+ };
1605
+ /**
1606
+ * Access to `useLink()` without depending on using vue-router
1607
+ *
1608
+ * @internal
1609
+ */
1610
+ useLink: typeof useLink;
1611
+ }
1612
+ declare interface RouterLinkOptions {
1613
+ /**
1614
+ * Route Location the link should navigate to when clicked on.
1615
+ */
1616
+ to: RouteLocationRaw;
1617
+ /**
1618
+ * Calls `router.replace` instead of `router.push`.
1619
+ */
1620
+ replace?: boolean;
1621
+ }
1622
+ declare interface RouterLinkProps extends RouterLinkOptions {
1623
+ /**
1624
+ * Whether RouterLink should not wrap its content in an `a` tag. Useful when
1625
+ * using `v-slot` to create a custom RouterLink
1626
+ */
1627
+ custom?: boolean;
1628
+ /**
1629
+ * Class to apply when the link is active
1630
+ */
1631
+ activeClass?: string;
1632
+ /**
1633
+ * Class to apply when the link is exact active
1634
+ */
1635
+ exactActiveClass?: string;
1636
+ /**
1637
+ * Value passed to the attribute `aria-current` when the link is exact active.
1638
+ *
1639
+ * @defaultValue `'page'`
1640
+ */
1641
+ ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
1642
+ /**
1643
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1644
+ */
1645
+ viewTransition?: boolean;
1646
+ }
1647
+ /**
1648
+ * Options to initialize a {@link Router} instance.
1649
+ */
1650
+ declare interface RouterOptions extends PathParserOptions {
1651
+ /**
1652
+ * History implementation used by the router. Most web applications should use
1653
+ * `createWebHistory` but it requires the server to be properly configured.
1654
+ * You can also use a _hash_ based history with `createWebHashHistory` that
1655
+ * does not require any configuration on the server but isn't handled at all
1656
+ * by search engines and does poorly on SEO.
1657
+ *
1658
+ * @example
1659
+ * ```js
1660
+ * createRouter({
1661
+ * history: createWebHistory(),
1662
+ * // other options...
1663
+ * })
1664
+ * ```
1665
+ */
1666
+ history: RouterHistory;
1667
+ /**
1668
+ * Initial list of routes that should be added to the router.
1669
+ */
1670
+ routes: Readonly<RouteRecordRaw[]>;
1671
+ /**
1672
+ * Function to control scrolling when navigating between pages. Can return a
1673
+ * Promise to delay scrolling. Check {@link ScrollBehavior}.
1674
+ *
1675
+ * @example
1676
+ * ```js
1677
+ * function scrollBehavior(to, from, savedPosition) {
1678
+ * // `to` and `from` are both route locations
1679
+ * // `savedPosition` can be null if there isn't one
1680
+ * }
1681
+ * ```
1682
+ */
1683
+ scrollBehavior?: RouterScrollBehavior;
1684
+ /**
1685
+ * Custom implementation to parse a query. See its counterpart,
1686
+ * {@link RouterOptions.stringifyQuery}.
1687
+ *
1688
+ * @example
1689
+ * Let's say you want to use the [qs package](https://github.com/ljharb/qs)
1690
+ * to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
1691
+ * ```js
1692
+ * import qs from 'qs'
1693
+ *
1694
+ * createRouter({
1695
+ * // other options...
1696
+ * parseQuery: qs.parse,
1697
+ * stringifyQuery: qs.stringify,
1698
+ * })
1699
+ * ```
1700
+ */
1701
+ parseQuery?: typeof parseQuery;
1702
+ /**
1703
+ * Custom implementation to stringify a query object. Should not prepend a leading `?`.
1704
+ * {@link RouterOptions.parseQuery | parseQuery} counterpart to handle query parsing.
1705
+ */
1706
+ stringifyQuery?: typeof stringifyQuery;
1707
+ /**
1708
+ * Default class applied to active {@link RouterLink}. If none is provided,
1709
+ * `router-link-active` will be applied.
1710
+ */
1711
+ linkActiveClass?: string;
1712
+ /**
1713
+ * Default class applied to exact active {@link RouterLink}. If none is provided,
1714
+ * `router-link-exact-active` will be applied.
1715
+ */
1716
+ linkExactActiveClass?: string;
1717
+ }
1718
+ /**
1719
+ * Type of the `scrollBehavior` option that can be passed to `createRouter`.
1720
+ */
1721
+ declare interface RouterScrollBehavior {
1722
+ /**
1723
+ * @param to - Route location where we are navigating to
1724
+ * @param from - Route location where we are navigating from
1725
+ * @param savedPosition - saved position if it exists, `null` otherwise
1726
+ */
1727
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
1728
+ }
1729
+ /**
1730
+ * Component to display the current route the user is at.
1731
+ */
1732
+ declare const RouterView: {
1733
+ new (): {
1734
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
1735
+ $slots: {
1736
+ default?: ({
1737
+ Component,
1738
+ route
1739
+ }: {
1740
+ Component: VNode;
1741
+ route: RouteLocationNormalizedLoaded;
1742
+ }) => VNode[];
1743
+ };
1744
+ };
1745
+ };
1746
+ declare interface RouterViewProps {
1747
+ name?: string;
1748
+ route?: RouteLocationNormalized;
1749
+ }
1750
+ declare type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
1751
+ /**
1752
+ * Scroll position similar to
1753
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
1754
+ * Note that not all browsers support `behavior`.
1755
+ */
1756
+ declare type ScrollPositionCoordinates = {
1757
+ behavior?: ScrollOptions['behavior'];
1758
+ left?: number;
1759
+ top?: number;
1760
+ };
1761
+ declare interface ScrollPositionElement extends ScrollToOptions {
1762
+ /**
1763
+ * A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
1764
+ * @example
1765
+ * Here are a few examples:
1766
+ *
1767
+ * - `.title`
1768
+ * - `.content:first-child`
1769
+ * - `#marker`
1770
+ * - `#marker\~with\~symbols`
1771
+ * - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
1772
+ *
1773
+ */
1774
+ el: string | Element;
1775
+ }
1776
+ /**
1777
+ * Internal normalized version of {@link ScrollPositionCoordinates} that always
1778
+ * has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
1779
+ *
1780
+ * @internal
1781
+ */
1782
+ declare type _ScrollPositionNormalized = {
1783
+ behavior?: ScrollOptions['behavior'];
1784
+ left: number;
1785
+ top: number;
1786
+ };
1787
+ /**
1788
+ * Initial route location where the router is. Can be used in navigation guards
1789
+ * to differentiate the initial navigation.
1790
+ *
1791
+ * @example
1792
+ * ```js
1793
+ * import { START_LOCATION } from 'vue-router'
1794
+ *
1795
+ * router.beforeEach((to, from) => {
1796
+ * if (from === START_LOCATION) {
1797
+ * // initial navigation
1798
+ * }
1799
+ * })
1800
+ * ```
1801
+ */
1802
+ /**
1803
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
1804
+ * doesn't prepend a `?`
1805
+ *
1806
+ * @internal
1807
+ *
1808
+ * @param query - query object to stringify
1809
+ * @returns string version of the query without the leading `?`
1810
+ */
1811
+ declare function stringifyQuery(query: LocationQueryRaw): string;
1812
+ /**
1813
+ * Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
1814
+ *
1815
+ * - `$router` - the router instance
1816
+ * - `$route` - the current route location
1817
+ * - `beforeRouteEnter` - Page component option
1818
+ * - `beforeRouteUpdate` - Page component option
1819
+ * - `beforeRouteLeave` - Page component option
1820
+ * - `RouterLink` - RouterLink Component
1821
+ * - `RouterView` - RouterView Component
1822
+ *
1823
+ * @internal
1824
+ */
1825
+ declare interface TypesConfig {}
1826
+ /**
1827
+ * Returns the internal behavior of a {@link RouterLink} without the rendering part.
1828
+ *
1829
+ * @param props - a `to` location and an optional `replace` flag
1830
+ */
1831
+ declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
1832
+ /**
1833
+ * Options passed to {@link useLink}.
1834
+ */
1835
+ declare interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
1836
+ to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
1837
+ replace?: MaybeRef<boolean | undefined>;
1838
+ /**
1839
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1840
+ */
1841
+ viewTransition?: boolean;
1842
+ }
1843
+ /**
1844
+ * Return type of {@link useLink}.
1845
+ * @internal
1846
+ */
1847
+ declare interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
1848
+ route: ComputedRef<RouteLocationResolved<Name>>;
1849
+ href: ComputedRef<string>;
1850
+ isActive: ComputedRef<boolean>;
1851
+ isExactActive: ComputedRef<boolean>;
1852
+ navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
1853
+ }
1854
+ /**
1855
+ * NOTE: this used to be `@vue/runtime-core` but it should have been `vue` for a long time. Using both declaration at
1856
+ * the same time breaks so using only one everywhere is the preferred way.
1857
+ */
1858
+ declare module 'vue' {
1859
+ export interface ComponentCustomOptions {
1860
+ /**
1861
+ * Guard called when the router is navigating to the route that is rendering
1862
+ * this component from a different route. Differently from `beforeRouteUpdate`
1863
+ * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
1864
+ * component instance through `this` because it triggers before the component
1865
+ * is even mounted.
1866
+ *
1867
+ * @param to - RouteLocationRaw we are navigating to
1868
+ * @param from - RouteLocationRaw we are navigating from
1869
+ * @param next - function to validate, cancel or modify (by redirecting) the
1870
+ * navigation
1871
+ */
1872
+ beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
1873
+ /**
1874
+ * Guard called whenever the route that renders this component has changed, but
1875
+ * it is reused for the new route. This allows you to guard for changes in
1876
+ * params, the query or the hash.
1877
+ *
1878
+ * @param to - RouteLocationRaw we are navigating to
1879
+ * @param from - RouteLocationRaw we are navigating from
1880
+ * @param next - function to validate, cancel or modify (by redirecting) the
1881
+ * navigation
1882
+ */
1883
+ beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
1884
+ /**
1885
+ * Guard called when the router is navigating away from the current route that
1886
+ * is rendering this component.
1887
+ *
1888
+ * @param to - RouteLocationRaw we are navigating to
1889
+ * @param from - RouteLocationRaw we are navigating from
1890
+ * @param next - function to validate, cancel or modify (by redirecting) the
1891
+ * navigation
1892
+ */
1893
+ beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
1894
+ }
1895
+ export interface ComponentCustomProperties {
1896
+ /**
1897
+ * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
1898
+ */
1899
+ $route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
1900
+ /**
1901
+ * {@link Router} instance used by the application.
1902
+ */
1903
+ $router: TypesConfig extends Record<'$router', infer T> ? T : Router;
1904
+ }
1905
+ export interface GlobalComponents {
1906
+ RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
1907
+ RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
1908
+ }
1909
+ }
1910
+ //#endregion
1911
+ //#region ../vue-utils/dist/vue-utils.d.mts
1912
+ type TypedSlot<Prop = any> = (prop: Prop) => VNodeChild;
1913
+ type VNodeChildOrSlot<Prop = any> = VNodeChild | TypedSlot<Prop>;
1914
+ //#endregion
1915
+ //#region src/utils/slots.d.ts
1916
+ type RawSlot = (...args: any[]) => any;
1917
+ type RawSlots = Record<string, RawSlot>;
1918
+ /**
1919
+ * Modify all ReturnTypes of the map type of the Slot
1920
+ *
1921
+ */
1922
+ type NormalizedSlotsReturnTypes<S extends RawSlots, T> = { [K in keyof S]: (...params: Parameters<S[K]>) => T };
1923
+ /**
1924
+ * Map of slots that can be bound as `v-slots` directives.
1925
+ */
1926
+ type SlotsDirectiveBindings<S extends RawSlots> = NormalizedSlotsReturnTypes<S, VNodeChild>;
1927
+ /**
1928
+ * Interface of the slots object that can be referenced in the setup context
1929
+ */
1930
+ /**
1931
+ * Map type of slots that can be set as `slots` option in Vue components
1932
+ */
1933
+ type ResolvedSlots<S extends RawSlots> = SlotsType<NormalizedSlotsReturnTypes<S, VNode[]>>;
1934
+ /**
1935
+ * A factory that generates map types for slots that can be set as `slots` options in Vue components and props options for tsx support
1936
+ *
1937
+ */
1938
+ type DefinedSlots<S extends RawSlots> = ResolvedSlots<S> & {
1939
+ (): {
1940
+ 'v-slots': PropType<SlotsDirectiveBindings<S>>;
1941
+ };
1942
+ };
1943
+ /**
1944
+ * Define Vue slot options and props factory for tsx support
1945
+ *
1946
+ * @example
1947
+ * ```tsx
1948
+ * import { defineComponent } from 'vue';
1949
+ * import { defineSlots } from '@fastkit/vue-utils';
1950
+ *
1951
+ * const slots = defineSlots({
1952
+ * default?: (params: string) => any;
1953
+ * requiredSlots: (optionalParams?: number) => any;
1954
+ * });
1955
+ *
1956
+ * const Component = defineComponent({
1957
+ * props: {
1958
+ * ...slots(), // For tsx
1959
+ * },
1960
+ * slots,
1961
+ * setup() {
1962
+ * // .....
1963
+ * },
1964
+ * });
1965
+ *
1966
+ * <Component
1967
+ * v-slots={{
1968
+ * requiredSlots: (optionalParams) => `${optionalParams || 'fallback message'}`,
1969
+ * default: () => <div>Hello slots.</div>
1970
+ * }}
1971
+ * />
1972
+ * ```
1973
+ *
1974
+ * @returns slot options and props factory
1975
+ */
1976
+ //#endregion
1977
+ //#region ../vue-form-control/dist/vue-form-control.d.mts
1978
+ //#region src/schemes/autocapitalize.d.ts
1979
+ type FormAutoCapitalize = 'off' | 'on' | 'words' | 'characters'; //#endregion
1980
+ //#region src/schemes/autocomplete.d.ts
1981
+ declare const FORM_AUTO_COMPLETES: readonly ["off", "on", "name", "honorific-prefix", "given-name", "additional-name", "family-name", "honorific-suffix", "nickname", "email", "username", "new-password", "current-password", "one-time-code", "organization-title", "organization", "street-address", "address-line1", "address-line2", "address-line3", "address-level4", "address-level3", "address-level2", "address-level1", "country", "country-name", "postal-code", "cc-name", "cc-given-name", "cc-additional-name", "cc-family-name", "cc-number", "cc-exp", "cc-exp-month", "cc-exp-year", "cc-csc", "cc-type", "transaction-currency", "transaction-amount", "language", "bday", "bday-day", "bday-month", "bday-year", "sex", "tel", "tel-country-code", "tel-national", "tel-area-code", "tel-local", "tel-extension", "impp", "url", "photo"];
1982
+ type FormAutoComplete = (typeof FORM_AUTO_COMPLETES)[number]; //#endregion
1983
+ //#region src/schemes/textinput.d.ts
1984
+ type TextFinalizer = (value?: string | null) => string | Promise<string>;
1985
+ declare const BUILTIN_TEXT_FINALIZERS: Record<"trim" | "removeSpace" | "upper" | "lower" | "halfWidth" | "singleSpace", TextFinalizer>;
1986
+ type BuiltinTextFinalizerName = keyof typeof BUILTIN_TEXT_FINALIZERS; //#endregion
1987
+ //#region src/schemes/imask.d.ts
1988
+ //#endregion
1989
+ //#region src/composables/group.d.ts
1990
+ declare function createFormGroupProps(): {
1991
+ /**
1992
+ * Collect the error messages of all nodes belonging to this node
1993
+ *
1994
+ * By default, a node attempts to render error messages on its own, but enabling this setting allows the parent group to manage the rendering of error messages.
1995
+ * If you want to exclude a specific node from this configuration, enable the `showOwnErrors` setting for that node.
1996
+ */
1997
+ collectErrorMessages: BooleanConstructor;
1998
+ /**
1999
+ * Auto scroll to the location of the form when invalid input is detected in the validation on submission
2000
+ */
2001
+ disableAutoScroll: BooleanConstructor;
2002
+ name: StringConstructor;
2003
+ tag: StringConstructor;
2004
+ modelValue: vue2.Prop<unknown, unknown>;
2005
+ tabindex: {
2006
+ type: (StringConstructor | NumberConstructor)[];
2007
+ default: number;
2008
+ };
2009
+ autofocus: BooleanConstructor;
2010
+ disabled: BooleanConstructor;
2011
+ readonly: BooleanConstructor;
2012
+ viewonly: BooleanConstructor;
2013
+ spellcheck: BooleanConstructor;
2014
+ required: BooleanConstructor | vue2.PropType<boolean>;
2015
+ clearable: BooleanConstructor;
2016
+ validateTiming: {
2017
+ type: vue2.PropType<ValidateTiming>;
2018
+ default: ValidateTiming;
2019
+ };
2020
+ rules: {
2021
+ type: vue2.PropType<RecursiveVerifiableRuleOrFn>;
2022
+ default: () => never[];
2023
+ };
2024
+ validationDeps: vue2.PropType<(nodeControl: FormNodeControl) => any>;
2025
+ error: BooleanConstructor;
2026
+ errorMessages: vue2.PropType<string | string[]>;
2027
+ showOwnErrors: {
2028
+ type: BooleanConstructor;
2029
+ default: undefined;
2030
+ };
2031
+ detach: BooleanConstructor;
2032
+ };
2033
+ type FormGroupProps = ExtractPropTypes<ReturnType<typeof createFormGroupProps>>;
2034
+ declare function createFormGroupEmits(): {
2035
+ 'update:modelValue': (value: unknown) => boolean;
2036
+ 'update:errors': (errors: FormNodeError[]) => boolean;
2037
+ change: (value: unknown) => boolean;
2038
+ focus: (ev: FocusEvent) => boolean;
2039
+ blur: (ev: FocusEvent) => boolean;
2040
+ };
2041
+ interface FormGroupEmitOptions extends ReturnType<typeof createFormGroupEmits> {}
2042
+ type FormGroupContext = SetupContext<FormGroupEmitOptions>;
2043
+ interface FormGroupOptions extends FormNodeControlBaseOptions {}
2044
+ declare class FormGroupControl extends FormNodeControl {
2045
+ readonly _props: FormGroupProps;
2046
+ protected _allNodes: Ref<FormNodeControl[]>;
2047
+ protected _allInvalidNodes: ComputedRef<FormNodeControl[]>;
2048
+ /**
2049
+ * All nodes in an error state belonging recursively to this group
2050
+ */
2051
+ get allInvalidNodes(): FormNodeControl<any, any, BooleanConstructor>[];
2052
+ /**
2053
+ * Collect the error messages of all nodes belonging to this node
2054
+ */
2055
+ get collectErrorMessages(): boolean;
2056
+ /**
2057
+ * Auto scroll to the location of the form when invalid input is detected in the validation on submission
2058
+ */
2059
+ get disableAutoScroll(): boolean;
2060
+ /**
2061
+ * List of all nodes belonging to this group
2062
+ *
2063
+ * This list is a reactive list, and depending on usage, it may contain a large number of nodes.
2064
+ * Please be aware that complex operations using this list can lead to performance issues.
2065
+ */
2066
+ get allNodes(): FormNodeControl<any, any, BooleanConstructor>[];
2067
+ constructor(props: FormGroupProps, ctx: FormGroupContext, options?: FormGroupOptions);
2068
+ /** @internal */
2069
+ __joinFromNode(node: FormNodeControl): void;
2070
+ /** @internal */
2071
+ __leaveFromNode(node: FormNodeControl): void;
2072
+ /**
2073
+ * Recursively retrieve the leading node in an error state within this group
2074
+ */
2075
+ findFirstInvalidNode(): FormNodeControl<any, any, BooleanConstructor> | undefined;
2076
+ /**
2077
+ * Scroll to the position of the leading node in an error state within this group
2078
+ */
2079
+ scrollToFirstInvalidNode(): void;
2080
+ protected dispatchAutoScroll(): void;
2081
+ protected _forceFinalize(): boolean;
2082
+ /**
2083
+ * Validate the values of this group and all descendant nodes. If there is one or more errors, scroll to the top error node
2084
+ *
2085
+ * If `disableAutoScroll` is set, scrolling will not be performed.
2086
+ */
2087
+ validateAndScroll(): Promise<boolean>;
2088
+ }
2089
+ //#endregion
2090
+ //#region src/composables/form.d.ts
2091
+ /**
2092
+ * Form action context
2093
+ */
2094
+ interface FormActionContext {
2095
+ /** Control for form element */
2096
+ form: VueForm;
2097
+ /** Action has been canceled */
2098
+ get canceled(): boolean;
2099
+ /** Submit event object */
2100
+ get event(): Event;
2101
+ /**
2102
+ * Cancel the action
2103
+ *
2104
+ * Currently, this method simply sets the `canceled` property of the context to `false`.
2105
+ * This specification is subject to change in the future.
2106
+ */
2107
+ cancel: () => void;
2108
+ }
2109
+ type FormActionHandler = (ctx: FormActionContext) => any;
2110
+ /**
2111
+ * @deprecated
2112
+ * This type has been changed to {@link FormActionHandler}. It will be deprecated in future releases.
2113
+ */
2114
+ type FormAction = string | FormActionHandler;
2115
+ interface FormInvalidSubmissionAcceptorContext {
2116
+ /** Form control */
2117
+ readonly form: VueForm;
2118
+ /**
2119
+ * Accepted
2120
+ */
2121
+ get accepted(): boolean;
2122
+ /**
2123
+ * Accept submission
2124
+ */
2125
+ accept(): void;
2126
+ }
2127
+ type FormInvalidSubmissionAcceptor = (payload: FormInvalidSubmissionAcceptorContext) => void;
2128
+ type FormAcceptInvalidSubmissionSpec = boolean | FormInvalidSubmissionAcceptor;
2129
+ interface FormOptions extends FormGroupOptions {}
2130
+ declare function createFormProps(options?: FormOptions): {
2131
+ /**
2132
+ * Do not perform default HTML validation when submitting the form
2133
+ *
2134
+ * @default true
2135
+ */
2136
+ novalidate: {
2137
+ type: BooleanConstructor;
2138
+ default: boolean;
2139
+ };
2140
+ /**
2141
+ * Action settings for form submission
2142
+ *
2143
+ * Set the destination URL or callback handler
2144
+ */
2145
+ action: PropType<FormAction>;
2146
+ /**
2147
+ * Automatic validation on transmission
2148
+ *
2149
+ * If this setting is enabled, all validation will be done before transmission and the transmission process will be canceled if there are invalid entries
2150
+ *
2151
+ * @default true
2152
+ */
2153
+ autoValidate: {
2154
+ type: BooleanConstructor;
2155
+ default: boolean;
2156
+ };
2157
+ /**
2158
+ * Form is sending
2159
+ */
2160
+ sending: BooleanConstructor;
2161
+ /**
2162
+ * Accept invalid values during form submission
2163
+ *
2164
+ * @default false
2165
+ */
2166
+ acceptInvalidSubmission: {
2167
+ type: PropType<FormAcceptInvalidSubmissionSpec>;
2168
+ default: boolean;
2169
+ };
2170
+ collectErrorMessages: BooleanConstructor;
2171
+ disableAutoScroll: BooleanConstructor;
2172
+ name: StringConstructor;
2173
+ tag: StringConstructor;
2174
+ modelValue: vue2.Prop<unknown, unknown>;
2175
+ tabindex: {
2176
+ type: (StringConstructor | NumberConstructor)[];
2177
+ default: number;
2178
+ };
2179
+ autofocus: BooleanConstructor;
2180
+ disabled: BooleanConstructor;
2181
+ readonly: BooleanConstructor;
2182
+ viewonly: BooleanConstructor;
2183
+ spellcheck: BooleanConstructor;
2184
+ required: BooleanConstructor | PropType<boolean>;
2185
+ clearable: BooleanConstructor;
2186
+ validateTiming: {
2187
+ type: PropType<ValidateTiming>;
2188
+ default: ValidateTiming;
2189
+ };
2190
+ rules: {
2191
+ type: PropType<RecursiveVerifiableRuleOrFn>;
2192
+ default: () => never[];
2193
+ };
2194
+ validationDeps: PropType<(nodeControl: FormNodeControl) => any>;
2195
+ error: BooleanConstructor;
2196
+ errorMessages: PropType<string | string[]>;
2197
+ showOwnErrors: {
2198
+ type: BooleanConstructor;
2199
+ default: undefined;
2200
+ };
2201
+ detach: BooleanConstructor;
2202
+ };
2203
+ type FormProps = ExtractPropTypes<ReturnType<typeof createFormProps>>;
2204
+ declare function createFormEmits(): {
2205
+ /**
2206
+ * Form Submission
2207
+ *
2208
+ * This event is notified when the validation is complete and before the action is called
2209
+ *
2210
+ * @param form - VueForm instance
2211
+ * @param ev - Event
2212
+ */
2213
+ submit: (form: VueForm, ev: Event) => boolean;
2214
+ /**
2215
+ * Updating sending status
2216
+ *
2217
+ * @param sending - sending status
2218
+ * @param form - VueForm instance
2219
+ */
2220
+ 'update:sending': (sending: boolean, form: VueForm) => boolean;
2221
+ /**
2222
+ * The form action has been finished
2223
+ *
2224
+ * @param actionContext - Form action context
2225
+ */
2226
+ finishAction: (actionContext: FormActionContext) => boolean;
2227
+ /**
2228
+ * Failed automatic validation
2229
+ *
2230
+ * @param form - VueForm instance
2231
+ */
2232
+ autoValidationFailed: (form: VueForm) => boolean;
2233
+ 'update:modelValue': (value: unknown) => boolean;
2234
+ 'update:errors': (errors: FormNodeError[]) => boolean;
2235
+ change: (value: unknown) => boolean;
2236
+ focus: (ev: FocusEvent) => boolean;
2237
+ blur: (ev: FocusEvent) => boolean;
2238
+ };
2239
+ interface FormEmitOptions extends ReturnType<typeof createFormEmits> {}
2240
+ type FormContext = SetupContext<FormEmitOptions>;
2241
+ /**
2242
+ * Option to check the submittability of the form
2243
+ */
2244
+ interface PrepareFormSubmissionOptions {
2245
+ /** Skip operability check */
2246
+ skipOperationCheck?: boolean;
2247
+ /** Skip in-progress check during submission */
2248
+ skipSendingCheck?: boolean;
2249
+ /** Skip validation */
2250
+ skipValidation?: boolean;
2251
+ }
2252
+ /**
2253
+ * Dispatch option for form action
2254
+ */
2255
+ interface DispatchFormActionOptions extends PrepareFormSubmissionOptions {
2256
+ /** Submit event object */
2257
+ event?: Event;
2258
+ }
2259
+ interface ComputedFormAttributes {
2260
+ ref: Ref<HTMLFormElement | null>;
2261
+ action: string | undefined;
2262
+ spellcheck: boolean;
2263
+ onSubmit: (ev: Event) => void;
2264
+ novalidate: boolean;
2265
+ 'aria-disabled': boolean;
2266
+ }
2267
+ /**
2268
+ * Control for form element
2269
+ */
2270
+ declare class VueForm extends FormGroupControl {
2271
+ readonly _props: FormProps;
2272
+ protected _formContext: FormContext;
2273
+ protected _nativeAction: ComputedRef<string | undefined>;
2274
+ protected _fnAction: ComputedRef<FormActionHandler | undefined>;
2275
+ protected _formRef: Ref<HTMLFormElement | null, HTMLFormElement | null>;
2276
+ protected _actionPromise: Ref<{
2277
+ then: <TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
2278
+ catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<any>;
2279
+ finally: (onfinally?: (() => void) | null | undefined) => Promise<any>;
2280
+ readonly [Symbol.toStringTag]: string;
2281
+ } | null, Promise<any> | {
2282
+ then: <TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
2283
+ catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<any>;
2284
+ finally: (onfinally?: (() => void) | null | undefined) => Promise<any>;
2285
+ readonly [Symbol.toStringTag]: string;
2286
+ } | null>;
2287
+ protected _sending: ComputedRef<boolean>;
2288
+ protected _formAttrs: ComputedRef<ComputedFormAttributes>;
2289
+ /**
2290
+ * Do not perform default HTML validation when submitting the form
2291
+ */
2292
+ get novalidate(): boolean;
2293
+ get nativeAction(): string | undefined;
2294
+ /**
2295
+ * Executing asynchronous submission action
2296
+ */
2297
+ get sending(): boolean;
2298
+ /**
2299
+ * Automatic validation on transmission
2300
+ *
2301
+ * If this setting is enabled, all validation will be done before transmission and the transmission process will be canceled if there are invalid entries
2302
+ *
2303
+ * @default true
2304
+ */
2305
+ get autoValidate(): boolean;
2306
+ /**
2307
+ * Attributes to apply to the form element
2308
+ */
2309
+ get formAttrs(): ComputedFormAttributes;
2310
+ constructor(props: FormProps, ctx: FormContext, options?: FormOptions);
2311
+ /**
2312
+ * Generates SubmitEvent and dispatches it to the form element
2313
+ *
2314
+ * - If `preventDefault()` is called by the event handler, the sending process is canceled
2315
+ */
2316
+ submit(): void;
2317
+ /**
2318
+ * Returns `true` if the form is in a submittable state after performing state checks and validation
2319
+ *
2320
+ * @param options - PrepareFormSubmissionOptions
2321
+ * @returns `true` if submission is possible
2322
+ */
2323
+ prepareFormSubmission(options?: PrepareFormSubmissionOptions): Promise<boolean>;
2324
+ protected _dispatchAction(options?: DispatchFormActionOptions): Promise<void>;
2325
+ /**
2326
+ * Dispatch the specified action function
2327
+ *
2328
+ * @param options - Dispatch option for form action
2329
+ */
2330
+ dispatchAction(options?: DispatchFormActionOptions): Promise<void>;
2331
+ /**
2332
+ * Handler for form element submission
2333
+ *
2334
+ * @param ev - Submit event object
2335
+ */
2336
+ handleSubmit(ev: Event): void;
2337
+ }
2338
+ //#endregion
2339
+ //#region src/service.d.ts
2340
+ type FormErrorMessageResolver = (error: FormNodeError, node?: FormNodeControl) => string | void;
2341
+ /**
2342
+ * Scroll option for the form element
2343
+ */
2344
+ interface VueFormScrollOptions {
2345
+ /**
2346
+ * Default scroll option
2347
+ *
2348
+ * @see {@link ScrollIntoViewOptions}
2349
+ */
2350
+ options?: ScrollIntoViewOptions;
2351
+ /**
2352
+ * Scroll handler function
2353
+ *
2354
+ * @param element - Scroll target element
2355
+ * @param options - Scroll option
2356
+ * @returns When canceling the default scroll and implementing custom scrolling within the application, return a truthy value.
2357
+ */
2358
+ fn?: (element: HTMLElement, options?: ScrollIntoViewOptions) => void;
2359
+ }
2360
+ interface VueFormServiceOptions {
2361
+ errorMessageResolvers?: FormErrorMessageResolver[];
2362
+ /**
2363
+ * Scroll option for the form element
2364
+ *
2365
+ * @see {@link VueFormScrollOptions}
2366
+ */
2367
+ scroll?: VueFormScrollOptions;
2368
+ /**
2369
+ * Default value for text input autocomplete.
2370
+ *
2371
+ * @see {@link FormAutoComplete}
2372
+ */
2373
+ defaultAutocomplete?: FormAutoComplete | boolean | undefined;
2374
+ }
2375
+ /**
2376
+ * Root service of `vue-form-control`
2377
+ */
2378
+ declare class VueFormService {
2379
+ readonly errorMessageResolvers: FormErrorMessageResolver[];
2380
+ /**
2381
+ * Scroll option for the form element
2382
+ *
2383
+ * @see {@link VueFormScrollOptions}
2384
+ */
2385
+ readonly scroll?: VueFormScrollOptions;
2386
+ constructor(options?: VueFormServiceOptions);
2387
+ addMessageResolver(resolvers: FormErrorMessageResolver | FormErrorMessageResolver[]): void;
2388
+ resolveErrorMessage(error: FormNodeError, node?: FormNodeControl): string | void;
2389
+ scrollToElement(element: HTMLElement, options?: ScrollIntoViewOptions): void;
2390
+ } //#endregion
2391
+ //#region src/composables/wrapper.d.ts
2392
+ type RequiredChipSource = (() => VNodeChild) | string | boolean;
2393
+ type FormNodeWrapperHinttip = boolean | string | (() => VNodeChild);
2394
+ type FormNodeWrapperHinttipDelay = 'click' | number;
2395
+ declare function createFormNodeWrapperProps$1(): {
2396
+ /**
2397
+ * Instance of FormNodeControl
2398
+ *
2399
+ * When this setting is applied, the state and error messages will always refer to the state of this node. If not set, it will attempt to compute them from descendant nodes.
2400
+ */
2401
+ nodeControl: PropType<FormNodeControl>; /** label */
2402
+ label: PropType<VNodeChildOrSlot>; /** hint message */
2403
+ hint: PropType<VNodeChildOrSlot>; /** Settings for displaying hint as tips */
2404
+ hinttip: PropType<FormNodeWrapperHinttip>; /** hint tip Display Delay */
2405
+ hinttipDelay: PropType<FormNodeWrapperHinttipDelay>; /** Elements to be added to the information message */
2406
+ infoAppends: PropType<VNodeChildOrSlot>; /** Hide information */
2407
+ hiddenInfo: BooleanConstructor; /** Chip(required) display settings */
2408
+ requiredChip: PropType<RequiredChipSource>;
2409
+ /**
2410
+ * Collect the error messages of all nodes belonging to this node
2411
+ *
2412
+ * By default, a node attempts to render error messages on its own, but enabling this setting allows the parent wrapper to manage the rendering of error messages.
2413
+ * If you want to exclude a specific node from this configuration, enable the `showOwnErrors` setting for that node.
2414
+ *
2415
+ * @default true
2416
+ */
2417
+ collectErrorMessages: {
2418
+ type: BooleanConstructor;
2419
+ default: boolean;
2420
+ };
2421
+ };
2422
+ type FormNodeWrapperProps = ExtractPropTypes<ReturnType<typeof createFormNodeWrapperProps$1>>;
2423
+ declare function createFormNodeWrapperEmits(): {
2424
+ clickLabel: (ev: PointerEvent, wrapper: FormNodeWrapper) => boolean;
2425
+ };
2426
+ type FormNodeWrapperEmitOptions = ReturnType<typeof createFormNodeWrapperEmits>;
2427
+ type FormNodeWrapperContext = SetupContext<FormNodeWrapperEmitOptions>;
2428
+ interface FormNodeWrapperOptions {
2429
+ hinttipPrepend?: () => VNodeChild;
2430
+ }
2431
+ /**
2432
+ * Form node wrapper
2433
+ */
2434
+ declare class FormNodeWrapper {
2435
+ readonly _props: FormNodeWrapperProps;
2436
+ readonly _service: VueFormService;
2437
+ protected _ctx: FormNodeWrapperContext | undefined;
2438
+ protected _allNodes: Ref<FormNodeControl[]>;
2439
+ protected _labelSlot: ComputedRef<TypedSlot<FormNodeWrapper> | undefined>;
2440
+ protected _hintSlot: ComputedRef<TypedSlot<FormNodeWrapper> | undefined>;
2441
+ protected _hinttip: ComputedRef<VNodeChild>;
2442
+ protected _hinttipDelay: ComputedRef<FormNodeWrapperHinttipDelay | undefined>;
2443
+ protected _hinttipPrepend?: () => VNodeChild;
2444
+ protected _infoAppendsSlot: ComputedRef<TypedSlot<FormNodeWrapper> | undefined>;
2445
+ protected _validating: ComputedRef<boolean>;
2446
+ protected _pending: ComputedRef<boolean>;
2447
+ protected _focused: ComputedRef<boolean>;
2448
+ protected _dirty: ComputedRef<boolean>;
2449
+ protected _disabled: ComputedRef<boolean>;
2450
+ protected _readonly: ComputedRef<boolean>;
2451
+ protected _viewonly: ComputedRef<boolean>;
2452
+ protected _touched: ComputedRef<boolean>;
2453
+ protected _required: ComputedRef<boolean>;
2454
+ protected _invalid: ComputedRef<boolean>;
2455
+ protected _resolvedErrorMessages: ComputedRef<FormNodeErrorMessageSource[]>;
2456
+ /**
2457
+ * Root service of `vue-form-control`
2458
+ *
2459
+ * @see {@link VueFormService}
2460
+ */
2461
+ get service(): VueFormService;
2462
+ /**
2463
+ * Instance of FormNodeControl
2464
+ *
2465
+ * When this setting is applied, the state and error messages will always refer to the state of this node. If not set, it will attempt to compute them from descendant nodes.
2466
+ */
2467
+ get nodeControl(): FormNodeControl | undefined;
2468
+ /**
2469
+ * List of all nodes belonging to this wrapper
2470
+ *
2471
+ * This list is a reactive list, and depending on usage, it may contain a large number of nodes.
2472
+ * Please be aware that complex operations using this list can lead to performance issues.
2473
+ */
2474
+ get allNodes(): FormNodeControl<any, any, BooleanConstructor>[];
2475
+ /**
2476
+ * At least one of the associated nodes is validating the value
2477
+ */
2478
+ get validating(): boolean;
2479
+ /**
2480
+ * Pending processing
2481
+ *
2482
+ * This is marked as `true` during the validation and finalization process of the value
2483
+ */
2484
+ get pending(): boolean;
2485
+ /**
2486
+ * One of the associated nodes is currently focused
2487
+ */
2488
+ get focused(): boolean;
2489
+ /**
2490
+ * The changes to the input value have not been committed yet
2491
+ *
2492
+ * @see {@link FormNodeControl.initialValue initialValue}
2493
+ */
2494
+ get dirty(): boolean;
2495
+ /**
2496
+ * The input value has not been changed from its initial value
2497
+ */
2498
+ get pristine(): boolean;
2499
+ /**
2500
+ * All associated nodes are disabled
2501
+ */
2502
+ get isDisabled(): boolean;
2503
+ /**
2504
+ * All associated nodes are read-only
2505
+ */
2506
+ get isReadonly(): boolean;
2507
+ /**
2508
+ * All associated nodes are view-only
2509
+ */
2510
+ get isViewonly(): boolean;
2511
+ /**
2512
+ * All associated nodes are operable
2513
+ */
2514
+ get canOperation(): boolean;
2515
+ /**
2516
+ * One of the associated nodes has already been touched
2517
+ */
2518
+ get touched(): boolean;
2519
+ /**
2520
+ * None of the associated nodes has been touched yet
2521
+ */
2522
+ get untouched(): boolean;
2523
+ /**
2524
+ * One of the associated nodes requires input
2525
+ */
2526
+ get isRequired(): boolean;
2527
+ /**
2528
+ * There is an error in the input value of one of the associated nodes
2529
+ */
2530
+ get invalid(): boolean;
2531
+ /**
2532
+ * No errors in the input values of all associated nodes
2533
+ */
2534
+ get valid(): boolean;
2535
+ /**
2536
+ * Collect the error messages of all nodes belonging to this node
2537
+ */
2538
+ get collectErrorMessages(): boolean;
2539
+ /**
2540
+ * Source code for all collected error messages
2541
+ *
2542
+ * This list is generated based on the setting of {@link FormNodeControl.showOwnErrors showOwnErrors}.
2543
+ *
2544
+ * @see {@link FormNodeErrorMessageSource}
2545
+ */
2546
+ get errorMessages(): FormNodeErrorMessageSource[];
2547
+ /**
2548
+ * Source code for the first error message among all collected messages
2549
+ *
2550
+ * This list is generated based on the setting of {@link FormNodeControl.showOwnErrors showOwnErrors}.
2551
+ *
2552
+ * @see {@link FormNodeErrorMessageSource}
2553
+ */
2554
+ get firstErrorMessage(): FormNodeErrorMessageSource | undefined;
2555
+ get labelSlot(): TypedSlot<FormNodeWrapper> | undefined;
2556
+ get hintSlot(): TypedSlot<FormNodeWrapper> | undefined;
2557
+ get infoAppendsSlot(): TypedSlot<FormNodeWrapper> | undefined;
2558
+ get hinttipDelay(): FormNodeWrapperHinttipDelay | undefined;
2559
+ constructor(props: FormNodeWrapperProps, ctx: FormNodeWrapperContext, options?: FormNodeWrapperOptions);
2560
+ renderLabel(): vue2.VNodeArrayChildren | undefined;
2561
+ renderHint(allowNotFocused?: boolean): vue2.VNodeArrayChildren | undefined;
2562
+ renderInfoAppends(): vue2.VNodeArrayChildren | undefined;
2563
+ protected _getContextOrDie(): {
2564
+ attrs: {
2565
+ [x: string]: unknown;
2566
+ };
2567
+ slots: Readonly<{
2568
+ [name: string]: vue2.Slot<any> | undefined;
2569
+ }>;
2570
+ emit: (event: "clickLabel", ev: PointerEvent, wrapper: FormNodeWrapper) => void;
2571
+ expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
2572
+ };
2573
+ renderFirstError(slotsOverrides?: FormNodeErrorSlotsSource): vue2.VNodeArrayChildren | undefined;
2574
+ renderMessage(allowNotFocused?: boolean): vue2.VNodeArrayChildren | " ";
2575
+ renderHinttip(): {
2576
+ tip: VNodeChild;
2577
+ hint: VNodeChild;
2578
+ } | undefined;
2579
+ /** @internal */
2580
+ __joinFromNode(node: FormNodeControl): void;
2581
+ /** @internal */
2582
+ __leaveFromNode(node: FormNodeControl): void;
2583
+ /**
2584
+ * Generate a Proxy instance that extends the interface for this wrapper.
2585
+ *
2586
+ * @param trait - trait object
2587
+ * @returns Mixed-in Proxy
2588
+ */
2589
+ extend<U extends object>(trait: U): Mixin<this, U>;
2590
+ }
2591
+ //#endregion
2592
+ //#region src/composables/node.d.ts
2593
+ type RecursiveVerifiableRuleOrFn = RecursiveArray<VerifiableRuleOrFn>;
2594
+ type FormNodeType = string | number | symbol;
2595
+ interface FormNodeError extends Omit<ValidationError, '$$symbol'> {}
2596
+ /**
2597
+ * Validation Timing
2598
+ *
2599
+ * - `always` Always validate
2600
+ * - `touch` Once touched, always validated thereafter.
2601
+ * - `blur` Once the focus is removed from the element at least once, subsequent validations will always be performed.
2602
+ * - `change` Once the value is changed at least once, subsequent validations will always be performed.
2603
+ * - `manual` Validation is not performed automatically. Only manual validation through programming is possible.
2604
+ *
2605
+ */
2606
+ type ValidateTiming = 'always' | 'touch' | 'blur' | 'change' | 'manual';
2607
+ type ValidationResult = ValidationError[] | null;
2608
+ type ValidateResolver = (result: ValidationResult) => void;
2609
+ type FormNodeStateExtension = (nodeControl: FormNodeControl, computedValue: boolean) => boolean;
2610
+ interface FormNodeStateExtensions {
2611
+ disabled?: FormNodeStateExtension;
2612
+ readonly?: FormNodeStateExtension;
2613
+ viewonly?: FormNodeStateExtension;
2614
+ canOperation?: FormNodeStateExtension;
2615
+ }
2616
+ interface FormNodeControlBaseOptions {
2617
+ nodeType?: FormNodeType;
2618
+ requiredFactory?: () => Rule<any> | undefined;
2619
+ defaultValidateTiming?: ValidateTiming;
2620
+ validationValue?: () => any;
2621
+ stateExtensions?: FormNodeStateExtensions;
2622
+ /** Add a custom error message */
2623
+ errorMessages?: () => string | string[] | undefined;
2624
+ }
2625
+ interface FormNodeControlOptions<T = any, D = T, Required extends Prop<any> = BooleanConstructor> extends FormNodeControlBaseOptions {
2626
+ modelValue?: Prop<T, D>;
2627
+ required?: Required;
2628
+ shallow?: boolean;
2629
+ }
2630
+ type FormNodeErrorSlotsSource = {
2631
+ /** Error message */error?: (error: FormNodeError) => any;
2632
+ } & { [K in `error:${string}`]: (error: FormNodeError) => any };
2633
+ declare function createFormNodeProps<T, D = T, Required extends Prop<any> = PropType<boolean>>(options?: FormNodeControlOptions<T, D, Required>): {
2634
+ /**
2635
+ * form node name
2636
+ *
2637
+ * This is set as is for input elements.
2638
+ */
2639
+ name: StringConstructor;
2640
+ /**
2641
+ * Tag string for node searching
2642
+ */
2643
+ tag: StringConstructor; /** model value */
2644
+ modelValue: Prop<T, D>;
2645
+ /**
2646
+ * Tab index
2647
+ *
2648
+ * @default 0
2649
+ *
2650
+ * @see https://developer.mozilla.org/docs/Web/HTML/Global_attributes/tabindex
2651
+ */
2652
+ tabindex: {
2653
+ type: (StringConstructor | NumberConstructor)[];
2654
+ default: number;
2655
+ }; /** Automatic focus */
2656
+ autofocus: BooleanConstructor; /** disabled state */
2657
+ disabled: BooleanConstructor; /** read-only state */
2658
+ readonly: BooleanConstructor; /** view-only state */
2659
+ viewonly: BooleanConstructor;
2660
+ /**
2661
+ * Spell Check Settings
2662
+ *
2663
+ * @see https://developer.mozilla.org/docs/Web/HTML/Global_attributes/spellcheck
2664
+ */
2665
+ spellcheck: BooleanConstructor; /** required */
2666
+ required: BooleanConstructor | Required; /** clearable */
2667
+ clearable: BooleanConstructor;
2668
+ /**
2669
+ * Validation Timing
2670
+ *
2671
+ * - `always` Always validate
2672
+ * - `touch` Once touched, always validated thereafter.
2673
+ * - `blur` Once the focus is removed from the element at least once, subsequent validations will always be performed.
2674
+ * - `change` Once the value is changed at least once, subsequent validations will always be performed.
2675
+ * - `manual` Validation is not performed automatically. Only manual validation through programming is possible.
2676
+ *
2677
+ * @see {@link ValidateTiming}
2678
+ */
2679
+ validateTiming: {
2680
+ type: PropType<ValidateTiming>;
2681
+ default: ValidateTiming;
2682
+ };
2683
+ /**
2684
+ * List of validation rules
2685
+ */
2686
+ rules: {
2687
+ type: PropType<RecursiveVerifiableRuleOrFn>;
2688
+ default: () => never[];
2689
+ };
2690
+ /**
2691
+ * Validation dependencies
2692
+ *
2693
+ * In vue-form-control, validation is performed again whenever the input value or related values change. However, if the validation condition references values from other nodes or external reactive values that are not included in the node, those changes cannot be detected.
2694
+ * By registering a function that returns such external reactive values, validation can be automatically triggered.
2695
+ */
2696
+ validationDeps: PropType<(nodeControl: FormNodeControl) => any>; /** Force an error state. */
2697
+ error: BooleanConstructor; /** List of error messages. */
2698
+ errorMessages: PropType<string | string[]>;
2699
+ /**
2700
+ * Display error messages on this node itself
2701
+ *
2702
+ * If `true`, attempts to render errors for this node itself; if `false`, delegates error message display to the associated form group or wrapper.
2703
+ *
2704
+ * @default `false` if a parent group or wrapper exists and the `collectErrorMessages` setting is enabled; otherwise, `true`.
2705
+ */
2706
+ showOwnErrors: {
2707
+ type: BooleanConstructor;
2708
+ default: undefined;
2709
+ };
2710
+ /**
2711
+ * Detach and become independent from the parent node
2712
+ *
2713
+ * By default, the form node inherits the state of the form node existing in the parent tree and notifies the parent node of its own validation status, among other things. This option disables that behavior, allowing this node and its descendants to be detached from the parent node.
2714
+ */
2715
+ detach: BooleanConstructor;
2716
+ };
2717
+ type FormNodeProps = ExtractPropTypes<ReturnType<typeof createFormNodeProps>>;
2718
+ declare class Wrapper<T, D = T> {
2719
+ wrapped(options: FormNodeControlOptions<T, D>): {
2720
+ /**
2721
+ * Update Model Values
2722
+ */
2723
+ 'update:modelValue': (value: T | D) => boolean;
2724
+ /**
2725
+ * Updating error content.
2726
+ * @param errors - List of error contents.
2727
+ */
2728
+ 'update:errors': (errors: FormNodeError[]) => boolean;
2729
+ /**
2730
+ * Update Model Values
2731
+ */
2732
+ change: (value: T | D) => boolean;
2733
+ /**
2734
+ * Focus on an element.
2735
+ * @param ev - FocusEvent
2736
+ */
2737
+ focus: (ev: FocusEvent) => boolean;
2738
+ /**
2739
+ * The focus is removed from an element.
2740
+ * @param ev - FocusEvent
2741
+ */
2742
+ blur: (ev: FocusEvent) => boolean;
2743
+ };
2744
+ }
2745
+ interface FormNodeEmitOptions<T, D = T> extends ReturnType<Wrapper<T, D>['wrapped']> {}
2746
+ type FormNodeContext<T, D = T> = SetupContext<FormNodeEmitOptions<T, D>>;
2747
+ /**
2748
+ * Source code for rendering error messages of form nodes
2749
+ */
2750
+ interface FormNodeErrorMessageSource {
2751
+ /** Render error message */
2752
+ render: (slotsOverrides?: FormNodeErrorSlotsSource) => VNodeArrayChildren;
2753
+ /**
2754
+ * Error object
2755
+ *
2756
+ * @see {@link FormNodeError}
2757
+ */
2758
+ error: FormNodeError;
2759
+ /**
2760
+ * Node holding the error
2761
+ *
2762
+ * @see {@link FormNodeControl}
2763
+ */
2764
+ node: FormNodeControl;
2765
+ /**
2766
+ * Automatically generated key
2767
+ *
2768
+ * Can be safely used as the key for the vnode when rendering in lists, etc.
2769
+ */
2770
+ key: string;
2771
+ }
2772
+ /**
2773
+ * Base class for all form nodes
2774
+ */
2775
+ declare class FormNodeControl<T = any, D = T, Required extends Prop<any> = BooleanConstructor> {
2776
+ readonly _props: FormNodeProps;
2777
+ readonly _service: VueFormService;
2778
+ readonly nodeType?: FormNodeType;
2779
+ readonly __multiple: boolean;
2780
+ protected _isMounted: Ref<boolean, boolean>;
2781
+ protected _mountedId: Ref<number | undefined, number | undefined>;
2782
+ protected _ctx: FormNodeContext<T, D>;
2783
+ protected _parentNode: FormNodeControl | null;
2784
+ protected _parentForm: VueForm | null;
2785
+ protected _parentFormGroup: FormGroupControl | null;
2786
+ protected _parentFormNodeWrapper: FormNodeWrapper | null;
2787
+ protected _booted: Ref<boolean, boolean>;
2788
+ protected _name: ComputedRef<string | undefined>;
2789
+ protected _value: Ref<T | D>;
2790
+ protected _initialValue: Ref<T | D>;
2791
+ protected _focused: Ref<boolean, boolean>;
2792
+ protected _children: Ref<FormNodeControl[]>;
2793
+ protected _invalidChildren: ComputedRef<FormNodeControl[]>;
2794
+ protected _finalizePromise: Ref<(() => Promise<void>) | null>;
2795
+ protected _validationErrors: Ref<ValidationError[]>;
2796
+ protected _validateResolvers: ValidateResolver[];
2797
+ protected _lastValidateValueChanged: boolean;
2798
+ protected _validating: Ref<boolean, boolean>;
2799
+ protected _validateRequestId: number;
2800
+ protected _isDestroyed: boolean;
2801
+ protected _dirty: ComputedRef<boolean>;
2802
+ protected _touched: Ref<boolean, boolean>;
2803
+ protected _shouldValidate: Ref<boolean, boolean>;
2804
+ protected _currentValue: WritableComputedRef<T | D>;
2805
+ protected _errorMessages: ComputedRef<string[]>;
2806
+ protected _errors: ComputedRef<FormNodeError[]>;
2807
+ protected _resolvedErrorMessages: ComputedRef<FormNodeErrorMessageSource[]>;
2808
+ protected _errorCount: ComputedRef<number>;
2809
+ protected _isDisabled: ComputedRef<boolean>;
2810
+ protected _isReadonly: ComputedRef<boolean>;
2811
+ protected _isViewonly: ComputedRef<boolean>;
2812
+ protected _canOperation: ComputedRef<boolean>;
2813
+ protected _rules: ComputedRef<VerifiableRule[]>;
2814
+ protected _hasRequired: ComputedRef<boolean>;
2815
+ protected _tabindex: ComputedRef<number>;
2816
+ protected _cii: ComponentInternalInstance | null;
2817
+ protected _validationValueGetter?: () => any;
2818
+ protected _shouldSkipValidation: boolean;
2819
+ protected _stateExtensions: FormNodeStateExtensions;
2820
+ protected _requiredFactory: () => Rule<any> | undefined;
2821
+ /**
2822
+ * Root service of `vue-form-control`
2823
+ *
2824
+ * @see {@link VueFormService}
2825
+ */
2826
+ get service(): VueFormService;
2827
+ /**
2828
+ * form node name
2829
+ *
2830
+ * This is set as is for input elements.
2831
+ */
2832
+ get name(): string | undefined;
2833
+ /**
2834
+ * Tag string for node searching
2835
+ */
2836
+ get tag(): string | undefined;
2837
+ /** Parent node */
2838
+ get parentNode(): FormNodeControl | null;
2839
+ /** Parent form group */
2840
+ get parentFormGroup(): FormGroupControl | null;
2841
+ /** Parent form node wrapper */
2842
+ get parentFormNodeWrapper(): FormNodeWrapper | null;
2843
+ /** Parent form */
2844
+ get parentForm(): VueForm | null;
2845
+ /** Automatic focus */
2846
+ get autofocus(): boolean;
2847
+ /**
2848
+ * Detached and independent from the parent node
2849
+ */
2850
+ get detached(): boolean;
2851
+ /**
2852
+ * Component created
2853
+ *
2854
+ * @remarks
2855
+ * Please be aware that it may not have been mounted yet.
2856
+ */
2857
+ get booted(): boolean;
2858
+ /** Component mounted */
2859
+ get isMounted(): boolean;
2860
+ /** If already mounted, its unique ID. */
2861
+ get mountedId(): number | undefined;
2862
+ /** If already mounted, its unique ID. */
2863
+ get mountedNodeId(): string | undefined;
2864
+ /** Finalizing the value adjustment process */
2865
+ get isFinalizing(): boolean;
2866
+ /** Validating the value */
2867
+ get validating(): boolean;
2868
+ /**
2869
+ * Pending processing
2870
+ *
2871
+ * This is marked as `true` during the validation and finalization process of the value
2872
+ */
2873
+ get pending(): boolean;
2874
+ /** Current input value */
2875
+ get value(): T | D;
2876
+ set value(value: T | D);
2877
+ /** Value used for validation */
2878
+ get validationValue(): any;
2879
+ /** In focus */
2880
+ get focused(): boolean;
2881
+ /**
2882
+ * Initial value before commit
2883
+ *
2884
+ * This value, once initialized with the value passed when the FormNode is instantiated, will not be modified from within the vue-form-control package internals.
2885
+ * Calling the commit series of methods from the application side updates the value to its state at that moment.
2886
+ *
2887
+ * @see {@link FormNodeControl.commitSelfValue commitSelfValue}
2888
+ * @see {@link FormNodeControl.commitValue commitValue}
2889
+ * @see {@link FormNodeControl.commitSelf commitSelf}
2890
+ * @see {@link FormNodeControl.commit commit}
2891
+ */
2892
+ get initialValue(): T | D;
2893
+ /**
2894
+ * The changes to the input value have not been committed yet
2895
+ *
2896
+ * @see {@link FormNodeControl.initialValue initialValue}
2897
+ */
2898
+ get dirty(): boolean;
2899
+ /**
2900
+ * The input value has not been changed from its initial value
2901
+ */
2902
+ get pristine(): boolean;
2903
+ /**
2904
+ * Touched the elements of this node at least once
2905
+ */
2906
+ get touched(): boolean;
2907
+ set touched(touched: boolean);
2908
+ /**
2909
+ * Not touched the elements of this node yet.
2910
+ */
2911
+ get untouched(): boolean;
2912
+ /**
2913
+ * The list of FormNode instances directly belonging to this node as children
2914
+ */
2915
+ get children(): FormNodeControl[];
2916
+ /**
2917
+ * The list of FormNode instances directly belonging to itself, and possessing one or more errors
2918
+ */
2919
+ get invalidChildren(): FormNodeControl[];
2920
+ /**
2921
+ * The list of validation errors for the value within itself
2922
+ */
2923
+ get validationErrors(): ValidationError[];
2924
+ /**
2925
+ * The list of all errors within itself
2926
+ *
2927
+ * This is a merged list of error messages injected through properties and its own `validationErrors`.
2928
+ *
2929
+ * @remarks
2930
+ * This list does not include error information specified with the `error` attribute.
2931
+ */
2932
+ get errors(): FormNodeError[];
2933
+ /**
2934
+ * Source code for all collected error messages
2935
+ *
2936
+ * This list is generated based on the setting of {@link FormNodeControl.showOwnErrors showOwnErrors}.
2937
+ *
2938
+ * @see {@link FormNodeErrorMessageSource}
2939
+ */
2940
+ get errorMessages(): FormNodeErrorMessageSource[];
2941
+ /**
2942
+ * Source code for the first error message among all collected messages
2943
+ *
2944
+ * This list is generated based on the setting of {@link FormNodeControl.showOwnErrors showOwnErrors}.
2945
+ *
2946
+ * @see {@link FormNodeErrorMessageSource}
2947
+ */
2948
+ get firstErrorMessage(): FormNodeErrorMessageSource | undefined;
2949
+ /**
2950
+ * Whether itself has one or more errors
2951
+ *
2952
+ * @remarks
2953
+ * This also takes into consideration the configuration of the `error` property.
2954
+ */
2955
+ get hasMyError(): boolean;
2956
+ /**
2957
+ * The number of errors it possesses
2958
+ */
2959
+ get errorCount(): number;
2960
+ /**
2961
+ * Either itself or the parent node has one or more errors.
2962
+ */
2963
+ get hasError(): boolean;
2964
+ /**
2965
+ * Either itself or the parent node is in a disabled state.
2966
+ */
2967
+ get isDisabled(): boolean;
2968
+ /**
2969
+ * Either itself or the parent node is in a read-only state.
2970
+ */
2971
+ get isReadonly(): boolean;
2972
+ /**
2973
+ * Either itself or the parent node is in a view-only state.
2974
+ */
2975
+ get isViewonly(): boolean;
2976
+ /**
2977
+ * Operable
2978
+ */
2979
+ get canOperation(): boolean;
2980
+ /**
2981
+ * Validation Timing
2982
+ *
2983
+ *@see {@link ValidateTiming}
2984
+ */
2985
+ get validateTiming(): ValidateTiming;
2986
+ /**
2987
+ * Always perform value validation.
2988
+ */
2989
+ get validateTimingIsAlways(): boolean;
2990
+ /**
2991
+ * Perform value validation only when the elements of this node have been touched at least once.
2992
+ */
2993
+ get validateTimingIsTouch(): boolean;
2994
+ /**
2995
+ * Perform value validation when focus is removed from the elements of this node.
2996
+ */
2997
+ get validateTimingIsBlur(): boolean;
2998
+ /**
2999
+ * Perform value validation when the input value changes.
3000
+ */
3001
+ get validateTimingIsChange(): boolean;
3002
+ /**
3003
+ * Value validation is manually performed on the application side.
3004
+ */
3005
+ get validateTimingIsManual(): boolean;
3006
+ /**
3007
+ * The list of all rules, including those specified in the properties under 'rules' and others calculated from values related to rule logic.
3008
+ */
3009
+ get rules(): VerifiableRule[];
3010
+ /**
3011
+ * Input is required
3012
+ *
3013
+ * @remarks
3014
+ * This checks whether there is at least one 'required' rule in the 'required' setting or within the specified 'rules'.
3015
+ */
3016
+ get isRequired(): boolean;
3017
+ /**
3018
+ * The component has been destroyed
3019
+ */
3020
+ get isDestroyed(): boolean;
3021
+ /**
3022
+ * There is at least one node in an error state among the nodes directly under this node
3023
+ */
3024
+ get hasInvalidChild(): boolean;
3025
+ /**
3026
+ * Either this node or one of its descendants has an error
3027
+ */
3028
+ get invalid(): boolean;
3029
+ /**
3030
+ * This node and none of its descendants have an error
3031
+ */
3032
+ get valid(): boolean;
3033
+ /**
3034
+ * Tab index
3035
+ *
3036
+ * When the node is disabled, it is forcibly set to `-1`.
3037
+ */
3038
+ get tabindex(): number;
3039
+ /**
3040
+ * Spell Check Settings
3041
+ *
3042
+ * @see https://developer.mozilla.org/docs/Web/HTML/Global_attributes/spellcheck
3043
+ */
3044
+ get spellcheck(): boolean;
3045
+ /**
3046
+ * The input value should be validated
3047
+ *
3048
+ * This varies based on the specified `validateTiming` and the user's interaction status.
3049
+ */
3050
+ get shouldValidate(): boolean;
3051
+ /**
3052
+ * The form to which this node belongs is currently executing an asynchronous submission action
3053
+ *
3054
+ * @remarks
3055
+ * If the `detach` option is set, this will always be `false`.
3056
+ */
3057
+ get sending(): boolean;
3058
+ /**
3059
+ * The current Vue instance initializing this node
3060
+ */
3061
+ get currentInstance(): ComponentInternalInstance | null;
3062
+ /**
3063
+ * The host element of the current Vue instance initializing this node
3064
+ */
3065
+ get currentEl(): HTMLElement | null;
3066
+ /**
3067
+ * Multiple input mode
3068
+ */
3069
+ get multiple(): boolean;
3070
+ /**
3071
+ * Display error messages on this node itself
3072
+ */
3073
+ get showOwnErrors(): boolean;
3074
+ /**
3075
+ * Whether to temporarily skip validation.
3076
+ * Useful for internal operations where validation is not needed.
3077
+ */
3078
+ get shouldSkipValidation(): boolean;
3079
+ readonly shallow: boolean;
3080
+ constructor(props: FormNodeProps, ctx: FormNodeContext<T, D>, options: FormNodeControlOptions<T, D, Required>);
3081
+ /** @internal */
3082
+ _createFormNodeErrorMessageSource(error: FormNodeError, index: number, slotsOverrides?: FormNodeErrorSlotsSource): FormNodeErrorMessageSource;
3083
+ protected hasRequiredRule(): VerifiableRule | undefined;
3084
+ /**
3085
+ * Recursively searches and retrieves the FormNode belonging to this node.
3086
+ *
3087
+ * @param predicate - Predicate executed recursively on descendant elements
3088
+ */
3089
+ findNodeRecursive(predicate: (node: FormNodeControl) => unknown): FormNodeControl | undefined;
3090
+ /**
3091
+ * Recursively retrieves all FormNodes belonging to this node.
3092
+ *
3093
+ * @param predicate - Predicate executed recursively on descendant elements
3094
+ */
3095
+ filterNodesRecursive(predicate: (node: FormNodeControl) => unknown): FormNodeControl[];
3096
+ /**
3097
+ * Search for a node within this node that matches the specified name
3098
+ *
3099
+ * @param name Node name
3100
+ */
3101
+ findNodeByName(name: string): FormNodeControl | undefined;
3102
+ /**
3103
+ * Search for a node within this node that matches the specified tag
3104
+ *
3105
+ * @param tag Tag string
3106
+ */
3107
+ findNodeByTag(tag: string): FormNodeControl | undefined;
3108
+ protected _getContextOrDie(): {
3109
+ attrs: {
3110
+ [x: string]: unknown;
3111
+ };
3112
+ slots: Readonly<{
3113
+ [name: string]: vue2.Slot<any> | undefined;
3114
+ }>;
3115
+ emit: ((event: "blur", ev: FocusEvent) => void) & ((event: "change", value: T | D) => void) & ((event: "update:modelValue", value: T | D) => void) & ((event: "update:errors", errors: FormNodeError[]) => void) & ((event: "focus", ev: FocusEvent) => void);
3116
+ expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
3117
+ };
3118
+ /**
3119
+ * Render the specified error source as a `VNodeArrayChildren`
3120
+ *
3121
+ * @param errorSource - string or FormNodeError
3122
+ */
3123
+ renderErrorSource(errorSource: string | FormNodeError, slotsOverrides?: FormNodeErrorSlotsSource): VNodeArrayChildren;
3124
+ protected _finalize(): Promise<void>;
3125
+ /**
3126
+ * Finalize the input value
3127
+ */
3128
+ finalize(): Promise<void>;
3129
+ /**
3130
+ * Ensure that the input value is finalized
3131
+ */
3132
+ ensureFinalized(): Promise<void>;
3133
+ /**
3134
+ * Ensure that the value of the self-node and all its child nodes is finalized
3135
+ */
3136
+ finalizeAll(): Promise<void>;
3137
+ /**
3138
+ * Set the value
3139
+ *
3140
+ * @param value - value
3141
+ */
3142
+ setValue(value: T | D): boolean;
3143
+ protected _syncValueFromProps(value: any): void;
3144
+ protected _resolveRules(): VerifiableRule[];
3145
+ /**
3146
+ * Set the validation execution necessity
3147
+ *
3148
+ * @param shouldValidate - The input value should be validated
3149
+ */
3150
+ setShouldValidate(shouldValidate: boolean): void;
3151
+ /**
3152
+ * Retrieve the default value when there is no input value
3153
+ */
3154
+ emptyValue(): T | D;
3155
+ /**
3156
+ * If the specified value is nullable, return `emptyValue`; otherwise, return the specified value as is
3157
+ *
3158
+ * @param value - Any value
3159
+ */
3160
+ safeModelValue(value: any): T | D;
3161
+ /**
3162
+ * Find and retrieve a rule corresponding to the specified name or a name matching the regular expression
3163
+ *
3164
+ * @param ruleName - Name or regular expression
3165
+ */
3166
+ findRule(ruleName: string | RegExp): VerifiableRule | undefined;
3167
+ /**
3168
+ * Reset the input value of this node to the initial value or the value at the last commit, whichever is applicable
3169
+ *
3170
+ * @see {@link FormNodeControl.initialValue initialValue}
3171
+ *
3172
+ * @remarks
3173
+ * This method does not reset the validation state. Typically, consider using {@link FormNodeControl.resetSelf resetSelf}.
3174
+ */
3175
+ resetSelfValue(): void;
3176
+ /**
3177
+ * Reset the input value of this node and all its descendant nodes to the initial value or the value at the last commit, whichever is applicable
3178
+ *
3179
+ * @see {@link FormNodeControl.resetSelfValue resetSelfValue}
3180
+ *
3181
+ * @remarks
3182
+ * This method does not reset the validation state. Typically, consider using {@link FormNodeControl.resetSelf reset}.
3183
+ */
3184
+ resetValue(): void;
3185
+ /**
3186
+ * Set the current input value as the initial value for this node.
3187
+ *
3188
+ * @remarks
3189
+ * This method does not reset the validation state. Typically, consider using {@link FormNodeControl.commitSelf commitSelf}.
3190
+ */
3191
+ commitSelfValue(): void;
3192
+ /**
3193
+ * Set the current input value as the initial value for this node and all its descendant nodes
3194
+ *
3195
+ * @remarks
3196
+ * This method does not reset the validation state. Typically, consider using {@link FormNodeControl.commit commit}.
3197
+ */
3198
+ commitValue(): void;
3199
+ private _resetGuard;
3200
+ /**
3201
+ * Reset the validation state of this node
3202
+ *
3203
+ * @remarks
3204
+ * This method does not perform a reset on descendant nodes. Typically, consider using {@link FormNodeControl.resetValidates resetValidates}.
3205
+ */
3206
+ resetSelfValidates(): void;
3207
+ /**
3208
+ * Reset the validation state of this node and all its descendant nodes
3209
+ */
3210
+ resetValidates(): void;
3211
+ /**
3212
+ * Reset the input value of this node to the initial value and reset the validation state
3213
+ *
3214
+ * @remarks
3215
+ * This method does not reset the state of descendant nodes. Typically, consider using {@link FormNodeControl.reset reset}.
3216
+ */
3217
+ resetSelf(): void;
3218
+ /**
3219
+ * Execute any process while skipping ongoing asynchronous validation, if any
3220
+ *
3221
+ * @param fn - The function to be executed
3222
+ */
3223
+ skipValidation(fn: (...args: any) => any): Promise<void>;
3224
+ /**
3225
+ * Reset the input value of this node and all its descendant nodes to the initial value and reset the validation state
3226
+ */
3227
+ reset(): Promise<void>;
3228
+ /**
3229
+ * Clear the input value of this node
3230
+ */
3231
+ clearSelf(): void;
3232
+ /**
3233
+ * Clear the input value of this node and all its descendant nodes
3234
+ */
3235
+ clear(): void;
3236
+ /**
3237
+ * Set the current input value of this node as the initial value and reset the validation state
3238
+ *
3239
+ * @remarks
3240
+ * This method does not reset the state of descendant nodes. Typically, consider using {@link FormNodeControl.commit commit}.
3241
+ */
3242
+ commitSelf(): void;
3243
+ /**
3244
+ * Set the current input value as the initial value for this node and all its descendant nodes, and reset the validation state
3245
+ */
3246
+ commit(): void;
3247
+ focus(opts?: FocusOptions): void;
3248
+ blur(): void;
3249
+ protected _forceFinalize(): boolean | undefined;
3250
+ /**
3251
+ * Execute validation for this node and all its descendant nodes, and retrieve the validation results
3252
+ *
3253
+ * @param force - Force execution
3254
+ * @param forceFinalize - Always finalize the value before validation
3255
+ *
3256
+ * @returns If validation is successful, return `true`.
3257
+ */
3258
+ validate(force?: boolean, forceFinalize?: boolean | undefined): Promise<boolean>;
3259
+ /**
3260
+ * Validate all nodes belonging to this node
3261
+ *
3262
+ * @remarks
3263
+ * Typically, consider using {@link FormNodeControl.validate validate}.
3264
+ *
3265
+ * @param force - Force execution
3266
+ * @param forceFinalize - Always finalize the value before validation
3267
+ */
3268
+ validateChildren(force?: boolean, forceFinalize?: boolean | undefined): Promise<boolean[]>;
3269
+ protected _allowFinalize(): boolean;
3270
+ /**
3271
+ * Validate the input value of this node
3272
+ *
3273
+ * This method usually cancels execution and returns the previous result in the following conditions:
3274
+ *
3275
+ * - The value for validation has not changed since the last validation.
3276
+ * - Currently, asynchronous validation is in progress.
3277
+ *
3278
+ * If you want to ignore this and force validation, specify `true` for the `force` argument
3279
+ *
3280
+ * @param force - Force execution
3281
+ * @param forceFinalize - Always finalize the value before validation
3282
+ *
3283
+ * @returns Validation result (either the list of validation errors or null).
3284
+ *
3285
+ * @remarks
3286
+ * This method does not perform a reset on descendant nodes. Typically, consider using {@link FormNodeControl.validate validate}.
3287
+ */
3288
+ validateSelf(force?: boolean, forceFinalize?: boolean | undefined): Promise<ValidationResult>;
3289
+ private resolveValidateResolvers;
3290
+ private clearValidateResolvers;
3291
+ /** @internal */
3292
+ _joinFromNode(node: FormNodeControl): void;
3293
+ /** @internal */
3294
+ _leaveFromNode(node: FormNodeControl): void;
3295
+ focusHandler(ev: FocusEvent): void;
3296
+ blurHandler(ev: FocusEvent): void;
3297
+ /**
3298
+ * Scroll to the visible position of the host element of this node
3299
+ *
3300
+ * @param options - options
3301
+ */
3302
+ scrollIntoView(options?: ScrollIntoViewOptions): void;
3303
+ /**
3304
+ * Generate a Proxy instance that extends the interface for this node.
3305
+ *
3306
+ * @param trait - trait object
3307
+ * @returns Mixed-in Proxy
3308
+ */
3309
+ extend<U extends object>(trait: U): Mixin<this, U>;
3310
+ }
3311
+ //#endregion
3312
+ //#region src/composables/textable.d.ts
3313
+ type TextableFinalizerSpec = TextFinalizer | BuiltinTextFinalizerName | (TextFinalizer | BuiltinTextFinalizerName)[];
3314
+ //#endregion
3315
+ //#region src/plugin.d.ts
3316
+ declare module 'vue' {
3317
+ interface ComponentCustomProperties {
3318
+ $form: VueFormService;
3319
+ }
3320
+ }
3321
+ //#endregion
3322
+ //#region src/components/VWysiwygEditor/VWysiwygEditor.d.ts
3323
+ interface VWysiwygEditorAPI {
3324
+ readonly editor: Editor | undefined;
3325
+ readonly control: TextableControl;
3326
+ }
3327
+ declare const VWysiwygEditor: vue2.DefineComponent<vue2.ExtractPropTypes<{
3328
+ extensions: {
3329
+ type: PropType<RawWysiwygExtension[]>;
3330
+ default: () => never[];
3331
+ };
3332
+ tools: {
3333
+ type: PropType<RawWysiwygEditorTool[]>;
3334
+ default: () => never[];
3335
+ };
3336
+ floatingToolbar: BooleanConstructor;
3337
+ disabledMinHeight: BooleanConstructor;
3338
+ disabledMaxHeight: BooleanConstructor;
3339
+ removeDefaultWrapper: {
3340
+ type: BooleanConstructor;
3341
+ default: boolean;
3342
+ };
3343
+ 'v-slots': PropType<{
3344
+ [x: `error:${string}`]: (error: FormNodeError) => VNodeChild;
3345
+ label?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3346
+ hint?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3347
+ infoAppends?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3348
+ error?: ((error: FormNodeError) => VNodeChild) | undefined;
3349
+ default?: (() => VNodeChild) | undefined;
3350
+ startAdornment?: (() => VNodeChild) | undefined;
3351
+ endAdornment?: (() => VNodeChild) | undefined;
3352
+ }>;
3353
+ size: {
3354
+ type: PropType<_fastkit_vui0.ControlSize>;
3355
+ validator: (value: any) => boolean;
3356
+ };
3357
+ loading: BooleanConstructor;
3358
+ variant: {
3359
+ type: PropType<_fastkit_vui0.ControlFieldVariant>;
3360
+ validator: (value: any) => boolean;
3361
+ };
3362
+ startAdornment: PropType<VNodeChildOrSlot>;
3363
+ endAdornment: PropType<VNodeChildOrSlot>;
3364
+ tabindex: {
3365
+ type: (StringConstructor | NumberConstructor)[];
3366
+ default: number;
3367
+ };
3368
+ nodeControl: PropType<FormNodeControl>;
3369
+ label: PropType<VNodeChildOrSlot>;
3370
+ hint: PropType<VNodeChildOrSlot>;
3371
+ hinttip: PropType<FormNodeWrapperHinttip>;
3372
+ hinttipDelay: PropType<FormNodeWrapperHinttipDelay>;
3373
+ infoAppends: PropType<VNodeChildOrSlot>;
3374
+ hiddenInfo: BooleanConstructor;
3375
+ requiredChip: PropType<RequiredChipSource>;
3376
+ collectErrorMessages: {
3377
+ type: BooleanConstructor;
3378
+ default: boolean;
3379
+ };
3380
+ minlength: (StringConstructor | NumberConstructor)[];
3381
+ maxlength: (StringConstructor | NumberConstructor)[];
3382
+ pattern: (StringConstructor | RegExpConstructor)[];
3383
+ placeholder: StringConstructor;
3384
+ autocapitalize: PropType<FormAutoCapitalize>;
3385
+ finalizers: PropType<TextableFinalizerSpec>;
3386
+ counter: PropType<boolean | string | number>;
3387
+ counterValue: PropType<(value: string) => number>;
3388
+ limit: BooleanConstructor;
3389
+ autocomplete: {
3390
+ type: PropType<FormAutoComplete | boolean>;
3391
+ default: () => boolean | "off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo" | undefined;
3392
+ };
3393
+ name: StringConstructor;
3394
+ tag: StringConstructor;
3395
+ modelValue: vue2.Prop<any, any>;
3396
+ autofocus: BooleanConstructor;
3397
+ disabled: BooleanConstructor;
3398
+ readonly: BooleanConstructor;
3399
+ viewonly: BooleanConstructor;
3400
+ spellcheck: BooleanConstructor;
3401
+ required: BooleanConstructor | PropType<boolean>;
3402
+ clearable: BooleanConstructor;
3403
+ validateTiming: {
3404
+ type: PropType<ValidateTiming>;
3405
+ default: ValidateTiming;
3406
+ };
3407
+ rules: {
3408
+ type: PropType<RecursiveVerifiableRuleOrFn>;
3409
+ default: () => never[];
3410
+ };
3411
+ validationDeps: PropType<(nodeControl: FormNodeControl) => any>;
3412
+ error: BooleanConstructor;
3413
+ errorMessages: PropType<string | string[]>;
3414
+ showOwnErrors: {
3415
+ type: BooleanConstructor;
3416
+ default: undefined;
3417
+ };
3418
+ detach: BooleanConstructor;
3419
+ }>, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue2.ComponentOptionsMixin, vue2.ComponentOptionsMixin, {
3420
+ 'update:modelValue': (value: string) => boolean;
3421
+ 'update:errors': (errors: FormNodeError[]) => boolean;
3422
+ change: (value: string) => boolean;
3423
+ focus: (ev: FocusEvent) => boolean;
3424
+ blur: (ev: FocusEvent) => boolean;
3425
+ }, string, vue2.PublicProps, Readonly<vue2.ExtractPropTypes<{
3426
+ extensions: {
3427
+ type: PropType<RawWysiwygExtension[]>;
3428
+ default: () => never[];
3429
+ };
3430
+ tools: {
3431
+ type: PropType<RawWysiwygEditorTool[]>;
3432
+ default: () => never[];
3433
+ };
3434
+ floatingToolbar: BooleanConstructor;
3435
+ disabledMinHeight: BooleanConstructor;
3436
+ disabledMaxHeight: BooleanConstructor;
3437
+ removeDefaultWrapper: {
3438
+ type: BooleanConstructor;
3439
+ default: boolean;
3440
+ };
3441
+ 'v-slots': PropType<{
3442
+ [x: `error:${string}`]: (error: FormNodeError) => VNodeChild;
3443
+ label?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3444
+ hint?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3445
+ infoAppends?: ((wrapper: FormNodeWrapper) => VNodeChild) | undefined;
3446
+ error?: ((error: FormNodeError) => VNodeChild) | undefined;
3447
+ default?: (() => VNodeChild) | undefined;
3448
+ startAdornment?: (() => VNodeChild) | undefined;
3449
+ endAdornment?: (() => VNodeChild) | undefined;
3450
+ }>;
3451
+ size: {
3452
+ type: PropType<_fastkit_vui0.ControlSize>;
3453
+ validator: (value: any) => boolean;
3454
+ };
3455
+ loading: BooleanConstructor;
3456
+ variant: {
3457
+ type: PropType<_fastkit_vui0.ControlFieldVariant>;
3458
+ validator: (value: any) => boolean;
3459
+ };
3460
+ startAdornment: PropType<VNodeChildOrSlot>;
3461
+ endAdornment: PropType<VNodeChildOrSlot>;
3462
+ tabindex: {
3463
+ type: (StringConstructor | NumberConstructor)[];
3464
+ default: number;
3465
+ };
3466
+ nodeControl: PropType<FormNodeControl>;
3467
+ label: PropType<VNodeChildOrSlot>;
3468
+ hint: PropType<VNodeChildOrSlot>;
3469
+ hinttip: PropType<FormNodeWrapperHinttip>;
3470
+ hinttipDelay: PropType<FormNodeWrapperHinttipDelay>;
3471
+ infoAppends: PropType<VNodeChildOrSlot>;
3472
+ hiddenInfo: BooleanConstructor;
3473
+ requiredChip: PropType<RequiredChipSource>;
3474
+ collectErrorMessages: {
3475
+ type: BooleanConstructor;
3476
+ default: boolean;
3477
+ };
3478
+ minlength: (StringConstructor | NumberConstructor)[];
3479
+ maxlength: (StringConstructor | NumberConstructor)[];
3480
+ pattern: (StringConstructor | RegExpConstructor)[];
3481
+ placeholder: StringConstructor;
3482
+ autocapitalize: PropType<FormAutoCapitalize>;
3483
+ finalizers: PropType<TextableFinalizerSpec>;
3484
+ counter: PropType<boolean | string | number>;
3485
+ counterValue: PropType<(value: string) => number>;
3486
+ limit: BooleanConstructor;
3487
+ autocomplete: {
3488
+ type: PropType<FormAutoComplete | boolean>;
3489
+ default: () => boolean | "off" | "on" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo" | undefined;
3490
+ };
3491
+ name: StringConstructor;
3492
+ tag: StringConstructor;
3493
+ modelValue: vue2.Prop<any, any>;
3494
+ autofocus: BooleanConstructor;
3495
+ disabled: BooleanConstructor;
3496
+ readonly: BooleanConstructor;
3497
+ viewonly: BooleanConstructor;
3498
+ spellcheck: BooleanConstructor;
3499
+ required: BooleanConstructor | PropType<boolean>;
3500
+ clearable: BooleanConstructor;
3501
+ validateTiming: {
3502
+ type: PropType<ValidateTiming>;
3503
+ default: ValidateTiming;
3504
+ };
3505
+ rules: {
3506
+ type: PropType<RecursiveVerifiableRuleOrFn>;
3507
+ default: () => never[];
3508
+ };
3509
+ validationDeps: PropType<(nodeControl: FormNodeControl) => any>;
3510
+ error: BooleanConstructor;
3511
+ errorMessages: PropType<string | string[]>;
3512
+ showOwnErrors: {
3513
+ type: BooleanConstructor;
3514
+ default: undefined;
3515
+ };
3516
+ detach: BooleanConstructor;
3517
+ }>> & Readonly<{
3518
+ onFocus?: ((ev: FocusEvent) => any) | undefined;
3519
+ onBlur?: ((ev: FocusEvent) => any) | undefined;
3520
+ onChange?: ((value: string) => any) | undefined;
3521
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
3522
+ "onUpdate:errors"?: ((errors: FormNodeError[]) => any) | undefined;
3523
+ }>, {
3524
+ error: boolean;
3525
+ floatingToolbar: boolean;
3526
+ disabledMinHeight: boolean;
3527
+ disabledMaxHeight: boolean;
3528
+ extensions: RawWysiwygExtension[];
3529
+ tools: RawWysiwygEditorTool[];
3530
+ removeDefaultWrapper: boolean;
3531
+ loading: boolean;
3532
+ tabindex: string | number;
3533
+ hiddenInfo: boolean;
3534
+ collectErrorMessages: boolean;
3535
+ limit: boolean;
3536
+ autocomplete: boolean | "name" | "off" | "on" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo";
3537
+ autofocus: boolean;
3538
+ disabled: boolean;
3539
+ readonly: boolean;
3540
+ viewonly: boolean;
3541
+ spellcheck: boolean;
3542
+ clearable: boolean;
3543
+ validateTiming: ValidateTiming;
3544
+ rules: RecursiveVerifiableRuleOrFn;
3545
+ showOwnErrors: boolean;
3546
+ detach: boolean;
3547
+ }, DefinedSlots<{
3548
+ [x: `error:${string}`]: (error: FormNodeError) => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3549
+ [key: string]: any;
3550
+ }>[];
3551
+ label?: ((wrapper: FormNodeWrapper) => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3552
+ [key: string]: any;
3553
+ }>[]) | undefined;
3554
+ hint?: ((wrapper: FormNodeWrapper) => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3555
+ [key: string]: any;
3556
+ }>[]) | undefined;
3557
+ infoAppends?: ((wrapper: FormNodeWrapper) => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3558
+ [key: string]: any;
3559
+ }>[]) | undefined;
3560
+ error?: ((error: FormNodeError) => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3561
+ [key: string]: any;
3562
+ }>[]) | undefined;
3563
+ } & {
3564
+ default?: (() => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3565
+ [key: string]: any;
3566
+ }>[]) | undefined;
3567
+ startAdornment?: (() => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3568
+ [key: string]: any;
3569
+ }>[]) | undefined;
3570
+ endAdornment?: (() => vue2.VNode<vue2.RendererNode, vue2.RendererElement, {
3571
+ [key: string]: any;
3572
+ }>[]) | undefined;
3573
+ }>, {}, {}, string, vue2.ComponentProvideOptions, true, {}, any>;
3574
+ //#endregion
3575
+ export { CreateWysiwygColorToolOptions, CreatedWysiwygExtension, RawWysiwygEditorTool, RawWysiwygExtension, ResolvedWysiwygEditorSettings, VUI_WYSIWYG_EDITOR_SYMBOL, VWysiwygEditor, VWysiwygEditorAPI, WYSIWYG_TEXT_ALIGN_VALUES, WysiwygBulletListTool, WysiwygColorExtension, WysiwygColorItem, WysiwygColorOptions, WysiwygCustomTagExtension, WysiwygCustomTagSettings, WysiwygCustomTagToolSettings, WysiwygEditorContext, WysiwygEditorEvent, WysiwygEditorEventsBucket, WysiwygEditorEventsOptions, WysiwygEditorInitializeContext, WysiwygEditorPrefixedEvent, WysiwygEditorTool, WysiwygEditorToolFactory, WysiwygEditorToolIcon, WysiwygExtensionFactory, WysiwygExtensionSource, WysiwygFormatBoldTool, WysiwygFormatItalicTool, WysiwygFormatUnderlineTool, WysiwygHistoryTool, WysiwygLinkTool, WysiwygLinter, WysiwygLinterBadWords, WysiwygLinterHeadingLevel, type WysiwygLinterOptions, WysiwygLinterPlugin, WysiwygLinterPunctuation, WysiwygOrderedListTool, WysiwygTextAlignOptions, WysiwygTextAlignTool, WysiwygTextAlignValue, createWysiwygColorTool, createWysiwygCustomTagMark, createWysiwygCustomTagTool, createWysiwygExtension, resolveRawWysiwygEditorTools, resolveRawWysiwygExtensions };
3576
+ //# sourceMappingURL=vui-wysiwyg.d.mts.map