@contember/react-repeater-dnd-kit 2.0.0-alpha.4 → 2.0.0-alpha.40
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/api-extractor.json +3 -0
- package/dist/development/index.cjs +11 -12
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +7 -7
- package/dist/development/{components → src/components}/RepeaterSortable.cjs +21 -16
- package/dist/development/src/components/RepeaterSortable.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortable.js +18 -13
- package/dist/development/src/components/RepeaterSortable.js.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableDragOverlay.cjs +10 -10
- package/dist/development/src/components/RepeaterSortableDragOverlay.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableDragOverlay.js +10 -10
- package/dist/development/src/components/RepeaterSortableDragOverlay.js.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableDropIndicator.cjs +2 -2
- package/dist/development/src/components/RepeaterSortableDropIndicator.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableDropIndicator.js +2 -2
- package/dist/development/src/components/RepeaterSortableDropIndicator.js.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableEachItem.cjs +8 -8
- package/dist/development/src/components/RepeaterSortableEachItem.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableEachItem.js +8 -8
- package/dist/development/src/components/RepeaterSortableEachItem.js.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableItemActivator.cjs +4 -4
- package/dist/development/src/components/RepeaterSortableItemActivator.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableItemActivator.js +2 -2
- package/dist/development/src/components/RepeaterSortableItemActivator.js.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableItemNode.cjs +2 -2
- package/dist/development/src/components/RepeaterSortableItemNode.cjs.map +1 -0
- package/dist/development/{components → src/components}/RepeaterSortableItemNode.js +2 -2
- package/dist/development/src/components/RepeaterSortableItemNode.js.map +1 -0
- package/dist/development/src/contexts.cjs.map +1 -0
- package/dist/development/src/contexts.js.map +1 -0
- package/dist/production/index.cjs +11 -12
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +7 -7
- package/dist/production/{components → src/components}/RepeaterSortable.cjs +15 -10
- package/dist/production/src/components/RepeaterSortable.cjs.map +1 -0
- package/dist/production/{components → src/components}/RepeaterSortable.js +12 -7
- package/dist/production/src/components/RepeaterSortable.js.map +1 -0
- package/dist/production/src/components/RepeaterSortableDragOverlay.cjs.map +1 -0
- package/dist/production/src/components/RepeaterSortableDragOverlay.js.map +1 -0
- package/dist/production/src/components/RepeaterSortableDropIndicator.cjs.map +1 -0
- package/dist/production/src/components/RepeaterSortableDropIndicator.js.map +1 -0
- package/dist/production/src/components/RepeaterSortableEachItem.cjs.map +1 -0
- package/dist/production/src/components/RepeaterSortableEachItem.js.map +1 -0
- package/dist/production/{components → src/components}/RepeaterSortableItemActivator.cjs +2 -2
- package/dist/production/src/components/RepeaterSortableItemActivator.cjs.map +1 -0
- package/dist/production/src/components/RepeaterSortableItemActivator.js.map +1 -0
- package/dist/production/src/components/RepeaterSortableItemNode.cjs.map +1 -0
- package/dist/production/src/components/RepeaterSortableItemNode.js.map +1 -0
- package/dist/production/src/contexts.cjs.map +1 -0
- package/dist/production/src/contexts.js.map +1 -0
- package/dist/types/components/RepeaterSortable.d.ts +34 -2
- package/dist/types/components/RepeaterSortable.d.ts.map +1 -1
- package/dist/types/components/RepeaterSortableDragOverlay.d.ts +3 -0
- package/dist/types/components/RepeaterSortableDragOverlay.d.ts.map +1 -1
- package/dist/types/components/RepeaterSortableDropIndicator.d.ts +4 -1
- package/dist/types/components/RepeaterSortableDropIndicator.d.ts.map +1 -1
- package/dist/types/components/RepeaterSortableEachItem.d.ts +4 -0
- package/dist/types/components/RepeaterSortableEachItem.d.ts.map +1 -1
- package/dist/types/components/RepeaterSortableItemActivator.d.ts +5 -2
- package/dist/types/components/RepeaterSortableItemActivator.d.ts.map +1 -1
- package/dist/types/components/RepeaterSortableItemNode.d.ts +5 -2
- package/dist/types/components/RepeaterSortableItemNode.d.ts.map +1 -1
- package/dist/types/contexts.d.ts +6 -1
- package/dist/types/contexts.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -18
- package/src/components/RepeaterSortable.tsx +47 -22
- package/src/components/RepeaterSortableDragOverlay.tsx +3 -0
- package/src/components/RepeaterSortableDropIndicator.tsx +3 -0
- package/src/components/RepeaterSortableEachItem.tsx +4 -0
- package/src/components/RepeaterSortableItemActivator.tsx +5 -2
- package/src/components/RepeaterSortableItemNode.tsx +5 -2
- package/src/contexts.ts +6 -0
- package/tsconfig.json +7 -0
- package/tsdoc.json +6 -0
- package/dist/development/components/RepeaterSortable.cjs.map +0 -1
- package/dist/development/components/RepeaterSortable.js.map +0 -1
- package/dist/development/components/RepeaterSortableDragOverlay.cjs.map +0 -1
- package/dist/development/components/RepeaterSortableDragOverlay.js.map +0 -1
- package/dist/development/components/RepeaterSortableDropIndicator.cjs.map +0 -1
- package/dist/development/components/RepeaterSortableDropIndicator.js.map +0 -1
- package/dist/development/components/RepeaterSortableEachItem.cjs.map +0 -1
- package/dist/development/components/RepeaterSortableEachItem.js.map +0 -1
- package/dist/development/components/RepeaterSortableItemActivator.cjs.map +0 -1
- package/dist/development/components/RepeaterSortableItemActivator.js.map +0 -1
- package/dist/development/components/RepeaterSortableItemNode.cjs.map +0 -1
- package/dist/development/components/RepeaterSortableItemNode.js.map +0 -1
- package/dist/development/contexts.cjs.map +0 -1
- package/dist/development/contexts.js.map +0 -1
- package/dist/production/components/RepeaterSortable.cjs.map +0 -1
- package/dist/production/components/RepeaterSortable.js.map +0 -1
- package/dist/production/components/RepeaterSortableDragOverlay.cjs.map +0 -1
- package/dist/production/components/RepeaterSortableDragOverlay.js.map +0 -1
- package/dist/production/components/RepeaterSortableDropIndicator.cjs.map +0 -1
- package/dist/production/components/RepeaterSortableDropIndicator.js.map +0 -1
- package/dist/production/components/RepeaterSortableEachItem.cjs.map +0 -1
- package/dist/production/components/RepeaterSortableEachItem.js.map +0 -1
- package/dist/production/components/RepeaterSortableItemActivator.cjs.map +0 -1
- package/dist/production/components/RepeaterSortableItemActivator.js.map +0 -1
- package/dist/production/components/RepeaterSortableItemNode.cjs.map +0 -1
- package/dist/production/components/RepeaterSortableItemNode.js.map +0 -1
- package/dist/production/contexts.cjs.map +0 -1
- package/dist/production/contexts.js.map +0 -1
- /package/dist/development/{contexts.cjs → src/contexts.cjs} +0 -0
- /package/dist/development/{contexts.js → src/contexts.js} +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableDragOverlay.cjs +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableDragOverlay.js +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableDropIndicator.cjs +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableDropIndicator.js +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableEachItem.cjs +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableEachItem.js +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableItemActivator.js +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableItemNode.cjs +0 -0
- /package/dist/production/{components → src/components}/RepeaterSortableItemNode.js +0 -0
- /package/dist/production/{contexts.cjs → src/contexts.cjs} +0 -0
- /package/dist/production/{contexts.js → src/contexts.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const contexts = require("./contexts.cjs");
|
|
3
|
+
const contexts = require("./src/contexts.cjs");
|
|
4
4
|
const reactRepeater = require("@contember/react-repeater");
|
|
5
|
-
const RepeaterSortable = require("./components/RepeaterSortable.cjs");
|
|
6
|
-
const RepeaterSortableDragOverlay = require("./components/RepeaterSortableDragOverlay.cjs");
|
|
7
|
-
const RepeaterSortableDropIndicator = require("./components/RepeaterSortableDropIndicator.cjs");
|
|
8
|
-
const RepeaterSortableItemActivator = require("./components/RepeaterSortableItemActivator.cjs");
|
|
9
|
-
const RepeaterSortableItemNode = require("./components/RepeaterSortableItemNode.cjs");
|
|
10
|
-
const RepeaterSortableEachItem = require("./components/RepeaterSortableEachItem.cjs");
|
|
5
|
+
const RepeaterSortable = require("./src/components/RepeaterSortable.cjs");
|
|
6
|
+
const RepeaterSortableDragOverlay = require("./src/components/RepeaterSortableDragOverlay.cjs");
|
|
7
|
+
const RepeaterSortableDropIndicator = require("./src/components/RepeaterSortableDropIndicator.cjs");
|
|
8
|
+
const RepeaterSortableItemActivator = require("./src/components/RepeaterSortableItemActivator.cjs");
|
|
9
|
+
const RepeaterSortableItemNode = require("./src/components/RepeaterSortableItemNode.cjs");
|
|
10
|
+
const RepeaterSortableEachItem = require("./src/components/RepeaterSortableEachItem.cjs");
|
|
11
11
|
exports.RepeaterActiveEntityContext = contexts.RepeaterActiveEntityContext;
|
|
12
12
|
exports.RepeaterSortableItemContext = contexts.RepeaterSortableItemContext;
|
|
13
13
|
exports.useRepeaterActiveEntity = contexts.useRepeaterActiveEntity;
|
|
@@ -19,10 +19,9 @@ exports.RepeaterSortableItemActivator = RepeaterSortableItemActivator.RepeaterSo
|
|
|
19
19
|
exports.RepeaterSortableItemNode = RepeaterSortableItemNode.RepeaterSortableItemNode;
|
|
20
20
|
exports.RepeaterSortableEachItem = RepeaterSortableEachItem.RepeaterSortableEachItem;
|
|
21
21
|
Object.keys(reactRepeater).forEach((k) => {
|
|
22
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
22
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: () => reactRepeater[k]
|
|
25
|
+
});
|
|
27
26
|
});
|
|
28
27
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RepeaterActiveEntityContext, RepeaterSortableItemContext, useRepeaterActiveEntity, useRepeaterSortableItem } from "./contexts.js";
|
|
1
|
+
import { RepeaterActiveEntityContext, RepeaterSortableItemContext, useRepeaterActiveEntity, useRepeaterSortableItem } from "./src/contexts.js";
|
|
2
2
|
export * from "@contember/react-repeater";
|
|
3
|
-
import { RepeaterSortable } from "./components/RepeaterSortable.js";
|
|
4
|
-
import { RepeaterSortableDragOverlay } from "./components/RepeaterSortableDragOverlay.js";
|
|
5
|
-
import { RepeaterSortableDropIndicator } from "./components/RepeaterSortableDropIndicator.js";
|
|
6
|
-
import { RepeaterSortableItemActivator } from "./components/RepeaterSortableItemActivator.js";
|
|
7
|
-
import { RepeaterSortableItemNode } from "./components/RepeaterSortableItemNode.js";
|
|
8
|
-
import { RepeaterSortableEachItem } from "./components/RepeaterSortableEachItem.js";
|
|
3
|
+
import { RepeaterSortable } from "./src/components/RepeaterSortable.js";
|
|
4
|
+
import { RepeaterSortableDragOverlay } from "./src/components/RepeaterSortableDragOverlay.js";
|
|
5
|
+
import { RepeaterSortableDropIndicator } from "./src/components/RepeaterSortableDropIndicator.js";
|
|
6
|
+
import { RepeaterSortableItemActivator } from "./src/components/RepeaterSortableItemActivator.js";
|
|
7
|
+
import { RepeaterSortableItemNode } from "./src/components/RepeaterSortableItemNode.js";
|
|
8
|
+
import { RepeaterSortableEachItem } from "./src/components/RepeaterSortableEachItem.js";
|
|
9
9
|
export {
|
|
10
10
|
RepeaterActiveEntityContext,
|
|
11
11
|
RepeaterSortable,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const core = require("@dnd-kit/core");
|
|
6
6
|
const contexts = require("../contexts.cjs");
|
|
7
7
|
const sortable = require("@dnd-kit/sortable");
|
|
8
8
|
const reactRepeater = require("@contember/react-repeater");
|
|
9
|
-
const RepeaterSortable = ({ children }) => {
|
|
10
|
-
const [activeId, setActiveId] =
|
|
9
|
+
const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }) => {
|
|
10
|
+
const [activeId, setActiveId] = React.useState(null);
|
|
11
11
|
const { moveItem } = reactRepeater.useRepeaterMethods();
|
|
12
12
|
const entities = reactRepeater.useRepeaterSortedEntities();
|
|
13
|
-
const activeItem =
|
|
13
|
+
const activeItem = React.useMemo(() => {
|
|
14
14
|
if (!activeId) {
|
|
15
15
|
return void 0;
|
|
16
16
|
}
|
|
@@ -21,18 +21,21 @@ const RepeaterSortable = ({ children }) => {
|
|
|
21
21
|
core.useSensor(core.TouchSensor),
|
|
22
22
|
core.useSensor(core.KeyboardSensor)
|
|
23
23
|
);
|
|
24
|
-
const onDragCancel = () => {
|
|
24
|
+
const onDragCancel = (event) => {
|
|
25
|
+
onDragCancelIn?.(event);
|
|
25
26
|
setActiveId(null);
|
|
26
27
|
};
|
|
27
|
-
const onDragEnd =
|
|
28
|
+
const onDragEnd = React.useCallback((event) => {
|
|
29
|
+
onDragEndIn?.(event);
|
|
28
30
|
setActiveId(null);
|
|
31
|
+
const { active, over } = event;
|
|
29
32
|
const activeEntity = entities.find((it) => it.id === active.id);
|
|
30
33
|
const overIndex = over ? entities.findIndex((it) => it.id === over.id) : void 0;
|
|
31
34
|
if (!activeEntity || overIndex === void 0) {
|
|
32
35
|
return;
|
|
33
36
|
}
|
|
34
37
|
moveItem?.(activeEntity, overIndex);
|
|
35
|
-
}, [entities, moveItem]);
|
|
38
|
+
}, [entities, moveItem, onDragEndIn]);
|
|
36
39
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
40
|
core.DndContext,
|
|
38
41
|
{
|
|
@@ -42,12 +45,14 @@ const RepeaterSortable = ({ children }) => {
|
|
|
42
45
|
strategy: core.MeasuringStrategy.Always
|
|
43
46
|
}
|
|
44
47
|
},
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
collisionDetection: core.closestCenter,
|
|
49
|
+
...props,
|
|
50
|
+
onDragStart: (event) => {
|
|
51
|
+
onDragStart?.(event);
|
|
52
|
+
setActiveId(event.active.id);
|
|
47
53
|
},
|
|
48
54
|
onDragEnd,
|
|
49
55
|
onDragCancel,
|
|
50
|
-
collisionDetection: core.closestCenter,
|
|
51
56
|
children: /* @__PURE__ */ jsxRuntime.jsx(contexts.RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children }) })
|
|
52
57
|
}
|
|
53
58
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport type { DragStartEvent } from '@dnd-kit/core'\nimport { closestCenter, DndContext, DndContextProps, DragCancelEvent, DragEndEvent, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, UniqueIdentifier, useSensor, useSensors } from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterMethods, useRepeaterSortedEntities } from '@contember/react-repeater'\n\n/**\n * Initializes dnd-kit based sorting for the repeater.\n * Using the props, you can customize the behavior of the sorting and hook into the drag events.\n *\n * ## Example\n * ```tsx\n * <Repeater {...}>\n * <RepeaterSortable>\n * <RepeaterSortableEachItem>\n * <div>\n * <RepeaterSortableDropIndicator position={'before'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * <RepeaterSortableItemNode>\n * <div>\n * <RepeaterSortableItemActivator>\n * <span/>\n * </RepeaterSortableItemActivator>\n * {children}\n * </div>\n * </RepeaterSortableItemNode>\n * <RepeaterSortableDropIndicator position={'afer'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * </div>\n * </RepeaterSortableEachItem>\n * <RepeaterSortableDragOverlay>\n * <div>\n * {children}\n * </div>\n * </RepeaterSortableDragOverlay>\n * </RepeaterSortable>\n * </Repeater>\n * ```\n */\nexport const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }: {\n\tchildren: ReactNode\n} & DndContextProps) => {\n\tconst [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)\n\tconst { moveItem } = useRepeaterMethods()\n\tconst entities = useRepeaterSortedEntities()\n\n\n\tconst activeItem = useMemo(() => {\n\t\tif (!activeId) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn entities.find(it => it.id === activeId)\n\t}, [activeId, entities])\n\n\tconst sensors = useSensors(\n\t\tuseSensor(MouseSensor),\n\t\tuseSensor(TouchSensor),\n\t\tuseSensor(KeyboardSensor),\n\t)\n\n\tconst onDragCancel = (event: DragCancelEvent) => {\n\t\tonDragCancelIn?.(event)\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback((event: DragEndEvent) => {\n\t\tonDragEndIn?.(event)\n\t\tsetActiveId(null)\n\t\tconst { active, over } = event\n\t\tconst activeEntity = entities.find(it => it.id === active.id)\n\t\tconst overIndex = over ? entities.findIndex(it => it.id === over.id) : undefined\n\t\tif (!activeEntity || overIndex === undefined) {\n\t\t\treturn\n\t\t}\n\t\tmoveItem?.(activeEntity, overIndex)\n\t}, [entities, moveItem, onDragEndIn])\n\n\treturn (\n\t\t<DndContext\n\t\t\tsensors={sensors}\n\t\t\tmeasuring={{\n\t\t\t\tdroppable: {\n\t\t\t\t\tstrategy: MeasuringStrategy.Always,\n\t\t\t\t},\n\t\t\t}}\n\t\t\tcollisionDetection={closestCenter}\n\t\t\t{...props}\n\t\t\tonDragStart={(event: DragStartEvent) => {\n\t\t\t\tonDragStart?.(event)\n\t\t\t\tsetActiveId(event.active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t>\n\t\t\t<RepeaterActiveEntityContext.Provider value={activeItem}>\n\t\t\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t\t\t{children}\n\t\t\t\t</SortableContext>\n\t\t\t</RepeaterActiveEntityContext.Provider>\n\t\t</DndContext>\n\t)\n}\n"],"names":["useState","useRepeaterMethods","useRepeaterSortedEntities","useMemo","useSensors","useSensor","MouseSensor","TouchSensor","KeyboardSensor","useCallback","jsx","DndContext","MeasuringStrategy","closestCenter","RepeaterActiveEntityContext","SortableContext","verticalListSortingStrategy"],"mappings":";;;;;;;;AAsCa,MAAA,mBAAmB,CAAC,EAAE,UAAU,aAAa,WAAW,aAAa,cAAc,gBAAgB,GAAG,YAE3F;AACvB,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAkC,IAAI;AAChE,QAAA,EAAE,SAAS,IAAIC,iCAAmB;AACxC,QAAM,WAAWC,cAAAA,0BAA0B;AAGrC,QAAA,aAAaC,MAAAA,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IAAA;AAER,WAAO,SAAS,KAAK,CAAM,OAAA,GAAG,OAAO,QAAQ;AAAA,EAAA,GAC3C,CAAC,UAAU,QAAQ,CAAC;AAEvB,QAAM,UAAUC,KAAA;AAAA,IACfC,KAAAA,UAAUC,KAAAA,WAAW;AAAA,IACrBD,KAAAA,UAAUE,KAAAA,WAAW;AAAA,IACrBF,KAAAA,UAAUG,KAAc,cAAA;AAAA,EACzB;AAEM,QAAA,eAAe,CAAC,UAA2B;AAChD,qBAAiB,KAAK;AACtB,gBAAY,IAAI;AAAA,EACjB;AAEM,QAAA,YAAYC,kBAAY,CAAC,UAAwB;AACtD,kBAAc,KAAK;AACnB,gBAAY,IAAI;AACV,UAAA,EAAE,QAAQ,KAAA,IAAS;AACzB,UAAM,eAAe,SAAS,KAAK,QAAM,GAAG,OAAO,OAAO,EAAE;AACtD,UAAA,YAAY,OAAO,SAAS,UAAU,QAAM,GAAG,OAAO,KAAK,EAAE,IAAI;AACnE,QAAA,CAAC,gBAAgB,cAAc,QAAW;AAC7C;AAAA,IAAA;AAED,eAAW,cAAc,SAAS;AAAA,EAChC,GAAA,CAAC,UAAU,UAAU,WAAW,CAAC;AAGnC,SAAAC,2BAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAUC,KAAAA,kBAAkB;AAAA,QAAA;AAAA,MAE9B;AAAA,MACA,oBAAoBC,KAAA;AAAA,MACnB,GAAG;AAAA,MACJ,aAAa,CAAC,UAA0B;AACvC,sBAAc,KAAK;AACP,oBAAA,MAAM,OAAO,EAAE;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAACH,2BAAA,IAAAI,SAAA,4BAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAACJ,2BAAA,IAAAK,SAAA,iBAAA,EAAgB,OAAO,UAAU,UAAUC,SAAA,6BAC1C,UACF,EACD,CAAA;AAAA,IAAA;AAAA,EACD;AAEF;;"}
|
|
@@ -4,7 +4,7 @@ import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndCon
|
|
|
4
4
|
import { RepeaterActiveEntityContext } from "../contexts.js";
|
|
5
5
|
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
6
6
|
import { useRepeaterMethods, useRepeaterSortedEntities } from "@contember/react-repeater";
|
|
7
|
-
const RepeaterSortable = ({ children }) => {
|
|
7
|
+
const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }) => {
|
|
8
8
|
const [activeId, setActiveId] = useState(null);
|
|
9
9
|
const { moveItem } = useRepeaterMethods();
|
|
10
10
|
const entities = useRepeaterSortedEntities();
|
|
@@ -19,18 +19,21 @@ const RepeaterSortable = ({ children }) => {
|
|
|
19
19
|
useSensor(TouchSensor),
|
|
20
20
|
useSensor(KeyboardSensor)
|
|
21
21
|
);
|
|
22
|
-
const onDragCancel = () => {
|
|
22
|
+
const onDragCancel = (event) => {
|
|
23
|
+
onDragCancelIn?.(event);
|
|
23
24
|
setActiveId(null);
|
|
24
25
|
};
|
|
25
|
-
const onDragEnd = useCallback((
|
|
26
|
+
const onDragEnd = useCallback((event) => {
|
|
27
|
+
onDragEndIn?.(event);
|
|
26
28
|
setActiveId(null);
|
|
29
|
+
const { active, over } = event;
|
|
27
30
|
const activeEntity = entities.find((it) => it.id === active.id);
|
|
28
31
|
const overIndex = over ? entities.findIndex((it) => it.id === over.id) : void 0;
|
|
29
32
|
if (!activeEntity || overIndex === void 0) {
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
35
|
moveItem?.(activeEntity, overIndex);
|
|
33
|
-
}, [entities, moveItem]);
|
|
36
|
+
}, [entities, moveItem, onDragEndIn]);
|
|
34
37
|
return /* @__PURE__ */ jsx(
|
|
35
38
|
DndContext,
|
|
36
39
|
{
|
|
@@ -40,12 +43,14 @@ const RepeaterSortable = ({ children }) => {
|
|
|
40
43
|
strategy: MeasuringStrategy.Always
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
collisionDetection: closestCenter,
|
|
47
|
+
...props,
|
|
48
|
+
onDragStart: (event) => {
|
|
49
|
+
onDragStart?.(event);
|
|
50
|
+
setActiveId(event.active.id);
|
|
45
51
|
},
|
|
46
52
|
onDragEnd,
|
|
47
53
|
onDragCancel,
|
|
48
|
-
collisionDetection: closestCenter,
|
|
49
54
|
children: /* @__PURE__ */ jsx(RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsx(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children }) })
|
|
50
55
|
}
|
|
51
56
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport type { DragStartEvent } from '@dnd-kit/core'\nimport { closestCenter, DndContext, DndContextProps, DragCancelEvent, DragEndEvent, KeyboardSensor, MeasuringStrategy, MouseSensor, TouchSensor, UniqueIdentifier, useSensor, useSensors } from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterMethods, useRepeaterSortedEntities } from '@contember/react-repeater'\n\n/**\n * Initializes dnd-kit based sorting for the repeater.\n * Using the props, you can customize the behavior of the sorting and hook into the drag events.\n *\n * ## Example\n * ```tsx\n * <Repeater {...}>\n * <RepeaterSortable>\n * <RepeaterSortableEachItem>\n * <div>\n * <RepeaterSortableDropIndicator position={'before'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * <RepeaterSortableItemNode>\n * <div>\n * <RepeaterSortableItemActivator>\n * <span/>\n * </RepeaterSortableItemActivator>\n * {children}\n * </div>\n * </RepeaterSortableItemNode>\n * <RepeaterSortableDropIndicator position={'afer'}><div>Drop here</div></RepeaterSortableDropIndicator>\n * </div>\n * </RepeaterSortableEachItem>\n * <RepeaterSortableDragOverlay>\n * <div>\n * {children}\n * </div>\n * </RepeaterSortableDragOverlay>\n * </RepeaterSortable>\n * </Repeater>\n * ```\n */\nexport const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }: {\n\tchildren: ReactNode\n} & DndContextProps) => {\n\tconst [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)\n\tconst { moveItem } = useRepeaterMethods()\n\tconst entities = useRepeaterSortedEntities()\n\n\n\tconst activeItem = useMemo(() => {\n\t\tif (!activeId) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn entities.find(it => it.id === activeId)\n\t}, [activeId, entities])\n\n\tconst sensors = useSensors(\n\t\tuseSensor(MouseSensor),\n\t\tuseSensor(TouchSensor),\n\t\tuseSensor(KeyboardSensor),\n\t)\n\n\tconst onDragCancel = (event: DragCancelEvent) => {\n\t\tonDragCancelIn?.(event)\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback((event: DragEndEvent) => {\n\t\tonDragEndIn?.(event)\n\t\tsetActiveId(null)\n\t\tconst { active, over } = event\n\t\tconst activeEntity = entities.find(it => it.id === active.id)\n\t\tconst overIndex = over ? entities.findIndex(it => it.id === over.id) : undefined\n\t\tif (!activeEntity || overIndex === undefined) {\n\t\t\treturn\n\t\t}\n\t\tmoveItem?.(activeEntity, overIndex)\n\t}, [entities, moveItem, onDragEndIn])\n\n\treturn (\n\t\t<DndContext\n\t\t\tsensors={sensors}\n\t\t\tmeasuring={{\n\t\t\t\tdroppable: {\n\t\t\t\t\tstrategy: MeasuringStrategy.Always,\n\t\t\t\t},\n\t\t\t}}\n\t\t\tcollisionDetection={closestCenter}\n\t\t\t{...props}\n\t\t\tonDragStart={(event: DragStartEvent) => {\n\t\t\t\tonDragStart?.(event)\n\t\t\t\tsetActiveId(event.active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t>\n\t\t\t<RepeaterActiveEntityContext.Provider value={activeItem}>\n\t\t\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t\t\t{children}\n\t\t\t\t</SortableContext>\n\t\t\t</RepeaterActiveEntityContext.Provider>\n\t\t</DndContext>\n\t)\n}\n"],"names":[],"mappings":";;;;;;AAsCa,MAAA,mBAAmB,CAAC,EAAE,UAAU,aAAa,WAAW,aAAa,cAAc,gBAAgB,GAAG,YAE3F;AACvB,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkC,IAAI;AAChE,QAAA,EAAE,SAAS,IAAI,mBAAmB;AACxC,QAAM,WAAW,0BAA0B;AAGrC,QAAA,aAAa,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IAAA;AAER,WAAO,SAAS,KAAK,CAAM,OAAA,GAAG,OAAO,QAAQ;AAAA,EAAA,GAC3C,CAAC,UAAU,QAAQ,CAAC;AAEvB,QAAM,UAAU;AAAA,IACf,UAAU,WAAW;AAAA,IACrB,UAAU,WAAW;AAAA,IACrB,UAAU,cAAc;AAAA,EACzB;AAEM,QAAA,eAAe,CAAC,UAA2B;AAChD,qBAAiB,KAAK;AACtB,gBAAY,IAAI;AAAA,EACjB;AAEM,QAAA,YAAY,YAAY,CAAC,UAAwB;AACtD,kBAAc,KAAK;AACnB,gBAAY,IAAI;AACV,UAAA,EAAE,QAAQ,KAAA,IAAS;AACzB,UAAM,eAAe,SAAS,KAAK,QAAM,GAAG,OAAO,OAAO,EAAE;AACtD,UAAA,YAAY,OAAO,SAAS,UAAU,QAAM,GAAG,OAAO,KAAK,EAAE,IAAI;AACnE,QAAA,CAAC,gBAAgB,cAAc,QAAW;AAC7C;AAAA,IAAA;AAED,eAAW,cAAc,SAAS;AAAA,EAChC,GAAA,CAAC,UAAU,UAAU,WAAW,CAAC;AAGnC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAU,kBAAkB;AAAA,QAAA;AAAA,MAE9B;AAAA,MACA,oBAAoB;AAAA,MACnB,GAAG;AAAA,MACJ,aAAa,CAAC,UAA0B;AACvC,sBAAc,KAAK;AACP,oBAAA,MAAM,OAAO,EAAE;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAAC,oBAAA,4BAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAAC,oBAAA,iBAAA,EAAgB,OAAO,UAAU,UAAU,6BAC1C,UACF,EACD,CAAA;AAAA,IAAA;AAAA,EACD;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../contexts'\nimport { Portal } from '@radix-ui/react-portal'\nimport { DragOverlay } from '@dnd-kit/core'\nimport { AccessorTree, Entity, useAccessorTreeState } from '@contember/react-binding'\nimport { RepeaterCurrentEntityContext } from '@contember/react-repeater'\n\n/**\n * Component for rendering the repeater item being dragged.\n */\nexport const RepeaterSortableDragOverlay = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst activeItem = useRepeaterActiveEntity()\n\tconst accessorTreeState = useAccessorTreeState()\n\tif (!activeItem) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<Portal>\n\t\t\t<DragOverlay>\n\t\t\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t\t\t<Entity accessor={activeItem}>\n\t\t\t\t\t\t<RepeaterCurrentEntityContext.Provider value={activeItem}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</RepeaterCurrentEntityContext.Provider>\n\t\t\t\t\t</Entity>\n\t\t\t\t</AccessorTree>\n\t\t\t</DragOverlay>\n\t\t</Portal>\n\t)\n}\n"],"names":["useRepeaterActiveEntity","useAccessorTreeState","jsx","Portal","DragOverlay","AccessorTree","Entity","RepeaterCurrentEntityContext"],"mappings":";;;;;;;;AAUO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAaA,SAAAA,wBAAwB;AAC3C,QAAM,oBAAoBC,aAAAA,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAGP,SAAAC,2BAAA,IAACC,sBACA,UAACD,2BAAAA,IAAAE,KAAAA,aAAA,EACA,yCAACC,aAAa,cAAA,EAAA,OAAO,mBACpB,UAAAH,2BAAAA,IAACI,aAAAA,QAAO,EAAA,UAAU,YACjB,UAACJ,2BAAAA,IAAAK,cAAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SACF,CAAA,EAAA,CACD,EACD,CAAA,EAAA,CACD,EACD,CAAA;AAEF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../contexts'\nimport { Portal } from '@radix-ui/react-portal'\nimport { DragOverlay } from '@dnd-kit/core'\nimport { AccessorTree, Entity, useAccessorTreeState } from '@contember/react-binding'\nimport { RepeaterCurrentEntityContext } from '@contember/react-repeater'\n\n/**\n * Component for rendering the repeater item being dragged.\n */\nexport const RepeaterSortableDragOverlay = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst activeItem = useRepeaterActiveEntity()\n\tconst accessorTreeState = useAccessorTreeState()\n\tif (!activeItem) {\n\t\treturn null\n\t}\n\treturn (\n\t\t<Portal>\n\t\t\t<DragOverlay>\n\t\t\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t\t\t<Entity accessor={activeItem}>\n\t\t\t\t\t\t<RepeaterCurrentEntityContext.Provider value={activeItem}>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</RepeaterCurrentEntityContext.Provider>\n\t\t\t\t\t</Entity>\n\t\t\t\t</AccessorTree>\n\t\t\t</DragOverlay>\n\t\t</Portal>\n\t)\n}\n"],"names":[],"mappings":";;;;;;AAUO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAa,wBAAwB;AAC3C,QAAM,oBAAoB,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAGP,SAAA,oBAAC,UACA,UAAC,oBAAA,aAAA,EACA,8BAAC,cAAa,EAAA,OAAO,mBACpB,UAAA,oBAAC,QAAO,EAAA,UAAU,YACjB,UAAC,oBAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SACF,CAAA,EAAA,CACD,EACD,CAAA,EAAA,CACD,EACD,CAAA;AAEF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\n\n/**\n * Renders a child element when the repeater item is being dragged over the drop indicator.\n */\nexport const RepeaterSortableDropIndicator = ({ children, position }: {\n\tchildren: ReactNode\n\tposition: 'before' | 'after'\n}) => {\n\tconst sortable = useRepeaterSortableItem()\n\tconst isOver = sortable.isOver\n\tconst activeSortable = sortable.active?.data.current?.sortable\n\tconst isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index\n\tconst renderedPosition = isAfter ? 'after' : 'before'\n\n\treturn renderedPosition === position && isOver ? <>{children}</> : null\n}\n"],"names":["useRepeaterSortableItem","jsx","Fragment"],"mappings":";;;;AAMO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAWA,SAAAA,wBAAwB;AACzC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS,QAAQ,KAAK,SAAS;AACtD,QAAM,WAAW,SAAS,MAAM,SAAS,SAAS,KAAK,gBAAgB;AACjE,QAAA,mBAAmB,UAAU,UAAU;AAE7C,SAAO,qBAAqB,YAAY,SAASC,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,SAAS,CAAA,IAAM;AACpE;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\n\n/**\n * Renders a child element when the repeater item is being dragged over the drop indicator.\n */\nexport const RepeaterSortableDropIndicator = ({ children, position }: {\n\tchildren: ReactNode\n\tposition: 'before' | 'after'\n}) => {\n\tconst sortable = useRepeaterSortableItem()\n\tconst isOver = sortable.isOver\n\tconst activeSortable = sortable.active?.data.current?.sortable\n\tconst isAfter = (sortable.data?.sortable.index ?? 0) > activeSortable?.index\n\tconst renderedPosition = isAfter ? 'after' : 'before'\n\n\treturn renderedPosition === position && isOver ? <>{children}</> : null\n}\n"],"names":[],"mappings":";;AAMO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAW,wBAAwB;AACzC,QAAM,SAAS,SAAS;AACxB,QAAM,iBAAiB,SAAS,QAAQ,KAAK,SAAS;AACtD,QAAM,WAAW,SAAS,MAAM,SAAS,SAAS,KAAK,gBAAgB;AACjE,QAAA,mBAAmB,UAAU,UAAU;AAE7C,SAAO,qBAAqB,YAAY,SAAS,oBAAA,UAAA,EAAG,SAAS,CAAA,IAAM;AACpE;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableEachItem.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { RepeaterEachItem, useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { RepeaterSortableItemContext } from '../contexts'\nimport { useEntity } from '@contember/react-binding'\n\n/**\n * Iterates over all entities in the repeater and renders the children for each entity.\n * Also sets up the dnd-kit sortable context for the repeater items.\n */\nexport const RepeaterSortableEachItem = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entities = useRepeaterSortedEntities()\n\n\treturn (\n\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t<RepeaterEachItem>\n\t\t\t\t<RepeaterSortableEachItemInner>\n\t\t\t\t\t{children}\n\t\t\t\t</RepeaterSortableEachItemInner>\n\n\t\t\t</RepeaterEachItem>\n\t\t</SortableContext>\n\t)\n}\nconst RepeaterSortableEachItemInner = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entity = useEntity()\n\tconst sortable = useSortable({\n\t\tid: entity.id,\n\t})\n\treturn (\n\t\t<RepeaterSortableItemContext.Provider value={sortable}>\n\t\t\t{children}\n\t\t</RepeaterSortableItemContext.Provider>\n\t)\n}\n"],"names":["useRepeaterSortedEntities","jsx","SortableContext","verticalListSortingStrategy","RepeaterEachItem","useEntity","sortable","useSortable","RepeaterSortableItemContext"],"mappings":";;;;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAWA,cAAAA,0BAA0B;AAE3C,SACEC,2BAAAA,IAAAC,SAAAA,iBAAA,EAAgB,OAAO,UAAU,UAAUC,SAAA,6BAC3C,UAACF,2BAAAA,IAAAG,cAAAA,kBAAA,EACA,UAACH,+BAAA,+BAAA,EACC,SACF,CAAA,EAED,CAAA,GACD;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAASI,aAAAA,UAAU;AACzB,QAAMC,aAAWC,SAAAA,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,wCACEC,SAAAA,4BAA4B,UAA5B,EAAqC,OAAOF,YAC3C,UACF;AAEF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableEachItem.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { RepeaterEachItem, useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { RepeaterSortableItemContext } from '../contexts'\nimport { useEntity } from '@contember/react-binding'\n\n/**\n * Iterates over all entities in the repeater and renders the children for each entity.\n * Also sets up the dnd-kit sortable context for the repeater items.\n */\nexport const RepeaterSortableEachItem = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entities = useRepeaterSortedEntities()\n\n\treturn (\n\t\t<SortableContext items={entities} strategy={verticalListSortingStrategy}>\n\t\t\t<RepeaterEachItem>\n\t\t\t\t<RepeaterSortableEachItemInner>\n\t\t\t\t\t{children}\n\t\t\t\t</RepeaterSortableEachItemInner>\n\n\t\t\t</RepeaterEachItem>\n\t\t</SortableContext>\n\t)\n}\nconst RepeaterSortableEachItemInner = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst entity = useEntity()\n\tconst sortable = useSortable({\n\t\tid: entity.id,\n\t})\n\treturn (\n\t\t<RepeaterSortableItemContext.Provider value={sortable}>\n\t\t\t{children}\n\t\t</RepeaterSortableItemContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAW,0BAA0B;AAE3C,SACE,oBAAA,iBAAA,EAAgB,OAAO,UAAU,UAAU,6BAC3C,UAAC,oBAAA,kBAAA,EACA,UAAC,oBAAA,+BAAA,EACC,SACF,CAAA,EAED,CAAA,GACD;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAAS,UAAU;AACzB,QAAM,WAAW,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,6BACE,4BAA4B,UAA5B,EAAqC,OAAO,UAC3C,UACF;AAEF;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const contexts = require("../contexts.cjs");
|
|
6
6
|
const reactSlot = require("@radix-ui/react-slot");
|
|
7
7
|
const reactUtils = require("@contember/react-utils");
|
|
8
|
-
const RepeaterSortableItemActivator =
|
|
8
|
+
const RepeaterSortableItemActivator = React.forwardRef((props, ref) => {
|
|
9
9
|
const { setActivatorNodeRef, listeners } = contexts.useRepeaterSortableItem();
|
|
10
10
|
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref: reactUtils.useComposeRef(ref, setActivatorNodeRef), ...listeners, ...props });
|
|
11
11
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useComposeRef } from '@contember/react-utils'\n\n/**\n * Slot for the repeater item activator, which is the element that triggers the drag and drop interaction (e.g. a handle).\n */\nexport const RepeaterSortableItemActivator = forwardRef<HTMLElement, {\n\tchildren: ReactElement\n}>((props, ref) => {\n\tconst { setActivatorNodeRef, listeners } = useRepeaterSortableItem()\n\treturn <Slot ref={useComposeRef(ref, setActivatorNodeRef)} {...listeners} {...props} />\n})\n"],"names":["forwardRef","useRepeaterSortableItem","jsx","Slot","useComposeRef"],"mappings":";;;;;;;AAQO,MAAM,gCAAgCA,MAAA,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAIC,iCAAwB;AAC5D,SAAAC,+BAACC,UAAAA,MAAK,EAAA,KAAKC,WAAc,cAAA,KAAK,mBAAmB,GAAI,GAAG,WAAY,GAAG,MAAO,CAAA;AACtF,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemActivator.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useComposeRef } from '@contember/react-utils'\n\n/**\n * Slot for the repeater item activator, which is the element that triggers the drag and drop interaction (e.g. a handle).\n */\nexport const RepeaterSortableItemActivator = forwardRef<HTMLElement, {\n\tchildren: ReactElement\n}>((props, ref) => {\n\tconst { setActivatorNodeRef, listeners } = useRepeaterSortableItem()\n\treturn <Slot ref={useComposeRef(ref, setActivatorNodeRef)} {...listeners} {...props} />\n})\n"],"names":[],"mappings":";;;;;AAQO,MAAM,gCAAgC,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAI,wBAAwB;AAC5D,SAAA,oBAAC,MAAK,EAAA,KAAK,cAAc,KAAK,mBAAmB,GAAI,GAAG,WAAY,GAAG,MAAO,CAAA;AACtF,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemNode.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\n\n/**\n * Slot for the repeater item node, which is the element that is being dragged.\n */\nexport const RepeaterSortableItemNode = ({ children }: {\n\tchildren: ReactElement\n}) => {\n\tconst { setNodeRef } = useRepeaterSortableItem()\n\treturn <Slot ref={setNodeRef}>{children}</Slot>\n}\n"],"names":["useRepeaterSortableItem","jsx","Slot"],"mappings":";;;;;AAOO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAIA,iCAAwB;AAC/C,SAAQC,2BAAAA,IAAAC,UAAAA,MAAA,EAAK,KAAK,YAAa,SAAS,CAAA;AACzC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemNode.js","sources":["../../../../../packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\n\n/**\n * Slot for the repeater item node, which is the element that is being dragged.\n */\nexport const RepeaterSortableItemNode = ({ children }: {\n\tchildren: ReactElement\n}) => {\n\tconst { setNodeRef } = useRepeaterSortableItem()\n\treturn <Slot ref={setNodeRef}>{children}</Slot>\n}\n"],"names":[],"mappings":";;;AAOO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAI,wBAAwB;AAC/C,SAAQ,oBAAA,MAAA,EAAK,KAAK,YAAa,SAAS,CAAA;AACzC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-repeater-dnd-kit/src/contexts.ts"],"sourcesContent":["import { createRequiredContext, createContext } from '@contember/react-utils'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { useSortable } from '@dnd-kit/sortable'\n\nconst RepeaterSortableItemContext_ = createRequiredContext<ReturnType<typeof useSortable>>('RepeaterSortableItemContext')\n/** @internal */\nexport const RepeaterSortableItemContext = RepeaterSortableItemContext_[0]\n/**\n * Returns the sortable context from dnd-kit (e.g. isDragging, isOver, setNodeRef) for the repeater item.\n */\nexport const useRepeaterSortableItem = RepeaterSortableItemContext_[1]\n\nconst RepeaterActiveEntityContext_ = createContext<EntityAccessor | undefined>('RepeaterActiveEntityContext', undefined)\n/** @internal */\nexport const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0]\n/**\n * Returns the entity that is currently being dragged in the repeater.\n */\nexport const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1]\n"],"names":["createRequiredContext","createContext"],"mappings":";;;AAIA,MAAM,+BAA+BA,iCAAsD,6BAA6B;AAE3G,MAAA,8BAA8B,6BAA6B,CAAC;AAI5D,MAAA,0BAA0B,6BAA6B,CAAC;AAErE,MAAM,+BAA+BC,WAA0C,cAAA,+BAA+B,MAAS;AAE1G,MAAA,8BAA8B,6BAA6B,CAAC;AAI5D,MAAA,0BAA0B,6BAA6B,CAAC;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-repeater-dnd-kit/src/contexts.ts"],"sourcesContent":["import { createRequiredContext, createContext } from '@contember/react-utils'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { useSortable } from '@dnd-kit/sortable'\n\nconst RepeaterSortableItemContext_ = createRequiredContext<ReturnType<typeof useSortable>>('RepeaterSortableItemContext')\n/** @internal */\nexport const RepeaterSortableItemContext = RepeaterSortableItemContext_[0]\n/**\n * Returns the sortable context from dnd-kit (e.g. isDragging, isOver, setNodeRef) for the repeater item.\n */\nexport const useRepeaterSortableItem = RepeaterSortableItemContext_[1]\n\nconst RepeaterActiveEntityContext_ = createContext<EntityAccessor | undefined>('RepeaterActiveEntityContext', undefined)\n/** @internal */\nexport const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0]\n/**\n * Returns the entity that is currently being dragged in the repeater.\n */\nexport const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,+BAA+B,sBAAsD,6BAA6B;AAE3G,MAAA,8BAA8B,6BAA6B,CAAC;AAI5D,MAAA,0BAA0B,6BAA6B,CAAC;AAErE,MAAM,+BAA+B,cAA0C,+BAA+B,MAAS;AAE1G,MAAA,8BAA8B,6BAA6B,CAAC;AAI5D,MAAA,0BAA0B,6BAA6B,CAAC;"}
|
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import { DndContextProps } from '@dnd-kit/core';
|
|
3
|
+
/**
|
|
4
|
+
* Initializes dnd-kit based sorting for the repeater.
|
|
5
|
+
* Using the props, you can customize the behavior of the sorting and hook into the drag events.
|
|
6
|
+
*
|
|
7
|
+
* ## Example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Repeater {...}>
|
|
10
|
+
* <RepeaterSortable>
|
|
11
|
+
* <RepeaterSortableEachItem>
|
|
12
|
+
* <div>
|
|
13
|
+
* <RepeaterSortableDropIndicator position={'before'}><div>Drop here</div></RepeaterSortableDropIndicator>
|
|
14
|
+
* <RepeaterSortableItemNode>
|
|
15
|
+
* <div>
|
|
16
|
+
* <RepeaterSortableItemActivator>
|
|
17
|
+
* <span/>
|
|
18
|
+
* </RepeaterSortableItemActivator>
|
|
19
|
+
* {children}
|
|
20
|
+
* </div>
|
|
21
|
+
* </RepeaterSortableItemNode>
|
|
22
|
+
* <RepeaterSortableDropIndicator position={'afer'}><div>Drop here</div></RepeaterSortableDropIndicator>
|
|
23
|
+
* </div>
|
|
24
|
+
* </RepeaterSortableEachItem>
|
|
25
|
+
* <RepeaterSortableDragOverlay>
|
|
26
|
+
* <div>
|
|
27
|
+
* {children}
|
|
28
|
+
* </div>
|
|
29
|
+
* </RepeaterSortableDragOverlay>
|
|
30
|
+
* </RepeaterSortable>
|
|
31
|
+
* </Repeater>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const RepeaterSortable: ({ children, onDragStart, onDragEnd: onDragEndIn, onDragCancel: onDragCancelIn, ...props }: {
|
|
3
35
|
children: ReactNode;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
} & DndContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
37
|
//# sourceMappingURL=RepeaterSortable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;AAExE,OAAO,EAA6B,eAAe,EAAuI,MAAM,eAAe,CAAA;AAK/M;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,gBAAgB,8FAA+F;IAC3H,QAAQ,EAAE,SAAS,CAAA;CACnB,GAAG,eAAe,4CA4DlB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOxC,eAAO,MAAM,2BAA2B,iBAAkB;IACzD,QAAQ,EAAE,SAAS,CAAA;CACnB,mDAmBA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOxC;;GAEG;AACH,eAAO,MAAM,2BAA2B,iBAAkB;IACzD,QAAQ,EAAE,SAAS,CAAA;CACnB,mDAmBA,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a child element when the repeater item is being dragged over the drop indicator.
|
|
4
|
+
*/
|
|
2
5
|
export declare const RepeaterSortableDropIndicator: ({ children, position }: {
|
|
3
6
|
children: ReactNode;
|
|
4
|
-
position:
|
|
7
|
+
position: "before" | "after";
|
|
5
8
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
9
|
//# sourceMappingURL=RepeaterSortableDropIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxC,eAAO,MAAM,6BAA6B,2BAA4B;IACrE,QAAQ,EAAE,SAAS,CAAA;IACnB,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC5B,mDAQA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxC;;GAEG;AACH,eAAO,MAAM,6BAA6B,2BAA4B;IACrE,QAAQ,EAAE,SAAS,CAAA;IACnB,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC5B,mDAQA,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Iterates over all entities in the repeater and renders the children for each entity.
|
|
4
|
+
* Also sets up the dnd-kit sortable context for the repeater items.
|
|
5
|
+
*/
|
|
2
6
|
export declare const RepeaterSortableEachItem: ({ children }: {
|
|
3
7
|
children: ReactNode;
|
|
4
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableEachItem.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableEachItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMxC,eAAO,MAAM,wBAAwB,iBAAkB;IACtD,QAAQ,EAAE,SAAS,CAAA;CACnB,4CAaA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RepeaterSortableEachItem.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableEachItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMxC;;;GAGG;AACH,eAAO,MAAM,wBAAwB,iBAAkB;IACtD,QAAQ,EAAE,SAAS,CAAA;CACnB,4CAaA,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Slot for the repeater item activator, which is the element that triggers the drag and drop interaction (e.g. a handle).
|
|
4
|
+
*/
|
|
2
5
|
export declare const RepeaterSortableItemActivator: React.ForwardRefExoticComponent<{
|
|
3
|
-
children:
|
|
6
|
+
children: ReactElement;
|
|
4
7
|
} & React.RefAttributes<HTMLElement>>;
|
|
5
8
|
//# sourceMappingURL=RepeaterSortableItemActivator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemActivator.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemActivator.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,YAAY,EAAa,MAAM,OAAO,CAAA;AAKlE;;GAEG;AACH,eAAO,MAAM,6BAA6B;cAC/B,YAAY;qCAIrB,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Slot for the repeater item node, which is the element that is being dragged.
|
|
4
|
+
*/
|
|
2
5
|
export declare const RepeaterSortableItemNode: ({ children }: {
|
|
3
|
-
children:
|
|
6
|
+
children: ReactElement;
|
|
4
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
8
|
//# sourceMappingURL=RepeaterSortableItemNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemNode.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemNode.d.ts","sourceRoot":"","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAI3C;;GAEG;AACH,eAAO,MAAM,wBAAwB,iBAAkB;IACtD,QAAQ,EAAE,YAAY,CAAA;CACtB,4CAGA,CAAA"}
|
package/dist/types/contexts.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { EntityAccessor } from '@contember/react-binding';
|
|
3
2
|
/** @internal */
|
|
4
3
|
export declare const RepeaterSortableItemContext: import("react").Context<{
|
|
@@ -26,6 +25,9 @@ export declare const RepeaterSortableItemContext: import("react").Context<{
|
|
|
26
25
|
transform: import("@dnd-kit/utilities").Transform | null;
|
|
27
26
|
transition: string | undefined;
|
|
28
27
|
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the sortable context from dnd-kit (e.g. isDragging, isOver, setNodeRef) for the repeater item.
|
|
30
|
+
*/
|
|
29
31
|
export declare const useRepeaterSortableItem: () => {
|
|
30
32
|
active: import("@dnd-kit/core").Active | null;
|
|
31
33
|
activeIndex: number;
|
|
@@ -53,5 +55,8 @@ export declare const useRepeaterSortableItem: () => {
|
|
|
53
55
|
};
|
|
54
56
|
/** @internal */
|
|
55
57
|
export declare const RepeaterActiveEntityContext: import("react").Context<EntityAccessor | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the entity that is currently being dragged in the repeater.
|
|
60
|
+
*/
|
|
56
61
|
export declare const useRepeaterActiveEntity: () => EntityAccessor | undefined;
|
|
57
62
|
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAIzD,gBAAgB;AAChB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;EAAkC,CAAA;AAC1E;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;CAAkC,CAAA;AAGtE,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,qDAAkC,CAAA;AAC1E;;GAEG;AACH,eAAO,MAAM,uBAAuB,kCAAkC,CAAA"}
|