@hybridly/vue 0.0.1-alpha.2 → 0.0.1-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,19 +1,23 @@
1
1
  import * as vue from 'vue';
2
- import { Plugin as Plugin$2, h, PropType, ComputedRef, ComponentOptions } from 'vue';
2
+ import { App, Plugin as Plugin$2, h, PropType, ComputedRef, DeepReadonly } from 'vue';
3
3
  import * as _hybridly_core from '@hybridly/core';
4
- import { VisitPayload as VisitPayload$1, ResolveComponent as ResolveComponent$1, RouterContextOptions, Plugin as Plugin$1, RouterContext, Method as Method$1, VisitOptions as VisitOptions$1, UrlResolvable as UrlResolvable$1 } from '@hybridly/core';
5
- export { router } from '@hybridly/core';
4
+ import { HybridPayload as HybridPayload$1, ResolveComponent as ResolveComponent$1, RouterContextOptions, Plugin as Plugin$1, RouterContext, Method as Method$1, HybridRequestOptions as HybridRequestOptions$1, UrlResolvable as UrlResolvable$1, registerHook as registerHook$1 } from '@hybridly/core';
5
+ export { can, route, router } from '@hybridly/core';
6
6
  import { ProgressOptions } from '@hybridly/progress-plugin';
7
+ import { Axios, AxiosResponse, AxiosProgressEvent } from 'axios';
7
8
  import * as _vue_shared from '@vue/shared';
8
9
  import { RequestData } from '@hybridly/utils';
9
- import { AxiosResponse, AxiosProgressEvent } from 'axios';
10
10
 
