dune-react 0.0.32 → 0.0.34
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/dist/components/puck-block/footer-sections/centered-minimal-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/centered-minimal-footer/index.js +1 -0
- package/dist/components/puck-block/footer-sections/compact-newsletter-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/contact-links-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/contact-links-footer/index.js +1 -1
- package/dist/components/puck-block/footer-sections/cta-links-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/cta-links-footer/index.js +1 -1
- package/dist/components/puck-block/footer-sections/links-newsletter-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/newsletter-links-footer/index.d.ts +11 -0
- package/dist/components/puck-block/footer-sections/newsletter-top-links-footer/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/centered-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/centered-navbar/index.js +1 -0
- package/dist/components/puck-block/header-sections/drawer-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/drawer-navbar/index.js +1 -1
- package/dist/components/puck-block/header-sections/floating-bordered-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/floating-bordered-navbar/index.js +1 -1
- package/dist/components/puck-block/header-sections/fullscreen-overlay-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/fullscreen-overlay-navbar/index.js +1 -1
- package/dist/components/puck-block/header-sections/mega-menu-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/mega-menu-navbar/index.js +1 -1
- package/dist/components/puck-block/header-sections/standard-navbar/index.d.ts +11 -0
- package/dist/components/puck-block/header-sections/standard-navbar/index.js +1 -0
- package/dist/components/puck-block/hero-sections/tab-hero/component.js +1 -0
- package/dist/components/puck-block/hero-sections/tab-hero/index.d.ts +3 -6
- package/dist/components/puck-block/hero-sections/tab-hero/index.js +2 -7
- package/dist/components/puck-block/pricing-sections/pricing-comparison-table/component.js +13 -0
- package/dist/components/puck-block/pricing-sections/split-pricing/component.js +2 -1
- package/dist/components/puck-block/registry.generated.d.ts +102 -6
- package/dist/components/puck-core/core/props/index.js +0 -7
- package/dist/components/puck-core/core/puck-fields-to-zod.d.ts +40 -0
- package/dist/components/puck-core/core/puck-fields-to-zod.js +113 -0
- package/dist/components/puck-core/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js +44 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js +43 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js +29 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js +665 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js +569 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js +410 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +74 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js +37 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +72 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js +314 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +95 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js +81 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js +51 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js +1345 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js +362 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +430 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js +8 -0
- package/package.json +11 -6
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
type PuckFieldOption = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
type PuckField = {
|
|
7
|
+
type: string;
|
|
8
|
+
options?: PuckFieldOption[];
|
|
9
|
+
objectFields?: Record<string, PuckField>;
|
|
10
|
+
arrayFields?: Record<string, PuckField>;
|
|
11
|
+
max?: number;
|
|
12
|
+
ai?: {
|
|
13
|
+
instructions?: string;
|
|
14
|
+
exclude?: boolean;
|
|
15
|
+
stream?: boolean;
|
|
16
|
+
};
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Registry for custom field schemas.
|
|
21
|
+
* Key: custom field render component name or identifier.
|
|
22
|
+
* Value: Zod schema for that field.
|
|
23
|
+
*
|
|
24
|
+
* Pre-registered:
|
|
25
|
+
* - IconPickerField → string (icon name)
|
|
26
|
+
* - ActionField → Action object
|
|
27
|
+
* - MediaUploadField → string (URL)
|
|
28
|
+
* - LocationField → MapLocation object
|
|
29
|
+
*/
|
|
30
|
+
export declare const customSchemaRegistry: Map<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a Puck component's `fields` config into a Zod schema at runtime.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const schema = puckFieldsToZod(conf.fields);
|
|
36
|
+
* // Use with AI structured output:
|
|
37
|
+
* const result = schema.parse(aiOutput);
|
|
38
|
+
*/
|
|
39
|
+
export declare function puckFieldsToZod(fields: Record<string, PuckField>): z.ZodObject<Record<string, z.ZodType>>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { object, string, enum as _enum, number, array, record, any, unknown } from "../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
|
|
2
|
+
const actionTypeValues = [
|
|
3
|
+
"page",
|
|
4
|
+
"external",
|
|
5
|
+
"scroll",
|
|
6
|
+
"email",
|
|
7
|
+
"phone",
|
|
8
|
+
"section",
|
|
9
|
+
"download",
|
|
10
|
+
"none"
|
|
11
|
+
];
|
|
12
|
+
const actionSchema = object({
|
|
13
|
+
type: _enum(actionTypeValues).optional(),
|
|
14
|
+
pageUrl: string().optional(),
|
|
15
|
+
externalUrl: string().optional(),
|
|
16
|
+
openInNewTab: string().optional(),
|
|
17
|
+
email: string().optional(),
|
|
18
|
+
subject: string().optional(),
|
|
19
|
+
phone: string().optional(),
|
|
20
|
+
sectionId: string().optional(),
|
|
21
|
+
downloadUrl: string().optional()
|
|
22
|
+
}).optional();
|
|
23
|
+
const iconSchema = string().optional();
|
|
24
|
+
const mediaUploadSchema = string().optional();
|
|
25
|
+
const locationSchema = object({
|
|
26
|
+
address: string(),
|
|
27
|
+
lat: number(),
|
|
28
|
+
lng: number(),
|
|
29
|
+
zoom: number().optional(),
|
|
30
|
+
placeId: string().optional()
|
|
31
|
+
}).optional();
|
|
32
|
+
const customSchemaRegistry = /* @__PURE__ */ new Map([
|
|
33
|
+
["IconPickerField", iconSchema],
|
|
34
|
+
["ActionField", actionSchema],
|
|
35
|
+
["MediaUploadField", mediaUploadSchema],
|
|
36
|
+
["LocationField", locationSchema]
|
|
37
|
+
]);
|
|
38
|
+
function resolveCustomField(field) {
|
|
39
|
+
const render = field.render;
|
|
40
|
+
const name = render == null ? void 0 : render.name;
|
|
41
|
+
if (name && customSchemaRegistry.has(name)) {
|
|
42
|
+
return customSchemaRegistry.get(name);
|
|
43
|
+
}
|
|
44
|
+
return any();
|
|
45
|
+
}
|
|
46
|
+
function withDescribe(schema, field) {
|
|
47
|
+
var _a;
|
|
48
|
+
const desc = (_a = field.ai) == null ? void 0 : _a.instructions;
|
|
49
|
+
return desc ? schema.describe(desc) : schema;
|
|
50
|
+
}
|
|
51
|
+
function puckFieldToZod(field) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
let schema;
|
|
54
|
+
switch (field.type) {
|
|
55
|
+
case "text":
|
|
56
|
+
case "textarea":
|
|
57
|
+
schema = string().optional();
|
|
58
|
+
break;
|
|
59
|
+
case "select":
|
|
60
|
+
case "radio": {
|
|
61
|
+
const values = (field.options ?? []).map((o) => o.value);
|
|
62
|
+
schema = values.length === 0 ? string().optional() : _enum(values).optional();
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "object": {
|
|
66
|
+
if (!field.objectFields || Object.keys(field.objectFields).length === 0) {
|
|
67
|
+
schema = record(string(), unknown()).optional();
|
|
68
|
+
} else {
|
|
69
|
+
const shape = {};
|
|
70
|
+
for (const [k, v] of Object.entries(field.objectFields)) {
|
|
71
|
+
if ((_a = v.ai) == null ? void 0 : _a.exclude) continue;
|
|
72
|
+
shape[k] = puckFieldToZod(v);
|
|
73
|
+
}
|
|
74
|
+
schema = object(shape).optional();
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case "array": {
|
|
79
|
+
if (!field.arrayFields || Object.keys(field.arrayFields).length === 0) {
|
|
80
|
+
schema = array(unknown()).optional();
|
|
81
|
+
} else {
|
|
82
|
+
const itemShape = {};
|
|
83
|
+
for (const [k, v] of Object.entries(field.arrayFields)) {
|
|
84
|
+
if ((_b = v.ai) == null ? void 0 : _b.exclude) continue;
|
|
85
|
+
itemShape[k] = puckFieldToZod(v);
|
|
86
|
+
}
|
|
87
|
+
let arraySchema = array(object(itemShape));
|
|
88
|
+
if (field.max) arraySchema = arraySchema.max(field.max);
|
|
89
|
+
schema = arraySchema.optional();
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "custom":
|
|
94
|
+
schema = resolveCustomField(field);
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
schema = any();
|
|
98
|
+
}
|
|
99
|
+
return withDescribe(schema, field);
|
|
100
|
+
}
|
|
101
|
+
function puckFieldsToZod(fields) {
|
|
102
|
+
var _a;
|
|
103
|
+
const shape = {};
|
|
104
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
105
|
+
if ((_a = field.ai) == null ? void 0 : _a.exclude) continue;
|
|
106
|
+
shape[key] = puckFieldToZod(field);
|
|
107
|
+
}
|
|
108
|
+
return object(shape);
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
customSchemaRegistry,
|
|
112
|
+
puckFieldsToZod
|
|
113
|
+
};
|
|
@@ -3,6 +3,7 @@ export { ActionField, ACTION_TYPE_FIELD_MAP, ACTION_TYPE_OPTIONS, PageActionFiel
|
|
|
3
3
|
export { type IconName, type Feature, type ActionType, type Action, resolveActionUrl, } from "./core/types";
|
|
4
4
|
export { withEditable } from "./core/with-editable";
|
|
5
5
|
export { findComponentById, getRandomAdjective } from "./core/utils";
|
|
6
|
+
export { puckFieldsToZod, customSchemaRegistry } from "./core/puck-fields-to-zod";
|
|
6
7
|
export { ErrorBoundary } from "./error-boundary";
|
|
7
8
|
export { InlineEditable } from "./inline-editable";
|
|
8
9
|
export { usePuckDispatch, usePuckAppState, usePuckHistory, usePuckConfig, usePuckGetSelectorForId, type PuckComponentInfo, } from "./core/hooks";
|
package/dist/index.js
CHANGED
|
@@ -202,6 +202,7 @@ import { buildComponents, categories, confMap, getComponentDefaultProps, section
|
|
|
202
202
|
import { cardField, cardsField, descriptionField, featuresField, headingField } from "./components/puck-core/core/props/content.js";
|
|
203
203
|
import { cn, liquidGlass } from "./utils/css-utils.js";
|
|
204
204
|
import { contentFields, contentFieldsWithFeatures } from "./components/puck-core/core/props/index.js";
|
|
205
|
+
import { customSchemaRegistry, puckFieldsToZod } from "./components/puck-core/core/puck-fields-to-zod.js";
|
|
205
206
|
import { downloadImage, downloadImageClient, fetchHasOnlineFile, getBase64Client, isValidFileSize, isValidFileType } from "./utils/utils-image.js";
|
|
206
207
|
import { formFieldField, formFieldDefaults, formField, formDefaults } from "./components/puck-core/core/props/form.js";
|
|
207
208
|
import { filterEmptyValues } from "./utils/utils-common.js";
|
|
@@ -700,6 +701,7 @@ export {
|
|
|
700
701
|
contentFields,
|
|
701
702
|
contentFieldsWithFeatures,
|
|
702
703
|
convertBase64ToBlob,
|
|
704
|
+
customSchemaRegistry,
|
|
703
705
|
descriptionField as description,
|
|
704
706
|
downloadImage,
|
|
705
707
|
downloadImageClient,
|
|
@@ -738,6 +740,7 @@ export {
|
|
|
738
740
|
padding,
|
|
739
741
|
paddingDefaults,
|
|
740
742
|
paddingLevel,
|
|
743
|
+
puckFieldsToZod,
|
|
741
744
|
resolveActionUrl,
|
|
742
745
|
sectionOverlay,
|
|
743
746
|
sectionStyle,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { $constructor } from "../core/core.js";
|
|
2
|
+
import { $ZodError, flattenError, formatError } from "../core/errors.js";
|
|
3
|
+
import { jsonStringifyReplacer } from "../core/util.js";
|
|
4
|
+
import "../core/registries.js";
|
|
5
|
+
const initializer = (inst, issues) => {
|
|
6
|
+
$ZodError.init(inst, issues);
|
|
7
|
+
inst.name = "ZodError";
|
|
8
|
+
Object.defineProperties(inst, {
|
|
9
|
+
format: {
|
|
10
|
+
value: (mapper) => formatError(inst, mapper)
|
|
11
|
+
// enumerable: false,
|
|
12
|
+
},
|
|
13
|
+
flatten: {
|
|
14
|
+
value: (mapper) => flattenError(inst, mapper)
|
|
15
|
+
// enumerable: false,
|
|
16
|
+
},
|
|
17
|
+
addIssue: {
|
|
18
|
+
value: (issue) => {
|
|
19
|
+
inst.issues.push(issue);
|
|
20
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
21
|
+
}
|
|
22
|
+
// enumerable: false,
|
|
23
|
+
},
|
|
24
|
+
addIssues: {
|
|
25
|
+
value: (issues2) => {
|
|
26
|
+
inst.issues.push(...issues2);
|
|
27
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
28
|
+
}
|
|
29
|
+
// enumerable: false,
|
|
30
|
+
},
|
|
31
|
+
isEmpty: {
|
|
32
|
+
get() {
|
|
33
|
+
return inst.issues.length === 0;
|
|
34
|
+
}
|
|
35
|
+
// enumerable: false,
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
const ZodRealError = $constructor("ZodError", initializer, {
|
|
40
|
+
Parent: Error
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
ZodRealError
|
|
44
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { $constructor } from "../core/core.js";
|
|
2
|
+
import { $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration } from "../core/schemas.js";
|
|
3
|
+
import "../core/registries.js";
|
|
4
|
+
import { _isoDateTime, _isoDate, _isoTime, _isoDuration } from "../core/api.js";
|
|
5
|
+
import { ZodStringFormat } from "./schemas.js";
|
|
6
|
+
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
7
|
+
$ZodISODateTime.init(inst, def);
|
|
8
|
+
ZodStringFormat.init(inst, def);
|
|
9
|
+
});
|
|
10
|
+
function datetime(params) {
|
|
11
|
+
return _isoDateTime(ZodISODateTime, params);
|
|
12
|
+
}
|
|
13
|
+
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
14
|
+
$ZodISODate.init(inst, def);
|
|
15
|
+
ZodStringFormat.init(inst, def);
|
|
16
|
+
});
|
|
17
|
+
function date(params) {
|
|
18
|
+
return _isoDate(ZodISODate, params);
|
|
19
|
+
}
|
|
20
|
+
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
21
|
+
$ZodISOTime.init(inst, def);
|
|
22
|
+
ZodStringFormat.init(inst, def);
|
|
23
|
+
});
|
|
24
|
+
function time(params) {
|
|
25
|
+
return _isoTime(ZodISOTime, params);
|
|
26
|
+
}
|
|
27
|
+
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
28
|
+
$ZodISODuration.init(inst, def);
|
|
29
|
+
ZodStringFormat.init(inst, def);
|
|
30
|
+
});
|
|
31
|
+
function duration(params) {
|
|
32
|
+
return _isoDuration(ZodISODuration, params);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
ZodISODate,
|
|
36
|
+
ZodISODateTime,
|
|
37
|
+
ZodISODuration,
|
|
38
|
+
ZodISOTime,
|
|
39
|
+
date,
|
|
40
|
+
datetime,
|
|
41
|
+
duration,
|
|
42
|
+
time
|
|
43
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { _parse, _safeParse, _parseAsync, _safeParseAsync, _encode, _decode, _encodeAsync, _decodeAsync, _safeEncode, _safeDecode, _safeEncodeAsync, _safeDecodeAsync } from "../core/parse.js";
|
|
2
|
+
import "../core/registries.js";
|
|
3
|
+
import { ZodRealError } from "./errors.js";
|
|
4
|
+
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
5
|
+
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
6
|
+
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
7
|
+
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
8
|
+
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
9
|
+
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
10
|
+
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
11
|
+
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
12
|
+
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
13
|
+
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
14
|
+
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
15
|
+
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
16
|
+
export {
|
|
17
|
+
decode,
|
|
18
|
+
decodeAsync,
|
|
19
|
+
encode,
|
|
20
|
+
encodeAsync,
|
|
21
|
+
parse,
|
|
22
|
+
parseAsync,
|
|
23
|
+
safeDecode,
|
|
24
|
+
safeDecodeAsync,
|
|
25
|
+
safeEncode,
|
|
26
|
+
safeEncodeAsync,
|
|
27
|
+
safeParse,
|
|
28
|
+
safeParseAsync
|
|
29
|
+
};
|