@measured/puck 0.20.3-canary.d855fa8c → 0.21.0-canary.01415f6c

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.
Files changed (52) hide show
  1. package/dist/Editor-IQP25PUX.css +404 -0
  2. package/dist/Editor-L3JAAT2X.mjs +204 -0
  3. package/dist/Render-3OV4N4MT.css +102 -0
  4. package/dist/Render-FXZX6NFH.mjs +55 -0
  5. package/dist/{walk-tree-JdJYB16L.d.mts → actions-tsxxcX1z.d.mts} +285 -81
  6. package/dist/{walk-tree-JdJYB16L.d.ts → actions-tsxxcX1z.d.ts} +285 -81
  7. package/dist/chunk-23IZFPL7.mjs +528 -0
  8. package/dist/chunk-3SDLQIUZ.mjs +429 -0
  9. package/dist/chunk-45I5SDOI.mjs +134 -0
  10. package/dist/chunk-5ZZVX2Z3.mjs +63 -0
  11. package/dist/chunk-AOEDIUVK.mjs +11 -0
  12. package/dist/chunk-B7REOAA7.mjs +435 -0
  13. package/dist/chunk-BXQQARCR.mjs +708 -0
  14. package/dist/{chunk-QIGVND56.mjs → chunk-CQUAWHOK.mjs} +6084 -7209
  15. package/dist/chunk-D2SRL6YA.mjs +1807 -0
  16. package/dist/chunk-LJEGWHDD.mjs +53 -0
  17. package/dist/chunk-M6W7YEVX.mjs +95 -0
  18. package/dist/chunk-PBAAIKXA.mjs +111 -0
  19. package/dist/chunk-U4VSQKO3.mjs +33 -0
  20. package/dist/chunk-V5I7CVLT.mjs +103 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-L7DWVNTZ.mjs +93 -0
  24. package/dist/index-Ca6V6NQD.d.ts +118 -0
  25. package/dist/index-mQvUCH3C.d.mts +118 -0
  26. package/dist/index.css +1036 -388
  27. package/dist/index.d.mts +116 -114
  28. package/dist/index.d.ts +116 -114
  29. package/dist/index.js +11765 -7729
  30. package/dist/index.mjs +34 -12
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +927 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-2HLHDP2G.mjs +57 -0
  36. package/dist/loaded-LZUXYAGW.mjs +60 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-UHVTB6OD.mjs +57 -0
  39. package/dist/no-external.css +1125 -473
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +11764 -7725
  43. package/dist/no-external.mjs +36 -9
  44. package/dist/rsc.css +102 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +477 -63
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  50. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  51. package/package.json +32 -5
  52. package/dist/chunk-OOLYDXKW.mjs +0 -964