11
- declare function initializeHybridly(options: HybridlyOptions): Promise<void>;
11
+ declare function initializeHybridly(options: HybridlyOptions): Promise<any>;
12
+ /**
13
+ * Resolves a page component.
14
+ */
15
+ declare function resolvePageComponent(name: string, pages: Record<string, any>, defaultLayout?: any): Promise<any>;
12
16
  interface HybridlyOptions {
13
17
  /** ID of the app element. */
14
18
  id?: string;
15
19
  /** Initial view data. */
16
- payload?: VisitPayload$1;
20
+ payload?: HybridPayload$1;
17
21
  /** A collection of pages. */
18
22
  pages?: Record<string, any>;
19
23
  /** An optional default persistent layout. */
@@ -24,12 +28,18 @@ interface HybridlyOptions {
24
28
  serializer?: RouterContextOptions['serializer'];
25
29
  /** Clean up the host element's payload dataset after loading. */
26
30
  cleanup?: boolean;
31
+ /** Whether to set up the devtools plugin. */
32
+ devtools?: boolean;
27
33
  /** Progressbar options. */
28
34
  progress?: boolean | Partial<ProgressOptions>;
29
35
  /** Sets up the hybridly router. */
30
- setup: (options: SetupArguments) => any;
36
+ setup?: (options: SetupArguments) => any;
31
37
  /** List of Hybridly plugins. */
32
38
  plugins?: Plugin$1[];
39
+ /** Callback that gets executed before Vue is mounted. */
40
+ enhanceVue?: (vue: App<Element>) => any;
41
+ /** Custom Axios instance. */
42
+ axios?: Axios;
33
43
  }
34
44
  interface SetupArguments {
35
45
  /** DOM element to mount Vue on. */
@@ -49,14 +59,15 @@ interface SetupArguments {
49
59
  declare const RouterLink: vue.DefineComponent<{
50
60
  href: {
51
61
  type: StringConstructor;
52
- required: true;
62
+ required: false;
63
+ default: undefined;
53
64
  };
54
65
  as: {
55
- type: (StringConstructor | ObjectConstructor)[];
66
+ type: (ObjectConstructor | StringConstructor)[];
56
67
  default: string;
57
68
  };
58
69
  method: {
59
- type: PropType<Method$1>;
70
+ type: PropType<Method$1 | "get" | "post" | "put" | "patch" | "delete">;
60
71
  default: string;
61
72
  };
62
73
  data: {
@@ -72,20 +83,26 @@ declare const RouterLink: vue.DefineComponent<{
72
83
  default: boolean;
73
84
  };
74
85
  options: {
75
- type: PropType<Omit<VisitOptions$1, "url" | "data" | "method">>;
86
+ type: PropType<Omit<HybridRequestOptions$1, "data" | "url" | "method">>;
76
87
  default: () => {};
77
88
  };
89
+ text: {
90
+ type: StringConstructor;
91
+ required: false;
92
+ default: undefined;
93
+ };
78
94
  }, (props: Readonly<_vue_shared.LooseRequired<Readonly<vue.ExtractPropTypes<{
79
95
  href: {
80
96
  type: StringConstructor;
81
- required: true;
97
+ required: false;
98
+ default: undefined;
82
99
  };
83
100
  as: {
84
- type: (StringConstructor | ObjectConstructor)[];
101
+ type: (ObjectConstructor | StringConstructor)[];
85
102
  default: string;
86
103
  };
87
104
  method: {
88
- type: PropType<Method$1>;
105
+ type: PropType<Method$1 | "get" | "post" | "put" | "patch" | "delete">;
89
106
  default: string;
90
107
  };
91
108
  data: {
@@ -101,22 +118,28 @@ declare const RouterLink: vue.DefineComponent<{
101
118
  default: boolean;
102
119
  };
103
120
  options: {
104
- type: PropType<Omit<VisitOptions$1, "url" | "data" | "method">>;
121
+ type: PropType<Omit<HybridRequestOptions$1, "data" | "url" | "method">>;
105
122
  default: () => {};
106
123
  };
124
+ text: {
125
+ type: StringConstructor;
126
+ required: false;
127
+ default: undefined;
128
+ };
107
129
  }>> & {}>>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
108
130
  [key: string]: any;
109
131
  }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
110
132
  href: {
111
133
  type: StringConstructor;
112
- required: true;
134
+ required: false;
135
+ default: undefined;
113
136
  };
114
137
  as: {
115
- type: (StringConstructor | ObjectConstructor)[];
138
+ type: (ObjectConstructor | StringConstructor)[];
116
139
  default: string;
117
140
  };
118
141
  method: {
119
- type: PropType<Method$1>;
142
+ type: PropType<Method$1 | "get" | "post" | "put" | "patch" | "delete">;
120
143
  default: string;
121
144
  };
122
145
  data: {
@@ -132,13 +155,20 @@ declare const RouterLink: vue.DefineComponent<{
132
155
  default: boolean;
133
156
  };
134
157
  options: {
135
- type: PropType<Omit<VisitOptions$1, "url" | "data" | "method">>;
158
+ type: PropType<Omit<HybridRequestOptions$1, "data" | "url" | "method">>;
136
159
  default: () => {};
137
160
  };
161
+ text: {
162
+ type: StringConstructor;
163
+ required: false;
164
+ default: undefined;
165
+ };
138
166
  }>>, {
139
167
  data: RequestData;
140
- method: Method$1;
141
- options: Omit<VisitOptions$1, "url" | "data" | "method">;
168
+ text: string;
169
+ href: string;
170
+ method: Method$1 | "get" | "post" | "put" | "patch" | "delete";
171
+ options: Omit<HybridRequestOptions$1, "data" | "url" | "method">;
142
172
  as: string | Record<string, any>;
143
173
  external: boolean;
144
174
  disabled: boolean;
@@ -174,51 +204,56 @@ interface AutoImportResolverOptions {
174
204
 
175
205
  /** Accesses all current properties. */
176
206
  declare function useProperties<T extends object, Global extends GlobalHybridlyProperties>(): vue.DeepReadonly<vue.UnwrapNestedRefs<T & Global>>;
207
+ /**
208
+ * Accesses a property with the given type.
209
+ * @experimental Workaround for not being able to type `useProperty`, might be removed in the future.
210
+ */
211
+ declare function useTypedProperty<T>(path: string, fallback?: T): ComputedRef<T>;
177
212
  /** Accesses a property with a dot notation. */
178
213
  declare function useProperty<T = GlobalHybridlyProperties, P extends Path<T> = Path<T>, Fallback extends PathValue<T, P> = PathValue<T, P>>(path: [P] extends [never] ? string : P, fallback?: Fallback): ComputedRef<[PathValue<T, P>] extends [never] ? Fallback : PathValue<T, P>>;
179
- declare type PathImpl<T, K extends keyof T> = K extends string ? T[K] extends Record<string, any> ? T[K] extends ArrayLike<any> ? K | `${K}.${PathImpl<T[K], Exclude<keyof T[K], keyof any[]>>}` : K | `${K}.${PathImpl<T[K], keyof T[K]>}` : K : never;
180
- declare type Path<T> = PathImpl<T, keyof T> | keyof T;
181
- declare type PathValue<T, P extends Path<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K]> ? PathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
214
+ type PathImpl<T, K extends keyof T> = K extends string ? T[K] extends Record<string, any> ? T[K] extends ArrayLike<any> ? K | `${K}.${PathImpl<T[K], Exclude<keyof T[K], keyof any[]>>}` : K | `${K}.${PathImpl<T[K], keyof T[K]>}` : K : never;
215
+ type Path<T> = PathImpl<T, keyof T> | keyof T;
216
+ type PathValue<T, P extends Path<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? Rest extends Path<T[K]> ? PathValue<T[K], Rest> : never : never : P extends keyof T ? T[P] : never;
182
217
 
183
- declare type MaybePromise<T> = T | Promise<T>;
218
+ type MaybePromise<T> = T | Promise<T>;
184
219
 
185
- interface Hooks {
220
+ interface RequestHooks {
186
221
  /**
187
- * Called before anything when a visit is going to happen.
188
- */
189
- before: (options: VisitOptions) => MaybePromise<any | boolean>;
222
+ * Called before a navigation request is going to happen.
223
+ */
224
+ before: (options: HybridRequestOptions, context: InternalRouterContext) => MaybePromise<any | boolean>;
190
225
  /**
191
- * Called before the request of a visit is going to happen.
226
+ * Called before the request of a navigation is going to happen.
192
227
  */
193
228
  start: (context: InternalRouterContext) => MaybePromise<any>;
194
229
  /**
195
230
  * Called when progress on the request is being made.
196
231
  */
197
- progress: (progress: Progress) => MaybePromise<any>;
232
+ progress: (progress: Progress, context: InternalRouterContext) => MaybePromise<any>;
198
233
  /**
199
- * Called when data is received after a request for a visit.
234
+ * Called when data is received after a request for a navigation.
200
235
  */
201
- data: (response: AxiosResponse) => MaybePromise<any>;
236
+ data: (response: AxiosResponse, context: InternalRouterContext) => MaybePromise<any>;
202
237
  /**
203
238
  * Called when a request is successful and there is no error.
204
239
  */
205
- success: (payload: VisitPayload) => MaybePromise<any>;
240
+ success: (payload: HybridPayload, context: InternalRouterContext) => MaybePromise<any>;
206
241
  /**
207
242
  * Called when a request is successful but there were errors.
208
243
  */
209
- error: (errors: Errors) => MaybePromise<any>;
244
+ error: (errors: Errors, context: InternalRouterContext) => MaybePromise<any>;
210
245
  /**
211
246
  * Called when a request has been aborted.
212
247
  */
213
248
  abort: (context: InternalRouterContext) => MaybePromise<any>;
214
249
  /**
215
- * Called when a response to a request is not a valid Hybridly response.
250
+ * Called when a response to a request is not a valid hybrid response.
216
251
  */
217
- invalid: (response: AxiosResponse) => MaybePromise<void>;
252
+ invalid: (response: AxiosResponse, context: InternalRouterContext) => MaybePromise<void>;
218
253
  /**
219
254
  * Called when an unknowne exception was triggered.
220
255
  */
221
- exception: (error: Error) => MaybePromise<void>;
256
+ exception: (error: Error, context: InternalRouterContext) => MaybePromise<void>;
222
257
  /**
223
258
  * Called whenever the request failed, for any reason, in addition to other hooks.
224
259
  */
@@ -227,19 +262,56 @@ interface Hooks {
227
262
  * Called after a request has been made, even if it didn't succeed.
228
263
  */
229
264
  after: (context: InternalRouterContext) => MaybePromise<void>;
265
+ }
266
+ interface Hooks extends RequestHooks {
267
+ /**
268
+ * Called when Hybridly's context is initialized.
269
+ */
270
+ initialized: (context: InternalRouterContext) => MaybePromise<void>;
271
+ /**
272
+ * Called after Hybridly's initial page load.
273
+ */
274
+ ready: (context: InternalRouterContext) => MaybePromise<void>;
230
275
  /**
231
- * Called when a visit has been made and a page component has been navigated to.
276
+ * Called when a back-forward navigation occurs.
232
277
  */
233
- navigate: (options: NavigationOptions) => MaybePromise<void>;
278
+ backForward: (state: any, context: InternalRouterContext) => MaybePromise<any>;
279
+ /**
280
+ * Called when a component navigation is being made.
281
+ */
282
+ navigating: (options: NavigationOptions, context: InternalRouterContext) => MaybePromise<void>;
283
+ /**
284
+ * Called when a component has been navigated to.
285
+ */
286
+ navigated: (options: NavigationOptions, context: InternalRouterContext) => MaybePromise<void>;
234
287
  }
235
288
 
236
- declare type UrlResolvable = string | URL | Location;
237
- declare type UrlTransformable = Partial<Omit<URL, 'searchParams' | 'toJSON' | 'toString'>>;
289
+ interface RoutingConfiguration {
290
+ url: string;
291
+ port?: number;
292
+ defaults: Record<string, any>;
293
+ routes: Record<string, RouteDefinition>;
294
+ }
295
+ interface RouteDefinition {
296
+ uri: string;
297
+ method: Method[];
298
+ bindings: Record<string, string>;
299
+ domain?: string;
300
+ wheres?: Record<string, string>;
301
+ name: string;
302
+ }
303
+
304
+ type UrlResolvable = string | URL | Location;
305
+ type UrlTransformable = BaseUrlTransformable | ((string: URL) => BaseUrlTransformable);
306
+ type BaseUrlTransformable = Partial<Omit<URL, 'searchParams' | 'toJSON' | 'toString'>> & {
307
+ query?: any;
308
+ trailingSlash?: boolean;
309
+ };
238
310
 
239
- declare type ConditionalNavigationOption = boolean | ((payload: VisitPayload) => boolean);
311
+ type ConditionalNavigationOption = boolean | ((payload: HybridPayload) => boolean);
240
312
  interface NavigationOptions {
241
313
  /** View to navigate to. */
242
- payload?: VisitPayload;
314
+ payload?: HybridPayload;
243
315
  /**
244
316
  * Whether to replace the current history state instead of adding
245
317
  * one. This affects the browser's "back" and "forward" features.
@@ -267,41 +339,50 @@ interface NavigationOptions {
267
339
  */
268
340
  updateHistoryState?: boolean;
269
341
  /**
270
- * Defines whether this navigation is a back/forward visit from the popstate event.
342
+ * Defines whether this navigation is a back/forward navigation from the popstate event.
271
343
  * @internal This is an advanced property meant to be used internally.
272
344
  */
273
345
  isBackForward?: boolean;
274
346
  }
275
- declare type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
276
- interface VisitOptions extends Omit<NavigationOptions, 'request'> {
277
- /** The URL to visit. */
347
+ type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
348
+ interface HybridRequestOptions extends Omit<NavigationOptions, 'payload'> {
349
+ /** The URL to navigation. */
278
350
  url?: UrlResolvable;
279
351
  /** HTTP verb to use for the request. */
280
- method?: Method;
352
+ method?: Method | Lowercase<Method>;
281
353
  /** Body of the request. */
282
354
  data?: RequestData;
283
- /** Which properties to update for this visit. Other properties will be ignored. */
355
+ /** Which properties to update for this navigation. Other properties will be ignored. */
284
356
  only?: string | string[];
285
- /** Which properties not to update for this visit. Other properties will be updated. */
357
+ /** Which properties not to update for this navigation. Other properties will be updated. */
286
358
  except?: string | string[];
287
359
  /** Specific headers to add to the request. */
288
360
  headers?: Record<string, string>;
289
361
  /** The bag in which to put potential errors. */
290
362
  errorBag?: string;
291
- /** Hooks for this visit. */
292
- hooks?: Partial<Hooks>;
363
+ /** Hooks for this navigation. */
364
+ hooks?: Partial<RequestHooks>;
293
365
  /** If `true`, force the usage of a `FormData` object. */
294
366
  useFormData?: boolean;
367
+ /**
368
+ * If `false`, disable automatic form spoofing.
369
+ * @see https://laravel.com/docs/9.x/routing#form-method-spoofing
370
+ */
371
+ spoof?: boolean;
372
+ /**
373
+ * If `false`, does not trigger the progress bar for this request.
374
+ */
375
+ progress?: boolean;
295
376
  }
296
- /** An axios visit being made. */
297
- interface PendingVisit {
377
+ /** A navigation being made. */
378
+ interface PendingNavigation {
298
379
  /** The URL to which the request is being made. */
299
380
  url: URL;
300
381
  /** Abort controller associated to this request. */
301
382
  controller: AbortController;
302
- /** Options for the associated visit. */
303
- options: VisitOptions;
304
- /** Visit identifier. */
383
+ /** Options for the associated hybrid request. */
384
+ options: HybridRequestOptions;
385
+ /** Navigation identifier. */
305
386
  id: string;
306
387
  }
307
388
  /** A page or dialog component. */
@@ -311,23 +392,25 @@ interface View {
311
392
  /** Properties to apply to the component. */
312
393
  properties: Properties;
313
394
  }
314
- declare type Property = null | string | number | boolean | Property[] | {
395
+ type Property = null | string | number | boolean | Property[] | {
315
396
  [name: string]: Property;
316
397
  };
317
- declare type Properties = Record<string | number, Property>;
398
+ type Properties = Record<string | number, Property>;
318
399
  interface SwapOptions<T> {
319
400
  /** The new component. */
320
401
  component: T;
402
+ /** The new properties. */
403
+ properties?: any;
321
404
  /** Whether to preserve the state of the component. */
322
405
  preserveState?: boolean;
323
406
  }
324
- declare type ViewComponent = any;
325
- declare type DialogComponent = any;
326
- declare type ResolveComponent = (name: string) => Promise<ViewComponent>;
327
- declare type SwapView = (options: SwapOptions<ViewComponent>) => Promise<void>;
328
- declare type SwapDialog = (options: SwapOptions<DialogComponent>) => Promise<void>;
329
- /** The payload of a visit request from the server. */
330
- interface VisitPayload {
407
+ type ViewComponent = any;
408
+ type DialogComponent = any;
409
+ type ResolveComponent = (name: string) => Promise<ViewComponent>;
410
+ type SwapView = (options: SwapOptions<ViewComponent>) => Promise<void>;
411
+ type SwapDialog = (options: SwapOptions<DialogComponent>) => Promise<void>;
412
+ /** The payload of a navigation request from the server. */
413
+ interface HybridPayload {
331
414
  /** The view to use in this request. */
332
415
  view: View;
333
416
  /** An optional dialog. */
@@ -347,10 +430,9 @@ interface Errors {
347
430
  [key: string]: string;
348
431
  }
349
432
 
350
- interface Plugin {
433
+ interface Plugin extends Partial<Hooks> {
434
+ /** Identifier of the plugin. */
351
435
  name: string;
352
- initialized: (context: InternalRouterContext) => MaybePromise<void>;
353
- hooks: Partial<Hooks>;
354
436
  }
355
437
 
356
438
  /** Router context. */
@@ -364,19 +446,23 @@ interface InternalRouterContext {
364
446
  /** The current local asset version. */
365
447
  version: string;
366
448
  /** The current adapter's functions. */
367
- adapter: Adapter;
449
+ adapter: ResolvedAdapter;
368
450
  /** Scroll positions of the current page's DOM elements. */
369
451
  scrollRegions: ScrollRegion[];
370
452
  /** Arbitrary state. */
371
453
  state: Record<string, any>;
372
- /** Currently pending visit. */
373
- activeVisit?: PendingVisit;
454
+ /** Currently pending navigation. */
455
+ pendingNavigation?: PendingNavigation;
374
456
  /** History state serializer. */
375
457
  serializer: Serializer;
376
458
  /** List of plugins. */
377
459
  plugins: Plugin[];
378
460
  /** Global hooks. */
379
461
  hooks: Partial<Record<keyof Hooks, Array<Function>>>;
462
+ /** The Axios instance. */
463
+ axios: Axios;
464
+ /** Routing configuration. */
465
+ routing?: RoutingConfiguration;
380
466
  }
381
467
  /** Adapter-specific functions. */
382
468
  interface Adapter {
@@ -389,6 +475,9 @@ interface Adapter {
389
475
  /** Called when the context is updated. */
390
476
  update?: (context: InternalRouterContext) => void;
391
477
  }
478
+ interface ResolvedAdapter extends Adapter {
479
+ updateRoutingConfiguration: (routing?: RoutingConfiguration) => void;
480
+ }
392
481
  interface ScrollRegion {
393
482
  top: number;
394
483
  left: number;
@@ -402,11 +491,8 @@ interface Serializer {
402
491
  /** Accesses the hybridly context. */
403
492
  declare function useContext(): vue.ComputedRef<Readonly<InternalRouterContext> | undefined>;
404
493
 
405
- /** Gets the router. */
406
- declare function useRouter(): _hybridly_core.Router;
407
-
408
- declare type Fields = Record<string, any>;
409
- interface FormOptions<T extends Fields> extends Omit<VisitOptions$1, 'data' | 'url'> {
494
+ type Fields = Record<string, any>;
495
+ interface FormOptions<T extends Fields> extends Omit<HybridRequestOptions$1, 'data' | 'url'> {
410
496
  fields: T;
411
497
  url?: UrlResolvable$1 | (() => UrlResolvable$1);
412
498
  key?: string | false;
@@ -416,16 +502,33 @@ interface FormOptions<T extends Fields> extends Omit<VisitOptions$1, 'data' | 'u
416
502
  }
417
503
  declare function useForm<T extends Fields = Fields>(options: FormOptions<T>): {
418
504
  reset: (...keys: (keyof T)[]) => void;
419
- initial: vue.UnwrapRef<vue.DeepReadonly<vue.UnwrapNestedRefs<T>>>;
420
505
  fields: vue.UnwrapRef<vue.UnwrapNestedRefs<T>>;
421
- loaded: any;
422
- submit: (optionsOverrides?: Omit<VisitOptions$1, 'data'>) => Promise<_hybridly_core.VisitResponse>;
423
506
  abort: () => void;
424
507
  setErrors: (incoming: Record<string, string>) => void;
425
- clearErrors: () => void;
508
+ clearErrors: (...keys: (keyof T)[]) => void;
509
+ clearError: (key: keyof T) => void;
510
+ hasDirty: (...keys: (keyof T)[]) => boolean;
511
+ submitWithOptions: (optionsOverrides?: Omit<HybridRequestOptions$1, 'data'>) => Promise<_hybridly_core.NavigationResponse>;
512
+ submit: () => Promise<_hybridly_core.NavigationResponse>;
426
513
  hasErrors: boolean;
514
+ initial: vue.UnwrapRef<DeepReadonly<T>>;
515
+ loaded: any;
516
+ progress: {
517
+ readonly event: {
518
+ readonly loaded: number;
519
+ readonly total?: number | undefined;
520
+ readonly progress?: number | undefined;
521
+ readonly bytes: number;
522
+ readonly rate?: number | undefined;
523
+ readonly estimated?: number | undefined;
524
+ readonly upload?: boolean | undefined;
525
+ readonly download?: boolean | undefined;
526
+ readonly event?: any;
527
+ };
528
+ readonly percentage: number;
529
+ } | undefined;
427
530
  isDirty: boolean;
428
- errors: vue.UnwrapRef<vue.DeepReadonly<vue.UnwrapNestedRefs<[Record<keyof T, string>] extends [vue.Ref<any>] ? vue.Ref<any> & Record<keyof T, string> : vue.Ref<vue.UnwrapRef<Record<keyof T, string>>>>>>;
531
+ errors: vue.UnwrapRef<DeepReadonly<[Record<keyof T, string>] extends [vue.Ref<any>] ? vue.Ref<any> & Record<keyof T, string> : vue.Ref<vue.UnwrapRef<Record<keyof T, string>>>>>;
429
532
  processing: boolean;
430
533
  successful: boolean;
431
534
  failed: boolean;
@@ -439,10 +542,10 @@ declare function useForm<T extends Fields = Fields>(options: FormOptions<T>): {
439
542
  */
440
543
  declare function useHistoryState<T = any>(key: string, initial: T): vue.Ref<vue.UnwrapRef<T>>;
441
544
 
442
- declare type BackForwardCallback = (context: RouterContext) => void;
545
+ type BackForwardCallback = (context: RouterContext) => void;
443
546
  declare function useBackForward(): {
444
547
  onBackForward: (fn: BackForwardCallback) => void;
445
- reloadOnBackForward: (options?: VisitOptions$1) => void;
548
+ reloadOnBackForward: (options?: HybridRequestOptions$1) => void;
446
549
  };
447
550
 
448
551
  declare global {
@@ -451,8 +554,8 @@ declare global {
451
554
  */
452
555
  interface Paginator<T = any> {
453
556
  data: T[];
454
- meta?: PaginatorMeta;
455
- links?: PaginatorLink[];
557
+ meta: PaginatorMeta;
558
+ links: PaginatorLink[];
456
559
  }
457
560
  /**
458
561
  * Paginated data without metadata wrapping.
@@ -521,35 +624,21 @@ declare function usePaginator<T = any>(paginator: UnwrappedPaginator<T> | Pagina
521
624
  to: number;
522
625
  };
523
626
 
524
- declare type Layout = ComponentOptions | (() => ComponentOptions) | [ComponentOptions];
627
+ type Layout = any;
525
628
  /**
526
629
  * Sets the persistent layout for this page.
527
630
  */
528
- declare function useLayout(layout: Layout): void;
529
-
530
- interface RouterConfiguration {
531
- url: string;
532
- port?: number;
533
- defaults: Record<string, any>;
534
- }
535
- interface RouteDefinition {
536
- uri: string;
537
- methods: Method$1[];
538
- bindings: Record<string, string>;
539
- domain?: string;
540
- wheres?: Record<string, string>;
541
- }
542
- interface RouteCollection extends RouterConfiguration {
543
- routes: Record<string, RouteDefinition>;
544
- }
545
- interface GlobalRouteCollection extends RouteCollection {
546
- }
547
- declare type RouteName = keyof GlobalRouteCollection['routes'];
548
- declare type RouteParameters<T extends RouteName> = Record<keyof GlobalRouteCollection['routes'][T]['bindings'], any> & Record<string, any>;
631
+ declare function defineLayout<T extends Record<string, K>, K = any>(layout: Layout, properties?: T): void;
632
+ declare function defineLayout(layouts: Layout[]): void;
633
+ /**
634
+ * Sets or gets the properties for the current persistent layout.
635
+ */
636
+ declare function defineLayoutProperties<T extends Record<string, K>, K = any>(properties: T): void;
549
637
 
550
638
  /**
551
- * Generates a route from the given route name.
639
+ * Registers a global hook.
640
+ * If called inside a component, unregisters after the component is unmounted.
552
641
  */
553
- declare function route<T extends RouteName>(name: T, parameters?: RouteParameters<T>, absolute?: boolean): string;
642
+ declare const registerHook: typeof registerHook$1;
554
643
 
555
- export { AutoImportResolverOptions, GlobalRouteCollection, HybridlyImports, HybridlyResolver, Layout, RouteCollection, RouteDefinition, RouteName, RouteParameters, RouterConfiguration, RouterLink, initializeHybridly, route, useBackForward, useContext, useForm, useHistoryState, useLayout, usePaginator, useProperties, useProperty, useRouter };
644
+ export { AutoImportResolverOptions, HybridlyImports, HybridlyResolver, Layout, RouterLink, defineLayout, defineLayoutProperties, initializeHybridly, registerHook, resolvePageComponent, useBackForward, useContext, useForm, useHistoryState, usePaginator, useProperties, useProperty, useTypedProperty };