@noya-app/noya-designsystem 0.1.57 → 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";
@@ -4510,11 +4525,14 @@ 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,
4535
+ onMoveItem,
4518
4536
  sharedDragProps = {
4519
4537
  dragRegistrationContext: DragRegistrationContext,
4520
4538
  activeDragContext: ActiveDragContext
@@ -4580,6 +4598,7 @@ function SharedDragProvider({
4580
4598
  },
4581
4599
  [registeredLists, dragState.source]
4582
4600
  );
4601
+ const stableOnMoveItem = useStableCallback(onMoveItem);
4583
4602
  const handleDragEnd = React45.useCallback(
4584
4603
  (event) => {
4585
4604
  const { active, over } = event;
@@ -4605,15 +4624,20 @@ function SharedDragProvider({
4605
4624
  const sourceList = registeredLists.get(dropTarget.source.listId);
4606
4625
  const targetList = registeredLists.get(dropTarget.target.listId);
4607
4626
  if (!sourceList || !targetList) return;
4608
- sourceList.onMoveItem(
4609
- dropTarget.source.index,
4610
- dropTarget.target.index,
4611
- dropTarget.indicator,
4612
- dropTarget.source.listId,
4613
- dropTarget.target.listId
4614
- );
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);
4637
+ }
4638
+ stableOnMoveItem?.(parameters);
4615
4639
  },
4616
- [registeredLists, dragState.source]
4640
+ [registeredLists, dragState.source, stableOnMoveItem]
4617
4641
  );
4618
4642
  const contextValue = React45.useMemo(
4619
4643
  () => ({
@@ -4628,7 +4652,7 @@ function SharedDragProvider({
4628
4652
  [dragState]
4629
4653
  );
4630
4654
  const collisionDetection = useMemo19(() => {
4631
- return getItemFirstCollisionDetection(Array.from(registeredLists.keys()));
4655
+ return getItemFirstCollisionDetection(registeredLists);
4632
4656
  }, [registeredLists]);
4633
4657
  return /* @__PURE__ */ React45.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React45.createElement(sharedDragProps.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React45.createElement(
4634
4658
  sharedDragProps.activeDragContext.Provider,
@@ -4668,11 +4692,11 @@ function withDragProvider(Component) {
4668
4692
  return /* @__PURE__ */ React45.createElement(Component, { ...props });
4669
4693
  };
4670
4694
  }
4671
- var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
4695
+ var getItemFirstCollisionDetection = (registeredLists) => (parameters) => {
4672
4696
  const pointerCollisions = pointerWithin(parameters);
4673
4697
  if (pointerCollisions.length > 0) {
4674
4698
  const itemCollisions = pointerCollisions.filter((collision) => {
4675
- for (const listId of registeredListIds) {
4699
+ for (const listId of registeredLists.keys()) {
4676
4700
  if (collision.id === listId) {
4677
4701
  return false;
4678
4702
  }
@@ -4683,7 +4707,33 @@ var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
4683
4707
  return itemCollisions;
4684
4708
  }
4685
4709
  }
4686
- 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;
4687
4737
  };
4688
4738
  function findDropTarget({
4689
4739
  activationPoint,
@@ -4718,14 +4768,14 @@ function findDropTarget({
4718
4768
  return;
4719
4769
  }
4720
4770
  if (over.id === targetList.id) {
4721
- const canDrop = targetList.acceptsDrop(
4722
- source.index,
4723
- Math.max(0, targetList.keys.length - 1),
4771
+ const canDrop = targetList.acceptsDrop({
4772
+ sourceIndex: source.index,
4773
+ targetIndex: Math.max(0, targetList.keys.length - 1),
4724
4774
  // Use last valid index or 0 for empty lists
4725
- "below",
4726
- sourceList.id,
4727
- targetList.id
4728
- );
4775
+ position: "below",
4776
+ sourceListId: sourceList.id,
4777
+ targetListId: targetList.id
4778
+ });
4729
4779
  if (canDrop) {
4730
4780
  return {
4731
4781
  source,
@@ -4768,7 +4818,11 @@ import * as React46 from "react";
4768
4818
  var normalizeListTargetIndex = (index, position) => {
4769
4819
  return position === "above" ? index : index + 1;
4770
4820
  };
4771
- var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
4821
+ var defaultAcceptsDrop = ({
4822
+ sourceIndex,
4823
+ targetIndex,
4824
+ position
4825
+ }) => {
4772
4826
  if (position === "inside") return false;
4773
4827
  const normalized = normalizeListTargetIndex(targetIndex, position);
4774
4828
  if (sourceIndex === normalized || sourceIndex + 1 === normalized) {
@@ -4801,13 +4855,13 @@ function validateDropIndicator({
4801
4855
  const overIndex = keys.findIndex((id) => id === overId);
4802
4856
  if (overIndex === -1) return void 0;
4803
4857
  if (activeIndex === -1 && sourceListId === targetListId) return void 0;
4804
- const acceptsDropInside = acceptsDrop2(
4805
- activeIndex,
4806
- overIndex,
4807
- "inside",
4858
+ const acceptsDropInside = acceptsDrop2({
4859
+ sourceIndex: activeIndex,
4860
+ targetIndex: overIndex,
4861
+ position: "inside",
4808
4862
  sourceListId,
4809
4863
  targetListId
4810
- );
4864
+ });
4811
4865
  if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
4812
4866
  return "inside";
4813
4867
  }
@@ -4816,16 +4870,13 @@ function validateDropIndicator({
4816
4870
  elementSize,
4817
4871
  offsetStart
4818
4872
  );
4819
- if (!isContained(elementStart, elementSize, offsetStart) && sourceListId === targetListId) {
4820
- return void 0;
4821
- }
4822
- const acceptedHalf = acceptsDrop2(
4823
- activeIndex,
4824
- overIndex,
4825
- containingHalf,
4873
+ const acceptedHalf = acceptsDrop2({
4874
+ sourceIndex: activeIndex,
4875
+ targetIndex: overIndex,
4876
+ position: containingHalf,
4826
4877
  sourceListId,
4827
4878
  targetListId
4828
- );
4879
+ });
4829
4880
  return acceptedHalf ? containingHalf : (
4830
4881
  // Lastly, check if inside but not middle third
4831
4882
  acceptsDropInside ? "inside" : void 0
@@ -4834,18 +4885,16 @@ function validateDropIndicator({
4834
4885
  function isContainedInMiddleThird(elementStart, elementSize, offsetStart) {
4835
4886
  return offsetStart >= elementStart + elementSize / 3 && offsetStart <= elementStart + elementSize * 2 / 3;
4836
4887
  }
4837
- function isContained(elementStart, elementSize, offsetStart) {
4838
- return offsetStart >= elementStart && offsetStart <= elementStart + elementSize;
4839
- }
4840
4888
  function getContainingHalf(elementStart, elementSize, offsetStart) {
4841
4889
  if (offsetStart < elementStart + elementSize / 2) return "above";
4842
4890
  return "below";
4843
4891
  }
4892
+ var dragItemKeySeparator = "-~-";
4844
4893
  function createDragItemKey(listId, itemId) {
4845
- return `${listId}-~-${itemId}`;
4894
+ return `${listId}${dragItemKeySeparator}${itemId}`;
4846
4895
  }
4847
4896
  function parseDragItemKey(key) {
4848
- const [listId, itemId] = key.split("-~-");
4897
+ const [listId, itemId] = key.split(dragItemKeySeparator);
4849
4898
  return { listId, itemId };
4850
4899
  }
4851
4900
 
@@ -4867,25 +4916,27 @@ function useSortableDropIndicator({
4867
4916
  const activeDrag = useActiveDrag(activeDragContext);
4868
4917
  const { source, target } = activeDrag;
4869
4918
  if (!source || !target) return;
4870
- const indicator = target.listId === listId && target.itemId === itemId ? activeDrag.indicator : void 0;
4919
+ if (target.listId === listId && target.itemId === itemId) {
4920
+ return activeDrag.indicator ?? void 0;
4921
+ }
4871
4922
  const targetParentIndex = target.index === -1 ? void 0 : getDropTargetParentIndex?.(target.index);
4872
- const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2(
4873
- source.index,
4874
- targetParentIndex,
4875
- "inside",
4876
- source.listId,
4877
- target.listId
4878
- );
4879
- const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2(
4880
- source.index,
4881
- target.index,
4882
- "inside",
4883
- source.listId,
4884
- target.listId
4885
- );
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
+ });
4886
4937
  const thisItemIsTargetParent = targetParentIndex === index;
4887
- const showDragInsideIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
4888
- return indicator ?? (showDragInsideIndicatorOnParent ? "inside" : void 0);
4938
+ const showIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
4939
+ return showIndicatorOnParent ? "inside" : void 0;
4889
4940
  }
4890
4941
  function SortableItem({
4891
4942
  id,
@@ -4941,13 +4992,7 @@ function SortableRoot_({
4941
4992
  sharedDragProps?.dragRegistrationContext ?? DragRegistrationContext
4942
4993
  );
4943
4994
  const { setNodeRef: setDroppableRef } = useDroppable({
4944
- id,
4945
- // Make the container droppable only when the list is empty
4946
- // This avoids conflicts with individual sortable items.
4947
- // This isn't strictly necessary since we also use a custom collision detection
4948
- // that prioritizes items over containers, but it helps with dropping into
4949
- // the best position (either above or below, rather than always below).
4950
- disabled: keys.length > 0
4995
+ id
4951
4996
  });
4952
4997
  React47.useEffect(() => {
4953
4998
  const listConfig = {
@@ -5113,7 +5158,7 @@ function ListViewEditableRowTitle({
5113
5158
  onKeyDown
5114
5159
  }) {
5115
5160
  const inputRef = useRef19(null);
5116
- useLayoutEffect5(() => {
5161
+ useLayoutEffect6(() => {
5117
5162
  const element = inputRef.current;
5118
5163
  if (!element || !autoFocus) return;
5119
5164
  element.focus();
@@ -5437,7 +5482,7 @@ var VirtualizedListInner = forwardRefGeneric(function VirtualizedListInner2({
5437
5482
  listRef.current?.scrollToItem(index);
5438
5483
  }
5439
5484
  }));
5440
- useLayoutEffect5(() => {
5485
+ useLayoutEffect6(() => {
5441
5486
  listRef.current?.resetAfterIndex(0);
5442
5487
  }, [
5443
5488
  // When items change, we need to re-render the virtualized list,
@@ -6201,7 +6246,7 @@ function ColorSwatchControl(props) {
6201
6246
  import { DropdownChevronIcon as DropdownChevronIcon2 } from "@noya-app/noya-icons";
6202
6247
  import React55, {
6203
6248
  useCallback as useCallback25,
6204
- useEffect as useEffect18,
6249
+ useEffect as useEffect19,
6205
6250
  useImperativeHandle as useImperativeHandle6,
6206
6251
  useMemo as useMemo23,
6207
6252
  useRef as useRef21,
@@ -6689,15 +6734,15 @@ var Combobox = memoGeneric(
6689
6734
  const { fieldId: id } = useLabel({
6690
6735
  fieldId: rest.id
6691
6736
  });
6692
- useEffect18(() => {
6737
+ useEffect19(() => {
6693
6738
  comboboxState.setItems(items);
6694
6739
  }, [items, comboboxState]);
6695
- useEffect18(() => {
6740
+ useEffect19(() => {
6696
6741
  comboboxState.setFilter(initialValueString);
6697
6742
  }, [comboboxState, initialValueString]);
6698
6743
  const { filter, selectedIndex, filteredItems } = state;
6699
6744
  const shouldShowMenu = isFocused && !(hideMenuWhenEmptyValue && filter === "");
6700
- useEffect18(() => {
6745
+ useEffect19(() => {
6701
6746
  if (listRef.current) {
6702
6747
  listRef.current.scrollToIndex(selectedIndex);
6703
6748
  }
@@ -6910,7 +6955,7 @@ var Combobox = memoGeneric(
6910
6955
  comboboxState
6911
6956
  ]
6912
6957
  );
6913
- useEffect18(() => {
6958
+ useEffect19(() => {
6914
6959
  if (!shouldBlur) return;
6915
6960
  if (document.activeElement !== ref.current) return;
6916
6961
  setShouldBlur(false);
@@ -7034,7 +7079,7 @@ import { getCurrentPlatform as getCurrentPlatform2, handleKeyboardEvent } from "
7034
7079
  import React57, {
7035
7080
  forwardRef as forwardRef21,
7036
7081
  useCallback as useCallback26,
7037
- useEffect as useEffect19,
7082
+ useEffect as useEffect20,
7038
7083
  useImperativeHandle as useImperativeHandle7,
7039
7084
  useMemo as useMemo24,
7040
7085
  useRef as useRef22,
@@ -7113,7 +7158,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
7113
7158
  const { index, search } = state;
7114
7159
  const listRef = React57.useRef(null);
7115
7160
  const hasCheckedItems = items.some((item) => item.checked);
7116
- useEffect19(() => {
7161
+ useEffect20(() => {
7117
7162
  listRef.current?.scrollToIndex(index);
7118
7163
  }, [index]);
7119
7164
  const results = useMemo24(
@@ -7134,7 +7179,7 @@ var SearchCompletionMenu = forwardRef21(function SearchCompletionMenu2({
7134
7179
  const setIndex = useCallback26((index2) => {
7135
7180
  setState((state2) => ({ ...state2, index: index2 }));
7136
7181
  }, []);
7137
- useEffect19(() => {
7182
+ useEffect20(() => {
7138
7183
  onHover?.(results[index]);
7139
7184
  }, [index, onHover, results]);
7140
7185
  const searchHeight = 31;
@@ -7909,14 +7954,14 @@ function useImageData(ref) {
7909
7954
  }
7910
7955
 
7911
7956
  // src/hooks/useObjectURL.ts
7912
- import { useLayoutEffect as useLayoutEffect6, useMemo as useMemo26 } from "react";
7957
+ import { useLayoutEffect as useLayoutEffect7, useMemo as useMemo26 } from "react";
7913
7958
  function useObjectURL(object) {
7914
7959
  const objectURL = useMemo26(() => {
7915
7960
  if (object instanceof Blob) return URL.createObjectURL(object);
7916
7961
  const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
7917
7962
  return URL.createObjectURL(new Blob([bytes]));
7918
7963
  }, [object]);
7919
- useLayoutEffect6(() => {
7964
+ useLayoutEffect7(() => {
7920
7965
  return () => URL.revokeObjectURL(objectURL);
7921
7966
  }, [objectURL]);
7922
7967
  return objectURL;
@@ -12013,7 +12058,7 @@ import React88, {
12013
12058
  } from "react";
12014
12059
 
12015
12060
  // src/hooks/useWindowSize.tsx
12016
- import { useEffect as useEffect20, useState as useState29 } from "react";
12061
+ import { useEffect as useEffect21, useState as useState29 } from "react";
12017
12062
  function useWindowSize() {
12018
12063
  const [size2, setSize] = useState29(
12019
12064
  typeof window === "undefined" ? { width: 0, height: 0 } : {
@@ -12021,7 +12066,7 @@ function useWindowSize() {
12021
12066
  height: window.innerHeight
12022
12067
  }
12023
12068
  );
12024
- useEffect20(() => {
12069
+ useEffect21(() => {
12025
12070
  const handleResize = () => setSize({
12026
12071
  width: window.innerWidth,
12027
12072
  height: window.innerHeight
@@ -12033,10 +12078,10 @@ function useWindowSize() {
12033
12078
  }
12034
12079
 
12035
12080
  // src/components/workspace/DrawerWorkspaceLayout.tsx
12036
- 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";
12037
12082
 
12038
12083
  // src/hooks/usePreservePanelSize.tsx
12039
- import { useLayoutEffect as useLayoutEffect8, useRef as useRef25 } from "react";
12084
+ import { useLayoutEffect as useLayoutEffect9, useRef as useRef25 } from "react";
12040
12085
  var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
12041
12086
  var LEFT_SIDEBAR_ID = "editor-left-sidebar";
12042
12087
  var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
@@ -12044,7 +12089,7 @@ var CONTENT_AREA_ID = "editor-content-area";
12044
12089
  function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12045
12090
  const windowSize = useWindowSize();
12046
12091
  const layoutRef = useRef25();
12047
- useLayoutEffect8(() => {
12092
+ useLayoutEffect9(() => {
12048
12093
  const panelGroup = document.querySelector(
12049
12094
  `[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
12050
12095
  );
@@ -12087,7 +12132,7 @@ function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
12087
12132
  panelGroupObserver.disconnect();
12088
12133
  };
12089
12134
  }, [panelGroupRef, setPanelLayoutState]);
12090
- useLayoutEffect8(() => {
12135
+ useLayoutEffect9(() => {
12091
12136
  if (!layoutRef.current) return;
12092
12137
  const {
12093
12138
  windowWidth: oldWindowWidth,
@@ -12184,7 +12229,7 @@ var DrawerWorkspaceLayout = memo36(function DrawerWorkspaceLayout2({
12184
12229
  }) {
12185
12230
  const portalContainer = useRef26(null);
12186
12231
  const [mounted, setMounted] = useState30(false);
12187
- useLayoutEffect9(() => {
12232
+ useLayoutEffect10(() => {
12188
12233
  if (mounted) return;
12189
12234
  setMounted(true);
12190
12235
  handleChangeLayoutState({
@@ -12525,7 +12570,7 @@ function usePlatformModKey() {
12525
12570
  }
12526
12571
 
12527
12572
  // src/hooks/useTheme.ts
12528
- import { useState as useState32, useEffect as useEffect21 } from "react";
12573
+ import { useState as useState32, useEffect as useEffect22 } from "react";
12529
12574
  function useTheme() {
12530
12575
  const [theme, setTheme] = useState32("light");
12531
12576
  const checkTheme = () => {
@@ -12539,7 +12584,7 @@ function useTheme() {
12539
12584
  break;
12540
12585
  }
12541
12586
  };
12542
- useEffect21(() => {
12587
+ useEffect22(() => {
12543
12588
  checkTheme();
12544
12589
  const observer = new MutationObserver((mutations) => {
12545
12590
  mutations.forEach((mutation) => {
@@ -12641,13 +12686,13 @@ function acceptsDrop({
12641
12686
  if (!allowSiblings) {
12642
12687
  return false;
12643
12688
  }
12644
- return defaultAcceptsDrop(
12645
- sourceIndexPath.at(-1),
12646
- targetIndexPath.at(-1),
12689
+ return defaultAcceptsDrop({
12690
+ sourceIndex: sourceIndexPath.at(-1),
12691
+ targetIndex: targetIndexPath.at(-1),
12647
12692
  position,
12648
- "",
12649
- ""
12650
- );
12693
+ sourceListId: "",
12694
+ targetListId: ""
12695
+ });
12651
12696
  }
12652
12697
  return true;
12653
12698
  }
@@ -13117,6 +13162,7 @@ export {
13117
13162
  cssVars,
13118
13163
  cx,
13119
13164
  defaultAcceptsDrop,
13165
+ dragItemKeySeparator,
13120
13166
  filterWithGroupedSections,
13121
13167
  fuzzyFilter,
13122
13168
  fuzzyScore,