@crediblemark/build 0.22.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/LICENSE +21 -0
- package/dist/Editor-XZF6CWVW.css +404 -0
- package/dist/Editor-ZC67OU2A.mjs +205 -0
- package/dist/Render-JBFI6HYN.mjs +55 -0
- package/dist/Render-WCX4AXOX.css +102 -0
- package/dist/actions-CEH_5LMY.d.mts +838 -0
- package/dist/actions-CEH_5LMY.d.ts +838 -0
- package/dist/chunk-3AJBFQU4.mjs +560 -0
- package/dist/chunk-4SQOX3ZQ.mjs +476 -0
- package/dist/chunk-B4BOBGYB.mjs +42 -0
- package/dist/chunk-CDMESQDA.mjs +148 -0
- package/dist/chunk-DSXRK4QJ.mjs +704 -0
- package/dist/chunk-GUJDGRSM.mjs +469 -0
- package/dist/chunk-HHBUU7WF.mjs +35 -0
- package/dist/chunk-IJHL7BIR.mjs +11 -0
- package/dist/chunk-PHGC6QYB.mjs +105 -0
- package/dist/chunk-QF3GD5WQ.mjs +65 -0
- package/dist/chunk-U2NVBXAC.mjs +2064 -0
- package/dist/chunk-VFD76OD5.mjs +55 -0
- package/dist/chunk-VGDMWS44.mjs +107 -0
- package/dist/chunk-VKBVSWU3.mjs +8538 -0
- package/dist/chunk-YH7AXYKP.mjs +109 -0
- package/dist/full-ABQQRJAO.css +301 -0
- package/dist/full-LJRK5736.mjs +94 -0
- package/dist/index-CkSfgrvw.d.ts +117 -0
- package/dist/index-Cxwg4vUV.d.mts +117 -0
- package/dist/index.css +2576 -0
- package/dist/index.d.mts +310 -0
- package/dist/index.d.ts +310 -0
- package/dist/index.js +15012 -0
- package/dist/index.mjs +83 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +960 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-DWCENJKQ.mjs +55 -0
- package/dist/loaded-N7VXUR4O.mjs +59 -0
- package/dist/loaded-NE2PIHUQ.mjs +56 -0
- package/dist/loaded-SMEIWWHS.css +87 -0
- package/dist/no-external.css +2574 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +15012 -0
- package/dist/no-external.mjs +83 -0
- package/dist/rsc.css +102 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1466 -0
- package/dist/rsc.mjs +147 -0
- package/dist/walk-tree-B4ZvMfxS.d.ts +29 -0
- package/dist/walk-tree-C78ZVz19.d.mts +29 -0
- package/package.json +145 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "./chunk-B4BOBGYB.mjs";
|
|
4
|
+
|
|
5
|
+
// lib/data/walk-tree.ts
|
|
6
|
+
init_react_import();
|
|
7
|
+
|
|
8
|
+
// lib/data/map-fields.ts
|
|
9
|
+
init_react_import();
|
|
10
|
+
|
|
11
|
+
// lib/data/default-slots.ts
|
|
12
|
+
init_react_import();
|
|
13
|
+
var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
14
|
+
(acc, fieldName) => fields[fieldName].type === "slot" ? { [fieldName]: [], ...acc } : acc,
|
|
15
|
+
value
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// lib/data/map-fields.ts
|
|
19
|
+
var isPromise = (v) => !!v && typeof v.then === "function";
|
|
20
|
+
var flatten = (values) => values.reduce((acc, item) => ({ ...acc, ...item }), {});
|
|
21
|
+
var containsPromise = (arr) => arr.some(isPromise);
|
|
22
|
+
var walkField = ({
|
|
23
|
+
value,
|
|
24
|
+
fields,
|
|
25
|
+
mappers,
|
|
26
|
+
propKey = "",
|
|
27
|
+
propPath = "",
|
|
28
|
+
id = "",
|
|
29
|
+
config,
|
|
30
|
+
recurseSlots = false
|
|
31
|
+
}) => {
|
|
32
|
+
const fieldType = fields[propKey]?.type;
|
|
33
|
+
const map = mappers[fieldType];
|
|
34
|
+
if (map && fieldType === "slot") {
|
|
35
|
+
const content = value || [];
|
|
36
|
+
const mappedContent = recurseSlots ? content.map((el) => {
|
|
37
|
+
const componentConfig = config.components[el.type];
|
|
38
|
+
if (!componentConfig) {
|
|
39
|
+
throw new Error(`Could not find component config for ${el.type}`);
|
|
40
|
+
}
|
|
41
|
+
const fields2 = componentConfig.fields ?? {};
|
|
42
|
+
return walkField({
|
|
43
|
+
value: { ...el, props: defaultSlots(el.props, fields2) },
|
|
44
|
+
fields: fields2,
|
|
45
|
+
mappers,
|
|
46
|
+
id: el.props.id,
|
|
47
|
+
config,
|
|
48
|
+
recurseSlots
|
|
49
|
+
});
|
|
50
|
+
}) : content;
|
|
51
|
+
if (containsPromise(mappedContent)) {
|
|
52
|
+
return Promise.all(mappedContent);
|
|
53
|
+
}
|
|
54
|
+
return map({
|
|
55
|
+
value: mappedContent,
|
|
56
|
+
parentId: id,
|
|
57
|
+
propName: propPath,
|
|
58
|
+
field: fields[propKey],
|
|
59
|
+
propPath
|
|
60
|
+
});
|
|
61
|
+
} else if (map && fields[propKey]) {
|
|
62
|
+
return map({
|
|
63
|
+
value,
|
|
64
|
+
parentId: id,
|
|
65
|
+
propName: propKey,
|
|
66
|
+
field: fields[propKey],
|
|
67
|
+
propPath
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (value && typeof value === "object") {
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
const arrayFields = fields[propKey]?.type === "array" ? fields[propKey].arrayFields : null;
|
|
73
|
+
if (!arrayFields) return value;
|
|
74
|
+
const newValue = value.map(
|
|
75
|
+
(el, idx) => walkField({
|
|
76
|
+
value: el,
|
|
77
|
+
fields: arrayFields,
|
|
78
|
+
mappers,
|
|
79
|
+
propKey,
|
|
80
|
+
propPath: `${propPath}[${idx}]`,
|
|
81
|
+
id,
|
|
82
|
+
config,
|
|
83
|
+
recurseSlots
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
if (containsPromise(newValue)) {
|
|
87
|
+
return Promise.all(newValue);
|
|
88
|
+
}
|
|
89
|
+
return newValue;
|
|
90
|
+
} else if ("$$typeof" in value) {
|
|
91
|
+
return value;
|
|
92
|
+
} else {
|
|
93
|
+
const objectFields = fields[propKey]?.type === "object" ? fields[propKey].objectFields : fields;
|
|
94
|
+
return walkObject({
|
|
95
|
+
value,
|
|
96
|
+
fields: objectFields,
|
|
97
|
+
mappers,
|
|
98
|
+
id,
|
|
99
|
+
getPropPath: (k) => `${propPath}.${k}`,
|
|
100
|
+
config,
|
|
101
|
+
recurseSlots
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return value;
|
|
106
|
+
};
|
|
107
|
+
var walkObject = ({
|
|
108
|
+
value,
|
|
109
|
+
fields,
|
|
110
|
+
mappers,
|
|
111
|
+
id,
|
|
112
|
+
getPropPath,
|
|
113
|
+
config,
|
|
114
|
+
recurseSlots
|
|
115
|
+
}) => {
|
|
116
|
+
const newProps = Object.entries(value).map(([k, v]) => {
|
|
117
|
+
const opts = {
|
|
118
|
+
value: v,
|
|
119
|
+
fields,
|
|
120
|
+
mappers,
|
|
121
|
+
propKey: k,
|
|
122
|
+
propPath: getPropPath(k),
|
|
123
|
+
id,
|
|
124
|
+
config,
|
|
125
|
+
recurseSlots
|
|
126
|
+
};
|
|
127
|
+
const newValue = walkField(opts);
|
|
128
|
+
if (isPromise(newValue)) {
|
|
129
|
+
return newValue.then((resolvedValue) => ({
|
|
130
|
+
[k]: resolvedValue
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
[k]: newValue
|
|
135
|
+
};
|
|
136
|
+
}, {});
|
|
137
|
+
if (containsPromise(newProps)) {
|
|
138
|
+
return Promise.all(newProps).then(flatten);
|
|
139
|
+
}
|
|
140
|
+
return flatten(newProps);
|
|
141
|
+
};
|
|
142
|
+
function mapFields(item, mappers, config, recurseSlots = false, shouldDefaultSlots = true) {
|
|
143
|
+
const itemType = "type" in item ? item.type : "root";
|
|
144
|
+
const componentConfig = itemType === "root" ? config.root : config.components?.[itemType];
|
|
145
|
+
const newProps = walkObject({
|
|
146
|
+
value: shouldDefaultSlots ? defaultSlots(item.props ?? {}, componentConfig?.fields ?? {}) : item.props,
|
|
147
|
+
fields: componentConfig?.fields ?? {},
|
|
148
|
+
mappers,
|
|
149
|
+
id: item.props ? item.props.id ?? "root" : "root",
|
|
150
|
+
getPropPath: (k) => k,
|
|
151
|
+
config,
|
|
152
|
+
recurseSlots
|
|
153
|
+
});
|
|
154
|
+
if (isPromise(newProps)) {
|
|
155
|
+
return newProps.then((resolvedProps) => ({
|
|
156
|
+
...item,
|
|
157
|
+
props: resolvedProps
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...item,
|
|
162
|
+
props: newProps
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// lib/data/walk-tree.ts
|
|
167
|
+
function walkTree(data, config, callbackFn) {
|
|
168
|
+
const walkItem = (item) => {
|
|
169
|
+
return mapFields(
|
|
170
|
+
item,
|
|
171
|
+
{
|
|
172
|
+
slot: ({ value, parentId, propName }) => {
|
|
173
|
+
const content = value;
|
|
174
|
+
return callbackFn(content, { parentId, propName }) ?? content;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
config,
|
|
178
|
+
true
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
if ("props" in data) {
|
|
182
|
+
return walkItem(data);
|
|
183
|
+
}
|
|
184
|
+
const _data = data;
|
|
185
|
+
const zones = _data.zones ?? {};
|
|
186
|
+
const mappedContent = _data.content.map(walkItem);
|
|
187
|
+
return {
|
|
188
|
+
root: walkItem(_data.root),
|
|
189
|
+
content: callbackFn(mappedContent, {
|
|
190
|
+
parentId: "root",
|
|
191
|
+
propName: "default-zone"
|
|
192
|
+
}) ?? mappedContent,
|
|
193
|
+
zones: Object.keys(zones).reduce(
|
|
194
|
+
(acc, zoneCompound) => ({
|
|
195
|
+
...acc,
|
|
196
|
+
[zoneCompound]: zones[zoneCompound].map(walkItem)
|
|
197
|
+
}),
|
|
198
|
+
{}
|
|
199
|
+
)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// lib/root-droppable-id.ts
|
|
204
|
+
init_react_import();
|
|
205
|
+
var rootAreaId = "root";
|
|
206
|
+
var rootZone = "default-zone";
|
|
207
|
+
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
|
208
|
+
|
|
209
|
+
// lib/data/flatten-node.ts
|
|
210
|
+
init_react_import();
|
|
211
|
+
import flat from "flat";
|
|
212
|
+
|
|
213
|
+
// lib/data/strip-slots.ts
|
|
214
|
+
init_react_import();
|
|
215
|
+
var stripSlots = (data, config) => {
|
|
216
|
+
return mapFields(data, { slot: () => null }, config);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// lib/data/flatten-node.ts
|
|
220
|
+
var { flatten: flatten2, unflatten } = flat;
|
|
221
|
+
var isPureObject = (val) => val != null && Object.prototype.toString.call(val) === "[object Object]";
|
|
222
|
+
var emptyArrayStr = "__credbuild_[]";
|
|
223
|
+
var emptyObjectStr = "__credbuild_{}";
|
|
224
|
+
function encodeEmptyObjects(props = {}) {
|
|
225
|
+
const result = {};
|
|
226
|
+
for (const key in props) {
|
|
227
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
228
|
+
const val = props[key];
|
|
229
|
+
if (Array.isArray(val) && val.length === 0) {
|
|
230
|
+
result[key] = emptyArrayStr;
|
|
231
|
+
} else if (isPureObject(val) && Object.keys(val).length === 0) {
|
|
232
|
+
result[key] = emptyObjectStr;
|
|
233
|
+
} else {
|
|
234
|
+
result[key] = val;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
function decodeEmptyObjects(props = {}) {
|
|
240
|
+
const result = {};
|
|
241
|
+
for (const key in props) {
|
|
242
|
+
if (!Object.prototype.hasOwnProperty.call(props, key)) continue;
|
|
243
|
+
const val = props[key];
|
|
244
|
+
if (val === emptyArrayStr) {
|
|
245
|
+
result[key] = [];
|
|
246
|
+
} else if (val === emptyObjectStr) {
|
|
247
|
+
result[key] = {};
|
|
248
|
+
} else {
|
|
249
|
+
result[key] = val;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
var flattenNode = (node, config) => {
|
|
255
|
+
return {
|
|
256
|
+
...node,
|
|
257
|
+
props: encodeEmptyObjects(flatten2(stripSlots(node, config).props))
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
var expandNode = (node) => {
|
|
261
|
+
const props = unflatten(decodeEmptyObjects(node.props));
|
|
262
|
+
return {
|
|
263
|
+
...node,
|
|
264
|
+
props
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// lib/data/to-component.ts
|
|
269
|
+
init_react_import();
|
|
270
|
+
var toComponent = (item) => {
|
|
271
|
+
return "type" in item ? item : {
|
|
272
|
+
...item,
|
|
273
|
+
props: { ...item.props, id: "root" },
|
|
274
|
+
type: "root"
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// lib/data/walk-app-state.ts
|
|
279
|
+
init_react_import();
|
|
280
|
+
|
|
281
|
+
// lib/data/for-related-zones.ts
|
|
282
|
+
init_react_import();
|
|
283
|
+
|
|
284
|
+
// lib/get-zone-id.ts
|
|
285
|
+
init_react_import();
|
|
286
|
+
var getZoneId = (zoneCompound) => {
|
|
287
|
+
if (!zoneCompound) {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
|
291
|
+
return zoneCompound.split(":");
|
|
292
|
+
}
|
|
293
|
+
return [rootDroppableId, zoneCompound];
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// lib/data/for-related-zones.ts
|
|
297
|
+
function forRelatedZones(item, data, cb, path = []) {
|
|
298
|
+
Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
|
|
299
|
+
const [parentId] = getZoneId(zoneCompound);
|
|
300
|
+
if (parentId === item.props.id) {
|
|
301
|
+
cb(path, zoneCompound, content);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// lib/data/walk-app-state.ts
|
|
307
|
+
function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
|
308
|
+
let newZones = {};
|
|
309
|
+
const newZoneIndex = {};
|
|
310
|
+
const newNodeIndex = {};
|
|
311
|
+
const processContent = (path, zoneCompound, content, zoneType, newId) => {
|
|
312
|
+
const [parentId] = zoneCompound.split(":");
|
|
313
|
+
const mappedContent = (mapContent(content, zoneCompound, zoneType) ?? content) || [];
|
|
314
|
+
const [_2, zone] = zoneCompound.split(":");
|
|
315
|
+
const newZoneCompound = `${newId || parentId}:${zone}`;
|
|
316
|
+
const newContent2 = mappedContent.map(
|
|
317
|
+
(zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
|
|
318
|
+
);
|
|
319
|
+
newZoneIndex[newZoneCompound] = {
|
|
320
|
+
contentIds: newContent2.map((item) => item.props.id),
|
|
321
|
+
type: zoneType
|
|
322
|
+
};
|
|
323
|
+
return [newZoneCompound, newContent2];
|
|
324
|
+
};
|
|
325
|
+
const processRelatedZones = (item, newId, initialPath) => {
|
|
326
|
+
forRelatedZones(
|
|
327
|
+
item,
|
|
328
|
+
state.data,
|
|
329
|
+
(relatedPath, relatedZoneCompound, relatedContent) => {
|
|
330
|
+
const [zoneCompound, newContent2] = processContent(
|
|
331
|
+
relatedPath,
|
|
332
|
+
relatedZoneCompound,
|
|
333
|
+
relatedContent,
|
|
334
|
+
"dropzone",
|
|
335
|
+
newId
|
|
336
|
+
);
|
|
337
|
+
newZones[zoneCompound] = newContent2;
|
|
338
|
+
},
|
|
339
|
+
initialPath
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
const processItem = (item, path, index) => {
|
|
343
|
+
const mappedItem = mapNodeOrSkip(item, path, index);
|
|
344
|
+
if (!mappedItem) return item;
|
|
345
|
+
const id = mappedItem.props.id;
|
|
346
|
+
const newProps = {
|
|
347
|
+
...mapFields(
|
|
348
|
+
mappedItem,
|
|
349
|
+
{
|
|
350
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
|
351
|
+
const content = value;
|
|
352
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
|
353
|
+
const [_2, newContent2] = processContent(
|
|
354
|
+
path,
|
|
355
|
+
zoneCompound,
|
|
356
|
+
content,
|
|
357
|
+
"slot",
|
|
358
|
+
parentId2
|
|
359
|
+
);
|
|
360
|
+
return newContent2;
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
config
|
|
364
|
+
).props,
|
|
365
|
+
id
|
|
366
|
+
};
|
|
367
|
+
processRelatedZones(item, id, path);
|
|
368
|
+
const newItem = { ...mappedItem, props: newProps };
|
|
369
|
+
const thisZoneCompound = path[path.length - 1];
|
|
370
|
+
const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
|
|
371
|
+
newNodeIndex[id] = {
|
|
372
|
+
data: newItem,
|
|
373
|
+
flatData: flattenNode(newItem, config),
|
|
374
|
+
path,
|
|
375
|
+
parentId,
|
|
376
|
+
zone
|
|
377
|
+
};
|
|
378
|
+
const finalData = { ...newItem, props: { ...newItem.props } };
|
|
379
|
+
if (newProps.id === "root") {
|
|
380
|
+
delete finalData["type"];
|
|
381
|
+
delete finalData.props["id"];
|
|
382
|
+
}
|
|
383
|
+
return finalData;
|
|
384
|
+
};
|
|
385
|
+
const zones = state.data.zones || {};
|
|
386
|
+
const [_, newContent] = processContent(
|
|
387
|
+
[],
|
|
388
|
+
rootDroppableId,
|
|
389
|
+
state.data.content,
|
|
390
|
+
"root"
|
|
391
|
+
);
|
|
392
|
+
const processedContent = newContent;
|
|
393
|
+
const zonesAlreadyProcessed = Object.keys(newZones);
|
|
394
|
+
Object.keys(zones || {}).forEach((zoneCompound) => {
|
|
395
|
+
const [parentId] = zoneCompound.split(":");
|
|
396
|
+
if (zonesAlreadyProcessed.includes(zoneCompound)) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const [_2, newContent2] = processContent(
|
|
400
|
+
[rootDroppableId],
|
|
401
|
+
zoneCompound,
|
|
402
|
+
zones[zoneCompound],
|
|
403
|
+
"dropzone",
|
|
404
|
+
parentId
|
|
405
|
+
);
|
|
406
|
+
newZones[zoneCompound] = newContent2;
|
|
407
|
+
}, newZones);
|
|
408
|
+
let rootAsComponent = toComponent({
|
|
409
|
+
props: { ...state.data.root.props ?? state.data.root }
|
|
410
|
+
});
|
|
411
|
+
if (state.data.root.readOnly) {
|
|
412
|
+
rootAsComponent.readOnly = state.data.root.readOnly;
|
|
413
|
+
}
|
|
414
|
+
const processedRoot = processItem(rootAsComponent, [], -1);
|
|
415
|
+
const root = {
|
|
416
|
+
...state.data.root,
|
|
417
|
+
...processedRoot
|
|
418
|
+
};
|
|
419
|
+
return {
|
|
420
|
+
...state,
|
|
421
|
+
data: {
|
|
422
|
+
root,
|
|
423
|
+
content: processedContent,
|
|
424
|
+
zones: {
|
|
425
|
+
...state.data.zones,
|
|
426
|
+
...newZones
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
indexes: {
|
|
430
|
+
nodes: { ...state.indexes.nodes, ...newNodeIndex },
|
|
431
|
+
zones: { ...state.indexes.zones, ...newZoneIndex }
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// lib/generate-id.ts
|
|
437
|
+
init_react_import();
|
|
438
|
+
import { v4 as uuidv4 } from "uuid";
|
|
439
|
+
var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
|
|
440
|
+
|
|
441
|
+
// lib/data/setup-zone.ts
|
|
442
|
+
init_react_import();
|
|
443
|
+
var setupZone = (data, zoneKey) => {
|
|
444
|
+
if (zoneKey === rootDroppableId) {
|
|
445
|
+
return data;
|
|
446
|
+
}
|
|
447
|
+
const newData = {
|
|
448
|
+
...data,
|
|
449
|
+
zones: data.zones ? { ...data.zones } : {}
|
|
450
|
+
};
|
|
451
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
|
452
|
+
return newData;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
export {
|
|
456
|
+
rootAreaId,
|
|
457
|
+
rootZone,
|
|
458
|
+
rootDroppableId,
|
|
459
|
+
getZoneId,
|
|
460
|
+
defaultSlots,
|
|
461
|
+
walkField,
|
|
462
|
+
mapFields,
|
|
463
|
+
expandNode,
|
|
464
|
+
toComponent,
|
|
465
|
+
walkAppState,
|
|
466
|
+
generateId,
|
|
467
|
+
walkTree,
|
|
468
|
+
setupZone
|
|
469
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
List,
|
|
3
|
+
ListOrdered
|
|
4
|
+
} from "./chunk-U2NVBXAC.mjs";
|
|
5
|
+
import {
|
|
6
|
+
init_react_import
|
|
7
|
+
} from "./chunk-B4BOBGYB.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
|
+
const blockOptions = useMemo(() => {
|
|
18
|
+
if (fieldOptions?.listItem !== false) {
|
|
19
|
+
return ["ul", "ol"];
|
|
20
|
+
}
|
|
21
|
+
return [];
|
|
22
|
+
}, [fieldOptions?.listItem]);
|
|
23
|
+
return useMemo(
|
|
24
|
+
() => blockOptions.map((item) => ({
|
|
25
|
+
value: item,
|
|
26
|
+
label: optionNodes[item].label,
|
|
27
|
+
icon: optionNodes[item].icon
|
|
28
|
+
})),
|
|
29
|
+
[blockOptions]
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
useListOptions
|
|
35
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "./chunk-B4BOBGYB.mjs";
|
|
4
|
+
|
|
5
|
+
// css-module:/home/crediblemark/Project/NEXT_CMS/packages/components/RichTextEditor/styles.module.css#css-module
|
|
6
|
+
init_react_import();
|
|
7
|
+
var styles_module_default = { "RichTextEditor": "_RichTextEditor_hp4qf_1", "RichTextEditor--editor": "_RichTextEditor--editor_hp4qf_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_hp4qf_107", "RichTextEditor--isActive": "_RichTextEditor--isActive_hp4qf_111", "RichTextEditor-menu": "_RichTextEditor-menu_hp4qf_117" };
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
styles_module_default
|
|
11
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "./chunk-B4BOBGYB.mjs";
|
|
4
|
+
|
|
5
|
+
// components/RichTextEditor/extension.ts
|
|
6
|
+
init_react_import();
|
|
7
|
+
import { Extension } from "@tiptap/core";
|
|
8
|
+
import { Blockquote } from "@tiptap/extension-blockquote";
|
|
9
|
+
import { Bold } from "@tiptap/extension-bold";
|
|
10
|
+
import { Code } from "@tiptap/extension-code";
|
|
11
|
+
import { CodeBlock } from "@tiptap/extension-code-block";
|
|
12
|
+
import { Document } from "@tiptap/extension-document";
|
|
13
|
+
import { HardBreak } from "@tiptap/extension-hard-break";
|
|
14
|
+
import { Heading } from "@tiptap/extension-heading";
|
|
15
|
+
import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
|
|
16
|
+
import { Italic } from "@tiptap/extension-italic";
|
|
17
|
+
import { Link } from "@tiptap/extension-link";
|
|
18
|
+
import {
|
|
19
|
+
BulletList,
|
|
20
|
+
ListItem,
|
|
21
|
+
ListKeymap,
|
|
22
|
+
OrderedList
|
|
23
|
+
} from "@tiptap/extension-list";
|
|
24
|
+
import { Paragraph } from "@tiptap/extension-paragraph";
|
|
25
|
+
import { Strike } from "@tiptap/extension-strike";
|
|
26
|
+
import { Text } from "@tiptap/extension-text";
|
|
27
|
+
import TextAlign from "@tiptap/extension-text-align";
|
|
28
|
+
import { Underline } from "@tiptap/extension-underline";
|
|
29
|
+
var defaultCredBuildRichTextOptions = {
|
|
30
|
+
textAlign: {
|
|
31
|
+
types: ["heading", "paragraph"]
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var CredBuildRichText = Extension.create({
|
|
35
|
+
name: "credbuildRichText",
|
|
36
|
+
addExtensions() {
|
|
37
|
+
const extensions = [];
|
|
38
|
+
const options = {
|
|
39
|
+
...this.options,
|
|
40
|
+
...defaultCredBuildRichTextOptions
|
|
41
|
+
};
|
|
42
|
+
if (options.bold !== false) {
|
|
43
|
+
extensions.push(Bold.configure(options.bold));
|
|
44
|
+
}
|
|
45
|
+
if (options.blockquote !== false) {
|
|
46
|
+
extensions.push(Blockquote.configure(options.blockquote));
|
|
47
|
+
}
|
|
48
|
+
if (options.code !== false) {
|
|
49
|
+
extensions.push(Code.configure(options.code));
|
|
50
|
+
}
|
|
51
|
+
if (options.codeBlock !== false) {
|
|
52
|
+
extensions.push(CodeBlock.configure(options.codeBlock));
|
|
53
|
+
}
|
|
54
|
+
if (options.document !== false) {
|
|
55
|
+
extensions.push(Document.configure(options.document));
|
|
56
|
+
}
|
|
57
|
+
if (options.hardBreak !== false) {
|
|
58
|
+
extensions.push(HardBreak.configure(options.hardBreak));
|
|
59
|
+
}
|
|
60
|
+
if (options.heading !== false) {
|
|
61
|
+
extensions.push(Heading.configure(options.heading));
|
|
62
|
+
}
|
|
63
|
+
if (options.horizontalRule !== false) {
|
|
64
|
+
extensions.push(HorizontalRule.configure(options.horizontalRule));
|
|
65
|
+
}
|
|
66
|
+
if (options.italic !== false) {
|
|
67
|
+
extensions.push(Italic.configure(options.italic));
|
|
68
|
+
}
|
|
69
|
+
if (options.listItem !== false) {
|
|
70
|
+
extensions.push(ListItem.configure(options.listItem));
|
|
71
|
+
if (options.bulletList !== false) {
|
|
72
|
+
extensions.push(BulletList.configure(options.bulletList));
|
|
73
|
+
}
|
|
74
|
+
if (options.orderedList !== false) {
|
|
75
|
+
extensions.push(OrderedList.configure(options.orderedList));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (options.listKeymap !== false) {
|
|
79
|
+
extensions.push(ListKeymap.configure(options?.listKeymap));
|
|
80
|
+
}
|
|
81
|
+
if (options.link !== false) {
|
|
82
|
+
extensions.push(Link.configure(options?.link));
|
|
83
|
+
}
|
|
84
|
+
if (options.paragraph !== false) {
|
|
85
|
+
extensions.push(Paragraph.configure(options.paragraph));
|
|
86
|
+
}
|
|
87
|
+
if (options.strike !== false) {
|
|
88
|
+
extensions.push(Strike.configure(options.strike));
|
|
89
|
+
}
|
|
90
|
+
if (options.text !== false) {
|
|
91
|
+
extensions.push(Text.configure(options.text));
|
|
92
|
+
}
|
|
93
|
+
if (options.textAlign !== false) {
|
|
94
|
+
extensions.push(TextAlign.configure(options.textAlign));
|
|
95
|
+
}
|
|
96
|
+
if (options.underline !== false) {
|
|
97
|
+
extensions.push(Underline.configure(options?.underline));
|
|
98
|
+
}
|
|
99
|
+
return extensions;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
CredBuildRichText
|
|
105
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Heading1,
|
|
3
|
+
Heading2,
|
|
4
|
+
Heading3,
|
|
5
|
+
Heading4,
|
|
6
|
+
Heading5,
|
|
7
|
+
Heading6
|
|
8
|
+
} from "./chunk-U2NVBXAC.mjs";
|
|
9
|
+
import {
|
|
10
|
+
init_react_import
|
|
11
|
+
} from "./chunk-B4BOBGYB.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
|
+
const blockOptions = useMemo(() => {
|
|
26
|
+
const options = [];
|
|
27
|
+
if (fieldOptions?.heading !== false) {
|
|
28
|
+
if (!fieldOptions?.heading?.levels) {
|
|
29
|
+
return ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
30
|
+
} else {
|
|
31
|
+
if (fieldOptions?.heading.levels.includes(1)) {
|
|
32
|
+
options.push("h1");
|
|
33
|
+
}
|
|
34
|
+
if (fieldOptions?.heading.levels.includes(2)) {
|
|
35
|
+
options.push("h2");
|
|
36
|
+
}
|
|
37
|
+
if (fieldOptions?.heading.levels.includes(3)) {
|
|
38
|
+
options.push("h3");
|
|
39
|
+
}
|
|
40
|
+
if (fieldOptions?.heading.levels.includes(4)) {
|
|
41
|
+
options.push("h4");
|
|
42
|
+
}
|
|
43
|
+
if (fieldOptions?.heading.levels.includes(5)) {
|
|
44
|
+
options.push("h5");
|
|
45
|
+
}
|
|
46
|
+
if (fieldOptions?.heading.levels.includes(6)) {
|
|
47
|
+
options.push("h6");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return options;
|
|
52
|
+
}, [fieldOptions?.heading]);
|
|
53
|
+
return useMemo(
|
|
54
|
+
() => blockOptions.map((item) => ({
|
|
55
|
+
value: item,
|
|
56
|
+
label: optionNodes[item].label,
|
|
57
|
+
icon: optionNodes[item].icon
|
|
58
|
+
})),
|
|
59
|
+
[blockOptions]
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
useHeadingOptions
|
|
65
|
+
};
|