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 CHANGED
@@ -45,6 +45,7 @@ yarn add -D kirby-types
45
45
  <td>
46
46
 
47
47
  - **API Response**: Type-safe API responses.
48
+ - **Blueprints**: Field definitions, fieldsets, and field options.
48
49
  - **Blocks**: All 11 default block types with content structures.
49
50
  - **Layouts**: Layout and column types with width unions.
50
51
  - **KQL**: Query Language request/response types.
@@ -125,6 +126,73 @@ const response: KirbyApiResponse<PageData> = {
125
126
  };
126
127
  ```
127
128
 
129
+ ### Blueprints
130
+
131
+ Types for field props and fieldsets as returned by Kirby's `Field->toArray()` and `Fieldset->toArray()`:
132
+
133
+ ```ts
134
+ import type {
135
+ KirbyFieldProps,
136
+ KirbyFieldsetProps,
137
+ KirbyOption,
138
+ KirbyTextFieldProps,
139
+ } from "kirby-types";
140
+
141
+ // Base field props (returned by Field->toArray())
142
+ const field: KirbyFieldProps = {
143
+ name: "title",
144
+ type: "text",
145
+ label: "Title",
146
+ required: true,
147
+ disabled: false,
148
+ hidden: false,
149
+ saveable: true,
150
+ translate: true,
151
+ autofocus: false,
152
+ width: "1/2",
153
+ };
154
+
155
+ // Type-specific field props
156
+ const textField: KirbyTextFieldProps = {
157
+ ...field,
158
+ type: "text",
159
+ counter: true,
160
+ font: "sans-serif",
161
+ spellcheck: false,
162
+ maxlength: 100,
163
+ };
164
+
165
+ // Fieldset (block type definition from Fieldset->toArray())
166
+ const fieldset: KirbyFieldsetProps = {
167
+ disabled: false,
168
+ editable: true,
169
+ icon: "text",
170
+ label: null,
171
+ name: "Heading",
172
+ preview: "fields",
173
+ tabs: {
174
+ content: {
175
+ name: "content",
176
+ label: "Content",
177
+ fields: { text: field },
178
+ },
179
+ },
180
+ translate: true,
181
+ type: "heading",
182
+ unset: false,
183
+ wysiwyg: false,
184
+ };
185
+
186
+ // Option (from Option->render())
187
+ const option: KirbyOption = {
188
+ disabled: false,
189
+ icon: "page",
190
+ info: null,
191
+ text: "Draft",
192
+ value: "draft",
193
+ };
194
+ ```
195
+
128
196
  ### Blocks
129
197
 
130
198
  ```ts
@@ -272,6 +340,30 @@ class Bold {
272
340
  | --------------------------------------- | ------------------------------------- |
273
341
  | [`KirbyApiResponse<T>`](./src/api.d.ts) | Standard Kirby API response structure |
274
342
 
343
+ ### Blueprints
344
+
345
+ | Type | Description |
346
+ | -------------------------------------------------- | ---------------------------------------------- |
347
+ | [`KirbyAnyFieldProps`](./src/blueprint.d.ts) | Union of all field prop types |
348
+ | [`KirbyBlocksFieldProps`](./src/blueprint.d.ts) | Blocks field props with fieldsets |
349
+ | [`KirbyColorFieldProps`](./src/blueprint.d.ts) | Color picker field props |
350
+ | [`KirbyDateFieldProps`](./src/blueprint.d.ts) | Date and time field props |
351
+ | [`KirbyFieldProps`](./src/blueprint.d.ts) | Base field props from `Field->toArray()` |
352
+ | [`KirbyFieldsetProps`](./src/blueprint.d.ts) | Fieldset from `Fieldset->toArray()` |
353
+ | [`KirbyFilesFieldProps`](./src/blueprint.d.ts) | Files/pages/users picker field props |
354
+ | [`KirbyLayoutFieldProps`](./src/blueprint.d.ts) | Layout field props with fieldsets and settings |
355
+ | [`KirbyLinkFieldProps`](./src/blueprint.d.ts) | Link field props |
356
+ | [`KirbyNumberFieldProps`](./src/blueprint.d.ts) | Number field props |
357
+ | [`KirbyObjectFieldProps`](./src/blueprint.d.ts) | Object field props with nested fields |
358
+ | [`KirbyOption`](./src/blueprint.d.ts) | Option from `Option->render()` |
359
+ | [`KirbyOptionsFieldProps`](./src/blueprint.d.ts) | Select/radio/checkboxes/multiselect/toggles |
360
+ | [`KirbyRangeFieldProps`](./src/blueprint.d.ts) | Range slider field props |
361
+ | [`KirbyStructureFieldProps`](./src/blueprint.d.ts) | Structure field props with nested fields |
362
+ | [`KirbyTagsFieldProps`](./src/blueprint.d.ts) | Tags field props |
363
+ | [`KirbyTextFieldProps`](./src/blueprint.d.ts) | Text/textarea field props |
364
+ | [`KirbyToggleFieldProps`](./src/blueprint.d.ts) | Toggle (boolean) field props |
365
+ | [`KirbyWriterFieldProps`](./src/blueprint.d.ts) | Writer (rich text) field props |
366
+
275
367
  ### Blocks
276
368
 
277
369
  | Type | Description |
package/index.d.ts CHANGED
@@ -9,6 +9,28 @@ export type {
9
9
  KirbyDefaultBlockType,
10
10
  } from "./src/blocks";
11
11
 
12
+ // Blueprint types
13
+ export type {
14
+ KirbyAnyFieldProps,
15
+ KirbyBlocksFieldProps,
16
+ KirbyDateFieldProps,
17
+ KirbyFieldProps,
18
+ KirbyFieldsetGroup,
19
+ KirbyFieldsetProps,
20
+ KirbyFieldsetTab,
21
+ KirbyFilesFieldProps,
22
+ KirbyLayoutFieldProps,
23
+ KirbyNumberFieldProps,
24
+ KirbyObjectFieldProps,
25
+ KirbyOption,
26
+ KirbyOptionsFieldProps,
27
+ KirbyStructureColumn,
28
+ KirbyStructureFieldProps,
29
+ KirbyTextFieldProps,
30
+ KirbyToggleFieldProps,
31
+ KirbyWriterFieldProps,
32
+ } from "./src/blueprint";
33
+
12
34
  // KQL types
13
35
  export type {
14
36
  KirbyQueryRequest,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kirby-types",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.3.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,13 +43,14 @@
43
43
  "test": "tsd -f \"test/**/*.test-d.ts\""
44
44
  },
45
45
  "peerDependencies": {
46
- "dayjs": "^1.0.0",
46
+ "dayjs": "^1.11.13",
47
47
  "prosemirror-commands": "^1.7.1",
48
48
  "prosemirror-inputrules": "^1.5.1",
49
49
  "prosemirror-model": "^1.25.4",
50
50
  "prosemirror-schema-list": "^1.5.1",
51
51
  "prosemirror-state": "^1.4.4",
52
- "vue": "^2.7.0"
52
+ "prosemirror-view": "^1.41.4",
53
+ "vue": "^2.7.16"
53
54
  },
54
55
  "peerDependenciesMeta": {
55
56
  "dayjs": {
@@ -70,6 +71,9 @@
70
71
  "prosemirror-state": {
71
72
  "optional": true
72
73
  },
74
+ "prosemirror-view": {
75
+ "optional": true
76
+ },
73
77
  "vue": {
74
78
  "optional": true
75
79
  }