@reacteditor/core 0.0.2 → 0.0.4
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/{chunk-BQ2PZ2YN.mjs → chunk-D2RG73WI.mjs} +79 -144
- package/dist/index.js +84 -151
- package/dist/index.mjs +1 -1
- package/dist/no-external.js +84 -151
- package/dist/no-external.mjs +1 -1
- package/package.json +8 -3
|
@@ -392,11 +392,14 @@ init_react_import();
|
|
|
392
392
|
import { useState as useState3 } from "react";
|
|
393
393
|
import { PointerSensor } from "@dnd-kit/react";
|
|
394
394
|
import { isElement } from "@dnd-kit/dom/utilities";
|
|
395
|
-
|
|
396
|
-
var
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
import { PointerActivationConstraints } from "@dnd-kit/dom";
|
|
396
|
+
var touchDefault = [
|
|
397
|
+
new PointerActivationConstraints.Delay({ value: 200, tolerance: 10 })
|
|
398
|
+
];
|
|
399
|
+
var otherDefault = [
|
|
400
|
+
new PointerActivationConstraints.Delay({ value: 200, tolerance: 10 }),
|
|
401
|
+
new PointerActivationConstraints.Distance({ value: 5 })
|
|
402
|
+
];
|
|
400
403
|
var useSensors = ({
|
|
401
404
|
other = otherDefault,
|
|
402
405
|
mouse,
|
|
@@ -426,8 +429,8 @@ var useSensors = ({
|
|
|
426
429
|
// lib/dnd/collision/dynamic/index.ts
|
|
427
430
|
init_react_import();
|
|
428
431
|
import {
|
|
429
|
-
CollisionPriority
|
|
430
|
-
CollisionType as
|
|
432
|
+
CollisionPriority,
|
|
433
|
+
CollisionType as CollisionType2
|
|
431
434
|
} from "@dnd-kit/abstract";
|
|
432
435
|
|
|
433
436
|
// lib/dnd/collision/directional/index.ts
|
|
@@ -573,70 +576,8 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
|
573
576
|
return intervalCache;
|
|
574
577
|
};
|
|
575
578
|
|
|
576
|
-
//
|
|
577
|
-
|
|
578
|
-
import { CollisionPriority, CollisionType as CollisionType2 } from "@dnd-kit/abstract";
|
|
579
|
-
import { Point as Point2 } from "@dnd-kit/geometry";
|
|
580
|
-
import { CollisionPriority as CollisionPriority2, CollisionType as CollisionType22 } from "@dnd-kit/abstract";
|
|
581
|
-
import { Point as Point22 } from "@dnd-kit/geometry";
|
|
582
|
-
import { CollisionPriority as CollisionPriority3, CollisionType as CollisionType3 } from "@dnd-kit/abstract";
|
|
583
|
-
import { Point as Point3, Rectangle } from "@dnd-kit/geometry";
|
|
584
|
-
import { CollisionPriority as CollisionPriority4, CollisionType as CollisionType4 } from "@dnd-kit/abstract";
|
|
585
|
-
import { Point as Point4 } from "@dnd-kit/geometry";
|
|
586
|
-
import { CollisionPriority as CollisionPriority5, CollisionType as CollisionType5 } from "@dnd-kit/abstract";
|
|
587
|
-
import { Point as Point5 } from "@dnd-kit/geometry";
|
|
588
|
-
import { CollisionPriority as CollisionPriority6, CollisionType as CollisionType6 } from "@dnd-kit/abstract";
|
|
589
|
-
import { Point as Point6 } from "@dnd-kit/geometry";
|
|
590
|
-
var pointerIntersection = ({
|
|
591
|
-
dragOperation,
|
|
592
|
-
droppable
|
|
593
|
-
}) => {
|
|
594
|
-
const pointerCoordinates = dragOperation.position.current;
|
|
595
|
-
if (!pointerCoordinates) {
|
|
596
|
-
return null;
|
|
597
|
-
}
|
|
598
|
-
const { id } = droppable;
|
|
599
|
-
if (!droppable.shape) {
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
|
603
|
-
const distance = Point2.distance(droppable.shape.center, pointerCoordinates);
|
|
604
|
-
return {
|
|
605
|
-
id,
|
|
606
|
-
value: 1 / distance,
|
|
607
|
-
type: CollisionType2.PointerIntersection,
|
|
608
|
-
priority: CollisionPriority.High
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
return null;
|
|
612
|
-
};
|
|
613
|
-
var closestCorners = (input) => {
|
|
614
|
-
const { dragOperation, droppable } = input;
|
|
615
|
-
const { shape, position } = dragOperation;
|
|
616
|
-
if (!droppable.shape) {
|
|
617
|
-
return null;
|
|
618
|
-
}
|
|
619
|
-
const shapeCorners = shape ? Rectangle.from(shape.current.boundingRectangle).corners : void 0;
|
|
620
|
-
const distance = Rectangle.from(
|
|
621
|
-
droppable.shape.boundingRectangle
|
|
622
|
-
).corners.reduce(
|
|
623
|
-
(acc, corner, index) => {
|
|
624
|
-
var _a;
|
|
625
|
-
return acc + Point3.distance(
|
|
626
|
-
Point3.from(corner),
|
|
627
|
-
(_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
|
|
628
|
-
);
|
|
629
|
-
},
|
|
630
|
-
0
|
|
631
|
-
);
|
|
632
|
-
const value = distance / 4;
|
|
633
|
-
return {
|
|
634
|
-
id: droppable.id,
|
|
635
|
-
value: 1 / value,
|
|
636
|
-
type: CollisionType3.Collision,
|
|
637
|
-
priority: CollisionPriority3.Normal
|
|
638
|
-
};
|
|
639
|
-
};
|
|
579
|
+
// lib/dnd/collision/dynamic/index.ts
|
|
580
|
+
import { closestCorners } from "@dnd-kit/collision";
|
|
640
581
|
|
|
641
582
|
// lib/dnd/collision/dynamic/store.ts
|
|
642
583
|
init_react_import();
|
|
@@ -674,7 +615,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
674
615
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
|
675
616
|
if (collision) {
|
|
676
617
|
return __spreadProps(__spreadValues({}, collision), {
|
|
677
|
-
priority:
|
|
618
|
+
priority: CollisionPriority.Highest,
|
|
678
619
|
data
|
|
679
620
|
});
|
|
680
621
|
}
|
|
@@ -692,8 +633,8 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
692
633
|
const collision = {
|
|
693
634
|
id: droppable.id,
|
|
694
635
|
value: intersectionRatio,
|
|
695
|
-
priority:
|
|
696
|
-
type:
|
|
636
|
+
priority: CollisionPriority.High,
|
|
637
|
+
type: CollisionType2.Collision
|
|
697
638
|
};
|
|
698
639
|
const shouldFlushId = flushNext === droppable.id;
|
|
699
640
|
flushNext = "";
|
|
@@ -720,7 +661,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
720
661
|
);
|
|
721
662
|
flushNext = droppable.id;
|
|
722
663
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
723
|
-
priority:
|
|
664
|
+
priority: CollisionPriority.Low,
|
|
724
665
|
data
|
|
725
666
|
});
|
|
726
667
|
}
|
|
@@ -732,7 +673,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
732
673
|
direction || ""
|
|
733
674
|
);
|
|
734
675
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
735
|
-
priority:
|
|
676
|
+
priority: CollisionPriority.Lowest,
|
|
736
677
|
data
|
|
737
678
|
});
|
|
738
679
|
}
|
|
@@ -744,6 +685,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
744
685
|
|
|
745
686
|
// components/Sortable/index.tsx
|
|
746
687
|
import { useSortable } from "@dnd-kit/react/sortable";
|
|
688
|
+
import { PointerActivationConstraints as PointerActivationConstraints2 } from "@dnd-kit/dom";
|
|
747
689
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
748
690
|
var SortableProvider = ({
|
|
749
691
|
children,
|
|
@@ -752,7 +694,7 @@ var SortableProvider = ({
|
|
|
752
694
|
onMove
|
|
753
695
|
}) => {
|
|
754
696
|
const sensors = useSensors({
|
|
755
|
-
mouse:
|
|
697
|
+
mouse: [new PointerActivationConstraints2.Distance({ value: 5 })]
|
|
756
698
|
});
|
|
757
699
|
return /* @__PURE__ */ jsx5(
|
|
758
700
|
DragDropProvider,
|
|
@@ -2512,6 +2454,7 @@ var DropZoneProvider = ({
|
|
|
2512
2454
|
// components/DraggableComponent/index.tsx
|
|
2513
2455
|
import { useShallow as useShallow4 } from "zustand/react/shallow";
|
|
2514
2456
|
import { useSortable as useSortable2 } from "@dnd-kit/react/sortable";
|
|
2457
|
+
import { Feedback } from "@dnd-kit/dom";
|
|
2515
2458
|
|
|
2516
2459
|
// lib/dnd/use-on-drag-finished.ts
|
|
2517
2460
|
init_react_import();
|
|
@@ -2657,6 +2600,13 @@ var DraggableComponent = ({
|
|
|
2657
2600
|
() => createDynamicCollisionDetector(dragAxis),
|
|
2658
2601
|
[dragAxis]
|
|
2659
2602
|
);
|
|
2603
|
+
const sortablePlugins = useMemo7(
|
|
2604
|
+
() => (defaults) => [
|
|
2605
|
+
...defaults,
|
|
2606
|
+
Feedback.configure({ feedback: "clone" })
|
|
2607
|
+
],
|
|
2608
|
+
[]
|
|
2609
|
+
);
|
|
2660
2610
|
const {
|
|
2661
2611
|
ref: sortableRef,
|
|
2662
2612
|
isDragging: thisIsDragging,
|
|
@@ -2682,8 +2632,7 @@ var DraggableComponent = ({
|
|
|
2682
2632
|
transition: {
|
|
2683
2633
|
duration: 200,
|
|
2684
2634
|
easing: "cubic-bezier(0.2, 0, 0, 1)"
|
|
2685
|
-
}
|
|
2686
|
-
feedback: "clone"
|
|
2635
|
+
}
|
|
2687
2636
|
});
|
|
2688
2637
|
useEffect8(() => {
|
|
2689
2638
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
@@ -3196,6 +3145,7 @@ import {
|
|
|
3196
3145
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
3197
3146
|
init_react_import();
|
|
3198
3147
|
import { Plugin } from "@dnd-kit/abstract";
|
|
3148
|
+
import { getDocuments } from "@dnd-kit/dom/utilities";
|
|
3199
3149
|
|
|
3200
3150
|
// lib/throttle.ts
|
|
3201
3151
|
init_react_import();
|
|
@@ -3276,25 +3226,6 @@ var GlobalPosition = class {
|
|
|
3276
3226
|
}
|
|
3277
3227
|
};
|
|
3278
3228
|
|
|
3279
|
-
// lib/bubble-pointer-event.ts
|
|
3280
|
-
init_react_import();
|
|
3281
|
-
var BaseEvent = typeof PointerEvent !== "undefined" ? PointerEvent : Event;
|
|
3282
|
-
var BubbledPointerEvent = class extends BaseEvent {
|
|
3283
|
-
constructor(type, data) {
|
|
3284
|
-
super(type, data);
|
|
3285
|
-
this._originalTarget = null;
|
|
3286
|
-
this.originalTarget = data.originalTarget;
|
|
3287
|
-
}
|
|
3288
|
-
// Necessary for Firefox
|
|
3289
|
-
set originalTarget(target) {
|
|
3290
|
-
this._originalTarget = target;
|
|
3291
|
-
}
|
|
3292
|
-
// Necessary for Firefox
|
|
3293
|
-
get originalTarget() {
|
|
3294
|
-
return this._originalTarget;
|
|
3295
|
-
}
|
|
3296
|
-
};
|
|
3297
|
-
|
|
3298
3229
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
3299
3230
|
var depthSort = (candidates) => {
|
|
3300
3231
|
return candidates.sort((a, b) => {
|
|
@@ -3437,7 +3368,7 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
3437
3368
|
}
|
|
3438
3369
|
this.registerEffect(() => {
|
|
3439
3370
|
const handleMove = (event) => {
|
|
3440
|
-
const target = event
|
|
3371
|
+
const target = event.target;
|
|
3441
3372
|
const position = new GlobalPosition(target, {
|
|
3442
3373
|
x: event.clientX,
|
|
3443
3374
|
y: event.clientY
|
|
@@ -3455,15 +3386,55 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
3455
3386
|
const handlePointerMove = (event) => {
|
|
3456
3387
|
handleMoveThrottled(event);
|
|
3457
3388
|
};
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
document.body.removeEventListener("pointermove", handlePointerMove, {
|
|
3389
|
+
const bound = /* @__PURE__ */ new Set();
|
|
3390
|
+
const bind = (doc) => {
|
|
3391
|
+
if (bound.has(doc)) return;
|
|
3392
|
+
bound.add(doc);
|
|
3393
|
+
doc.addEventListener("pointermove", handlePointerMove, {
|
|
3464
3394
|
capture: true
|
|
3395
|
+
// dndkit's PointerSensor prevents propagation during drag
|
|
3465
3396
|
});
|
|
3466
3397
|
};
|
|
3398
|
+
const bindAll = () => {
|
|
3399
|
+
for (const doc of getDocuments()) bind(doc);
|
|
3400
|
+
};
|
|
3401
|
+
bindAll();
|
|
3402
|
+
const onIframeLoad = () => bindAll();
|
|
3403
|
+
const observed = /* @__PURE__ */ new Set();
|
|
3404
|
+
const observeFrame = (el) => {
|
|
3405
|
+
if (observed.has(el)) return;
|
|
3406
|
+
observed.add(el);
|
|
3407
|
+
el.addEventListener("load", onIframeLoad);
|
|
3408
|
+
};
|
|
3409
|
+
for (const el of Array.from(
|
|
3410
|
+
document.querySelectorAll(
|
|
3411
|
+
"iframe, frame"
|
|
3412
|
+
)
|
|
3413
|
+
)) {
|
|
3414
|
+
observeFrame(el);
|
|
3415
|
+
}
|
|
3416
|
+
const observer = new MutationObserver((mutations) => {
|
|
3417
|
+
for (const m of mutations) {
|
|
3418
|
+
for (const node of Array.from(m.addedNodes)) {
|
|
3419
|
+
if (node instanceof HTMLIFrameElement || typeof HTMLFrameElement !== "undefined" && node instanceof HTMLFrameElement) {
|
|
3420
|
+
observeFrame(node);
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
bindAll();
|
|
3425
|
+
});
|
|
3426
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
3427
|
+
const cleanup = () => {
|
|
3428
|
+
observer.disconnect();
|
|
3429
|
+
for (const el of observed) {
|
|
3430
|
+
el.removeEventListener("load", onIframeLoad);
|
|
3431
|
+
}
|
|
3432
|
+
for (const doc of bound) {
|
|
3433
|
+
doc.removeEventListener("pointermove", handlePointerMove, {
|
|
3434
|
+
capture: true
|
|
3435
|
+
});
|
|
3436
|
+
}
|
|
3437
|
+
};
|
|
3467
3438
|
return cleanup;
|
|
3468
3439
|
});
|
|
3469
3440
|
}
|
|
@@ -4139,6 +4110,9 @@ var Drawer = ({
|
|
|
4139
4110
|
};
|
|
4140
4111
|
Drawer.Item = DrawerItem;
|
|
4141
4112
|
|
|
4113
|
+
// components/DropZone/index.tsx
|
|
4114
|
+
import { pointerIntersection } from "@dnd-kit/collision";
|
|
4115
|
+
|
|
4142
4116
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
4143
4117
|
init_react_import();
|
|
4144
4118
|
import { useEffect as useEffect10, useRef as useRef4, useState as useState12 } from "react";
|
|
@@ -7017,44 +6991,6 @@ var styles_module_default21 = { "EditorPreview": "_EditorPreview_xou64_1", "Edit
|
|
|
7017
6991
|
// components/Editor/components/Preview/index.tsx
|
|
7018
6992
|
import { Fragment as Fragment11, jsx as jsx44 } from "react/jsx-runtime";
|
|
7019
6993
|
var getClassName26 = get_class_name_factory_default("EditorPreview", styles_module_default21);
|
|
7020
|
-
var useBubbleIframeEvents = (ref) => {
|
|
7021
|
-
const status = useAppStore((s) => s.status);
|
|
7022
|
-
useEffect21(() => {
|
|
7023
|
-
if (ref.current && status === "READY") {
|
|
7024
|
-
const iframe = ref.current;
|
|
7025
|
-
const handlePointerMove = (event) => {
|
|
7026
|
-
const evt = new BubbledPointerEvent("pointermove", __spreadProps(__spreadValues({}, event), {
|
|
7027
|
-
bubbles: true,
|
|
7028
|
-
cancelable: false,
|
|
7029
|
-
clientX: event.clientX,
|
|
7030
|
-
clientY: event.clientY,
|
|
7031
|
-
originalTarget: event.target
|
|
7032
|
-
}));
|
|
7033
|
-
iframe.dispatchEvent(evt);
|
|
7034
|
-
};
|
|
7035
|
-
const register = () => {
|
|
7036
|
-
var _a;
|
|
7037
|
-
unregister();
|
|
7038
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.addEventListener(
|
|
7039
|
-
"pointermove",
|
|
7040
|
-
handlePointerMove,
|
|
7041
|
-
{ capture: true }
|
|
7042
|
-
);
|
|
7043
|
-
};
|
|
7044
|
-
const unregister = () => {
|
|
7045
|
-
var _a;
|
|
7046
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.removeEventListener(
|
|
7047
|
-
"pointermove",
|
|
7048
|
-
handlePointerMove
|
|
7049
|
-
);
|
|
7050
|
-
};
|
|
7051
|
-
register();
|
|
7052
|
-
return () => {
|
|
7053
|
-
unregister();
|
|
7054
|
-
};
|
|
7055
|
-
}
|
|
7056
|
-
}, [status]);
|
|
7057
|
-
};
|
|
7058
6994
|
var Preview2 = ({ id = "editor-preview" }) => {
|
|
7059
6995
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7060
6996
|
const root = useAppStore((s) => s.state.data.root);
|
|
@@ -7087,7 +7023,6 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
7087
7023
|
const Frame = useMemo18(() => overrides.iframe, [overrides]);
|
|
7088
7024
|
const rootProps = root.props || root;
|
|
7089
7025
|
const ref = useRef11(null);
|
|
7090
|
-
useBubbleIframeEvents(ref);
|
|
7091
7026
|
const inner = !renderData ? /* @__PURE__ */ jsx44(
|
|
7092
7027
|
Page,
|
|
7093
7028
|
__spreadProps(__spreadValues({}, rootProps), {
|
package/dist/index.js
CHANGED
|
@@ -5633,11 +5633,14 @@ init_react_import();
|
|
|
5633
5633
|
var import_react12 = require("react");
|
|
5634
5634
|
var import_react13 = require("@dnd-kit/react");
|
|
5635
5635
|
var import_utilities = require("@dnd-kit/dom/utilities");
|
|
5636
|
-
var
|
|
5637
|
-
var
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5636
|
+
var import_dom = require("@dnd-kit/dom");
|
|
5637
|
+
var touchDefault = [
|
|
5638
|
+
new import_dom.PointerActivationConstraints.Delay({ value: 200, tolerance: 10 })
|
|
5639
|
+
];
|
|
5640
|
+
var otherDefault = [
|
|
5641
|
+
new import_dom.PointerActivationConstraints.Delay({ value: 200, tolerance: 10 }),
|
|
5642
|
+
new import_dom.PointerActivationConstraints.Distance({ value: 5 })
|
|
5643
|
+
];
|
|
5641
5644
|
var useSensors = ({
|
|
5642
5645
|
other = otherDefault,
|
|
5643
5646
|
mouse,
|
|
@@ -5666,7 +5669,7 @@ var useSensors = ({
|
|
|
5666
5669
|
|
|
5667
5670
|
// lib/dnd/collision/dynamic/index.ts
|
|
5668
5671
|
init_react_import();
|
|
5669
|
-
var
|
|
5672
|
+
var import_abstract2 = require("@dnd-kit/abstract");
|
|
5670
5673
|
|
|
5671
5674
|
// lib/dnd/collision/directional/index.ts
|
|
5672
5675
|
init_react_import();
|
|
@@ -5811,70 +5814,8 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
|
5811
5814
|
return intervalCache;
|
|
5812
5815
|
};
|
|
5813
5816
|
|
|
5814
|
-
//
|
|
5815
|
-
|
|
5816
|
-
var import_abstract2 = require("@dnd-kit/abstract");
|
|
5817
|
-
var import_geometry2 = require("@dnd-kit/geometry");
|
|
5818
|
-
var import_abstract3 = require("@dnd-kit/abstract");
|
|
5819
|
-
var import_geometry3 = require("@dnd-kit/geometry");
|
|
5820
|
-
var import_abstract4 = require("@dnd-kit/abstract");
|
|
5821
|
-
var import_geometry4 = require("@dnd-kit/geometry");
|
|
5822
|
-
var import_abstract5 = require("@dnd-kit/abstract");
|
|
5823
|
-
var import_geometry5 = require("@dnd-kit/geometry");
|
|
5824
|
-
var import_abstract6 = require("@dnd-kit/abstract");
|
|
5825
|
-
var import_geometry6 = require("@dnd-kit/geometry");
|
|
5826
|
-
var import_abstract7 = require("@dnd-kit/abstract");
|
|
5827
|
-
var import_geometry7 = require("@dnd-kit/geometry");
|
|
5828
|
-
var pointerIntersection = ({
|
|
5829
|
-
dragOperation,
|
|
5830
|
-
droppable
|
|
5831
|
-
}) => {
|
|
5832
|
-
const pointerCoordinates = dragOperation.position.current;
|
|
5833
|
-
if (!pointerCoordinates) {
|
|
5834
|
-
return null;
|
|
5835
|
-
}
|
|
5836
|
-
const { id } = droppable;
|
|
5837
|
-
if (!droppable.shape) {
|
|
5838
|
-
return null;
|
|
5839
|
-
}
|
|
5840
|
-
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
|
5841
|
-
const distance = import_geometry2.Point.distance(droppable.shape.center, pointerCoordinates);
|
|
5842
|
-
return {
|
|
5843
|
-
id,
|
|
5844
|
-
value: 1 / distance,
|
|
5845
|
-
type: import_abstract2.CollisionType.PointerIntersection,
|
|
5846
|
-
priority: import_abstract2.CollisionPriority.High
|
|
5847
|
-
};
|
|
5848
|
-
}
|
|
5849
|
-
return null;
|
|
5850
|
-
};
|
|
5851
|
-
var closestCorners = (input) => {
|
|
5852
|
-
const { dragOperation, droppable } = input;
|
|
5853
|
-
const { shape, position } = dragOperation;
|
|
5854
|
-
if (!droppable.shape) {
|
|
5855
|
-
return null;
|
|
5856
|
-
}
|
|
5857
|
-
const shapeCorners = shape ? import_geometry4.Rectangle.from(shape.current.boundingRectangle).corners : void 0;
|
|
5858
|
-
const distance = import_geometry4.Rectangle.from(
|
|
5859
|
-
droppable.shape.boundingRectangle
|
|
5860
|
-
).corners.reduce(
|
|
5861
|
-
(acc, corner, index) => {
|
|
5862
|
-
var _a;
|
|
5863
|
-
return acc + import_geometry4.Point.distance(
|
|
5864
|
-
import_geometry4.Point.from(corner),
|
|
5865
|
-
(_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
|
|
5866
|
-
);
|
|
5867
|
-
},
|
|
5868
|
-
0
|
|
5869
|
-
);
|
|
5870
|
-
const value = distance / 4;
|
|
5871
|
-
return {
|
|
5872
|
-
id: droppable.id,
|
|
5873
|
-
value: 1 / value,
|
|
5874
|
-
type: import_abstract4.CollisionType.Collision,
|
|
5875
|
-
priority: import_abstract4.CollisionPriority.Normal
|
|
5876
|
-
};
|
|
5877
|
-
};
|
|
5817
|
+
// lib/dnd/collision/dynamic/index.ts
|
|
5818
|
+
var import_collision = require("@dnd-kit/collision");
|
|
5878
5819
|
|
|
5879
5820
|
// lib/dnd/collision/dynamic/store.ts
|
|
5880
5821
|
init_react_import();
|
|
@@ -5912,7 +5853,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5912
5853
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
|
5913
5854
|
if (collision) {
|
|
5914
5855
|
return __spreadProps(__spreadValues({}, collision), {
|
|
5915
|
-
priority:
|
|
5856
|
+
priority: import_abstract2.CollisionPriority.Highest,
|
|
5916
5857
|
data
|
|
5917
5858
|
});
|
|
5918
5859
|
}
|
|
@@ -5930,8 +5871,8 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5930
5871
|
const collision = {
|
|
5931
5872
|
id: droppable.id,
|
|
5932
5873
|
value: intersectionRatio,
|
|
5933
|
-
priority:
|
|
5934
|
-
type:
|
|
5874
|
+
priority: import_abstract2.CollisionPriority.High,
|
|
5875
|
+
type: import_abstract2.CollisionType.Collision
|
|
5935
5876
|
};
|
|
5936
5877
|
const shouldFlushId = flushNext === droppable.id;
|
|
5937
5878
|
flushNext = "";
|
|
@@ -5941,7 +5882,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5941
5882
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
|
5942
5883
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
|
5943
5884
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
|
5944
|
-
const fallbackCollision = closestCorners(input);
|
|
5885
|
+
const fallbackCollision = (0, import_collision.closestCorners)(input);
|
|
5945
5886
|
if (fallbackCollision) {
|
|
5946
5887
|
const direction = getDirection(dragAxis, {
|
|
5947
5888
|
x: dragShape.center.x - (((_d = droppable.shape) == null ? void 0 : _d.center.x) || 0),
|
|
@@ -5958,7 +5899,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5958
5899
|
);
|
|
5959
5900
|
flushNext = droppable.id;
|
|
5960
5901
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
5961
|
-
priority:
|
|
5902
|
+
priority: import_abstract2.CollisionPriority.Low,
|
|
5962
5903
|
data
|
|
5963
5904
|
});
|
|
5964
5905
|
}
|
|
@@ -5970,7 +5911,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5970
5911
|
direction || ""
|
|
5971
5912
|
);
|
|
5972
5913
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
5973
|
-
priority:
|
|
5914
|
+
priority: import_abstract2.CollisionPriority.Lowest,
|
|
5974
5915
|
data
|
|
5975
5916
|
});
|
|
5976
5917
|
}
|
|
@@ -5982,6 +5923,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5982
5923
|
|
|
5983
5924
|
// components/Sortable/index.tsx
|
|
5984
5925
|
var import_sortable = require("@dnd-kit/react/sortable");
|
|
5926
|
+
var import_dom2 = require("@dnd-kit/dom");
|
|
5985
5927
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5986
5928
|
var SortableProvider = ({
|
|
5987
5929
|
children,
|
|
@@ -5990,7 +5932,7 @@ var SortableProvider = ({
|
|
|
5990
5932
|
onMove
|
|
5991
5933
|
}) => {
|
|
5992
5934
|
const sensors = useSensors({
|
|
5993
|
-
mouse:
|
|
5935
|
+
mouse: [new import_dom2.PointerActivationConstraints.Distance({ value: 5 })]
|
|
5994
5936
|
});
|
|
5995
5937
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5996
5938
|
import_react14.DragDropProvider,
|
|
@@ -7873,7 +7815,7 @@ init_react_import();
|
|
|
7873
7815
|
var import_react69 = require("@dnd-kit/react");
|
|
7874
7816
|
init_store();
|
|
7875
7817
|
var import_react70 = require("react");
|
|
7876
|
-
var
|
|
7818
|
+
var import_dom4 = require("@dnd-kit/dom");
|
|
7877
7819
|
|
|
7878
7820
|
// components/DropZone/index.tsx
|
|
7879
7821
|
init_react_import();
|
|
@@ -7971,6 +7913,7 @@ var DropZoneProvider = ({
|
|
|
7971
7913
|
var import_shallow4 = require("zustand/react/shallow");
|
|
7972
7914
|
init_get_item();
|
|
7973
7915
|
var import_sortable2 = require("@dnd-kit/react/sortable");
|
|
7916
|
+
var import_dom3 = require("@dnd-kit/dom");
|
|
7974
7917
|
|
|
7975
7918
|
// lib/dnd/use-on-drag-finished.ts
|
|
7976
7919
|
init_react_import();
|
|
@@ -8120,6 +8063,13 @@ var DraggableComponent = ({
|
|
|
8120
8063
|
() => createDynamicCollisionDetector(dragAxis),
|
|
8121
8064
|
[dragAxis]
|
|
8122
8065
|
);
|
|
8066
|
+
const sortablePlugins = (0, import_react51.useMemo)(
|
|
8067
|
+
() => (defaults) => [
|
|
8068
|
+
...defaults,
|
|
8069
|
+
import_dom3.Feedback.configure({ feedback: "clone" })
|
|
8070
|
+
],
|
|
8071
|
+
[]
|
|
8072
|
+
);
|
|
8123
8073
|
const {
|
|
8124
8074
|
ref: sortableRef,
|
|
8125
8075
|
isDragging: thisIsDragging,
|
|
@@ -8145,8 +8095,7 @@ var DraggableComponent = ({
|
|
|
8145
8095
|
transition: {
|
|
8146
8096
|
duration: 200,
|
|
8147
8097
|
easing: "cubic-bezier(0.2, 0, 0, 1)"
|
|
8148
|
-
}
|
|
8149
|
-
feedback: "clone"
|
|
8098
|
+
}
|
|
8150
8099
|
});
|
|
8151
8100
|
(0, import_react51.useEffect)(() => {
|
|
8152
8101
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
@@ -8632,6 +8581,7 @@ var styles_module_default18 = { "DropZone": "_DropZone_q9qsx_1", "DropZone--hasC
|
|
|
8632
8581
|
// components/DropZone/index.tsx
|
|
8633
8582
|
init_store();
|
|
8634
8583
|
var import_react68 = require("@dnd-kit/react");
|
|
8584
|
+
var import_collision2 = require("@dnd-kit/collision");
|
|
8635
8585
|
|
|
8636
8586
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8637
8587
|
init_react_import();
|
|
@@ -10126,7 +10076,7 @@ var DropZoneEdit = (0, import_react67.forwardRef)(
|
|
|
10126
10076
|
id: zoneCompound,
|
|
10127
10077
|
collisionPriority: isEnabled ? depth : 0,
|
|
10128
10078
|
disabled: !isDropEnabled,
|
|
10129
|
-
collisionDetector: pointerIntersection,
|
|
10079
|
+
collisionDetector: import_collision2.pointerIntersection,
|
|
10130
10080
|
type: "dropzone",
|
|
10131
10081
|
data: {
|
|
10132
10082
|
areaId,
|
|
@@ -10290,7 +10240,8 @@ init_get_item();
|
|
|
10290
10240
|
|
|
10291
10241
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
10292
10242
|
init_react_import();
|
|
10293
|
-
var
|
|
10243
|
+
var import_abstract3 = require("@dnd-kit/abstract");
|
|
10244
|
+
var import_utilities2 = require("@dnd-kit/dom/utilities");
|
|
10294
10245
|
|
|
10295
10246
|
// lib/throttle.ts
|
|
10296
10247
|
init_react_import();
|
|
@@ -10360,25 +10311,6 @@ var GlobalPosition = class {
|
|
|
10360
10311
|
}
|
|
10361
10312
|
};
|
|
10362
10313
|
|
|
10363
|
-
// lib/bubble-pointer-event.ts
|
|
10364
|
-
init_react_import();
|
|
10365
|
-
var BaseEvent = typeof PointerEvent !== "undefined" ? PointerEvent : Event;
|
|
10366
|
-
var BubbledPointerEvent = class extends BaseEvent {
|
|
10367
|
-
constructor(type, data) {
|
|
10368
|
-
super(type, data);
|
|
10369
|
-
this._originalTarget = null;
|
|
10370
|
-
this.originalTarget = data.originalTarget;
|
|
10371
|
-
}
|
|
10372
|
-
// Necessary for Firefox
|
|
10373
|
-
set originalTarget(target) {
|
|
10374
|
-
this._originalTarget = target;
|
|
10375
|
-
}
|
|
10376
|
-
// Necessary for Firefox
|
|
10377
|
-
get originalTarget() {
|
|
10378
|
-
return this._originalTarget;
|
|
10379
|
-
}
|
|
10380
|
-
};
|
|
10381
|
-
|
|
10382
10314
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
10383
10315
|
init_root_droppable_id();
|
|
10384
10316
|
var depthSort = (candidates) => {
|
|
@@ -10514,7 +10446,7 @@ var findDeepestCandidate = (position, manager) => {
|
|
|
10514
10446
|
area: rootAreaId
|
|
10515
10447
|
};
|
|
10516
10448
|
};
|
|
10517
|
-
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends
|
|
10449
|
+
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract3.Plugin {
|
|
10518
10450
|
constructor(manager, options) {
|
|
10519
10451
|
super(manager);
|
|
10520
10452
|
if (typeof window === "undefined") {
|
|
@@ -10522,7 +10454,7 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
10522
10454
|
}
|
|
10523
10455
|
this.registerEffect(() => {
|
|
10524
10456
|
const handleMove = (event) => {
|
|
10525
|
-
const target = event
|
|
10457
|
+
const target = event.target;
|
|
10526
10458
|
const position = new GlobalPosition(target, {
|
|
10527
10459
|
x: event.clientX,
|
|
10528
10460
|
y: event.clientY
|
|
@@ -10540,15 +10472,55 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
10540
10472
|
const handlePointerMove = (event) => {
|
|
10541
10473
|
handleMoveThrottled(event);
|
|
10542
10474
|
};
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
document.body.removeEventListener("pointermove", handlePointerMove, {
|
|
10475
|
+
const bound = /* @__PURE__ */ new Set();
|
|
10476
|
+
const bind = (doc) => {
|
|
10477
|
+
if (bound.has(doc)) return;
|
|
10478
|
+
bound.add(doc);
|
|
10479
|
+
doc.addEventListener("pointermove", handlePointerMove, {
|
|
10549
10480
|
capture: true
|
|
10481
|
+
// dndkit's PointerSensor prevents propagation during drag
|
|
10550
10482
|
});
|
|
10551
10483
|
};
|
|
10484
|
+
const bindAll = () => {
|
|
10485
|
+
for (const doc of (0, import_utilities2.getDocuments)()) bind(doc);
|
|
10486
|
+
};
|
|
10487
|
+
bindAll();
|
|
10488
|
+
const onIframeLoad = () => bindAll();
|
|
10489
|
+
const observed = /* @__PURE__ */ new Set();
|
|
10490
|
+
const observeFrame = (el) => {
|
|
10491
|
+
if (observed.has(el)) return;
|
|
10492
|
+
observed.add(el);
|
|
10493
|
+
el.addEventListener("load", onIframeLoad);
|
|
10494
|
+
};
|
|
10495
|
+
for (const el of Array.from(
|
|
10496
|
+
document.querySelectorAll(
|
|
10497
|
+
"iframe, frame"
|
|
10498
|
+
)
|
|
10499
|
+
)) {
|
|
10500
|
+
observeFrame(el);
|
|
10501
|
+
}
|
|
10502
|
+
const observer = new MutationObserver((mutations) => {
|
|
10503
|
+
for (const m of mutations) {
|
|
10504
|
+
for (const node of Array.from(m.addedNodes)) {
|
|
10505
|
+
if (node instanceof HTMLIFrameElement || typeof HTMLFrameElement !== "undefined" && node instanceof HTMLFrameElement) {
|
|
10506
|
+
observeFrame(node);
|
|
10507
|
+
}
|
|
10508
|
+
}
|
|
10509
|
+
}
|
|
10510
|
+
bindAll();
|
|
10511
|
+
});
|
|
10512
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
10513
|
+
const cleanup = () => {
|
|
10514
|
+
observer.disconnect();
|
|
10515
|
+
for (const el of observed) {
|
|
10516
|
+
el.removeEventListener("load", onIframeLoad);
|
|
10517
|
+
}
|
|
10518
|
+
for (const doc of bound) {
|
|
10519
|
+
doc.removeEventListener("pointermove", handlePointerMove, {
|
|
10520
|
+
capture: true
|
|
10521
|
+
});
|
|
10522
|
+
}
|
|
10523
|
+
};
|
|
10552
10524
|
return cleanup;
|
|
10553
10525
|
});
|
|
10554
10526
|
}
|
|
@@ -10784,9 +10756,9 @@ var DragDropContextClient = ({
|
|
|
10784
10756
|
}
|
|
10785
10757
|
}, []);
|
|
10786
10758
|
const [plugins] = (0, import_react70.useState)(() => [
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
...disableAutoScroll ?
|
|
10759
|
+
import_dom4.ScrollListener,
|
|
10760
|
+
import_dom4.Scroller,
|
|
10761
|
+
...disableAutoScroll ? import_dom4.defaultPreset.plugins.filter((plugin) => plugin !== import_dom4.AutoScroller) : import_dom4.defaultPreset.plugins,
|
|
10790
10762
|
createNestedDroppablePlugin(
|
|
10791
10763
|
{
|
|
10792
10764
|
onChange: (params, manager) => {
|
|
@@ -11911,44 +11883,6 @@ var styles_module_default22 = { "EditorPreview": "_EditorPreview_xou64_1", "Edit
|
|
|
11911
11883
|
init_lib();
|
|
11912
11884
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11913
11885
|
var getClassName30 = get_class_name_factory_default("EditorPreview", styles_module_default22);
|
|
11914
|
-
var useBubbleIframeEvents = (ref) => {
|
|
11915
|
-
const status = useAppStore((s) => s.status);
|
|
11916
|
-
(0, import_react77.useEffect)(() => {
|
|
11917
|
-
if (ref.current && status === "READY") {
|
|
11918
|
-
const iframe = ref.current;
|
|
11919
|
-
const handlePointerMove = (event) => {
|
|
11920
|
-
const evt = new BubbledPointerEvent("pointermove", __spreadProps(__spreadValues({}, event), {
|
|
11921
|
-
bubbles: true,
|
|
11922
|
-
cancelable: false,
|
|
11923
|
-
clientX: event.clientX,
|
|
11924
|
-
clientY: event.clientY,
|
|
11925
|
-
originalTarget: event.target
|
|
11926
|
-
}));
|
|
11927
|
-
iframe.dispatchEvent(evt);
|
|
11928
|
-
};
|
|
11929
|
-
const register = () => {
|
|
11930
|
-
var _a;
|
|
11931
|
-
unregister();
|
|
11932
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.addEventListener(
|
|
11933
|
-
"pointermove",
|
|
11934
|
-
handlePointerMove,
|
|
11935
|
-
{ capture: true }
|
|
11936
|
-
);
|
|
11937
|
-
};
|
|
11938
|
-
const unregister = () => {
|
|
11939
|
-
var _a;
|
|
11940
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.removeEventListener(
|
|
11941
|
-
"pointermove",
|
|
11942
|
-
handlePointerMove
|
|
11943
|
-
);
|
|
11944
|
-
};
|
|
11945
|
-
register();
|
|
11946
|
-
return () => {
|
|
11947
|
-
unregister();
|
|
11948
|
-
};
|
|
11949
|
-
}
|
|
11950
|
-
}, [status]);
|
|
11951
|
-
};
|
|
11952
11886
|
var Preview2 = ({ id = "editor-preview" }) => {
|
|
11953
11887
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11954
11888
|
const root = useAppStore((s) => s.state.data.root);
|
|
@@ -11981,7 +11915,6 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
11981
11915
|
const Frame = (0, import_react77.useMemo)(() => overrides.iframe, [overrides]);
|
|
11982
11916
|
const rootProps = root.props || root;
|
|
11983
11917
|
const ref = (0, import_react77.useRef)(null);
|
|
11984
|
-
useBubbleIframeEvents(ref);
|
|
11985
11918
|
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11986
11919
|
Page,
|
|
11987
11920
|
__spreadProps(__spreadValues({}, rootProps), {
|
package/dist/index.mjs
CHANGED
package/dist/no-external.js
CHANGED
|
@@ -5633,11 +5633,14 @@ init_react_import();
|
|
|
5633
5633
|
var import_react12 = require("react");
|
|
5634
5634
|
var import_react13 = require("@dnd-kit/react");
|
|
5635
5635
|
var import_utilities = require("@dnd-kit/dom/utilities");
|
|
5636
|
-
var
|
|
5637
|
-
var
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5636
|
+
var import_dom = require("@dnd-kit/dom");
|
|
5637
|
+
var touchDefault = [
|
|
5638
|
+
new import_dom.PointerActivationConstraints.Delay({ value: 200, tolerance: 10 })
|
|
5639
|
+
];
|
|
5640
|
+
var otherDefault = [
|
|
5641
|
+
new import_dom.PointerActivationConstraints.Delay({ value: 200, tolerance: 10 }),
|
|
5642
|
+
new import_dom.PointerActivationConstraints.Distance({ value: 5 })
|
|
5643
|
+
];
|
|
5641
5644
|
var useSensors = ({
|
|
5642
5645
|
other = otherDefault,
|
|
5643
5646
|
mouse,
|
|
@@ -5666,7 +5669,7 @@ var useSensors = ({
|
|
|
5666
5669
|
|
|
5667
5670
|
// lib/dnd/collision/dynamic/index.ts
|
|
5668
5671
|
init_react_import();
|
|
5669
|
-
var
|
|
5672
|
+
var import_abstract2 = require("@dnd-kit/abstract");
|
|
5670
5673
|
|
|
5671
5674
|
// lib/dnd/collision/directional/index.ts
|
|
5672
5675
|
init_react_import();
|
|
@@ -5811,70 +5814,8 @@ var trackMovementInterval = (point, dragAxis = "dynamic") => {
|
|
|
5811
5814
|
return intervalCache;
|
|
5812
5815
|
};
|
|
5813
5816
|
|
|
5814
|
-
//
|
|
5815
|
-
|
|
5816
|
-
var import_abstract2 = require("@dnd-kit/abstract");
|
|
5817
|
-
var import_geometry2 = require("@dnd-kit/geometry");
|
|
5818
|
-
var import_abstract3 = require("@dnd-kit/abstract");
|
|
5819
|
-
var import_geometry3 = require("@dnd-kit/geometry");
|
|
5820
|
-
var import_abstract4 = require("@dnd-kit/abstract");
|
|
5821
|
-
var import_geometry4 = require("@dnd-kit/geometry");
|
|
5822
|
-
var import_abstract5 = require("@dnd-kit/abstract");
|
|
5823
|
-
var import_geometry5 = require("@dnd-kit/geometry");
|
|
5824
|
-
var import_abstract6 = require("@dnd-kit/abstract");
|
|
5825
|
-
var import_geometry6 = require("@dnd-kit/geometry");
|
|
5826
|
-
var import_abstract7 = require("@dnd-kit/abstract");
|
|
5827
|
-
var import_geometry7 = require("@dnd-kit/geometry");
|
|
5828
|
-
var pointerIntersection = ({
|
|
5829
|
-
dragOperation,
|
|
5830
|
-
droppable
|
|
5831
|
-
}) => {
|
|
5832
|
-
const pointerCoordinates = dragOperation.position.current;
|
|
5833
|
-
if (!pointerCoordinates) {
|
|
5834
|
-
return null;
|
|
5835
|
-
}
|
|
5836
|
-
const { id } = droppable;
|
|
5837
|
-
if (!droppable.shape) {
|
|
5838
|
-
return null;
|
|
5839
|
-
}
|
|
5840
|
-
if (droppable.shape.containsPoint(pointerCoordinates)) {
|
|
5841
|
-
const distance = import_geometry2.Point.distance(droppable.shape.center, pointerCoordinates);
|
|
5842
|
-
return {
|
|
5843
|
-
id,
|
|
5844
|
-
value: 1 / distance,
|
|
5845
|
-
type: import_abstract2.CollisionType.PointerIntersection,
|
|
5846
|
-
priority: import_abstract2.CollisionPriority.High
|
|
5847
|
-
};
|
|
5848
|
-
}
|
|
5849
|
-
return null;
|
|
5850
|
-
};
|
|
5851
|
-
var closestCorners = (input) => {
|
|
5852
|
-
const { dragOperation, droppable } = input;
|
|
5853
|
-
const { shape, position } = dragOperation;
|
|
5854
|
-
if (!droppable.shape) {
|
|
5855
|
-
return null;
|
|
5856
|
-
}
|
|
5857
|
-
const shapeCorners = shape ? import_geometry4.Rectangle.from(shape.current.boundingRectangle).corners : void 0;
|
|
5858
|
-
const distance = import_geometry4.Rectangle.from(
|
|
5859
|
-
droppable.shape.boundingRectangle
|
|
5860
|
-
).corners.reduce(
|
|
5861
|
-
(acc, corner, index) => {
|
|
5862
|
-
var _a;
|
|
5863
|
-
return acc + import_geometry4.Point.distance(
|
|
5864
|
-
import_geometry4.Point.from(corner),
|
|
5865
|
-
(_a = shapeCorners == null ? void 0 : shapeCorners[index]) != null ? _a : position.current
|
|
5866
|
-
);
|
|
5867
|
-
},
|
|
5868
|
-
0
|
|
5869
|
-
);
|
|
5870
|
-
const value = distance / 4;
|
|
5871
|
-
return {
|
|
5872
|
-
id: droppable.id,
|
|
5873
|
-
value: 1 / value,
|
|
5874
|
-
type: import_abstract4.CollisionType.Collision,
|
|
5875
|
-
priority: import_abstract4.CollisionPriority.Normal
|
|
5876
|
-
};
|
|
5877
|
-
};
|
|
5817
|
+
// lib/dnd/collision/dynamic/index.ts
|
|
5818
|
+
var import_collision = require("@dnd-kit/collision");
|
|
5878
5819
|
|
|
5879
5820
|
// lib/dnd/collision/dynamic/store.ts
|
|
5880
5821
|
init_react_import();
|
|
@@ -5912,7 +5853,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5912
5853
|
collisionDebug(dragCenter, dropCenter, droppable.id.toString(), "yellow");
|
|
5913
5854
|
if (collision) {
|
|
5914
5855
|
return __spreadProps(__spreadValues({}, collision), {
|
|
5915
|
-
priority:
|
|
5856
|
+
priority: import_abstract2.CollisionPriority.Highest,
|
|
5916
5857
|
data
|
|
5917
5858
|
});
|
|
5918
5859
|
}
|
|
@@ -5930,8 +5871,8 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5930
5871
|
const collision = {
|
|
5931
5872
|
id: droppable.id,
|
|
5932
5873
|
value: intersectionRatio,
|
|
5933
|
-
priority:
|
|
5934
|
-
type:
|
|
5874
|
+
priority: import_abstract2.CollisionPriority.High,
|
|
5875
|
+
type: import_abstract2.CollisionType.Collision
|
|
5935
5876
|
};
|
|
5936
5877
|
const shouldFlushId = flushNext === droppable.id;
|
|
5937
5878
|
flushNext = "";
|
|
@@ -5941,7 +5882,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5941
5882
|
const xAxisIntersection = dropShape.boundingRectangle.right > dragShape.boundingRectangle.left && dropShape.boundingRectangle.left < dragShape.boundingRectangle.right;
|
|
5942
5883
|
const yAxisIntersection = dropShape.boundingRectangle.bottom > dragShape.boundingRectangle.top && dropShape.boundingRectangle.top < dragShape.boundingRectangle.bottom;
|
|
5943
5884
|
if (dragAxis === "y" && xAxisIntersection || yAxisIntersection) {
|
|
5944
|
-
const fallbackCollision = closestCorners(input);
|
|
5885
|
+
const fallbackCollision = (0, import_collision.closestCorners)(input);
|
|
5945
5886
|
if (fallbackCollision) {
|
|
5946
5887
|
const direction = getDirection(dragAxis, {
|
|
5947
5888
|
x: dragShape.center.x - (((_d = droppable.shape) == null ? void 0 : _d.center.x) || 0),
|
|
@@ -5958,7 +5899,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5958
5899
|
);
|
|
5959
5900
|
flushNext = droppable.id;
|
|
5960
5901
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
5961
|
-
priority:
|
|
5902
|
+
priority: import_abstract2.CollisionPriority.Low,
|
|
5962
5903
|
data
|
|
5963
5904
|
});
|
|
5964
5905
|
}
|
|
@@ -5970,7 +5911,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5970
5911
|
direction || ""
|
|
5971
5912
|
);
|
|
5972
5913
|
return __spreadProps(__spreadValues({}, fallbackCollision), {
|
|
5973
|
-
priority:
|
|
5914
|
+
priority: import_abstract2.CollisionPriority.Lowest,
|
|
5974
5915
|
data
|
|
5975
5916
|
});
|
|
5976
5917
|
}
|
|
@@ -5982,6 +5923,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => ((inpu
|
|
|
5982
5923
|
|
|
5983
5924
|
// components/Sortable/index.tsx
|
|
5984
5925
|
var import_sortable = require("@dnd-kit/react/sortable");
|
|
5926
|
+
var import_dom2 = require("@dnd-kit/dom");
|
|
5985
5927
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5986
5928
|
var SortableProvider = ({
|
|
5987
5929
|
children,
|
|
@@ -5990,7 +5932,7 @@ var SortableProvider = ({
|
|
|
5990
5932
|
onMove
|
|
5991
5933
|
}) => {
|
|
5992
5934
|
const sensors = useSensors({
|
|
5993
|
-
mouse:
|
|
5935
|
+
mouse: [new import_dom2.PointerActivationConstraints.Distance({ value: 5 })]
|
|
5994
5936
|
});
|
|
5995
5937
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5996
5938
|
import_react14.DragDropProvider,
|
|
@@ -7873,7 +7815,7 @@ init_react_import();
|
|
|
7873
7815
|
var import_react69 = require("@dnd-kit/react");
|
|
7874
7816
|
init_store();
|
|
7875
7817
|
var import_react70 = require("react");
|
|
7876
|
-
var
|
|
7818
|
+
var import_dom4 = require("@dnd-kit/dom");
|
|
7877
7819
|
|
|
7878
7820
|
// components/DropZone/index.tsx
|
|
7879
7821
|
init_react_import();
|
|
@@ -7971,6 +7913,7 @@ var DropZoneProvider = ({
|
|
|
7971
7913
|
var import_shallow4 = require("zustand/react/shallow");
|
|
7972
7914
|
init_get_item();
|
|
7973
7915
|
var import_sortable2 = require("@dnd-kit/react/sortable");
|
|
7916
|
+
var import_dom3 = require("@dnd-kit/dom");
|
|
7974
7917
|
|
|
7975
7918
|
// lib/dnd/use-on-drag-finished.ts
|
|
7976
7919
|
init_react_import();
|
|
@@ -8120,6 +8063,13 @@ var DraggableComponent = ({
|
|
|
8120
8063
|
() => createDynamicCollisionDetector(dragAxis),
|
|
8121
8064
|
[dragAxis]
|
|
8122
8065
|
);
|
|
8066
|
+
const sortablePlugins = (0, import_react51.useMemo)(
|
|
8067
|
+
() => (defaults) => [
|
|
8068
|
+
...defaults,
|
|
8069
|
+
import_dom3.Feedback.configure({ feedback: "clone" })
|
|
8070
|
+
],
|
|
8071
|
+
[]
|
|
8072
|
+
);
|
|
8123
8073
|
const {
|
|
8124
8074
|
ref: sortableRef,
|
|
8125
8075
|
isDragging: thisIsDragging,
|
|
@@ -8145,8 +8095,7 @@ var DraggableComponent = ({
|
|
|
8145
8095
|
transition: {
|
|
8146
8096
|
duration: 200,
|
|
8147
8097
|
easing: "cubic-bezier(0.2, 0, 0, 1)"
|
|
8148
|
-
}
|
|
8149
|
-
feedback: "clone"
|
|
8098
|
+
}
|
|
8150
8099
|
});
|
|
8151
8100
|
(0, import_react51.useEffect)(() => {
|
|
8152
8101
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
@@ -8632,6 +8581,7 @@ var styles_module_default18 = { "DropZone": "_DropZone_q9qsx_1", "DropZone--hasC
|
|
|
8632
8581
|
// components/DropZone/index.tsx
|
|
8633
8582
|
init_store();
|
|
8634
8583
|
var import_react68 = require("@dnd-kit/react");
|
|
8584
|
+
var import_collision2 = require("@dnd-kit/collision");
|
|
8635
8585
|
|
|
8636
8586
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8637
8587
|
init_react_import();
|
|
@@ -10126,7 +10076,7 @@ var DropZoneEdit = (0, import_react67.forwardRef)(
|
|
|
10126
10076
|
id: zoneCompound,
|
|
10127
10077
|
collisionPriority: isEnabled ? depth : 0,
|
|
10128
10078
|
disabled: !isDropEnabled,
|
|
10129
|
-
collisionDetector: pointerIntersection,
|
|
10079
|
+
collisionDetector: import_collision2.pointerIntersection,
|
|
10130
10080
|
type: "dropzone",
|
|
10131
10081
|
data: {
|
|
10132
10082
|
areaId,
|
|
@@ -10290,7 +10240,8 @@ init_get_item();
|
|
|
10290
10240
|
|
|
10291
10241
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
10292
10242
|
init_react_import();
|
|
10293
|
-
var
|
|
10243
|
+
var import_abstract3 = require("@dnd-kit/abstract");
|
|
10244
|
+
var import_utilities2 = require("@dnd-kit/dom/utilities");
|
|
10294
10245
|
|
|
10295
10246
|
// lib/throttle.ts
|
|
10296
10247
|
init_react_import();
|
|
@@ -10360,25 +10311,6 @@ var GlobalPosition = class {
|
|
|
10360
10311
|
}
|
|
10361
10312
|
};
|
|
10362
10313
|
|
|
10363
|
-
// lib/bubble-pointer-event.ts
|
|
10364
|
-
init_react_import();
|
|
10365
|
-
var BaseEvent = typeof PointerEvent !== "undefined" ? PointerEvent : Event;
|
|
10366
|
-
var BubbledPointerEvent = class extends BaseEvent {
|
|
10367
|
-
constructor(type, data) {
|
|
10368
|
-
super(type, data);
|
|
10369
|
-
this._originalTarget = null;
|
|
10370
|
-
this.originalTarget = data.originalTarget;
|
|
10371
|
-
}
|
|
10372
|
-
// Necessary for Firefox
|
|
10373
|
-
set originalTarget(target) {
|
|
10374
|
-
this._originalTarget = target;
|
|
10375
|
-
}
|
|
10376
|
-
// Necessary for Firefox
|
|
10377
|
-
get originalTarget() {
|
|
10378
|
-
return this._originalTarget;
|
|
10379
|
-
}
|
|
10380
|
-
};
|
|
10381
|
-
|
|
10382
10314
|
// lib/dnd/NestedDroppablePlugin.ts
|
|
10383
10315
|
init_root_droppable_id();
|
|
10384
10316
|
var depthSort = (candidates) => {
|
|
@@ -10514,7 +10446,7 @@ var findDeepestCandidate = (position, manager) => {
|
|
|
10514
10446
|
area: rootAreaId
|
|
10515
10447
|
};
|
|
10516
10448
|
};
|
|
10517
|
-
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends
|
|
10449
|
+
var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlugin extends import_abstract3.Plugin {
|
|
10518
10450
|
constructor(manager, options) {
|
|
10519
10451
|
super(manager);
|
|
10520
10452
|
if (typeof window === "undefined") {
|
|
@@ -10522,7 +10454,7 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
10522
10454
|
}
|
|
10523
10455
|
this.registerEffect(() => {
|
|
10524
10456
|
const handleMove = (event) => {
|
|
10525
|
-
const target = event
|
|
10457
|
+
const target = event.target;
|
|
10526
10458
|
const position = new GlobalPosition(target, {
|
|
10527
10459
|
x: event.clientX,
|
|
10528
10460
|
y: event.clientY
|
|
@@ -10540,15 +10472,55 @@ var createNestedDroppablePlugin = ({ onChange }, id) => class NestedDroppablePlu
|
|
|
10540
10472
|
const handlePointerMove = (event) => {
|
|
10541
10473
|
handleMoveThrottled(event);
|
|
10542
10474
|
};
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
document.body.removeEventListener("pointermove", handlePointerMove, {
|
|
10475
|
+
const bound = /* @__PURE__ */ new Set();
|
|
10476
|
+
const bind = (doc) => {
|
|
10477
|
+
if (bound.has(doc)) return;
|
|
10478
|
+
bound.add(doc);
|
|
10479
|
+
doc.addEventListener("pointermove", handlePointerMove, {
|
|
10549
10480
|
capture: true
|
|
10481
|
+
// dndkit's PointerSensor prevents propagation during drag
|
|
10550
10482
|
});
|
|
10551
10483
|
};
|
|
10484
|
+
const bindAll = () => {
|
|
10485
|
+
for (const doc of (0, import_utilities2.getDocuments)()) bind(doc);
|
|
10486
|
+
};
|
|
10487
|
+
bindAll();
|
|
10488
|
+
const onIframeLoad = () => bindAll();
|
|
10489
|
+
const observed = /* @__PURE__ */ new Set();
|
|
10490
|
+
const observeFrame = (el) => {
|
|
10491
|
+
if (observed.has(el)) return;
|
|
10492
|
+
observed.add(el);
|
|
10493
|
+
el.addEventListener("load", onIframeLoad);
|
|
10494
|
+
};
|
|
10495
|
+
for (const el of Array.from(
|
|
10496
|
+
document.querySelectorAll(
|
|
10497
|
+
"iframe, frame"
|
|
10498
|
+
)
|
|
10499
|
+
)) {
|
|
10500
|
+
observeFrame(el);
|
|
10501
|
+
}
|
|
10502
|
+
const observer = new MutationObserver((mutations) => {
|
|
10503
|
+
for (const m of mutations) {
|
|
10504
|
+
for (const node of Array.from(m.addedNodes)) {
|
|
10505
|
+
if (node instanceof HTMLIFrameElement || typeof HTMLFrameElement !== "undefined" && node instanceof HTMLFrameElement) {
|
|
10506
|
+
observeFrame(node);
|
|
10507
|
+
}
|
|
10508
|
+
}
|
|
10509
|
+
}
|
|
10510
|
+
bindAll();
|
|
10511
|
+
});
|
|
10512
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
10513
|
+
const cleanup = () => {
|
|
10514
|
+
observer.disconnect();
|
|
10515
|
+
for (const el of observed) {
|
|
10516
|
+
el.removeEventListener("load", onIframeLoad);
|
|
10517
|
+
}
|
|
10518
|
+
for (const doc of bound) {
|
|
10519
|
+
doc.removeEventListener("pointermove", handlePointerMove, {
|
|
10520
|
+
capture: true
|
|
10521
|
+
});
|
|
10522
|
+
}
|
|
10523
|
+
};
|
|
10552
10524
|
return cleanup;
|
|
10553
10525
|
});
|
|
10554
10526
|
}
|
|
@@ -10784,9 +10756,9 @@ var DragDropContextClient = ({
|
|
|
10784
10756
|
}
|
|
10785
10757
|
}, []);
|
|
10786
10758
|
const [plugins] = (0, import_react70.useState)(() => [
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
...disableAutoScroll ?
|
|
10759
|
+
import_dom4.ScrollListener,
|
|
10760
|
+
import_dom4.Scroller,
|
|
10761
|
+
...disableAutoScroll ? import_dom4.defaultPreset.plugins.filter((plugin) => plugin !== import_dom4.AutoScroller) : import_dom4.defaultPreset.plugins,
|
|
10790
10762
|
createNestedDroppablePlugin(
|
|
10791
10763
|
{
|
|
10792
10764
|
onChange: (params, manager) => {
|
|
@@ -11911,44 +11883,6 @@ var styles_module_default22 = { "EditorPreview": "_EditorPreview_xou64_1", "Edit
|
|
|
11911
11883
|
init_lib();
|
|
11912
11884
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11913
11885
|
var getClassName30 = get_class_name_factory_default("EditorPreview", styles_module_default22);
|
|
11914
|
-
var useBubbleIframeEvents = (ref) => {
|
|
11915
|
-
const status = useAppStore((s) => s.status);
|
|
11916
|
-
(0, import_react77.useEffect)(() => {
|
|
11917
|
-
if (ref.current && status === "READY") {
|
|
11918
|
-
const iframe = ref.current;
|
|
11919
|
-
const handlePointerMove = (event) => {
|
|
11920
|
-
const evt = new BubbledPointerEvent("pointermove", __spreadProps(__spreadValues({}, event), {
|
|
11921
|
-
bubbles: true,
|
|
11922
|
-
cancelable: false,
|
|
11923
|
-
clientX: event.clientX,
|
|
11924
|
-
clientY: event.clientY,
|
|
11925
|
-
originalTarget: event.target
|
|
11926
|
-
}));
|
|
11927
|
-
iframe.dispatchEvent(evt);
|
|
11928
|
-
};
|
|
11929
|
-
const register = () => {
|
|
11930
|
-
var _a;
|
|
11931
|
-
unregister();
|
|
11932
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.addEventListener(
|
|
11933
|
-
"pointermove",
|
|
11934
|
-
handlePointerMove,
|
|
11935
|
-
{ capture: true }
|
|
11936
|
-
);
|
|
11937
|
-
};
|
|
11938
|
-
const unregister = () => {
|
|
11939
|
-
var _a;
|
|
11940
|
-
(_a = iframe.contentDocument) == null ? void 0 : _a.removeEventListener(
|
|
11941
|
-
"pointermove",
|
|
11942
|
-
handlePointerMove
|
|
11943
|
-
);
|
|
11944
|
-
};
|
|
11945
|
-
register();
|
|
11946
|
-
return () => {
|
|
11947
|
-
unregister();
|
|
11948
|
-
};
|
|
11949
|
-
}
|
|
11950
|
-
}, [status]);
|
|
11951
|
-
};
|
|
11952
11886
|
var Preview2 = ({ id = "editor-preview" }) => {
|
|
11953
11887
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
11954
11888
|
const root = useAppStore((s) => s.state.data.root);
|
|
@@ -11981,7 +11915,6 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
11981
11915
|
const Frame = (0, import_react77.useMemo)(() => overrides.iframe, [overrides]);
|
|
11982
11916
|
const rootProps = root.props || root;
|
|
11983
11917
|
const ref = (0, import_react77.useRef)(null);
|
|
11984
|
-
useBubbleIframeEvents(ref);
|
|
11985
11918
|
const inner = !renderData ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11986
11919
|
Page,
|
|
11987
11920
|
__spreadProps(__spreadValues({}, rootProps), {
|
package/dist/no-external.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reacteditor/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "The open-source visual editor for React",
|
|
5
5
|
"author": "Rami Bitar <rami@frontend.co>",
|
|
6
6
|
"repository": "frontend-inc/react-editor",
|
|
@@ -98,8 +98,13 @@
|
|
|
98
98
|
"typescript": "^5.5.4"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@dnd-kit/
|
|
102
|
-
"@dnd-kit/
|
|
101
|
+
"@dnd-kit/abstract": "0.4.0",
|
|
102
|
+
"@dnd-kit/collision": "0.4.0",
|
|
103
|
+
"@dnd-kit/dom": "0.4.0",
|
|
104
|
+
"@dnd-kit/geometry": "0.4.0",
|
|
105
|
+
"@dnd-kit/helpers": "0.4.0",
|
|
106
|
+
"@dnd-kit/react": "0.4.0",
|
|
107
|
+
"@dnd-kit/state": "0.4.0",
|
|
103
108
|
"@radix-ui/react-popover": "^1.1.15",
|
|
104
109
|
"@radix-ui/react-select": "^2.2.6",
|
|
105
110
|
"@tanstack/react-virtual": "^3.13.9",
|