kirby-types 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -6
- package/src/panel/api.d.ts +30 -54
- package/src/panel/base.d.ts +14 -12
- package/src/panel/features.d.ts +39 -31
- package/src/panel/helpers.d.ts +42 -29
- package/src/panel/index.d.ts +119 -62
- package/src/panel/libraries.d.ts +146 -134
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirby-types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"packageManager": "pnpm@10.27.0",
|
|
6
6
|
"description": "TypeScript types for Kirby Panel plugins and headless CMS usage",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|
|
@@ -43,14 +43,18 @@
|
|
|
43
43
|
"test": "tsd -f \"test/**/*.test-d.ts\""
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"prosemirror-
|
|
48
|
-
"prosemirror-
|
|
49
|
-
"prosemirror-
|
|
50
|
-
"prosemirror-
|
|
46
|
+
"dayjs": "^1.0.0",
|
|
47
|
+
"prosemirror-commands": "^1.7.1",
|
|
48
|
+
"prosemirror-inputrules": "^1.5.1",
|
|
49
|
+
"prosemirror-model": "^1.25.4",
|
|
50
|
+
"prosemirror-schema-list": "^1.5.1",
|
|
51
|
+
"prosemirror-state": "^1.4.4",
|
|
51
52
|
"vue": "^2.7.0"
|
|
52
53
|
},
|
|
53
54
|
"peerDependenciesMeta": {
|
|
55
|
+
"dayjs": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
54
58
|
"prosemirror-commands": {
|
|
55
59
|
"optional": true
|
|
56
60
|
},
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
"devDependencies": {
|
|
74
78
|
"@antfu/eslint-config": "^6.7.3",
|
|
75
79
|
"bumpp": "^10.3.2",
|
|
80
|
+
"dayjs": "^1.11.13",
|
|
76
81
|
"eslint": "^9.39.2",
|
|
77
82
|
"prettier": "^3.7.4",
|
|
78
83
|
"tsd": "^0.33.0",
|
package/src/panel/api.d.ts
CHANGED
|
@@ -76,33 +76,28 @@ export interface PanelApiAuth {
|
|
|
76
76
|
/**
|
|
77
77
|
* Logs out the current user.
|
|
78
78
|
*/
|
|
79
|
-
logout: () => Promise<
|
|
79
|
+
logout: () => Promise<any>;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Pings the server to keep session alive.
|
|
83
83
|
*/
|
|
84
|
-
ping: () => Promise<
|
|
84
|
+
ping: () => Promise<any>;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Gets the current user.
|
|
88
88
|
*
|
|
89
89
|
* @param query - Query parameters
|
|
90
|
-
* @param options - Request options
|
|
91
90
|
* @returns User data
|
|
92
91
|
*/
|
|
93
|
-
user: (
|
|
94
|
-
query?: Record<string, any>,
|
|
95
|
-
options?: PanelApiRequestOptions,
|
|
96
|
-
) => Promise<any>;
|
|
92
|
+
user: (query?: Record<string, any>) => Promise<any>;
|
|
97
93
|
|
|
98
94
|
/**
|
|
99
95
|
* Verifies a 2FA code.
|
|
100
96
|
*
|
|
101
97
|
* @param code - Verification code
|
|
102
|
-
* @param data - Additional data
|
|
103
98
|
* @returns Verification result
|
|
104
99
|
*/
|
|
105
|
-
verifyCode: (code: string
|
|
100
|
+
verifyCode: (code: string) => Promise<any>;
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
// -----------------------------------------------------------------------------
|
|
@@ -135,7 +130,7 @@ export interface PanelApiFiles {
|
|
|
135
130
|
* @param parent - Parent page/site path
|
|
136
131
|
* @param filename - Filename to delete
|
|
137
132
|
*/
|
|
138
|
-
delete: (parent: string | null, filename: string) => Promise<
|
|
133
|
+
delete: (parent: string | null, filename: string) => Promise<any>;
|
|
139
134
|
|
|
140
135
|
/**
|
|
141
136
|
* Gets a file.
|
|
@@ -225,18 +220,17 @@ export interface PanelApiLanguages {
|
|
|
225
220
|
/**
|
|
226
221
|
* Creates a new language.
|
|
227
222
|
*
|
|
228
|
-
* @param
|
|
229
|
-
* @param data - Language data
|
|
223
|
+
* @param data - Language data (including code)
|
|
230
224
|
* @returns Created language
|
|
231
225
|
*/
|
|
232
|
-
create: (
|
|
226
|
+
create: (data: PanelApiLanguageData) => Promise<any>;
|
|
233
227
|
|
|
234
228
|
/**
|
|
235
229
|
* Deletes a language.
|
|
236
230
|
*
|
|
237
231
|
* @param code - Language code
|
|
238
232
|
*/
|
|
239
|
-
delete: (code: string) => Promise<
|
|
233
|
+
delete: (code: string) => Promise<any>;
|
|
240
234
|
|
|
241
235
|
/**
|
|
242
236
|
* Gets a language.
|
|
@@ -381,7 +375,7 @@ export interface PanelApiPages {
|
|
|
381
375
|
* @param id - Page ID
|
|
382
376
|
* @param data - Delete options
|
|
383
377
|
*/
|
|
384
|
-
delete: (id: string, data?: { force?: boolean }) => Promise<
|
|
378
|
+
delete: (id: string, data?: { force?: boolean }) => Promise<any>;
|
|
385
379
|
|
|
386
380
|
/**
|
|
387
381
|
* Duplicates a page.
|
|
@@ -488,11 +482,10 @@ export interface PanelApiRoles {
|
|
|
488
482
|
/**
|
|
489
483
|
* Lists available roles.
|
|
490
484
|
*
|
|
491
|
-
* @param
|
|
492
|
-
* @param query - Query parameters
|
|
485
|
+
* @param params - Query parameters
|
|
493
486
|
* @returns Array of roles
|
|
494
487
|
*/
|
|
495
|
-
list: (
|
|
488
|
+
list: (params?: Record<string, any>) => Promise<any[]>;
|
|
496
489
|
}
|
|
497
490
|
|
|
498
491
|
// -----------------------------------------------------------------------------
|
|
@@ -523,22 +516,17 @@ export interface PanelApiSite {
|
|
|
523
516
|
* Changes the site title.
|
|
524
517
|
*
|
|
525
518
|
* @param title - New title
|
|
526
|
-
* @param language - Language code
|
|
527
519
|
* @returns Updated site
|
|
528
520
|
*/
|
|
529
|
-
changeTitle: (title: string
|
|
521
|
+
changeTitle: (title: string) => Promise<any>;
|
|
530
522
|
|
|
531
523
|
/**
|
|
532
524
|
* Searches site children.
|
|
533
525
|
*
|
|
534
526
|
* @param query - Search query
|
|
535
|
-
* @param options - Query options
|
|
536
527
|
* @returns Search results
|
|
537
528
|
*/
|
|
538
|
-
children: (
|
|
539
|
-
query?: PanelApiSearchQuery,
|
|
540
|
-
options?: Record<string, any>,
|
|
541
|
-
) => Promise<any>;
|
|
529
|
+
children: (query?: PanelApiSearchQuery) => Promise<any>;
|
|
542
530
|
|
|
543
531
|
/**
|
|
544
532
|
* Gets the site.
|
|
@@ -552,10 +540,9 @@ export interface PanelApiSite {
|
|
|
552
540
|
* Updates the site content.
|
|
553
541
|
*
|
|
554
542
|
* @param data - Content data
|
|
555
|
-
* @param language - Language code
|
|
556
543
|
* @returns Updated site
|
|
557
544
|
*/
|
|
558
|
-
update: (data: Record<string, any
|
|
545
|
+
update: (data: Record<string, any>) => Promise<any>;
|
|
559
546
|
}
|
|
560
547
|
|
|
561
548
|
// -----------------------------------------------------------------------------
|
|
@@ -602,25 +589,17 @@ export interface PanelApiSystem {
|
|
|
602
589
|
* Installs Kirby with initial user.
|
|
603
590
|
*
|
|
604
591
|
* @param data - Installation data
|
|
605
|
-
* @param query - Query parameters
|
|
606
592
|
* @returns Installation result
|
|
607
593
|
*/
|
|
608
|
-
install: (
|
|
609
|
-
data: PanelApiSystemInstallData,
|
|
610
|
-
query?: Record<string, any>,
|
|
611
|
-
) => Promise<any>;
|
|
594
|
+
install: (data: PanelApiSystemInstallData) => Promise<any>;
|
|
612
595
|
|
|
613
596
|
/**
|
|
614
597
|
* Registers a license.
|
|
615
598
|
*
|
|
616
599
|
* @param data - Registration data
|
|
617
|
-
* @param query - Query parameters
|
|
618
600
|
* @returns Registration result
|
|
619
601
|
*/
|
|
620
|
-
register: (
|
|
621
|
-
data: PanelApiSystemRegisterData,
|
|
622
|
-
query?: Record<string, any>,
|
|
623
|
-
) => Promise<any>;
|
|
602
|
+
register: (data: PanelApiSystemRegisterData) => Promise<any>;
|
|
624
603
|
}
|
|
625
604
|
|
|
626
605
|
// -----------------------------------------------------------------------------
|
|
@@ -686,11 +665,11 @@ export interface PanelApiUsers {
|
|
|
686
665
|
/**
|
|
687
666
|
* Gets available blueprints for users.
|
|
688
667
|
*
|
|
689
|
-
* @param
|
|
690
|
-
* @param
|
|
668
|
+
* @param id - User ID for context
|
|
669
|
+
* @param section - Section name to filter by
|
|
691
670
|
* @returns Array of blueprints
|
|
692
671
|
*/
|
|
693
|
-
blueprints: (
|
|
672
|
+
blueprints: (id: string, section?: string) => Promise<any[]>;
|
|
694
673
|
|
|
695
674
|
/**
|
|
696
675
|
* Changes a user's email.
|
|
@@ -724,13 +703,13 @@ export interface PanelApiUsers {
|
|
|
724
703
|
*
|
|
725
704
|
* @param id - User ID
|
|
726
705
|
* @param password - New password
|
|
727
|
-
* @param
|
|
706
|
+
* @param currentPassword - Current password for verification
|
|
728
707
|
* @returns Updated user
|
|
729
708
|
*/
|
|
730
709
|
changePassword: (
|
|
731
710
|
id: string,
|
|
732
711
|
password: string,
|
|
733
|
-
|
|
712
|
+
currentPassword: string,
|
|
734
713
|
) => Promise<any>;
|
|
735
714
|
|
|
736
715
|
/**
|
|
@@ -745,25 +724,24 @@ export interface PanelApiUsers {
|
|
|
745
724
|
/**
|
|
746
725
|
* Creates a new user.
|
|
747
726
|
*
|
|
748
|
-
* @param
|
|
749
|
-
* @param data - User data
|
|
727
|
+
* @param data - User data (including email as identifier)
|
|
750
728
|
* @returns Created user
|
|
751
729
|
*/
|
|
752
|
-
create: (
|
|
730
|
+
create: (data: PanelApiUserCreateData) => Promise<any>;
|
|
753
731
|
|
|
754
732
|
/**
|
|
755
733
|
* Deletes a user.
|
|
756
734
|
*
|
|
757
735
|
* @param id - User ID
|
|
758
736
|
*/
|
|
759
|
-
delete: (id: string) => Promise<
|
|
737
|
+
delete: (id: string) => Promise<any>;
|
|
760
738
|
|
|
761
739
|
/**
|
|
762
740
|
* Deletes a user's avatar.
|
|
763
741
|
*
|
|
764
742
|
* @param id - User ID
|
|
765
743
|
*/
|
|
766
|
-
deleteAvatar: (id: string) => Promise<
|
|
744
|
+
deleteAvatar: (id: string) => Promise<any>;
|
|
767
745
|
|
|
768
746
|
/**
|
|
769
747
|
* Gets a user.
|
|
@@ -842,13 +820,13 @@ export interface PanelApiUsers {
|
|
|
842
820
|
* @example
|
|
843
821
|
* ```ts
|
|
844
822
|
* // Get a page
|
|
845
|
-
* const page = await panel.api.pages.get(
|
|
823
|
+
* const page = await panel.api.pages.get("home");
|
|
846
824
|
*
|
|
847
825
|
* // Create a new page
|
|
848
|
-
* await panel.api.pages.create(
|
|
849
|
-
* slug:
|
|
850
|
-
* title:
|
|
851
|
-
* template:
|
|
826
|
+
* await panel.api.pages.create("blog", {
|
|
827
|
+
* slug: "new-post",
|
|
828
|
+
* title: "New Post",
|
|
829
|
+
* template: "article"
|
|
852
830
|
* });
|
|
853
831
|
* ```
|
|
854
832
|
*
|
|
@@ -913,7 +891,6 @@ export interface PanelApi {
|
|
|
913
891
|
* @param data - Request body
|
|
914
892
|
* @param options - Request options
|
|
915
893
|
* @param silent - Skip loading indicator
|
|
916
|
-
* @param upload - Whether uploading file
|
|
917
894
|
* @returns Response data
|
|
918
895
|
*/
|
|
919
896
|
post: (
|
|
@@ -921,7 +898,6 @@ export interface PanelApi {
|
|
|
921
898
|
data?: any,
|
|
922
899
|
options?: PanelApiRequestOptions,
|
|
923
900
|
silent?: boolean,
|
|
924
|
-
upload?: boolean,
|
|
925
901
|
) => Promise<any>;
|
|
926
902
|
|
|
927
903
|
/**
|
package/src/panel/base.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* ```ts
|
|
26
26
|
* // State is used by: language, menu, notification, system, translation, user, drag, theme
|
|
27
27
|
* const notification: PanelState<PanelNotificationDefaults> = panel.notification;
|
|
28
|
-
* notification.set({ message:
|
|
28
|
+
* notification.set({ message: "Saved!" });
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
31
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/state.js
|
|
@@ -149,11 +149,11 @@ export type PanelEventListenerMap<TEvents extends string = string> = Partial<
|
|
|
149
149
|
*
|
|
150
150
|
* @example
|
|
151
151
|
* ```ts
|
|
152
|
-
* panel.dialog.addEventListener(
|
|
153
|
-
* console.log(
|
|
152
|
+
* panel.dialog.addEventListener("submit", (value) => {
|
|
153
|
+
* console.log("Dialog submitted:", value);
|
|
154
154
|
* });
|
|
155
155
|
*
|
|
156
|
-
* panel.dialog.emit(
|
|
156
|
+
* panel.dialog.emit("submit", formData);
|
|
157
157
|
* ```
|
|
158
158
|
*
|
|
159
159
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/listeners.js
|
|
@@ -241,10 +241,10 @@ export interface PanelFeatureDefaults {
|
|
|
241
241
|
* @example
|
|
242
242
|
* ```ts
|
|
243
243
|
* // Load a view
|
|
244
|
-
* await panel.view.load(
|
|
244
|
+
* await panel.view.load("/pages/home");
|
|
245
245
|
*
|
|
246
246
|
* // Open a dropdown with options
|
|
247
|
-
* await panel.dropdown.open(
|
|
247
|
+
* await panel.dropdown.open("/dropdowns/pages/home/options");
|
|
248
248
|
* ```
|
|
249
249
|
*
|
|
250
250
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/feature.js
|
|
@@ -359,8 +359,9 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
|
|
|
359
359
|
* Reloads the feature by re-opening its current URL.
|
|
360
360
|
*
|
|
361
361
|
* @param options - Request options
|
|
362
|
+
* @returns False if no path exists, otherwise void
|
|
362
363
|
*/
|
|
363
|
-
reload: (options?: PanelRequestOptions) => Promise<void>;
|
|
364
|
+
reload: (options?: PanelRequestOptions) => Promise<void | false>;
|
|
364
365
|
|
|
365
366
|
/**
|
|
366
367
|
* Creates a full URL object for the current path and query.
|
|
@@ -405,7 +406,7 @@ export interface PanelSuccessResponse {
|
|
|
405
406
|
message?: string;
|
|
406
407
|
/** Events to emit (string or array of strings) */
|
|
407
408
|
event?: string | string[];
|
|
408
|
-
/** Whether to emit the global
|
|
409
|
+
/** Whether to emit the global `"success"` event (default: true) */
|
|
409
410
|
emit?: boolean;
|
|
410
411
|
/** URL to navigate to */
|
|
411
412
|
route?: string | { url: string; options?: PanelRequestOptions };
|
|
@@ -431,14 +432,14 @@ export interface PanelSuccessResponse {
|
|
|
431
432
|
* @example
|
|
432
433
|
* ```ts
|
|
433
434
|
* // Open a dialog
|
|
434
|
-
* await panel.dialog.open(
|
|
435
|
+
* await panel.dialog.open("/dialogs/pages/create", {
|
|
435
436
|
* on: {
|
|
436
|
-
* submit: (value) => console.log(
|
|
437
|
+
* submit: (value) => console.log("Created:", value)
|
|
437
438
|
* }
|
|
438
439
|
* });
|
|
439
440
|
*
|
|
440
441
|
* // Close with history navigation
|
|
441
|
-
* panel.drawer.goTo(
|
|
442
|
+
* panel.drawer.goTo("previous-drawer-id");
|
|
442
443
|
* ```
|
|
443
444
|
*
|
|
444
445
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/modal.js
|
|
@@ -527,8 +528,9 @@ export interface PanelModal<
|
|
|
527
528
|
* Reloads the modal by closing and reopening at the same URL.
|
|
528
529
|
*
|
|
529
530
|
* @param options - Request options
|
|
531
|
+
* @returns False if no path exists, otherwise void
|
|
530
532
|
*/
|
|
531
|
-
reload: (options?: PanelRequestOptions) => Promise<void>;
|
|
533
|
+
reload: (options?: PanelRequestOptions) => Promise<void | false>;
|
|
532
534
|
|
|
533
535
|
/**
|
|
534
536
|
* Sets modal state, auto-generating an ID if not provided.
|
package/src/panel/features.d.ts
CHANGED
|
@@ -13,12 +13,12 @@ import type {
|
|
|
13
13
|
NotificationTheme,
|
|
14
14
|
NotificationType,
|
|
15
15
|
PanelEventCallback,
|
|
16
|
-
PanelEventListenerMap,
|
|
17
16
|
PanelEventListeners,
|
|
18
17
|
PanelFeature,
|
|
19
18
|
PanelFeatureDefaults,
|
|
20
19
|
PanelHistory,
|
|
21
20
|
PanelModal,
|
|
21
|
+
PanelModalListeners,
|
|
22
22
|
PanelRequestOptions,
|
|
23
23
|
PanelState,
|
|
24
24
|
} from "./base";
|
|
@@ -120,10 +120,10 @@ export interface PanelDrag extends PanelState<PanelDragDefaults> {
|
|
|
120
120
|
/**
|
|
121
121
|
* Starts a drag operation with type and data.
|
|
122
122
|
*
|
|
123
|
-
* @param type - Drag item type (e.g., `
|
|
124
|
-
* @param data - Associated data
|
|
123
|
+
* @param type - Drag item type (e.g., `"page"`, `"file"`)
|
|
124
|
+
* @param data - Associated data (string or object)
|
|
125
125
|
*/
|
|
126
|
-
start: (type: string, data: Record<string, any>) => void;
|
|
126
|
+
start: (type: string, data: string | Record<string, any>) => void;
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* Stops the current drag operation and resets state.
|
|
@@ -197,7 +197,7 @@ export interface PanelTheme extends Omit<
|
|
|
197
197
|
* Default state for content language.
|
|
198
198
|
*/
|
|
199
199
|
export interface PanelLanguageDefaults {
|
|
200
|
-
/** Language code (e.g., `
|
|
200
|
+
/** Language code (e.g., `"en"`, `"de"`) */
|
|
201
201
|
code: string | null;
|
|
202
202
|
/** Whether this is the default language */
|
|
203
203
|
default: boolean;
|
|
@@ -218,7 +218,7 @@ export interface PanelLanguageDefaults {
|
|
|
218
218
|
* @since 4.0.0
|
|
219
219
|
*/
|
|
220
220
|
export interface PanelLanguage extends PanelState<PanelLanguageDefaults> {
|
|
221
|
-
/** Language code (e.g., `
|
|
221
|
+
/** Language code (e.g., `"en"`, `"de"`) */
|
|
222
222
|
code: string | null;
|
|
223
223
|
/** Whether this is the default language */
|
|
224
224
|
default: boolean;
|
|
@@ -284,9 +284,10 @@ export interface PanelMenu extends Omit<PanelState<PanelMenuDefaults>, "set"> {
|
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
286
|
* Handles outside clicks to close mobile menu.
|
|
287
|
+
* Returns false if not mobile/open, void otherwise.
|
|
287
288
|
* @internal
|
|
288
289
|
*/
|
|
289
|
-
blur: (event: Event) => void;
|
|
290
|
+
blur: (event: Event) => false | void;
|
|
290
291
|
|
|
291
292
|
/**
|
|
292
293
|
* Collapses the sidebar menu.
|
|
@@ -296,9 +297,10 @@ export interface PanelMenu extends Omit<PanelState<PanelMenuDefaults>, "set"> {
|
|
|
296
297
|
|
|
297
298
|
/**
|
|
298
299
|
* Handles escape key to close mobile menu.
|
|
300
|
+
* Returns false if not mobile/open, void otherwise.
|
|
299
301
|
* @internal
|
|
300
302
|
*/
|
|
301
|
-
escape: () => void;
|
|
303
|
+
escape: () => false | void;
|
|
302
304
|
|
|
303
305
|
/**
|
|
304
306
|
* Expands the sidebar menu.
|
|
@@ -429,12 +431,14 @@ export interface PanelNotification extends PanelState<PanelNotificationDefaults>
|
|
|
429
431
|
/**
|
|
430
432
|
* Creates an error notification.
|
|
431
433
|
* Opens error dialog in view context.
|
|
434
|
+
* May redirect to logout for auth errors.
|
|
432
435
|
*
|
|
433
436
|
* @param error - Error object, string, or Error instance
|
|
437
|
+
* @returns Notification state, or void if redirected
|
|
434
438
|
*/
|
|
435
439
|
error: (
|
|
436
440
|
error: Error | string | PanelErrorObject,
|
|
437
|
-
) => PanelNotificationDefaults;
|
|
441
|
+
) => PanelNotificationDefaults | void;
|
|
438
442
|
|
|
439
443
|
/**
|
|
440
444
|
* Creates a fatal error notification.
|
|
@@ -523,7 +527,7 @@ export interface PanelSystem extends PanelState<PanelSystemDefaults> {
|
|
|
523
527
|
* Default state for interface translation.
|
|
524
528
|
*/
|
|
525
529
|
export interface PanelTranslationDefaults {
|
|
526
|
-
/** Translation code (e.g., `
|
|
530
|
+
/** Translation code (e.g., `"en"`, `"de"`) */
|
|
527
531
|
code: string;
|
|
528
532
|
/** Translation strings by key */
|
|
529
533
|
data: Record<string, string>;
|
|
@@ -545,7 +549,7 @@ export interface PanelTranslationDefaults {
|
|
|
545
549
|
* @since 4.0.0
|
|
546
550
|
*/
|
|
547
551
|
export interface PanelTranslation extends PanelState<PanelTranslationDefaults> {
|
|
548
|
-
/** Translation code (e.g., `
|
|
552
|
+
/** Translation code (e.g., `"en"`, `"de"`) */
|
|
549
553
|
code: string;
|
|
550
554
|
/** Translation strings by key */
|
|
551
555
|
data: Record<string, string>;
|
|
@@ -745,12 +749,13 @@ export interface PanelDropdown extends PanelFeature<PanelFeatureDefaults> {
|
|
|
745
749
|
|
|
746
750
|
/**
|
|
747
751
|
* Opens a dropdown asynchronously.
|
|
748
|
-
*
|
|
752
|
+
*
|
|
753
|
+
* @deprecated Since 4.0.0 - Use `open()` instead
|
|
749
754
|
*/
|
|
750
755
|
openAsync: (
|
|
751
756
|
dropdown: string | URL | Partial<PanelFeatureDefaults>,
|
|
752
757
|
options?: PanelRequestOptions | PanelEventCallback,
|
|
753
|
-
) => () => Promise<PanelFeatureDefaults>;
|
|
758
|
+
) => (ready?: () => void) => Promise<PanelFeatureDefaults>;
|
|
754
759
|
|
|
755
760
|
/**
|
|
756
761
|
* Returns dropdown options array from props.
|
|
@@ -812,13 +817,11 @@ export interface PanelDialog extends PanelModal<PanelDialogDefaults> {
|
|
|
812
817
|
|
|
813
818
|
/**
|
|
814
819
|
* Opens a legacy Vue component dialog.
|
|
815
|
-
*
|
|
820
|
+
*
|
|
821
|
+
* @param dialog - Vue component instance
|
|
822
|
+
* @deprecated Since 4.0.0 - Use `open()` with component object instead
|
|
816
823
|
*/
|
|
817
|
-
openComponent: (dialog:
|
|
818
|
-
component: string;
|
|
819
|
-
props?: Record<string, any>;
|
|
820
|
-
on?: PanelEventListenerMap;
|
|
821
|
-
}) => Promise<void>;
|
|
824
|
+
openComponent: (dialog: any) => Promise<PanelDialogDefaults>;
|
|
822
825
|
}
|
|
823
826
|
|
|
824
827
|
// -----------------------------------------------------------------------------
|
|
@@ -845,7 +848,7 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
|
845
848
|
/** Breadcrumb from history milestones */
|
|
846
849
|
readonly breadcrumb: PanelHistory["milestones"];
|
|
847
850
|
|
|
848
|
-
/** Drawer icon, defaults to
|
|
851
|
+
/** Drawer icon, defaults to `"box"` */
|
|
849
852
|
readonly icon: string;
|
|
850
853
|
|
|
851
854
|
/**
|
|
@@ -860,8 +863,14 @@ export interface PanelDrawer extends PanelModal<PanelDrawerDefaults> {
|
|
|
860
863
|
* Switches drawer tabs.
|
|
861
864
|
*
|
|
862
865
|
* @param tab - Tab name to switch to
|
|
866
|
+
* @returns False if no tabs exist, void otherwise
|
|
863
867
|
*/
|
|
864
|
-
tab: (tab: string) => void;
|
|
868
|
+
tab: (tab: string) => void | false;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Returns drawer event listeners for Vue component binding.
|
|
872
|
+
*/
|
|
873
|
+
listeners: () => PanelModalListeners;
|
|
865
874
|
}
|
|
866
875
|
|
|
867
876
|
// -----------------------------------------------------------------------------
|
|
@@ -1142,7 +1151,7 @@ export interface PanelSearcher {
|
|
|
1142
1151
|
/**
|
|
1143
1152
|
* Opens the search dialog.
|
|
1144
1153
|
*
|
|
1145
|
-
* @param type - Search type (e.g., `
|
|
1154
|
+
* @param type - Search type (e.g., `"pages"`, `"files"`, `"users"`)
|
|
1146
1155
|
*/
|
|
1147
1156
|
open: (type?: string) => void;
|
|
1148
1157
|
|
|
@@ -1183,7 +1192,7 @@ export interface PanelUploadFile {
|
|
|
1183
1192
|
filename: string;
|
|
1184
1193
|
/** File size in bytes */
|
|
1185
1194
|
size: number;
|
|
1186
|
-
/** Formatted file size (e.g., `
|
|
1195
|
+
/** Formatted file size (e.g., `"1.2 MB"`) */
|
|
1187
1196
|
niceSize: string;
|
|
1188
1197
|
/** MIME type */
|
|
1189
1198
|
type: string;
|
|
@@ -1203,8 +1212,8 @@ export interface PanelUploadFile {
|
|
|
1203
1212
|
* Default state for upload feature.
|
|
1204
1213
|
*/
|
|
1205
1214
|
export interface PanelUploadDefaults {
|
|
1206
|
-
/**
|
|
1207
|
-
abort:
|
|
1215
|
+
/** AbortController for current upload */
|
|
1216
|
+
abort: AbortController | null;
|
|
1208
1217
|
/** Accepted file types */
|
|
1209
1218
|
accept: string;
|
|
1210
1219
|
/** Additional file attributes */
|
|
@@ -1234,8 +1243,8 @@ export interface PanelUploadDefaults {
|
|
|
1234
1243
|
*/
|
|
1235
1244
|
export interface PanelUpload
|
|
1236
1245
|
extends PanelState<PanelUploadDefaults>, PanelEventListeners {
|
|
1237
|
-
/**
|
|
1238
|
-
abort:
|
|
1246
|
+
/** AbortController for current upload */
|
|
1247
|
+
abort: AbortController | null;
|
|
1239
1248
|
/** Accepted file types */
|
|
1240
1249
|
accept: string;
|
|
1241
1250
|
/** Additional file attributes */
|
|
@@ -1276,10 +1285,12 @@ export interface PanelUpload
|
|
|
1276
1285
|
|
|
1277
1286
|
/**
|
|
1278
1287
|
* Finds duplicate file by comparing properties.
|
|
1288
|
+
* Returns the index of the duplicate file, or false if not found.
|
|
1279
1289
|
*
|
|
1280
1290
|
* @param file - File to check
|
|
1291
|
+
* @returns Index of duplicate file or false
|
|
1281
1292
|
*/
|
|
1282
|
-
findDuplicate: (file: File) =>
|
|
1293
|
+
findDuplicate: (file: File) => number | false;
|
|
1283
1294
|
|
|
1284
1295
|
/**
|
|
1285
1296
|
* Checks if file has a unique name.
|
|
@@ -1392,9 +1403,6 @@ export interface PanelEventEmitter {
|
|
|
1392
1403
|
* @since 4.0.0
|
|
1393
1404
|
*/
|
|
1394
1405
|
export interface PanelEvents extends PanelEventEmitter {
|
|
1395
|
-
/** Internal mitt emitter instance */
|
|
1396
|
-
emitter: PanelEventEmitter;
|
|
1397
|
-
|
|
1398
1406
|
/** Element that was entered during drag */
|
|
1399
1407
|
entered: Element | null;
|
|
1400
1408
|
|