@contember/react-repeater-dnd-kit 2.0.0-alpha.39 → 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.
Files changed (63) hide show
  1. package/dist/development/src/components/RepeaterSortable.cjs +3 -3
  2. package/dist/development/src/components/RepeaterSortable.cjs.map +1 -1
  3. package/dist/development/src/components/RepeaterSortable.js +3 -3
  4. package/dist/development/src/components/RepeaterSortable.js.map +1 -1
  5. package/dist/development/src/components/RepeaterSortableDragOverlay.cjs +5 -5
  6. package/dist/development/src/components/RepeaterSortableDragOverlay.cjs.map +1 -1
  7. package/dist/development/src/components/RepeaterSortableDragOverlay.js +5 -5
  8. package/dist/development/src/components/RepeaterSortableDragOverlay.js.map +1 -1
  9. package/dist/development/src/components/RepeaterSortableDropIndicator.cjs +1 -1
  10. package/dist/development/src/components/RepeaterSortableDropIndicator.cjs.map +1 -1
  11. package/dist/development/src/components/RepeaterSortableDropIndicator.js +1 -1
  12. package/dist/development/src/components/RepeaterSortableDropIndicator.js.map +1 -1
  13. package/dist/development/src/components/RepeaterSortableEachItem.cjs +4 -4
  14. package/dist/development/src/components/RepeaterSortableEachItem.cjs.map +1 -1
  15. package/dist/development/src/components/RepeaterSortableEachItem.js +4 -4
  16. package/dist/development/src/components/RepeaterSortableEachItem.js.map +1 -1
  17. package/dist/development/src/components/RepeaterSortableItemActivator.cjs +1 -1
  18. package/dist/development/src/components/RepeaterSortableItemActivator.cjs.map +1 -1
  19. package/dist/development/src/components/RepeaterSortableItemActivator.js +1 -1
  20. package/dist/development/src/components/RepeaterSortableItemActivator.js.map +1 -1
  21. package/dist/development/src/components/RepeaterSortableItemNode.cjs +1 -1
  22. package/dist/development/src/components/RepeaterSortableItemNode.cjs.map +1 -1
  23. package/dist/development/src/components/RepeaterSortableItemNode.js +1 -1
  24. package/dist/development/src/components/RepeaterSortableItemNode.js.map +1 -1
  25. package/dist/development/src/contexts.cjs.map +1 -1
  26. package/dist/development/src/contexts.js.map +1 -1
  27. package/dist/production/src/components/RepeaterSortable.cjs.map +1 -1
  28. package/dist/production/src/components/RepeaterSortable.js.map +1 -1
  29. package/dist/production/src/components/RepeaterSortableDragOverlay.cjs.map +1 -1
  30. package/dist/production/src/components/RepeaterSortableDragOverlay.js.map +1 -1
  31. package/dist/production/src/components/RepeaterSortableDropIndicator.cjs.map +1 -1
  32. package/dist/production/src/components/RepeaterSortableDropIndicator.js.map +1 -1
  33. package/dist/production/src/components/RepeaterSortableEachItem.cjs.map +1 -1
  34. package/dist/production/src/components/RepeaterSortableEachItem.js.map +1 -1
  35. package/dist/production/src/components/RepeaterSortableItemActivator.cjs.map +1 -1
  36. package/dist/production/src/components/RepeaterSortableItemActivator.js.map +1 -1
  37. package/dist/production/src/components/RepeaterSortableItemNode.cjs.map +1 -1
  38. package/dist/production/src/components/RepeaterSortableItemNode.js.map +1 -1
  39. package/dist/production/src/contexts.cjs.map +1 -1
  40. package/dist/production/src/contexts.js.map +1 -1
  41. package/dist/types/components/RepeaterSortable.d.ts +31 -0
  42. package/dist/types/components/RepeaterSortable.d.ts.map +1 -1
  43. package/dist/types/components/RepeaterSortableDragOverlay.d.ts +3 -0
  44. package/dist/types/components/RepeaterSortableDragOverlay.d.ts.map +1 -1
  45. package/dist/types/components/RepeaterSortableDropIndicator.d.ts +3 -0
  46. package/dist/types/components/RepeaterSortableDropIndicator.d.ts.map +1 -1
  47. package/dist/types/components/RepeaterSortableEachItem.d.ts +4 -0
  48. package/dist/types/components/RepeaterSortableEachItem.d.ts.map +1 -1
  49. package/dist/types/components/RepeaterSortableItemActivator.d.ts +5 -2
  50. package/dist/types/components/RepeaterSortableItemActivator.d.ts.map +1 -1
  51. package/dist/types/components/RepeaterSortableItemNode.d.ts +5 -2
  52. package/dist/types/components/RepeaterSortableItemNode.d.ts.map +1 -1
  53. package/dist/types/contexts.d.ts +6 -0
  54. package/dist/types/contexts.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +4 -4
  57. package/src/components/RepeaterSortable.tsx +31 -0
  58. package/src/components/RepeaterSortableDragOverlay.tsx +3 -0
  59. package/src/components/RepeaterSortableDropIndicator.tsx +3 -0
  60. package/src/components/RepeaterSortableEachItem.tsx +4 -0
  61. package/src/components/RepeaterSortableItemActivator.tsx +5 -2
  62. package/src/components/RepeaterSortableItemNode.tsx +5 -2
  63. package/src/contexts.ts +6 -0
