kirby-types 1.2.0 → 1.3.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.
@@ -55,7 +55,7 @@ export interface PanelHelpersArray {
55
55
  * Sorts array by field and direction.
56
56
  *
57
57
  * @param array - Array to sort
58
- * @param sortBy - Sort specification (e.g., `'name asc'`, `'date desc'`)
58
+ * @param sortBy - Sort specification (e.g., `"name asc"`, `"date desc"`)
59
59
  * @returns Sorted array
60
60
  */
61
61
  sortBy: <T extends Record<string, any>>(array: T[], sortBy: string) => T[];
@@ -265,7 +265,7 @@ export interface PanelHelpersObject {
265
265
  ) => Partial<T>;
266
266
 
267
267
  /**
268
- * Checks if value is empty (null, undefined, '', empty object/array).
268
+ * Checks if value is empty (`null`, `undefined`, `""`, empty object/array).
269
269
  *
270
270
  * @param value - Value to check
271
271
  * @returns True if empty
@@ -743,7 +743,7 @@ export interface PanelHelpersPage {
743
743
  /**
744
744
  * Returns props for page status button.
745
745
  *
746
- * @param status - Page status ('draft', 'unlisted', 'listed')
746
+ * @param status - Page status (`"draft"`, `"unlisted"`, `"listed"`)
747
747
  * @param disabled - Whether to disable
748
748
  * @returns Button props
749
749
  */
@@ -6,11 +6,13 @@
6
6
  * This is the main entry point for all Panel type definitions.
7
7
  * Types are organized into modules for better maintainability:
8
8
  *
9
- * - `panel.base.ts` - State, Feature, Modal, History, Event Listeners
10
- * - `panel.features.ts` - View, Dialog, Drawer, Dropdown, Notification, etc.
11
- * - `panel.helpers.ts` - $helper.* utilities
12
- * - `panel.libraries.ts` - $library.* (colors, dayjs, autosize)
13
- * - `panel.api.ts` - API client methods
9
+ * - `base.d.ts` - State, Feature, Modal, History, Event Listeners
10
+ * - `features.d.ts` - View, Dialog, Drawer, Dropdown, Notification, etc.
11
+ * - `helpers.d.ts` - $helper.* utilities
12
+ * - `libraries.d.ts` - $library.* (colors, dayjs, autosize)
13
+ * - `api.d.ts` - API client methods
14
+ * - `writer.d.ts` - Writer (ProseMirror) editor and extensions
15
+ * - `textarea.d.ts` - Textarea toolbar buttons
14
16
  *
15
17
  * @see https://github.com/getkirby/kirby/tree/main/panel/src/panel
16
18
  * @since 4.0.0
@@ -26,56 +28,43 @@ import type {
26
28
  import type * as PanelFeatures from "./features";
27
29
  import type { PanelHelpers } from "./helpers";
28
30
  import type { PanelLibrary } from "./libraries";
31
+ import type { TextareaButton } from "./textarea";
32
+ import type { WriterMarkExtension, WriterNodeExtension } from "./writer";
29
33
 
30
34
  // =============================================================================
31
- // Re-exports from panel.api.ts
35
+ // Re-exports from api.d.ts
32
36
  // =============================================================================
33
37
 
34
38
  export type {
35
- // Request Types
36
- PanelApiRequestOptions,
37
- PanelApiPagination,
38
- PanelApiSearchQuery,
39
39
  // Auth
40
- PanelApiLoginData,
41
40
  PanelApiAuth,
42
41
  // Files
43
42
  PanelApiFiles,
44
43
  // Languages
45
- PanelApiLanguageData,
46
44
  PanelApiLanguages,
47
45
  // Pages
48
- PanelApiPageCreateData,
49
- PanelApiPageDuplicateOptions,
50
46
  PanelApiPages,
51
47
  // Roles
52
48
  PanelApiRoles,
53
49
  // Site
54
50
  PanelApiSite,
55
51
  // System
56
- PanelApiSystemInstallData,
57
- PanelApiSystemRegisterData,
58
52
  PanelApiSystem,
59
53
  // Translations
60
54
  PanelApiTranslations,
61
55
  // Users
62
- PanelApiUserCreateData,
63
56
  PanelApiUsers,
64
57
  // Main API Interface
65
58
  PanelApi,
66
59
  } from "./api";
67
60
 
68
61
  // =============================================================================
69
- // Re-exports from panel.base.ts
62
+ // Re-exports from base.d.ts
70
63
  // =============================================================================
71
64
 
72
65
  export type {
73
66
  // State Management
74
67
  PanelState,
75
- PanelStateBase,
76
- PanelFeatureBase,
77
- PanelModalBase,
78
- PanelHistoryBase,
79
68
  // Event Listeners
80
69
  PanelEventCallback,
81
70
  PanelEventListenerMap,
@@ -102,55 +91,43 @@ export type {
102
91
  } from "./base";
103
92
 
104
93
  // =============================================================================
105
- // Re-exports from panel.features.ts
94
+ // Re-exports from features.d.ts
106
95
  // =============================================================================
107
96
 
108
97
  export type {
109
98
  // Timer
110
99
  PanelTimer,
111
100
  // Activation
112
- PanelActivationDefaults,
113
101
  PanelActivation,
114
102
  // Drag
115
- PanelDragDefaults,
116
103
  PanelDrag,
117
104
  // Theme
118
- PanelThemeDefaults,
119
105
  PanelThemeValue,
120
106
  PanelTheme,
121
107
  // Language
122
- PanelLanguageDefaults,
123
108
  PanelLanguage,
124
109
  // Menu
125
110
  PanelMenuEntry,
126
- PanelMenuDefaults,
127
111
  PanelMenu,
128
112
  // Notification
129
- PanelNotificationDefaults,
130
113
  PanelNotificationOptions,
131
114
  PanelErrorObject,
132
115
  PanelNotification,
133
116
  // System
134
- PanelSystemDefaults,
135
117
  PanelSystem,
136
118
  // Translation
137
- PanelTranslationDefaults,
138
119
  PanelTranslation,
139
120
  // User
140
- PanelUserDefaults,
141
121
  PanelUser,
142
122
  // View
143
123
  PanelBreadcrumbItem,
144
- PanelViewDefaults,
145
124
  PanelView,
146
125
  // Dropdown
147
126
  PanelDropdownOption,
148
127
  PanelDropdown,
149
128
  // Dialog
150
- PanelDialogDefaults,
151
129
  PanelDialog,
152
130
  // Drawer
153
- PanelDrawerDefaults,
154
131
  PanelDrawer,
155
132
  // Content
156
133
  PanelContentVersion,
@@ -165,103 +142,61 @@ export type {
165
142
  PanelSearcher,
166
143
  // Upload
167
144
  PanelUploadFile,
168
- PanelUploadDefaults,
169
145
  PanelUpload,
170
146
  // Events
171
- PanelKeychain,
172
147
  PanelEventEmitter,
173
148
  PanelEvents,
174
149
  } from "./features";
175
150
 
176
151
  // =============================================================================
177
- // Re-exports from panel.helpers.ts
152
+ // Re-exports from helpers.d.ts
178
153
  // =============================================================================
179
154
 
180
155
  export type {
181
- // Array
182
- PanelArraySearchOptions,
183
- PanelHelpersArray,
184
- // String
185
- PanelSlugRules,
186
- PanelHelpersString,
187
- // Object
188
- PanelHelpersObject,
189
- // URL
190
- PanelHelpersUrl,
191
- // Clipboard
192
- PanelHelpersClipboard,
193
- // Embed
194
- PanelHelpersEmbed,
195
- // Field
196
- PanelFieldDefinition,
197
- PanelHelpersField,
198
- // File
199
- PanelHelpersFile,
200
- // Keyboard
201
- PanelHelpersKeyboard,
202
- // Link
203
- PanelLinkType,
204
- PanelLinkDetection,
205
- PanelLinkPreview,
206
- PanelHelpersLink,
207
- // Page
208
- PanelPageStatusProps,
209
- PanelHelpersPage,
210
- // Upload
211
- PanelUploadProgressCallback,
212
- PanelUploadCompleteCallback,
213
- PanelUploadParams,
214
- // Utility Types
215
- PanelDebounceOptions,
216
- PanelThrottleOptions,
217
- PanelDebouncedFunction,
218
- PanelThrottledFunction,
219
- PanelSortOptions,
220
- PanelComparator,
221
156
  // Main Helpers Interface
222
157
  PanelHelpers,
223
158
  } from "./helpers";
224
159
 
225
160
  // =============================================================================
226
- // Re-exports from panel.libraries.ts
161
+ // Re-exports from libraries.d.ts
227
162
  // =============================================================================
228
163
 
229
164
  export type {
230
- // Color Types
231
- PanelColorFormat,
232
- PanelColorRGB,
233
- PanelColorHSL,
234
- PanelColorHSV,
235
- PanelColorObject,
236
- PanelColorInput,
237
- PanelLibraryColors,
238
- // Dayjs Types
239
- PanelDayjsISOFormat,
240
- PanelDayjsRoundUnit,
241
- PanelDayjsMergeUnit,
242
- PanelDayjsPatternPart,
243
- PanelDayjsPattern,
244
- PanelDayjsExtensions,
245
- PanelDayjsInstance,
246
- PanelDayjsStaticExtensions,
247
- PanelLibraryDayjs,
248
- // Autosize
249
- PanelLibraryAutosize,
250
165
  // Main Library Interface
251
166
  PanelLibrary,
252
167
  } from "./libraries";
253
168
 
254
169
  // =============================================================================
255
- // Re-exports from panel.writer.ts
170
+ // Re-exports from textarea.d.ts
171
+ // =============================================================================
172
+
173
+ export type {
174
+ // Textarea Toolbar
175
+ TextareaButton,
176
+ TextareaToolbarContext,
177
+ } from "./textarea";
178
+
179
+ // =============================================================================
180
+ // Re-exports from writer.d.ts
256
181
  // =============================================================================
257
182
 
258
183
  export type {
184
+ // Writer Editor
185
+ WriterEditor,
186
+ // Writer Toolbar
187
+ WriterToolbarButton,
259
188
  // Writer Utilities
260
189
  WriterUtils,
261
190
  // Writer Contexts
262
191
  WriterMarkContext,
263
192
  WriterNodeContext,
264
193
  WriterExtensionContext,
194
+ // Writer Schemas
195
+ WriterMarkSchema,
196
+ WriterNodeSchema,
197
+ // Writer Extensions
198
+ WriterMarkExtension,
199
+ WriterNodeExtension,
265
200
  } from "./writer";
266
201
 
267
202
  // =============================================================================
@@ -293,14 +228,6 @@ export type PanelApp = InstanceType<VueConstructor> & {
293
228
  // Panel Configuration
294
229
  // =============================================================================
295
230
 
296
- /**
297
- * Panel API configuration.
298
- */
299
- export interface PanelConfigApi {
300
- /** Whether to use method override for PUT/PATCH/DELETE */
301
- methodOverride: boolean;
302
- }
303
-
304
231
  /**
305
232
  * Global Panel configuration.
306
233
  *
@@ -308,7 +235,10 @@ export interface PanelConfigApi {
308
235
  */
309
236
  export interface PanelConfig {
310
237
  /** API configuration */
311
- api: PanelConfigApi;
238
+ api: {
239
+ /** Whether to use method override for PUT/PATCH/DELETE */
240
+ methodOverride: boolean;
241
+ };
312
242
  /** Whether debug mode is enabled */
313
243
  debug: boolean;
314
244
  /** Whether KirbyText is enabled */
@@ -328,7 +258,7 @@ export interface PanelConfig {
328
258
  /**
329
259
  * Access permissions for Panel areas.
330
260
  */
331
- export interface PanelPermissionsAccess {
261
+ interface PanelPermissionsAccess {
332
262
  account: boolean;
333
263
  languages: boolean;
334
264
  panel: boolean;
@@ -340,7 +270,7 @@ export interface PanelPermissionsAccess {
340
270
  /**
341
271
  * File operation permissions.
342
272
  */
343
- export interface PanelPermissionsFiles {
273
+ interface PanelPermissionsFiles {
344
274
  access: boolean;
345
275
  changeName: boolean;
346
276
  changeTemplate: boolean;
@@ -356,7 +286,7 @@ export interface PanelPermissionsFiles {
356
286
  /**
357
287
  * Language operation permissions.
358
288
  */
359
- export interface PanelPermissionsLanguages {
289
+ interface PanelPermissionsLanguages {
360
290
  create: boolean;
361
291
  delete: boolean;
362
292
  update: boolean;
@@ -365,7 +295,7 @@ export interface PanelPermissionsLanguages {
365
295
  /**
366
296
  * Page operation permissions.
367
297
  */
368
- export interface PanelPermissionsPages {
298
+ interface PanelPermissionsPages {
369
299
  access: boolean;
370
300
  changeSlug: boolean;
371
301
  changeStatus: boolean;
@@ -385,7 +315,7 @@ export interface PanelPermissionsPages {
385
315
  /**
386
316
  * Site operation permissions.
387
317
  */
388
- export interface PanelPermissionsSite {
318
+ interface PanelPermissionsSite {
389
319
  changeTitle: boolean;
390
320
  update: boolean;
391
321
  }
@@ -393,7 +323,7 @@ export interface PanelPermissionsSite {
393
323
  /**
394
324
  * User management permissions (for other users).
395
325
  */
396
- export interface PanelPermissionsUsers {
326
+ interface PanelPermissionsUsers {
397
327
  changeEmail: boolean;
398
328
  changeLanguage: boolean;
399
329
  changeName: boolean;
@@ -407,7 +337,7 @@ export interface PanelPermissionsUsers {
407
337
  /**
408
338
  * Current user permissions (for own account).
409
339
  */
410
- export interface PanelPermissionsUser {
340
+ interface PanelPermissionsUser {
411
341
  changeEmail: boolean;
412
342
  changeLanguage: boolean;
413
343
  changeName: boolean;
@@ -497,29 +427,6 @@ export interface PanelRequestResponse {
497
427
  // Panel Plugins
498
428
  // =============================================================================
499
429
 
500
- /**
501
- * Third-party plugin data.
502
- */
503
- export type PanelPluginsThirdParty = Record<string, any>;
504
-
505
- /**
506
- * Custom view button definitions.
507
- */
508
- export type PanelPluginsViewButtons = Record<
509
- string,
510
- ComponentPublicInstance | Record<string, any>
511
- >;
512
-
513
- /**
514
- * Custom writer node definitions.
515
- */
516
- export type PanelPluginsWriterNodes = Record<string, Record<string, any>>;
517
-
518
- /**
519
- * Custom view definitions.
520
- */
521
- export type PanelPluginsViews = Record<string, Record<string, any>>;
522
-
523
430
  /**
524
431
  * Panel plugin system.
525
432
  *
@@ -567,7 +474,7 @@ export interface PanelPlugins {
567
474
  components: Record<string, ComponentPublicInstance>;
568
475
 
569
476
  /** Callbacks to run after Panel creation */
570
- created: Array<() => void>;
477
+ created: (() => void)[];
571
478
 
572
479
  /** Registered SVG icons */
573
480
  icons: Record<string, string>;
@@ -578,26 +485,35 @@ export interface PanelPlugins {
578
485
  /** Registered Panel routes */
579
486
  routes: Record<string, any>[];
580
487
 
581
- /** Registered textarea toolbar buttons */
582
- textareaButtons: Record<string, Record<string, any>>;
488
+ /**
489
+ * Registered textarea toolbar buttons.
490
+ * @see https://getkirby.com/docs/reference/plugins/extensions/textarea-buttons
491
+ */
492
+ textareaButtons: Record<string, TextareaButton>;
583
493
 
584
494
  /** Registered third-party plugin data */
585
- thirdParty: PanelPluginsThirdParty;
495
+ thirdParty: Record<string, any>;
586
496
 
587
497
  /** Installed Vue plugins via `Vue.use()` */
588
498
  use: any[];
589
499
 
590
500
  /** Registered view buttons */
591
- viewButtons: PanelPluginsViewButtons;
501
+ viewButtons: Record<string, ComponentPublicInstance | Record<string, any>>;
592
502
 
593
503
  /** Registered Panel views */
594
- views: PanelPluginsViews;
504
+ views: Record<string, Record<string, any>>;
595
505
 
596
- /** Registered writer marks */
597
- writerMarks: Record<string, Record<string, any>>;
506
+ /**
507
+ * Registered writer marks.
508
+ * @see https://getkirby.com/docs/reference/plugins/extensions/writer-marks
509
+ */
510
+ writerMarks: Record<string, WriterMarkExtension>;
598
511
 
599
- /** Registered writer nodes */
600
- writerNodes: PanelPluginsWriterNodes;
512
+ /**
513
+ * Registered writer nodes.
514
+ * @see https://getkirby.com/docs/reference/plugins/extensions/writer-nodes
515
+ */
516
+ writerNodes: Record<string, WriterNodeExtension>;
601
517
  }
602
518
 
603
519
  // =============================================================================
@@ -906,7 +822,7 @@ export interface Panel {
906
822
  *
907
823
  * When called with a query, performs the search and returns results.
908
824
  *
909
- * @param type - Search type ('pages', 'files', 'users')
825
+ * @param type - Search type (`"pages"`, `"files"`, `"users"`)
910
826
  * @param query - Search query string
911
827
  * @param options - Search options (page, limit)
912
828
  * @returns Search results when query provided, void otherwise
@@ -961,7 +877,7 @@ export interface Panel {
961
877
  /**
962
878
  * Lock information for content.
963
879
  */
964
- export interface PanelViewPropsLockUser {
880
+ interface PanelViewPropsLockUser {
965
881
  id: string;
966
882
  email: string;
967
883
  }
@@ -969,7 +885,7 @@ export interface PanelViewPropsLockUser {
969
885
  /**
970
886
  * Content lock state.
971
887
  */
972
- export interface PanelViewPropsLock {
888
+ interface PanelViewPropsLock {
973
889
  isLegacy: boolean;
974
890
  isLocked: boolean;
975
891
  modified: string | null;
@@ -979,7 +895,7 @@ export interface PanelViewPropsLock {
979
895
  /**
980
896
  * Content permissions for a view.
981
897
  */
982
- export interface PanelViewPropsPermissions {
898
+ interface PanelViewPropsPermissions {
983
899
  access: boolean;
984
900
  changeSlug: boolean;
985
901
  changeStatus: boolean;
@@ -999,7 +915,7 @@ export interface PanelViewPropsPermissions {
999
915
  /**
1000
916
  * Version information.
1001
917
  */
1002
- export interface PanelViewPropsVersions {
918
+ interface PanelViewPropsVersions {
1003
919
  latest: Record<string, any>;
1004
920
  changes: Record<string, any>;
1005
921
  }
@@ -1007,7 +923,7 @@ export interface PanelViewPropsVersions {
1007
923
  /**
1008
924
  * Tab definition.
1009
925
  */
1010
- export interface PanelViewPropsTab {
926
+ interface PanelViewPropsTab {
1011
927
  label: string;
1012
928
  icon: string;
1013
929
  columns: Record<string, any>[];
@@ -1018,7 +934,7 @@ export interface PanelViewPropsTab {
1018
934
  /**
1019
935
  * Navigation link (next/prev).
1020
936
  */
1021
- export interface PanelViewPropsNavigation {
937
+ interface PanelViewPropsNavigation {
1022
938
  link: string;
1023
939
  title: string;
1024
940
  }
@@ -1026,7 +942,7 @@ export interface PanelViewPropsNavigation {
1026
942
  /**
1027
943
  * Model information.
1028
944
  */
1029
- export interface PanelViewPropsModel {
945
+ interface PanelViewPropsModel {
1030
946
  id: string;
1031
947
  link: string;
1032
948
  parent: string;
@@ -1039,7 +955,7 @@ export interface PanelViewPropsModel {
1039
955
  /**
1040
956
  * Button definition.
1041
957
  */
1042
- export interface PanelViewPropsButton {
958
+ interface PanelViewPropsButton {
1043
959
  component: string;
1044
960
  key: string;
1045
961
  props: {
@@ -173,37 +173,6 @@ export interface PanelLibraryColors {
173
173
  // Dayjs Types
174
174
  // -----------------------------------------------------------------------------
175
175
 
176
- /**
177
- * ISO format type for Kirby's `toISO`/`iso` methods.
178
- */
179
- export type PanelDayjsISOFormat = "date" | "time" | "datetime";
180
-
181
- /**
182
- * Valid units for Kirby's `round()` method.
183
- *
184
- * Note: `day` is an alias for `date`. Units `week` and `millisecond`
185
- * are NOT supported by `round()` and will throw an error.
186
- */
187
- export type PanelDayjsRoundUnit =
188
- | "second"
189
- | "minute"
190
- | "hour"
191
- | "day"
192
- | "date"
193
- | "month"
194
- | "year";
195
-
196
- /**
197
- * Valid units for Kirby's `merge()` method.
198
- */
199
- export type PanelDayjsMergeUnit =
200
- | "year"
201
- | "month"
202
- | "date"
203
- | "hour"
204
- | "minute"
205
- | "second";
206
-
207
176
  /**
208
177
  * Pattern part information.
209
178
  */
@@ -255,7 +224,7 @@ export interface PanelDayjsExtensions {
255
224
  * @param format - `"date"` → `"YYYY-MM-DD"`, `"time"` → `"HH:mm:ss"`, `"datetime"` → `"YYYY-MM-DD HH:mm:ss"`
256
225
  * @returns ISO formatted string
257
226
  */
258
- toISO: (format?: PanelDayjsISOFormat) => string;
227
+ toISO: (format?: "date" | "time" | "datetime") => string;
259
228
 
260
229
  /**
261
230
  * Validates datetime against an upper or lower (min/max) boundary.
@@ -275,24 +244,30 @@ export interface PanelDayjsExtensions {
275
244
  * Merges date or time parts from another dayjs instance.
276
245
  *
277
246
  * @param dt - Dayjs instance to merge from
278
- * @param units - `"date"`, `"time"`, or array of specific units
247
+ * @param units - `"date"`, `"time"`, or array of specific units (`"year"`, `"month"`, `"date"`, `"hour"`, `"minute"`, `"second"`)
279
248
  * @returns New dayjs instance (returns `this` if `dt` is invalid)
280
249
  */
281
250
  merge: (
282
251
  dt: Dayjs | null | undefined,
283
- units?: "date" | "time" | PanelDayjsMergeUnit[],
252
+ units?:
253
+ | "date"
254
+ | "time"
255
+ | ("year" | "month" | "date" | "hour" | "minute" | "second")[],
284
256
  ) => Dayjs & PanelDayjsExtensions;
285
257
 
286
258
  /**
287
259
  * Rounds to nearest unit step.
288
260
  *
261
+ * Note: `day` is an alias for `date`. Units `week` and `millisecond`
262
+ * are NOT supported and will throw an error.
263
+ *
289
264
  * @param unit - Unit to round (default: `"date"`)
290
265
  * @param size - Step size (default: `1`). Must divide evenly into the unit's range.
291
266
  * @returns Rounded dayjs instance
292
267
  * @throws Error if unit is invalid or size doesn't divide evenly
293
268
  */
294
269
  round: (
295
- unit?: PanelDayjsRoundUnit,
270
+ unit?: "second" | "minute" | "hour" | "day" | "date" | "month" | "year",
296
271
  size?: number,
297
272
  ) => Dayjs & PanelDayjsExtensions;
298
273
  }
@@ -330,7 +305,7 @@ export interface PanelDayjsStaticExtensions {
330
305
  */
331
306
  iso: (
332
307
  value: string,
333
- format?: PanelDayjsISOFormat,
308
+ format?: "date" | "time" | "datetime",
334
309
  ) => PanelDayjsInstance | null;
335
310
 
336
311
  /**