@onderwijsin/nuxt-markdown-renderer 0.3.0 → 0.4.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 +48 -41
- package/dist/metadata/runtime/app/components/renderer/MarkdownAnchor.vue +1 -0
- package/dist/metadata/runtime/app/components/renderer/MarkdownItemList.vue +1 -0
- package/dist/metadata/runtime/shared/types.ts +4 -4
- package/dist/metadata/schema/editor-component-schema.ts +25 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/app/components/renderer/MarkdownAnchor.vue +1 -0
- package/dist/runtime/app/components/renderer/MarkdownButton.d.vue.ts +1 -1
- package/dist/runtime/app/components/renderer/MarkdownButton.vue.d.ts +1 -1
- package/dist/runtime/app/components/renderer/MarkdownItemList.vue +1 -0
- package/dist/runtime/server/utils/component-metadata-handler.d.ts +3 -0
- package/dist/runtime/server/utils/metadata.js +2 -0
- package/dist/runtime/shared/types.d.ts +4 -4
- package/dist/schema/editor-component-schema.d.ts +18 -7
- package/dist/schema/editor-component-schema.js +22 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,14 +67,16 @@ Import the module stylesheet in the consuming application's main CSS file after
|
|
|
67
67
|
|
|
68
68
|
The built-in MDC nodes are:
|
|
69
69
|
|
|
70
|
-
| Markdown node
|
|
71
|
-
|
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `Reference`
|
|
77
|
-
| `RelatedItemList`
|
|
70
|
+
| Markdown node | Vue implementation | Editor label | Behavior |
|
|
71
|
+
| ------------------ | ------------------------- | ------------ | -------------------------------------------- |
|
|
72
|
+
| `MarkdownAnchor` | `MarkdownAnchor` | Anchor | Invisible block target for fragment links. |
|
|
73
|
+
| `MarkdownButton` | `MarkdownButton` | Button | Inline Nuxt UI button or link. |
|
|
74
|
+
| `MarkdownCallout` | `MarkdownCallout` | Callout | Block Nuxt UI alert with editable content. |
|
|
75
|
+
| `MarkdownItemList` | `MarkdownItemList` | Item list | Stacked page cards with optional dividers. |
|
|
76
|
+
| `Reference` | `MarkdownReference` | — | Directus item reference; excluded from menu. |
|
|
77
|
+
| `RelatedItemList` | `MarkdownRelatedItemList` | — | CMS selections rendered as mapped item rows. |
|
|
78
|
+
|
|
79
|
+
The CMS insert menu shows descriptions for Anchor, Button, Callout, and Item list.
|
|
78
80
|
|
|
79
81
|
The built-in button's icon editor metadata uses the `lucide` collection by default. To offer other
|
|
80
82
|
icon collections in component metadata, override the relevant renderer component and define its own
|
|
@@ -112,21 +114,21 @@ CSS after the module stylesheet:
|
|
|
112
114
|
|
|
113
115
|
### Item lists
|
|
114
116
|
|
|
115
|
-
The `
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
The `MarkdownItemList` component wraps Nuxt UI's `UPageList` and ghost `UPageCard` components. It
|
|
118
|
+
accepts a required `items` array and an optional boolean `divide` prop (default `false`). It exposes
|
|
119
|
+
no content slots. All item fields are optional:
|
|
118
120
|
|
|
119
121
|
| Field | Type | Behavior |
|
|
120
122
|
| ------------- | --------- | ------------------------------------------------------------------ |
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `description` | `string` | Supporting text. |
|
|
123
|
+
| `title` | `string` | Title of the list item. |
|
|
124
|
+
| `description` | `string` | Supporting text below the title. |
|
|
124
125
|
| `to` | `string` | Internal path or full URL. Omit to render an unlinked item. |
|
|
125
126
|
| `external` | `boolean` | Opens `to` as an external link in a new tab. Ignored without `to`. |
|
|
127
|
+
| `image` | `string` | Leading image URL. Takes precedence over the icon. |
|
|
126
128
|
| `icon` | `string` | Iconify icon name, used when no image is supplied. |
|
|
127
129
|
|
|
128
130
|
```mdc
|
|
129
|
-
::
|
|
131
|
+
::MarkdownItemList
|
|
130
132
|
---
|
|
131
133
|
divide: true
|
|
132
134
|
items:
|
|
@@ -142,19 +144,22 @@ items:
|
|
|
142
144
|
::
|
|
143
145
|
```
|
|
144
146
|
|
|
145
|
-
Include `
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
Include `MarkdownItemList` in any component set used to render it. The CMS shows item fields in the
|
|
148
|
+
order above, with Image directly above Icon. Editor metadata provides image, URL, and Lucide icon
|
|
149
|
+
controls for the nested fields. The editor keeps `icon` and `external` visible. When rendered, an
|
|
150
|
+
image takes precedence over the icon, and `external` applies only when `to` is set.
|
|
151
|
+
|
|
152
|
+
When upgrading from v0.3.0, rename stored `::ItemList` blocks to `::MarkdownItemList` and update any
|
|
153
|
+
`ItemList` entries in `componentSets` and editor integrations to `MarkdownItemList`.
|
|
149
154
|
|
|
150
155
|
### Related item lists
|
|
151
156
|
|
|
152
157
|
The `RelatedItemList` node is rendered by `MarkdownRelatedItemList`, reusing `MarkdownItemList` to
|
|
153
158
|
render CMS-selected content in its original order. Its only prop is the required `items` array; it
|
|
154
|
-
has no slots or additional display props. Like `MarkdownReference` → `Reference`,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`
|
|
159
|
+
has no slots or additional display props. Like `MarkdownReference` → `Reference`,
|
|
160
|
+
`MarkdownRelatedItemList` keeps its CMS-owned node name `RelatedItemList`. Each selection has a
|
|
161
|
+
required `collection: string` and `item: string | number`, plus optional `label: string` and
|
|
162
|
+
`data: Record<string, unknown>`.
|
|
158
163
|
|
|
159
164
|
```mdc
|
|
160
165
|
::RelatedItemList
|
|
@@ -315,7 +320,7 @@ defineEditorComponentSchema({
|
|
|
315
320
|
description: "A prominent page introduction.",
|
|
316
321
|
type: "block",
|
|
317
322
|
properties: {
|
|
318
|
-
actionTo: { input: "url" },
|
|
323
|
+
actionTo: { label: "Call to action", input: "url" },
|
|
319
324
|
image: { properties: { src: { input: "image" } } },
|
|
320
325
|
actions: {
|
|
321
326
|
items: {
|
|
@@ -366,19 +371,20 @@ For the module's built-in components, metadata inference reads the packaged type
|
|
|
366
371
|
preserves JSDoc, defaults, slots, nested prop structure, and macro tags in installed applications as
|
|
367
372
|
well as the module playground.
|
|
368
373
|
|
|
369
|
-
| Field | Purpose
|
|
370
|
-
| ------------------------------------------------ |
|
|
371
|
-
| `label` | Human-facing label, distinct from the Markdown node name.
|
|
372
|
-
| `description` | Help text shown while choosing a component.
|
|
373
|
-
| `type` | Required insertion behavior: `"block"` or `"inline"`.
|
|
374
|
-
| `deprecated` | `true`, a non-empty guidance string, or `{ text: string }`.
|
|
375
|
-
| `properties.<name>.
|
|
376
|
-
| `properties.<name>.
|
|
377
|
-
| `properties.<name>.
|
|
378
|
-
| `properties.<name>.
|
|
379
|
-
| `properties.<name>.
|
|
380
|
-
| `properties.<name>.
|
|
381
|
-
| `properties.<name>.
|
|
374
|
+
| Field | Purpose |
|
|
375
|
+
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
376
|
+
| `label` | Human-facing label, distinct from the Markdown node name. |
|
|
377
|
+
| `description` | Help text shown while choosing a component. |
|
|
378
|
+
| `type` | Required insertion behavior: `"block"` or `"inline"`. |
|
|
379
|
+
| `deprecated` | `true`, a non-empty guidance string, or `{ text: string }`. |
|
|
380
|
+
| `properties.<name>.label` | Optional display label for the prop in the editor. |
|
|
381
|
+
| `properties.<name>.values` | Explicit choices, particularly for imported union types. |
|
|
382
|
+
| `properties.<name>.input` | `"image"`, `"video"`, or `"url"` as shorthand or in an object such as `{ type: "video" }`. Icon uses `{ type: "icon", collections: [...] }`. |
|
|
383
|
+
| `properties.<name>.properties` | Overrides for fields of an inferred object prop. |
|
|
384
|
+
| `properties.<name>.items` | Overrides for the inferred item of an array prop. |
|
|
385
|
+
| `properties.<name>.deprecated` | `true`, a non-empty guidance string, or `{ text: string }`. |
|
|
386
|
+
| `properties.<name>.type` | Explicit `string`, `number`, `boolean`, `object`, or `array` editor type. |
|
|
387
|
+
| `properties.<name>.description/default/required` | Overrides the corresponding inferred metadata. |
|
|
382
388
|
|
|
383
389
|
The macro translates `input` and `deprecated` to the standard tags consumed by the Directus
|
|
384
390
|
extension. Special inputs use a `specialInputType` tag; icon collections appear as
|
|
@@ -387,12 +393,13 @@ no options. Only fields declared by the input's Zod config schema are accepted a
|
|
|
387
393
|
tag's `config` object. The lower-level `extendComponentMeta` macro remains available for metadata
|
|
388
394
|
not covered by this convenience API. Invalid macro fields, including misspelled nested fields or
|
|
389
395
|
unsupported input controls, produce a build warning with the failing property path; that component's
|
|
390
|
-
editor overrides are ignored until the schema is corrected. The `image`, `url`, and `icon`
|
|
391
|
-
require an inferred string prop, including at nested paths. An incompatible inferred type
|
|
392
|
-
metadata endpoint to report the component and property path as a validation error.
|
|
396
|
+
editor overrides are ignored until the schema is corrected. The `image`, `video`, `url`, and `icon`
|
|
397
|
+
inputs require an inferred string prop, including at nested paths. An incompatible inferred type
|
|
398
|
+
causes the metadata endpoint to report the component and property path as a validation error.
|
|
393
399
|
|
|
394
400
|
Use `properties` at the top level of `defineEditorComponentSchema` and for nested object fields. The
|
|
395
|
-
|
|
401
|
+
metadata endpoint returns the fields under `props`, keyed by their Vue names. Each field carries an
|
|
402
|
+
optional `label` when one is supplied.
|
|
396
403
|
|
|
397
404
|
### Component sets
|
|
398
405
|
|
|
@@ -12,9 +12,7 @@ export interface RelatedItem {
|
|
|
12
12
|
|
|
13
13
|
/** Display fields shared by the item-list components. */
|
|
14
14
|
export interface ItemListItem {
|
|
15
|
-
/**
|
|
16
|
-
image?: string;
|
|
17
|
-
/** Item title. */
|
|
15
|
+
/** title of the list item */
|
|
18
16
|
title?: string;
|
|
19
17
|
/** Supporting text below the title. */
|
|
20
18
|
description?: string;
|
|
@@ -22,7 +20,9 @@ export interface ItemListItem {
|
|
|
22
20
|
to?: string;
|
|
23
21
|
/** Whether to open the destination as an external link in a new tab. */
|
|
24
22
|
external?: boolean;
|
|
25
|
-
/**
|
|
23
|
+
/** Image that is leading the list item. */
|
|
24
|
+
image?: string;
|
|
25
|
+
/** Icon that is displayed when no image is provided. */
|
|
26
26
|
icon?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -19,7 +19,7 @@ const description = z.string().optional();
|
|
|
19
19
|
const defaultValue = z.unknown().optional();
|
|
20
20
|
/** Whether the editor requires a prop or nested property. */
|
|
21
21
|
const required = z.boolean().optional();
|
|
22
|
-
/** Human-readable
|
|
22
|
+
/** Human-readable label supplied by the macro. */
|
|
23
23
|
const label = z.string();
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -57,11 +57,19 @@ const urlInput = defineSpecialInput({
|
|
|
57
57
|
propertyType: "string",
|
|
58
58
|
config: z.strictObject({})
|
|
59
59
|
});
|
|
60
|
+
|
|
61
|
+
const mediaInputConfig = z.strictObject({});
|
|
60
62
|
/** Image editor control, with optional empty configuration. */
|
|
61
63
|
const imageInput = defineSpecialInput({
|
|
62
64
|
inputType: "image",
|
|
63
65
|
propertyType: "string",
|
|
64
|
-
config:
|
|
66
|
+
config: mediaInputConfig
|
|
67
|
+
});
|
|
68
|
+
/** Video editor control, with the same configuration as the image control. */
|
|
69
|
+
const videoInput = defineSpecialInput({
|
|
70
|
+
inputType: "video",
|
|
71
|
+
propertyType: "string",
|
|
72
|
+
config: mediaInputConfig
|
|
65
73
|
});
|
|
66
74
|
/** Icon editor control, requiring at least one Iconify collection. */
|
|
67
75
|
const iconInput = defineSpecialInput({
|
|
@@ -77,11 +85,17 @@ const iconInput = defineSpecialInput({
|
|
|
77
85
|
export const specialInputs = z.discriminatedUnion("inputType", [
|
|
78
86
|
urlInput.endpoint,
|
|
79
87
|
imageInput.endpoint,
|
|
88
|
+
videoInput.endpoint,
|
|
80
89
|
iconInput.endpoint
|
|
81
90
|
]);
|
|
82
91
|
|
|
83
92
|
/** Accepted macro input names, derived from the special-input definitions. */
|
|
84
|
-
export const SpecialInputNameSchema = z.union([
|
|
93
|
+
export const SpecialInputNameSchema = z.union([
|
|
94
|
+
urlInput.name,
|
|
95
|
+
imageInput.name,
|
|
96
|
+
videoInput.name,
|
|
97
|
+
iconInput.name
|
|
98
|
+
]);
|
|
85
99
|
|
|
86
100
|
/**
|
|
87
101
|
* Macro syntax for controls. Every control accepts an object form; controls without required
|
|
@@ -90,8 +104,14 @@ export const SpecialInputNameSchema = z.union([urlInput.name, imageInput.name, i
|
|
|
90
104
|
export const SpecialInputMacroSchema = z.union([
|
|
91
105
|
urlInput.shorthand,
|
|
92
106
|
imageInput.shorthand,
|
|
107
|
+
videoInput.shorthand,
|
|
93
108
|
iconInput.shorthand,
|
|
94
|
-
z.discriminatedUnion("type", [
|
|
109
|
+
z.discriminatedUnion("type", [
|
|
110
|
+
urlInput.macro,
|
|
111
|
+
imageInput.macro,
|
|
112
|
+
videoInput.macro,
|
|
113
|
+
iconInput.macro
|
|
114
|
+
])
|
|
95
115
|
]);
|
|
96
116
|
|
|
97
117
|
/** Tag name used by the endpoint to identify a validated special editor input. */
|
|
@@ -110,6 +130,7 @@ const deprecation = z.union([z.boolean(), z.object({ text: z.string() }), z.stri
|
|
|
110
130
|
|
|
111
131
|
/** Non-recursive property overrides accepted by the authoring macro. */
|
|
112
132
|
const inputFields = z.strictObject({
|
|
133
|
+
label: label.optional(),
|
|
113
134
|
values: choices.optional(),
|
|
114
135
|
input: SpecialInputMacroSchema.optional(),
|
|
115
136
|
deprecated: deprecation.optional(),
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -6,12 +6,11 @@ import { isRecord, isString, fromEntries, toEntries } from '@onderwijsin/nuxt-mo
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { EditorComponentInputSchema, EditorComponentEnrichmentSchema, SPECIAL_INPUT_TAG_NAME } from '../dist/schema/editor-component-schema.js';
|
|
8
8
|
|
|
9
|
-
const version = "0.
|
|
9
|
+
const version = "0.4.0";
|
|
10
10
|
|
|
11
11
|
function resolveRendererNodeName(filePath) {
|
|
12
12
|
const fileName = basename(filePath, extname(filePath));
|
|
13
13
|
if (fileName === "MarkdownReference") return "Reference";
|
|
14
|
-
if (fileName === "MarkdownItemList") return "ItemList";
|
|
15
14
|
if (fileName === "MarkdownRelatedItemList") return "RelatedItemList";
|
|
16
15
|
return fileName;
|
|
17
16
|
}
|
|
@@ -20,7 +20,7 @@ type __VLS_Props = {
|
|
|
20
20
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
21
|
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
22
22
|
color: "success" | "error" | "primary" | "secondary" | "info" | "warning" | "neutral";
|
|
23
|
-
variant: "link" | "
|
|
23
|
+
variant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: typeof __VLS_export;
|
|
26
26
|
export default _default;
|
|
@@ -20,7 +20,7 @@ type __VLS_Props = {
|
|
|
20
20
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
21
|
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
22
22
|
color: "success" | "error" | "primary" | "secondary" | "info" | "warning" | "neutral";
|
|
23
|
-
variant: "link" | "
|
|
23
|
+
variant: "link" | "solid" | "outline" | "soft" | "subtle" | "ghost";
|
|
24
24
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
25
|
declare const _default: typeof __VLS_export;
|
|
26
26
|
export default _default;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { defineEditorComponentSchema } from "../../utils/define-editor-component-schema";
|
|
3
3
|
defineEditorComponentSchema({
|
|
4
4
|
label: "Item list",
|
|
5
|
+
description: "Display a vertical list of cards with optional images, icons, and links.",
|
|
5
6
|
type: "block",
|
|
6
7
|
properties: {
|
|
7
8
|
items: {
|
|
@@ -15,6 +15,7 @@ export declare function createComponentMetadataHandler(componentMeta: unknown, r
|
|
|
15
15
|
description?: string | undefined;
|
|
16
16
|
values?: string[] | undefined;
|
|
17
17
|
default?: unknown;
|
|
18
|
+
label?: string | undefined;
|
|
18
19
|
required?: boolean | undefined;
|
|
19
20
|
tags?: {
|
|
20
21
|
name: string;
|
|
@@ -28,6 +29,7 @@ export declare function createComponentMetadataHandler(componentMeta: unknown, r
|
|
|
28
29
|
description?: string | undefined;
|
|
29
30
|
values?: string[] | undefined;
|
|
30
31
|
default?: unknown;
|
|
32
|
+
label?: string | undefined;
|
|
31
33
|
required?: boolean | undefined;
|
|
32
34
|
tags?: {
|
|
33
35
|
name: string;
|
|
@@ -41,6 +43,7 @@ export declare function createComponentMetadataHandler(componentMeta: unknown, r
|
|
|
41
43
|
description?: string | undefined;
|
|
42
44
|
values?: string[] | undefined;
|
|
43
45
|
default?: unknown;
|
|
46
|
+
label?: string | undefined;
|
|
44
47
|
required?: boolean | undefined;
|
|
45
48
|
tags?: {
|
|
46
49
|
name: string;
|
|
@@ -99,6 +99,7 @@ function transformProperty(value, custom, fallbackName, path) {
|
|
|
99
99
|
if (!isRecord(value)) return void 0;
|
|
100
100
|
const name = isString(value.name) ? value.name : fallbackName;
|
|
101
101
|
if (!name) return void 0;
|
|
102
|
+
const label = custom?.label;
|
|
102
103
|
const description = custom?.description ?? value.description;
|
|
103
104
|
const values = custom?.values ?? resolveSchemaValues(value.schema);
|
|
104
105
|
const inferredType = resolveEditorType(value.type);
|
|
@@ -121,6 +122,7 @@ function transformProperty(value, custom, fallbackName, path) {
|
|
|
121
122
|
const required = custom?.required === true || custom?.required !== false && value.required === true;
|
|
122
123
|
return {
|
|
123
124
|
name,
|
|
125
|
+
...isDefined(label) ? { label } : {},
|
|
124
126
|
type,
|
|
125
127
|
...structure?.properties ? { properties: structure.properties } : {},
|
|
126
128
|
...structure?.items ? { items: structure.items } : {},
|
|
@@ -11,9 +11,7 @@ export interface RelatedItem {
|
|
|
11
11
|
}
|
|
12
12
|
/** Display fields shared by the item-list components. */
|
|
13
13
|
export interface ItemListItem {
|
|
14
|
-
/**
|
|
15
|
-
image?: string;
|
|
16
|
-
/** Item title. */
|
|
14
|
+
/** title of the list item */
|
|
17
15
|
title?: string;
|
|
18
16
|
/** Supporting text below the title. */
|
|
19
17
|
description?: string;
|
|
@@ -21,7 +19,9 @@ export interface ItemListItem {
|
|
|
21
19
|
to?: string;
|
|
22
20
|
/** Whether to open the destination as an external link in a new tab. */
|
|
23
21
|
external?: boolean;
|
|
24
|
-
/**
|
|
22
|
+
/** Image that is leading the list item. */
|
|
23
|
+
image?: string;
|
|
24
|
+
/** Icon that is displayed when no image is provided. */
|
|
25
25
|
icon?: string;
|
|
26
26
|
}
|
|
27
27
|
/** Maps a CMS selection to display fields; the title defaults to the source label. */
|
|
@@ -11,6 +11,10 @@ export declare const specialInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
11
11
|
inputType: z.ZodLiteral<"image">;
|
|
12
12
|
propertyType: z.ZodLiteral<"string">;
|
|
13
13
|
config: z.ZodObject<{}, z.core.$strip> | z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
inputType: z.ZodLiteral<"video">;
|
|
16
|
+
propertyType: z.ZodLiteral<"string">;
|
|
17
|
+
config: z.ZodObject<{}, z.core.$strip> | z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
14
18
|
}, z.core.$strip>, z.ZodObject<{
|
|
15
19
|
inputType: z.ZodLiteral<"icon">;
|
|
16
20
|
propertyType: z.ZodLiteral<"string">;
|
|
@@ -21,15 +25,17 @@ export declare const specialInputs: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
21
25
|
}, z.core.$strip>>;
|
|
22
26
|
}, z.core.$strip>], "inputType">;
|
|
23
27
|
/** Accepted macro input names, derived from the special-input definitions. */
|
|
24
|
-
export declare const SpecialInputNameSchema: z.ZodUnion<readonly [z.ZodLiteral<"url">, z.ZodLiteral<"image">, z.ZodLiteral<"icon">]>;
|
|
28
|
+
export declare const SpecialInputNameSchema: z.ZodUnion<readonly [z.ZodLiteral<"url">, z.ZodLiteral<"image">, z.ZodLiteral<"video">, z.ZodLiteral<"icon">]>;
|
|
25
29
|
/**
|
|
26
30
|
* Macro syntax for controls. Every control accepts an object form; controls without required
|
|
27
31
|
* configuration also accept their name as shorthand.
|
|
28
32
|
*/
|
|
29
|
-
export declare const SpecialInputMacroSchema: z.ZodUnion<readonly [z.ZodCustom<"url", "url">, z.ZodCustom<"image", "image">, z.ZodCustom<never, never>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
export declare const SpecialInputMacroSchema: z.ZodUnion<readonly [z.ZodCustom<"url", "url">, z.ZodCustom<"image", "image">, z.ZodCustom<"video", "video">, z.ZodCustom<never, never>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
34
|
type: z.ZodLiteral<"url">;
|
|
31
35
|
}, z.core.$strict>, z.ZodObject<{
|
|
32
36
|
type: z.ZodLiteral<"image">;
|
|
37
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"video">;
|
|
33
39
|
}, z.core.$strict>, z.ZodObject<{
|
|
34
40
|
type: z.ZodLiteral<"icon">;
|
|
35
41
|
collections: z.ZodArray<z.ZodString>;
|
|
@@ -44,11 +50,14 @@ export declare const EditorTagSchema: z.ZodObject<{
|
|
|
44
50
|
}, z.core.$strip>;
|
|
45
51
|
/** Non-recursive property overrides accepted by the authoring macro. */
|
|
46
52
|
declare const inputFields: z.ZodObject<{
|
|
53
|
+
label: z.ZodOptional<z.ZodString>;
|
|
47
54
|
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
-
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<"url", "url">, z.ZodCustom<"image", "image">, z.ZodCustom<never, never>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
|
+
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<"url", "url">, z.ZodCustom<"image", "image">, z.ZodCustom<"video", "video">, z.ZodCustom<never, never>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
56
|
type: z.ZodLiteral<"url">;
|
|
50
57
|
}, z.core.$strict>, z.ZodObject<{
|
|
51
58
|
type: z.ZodLiteral<"image">;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"video">;
|
|
52
61
|
}, z.core.$strict>, z.ZodObject<{
|
|
53
62
|
type: z.ZodLiteral<"icon">;
|
|
54
63
|
collections: z.ZodArray<z.ZodString>;
|
|
@@ -103,6 +112,7 @@ declare const enrichmentFields: z.ZodObject<{
|
|
|
103
112
|
array: "array";
|
|
104
113
|
}>>;
|
|
105
114
|
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
+
label: z.ZodOptional<z.ZodString>;
|
|
106
116
|
description: z.ZodOptional<z.ZodString>;
|
|
107
117
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
108
118
|
}, z.core.$strip>;
|
|
@@ -125,8 +135,8 @@ export declare const EditorComponentEnrichmentSchema: z.ZodObject<{
|
|
|
125
135
|
text: z.ZodOptional<z.ZodString>;
|
|
126
136
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
127
137
|
}, z.core.$strip>>>;
|
|
128
|
-
description: z.ZodOptional<z.ZodString>;
|
|
129
138
|
label: z.ZodString;
|
|
139
|
+
description: z.ZodOptional<z.ZodString>;
|
|
130
140
|
}, z.core.$strip>;
|
|
131
141
|
/** Partial namespaced enrichment allowed for direct `extendComponentMeta` usage. */
|
|
132
142
|
export declare const EditorComponentPartialEnrichmentSchema: z.ZodObject<{
|
|
@@ -140,8 +150,8 @@ export declare const EditorComponentPartialEnrichmentSchema: z.ZodObject<{
|
|
|
140
150
|
text: z.ZodOptional<z.ZodString>;
|
|
141
151
|
config: z.ZodOptional<z.ZodUnknown>;
|
|
142
152
|
}, z.core.$strip>>>>;
|
|
143
|
-
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
144
153
|
label: z.ZodOptional<z.ZodString>;
|
|
154
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
145
155
|
}, z.core.$strip>;
|
|
146
156
|
/** Editor property fields after inference supplies a required name and type. */
|
|
147
157
|
declare const outputFields: z.ZodObject<{
|
|
@@ -155,6 +165,7 @@ declare const outputFields: z.ZodObject<{
|
|
|
155
165
|
}>;
|
|
156
166
|
default: z.ZodOptional<z.ZodUnknown>;
|
|
157
167
|
values: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
|
+
label: z.ZodOptional<z.ZodString>;
|
|
158
169
|
description: z.ZodOptional<z.ZodString>;
|
|
159
170
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
160
171
|
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -175,8 +186,8 @@ export declare const EditorComponentOutputSchema: z.ZodObject<{
|
|
|
175
186
|
name: z.ZodString;
|
|
176
187
|
props: z.ZodRecord<z.ZodString, z.ZodType<RecursiveOutput, unknown, z.core.$ZodTypeInternals<RecursiveOutput, unknown>>>;
|
|
177
188
|
slots: z.ZodArray<z.ZodString>;
|
|
178
|
-
description: z.ZodOptional<z.ZodString>;
|
|
179
189
|
label: z.ZodString;
|
|
190
|
+
description: z.ZodOptional<z.ZodString>;
|
|
180
191
|
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
192
|
name: z.ZodString;
|
|
182
193
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -192,8 +203,8 @@ export declare const EditorComponentResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
192
203
|
name: z.ZodString;
|
|
193
204
|
props: z.ZodRecord<z.ZodString, z.ZodType<RecursiveOutput, unknown, z.core.$ZodTypeInternals<RecursiveOutput, unknown>>>;
|
|
194
205
|
slots: z.ZodArray<z.ZodString>;
|
|
195
|
-
description: z.ZodOptional<z.ZodString>;
|
|
196
206
|
label: z.ZodString;
|
|
207
|
+
description: z.ZodOptional<z.ZodString>;
|
|
197
208
|
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
198
209
|
name: z.ZodString;
|
|
199
210
|
text: z.ZodOptional<z.ZodString>;
|
|
@@ -29,10 +29,16 @@ const urlInput = defineSpecialInput({
|
|
|
29
29
|
propertyType: "string",
|
|
30
30
|
config: z.strictObject({})
|
|
31
31
|
});
|
|
32
|
+
const mediaInputConfig = z.strictObject({});
|
|
32
33
|
const imageInput = defineSpecialInput({
|
|
33
34
|
inputType: "image",
|
|
34
35
|
propertyType: "string",
|
|
35
|
-
config:
|
|
36
|
+
config: mediaInputConfig
|
|
37
|
+
});
|
|
38
|
+
const videoInput = defineSpecialInput({
|
|
39
|
+
inputType: "video",
|
|
40
|
+
propertyType: "string",
|
|
41
|
+
config: mediaInputConfig
|
|
36
42
|
});
|
|
37
43
|
const iconInput = defineSpecialInput({
|
|
38
44
|
inputType: "icon",
|
|
@@ -42,14 +48,26 @@ const iconInput = defineSpecialInput({
|
|
|
42
48
|
export const specialInputs = z.discriminatedUnion("inputType", [
|
|
43
49
|
urlInput.endpoint,
|
|
44
50
|
imageInput.endpoint,
|
|
51
|
+
videoInput.endpoint,
|
|
45
52
|
iconInput.endpoint
|
|
46
53
|
]);
|
|
47
|
-
export const SpecialInputNameSchema = z.union([
|
|
54
|
+
export const SpecialInputNameSchema = z.union([
|
|
55
|
+
urlInput.name,
|
|
56
|
+
imageInput.name,
|
|
57
|
+
videoInput.name,
|
|
58
|
+
iconInput.name
|
|
59
|
+
]);
|
|
48
60
|
export const SpecialInputMacroSchema = z.union([
|
|
49
61
|
urlInput.shorthand,
|
|
50
62
|
imageInput.shorthand,
|
|
63
|
+
videoInput.shorthand,
|
|
51
64
|
iconInput.shorthand,
|
|
52
|
-
z.discriminatedUnion("type", [
|
|
65
|
+
z.discriminatedUnion("type", [
|
|
66
|
+
urlInput.macro,
|
|
67
|
+
imageInput.macro,
|
|
68
|
+
videoInput.macro,
|
|
69
|
+
iconInput.macro
|
|
70
|
+
])
|
|
53
71
|
]);
|
|
54
72
|
export const SPECIAL_INPUT_TAG_NAME = "specialInputType";
|
|
55
73
|
export const EditorTagSchema = z.object({
|
|
@@ -60,6 +78,7 @@ export const EditorTagSchema = z.object({
|
|
|
60
78
|
const tags = z.array(EditorTagSchema).optional();
|
|
61
79
|
const deprecation = z.union([z.boolean(), z.object({ text: z.string() }), z.string().min(1)]);
|
|
62
80
|
const inputFields = z.strictObject({
|
|
81
|
+
label: label.optional(),
|
|
63
82
|
values: choices.optional(),
|
|
64
83
|
input: SpecialInputMacroSchema.optional(),
|
|
65
84
|
deprecated: deprecation.optional(),
|