@@ -55,11 +55,11 @@ const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDra
55
55
  onDragCancel,
56
56
  children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children }, void 0, false, {
57
57
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
58
- lineNumber: 64,
58
+ lineNumber: 95,
59
59
  columnNumber: 5
60
60
  }, void 0) }, void 0, false, {
61
61
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
62
- lineNumber: 63,
62
+ lineNumber: 94,
63
63
  columnNumber: 4
64
64
  }, void 0)
65
65
  },
@@ -67,7 +67,7 @@ const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDra
67
67
  false,
68
68
  {
69
69
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
70
- lineNumber: 47,
70
+ lineNumber: 78,
71
71
  columnNumber: 3
72
72
  },
73
73
  void 0
@@ -1 +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\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","jsxDEV","DndContext","MeasuringStrategy","closestCenter","RepeaterActiveEntityContext","SortableContext","verticalListSortingStrategy","this"],"mappings":";;;;;;;;AAOa,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,8BAAA;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,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,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;;"}
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","jsxDEV","DndContext","MeasuringStrategy","closestCenter","RepeaterActiveEntityContext","SortableContext","verticalListSortingStrategy","this"],"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,8BAAA;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,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,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;;"}
@@ -53,11 +53,11 @@ const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDra
53
53
  onDragCancel,
54
54
  children: /* @__PURE__ */ jsxDEV(RepeaterActiveEntityContext.Provider, { value: activeItem, children: /* @__PURE__ */ jsxDEV(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children }, void 0, false, {
55
55
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
56
- lineNumber: 64,
56
+ lineNumber: 95,
57
57
  columnNumber: 5
58
58
  }, void 0) }, void 0, false, {
59
59
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
60
- lineNumber: 63,
60
+ lineNumber: 94,
61
61
  columnNumber: 4
62
62
  }, void 0)
63
63
  },
@@ -65,7 +65,7 @@ const RepeaterSortable = ({ children, onDragStart, onDragEnd: onDragEndIn, onDra
65
65
  false,
66
66
  {
67
67
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortable.tsx",
68
- lineNumber: 47,
68
+ lineNumber: 78,
69
69
  columnNumber: 3
70
70
  },
71
71
  void 0
@@ -1 +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\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":["this"],"mappings":";;;;;;AAOa,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,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,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;"}
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":["this"],"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,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,MAAA,GAIAA,MAAA;AAAA,IAAA;AAAA,IApBD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAqBA;AAEF;"}
@@ -14,23 +14,23 @@ const RepeaterSortableDragOverlay = ({ children }) => {
14
14
  }
15
15
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactPortal.Portal, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(core.DragOverlay, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.AccessorTree, { state: accessorTreeState, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBinding.Entity, { accessor: activeItem, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.RepeaterCurrentEntityContext.Provider, { value: activeItem, children }, void 0, false, {
16
16
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
17
- lineNumber: 21,
17
+ lineNumber: 24,
18
18
  columnNumber: 7
19
19
  }, void 0) }, void 0, false, {
20
20
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
21
- lineNumber: 20,
21
+ lineNumber: 23,
22
22
  columnNumber: 6
23
23
  }, void 0) }, void 0, false, {
24
24
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
25
- lineNumber: 19,
25
+ lineNumber: 22,
26
26
  columnNumber: 5
27
27
  }, void 0) }, void 0, false, {
28
28
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
29
- lineNumber: 18,
29
+ lineNumber: 21,
30
30
  columnNumber: 4
31
31
  }, void 0) }, void 0, false, {
32
32
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
33
- lineNumber: 17,
33
+ lineNumber: 20,
34
34
  columnNumber: 3
35
35
  }, void 0);
