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.
- 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 +139 -114
- package/src/panel/helpers.d.ts +90 -68
- package/src/panel/index.d.ts +131 -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/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kirby-types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "1.4.9",
|
|
5
|
+
"packageManager": "pnpm@10.33.2",
|
|
6
6
|
"description": "TypeScript types for Kirby Panel plugins and headless CMS usage",
|
|
7
7
|
"author": "Johann Schopplich <hello@johannschopplich.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@antfu/eslint-config": "^
|
|
83
|
-
"bumpp": "^
|
|
84
|
-
"dayjs": "^1.11.
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"prettier": "^3.
|
|
82
|
+
"@antfu/eslint-config": "^8.2.0",
|
|
83
|
+
"bumpp": "^11.0.1",
|
|
84
|
+
"dayjs": "^1.11.20",
|
|
85
|
+
"eslint": "^10.2.1",
|
|
86
|
+
"prettier": "^3.8.3",
|
|
87
87
|
"tsd": "^0.33.0",
|
|
88
|
-
"typescript": "^
|
|
88
|
+
"typescript": "^6.0.3"
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/panel/api.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type { PanelRequestOptions } from "./base";
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* API request options.
|
|
18
|
+
* @source panel/src/api/request.js
|
|
19
|
+
* @source panel/src/api/index.js
|
|
18
20
|
*/
|
|
19
21
|
export interface PanelApiRequestOptions extends PanelRequestOptions {
|
|
20
22
|
/** Whether to skip loading indicator */
|
|
@@ -23,6 +25,7 @@ export interface PanelApiRequestOptions extends PanelRequestOptions {
|
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Pagination query parameters.
|
|
28
|
+
* @source panel/src/api/index.js
|
|
26
29
|
*/
|
|
27
30
|
export interface PanelApiPagination {
|
|
28
31
|
/** Page number */
|
|
@@ -33,6 +36,7 @@ export interface PanelApiPagination {
|
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
38
|
* Search query parameters.
|
|
39
|
+
* @source panel/src/api/index.js
|
|
36
40
|
*/
|
|
37
41
|
export interface PanelApiSearchQuery extends PanelApiPagination {
|
|
38
42
|
/** Search query string */
|
|
@@ -64,6 +68,7 @@ export interface PanelApiSearchQuery extends PanelApiPagination {
|
|
|
64
68
|
* status: "draft" | "unlisted" | "listed";
|
|
65
69
|
* }
|
|
66
70
|
* ```
|
|
71
|
+
* @source panel/src/api/request.js
|
|
67
72
|
*/
|
|
68
73
|
export interface PanelModelData<TContent = Record<string, any>> {
|
|
69
74
|
/** Model identifier (page id, file id, user id; undefined for site) */
|
|
@@ -80,6 +85,7 @@ export interface PanelModelData<TContent = Record<string, any>> {
|
|
|
80
85
|
|
|
81
86
|
/**
|
|
82
87
|
* User authentication data.
|
|
88
|
+
* @source panel/src/api/auth.js
|
|
83
89
|
*/
|
|
84
90
|
export interface PanelApiLoginData {
|
|
85
91
|
/** User email */
|
|
@@ -94,6 +100,7 @@ export interface PanelApiLoginData {
|
|
|
94
100
|
* Authentication API methods.
|
|
95
101
|
*
|
|
96
102
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/auth.js
|
|
103
|
+
* @source panel/src/api/auth.js
|
|
97
104
|
*/
|
|
98
105
|
export interface PanelApiAuth {
|
|
99
106
|
/**
|
|
@@ -104,14 +111,10 @@ export interface PanelApiAuth {
|
|
|
104
111
|
*/
|
|
105
112
|
login: (data: PanelApiLoginData) => Promise<any>;
|
|
106
113
|
|
|
107
|
-
/**
|
|
108
|
-
* Logs out the current user.
|
|
109
|
-
*/
|
|
114
|
+
/** Logs out the current user. */
|
|
110
115
|
logout: () => Promise<any>;
|
|
111
116
|
|
|
112
|
-
/**
|
|
113
|
-
* Pings the server to keep session alive.
|
|
114
|
-
*/
|
|
117
|
+
/** Pings the server to keep session alive. */
|
|
115
118
|
ping: () => Promise<any>;
|
|
116
119
|
|
|
117
120
|
/**
|
|
@@ -139,6 +142,7 @@ export interface PanelApiAuth {
|
|
|
139
142
|
* Files API methods.
|
|
140
143
|
*
|
|
141
144
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/files.js
|
|
145
|
+
* @source panel/src/api/files.js
|
|
142
146
|
*/
|
|
143
147
|
export interface PanelApiFiles {
|
|
144
148
|
/**
|
|
@@ -224,9 +228,7 @@ export interface PanelApiFiles {
|
|
|
224
228
|
// Languages API
|
|
225
229
|
// -----------------------------------------------------------------------------
|
|
226
230
|
|
|
227
|
-
/**
|
|
228
|
-
* Language data for create/update.
|
|
229
|
-
*/
|
|
231
|
+
/** Language data for create/update. */
|
|
230
232
|
export interface PanelApiLanguageData {
|
|
231
233
|
/** Language code */
|
|
232
234
|
code: string;
|
|
@@ -246,6 +248,7 @@ export interface PanelApiLanguageData {
|
|
|
246
248
|
* Languages API methods.
|
|
247
249
|
*
|
|
248
250
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/languages.js
|
|
251
|
+
* @source panel/src/api/languages.js
|
|
249
252
|
*/
|
|
250
253
|
export interface PanelApiLanguages {
|
|
251
254
|
/**
|
|
@@ -292,9 +295,7 @@ export interface PanelApiLanguages {
|
|
|
292
295
|
// Pages API
|
|
293
296
|
// -----------------------------------------------------------------------------
|
|
294
297
|
|
|
295
|
-
/**
|
|
296
|
-
* Page creation data.
|
|
297
|
-
*/
|
|
298
|
+
/** Page creation data. */
|
|
298
299
|
export interface PanelApiPageCreateData {
|
|
299
300
|
/** Page slug */
|
|
300
301
|
slug: string;
|
|
@@ -308,9 +309,7 @@ export interface PanelApiPageCreateData {
|
|
|
308
309
|
status?: "draft" | "unlisted" | "listed";
|
|
309
310
|
}
|
|
310
311
|
|
|
311
|
-
/**
|
|
312
|
-
* Page duplicate options.
|
|
313
|
-
*/
|
|
312
|
+
/** Page duplicate options. */
|
|
314
313
|
export interface PanelApiPageDuplicateOptions {
|
|
315
314
|
/** Copy children pages */
|
|
316
315
|
children?: boolean;
|
|
@@ -322,6 +321,7 @@ export interface PanelApiPageDuplicateOptions {
|
|
|
322
321
|
* Pages API methods.
|
|
323
322
|
*
|
|
324
323
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/pages.js
|
|
324
|
+
* @source panel/src/api/pages.js
|
|
325
325
|
*/
|
|
326
326
|
export interface PanelApiPages {
|
|
327
327
|
/**
|
|
@@ -405,6 +405,7 @@ export interface PanelApiPages {
|
|
|
405
405
|
*
|
|
406
406
|
* @param id - Page ID
|
|
407
407
|
* @param data - Delete options
|
|
408
|
+
* @param data.force - Force delete even if the page has children or drafts
|
|
408
409
|
*/
|
|
409
410
|
delete: (id: string, data?: { force?: boolean }) => Promise<any>;
|
|
410
411
|
|
|
@@ -419,7 +420,7 @@ export interface PanelApiPages {
|
|
|
419
420
|
duplicate: (
|
|
420
421
|
id: string,
|
|
421
422
|
slug: string,
|
|
422
|
-
options
|
|
423
|
+
options: PanelApiPageDuplicateOptions,
|
|
423
424
|
) => Promise<any>;
|
|
424
425
|
|
|
425
426
|
/**
|
|
@@ -460,12 +461,12 @@ export interface PanelApiPages {
|
|
|
460
461
|
* Gets a page's preview URL.
|
|
461
462
|
*
|
|
462
463
|
* @param id - Page ID
|
|
463
|
-
* @returns Preview URL
|
|
464
|
+
* @returns Preview URL, or `null` when preview is disabled for the page
|
|
464
465
|
*/
|
|
465
|
-
preview: (id: string) => Promise<string>;
|
|
466
|
+
preview: (id: string) => Promise<string | null>;
|
|
466
467
|
|
|
467
468
|
/**
|
|
468
|
-
* Searches
|
|
469
|
+
* Searches direct children of a parent page (or the site root).
|
|
469
470
|
*
|
|
470
471
|
* @param parent - Parent page ID (null for root)
|
|
471
472
|
* @param query - Search query
|
|
@@ -500,6 +501,7 @@ export interface PanelApiPages {
|
|
|
500
501
|
* Roles API methods.
|
|
501
502
|
*
|
|
502
503
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/roles.js
|
|
504
|
+
* @source panel/src/api/roles.js
|
|
503
505
|
*/
|
|
504
506
|
export interface PanelApiRoles {
|
|
505
507
|
/**
|
|
@@ -527,6 +529,7 @@ export interface PanelApiRoles {
|
|
|
527
529
|
* Site API methods.
|
|
528
530
|
*
|
|
529
531
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/site.js
|
|
532
|
+
* @source panel/src/api/site.js
|
|
530
533
|
*/
|
|
531
534
|
export interface PanelApiSite {
|
|
532
535
|
/**
|
|
@@ -580,9 +583,7 @@ export interface PanelApiSite {
|
|
|
580
583
|
// System API
|
|
581
584
|
// -----------------------------------------------------------------------------
|
|
582
585
|
|
|
583
|
-
/**
|
|
584
|
-
* System installation data.
|
|
585
|
-
*/
|
|
586
|
+
/** System installation data. */
|
|
586
587
|
export interface PanelApiSystemInstallData {
|
|
587
588
|
/** Admin email */
|
|
588
589
|
email: string;
|
|
@@ -592,9 +593,7 @@ export interface PanelApiSystemInstallData {
|
|
|
592
593
|
language?: string;
|
|
593
594
|
}
|
|
594
595
|
|
|
595
|
-
/**
|
|
596
|
-
* License registration data.
|
|
597
|
-
*/
|
|
596
|
+
/** License registration data. */
|
|
598
597
|
export interface PanelApiSystemRegisterData {
|
|
599
598
|
/** License key */
|
|
600
599
|
license: string;
|
|
@@ -606,6 +605,7 @@ export interface PanelApiSystemRegisterData {
|
|
|
606
605
|
* System API methods.
|
|
607
606
|
*
|
|
608
607
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/system.js
|
|
608
|
+
* @source panel/src/api/system.js
|
|
609
609
|
*/
|
|
610
610
|
export interface PanelApiSystem {
|
|
611
611
|
/**
|
|
@@ -620,7 +620,7 @@ export interface PanelApiSystem {
|
|
|
620
620
|
* Installs Kirby with initial user.
|
|
621
621
|
*
|
|
622
622
|
* @param data - Installation data
|
|
623
|
-
* @returns
|
|
623
|
+
* @returns The newly created admin user
|
|
624
624
|
*/
|
|
625
625
|
install: (data: PanelApiSystemInstallData) => Promise<any>;
|
|
626
626
|
|
|
@@ -641,6 +641,7 @@ export interface PanelApiSystem {
|
|
|
641
641
|
* Translations API methods.
|
|
642
642
|
*
|
|
643
643
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/translations.js
|
|
644
|
+
* @source panel/src/api/translations.js
|
|
644
645
|
*/
|
|
645
646
|
export interface PanelApiTranslations {
|
|
646
647
|
/**
|
|
@@ -663,9 +664,7 @@ export interface PanelApiTranslations {
|
|
|
663
664
|
// Users API
|
|
664
665
|
// -----------------------------------------------------------------------------
|
|
665
666
|
|
|
666
|
-
/**
|
|
667
|
-
* User creation data.
|
|
668
|
-
*/
|
|
667
|
+
/** User creation data. */
|
|
669
668
|
export interface PanelApiUserCreateData {
|
|
670
669
|
/** User email */
|
|
671
670
|
email: string;
|
|
@@ -683,6 +682,7 @@ export interface PanelApiUserCreateData {
|
|
|
683
682
|
* Users API methods.
|
|
684
683
|
*
|
|
685
684
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/users.js
|
|
685
|
+
* @source panel/src/api/users.js
|
|
686
686
|
*/
|
|
687
687
|
export interface PanelApiUsers {
|
|
688
688
|
/**
|
|
@@ -755,7 +755,7 @@ export interface PanelApiUsers {
|
|
|
755
755
|
/**
|
|
756
756
|
* Creates a new user.
|
|
757
757
|
*
|
|
758
|
-
* @param data - User data (
|
|
758
|
+
* @param data - User data (email is required; id is generated by Kirby)
|
|
759
759
|
* @returns Created user
|
|
760
760
|
*/
|
|
761
761
|
create: (data: PanelApiUserCreateData) => Promise<any>;
|
|
@@ -793,7 +793,7 @@ export interface PanelApiUsers {
|
|
|
793
793
|
link: (id: string, path?: string) => string;
|
|
794
794
|
|
|
795
795
|
/**
|
|
796
|
-
*
|
|
796
|
+
* Queries users via the users/search endpoint.
|
|
797
797
|
*
|
|
798
798
|
* @param query - Query parameters
|
|
799
799
|
* @returns Array of users
|
|
@@ -812,13 +812,9 @@ export interface PanelApiUsers {
|
|
|
812
812
|
* Searches users.
|
|
813
813
|
*
|
|
814
814
|
* @param query - Search query
|
|
815
|
-
* @param options - Query options
|
|
816
815
|
* @returns Search results
|
|
817
816
|
*/
|
|
818
|
-
search: (
|
|
819
|
-
query?: PanelApiSearchQuery,
|
|
820
|
-
options?: Record<string, any>,
|
|
821
|
-
) => Promise<any>;
|
|
817
|
+
search: (query?: PanelApiSearchQuery) => Promise<any>;
|
|
822
818
|
|
|
823
819
|
/**
|
|
824
820
|
* Updates a user's content.
|
|
@@ -862,6 +858,12 @@ export interface PanelApiUsers {
|
|
|
862
858
|
* ```
|
|
863
859
|
*
|
|
864
860
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/api/index.js
|
|
861
|
+
* @source panel/src/api/index.js
|
|
862
|
+
* @source panel/src/api/request.js
|
|
863
|
+
* @source panel/src/api/get.js
|
|
864
|
+
* @source panel/src/api/post.js
|
|
865
|
+
* @source panel/src/api/patch.js
|
|
866
|
+
* @source panel/src/api/delete.js
|
|
865
867
|
*/
|
|
866
868
|
export interface PanelApi {
|
|
867
869
|
/** CSRF token for requests */
|
|
@@ -882,8 +884,8 @@ export interface PanelApi {
|
|
|
882
884
|
/** Number of running requests */
|
|
883
885
|
running: number;
|
|
884
886
|
|
|
885
|
-
/** Current language code */
|
|
886
|
-
language: string;
|
|
887
|
+
/** Current language code (lazily set on first request, or `undefined` before any request has run) */
|
|
888
|
+
language: string | undefined;
|
|
887
889
|
|
|
888
890
|
/**
|
|
889
891
|
* Makes a raw API request.
|
|
@@ -921,6 +923,7 @@ export interface PanelApi {
|
|
|
921
923
|
* @param path - API path
|
|
922
924
|
* @param data - Request body
|
|
923
925
|
* @param options - Request options
|
|
926
|
+
* @param method - HTTP method to send (defaults to `POST`; `patch` and `delete` delegate here to set `PATCH`/`DELETE`)
|
|
924
927
|
* @param silent - Skip loading indicator
|
|
925
928
|
* @returns Response data
|
|
926
929
|
*/
|
|
@@ -928,6 +931,7 @@ export interface PanelApi {
|
|
|
928
931
|
path: string,
|
|
929
932
|
data?: any,
|
|
930
933
|
options?: PanelApiRequestOptions,
|
|
934
|
+
method?: string,
|
|
931
935
|
silent?: boolean,
|
|
932
936
|
) => Promise<T>;
|
|
933
937
|
|
package/src/panel/base.d.ts
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
31
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/state.js
|
|
32
|
+
* @source panel/src/panel/state.js
|
|
32
33
|
*/
|
|
33
34
|
export interface PanelState<TDefaults extends object = Record<string, any>> {
|
|
34
35
|
/**
|
|
@@ -76,9 +77,8 @@ export interface PanelState<TDefaults extends object = Record<string, any>> {
|
|
|
76
77
|
// -----------------------------------------------------------------------------
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* Base interface providing common state methods.
|
|
80
|
-
* Used as an intermediate type for features that extend State.
|
|
81
80
|
* @internal
|
|
81
|
+
* @source panel/src/panel/state.js
|
|
82
82
|
*/
|
|
83
83
|
export interface PanelStateBase {
|
|
84
84
|
key: () => string;
|
|
@@ -90,8 +90,8 @@ export interface PanelStateBase {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Base interface for Features extending State with event listeners.
|
|
94
93
|
* @internal
|
|
94
|
+
* @source panel/src/panel/feature.js
|
|
95
95
|
*/
|
|
96
96
|
export interface PanelFeatureBase extends PanelStateBase, PanelEventListeners {
|
|
97
97
|
abortController: AbortController | null;
|
|
@@ -105,8 +105,8 @@ export interface PanelFeatureBase extends PanelStateBase, PanelEventListeners {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
* Base interface for Modals extending Feature.
|
|
109
108
|
* @internal
|
|
109
|
+
* @source panel/src/panel/modal.js
|
|
110
110
|
*/
|
|
111
111
|
export interface PanelModalBase extends PanelFeatureBase {
|
|
112
112
|
id: string | null;
|
|
@@ -115,8 +115,8 @@ export interface PanelModalBase extends PanelFeatureBase {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Base interface for History implementations.
|
|
119
118
|
* @internal
|
|
119
|
+
* @source panel/src/panel/history.js
|
|
120
120
|
*/
|
|
121
121
|
export interface PanelHistoryBase {
|
|
122
122
|
milestones: PanelHistoryMilestone[];
|
|
@@ -127,12 +127,13 @@ export interface PanelHistoryBase {
|
|
|
127
127
|
// -----------------------------------------------------------------------------
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* @source panel/src/panel/listeners.js
|
|
131
131
|
*/
|
|
132
132
|
export type PanelEventCallback<TReturn = any> = (...args: any[]) => TReturn;
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* Map of event names to their callback functions.
|
|
136
|
+
* @source panel/src/panel/listeners.js
|
|
136
137
|
*/
|
|
137
138
|
export type PanelEventListenerMap<TEvents extends string = string> = Partial<
|
|
138
139
|
Record<TEvents, PanelEventCallback>
|
|
@@ -157,12 +158,9 @@ export type PanelEventListenerMap<TEvents extends string = string> = Partial<
|
|
|
157
158
|
* ```
|
|
158
159
|
*
|
|
159
160
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/listeners.js
|
|
161
|
+
* @source panel/src/panel/listeners.js
|
|
160
162
|
*/
|
|
161
163
|
export interface PanelEventListeners<TEvents extends string = string> {
|
|
162
|
-
/**
|
|
163
|
-
* Map of registered event listeners.
|
|
164
|
-
* Keys are event names, values are callback functions.
|
|
165
|
-
*/
|
|
166
164
|
on: PanelEventListenerMap<TEvents>;
|
|
167
165
|
|
|
168
166
|
/**
|
|
@@ -202,9 +200,7 @@ export interface PanelEventListeners<TEvents extends string = string> {
|
|
|
202
200
|
*/
|
|
203
201
|
hasEventListener: (event: TEvents) => boolean;
|
|
204
202
|
|
|
205
|
-
/**
|
|
206
|
-
* Returns all registered listeners.
|
|
207
|
-
*/
|
|
203
|
+
/** Returns all registered listeners. */
|
|
208
204
|
listeners: () => PanelEventListenerMap<TEvents>;
|
|
209
205
|
}
|
|
210
206
|
|
|
@@ -213,7 +209,7 @@ export interface PanelEventListeners<TEvents extends string = string> {
|
|
|
213
209
|
// -----------------------------------------------------------------------------
|
|
214
210
|
|
|
215
211
|
/**
|
|
216
|
-
*
|
|
212
|
+
* @source panel/src/panel/feature.js
|
|
217
213
|
*/
|
|
218
214
|
export interface PanelFeatureDefaults {
|
|
219
215
|
abortController: AbortController | null;
|
|
@@ -234,7 +230,7 @@ export interface PanelFeatureDefaults {
|
|
|
234
230
|
* loading states, API requests, and event handling. They extend
|
|
235
231
|
* State with HTTP request methods and the event listener mixin.
|
|
236
232
|
*
|
|
237
|
-
* Features include: view, dropdown
|
|
233
|
+
* Features include: view, dropdown.
|
|
238
234
|
*
|
|
239
235
|
* @typeParam TDefaults - Shape of the feature's default state
|
|
240
236
|
*
|
|
@@ -248,6 +244,7 @@ export interface PanelFeatureDefaults {
|
|
|
248
244
|
* ```
|
|
249
245
|
*
|
|
250
246
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/feature.js
|
|
247
|
+
* @source panel/src/panel/feature.js
|
|
251
248
|
*/
|
|
252
249
|
export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
|
|
253
250
|
extends PanelState<TDefaults>, PanelEventListeners {
|
|
@@ -281,19 +278,13 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
|
|
|
281
278
|
*/
|
|
282
279
|
props: Record<string, any>;
|
|
283
280
|
|
|
284
|
-
/**
|
|
285
|
-
* URL query parameters from the latest request.
|
|
286
|
-
*/
|
|
281
|
+
/** URL query parameters from the latest request. */
|
|
287
282
|
query: Record<string, any>;
|
|
288
283
|
|
|
289
|
-
/**
|
|
290
|
-
* Previous path for navigation and redirects.
|
|
291
|
-
*/
|
|
284
|
+
/** Previous path for navigation and redirects. */
|
|
292
285
|
referrer: string | null;
|
|
293
286
|
|
|
294
|
-
/**
|
|
295
|
-
* Timestamp from the backend for cache invalidation.
|
|
296
|
-
*/
|
|
287
|
+
/** Timestamp from the backend for cache invalidation. */
|
|
297
288
|
timestamp: number | null;
|
|
298
289
|
|
|
299
290
|
/**
|
|
@@ -363,9 +354,7 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
|
|
|
363
354
|
*/
|
|
364
355
|
reload: (options?: PanelRequestOptions) => Promise<void | false>;
|
|
365
356
|
|
|
366
|
-
/**
|
|
367
|
-
* Creates a full URL object for the current path and query.
|
|
368
|
-
*/
|
|
357
|
+
/** Creates a full URL object for the current path and query. */
|
|
369
358
|
url: () => URL;
|
|
370
359
|
}
|
|
371
360
|
|
|
@@ -375,6 +364,7 @@ export interface PanelFeature<TDefaults extends object = PanelFeatureDefaults>
|
|
|
375
364
|
|
|
376
365
|
/**
|
|
377
366
|
* Modal event types for dialogs and drawers.
|
|
367
|
+
* @source panel/src/panel/modal.js
|
|
378
368
|
*/
|
|
379
369
|
export type PanelModalEvent =
|
|
380
370
|
| "cancel"
|
|
@@ -387,6 +377,7 @@ export type PanelModalEvent =
|
|
|
387
377
|
|
|
388
378
|
/**
|
|
389
379
|
* Bound listener functions returned by `modal.listeners()`.
|
|
380
|
+
* @source panel/src/panel/modal.js
|
|
390
381
|
*/
|
|
391
382
|
export interface PanelModalListeners {
|
|
392
383
|
cancel: () => Promise<void>;
|
|
@@ -394,15 +385,14 @@ export interface PanelModalListeners {
|
|
|
394
385
|
input: (value: any) => void;
|
|
395
386
|
submit: (value?: any, options?: PanelRequestOptions) => Promise<any>;
|
|
396
387
|
success: (response: PanelSuccessResponse) => void;
|
|
397
|
-
/** Additional custom event listeners */
|
|
398
388
|
[key: string]: ((...args: any[]) => any) | undefined;
|
|
399
389
|
}
|
|
400
390
|
|
|
401
391
|
/**
|
|
402
392
|
* Success response from modal submission.
|
|
393
|
+
* @source panel/src/panel/modal.js
|
|
403
394
|
*/
|
|
404
395
|
export interface PanelSuccessResponse {
|
|
405
|
-
/** Success message to display */
|
|
406
396
|
message?: string;
|
|
407
397
|
/** Events to emit (string or array of strings) */
|
|
408
398
|
event?: string | string[];
|
|
@@ -443,6 +433,7 @@ export interface PanelSuccessResponse {
|
|
|
443
433
|
* ```
|
|
444
434
|
*
|
|
445
435
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/modal.js
|
|
436
|
+
* @source panel/src/panel/modal.js
|
|
446
437
|
*/
|
|
447
438
|
export interface PanelModal<
|
|
448
439
|
TDefaults extends object = PanelFeatureDefaults & { id: string | null },
|
|
@@ -453,9 +444,6 @@ export interface PanelModal<
|
|
|
453
444
|
*/
|
|
454
445
|
id: string | null;
|
|
455
446
|
|
|
456
|
-
/**
|
|
457
|
-
* Whether the modal is currently visible.
|
|
458
|
-
*/
|
|
459
447
|
isOpen: boolean;
|
|
460
448
|
|
|
461
449
|
/**
|
|
@@ -470,9 +458,7 @@ export interface PanelModal<
|
|
|
470
458
|
*/
|
|
471
459
|
readonly value: any;
|
|
472
460
|
|
|
473
|
-
/**
|
|
474
|
-
* Cancels the modal by emitting 'cancel' and closing.
|
|
475
|
-
*/
|
|
461
|
+
/** Cancels the modal by emitting 'cancel' and closing. */
|
|
476
462
|
cancel: () => Promise<void>;
|
|
477
463
|
|
|
478
464
|
/**
|
|
@@ -513,7 +499,7 @@ export interface PanelModal<
|
|
|
513
499
|
|
|
514
500
|
/**
|
|
515
501
|
* Opens the modal by URL or state object.
|
|
516
|
-
* Closes
|
|
502
|
+
* Closes the current notification on first open and blocks document overflow.
|
|
517
503
|
*
|
|
518
504
|
* @param modal - URL or state object
|
|
519
505
|
* @param options - Request options
|
|
@@ -591,9 +577,9 @@ export interface PanelModal<
|
|
|
591
577
|
|
|
592
578
|
/**
|
|
593
579
|
* A history milestone representing a saved modal state.
|
|
580
|
+
* @source panel/src/panel/history.js
|
|
594
581
|
*/
|
|
595
582
|
export interface PanelHistoryMilestone {
|
|
596
|
-
/** Unique identifier for this milestone */
|
|
597
583
|
id: string;
|
|
598
584
|
/** Additional state properties */
|
|
599
585
|
[key: string]: any;
|
|
@@ -616,11 +602,9 @@ export interface PanelHistoryMilestone {
|
|
|
616
602
|
* ```
|
|
617
603
|
*
|
|
618
604
|
* @see https://github.com/getkirby/kirby/blob/main/panel/src/panel/history.js
|
|
605
|
+
* @source panel/src/panel/history.js
|
|
619
606
|
*/
|
|
620
607
|
export interface PanelHistory {
|
|
621
|
-
/**
|
|
622
|
-
* Array of stored state milestones.
|
|
623
|
-
*/
|
|
624
608
|
milestones: PanelHistoryMilestone[];
|
|
625
609
|
|
|
626
610
|
/**
|
|
@@ -642,9 +626,7 @@ export interface PanelHistory {
|
|
|
642
626
|
*/
|
|
643
627
|
at: (index: number) => PanelHistoryMilestone | undefined;
|
|
644
628
|
|
|
645
|
-
/**
|
|
646
|
-
* Clears all milestones from history.
|
|
647
|
-
*/
|
|
629
|
+
/** Clears all milestones from history. */
|
|
648
630
|
clear: () => void;
|
|
649
631
|
|
|
650
632
|
/**
|
|
@@ -680,14 +662,10 @@ export interface PanelHistory {
|
|
|
680
662
|
*/
|
|
681
663
|
index: (id: string) => number;
|
|
682
664
|
|
|
683
|
-
/**
|
|
684
|
-
* Checks if history has no milestones.
|
|
685
|
-
*/
|
|
665
|
+
/** Checks if history has no milestones. */
|
|
686
666
|
isEmpty: () => boolean;
|
|
687
667
|
|
|
688
|
-
/**
|
|
689
|
-
* Gets the last milestone in history.
|
|
690
|
-
*/
|
|
668
|
+
/** Gets the last milestone in history. */
|
|
691
669
|
last: () => PanelHistoryMilestone | undefined;
|
|
692
670
|
|
|
693
671
|
/**
|
|
@@ -721,29 +699,35 @@ export interface PanelHistory {
|
|
|
721
699
|
|
|
722
700
|
/**
|
|
723
701
|
* Options for Panel API requests.
|
|
702
|
+
* @source panel/src/panel/request.js
|
|
703
|
+
* @source panel/src/panel/feature.js
|
|
724
704
|
*/
|
|
725
705
|
export interface PanelRequestOptions {
|
|
726
|
-
/** Request headers */
|
|
727
706
|
headers?: Record<string, string>;
|
|
728
707
|
/** Request body for POST/PATCH */
|
|
729
708
|
body?: any;
|
|
730
|
-
/** Query parameters */
|
|
731
709
|
query?: Record<string, string | number | boolean>;
|
|
732
|
-
/** AbortSignal for request cancellation */
|
|
733
710
|
signal?: AbortSignal;
|
|
734
711
|
/**
|
|
735
712
|
* If true, skips setting `isLoading` state.
|
|
736
713
|
* Useful for background requests.
|
|
737
714
|
*/
|
|
738
715
|
silent?: boolean;
|
|
716
|
+
on?: PanelEventListenerMap;
|
|
717
|
+
/** CSRF token sent as the `x-csrf` header. */
|
|
718
|
+
csrf?: string | false;
|
|
739
719
|
/**
|
|
740
|
-
*
|
|
720
|
+
* Fiber globals sent as the `x-fiber-globals` header.
|
|
721
|
+
* Arrays are joined with commas; strings are forwarded as-is.
|
|
741
722
|
*/
|
|
742
|
-
|
|
723
|
+
globals?: string | string[];
|
|
724
|
+
/** Referrer path sent as the `x-fiber-referrer` header. */
|
|
725
|
+
referrer?: string | false;
|
|
743
726
|
}
|
|
744
727
|
|
|
745
728
|
/**
|
|
746
729
|
* Extended options for refresh requests.
|
|
730
|
+
* @source panel/src/panel/feature.js
|
|
747
731
|
*/
|
|
748
732
|
export interface PanelRefreshOptions extends PanelRequestOptions {
|
|
749
733
|
/** URL to refresh from (defaults to current URL) */
|
|
@@ -757,12 +741,14 @@ export interface PanelRefreshOptions extends PanelRequestOptions {
|
|
|
757
741
|
/**
|
|
758
742
|
* Panel context indicating which layer is currently active.
|
|
759
743
|
* Used to determine where notifications appear and which feature has focus.
|
|
744
|
+
* @source panel/src/panel/panel.js
|
|
760
745
|
*/
|
|
761
746
|
export type PanelContext = "view" | "dialog" | "drawer";
|
|
762
747
|
|
|
763
748
|
/**
|
|
764
749
|
* Context for notifications indicating where they should appear.
|
|
765
750
|
* Matches the active editing layer.
|
|
751
|
+
* @source panel/src/panel/notification.js
|
|
766
752
|
*/
|
|
767
753
|
export type NotificationContext = "view" | "dialog" | "drawer";
|
|
768
754
|
|
|
@@ -772,6 +758,7 @@ export type NotificationContext = "view" | "dialog" | "drawer";
|
|
|
772
758
|
* - `success`: Operation completed, auto-closes
|
|
773
759
|
* - `error`: Operation failed, persists until dismissed
|
|
774
760
|
* - `fatal`: Critical error, displayed in isolated iframe
|
|
761
|
+
* @source panel/src/panel/notification.js
|
|
775
762
|
*/
|
|
776
763
|
export type NotificationType = "error" | "success" | "fatal" | "info";
|
|
777
764
|
|
|
@@ -780,5 +767,6 @@ export type NotificationType = "error" | "success" | "fatal" | "info";
|
|
|
780
767
|
* - `positive`: Green, for success
|
|
781
768
|
* - `negative`: Red, for errors
|
|
782
769
|
* - `info`: Blue, for information
|
|
770
|
+
* @source panel/src/panel/notification.js
|
|
783
771
|
*/
|
|
784
772
|
export type NotificationTheme = "positive" | "negative" | "info";
|