@contember/react-repeater-dnd-kit 1.3.0-alpha.26 → 2.0.0-alpha.1
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/development/components/RepeaterSortable.cjs +5 -4
- package/dist/development/components/RepeaterSortable.cjs.map +1 -1
- package/dist/development/components/RepeaterSortable.js +6 -5
- package/dist/development/components/RepeaterSortable.js.map +1 -1
- package/dist/development/components/RepeaterSortableDragOverlay.cjs +1 -1
- package/dist/development/components/RepeaterSortableDragOverlay.cjs.map +1 -1
- package/dist/development/components/RepeaterSortableDragOverlay.js +1 -1
- package/dist/development/components/RepeaterSortableDragOverlay.js.map +1 -1
- package/dist/development/components/RepeaterSortableDropIndicator.cjs +1 -1
- package/dist/development/components/RepeaterSortableDropIndicator.cjs.map +1 -1
- package/dist/development/components/RepeaterSortableDropIndicator.js +1 -1
- package/dist/development/components/RepeaterSortableDropIndicator.js.map +1 -1
- package/dist/development/components/RepeaterSortableEachItem.cjs +1 -1
- package/dist/development/components/RepeaterSortableEachItem.cjs.map +1 -1
- package/dist/development/components/RepeaterSortableEachItem.js +1 -1
- package/dist/development/components/RepeaterSortableEachItem.js.map +1 -1
- package/dist/development/components/RepeaterSortableItemActivator.cjs +1 -1
- package/dist/development/components/RepeaterSortableItemActivator.cjs.map +1 -1
- package/dist/development/components/RepeaterSortableItemActivator.js +1 -1
- package/dist/development/components/RepeaterSortableItemActivator.js.map +1 -1
- package/dist/development/components/RepeaterSortableItemNode.cjs +1 -1
- package/dist/development/components/RepeaterSortableItemNode.cjs.map +1 -1
- package/dist/development/components/RepeaterSortableItemNode.js +1 -1
- package/dist/development/components/RepeaterSortableItemNode.js.map +1 -1
- package/dist/development/contexts.cjs +14 -0
- package/dist/development/contexts.cjs.map +1 -0
- package/dist/development/contexts.js +14 -0
- package/dist/development/contexts.js.map +1 -0
- package/dist/development/index.cjs +5 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +6 -1
- package/dist/development/index.js.map +1 -1
- package/dist/production/components/RepeaterSortable.cjs +2 -1
- package/dist/production/components/RepeaterSortable.cjs.map +1 -1
- package/dist/production/components/RepeaterSortable.js +3 -2
- package/dist/production/components/RepeaterSortable.js.map +1 -1
- package/dist/production/components/RepeaterSortableDragOverlay.cjs +1 -1
- package/dist/production/components/RepeaterSortableDragOverlay.cjs.map +1 -1
- package/dist/production/components/RepeaterSortableDragOverlay.js +1 -1
- package/dist/production/components/RepeaterSortableDragOverlay.js.map +1 -1
- package/dist/production/components/RepeaterSortableDropIndicator.cjs +1 -1
- package/dist/production/components/RepeaterSortableDropIndicator.cjs.map +1 -1
- package/dist/production/components/RepeaterSortableDropIndicator.js +1 -1
- package/dist/production/components/RepeaterSortableDropIndicator.js.map +1 -1
- package/dist/production/components/RepeaterSortableEachItem.cjs +1 -1
- package/dist/production/components/RepeaterSortableEachItem.cjs.map +1 -1
- package/dist/production/components/RepeaterSortableEachItem.js +1 -1
- package/dist/production/components/RepeaterSortableEachItem.js.map +1 -1
- package/dist/production/components/RepeaterSortableItemActivator.cjs +1 -1
- package/dist/production/components/RepeaterSortableItemActivator.cjs.map +1 -1
- package/dist/production/components/RepeaterSortableItemActivator.js +1 -1
- package/dist/production/components/RepeaterSortableItemActivator.js.map +1 -1
- package/dist/production/components/RepeaterSortableItemNode.cjs +1 -1
- package/dist/production/components/RepeaterSortableItemNode.cjs.map +1 -1
- package/dist/production/components/RepeaterSortableItemNode.js +1 -1
- package/dist/production/components/RepeaterSortableItemNode.js.map +1 -1
- package/dist/production/contexts.cjs +14 -0
- package/dist/production/contexts.cjs.map +1 -0
- package/dist/production/contexts.js +14 -0
- package/dist/production/contexts.js.map +1 -0
- package/dist/production/index.cjs +5 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +6 -1
- package/dist/production/index.js.map +1 -1
- package/dist/types/components/RepeaterSortable.d.ts.map +1 -1
- package/dist/types/{internal/contexts.d.ts → contexts.d.ts} +6 -2
- package/dist/types/contexts.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/RepeaterSortable.tsx +3 -1
- package/src/components/RepeaterSortableDragOverlay.tsx +1 -1
- package/src/components/RepeaterSortableDropIndicator.tsx +1 -1
- package/src/components/RepeaterSortableEachItem.tsx +1 -1
- package/src/components/RepeaterSortableItemActivator.tsx +1 -1
- package/src/components/RepeaterSortableItemNode.tsx +1 -1
- package/src/contexts.ts +13 -0
- package/src/index.ts +2 -0
- package/dist/development/internal/contexts.cjs +0 -10
- package/dist/development/internal/contexts.cjs.map +0 -1
- package/dist/development/internal/contexts.js +0 -10
- package/dist/development/internal/contexts.js.map +0 -1
- package/dist/production/internal/contexts.cjs +0 -10
- package/dist/production/internal/contexts.cjs.map +0 -1
- package/dist/production/internal/contexts.js +0 -10
- package/dist/production/internal/contexts.js.map +0 -1
- package/dist/types/internal/contexts.d.ts.map +0 -1
- package/src/internal/contexts.ts +0 -6
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const core = require("@dnd-kit/core");
|
|
6
|
-
const contexts = require("../
|
|
6
|
+
const contexts = require("../contexts.cjs");
|
|
7
7
|
const sortable = require("@dnd-kit/sortable");
|
|
8
8
|
const reactRepeater = require("@contember/react-repeater");
|
|
9
9
|
const RepeaterSortable = ({ children }) => {
|
|
@@ -47,13 +47,14 @@ const RepeaterSortable = ({ children }) => {
|
|
|
47
47
|
},
|
|
48
48
|
onDragEnd,
|
|
49
49
|
onDragCancel,
|
|
50
|
+
collisionDetection: core.closestCenter,
|
|
50
51
|
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children }, void 0, false, {
|
|
51
52
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
52
|
-
lineNumber:
|
|
53
|
+
lineNumber: 70,
|
|
53
54
|
columnNumber: 5
|
|
54
55
|
}, void 0) }, void 0, false, {
|
|
55
56
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
56
|
-
lineNumber:
|
|
57
|
+
lineNumber: 69,
|
|
57
58
|
columnNumber: 4
|
|
58
59
|
}, void 0)
|
|
59
60
|
},
|
|
@@ -61,7 +62,7 @@ const RepeaterSortable = ({ children }) => {
|
|
|
61
62
|
false,
|
|
62
63
|
{
|
|
63
64
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
64
|
-
lineNumber:
|
|
65
|
+
lineNumber: 55,
|
|
65
66
|
columnNumber: 3
|
|
66
67
|
},
|
|
67
68
|
void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tclosestCenter,\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { useRepeaterMethods } from '@contember/react-repeater'\n\nexport const RepeaterSortable = ({ children }: {\n\tchildren: ReactNode\n}) => {\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 = () => {\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback(({ active, over }: DragEndEvent) => {\n\t\tsetActiveId(null)\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])\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\tonDragStart={({ active }) => {\n\t\t\t\tsetActiveId(active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t\tcollisionDetection={closestCenter}\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","jsxDEV","DndContext","MeasuringStrategy","closestCenter","RepeaterActiveEntityContext","SortableContext","verticalListSortingStrategy","this"],"mappings":";;;;;;;;AAkBO,MAAM,mBAAmB,CAAC,EAAE,eAE7B;AACL,QAAM,CAAC,UAAU,WAAW,IAAIA,eAAkC,IAAI;AAChE,QAAA,EAAE,aAAaC,cAAAA;AACrB,QAAM,WAAWC,cAAAA;AAGX,QAAA,aAAaC,MAAAA,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IACR;AACA,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,KAAAA,cAAc;AAAA,EAAA;AAGzB,QAAM,eAAe,MAAM;AAC1B,gBAAY,IAAI;AAAA,EAAA;AAGjB,QAAM,YAAYC,MAAY,YAAA,CAAC,EAAE,QAAQ,WAAyB;AACjE,gBAAY,IAAI;AAChB,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,IACD;AACA,eAAW,cAAc,SAAS;AAAA,EAAA,GAChC,CAAC,UAAU,QAAQ,CAAC;AAGtB,SAAAC,8BAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAUC,KAAkB,kBAAA;AAAA,QAC7B;AAAA,MACD;AAAA,MACA,aAAa,CAAC,EAAE,aAAa;AAC5B,oBAAY,OAAO,EAAE;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoBC,KAAA;AAAA,MAEpB,UAACH,8BAAA,OAAAI,qCAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAACJ,8BAAA,OAAAK,SAAA,iBAAA,EAAgB,OAAO,UAAU,UAAUC,SAAAA,6BAC1C,YADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAIA,GAAAA,MAAA;AAAA,IAAA;AAAA,IAlBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAqBF;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { useState, useMemo, useCallback } from "react";
|
|
3
|
-
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy } from "@dnd-kit/core";
|
|
4
|
-
import { RepeaterActiveEntityContext } from "../
|
|
3
|
+
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy, closestCenter } from "@dnd-kit/core";
|
|
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
7
|
const RepeaterSortable = ({ children }) => {
|
|
@@ -45,13 +45,14 @@ const RepeaterSortable = ({ children }) => {
|
|
|
45
45
|
},
|
|
46
46
|
onDragEnd,
|
|
47
47
|
onDragCancel,
|
|
48
|
+
collisionDetection: closestCenter,
|
|
48
49
|
children: /* @__PURE__ */ jsxDEV(RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDEV(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children }, void 0, false, {
|
|
49
50
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
50
|
-
lineNumber:
|
|
51
|
+
lineNumber: 70,
|
|
51
52
|
columnNumber: 5
|
|
52
53
|
}, void 0) }, void 0, false, {
|
|
53
54
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
54
|
-
lineNumber:
|
|
55
|
+
lineNumber: 69,
|
|
55
56
|
columnNumber: 4
|
|
56
57
|
}, void 0)
|
|
57
58
|
},
|
|
@@ -59,7 +60,7 @@ const RepeaterSortable = ({ children }) => {
|
|
|
59
60
|
false,
|
|
60
61
|
{
|
|
61
62
|
fileName: "/__w/interface/interface/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
|
|
62
|
-
lineNumber:
|
|
63
|
+
lineNumber: 55,
|
|
63
64
|
columnNumber: 3
|
|
64
65
|
},
|
|
65
66
|
void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.js","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.js","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tclosestCenter,\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { useRepeaterMethods } from '@contember/react-repeater'\n\nexport const RepeaterSortable = ({ children }: {\n\tchildren: ReactNode\n}) => {\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 = () => {\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback(({ active, over }: DragEndEvent) => {\n\t\tsetActiveId(null)\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])\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\tonDragStart={({ active }) => {\n\t\t\t\tsetActiveId(active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t\tcollisionDetection={closestCenter}\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":["this"],"mappings":";;;;;;AAkBO,MAAM,mBAAmB,CAAC,EAAE,eAE7B;AACL,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkC,IAAI;AAChE,QAAA,EAAE,aAAa;AACrB,QAAM,WAAW;AAGX,QAAA,aAAa,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IACR;AACA,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,EAAA;AAGzB,QAAM,eAAe,MAAM;AAC1B,gBAAY,IAAI;AAAA,EAAA;AAGjB,QAAM,YAAY,YAAY,CAAC,EAAE,QAAQ,WAAyB;AACjE,gBAAY,IAAI;AAChB,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,IACD;AACA,eAAW,cAAc,SAAS;AAAA,EAAA,GAChC,CAAC,UAAU,QAAQ,CAAC;AAGtB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAU,kBAAkB;AAAA,QAC7B;AAAA,MACD;AAAA,MACA,aAAa,CAAC,EAAE,aAAa;AAC5B,oBAAY,OAAO,EAAE;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB;AAAA,MAEpB,UAAC,uBAAA,4BAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAAC,uBAAA,iBAAA,EAAgB,OAAO,UAAU,UAAU,6BAC1C,YADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAIA,GAAAA,MAAA;AAAA,IAAA;AAAA,IAlBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAqBF;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const contexts = require("../
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
5
|
const reactPortal = require("@radix-ui/react-portal");
|
|
6
6
|
const core = require("@dnd-kit/core");
|
|
7
7
|
const reactBinding = require("@contember/react-binding");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../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\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","Portal","jsxDEV","DragOverlay","AccessorTree","Entity","RepeaterCurrentEntityContext","this"],"mappings":";;;;;;;;AAOO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAaA,SAAAA;AACnB,QAAM,oBAAoBC,aAAAA;AAC1B,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EACR;AACA,8CACEC,YACA,QAAA,EAAA,UAAAC,8BAAA,OAACC,oBACA,UAACD,8BAAA,OAAAE,aAAA,cAAA,EAAa,OAAO,mBACpB,UAAAF,8BAAAA,OAACG,aAAO,QAAA,EAAA,UAAU,YACjB,UAACH,8BAAAA,OAAAI,cAAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAMA,EAPD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAQA,EATD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAUA,GAAAA,MAAA;AAEF;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useRepeaterActiveEntity } from "../
|
|
2
|
+
import { useRepeaterActiveEntity } from "../contexts.js";
|
|
3
3
|
import { Portal } from "@radix-ui/react-portal";
|
|
4
4
|
import { DragOverlay } from "@dnd-kit/core";
|
|
5
5
|
import { useAccessorTreeState, AccessorTree, Entity } from "@contember/react-binding";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../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\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":["this"],"mappings":";;;;;;AAOO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAa;AACnB,QAAM,oBAAoB;AAC1B,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EACR;AACA,gCACE,QACA,EAAA,UAAA,uBAAC,eACA,UAAC,uBAAA,cAAA,EAAa,OAAO,mBACpB,UAAA,uBAAC,QAAO,EAAA,UAAU,YACjB,UAAC,uBAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA,EALD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAMA,EAPD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAQA,EATD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAUA,GAAAA,MAAA;AAEF;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const contexts = require("../
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
5
|
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
6
6
|
const sortable = contexts.useRepeaterSortableItem();
|
|
7
7
|
const isOver = sortable.isOver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\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","jsxDEV","Fragment","this"],"mappings":";;;;AAGO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAWA,SAAAA;AACjB,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,8BAAA,OAAAC,wBAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY,IAAM;AACpE;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useRepeaterSortableItem } from "../
|
|
2
|
+
import { useRepeaterSortableItem } from "../contexts.js";
|
|
3
3
|
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
4
4
|
const sortable = useRepeaterSortableItem();
|
|
5
5
|
const isOver = sortable.isOver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\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":["this"],"mappings":";;AAGO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAW;AACjB,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,uBAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY,IAAM;AACpE;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const sortable = require("@dnd-kit/sortable");
|
|
5
5
|
const reactRepeater = require("@contember/react-repeater");
|
|
6
|
-
const contexts = require("../
|
|
6
|
+
const contexts = require("../contexts.cjs");
|
|
7
7
|
const reactBinding = require("@contember/react-binding");
|
|
8
8
|
const RepeaterSortableEachItem = ({ children }) => {
|
|
9
9
|
const entities = reactRepeater.useRepeaterSortedEntities();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableEachItem.cjs","sources":["../../../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 '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableEachItem.cjs","sources":["../../../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\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","jsxDEV","SortableContext","verticalListSortingStrategy","RepeaterEachItem","this","useEntity","sortable","useSortable","RepeaterSortableItemContext"],"mappings":";;;;;;;AAMO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAWA,cAAAA;AAGhB,SAAAC,8BAAAA,OAACC,SAAAA,iBAAgB,EAAA,OAAO,UAAU,UAAUC,sCAC3C,UAACF,8BAAAA,OAAAG,cAAAA,kBAAA,EACA,UAACH,8BAAAA,OAAA,+BAAA,EACC,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAI,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAAA,MAAA;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAASC,aAAAA;AACf,QAAMC,aAAWC,SAAAA,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,8CACEC,qCAA4B,UAA5B,EAAqC,OAAOF,YAC3C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAF,MAAA;AAEF;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { SortableContext, verticalListSortingStrategy, useSortable } from "@dnd-kit/sortable";
|
|
3
3
|
import { useRepeaterSortedEntities, RepeaterEachItem } from "@contember/react-repeater";
|
|
4
|
-
import { RepeaterSortableItemContext } from "../
|
|
4
|
+
import { RepeaterSortableItemContext } from "../contexts.js";
|
|
5
5
|
import { useEntity } from "@contember/react-binding";
|
|
6
6
|
const RepeaterSortableEachItem = ({ children }) => {
|
|
7
7
|
const entities = useRepeaterSortedEntities();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableEachItem.js","sources":["../../../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 '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableEachItem.js","sources":["../../../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\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":["this"],"mappings":";;;;;AAMO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAW;AAGhB,SAAA,uBAAC,iBAAgB,EAAA,OAAO,UAAU,UAAU,6BAC3C,UAAC,uBAAA,kBAAA,EACA,UAAC,uBAAA,+BAAA,EACC,YADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAHD,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAKA,EAND,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAOA,GAAAA,MAAA;AAEF;AACA,MAAM,gCAAgC,CAAC,EAAE,eAEnC;AACL,QAAM,SAAS;AACf,QAAM,WAAW,YAAY;AAAA,IAC5B,IAAI,OAAO;AAAA,EAAA,CACX;AACD,gCACE,4BAA4B,UAA5B,EAAqC,OAAO,UAC3C,SADF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;AAEF;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const contexts = require("../
|
|
5
|
+
const contexts = require("../contexts.cjs");
|
|
6
6
|
const reactSlot = require("@radix-ui/react-slot");
|
|
7
7
|
const reactUtils = require("@contember/react-utils");
|
|
8
8
|
const RepeaterSortableItemActivator = react.forwardRef((props, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useComposeRef } from '@contember/react-utils'\n\nexport const RepeaterSortableItemActivator = forwardRef<HTMLElement, {\n\tchildren: ReactNode\n}>((props, ref) => {\n\tconst { setActivatorNodeRef, listeners } = useRepeaterSortableItem()\n\treturn <Slot ref={useComposeRef(ref, setActivatorNodeRef)} {...listeners} {...props} />\n})\n"],"names":["forwardRef","useRepeaterSortableItem","jsxDEV","Slot","useComposeRef","this"],"mappings":";;;;;;;AAKO,MAAM,gCAAgCA,MAAA,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAIC,SAAwB,wBAAA;AAC5D,SAAAC,8BAAA,OAACC,UAAK,MAAA,EAAA,KAAKC,WAAAA,cAAc,KAAK,mBAAmB,GAAI,GAAG,WAAY,GAAG,MAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8E,GAAAC,MAAA;AACtF,CAAC;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { useRepeaterSortableItem } from "../
|
|
3
|
+
import { useRepeaterSortableItem } from "../contexts.js";
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
5
5
|
import { useComposeRef } from "@contember/react-utils";
|
|
6
6
|
const RepeaterSortableItemActivator = forwardRef((props, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemActivator.js","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemActivator.js","sources":["../../../src/components/RepeaterSortableItemActivator.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useComposeRef } from '@contember/react-utils'\n\nexport const RepeaterSortableItemActivator = forwardRef<HTMLElement, {\n\tchildren: ReactNode\n}>((props, ref) => {\n\tconst { setActivatorNodeRef, listeners } = useRepeaterSortableItem()\n\treturn <Slot ref={useComposeRef(ref, setActivatorNodeRef)} {...listeners} {...props} />\n})\n"],"names":["this"],"mappings":";;;;;AAKO,MAAM,gCAAgC,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAI,wBAAwB;AAC5D,SAAA,uBAAC,MAAK,EAAA,KAAK,cAAc,KAAK,mBAAmB,GAAI,GAAG,WAAY,GAAG,MAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAA8E,GAAAA,MAAA;AACtF,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const contexts = require("../
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
5
|
const reactSlot = require("@radix-ui/react-slot");
|
|
6
6
|
const RepeaterSortableItemNode = ({ children }) => {
|
|
7
7
|
const { setNodeRef } = contexts.useRepeaterSortableItem();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemNode.cjs","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemNode.cjs","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\n\nexport const RepeaterSortableItemNode = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst { setNodeRef } = useRepeaterSortableItem()\n\treturn <Slot ref={setNodeRef}>{children}</Slot>\n}\n"],"names":["useRepeaterSortableItem","jsxDEV","Slot","this"],"mappings":";;;;;AAIO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,eAAeA,SAAAA;AACvB,SAAQC,8BAAA,OAAAC,UAAA,MAAA,EAAK,KAAK,YAAa,SAAxB,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAiC,GAAAC,MAAA;AACzC;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import { useRepeaterSortableItem } from "../
|
|
2
|
+
import { useRepeaterSortableItem } from "../contexts.js";
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
const RepeaterSortableItemNode = ({ children }) => {
|
|
5
5
|
const { setNodeRef } = useRepeaterSortableItem();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableItemNode.js","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableItemNode.js","sources":["../../../src/components/RepeaterSortableItemNode.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\n\nexport const RepeaterSortableItemNode = ({ children }: {\n\tchildren: ReactNode\n}) => {\n\tconst { setNodeRef } = useRepeaterSortableItem()\n\treturn <Slot ref={setNodeRef}>{children}</Slot>\n}\n"],"names":["this"],"mappings":";;;AAIO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,eAAe;AACvB,SAAQ,uBAAA,MAAA,EAAK,KAAK,YAAa,SAAxB,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAiC,GAAAA,MAAA;AACzC;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const reactUtils = require("@contember/react-utils");
|
|
4
|
+
const RepeaterSortableItemContext_ = reactUtils.createRequiredContext("RepeaterSortableItemContext");
|
|
5
|
+
const RepeaterSortableItemContext = RepeaterSortableItemContext_[0];
|
|
6
|
+
const useRepeaterSortableItem = RepeaterSortableItemContext_[1];
|
|
7
|
+
const RepeaterActiveEntityContext_ = reactUtils.createContext("RepeaterActiveEntityContext", void 0);
|
|
8
|
+
const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0];
|
|
9
|
+
const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1];
|
|
10
|
+
exports.RepeaterActiveEntityContext = RepeaterActiveEntityContext;
|
|
11
|
+
exports.RepeaterSortableItemContext = RepeaterSortableItemContext;
|
|
12
|
+
exports.useRepeaterActiveEntity = useRepeaterActiveEntity;
|
|
13
|
+
exports.useRepeaterSortableItem = useRepeaterSortableItem;
|
|
14
|
+
//# sourceMappingURL=contexts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../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]\nexport const useRepeaterSortableItem = RepeaterSortableItemContext_[1]\n\nconst RepeaterActiveEntityContext_ = createContext<EntityAccessor | undefined>('RepeaterActiveEntityContext', undefined)\n/** @internal */\nexport const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0]\nexport const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1]\n"],"names":["createRequiredContext","createContext"],"mappings":";;;AAIA,MAAM,+BAA+BA,WAAAA,sBAAsD,6BAA6B;AAE3G,MAAA,8BAA8B,6BAA6B,CAAC;AAC5D,MAAA,0BAA0B,6BAA6B,CAAC;AAErE,MAAM,+BAA+BC,WAA0C,cAAA,+BAA+B,MAAS;AAE1G,MAAA,8BAA8B,6BAA6B,CAAC;AAC5D,MAAA,0BAA0B,6BAA6B,CAAC;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequiredContext, createContext } from "@contember/react-utils";
|
|
2
|
+
const RepeaterSortableItemContext_ = createRequiredContext("RepeaterSortableItemContext");
|
|
3
|
+
const RepeaterSortableItemContext = RepeaterSortableItemContext_[0];
|
|
4
|
+
const useRepeaterSortableItem = RepeaterSortableItemContext_[1];
|
|
5
|
+
const RepeaterActiveEntityContext_ = createContext("RepeaterActiveEntityContext", void 0);
|
|
6
|
+
const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0];
|
|
7
|
+
const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1];
|
|
8
|
+
export {
|
|
9
|
+
RepeaterActiveEntityContext,
|
|
10
|
+
RepeaterSortableItemContext,
|
|
11
|
+
useRepeaterActiveEntity,
|
|
12
|
+
useRepeaterSortableItem
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=contexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../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]\nexport const useRepeaterSortableItem = RepeaterSortableItemContext_[1]\n\nconst RepeaterActiveEntityContext_ = createContext<EntityAccessor | undefined>('RepeaterActiveEntityContext', undefined)\n/** @internal */\nexport const RepeaterActiveEntityContext = RepeaterActiveEntityContext_[0]\nexport const useRepeaterActiveEntity = RepeaterActiveEntityContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,+BAA+B,sBAAsD,6BAA6B;AAE3G,MAAA,8BAA8B,6BAA6B,CAAC;AAC5D,MAAA,0BAA0B,6BAA6B,CAAC;AAErE,MAAM,+BAA+B,cAA0C,+BAA+B,MAAS;AAE1G,MAAA,8BAA8B,6BAA6B,CAAC;AAC5D,MAAA,0BAA0B,6BAA6B,CAAC;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const contexts = require("./contexts.cjs");
|
|
3
4
|
const reactRepeater = require("@contember/react-repeater");
|
|
4
5
|
const RepeaterSortable = require("./components/RepeaterSortable.cjs");
|
|
5
6
|
const RepeaterSortableDragOverlay = require("./components/RepeaterSortableDragOverlay.cjs");
|
|
@@ -7,6 +8,10 @@ const RepeaterSortableDropIndicator = require("./components/RepeaterSortableDrop
|
|
|
7
8
|
const RepeaterSortableItemActivator = require("./components/RepeaterSortableItemActivator.cjs");
|
|
8
9
|
const RepeaterSortableItemNode = require("./components/RepeaterSortableItemNode.cjs");
|
|
9
10
|
const RepeaterSortableEachItem = require("./components/RepeaterSortableEachItem.cjs");
|
|
11
|
+
exports.RepeaterActiveEntityContext = contexts.RepeaterActiveEntityContext;
|
|
12
|
+
exports.RepeaterSortableItemContext = contexts.RepeaterSortableItemContext;
|
|
13
|
+
exports.useRepeaterActiveEntity = contexts.useRepeaterActiveEntity;
|
|
14
|
+
exports.useRepeaterSortableItem = contexts.useRepeaterSortableItem;
|
|
10
15
|
exports.RepeaterSortable = RepeaterSortable.RepeaterSortable;
|
|
11
16
|
exports.RepeaterSortableDragOverlay = RepeaterSortableDragOverlay.RepeaterSortableDragOverlay;
|
|
12
17
|
exports.RepeaterSortableDropIndicator = RepeaterSortableDropIndicator.RepeaterSortableDropIndicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RepeaterActiveEntityContext, RepeaterSortableItemContext, useRepeaterActiveEntity, useRepeaterSortableItem } from "./contexts.js";
|
|
1
2
|
export * from "@contember/react-repeater";
|
|
2
3
|
import { RepeaterSortable } from "./components/RepeaterSortable.js";
|
|
3
4
|
import { RepeaterSortableDragOverlay } from "./components/RepeaterSortableDragOverlay.js";
|
|
@@ -6,11 +7,15 @@ import { RepeaterSortableItemActivator } from "./components/RepeaterSortableItem
|
|
|
6
7
|
import { RepeaterSortableItemNode } from "./components/RepeaterSortableItemNode.js";
|
|
7
8
|
import { RepeaterSortableEachItem } from "./components/RepeaterSortableEachItem.js";
|
|
8
9
|
export {
|
|
10
|
+
RepeaterActiveEntityContext,
|
|
9
11
|
RepeaterSortable,
|
|
10
12
|
RepeaterSortableDragOverlay,
|
|
11
13
|
RepeaterSortableDropIndicator,
|
|
12
14
|
RepeaterSortableEachItem,
|
|
13
15
|
RepeaterSortableItemActivator,
|
|
14
|
-
|
|
16
|
+
RepeaterSortableItemContext,
|
|
17
|
+
RepeaterSortableItemNode,
|
|
18
|
+
useRepeaterActiveEntity,
|
|
19
|
+
useRepeaterSortableItem
|
|
15
20
|
};
|
|
16
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
5
|
const core = require("@dnd-kit/core");
|
|
6
|
-
const contexts = require("../
|
|
6
|
+
const contexts = require("../contexts.cjs");
|
|
7
7
|
const sortable = require("@dnd-kit/sortable");
|
|
8
8
|
const reactRepeater = require("@contember/react-repeater");
|
|
9
9
|
const RepeaterSortable = ({ children }) => {
|
|
@@ -47,6 +47,7 @@ const RepeaterSortable = ({ children }) => {
|
|
|
47
47
|
},
|
|
48
48
|
onDragEnd,
|
|
49
49
|
onDragCancel,
|
|
50
|
+
collisionDetection: core.closestCenter,
|
|
50
51
|
children: /* @__PURE__ */ jsxRuntime.jsx(contexts.RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children }) })
|
|
51
52
|
}
|
|
52
53
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.cjs","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tclosestCenter,\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { useRepeaterMethods } from '@contember/react-repeater'\n\nexport const RepeaterSortable = ({ children }: {\n\tchildren: ReactNode\n}) => {\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 = () => {\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback(({ active, over }: DragEndEvent) => {\n\t\tsetActiveId(null)\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])\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\tonDragStart={({ active }) => {\n\t\t\t\tsetActiveId(active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t\tcollisionDetection={closestCenter}\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":";;;;;;;;AAkBO,MAAM,mBAAmB,CAAC,EAAE,eAE7B;AACL,QAAM,CAAC,UAAU,WAAW,IAAIA,eAAkC,IAAI;AAChE,QAAA,EAAE,aAAaC,cAAAA;AACrB,QAAM,WAAWC,cAAAA;AAGX,QAAA,aAAaC,MAAAA,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IACR;AACA,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,KAAAA,cAAc;AAAA,EAAA;AAGzB,QAAM,eAAe,MAAM;AAC1B,gBAAY,IAAI;AAAA,EAAA;AAGjB,QAAM,YAAYC,MAAY,YAAA,CAAC,EAAE,QAAQ,WAAyB;AACjE,gBAAY,IAAI;AAChB,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,IACD;AACA,eAAW,cAAc,SAAS;AAAA,EAAA,GAChC,CAAC,UAAU,QAAQ,CAAC;AAGtB,SAAAC,2BAAA;AAAA,IAACC,KAAA;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAUC,KAAkB,kBAAA;AAAA,QAC7B;AAAA,MACD;AAAA,MACA,aAAa,CAAC,EAAE,aAAa;AAC5B,oBAAY,OAAO,EAAE;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoBC,KAAA;AAAA,MAEpB,UAACH,2BAAA,IAAAI,qCAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAACJ,2BAAAA,IAAAK,SAAAA,iBAAA,EAAgB,OAAO,UAAU,UAAUC,SAAAA,6BAC1C,SACF,CAAA,GACD;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, useCallback } from "react";
|
|
3
|
-
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy } from "@dnd-kit/core";
|
|
4
|
-
import { RepeaterActiveEntityContext } from "../
|
|
3
|
+
import { useSensors, useSensor, MouseSensor, TouchSensor, KeyboardSensor, DndContext, MeasuringStrategy, closestCenter } from "@dnd-kit/core";
|
|
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
7
|
const RepeaterSortable = ({ children }) => {
|
|
@@ -45,6 +45,7 @@ const RepeaterSortable = ({ children }) => {
|
|
|
45
45
|
},
|
|
46
46
|
onDragEnd,
|
|
47
47
|
onDragCancel,
|
|
48
|
+
collisionDetection: closestCenter,
|
|
48
49
|
children: /* @__PURE__ */ jsx(RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsx(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children }) })
|
|
49
50
|
}
|
|
50
51
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortable.js","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortable.js","sources":["../../../src/components/RepeaterSortable.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo, useState } from 'react'\nimport {\n\tclosestCenter,\n\tDndContext,\n\tDragEndEvent,\n\tKeyboardSensor,\n\tMeasuringStrategy,\n\tMouseSensor,\n\tTouchSensor,\n\tUniqueIdentifier,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core'\nimport { RepeaterActiveEntityContext } from '../contexts'\nimport { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'\nimport { useRepeaterSortedEntities } from '@contember/react-repeater'\nimport { useRepeaterMethods } from '@contember/react-repeater'\n\nexport const RepeaterSortable = ({ children }: {\n\tchildren: ReactNode\n}) => {\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 = () => {\n\t\tsetActiveId(null)\n\t}\n\n\tconst onDragEnd = useCallback(({ active, over }: DragEndEvent) => {\n\t\tsetActiveId(null)\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])\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\tonDragStart={({ active }) => {\n\t\t\t\tsetActiveId(active.id)\n\t\t\t}}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDragCancel={onDragCancel}\n\t\t\tcollisionDetection={closestCenter}\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":";;;;;;AAkBO,MAAM,mBAAmB,CAAC,EAAE,eAE7B;AACL,QAAM,CAAC,UAAU,WAAW,IAAI,SAAkC,IAAI;AAChE,QAAA,EAAE,aAAa;AACrB,QAAM,WAAW;AAGX,QAAA,aAAa,QAAQ,MAAM;AAChC,QAAI,CAAC,UAAU;AACP,aAAA;AAAA,IACR;AACA,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,EAAA;AAGzB,QAAM,eAAe,MAAM;AAC1B,gBAAY,IAAI;AAAA,EAAA;AAGjB,QAAM,YAAY,YAAY,CAAC,EAAE,QAAQ,WAAyB;AACjE,gBAAY,IAAI;AAChB,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,IACD;AACA,eAAW,cAAc,SAAS;AAAA,EAAA,GAChC,CAAC,UAAU,QAAQ,CAAC;AAGtB,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV,WAAW;AAAA,UACV,UAAU,kBAAkB;AAAA,QAC7B;AAAA,MACD;AAAA,MACA,aAAa,CAAC,EAAE,aAAa;AAC5B,oBAAY,OAAO,EAAE;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB;AAAA,MAEpB,UAAC,oBAAA,4BAA4B,UAA5B,EAAqC,OAAO,YAC5C,UAAC,oBAAA,iBAAA,EAAgB,OAAO,UAAU,UAAU,6BAC1C,SACF,CAAA,GACD;AAAA,IAAA;AAAA,EAAA;AAGH;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const contexts = require("../
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
5
|
const reactPortal = require("@radix-ui/react-portal");
|
|
6
6
|
const core = require("@dnd-kit/core");
|
|
7
7
|
const reactBinding = require("@contember/react-binding");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.cjs","sources":["../../../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\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":";;;;;;;;AAOO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAaA,SAAAA;AACnB,QAAM,oBAAoBC,aAAAA;AAC1B,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EACR;AAEC,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,2BAAA,IAAAK,cAAA,6BAA6B,UAA7B,EAAsC,OAAO,YAC5C,SACF,CAAA,EACD,CAAA,EACD,CAAA,EACD,CAAA,EACD,CAAA;AAEF;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRepeaterActiveEntity } from "../
|
|
2
|
+
import { useRepeaterActiveEntity } from "../contexts.js";
|
|
3
3
|
import { Portal } from "@radix-ui/react-portal";
|
|
4
4
|
import { DragOverlay } from "@dnd-kit/core";
|
|
5
5
|
import { useAccessorTreeState, AccessorTree, Entity } from "@contember/react-binding";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../src/components/RepeaterSortableDragOverlay.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterActiveEntity } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDragOverlay.js","sources":["../../../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\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":";;;;;;AAOO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAa;AACnB,QAAM,oBAAoB;AAC1B,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EACR;AAEC,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,EACD,CAAA,EACD,CAAA,EACD,CAAA,EACD,CAAA;AAEF;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const contexts = require("../
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
5
|
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
6
6
|
const sortable = contexts.useRepeaterSortableItem();
|
|
7
7
|
const isOver = sortable.isOver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.cjs","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\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":";;;;AAGO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAWA,SAAAA;AACjB,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,UAAS,IAAM;AACpE;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useRepeaterSortableItem } from "../
|
|
2
|
+
import { useRepeaterSortableItem } from "../contexts.js";
|
|
3
3
|
const RepeaterSortableDropIndicator = ({ children, position }) => {
|
|
4
4
|
const sortable = useRepeaterSortableItem();
|
|
5
5
|
const isOver = sortable.isOver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../
|
|
1
|
+
{"version":3,"file":"RepeaterSortableDropIndicator.js","sources":["../../../src/components/RepeaterSortableDropIndicator.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useRepeaterSortableItem } from '../contexts'\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":";;AAGO,MAAM,gCAAgC,CAAC,EAAE,UAAU,eAGpD;AACL,QAAM,WAAW;AACjB,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,UAAS,IAAM;AACpE;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const sortable = require("@dnd-kit/sortable");
|
|
5
5
|
const reactRepeater = require("@contember/react-repeater");
|
|
6
|
-
const contexts = require("../
|
|
6
|
+
const contexts = require("../contexts.cjs");
|
|
7
7
|
const reactBinding = require("@contember/react-binding");
|
|
8
8
|
const RepeaterSortableEachItem = ({ children }) => {
|
|
9
9
|
const entities = reactRepeater.useRepeaterSortedEntities();
|