36
36
  };
@@ -1 +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\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,wBAAwB;AAC3C,QAAM,oBAAoBC,aAAAA,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAER,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
+ {"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","Portal","jsxDEV","DragOverlay","AccessorTree","Entity","RepeaterCurrentEntityContext","this"],"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;AAER,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;;"}
@@ -12,23 +12,23 @@ const RepeaterSortableDragOverlay = ({ children }) => {
12
12
  }
13
13
  return /* @__PURE__ */ jsxDEV(Portal, { children: /* @__PURE__ */ jsxDEV(DragOverlay, { children: /* @__PURE__ */ jsxDEV(AccessorTree, { state: accessorTreeState, children: /* @__PURE__ */ jsxDEV(Entity, { accessor: activeItem, children: /* @__PURE__ */ jsxDEV(RepeaterCurrentEntityContext.Provider, { value: activeItem, children }, void 0, false, {
14
14
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
15
- lineNumber: 21,
15
+ lineNumber: 24,
16
16
  columnNumber: 7
17
17
  }, void 0) }, void 0, false, {
18
18
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
19
- lineNumber: 20,
19
+ lineNumber: 23,
20
20
  columnNumber: 6
21
21
  }, void 0) }, void 0, false, {
22
22
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
23
- lineNumber: 19,
23
+ lineNumber: 22,
24
24
  columnNumber: 5
25
25
  }, void 0) }, void 0, false, {
26
26
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
27
- lineNumber: 18,
27
+ lineNumber: 21,
28
28
  columnNumber: 4
29
29
  }, void 0) }, void 0, false, {
30
30
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDragOverlay.tsx",
31
- lineNumber: 17,
31
+ lineNumber: 20,
32
32
  columnNumber: 3
33
33
  }, void 0);
34
34
  };
@@ -1 +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\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,wBAAwB;AAC3C,QAAM,oBAAoB,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAER,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
+ {"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":["this"],"mappings":";;;;;;AAUO,MAAM,8BAA8B,CAAC,EAAE,eAExC;AACL,QAAM,aAAa,wBAAwB;AAC3C,QAAM,oBAAoB,qBAAqB;AAC/C,MAAI,CAAC,YAAY;AACT,WAAA;AAAA,EAAA;AAER,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;"}
@@ -10,7 +10,7 @@ const RepeaterSortableDropIndicator = ({ children, position }) => {
10
10
  const renderedPosition = isAfter ? "after" : "before";
11
11
  return renderedPosition === position && isOver ? /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children }, void 0, false, {
12
12
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx",
13
- lineNumber: 14,
13
+ lineNumber: 17,
14
14
  columnNumber: 51
15
15
  }, void 0) : null;
16
16
  };
@@ -1 +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\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,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,8BAAA,OAAAC,wBAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY,IAAM;AACpE;;"}
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","jsxDEV","Fragment","this"],"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,8BAAA,OAAAC,wBAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY,IAAM;AACpE;;"}
@@ -8,7 +8,7 @@ const RepeaterSortableDropIndicator = ({ children, position }) => {
8
8
  const renderedPosition = isAfter ? "after" : "before";
9
9
  return renderedPosition === position && isOver ? /* @__PURE__ */ jsxDEV(Fragment, { children }, void 0, false, {
10
10
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableDropIndicator.tsx",
11
- lineNumber: 14,
11
+ lineNumber: 17,
12
12
  columnNumber: 51
13
13
  }, void 0) : null;
14
14
  };
