@noya-app/noya-designsystem 0.1.56 → 0.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -218,8 +218,11 @@ import { useEffect as useEffect2, useState as useState5 } from "react";
218
218
  // ../noya-react-utils/src/hooks/useIsMounted.ts
219
219
  import { useEffect as useEffect3, useRef as useRef4 } from "react";
220
220
 
221
+ // ../noya-react-utils/src/hooks/useIsomorphicLayoutEffect.ts
222
+ import { useEffect as useEffect4, useLayoutEffect } from "react";
223
+
221
224
  // ../noya-react-utils/src/hooks/useLateReference.ts
222
- import { useCallback as useCallback5, useLayoutEffect, useRef as useRef5 } from "react";
225
+ import { useCallback as useCallback5, useLayoutEffect as useLayoutEffect2, useRef as useRef5 } from "react";
223
226
 
224
227
  // ../noya-react-utils/src/hooks/useLazyValue.ts
225
228
  import { useRef as useRef6 } from "react";
@@ -253,7 +256,7 @@ import { useCallback as useCallback7, useMemo as useMemo2, useState as useState6
253
256
  // ../noya-react-utils/src/hooks/usePersistentState.ts
254
257
  import {
255
258
  useCallback as useCallback8,
256
- useEffect as useEffect4,
259
+ useEffect as useEffect5,
257
260
  useMemo as useMemo3,
258
261
  useState as useState7
259
262
  } from "react";
@@ -264,7 +267,7 @@ function usePersistentStateString(storage, storageKey, defaultValue2) {
264
267
  const [state, setState] = useState7(
265
268
  () => getCurrentValue(storage, storageKey, defaultValue2)
266
269
  );
267
- useEffect4(() => {
270
+ useEffect5(() => {
268
271
  const newValue = getCurrentValue(storage, storageKey, defaultValue2);
269
272
  setState(newValue);
270
273
  }, [defaultValue2, storage, storageKey]);
@@ -276,7 +279,7 @@ function usePersistentStateString(storage, storageKey, defaultValue2) {
276
279
  },
277
280
  [defaultValue2, storage, storageKey]
278
281
  );
279
- useEffect4(() => {
282
+ useEffect5(() => {
280
283
  const dispose = storage.addListener(storageKey, (newValue) => {
281
284
  setState(newValue);
282
285
  });
@@ -286,21 +289,33 @@ function usePersistentStateString(storage, storageKey, defaultValue2) {
286
289
  }
287
290
 
288
291
  // ../noya-react-utils/src/hooks/usePixelRatio.ts
289
- import { useEffect as useEffect5, useState as useState8 } from "react";
292
+ import { useEffect as useEffect6, useState as useState8 } from "react";
290
293
 
291
294
  // ../noya-react-utils/src/hooks/useShallowArray.ts
292
295
  import { isShallowEqual } from "@noya-app/noya-utils";
293
296
  import { useRef as useRef7 } from "react";
294
297
 
295
298
  // ../noya-react-utils/src/hooks/useStableCallback.ts
296
- import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect2, useRef as useRef8 } from "react";
299
+ import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect3, useRef as useRef8 } from "react";
300
+ var noop2 = () => {
301
+ };
302
+ function useStableCallback(callback) {
303
+ const callbackRef = useRef8(callback || noop2);
304
+ useLayoutEffect3(() => {
305
+ callbackRef.current = callback || noop2;
306
+ }, [callback]);
307
+ return useCallback9(
308
+ (...args) => callbackRef.current(...args),
309
+ [callbackRef]
310
+ );
311
+ }
297
312
 
298
313
  // ../noya-react-utils/src/hooks/useSystemColorScheme.ts
299
- import { useEffect as useEffect6, useState as useState9 } from "react";
314
+ import { useEffect as useEffect7, useState as useState9 } from "react";
300
315
 
301
316
  // ../noya-react-utils/src/hooks/useUrlHashParameters.ts
302
317
  import { decodeQueryParameters } from "@noya-app/noya-utils";
303
- import { useEffect as useEffect7, useState as useState10 } from "react";
318
+ import { useEffect as useEffect8, useState as useState10 } from "react";
304
319
 
305
320
  // ../emitter/src/index.ts
306
321
  var Emitter = class {
@@ -1049,14 +1064,14 @@ import { composeRefs } from "@radix-ui/react-compose-refs";
1049
1064
  import React15, {
1050
1065
  forwardRef as forwardRef7,
1051
1066
  useCallback as useCallback11,
1052
- useEffect as useEffect9,
1053
- useLayoutEffect as useLayoutEffect3,
1067
+ useEffect as useEffect10,
1068
+ useLayoutEffect as useLayoutEffect4,
1054
1069
  useRef as useRef10,
1055
1070
  useState as useState11
1056
1071
  } from "react";
1057
1072
 
1058
1073
  // src/contexts/GlobalInputBlurContext.tsx
1059
- import { createContext as createContext2, useContext as useContext2, useEffect as useEffect8 } from "react";
1074
+ import { createContext as createContext2, useContext as useContext2, useEffect as useEffect9 } from "react";
1060
1075
  var defaultValue = /* @__PURE__ */ (() => {
1061
1076
  const listeners = [];
1062
1077
  const value = {
@@ -1083,7 +1098,7 @@ var useGlobalInputBlur = () => {
1083
1098
  };
1084
1099
  function useGlobalInputBlurListener(f) {
1085
1100
  const context = useGlobalInputBlur();
1086
- useEffect8(() => {
1101
+ useEffect9(() => {
1087
1102
  context.addListener(f);
1088
1103
  return () => {
1089
1104
  context.removeListener(f);
@@ -1174,7 +1189,7 @@ var SubmittableTextInput = forwardRef7(function SubmittableTextInput2({
1174
1189
  const userDidEdit = useRef10(false);
1175
1190
  const isSubmitTriggeredByEscapeKey = useRef10(false);
1176
1191
  const [internalValue, setInternalValue] = useState11("");
1177
- useLayoutEffect3(() => {
1192
+ useLayoutEffect4(() => {
1178
1193
  setInternalValue(value);
1179
1194
  }, [value]);
1180
1195
  const handleSubmit = useCallback11(() => {
@@ -1235,7 +1250,7 @@ var SubmittableTextInput = forwardRef7(function SubmittableTextInput2({
1235
1250
  );
1236
1251
  const latestHandleSubmit = useRef10(handleSubmit);
1237
1252
  latestHandleSubmit.current = handleSubmit;
1238
- useEffect9(() => {
1253
+ useEffect10(() => {
1239
1254
  if (submitAutomaticallyAfterDelay) {
1240
1255
  if (autoSubmitTimeoutRef.current) {
1241
1256
  clearTimeout(autoSubmitTimeoutRef.current);
@@ -1321,7 +1336,7 @@ var Label = memo6(
1321
1336
 
1322
1337
  // src/components/Popover.tsx
1323
1338
  import * as PopoverPrimitive from "@radix-ui/react-popover";
1324
- import React18, { useEffect as useEffect10, useId, useRef as useRef11 } from "react";
1339
+ import React18, { useEffect as useEffect11, useId, useRef as useRef11 } from "react";
1325
1340
 
1326
1341
  // src/contexts/OpenPortalsContext.tsx
1327
1342
  import * as React17 from "react";
@@ -1400,7 +1415,7 @@ function Popover({
1400
1415
  defaultValue: false
1401
1416
  });
1402
1417
  const { addOpenPortal, removeOpenPortal } = useOpenPortalsControls();
1403
- useEffect10(() => {
1418
+ useEffect11(() => {
1404
1419
  if (!isOpen) return;
1405
1420
  addOpenPortal(portalScopeId || defaultId);
1406
1421
  return () => {
@@ -1475,7 +1490,7 @@ var InputFieldContext = createContext4({
1475
1490
  endRef: null
1476
1491
  });
1477
1492
  var useInputFieldContext = () => useContext4(InputFieldContext);
1478
- var noop2 = () => {
1493
+ var noop3 = () => {
1479
1494
  };
1480
1495
  var getFieldSpacing = ({
1481
1496
  endWidth = 0,
@@ -1725,7 +1740,7 @@ function InputFieldNumberInput(props) {
1725
1740
  onKeyDown: !readOnly ? handleKeyDown : void 0,
1726
1741
  onBlur: handleBlur,
1727
1742
  ...readOnly ? { readOnly: true } : {},
1728
- ..."onChange" in props ? { onChange: readOnly ? noop2 : handleChange } : { onSubmit: readOnly ? noop2 : handleSubmit }
1743
+ ..."onChange" in props ? { onChange: readOnly ? noop3 : handleChange } : { onSubmit: readOnly ? noop3 : handleSubmit }
1729
1744
  }
1730
1745
  );
1731
1746
  }
@@ -2987,12 +3002,12 @@ import React31, {
2987
3002
  forwardRef as forwardRef12,
2988
3003
  memo as memo12,
2989
3004
  useCallback as useCallback15,
2990
- useEffect as useEffect12,
3005
+ useEffect as useEffect13,
2991
3006
  useRef as useRef13
2992
3007
  } from "react";
2993
3008
  var useAutoResize = (value) => {
2994
3009
  const textareaRef = useRef13(null);
2995
- useEffect12(() => {
3010
+ useEffect13(() => {
2996
3011
  if (value === void 0) return;
2997
3012
  if (!textareaRef.current) return;
2998
3013
  textareaRef.current.style.height = "auto";
@@ -3125,8 +3140,8 @@ import React33, {
3125
3140
  Children as Children2,
3126
3141
  isValidElement as isValidElement2,
3127
3142
  useCallback as useCallback16,
3128
- useEffect as useEffect13,
3129
- useLayoutEffect as useLayoutEffect4,
3143
+ useEffect as useEffect14,
3144
+ useLayoutEffect as useLayoutEffect5,
3130
3145
  useRef as useRef14,
3131
3146
  useState as useState17
3132
3147
  } from "react";
@@ -3166,7 +3181,7 @@ var PresenceChild = ({
3166
3181
  willChange: "opacity",
3167
3182
  backfaceVisibility: "hidden"
3168
3183
  };
3169
- useLayoutEffect4(() => {
3184
+ useLayoutEffect5(() => {
3170
3185
  let rafId;
3171
3186
  if (isPresent && animationState !== "entered") {
3172
3187
  if (isInitialMount.current && skipInitialAnimation) {
@@ -3215,7 +3230,7 @@ var AnimatePresence = ({
3215
3230
  const previousChildrenRef = useRef14([]);
3216
3231
  const removingChildrenRef = useRef14(/* @__PURE__ */ new Set());
3217
3232
  const waitingToEnterRef = useRef14([]);
3218
- useEffect13(() => {
3233
+ useEffect14(() => {
3219
3234
  const newChildren = Children2.toArray(children).filter(
3220
3235
  isValidElement2
3221
3236
  );
@@ -3703,7 +3718,7 @@ import React39, {
3703
3718
  forwardRef as forwardRef17,
3704
3719
  memo as memo15,
3705
3720
  useCallback as useCallback17,
3706
- useEffect as useEffect15,
3721
+ useEffect as useEffect16,
3707
3722
  useImperativeHandle as useImperativeHandle2,
3708
3723
  useRef as useRef16,
3709
3724
  useState as useState19
@@ -3729,7 +3744,7 @@ var EditableText = memo15(
3729
3744
  ...props
3730
3745
  }, ref) {
3731
3746
  const [inputValue, setInputValue] = useState19(value);
3732
- useEffect15(() => {
3747
+ useEffect16(() => {
3733
3748
  setInputValue(value);
3734
3749
  }, [value]);
3735
3750
  const [focusedInternal, setFocused] = useState19(false);
@@ -3765,7 +3780,7 @@ var EditableText = memo15(
3765
3780
  inputRef.current?.focus();
3766
3781
  inputRef.current?.setSelectionRange(0, inputRef.current.value.length);
3767
3782
  }
3768
- useEffect15(() => {
3783
+ useEffect16(() => {
3769
3784
  if (testFocused) return;
3770
3785
  if (focused) {
3771
3786
  setTimeout(focusInput, 1);
@@ -4424,7 +4439,7 @@ import React48, {
4424
4439
  useCallback as useCallback23,
4425
4440
  useContext as useContext11,
4426
4441
  useImperativeHandle as useImperativeHandle4,
4427
- useLayoutEffect as useLayoutEffect5,
4442
+ useLayoutEffect as useLayoutEffect6,
4428
4443
  useMemo as useMemo21,
4429
4444
  useRef as useRef19
4430
4445
  } from "react";
@@ -4455,7 +4470,7 @@ function mergeEventHandlers(...handlerMaps) {
4455
4470
  }
4456
4471
 
4457
4472
  // src/components/sorting/Sortable.tsx
4458
- import { useDndContext, useDroppable } from "@dnd-kit/core";
4473
+ import { useDroppable } from "@dnd-kit/core";
4459
4474
  import {
4460
4475
  horizontalListSortingStrategy,
4461
4476
  SortableContext,
@@ -4510,12 +4525,15 @@ import {
4510
4525
  useSensor,
4511
4526
  useSensors
4512
4527
  } from "@dnd-kit/core";
4528
+ import { rectContainsPoint, unionRects } from "@noya-app/noya-geometry";
4529
+ import { windowsOf } from "@noya-app/noya-utils";
4513
4530
  import * as React45 from "react";
4514
4531
  import { useMemo as useMemo19 } from "react";
4515
4532
  import { createPortal as createPortal2 } from "react-dom";
4516
4533
  function SharedDragProvider({
4517
4534
  children,
4518
- contexts = {
4535
+ onMoveItem,
4536
+ sharedDragProps = {
4519
4537
  dragRegistrationContext: DragRegistrationContext,
4520
4538
  activeDragContext: ActiveDragContext
4521
4539
  }
@@ -4528,22 +4546,13 @@ function SharedDragProvider({
4528
4546
  })
4529
4547
  );
4530
4548
  const mounted = useMounted();
4531
- const [activeItem, setActiveItem] = React45.useState(null);
4532
- const [delta, setDelta] = React45.useState({ x: 0, y: 0 });
4549
+ const [dragState, setDragState] = React45.useState({
4550
+ source: null,
4551
+ target: null,
4552
+ indicator: null
4553
+ });
4533
4554
  const { registerList, unregisterList, registeredLists } = useDragRegistrationManager();
4534
4555
  const activatorEventRef = React45.useRef(null);
4535
- const acceptsListDrop = React45.useCallback(
4536
- (sourceListId, targetListId) => {
4537
- const sourceList = registeredLists.get(sourceListId);
4538
- const targetList = registeredLists.get(targetListId);
4539
- if (!sourceList || !targetList) return false;
4540
- return targetList.acceptsFromList({
4541
- sourceListId,
4542
- targetListId
4543
- });
4544
- },
4545
- [registeredLists]
4546
- );
4547
4556
  const handleDragStart = React45.useCallback(
4548
4557
  (event) => {
4549
4558
  activatorEventRef.current = event.activatorEvent;
@@ -4551,132 +4560,121 @@ function SharedDragProvider({
4551
4560
  const itemIndex = list.keys.findIndex((key) => key === event.active.id);
4552
4561
  if (itemIndex >= 0) {
4553
4562
  const dragItem = {
4554
- id: event.active.id,
4563
+ itemId: event.active.id,
4555
4564
  listId,
4556
4565
  index: itemIndex
4557
4566
  };
4558
- setActiveItem(dragItem);
4567
+ setDragState({
4568
+ source: dragItem,
4569
+ target: null,
4570
+ indicator: null
4571
+ });
4559
4572
  break;
4560
4573
  }
4561
4574
  }
4562
4575
  },
4563
4576
  [registeredLists]
4564
4577
  );
4565
- const handleDragMove = React45.useCallback((event) => {
4566
- setDelta({ x: event.delta.x, y: event.delta.y });
4567
- }, []);
4578
+ const handleDragMove = React45.useCallback(
4579
+ (event) => {
4580
+ const { active, over } = event;
4581
+ if (!activatorEventRef.current || !dragState.source) return;
4582
+ const dropTarget = findDropTarget({
4583
+ activationPoint: {
4584
+ x: activatorEventRef.current.clientX,
4585
+ y: activatorEventRef.current.clientY
4586
+ },
4587
+ delta: { x: event.delta.x, y: event.delta.y },
4588
+ over,
4589
+ active,
4590
+ source: dragState.source,
4591
+ registeredLists
4592
+ });
4593
+ setDragState({
4594
+ source: dragState.source,
4595
+ target: dropTarget?.target ?? null,
4596
+ indicator: dropTarget?.indicator ?? null
4597
+ });
4598
+ },
4599
+ [registeredLists, dragState.source]
4600
+ );
4601
+ const stableOnMoveItem = useStableCallback(onMoveItem);
4568
4602
  const handleDragEnd = React45.useCallback(
4569
4603
  (event) => {
4570
4604
  const { active, over } = event;
4571
- const activatorEventPoint = activatorEventRef.current ? {
4572
- x: activatorEventRef.current.clientX,
4573
- y: activatorEventRef.current.clientY
4574
- } : null;
4575
- setActiveItem(null);
4605
+ if (!activatorEventRef.current || !dragState.source) return;
4606
+ const dropTarget = findDropTarget({
4607
+ activationPoint: {
4608
+ x: activatorEventRef.current.clientX,
4609
+ y: activatorEventRef.current.clientY
4610
+ },
4611
+ delta: { x: event.delta.x, y: event.delta.y },
4612
+ over,
4613
+ active,
4614
+ source: dragState.source,
4615
+ registeredLists
4616
+ });
4617
+ setDragState({
4618
+ source: null,
4619
+ target: null,
4620
+ indicator: null
4621
+ });
4576
4622
  activatorEventRef.current = null;
4577
- if (!activeItem || !over || active.id === over.id) {
4578
- return;
4579
- }
4580
- let targetListId = null;
4581
- let targetIndex = -1;
4582
- for (const [listId, list] of registeredLists) {
4583
- const itemIndex = list.keys.findIndex((key) => key === over.id);
4584
- if (itemIndex >= 0) {
4585
- targetListId = listId;
4586
- targetIndex = itemIndex;
4587
- break;
4588
- }
4589
- if (over.id === listId) {
4590
- targetListId = listId;
4591
- targetIndex = list.keys.length;
4592
- break;
4593
- }
4594
- }
4595
- if (!targetListId || !acceptsListDrop(activeItem.listId, targetListId)) {
4596
- setActiveItem(null);
4597
- activatorEventRef.current = null;
4598
- return;
4599
- }
4600
- const targetList = registeredLists.get(targetListId);
4601
- const sourceList = registeredLists.get(activeItem.listId);
4602
- if (!targetList || !sourceList) {
4603
- return;
4604
- }
4605
- if (targetIndex < targetList.keys.length && activatorEventPoint) {
4606
- const eventX = activatorEventPoint.x;
4607
- const eventY = activatorEventPoint.y;
4608
- const currentX = eventX + delta.x;
4609
- const currentY = eventY + delta.y;
4610
- const absolutePosition = { x: currentX, y: currentY };
4611
- const indicator = targetList.getDropIndicator({
4612
- absolutePosition,
4613
- active,
4614
- over,
4615
- sourceListId: activeItem.listId,
4616
- targetListId
4617
- });
4618
- if (!indicator) return;
4619
- sourceList.onMoveItem(
4620
- activeItem.index,
4621
- targetIndex,
4622
- indicator,
4623
- activeItem.listId,
4624
- targetListId
4625
- );
4626
- } else if (targetIndex >= targetList.keys.length) {
4627
- const canDrop = targetList.acceptsDrop(
4628
- activeItem.index,
4629
- Math.max(0, targetList.keys.length - 1),
4630
- // Use last valid index or 0 for empty lists
4631
- "below",
4632
- activeItem.listId,
4633
- targetListId
4634
- );
4635
- if (canDrop) {
4636
- sourceList.onMoveItem(
4637
- activeItem.index,
4638
- targetIndex,
4639
- "below",
4640
- activeItem.listId,
4641
- targetListId
4642
- );
4643
- }
4623
+ if (!dropTarget) return;
4624
+ const sourceList = registeredLists.get(dropTarget.source.listId);
4625
+ const targetList = registeredLists.get(dropTarget.target.listId);
4626
+ if (!sourceList || !targetList) return;
4627
+ const parameters = {
4628
+ sourceIndex: dropTarget.source.index,
4629
+ targetIndex: dropTarget.target.index,
4630
+ position: dropTarget.indicator,
4631
+ sourceListId: dropTarget.source.listId,
4632
+ targetListId: dropTarget.target.listId
4633
+ };
4634
+ sourceList.onMoveItem(parameters);
4635
+ if (dropTarget.target.listId !== dropTarget.source.listId) {
4636
+ targetList.onMoveItem(parameters);
4644
4637
  }
4638
+ stableOnMoveItem?.(parameters);
4645
4639
  },
4646
- [activeItem, registeredLists, acceptsListDrop, delta]
4640
+ [registeredLists, dragState.source, stableOnMoveItem]
4647
4641
  );
4648
4642
  const contextValue = React45.useMemo(
4649
4643
  () => ({
4650
- activeItem,
4651
- delta,
4652
4644
  registerList,
4653
4645
  unregisterList
4654
4646
  }),
4655
- [activeItem, delta, registerList, unregisterList]
4647
+ [registerList, unregisterList]
4656
4648
  );
4657
- const activeList = activeItem ? registeredLists.get(activeItem.listId) : null;
4649
+ const activeList = dragState.source ? registeredLists.get(dragState.source.listId) : null;
4658
4650
  const activeDragContextValue = React45.useMemo(
4659
- () => ({ activeItem, delta }),
4660
- [activeItem, delta]
4651
+ () => dragState,
4652
+ [dragState]
4661
4653
  );
4662
4654
  const collisionDetection = useMemo19(() => {
4663
- return getItemFirstCollisionDetection(Array.from(registeredLists.keys()));
4655
+ return getItemFirstCollisionDetection(registeredLists);
4664
4656
  }, [registeredLists]);
4665
- return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(contexts.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(contexts.activeDragContext.Provider, { value: activeDragContextValue }, /* @__PURE__ */ React45.createElement(
4666
- DndContext,
4657
+ return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(sharedDragProps.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(
4658
+ sharedDragProps.activeDragContext.Provider,
4667
4659
  {
4668
- sensors,
4669
- collisionDetection,
4670
- onDragStart: handleDragStart,
4671
- onDragMove: handleDragMove,
4672
- onDragEnd: handleDragEnd
4660
+ value: activeDragContextValue
4673
4661
  },
4674
- children,
4675
- mounted && activeList?.renderOverlay && activeItem && createPortal2(
4676
- /* @__PURE__ */ React45.createElement(DragOverlay, { dropAnimation: null }, activeList.renderOverlay(activeItem.id)),
4677
- document.body
4662
+ /* @__PURE__ */ React45.createElement(
4663
+ DndContext,
4664
+ {
4665
+ sensors,
4666
+ collisionDetection,
4667
+ onDragStart: handleDragStart,
4668
+ onDragMove: handleDragMove,
4669
+ onDragEnd: handleDragEnd
4670
+ },
4671
+ children,
4672
+ mounted && activeList?.renderOverlay && dragState.source && createPortal2(
4673
+ /* @__PURE__ */ React45.createElement(DragOverlay, { dropAnimation: null }, activeList.renderOverlay(dragState.source.itemId)),
4674
+ document.body
4675
+ )
4678
4676
  )
4679
- ))));
4677
+ )));
4680
4678
  }
4681
4679
  function useMounted() {
4682
4680
  const [mounted, setMounted] = React45.useState(false);
@@ -4694,11 +4692,11 @@ function withDragProvider(Component) {
4694
4692
  return /* @__PURE__ */ React45.createElement(Component, { ...props });
4695
4693
  };
4696
4694
  }
4697
- var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
4695
+ var getItemFirstCollisionDetection = (registeredLists) => (parameters) => {
4698
4696
  const pointerCollisions = pointerWithin(parameters);
4699
4697
  if (pointerCollisions.length > 0) {
4700
4698
  const itemCollisions = pointerCollisions.filter((collision) => {
4701
- for (const listId of registeredListIds) {
4699
+ for (const listId of registeredLists.keys()) {
4702
4700
  if (collision.id === listId) {
4703
4701
  return false;
4704
4702
  }
@@ -4709,15 +4707,122 @@ var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
4709
4707
  return itemCollisions;
4710
4708
  }
4711
4709
  }
4712
- return pointerCollisions.length > 0 ? pointerCollisions : closestCenter(parameters);
4710
+ const listCollision = pointerCollisions.at(0);
4711
+ const nearestCenters = closestCenter(parameters);
4712
+ if (parameters.pointerCoordinates && listCollision) {
4713
+ const list = registeredLists.get(listCollision.id);
4714
+ if (list) {
4715
+ const pairs = windowsOf(list.keys, 2);
4716
+ for (const pair of pairs) {
4717
+ const clientRects = pair.map(
4718
+ (key) => parameters.droppableRects.get(key)
4719
+ );
4720
+ const merged = unionRects(
4721
+ ...clientRects.map((rect) => ({
4722
+ x: rect.left,
4723
+ y: rect.top,
4724
+ width: rect.width,
4725
+ height: rect.height
4726
+ }))
4727
+ );
4728
+ if (rectContainsPoint(merged, parameters.pointerCoordinates)) {
4729
+ return nearestCenters.filter(
4730
+ (center) => pair.some((id) => id === center.id)
4731
+ );
4732
+ }
4733
+ }
4734
+ }
4735
+ }
4736
+ return pointerCollisions;
4713
4737
  };
4738
+ function findDropTarget({
4739
+ activationPoint,
4740
+ delta,
4741
+ over,
4742
+ active,
4743
+ source,
4744
+ registeredLists
4745
+ }) {
4746
+ if (!over || active.id === over.id) return;
4747
+ let targetListId = null;
4748
+ let targetIndex = -1;
4749
+ for (const [listId, list] of registeredLists) {
4750
+ const itemIndex = list.keys.findIndex((key) => key === over.id);
4751
+ if (itemIndex >= 0) {
4752
+ targetListId = listId;
4753
+ targetIndex = itemIndex;
4754
+ break;
4755
+ }
4756
+ if (over.id === listId) {
4757
+ targetListId = listId;
4758
+ targetIndex = list.keys.length;
4759
+ break;
4760
+ }
4761
+ }
4762
+ const targetList = targetListId !== null ? registeredLists.get(targetListId) : null;
4763
+ const sourceList = registeredLists.get(source.listId);
4764
+ if (!targetList || !sourceList || !targetList.acceptsFromList({
4765
+ sourceListId: sourceList.id,
4766
+ targetListId: targetList.id
4767
+ })) {
4768
+ return;
4769
+ }
4770
+ if (over.id === targetList.id) {
4771
+ const canDrop = targetList.acceptsDrop({
4772
+ sourceIndex: source.index,
4773
+ targetIndex: Math.max(0, targetList.keys.length - 1),
4774
+ // Use last valid index or 0 for empty lists
4775
+ position: "below",
4776
+ sourceListId: sourceList.id,
4777
+ targetListId: targetList.id
4778
+ });
4779
+ if (canDrop) {
4780
+ return {
4781
+ source,
4782
+ target: {
4783
+ itemId: over.id,
4784
+ listId: targetList.id,
4785
+ index: targetIndex
4786
+ },
4787
+ indicator: "below"
4788
+ };
4789
+ }
4790
+ }
4791
+ const eventX = activationPoint.x;
4792
+ const eventY = activationPoint.y;
4793
+ const currentX = eventX + delta.x;
4794
+ const currentY = eventY + delta.y;
4795
+ const absolutePosition = { x: currentX, y: currentY };
4796
+ const indicator = targetList.getDropIndicator({
4797
+ absolutePosition,
4798
+ active,
4799
+ over,
4800
+ sourceListId: sourceList.id,
4801
+ targetListId: targetList.id
4802
+ });
4803
+ if (indicator) {
4804
+ return {
4805
+ source,
4806
+ target: {
4807
+ itemId: over.id,
4808
+ listId: targetList.id,
4809
+ index: targetIndex
4810
+ },
4811
+ indicator
4812
+ };
4813
+ }
4814
+ }
4714
4815
 
4715
4816
  // src/components/sorting/sorting.ts
4716
4817
  import * as React46 from "react";
4717
4818
  var normalizeListTargetIndex = (index, position) => {
4718
4819
  return position === "above" ? index : index + 1;
4719
4820
  };
4720
- var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
4821
+ var defaultAcceptsDrop = ({
4822
+ sourceIndex,
4823
+ targetIndex,
4824
+ position
4825
+ }) => {
4721
4826
  if (position === "inside") return false;
4722
4827
  const normalized = normalizeListTargetIndex(targetIndex, position);
4723
4828
  if (sourceIndex === normalized || sourceIndex + 1 === normalized) {
@@ -4750,13 +4855,13 @@ function validateDropIndicator({
4750
4855
  const overIndex = keys.findIndex((id) => id === overId);
4751
4856
  if (overIndex === -1) return void 0;
4752
4857
  if (activeIndex === -1 && sourceListId === targetListId) return void 0;
4753
- const acceptsDropInside = acceptsDrop2(
4754
- activeIndex,
4755
- overIndex,
4756
- "inside",
4858
+ const acceptsDropInside = acceptsDrop2({
4859
+ sourceIndex: activeIndex,
4860
+ targetIndex: overIndex,
4861
+ position: "inside",
4757
4862
  sourceListId,
4758
4863
  targetListId
4759
- );
4864
+ });
4760
4865
  if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
4761
4866
  return "inside";
4762
4867
  }
@@ -4765,13 +4870,13 @@ function validateDropIndicator({
4765
4870
  elementSize,
4766
4871
  offsetStart
4767
4872
  );
4768
- const acceptedHalf = acceptsDrop2(
4769
- activeIndex,
4770
- overIndex,
4771
- containingHalf,
4873
+ const acceptedHalf = acceptsDrop2({
4874
+ sourceIndex: activeIndex,
4875
+ targetIndex: overIndex,
4876
+ position: containingHalf,
4772
4877
  sourceListId,
4773
4878
  targetListId
4774
- );
4879
+ });
4775
4880
  return acceptedHalf ? containingHalf : (
4776
4881
  // Lastly, check if inside but not middle third
4777
4882
  acceptsDropInside ? "inside" : void 0
@@ -4784,80 +4889,75 @@ function getContainingHalf(elementStart, elementSize, offsetStart) {
4784
4889
  if (offsetStart < elementStart + elementSize / 2) return "above";
4785
4890
  return "below";
4786
4891
  }
4892
+ var dragItemKeySeparator = "-~-";
4893
+ function createDragItemKey(listId, itemId) {
4894
+ return `${listId}${dragItemKeySeparator}${itemId}`;
4895
+ }
4896
+ function parseDragItemKey(key) {
4897
+ const [listId, itemId] = key.split(dragItemKeySeparator);
4898
+ return { listId, itemId };
4899
+ }
4787
4900
 
4788
4901
  // src/components/sorting/Sortable.tsx
4789
4902
  var SortableItemContext2 = React47.createContext({
4790
- keys: [],
4791
4903
  acceptsDrop: defaultAcceptsDrop,
4792
- axis: "y",
4793
4904
  listId: "",
4794
4905
  getDropTargetParentIndex: void 0,
4795
4906
  activeDragContext: ActiveDragContext
4796
4907
  });
4797
4908
  function useSortableDropIndicator({
4798
- id,
4799
4909
  index,
4800
- isDragging,
4801
- overIndex,
4802
- activeIndex,
4803
- keys,
4804
- acceptsDrop: acceptsDrop2,
4805
- axis,
4910
+ itemId,
4806
4911
  listId,
4912
+ acceptsDrop: acceptsDrop2,
4807
4913
  getDropTargetParentIndex
4808
4914
  }) {
4809
- const { active, over, activatorEvent } = useDndContext();
4810
4915
  const { activeDragContext } = React47.useContext(SortableItemContext2);
4811
- const { activeItem, delta: position } = useActiveDrag(activeDragContext);
4812
- if (index < 0 || isDragging || !active || !over || !activeItem || !// Same-list drop: check normal overIndex matching
4813
- (activeItem.listId === listId && index === overIndex || // Cross-list drop: check if we're hovering over this specific item
4814
- activeItem.listId !== listId && over.id === id)) {
4815
- return void 0;
4916
+ const activeDrag = useActiveDrag(activeDragContext);
4917
+ const { source, target } = activeDrag;
4918
+ if (!source || !target) return;
4919
+ if (target.listId === listId && target.itemId === itemId) {
4920
+ return activeDrag.indicator ?? void 0;
4816
4921
  }
4817
- const isCrossContainer = activeItem.listId !== listId;
4818
- const validationKeys = isCrossContainer ? [active.id, ...keys] : keys;
4819
- const eventX = activatorEvent?.clientX ?? 0;
4820
- const eventY = activatorEvent?.clientY ?? 0;
4821
- const offsetLeft = eventX + position.x;
4822
- const offsetTop = eventY + position.y;
4823
- const parentIndex = overIndex === -1 ? void 0 : getDropTargetParentIndex?.(overIndex);
4824
- const isValidParent = parentIndex === void 0 || parentIndex === -1 ? false : acceptsDrop2(activeIndex, parentIndex, "inside", listId, listId);
4825
- const overIdAcceptsDrop = overIndex === -1 ? void 0 : acceptsDrop2(activeIndex, overIndex, "inside", listId, listId);
4826
- const relativeDropPosition = index >= 0 && index === overIndex && !isDragging && active && over ? validateDropIndicator({
4827
- acceptsDrop: acceptsDrop2,
4828
- keys: validationKeys,
4829
- activeId: active.id,
4830
- overId: over.id,
4831
- offsetStart: axis === "x" ? offsetLeft : offsetTop,
4832
- elementStart: axis === "x" ? over.rect.left : over.rect.top,
4833
- elementSize: axis === "x" ? over.rect.width : over.rect.height,
4834
- sourceListId: listId,
4835
- targetListId: listId
4836
- }) : void 0;
4837
- const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && parentIndex === index;
4838
- return relativeDropPosition ?? (showDragInsideIndicatorOnParent ? "inside" : void 0);
4922
+ const targetParentIndex = target.index === -1 ? void 0 : getDropTargetParentIndex?.(target.index);
4923
+ const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2({
4924
+ sourceIndex: source.index,
4925
+ targetIndex: targetParentIndex,
4926
+ position: "inside",
4927
+ sourceListId: source.listId,
4928
+ targetListId: target.listId
4929
+ });
4930
+ const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2({
4931
+ sourceIndex: source.index,
4932
+ targetIndex: target.index,
4933
+ position: "inside",
4934
+ sourceListId: source.listId,
4935
+ targetListId: target.listId
4936
+ });
4937
+ const thisItemIsTargetParent = targetParentIndex === index;
4938
+ const showIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
4939
+ return showIndicatorOnParent ? "inside" : void 0;
4839
4940
  }
4840
4941
  function SortableItem({
4841
4942
  id,
4842
4943
  disabled,
4843
4944
  children
4844
4945
  }) {
4845
- const { keys, acceptsDrop: acceptsDrop2, axis, listId, getDropTargetParentIndex } = React47.useContext(SortableItemContext2);
4846
- const { attributes, listeners, setNodeRef, isDragging, index, overIndex } = useSortable({ id, disabled });
4946
+ const { acceptsDrop: acceptsDrop2, listId, getDropTargetParentIndex } = React47.useContext(SortableItemContext2);
4947
+ const dragItemKey = createDragItemKey(listId, id);
4948
+ const { attributes, listeners, setNodeRef, isDragging, index } = useSortable({
4949
+ id: dragItemKey,
4950
+ disabled
4951
+ });
4847
4952
  const ref = React47.useCallback(
4848
4953
  (node) => setNodeRef(node),
4849
4954
  [setNodeRef]
4850
4955
  );
4851
4956
  const relativeDropPosition = useSortableDropIndicator({
4852
- id,
4853
4957
  index,
4854
- isDragging,
4855
- overIndex,
4856
- keys,
4857
- acceptsDrop: acceptsDrop2,
4858
- axis,
4958
+ itemId: dragItemKey,
4859
4959
  listId,
4860
- activeIndex: index,
4960
+ acceptsDrop: acceptsDrop2,
4861
4961
  getDropTargetParentIndex
4862
4962
  });
4863
4963
  return children({
@@ -4872,7 +4972,7 @@ function SortableItem({
4872
4972
  }
4873
4973
  function SortableRoot_({
4874
4974
  id: idProp,
4875
- keys,
4975
+ keys: keysProp,
4876
4976
  onMoveItem,
4877
4977
  renderOverlay,
4878
4978
  acceptsFromList,
@@ -4880,22 +4980,19 @@ function SortableRoot_({
4880
4980
  axis = "y",
4881
4981
  children,
4882
4982
  getDropTargetParentIndex,
4883
- sharedDragProviderContexts,
4983
+ sharedDragProps,
4884
4984
  containerRef
4885
4985
  }) {
4886
4986
  const defaultId = React47.useId();
4887
4987
  const id = idProp ?? defaultId;
4988
+ const keys = React47.useMemo(() => {
4989
+ return keysProp.map((key) => createDragItemKey(id, key));
4990
+ }, [keysProp, id]);
4888
4991
  const { registerList, unregisterList } = useDragRegistration(
4889
- sharedDragProviderContexts?.dragRegistrationContext ?? DragRegistrationContext
4992
+ sharedDragProps?.dragRegistrationContext ?? DragRegistrationContext
4890
4993
  );
4891
4994
  const { setNodeRef: setDroppableRef } = useDroppable({
4892
- id,
4893
- // Make the container droppable only when the list is empty
4894
- // This avoids conflicts with individual sortable items.
4895
- // This isn't strictly necessary since we also use a custom collision detection
4896
- // that prioritizes items over containers, but it helps with dropping into
4897
- // the best position (either above or below, rather than always below).
4898
- disabled: keys.length > 0
4995
+ id
4899
4996
  });
4900
4997
  React47.useEffect(() => {
4901
4998
  const listConfig = {
@@ -4907,7 +5004,7 @@ function SortableRoot_({
4907
5004
  const index = keys.findIndex((key) => key === id2);
4908
5005
  return renderOverlay?.(index) ?? null;
4909
5006
  },
4910
- acceptsFromList: acceptsFromList ?? (({ sourceListId, targetListId }) => sourceListId === targetListId),
5007
+ acceptsFromList: acceptsFromList ?? (() => true),
4911
5008
  acceptsDrop: acceptsDrop2,
4912
5009
  getDropIndicator: (parameters) => {
4913
5010
  const { absolutePosition, active, over, sourceListId, targetListId } = parameters;
@@ -4947,19 +5044,11 @@ function SortableRoot_({
4947
5044
  () => ({
4948
5045
  keys,
4949
5046
  acceptsDrop: acceptsDrop2,
4950
- axis,
4951
5047
  listId: id,
4952
5048
  getDropTargetParentIndex,
4953
- activeDragContext: sharedDragProviderContexts?.activeDragContext ?? ActiveDragContext
5049
+ activeDragContext: sharedDragProps?.activeDragContext ?? ActiveDragContext
4954
5050
  }),
4955
- [
4956
- keys,
4957
- acceptsDrop2,
4958
- axis,
4959
- id,
4960
- getDropTargetParentIndex,
4961
- sharedDragProviderContexts
4962
- ]
5051
+ [keys, acceptsDrop2, id, getDropTargetParentIndex, sharedDragProps]
4963
5052
  );
4964
5053
  React47.useEffect(() => {
4965
5054
  if (containerRef) {
@@ -5069,7 +5158,7 @@ function ListViewEditableRowTitle({
5069
5158
  onKeyDown
5070
5159
  }) {
5071
5160
  const inputRef = useRef19(null);
5072
- useLayoutEffect5(() => {
5161
+ useLayoutEffect6(() => {
5073
5162
  const element = inputRef.current;
5074
5163
  if (!element || !autoFocus) return;
5075
5164
  element.focus();
@@ -5393,7 +5482,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
5393
5482
  listRef.current?.scrollToItem(index);
5394
5483
  }
5395
5484
  }));
5396
- useLayoutEffect5(() => {
5485
+ useLayoutEffect6(() => {
5397
5486
  listRef.current?.resetAfterIndex(0);
5398
5487
  }, [
5399
5488
  // When items change, we need to re-render the virtualized list,
@@ -5483,7 +5572,9 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
5483
5572
  onDragLeave,
5484
5573
  onDrop,
5485
5574
  renderEmptyState,
5486
- getDropTargetParentIndex
5575
+ getDropTargetParentIndex,
5576
+ sharedDragProps,
5577
+ sortableId
5487
5578
  }, forwardedRef) {
5488
5579
  const handleClick = useCallback23(
5489
5580
  (event) => {
@@ -5607,11 +5698,13 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
5607
5698
  const withSortable = (children) => sortable ? /* @__PURE__ */ React48.createElement(
5608
5699
  Sortable.Root,
5609
5700
  {
5701
+ id: sortableId,
5610
5702
  onMoveItem,
5611
5703
  keys: ids,
5612
5704
  renderOverlay,
5613
5705
  acceptsDrop: acceptsDrop2,
5614
- getDropTargetParentIndex
5706
+ getDropTargetParentIndex,
5707
+ sharedDragProps
5615
5708
  },
5616
5709
  children
5617
5710
  ) : children;
@@ -5804,7 +5897,9 @@ var List = memoGeneric(
5804
5897
  getDropTargetParentIndex,
5805
5898
  getPlaceholder,
5806
5899
  onClickItem,
5807
- dragIndicatorStyle
5900
+ dragIndicatorStyle,
5901
+ sortableId,
5902
+ sharedDragProps
5808
5903
  } = props;
5809
5904
  const [internalHoveredId, setHoveredId] = useState23();
5810
5905
  const [internalRenamingId, setRenamingId] = useState23();
@@ -5865,6 +5960,8 @@ var List = memoGeneric(
5865
5960
  onMoveItem,
5866
5961
  renderEmptyState,
5867
5962
  getDropTargetParentIndex,
5963
+ sharedDragProps,
5964
+ sortableId,
5868
5965
  ...dropTargetProps,
5869
5966
  renderItem: (item, _, { isDragOverlay }) => {
5870
5967
  const id = getId(item);
@@ -6149,7 +6246,7 @@ function ColorSwatchControl(props) {
6149
6246
  import { DropdownChevronIcon as DropdownChevronIcon2 } from "@noya-app/noya-icons";
6150
6247
  import React55, {
6151
6248
  useCallback as useCallback25,
6152
- useEffect as useEffect18,
6249
+ useEffect as useEffect19,
6153
6250
  useImperativeHandle as useImperativeHandle6,
6154
6251
  useMemo as useMemo23,
6155
6252
  useRef as useRef21,
@@ -6637,15 +6734,15 @@ var Combobox = memoGeneric(
6637
6734
  const { fieldId: id } = useLabel({
6638
6735
  fieldId: rest.id
6639
6736
  });
6640
- useEffect18(() => {
6737
+ useEffect19(() => {
6641
6738
  comboboxState.setItems(items);
6642
6739
  }, [items, comboboxState]);
6643
- useEffect18(() => {
6740
+ useEffect19(() => {
6644
6741
  comboboxState.setFilter(initialValueString);
6645
6742
  }, [comboboxState, initialValueString]);
6646
6743
  const { filter, selectedIndex, filteredItems } = state;
6647
6744
  const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
6648
- useEffect18(() => {
6745
+ useEffect19(() => {
6649
6746
  if (listRef.current) {
6650
6747
  listRef.current.scrollToIndex(selectedIndex);
6651
6748
  }
@@ -6858,7 +6955,7 @@ var Combobox = memoGeneric(
6858
6955
  comboboxState
6859
6956
  ]
6860
6957
  );
6861
- useEffect18(() => {
6958
+ useEffect19(() => {
6862
6959
  if (!shouldBlur) return;
6863
6960
  if (document.activeElement !== ref.current) return;
6864
6961
  setShouldBlur(false);
@@ -6982,7 +7079,7 @@ import { getCurrentPlatform as getCurrentPlatform2, handleKeyboardEvent } from "
6982
7079
  import React57, {
6983
7080
  forwardRef as forwardRef21,
6984
7081
  useCallback as useCallback26,
6985
- useEffect as useEffect19,
7082
+ useEffect as useEffect20,
6986
7083
  useImperativeHandle as useImperativeHandle7,
6987
7084
  useMemo as useMemo24,
6988
7085
  useRef as useRef22,
@@ -7061,7 +7158,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
7061
7158
  const { index, search } = state;
7062
7159
  const listRef = React57.useRef(null);
7063
7160
  const hasCheckedItems = items.some((item) => item.checked);
7064
- useEffect19(() => {
7161
+ useEffect20(() => {
7065
7162
  listRef.current?.scrollToIndex(index);
7066
7163
  }, [index]);
7067
7164
  const results = useMemo24(
@@ -7082,7 +7179,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
7082
7179
  const setIndex = useCallback26((index2) => {
7083
7180
  setState((state2) => ({ ...state2, index: index2 }));
7084
7181
  }, []);
7085
- useEffect19(() => {
7182
+ useEffect20(() => {
7086
7183
  onHover?.(results[index]);
7087
7184
  }, [index, onHover, results]);
7088
7185
  const searchHeight = 31;
@@ -7857,14 +7954,14 @@ function useImageData(ref) {
7857
7954
  }
7858
7955
 
7859
7956
  // src/hooks/useObjectURL.ts
7860
- import { useLayoutEffect as useLayoutEffect6, useMemo as useMemo26 } from "react";
7957
+ import { useLayoutEffect as useLayoutEffect7, useMemo as useMemo26 } from "react";
7861
7958
  function useObjectURL(object) {
7862
7959
  const objectURL = useMemo26(() => {
7863
7960
  if (object instanceof Blob) return URL.createObjectURL(object);
7864
7961
  const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
7865
7962
  return URL.createObjectURL(new Blob([bytes]));
7866
7963
  }, [object]);
7867
- useLayoutEffect6(() => {
7964
+ useLayoutEffect7(() => {
7868
7965
  return () => URL.revokeObjectURL(objectURL);
7869
7966
  }, [objectURL]);
7870
7967
  return objectURL;
@@ -11767,24 +11864,15 @@ function createSharedDrag() {
11767
11864
  const activeDragContext = React82.createContext(
11768
11865
  null
11769
11866
  );
11770
- const Provider3 = ({ children }) => /* @__PURE__ */ React82.createElement(
11771
- SharedDragProvider,
11772
- {
11773
- contexts: {
11774
- dragRegistrationContext,
11775
- activeDragContext
11776
- }
11777
- },
11778
- children
11779
- );
11780
- const dragProps = {
11867
+ const sharedDragProps = {
11781
11868
  dragRegistrationContext,
11782
11869
  activeDragContext
11783
11870
  };
11871
+ const Provider3 = ({ children }) => /* @__PURE__ */ React82.createElement(SharedDragProvider, { sharedDragProps }, children);
11784
11872
  return {
11785
11873
  Provider: Provider3,
11786
- Sortable: (props) => /* @__PURE__ */ React82.createElement(Sortable, { sharedDragProviderContexts: dragProps, ...props }),
11787
- props: dragProps
11874
+ Sortable: (props) => /* @__PURE__ */ React82.createElement(Sortable, { sharedDragProps, ...props }),
11875
+ props: sharedDragProps
11788
11876
  };
11789
11877
  }
11790
11878
 
@@ -11970,7 +12058,7 @@ import React88, {
11970
12058
  } from "react";
11971
12059
 
11972
12060
  // src/hooks/useWindowSize.tsx
11973
- import { useEffect as useEffect20, useState as useState29 } from "react";
12061
+ import { useEffect as useEffect21, useState as useState29 } from "react";
11974
12062
  function useWindowSize() {
11975
12063
  const [size2, setSize] = useState29(
11976
12064
  typeof window === "undefined" ? { width: 0, height: 0 } : {
@@ -11978,7 +12066,7 @@ function useWindowSize() {
11978
12066
  height: window.innerHeight
11979
12067
  }
11980
12068
  );
11981
- useEffect20(() => {
12069
+ useEffect21(() => {
11982
12070
  const handleResize = () => setSize({
11983
12071
  width: window.innerWidth,
11984
12072
  height: window.innerHeight
@@ -11990,10 +12078,10 @@ function useWindowSize() {
11990
12078
  }
11991
12079
 
11992
12080
  // src/components/workspace/DrawerWorkspaceLayout.tsx
11993
- import React86, { memo as memo36, useLayoutEffect as useLayoutEffect9, useRef as useRef26, useState as useState30 } from "react";
12081
+ import React86, { memo as memo36, useLayoutEffect as useLayoutEffect10, useRef as useRef26, useState as useState30 } from "react";
11994
12082
 
11995
12083
  // src/hooks/usePreservePanelSize.tsx
11996
- import { useLayoutEffect as useLayoutEffect8, useRef as useRef25 } from "react";
12084
+ import { useLayoutEffect as useLayoutEffect9, useRef as useRef25 } from "react";
11997
12085
  var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
11998
12086
  var LEFT_SIDEBAR_ID = "editor-left-sidebar";
11999
12087
  var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
@@ -12001,7 +12089,7 @@ var CONTENT_AREA_ID = "editor-content-area";
12001
12089
  function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12002
12090
  const windowSize = useWindowSize();
12003
12091
  const layoutRef = useRef25();
12004
- useLayoutEffect8(() => {
12092
+ useLayoutEffect9(() => {
12005
12093
  const panelGroup = document.querySelector(
12006
12094
  `[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
12007
12095
  );
@@ -12044,7 +12132,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12044
12132
  panelGroupObserver.disconnect();
12045
12133
  };
12046
12134
  }, [panelGroupRef, setPanelLayoutState]);
12047
- useLayoutEffect8(() => {
12135
+ useLayoutEffect9(() => {
12048
12136
  if (!layoutRef.current) return;
12049
12137
  const {
12050
12138
  windowWidth: oldWindowWidth,
@@ -12141,7 +12229,7 @@ var DrawerWorkspaceLayout = memo36(function DrawerWorkspaceLayout2({
12141
12229
  }) {
12142
12230
  const portalContainer = useRef26(null);
12143
12231
  const [mounted, setMounted] = useState30(false);
12144
- useLayoutEffect9(() => {
12232
+ useLayoutEffect10(() => {
12145
12233
  if (mounted) return;
12146
12234
  setMounted(true);
12147
12235
  handleChangeLayoutState({
@@ -12482,7 +12570,7 @@ function usePlatformModKey() {
12482
12570
  }
12483
12571
 
12484
12572
  // src/hooks/useTheme.ts
12485
- import { useState as useState32, useEffect as useEffect21 } from "react";
12573
+ import { useState as useState32, useEffect as useEffect22 } from "react";
12486
12574
  function useTheme() {
12487
12575
  const [theme, setTheme] = useState32("light");
12488
12576
  const checkTheme = () => {
@@ -12496,7 +12584,7 @@ function useTheme() {
12496
12584
  break;
12497
12585
  }
12498
12586
  };
12499
- useEffect21(() => {
12587
+ useEffect22(() => {
12500
12588
  checkTheme();
12501
12589
  const observer = new MutationObserver((mutations) => {
12502
12590
  mutations.forEach((mutation) => {
@@ -12598,13 +12686,13 @@ function acceptsDrop({
12598
12686
  if (!allowSiblings) {
12599
12687
  return false;
12600
12688
  }
12601
- return defaultAcceptsDrop(
12602
- sourceIndexPath.at(-1),
12603
- targetIndexPath.at(-1),
12689
+ return defaultAcceptsDrop({
12690
+ sourceIndex: sourceIndexPath.at(-1),
12691
+ targetIndex: targetIndexPath.at(-1),
12604
12692
  position,
12605
- "",
12606
- ""
12607
- );
12693
+ sourceListId: "",
12694
+ targetListId: ""
12695
+ });
12608
12696
  }
12609
12697
  return true;
12610
12698
  }
@@ -13067,12 +13155,14 @@ export {
13067
13155
  colorForStringValues,
13068
13156
  colorFromString,
13069
13157
  colorSwatchSizeMap,
13158
+ createDragItemKey,
13070
13159
  createSectionedMenu,
13071
13160
  createSharedDrag,
13072
13161
  cssVarNames,
13073
13162
  cssVars,
13074
13163
  cx,
13075
13164
  defaultAcceptsDrop,
13165
+ dragItemKeySeparator,
13076
13166
  filterWithGroupedSections,
13077
13167
  fuzzyFilter,
13078
13168
  fuzzyScore,
@@ -13097,6 +13187,7 @@ export {
13097
13187
  mergeConflictingClassNames,
13098
13188
  moveTreeItem,
13099
13189
  normalizeListTargetIndex,
13190
+ parseDragItemKey,
13100
13191
  popoverStyle,
13101
13192
  portalScopeDataSetName,
13102
13193
  portalScopePropName,