@measured/puck 0.21.0-canary.8358d3e1 → 0.21.0-canary.89038d0c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Editor-N46HUQEC.mjs → Editor-O447AVCX.mjs} +13 -10
- package/dist/{Render-Y567PGZ7.mjs → Render-OFE6QLI2.mjs} +6 -4
- package/dist/{walk-tree-Ja9bNCM9.d.mts → actions-ONhOkrvf.d.mts} +1 -27
- package/dist/{walk-tree-Ja9bNCM9.d.ts → actions-ONhOkrvf.d.ts} +1 -27
- package/dist/{chunk-FNWOH4R6.mjs → chunk-2Q4PACDA.mjs} +8 -6
- package/dist/{chunk-DNF2EMM4.mjs → chunk-62AAYNXG.mjs} +2 -2
- package/dist/{chunk-K3V4LVUL.mjs → chunk-BSDEIOEK.mjs} +11 -9
- package/dist/{chunk-WUWXFMEM.mjs → chunk-CSSRLPHM.mjs} +1 -1
- package/dist/{chunk-7KY6RHEY.mjs → chunk-DAQLMM2T.mjs} +15 -523
- package/dist/{chunk-DCSQEDMK.mjs → chunk-M6W7YEVX.mjs} +1 -100
- package/dist/{chunk-DJSH5REF.mjs → chunk-NLUHDYVR.mjs} +2 -123
- package/dist/{chunk-GQKMOYLG.mjs → chunk-PLXSMBAA.mjs} +2 -2
- package/dist/{chunk-3QHWXJEI.mjs → chunk-QAWJTCV5.mjs} +2 -2
- package/dist/chunk-QBGM4ELA.mjs +528 -0
- package/dist/chunk-T3WX7XJ6.mjs +132 -0
- package/dist/{chunk-R6CVX2IY.mjs → chunk-V5I7CVLT.mjs} +1 -1
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/{chunk-C2TVYIYC.mjs → chunk-Y656T6AQ.mjs} +10 -6
- package/dist/{chunk-N5XMZOMC.mjs → chunk-Z476VA6G.mjs} +279 -203
- package/dist/{full-NLUNPJWS.mjs → full-BEMDJKDS.mjs} +10 -7
- package/dist/index-BEoNHRI1.d.ts +116 -0
- package/dist/index-DfxZ7tZF.d.mts +116 -0
- package/dist/index.d.mts +6 -116
- package/dist/index.d.ts +6 -116
- package/dist/index.js +446 -376
- package/dist/index.mjs +14 -11
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +908 -0
- package/dist/internal.mjs +13 -0
- package/dist/{loaded-ZXOU6S6R.mjs → loaded-JU3A7Y4L.mjs} +7 -4
- package/dist/{loaded-HMSPJUZM.mjs → loaded-N3FYGF2Y.mjs} +7 -4
- package/dist/{loaded-EV34KGYJ.mjs → loaded-OBY7OMS6.mjs} +7 -4
- package/dist/no-external.d.mts +3 -1
- package/dist/no-external.d.ts +3 -1
- package/dist/no-external.js +446 -376
- package/dist/no-external.mjs +14 -11
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +6 -4
- package/dist/walk-tree-CdriEzFJ.d.mts +29 -0
- package/dist/walk-tree-DHbAZ4wF.d.ts +29 -0
- package/package.json +9 -4
|
@@ -1,21 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createReducer,
|
|
3
|
+
generateId,
|
|
4
|
+
getItem,
|
|
5
|
+
makeStatePublic
|
|
6
|
+
} from "./chunk-QBGM4ELA.mjs";
|
|
1
7
|
import {
|
|
2
8
|
defaultAppState,
|
|
3
9
|
defaultViewports,
|
|
4
10
|
getChanged,
|
|
5
|
-
resolveComponentData
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
resolveComponentData
|
|
12
|
+
} from "./chunk-T3WX7XJ6.mjs";
|
|
13
|
+
import {
|
|
14
|
+
get_class_name_factory_default
|
|
15
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
16
|
+
import {
|
|
17
|
+
walkAppState
|
|
18
|
+
} from "./chunk-NLUHDYVR.mjs";
|
|
11
19
|
import {
|
|
12
20
|
__async,
|
|
13
21
|
__objRest,
|
|
14
22
|
__spreadProps,
|
|
15
23
|
__spreadValues,
|
|
16
|
-
get_class_name_factory_default,
|
|
17
24
|
init_react_import
|
|
18
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
19
26
|
|
|
20
27
|
// ../../node_modules/lucide-react/dist/esm/icons/align-left.js
|
|
21
28
|
init_react_import();
|
|
@@ -530,515 +537,6 @@ var ZoomOut = createLucideIcon("ZoomOut", [
|
|
|
530
537
|
|
|
531
538
|
// store/index.ts
|
|
532
539
|
init_react_import();
|
|
533
|
-
|
|
534
|
-
// reducer/index.ts
|
|
535
|
-
init_react_import();
|
|
536
|
-
|
|
537
|
-
// reducer/actions/set.ts
|
|
538
|
-
init_react_import();
|
|
539
|
-
var setAction = (state, action, appStore) => {
|
|
540
|
-
if (typeof action.state === "object") {
|
|
541
|
-
const newState = __spreadValues(__spreadValues({}, state), action.state);
|
|
542
|
-
if (action.state.indexes) {
|
|
543
|
-
return newState;
|
|
544
|
-
}
|
|
545
|
-
console.warn(
|
|
546
|
-
"`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
|
547
|
-
);
|
|
548
|
-
return walkAppState(newState, appStore.config);
|
|
549
|
-
}
|
|
550
|
-
return __spreadValues(__spreadValues({}, state), action.state(state));
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
// reducer/actions/insert.ts
|
|
554
|
-
init_react_import();
|
|
555
|
-
|
|
556
|
-
// lib/data/insert.ts
|
|
557
|
-
init_react_import();
|
|
558
|
-
var insert = (list, index, item) => {
|
|
559
|
-
const result = Array.from(list || []);
|
|
560
|
-
result.splice(index, 0, item);
|
|
561
|
-
return result;
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
// lib/generate-id.ts
|
|
565
|
-
init_react_import();
|
|
566
|
-
import { v4 as uuidv4 } from "uuid";
|
|
567
|
-
var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
|
|
568
|
-
|
|
569
|
-
// lib/data/get-ids-for-parent.ts
|
|
570
|
-
init_react_import();
|
|
571
|
-
var getIdsForParent = (zoneCompound, state) => {
|
|
572
|
-
const [parentId] = zoneCompound.split(":");
|
|
573
|
-
const node = state.indexes.nodes[parentId];
|
|
574
|
-
return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
// lib/data/populate-ids.ts
|
|
578
|
-
init_react_import();
|
|
579
|
-
var populateIds = (data, config, override = false) => {
|
|
580
|
-
const id = generateId(data.type);
|
|
581
|
-
return walkTree(
|
|
582
|
-
__spreadProps(__spreadValues({}, data), {
|
|
583
|
-
props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
|
|
584
|
-
}),
|
|
585
|
-
config,
|
|
586
|
-
(contents) => contents.map((item) => {
|
|
587
|
-
const id2 = generateId(item.type);
|
|
588
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
589
|
-
props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
|
|
590
|
-
});
|
|
591
|
-
})
|
|
592
|
-
);
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
// reducer/actions/insert.ts
|
|
596
|
-
function insertAction(state, action, appStore) {
|
|
597
|
-
const id = action.id || generateId(action.componentType);
|
|
598
|
-
const emptyComponentData = populateIds(
|
|
599
|
-
{
|
|
600
|
-
type: action.componentType,
|
|
601
|
-
props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
|
|
602
|
-
id
|
|
603
|
-
})
|
|
604
|
-
},
|
|
605
|
-
appStore.config
|
|
606
|
-
);
|
|
607
|
-
const [parentId] = action.destinationZone.split(":");
|
|
608
|
-
const idsInPath = getIdsForParent(action.destinationZone, state);
|
|
609
|
-
return walkAppState(
|
|
610
|
-
state,
|
|
611
|
-
appStore.config,
|
|
612
|
-
(content, zoneCompound) => {
|
|
613
|
-
if (zoneCompound === action.destinationZone) {
|
|
614
|
-
return insert(
|
|
615
|
-
content || [],
|
|
616
|
-
action.destinationIndex,
|
|
617
|
-
emptyComponentData
|
|
618
|
-
);
|
|
619
|
-
}
|
|
620
|
-
return content;
|
|
621
|
-
},
|
|
622
|
-
(childItem, path) => {
|
|
623
|
-
if (childItem.props.id === id || childItem.props.id === parentId) {
|
|
624
|
-
return childItem;
|
|
625
|
-
} else if (idsInPath.includes(childItem.props.id)) {
|
|
626
|
-
return childItem;
|
|
627
|
-
} else if (path.includes(action.destinationZone)) {
|
|
628
|
-
return childItem;
|
|
629
|
-
}
|
|
630
|
-
return null;
|
|
631
|
-
}
|
|
632
|
-
);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// reducer/actions/replace.ts
|
|
636
|
-
init_react_import();
|
|
637
|
-
var replaceAction = (state, action, appStore) => {
|
|
638
|
-
const [parentId] = action.destinationZone.split(":");
|
|
639
|
-
const idsInPath = getIdsForParent(action.destinationZone, state);
|
|
640
|
-
const originalId = state.indexes.zones[action.destinationZone].contentIds[action.destinationIndex];
|
|
641
|
-
const idChanged = originalId !== action.data.props.id;
|
|
642
|
-
if (idChanged) {
|
|
643
|
-
throw new Error(
|
|
644
|
-
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
const newSlotIds = [];
|
|
648
|
-
const data = walkTree(action.data, appStore.config, (contents, opts) => {
|
|
649
|
-
newSlotIds.push(`${opts.parentId}:${opts.propName}`);
|
|
650
|
-
return contents.map((item) => {
|
|
651
|
-
const id = generateId(item.type);
|
|
652
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
653
|
-
props: __spreadValues({ id }, item.props)
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
const stateWithDeepSlotsRemoved = __spreadProps(__spreadValues({}, state), {
|
|
658
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
659
|
-
});
|
|
660
|
-
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
|
661
|
-
const id = zoneCompound.split(":")[0];
|
|
662
|
-
if (id === originalId) {
|
|
663
|
-
if (!newSlotIds.includes(zoneCompound)) {
|
|
664
|
-
delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
|
-
return walkAppState(
|
|
669
|
-
stateWithDeepSlotsRemoved,
|
|
670
|
-
appStore.config,
|
|
671
|
-
(content, zoneCompound) => {
|
|
672
|
-
const newContent = [...content];
|
|
673
|
-
if (zoneCompound === action.destinationZone) {
|
|
674
|
-
newContent[action.destinationIndex] = data;
|
|
675
|
-
}
|
|
676
|
-
return newContent;
|
|
677
|
-
},
|
|
678
|
-
(childItem, path) => {
|
|
679
|
-
const pathIds = path.map((p) => p.split(":")[0]);
|
|
680
|
-
if (childItem.props.id === data.props.id) {
|
|
681
|
-
return data;
|
|
682
|
-
} else if (childItem.props.id === parentId) {
|
|
683
|
-
return childItem;
|
|
684
|
-
} else if (idsInPath.indexOf(childItem.props.id) > -1) {
|
|
685
|
-
return childItem;
|
|
686
|
-
} else if (pathIds.indexOf(data.props.id) > -1) {
|
|
687
|
-
return childItem;
|
|
688
|
-
}
|
|
689
|
-
return null;
|
|
690
|
-
}
|
|
691
|
-
);
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
// reducer/actions/replace-root.ts
|
|
695
|
-
init_react_import();
|
|
696
|
-
var replaceRootAction = (state, action, appStore) => {
|
|
697
|
-
return walkAppState(
|
|
698
|
-
state,
|
|
699
|
-
appStore.config,
|
|
700
|
-
(content) => content,
|
|
701
|
-
(childItem) => {
|
|
702
|
-
if (childItem.props.id === "root") {
|
|
703
|
-
return __spreadProps(__spreadValues({}, childItem), {
|
|
704
|
-
props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
|
|
705
|
-
readOnly: action.root.readOnly
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
return childItem;
|
|
709
|
-
}
|
|
710
|
-
);
|
|
711
|
-
};
|
|
712
|
-
|
|
713
|
-
// reducer/actions/duplicate.ts
|
|
714
|
-
init_react_import();
|
|
715
|
-
|
|
716
|
-
// lib/data/get-item.ts
|
|
717
|
-
init_react_import();
|
|
718
|
-
function getItem(selector, state) {
|
|
719
|
-
var _a, _b;
|
|
720
|
-
const zone = (_a = state.indexes.zones) == null ? void 0 : _a[selector.zone || rootDroppableId];
|
|
721
|
-
return zone ? (_b = state.indexes.nodes[zone.contentIds[selector.index]]) == null ? void 0 : _b.data : void 0;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
// reducer/actions/duplicate.ts
|
|
725
|
-
function duplicateAction(state, action, appStore) {
|
|
726
|
-
const item = getItem(
|
|
727
|
-
{ index: action.sourceIndex, zone: action.sourceZone },
|
|
728
|
-
state
|
|
729
|
-
);
|
|
730
|
-
const idsInPath = getIdsForParent(action.sourceZone, state);
|
|
731
|
-
const newItem = __spreadProps(__spreadValues({}, item), {
|
|
732
|
-
props: __spreadProps(__spreadValues({}, item.props), {
|
|
733
|
-
id: generateId(item.type)
|
|
734
|
-
})
|
|
735
|
-
});
|
|
736
|
-
const modified = walkAppState(
|
|
737
|
-
state,
|
|
738
|
-
appStore.config,
|
|
739
|
-
(content, zoneCompound) => {
|
|
740
|
-
if (zoneCompound === action.sourceZone) {
|
|
741
|
-
return insert(content, action.sourceIndex + 1, item);
|
|
742
|
-
}
|
|
743
|
-
return content;
|
|
744
|
-
},
|
|
745
|
-
(childItem, path, index) => {
|
|
746
|
-
const zoneCompound = path[path.length - 1];
|
|
747
|
-
const parents = path.map((p) => p.split(":")[0]);
|
|
748
|
-
if (parents.indexOf(newItem.props.id) > -1) {
|
|
749
|
-
return __spreadProps(__spreadValues({}, childItem), {
|
|
750
|
-
props: __spreadProps(__spreadValues({}, childItem.props), {
|
|
751
|
-
id: generateId(childItem.type)
|
|
752
|
-
})
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
if (zoneCompound === action.sourceZone && index === action.sourceIndex + 1) {
|
|
756
|
-
return newItem;
|
|
757
|
-
}
|
|
758
|
-
const [sourceZoneParent] = action.sourceZone.split(":");
|
|
759
|
-
if (sourceZoneParent === childItem.props.id || idsInPath.indexOf(childItem.props.id) > -1) {
|
|
760
|
-
return childItem;
|
|
761
|
-
}
|
|
762
|
-
return null;
|
|
763
|
-
}
|
|
764
|
-
);
|
|
765
|
-
return __spreadProps(__spreadValues({}, modified), {
|
|
766
|
-
ui: __spreadProps(__spreadValues({}, modified.ui), {
|
|
767
|
-
itemSelector: {
|
|
768
|
-
index: action.sourceIndex + 1,
|
|
769
|
-
zone: action.sourceZone
|
|
770
|
-
}
|
|
771
|
-
})
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
// reducer/actions/reorder.ts
|
|
776
|
-
init_react_import();
|
|
777
|
-
|
|
778
|
-
// reducer/actions/move.ts
|
|
779
|
-
init_react_import();
|
|
780
|
-
|
|
781
|
-
// lib/data/remove.ts
|
|
782
|
-
init_react_import();
|
|
783
|
-
var remove = (list, index) => {
|
|
784
|
-
const result = Array.from(list);
|
|
785
|
-
result.splice(index, 1);
|
|
786
|
-
return result;
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
// reducer/actions/move.ts
|
|
790
|
-
var moveAction = (state, action, appStore) => {
|
|
791
|
-
if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
|
|
792
|
-
return state;
|
|
793
|
-
}
|
|
794
|
-
const item = getItem(
|
|
795
|
-
{ zone: action.sourceZone, index: action.sourceIndex },
|
|
796
|
-
state
|
|
797
|
-
);
|
|
798
|
-
if (!item) return state;
|
|
799
|
-
const idsInSourcePath = getIdsForParent(action.sourceZone, state);
|
|
800
|
-
const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
|
|
801
|
-
return walkAppState(
|
|
802
|
-
state,
|
|
803
|
-
appStore.config,
|
|
804
|
-
(content, zoneCompound) => {
|
|
805
|
-
if (zoneCompound === action.sourceZone && zoneCompound === action.destinationZone) {
|
|
806
|
-
return insert(
|
|
807
|
-
remove(content, action.sourceIndex),
|
|
808
|
-
action.destinationIndex,
|
|
809
|
-
item
|
|
810
|
-
);
|
|
811
|
-
} else if (zoneCompound === action.sourceZone) {
|
|
812
|
-
return remove(content, action.sourceIndex);
|
|
813
|
-
} else if (zoneCompound === action.destinationZone) {
|
|
814
|
-
return insert(content, action.destinationIndex, item);
|
|
815
|
-
}
|
|
816
|
-
return content;
|
|
817
|
-
},
|
|
818
|
-
(childItem, path) => {
|
|
819
|
-
const [sourceZoneParent] = action.sourceZone.split(":");
|
|
820
|
-
const [destinationZoneParent] = action.destinationZone.split(":");
|
|
821
|
-
const childId = childItem.props.id;
|
|
822
|
-
if (sourceZoneParent === childId || destinationZoneParent === childId || item.props.id === childId || idsInSourcePath.indexOf(childId) > -1 || idsInDestinationPath.indexOf(childId) > -1 || path.includes(action.destinationZone)) {
|
|
823
|
-
return childItem;
|
|
824
|
-
}
|
|
825
|
-
return null;
|
|
826
|
-
}
|
|
827
|
-
);
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
// reducer/actions/reorder.ts
|
|
831
|
-
var reorderAction = (state, action, appStore) => {
|
|
832
|
-
return moveAction(
|
|
833
|
-
state,
|
|
834
|
-
{
|
|
835
|
-
type: "move",
|
|
836
|
-
sourceIndex: action.sourceIndex,
|
|
837
|
-
sourceZone: action.destinationZone,
|
|
838
|
-
destinationIndex: action.destinationIndex,
|
|
839
|
-
destinationZone: action.destinationZone
|
|
840
|
-
},
|
|
841
|
-
appStore
|
|
842
|
-
);
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
// reducer/actions/remove.ts
|
|
846
|
-
init_react_import();
|
|
847
|
-
var removeAction = (state, action, appStore) => {
|
|
848
|
-
const item = getItem({ index: action.index, zone: action.zone }, state);
|
|
849
|
-
const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
|
|
850
|
-
(acc, [nodeId, nodeData]) => {
|
|
851
|
-
const pathIds = nodeData.path.map((p) => p.split(":")[0]);
|
|
852
|
-
if (pathIds.includes(item.props.id)) {
|
|
853
|
-
return [...acc, nodeId];
|
|
854
|
-
}
|
|
855
|
-
return acc;
|
|
856
|
-
},
|
|
857
|
-
[item.props.id]
|
|
858
|
-
);
|
|
859
|
-
const newState = walkAppState(
|
|
860
|
-
state,
|
|
861
|
-
appStore.config,
|
|
862
|
-
(content, zoneCompound) => {
|
|
863
|
-
if (zoneCompound === action.zone) {
|
|
864
|
-
return remove(content, action.index);
|
|
865
|
-
}
|
|
866
|
-
return content;
|
|
867
|
-
}
|
|
868
|
-
);
|
|
869
|
-
Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
|
|
870
|
-
const parentId = zoneCompound.split(":")[0];
|
|
871
|
-
if (nodesToDelete.includes(parentId) && newState.data.zones) {
|
|
872
|
-
delete newState.data.zones[zoneCompound];
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
|
|
876
|
-
const parentId = zoneCompound.split(":")[0];
|
|
877
|
-
if (nodesToDelete.includes(parentId)) {
|
|
878
|
-
delete newState.indexes.zones[zoneCompound];
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
nodesToDelete.forEach((id) => {
|
|
882
|
-
delete newState.indexes.nodes[id];
|
|
883
|
-
});
|
|
884
|
-
return newState;
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
// reducer/actions/register-zone.ts
|
|
888
|
-
init_react_import();
|
|
889
|
-
var zoneCache = {};
|
|
890
|
-
function registerZoneAction(state, action) {
|
|
891
|
-
if (zoneCache[action.zone]) {
|
|
892
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
893
|
-
data: __spreadProps(__spreadValues({}, state.data), {
|
|
894
|
-
zones: __spreadProps(__spreadValues({}, state.data.zones), {
|
|
895
|
-
[action.zone]: zoneCache[action.zone]
|
|
896
|
-
})
|
|
897
|
-
}),
|
|
898
|
-
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
|
899
|
-
zones: __spreadProps(__spreadValues({}, state.indexes.zones), {
|
|
900
|
-
[action.zone]: __spreadProps(__spreadValues({}, state.indexes.zones[action.zone]), {
|
|
901
|
-
contentIds: zoneCache[action.zone].map((item) => item.props.id),
|
|
902
|
-
type: "dropzone"
|
|
903
|
-
})
|
|
904
|
-
})
|
|
905
|
-
})
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
return __spreadProps(__spreadValues({}, state), { data: setupZone(state.data, action.zone) });
|
|
909
|
-
}
|
|
910
|
-
function unregisterZoneAction(state, action) {
|
|
911
|
-
const _zones = __spreadValues({}, state.data.zones || {});
|
|
912
|
-
const zoneIndex = __spreadValues({}, state.indexes.zones || {});
|
|
913
|
-
if (_zones[action.zone]) {
|
|
914
|
-
zoneCache[action.zone] = _zones[action.zone];
|
|
915
|
-
delete _zones[action.zone];
|
|
916
|
-
}
|
|
917
|
-
delete zoneIndex[action.zone];
|
|
918
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
919
|
-
data: __spreadProps(__spreadValues({}, state.data), {
|
|
920
|
-
zones: _zones
|
|
921
|
-
}),
|
|
922
|
-
indexes: __spreadProps(__spreadValues({}, state.indexes), {
|
|
923
|
-
zones: zoneIndex
|
|
924
|
-
})
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
// reducer/actions/set-data.ts
|
|
929
|
-
init_react_import();
|
|
930
|
-
var setDataAction = (state, action, appStore) => {
|
|
931
|
-
if (typeof action.data === "object") {
|
|
932
|
-
console.warn(
|
|
933
|
-
"`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
|
|
934
|
-
);
|
|
935
|
-
return walkAppState(
|
|
936
|
-
__spreadProps(__spreadValues({}, state), {
|
|
937
|
-
data: __spreadValues(__spreadValues({}, state.data), action.data)
|
|
938
|
-
}),
|
|
939
|
-
appStore.config
|
|
940
|
-
);
|
|
941
|
-
}
|
|
942
|
-
return walkAppState(
|
|
943
|
-
__spreadProps(__spreadValues({}, state), {
|
|
944
|
-
data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
|
|
945
|
-
}),
|
|
946
|
-
appStore.config
|
|
947
|
-
);
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
// reducer/actions/set-ui.ts
|
|
951
|
-
init_react_import();
|
|
952
|
-
var setUiAction = (state, action) => {
|
|
953
|
-
if (typeof action.ui === "object") {
|
|
954
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
955
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
959
|
-
ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
|
|
960
|
-
});
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
// lib/data/make-state-public.ts
|
|
964
|
-
init_react_import();
|
|
965
|
-
var makeStatePublic = (state) => {
|
|
966
|
-
const { data, ui } = state;
|
|
967
|
-
return { data, ui };
|
|
968
|
-
};
|
|
969
|
-
|
|
970
|
-
// reducer/actions.tsx
|
|
971
|
-
init_react_import();
|
|
972
|
-
|
|
973
|
-
// reducer/index.ts
|
|
974
|
-
function storeInterceptor(reducer, record, onAction) {
|
|
975
|
-
return (state, action) => {
|
|
976
|
-
const newAppState = reducer(state, action);
|
|
977
|
-
const isValidType = ![
|
|
978
|
-
"registerZone",
|
|
979
|
-
"unregisterZone",
|
|
980
|
-
"setData",
|
|
981
|
-
"setUi",
|
|
982
|
-
"set"
|
|
983
|
-
].includes(action.type);
|
|
984
|
-
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
|
985
|
-
if (record) record(newAppState);
|
|
986
|
-
}
|
|
987
|
-
onAction == null ? void 0 : onAction(action, makeStatePublic(newAppState), makeStatePublic(state));
|
|
988
|
-
return newAppState;
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
function createReducer({
|
|
992
|
-
record,
|
|
993
|
-
onAction,
|
|
994
|
-
appStore
|
|
995
|
-
}) {
|
|
996
|
-
return storeInterceptor(
|
|
997
|
-
(state, action) => {
|
|
998
|
-
if (action.type === "set") {
|
|
999
|
-
return setAction(state, action, appStore);
|
|
1000
|
-
}
|
|
1001
|
-
if (action.type === "insert") {
|
|
1002
|
-
return insertAction(state, action, appStore);
|
|
1003
|
-
}
|
|
1004
|
-
if (action.type === "replace") {
|
|
1005
|
-
return replaceAction(state, action, appStore);
|
|
1006
|
-
}
|
|
1007
|
-
if (action.type === "replaceRoot") {
|
|
1008
|
-
return replaceRootAction(state, action, appStore);
|
|
1009
|
-
}
|
|
1010
|
-
if (action.type === "duplicate") {
|
|
1011
|
-
return duplicateAction(state, action, appStore);
|
|
1012
|
-
}
|
|
1013
|
-
if (action.type === "reorder") {
|
|
1014
|
-
return reorderAction(state, action, appStore);
|
|
1015
|
-
}
|
|
1016
|
-
if (action.type === "move") {
|
|
1017
|
-
return moveAction(state, action, appStore);
|
|
1018
|
-
}
|
|
1019
|
-
if (action.type === "remove") {
|
|
1020
|
-
return removeAction(state, action, appStore);
|
|
1021
|
-
}
|
|
1022
|
-
if (action.type === "registerZone") {
|
|
1023
|
-
return registerZoneAction(state, action);
|
|
1024
|
-
}
|
|
1025
|
-
if (action.type === "unregisterZone") {
|
|
1026
|
-
return unregisterZoneAction(state, action);
|
|
1027
|
-
}
|
|
1028
|
-
if (action.type === "setData") {
|
|
1029
|
-
return setDataAction(state, action, appStore);
|
|
1030
|
-
}
|
|
1031
|
-
if (action.type === "setUi") {
|
|
1032
|
-
return setUiAction(state, action);
|
|
1033
|
-
}
|
|
1034
|
-
return state;
|
|
1035
|
-
},
|
|
1036
|
-
record,
|
|
1037
|
-
onAction
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
// store/index.ts
|
|
1042
540
|
import { create as create2, useStore } from "zustand";
|
|
1043
541
|
import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
|
|
1044
542
|
import { createContext, useContext } from "react";
|
|
@@ -2143,12 +1641,6 @@ export {
|
|
|
2143
1641
|
ZoomOut,
|
|
2144
1642
|
reorder,
|
|
2145
1643
|
replace,
|
|
2146
|
-
insert,
|
|
2147
|
-
generateId,
|
|
2148
|
-
populateIds,
|
|
2149
|
-
insertAction,
|
|
2150
|
-
getItem,
|
|
2151
|
-
makeStatePublic,
|
|
2152
1644
|
monitorHotkeys,
|
|
2153
1645
|
useMonitorHotkeys,
|
|
2154
1646
|
useHotkey,
|
|
@@ -84,95 +84,6 @@ var init_react_import = __esm({
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
// ../../node_modules/classnames/index.js
|
|
88
|
-
var require_classnames = __commonJS({
|
|
89
|
-
"../../node_modules/classnames/index.js"(exports, module) {
|
|
90
|
-
"use strict";
|
|
91
|
-
init_react_import();
|
|
92
|
-
(function() {
|
|
93
|
-
"use strict";
|
|
94
|
-
var hasOwn = {}.hasOwnProperty;
|
|
95
|
-
function classNames() {
|
|
96
|
-
var classes = "";
|
|
97
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
98
|
-
var arg = arguments[i];
|
|
99
|
-
if (arg) {
|
|
100
|
-
classes = appendClass(classes, parseValue(arg));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return classes;
|
|
104
|
-
}
|
|
105
|
-
function parseValue(arg) {
|
|
106
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
107
|
-
return arg;
|
|
108
|
-
}
|
|
109
|
-
if (typeof arg !== "object") {
|
|
110
|
-
return "";
|
|
111
|
-
}
|
|
112
|
-
if (Array.isArray(arg)) {
|
|
113
|
-
return classNames.apply(null, arg);
|
|
114
|
-
}
|
|
115
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
116
|
-
return arg.toString();
|
|
117
|
-
}
|
|
118
|
-
var classes = "";
|
|
119
|
-
for (var key in arg) {
|
|
120
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
121
|
-
classes = appendClass(classes, key);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return classes;
|
|
125
|
-
}
|
|
126
|
-
function appendClass(value, newClass) {
|
|
127
|
-
if (!newClass) {
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
if (value) {
|
|
131
|
-
return value + " " + newClass;
|
|
132
|
-
}
|
|
133
|
-
return value + newClass;
|
|
134
|
-
}
|
|
135
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
136
|
-
classNames.default = classNames;
|
|
137
|
-
module.exports = classNames;
|
|
138
|
-
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
139
|
-
define("classnames", [], function() {
|
|
140
|
-
return classNames;
|
|
141
|
-
});
|
|
142
|
-
} else {
|
|
143
|
-
window.classNames = classNames;
|
|
144
|
-
}
|
|
145
|
-
})();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// lib/get-class-name-factory.ts
|
|
150
|
-
init_react_import();
|
|
151
|
-
var import_classnames = __toESM(require_classnames());
|
|
152
|
-
var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
|
|
153
|
-
if (typeof options === "string") {
|
|
154
|
-
const descendant = options;
|
|
155
|
-
const style = styles[`${rootClass}-${descendant}`];
|
|
156
|
-
if (style) {
|
|
157
|
-
return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
|
|
158
|
-
}
|
|
159
|
-
return "";
|
|
160
|
-
} else if (typeof options === "object") {
|
|
161
|
-
const modifiers = options;
|
|
162
|
-
const prefixedModifiers = {};
|
|
163
|
-
for (let modifier in modifiers) {
|
|
164
|
-
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
|
165
|
-
}
|
|
166
|
-
const c = styles[rootClass];
|
|
167
|
-
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
|
168
|
-
[c]: !!c
|
|
169
|
-
}, prefixedModifiers));
|
|
170
|
-
} else {
|
|
171
|
-
return config.baseClass + styles[rootClass] || "";
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
var get_class_name_factory_default = getClassNameFactory;
|
|
175
|
-
|
|
176
87
|
export {
|
|
177
88
|
__spreadValues,
|
|
178
89
|
__spreadProps,
|
|
@@ -180,15 +91,5 @@ export {
|
|
|
180
91
|
__commonJS,
|
|
181
92
|
__toESM,
|
|
182
93
|
__async,
|
|
183
|
-
init_react_import
|
|
184
|
-
get_class_name_factory_default
|
|
94
|
+
init_react_import
|
|
185
95
|
};
|
|
186
|
-
/*! Bundled license information:
|
|
187
|
-
|
|
188
|
-
classnames/index.js:
|
|
189
|
-
(*!
|
|
190
|
-
Copyright (c) 2018 Jed Watson.
|
|
191
|
-
Licensed under the MIT License (MIT), see
|
|
192
|
-
http://jedwatson.github.io/classnames
|
|
193
|
-
*)
|
|
194
|
-
*/
|