@@ -1 +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\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,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,uBAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY,IAAM;AACpE;"}
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":["this"],"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,uBAAA,UAAA,EAAG,SAAH,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY,IAAM;AACpE;"}
@@ -9,15 +9,15 @@ const RepeaterSortableEachItem = ({ children }) => {
9
9
  const entities = reactRepeater.useRepeaterSortedEntities();
10
10
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(sortable.SortableContext, { items: entities, strategy: sortable.verticalListSortingStrategy, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactRepeater.RepeaterEachItem, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(RepeaterSortableEachItemInner, { children }, void 0, false, {
11
11
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
12
- lineNumber: 15,
12
+ lineNumber: 19,
13
13
  columnNumber: 5
14
14
  }, void 0) }, void 0, false, {
15
15
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
16
- lineNumber: 14,
16
+ lineNumber: 18,
17
17
  columnNumber: 4
18
18
  }, void 0) }, void 0, false, {
19
19
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
20
- lineNumber: 13,
20
+ lineNumber: 17,
21
21
  columnNumber: 3
22
22
  }, void 0);
23
23
  };
@@ -28,7 +28,7 @@ const RepeaterSortableEachItemInner = ({ children }) => {
28
28
  });
29
29
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.RepeaterSortableItemContext.Provider, { value: sortable$1, children }, void 0, false, {
30
30
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
31
- lineNumber: 31,
31
+ lineNumber: 35,
32
32
  columnNumber: 3
33
33
  }, void 0);
34
34
  };
@@ -1 +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\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,0BAA0B;AAG1C,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,UAAU;AACzB,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
+ {"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","jsxDEV","SortableContext","verticalListSortingStrategy","RepeaterEachItem","this","useEntity","sortable","useSortable","RepeaterSortableItemContext"],"mappings":";;;;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAWA,cAAAA,0BAA0B;AAG1C,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,UAAU;AACzB,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;;"}
@@ -7,15 +7,15 @@ const RepeaterSortableEachItem = ({ children }) => {
7
7
  const entities = useRepeaterSortedEntities();
8
8
  return /* @__PURE__ */ jsxDEV(SortableContext, { items: entities, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxDEV(RepeaterEachItem, { children: /* @__PURE__ */ jsxDEV(RepeaterSortableEachItemInner, { children }, void 0, false, {
9
9
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
10
- lineNumber: 15,
10
+ lineNumber: 19,
11
11
  columnNumber: 5
12
12
  }, void 0) }, void 0, false, {
13
13
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
14
- lineNumber: 14,
14
+ lineNumber: 18,
15
15
  columnNumber: 4
16
16
  }, void 0) }, void 0, false, {
17
17
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
18
- lineNumber: 13,
18
+ lineNumber: 17,
19
19
  columnNumber: 3
20
20
  }, void 0);
21
21
  };
@@ -26,7 +26,7 @@ const RepeaterSortableEachItemInner = ({ children }) => {
26
26
  });
27
27
  return /* @__PURE__ */ jsxDEV(RepeaterSortableItemContext.Provider, { value: sortable, children }, void 0, false, {
28
28
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableEachItem.tsx",
29
- lineNumber: 31,
29
+ lineNumber: 35,
30
30
  columnNumber: 3
31
31
  }, void 0);
32
32
  };
