@measured/puck 0.21.0-canary.cf074bc6 → 0.21.0-canary.d5f934f0

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-F2LSS6SE.css +403 -0
  2. package/dist/Editor-STTYPZJ4.mjs +204 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-Ctf3FZQI.d.mts → actions-tsxxcX1z.d.mts} +285 -82
  6. package/dist/{walk-tree-Ctf3FZQI.d.ts → actions-tsxxcX1z.d.ts} +285 -82
  7. package/dist/chunk-5ATHPL4L.mjs +111 -0
  8. package/dist/chunk-6K3HTV5G.mjs +419 -0
  9. package/dist/chunk-CSSRLPHM.mjs +11 -0
  10. package/dist/chunk-DBBPIWHH.mjs +528 -0
  11. package/dist/{chunk-MYJB3LKU.mjs → chunk-GUTA7GLC.mjs} +6886 -8142
  12. package/dist/chunk-IDHXWXYL.mjs +1807 -0
  13. package/dist/chunk-M6W7YEVX.mjs +95 -0
  14. package/dist/chunk-MML4TKL2.mjs +63 -0
  15. package/dist/chunk-O7X34GXV.mjs +708 -0
  16. package/dist/chunk-ODDSBBX3.mjs +435 -0
  17. package/dist/chunk-PRRLVCLF.mjs +33 -0
  18. package/dist/chunk-QV3IXRNS.mjs +134 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-VL2VNWXO.mjs +53 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-C4C2K2OO.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 +1035 -388
  27. package/dist/index.d.mts +116 -114
  28. package/dist/index.d.ts +116 -114
  29. package/dist/index.js +11410 -7513
  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-DB2OXVC5.mjs +57 -0
  36. package/dist/loaded-GEFHNL7S.mjs +57 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-TVTW742N.mjs +60 -0
  39. package/dist/no-external.css +1124 -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 +11411 -7511
  43. package/dist/no-external.mjs +36 -9
  44. package/dist/rsc.css +101 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +446 -38
  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,435 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues,
