kirby-types 1.1.1 → 1.1.2

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.
@@ -30,9 +30,7 @@
30
30
  *
31
31
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/state.js
32
32
  */
33
- export interface PanelState<
34
- TDefaults extends object = Record<string, unknown>,
35
- > {
33
+ export interface PanelState<TDefaults extends object = Record<string, any>> {
36
34
  /**
37
35
  * Returns the state key identifier.
38
36
  * Used by backend responses to target the correct state object.
@@ -70,7 +68,7 @@ export interface PanelState<
70
68
  * Validates that the state is a plain object.
71
69
  * @throws Error if state is not an object
72
70
  */
73
- validateState: (state: unknown) => boolean;
71
+ validateState: (state: any) => boolean;
74
72
  }
75
73
 
76
74
  // -----------------------------------------------------------------------------
@@ -84,11 +82,11 @@ export interface PanelState<
84
82
  */
85
83
  export interface PanelStateBase {
86
84
  key: () => string;
87
- defaults: () => Record<string, unknown>;
88
- reset: () => Record<string, unknown>;
89
- set: (state: Record<string, unknown>) => Record<string, unknown>;
90
- state: () => Record<string, unknown>;
91
- validateState: (state: unknown) => boolean;
85
+ defaults: () => Record<string, any>;
86
+ reset: () => Record<string, any>;
87
+ set: (state: Record<string, any>) => Record<string, any>;
88
+ state: () => Record<string, any>;
89
+ validateState: (state: any) => boolean;
92
90
  }
93
91
 
94
92
  /**
@@ -100,8 +98,8 @@ export interface PanelFeatureBase extends PanelStateBase, PanelEventListeners {
100
98
  component: string | null;
101
99
  isLoading: boolean;
102
100
  path: string | null;
103
- props: Record<string, unknown>;
104
- query: Record<string, unknown>;
101
+ props: Record<string, any>;
102
+ query: Record<string, any>;
105
103
  referrer: string | null;
106
104
  timestamp: number | null;
107
105
  }
@@ -131,9 +129,7 @@ export interface PanelHistoryBase {
131
129
  /**
132
130
  * Event callback function type.
133
131
  */
134
- export type PanelEventCallback<TReturn = unknown> = (
135
- ...args: unknown[]
136
- ) => TReturn;
132
+ export type PanelEventCallback<TReturn = any> = (...args: any[]) => TReturn;
137
133
 
138
134
  /**
139
135
  * Map of event names to their callback functions.
@@ -193,9 +189,9 @@ export interface PanelEventListeners<TEvents extends string = string> {
193
189
  * @param args - Arguments to pass to the listener
194
190
  * @returns Listener result, or a noop function if no listener exists
195
191
  */
196
- emit: <TReturn = unknown>(
192
+ emit: <TReturn = any>(
197
193
  event: TEvents,
198
- ...args: unknown[]
194
+ ...args: any[]
199
195
  ) => TReturn | (() => void);
200
196
 
201
197
  /**
@@ -225,8 +221,8 @@ export interface PanelFeatureDefaults {
225
221
  isLoading: boolean;
226
222
  on: PanelEventListenerMap;
227
223
  path: string | null;
228
- props: Record<string, unknown>;
229
- query: Record<string, unknown>;
224
+ props: Record<string, any>;
225
+ query: Record<string, any>;
230
226
  referrer: string | null;
231
227
  timestamp: number | null;
232
228
  }
@@ -283,12 +279,12 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
283
279
  * Props passed to the Vue component.
284
280
  * Contains all data from the backend response.
285
281
  */
286
- props: Record<string, unknown>;
282
+ props: Record<string, any>;
287
283
 
288
284
  /**
289
285
  * URL query parameters from the latest request.
290
286
  */
291
- query: Record<string, unknown>;
287
+ query: Record<string, any>;
292
288
 
293
289
  /**
294
290
  * Previous path for navigation and redirects.
@@ -311,7 +307,7 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
311
307
  get: (
312
308
  url: string | URL,
313
309
  options?: PanelRequestOptions,
314
- ) => Promise<unknown | false>;
310
+ ) => Promise<any | false>;
315
311
 
316
312
  /**
317
313
  * Loads a feature from the server and opens it.
@@ -348,10 +344,7 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
348
344
  * @returns Response data or false on error
349
345
  * @throws Error if feature has no path
350
346
  */
351
- post: (
352
- value?: unknown,
353
- options?: PanelRequestOptions,
354
- ) => Promise<unknown | false>;
347
+ post: (value?: any, options?: PanelRequestOptions) => Promise<any | false>;
355
348
 
356
349
  /**
357
350
  * Reloads properties from the server to refresh state.
@@ -397,8 +390,8 @@ export type PanelModalEvent =
397
390
  export interface PanelModalListeners {
398
391
  cancel: () => Promise<void>;
399
392
  close: (id?: string | boolean) => Promise<void>;
400
- input: (value: unknown) => void;
401
- submit: (value?: unknown, options?: PanelRequestOptions) => Promise<unknown>;
393
+ input: (value: any) => void;
394
+ submit: (value?: any, options?: PanelRequestOptions) => Promise<any>;
402
395
  success: (response: PanelSuccessResponse) => void;
403
396
  /** Additional custom event listeners */
404
397
  [key: string]: ((...args: any[]) => any) | undefined;
@@ -421,7 +414,7 @@ export interface PanelSuccessResponse {
421
414
  /** Whether to reload the view */
422
415
  reload?: boolean | PanelRequestOptions;
423
416
  /** Additional properties */
424
- [key: string]: unknown;
417
+ [key: string]: any;
425
418
  }
426
419
 
427
420
  /**
@@ -474,7 +467,7 @@ export interface PanelModal<
474
467
  * Quick access to `props.value`.
475
468
  * Dialogs and drawers often contain forms.
476
469
  */
477
- readonly value: unknown;
470
+ readonly value: any;
478
471
 
479
472
  /**
480
473
  * Cancels the modal by emitting 'cancel' and closing.
@@ -509,7 +502,7 @@ export interface PanelModal<
509
502
  *
510
503
  * @param value - New form value
511
504
  */
512
- input: (value: unknown) => void;
505
+ input: (value: any) => void;
513
506
 
514
507
  /**
515
508
  * Returns bound listener functions for the Fiber component.
@@ -553,7 +546,7 @@ export interface PanelModal<
553
546
  * @param options - Request options
554
547
  * @returns Response from listener, POST, or closes if no handler
555
548
  */
556
- submit: (value?: unknown, options?: PanelRequestOptions) => Promise<unknown>;
549
+ submit: (value?: any, options?: PanelRequestOptions) => Promise<any>;
557
550
 
558
551
  /**
559
552
  * Handles success response after submission.
@@ -601,7 +594,7 @@ export interface PanelHistoryMilestone {
601
594
  /** Unique identifier for this milestone */
602
595
  id: string;
603
596
  /** Additional state properties */
604
- [key: string]: unknown;
597
+ [key: string]: any;
605
598
  }
606
599
 
607
600
  /**
@@ -731,7 +724,7 @@ export interface PanelRequestOptions {
731
724
  /** Request headers */
732
725
  headers?: Record<string, string>;
733
726
  /** Request body for POST/PATCH */
734
- body?: unknown;
727
+ body?: any;
735
728
  /** Query parameters */
736
729
  query?: Record<string, string | number | boolean>;
737
730
  /** AbortSignal for request cancellation */
@@ -99,7 +99,7 @@ export interface PanelDragDefaults {
99
99
  /** Type of item being dragged */
100
100
  type: string | null;
101
101
  /** Data associated with the dragged item */
102
- data: Record<string, unknown>;
102
+ data: Record<string, any>;
103
103
  }
104
104
 
105
105
  /**
@@ -112,7 +112,7 @@ export interface PanelDrag extends PanelState<PanelDragDefaults> {
112
112
  /** Type of item being dragged */
113
113
  type: string | null;
114
114
  /** Data associated with the dragged item */
115
- data: Record<string, unknown>;
115
+ data: Record<string, any>;
116
116
 
117
117
  /** Whether a drag operation is in progress */
118
118
  readonly isDragging: boolean;
@@ -123,7 +123,7 @@ export interface PanelDrag extends PanelState<PanelDragDefaults> {
123
123
  * @param type - Drag item type (e.g., `'page'`, `'file'`)
124
124
  * @param data - Associated data
125
125
  */
126
- start: (type: string, data: Record<string, unknown>) => void;
126
+ start: (type: string, data: Record<string, any>) => void;
127
127
 
128
128
  /**
129
129
  * Stops the current drag operation and resets state.
@@ -334,7 +334,7 @@ export interface PanelNotificationDefaults {
334
334
  /** Context where notification appears */
335
335
  context: NotificationContext | null;
336
336
  /** Additional details (for error dialogs) */
337
- details: Record<string, unknown> | null;
337
+ details: Record<string, any> | null;
338
338
  /** Icon name */
339
339
  icon: string | null;
340
340
  /** Whether notification is visible */
@@ -356,7 +356,7 @@ export interface PanelNotificationOptions {
356
356
  /** Context where notification appears */
357
357
  context?: NotificationContext;
358
358
  /** Additional details */
359
- details?: Record<string, unknown>;
359
+ details?: Record<string, any>;
360
360
  /** Icon name */
361
361
  icon?: string;
362
362
  /** Notification message */
@@ -376,7 +376,7 @@ export interface PanelErrorObject {
376
376
  /** Error message */
377
377
  message: string;
378
378
  /** Additional error details */
379
- details?: Record<string, unknown>;
379
+ details?: Record<string, any>;
380
380
  /** Error key for special handling */
381
381
  key?: string;
382
382
  }
@@ -394,7 +394,7 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
394
394
  /** Context where notification appears */
395
395
  context: NotificationContext | null;
396
396
  /** Additional details (for error dialogs) */
397
- details: Record<string, unknown> | null;
397
+ details: Record<string, any> | null;
398
398
  /** Icon name */
399
399
  icon: string | null;
400
400
  /** Whether notification is visible */
@@ -481,15 +481,15 @@ export interface PanelSystemDefaults {
481
481
  /** ASCII character replacements for slugs */
482
482
  ascii: Record<string, string>;
483
483
  /** CSRF token for API requests */
484
- csrf: string | null;
484
+ csrf: string;
485
485
  /** Whether running on localhost */
486
- isLocal: boolean | null;
486
+ isLocal: boolean;
487
487
  /** Locale names by code */
488
488
  locales: Record<string, string>;
489
489
  /** Slug rules by language */
490
490
  slugs: Record<string, string>;
491
491
  /** Site title */
492
- title: string | null;
492
+ title: string;
493
493
  }
494
494
 
495
495
  /**
@@ -504,15 +504,15 @@ export interface PanelSystem extends PanelState<PanelSystemDefaults> {
504
504
  /** ASCII character replacements for slugs */
505
505
  ascii: Record<string, string>;
506
506
  /** CSRF token for API requests */
507
- csrf: string | null;
507
+ csrf: string;
508
508
  /** Whether running on localhost */
509
- isLocal: boolean | null;
509
+ isLocal: boolean;
510
510
  /** Locale names by code */
511
511
  locales: Record<string, string>;
512
512
  /** Slug rules by language */
513
513
  slugs: Record<string, string>;
514
514
  /** Site title */
515
- title: string | null;
515
+ title: string;
516
516
  }
517
517
 
518
518
  // -----------------------------------------------------------------------------
@@ -524,13 +524,13 @@ export interface PanelSystem extends PanelState<PanelSystemDefaults> {
524
524
  */
525
525
  export interface PanelTranslationDefaults {
526
526
  /** Translation code (e.g., `'en'`, `'de'`) */
527
- code: string | null;
527
+ code: string;
528
528
  /** Translation strings by key */
529
529
  data: Record<string, string>;
530
530
  /** Text direction */
531
531
  direction: "ltr" | "rtl";
532
532
  /** Translation name */
533
- name: string | null;
533
+ name: string;
534
534
  /** First day of week (`0`=Sunday, `1`=Monday) */
535
535
  weekday: number;
536
536
  }
@@ -546,13 +546,13 @@ export interface PanelTranslationDefaults {
546
546
  */
547
547
  export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
548
548
  /** Translation code (e.g., `'en'`, `'de'`) */
549
- code: string | null;
549
+ code: string;
550
550
  /** Translation strings by key */
551
551
  data: Record<string, string>;
552
552
  /** Text direction */
553
553
  direction: "ltr" | "rtl";
554
554
  /** Translation name */
555
- name: string | null;
555
+ name: string;
556
556
  /** First day of week (`0`=Sunday, `1`=Monday) */
557
557
  weekday: number;
558
558
 
@@ -571,7 +571,7 @@ export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
571
571
  */
572
572
  translate: (
573
573
  key: string,
574
- data?: Record<string, unknown>,
574
+ data?: Record<string, any>,
575
575
  fallback?: string | null,
576
576
  ) => string | undefined;
577
577
  }
@@ -716,7 +716,7 @@ export interface PanelDropdownOption {
716
716
  /** Whether option is disabled */
717
717
  disabled?: boolean;
718
718
  /** Additional properties */
719
- [key: string]: unknown;
719
+ [key: string]: any;
720
720
  }
721
721
 
722
722
  /**
@@ -776,7 +776,7 @@ export interface PanelDialogDefaults extends PanelFeatureDefaults {
776
776
  /** Whether using legacy Vue component */
777
777
  legacy: boolean;
778
778
  /** Reference to legacy component */
779
- ref: unknown;
779
+ ref: any;
780
780
  }
781
781
 
782
782
  /**
@@ -791,7 +791,7 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
791
791
  /** Whether using legacy Vue component */
792
792
  legacy: boolean;
793
793
  /** Reference to legacy component */
794
- ref: unknown;
794
+ ref: any;
795
795
 
796
796
  /**
797
797
  * Closes the dialog, handling legacy components.
@@ -806,7 +806,7 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
806
806
  | string
807
807
  | URL
808
808
  | Partial<PanelDialogDefaults>
809
- | { component: string; props?: Record<string, unknown> },
809
+ | { component: string; props?: Record<string, any> },
810
810
  options?: PanelRequestOptions | PanelEventCallback,
811
811
  ) => Promise<PanelDialogDefaults>;
812
812
 
@@ -816,7 +816,7 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
816
816
  */
817
817
  openComponent: (dialog: {
818
818
  component: string;
819
- props?: Record<string, unknown>;
819
+ props?: Record<string, any>;
820
820
  on?: PanelEventListenerMap;
821
821
  }) => Promise<void>;
822
822
  }
@@ -872,7 +872,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
872
872
  * Content version representing saved or changed state.
873
873
  */
874
874
  export interface PanelContentVersion {
875
- [field: string]: unknown;
875
+ [field: string]: any;
876
876
  }
877
877
 
878
878
  /**
@@ -930,7 +930,7 @@ export interface PanelContent {
930
930
 
931
931
  /** Throttled save function (1000ms) */
932
932
  saveLazy: ((
933
- values?: Record<string, unknown>,
933
+ values?: Record<string, any>,
934
934
  env?: PanelContentEnv,
935
935
  ) => Promise<void>) & { cancel: () => void };
936
936
 
@@ -945,7 +945,7 @@ export interface PanelContent {
945
945
  * @param env - Environment context
946
946
  * @throws Error if called for another view
947
947
  */
948
- diff: (env?: PanelContentEnv) => Record<string, unknown>;
948
+ diff: (env?: PanelContentEnv) => Record<string, any>;
949
949
 
950
950
  /**
951
951
  * Discards all unpublished changes.
@@ -964,7 +964,7 @@ export interface PanelContent {
964
964
  */
965
965
  emit: (
966
966
  event: string,
967
- options?: Record<string, unknown>,
967
+ options?: Record<string, any>,
968
968
  env?: PanelContentEnv,
969
969
  ) => void;
970
970
 
@@ -1019,9 +1019,9 @@ export interface PanelContent {
1019
1019
  * @throws Error if called for another view
1020
1020
  */
1021
1021
  merge: (
1022
- values?: Record<string, unknown>,
1022
+ values?: Record<string, any>,
1023
1023
  env?: PanelContentEnv,
1024
- ) => Record<string, unknown>;
1024
+ ) => Record<string, any>;
1025
1025
 
1026
1026
  /**
1027
1027
  * Publishes current changes.
@@ -1031,7 +1031,7 @@ export interface PanelContent {
1031
1031
  * @throws Error if called for another view
1032
1032
  */
1033
1033
  publish: (
1034
- values?: Record<string, unknown>,
1034
+ values?: Record<string, any>,
1035
1035
  env?: PanelContentEnv,
1036
1036
  ) => Promise<void>;
1037
1037
 
@@ -1044,9 +1044,9 @@ export interface PanelContent {
1044
1044
  */
1045
1045
  request: (
1046
1046
  method?: "save" | "publish" | "discard",
1047
- values?: Record<string, unknown>,
1047
+ values?: Record<string, any>,
1048
1048
  env?: PanelContentEnv,
1049
- ) => Promise<unknown>;
1049
+ ) => Promise<any>;
1050
1050
 
1051
1051
  /**
1052
1052
  * Saves current changes.
@@ -1054,10 +1054,7 @@ export interface PanelContent {
1054
1054
  * @param values - Values to save
1055
1055
  * @param env - Environment context
1056
1056
  */
1057
- save: (
1058
- values?: Record<string, unknown>,
1059
- env?: PanelContentEnv,
1060
- ) => Promise<void>;
1057
+ save: (values?: Record<string, any>, env?: PanelContentEnv) => Promise<void>;
1061
1058
 
1062
1059
  /**
1063
1060
  * Updates form values and saves.
@@ -1066,7 +1063,7 @@ export interface PanelContent {
1066
1063
  * @param env - Environment context
1067
1064
  */
1068
1065
  update: (
1069
- values?: Record<string, unknown>,
1066
+ values?: Record<string, any>,
1070
1067
  env?: PanelContentEnv,
1071
1068
  ) => Promise<void>;
1072
1069
 
@@ -1076,7 +1073,7 @@ export interface PanelContent {
1076
1073
  * @param values - Values to update
1077
1074
  * @param env - Environment context
1078
1075
  */
1079
- updateLazy: (values?: Record<string, unknown>, env?: PanelContentEnv) => void;
1076
+ updateLazy: (values?: Record<string, any>, env?: PanelContentEnv) => void;
1080
1077
 
1081
1078
  /**
1082
1079
  * Returns a specific version of content.
@@ -1119,7 +1116,7 @@ export interface PanelSearchOptions {
1119
1116
  */
1120
1117
  export interface PanelSearchResult {
1121
1118
  /** Result list (null if query too short) */
1122
- results: unknown[] | null;
1119
+ results: any[] | null;
1123
1120
  /** Pagination info */
1124
1121
  pagination: PanelSearchPagination;
1125
1122
  }
@@ -1199,7 +1196,7 @@ export interface PanelUploadFile {
1199
1196
  /** Error message if failed */
1200
1197
  error: string | null;
1201
1198
  /** Response model after successful upload */
1202
- model: unknown | null;
1199
+ model: any | null;
1203
1200
  }
1204
1201
 
1205
1202
  /**
@@ -1211,7 +1208,7 @@ export interface PanelUploadDefaults {
1211
1208
  /** Accepted file types */
1212
1209
  accept: string;
1213
1210
  /** Additional file attributes */
1214
- attributes: Record<string, unknown>;
1211
+ attributes: Record<string, any>;
1215
1212
  /** Files to upload */
1216
1213
  files: PanelUploadFile[];
1217
1214
  /** Maximum number of files */
@@ -1219,7 +1216,7 @@ export interface PanelUploadDefaults {
1219
1216
  /** Whether multiple files allowed */
1220
1217
  multiple: boolean;
1221
1218
  /** File preview data */
1222
- preview: Record<string, unknown>;
1219
+ preview: Record<string, any>;
1223
1220
  /** File being replaced */
1224
1221
  replacing: PanelUploadFile | null;
1225
1222
  /** Upload endpoint URL */
@@ -1242,7 +1239,7 @@ export interface PanelUpload
1242
1239
  /** Accepted file types */
1243
1240
  accept: string;
1244
1241
  /** Additional file attributes */
1245
- attributes: Record<string, unknown>;
1242
+ attributes: Record<string, any>;
1246
1243
  /** Files to upload */
1247
1244
  files: PanelUploadFile[];
1248
1245
  /** Maximum number of files */
@@ -1250,7 +1247,7 @@ export interface PanelUpload
1250
1247
  /** Whether multiple files allowed */
1251
1248
  multiple: boolean;
1252
1249
  /** File preview data */
1253
- preview: Record<string, unknown>;
1250
+ preview: Record<string, any>;
1254
1251
  /** File being replaced */
1255
1252
  replacing: PanelUploadFile | null;
1256
1253
  /** Upload endpoint URL */
@@ -1363,7 +1360,7 @@ export interface PanelUpload
1363
1360
  */
1364
1361
  upload: (
1365
1362
  file: PanelUploadFile,
1366
- attributes?: Record<string, unknown>,
1363
+ attributes?: Record<string, any>,
1367
1364
  ) => Promise<void>;
1368
1365
  }
1369
1366
 
@@ -1380,9 +1377,9 @@ export type PanelKeychain = string;
1380
1377
  * Event emitter interface (mitt-compatible).
1381
1378
  */
1382
1379
  export interface PanelEventEmitter {
1383
- emit: (event: string, ...args: unknown[]) => void;
1384
- on: (event: string, handler: (...args: unknown[]) => void) => void;
1385
- off: (event: string, handler?: (...args: unknown[]) => void) => void;
1380
+ emit: (event: string, ...args: any[]) => void;
1381
+ on: (event: string, handler: (...args: any[]) => void) => void;
1382
+ off: (event: string, handler?: (...args: any[]) => void) => void;
1386
1383
  }
1387
1384
 
1388
1385
  /**