@@ -0,0 +1,429 @@
1
+ import {
2
+ styles_module_default
3
+ } from "./chunk-AOEDIUVK.mjs";
4
+ import {
5
+ defaultAppState,
6
+ resolveComponentData
7
+ } from "./chunk-45I5SDOI.mjs";
8
+ import {
9
+ get_class_name_factory_default
10
+ } from "./chunk-Y2EFNT5P.mjs";
11
+ import {
12
+ mapFields,
13
+ walkAppState,
14
+ walkTree
15
+ } from "./chunk-B7REOAA7.mjs";
16
+ import {
17
+ __async,
18
+ __objRest,
19
+ __spreadProps,
20
+ __spreadValues,
21
+ init_react_import
22
+ } from "./chunk-M6W7YEVX.mjs";
23
+
24
+ // lib/migrate.ts
25
+ init_react_import();
26
+ var migrations = [
27
+ // Migrate root to root.props
28
+ (data) => {
29
+ const rootProps = data.root.props || data.root;
30
+ if (Object.keys(data.root).length > 0 && !data.root.props) {
31
+ console.warn(
32
+ "Migration applied: Root props moved from `root` to `root.props`."
33
+ );
34
+ return __spreadProps(__spreadValues({}, data), {
35
+ root: {
36
+ props: __spreadValues({}, rootProps)
37
+ }
38
+ });
39
+ }
40
+ return data;
41
+ },
42
+ // Migrate zones to slots
43
+ (data, config, migrationOptions) => {
44
+ var _a, _b;
45
+ if (!config) return data;
46
+ console.log("Migrating DropZones to slots...");
47
+ const updatedItems = {};
48
+ const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
49
+ const { indexes } = walkAppState(appState, config);
50
+ const deletedCompounds = [];
51
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
52
+ var _a2, _b2, _c;
53
+ if (zoneType === "dropzone") {
54
+ const [id, slotName] = zoneCompound.split(":");
55
+ const nodeData = indexes.nodes[id].data;
56
+ const componentType = nodeData.type;
57
+ const configForComponent = id === "root" ? config.root : config.components[componentType];
58
+ if (((_b2 = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b2.type) === "slot") {
59
+ updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
60
+ props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
61
+ [slotName]: content
62
+ })
63
+ });
64
+ deletedCompounds.push(zoneCompound);
65
+ }
66
+ return content;
67
+ }
68
+ return content;
69
+ });
70
+ const updated = walkAppState(
71
+ appState,
72
+ config,
73
+ (content) => content,
74
+ (item) => {
75
+ var _a2;
76
+ return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
77
+ }
78
+ );
79
+ deletedCompounds.forEach((zoneCompound) => {
80
+ var _a2;
81
+ const [_, propName] = zoneCompound.split(":");
82
+ console.log(
83
+ `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
84
+ );
85
+ (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
86
+ });
87
+ if (migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) {
88
+ const unmigratedZonesGrouped = {};
89
+ Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
90
+ var _a2;
91
+ const [componentId, propName] = zoneCompound.split(":");
92
+ const content = (_a2 = updated.data.zones) == null ? void 0 : _a2[zoneCompound];
93
+ if (!content) {
94
+ return;
95
+ }
96
+ if (!unmigratedZonesGrouped[componentId]) {
97
+ unmigratedZonesGrouped[componentId] = {};
98
+ }
99
+ if (!unmigratedZonesGrouped[componentId][propName]) {
100
+ unmigratedZonesGrouped[componentId][propName] = content;
101
+ }
102
+ });
103
+ Object.keys(unmigratedZonesGrouped).forEach((componentId) => {
104
+ updated.data = walkTree(updated.data, config, (content) => {
105
+ return content.map((child) => {
106
+ var _a2;
107
+ if (child.props.id !== componentId) {
108
+ return child;
109
+ }
110
+ const migrateFn = (_a2 = migrationOptions == null ? void 0 : migrationOptions.migrateDynamicZonesForComponent) == null ? void 0 : _a2[child.type];
111
+ if (!migrateFn) {
112
+ return child;
113
+ }
114
+ const zones = unmigratedZonesGrouped[componentId];
115
+ const migratedProps = migrateFn(child.props, zones);
116
+ Object.keys(zones).forEach((propName) => {
117
+ var _a3;
118
+ const zoneCompound = `${componentId}:${propName}`;
119
+ console.log(`\u2713 Success: Migrated "${zoneCompound}" DropZone`);
120
+ (_a3 = updated.data.zones) == null ? true : delete _a3[zoneCompound];
121
+ });
122
+ return __spreadProps(__spreadValues({}, child), {
123
+ props: migratedProps
124
+ });
125
+ });
126
+ });
127
+ });
128
+ }
129
+ Object.keys((_b = updated.data.zones) != null ? _b : {}).forEach((zoneCompound) => {
130
+ const [_, propName] = zoneCompound.split(":");
131
+ throw new Error(
132
+ `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
133
+ );
134
+ });
135
+ delete updated.data.zones;
136
+ return updated.data;
137
+ }
138
+ ];
139
+ function migrate(data, config, migrationOptions) {
140
+ return migrations == null ? void 0 : migrations.reduce(
141
+ (acc, migration) => migration(acc, config, migrationOptions),
142
+ data
143
+ );
144
+ }
145
+
146
+ // lib/transform-props.ts
147
+ init_react_import();
148
+
149
+ // lib/data/default-data.ts
150
+ init_react_import();
151
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
152
+ root: data.root || {},
153
+ content: data.content || []
154
+ });
155
+
156
+ // lib/transform-props.ts
157
+ function transformProps(data, propTransforms, config = { components: {} }) {
158
+ const mapItem = (item) => {
159
+ if (propTransforms[item.type]) {
160
+ return __spreadProps(__spreadValues({}, item), {
161
+ props: __spreadValues({
162
+ id: item.props.id
163
+ }, propTransforms[item.type](item.props))
164
+ });
165
+ }
166
+ return item;
167
+ };
168
+ const defaultedData = defaultData(data);
169
+ const rootProps = defaultedData.root.props || defaultedData.root;
170
+ let newRoot = __spreadValues({}, defaultedData.root);
171
+ if (propTransforms["root"]) {
172
+ newRoot.props = propTransforms["root"](rootProps);
173
+ }
174
+ const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
175
+ const updatedData = walkTree(
176
+ dataWithUpdatedRoot,
177
+ config,
178
+ (content) => content.map(mapItem)
179
+ );
180
+ if (!defaultedData.root.props) {
181
+ updatedData.root = updatedData.root.props;
182
+ }
183
+ return updatedData;
184
+ }
185
+
186
+ // lib/resolve-all-data.ts
187
+ init_react_import();
188
+
189
+ // lib/data/to-component.ts
190
+ init_react_import();
191
+ var toComponent = (item) => {
192
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
193
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
194
+ type: "root"
195
+ });
196
+ };
197
+
198
+ // lib/resolve-all-data.ts
199
+ function resolveAllData(_0, _1) {
200
+ return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
201
+ var _a;
202
+ const defaultedData = defaultData(data);
203
+ const resolveNode = (_node) => __async(null, null, function* () {
204
+ const node = toComponent(_node);
205
+ onResolveStart == null ? void 0 : onResolveStart(node);
206
+ const resolved = (yield resolveComponentData(
207
+ node,
208
+ config,
209
+ metadata,
210
+ () => {
211
+ },
212
+ () => {
213
+ },
214
+ "force"
215
+ )).node;
216
+ const resolvedDeep = yield mapFields(
217
+ resolved,
218
+ { slot: ({ value }) => processContent(value) },
219
+ config
220
+ );
221
+ onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
222
+ return resolvedDeep;
223
+ });
224
+ const processContent = (content) => __async(null, null, function* () {
225
+ return Promise.all(content.map(resolveNode));
226
+ });
227
+ const processZones = () => __async(null, null, function* () {
228
+ var _a2;
229
+ const zones = (_a2 = data.zones) != null ? _a2 : {};
230
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
231
+ zones[zoneKey] = yield Promise.all(content.map(resolveNode));
232
+ }));
233
+ return zones;
234
+ });
235
+ const dynamic = {
236
+ root: yield resolveNode(defaultedData.root),
237
+ content: yield processContent(defaultedData.content),
238
+ zones: yield processZones()
239
+ };
240
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
241
+ const content = defaultedData.zones[zoneKey];
242
+ dynamic.zones[zoneKey] = yield processContent(content);
243
+ }), {});
244
+ return dynamic;
245
+ });
246
+ }
247
+
248
+ // lib/field-transforms/default-transforms/slot-transform.tsx
249
+ init_react_import();
250
+ var getSlotTransform = (renderSlotEdit, renderSlotRender = renderSlotEdit) => ({
251
+ slot: ({ value: content, propName, field, isReadOnly }) => {
252
+ const render = isReadOnly ? renderSlotRender : renderSlotEdit;
253
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
254
+ allow: (field == null ? void 0 : field.type) === "slot" ? field.allow : [],
255
+ disallow: (field == null ? void 0 : field.type) === "slot" ? field.disallow : []
256
+ }, dzProps), {
257
+ zone: propName,
258
+ content
259
+ }));
260
+ return Slot;
261
+ }
262
+ });
263
+
264
+ // lib/use-slots.tsx
265
+ init_react_import();
266
+
267
+ // lib/field-transforms/use-field-transforms.tsx
268
+ init_react_import();
269
+ import { useMemo } from "react";
270
+
271
+ // lib/field-transforms/build-mappers.ts
272
+ init_react_import();
273
+ function buildMappers(transforms, readOnly, forceReadOnly) {
274
+ return Object.keys(transforms).reduce((acc, _fieldType) => {
275
+ const fieldType = _fieldType;
276
+ return __spreadProps(__spreadValues({}, acc), {
277
+ [fieldType]: (_a) => {
278
+ var _b = _a, {
279
+ parentId
280
+ } = _b, params = __objRest(_b, [
281
+ "parentId"
282
+ ]);
283
+ const wildcardPath = params.propPath.replace(/\[\d+\]/g, "[*]");
284
+ const isReadOnly = (readOnly == null ? void 0 : readOnly[params.propPath]) || (readOnly == null ? void 0 : readOnly[wildcardPath]) || forceReadOnly || false;
285
+ const fn = transforms[fieldType];
286
+ return fn == null ? void 0 : fn(__spreadProps(__spreadValues({}, params), {
287
+ isReadOnly,
288
+ componentId: parentId
289
+ }));
290
+ }
291
+ });
292
+ }, {});
293
+ }
294
+
295
+ // lib/field-transforms/use-field-transforms.tsx
296
+ function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
297
+ const mappers = useMemo(
298
+ () => buildMappers(transforms, readOnly, forceReadOnly),
299
+ [transforms, readOnly, forceReadOnly]
300
+ );
301
+ const transformedProps = useMemo(() => {
302
+ return mapFields(item, mappers, config).props;
303
+ }, [config, item, mappers]);
304
+ const mergedProps = useMemo(
305
+ () => __spreadValues(__spreadValues({}, item.props), transformedProps),
306
+ [item.props, transformedProps]
307
+ );
308
+ return mergedProps;
309
+ }
310
+
311
+ // lib/use-slots.tsx
312
+ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
313
+ return useFieldTransforms(
314
+ config,
315
+ item,
316
+ getSlotTransform(renderSlotEdit, renderSlotRender),
317
+ readOnly,
318
+ forceReadOnly
319
+ );
320
+ }
321
+
322
+ // components/RichTextEditor/lib/use-richtext-props.tsx
323
+ init_react_import();
324
+ import { lazy, Suspense, useMemo as useMemo2 } from "react";
325
+
326
+ // components/RichTextEditor/components/RenderFallback.tsx
327
+ init_react_import();
328
+ import { jsx } from "react/jsx-runtime";
329
+ var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
330
+ function RichTextRenderFallback({ content }) {
331
+ return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx(
332
+ "div",
333
+ {
334
+ className: "rich-text",
335
+ dangerouslySetInnerHTML: { __html: content }
336
+ }
337
+ ) });
338
+ }
339
+
340
+ // components/RichTextEditor/lib/use-richtext-props.tsx
341
+ import { jsx as jsx2 } from "react/jsx-runtime";
342
+ function useRichtextProps(fields, props) {
343
+ const findAllRichtextKeys = (fields2) => {
344
+ if (!fields2) return [];
345
+ const result = [];
346
+ for (const [key, field] of Object.entries(fields2)) {
347
+ if (field.type === "richtext") {
348
+ result.push(key);
349
+ }
350
+ }
351
+ return result;
352
+ };
353
+ const richtextKeys = useMemo2(() => findAllRichtextKeys(fields), [fields]);
354
+ const richtextProps = useMemo2(() => {
355
+ if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
356
+ const RichTextRender = lazy(
357
+ () => import("./Render-FXZX6NFH.mjs").then((m) => ({
358
+ default: m.RichTextRender
359
+ }))
360
+ );
361
+ return richtextKeys.reduce((acc, key) => {
362
+ acc[key] = /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2(RichTextRenderFallback, { content: props[key] }), children: /* @__PURE__ */ jsx2(
363
+ RichTextRender,
364
+ {
365
+ content: props[key],
366
+ field: fields[key]
367
+ }
368
+ ) });
369
+ return acc;
370
+ }, {});
371
+ }, [richtextKeys, props, fields]);
372
+ return richtextProps;
373
+ }
374
+
375
+ // components/SlotRender/server.tsx
376
+ init_react_import();
377
+ import { forwardRef } from "react";
378
+ import { jsx as jsx3 } from "react/jsx-runtime";
379
+ var SlotRenderPure = (props) => /* @__PURE__ */ jsx3(SlotRender, __spreadValues({}, props));
380
+ var Item = ({
381
+ config,
382
+ item,
383
+ metadata
384
+ }) => {
385
+ const Component = config.components[item.type];
386
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx3(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
387
+ const richtextProps = useRichtextProps(Component.fields, props);
388
+ return /* @__PURE__ */ jsx3(
389
+ Component.render,
390
+ __spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
391
+ puck: __spreadProps(__spreadValues({}, props.puck), {
392
+ metadata: metadata || {}
393
+ })
394
+ })
395
+ );
396
+ };
397
+ var SlotRender = forwardRef(
398
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
399
+ const El = as != null ? as : "div";
400
+ return /* @__PURE__ */ jsx3(El, { className, style, ref, children: content.map((item) => {
401
+ if (!config.components[item.type]) {
402
+ return null;
403
+ }
404
+ return /* @__PURE__ */ jsx3(
405
+ Item,
406
+ {
407
+ config,
408
+ item,
409
+ metadata
410
+ },
411
+ item.props.id
412
+ );
413
+ }) });
414
+ }
415
+ );
416
+
417
+ export {
418
+ buildMappers,
419
+ getSlotTransform,
420
+ useSlots,
421
+ RichTextRenderFallback,
422
+ useRichtextProps,
423
+ SlotRenderPure,
424
+ SlotRender,
425
+ toComponent,
426
+ migrate,
427
+ transformProps,
428
+ resolveAllData
429
+ };
@@ -0,0 +1,134 @@
1
+ import {
2
+ mapFields
3
+ } from "./chunk-B7REOAA7.mjs";
4
+ import {
5
+ __async,
6
+ __spreadProps,
7
+ __spreadValues,
8
+ init_react_import
9
+ } from "./chunk-M6W7YEVX.mjs";
10
+
11
+ // components/ViewportControls/default-viewports.ts
12
+ init_react_import();
13
+ var defaultViewports = [
14
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
15
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
16
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
17
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
18
+ ];
19
+
20
+ // lib/resolve-component-data.ts
21
+ init_react_import();
22
+
23
+ // lib/get-changed.ts
24
+ init_react_import();
25
+ import { deepEqual } from "fast-equals";
26
+ var getChanged = (newItem, oldItem) => {
27
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
28
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
29
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
30
+ return __spreadProps(__spreadValues({}, acc), {
31
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
32
+ });
33
+ }, {}) : {};
34
+ };
35
+
36
+ // lib/resolve-component-data.ts
37
+ import { deepEqual as deepEqual2 } from "fast-equals";
38
+ var cache = { lastChange: {} };
39
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
40
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
41
+ const resolvedItem = __spreadValues({}, item);
42
+ const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
43
+ const id = "id" in item.props ? item.props.id : "root";
44
+ if (shouldRunResolver) {
45
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
46
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
47
+ return { node: resolved, didChange: false };
48
+ }
49
+ const changed = getChanged(item, oldItem);
50
+ if (onResolveStart) {
51
+ onResolveStart(item);
52
+ }
53
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
54
+ changed,
55
+ lastData: oldItem,
56
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
57
+ trigger
58
+ });
59
+ resolvedItem.props = __spreadValues(__spreadValues({}, item.props), resolvedProps);
60
+ if (Object.keys(readOnly).length) {
61
+ resolvedItem.readOnly = readOnly;
62
+ }
63
+ }
64
+ let itemWithResolvedChildren = yield mapFields(
65
+ resolvedItem,
66
+ {
67
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
68
+ const content = value;
69
+ return yield Promise.all(
70
+ content.map(
71
+ (childItem) => __async(null, null, function* () {
72
+ return (yield resolveComponentData(
73
+ childItem,
74
+ config,
75
+ metadata,
76
+ onResolveStart,
77
+ onResolveEnd,
78
+ trigger
79
+ )).node;
80
+ })
81
+ )
82
+ );
83
+ })
84
+ },
85
+ config
86
+ );
87
+ if (shouldRunResolver && onResolveEnd) {
88
+ onResolveEnd(resolvedItem);
89
+ }
90
+ cache.lastChange[id] = {
91
+ item,
92
+ resolved: itemWithResolvedChildren
93
+ };
94
+ return {
95
+ node: itemWithResolvedChildren,
96
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
97
+ };
98
+ });
99
+
100
+ // store/default-app-state.ts
101
+ init_react_import();
102
+ var defaultAppState = {
103
+ data: { content: [], root: {}, zones: {} },
104
+ ui: {
105
+ leftSideBarVisible: true,
106
+ rightSideBarVisible: true,
107
+ arrayState: {},
108
+ itemSelector: null,
109
+ componentList: {},
110
+ isDragging: false,
111
+ previewMode: "edit",
112
+ viewports: {
113
+ current: {
114
+ width: defaultViewports[0].width,
115
+ height: defaultViewports[0].height || "auto"
116
+ },
117
+ options: [],
118
+ controlsVisible: true
119
+ },
120
+ field: { focus: null },
121
+ plugin: { current: null }
122
+ },
123
+ indexes: {
124
+ nodes: {},
125
+ zones: {}
126
+ }
127
+ };
128
+
129
+ export {
130
+ defaultViewports,
131
+ getChanged,
132
+ resolveComponentData,
133
+ defaultAppState
134
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ Heading1,
3
+ Heading2,
4
+ Heading3,
5
+ Heading4,
6
+ Heading5,
7
+ Heading6
8
+ } from "./chunk-D2SRL6YA.mjs";
9
+ import {
10
+ init_react_import
11
+ } from "./chunk-M6W7YEVX.mjs";
12
+
13
+ // components/RichTextMenu/controls/HeadingSelect/use-options.ts
14
+ init_react_import();
15
+ import { useMemo } from "react";
16
+ var optionNodes = {
17
+ h1: { label: "Heading 1", icon: Heading1 },
18
+ h2: { label: "Heading 2", icon: Heading2 },
19
+ h3: { label: "Heading 3", icon: Heading3 },
20
+ h4: { label: "Heading 4", icon: Heading4 },
21
+ h5: { label: "Heading 5", icon: Heading5 },
22
+ h6: { label: "Heading 6", icon: Heading6 }
23
+ };
24
+ var useHeadingOptions = (fieldOptions) => {
25
+ var _a;
26
+ let blockOptions = [];
27
+ if ((fieldOptions == null ? void 0 : fieldOptions.heading) !== false) {
28
+ if (!((_a = fieldOptions == null ? void 0 : fieldOptions.heading) == null ? void 0 : _a.levels)) {
29
+ blockOptions = ["h1", "h2", "h3", "h4", "h5", "h6"];
30
+ } else {
31
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(1)) {
32
+ blockOptions.push("h1");
33
+ }
34
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(2)) {
35
+ blockOptions.push("h2");
36
+ }
37
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(3)) {
38
+ blockOptions.push("h3");
39
+ }
40
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(4)) {
41
+ blockOptions.push("h4");
42
+ }
43
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(5)) {
44
+ blockOptions.push("h5");
45
+ }
46
+ if (fieldOptions == null ? void 0 : fieldOptions.heading.levels.includes(6)) {
47
+ blockOptions.push("h6");
48
+ }
49
+ }
50
+ }
51
+ return useMemo(
52
+ () => blockOptions.map((item) => ({
53
+ value: item,
54
+ label: optionNodes[item].label,
55
+ icon: optionNodes[item].icon
56
+ })),
57
+ [blockOptions]
58
+ );
59
+ };
60
+
61
+ export {
62
+ useHeadingOptions
63
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ init_react_import
3
+ } from "./chunk-M6W7YEVX.mjs";
4
+
5
+ // css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css#css-module
6
+ init_react_import();
7
+ var styles_module_default = { "RichTextEditor": "_RichTextEditor_z25h4_1", "RichTextEditor--editor": "_RichTextEditor--editor_z25h4_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_z25h4_107", "RichTextEditor--isActive": "_RichTextEditor--isActive_z25h4_111", "RichTextEditor-menu": "_RichTextEditor-menu_z25h4_117" };
8
+
9
+ export {
10
+ styles_module_default
11
+ };