kirby-types 1.4.7 → 1.4.8
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/package.json +8 -8
- package/src/panel/api.d.ts +42 -38
- package/src/panel/base.d.ts +42 -54
- package/src/panel/features.d.ts +127 -121
- package/src/panel/helpers.d.ts +90 -68
- package/src/panel/index.d.ts +129 -23
- package/src/panel/libraries.d.ts +45 -66
- package/src/panel/textarea.d.ts +18 -50
- package/src/panel/writer.d.ts +66 -35
package/src/panel/features.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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
|
|
451
|
+
* @param error - Error object, string, or plain `{ message }` object
|
|
448
452
|
*/
|
|
449
|
-
fatal: (
|
|
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
|
|
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 */
|
|
@@ -649,8 +662,12 @@ export interface PanelViewDefaults extends PanelFeatureDefaults {
|
|
|
649
662
|
id: string | null;
|
|
650
663
|
/** View link */
|
|
651
664
|
link: string | null;
|
|
652
|
-
/**
|
|
653
|
-
|
|
665
|
+
/**
|
|
666
|
+
* Relative path to this view.
|
|
667
|
+
* Inherits the `string | null` shape from `PanelFeatureDefaults.path`;
|
|
668
|
+
* View does not override the runtime default of `null`.
|
|
669
|
+
*/
|
|
670
|
+
path: string | null;
|
|
654
671
|
/** Default search type */
|
|
655
672
|
search: string;
|
|
656
673
|
/** View title */
|
|
@@ -665,6 +682,8 @@ export interface PanelViewDefaults extends PanelFeatureDefaults {
|
|
|
665
682
|
*
|
|
666
683
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/view.js
|
|
667
684
|
* @since 4.0.0
|
|
685
|
+
* @source panel/src/panel/view.js
|
|
686
|
+
* @source panel/src/panel/feature.js
|
|
668
687
|
*/
|
|
669
688
|
export interface PanelView extends Omit<
|
|
670
689
|
PanelFeature<PanelViewDefaults>,
|
|
@@ -680,24 +699,20 @@ export interface PanelView extends Omit<
|
|
|
680
699
|
id: string | null;
|
|
681
700
|
/** View link */
|
|
682
701
|
link: string | null;
|
|
683
|
-
/** Relative path to this view */
|
|
684
|
-
path: string;
|
|
702
|
+
/** Relative path to this view (inherits `string | null` from feature defaults) */
|
|
703
|
+
path: string | null;
|
|
685
704
|
/** Default search type */
|
|
686
705
|
search: string;
|
|
687
706
|
/** View title */
|
|
688
707
|
title: string | null;
|
|
689
708
|
|
|
690
|
-
/**
|
|
691
|
-
* Loads a view, canceling any previous request.
|
|
692
|
-
*/
|
|
709
|
+
/** Loads a view, canceling any previous request. */
|
|
693
710
|
load: (
|
|
694
711
|
url: string | URL,
|
|
695
712
|
options?: PanelRequestOptions | PanelEventCallback,
|
|
696
713
|
) => Promise<PanelViewDefaults>;
|
|
697
714
|
|
|
698
|
-
/**
|
|
699
|
-
* Sets view state and updates document title and browser URL.
|
|
700
|
-
*/
|
|
715
|
+
/** Sets view state and updates document title and browser URL. */
|
|
701
716
|
set: (state: Partial<PanelViewDefaults>) => void;
|
|
702
717
|
|
|
703
718
|
/**
|
|
@@ -713,14 +728,15 @@ export interface PanelView extends Omit<
|
|
|
713
728
|
|
|
714
729
|
/**
|
|
715
730
|
* Dropdown option item.
|
|
731
|
+
* @source panel/src/panel/dropdown.js
|
|
716
732
|
*/
|
|
717
733
|
export interface PanelDropdownOption {
|
|
718
734
|
/** Option text */
|
|
719
735
|
text: string;
|
|
720
736
|
/** Icon name */
|
|
721
737
|
icon?: string;
|
|
722
|
-
/** Click handler or link */
|
|
723
|
-
click?: () => void | string;
|
|
738
|
+
/** Click handler, or a link string */
|
|
739
|
+
click?: (() => void) | string;
|
|
724
740
|
/** Whether option is disabled */
|
|
725
741
|
disabled?: boolean;
|
|
726
742
|
/** Additional properties */
|
|
@@ -735,11 +751,11 @@ export interface PanelDropdownOption {
|
|
|
735
751
|
*
|
|
736
752
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/dropdown.js
|
|
737
753
|
* @since 4.0.0
|
|
754
|
+
* @source panel/src/panel/dropdown.js
|
|
755
|
+
* @source panel/src/panel/feature.js
|
|
738
756
|
*/
|
|
739
757
|
export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
|
|
740
|
-
/**
|
|
741
|
-
* Closes the dropdown and resets state.
|
|
742
|
-
*/
|
|
758
|
+
/** Closes the dropdown and resets state. */
|
|
743
759
|
close: () => void;
|
|
744
760
|
|
|
745
761
|
/**
|
|
@@ -752,23 +768,20 @@ export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
|
|
|
752
768
|
) => Promise<PanelFeatureDefaults>;
|
|
753
769
|
|
|
754
770
|
/**
|
|
755
|
-
* Opens a dropdown asynchronously
|
|
771
|
+
* Opens a dropdown asynchronously and returns a closure that invokes
|
|
772
|
+
* `ready(items)` with the resolved option list.
|
|
756
773
|
*
|
|
757
774
|
* @deprecated Since 4.0.0 - Use `open()` instead
|
|
758
775
|
*/
|
|
759
776
|
openAsync: (
|
|
760
777
|
dropdown: string | URL | Partial<PanelFeatureDefaults>,
|
|
761
778
|
options?: PanelRequestOptions | PanelEventCallback,
|
|
762
|
-
) => (ready
|
|
779
|
+
) => (ready: (items: PanelDropdownOption[]) => void) => Promise<void>;
|
|
763
780
|
|
|
764
|
-
/**
|
|
765
|
-
* Returns dropdown options array from props.
|
|
766
|
-
*/
|
|
781
|
+
/** Returns dropdown options array from props. */
|
|
767
782
|
options: () => PanelDropdownOption[];
|
|
768
783
|
|
|
769
|
-
/**
|
|
770
|
-
* Sets dropdown state, handling deprecated responses.
|
|
771
|
-
*/
|
|
784
|
+
/** Sets dropdown state, handling deprecated responses. */
|
|
772
785
|
set: (state: Partial<PanelFeatureDefaults>) => PanelFeatureDefaults;
|
|
773
786
|
}
|
|
774
787
|
|
|
@@ -778,6 +791,8 @@ export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
|
|
|
778
791
|
|
|
779
792
|
/**
|
|
780
793
|
* Default state for the dialog modal.
|
|
794
|
+
* @source panel/src/panel/dialog.js
|
|
795
|
+
* @source panel/src/panel/modal.js
|
|
781
796
|
*/
|
|
782
797
|
export interface PanelDialogDefaults extends PanelFeatureDefaults {
|
|
783
798
|
/** Unique dialog ID */
|
|
@@ -795,6 +810,8 @@ export interface PanelDialogDefaults extends PanelFeatureDefaults {
|
|
|
795
810
|
*
|
|
796
811
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/dialog.js
|
|
797
812
|
* @since 4.0.0
|
|
813
|
+
* @source panel/src/panel/dialog.js
|
|
814
|
+
* @source panel/src/panel/modal.js
|
|
798
815
|
*/
|
|
799
816
|
export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
|
|
800
817
|
/** Whether using legacy Vue component */
|
|
@@ -802,14 +819,10 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
|
|
|
802
819
|
/** Reference to legacy component */
|
|
803
820
|
ref: any;
|
|
804
821
|
|
|
805
|
-
/**
|
|
806
|
-
* Closes the dialog, handling legacy components.
|
|
807
|
-
*/
|
|
822
|
+
/** Closes the dialog, handling legacy components. */
|
|
808
823
|
close: () => Promise<void>;
|
|
809
824
|
|
|
810
|
-
/**
|
|
811
|
-
* Opens a dialog by URL, state object, or legacy component.
|
|
812
|
-
*/
|
|
825
|
+
/** Opens a dialog by URL, state object, or legacy component. */
|
|
813
826
|
open: (
|
|
814
827
|
dialog:
|
|
815
828
|
| string
|
|
@@ -834,6 +847,8 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
|
|
|
834
847
|
|
|
835
848
|
/**
|
|
836
849
|
* Default state for the drawer modal.
|
|
850
|
+
* @source panel/src/panel/drawer.js
|
|
851
|
+
* @source panel/src/panel/modal.js
|
|
837
852
|
*/
|
|
838
853
|
export interface PanelDrawerDefaults extends PanelFeatureDefaults {
|
|
839
854
|
/** Unique drawer ID */
|
|
@@ -847,6 +862,8 @@ export interface PanelDrawerDefaults extends PanelFeatureDefaults {
|
|
|
847
862
|
*
|
|
848
863
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/drawer.js
|
|
849
864
|
* @since 4.0.0
|
|
865
|
+
* @source panel/src/panel/drawer.js
|
|
866
|
+
* @source panel/src/panel/modal.js
|
|
850
867
|
*/
|
|
851
868
|
export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
852
869
|
/** Breadcrumb from history milestones */
|
|
@@ -855,9 +872,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
|
855
872
|
/** Drawer icon, defaults to `"box"` */
|
|
856
873
|
readonly icon: string;
|
|
857
874
|
|
|
858
|
-
/**
|
|
859
|
-
* Opens a drawer by URL or state object.
|
|
860
|
-
*/
|
|
875
|
+
/** Opens a drawer by URL or state object. */
|
|
861
876
|
open: (
|
|
862
877
|
drawer: string | URL | Partial<PanelDrawerDefaults>,
|
|
863
878
|
options?: PanelRequestOptions | PanelEventCallback,
|
|
@@ -865,15 +880,14 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
|
865
880
|
|
|
866
881
|
/**
|
|
867
882
|
* Switches drawer tabs.
|
|
883
|
+
* If `tab` is omitted, falls back to the first key of `props.tabs`.
|
|
868
884
|
*
|
|
869
885
|
* @param tab - Tab name to switch to
|
|
870
886
|
* @returns False if no tabs exist, void otherwise
|
|
871
887
|
*/
|
|
872
|
-
tab: (tab
|
|
888
|
+
tab: (tab?: string) => void | false;
|
|
873
889
|
|
|
874
|
-
/**
|
|
875
|
-
* Returns drawer event listeners for Vue component binding.
|
|
876
|
-
*/
|
|
890
|
+
/** Returns the modal listeners extended with drawer-specific `crumb` (history navigation) and `tab` handlers. */
|
|
877
891
|
listeners: () => PanelModalListeners;
|
|
878
892
|
}
|
|
879
893
|
|
|
@@ -883,6 +897,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
|
883
897
|
|
|
884
898
|
/**
|
|
885
899
|
* Content version representing saved or changed state.
|
|
900
|
+
* @source panel/src/panel/content.js
|
|
886
901
|
*/
|
|
887
902
|
export interface PanelContentVersion {
|
|
888
903
|
[field: string]: any;
|
|
@@ -890,6 +905,7 @@ export interface PanelContentVersion {
|
|
|
890
905
|
|
|
891
906
|
/**
|
|
892
907
|
* Content versions container.
|
|
908
|
+
* @source panel/src/panel/content.js
|
|
893
909
|
*/
|
|
894
910
|
export interface PanelContentVersions {
|
|
895
911
|
/** Original saved content */
|
|
@@ -900,6 +916,7 @@ export interface PanelContentVersions {
|
|
|
900
916
|
|
|
901
917
|
/**
|
|
902
918
|
* Lock state for content editing.
|
|
919
|
+
* @source panel/src/panel/content.js
|
|
903
920
|
*/
|
|
904
921
|
export interface PanelContentLock {
|
|
905
922
|
/** Whether content is locked by another user */
|
|
@@ -914,6 +931,7 @@ export interface PanelContentLock {
|
|
|
914
931
|
|
|
915
932
|
/**
|
|
916
933
|
* Environment context for content operations.
|
|
934
|
+
* @source panel/src/panel/content.js
|
|
917
935
|
*/
|
|
918
936
|
export interface PanelContentEnv {
|
|
919
937
|
/** API endpoint path */
|
|
@@ -930,6 +948,7 @@ export interface PanelContentEnv {
|
|
|
930
948
|
*
|
|
931
949
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/content.js
|
|
932
950
|
* @since 5.0.0
|
|
951
|
+
* @source panel/src/panel/content.js
|
|
933
952
|
*/
|
|
934
953
|
export interface PanelContent {
|
|
935
954
|
/** Reference to lock dialog if open */
|
|
@@ -938,18 +957,13 @@ export interface PanelContent {
|
|
|
938
957
|
/** Whether content is being saved/published/discarded */
|
|
939
958
|
isProcessing: boolean;
|
|
940
959
|
|
|
941
|
-
/** AbortController for save requests */
|
|
942
|
-
saveAbortController: AbortController | null;
|
|
943
|
-
|
|
944
960
|
/** Throttled save function (1000ms) */
|
|
945
961
|
saveLazy: ((
|
|
946
962
|
values?: Record<string, any>,
|
|
947
963
|
env?: PanelContentEnv,
|
|
948
964
|
) => Promise<void>) & { cancel: () => void };
|
|
949
965
|
|
|
950
|
-
/**
|
|
951
|
-
* Cancels any ongoing or scheduled save requests.
|
|
952
|
-
*/
|
|
966
|
+
/** Cancels any ongoing or scheduled save requests. */
|
|
953
967
|
cancelSaving: () => void;
|
|
954
968
|
|
|
955
969
|
/**
|
|
@@ -996,7 +1010,7 @@ export interface PanelContent {
|
|
|
996
1010
|
hasDiff: (env?: PanelContentEnv) => boolean;
|
|
997
1011
|
|
|
998
1012
|
/**
|
|
999
|
-
* Whether the
|
|
1013
|
+
* Whether the given env's `api` and `language` both match the current view.
|
|
1000
1014
|
*
|
|
1001
1015
|
* @param env - Environment context
|
|
1002
1016
|
*/
|
|
@@ -1095,9 +1109,7 @@ export interface PanelContent {
|
|
|
1095
1109
|
*/
|
|
1096
1110
|
version: (versionId: "latest" | "changes") => PanelContentVersion;
|
|
1097
1111
|
|
|
1098
|
-
/**
|
|
1099
|
-
* Returns all content versions.
|
|
1100
|
-
*/
|
|
1112
|
+
/** Returns all content versions. */
|
|
1101
1113
|
versions: () => PanelContentVersions;
|
|
1102
1114
|
}
|
|
1103
1115
|
|
|
@@ -1107,6 +1119,7 @@ export interface PanelContent {
|
|
|
1107
1119
|
|
|
1108
1120
|
/**
|
|
1109
1121
|
* Search pagination info.
|
|
1122
|
+
* @source panel/src/panel/search.js
|
|
1110
1123
|
*/
|
|
1111
1124
|
export interface PanelSearchPagination {
|
|
1112
1125
|
page?: number;
|
|
@@ -1116,6 +1129,7 @@ export interface PanelSearchPagination {
|
|
|
1116
1129
|
|
|
1117
1130
|
/**
|
|
1118
1131
|
* Search query options.
|
|
1132
|
+
* @source panel/src/panel/search.js
|
|
1119
1133
|
*/
|
|
1120
1134
|
export interface PanelSearchOptions {
|
|
1121
1135
|
/** Page number */
|
|
@@ -1126,6 +1140,7 @@ export interface PanelSearchOptions {
|
|
|
1126
1140
|
|
|
1127
1141
|
/**
|
|
1128
1142
|
* Search result from API.
|
|
1143
|
+
* @source panel/src/panel/search.js
|
|
1129
1144
|
*/
|
|
1130
1145
|
export interface PanelSearchResult {
|
|
1131
1146
|
/** Result list (null if query too short) */
|
|
@@ -1141,6 +1156,7 @@ export interface PanelSearchResult {
|
|
|
1141
1156
|
*
|
|
1142
1157
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/search.js
|
|
1143
1158
|
* @since 4.4.0
|
|
1159
|
+
* @source panel/src/panel/search.js
|
|
1144
1160
|
*/
|
|
1145
1161
|
export interface PanelSearcher {
|
|
1146
1162
|
/** AbortController for current request */
|
|
@@ -1160,8 +1176,7 @@ export interface PanelSearcher {
|
|
|
1160
1176
|
open: (type?: string) => void;
|
|
1161
1177
|
|
|
1162
1178
|
/**
|
|
1163
|
-
* Queries the search API.
|
|
1164
|
-
* Returns empty results for queries under 2 characters.
|
|
1179
|
+
* 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
1180
|
*
|
|
1166
1181
|
* @param type - Search type
|
|
1167
1182
|
* @param query - Search query
|
|
@@ -1171,7 +1186,7 @@ export interface PanelSearcher {
|
|
|
1171
1186
|
type: string,
|
|
1172
1187
|
query: string,
|
|
1173
1188
|
options?: PanelSearchOptions,
|
|
1174
|
-
) => Promise<PanelSearchResult>;
|
|
1189
|
+
) => Promise<PanelSearchResult | undefined>;
|
|
1175
1190
|
}
|
|
1176
1191
|
|
|
1177
1192
|
// -----------------------------------------------------------------------------
|
|
@@ -1182,6 +1197,7 @@ export interface PanelSearcher {
|
|
|
1182
1197
|
* Upload file state representing a file in the upload queue.
|
|
1183
1198
|
*
|
|
1184
1199
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js
|
|
1200
|
+
* @source panel/src/panel/upload.js
|
|
1185
1201
|
*/
|
|
1186
1202
|
export interface PanelUploadFile {
|
|
1187
1203
|
/** Unique file ID */
|
|
@@ -1214,6 +1230,7 @@ export interface PanelUploadFile {
|
|
|
1214
1230
|
|
|
1215
1231
|
/**
|
|
1216
1232
|
* Default state for upload feature.
|
|
1233
|
+
* @source panel/src/panel/upload.js
|
|
1217
1234
|
*/
|
|
1218
1235
|
export interface PanelUploadDefaults {
|
|
1219
1236
|
/** AbortController for current upload */
|
|
@@ -1230,8 +1247,8 @@ export interface PanelUploadDefaults {
|
|
|
1230
1247
|
multiple: boolean;
|
|
1231
1248
|
/** File preview data */
|
|
1232
1249
|
preview: Record<string, any>;
|
|
1233
|
-
/**
|
|
1234
|
-
replacing:
|
|
1250
|
+
/** Server file model being replaced (carries `link`, `extension`, `mime`). */
|
|
1251
|
+
replacing: any | null;
|
|
1235
1252
|
/** Upload endpoint URL */
|
|
1236
1253
|
url: string | null;
|
|
1237
1254
|
}
|
|
@@ -1244,6 +1261,7 @@ export interface PanelUploadDefaults {
|
|
|
1244
1261
|
*
|
|
1245
1262
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js
|
|
1246
1263
|
* @since 4.0.0
|
|
1264
|
+
* @source panel/src/panel/upload.js
|
|
1247
1265
|
*/
|
|
1248
1266
|
export interface PanelUpload
|
|
1249
1267
|
extends PanelState<PanelUploadDefaults>, PanelEventListeners {
|
|
@@ -1261,47 +1279,41 @@ export interface PanelUpload
|
|
|
1261
1279
|
multiple: boolean;
|
|
1262
1280
|
/** File preview data */
|
|
1263
1281
|
preview: Record<string, any>;
|
|
1264
|
-
/**
|
|
1265
|
-
replacing:
|
|
1282
|
+
/** Server file model being replaced (see `PanelUploadDefaults.replacing`) */
|
|
1283
|
+
replacing: any | null;
|
|
1266
1284
|
/** Upload endpoint URL */
|
|
1267
1285
|
url: string | null;
|
|
1268
1286
|
|
|
1269
1287
|
/** Hidden file input element */
|
|
1270
1288
|
input: HTMLInputElement | null;
|
|
1271
1289
|
|
|
1272
|
-
/**
|
|
1273
|
-
readonly completed:
|
|
1290
|
+
/** Server file models for files that completed uploading. */
|
|
1291
|
+
readonly completed: any[];
|
|
1274
1292
|
|
|
1275
|
-
/**
|
|
1276
|
-
* Shows success notification and emits model.update.
|
|
1277
|
-
*/
|
|
1293
|
+
/** Shows success notification and emits model.update. */
|
|
1278
1294
|
announce: () => void;
|
|
1279
1295
|
|
|
1280
|
-
/**
|
|
1281
|
-
* Cancels current upload and resets state.
|
|
1282
|
-
*/
|
|
1296
|
+
/** Emits `cancel`, aborts any ongoing upload, and if some files already finished emits `complete` and announces success before resetting state. */
|
|
1283
1297
|
cancel: () => Promise<void>;
|
|
1284
1298
|
|
|
1285
|
-
/**
|
|
1286
|
-
* Called when upload dialog submit clicked.
|
|
1287
|
-
*/
|
|
1299
|
+
/** Closes the upload dialog after all remaining files have uploaded; if any files completed, emits `complete` and `done`, announces success, and resets state. */
|
|
1288
1300
|
done: () => Promise<void>;
|
|
1289
1301
|
|
|
1290
1302
|
/**
|
|
1291
|
-
* Finds
|
|
1292
|
-
* Returns the index of the duplicate file, or false if not found.
|
|
1303
|
+
* 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
1304
|
*
|
|
1294
|
-
* @param file -
|
|
1295
|
-
* @returns Index of duplicate file or
|
|
1305
|
+
* @param file - Enriched upload file to check
|
|
1306
|
+
* @returns Index of the duplicate file, or `-1` if none
|
|
1296
1307
|
*/
|
|
1297
|
-
findDuplicate: (file:
|
|
1308
|
+
findDuplicate: (file: PanelUploadFile) => number;
|
|
1298
1309
|
|
|
1299
1310
|
/**
|
|
1300
1311
|
* Checks if file has a unique name.
|
|
1312
|
+
* Compares `file.name` and `file.extension` against the upload queue.
|
|
1301
1313
|
*
|
|
1302
|
-
* @param file -
|
|
1314
|
+
* @param file - Enriched upload file to check
|
|
1303
1315
|
*/
|
|
1304
|
-
hasUniqueName: (file:
|
|
1316
|
+
hasUniqueName: (file: PanelUploadFile) => boolean;
|
|
1305
1317
|
|
|
1306
1318
|
/**
|
|
1307
1319
|
* Converts File to enriched upload file object.
|
|
@@ -1337,34 +1349,30 @@ export interface PanelUpload
|
|
|
1337
1349
|
|
|
1338
1350
|
/**
|
|
1339
1351
|
* Opens picker to replace an existing file.
|
|
1352
|
+
* The `file` argument is a server file model (reads `file.link`,
|
|
1353
|
+
* `file.extension`, `file.mime`), not a queued `PanelUploadFile`.
|
|
1340
1354
|
*
|
|
1341
|
-
* @param file -
|
|
1355
|
+
* @param file - Server file model being replaced
|
|
1342
1356
|
* @param options - Upload options
|
|
1343
1357
|
*/
|
|
1344
|
-
replace: (
|
|
1345
|
-
file: PanelUploadFile,
|
|
1346
|
-
options?: Partial<PanelUploadDefaults>,
|
|
1347
|
-
) => void;
|
|
1358
|
+
replace: (file: any, options?: Partial<PanelUploadDefaults>) => void;
|
|
1348
1359
|
|
|
1349
1360
|
/**
|
|
1350
1361
|
* Adds files to upload list with deduplication.
|
|
1362
|
+
* Also accepts an `Event` whose `target.files` is unwrapped to a `FileList`.
|
|
1351
1363
|
*
|
|
1352
|
-
* @param files - Files to add
|
|
1364
|
+
* @param files - Files to add (or input change Event)
|
|
1353
1365
|
* @param options - Upload options
|
|
1354
1366
|
*/
|
|
1355
1367
|
select: (
|
|
1356
|
-
files: File[] | FileList,
|
|
1368
|
+
files: File[] | FileList | Event,
|
|
1357
1369
|
options?: Partial<PanelUploadDefaults>,
|
|
1358
1370
|
) => void;
|
|
1359
1371
|
|
|
1360
|
-
/**
|
|
1361
|
-
* Sets state and registers event listeners.
|
|
1362
|
-
*/
|
|
1372
|
+
/** Sets state and registers event listeners. */
|
|
1363
1373
|
set: (state: Partial<PanelUploadDefaults>) => PanelUploadDefaults;
|
|
1364
1374
|
|
|
1365
|
-
/**
|
|
1366
|
-
* Submits and uploads all remaining files.
|
|
1367
|
-
*/
|
|
1375
|
+
/** Submits and uploads all remaining files. */
|
|
1368
1376
|
submit: () => Promise<void>;
|
|
1369
1377
|
|
|
1370
1378
|
/**
|
|
@@ -1385,6 +1393,7 @@ export interface PanelUpload
|
|
|
1385
1393
|
|
|
1386
1394
|
/**
|
|
1387
1395
|
* Event emitter interface (mitt-compatible).
|
|
1396
|
+
* @source panel/src/panel/events.js
|
|
1388
1397
|
*/
|
|
1389
1398
|
export interface PanelEventEmitter {
|
|
1390
1399
|
emit: (event: string, ...args: any[]) => void;
|
|
@@ -1400,6 +1409,7 @@ export interface PanelEventEmitter {
|
|
|
1400
1409
|
*
|
|
1401
1410
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/events.js
|
|
1402
1411
|
* @since 4.0.0
|
|
1412
|
+
* @source panel/src/panel/events.js
|
|
1403
1413
|
*/
|
|
1404
1414
|
export interface PanelEvents extends PanelEventEmitter {
|
|
1405
1415
|
/** Element that was entered during drag */
|
|
@@ -1535,13 +1545,9 @@ export interface PanelEvents extends PanelEventEmitter {
|
|
|
1535
1545
|
*/
|
|
1536
1546
|
prevent: (event: Event) => void;
|
|
1537
1547
|
|
|
1538
|
-
/**
|
|
1539
|
-
* Subscribes all global event listeners.
|
|
1540
|
-
*/
|
|
1548
|
+
/** Subscribes all global event listeners. */
|
|
1541
1549
|
subscribe: () => void;
|
|
1542
1550
|
|
|
1543
|
-
/**
|
|
1544
|
-
* Unsubscribes all global event listeners.
|
|
1545
|
-
*/
|
|
1551
|
+
/** Unsubscribes all global event listeners. */
|
|
1546
1552
|
unsubscribe: () => void;
|
|
1547
1553
|
}
|