kirby-types 1.4.7 → 1.4.9

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.
@@ -32,6 +32,7 @@ import type {
32
32
  *
33
33
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/timer.js
34
34
  * @since 4.0.0
35
+ * @source panel/src/panel/timer.js
35
36
  */
36
37
  export interface PanelTimer {
37
38
  /** Current interval ID, or null if not running */
@@ -46,9 +47,7 @@ export interface PanelTimer {
46
47
  */
47
48
  start: (timeout: number | false | null, callback: () => void) => void;
48
49
 
49
- /**
50
- * Stops the timer and clears the interval.
51
- */
50
+ /** Stops the timer and clears the interval. */
52
51
  stop: () => void;
53
52
  }
54
53
 
@@ -58,6 +57,7 @@ export interface PanelTimer {
58
57
 
59
58
  /**
60
59
  * Default state for the activation feature.
60
+ * @source panel/src/panel/activiation.js
61
61
  */
62
62
  export interface PanelActivationDefaults {
63
63
  /** Whether the activation card is visible */
@@ -72,19 +72,16 @@ export interface PanelActivationDefaults {
72
72
  *
73
73
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/activiation.js
74
74
  * @since 4.0.0
75
+ * @source panel/src/panel/activiation.js
75
76
  */
76
77
  export interface PanelActivation extends PanelState<PanelActivationDefaults> {
77
78
  /** Whether the activation card is visible */
78
79
  isOpen: boolean;
79
80
 
80
- /**
81
- * Closes the activation card and persists state to session storage.
82
- */
81
+ /** Closes the activation card and persists state to session storage. */
83
82
  close: () => void;
84
83
 
85
- /**
86
- * Opens the activation card and clears session storage state.
87
- */
84
+ /** Opens the activation card and clears session storage state. */
88
85
  open: () => void;
89
86
  }
90
87
 
@@ -94,6 +91,7 @@ export interface PanelActivation extends PanelState<PanelActivationDefaults> {
94
91
 
95
92
  /**
96
93
  * Default state for drag operations.
94
+ * @source panel/src/panel/drag.js
97
95
  */
98
96
  export interface PanelDragDefaults {
99
97
  /** Type of item being dragged */
@@ -107,6 +105,7 @@ export interface PanelDragDefaults {
107
105
  *
108
106
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/drag.js
109
107
  * @since 4.0.0
108
+ * @source panel/src/panel/drag.js
110
109
  */
111
110
  export interface PanelDrag extends PanelState<PanelDragDefaults> {
112
111
  /** Type of item being dragged */
@@ -125,9 +124,7 @@ export interface PanelDrag extends PanelState<PanelDragDefaults> {
125
124
  */
126
125
  start: (type: string, data: string | Record<string, any>) => void;
127
126
 
128
- /**
129
- * Stops the current drag operation and resets state.
130
- */
127
+ /** Stops the current drag operation and resets state. */
131
128
  stop: () => void;
132
129
  }
133
130
 
@@ -137,6 +134,7 @@ export interface PanelDrag extends PanelState<PanelDragDefaults> {
137
134
 
138
135
  /**
139
136
  * Default state for theme management.
137
+ * @source panel/src/panel/theme.js
140
138
  */
141
139
  export interface PanelThemeDefaults {
142
140
  /** User's theme preference from localStorage */
@@ -147,6 +145,7 @@ export interface PanelThemeDefaults {
147
145
 
148
146
  /**
149
147
  * Theme type values.
148
+ * @source panel/src/panel/theme.js
150
149
  */
151
150
  export type PanelThemeValue = "light" | "dark" | "system";
152
151
 
@@ -158,6 +157,7 @@ export type PanelThemeValue = "light" | "dark" | "system";
158
157
  *
159
158
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/theme.js
160
159
  * @since 5.0.0
160
+ * @source panel/src/panel/theme.js
161
161
  */
162
162
  export interface PanelTheme extends Omit<
163
163
  PanelState<PanelThemeDefaults>,
@@ -195,6 +195,7 @@ export interface PanelTheme extends Omit<
195
195
 
196
196
  /**
197
197
  * Default state for content language.
198
+ * @source panel/src/panel/language.js
198
199
  */
199
200
  export interface PanelLanguageDefaults {
200
201
  /** Language code (e.g., `"en"`, `"de"`) */
@@ -203,6 +204,8 @@ export interface PanelLanguageDefaults {
203
204
  default: boolean;
204
205
  /** Text direction */
205
206
  direction: "ltr" | "rtl";
207
+ /** Whether the language uses a custom domain. */
208
+ hasCustomDomain: boolean;
206
209
  /** Language name */
207
210
  name: string | null;
208
211
  /** Slug conversion rules */
@@ -216,6 +219,7 @@ export interface PanelLanguageDefaults {
216
219
  *
217
220
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/language.js
218
221
  * @since 4.0.0
222
+ * @source panel/src/panel/language.js
219
223
  */
220
224
  export interface PanelLanguage extends PanelState<PanelLanguageDefaults> {
221
225
  /** Language code (e.g., `"en"`, `"de"`) */
@@ -239,6 +243,7 @@ export interface PanelLanguage extends PanelState<PanelLanguageDefaults> {
239
243
 
240
244
  /**
241
245
  * Menu entry types.
246
+ * @source panel/src/panel/menu.js
242
247
  */
243
248
  export interface PanelMenuEntry {
244
249
  /** Whether this entry is currently active */
@@ -255,6 +260,7 @@ export interface PanelMenuEntry {
255
260
 
256
261
  /**
257
262
  * Default state for the sidebar menu.
263
+ * @source panel/src/panel/menu.js
258
264
  */
259
265
  export interface PanelMenuDefaults {
260
266
  /** Menu entries (items or separator strings) */
@@ -273,6 +279,7 @@ export interface PanelMenuDefaults {
273
279
  *
274
280
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/menu.js
275
281
  * @since 4.0.0
282
+ * @source panel/src/panel/menu.js
276
283
  */
277
284
  export interface PanelMenu extends Omit<PanelState<PanelMenuDefaults>, "set"> {
278
285
  /** Menu entries (items or separator strings) */
@@ -314,14 +321,10 @@ export interface PanelMenu extends Omit<PanelState<PanelMenuDefaults>, "set"> {
314
321
  */
315
322
  resize: () => void;
316
323
 
317
- /**
318
- * Sets menu entries and handles initial resize.
319
- */
324
+ /** Sets menu entries and handles initial resize. */
320
325
  set: (entries: (PanelMenuEntry | "-")[]) => PanelMenuDefaults;
321
326
 
322
- /**
323
- * Toggles the sidebar menu state.
324
- */
327
+ /** Toggles the sidebar menu state. */
325
328
  toggle: () => void;
326
329
  }
327
330
 
@@ -331,6 +334,7 @@ export interface PanelMenu extends Omit<PanelState<PanelMenuDefaults>, "set"> {
331
334
 
332
335
  /**
333
336
  * Default state for notifications.
337
+ * @source panel/src/panel/notification.js
334
338
  */
335
339
  export interface PanelNotificationDefaults {
336
340
  /** Context where notification appears */
@@ -353,6 +357,7 @@ export interface PanelNotificationDefaults {
353
357
 
354
358
  /**
355
359
  * Options for opening a notification.
360
+ * @source panel/src/panel/notification.js
356
361
  */
357
362
  export interface PanelNotificationOptions {
358
363
  /** Context where notification appears */
@@ -373,6 +378,7 @@ export interface PanelNotificationOptions {
373
378
 
374
379
  /**
375
380
  * Error object for notifications.
381
+ * @source panel/src/panel/notification.js
376
382
  */
377
383
  export interface PanelErrorObject {
378
384
  /** Error message */
@@ -391,6 +397,7 @@ export interface PanelErrorObject {
391
397
  *
392
398
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/notification.js
393
399
  * @since 4.0.0
400
+ * @source panel/src/panel/notification.js
394
401
  */
395
402
  export interface PanelNotification extends PanelState<PanelNotificationDefaults> {
396
403
  /** Context where notification appears */
@@ -416,9 +423,7 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
416
423
  /** Whether this is a fatal error notification */
417
424
  readonly isFatal: boolean;
418
425
 
419
- /**
420
- * Closes the notification and resets state.
421
- */
426
+ /** Closes the notification and resets state. */
422
427
  close: () => PanelNotificationDefaults;
423
428
 
424
429
  /**
@@ -429,9 +434,7 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
429
434
  deprecated: (message: string) => void;
430
435
 
431
436
  /**
432
- * Creates an error notification.
433
- * Opens error dialog in view context.
434
- * May redirect to logout for auth errors.
437
+ * Always shows the error notification bar; in view context also opens the `k-error-dialog`. Forwards `JsonRequestError` to `fatal()`, unwraps nested `error`/`details` fields from `RequestError` responses, and redirects authenticated users to logout on `AuthError`.
435
438
  *
436
439
  * @param error - Error object, string, or Error instance
437
440
  * @returns Notification state, or void if redirected
@@ -442,11 +445,14 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
442
445
 
443
446
  /**
444
447
  * Creates a fatal error notification.
445
- * Displayed in an isolated iframe.
448
+ * Displayed in an isolated iframe. Also accepts a plain object with
449
+ * a `message` field via `error.message ?? "Something went wrong"`.
446
450
  *
447
- * @param error - Error object, string, or Error instance
451
+ * @param error - Error object, string, or plain `{ message }` object
448
452
  */
449
- fatal: (error: Error | string) => PanelNotificationDefaults;
453
+ fatal: (
454
+ error: Error | string | PanelErrorObject,
455
+ ) => PanelNotificationDefaults;
450
456
 
451
457
  /**
452
458
  * Creates an info notification.
@@ -456,7 +462,7 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
456
462
  info: (info?: string | PanelNotificationOptions) => PanelNotificationDefaults;
457
463
 
458
464
  /**
459
- * Opens a notification with the given options.
465
+ * Opens a notification. When passed a string, delegates to `success()`. Otherwise sets the panel context, defaults `timeout` to 4000ms for non-error/non-fatal types, opens the notification, and starts the auto-close timer.
460
466
  *
461
467
  * @param notification - Message string or options object
462
468
  */
@@ -480,6 +486,7 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
480
486
 
481
487
  /**
482
488
  * Default state for system information.
489
+ * @source panel/src/panel/system.js
483
490
  */
484
491
  export interface PanelSystemDefaults {
485
492
  /** ASCII character replacements for slugs */
@@ -503,6 +510,7 @@ export interface PanelSystemDefaults {
503
510
  *
504
511
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/system.js
505
512
  * @since 4.0.0
513
+ * @source panel/src/panel/system.js
506
514
  */
507
515
  export interface PanelSystem extends PanelState<PanelSystemDefaults> {
508
516
  /** ASCII character replacements for slugs */
@@ -525,6 +533,7 @@ export interface PanelSystem extends PanelState<PanelSystemDefaults> {
525
533
 
526
534
  /**
527
535
  * Default state for interface translation.
536
+ * @source panel/src/panel/translation.js
528
537
  */
529
538
  export interface PanelTranslationDefaults {
530
539
  /** Translation code (e.g., `"en"`, `"de"`) */
@@ -547,6 +556,7 @@ export interface PanelTranslationDefaults {
547
556
  *
548
557
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/translation.js
549
558
  * @since 4.0.0
559
+ * @source panel/src/panel/translation.js
550
560
  */
551
561
  export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
552
562
  /** Translation code (e.g., `"en"`, `"de"`) */
@@ -560,9 +570,7 @@ export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
560
570
  /** First day of week (`0`=Sunday, `1`=Monday) */
561
571
  weekday: number;
562
572
 
563
- /**
564
- * Sets translation state and updates document language/direction.
565
- */
573
+ /** Sets translation state and updates document language/direction. */
566
574
  set: (state: Partial<PanelTranslationDefaults>) => PanelTranslationDefaults;
567
575
 
568
576
  /**
@@ -586,6 +594,7 @@ export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
586
594
 
587
595
  /**
588
596
  * Default state for the current user.
597
+ * @source panel/src/panel/user.js
589
598
  */
590
599
  export interface PanelUserDefaults {
591
600
  /** User email */
@@ -607,6 +616,7 @@ export interface PanelUserDefaults {
607
616
  *
608
617
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/user.js
609
618
  * @since 4.0.0
619
+ * @source panel/src/panel/user.js
610
620
  */
611
621
  export interface PanelUser extends PanelState<PanelUserDefaults> {
612
622
  /** User email */
@@ -627,6 +637,7 @@ export interface PanelUser extends PanelState<PanelUserDefaults> {
627
637
 
628
638
  /**
629
639
  * Breadcrumb item for view navigation.
640
+ * @source panel/src/panel/view.js
630
641
  */
631
642
  export interface PanelBreadcrumbItem {
632
643
  /** Display label */
@@ -637,6 +648,8 @@ export interface PanelBreadcrumbItem {
637
648
 
638
649
  /**
639
650
  * Default state for the view feature.
651
+ * @source panel/src/panel/view.js
652
+ * @source panel/src/panel/feature.js
640
653
  */
641
654
  export interface PanelViewDefaults extends PanelFeatureDefaults {
642
655
  /** Breadcrumb navigation items */
@@ -665,6 +678,8 @@ export interface PanelViewDefaults extends PanelFeatureDefaults {
665
678
  *
666
679
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/view.js
667
680
  * @since 4.0.0
681
+ * @source panel/src/panel/view.js
682
+ * @source panel/src/panel/feature.js
668
683
  */
669
684
  export interface PanelView extends Omit<
670
685
  PanelFeature<PanelViewDefaults>,
@@ -687,17 +702,13 @@ export interface PanelView extends Omit<
687
702
  /** View title */
688
703
  title: string | null;
689
704
 
690
- /**
691
- * Loads a view, canceling any previous request.
692
- */
705
+ /** Loads a view, canceling any previous request. */
693
706
  load: (
694
707
  url: string | URL,
695
708
  options?: PanelRequestOptions | PanelEventCallback,
696
709
  ) => Promise<PanelViewDefaults>;
697
710
 
698
- /**
699
- * Sets view state and updates document title and browser URL.
700
- */
711
+ /** Sets view state and updates document title and browser URL. */
701
712
  set: (state: Partial<PanelViewDefaults>) => void;
702
713
 
703
714
  /**
@@ -713,14 +724,15 @@ export interface PanelView extends Omit<
713
724
 
714
725
  /**
715
726
  * Dropdown option item.
727
+ * @source panel/src/panel/dropdown.js
716
728
  */
717
729
  export interface PanelDropdownOption {
718
730
  /** Option text */
719
731
  text: string;
720
732
  /** Icon name */
721
733
  icon?: string;
722
- /** Click handler or link */
723
- click?: () => void | string;
734
+ /** Click handler, or a link string */
735
+ click?: (() => void) | string;
724
736
  /** Whether option is disabled */
725
737
  disabled?: boolean;
726
738
  /** Additional properties */
@@ -735,11 +747,11 @@ export interface PanelDropdownOption {
735
747
  *
736
748
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/dropdown.js
737
749
  * @since 4.0.0
750
+ * @source panel/src/panel/dropdown.js
751
+ * @source panel/src/panel/feature.js
738
752
  */
739
753
  export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
740
- /**
741
- * Closes the dropdown and resets state.
742
- */
754
+ /** Closes the dropdown and resets state. */
743
755
  close: () => void;
744
756
 
745
757
  /**
@@ -752,23 +764,20 @@ export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
752
764
  ) => Promise<PanelFeatureDefaults>;
753
765
 
754
766
  /**
755
- * Opens a dropdown asynchronously.
767
+ * Opens a dropdown asynchronously and returns a closure that invokes
768
+ * `ready(items)` with the resolved option list.
756
769
  *
757
770
  * @deprecated Since 4.0.0 - Use `open()` instead
758
771
  */
759
772
  openAsync: (
760
773
  dropdown: string | URL | Partial<PanelFeatureDefaults>,
761
774
  options?: PanelRequestOptions | PanelEventCallback,
762
- ) => (ready?: () => void) => Promise<PanelFeatureDefaults>;
775
+ ) => (ready: (items: PanelDropdownOption[]) => void) => Promise<void>;
763
776
 
764
- /**
765
- * Returns dropdown options array from props.
766
- */
777
+ /** Returns dropdown options array from props. */
767
778
  options: () => PanelDropdownOption[];
768
779
 
769
- /**
770
- * Sets dropdown state, handling deprecated responses.
771
- */
780
+ /** Sets dropdown state, handling deprecated responses. */
772
781
  set: (state: Partial<PanelFeatureDefaults>) => PanelFeatureDefaults;
773
782
  }
774
783
 
@@ -778,6 +787,8 @@ export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
778
787
 
779
788
  /**
780
789
  * Default state for the dialog modal.
790
+ * @source panel/src/panel/dialog.js
791
+ * @source panel/src/panel/modal.js
781
792
  */
782
793
  export interface PanelDialogDefaults extends PanelFeatureDefaults {
783
794
  /** Unique dialog ID */
@@ -795,6 +806,8 @@ export interface PanelDialogDefaults extends PanelFeatureDefaults {
795
806
  *
796
807
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/dialog.js
797
808
  * @since 4.0.0
809
+ * @source panel/src/panel/dialog.js
810
+ * @source panel/src/panel/modal.js
798
811
  */
799
812
  export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
800
813
  /** Whether using legacy Vue component */
@@ -802,14 +815,10 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
802
815
  /** Reference to legacy component */
803
816
  ref: any;
804
817
 
805
- /**
806
- * Closes the dialog, handling legacy components.
807
- */
818
+ /** Closes the dialog, handling legacy components. */
808
819
  close: () => Promise<void>;
809
820
 
810
- /**
811
- * Opens a dialog by URL, state object, or legacy component.
812
- */
821
+ /** Opens a dialog by URL, state object, or legacy component. */
813
822
  open: (
814
823
  dialog:
815
824
  | string
@@ -834,6 +843,8 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
834
843
 
835
844
  /**
836
845
  * Default state for the drawer modal.
846
+ * @source panel/src/panel/drawer.js
847
+ * @source panel/src/panel/modal.js
837
848
  */
838
849
  export interface PanelDrawerDefaults extends PanelFeatureDefaults {
839
850
  /** Unique drawer ID */
@@ -847,6 +858,8 @@ export interface PanelDrawerDefaults extends PanelFeatureDefaults {
847
858
  *
848
859
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/drawer.js
849
860
  * @since 4.0.0
861
+ * @source panel/src/panel/drawer.js
862
+ * @source panel/src/panel/modal.js
850
863
  */
851
864
  export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
852
865
  /** Breadcrumb from history milestones */
@@ -855,9 +868,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
855
868
  /** Drawer icon, defaults to `"box"` */
856
869
  readonly icon: string;
857
870
 
858
- /**
859
- * Opens a drawer by URL or state object.
860
- */
871
+ /** Opens a drawer by URL or state object. */
861
872
  open: (
862
873
  drawer: string | URL | Partial<PanelDrawerDefaults>,
863
874
  options?: PanelRequestOptions | PanelEventCallback,
@@ -865,15 +876,14 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
865
876
 
866
877
  /**
867
878
  * Switches drawer tabs.
879
+ * If `tab` is omitted, falls back to the first key of `props.tabs`.
868
880
  *
869
881
  * @param tab - Tab name to switch to
870
882
  * @returns False if no tabs exist, void otherwise
871
883
  */
872
- tab: (tab: string) => void | false;
884
+ tab: (tab?: string) => void | false;
873
885
 
874
- /**
875
- * Returns drawer event listeners for Vue component binding.
876
- */
886
+ /** Returns the modal listeners extended with drawer-specific `crumb` (history navigation) and `tab` handlers. */
877
887
  listeners: () => PanelModalListeners;
878
888
  }
879
889
 
@@ -883,6 +893,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
883
893
 
884
894
  /**
885
895
  * Content version representing saved or changed state.
896
+ * @source panel/src/panel/content.js
886
897
  */
887
898
  export interface PanelContentVersion {
888
899
  [field: string]: any;
@@ -890,6 +901,7 @@ export interface PanelContentVersion {
890
901
 
891
902
  /**
892
903
  * Content versions container.
904
+ * @source panel/src/panel/content.js
893
905
  */
894
906
  export interface PanelContentVersions {
895
907
  /** Original saved content */
@@ -900,6 +912,7 @@ export interface PanelContentVersions {
900
912
 
901
913
  /**
902
914
  * Lock state for content editing.
915
+ * @source panel/src/panel/content.js
903
916
  */
904
917
  export interface PanelContentLock {
905
918
  /** Whether content is locked by another user */
@@ -914,6 +927,7 @@ export interface PanelContentLock {
914
927
 
915
928
  /**
916
929
  * Environment context for content operations.
930
+ * @source panel/src/panel/content.js
917
931
  */
918
932
  export interface PanelContentEnv {
919
933
  /** API endpoint path */
@@ -930,6 +944,7 @@ export interface PanelContentEnv {
930
944
  *
931
945
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/content.js
932
946
  * @since 5.0.0
947
+ * @source panel/src/panel/content.js
933
948
  */
934
949
  export interface PanelContent {
935
950
  /** Reference to lock dialog if open */
@@ -938,18 +953,13 @@ export interface PanelContent {
938
953
  /** Whether content is being saved/published/discarded */
939
954
  isProcessing: boolean;
940
955
 
941
- /** AbortController for save requests */
942
- saveAbortController: AbortController | null;
943
-
944
956
  /** Throttled save function (1000ms) */
945
957
  saveLazy: ((
946
958
  values?: Record<string, any>,
947
959
  env?: PanelContentEnv,
948
960
  ) => Promise<void>) & { cancel: () => void };
949
961
 
950
- /**
951
- * Cancels any ongoing or scheduled save requests.
952
- */
962
+ /** Cancels any ongoing or scheduled save requests. */
953
963
  cancelSaving: () => void;
954
964
 
955
965
  /**
@@ -996,7 +1006,7 @@ export interface PanelContent {
996
1006
  hasDiff: (env?: PanelContentEnv) => boolean;
997
1007
 
998
1008
  /**
999
- * Whether the API endpoint belongs to the current view.
1009
+ * Whether the given env's `api` and `language` both match the current view.
1000
1010
  *
1001
1011
  * @param env - Environment context
1002
1012
  */
@@ -1095,9 +1105,7 @@ export interface PanelContent {
1095
1105
  */
1096
1106
  version: (versionId: "latest" | "changes") => PanelContentVersion;
1097
1107
 
1098
- /**
1099
- * Returns all content versions.
1100
- */
1108
+ /** Returns all content versions. */
1101
1109
  versions: () => PanelContentVersions;
1102
1110
  }
1103
1111
 
@@ -1107,6 +1115,7 @@ export interface PanelContent {
1107
1115
 
1108
1116
  /**
1109
1117
  * Search pagination info.
1118
+ * @source panel/src/panel/search.js
1110
1119
  */
1111
1120
  export interface PanelSearchPagination {
1112
1121
  page?: number;
@@ -1116,6 +1125,7 @@ export interface PanelSearchPagination {
1116
1125
 
1117
1126
  /**
1118
1127
  * Search query options.
1128
+ * @source panel/src/panel/search.js
1119
1129
  */
1120
1130
  export interface PanelSearchOptions {
1121
1131
  /** Page number */
@@ -1126,6 +1136,7 @@ export interface PanelSearchOptions {
1126
1136
 
1127
1137
  /**
1128
1138
  * Search result from API.
1139
+ * @source panel/src/panel/search.js
1129
1140
  */
1130
1141
  export interface PanelSearchResult {
1131
1142
  /** Result list (null if query too short) */
@@ -1141,6 +1152,7 @@ export interface PanelSearchResult {
1141
1152
  *
1142
1153
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/search.js
1143
1154
  * @since 4.4.0
1155
+ * @source panel/src/panel/search.js
1144
1156
  */
1145
1157
  export interface PanelSearcher {
1146
1158
  /** AbortController for current request */
@@ -1160,8 +1172,7 @@ export interface PanelSearcher {
1160
1172
  open: (type?: string) => void;
1161
1173
 
1162
1174
  /**
1163
- * Queries the search API.
1164
- * Returns empty results for queries under 2 characters.
1175
+ * Queries the search API. For queries shorter than 2 characters returns `{ results: null, pagination: {} }` without hitting the server. Resolves to `undefined` when the request was aborted by a subsequent search (the catch falls through with no return).
1165
1176
  *
1166
1177
  * @param type - Search type
1167
1178
  * @param query - Search query
@@ -1171,17 +1182,38 @@ export interface PanelSearcher {
1171
1182
  type: string,
1172
1183
  query: string,
1173
1184
  options?: PanelSearchOptions,
1174
- ) => Promise<PanelSearchResult>;
1185
+ ) => Promise<PanelSearchResult | undefined>;
1175
1186
  }
1176
1187
 
1177
1188
  // -----------------------------------------------------------------------------
1178
1189
  // Upload
1179
1190
  // -----------------------------------------------------------------------------
1180
1191
 
1192
+ /**
1193
+ * Server-side file model passed to `PanelUpload.replace()` and stored in
1194
+ * `PanelUploadDefaults.replacing`. Distinct from `PanelUploadFile` (the
1195
+ * client-side queued upload). Carries the fields read by `replace()` to
1196
+ * configure the upload picker (`url`, `accept`).
1197
+ *
1198
+ * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js
1199
+ * @source panel/src/panel/upload.js
1200
+ */
1201
+ export interface PanelUploadReplaceFile {
1202
+ /** API path segment used to build the upload URL */
1203
+ link: string;
1204
+ /** File extension without dot, used for the picker `accept` filter */
1205
+ extension: string;
1206
+ /** MIME type, used for the picker `accept` filter */
1207
+ mime: string;
1208
+ /** Additional server-side fields */
1209
+ [key: string]: any;
1210
+ }
1211
+
1181
1212
  /**
1182
1213
  * Upload file state representing a file in the upload queue.
1183
1214
  *
1184
1215
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js
1216
+ * @source panel/src/panel/upload.js
1185
1217
  */
1186
1218
  export interface PanelUploadFile {
1187
1219
  /** Unique file ID */
@@ -1214,6 +1246,7 @@ export interface PanelUploadFile {
1214
1246
 
1215
1247
  /**
1216
1248
  * Default state for upload feature.
1249
+ * @source panel/src/panel/upload.js
1217
1250
  */
1218
1251
  export interface PanelUploadDefaults {
1219
1252
  /** AbortController for current upload */
@@ -1230,8 +1263,8 @@ export interface PanelUploadDefaults {
1230
1263
  multiple: boolean;
1231
1264
  /** File preview data */
1232
1265
  preview: Record<string, any>;
1233
- /** File being replaced */
1234
- replacing: PanelUploadFile | null;
1266
+ /** Server file model being replaced (carries `link`, `extension`, `mime`). */
1267
+ replacing: PanelUploadReplaceFile | null;
1235
1268
  /** Upload endpoint URL */
1236
1269
  url: string | null;
1237
1270
  }
@@ -1244,6 +1277,7 @@ export interface PanelUploadDefaults {
1244
1277
  *
1245
1278
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js
1246
1279
  * @since 4.0.0
1280
+ * @source panel/src/panel/upload.js
1247
1281
  */
1248
1282
  export interface PanelUpload
1249
1283
  extends PanelState<PanelUploadDefaults>, PanelEventListeners {
@@ -1261,47 +1295,41 @@ export interface PanelUpload
1261
1295
  multiple: boolean;
1262
1296
  /** File preview data */
1263
1297
  preview: Record<string, any>;
1264
- /** File being replaced */
1265
- replacing: PanelUploadFile | null;
1298
+ /** Server file model being replaced (see `PanelUploadDefaults.replacing`) */
1299
+ replacing: PanelUploadReplaceFile | null;
1266
1300
  /** Upload endpoint URL */
1267
1301
  url: string | null;
1268
1302
 
1269
1303
  /** Hidden file input element */
1270
1304
  input: HTMLInputElement | null;
1271
1305
 
1272
- /** Files that completed uploading */
1273
- readonly completed: PanelUploadFile[];
1306
+ /** Server file models for files that completed uploading. */
1307
+ readonly completed: any[];
1274
1308
 
1275
- /**
1276
- * Shows success notification and emits model.update.
1277
- */
1309
+ /** Shows success notification and emits model.update. */
1278
1310
  announce: () => void;
1279
1311
 
1280
- /**
1281
- * Cancels current upload and resets state.
1282
- */
1312
+ /** Emits `cancel`, aborts any ongoing upload, and if some files already finished emits `complete` and announces success before resetting state. */
1283
1313
  cancel: () => Promise<void>;
1284
1314
 
1285
- /**
1286
- * Called when upload dialog submit clicked.
1287
- */
1315
+ /** Closes the upload dialog after all remaining files have uploaded; if any files completed, emits `complete` and `done`, announces success, and resets state. */
1288
1316
  done: () => Promise<void>;
1289
1317
 
1290
1318
  /**
1291
- * Finds duplicate file by comparing properties.
1292
- * Returns the index of the duplicate file, or false if not found.
1319
+ * Finds the index of an existing file in the queue with the same `src.name`, `src.type`, `src.size`, and `src.lastModified`. Returns the matching index, or `-1` if no duplicate is found.
1293
1320
  *
1294
- * @param file - File to check
1295
- * @returns Index of duplicate file or false
1321
+ * @param file - Enriched upload file to check
1322
+ * @returns Index of the duplicate file, or `-1` if none
1296
1323
  */
1297
- findDuplicate: (file: File) => number | false;
1324
+ findDuplicate: (file: PanelUploadFile) => number;
1298
1325
 
1299
1326
  /**
1300
1327
  * Checks if file has a unique name.
1328
+ * Compares `file.name` and `file.extension` against the upload queue.
1301
1329
  *
1302
- * @param file - File to check
1330
+ * @param file - Enriched upload file to check
1303
1331
  */
1304
- hasUniqueName: (file: File) => boolean;
1332
+ hasUniqueName: (file: PanelUploadFile) => boolean;
1305
1333
 
1306
1334
  /**
1307
1335
  * Converts File to enriched upload file object.
@@ -1337,34 +1365,33 @@ export interface PanelUpload
1337
1365
 
1338
1366
  /**
1339
1367
  * Opens picker to replace an existing file.
1368
+ * The `file` argument is a server file model (reads `file.link`,
1369
+ * `file.extension`, `file.mime`), not a queued `PanelUploadFile`.
1340
1370
  *
1341
- * @param file - File to replace
1371
+ * @param file - Server file model being replaced
1342
1372
  * @param options - Upload options
1343
1373
  */
1344
1374
  replace: (
1345
- file: PanelUploadFile,
1375
+ file: PanelUploadReplaceFile,
1346
1376
  options?: Partial<PanelUploadDefaults>,
1347
1377
  ) => void;
1348
1378
 
1349
1379
  /**
1350
1380
  * Adds files to upload list with deduplication.
1381
+ * Also accepts an `Event` whose `target.files` is unwrapped to a `FileList`.
1351
1382
  *
1352
- * @param files - Files to add
1383
+ * @param files - Files to add (or input change Event)
1353
1384
  * @param options - Upload options
1354
1385
  */
1355
1386
  select: (
1356
- files: File[] | FileList,
1387
+ files: File[] | FileList | Event,
1357
1388
  options?: Partial<PanelUploadDefaults>,
1358
1389
  ) => void;
1359
1390
 
1360
- /**
1361
- * Sets state and registers event listeners.
1362
- */
1391
+ /** Sets state and registers event listeners. */
1363
1392
  set: (state: Partial<PanelUploadDefaults>) => PanelUploadDefaults;
1364
1393
 
1365
- /**
1366
- * Submits and uploads all remaining files.
1367
- */
1394
+ /** Submits and uploads all remaining files. */
1368
1395
  submit: () => Promise<void>;
1369
1396
 
1370
1397
  /**
@@ -1385,6 +1412,7 @@ export interface PanelUpload
1385
1412
 
1386
1413
  /**
1387
1414
  * Event emitter interface (mitt-compatible).
1415
+ * @source panel/src/panel/events.js
1388
1416
  */
1389
1417
  export interface PanelEventEmitter {
1390
1418
  emit: (event: string, ...args: any[]) => void;
@@ -1400,6 +1428,7 @@ export interface PanelEventEmitter {
1400
1428
  *
1401
1429
  * @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/events.js
1402
1430
  * @since 4.0.0
1431
+ * @source panel/src/panel/events.js
1403
1432
  */
1404
1433
  export interface PanelEvents extends PanelEventEmitter {
1405
1434
  /** Element that was entered during drag */
@@ -1535,13 +1564,9 @@ export interface PanelEvents extends PanelEventEmitter {
1535
1564
  */
1536
1565
  prevent: (event: Event) => void;
1537
1566
 
1538
- /**
1539
- * Subscribes all global event listeners.
1540
- */
1567
+ /** Subscribes all global event listeners. */
1541
1568
  subscribe: () => void;
1542
1569
 
1543
- /**
1544
- * Unsubscribes all global event listeners.
1545
- */
1570
+ /** Unsubscribes all global event listeners. */
1546
1571
  unsubscribe: () => void;
1547
1572
  }