@measured/puck-plugin-heading-analyzer 0.19.0-canary.0ea6ce4 → 0.19.0-canary.1286b503
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +1544 -196
- package/dist/index.mjs +1538 -200
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -61,6 +61,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
61
61
|
mod
|
62
62
|
));
|
63
63
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
64
|
+
var __async = (__this, __arguments, generator) => {
|
65
|
+
return new Promise((resolve, reject) => {
|
66
|
+
var fulfilled = (value) => {
|
67
|
+
try {
|
68
|
+
step(generator.next(value));
|
69
|
+
} catch (e) {
|
70
|
+
reject(e);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
var rejected = (value) => {
|
74
|
+
try {
|
75
|
+
step(generator.throw(value));
|
76
|
+
} catch (e) {
|
77
|
+
reject(e);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
81
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
82
|
+
});
|
83
|
+
};
|
64
84
|
|
65
85
|
// ../tsup-config/react-import.js
|
66
86
|
var import_react;
|
@@ -133,6 +153,42 @@ var require_classnames = __commonJS({
|
|
133
153
|
}
|
134
154
|
});
|
135
155
|
|
156
|
+
// ../../node_modules/fast-deep-equal/index.js
|
157
|
+
var require_fast_deep_equal = __commonJS({
|
158
|
+
"../../node_modules/fast-deep-equal/index.js"(exports2, module2) {
|
159
|
+
"use strict";
|
160
|
+
init_react_import();
|
161
|
+
module2.exports = function equal(a, b) {
|
162
|
+
if (a === b) return true;
|
163
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
164
|
+
if (a.constructor !== b.constructor) return false;
|
165
|
+
var length, i, keys;
|
166
|
+
if (Array.isArray(a)) {
|
167
|
+
length = a.length;
|
168
|
+
if (length != b.length) return false;
|
169
|
+
for (i = length; i-- !== 0; )
|
170
|
+
if (!equal(a[i], b[i])) return false;
|
171
|
+
return true;
|
172
|
+
}
|
173
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
174
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
175
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
176
|
+
keys = Object.keys(a);
|
177
|
+
length = keys.length;
|
178
|
+
if (length !== Object.keys(b).length) return false;
|
179
|
+
for (i = length; i-- !== 0; )
|
180
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
181
|
+
for (i = length; i-- !== 0; ) {
|
182
|
+
var key = keys[i];
|
183
|
+
if (!equal(a[key], b[key])) return false;
|
184
|
+
}
|
185
|
+
return true;
|
186
|
+
}
|
187
|
+
return a !== a && b !== b;
|
188
|
+
};
|
189
|
+
}
|
190
|
+
});
|
191
|
+
|
136
192
|
// index.ts
|
137
193
|
var plugin_heading_analyzer_exports = {};
|
138
194
|
__export(plugin_heading_analyzer_exports, {
|
@@ -143,7 +199,7 @@ init_react_import();
|
|
143
199
|
|
144
200
|
// src/HeadingAnalyzer.tsx
|
145
201
|
init_react_import();
|
146
|
-
var
|
202
|
+
var import_react11 = require("react");
|
147
203
|
|
148
204
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
149
205
|
init_react_import();
|
@@ -304,122 +360,771 @@ var ChevronRight = createLucideIcon("ChevronRight", [
|
|
304
360
|
|
305
361
|
// ../core/lib/use-breadcrumbs.ts
|
306
362
|
init_react_import();
|
307
|
-
var
|
363
|
+
var import_react10 = require("react");
|
308
364
|
|
309
|
-
// ../core/
|
365
|
+
// ../core/store/index.ts
|
310
366
|
init_react_import();
|
311
|
-
var import_react7 = require("react");
|
312
367
|
|
313
|
-
// ../core/
|
368
|
+
// ../core/reducer/index.ts
|
369
|
+
init_react_import();
|
370
|
+
|
371
|
+
// ../core/reducer/actions/set.ts
|
372
|
+
init_react_import();
|
373
|
+
|
374
|
+
// ../core/lib/data/walk-tree.ts
|
375
|
+
init_react_import();
|
376
|
+
|
377
|
+
// ../core/lib/data/for-each-slot.ts
|
314
378
|
init_react_import();
|
315
|
-
var import_react6 = require("react");
|
316
379
|
|
317
|
-
// ../core/lib/
|
380
|
+
// ../core/lib/data/is-slot.ts
|
381
|
+
init_react_import();
|
382
|
+
var isSlot = (prop) => {
|
383
|
+
var _a, _b;
|
384
|
+
return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
|
385
|
+
};
|
386
|
+
var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
|
387
|
+
var _a, _b;
|
388
|
+
const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
|
389
|
+
if (!configForComponent) return isSlot(propValue);
|
390
|
+
return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
|
391
|
+
};
|
392
|
+
|
393
|
+
// ../core/lib/data/for-each-slot.ts
|
394
|
+
var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
|
395
|
+
const props = item.props || {};
|
396
|
+
const propKeys = Object.keys(props);
|
397
|
+
for (let i = 0; i < propKeys.length; i++) {
|
398
|
+
const propKey = propKeys[i];
|
399
|
+
const itemType = "type" in item ? item.type : "root";
|
400
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
401
|
+
const content = props[propKey];
|
402
|
+
cb(props.id, propKey, content);
|
403
|
+
if (recursive) {
|
404
|
+
content.forEach(
|
405
|
+
(childItem) => __async(void 0, null, function* () {
|
406
|
+
return forEachSlot(childItem, cb, true, isSlot2);
|
407
|
+
})
|
408
|
+
);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
}
|
412
|
+
};
|
413
|
+
|
414
|
+
// ../core/lib/data/for-related-zones.ts
|
415
|
+
init_react_import();
|
416
|
+
|
417
|
+
// ../core/lib/get-zone-id.ts
|
318
418
|
init_react_import();
|
319
419
|
|
320
420
|
// ../core/lib/root-droppable-id.ts
|
321
421
|
init_react_import();
|
322
|
-
var
|
422
|
+
var rootAreaId = "root";
|
423
|
+
var rootZone = "default-zone";
|
424
|
+
var rootDroppableId = `${rootAreaId}:${rootZone}`;
|
425
|
+
|
426
|
+
// ../core/lib/get-zone-id.ts
|
427
|
+
var getZoneId = (zoneCompound) => {
|
428
|
+
if (!zoneCompound) {
|
429
|
+
return [];
|
430
|
+
}
|
431
|
+
if (zoneCompound && zoneCompound.indexOf(":") > -1) {
|
432
|
+
return zoneCompound.split(":");
|
433
|
+
}
|
434
|
+
return [rootDroppableId, zoneCompound];
|
435
|
+
};
|
323
436
|
|
324
|
-
// ../core/lib/
|
437
|
+
// ../core/lib/data/for-related-zones.ts
|
438
|
+
function forRelatedZones(item, data, cb, path = []) {
|
439
|
+
Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
|
440
|
+
const [parentId] = getZoneId(zoneCompound);
|
441
|
+
if (parentId === item.props.id) {
|
442
|
+
cb(path, zoneCompound, content);
|
443
|
+
}
|
444
|
+
});
|
445
|
+
}
|
446
|
+
|
447
|
+
// ../core/lib/data/strip-slots.ts
|
325
448
|
init_react_import();
|
449
|
+
var stripSlots = (data) => {
|
450
|
+
return __spreadProps(__spreadValues({}, data), {
|
451
|
+
props: Object.entries(data.props).reduce(
|
452
|
+
(acc, [propKey, propVal]) => {
|
453
|
+
if (isSlot(propVal)) {
|
454
|
+
return acc;
|
455
|
+
}
|
456
|
+
return __spreadProps(__spreadValues({}, acc), { [propKey]: propVal });
|
457
|
+
},
|
458
|
+
{ id: data.props.id }
|
459
|
+
)
|
460
|
+
});
|
461
|
+
};
|
326
462
|
|
327
|
-
// ../core/
|
463
|
+
// ../core/lib/data/walk-tree.ts
|
464
|
+
function walkTree(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
|
465
|
+
var _a;
|
466
|
+
let newZones = {};
|
467
|
+
const newZoneIndex = {};
|
468
|
+
const newNodeIndex = {};
|
469
|
+
const processContent = (path, zoneCompound, content, zoneType, newId) => {
|
470
|
+
var _a2;
|
471
|
+
const [parentId] = zoneCompound.split(":");
|
472
|
+
const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
|
473
|
+
const [_2, zone] = zoneCompound.split(":");
|
474
|
+
const newZoneCompound = `${newId || parentId}:${zone}`;
|
475
|
+
const newContent2 = mappedContent.map(
|
476
|
+
(zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
|
477
|
+
);
|
478
|
+
newZoneIndex[newZoneCompound] = {
|
479
|
+
contentIds: newContent2.map((item) => item.props.id),
|
480
|
+
type: zoneType
|
481
|
+
};
|
482
|
+
return [newZoneCompound, newContent2];
|
483
|
+
};
|
484
|
+
const processRelatedZones = (item, newId, initialPath) => {
|
485
|
+
forRelatedZones(
|
486
|
+
item,
|
487
|
+
state.data,
|
488
|
+
(relatedPath, relatedZoneCompound, relatedContent) => {
|
489
|
+
const [zoneCompound, newContent2] = processContent(
|
490
|
+
relatedPath,
|
491
|
+
relatedZoneCompound,
|
492
|
+
relatedContent,
|
493
|
+
"dropzone",
|
494
|
+
newId
|
495
|
+
);
|
496
|
+
newZones[zoneCompound] = newContent2;
|
497
|
+
},
|
498
|
+
initialPath
|
499
|
+
);
|
500
|
+
};
|
501
|
+
const processItem = (item, path, index) => {
|
502
|
+
const mappedItem = mapNodeOrSkip(item, path, index);
|
503
|
+
if (!mappedItem) return item;
|
504
|
+
const id = mappedItem.props.id;
|
505
|
+
const newProps = __spreadValues({}, mappedItem.props);
|
506
|
+
forEachSlot(
|
507
|
+
mappedItem,
|
508
|
+
(parentId2, slotId, content) => {
|
509
|
+
const zoneCompound = `${parentId2}:${slotId}`;
|
510
|
+
const [_2, newContent2] = processContent(
|
511
|
+
path,
|
512
|
+
zoneCompound,
|
513
|
+
content,
|
514
|
+
"slot",
|
515
|
+
parentId2
|
516
|
+
);
|
517
|
+
newProps[slotId] = newContent2;
|
518
|
+
},
|
519
|
+
false,
|
520
|
+
createIsSlotConfig(config)
|
521
|
+
);
|
522
|
+
processRelatedZones(item, id, path);
|
523
|
+
const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
|
524
|
+
const thisZoneCompound = path[path.length - 1];
|
525
|
+
const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
|
526
|
+
newNodeIndex[id] = {
|
527
|
+
data: newItem,
|
528
|
+
flatData: stripSlots(newItem),
|
529
|
+
path,
|
530
|
+
parentId,
|
531
|
+
zone
|
532
|
+
};
|
533
|
+
const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
|
534
|
+
if (newProps.id === "root") {
|
535
|
+
delete finalData["type"];
|
536
|
+
delete finalData.props["id"];
|
537
|
+
}
|
538
|
+
return finalData;
|
539
|
+
};
|
540
|
+
const zones = state.data.zones || {};
|
541
|
+
const [_, newContent] = processContent(
|
542
|
+
[],
|
543
|
+
rootDroppableId,
|
544
|
+
state.data.content,
|
545
|
+
"root"
|
546
|
+
);
|
547
|
+
const processedContent = newContent;
|
548
|
+
const zonesAlreadyProcessed = Object.keys(newZones);
|
549
|
+
Object.keys(zones || {}).forEach((zoneCompound) => {
|
550
|
+
const [parentId] = zoneCompound.split(":");
|
551
|
+
if (zonesAlreadyProcessed.includes(zoneCompound)) {
|
552
|
+
return;
|
553
|
+
}
|
554
|
+
const [_2, newContent2] = processContent(
|
555
|
+
[rootDroppableId],
|
556
|
+
zoneCompound,
|
557
|
+
zones[zoneCompound],
|
558
|
+
"dropzone",
|
559
|
+
parentId
|
560
|
+
);
|
561
|
+
newZones[zoneCompound] = newContent2;
|
562
|
+
}, newZones);
|
563
|
+
const processedRoot = processItem(
|
564
|
+
{
|
565
|
+
type: "root",
|
566
|
+
props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
|
567
|
+
},
|
568
|
+
[],
|
569
|
+
-1
|
570
|
+
);
|
571
|
+
const root = __spreadProps(__spreadValues({}, state.data.root), {
|
572
|
+
props: processedRoot.props
|
573
|
+
});
|
574
|
+
return __spreadProps(__spreadValues({}, state), {
|
575
|
+
data: {
|
576
|
+
root,
|
577
|
+
content: processedContent,
|
578
|
+
zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
|
579
|
+
},
|
580
|
+
indexes: {
|
581
|
+
nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
|
582
|
+
zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
|
583
|
+
}
|
584
|
+
});
|
585
|
+
}
|
586
|
+
|
587
|
+
// ../core/reducer/actions/set.ts
|
588
|
+
var setAction = (state, action, appStore) => {
|
589
|
+
if (typeof action.state === "object") {
|
590
|
+
const newState = __spreadValues(__spreadValues({}, state), action.state);
|
591
|
+
if (action.state.indexes) {
|
592
|
+
return newState;
|
593
|
+
}
|
594
|
+
console.warn(
|
595
|
+
"`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
596
|
+
);
|
597
|
+
return walkTree(newState, appStore.config);
|
598
|
+
}
|
599
|
+
return __spreadValues(__spreadValues({}, state), action.state(state));
|
600
|
+
};
|
601
|
+
|
602
|
+
// ../core/reducer/actions/insert.ts
|
328
603
|
init_react_import();
|
329
|
-
var defaultViewports = [
|
330
|
-
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
331
|
-
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
332
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
333
|
-
];
|
334
604
|
|
335
|
-
// ../core/lib/
|
605
|
+
// ../core/lib/data/insert.ts
|
336
606
|
init_react_import();
|
337
|
-
var
|
607
|
+
var insert = (list, index, item) => {
|
608
|
+
const result = Array.from(list || []);
|
609
|
+
result.splice(index, 0, item);
|
610
|
+
return result;
|
611
|
+
};
|
338
612
|
|
339
|
-
// ../core/lib/
|
613
|
+
// ../core/lib/generate-id.ts
|
340
614
|
init_react_import();
|
341
615
|
|
342
|
-
//
|
616
|
+
// ../../node_modules/uuid/dist/esm-node/index.js
|
343
617
|
init_react_import();
|
344
618
|
|
345
|
-
//
|
619
|
+
// ../../node_modules/uuid/dist/esm-node/rng.js
|
346
620
|
init_react_import();
|
347
|
-
var
|
621
|
+
var import_crypto = __toESM(require("crypto"));
|
622
|
+
var rnds8Pool = new Uint8Array(256);
|
623
|
+
var poolPtr = rnds8Pool.length;
|
624
|
+
function rng() {
|
625
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
626
|
+
import_crypto.default.randomFillSync(rnds8Pool);
|
627
|
+
poolPtr = 0;
|
628
|
+
}
|
629
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
630
|
+
}
|
348
631
|
|
349
|
-
//
|
632
|
+
// ../../node_modules/uuid/dist/esm-node/stringify.js
|
350
633
|
init_react_import();
|
634
|
+
var byteToHex = [];
|
635
|
+
for (let i = 0; i < 256; ++i) {
|
636
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
637
|
+
}
|
638
|
+
function unsafeStringify(arr, offset = 0) {
|
639
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
640
|
+
}
|
351
641
|
|
352
|
-
//
|
642
|
+
// ../../node_modules/uuid/dist/esm-node/v4.js
|
353
643
|
init_react_import();
|
354
644
|
|
355
|
-
//
|
645
|
+
// ../../node_modules/uuid/dist/esm-node/native.js
|
356
646
|
init_react_import();
|
647
|
+
var import_crypto2 = __toESM(require("crypto"));
|
648
|
+
var native_default = {
|
649
|
+
randomUUID: import_crypto2.default.randomUUID
|
650
|
+
};
|
357
651
|
|
358
|
-
//
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
652
|
+
// ../../node_modules/uuid/dist/esm-node/v4.js
|
653
|
+
function v4(options, buf, offset) {
|
654
|
+
if (native_default.randomUUID && !buf && !options) {
|
655
|
+
return native_default.randomUUID();
|
656
|
+
}
|
657
|
+
options = options || {};
|
658
|
+
const rnds = options.random || (options.rng || rng)();
|
659
|
+
rnds[6] = rnds[6] & 15 | 64;
|
660
|
+
rnds[8] = rnds[8] & 63 | 128;
|
661
|
+
if (buf) {
|
662
|
+
offset = offset || 0;
|
663
|
+
for (let i = 0; i < 16; ++i) {
|
664
|
+
buf[offset + i] = rnds[i];
|
665
|
+
}
|
666
|
+
return buf;
|
667
|
+
}
|
668
|
+
return unsafeStringify(rnds);
|
669
|
+
}
|
670
|
+
var v4_default = v4;
|
671
|
+
|
672
|
+
// ../core/lib/generate-id.ts
|
673
|
+
var generateId = (type) => type ? `${type}-${v4_default()}` : v4_default();
|
674
|
+
|
675
|
+
// ../core/lib/data/get-ids-for-parent.ts
|
676
|
+
init_react_import();
|
677
|
+
var getIdsForParent = (zoneCompound, state) => {
|
678
|
+
const [parentId] = zoneCompound.split(":");
|
679
|
+
const node = state.indexes.nodes[parentId];
|
680
|
+
return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
|
681
|
+
};
|
682
|
+
|
683
|
+
// ../core/reducer/actions/insert.ts
|
684
|
+
function insertAction(state, action, appStore) {
|
685
|
+
const id = action.id || generateId(action.componentType);
|
686
|
+
const emptyComponentData = {
|
687
|
+
type: action.componentType,
|
688
|
+
props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
|
689
|
+
id
|
690
|
+
})
|
691
|
+
};
|
692
|
+
const [parentId] = action.destinationZone.split(":");
|
693
|
+
const idsInPath = getIdsForParent(action.destinationZone, state);
|
694
|
+
return walkTree(
|
695
|
+
state,
|
696
|
+
appStore.config,
|
697
|
+
(content, zoneCompound) => {
|
698
|
+
if (zoneCompound === action.destinationZone) {
|
699
|
+
return insert(
|
700
|
+
content || [],
|
701
|
+
action.destinationIndex,
|
702
|
+
emptyComponentData
|
703
|
+
);
|
704
|
+
}
|
705
|
+
return content;
|
377
706
|
},
|
378
|
-
|
707
|
+
(childItem, path) => {
|
708
|
+
if (childItem.props.id === id || childItem.props.id === parentId) {
|
709
|
+
return childItem;
|
710
|
+
} else if (idsInPath.includes(childItem.props.id)) {
|
711
|
+
return childItem;
|
712
|
+
} else if (path.includes(action.destinationZone)) {
|
713
|
+
return childItem;
|
714
|
+
}
|
715
|
+
return null;
|
716
|
+
}
|
717
|
+
);
|
718
|
+
}
|
719
|
+
|
720
|
+
// ../core/reducer/actions/replace.ts
|
721
|
+
init_react_import();
|
722
|
+
var replaceAction = (state, action, appStore) => {
|
723
|
+
const [parentId] = action.destinationZone.split(":");
|
724
|
+
const idsInPath = getIdsForParent(action.destinationZone, state);
|
725
|
+
const originalId = state.indexes.zones[action.destinationZone].contentIds[action.destinationIndex];
|
726
|
+
const idChanged = originalId !== action.data.props.id;
|
727
|
+
if (idChanged) {
|
728
|
+
throw new Error(
|
729
|
+
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
730
|
+
);
|
379
731
|
}
|
732
|
+
return walkTree(
|
733
|
+
state,
|
734
|
+
appStore.config,
|
735
|
+
(content, zoneCompound) => {
|
736
|
+
const newContent = [...content];
|
737
|
+
if (zoneCompound === action.destinationZone) {
|
738
|
+
newContent[action.destinationIndex] = action.data;
|
739
|
+
}
|
740
|
+
return newContent;
|
741
|
+
},
|
742
|
+
(childItem, path) => {
|
743
|
+
const pathIds = path.map((p) => p.split(":")[0]);
|
744
|
+
if (childItem.props.id === action.data.props.id) {
|
745
|
+
return action.data;
|
746
|
+
} else if (childItem.props.id === parentId) {
|
747
|
+
return childItem;
|
748
|
+
} else if (idsInPath.indexOf(childItem.props.id) > -1) {
|
749
|
+
return childItem;
|
750
|
+
} else if (pathIds.indexOf(action.data.props.id) > -1) {
|
751
|
+
return childItem;
|
752
|
+
}
|
753
|
+
return null;
|
754
|
+
}
|
755
|
+
);
|
380
756
|
};
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
757
|
+
|
758
|
+
// ../core/reducer/actions/replace-root.ts
|
759
|
+
init_react_import();
|
760
|
+
var replaceRootAction = (state, action, appStore) => {
|
761
|
+
return walkTree(
|
762
|
+
state,
|
763
|
+
appStore.config,
|
764
|
+
(content) => content,
|
765
|
+
(childItem) => {
|
766
|
+
if (childItem.props.id === "root") {
|
767
|
+
return __spreadProps(__spreadValues({}, childItem), {
|
768
|
+
props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
|
769
|
+
readOnly: action.root.readOnly
|
770
|
+
});
|
771
|
+
}
|
772
|
+
return childItem;
|
773
|
+
}
|
774
|
+
);
|
775
|
+
};
|
776
|
+
|
777
|
+
// ../core/reducer/actions/duplicate.ts
|
778
|
+
init_react_import();
|
779
|
+
|
780
|
+
// ../core/lib/data/get-item.ts
|
781
|
+
init_react_import();
|
782
|
+
function getItem(selector, state) {
|
783
|
+
var _a, _b;
|
784
|
+
const zone = (_a = state.indexes.zones) == null ? void 0 : _a[selector.zone || rootDroppableId];
|
785
|
+
return zone ? (_b = state.indexes.nodes[zone.contentIds[selector.index]]) == null ? void 0 : _b.data : void 0;
|
786
|
+
}
|
787
|
+
|
788
|
+
// ../core/reducer/actions/duplicate.ts
|
789
|
+
function duplicateAction(state, action, appStore) {
|
790
|
+
const item = getItem(
|
791
|
+
{ index: action.sourceIndex, zone: action.sourceZone },
|
792
|
+
state
|
793
|
+
);
|
794
|
+
const idsInPath = getIdsForParent(action.sourceZone, state);
|
795
|
+
const newItem = __spreadProps(__spreadValues({}, item), {
|
796
|
+
props: __spreadProps(__spreadValues({}, item.props), {
|
797
|
+
id: generateId(item.type)
|
798
|
+
})
|
799
|
+
});
|
800
|
+
const modified = walkTree(
|
801
|
+
state,
|
802
|
+
appStore.config,
|
803
|
+
(content, zoneCompound) => {
|
804
|
+
if (zoneCompound === action.sourceZone) {
|
805
|
+
return insert(content, action.sourceIndex + 1, item);
|
806
|
+
}
|
807
|
+
return content;
|
808
|
+
},
|
809
|
+
(childItem, path, index) => {
|
810
|
+
const zoneCompound = path[path.length - 1];
|
811
|
+
const parents = path.map((p) => p.split(":")[0]);
|
812
|
+
if (parents.indexOf(newItem.props.id) > -1) {
|
813
|
+
return __spreadProps(__spreadValues({}, childItem), {
|
814
|
+
props: __spreadProps(__spreadValues({}, childItem.props), {
|
815
|
+
id: generateId(childItem.type)
|
816
|
+
})
|
817
|
+
});
|
818
|
+
}
|
819
|
+
if (zoneCompound === action.sourceZone && index === action.sourceIndex + 1) {
|
820
|
+
return newItem;
|
821
|
+
}
|
822
|
+
const [sourceZoneParent] = action.sourceZone.split(":");
|
823
|
+
if (sourceZoneParent === childItem.props.id || idsInPath.indexOf(childItem.props.id) > -1) {
|
824
|
+
return childItem;
|
825
|
+
}
|
826
|
+
return null;
|
827
|
+
}
|
828
|
+
);
|
829
|
+
return __spreadProps(__spreadValues({}, modified), {
|
830
|
+
ui: __spreadProps(__spreadValues({}, modified.ui), {
|
831
|
+
itemSelector: {
|
832
|
+
index: action.sourceIndex + 1,
|
833
|
+
zone: action.sourceZone
|
834
|
+
}
|
835
|
+
})
|
836
|
+
});
|
837
|
+
}
|
838
|
+
|
839
|
+
// ../core/reducer/actions/reorder.ts
|
840
|
+
init_react_import();
|
841
|
+
|
842
|
+
// ../core/reducer/actions/move.ts
|
843
|
+
init_react_import();
|
844
|
+
|
845
|
+
// ../core/lib/data/remove.ts
|
846
|
+
init_react_import();
|
847
|
+
var remove = (list, index) => {
|
848
|
+
const result = Array.from(list);
|
849
|
+
result.splice(index, 1);
|
850
|
+
return result;
|
851
|
+
};
|
852
|
+
|
853
|
+
// ../core/reducer/actions/move.ts
|
854
|
+
var moveAction = (state, action, appStore) => {
|
855
|
+
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
856
|
+
return state;
|
857
|
+
}
|
858
|
+
const item = getItem(
|
859
|
+
{ zone: action.sourceZone, index: action.sourceIndex },
|
860
|
+
state
|
861
|
+
);
|
862
|
+
if (!item) return state;
|
863
|
+
const idsInSourcePath = getIdsForParent(action.sourceZone, state);
|
864
|
+
const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
|
865
|
+
return walkTree(
|
866
|
+
state,
|
867
|
+
appStore.config,
|
868
|
+
(content, zoneCompound) => {
|
869
|
+
if (zoneCompound === action.sourceZone && zoneCompound === action.destinationZone) {
|
870
|
+
return insert(
|
871
|
+
remove(content, action.sourceIndex),
|
872
|
+
action.destinationIndex,
|
873
|
+
item
|
874
|
+
);
|
875
|
+
} else if (zoneCompound === action.sourceZone) {
|
876
|
+
return remove(content, action.sourceIndex);
|
877
|
+
} else if (zoneCompound === action.destinationZone) {
|
878
|
+
return insert(content, action.destinationIndex, item);
|
879
|
+
}
|
880
|
+
return content;
|
881
|
+
},
|
882
|
+
(childItem, path) => {
|
883
|
+
const [sourceZoneParent] = action.sourceZone.split(":");
|
884
|
+
const [destinationZoneParent] = action.destinationZone.split(":");
|
885
|
+
const childId = childItem.props.id;
|
886
|
+
if (sourceZoneParent === childId || destinationZoneParent === childId || item.props.id === childId || idsInSourcePath.indexOf(childId) > -1 || idsInDestinationPath.indexOf(childId) > -1 || path.includes(action.destinationZone)) {
|
887
|
+
return childItem;
|
888
|
+
}
|
889
|
+
return null;
|
419
890
|
}
|
891
|
+
);
|
892
|
+
};
|
893
|
+
|
894
|
+
// ../core/reducer/actions/reorder.ts
|
895
|
+
var reorderAction = (state, action, appStore) => {
|
896
|
+
return moveAction(
|
897
|
+
state,
|
898
|
+
{
|
899
|
+
type: "move",
|
900
|
+
sourceIndex: action.sourceIndex,
|
901
|
+
sourceZone: action.destinationZone,
|
902
|
+
destinationIndex: action.destinationIndex,
|
903
|
+
destinationZone: action.destinationZone
|
904
|
+
},
|
905
|
+
appStore
|
906
|
+
);
|
907
|
+
};
|
908
|
+
|
909
|
+
// ../core/reducer/actions/remove.ts
|
910
|
+
init_react_import();
|
911
|
+
var removeAction = (state, action, appStore) => {
|
912
|
+
const item = getItem({ index: action.index, zone: action.zone }, state);
|
913
|
+
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
914
|
+
(acc, [nodeId, nodeData]) => {
|
915
|
+
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
916
|
+
if (pathIds.includes(item.props.id)) {
|
917
|
+
return [...acc, nodeId];
|
918
|
+
}
|
919
|
+
return acc;
|
920
|
+
},
|
921
|
+
[item.props.id]
|
922
|
+
);
|
923
|
+
const newState = walkTree(
|
924
|
+
state,
|
925
|
+
appStore.config,
|
926
|
+
(content, zoneCompound) => {
|
927
|
+
if (zoneCompound === action.zone) {
|
928
|
+
return remove(content, action.index);
|
929
|
+
}
|
930
|
+
return content;
|
931
|
+
}
|
932
|
+
);
|
933
|
+
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
934
|
+
const parentId = zoneCompound.split(":")[0];
|
935
|
+
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
936
|
+
delete newState.data.zones[zoneCompound];
|
937
|
+
}
|
938
|
+
});
|
939
|
+
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
940
|
+
const parentId = zoneCompound.split(":")[0];
|
941
|
+
if (nodesToDelete.includes(parentId)) {
|
942
|
+
delete newState.indexes.zones[zoneCompound];
|
943
|
+
}
|
944
|
+
});
|
945
|
+
nodesToDelete.forEach((id) => {
|
946
|
+
delete newState.indexes.nodes[id];
|
947
|
+
});
|
948
|
+
return newState;
|
949
|
+
};
|
950
|
+
|
951
|
+
// ../core/reducer/actions/register-zone.ts
|
952
|
+
init_react_import();
|
953
|
+
|
954
|
+
// ../core/lib/data/setup-zone.ts
|
955
|
+
init_react_import();
|
956
|
+
var setupZone = (data, zoneKey) => {
|
957
|
+
if (zoneKey === rootDroppableId) {
|
958
|
+
return data;
|
959
|
+
}
|
960
|
+
const newData = __spreadProps(__spreadValues({}, data), {
|
961
|
+
zones: data.zones ? __spreadValues({}, data.zones) : {}
|
962
|
+
});
|
963
|
+
newData.zones[zoneKey] = newData.zones[zoneKey] || [];
|
964
|
+
return newData;
|
965
|
+
};
|
966
|
+
|
967
|
+
// ../core/reducer/actions/register-zone.ts
|
968
|
+
var zoneCache = {};
|
969
|
+
function registerZoneAction(state, action) {
|
970
|
+
if (zoneCache[action.zone]) {
|
971
|
+
return __spreadProps(__spreadValues({}, state), {
|
972
|
+
data: __spreadProps(__spreadValues({}, state.data), {
|
973
|
+
zones: __spreadProps(__spreadValues({}, state.data.zones), {
|
974
|
+
[action.zone]: zoneCache[action.zone]
|
975
|
+
})
|
976
|
+
}),
|
977
|
+
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
978
|
+
zones: __spreadProps(__spreadValues({}, state.indexes.zones), {
|
979
|
+
[action.zone]: __spreadProps(__spreadValues({}, state.indexes.zones[action.zone]), {
|
980
|
+
contentIds: zoneCache[action.zone].map((item) => item.props.id),
|
981
|
+
type: "dropzone"
|
982
|
+
})
|
983
|
+
})
|
984
|
+
})
|
985
|
+
});
|
986
|
+
}
|
987
|
+
return __spreadProps(__spreadValues({}, state), { data: setupZone(state.data, action.zone) });
|
988
|
+
}
|
989
|
+
function unregisterZoneAction(state, action) {
|
990
|
+
const _zones = __spreadValues({}, state.data.zones || {});
|
991
|
+
const zoneIndex = __spreadValues({}, state.indexes.zones || {});
|
992
|
+
if (_zones[action.zone]) {
|
993
|
+
zoneCache[action.zone] = _zones[action.zone];
|
994
|
+
delete _zones[action.zone];
|
995
|
+
}
|
996
|
+
delete zoneIndex[action.zone];
|
997
|
+
return __spreadProps(__spreadValues({}, state), {
|
998
|
+
data: __spreadProps(__spreadValues({}, state.data), {
|
999
|
+
zones: _zones
|
1000
|
+
}),
|
1001
|
+
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
1002
|
+
zones: zoneIndex
|
1003
|
+
})
|
420
1004
|
});
|
421
1005
|
}
|
422
1006
|
|
1007
|
+
// ../core/reducer/actions/set-data.ts
|
1008
|
+
init_react_import();
|
1009
|
+
var setDataAction = (state, action, appStore) => {
|
1010
|
+
if (typeof action.data === "object") {
|
1011
|
+
console.warn(
|
1012
|
+
"`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
1013
|
+
);
|
1014
|
+
return walkTree(
|
1015
|
+
__spreadProps(__spreadValues({}, state), {
|
1016
|
+
data: __spreadValues(__spreadValues({}, state.data), action.data)
|
1017
|
+
}),
|
1018
|
+
appStore.config
|
1019
|
+
);
|
1020
|
+
}
|
1021
|
+
return walkTree(
|
1022
|
+
__spreadProps(__spreadValues({}, state), {
|
1023
|
+
data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
|
1024
|
+
}),
|
1025
|
+
appStore.config
|
1026
|
+
);
|
1027
|
+
};
|
1028
|
+
|
1029
|
+
// ../core/reducer/actions/set-ui.ts
|
1030
|
+
init_react_import();
|
1031
|
+
var setUiAction = (state, action) => {
|
1032
|
+
if (typeof action.ui === "object") {
|
1033
|
+
return __spreadProps(__spreadValues({}, state), {
|
1034
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
1035
|
+
});
|
1036
|
+
}
|
1037
|
+
return __spreadProps(__spreadValues({}, state), {
|
1038
|
+
ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
|
1039
|
+
});
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
// ../core/lib/data/make-state-public.ts
|
1043
|
+
init_react_import();
|
1044
|
+
var makeStatePublic = (state) => {
|
1045
|
+
const { data, ui } = state;
|
1046
|
+
return { data, ui };
|
1047
|
+
};
|
1048
|
+
|
1049
|
+
// ../core/reducer/actions.tsx
|
1050
|
+
init_react_import();
|
1051
|
+
|
1052
|
+
// ../core/reducer/index.ts
|
1053
|
+
function storeInterceptor(reducer, record, onAction) {
|
1054
|
+
return (state, action) => {
|
1055
|
+
const newAppState = reducer(state, action);
|
1056
|
+
const isValidType = ![
|
1057
|
+
"registerZone",
|
1058
|
+
"unregisterZone",
|
1059
|
+
"setData",
|
1060
|
+
"setUi",
|
1061
|
+
"set"
|
1062
|
+
].includes(action.type);
|
1063
|
+
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
1064
|
+
if (record) record(newAppState);
|
1065
|
+
}
|
1066
|
+
onAction == null ? void 0 : onAction(action, makeStatePublic(newAppState), makeStatePublic(state));
|
1067
|
+
return newAppState;
|
1068
|
+
};
|
1069
|
+
}
|
1070
|
+
function createReducer({
|
1071
|
+
record,
|
1072
|
+
onAction,
|
1073
|
+
appStore
|
1074
|
+
}) {
|
1075
|
+
return storeInterceptor(
|
1076
|
+
(state, action) => {
|
1077
|
+
if (action.type === "set") {
|
1078
|
+
return setAction(state, action, appStore);
|
1079
|
+
}
|
1080
|
+
if (action.type === "insert") {
|
1081
|
+
return insertAction(state, action, appStore);
|
1082
|
+
}
|
1083
|
+
if (action.type === "replace") {
|
1084
|
+
return replaceAction(state, action, appStore);
|
1085
|
+
}
|
1086
|
+
if (action.type === "replaceRoot") {
|
1087
|
+
return replaceRootAction(state, action, appStore);
|
1088
|
+
}
|
1089
|
+
if (action.type === "duplicate") {
|
1090
|
+
return duplicateAction(state, action, appStore);
|
1091
|
+
}
|
1092
|
+
if (action.type === "reorder") {
|
1093
|
+
return reorderAction(state, action, appStore);
|
1094
|
+
}
|
1095
|
+
if (action.type === "move") {
|
1096
|
+
return moveAction(state, action, appStore);
|
1097
|
+
}
|
1098
|
+
if (action.type === "remove") {
|
1099
|
+
return removeAction(state, action, appStore);
|
1100
|
+
}
|
1101
|
+
if (action.type === "registerZone") {
|
1102
|
+
return registerZoneAction(state, action);
|
1103
|
+
}
|
1104
|
+
if (action.type === "unregisterZone") {
|
1105
|
+
return unregisterZoneAction(state, action);
|
1106
|
+
}
|
1107
|
+
if (action.type === "setData") {
|
1108
|
+
return setDataAction(state, action, appStore);
|
1109
|
+
}
|
1110
|
+
if (action.type === "setUi") {
|
1111
|
+
return setUiAction(state, action);
|
1112
|
+
}
|
1113
|
+
return state;
|
1114
|
+
},
|
1115
|
+
record,
|
1116
|
+
onAction
|
1117
|
+
);
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
// ../core/components/ViewportControls/default-viewports.ts
|
1121
|
+
init_react_import();
|
1122
|
+
var defaultViewports = [
|
1123
|
+
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1124
|
+
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1125
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1126
|
+
];
|
1127
|
+
|
423
1128
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
424
1129
|
init_react_import();
|
425
1130
|
var createStoreImpl = (createState) => {
|
@@ -445,94 +1150,711 @@ var createStoreImpl = (createState) => {
|
|
445
1150
|
};
|
446
1151
|
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
447
1152
|
|
448
|
-
//
|
449
|
-
|
450
|
-
var
|
451
|
-
var
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
1153
|
+
// ../../node_modules/zustand/esm/react.mjs
|
1154
|
+
init_react_import();
|
1155
|
+
var import_react4 = __toESM(require("react"), 1);
|
1156
|
+
var identity = (arg) => arg;
|
1157
|
+
function useStore(api, selector = identity) {
|
1158
|
+
const slice = import_react4.default.useSyncExternalStore(
|
1159
|
+
api.subscribe,
|
1160
|
+
() => selector(api.getState()),
|
1161
|
+
() => selector(api.getInitialState())
|
1162
|
+
);
|
1163
|
+
import_react4.default.useDebugValue(slice);
|
1164
|
+
return slice;
|
1165
|
+
}
|
1166
|
+
var createImpl = (createState) => {
|
1167
|
+
const api = createStore(createState);
|
1168
|
+
const useBoundStore = (selector) => useStore(api, selector);
|
1169
|
+
Object.assign(useBoundStore, api);
|
1170
|
+
return useBoundStore;
|
1171
|
+
};
|
1172
|
+
var create = (createState) => createState ? createImpl(createState) : createImpl;
|
1173
|
+
|
1174
|
+
// ../../node_modules/zustand/esm/middleware.mjs
|
1175
|
+
init_react_import();
|
1176
|
+
var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
1177
|
+
const origSubscribe = api.subscribe;
|
1178
|
+
api.subscribe = (selector, optListener, options) => {
|
1179
|
+
let listener = selector;
|
1180
|
+
if (optListener) {
|
1181
|
+
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
1182
|
+
let currentSlice = selector(api.getState());
|
1183
|
+
listener = (state) => {
|
1184
|
+
const nextSlice = selector(state);
|
1185
|
+
if (!equalityFn(currentSlice, nextSlice)) {
|
1186
|
+
const previousSlice = currentSlice;
|
1187
|
+
optListener(currentSlice = nextSlice, previousSlice);
|
1188
|
+
}
|
1189
|
+
};
|
1190
|
+
if (options == null ? void 0 : options.fireImmediately) {
|
1191
|
+
optListener(currentSlice, currentSlice);
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
return origSubscribe(listener);
|
1195
|
+
};
|
1196
|
+
const initialState = fn(set, get, api);
|
1197
|
+
return initialState;
|
1198
|
+
};
|
1199
|
+
var subscribeWithSelector = subscribeWithSelectorImpl;
|
1200
|
+
|
1201
|
+
// ../core/store/index.ts
|
1202
|
+
var import_react9 = require("react");
|
1203
|
+
|
1204
|
+
// ../core/store/slices/history.ts
|
1205
|
+
init_react_import();
|
1206
|
+
var import_react6 = require("react");
|
1207
|
+
|
1208
|
+
// ../core/lib/use-hotkey.ts
|
1209
|
+
init_react_import();
|
1210
|
+
var import_react5 = require("react");
|
1211
|
+
var useHotkeyStore = create()(
|
1212
|
+
subscribeWithSelector((set) => ({
|
1213
|
+
held: {},
|
1214
|
+
hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
|
1215
|
+
release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
|
1216
|
+
reset: (held = {}) => set(() => ({ held })),
|
1217
|
+
triggers: {}
|
459
1218
|
}))
|
460
1219
|
);
|
461
1220
|
|
462
|
-
// ../core/
|
1221
|
+
// ../core/store/slices/history.ts
|
1222
|
+
var EMPTY_HISTORY_INDEX = 0;
|
1223
|
+
function debounce(func, timeout = 300) {
|
1224
|
+
let timer;
|
1225
|
+
return (...args) => {
|
1226
|
+
clearTimeout(timer);
|
1227
|
+
timer = setTimeout(() => {
|
1228
|
+
func(...args);
|
1229
|
+
}, timeout);
|
1230
|
+
};
|
1231
|
+
}
|
1232
|
+
var tidyState = (state) => {
|
1233
|
+
return __spreadProps(__spreadValues({}, state), {
|
1234
|
+
ui: __spreadProps(__spreadValues({}, state.ui), {
|
1235
|
+
field: {
|
1236
|
+
focus: null
|
1237
|
+
}
|
1238
|
+
})
|
1239
|
+
});
|
1240
|
+
};
|
1241
|
+
var createHistorySlice = (set, get) => {
|
1242
|
+
const record = debounce((state) => {
|
1243
|
+
const { histories, index } = get().history;
|
1244
|
+
const history = {
|
1245
|
+
state,
|
1246
|
+
id: generateId("history")
|
1247
|
+
};
|
1248
|
+
const newHistories = [...histories.slice(0, index + 1), history];
|
1249
|
+
set({
|
1250
|
+
history: __spreadProps(__spreadValues({}, get().history), {
|
1251
|
+
histories: newHistories,
|
1252
|
+
index: newHistories.length - 1
|
1253
|
+
})
|
1254
|
+
});
|
1255
|
+
}, 250);
|
1256
|
+
return {
|
1257
|
+
initialAppState: {},
|
1258
|
+
index: EMPTY_HISTORY_INDEX,
|
1259
|
+
histories: [],
|
1260
|
+
hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
|
1261
|
+
hasFuture: () => get().history.index < get().history.histories.length - 1,
|
1262
|
+
prevHistory: () => {
|
1263
|
+
const { history } = get();
|
1264
|
+
return history.hasPast() ? history.histories[history.index - 1] : null;
|
1265
|
+
},
|
1266
|
+
nextHistory: () => {
|
1267
|
+
const s = get().history;
|
1268
|
+
return s.hasFuture() ? s.histories[s.index + 1] : null;
|
1269
|
+
},
|
1270
|
+
currentHistory: () => get().history.histories[get().history.index],
|
1271
|
+
back: () => {
|
1272
|
+
var _a;
|
1273
|
+
const { history, dispatch } = get();
|
1274
|
+
if (history.hasPast()) {
|
1275
|
+
const state = tidyState(
|
1276
|
+
((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
|
1277
|
+
);
|
1278
|
+
dispatch({
|
1279
|
+
type: "set",
|
1280
|
+
state
|
1281
|
+
});
|
1282
|
+
set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
|
1283
|
+
}
|
1284
|
+
},
|
1285
|
+
forward: () => {
|
1286
|
+
var _a;
|
1287
|
+
const { history, dispatch } = get();
|
1288
|
+
if (history.hasFuture()) {
|
1289
|
+
const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
|
1290
|
+
dispatch({ type: "set", state: state ? tidyState(state) : {} });
|
1291
|
+
set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
|
1292
|
+
}
|
1293
|
+
},
|
1294
|
+
setHistories: (histories) => {
|
1295
|
+
var _a;
|
1296
|
+
const { dispatch, history } = get();
|
1297
|
+
dispatch({
|
1298
|
+
type: "set",
|
1299
|
+
state: ((_a = history.histories[history.histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
|
1300
|
+
});
|
1301
|
+
set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
|
1302
|
+
},
|
1303
|
+
setHistoryIndex: (index) => {
|
1304
|
+
var _a;
|
1305
|
+
const { dispatch, history } = get();
|
1306
|
+
dispatch({
|
1307
|
+
type: "set",
|
1308
|
+
state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
|
1309
|
+
});
|
1310
|
+
set({ history: __spreadProps(__spreadValues({}, history), { index }) });
|
1311
|
+
},
|
1312
|
+
record
|
1313
|
+
};
|
1314
|
+
};
|
1315
|
+
|
1316
|
+
// ../core/store/slices/nodes.ts
|
463
1317
|
init_react_import();
|
464
|
-
var
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
1318
|
+
var createNodesSlice = (set, get) => ({
|
1319
|
+
nodes: {},
|
1320
|
+
registerNode: (id, node) => {
|
1321
|
+
const s = get().nodes;
|
1322
|
+
const emptyNode = {
|
1323
|
+
id,
|
1324
|
+
methods: { sync: () => null },
|
1325
|
+
element: null
|
1326
|
+
};
|
1327
|
+
const existingNode = s.nodes[id];
|
1328
|
+
set({
|
1329
|
+
nodes: __spreadProps(__spreadValues({}, s), {
|
1330
|
+
nodes: __spreadProps(__spreadValues({}, s.nodes), {
|
1331
|
+
[id]: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, emptyNode), existingNode), node), {
|
1332
|
+
id
|
1333
|
+
})
|
1334
|
+
})
|
1335
|
+
})
|
1336
|
+
});
|
1337
|
+
},
|
1338
|
+
unregisterNode: (id) => {
|
1339
|
+
const s = get().nodes;
|
1340
|
+
const existingNode = s.nodes[id];
|
1341
|
+
if (existingNode) {
|
1342
|
+
const newNodes = __spreadValues({}, s.nodes);
|
1343
|
+
delete newNodes[id];
|
1344
|
+
set({
|
1345
|
+
nodes: __spreadProps(__spreadValues({}, s), {
|
1346
|
+
nodes: newNodes
|
1347
|
+
})
|
1348
|
+
});
|
1349
|
+
}
|
470
1350
|
}
|
471
|
-
|
1351
|
+
});
|
1352
|
+
|
1353
|
+
// ../core/store/slices/permissions.ts
|
1354
|
+
init_react_import();
|
1355
|
+
var import_react7 = require("react");
|
1356
|
+
|
1357
|
+
// ../core/lib/data/flatten-data.ts
|
1358
|
+
init_react_import();
|
1359
|
+
var flattenData = (state, config) => {
|
1360
|
+
const data = [];
|
1361
|
+
walkTree(
|
1362
|
+
state,
|
1363
|
+
config,
|
1364
|
+
(content) => content,
|
1365
|
+
(item) => {
|
1366
|
+
data.push(item);
|
1367
|
+
return null;
|
1368
|
+
}
|
1369
|
+
);
|
1370
|
+
return data;
|
472
1371
|
};
|
473
1372
|
|
474
|
-
// ../core/lib/
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
1373
|
+
// ../core/lib/get-changed.ts
|
1374
|
+
init_react_import();
|
1375
|
+
var getChanged = (newItem, oldItem) => {
|
1376
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
1377
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
1378
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
1379
|
+
return __spreadProps(__spreadValues({}, acc), {
|
1380
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
1381
|
+
});
|
1382
|
+
}, {}) : {};
|
1383
|
+
};
|
1384
|
+
|
1385
|
+
// ../core/store/slices/permissions.ts
|
1386
|
+
var createPermissionsSlice = (set, get) => {
|
1387
|
+
const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
|
1388
|
+
const { state, permissions, config } = get();
|
1389
|
+
const { cache: cache2, globalPermissions } = permissions;
|
1390
|
+
const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
|
1391
|
+
var _a, _b, _c;
|
1392
|
+
const { config: config2, state: appState, setComponentLoading } = get();
|
1393
|
+
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
1394
|
+
if (!componentConfig) {
|
1395
|
+
return;
|
1396
|
+
}
|
1397
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
1398
|
+
if (componentConfig.resolvePermissions) {
|
1399
|
+
const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
|
1400
|
+
if (Object.values(changed).some((el) => el === true) || force2) {
|
1401
|
+
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
1402
|
+
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
1403
|
+
item2,
|
1404
|
+
{
|
1405
|
+
changed,
|
1406
|
+
lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
|
1407
|
+
permissions: initialPermissions,
|
1408
|
+
appState: makeStatePublic(appState),
|
1409
|
+
lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
|
1410
|
+
}
|
1411
|
+
);
|
1412
|
+
const latest = get().permissions;
|
1413
|
+
set({
|
1414
|
+
permissions: __spreadProps(__spreadValues({}, latest), {
|
1415
|
+
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
1416
|
+
[item2.props.id]: {
|
1417
|
+
lastData: item2,
|
1418
|
+
lastPermissions: resolvedPermissions
|
1419
|
+
}
|
1420
|
+
}),
|
1421
|
+
resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
|
1422
|
+
[item2.props.id]: resolvedPermissions
|
1423
|
+
})
|
1424
|
+
})
|
1425
|
+
});
|
1426
|
+
clearTimeout2();
|
488
1427
|
}
|
489
|
-
|
1428
|
+
}
|
1429
|
+
});
|
1430
|
+
const resolveDataForRoot = (force2 = false) => {
|
1431
|
+
const { state: appState } = get();
|
1432
|
+
resolveDataForItem(
|
1433
|
+
// Shim the root data in by conforming to component data shape
|
1434
|
+
{
|
1435
|
+
type: "root",
|
1436
|
+
props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "root" })
|
1437
|
+
},
|
1438
|
+
force2
|
1439
|
+
);
|
1440
|
+
};
|
1441
|
+
const { item, type, root } = params;
|
1442
|
+
if (item) {
|
1443
|
+
yield resolveDataForItem(item, force);
|
1444
|
+
} else if (type) {
|
1445
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
|
1446
|
+
yield resolveDataForItem(item2, force);
|
1447
|
+
}));
|
1448
|
+
} else if (root) {
|
1449
|
+
resolveDataForRoot(force);
|
1450
|
+
} else {
|
1451
|
+
flattenData(state, config).map((item2) => __async(void 0, null, function* () {
|
1452
|
+
yield resolveDataForItem(item2, force);
|
1453
|
+
}));
|
490
1454
|
}
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
1455
|
+
});
|
1456
|
+
const refreshPermissions = (params) => resolvePermissions(params, true);
|
1457
|
+
return {
|
1458
|
+
cache: {},
|
1459
|
+
globalPermissions: {
|
1460
|
+
drag: true,
|
1461
|
+
edit: true,
|
1462
|
+
delete: true,
|
1463
|
+
duplicate: true,
|
1464
|
+
insert: true
|
1465
|
+
},
|
1466
|
+
resolvedPermissions: {},
|
1467
|
+
getPermissions: ({ item, type, root } = {}) => {
|
1468
|
+
const { config, permissions } = get();
|
1469
|
+
const { globalPermissions, resolvedPermissions } = permissions;
|
1470
|
+
if (item) {
|
1471
|
+
const componentConfig = config.components[item.type];
|
1472
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
|
1473
|
+
const resolvedForItem = resolvedPermissions[item.props.id];
|
1474
|
+
return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
|
1475
|
+
} else if (type) {
|
1476
|
+
const componentConfig = config.components[type];
|
1477
|
+
return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
|
1478
|
+
} else if (root) {
|
1479
|
+
const rootConfig = config.root;
|
1480
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
|
1481
|
+
const resolvedForItem = resolvedPermissions["root"];
|
1482
|
+
return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
|
1483
|
+
}
|
1484
|
+
return globalPermissions;
|
1485
|
+
},
|
1486
|
+
resolvePermissions,
|
1487
|
+
refreshPermissions
|
1488
|
+
};
|
1489
|
+
};
|
1490
|
+
|
1491
|
+
// ../core/store/slices/fields.ts
|
1492
|
+
init_react_import();
|
1493
|
+
var import_react8 = require("react");
|
1494
|
+
var createFieldsSlice = (_set, _get) => {
|
1495
|
+
return {
|
1496
|
+
fields: {},
|
1497
|
+
loading: false,
|
1498
|
+
lastResolvedData: {}
|
1499
|
+
};
|
1500
|
+
};
|
1501
|
+
|
1502
|
+
// ../core/lib/resolve-component-data.ts
|
1503
|
+
init_react_import();
|
1504
|
+
|
1505
|
+
// ../core/lib/data/map-slots.ts
|
1506
|
+
init_react_import();
|
1507
|
+
function mapSlotsAsync(_0, _1) {
|
1508
|
+
return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
|
1509
|
+
const props = __spreadValues({}, item.props);
|
1510
|
+
const propKeys = Object.keys(props);
|
1511
|
+
for (let i = 0; i < propKeys.length; i++) {
|
1512
|
+
const propKey = propKeys[i];
|
1513
|
+
const itemType = "type" in item ? item.type : "root";
|
1514
|
+
if (isSlot2(itemType, propKey, props[propKey])) {
|
1515
|
+
const content = props[propKey];
|
1516
|
+
const mappedContent = recursive ? yield Promise.all(
|
1517
|
+
content.map((item2) => __async(this, null, function* () {
|
1518
|
+
return yield mapSlotsAsync(item2, map, recursive, isSlot2);
|
1519
|
+
}))
|
1520
|
+
) : content;
|
1521
|
+
props[propKey] = yield map(mappedContent, propKey);
|
1522
|
+
}
|
495
1523
|
}
|
496
|
-
|
497
|
-
|
1524
|
+
return __spreadProps(__spreadValues({}, item), { props });
|
1525
|
+
});
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
// ../core/lib/resolve-component-data.ts
|
1529
|
+
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
1530
|
+
var cache = { lastChange: {} };
|
1531
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
|
1532
|
+
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
1533
|
+
if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
|
1534
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1535
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1536
|
+
if (item && (0, import_fast_deep_equal.default)(item, oldItem)) {
|
1537
|
+
return { node: resolved, didChange: false };
|
498
1538
|
}
|
499
|
-
const
|
500
|
-
|
501
|
-
|
502
|
-
const item = parentZone[itemIndex];
|
503
|
-
if (!item) {
|
504
|
-
return acc;
|
1539
|
+
const changed = getChanged(item, oldItem);
|
1540
|
+
if (onResolveStart) {
|
1541
|
+
onResolveStart(item);
|
505
1542
|
}
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
1543
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
|
1544
|
+
changed,
|
1545
|
+
lastData: oldItem,
|
1546
|
+
metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
|
1547
|
+
trigger
|
1548
|
+
});
|
1549
|
+
let resolvedItem = __spreadProps(__spreadValues({}, item), {
|
1550
|
+
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
1551
|
+
});
|
1552
|
+
if (recursive) {
|
1553
|
+
resolvedItem = yield mapSlotsAsync(
|
1554
|
+
resolvedItem,
|
1555
|
+
(content) => __async(void 0, null, function* () {
|
1556
|
+
return Promise.all(
|
1557
|
+
content.map(
|
1558
|
+
(childItem) => __async(void 0, null, function* () {
|
1559
|
+
return (yield resolveComponentData(
|
1560
|
+
childItem,
|
1561
|
+
config,
|
1562
|
+
metadata,
|
1563
|
+
onResolveStart,
|
1564
|
+
onResolveEnd,
|
1565
|
+
trigger,
|
1566
|
+
false
|
1567
|
+
)).node;
|
1568
|
+
})
|
1569
|
+
)
|
1570
|
+
);
|
1571
|
+
}),
|
1572
|
+
false,
|
1573
|
+
createIsSlotConfig(config)
|
1574
|
+
);
|
1575
|
+
}
|
1576
|
+
if (Object.keys(readOnly).length) {
|
1577
|
+
resolvedItem.readOnly = readOnly;
|
1578
|
+
}
|
1579
|
+
cache.lastChange[id] = {
|
1580
|
+
item,
|
1581
|
+
resolved: resolvedItem
|
1582
|
+
};
|
1583
|
+
if (onResolveEnd) {
|
1584
|
+
onResolveEnd(resolvedItem);
|
1585
|
+
}
|
1586
|
+
return { node: resolvedItem, didChange: !(0, import_fast_deep_equal.default)(item, resolvedItem) };
|
1587
|
+
}
|
1588
|
+
return { node: item, didChange: false };
|
1589
|
+
});
|
1590
|
+
|
1591
|
+
// ../core/lib/data/to-root.ts
|
1592
|
+
init_react_import();
|
1593
|
+
var toRoot = (item) => {
|
1594
|
+
if ("type" in item && item.type !== "root") {
|
1595
|
+
throw new Error("Converting non-root item to root.");
|
1596
|
+
}
|
1597
|
+
const { readOnly } = item;
|
1598
|
+
if (item.props) {
|
1599
|
+
if ("id" in item.props) {
|
1600
|
+
const _a = item.props, { id } = _a, props = __objRest(_a, ["id"]);
|
1601
|
+
return { props, readOnly };
|
1602
|
+
}
|
1603
|
+
return { props: item.props, readOnly };
|
1604
|
+
}
|
1605
|
+
return { props: {}, readOnly };
|
518
1606
|
};
|
1607
|
+
|
1608
|
+
// ../core/store/index.ts
|
1609
|
+
var defaultAppState = {
|
1610
|
+
data: { content: [], root: {}, zones: {} },
|
1611
|
+
ui: {
|
1612
|
+
leftSideBarVisible: true,
|
1613
|
+
rightSideBarVisible: true,
|
1614
|
+
arrayState: {},
|
1615
|
+
itemSelector: null,
|
1616
|
+
componentList: {},
|
1617
|
+
isDragging: false,
|
1618
|
+
previewMode: "edit",
|
1619
|
+
viewports: {
|
1620
|
+
current: {
|
1621
|
+
width: defaultViewports[0].width,
|
1622
|
+
height: defaultViewports[0].height || "auto"
|
1623
|
+
},
|
1624
|
+
options: [],
|
1625
|
+
controlsVisible: true
|
1626
|
+
},
|
1627
|
+
field: { focus: null }
|
1628
|
+
},
|
1629
|
+
indexes: {
|
1630
|
+
nodes: {},
|
1631
|
+
zones: {}
|
1632
|
+
}
|
1633
|
+
};
|
1634
|
+
var defaultPageFields = {
|
1635
|
+
title: { type: "text" }
|
1636
|
+
};
|
1637
|
+
var createAppStore = (initialAppStore) => create()(
|
1638
|
+
subscribeWithSelector((set, get) => {
|
1639
|
+
var _a, _b;
|
1640
|
+
return __spreadProps(__spreadValues({
|
1641
|
+
state: defaultAppState,
|
1642
|
+
config: { components: {} },
|
1643
|
+
componentState: {},
|
1644
|
+
plugins: [],
|
1645
|
+
overrides: {},
|
1646
|
+
viewports: defaultViewports,
|
1647
|
+
zoomConfig: {
|
1648
|
+
autoZoom: 1,
|
1649
|
+
rootHeight: 0,
|
1650
|
+
zoom: 1
|
1651
|
+
},
|
1652
|
+
status: "LOADING",
|
1653
|
+
iframe: {},
|
1654
|
+
metadata: {}
|
1655
|
+
}, initialAppStore), {
|
1656
|
+
fields: createFieldsSlice(set, get),
|
1657
|
+
history: createHistorySlice(set, get),
|
1658
|
+
nodes: createNodesSlice(set, get),
|
1659
|
+
permissions: createPermissionsSlice(set, get),
|
1660
|
+
getComponentConfig: (type) => {
|
1661
|
+
var _a2;
|
1662
|
+
const { config, selectedItem } = get();
|
1663
|
+
const rootFields = ((_a2 = config.root) == null ? void 0 : _a2.fields) || defaultPageFields;
|
1664
|
+
return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
|
1665
|
+
},
|
1666
|
+
selectedItem: ((_a = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _a.ui.itemSelector) ? getItem(
|
1667
|
+
(_b = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _b.ui.itemSelector,
|
1668
|
+
initialAppStore.state
|
1669
|
+
) : null,
|
1670
|
+
dispatch: (action) => set((s) => {
|
1671
|
+
var _a2, _b2;
|
1672
|
+
const { record } = get().history;
|
1673
|
+
const dispatch = createReducer({
|
1674
|
+
record,
|
1675
|
+
appStore: s
|
1676
|
+
});
|
1677
|
+
const state = dispatch(s.state, action);
|
1678
|
+
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
1679
|
+
(_b2 = (_a2 = get()).onAction) == null ? void 0 : _b2.call(_a2, action, state, get().state);
|
1680
|
+
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
1681
|
+
}),
|
1682
|
+
setZoomConfig: (zoomConfig) => set({ zoomConfig }),
|
1683
|
+
setStatus: (status) => set({ status }),
|
1684
|
+
setComponentState: (componentState) => set({ componentState }),
|
1685
|
+
pendingLoadTimeouts: {},
|
1686
|
+
setComponentLoading: (id, loading = true, defer = 0) => {
|
1687
|
+
const { setComponentState, pendingLoadTimeouts } = get();
|
1688
|
+
const loadId = generateId();
|
1689
|
+
const setLoading = () => {
|
1690
|
+
var _a2;
|
1691
|
+
const { componentState } = get();
|
1692
|
+
setComponentState(__spreadProps(__spreadValues({}, componentState), {
|
1693
|
+
[id]: __spreadProps(__spreadValues({}, componentState[id]), {
|
1694
|
+
loadingCount: (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) + 1
|
1695
|
+
})
|
1696
|
+
}));
|
1697
|
+
};
|
1698
|
+
const unsetLoading = () => {
|
1699
|
+
var _a2;
|
1700
|
+
const { componentState } = get();
|
1701
|
+
clearTimeout(timeout);
|
1702
|
+
delete pendingLoadTimeouts[loadId];
|
1703
|
+
set({ pendingLoadTimeouts });
|
1704
|
+
setComponentState(__spreadProps(__spreadValues({}, componentState), {
|
1705
|
+
[id]: __spreadProps(__spreadValues({}, componentState[id]), {
|
1706
|
+
loadingCount: Math.max(
|
1707
|
+
(((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) - 1,
|
1708
|
+
0
|
1709
|
+
)
|
1710
|
+
})
|
1711
|
+
}));
|
1712
|
+
};
|
1713
|
+
const timeout = setTimeout(() => {
|
1714
|
+
if (loading) {
|
1715
|
+
setLoading();
|
1716
|
+
} else {
|
1717
|
+
unsetLoading();
|
1718
|
+
}
|
1719
|
+
delete pendingLoadTimeouts[loadId];
|
1720
|
+
set({ pendingLoadTimeouts });
|
1721
|
+
}, defer);
|
1722
|
+
set({
|
1723
|
+
pendingLoadTimeouts: __spreadProps(__spreadValues({}, pendingLoadTimeouts), {
|
1724
|
+
[id]: timeout
|
1725
|
+
})
|
1726
|
+
});
|
1727
|
+
return unsetLoading;
|
1728
|
+
},
|
1729
|
+
unsetComponentLoading: (id) => {
|
1730
|
+
const { setComponentLoading } = get();
|
1731
|
+
setComponentLoading(id, false);
|
1732
|
+
},
|
1733
|
+
// Helper
|
1734
|
+
setUi: (ui, recordHistory) => set((s) => {
|
1735
|
+
const dispatch = createReducer({
|
1736
|
+
record: () => {
|
1737
|
+
},
|
1738
|
+
appStore: s
|
1739
|
+
});
|
1740
|
+
const state = dispatch(s.state, {
|
1741
|
+
type: "setUi",
|
1742
|
+
ui,
|
1743
|
+
recordHistory
|
1744
|
+
});
|
1745
|
+
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
1746
|
+
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
1747
|
+
}),
|
1748
|
+
resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
|
1749
|
+
const { config, metadata, setComponentLoading, permissions } = get();
|
1750
|
+
const timeouts = {};
|
1751
|
+
return yield resolveComponentData(
|
1752
|
+
componentData,
|
1753
|
+
config,
|
1754
|
+
metadata,
|
1755
|
+
(item) => {
|
1756
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1757
|
+
timeouts[id] = setComponentLoading(id, true, 50);
|
1758
|
+
},
|
1759
|
+
(item) => __async(void 0, null, function* () {
|
1760
|
+
const id = "id" in item.props ? item.props.id : "root";
|
1761
|
+
if ("type" in item) {
|
1762
|
+
yield permissions.refreshPermissions({ item });
|
1763
|
+
} else {
|
1764
|
+
yield permissions.refreshPermissions({ root: true });
|
1765
|
+
}
|
1766
|
+
timeouts[id]();
|
1767
|
+
}),
|
1768
|
+
trigger
|
1769
|
+
);
|
1770
|
+
}),
|
1771
|
+
resolveAndCommitData: () => __async(void 0, null, function* () {
|
1772
|
+
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
1773
|
+
walkTree(
|
1774
|
+
state,
|
1775
|
+
config,
|
1776
|
+
(content) => content,
|
1777
|
+
(childItem) => {
|
1778
|
+
resolveComponentData2(childItem, "load").then((resolved) => {
|
1779
|
+
const { state: state2 } = get();
|
1780
|
+
const node = state2.indexes.nodes[resolved.node.props.id];
|
1781
|
+
if (node && resolved.didChange) {
|
1782
|
+
if (resolved.node.props.id === "root") {
|
1783
|
+
dispatch({
|
1784
|
+
type: "replaceRoot",
|
1785
|
+
root: toRoot(resolved.node)
|
1786
|
+
});
|
1787
|
+
} else {
|
1788
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
1789
|
+
const parentZone = state2.indexes.zones[zoneCompound];
|
1790
|
+
const index = parentZone.contentIds.indexOf(
|
1791
|
+
resolved.node.props.id
|
1792
|
+
);
|
1793
|
+
dispatch({
|
1794
|
+
type: "replace",
|
1795
|
+
data: resolved.node,
|
1796
|
+
destinationIndex: index,
|
1797
|
+
destinationZone: zoneCompound
|
1798
|
+
});
|
1799
|
+
}
|
1800
|
+
}
|
1801
|
+
});
|
1802
|
+
return childItem;
|
1803
|
+
}
|
1804
|
+
);
|
1805
|
+
})
|
1806
|
+
});
|
1807
|
+
})
|
1808
|
+
);
|
1809
|
+
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
1810
|
+
function useAppStore(selector) {
|
1811
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
1812
|
+
return useStore(context, selector);
|
1813
|
+
}
|
1814
|
+
function useAppStoreApi() {
|
1815
|
+
return (0, import_react9.useContext)(appStoreContext);
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
// ../core/lib/use-breadcrumbs.ts
|
519
1819
|
var useBreadcrumbs = (renderCount) => {
|
520
|
-
const {
|
521
|
-
|
522
|
-
selectedItem
|
523
|
-
}
|
524
|
-
const
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
1820
|
+
const selectedId = useAppStore((s) => {
|
1821
|
+
var _a;
|
1822
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
1823
|
+
});
|
1824
|
+
const config = useAppStore((s) => s.config);
|
1825
|
+
const path = useAppStore((s) => {
|
1826
|
+
var _a;
|
1827
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
1828
|
+
});
|
1829
|
+
const appStore = useAppStoreApi();
|
1830
|
+
return (0, import_react10.useMemo)(() => {
|
1831
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
1832
|
+
var _a, _b, _c;
|
1833
|
+
const [componentId] = zoneCompound.split(":");
|
1834
|
+
if (componentId === "root") {
|
1835
|
+
return {
|
1836
|
+
label: "Page",
|
1837
|
+
selector: null
|
1838
|
+
};
|
1839
|
+
}
|
1840
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
1841
|
+
const parentId = node.path[node.path.length - 1];
|
1842
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
1843
|
+
const index = contentIds.indexOf(componentId);
|
1844
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
1845
|
+
return {
|
1846
|
+
label,
|
1847
|
+
selector: node ? {
|
1848
|
+
index,
|
1849
|
+
zone: node.path[node.path.length - 1]
|
1850
|
+
} : null
|
1851
|
+
};
|
1852
|
+
})) || [];
|
531
1853
|
if (renderCount) {
|
532
1854
|
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
533
1855
|
}
|
534
1856
|
return breadcrumbs;
|
535
|
-
}, [
|
1857
|
+
}, [path, renderCount]);
|
536
1858
|
};
|
537
1859
|
|
538
1860
|
// ../core/components/Loader/index.tsx
|
@@ -544,10 +1866,10 @@ init_react_import();
|
|
544
1866
|
// ../core/lib/filter.ts
|
545
1867
|
init_react_import();
|
546
1868
|
|
547
|
-
// ../core/lib/reorder.ts
|
1869
|
+
// ../core/lib/data/reorder.ts
|
548
1870
|
init_react_import();
|
549
1871
|
|
550
|
-
// ../core/lib/replace.ts
|
1872
|
+
// ../core/lib/data/replace.ts
|
551
1873
|
init_react_import();
|
552
1874
|
|
553
1875
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
@@ -555,7 +1877,7 @@ init_react_import();
|
|
555
1877
|
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
556
1878
|
|
557
1879
|
// ../core/components/Loader/index.tsx
|
558
|
-
var
|
1880
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
559
1881
|
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
560
1882
|
var Loader = (_a) => {
|
561
1883
|
var _b = _a, {
|
@@ -565,7 +1887,7 @@ var Loader = (_a) => {
|
|
565
1887
|
"color",
|
566
1888
|
"size"
|
567
1889
|
]);
|
568
|
-
return /* @__PURE__ */ (0,
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
569
1891
|
"span",
|
570
1892
|
__spreadValues({
|
571
1893
|
className: getClassName2(),
|
@@ -580,7 +1902,7 @@ var Loader = (_a) => {
|
|
580
1902
|
};
|
581
1903
|
|
582
1904
|
// ../core/components/SidebarSection/index.tsx
|
583
|
-
var
|
1905
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
584
1906
|
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
585
1907
|
var SidebarSection = ({
|
586
1908
|
children,
|
@@ -591,17 +1913,17 @@ var SidebarSection = ({
|
|
591
1913
|
noPadding,
|
592
1914
|
isLoading
|
593
1915
|
}) => {
|
594
|
-
const
|
1916
|
+
const setUi = useAppStore((s) => s.setUi);
|
595
1917
|
const breadcrumbs = useBreadcrumbs(1);
|
596
|
-
return /* @__PURE__ */ (0,
|
1918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
597
1919
|
"div",
|
598
1920
|
{
|
599
1921
|
className: getClassName3({ noBorderTop, noPadding }),
|
600
1922
|
style: { background },
|
601
1923
|
children: [
|
602
|
-
/* @__PURE__ */ (0,
|
603
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
604
|
-
/* @__PURE__ */ (0,
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
1925
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
1926
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
605
1927
|
"button",
|
606
1928
|
{
|
607
1929
|
type: "button",
|
@@ -610,12 +1932,12 @@ var SidebarSection = ({
|
|
610
1932
|
children: breadcrumb.label
|
611
1933
|
}
|
612
1934
|
),
|
613
|
-
/* @__PURE__ */ (0,
|
1935
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
614
1936
|
] }, i)) : null,
|
615
|
-
/* @__PURE__ */ (0,
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
616
1938
|
] }) }),
|
617
|
-
/* @__PURE__ */ (0,
|
618
|
-
isLoading && /* @__PURE__ */ (0,
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
1940
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
619
1941
|
]
|
620
1942
|
}
|
621
1943
|
);
|
@@ -629,18 +1951,18 @@ init_react_import();
|
|
629
1951
|
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
630
1952
|
|
631
1953
|
// ../core/components/OutlineList/index.tsx
|
632
|
-
var
|
1954
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
633
1955
|
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
634
1956
|
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
635
1957
|
var OutlineList = ({ children }) => {
|
636
|
-
return /* @__PURE__ */ (0,
|
1958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
637
1959
|
};
|
638
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0,
|
1960
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
639
1961
|
OutlineList.Item = ({
|
640
1962
|
children,
|
641
1963
|
onClick
|
642
1964
|
}) => {
|
643
|
-
return /* @__PURE__ */ (0,
|
1965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
644
1966
|
"li",
|
645
1967
|
{
|
646
1968
|
className: getClassNameItem({ clickable: !!onClick }),
|
@@ -674,7 +1996,7 @@ var getFrame = () => {
|
|
674
1996
|
|
675
1997
|
// src/HeadingAnalyzer.tsx
|
676
1998
|
var import_react_from_json = __toESM(require("react-from-json"));
|
677
|
-
var
|
1999
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
678
2000
|
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
679
2001
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
680
2002
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
@@ -682,6 +2004,9 @@ var getOutline = ({ frame } = {}) => {
|
|
682
2004
|
const headings = (frame == null ? void 0 : frame.querySelectorAll("h1,h2,h3,h4,h5,h6")) || [];
|
683
2005
|
const _outline = [];
|
684
2006
|
headings.forEach((item, i) => {
|
2007
|
+
if (item.closest("[data-dnd-dragging]")) {
|
2008
|
+
return;
|
2009
|
+
}
|
685
2010
|
_outline.push({
|
686
2011
|
rank: parseInt(item.tagName.split("H")[1]),
|
687
2012
|
text: item.textContent,
|
@@ -724,24 +2049,47 @@ function buildHierarchy(frame) {
|
|
724
2049
|
}
|
725
2050
|
return root.children;
|
726
2051
|
}
|
2052
|
+
var usePuck = (0, import_puck.createUsePuck)();
|
727
2053
|
var HeadingAnalyzer = () => {
|
728
|
-
const
|
729
|
-
const [hierarchy, setHierarchy] = (0,
|
730
|
-
(0,
|
2054
|
+
const data = usePuck((s) => s.appState.data);
|
2055
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
2056
|
+
(0, import_react11.useEffect)(() => {
|
731
2057
|
const frame = getFrame();
|
732
|
-
|
733
|
-
|
734
|
-
setHierarchy(buildHierarchy(entry));
|
735
|
-
const observer = new MutationObserver(() => {
|
2058
|
+
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2059
|
+
const createHierarchy = () => {
|
736
2060
|
setHierarchy(buildHierarchy(entry));
|
2061
|
+
};
|
2062
|
+
const entryObserver = new MutationObserver(() => {
|
2063
|
+
createHierarchy();
|
2064
|
+
});
|
2065
|
+
const frameObserver = new MutationObserver(() => {
|
2066
|
+
entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2067
|
+
if (entry) {
|
2068
|
+
registerEntryObserver();
|
2069
|
+
frameObserver.disconnect();
|
2070
|
+
}
|
737
2071
|
});
|
738
|
-
|
2072
|
+
const registerEntryObserver = () => {
|
2073
|
+
if (!entry) return;
|
2074
|
+
entryObserver.observe(entry, { subtree: true, childList: true });
|
2075
|
+
};
|
2076
|
+
const registerFrameObserver = () => {
|
2077
|
+
if (!frame) return;
|
2078
|
+
frameObserver.observe(frame, { subtree: true, childList: true });
|
2079
|
+
};
|
2080
|
+
if (entry) {
|
2081
|
+
createHierarchy();
|
2082
|
+
registerEntryObserver();
|
2083
|
+
} else {
|
2084
|
+
registerFrameObserver();
|
2085
|
+
}
|
739
2086
|
return () => {
|
740
|
-
|
2087
|
+
entryObserver.disconnect();
|
2088
|
+
frameObserver.disconnect();
|
741
2089
|
};
|
742
|
-
}, [
|
743
|
-
return /* @__PURE__ */ (0,
|
744
|
-
/* @__PURE__ */ (0,
|
2090
|
+
}, [data]);
|
2091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
745
2093
|
"small",
|
746
2094
|
{
|
747
2095
|
className: getClassName5("cssWarning"),
|
@@ -753,19 +2101,19 @@ var HeadingAnalyzer = () => {
|
|
753
2101
|
children: [
|
754
2102
|
"Heading analyzer styles not loaded. Please review the",
|
755
2103
|
" ",
|
756
|
-
/* @__PURE__ */ (0,
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
757
2105
|
"."
|
758
2106
|
]
|
759
2107
|
}
|
760
2108
|
),
|
761
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
762
|
-
/* @__PURE__ */ (0,
|
2109
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
763
2111
|
ReactFromJSON,
|
764
2112
|
{
|
765
2113
|
mapping: {
|
766
|
-
Root: (props) => /* @__PURE__ */ (0,
|
767
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
768
|
-
/* @__PURE__ */ (0,
|
2114
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
2115
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
769
2117
|
"small",
|
770
2118
|
{
|
771
2119
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -783,14 +2131,14 @@ var HeadingAnalyzer = () => {
|
|
783
2131
|
}, 2e3);
|
784
2132
|
}
|
785
2133
|
},
|
786
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
787
|
-
/* @__PURE__ */ (0,
|
2134
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
788
2136
|
"H",
|
789
2137
|
props.rank
|
790
2138
|
] }),
|
791
2139
|
": Missing"
|
792
|
-
] }) : /* @__PURE__ */ (0,
|
793
|
-
/* @__PURE__ */ (0,
|
2140
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2141
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
794
2142
|
"H",
|
795
2143
|
props.rank
|
796
2144
|
] }),
|
@@ -799,7 +2147,7 @@ var HeadingAnalyzer = () => {
|
|
799
2147
|
] })
|
800
2148
|
}
|
801
2149
|
) }),
|
802
|
-
/* @__PURE__ */ (0,
|
2150
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
803
2151
|
] })
|
804
2152
|
},
|
805
2153
|
entry: {
|
@@ -821,9 +2169,9 @@ var HeadingAnalyzer = () => {
|
|
821
2169
|
};
|
822
2170
|
var headingAnalyzer = {
|
823
2171
|
overrides: {
|
824
|
-
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0,
|
2172
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
825
2173
|
children,
|
826
|
-
/* @__PURE__ */ (0,
|
2174
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
|
827
2175
|
] })
|
828
2176
|
}
|
829
2177
|
};
|