@@ -1 +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\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,0BAA0B;AAG1C,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,UAAU;AACzB,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;"}
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":["this"],"mappings":";;;;;AAUO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACL,QAAM,WAAW,0BAA0B;AAG1C,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,UAAU;AACzB,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;"}
@@ -9,7 +9,7 @@ const RepeaterSortableItemActivator = React.forwardRef((props, ref) => {
9
9
  const { setActivatorNodeRef, listeners } = contexts.useRepeaterSortableItem();
10
10
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactSlot.Slot, { ref: reactUtils.useComposeRef(ref, setActivatorNodeRef), ...listeners, ...props }, void 0, false, {
11
11
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx",
12
- lineNumber: 10,
12
+ lineNumber: 13,
13
13
  columnNumber: 9
14
14
  }, void 0);
15
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/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,iCAAwB;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
+ {"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","jsxDEV","Slot","useComposeRef","this"],"mappings":";;;;;;;AAQO,MAAM,gCAAgCA,MAAA,WAE1C,CAAC,OAAO,QAAQ;AAClB,QAAM,EAAE,qBAAqB,UAAU,IAAIC,iCAAwB;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;;"}
@@ -7,7 +7,7 @@ const RepeaterSortableItemActivator = forwardRef((props, ref) => {
7
7
  const { setActivatorNodeRef, listeners } = useRepeaterSortableItem();
8
8
  return /* @__PURE__ */ jsxDEV(Slot, { ref: useComposeRef(ref, setActivatorNodeRef), ...listeners, ...props }, void 0, false, {
9
9
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemActivator.tsx",
10
- lineNumber: 10,
10
+ lineNumber: 13,
11
11
  columnNumber: 9
12
12
  }, void 0);
13
13
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemActivator.js","sources":["../../../../../packages/react-repeater-dnd-kit/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
+ {"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":["this"],"mappings":";;;;;AAQO,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;"}
@@ -7,7 +7,7 @@ const RepeaterSortableItemNode = ({ children }) => {
7
7
  const { setNodeRef } = contexts.useRepeaterSortableItem();
8
8
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactSlot.Slot, { ref: setNodeRef, children }, void 0, false, {
9
9
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemNode.tsx",
10
- lineNumber: 9,
10
+ lineNumber: 12,
11
11
  columnNumber: 9
12
12
  }, void 0);
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemNode.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/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,WAAW,IAAIA,iCAAwB;AAC/C,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
+ {"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","jsxDEV","Slot","this"],"mappings":";;;;;AAOO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAIA,iCAAwB;AAC/C,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;;"}
@@ -5,7 +5,7 @@ const RepeaterSortableItemNode = ({ children }) => {
5
5
  const { setNodeRef } = useRepeaterSortableItem();
6
6
  return /* @__PURE__ */ jsxDEV(Slot, { ref: setNodeRef, children }, void 0, false, {
7
7
  fileName: "/home/runner/work/contember/contember/packages/react-repeater-dnd-kit/src/components/RepeaterSortableItemNode.tsx",
8
- lineNumber: 9,
8
+ lineNumber: 12,
9
9
  columnNumber: 9
10
10
  }, void 0);
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemNode.js","sources":["../../../../../packages/react-repeater-dnd-kit/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,WAAW,IAAI,wBAAwB;AAC/C,SAAQ,uBAAA,MAAA,EAAK,KAAK,YAAa,SAAxB,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAiC,GAAAA,MAAA;AACzC;"}
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":["this"],"mappings":";;;AAOO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAI,wBAAwB;AAC/C,SAAQ,uBAAA,MAAA,EAAK,KAAK,YAAa,SAAxB,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAiC,GAAAA,MAAA;AACzC;"}
@@ -1 +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]\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,iCAAsD,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;;;;;"}
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;;;;;"}
@@ -1 +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]\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
+ {"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 +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\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":";;;;;;;;AAOa,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;;"}
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;;"}
@@ -1 +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\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":";;;;;;AAOa,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;"}
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;"}
@@ -1 +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\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,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;;"}
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;;"}
@@ -1 +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\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,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;"}
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;"}
@@ -1 +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\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,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;;"}
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;;"}
@@ -1 +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\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,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;"}
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;"}
@@ -1 +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\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":";;;;;;;AAMO,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;;"}
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;;"}
@@ -1 +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\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":";;;;;AAMO,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
+ {"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 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemActivator.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/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","jsx","Slot","useComposeRef"],"mappings":";;;;;;;AAKO,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;;"}
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;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemActivator.js","sources":["../../../../../packages/react-repeater-dnd-kit/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":[],"mappings":";;;;;AAKO,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;"}
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;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemNode.cjs","sources":["../../../../../packages/react-repeater-dnd-kit/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","jsx","Slot"],"mappings":";;;;;AAIO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAIA,iCAAwB;AAC/C,SAAQC,2BAAAA,IAAAC,UAAAA,MAAA,EAAK,KAAK,YAAa,SAAS,CAAA;AACzC;;"}
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;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RepeaterSortableItemNode.js","sources":["../../../../../packages/react-repeater-dnd-kit/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":[],"mappings":";;;AAIO,MAAM,2BAA2B,CAAC,EAAE,eAErC;AACC,QAAA,EAAE,WAAW,IAAI,wBAAwB;AAC/C,SAAQ,oBAAA,MAAA,EAAK,KAAK,YAAa,SAAS,CAAA;AACzC;"}
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;"}