4
+ init_react_import
5
+ } from "./chunk-M6W7YEVX.mjs";
6
+
7
+ // lib/data/walk-tree.ts
8
+ init_react_import();
9
+
10
+ // lib/data/map-fields.ts
11
+ init_react_import();
12
+
13
+ // lib/data/default-slots.ts
14
+ init_react_import();
15
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
16
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
17
+ value
18
+ );
19
+
20
+ // lib/data/map-fields.ts
21
+ var isPromise = (v) => !!v && typeof v.then === "function";
22
+ var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
23
+ var containsPromise = (arr) => arr.some(isPromise);
24
+ var walkField = ({
25
+ value,
26
+ fields,
27
+ mappers,
28
+ propKey = "",
29
+ propPath = "",
30
+ id = "",
31
+ config,
32
+ recurseSlots = false
33
+ }) => {
34
+ var _a, _b, _c;
35
+ const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
36
+ const map = mappers[fieldType];
37
+ if (map && fieldType === "slot") {
38
+ const content = value || [];
39
+ const mappedContent = recurseSlots ? content.map((el) => {
40
+ var _a2;
41
+ const componentConfig = config.components[el.type];
42
+ if (!componentConfig) {
43
+ throw new Error(`Could not find component config for ${el.type}`);
44
+ }
45
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
46
+ return walkField({
47
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
48
+ fields: fields2,
49
+ mappers,
50
+ id: el.props.id,
51
+ config,
52
+ recurseSlots
53
+ });
54
+ }) : content;
55
+ if (containsPromise(mappedContent)) {
56
+ return Promise.all(mappedContent);
57
+ }
58
+ return map({
59
+ value: mappedContent,
60
+ parentId: id,
61
+ propName: propPath,
62
+ field: fields[propKey],
63
+ propPath
64
+ });
65
+ } else if (map && fields[propKey]) {
66
+ return map({
67
+ value,
68
+ parentId: id,
69
+ propName: propKey,
70
+ field: fields[propKey],
71
+ propPath
72
+ });
73
+ }
74
+ if (value && typeof value === "object") {
75
+ if (Array.isArray(value)) {
76
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
77
+ if (!arrayFields) return value;
78
+ const newValue = value.map(
79
+ (el, idx) => walkField({
80
+ value: el,
81
+ fields: arrayFields,
82
+ mappers,
83
+ propKey,
84
+ propPath: `${propPath}[${idx}]`,
85
+ id,
86
+ config,
87
+ recurseSlots
88
+ })
89
+ );
90
+ if (containsPromise(newValue)) {
91
+ return Promise.all(newValue);
92
+ }
93
+ return newValue;
94
+ } else if ("$$typeof" in value) {
95
+ return value;
96
+ } else {
97
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
98
+ return walkObject({
99
+ value,
100
+ fields: objectFields,
101
+ mappers,
102
+ id,
103
+ getPropPath: (k) => `${propPath}.${k}`,
104
+ config,
105
+ recurseSlots
106
+ });
107
+ }
108
+ }
109
+ return value;
110
+ };
111
+ var walkObject = ({
112
+ value,
113
+ fields,
114
+ mappers,
115
+ id,
116
+ getPropPath,
117
+ config,
118
+ recurseSlots
119
+ }) => {
120
+ const newProps = Object.entries(value).map(([k, v]) => {
121
+ const opts = {
122
+ value: v,
123
+ fields,
124
+ mappers,
125
+ propKey: k,
126
+ propPath: getPropPath(k),
127
+ id,
128
+ config,
129
+ recurseSlots
130
+ };
131
+ const newValue = walkField(opts);
132
+ if (isPromise(newValue)) {
133
+ return newValue.then((resolvedValue) => ({
134
+ [k]: resolvedValue
135
+ }));
136
+ }
137
+ return {
138
+ [k]: newValue
139
+ };
140
+ }, {});
141
+ if (containsPromise(newProps)) {
142
+ return Promise.all(newProps).then(flatten);
143
+ }
144
+ return flatten(newProps);
145
+ };
146
+ function mapFields(item, mappers, config, recurseSlots = false) {
147
+ var _a, _b, _c, _d, _e;
148
+ const itemType = "type" in item ? item.type : "root";
149
+ const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
150
+ const newProps = walkObject({
151
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
152
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
153
+ mappers,
154
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
155
+ getPropPath: (k) => k,
156
+ config,
157
+ recurseSlots
158
+ });
159
+ if (isPromise(newProps)) {
160
+ return newProps.then((resolvedProps) => __spreadProps(__spreadValues({}, item), {
161
+ props: resolvedProps
162
+ }));
163
+ }
164
+ return __spreadProps(__spreadValues({}, item), {
165
+ props: newProps
166
+ });
167
+ }
168
+
169
+ // lib/data/walk-tree.ts
170
+ function walkTree(data, config, callbackFn) {
171
+ var _a, _b;
172
+ const walkItem = (item) => {
173
+ return mapFields(
174
+ item,
175
+ {
176
+ slot: ({ value, parentId, propName }) => {
177
+ var _a2;
178
+ const content = value;
179
+ return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
180
+ }
181
+ },
182
+ config,
183
+ true
184
+ );
185
+ };
186
+ if ("props" in data) {
187
+ return walkItem(data);
188
+ }
189
+ const _data = data;
190
+ const zones = (_a = _data.zones) != null ? _a : {};
191
+ const mappedContent = _data.content.map(walkItem);
192
+ return {
193
+ root: walkItem(_data.root),
194
+ content: (_b = callbackFn(mappedContent, {
195
+ parentId: "root",
196
+ propName: "default-zone"
197
+ })) != null ? _b : mappedContent,
198
+ zones: Object.keys(zones).reduce(
199
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
200
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
201
+ }),
202
+ {}
203
+ )
204
+ };
205
+ }
206
+
207
+ // lib/root-droppable-id.ts
208
+ init_react_import();
209
+ var rootAreaId = "root";
210
+ var rootZone = "default-zone";
211
+ var rootDroppableId = `${rootAreaId}:${rootZone}`;
212
+
213
+ // lib/data/flatten-node.ts
214
+ init_react_import();
215
+ import flat from "flat";
216
+
217
+ // lib/data/strip-slots.ts
218
+ init_react_import();
219
+ var stripSlots = (data, config) => {
220
+ return mapFields(data, { slot: () => null }, config);
221
+ };
222
+
223
+ // lib/data/flatten-node.ts
224
+ var { flatten: flatten2, unflatten } = flat;
225
+ function isEmptyArrayOrObject(val) {
226
+ if (Array.isArray(val)) {
227
+ return val.length === 0;
228
+ }
229
+ if (val != null && Object.prototype.toString.call(val) === "[object Object]") {
230
+ return Object.keys(val).length === 0;
231
+ }
232
+ return false;
233
+ }
234
+ function stripEmptyObjects(props) {
235
+ const result = {};
236
+ for (const key in props) {
237
+ if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
238
+ const val = props[key];
239
+ if (isEmptyArrayOrObject(val)) continue;
240
+ result[key] = val;
241
+ }
242
+ return result;
243
+ }
244
+ var flattenNode = (node, config) => {
245
+ return __spreadProps(__spreadValues({}, node), {
246
+ props: stripEmptyObjects(flatten2(stripSlots(node, config).props))
247
+ });
248
+ };
249
+ var expandNode = (node) => {
250
+ const props = unflatten(node.props);
251
+ return __spreadProps(__spreadValues({}, node), {
252
+ props
253
+ });
254
+ };
255
+
256
+ // lib/data/walk-app-state.ts
257
+ init_react_import();
258
+
259
+ // lib/data/for-related-zones.ts
260
+ init_react_import();
261
+
262
+ // lib/get-zone-id.ts
263
+ init_react_import();
264
+ var getZoneId = (zoneCompound) => {
265
+ if (!zoneCompound) {
266
+ return [];
267
+ }
268
+ if (zoneCompound && zoneCompound.indexOf(":") > -1) {
269
+ return zoneCompound.split(":");
270
+ }
271
+ return [rootDroppableId, zoneCompound];
272
+ };
273
+
274
+ // lib/data/for-related-zones.ts
275
+ function forRelatedZones(item, data, cb, path = []) {
276
+ Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
277
+ const [parentId] = getZoneId(zoneCompound);
278
+ if (parentId === item.props.id) {
279
+ cb(path, zoneCompound, content);
280
+ }
281
+ });
282
+ }
283
+
284
+ // lib/data/walk-app-state.ts
285
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
286
+ var _a;
287
+ let newZones = {};
288
+ const newZoneIndex = {};
289
+ const newNodeIndex = {};
290
+ const processContent = (path, zoneCompound, content, zoneType, newId) => {
291
+ var _a2;
292
+ const [parentId] = zoneCompound.split(":");
293
+ const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
294
+ const [_2, zone] = zoneCompound.split(":");
295
+ const newZoneCompound = `${newId || parentId}:${zone}`;
296
+ const newContent2 = mappedContent.map(
297
+ (zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
298
+ );
299
+ newZoneIndex[newZoneCompound] = {
300
+ contentIds: newContent2.map((item) => item.props.id),
301
+ type: zoneType
302
+ };
303
+ return [newZoneCompound, newContent2];
304
+ };
305
+ const processRelatedZones = (item, newId, initialPath) => {
306
+ forRelatedZones(
307
+ item,
308
+ state.data,
309
+ (relatedPath, relatedZoneCompound, relatedContent) => {
310
+ const [zoneCompound, newContent2] = processContent(
311
+ relatedPath,
312
+ relatedZoneCompound,
313
+ relatedContent,
314
+ "dropzone",
315
+ newId
316
+ );
317
+ newZones[zoneCompound] = newContent2;
318
+ },
319
+ initialPath
320
+ );
321
+ };
322
+ const processItem = (item, path, index) => {
323
+ const mappedItem = mapNodeOrSkip(item, path, index);
324
+ if (!mappedItem) return item;
325
+ const id = mappedItem.props.id;
326
+ const newProps = __spreadProps(__spreadValues({}, mapFields(
327
+ mappedItem,
328
+ {
329
+ slot: ({ value, parentId: parentId2, propPath }) => {
330
+ const content = value;
331
+ const zoneCompound = `${parentId2}:${propPath}`;
332
+ const [_2, newContent2] = processContent(
333
+ path,
334
+ zoneCompound,
335
+ content,
336
+ "slot",
337
+ parentId2
338
+ );
339
+ return newContent2;
340
+ }
341
+ },
342
+ config
343
+ ).props), {
344
+ id
345
+ });
346
+ processRelatedZones(item, id, path);
347
+ const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
348
+ const thisZoneCompound = path[path.length - 1];
349
+ const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
350
+ newNodeIndex[id] = {
351
+ data: newItem,
352
+ flatData: flattenNode(newItem, config),
353
+ path,
354
+ parentId,
355
+ zone
356
+ };
357
+ const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
358
+ if (newProps.id === "root") {
359
+ delete finalData["type"];
360
+ delete finalData.props["id"];
361
+ }
362
+ return finalData;
363
+ };
364
+ const zones = state.data.zones || {};
365
+ const [_, newContent] = processContent(
366
+ [],
367
+ rootDroppableId,
368
+ state.data.content,
369
+ "root"
370
+ );
371
+ const processedContent = newContent;
372
+ const zonesAlreadyProcessed = Object.keys(newZones);
373
+ Object.keys(zones || {}).forEach((zoneCompound) => {
374
+ const [parentId] = zoneCompound.split(":");
375
+ if (zonesAlreadyProcessed.includes(zoneCompound)) {
376
+ return;
377
+ }
378
+ const [_2, newContent2] = processContent(
379
+ [rootDroppableId],
380
+ zoneCompound,
381
+ zones[zoneCompound],
382
+ "dropzone",
383
+ parentId
384
+ );
385
+ newZones[zoneCompound] = newContent2;
386
+ }, newZones);
387
+ const processedRoot = processItem(
388
+ {
389
+ type: "root",
390
+ props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
391
+ },
392
+ [],
393
+ -1
394
+ );
395
+ const root = __spreadProps(__spreadValues({}, state.data.root), {
396
+ props: processedRoot.props
397
+ });
398
+ return __spreadProps(__spreadValues({}, state), {
399
+ data: {
400
+ root,
401
+ content: processedContent,
402
+ zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
403
+ },
404
+ indexes: {
405
+ nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
406
+ zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
407
+ }
408
+ });
409
+ }
410
+
411
+ // lib/data/setup-zone.ts
412
+ init_react_import();
413
+ var setupZone = (data, zoneKey) => {
414
+ if (zoneKey === rootDroppableId) {
415
+ return data;
416
+ }
417
+ const newData = __spreadProps(__spreadValues({}, data), {
418
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
419
+ });
420
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
421
+ return newData;
422
+ };
423
+
424
+ export {
425
+ rootAreaId,
426
+ rootZone,
427
+ rootDroppableId,
428
+ defaultSlots,
429
+ walkField,
430
+ mapFields,
431
+ expandNode,
432
+ walkAppState,
433
+ walkTree,
434
+ setupZone
435
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ List,
3
+ ListOrdered
4
+ } from "./chunk-IDHXWXYL.mjs";
5
+ import {
6
+ init_react_import
7
+ } from "./chunk-M6W7YEVX.mjs";
8
+
9
+ // components/RichTextMenu/controls/ListSelect/use-options.ts
10
+ init_react_import();
11
+ import { useMemo } from "react";
12
+ var optionNodes = {
13
+ ul: { label: "Bullet list", icon: List },
14
+ ol: { label: "Numbered list", icon: ListOrdered }
15
+ };
16
+ var useListOptions = (fieldOptions) => {
17
+ let blockOptions = [];
18
+ if ((fieldOptions == null ? void 0 : fieldOptions.listItem) !== false) {
19
+ blockOptions = ["ul", "ol"];
20
+ }
21
+ return useMemo(
22
+ () => blockOptions.map((item) => ({
23
+ value: item,
24
+ label: optionNodes[item].label,
25
+ icon: optionNodes[item].icon
26
+ })),
27
+ [blockOptions]
28
+ );
29
+ };
30
+
31
+ export {
32
+ useListOptions
33
+ };
@@ -0,0 +1,134 @@
1
+ import {
2
+ mapFields
3
+ } from "./chunk-ODDSBBX3.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,103 @@
1
+ import {
2
+ __spreadValues,
3
+ init_react_import
4
+ } from "./chunk-M6W7YEVX.mjs";
5
+
6
+ // components/RichTextEditor/extension.ts
7
+ init_react_import();
8
+ import { Extension } from "@tiptap/core";
9
+ import { Blockquote } from "@tiptap/extension-blockquote";
10
+ import { Bold } from "@tiptap/extension-bold";
11
+ import { Code } from "@tiptap/extension-code";
12
+ import { CodeBlock } from "@tiptap/extension-code-block";
13
+ import { Document } from "@tiptap/extension-document";
14
+ import { HardBreak } from "@tiptap/extension-hard-break";
15
+ import { Heading } from "@tiptap/extension-heading";
16
+ import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
17
+ import { Italic } from "@tiptap/extension-italic";
18
+ import { Link } from "@tiptap/extension-link";
19
+ import {
20
+ BulletList,
21
+ ListItem,
22
+ ListKeymap,
23
+ OrderedList
24
+ } from "@tiptap/extension-list";
25
+ import { Paragraph } from "@tiptap/extension-paragraph";
26
+ import { Strike } from "@tiptap/extension-strike";
27
+ import { Text } from "@tiptap/extension-text";
28
+ import TextAlign from "@tiptap/extension-text-align";
29
+ import { Underline } from "@tiptap/extension-underline";
30
+ var defaultPuckRichTextOptions = {
31
+ textAlign: {
32
+ types: ["heading", "paragraph"]
33
+ }
34
+ };
35
+ var PuckRichText = Extension.create({
36
+ name: "puckRichText",
37
+ addExtensions() {
38
+ const extensions = [];
39
+ const options = __spreadValues(__spreadValues({}, this.options), defaultPuckRichTextOptions);
40
+ if (options.bold !== false) {
41
+ extensions.push(Bold.configure(options.bold));
42
+ }
43
+ if (options.blockquote !== false) {
44
+ extensions.push(Blockquote.configure(options.blockquote));
45
+ }
46
+ if (options.bulletList !== false) {
47
+ extensions.push(BulletList.configure(options.bulletList));
48
+ }
49
+ if (options.code !== false) {
50
+ extensions.push(Code.configure(options.code));
51
+ }
52
+ if (options.codeBlock !== false) {
53
+ extensions.push(CodeBlock.configure(options.codeBlock));
54
+ }
55
+ if (options.document !== false) {
56
+ extensions.push(Document.configure(options.document));
57
+ }
58
+ if (options.hardBreak !== false) {
59
+ extensions.push(HardBreak.configure(options.hardBreak));
60
+ }
61
+ if (options.heading !== false) {
62
+ extensions.push(Heading.configure(options.heading));
63
+ }
64
+ if (options.horizontalRule !== false) {
65
+ extensions.push(HorizontalRule.configure(options.horizontalRule));
66
+ }
67
+ if (options.italic !== false) {
68
+ extensions.push(Italic.configure(options.italic));
69
+ }
70
+ if (options.listItem !== false) {
71
+ extensions.push(ListItem.configure(options.listItem));
72
+ }
73
+ if (options.listKeymap !== false) {
74
+ extensions.push(ListKeymap.configure(options == null ? void 0 : options.listKeymap));
75
+ }
76
+ if (options.link !== false) {
77
+ extensions.push(Link.configure(options == null ? void 0 : options.link));
78
+ }
79
+ if (options.orderedList !== false) {
80
+ extensions.push(OrderedList.configure(options.orderedList));
81
+ }
82
+ if (options.paragraph !== false) {
83
+ extensions.push(Paragraph.configure(options.paragraph));
84
+ }
85
+ if (options.strike !== false) {
86
+ extensions.push(Strike.configure(options.strike));
87
+ }
88
+ if (options.text !== false) {
89
+ extensions.push(Text.configure(options.text));
90
+ }
91
+ if (options.textAlign !== false) {
92
+ extensions.push(TextAlign.configure(options.textAlign));
93
+ }
94
+ if (options.underline !== false) {
95
+ extensions.push(Underline.configure(options == null ? void 0 : options.underline));
96
+ }
97
+ return extensions;
98
+ }
99
+ });
100
+
101
+ export {
102
+ PuckRichText
103
+ };