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.
- package/README.md +92 -0
- package/index.d.ts +22 -0
- package/package.json +7 -3
- package/src/blueprint.d.ts +660 -0
- package/src/panel/features.d.ts +8 -9
- package/src/panel/helpers.d.ts +3 -3
- package/src/panel/index.d.ts +74 -158
- package/src/panel/libraries.d.ts +11 -36
- package/src/panel/textarea.d.ts +192 -0
- package/src/panel/writer.d.ts +570 -13
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blueprint type definitions for Kirby.
|
|
3
|
+
*
|
|
4
|
+
* Types representing field, fieldset, and option structures as returned
|
|
5
|
+
* by Kirby's Form and Fieldset classes when serialized via `toArray()`.
|
|
6
|
+
*
|
|
7
|
+
* @see https://getkirby.com/docs/reference/panel/blueprints
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Field Options
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Rendered option for select, radio, checkbox, and toggle fields.
|
|
16
|
+
*
|
|
17
|
+
* Represents the output of `Option->render()` which is used by
|
|
18
|
+
* fields with the options mixin (select, radio, checkboxes, etc.).
|
|
19
|
+
*
|
|
20
|
+
* @see https://github.com/getkirby/kirby/blob/main/src/Option/Option.php
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const option: KirbyOption = {
|
|
25
|
+
* disabled: false,
|
|
26
|
+
* icon: "page",
|
|
27
|
+
* info: "Additional info",
|
|
28
|
+
* text: "Draft",
|
|
29
|
+
* value: "draft"
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export interface KirbyOption {
|
|
34
|
+
/** Whether the option is disabled */
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
/** Optional icon identifier */
|
|
37
|
+
icon: string | null;
|
|
38
|
+
/** Optional additional info text */
|
|
39
|
+
info: string | null;
|
|
40
|
+
/** Display text (falls back to value if not set) */
|
|
41
|
+
text: string | null;
|
|
42
|
+
/** Option value stored in content file */
|
|
43
|
+
value: string | number | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// Field Props (Base)
|
|
48
|
+
// =============================================================================
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Base field props shared by all field types.
|
|
52
|
+
*
|
|
53
|
+
* Represents the common properties returned by `Field->toArray()`.
|
|
54
|
+
* Field-specific types extend this with additional props.
|
|
55
|
+
*
|
|
56
|
+
* @see https://github.com/getkirby/kirby/blob/main/src/Form/Field.php
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const field: KirbyFieldProps = {
|
|
61
|
+
* name: "title",
|
|
62
|
+
* type: "text",
|
|
63
|
+
* label: "Title",
|
|
64
|
+
* required: true,
|
|
65
|
+
* width: "1/2"
|
|
66
|
+
* };
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export interface KirbyFieldProps {
|
|
70
|
+
/** Optional text shown after the input */
|
|
71
|
+
after?: string;
|
|
72
|
+
/** Whether field receives focus on form load */
|
|
73
|
+
autofocus: boolean;
|
|
74
|
+
/** Optional text shown before the input */
|
|
75
|
+
before?: string;
|
|
76
|
+
/** Default value for new content */
|
|
77
|
+
default?: any;
|
|
78
|
+
/** Whether the field is disabled */
|
|
79
|
+
disabled: boolean;
|
|
80
|
+
/** Help text below the field (supports Markdown) */
|
|
81
|
+
help?: string;
|
|
82
|
+
/** Whether the field is hidden via `when` condition */
|
|
83
|
+
hidden: boolean;
|
|
84
|
+
/** Icon identifier */
|
|
85
|
+
icon?: string;
|
|
86
|
+
/** Human-readable field label */
|
|
87
|
+
label?: string;
|
|
88
|
+
/** Field identifier within the blueprint */
|
|
89
|
+
name: string;
|
|
90
|
+
/** Placeholder text for empty fields */
|
|
91
|
+
placeholder?: string;
|
|
92
|
+
/** Whether the field is required */
|
|
93
|
+
required: boolean;
|
|
94
|
+
/** Whether field values can be saved (false for info/headline fields) */
|
|
95
|
+
saveable: boolean;
|
|
96
|
+
/** Whether the field is translatable in multi-lang setups */
|
|
97
|
+
translate: boolean;
|
|
98
|
+
/** Field type identifier (e.g., `text`, `textarea`, `blocks`) */
|
|
99
|
+
type: string;
|
|
100
|
+
/** Current field value */
|
|
101
|
+
value?: any;
|
|
102
|
+
/** Conditional visibility rules */
|
|
103
|
+
when?: Record<string, any>;
|
|
104
|
+
/** Field width in grid (e.g., `1/1`, `1/2`, `1/3`) */
|
|
105
|
+
width: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// Field Props (Type-Specific)
|
|
110
|
+
// =============================================================================
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Props for text and textarea fields.
|
|
114
|
+
*
|
|
115
|
+
* @see https://getkirby.com/docs/reference/panel/fields/text
|
|
116
|
+
*/
|
|
117
|
+
export interface KirbyTextFieldProps extends KirbyFieldProps {
|
|
118
|
+
type: "text" | "textarea" | "slug" | "url" | "email" | "tel";
|
|
119
|
+
/** Value converter: `lower`, `upper`, `ucfirst`, `slug` */
|
|
120
|
+
converter?: "lower" | "upper" | "ucfirst" | "slug";
|
|
121
|
+
/** Whether to show character counter */
|
|
122
|
+
counter: boolean;
|
|
123
|
+
/** Font family: `sans-serif` or `monospace` */
|
|
124
|
+
font: "sans-serif" | "monospace";
|
|
125
|
+
/** Maximum character length */
|
|
126
|
+
maxlength?: number;
|
|
127
|
+
/** Minimum character length */
|
|
128
|
+
minlength?: number;
|
|
129
|
+
/** Validation regex pattern */
|
|
130
|
+
pattern?: string;
|
|
131
|
+
/** Whether spellcheck is enabled */
|
|
132
|
+
spellcheck: boolean;
|
|
133
|
+
value?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Props for number fields.
|
|
138
|
+
*
|
|
139
|
+
* @see https://getkirby.com/docs/reference/panel/fields/number
|
|
140
|
+
*/
|
|
141
|
+
export interface KirbyNumberFieldProps extends KirbyFieldProps {
|
|
142
|
+
type: "number";
|
|
143
|
+
/** Maximum value */
|
|
144
|
+
max?: number;
|
|
145
|
+
/** Minimum value */
|
|
146
|
+
min?: number;
|
|
147
|
+
/** Step increment, or `"any"` to allow any decimal value */
|
|
148
|
+
step?: number | "any";
|
|
149
|
+
value?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Props for select, radio, checkboxes, multiselect, and toggles fields.
|
|
154
|
+
*
|
|
155
|
+
* @see https://getkirby.com/docs/reference/panel/fields/select
|
|
156
|
+
*/
|
|
157
|
+
export interface KirbyOptionsFieldProps extends KirbyFieldProps {
|
|
158
|
+
type: "select" | "radio" | "checkboxes" | "multiselect" | "toggles";
|
|
159
|
+
/** Input acceptance mode for multiselect: `"all"` or `"options"` */
|
|
160
|
+
accept?: "all" | "options";
|
|
161
|
+
/** Whether to show batch select toggle (checkboxes only) */
|
|
162
|
+
batch?: boolean;
|
|
163
|
+
/** Number of columns for layout (radio, checkboxes) */
|
|
164
|
+
columns?: number;
|
|
165
|
+
/** Whether toggles should span full width */
|
|
166
|
+
grow?: boolean;
|
|
167
|
+
/** Whether to show labels for icon-only toggles */
|
|
168
|
+
labels?: boolean;
|
|
169
|
+
/** Maximum number of selected options (checkboxes, multiselect) */
|
|
170
|
+
max?: number;
|
|
171
|
+
/** Minimum number of selected options (checkboxes, multiselect) */
|
|
172
|
+
min?: number;
|
|
173
|
+
/** Available options */
|
|
174
|
+
options: KirbyOption[];
|
|
175
|
+
/** Whether a toggle can be deactivated on click (toggles only) */
|
|
176
|
+
reset?: boolean;
|
|
177
|
+
value?: string | string[];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Props for toggle fields.
|
|
182
|
+
*
|
|
183
|
+
* @see https://getkirby.com/docs/reference/panel/fields/toggle
|
|
184
|
+
*/
|
|
185
|
+
export interface KirbyToggleFieldProps extends KirbyFieldProps {
|
|
186
|
+
type: "toggle";
|
|
187
|
+
/** Text shown when toggle is off */
|
|
188
|
+
text?: string | [string, string];
|
|
189
|
+
value?: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Props for date and time fields.
|
|
194
|
+
*
|
|
195
|
+
* @see https://getkirby.com/docs/reference/panel/fields/date
|
|
196
|
+
*/
|
|
197
|
+
export interface KirbyDateFieldProps extends KirbyFieldProps {
|
|
198
|
+
type: "date" | "time";
|
|
199
|
+
/** Whether to show the dropdown calendar (date only) */
|
|
200
|
+
calendar?: boolean;
|
|
201
|
+
/** Date/time display format (dayjs tokens) */
|
|
202
|
+
display?: string;
|
|
203
|
+
/** Maximum date/time */
|
|
204
|
+
max?: string;
|
|
205
|
+
/** Minimum date/time */
|
|
206
|
+
min?: string;
|
|
207
|
+
/** Hour notation: `12` or `24` (time only) */
|
|
208
|
+
notation?: 12 | 24;
|
|
209
|
+
/** Step configuration for rounding (size and unit like `"minute"`, `"hour"`, `"day"`) */
|
|
210
|
+
step?: { size: number; unit: string };
|
|
211
|
+
/** Whether to include time picker (date only) */
|
|
212
|
+
time?: boolean | Record<string, any>;
|
|
213
|
+
value?: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Picker item data as returned by the Panel API.
|
|
218
|
+
*/
|
|
219
|
+
export interface KirbyPickerItem {
|
|
220
|
+
/** Item identifier (UUID or ID) */
|
|
221
|
+
id: string;
|
|
222
|
+
/** Display text */
|
|
223
|
+
text?: string;
|
|
224
|
+
/** Additional info text */
|
|
225
|
+
info?: string;
|
|
226
|
+
/** Image configuration */
|
|
227
|
+
image?: Record<string, any>;
|
|
228
|
+
/** Item link URL */
|
|
229
|
+
link?: string;
|
|
230
|
+
[key: string]: any;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Props for files, pages, and users fields.
|
|
235
|
+
*
|
|
236
|
+
* @see https://getkirby.com/docs/reference/panel/fields/files
|
|
237
|
+
*/
|
|
238
|
+
export interface KirbyFilesFieldProps extends KirbyFieldProps {
|
|
239
|
+
type: "files" | "pages" | "users";
|
|
240
|
+
/** Placeholder text when no items are selected */
|
|
241
|
+
empty?: string;
|
|
242
|
+
/** Image settings for each item */
|
|
243
|
+
image?: Record<string, any>;
|
|
244
|
+
/** Info text template for each item */
|
|
245
|
+
info?: string;
|
|
246
|
+
/** Whether each item should be clickable */
|
|
247
|
+
link?: boolean;
|
|
248
|
+
/** Maximum number of items */
|
|
249
|
+
max?: number;
|
|
250
|
+
/** Minimum number of items */
|
|
251
|
+
min?: number;
|
|
252
|
+
/** Whether multiple selection is allowed */
|
|
253
|
+
multiple: boolean;
|
|
254
|
+
/** Query for available items */
|
|
255
|
+
query?: string;
|
|
256
|
+
/** Whether to show search field in picker */
|
|
257
|
+
search?: boolean;
|
|
258
|
+
/** Whether to store `"uuid"` or `"id"` in content file */
|
|
259
|
+
store?: "uuid" | "id";
|
|
260
|
+
/** Text template for each item */
|
|
261
|
+
text?: string;
|
|
262
|
+
/** Selected items (transformed picker data, not raw IDs) */
|
|
263
|
+
value?: KirbyPickerItem[];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Props for color fields.
|
|
268
|
+
*
|
|
269
|
+
* @see https://getkirby.com/docs/reference/panel/fields/color
|
|
270
|
+
*/
|
|
271
|
+
export interface KirbyColorFieldProps extends KirbyFieldProps {
|
|
272
|
+
type: "color";
|
|
273
|
+
/** Whether to allow alpha transparency */
|
|
274
|
+
alpha?: boolean;
|
|
275
|
+
/** CSS color format to display and store */
|
|
276
|
+
format?: "hex" | "rgb" | "hsl";
|
|
277
|
+
/** Color picker mode */
|
|
278
|
+
mode?: "picker" | "input" | "options";
|
|
279
|
+
/** Predefined color options */
|
|
280
|
+
options?: KirbyColorOption[];
|
|
281
|
+
value?: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Color option for the color field.
|
|
286
|
+
*/
|
|
287
|
+
export interface KirbyColorOption {
|
|
288
|
+
/** Color value (hex, rgb, or hsl) */
|
|
289
|
+
value: string;
|
|
290
|
+
/** Optional display text/label */
|
|
291
|
+
text?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Props for range fields (slider input).
|
|
296
|
+
*
|
|
297
|
+
* @see https://getkirby.com/docs/reference/panel/fields/range
|
|
298
|
+
*/
|
|
299
|
+
export interface KirbyRangeFieldProps extends KirbyFieldProps {
|
|
300
|
+
type: "range";
|
|
301
|
+
/** Maximum value (default: 100) */
|
|
302
|
+
max?: number;
|
|
303
|
+
/** Minimum value */
|
|
304
|
+
min?: number;
|
|
305
|
+
/** Step increment, or `"any"` for any decimal value */
|
|
306
|
+
step?: number | "any";
|
|
307
|
+
/** Tooltip configuration (before/after text) or boolean to enable/disable */
|
|
308
|
+
tooltip?: boolean | { before?: string; after?: string };
|
|
309
|
+
value?: number;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Search configuration for tags field.
|
|
314
|
+
*/
|
|
315
|
+
export interface KirbyTagsSearch {
|
|
316
|
+
/** Maximum items to display in dropdown */
|
|
317
|
+
display?: number;
|
|
318
|
+
/** Minimum characters before search starts */
|
|
319
|
+
min?: number;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Props for tags fields.
|
|
324
|
+
*
|
|
325
|
+
* @see https://getkirby.com/docs/reference/panel/fields/tags
|
|
326
|
+
*/
|
|
327
|
+
export interface KirbyTagsFieldProps extends KirbyFieldProps {
|
|
328
|
+
type: "tags";
|
|
329
|
+
/** Input acceptance: `"all"` for any input, `"options"` for predefined only */
|
|
330
|
+
accept?: "all" | "options";
|
|
331
|
+
/** Tag icon */
|
|
332
|
+
icon?: string;
|
|
333
|
+
/** Display layout: `"list"` for full-width tags */
|
|
334
|
+
layout?: "list" | null;
|
|
335
|
+
/** Maximum number of tags */
|
|
336
|
+
max?: number;
|
|
337
|
+
/** Minimum number of tags */
|
|
338
|
+
min?: number;
|
|
339
|
+
/** Predefined tag options */
|
|
340
|
+
options?: KirbyOption[];
|
|
341
|
+
/** Search configuration or boolean to enable/disable */
|
|
342
|
+
search?: boolean | KirbyTagsSearch;
|
|
343
|
+
/** Tag separator for storage (default: `,`) */
|
|
344
|
+
separator?: string;
|
|
345
|
+
/** Whether to sort tags by dropdown position */
|
|
346
|
+
sort?: boolean;
|
|
347
|
+
value?: string[];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Props for link fields.
|
|
352
|
+
*
|
|
353
|
+
* @see https://getkirby.com/docs/reference/panel/fields/link
|
|
354
|
+
*/
|
|
355
|
+
export interface KirbyLinkFieldProps extends KirbyFieldProps {
|
|
356
|
+
type: "link";
|
|
357
|
+
/** Allowed link types */
|
|
358
|
+
options?: ("anchor" | "url" | "page" | "file" | "email" | "tel" | "custom")[];
|
|
359
|
+
value?: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Props for structure fields.
|
|
364
|
+
*
|
|
365
|
+
* @see https://getkirby.com/docs/reference/panel/fields/structure
|
|
366
|
+
*/
|
|
367
|
+
export interface KirbyStructureFieldProps extends KirbyFieldProps {
|
|
368
|
+
type: "structure";
|
|
369
|
+
/** Whether to enable batch editing */
|
|
370
|
+
batch?: boolean;
|
|
371
|
+
/** Column definitions for table display */
|
|
372
|
+
columns?: Record<string, KirbyStructureColumn>;
|
|
373
|
+
/** Whether to allow duplicating rows */
|
|
374
|
+
duplicate?: boolean;
|
|
375
|
+
/** Placeholder text when no entries exist */
|
|
376
|
+
empty?: string;
|
|
377
|
+
/** Nested field definitions */
|
|
378
|
+
fields: Record<string, KirbyFieldProps>;
|
|
379
|
+
/** Number of entries per page before pagination */
|
|
380
|
+
limit?: number;
|
|
381
|
+
/** Maximum number of entries */
|
|
382
|
+
max?: number;
|
|
383
|
+
/** Minimum number of entries */
|
|
384
|
+
min?: number;
|
|
385
|
+
/** Whether to prepend new entries */
|
|
386
|
+
prepend?: boolean | null;
|
|
387
|
+
/** Whether entries are sortable via drag & drop */
|
|
388
|
+
sortable?: boolean | null;
|
|
389
|
+
/** Sort entries by field (disables drag & drop) */
|
|
390
|
+
sortBy?: string;
|
|
391
|
+
value?: Record<string, any>[];
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Column definition for structure field table display.
|
|
396
|
+
*/
|
|
397
|
+
export interface KirbyStructureColumn {
|
|
398
|
+
/** Column label */
|
|
399
|
+
label?: string;
|
|
400
|
+
/** Column width */
|
|
401
|
+
width?: string;
|
|
402
|
+
/** Field type for display */
|
|
403
|
+
type?: string;
|
|
404
|
+
/** Whether to show mobile */
|
|
405
|
+
mobile?: boolean;
|
|
406
|
+
/** Text alignment */
|
|
407
|
+
align?: "left" | "center" | "right";
|
|
408
|
+
/** Value template */
|
|
409
|
+
value?: string;
|
|
410
|
+
/** Before text */
|
|
411
|
+
before?: string;
|
|
412
|
+
/** After text */
|
|
413
|
+
after?: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Props for object fields.
|
|
418
|
+
*
|
|
419
|
+
* @see https://getkirby.com/docs/reference/panel/fields/object
|
|
420
|
+
*/
|
|
421
|
+
export interface KirbyObjectFieldProps extends KirbyFieldProps {
|
|
422
|
+
type: "object";
|
|
423
|
+
/** Placeholder text when no data exists */
|
|
424
|
+
empty?: string;
|
|
425
|
+
/** Nested field definitions */
|
|
426
|
+
fields: Record<string, KirbyFieldProps>;
|
|
427
|
+
value?: Record<string, any> | "";
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Props for blocks fields.
|
|
432
|
+
*
|
|
433
|
+
* @see https://getkirby.com/docs/reference/panel/fields/blocks
|
|
434
|
+
*/
|
|
435
|
+
export interface KirbyBlocksFieldProps extends KirbyFieldProps {
|
|
436
|
+
type: "blocks";
|
|
437
|
+
/** Empty state configuration */
|
|
438
|
+
empty?: string;
|
|
439
|
+
/** Available block fieldsets */
|
|
440
|
+
fieldsets: Record<string, KirbyFieldsetProps>;
|
|
441
|
+
/** Fieldset group configuration */
|
|
442
|
+
fieldsetGroups?: Record<string, KirbyFieldsetGroup>;
|
|
443
|
+
/** Group name for fieldsets */
|
|
444
|
+
group?: string;
|
|
445
|
+
/** Maximum number of blocks */
|
|
446
|
+
max?: number;
|
|
447
|
+
/** Minimum number of blocks */
|
|
448
|
+
min?: number;
|
|
449
|
+
value?: KirbyBlockValue[];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Props for layout fields.
|
|
454
|
+
*
|
|
455
|
+
* @see https://getkirby.com/docs/reference/panel/fields/layout
|
|
456
|
+
*/
|
|
457
|
+
export interface KirbyLayoutFieldProps extends KirbyFieldProps {
|
|
458
|
+
type: "layout";
|
|
459
|
+
/** Empty state configuration */
|
|
460
|
+
empty?: string;
|
|
461
|
+
/** Available block fieldsets */
|
|
462
|
+
fieldsets: Record<string, KirbyFieldsetProps>;
|
|
463
|
+
/** Fieldset group configuration */
|
|
464
|
+
fieldsetGroups?: Record<string, KirbyFieldsetGroup>;
|
|
465
|
+
/** Group name for fieldsets */
|
|
466
|
+
group?: string;
|
|
467
|
+
/** Available layout configurations (column width arrays) */
|
|
468
|
+
layouts: string[][];
|
|
469
|
+
/** Maximum number of layouts */
|
|
470
|
+
max?: number;
|
|
471
|
+
/** Minimum number of layouts */
|
|
472
|
+
min?: number;
|
|
473
|
+
/** Layout selector styling options (size: `"small"`|`"medium"`|`"large"`|`"huge"`, columns count) */
|
|
474
|
+
selector?: {
|
|
475
|
+
size?: "small" | "medium" | "large" | "huge";
|
|
476
|
+
columns?: number;
|
|
477
|
+
};
|
|
478
|
+
/** Layout settings fieldset (rendered via `Fieldset->toArray()`) */
|
|
479
|
+
settings?: KirbyFieldsetProps;
|
|
480
|
+
value?: KirbyLayoutValue[];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Props for writer fields.
|
|
485
|
+
*
|
|
486
|
+
* @see https://getkirby.com/docs/reference/panel/fields/writer
|
|
487
|
+
*/
|
|
488
|
+
export interface KirbyWriterFieldProps extends KirbyFieldProps {
|
|
489
|
+
type: "writer";
|
|
490
|
+
/** Whether to show character counter */
|
|
491
|
+
counter?: boolean;
|
|
492
|
+
/** Available heading levels (1-6) */
|
|
493
|
+
headings?: number[];
|
|
494
|
+
/** Whether only inline formatting is allowed */
|
|
495
|
+
inline: boolean;
|
|
496
|
+
/** Available formatting marks (`bold`, `italic`, `underline`, `strike`, `code`, `link`, `email`) or `true`/`false` */
|
|
497
|
+
marks?: string[] | boolean;
|
|
498
|
+
/** Maximum character length */
|
|
499
|
+
maxlength?: number;
|
|
500
|
+
/** Minimum character length */
|
|
501
|
+
minlength?: number;
|
|
502
|
+
/** Available block nodes (`paragraph`, `heading`, `bulletList`, `orderedList`, `quote`) or `true`/`false` */
|
|
503
|
+
nodes?: string[] | boolean;
|
|
504
|
+
/** Toolbar configuration */
|
|
505
|
+
toolbar?: Record<string, any>;
|
|
506
|
+
value?: string;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// =============================================================================
|
|
510
|
+
// Block & Layout Values
|
|
511
|
+
// =============================================================================
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Block value as stored in content.
|
|
515
|
+
*/
|
|
516
|
+
export interface KirbyBlockValue {
|
|
517
|
+
/** Block content fields */
|
|
518
|
+
content: Record<string, any>;
|
|
519
|
+
/** Unique block identifier */
|
|
520
|
+
id: string;
|
|
521
|
+
/** Whether the block is hidden */
|
|
522
|
+
isHidden: boolean;
|
|
523
|
+
/** Block type identifier */
|
|
524
|
+
type: string;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Layout value as stored in content.
|
|
529
|
+
*/
|
|
530
|
+
export interface KirbyLayoutValue {
|
|
531
|
+
/** Layout attributes */
|
|
532
|
+
attrs: Record<string, any> | any[];
|
|
533
|
+
/** Layout columns */
|
|
534
|
+
columns: KirbyLayoutColumnValue[];
|
|
535
|
+
/** Unique layout identifier */
|
|
536
|
+
id: string;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Layout column value as stored in content.
|
|
541
|
+
*/
|
|
542
|
+
export interface KirbyLayoutColumnValue {
|
|
543
|
+
/** Blocks in this column */
|
|
544
|
+
blocks: KirbyBlockValue[];
|
|
545
|
+
/** Unique column identifier */
|
|
546
|
+
id: string;
|
|
547
|
+
/** Column width fraction */
|
|
548
|
+
width: string;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// =============================================================================
|
|
552
|
+
// Fieldset (Block Type Definition)
|
|
553
|
+
// =============================================================================
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Fieldset props as returned by `Fieldset->toArray()`.
|
|
557
|
+
*
|
|
558
|
+
* Represents a block type definition with its fields organized in tabs.
|
|
559
|
+
* Used by blocks and layout fields.
|
|
560
|
+
*
|
|
561
|
+
* @see https://github.com/getkirby/kirby/blob/main/src/Cms/Fieldset.php
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* ```ts
|
|
565
|
+
* const fieldset: KirbyFieldsetProps = {
|
|
566
|
+
* disabled: false,
|
|
567
|
+
* editable: true,
|
|
568
|
+
* icon: "text",
|
|
569
|
+
* label: null,
|
|
570
|
+
* name: "Heading",
|
|
571
|
+
* preview: "fields",
|
|
572
|
+
* tabs: {
|
|
573
|
+
* content: {
|
|
574
|
+
* fields: { text: {...}, level: {...} },
|
|
575
|
+
* label: "Content",
|
|
576
|
+
* name: "content"
|
|
577
|
+
* }
|
|
578
|
+
* },
|
|
579
|
+
* translate: true,
|
|
580
|
+
* type: "heading",
|
|
581
|
+
* unset: false,
|
|
582
|
+
* wysiwyg: false
|
|
583
|
+
* };
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
export interface KirbyFieldsetProps {
|
|
587
|
+
/** Whether the fieldset is disabled */
|
|
588
|
+
disabled: boolean;
|
|
589
|
+
/** Whether the block can be edited (has fields) */
|
|
590
|
+
editable: boolean;
|
|
591
|
+
/** Icon identifier */
|
|
592
|
+
icon: string | null;
|
|
593
|
+
/** Short label for block selector */
|
|
594
|
+
label: string | null;
|
|
595
|
+
/** Human-readable block name */
|
|
596
|
+
name: string;
|
|
597
|
+
/** Preview mode: `fields`, field name, or custom component */
|
|
598
|
+
preview: string | boolean | null;
|
|
599
|
+
/** Tabs containing field definitions */
|
|
600
|
+
tabs: Record<string, KirbyFieldsetTab>;
|
|
601
|
+
/** Whether the block is translatable */
|
|
602
|
+
translate: boolean;
|
|
603
|
+
/** Block type identifier (e.g., `text`, `heading`, `image`) */
|
|
604
|
+
type: string;
|
|
605
|
+
/** Whether the fieldset should be hidden */
|
|
606
|
+
unset: boolean;
|
|
607
|
+
/** Whether the block uses WYSIWYG editing */
|
|
608
|
+
wysiwyg: boolean;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Tab within a fieldset.
|
|
613
|
+
*/
|
|
614
|
+
export interface KirbyFieldsetTab {
|
|
615
|
+
/** Field definitions in this tab */
|
|
616
|
+
fields: Record<string, KirbyFieldProps>;
|
|
617
|
+
/** Tab label */
|
|
618
|
+
label?: string;
|
|
619
|
+
/** Tab identifier */
|
|
620
|
+
name: string;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Fieldset group for organizing block types.
|
|
625
|
+
*/
|
|
626
|
+
export interface KirbyFieldsetGroup {
|
|
627
|
+
/** Group label */
|
|
628
|
+
label: string;
|
|
629
|
+
/** Group identifier */
|
|
630
|
+
name: string;
|
|
631
|
+
/** Whether the group is open by default */
|
|
632
|
+
open: boolean;
|
|
633
|
+
/** Block types in this group */
|
|
634
|
+
sets: string[];
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// =============================================================================
|
|
638
|
+
// Union Types
|
|
639
|
+
// =============================================================================
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Union of all field prop types.
|
|
643
|
+
*/
|
|
644
|
+
export type KirbyAnyFieldProps =
|
|
645
|
+
| KirbyFieldProps
|
|
646
|
+
| KirbyTextFieldProps
|
|
647
|
+
| KirbyNumberFieldProps
|
|
648
|
+
| KirbyOptionsFieldProps
|
|
649
|
+
| KirbyToggleFieldProps
|
|
650
|
+
| KirbyDateFieldProps
|
|
651
|
+
| KirbyFilesFieldProps
|
|
652
|
+
| KirbyColorFieldProps
|
|
653
|
+
| KirbyRangeFieldProps
|
|
654
|
+
| KirbyTagsFieldProps
|
|
655
|
+
| KirbyLinkFieldProps
|
|
656
|
+
| KirbyStructureFieldProps
|
|
657
|
+
| KirbyObjectFieldProps
|
|
658
|
+
| KirbyBlocksFieldProps
|
|
659
|
+
| KirbyLayoutFieldProps
|
|
660
|
+
| KirbyWriterFieldProps;
|
package/src/panel/features.d.ts
CHANGED
|
@@ -649,6 +649,8 @@ export interface PanelViewDefaults extends PanelFeatureDefaults {
|
|
|
649
649
|
id: string | null;
|
|
650
650
|
/** View link */
|
|
651
651
|
link: string | null;
|
|
652
|
+
/** Relative path to this view */
|
|
653
|
+
path: string;
|
|
652
654
|
/** Default search type */
|
|
653
655
|
search: string;
|
|
654
656
|
/** View title */
|
|
@@ -678,6 +680,8 @@ export interface PanelView extends Omit<
|
|
|
678
680
|
id: string | null;
|
|
679
681
|
/** View link */
|
|
680
682
|
link: string | null;
|
|
683
|
+
/** Relative path to this view */
|
|
684
|
+
path: string;
|
|
681
685
|
/** Default search type */
|
|
682
686
|
search: string;
|
|
683
687
|
/** View title */
|
|
@@ -967,7 +971,7 @@ export interface PanelContent {
|
|
|
967
971
|
/**
|
|
968
972
|
* Emits a content event with environment context.
|
|
969
973
|
*
|
|
970
|
-
* @param event - Event name (prefixed with
|
|
974
|
+
* @param event - Event name (prefixed with `"content."`)
|
|
971
975
|
* @param options - Additional event data
|
|
972
976
|
* @param env - Environment context
|
|
973
977
|
*/
|
|
@@ -1379,11 +1383,6 @@ export interface PanelUpload
|
|
|
1379
1383
|
// Events
|
|
1380
1384
|
// -----------------------------------------------------------------------------
|
|
1381
1385
|
|
|
1382
|
-
/**
|
|
1383
|
-
* Keychain modifier string (e.g., `'cmd.shift.s'`).
|
|
1384
|
-
*/
|
|
1385
|
-
export type PanelKeychain = string;
|
|
1386
|
-
|
|
1387
1386
|
/**
|
|
1388
1387
|
* Event emitter interface (mitt-compatible).
|
|
1389
1388
|
*/
|
|
@@ -1479,13 +1478,13 @@ export interface PanelEvents extends PanelEventEmitter {
|
|
|
1479
1478
|
focus: (event: FocusEvent) => void;
|
|
1480
1479
|
|
|
1481
1480
|
/**
|
|
1482
|
-
* Creates keychain modifier string.
|
|
1481
|
+
* Creates keychain modifier string (e.g., `"keydown.cmd.shift.s"`).
|
|
1483
1482
|
*
|
|
1484
1483
|
* @param type - Event type
|
|
1485
1484
|
* @param event - KeyboardEvent
|
|
1486
|
-
* @returns Keychain string
|
|
1485
|
+
* @returns Keychain string
|
|
1487
1486
|
*/
|
|
1488
|
-
keychain: (type: "keydown" | "keyup", event: KeyboardEvent) =>
|
|
1487
|
+
keychain: (type: "keydown" | "keyup", event: KeyboardEvent) => string;
|
|
1489
1488
|
|
|
1490
1489
|
/**
|
|
1491
1490
|
* Handles window keydown event.
|