@noya-app/noya-designsystem 0.1.7 → 0.1.9

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
@@ -144,7 +144,7 @@ var ButtonElement = styled4.button(({ theme, active, disabled, variant, size: si
144
144
  boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors.primary}`
145
145
  },
146
146
  "&:hover": {
147
- background: variant === "primaryGradient" ? theme.colors.primaryLight : theme.colors.inputBackgroundLight
147
+ background: variant === "primaryGradient" || active ? theme.colors.primaryLight : theme.colors.inputBackgroundLight
148
148
  },
149
149
  "&:active": {
150
150
  background: variant === "primaryGradient" ? theme.colors.primary : theme.colors.activeBackground
@@ -264,7 +264,7 @@ import React18, {
264
264
  createContext as createContext4,
265
265
  memo as memo10,
266
266
  useContext as useContext4,
267
- useMemo as useMemo7
267
+ useMemo as useMemo8
268
268
  } from "react";
269
269
  import { ThemeProvider, useTheme as useTheme2 } from "styled-components";
270
270
 
@@ -359,11 +359,11 @@ var ToastProvider = ({ children }) => /* @__PURE__ */ React6.createElement(Toast
359
359
  // src/contexts/DialogContext.tsx
360
360
  import React17, {
361
361
  createContext as createContext3,
362
- useCallback as useCallback11,
362
+ useCallback as useCallback12,
363
363
  useContext as useContext3,
364
- useMemo as useMemo6,
364
+ useMemo as useMemo7,
365
365
  useRef as useRef11,
366
- useState as useState10
366
+ useState as useState11
367
367
  } from "react";
368
368
  import styled13 from "styled-components";
369
369
 
@@ -678,22 +678,109 @@ import { useRef as useRef6 } from "react";
678
678
  // ../noya-react-utils/src/hooks/useMutableState.ts
679
679
  import { useCallback as useCallback6, useMemo as useMemo3, useState as useState5 } from "react";
680
680
 
681
+ // ../noya-react-utils/src/hooks/usePersistentState.ts
682
+ import {
683
+ useCallback as useCallback7,
684
+ useEffect as useEffect4,
685
+ useMemo as useMemo4,
686
+ useState as useState6
687
+ } from "react";
688
+
681
689
  // ../noya-react-utils/src/hooks/usePixelRatio.ts
682
- import { useEffect as useEffect4, useState as useState6 } from "react";
690
+ import { useEffect as useEffect5, useState as useState7 } from "react";
683
691
 
684
692
  // ../noya-react-utils/src/hooks/useShallowArray.ts
685
693
  import { isShallowEqual } from "@noya-app/noya-utils";
686
694
  import { useRef as useRef7 } from "react";
687
695
 
688
696
  // ../noya-react-utils/src/hooks/useStableCallback.ts
689
- import { useCallback as useCallback7, useLayoutEffect as useLayoutEffect2, useRef as useRef8 } from "react";
697
+ import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect2, useRef as useRef8 } from "react";
690
698
 
691
699
  // ../noya-react-utils/src/hooks/useSystemColorScheme.ts
692
- import { useEffect as useEffect5, useState as useState7 } from "react";
700
+ import { useEffect as useEffect6, useState as useState8 } from "react";
693
701
 
694
702
  // ../noya-react-utils/src/hooks/useUrlHashParameters.ts
695
703
  import { decodeQueryParameters } from "@noya-app/noya-utils";
696
- import { useEffect as useEffect6, useState as useState8 } from "react";
704
+ import { useEffect as useEffect7, useState as useState9 } from "react";
705
+
706
+ // ../emitter/src/index.ts
707
+ var Emitter = class {
708
+ constructor(options = {}) {
709
+ this.bufferEventsIfNoListeners = options.bufferEventsIfNoListeners ?? false;
710
+ }
711
+ bufferEventsIfNoListeners;
712
+ listeners = [];
713
+ addListener = (f, options = {}) => {
714
+ if (options.once) {
715
+ const handler = (...args) => {
716
+ this.removeListener(handler);
717
+ return f(...args);
718
+ };
719
+ this.listeners.push(handler);
720
+ } else {
721
+ this.listeners.push(f);
722
+ }
723
+ if (this.bufferedEvents.length > 0) {
724
+ const eventsToEmit = this.bufferedEvents;
725
+ this.bufferedEvents = [];
726
+ eventsToEmit.forEach((event) => {
727
+ this.emit(...event);
728
+ });
729
+ }
730
+ return () => this.removeListener(f);
731
+ };
732
+ removeListener = (f) => {
733
+ const index = this.listeners.indexOf(f);
734
+ if (index === -1)
735
+ return;
736
+ this.listeners.splice(index, 1);
737
+ };
738
+ emit = (...args) => {
739
+ if (this.bufferEventsIfNoListeners && this.listeners.length === 0) {
740
+ this.bufferedEvents.push(args);
741
+ return;
742
+ }
743
+ this.listeners.forEach((l) => l(...args));
744
+ };
745
+ bufferedEvents = [];
746
+ };
747
+
748
+ // ../noya-react-utils/src/utils/ClientStorage.ts
749
+ var ClientStorage = class {
750
+ getItem(storageKey) {
751
+ if (typeof localStorage === "undefined") {
752
+ return null;
753
+ }
754
+ return localStorage.getItem(storageKey);
755
+ }
756
+ setItem(storageKey, value) {
757
+ if (typeof localStorage === "undefined") {
758
+ return;
759
+ }
760
+ if (value === null) {
761
+ localStorage.removeItem(storageKey);
762
+ } else {
763
+ localStorage.setItem(storageKey, value);
764
+ }
765
+ this.emitter.emit(storageKey, value);
766
+ }
767
+ emitter = new Emitter();
768
+ _isListening = false;
769
+ addListener(storageKey, listener) {
770
+ if (!this._isListening && typeof window !== "undefined") {
771
+ this._isListening = true;
772
+ window.addEventListener("storage", (event) => {
773
+ this.emitter.emit(event.key, event.newValue);
774
+ });
775
+ }
776
+ return this.emitter.addListener((key, value) => {
777
+ if (key === storageKey) {
778
+ listener(value);
779
+ }
780
+ });
781
+ }
782
+ };
783
+ var clientStorage = new ClientStorage();
697
784
 
698
785
  // ../noya-react-utils/src/utils/assignRef.ts
699
786
  function assignRef(ref, value) {
@@ -711,11 +798,11 @@ import React16, {
711
798
  forwardRef as forwardRef7,
712
799
  isValidElement as isValidElement2,
713
800
  memo as memo9,
714
- useCallback as useCallback10,
801
+ useCallback as useCallback11,
715
802
  useContext as useContext2,
716
- useEffect as useEffect9,
803
+ useEffect as useEffect10,
717
804
  useLayoutEffect as useLayoutEffect4,
718
- useMemo as useMemo5,
805
+ useMemo as useMemo6,
719
806
  useRef as useRef10
720
807
  } from "react";
721
808
  import styled12 from "styled-components";
@@ -751,8 +838,8 @@ import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
751
838
  import React12, {
752
839
  forwardRef as forwardRef4,
753
840
  memo as memo7,
754
- useCallback as useCallback8,
755
- useMemo as useMemo4
841
+ useCallback as useCallback9,
842
+ useMemo as useMemo5
756
843
  } from "react";
757
844
  import styled9 from "styled-components";
758
845
 
@@ -912,7 +999,7 @@ var DropdownMenuItem = memo7(function ContextMenuItem({
912
999
  items,
913
1000
  shortcut
914
1001
  }) {
915
- const handleSelectItem = useCallback8(() => {
1002
+ const handleSelectItem = useCallback9(() => {
916
1003
  if (!value)
917
1004
  return;
918
1005
  onSelect(value);
@@ -952,7 +1039,7 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
952
1039
  const hasCheckedItem = items.some(
953
1040
  (item) => item !== SEPARATOR_ITEM && item.checked
954
1041
  );
955
- const keymap = useMemo4(
1042
+ const keymap = useMemo5(
956
1043
  () => isNested || shouldBindKeyboardShortcuts === false ? {} : getKeyboardShortcutsForMenuItems(items, onSelect),
957
1044
  [isNested, items, onSelect, shouldBindKeyboardShortcuts]
958
1045
  );
@@ -960,7 +1047,7 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
960
1047
  const RootComponent = isNested ? RadixDropdownMenu.Sub : RadixDropdownMenu.Root;
961
1048
  const TriggerComponent = isNested ? RadixDropdownMenu.SubTrigger : RadixDropdownMenu.Trigger;
962
1049
  const ContentComponent = isNested ? SubContent2 : Content5;
963
- const contentStyle = useMemo4(() => ({ zIndex: 1e3 }), []);
1050
+ const contentStyle = useMemo5(() => ({ zIndex: 1e3 }), []);
964
1051
  return /* @__PURE__ */ React12.createElement(RootComponent, { onOpenChange, open }, /* @__PURE__ */ React12.createElement(TriggerComponent, { ref: forwardedRef, asChild: true }, children), /* @__PURE__ */ React12.createElement(RadixDropdownMenu.Portal, null, /* @__PURE__ */ React12.createElement(
965
1052
  ContentComponent,
966
1053
  {
@@ -994,15 +1081,15 @@ var DropdownMenu = memo7(DropdownMenuRoot);
994
1081
  import { composeRefs } from "@radix-ui/react-compose-refs";
995
1082
  import React13, {
996
1083
  forwardRef as forwardRef5,
997
- useCallback as useCallback9,
998
- useEffect as useEffect8,
1084
+ useCallback as useCallback10,
1085
+ useEffect as useEffect9,
999
1086
  useLayoutEffect as useLayoutEffect3,
1000
1087
  useRef as useRef9,
1001
- useState as useState9
1088
+ useState as useState10
1002
1089
  } from "react";
1003
1090
 
1004
1091
  // src/contexts/GlobalInputBlurContext.tsx
1005
- import { createContext, useContext, useEffect as useEffect7 } from "react";
1092
+ import { createContext, useContext, useEffect as useEffect8 } from "react";
1006
1093
  var defaultValue = /* @__PURE__ */ (() => {
1007
1094
  const listeners = [];
1008
1095
  const value = {
@@ -1030,7 +1117,7 @@ var useGlobalInputBlur = () => {
1030
1117
  };
1031
1118
  function useGlobalInputBlurListener(f) {
1032
1119
  const context = useGlobalInputBlur();
1033
- useEffect7(() => {
1120
+ useEffect8(() => {
1034
1121
  context.addListener(f);
1035
1122
  return () => {
1036
1123
  context.removeListener(f);
@@ -1063,14 +1150,14 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
1063
1150
  onFocusCapture,
1064
1151
  ...rest
1065
1152
  }, forwardedRef) {
1066
- const handleBlur = useCallback9(
1153
+ const handleBlur = useCallback10(
1067
1154
  (event) => {
1068
1155
  onBlur?.(event);
1069
1156
  onFocusChange?.(false);
1070
1157
  },
1071
1158
  [onBlur, onFocusChange]
1072
1159
  );
1073
- const handleFocusCapture = useCallback9(
1160
+ const handleFocusCapture = useCallback10(
1074
1161
  (event) => {
1075
1162
  onFocusCapture?.(event);
1076
1163
  onFocusChange?.(true);
@@ -1084,7 +1171,7 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
1084
1171
  ...rest,
1085
1172
  value,
1086
1173
  onKeyDown,
1087
- onChange: useCallback9(
1174
+ onChange: useCallback10(
1088
1175
  (event) => onChange(event.target.value),
1089
1176
  [onChange]
1090
1177
  ),
@@ -1109,11 +1196,11 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1109
1196
  latestValue.current = value;
1110
1197
  const userDidEdit = useRef9(false);
1111
1198
  const isSubmitTriggeredByEscapeKey = useRef9(false);
1112
- const [internalValue, setInternalValue] = useState9("");
1199
+ const [internalValue, setInternalValue] = useState10("");
1113
1200
  useLayoutEffect3(() => {
1114
1201
  setInternalValue(value);
1115
1202
  }, [value]);
1116
- const handleSubmit = useCallback9(() => {
1203
+ const handleSubmit = useCallback10(() => {
1117
1204
  const submissionValue = isSubmitTriggeredByEscapeKey.current ? value : internalValue;
1118
1205
  isSubmitTriggeredByEscapeKey.current = false;
1119
1206
  if (submissionValue === value && !allowSubmittingWithSameValue)
@@ -1123,13 +1210,13 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1123
1210
  setInternalValue(latestValue.current);
1124
1211
  }, [allowSubmittingWithSameValue, value, internalValue, onSubmit]);
1125
1212
  useGlobalInputBlurListener(
1126
- useCallback9(() => {
1213
+ useCallback10(() => {
1127
1214
  if (ref.current !== document.activeElement)
1128
1215
  return;
1129
1216
  handleSubmit();
1130
1217
  }, [handleSubmit])
1131
1218
  );
1132
- const handleKeyDown = useCallback9(
1219
+ const handleKeyDown = useCallback10(
1133
1220
  (event) => {
1134
1221
  if (event.key === "Enter") {
1135
1222
  handleSubmit();
@@ -1144,14 +1231,14 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1144
1231
  },
1145
1232
  [onKeyDown, handleSubmit]
1146
1233
  );
1147
- const handleChange = useCallback9(
1234
+ const handleChange = useCallback10(
1148
1235
  (event) => {
1149
1236
  userDidEdit.current = true;
1150
1237
  setInternalValue(event.target.value);
1151
1238
  },
1152
1239
  []
1153
1240
  );
1154
- const handleBlur = useCallback9(
1241
+ const handleBlur = useCallback10(
1155
1242
  (event) => {
1156
1243
  onBlur?.(event);
1157
1244
  onFocusChange?.(false);
@@ -1159,7 +1246,7 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1159
1246
  },
1160
1247
  [onBlur, onFocusChange, handleSubmit]
1161
1248
  );
1162
- const handleFocusCapture = useCallback9(
1249
+ const handleFocusCapture = useCallback10(
1163
1250
  (event) => {
1164
1251
  onFocusCapture?.(event);
1165
1252
  onFocusChange?.(true);
@@ -1171,7 +1258,7 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1171
1258
  );
1172
1259
  const latestHandleSubmit = useRef9(handleSubmit);
1173
1260
  latestHandleSubmit.current = handleSubmit;
1174
- useEffect8(() => {
1261
+ useEffect9(() => {
1175
1262
  if (submitAutomaticallyAfterDelay) {
1176
1263
  if (autoSubmitTimeoutRef.current) {
1177
1264
  clearTimeout(autoSubmitTimeoutRef.current);
@@ -1203,11 +1290,11 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
1203
1290
  });
1204
1291
  var TextInput_default = forwardRef5(function TextInput(props, forwardedRef) {
1205
1292
  const commonProps = {
1206
- onPointerDown: useCallback9(
1293
+ onPointerDown: useCallback10(
1207
1294
  (event) => event.stopPropagation(),
1208
1295
  []
1209
1296
  ),
1210
- onClick: useCallback9(
1297
+ onClick: useCallback10(
1211
1298
  (event) => event.stopPropagation(),
1212
1299
  []
1213
1300
  ),
@@ -1438,7 +1525,7 @@ var DropdownContainer = styled12.span(({ theme }) => ({
1438
1525
  }));
1439
1526
  var InputFieldDropdownMenu = memo9(function InputFieldDropdownMenu2({ id, items, onSelect, children }) {
1440
1527
  const { size: size2 } = useContext2(InputFieldContext);
1441
- const contentStyle = useMemo5(
1528
+ const contentStyle = useMemo6(
1442
1529
  () => ({
1443
1530
  margin: "-4px 0",
1444
1531
  minHeight: size2 === "small" ? "15px" : void 0
@@ -1459,7 +1546,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
1459
1546
  onClick
1460
1547
  }) {
1461
1548
  const { size: size2, inputRef } = useContext2(InputFieldContext);
1462
- const defaultHandleClick = useCallback10(
1549
+ const defaultHandleClick = useCallback11(
1463
1550
  (event) => {
1464
1551
  if (inputRef && typeof inputRef !== "function") {
1465
1552
  inputRef.current?.focus();
@@ -1470,7 +1557,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
1470
1557
  },
1471
1558
  [inputRef]
1472
1559
  );
1473
- const handlePointerDown = useCallback10((event) => {
1560
+ const handlePointerDown = useCallback11((event) => {
1474
1561
  event.preventDefault();
1475
1562
  event.stopPropagation();
1476
1563
  }, []);
@@ -1571,7 +1658,7 @@ var InputFieldInput = forwardRef7(function InputFieldInput2(props, forwardedRef)
1571
1658
  onFocusChange,
1572
1659
  setInputRef
1573
1660
  } = useContext2(InputFieldContext);
1574
- const handleFocusChange = useCallback10(
1661
+ const handleFocusChange = useCallback11(
1575
1662
  (isFocused) => {
1576
1663
  onFocusChange(isFocused);
1577
1664
  },
@@ -1637,7 +1724,7 @@ function InputFieldNumberInput(props) {
1637
1724
  const { value, placeholder, onNudge } = props;
1638
1725
  const onSubmit = "onSubmit" in props ? props.onSubmit : void 0;
1639
1726
  const onChange = "onChange" in props ? props.onChange : void 0;
1640
- const handleSubmit = useCallback10(
1727
+ const handleSubmit = useCallback11(
1641
1728
  (value2) => {
1642
1729
  const newValue = parseNumber(value2);
1643
1730
  if (!isNaN(newValue)) {
@@ -1646,7 +1733,7 @@ function InputFieldNumberInput(props) {
1646
1733
  },
1647
1734
  [onSubmit]
1648
1735
  );
1649
- const handleKeyDown = useCallback10(
1736
+ const handleKeyDown = useCallback11(
1650
1737
  (event) => {
1651
1738
  const amount = handleNudge(event);
1652
1739
  if (!amount)
@@ -1657,7 +1744,7 @@ function InputFieldNumberInput(props) {
1657
1744
  },
1658
1745
  [onNudge]
1659
1746
  );
1660
- const handleChange = useCallback10(
1747
+ const handleChange = useCallback11(
1661
1748
  (value2) => {
1662
1749
  onChange?.(parseNumber(value2));
1663
1750
  },
@@ -1704,7 +1791,7 @@ function InputFieldRoot({
1704
1791
  const [isFocused, setIsFocused] = React16.useState(false);
1705
1792
  const [measuredLabelSize, setMeasuredLabelSize] = React16.useState();
1706
1793
  const [measuredWidth, setMeasuredWidth] = React16.useState();
1707
- const handleFocusChange = useCallback10(
1794
+ const handleFocusChange = useCallback11(
1708
1795
  (isFocused2) => {
1709
1796
  setIsFocused(isFocused2);
1710
1797
  onFocusChange?.(isFocused2);
@@ -1712,14 +1799,14 @@ function InputFieldRoot({
1712
1799
  [onFocusChange]
1713
1800
  );
1714
1801
  const [inputRef, setInputRef] = React16.useState();
1715
- useEffect9(() => {
1802
+ useEffect10(() => {
1716
1803
  if (inputRef && typeof inputRef !== "function") {
1717
1804
  setMeasuredWidth?.(
1718
1805
  isFocused ? inputRef?.current?.getBoundingClientRect().width : void 0
1719
1806
  );
1720
1807
  }
1721
1808
  }, [inputRef, isFocused]);
1722
- const contextValue = useMemo5(
1809
+ const contextValue = useMemo6(
1723
1810
  () => ({
1724
1811
  labelPosition,
1725
1812
  labelSize: measuredLabelSize ?? labelSize ?? 6,
@@ -1797,20 +1884,20 @@ var DialogContext = createContext3(void 0);
1797
1884
  var DialogProvider = function DialogProvider2({
1798
1885
  children
1799
1886
  }) {
1800
- const [contents, setContents] = useState10();
1887
+ const [contents, setContents] = useState11();
1801
1888
  const isOpen = !!contents;
1802
- const close = useCallback11(() => {
1889
+ const close = useCallback12(() => {
1803
1890
  if (!contents)
1804
1891
  return;
1805
1892
  contents.resolve(void 0);
1806
1893
  }, [contents]);
1807
- const submit = useCallback11(() => {
1894
+ const submit = useCallback12(() => {
1808
1895
  if (!contents || !contents.inputValue)
1809
1896
  return;
1810
1897
  contents.resolve(contents.inputValue);
1811
1898
  setContents(void 0);
1812
1899
  }, [contents]);
1813
- const open = useCallback11(
1900
+ const open = useCallback12(
1814
1901
  (title, inputValue = "") => {
1815
1902
  const { promise, resolve } = createDeferredPromise();
1816
1903
  setContents({
@@ -1825,7 +1912,7 @@ var DialogProvider = function DialogProvider2({
1825
1912
  },
1826
1913
  []
1827
1914
  );
1828
- const handleKeyDown = useCallback11(
1915
+ const handleKeyDown = useCallback12(
1829
1916
  (event) => {
1830
1917
  if (event.key !== "Enter")
1831
1918
  return;
@@ -1837,7 +1924,7 @@ var DialogProvider = function DialogProvider2({
1837
1924
  );
1838
1925
  const inputRef = useRef11(null);
1839
1926
  const dialogRef = useRef11(null);
1840
- const containsElement = useCallback11((element) => {
1927
+ const containsElement = useCallback12((element) => {
1841
1928
  if (!dialogRef.current)
1842
1929
  return false;
1843
1930
  return dialogRef.current.containsElement(element);
@@ -1845,7 +1932,7 @@ var DialogProvider = function DialogProvider2({
1845
1932
  return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
1846
1933
  DialogContext.Provider,
1847
1934
  {
1848
- value: useMemo6(
1935
+ value: useMemo7(
1849
1936
  () => ({ openInputDialog: open, containsElement }),
1850
1937
  [containsElement, open]
1851
1938
  )
@@ -1857,7 +1944,7 @@ var DialogProvider = function DialogProvider2({
1857
1944
  ref: dialogRef,
1858
1945
  title: contents?.title,
1859
1946
  open: isOpen,
1860
- onOpenChange: useCallback11(
1947
+ onOpenChange: useCallback12(
1861
1948
  (isOpen2) => {
1862
1949
  if (!isOpen2) {
1863
1950
  close();
@@ -1865,7 +1952,7 @@ var DialogProvider = function DialogProvider2({
1865
1952
  },
1866
1953
  [close]
1867
1954
  ),
1868
- onOpenAutoFocus: useCallback11((event) => {
1955
+ onOpenAutoFocus: useCallback12((event) => {
1869
1956
  event.stopPropagation();
1870
1957
  event.preventDefault();
1871
1958
  inputRef.current?.focus();
@@ -1914,7 +2001,7 @@ var DesignSystemConfigurationProvider = memo10(
1914
2001
  theme,
1915
2002
  platform
1916
2003
  }) {
1917
- const contextValue = useMemo7(() => ({ platform }), [platform]);
2004
+ const contextValue = useMemo8(() => ({ platform }), [platform]);
1918
2005
  return /* @__PURE__ */ React18.createElement(DesignSystemConfigurationContext.Provider, { value: contextValue }, /* @__PURE__ */ React18.createElement(ThemeProvider, { theme }, /* @__PURE__ */ React18.createElement(DialogProvider, null, /* @__PURE__ */ React18.createElement(ToastProvider, null, children))));
1919
2006
  }
1920
2007
  );
@@ -2174,8 +2261,8 @@ import { useKeyboardShortcuts as useKeyboardShortcuts2 } from "@noya-app/noya-ke
2174
2261
  import * as RadixContextMenu from "@radix-ui/react-context-menu";
2175
2262
  import React21, {
2176
2263
  memo as memo12,
2177
- useCallback as useCallback12,
2178
- useMemo as useMemo9
2264
+ useCallback as useCallback13,
2265
+ useMemo as useMemo10
2179
2266
  } from "react";
2180
2267
  import styled15 from "styled-components";
2181
2268
  var SeparatorElement2 = styled15(RadixContextMenu.Separator)(
@@ -2199,11 +2286,11 @@ var ContextMenuItem2 = memo12(function ContextMenuItem3({
2199
2286
  items,
2200
2287
  shortcut
2201
2288
  }) {
2202
- const handlePointerDown = useCallback12(
2289
+ const handlePointerDown = useCallback13(
2203
2290
  (event) => event.stopPropagation(),
2204
2291
  []
2205
2292
  );
2206
- const handleSelectItem = useCallback12(() => {
2293
+ const handleSelectItem = useCallback13(() => {
2207
2294
  if (!value)
2208
2295
  return;
2209
2296
  onSelect(value);
@@ -2252,12 +2339,12 @@ function ContextMenuRoot({
2252
2339
  const hasCheckedItem = items.some(
2253
2340
  (item) => item !== SEPARATOR_ITEM && item.checked
2254
2341
  );
2255
- const keymap = useMemo9(
2342
+ const keymap = useMemo10(
2256
2343
  () => isNested || shouldBindKeyboardShortcuts === false ? {} : getKeyboardShortcutsForMenuItems(items, onSelect),
2257
2344
  [isNested, items, onSelect, shouldBindKeyboardShortcuts]
2258
2345
  );
2259
2346
  useKeyboardShortcuts2(keymap);
2260
- const onPointerDown = useCallback12((event) => {
2347
+ const onPointerDown = useCallback13((event) => {
2261
2348
  event.preventDefault();
2262
2349
  }, []);
2263
2350
  const RootComponent = isNested ? RadixContextMenu.Sub : RadixContextMenu.Root;
@@ -2300,7 +2387,7 @@ var DividerVertical = memo13(function DividerVertical2(props) {
2300
2387
 
2301
2388
  // src/components/DraggableMenuButton.tsx
2302
2389
  import { DragHandleDots2Icon } from "@noya-app/noya-icons";
2303
- import React23, { memo as memo14, useCallback as useCallback13, useState as useState12 } from "react";
2390
+ import React23, { memo as memo14, useCallback as useCallback14, useState as useState13 } from "react";
2304
2391
  import styled17 from "styled-components";
2305
2392
  var DotButtonElement = styled17.div(({ theme }) => ({
2306
2393
  cursor: "pointer",
@@ -2326,9 +2413,9 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
2326
2413
  isVisible = true
2327
2414
  }) {
2328
2415
  const color = useDesignSystemTheme().colors.icon;
2329
- const [open, setOpen] = useState12(false);
2416
+ const [open, setOpen] = useState13(false);
2330
2417
  const [downPosition, setDownPosition] = React23.useState(null);
2331
- const handlePointerDownCapture = useCallback13(
2418
+ const handlePointerDownCapture = useCallback14(
2332
2419
  (event) => {
2333
2420
  if (open) {
2334
2421
  setDownPosition(null);
@@ -2341,7 +2428,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
2341
2428
  },
2342
2429
  [open]
2343
2430
  );
2344
- const handlePointerUp = useCallback13(
2431
+ const handlePointerUp = useCallback14(
2345
2432
  (event) => {
2346
2433
  if (open || !downPosition) {
2347
2434
  setDownPosition(null);
@@ -2357,7 +2444,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
2357
2444
  },
2358
2445
  [downPosition, open]
2359
2446
  );
2360
- const handleOpenChange = useCallback13(
2447
+ const handleOpenChange = useCallback14(
2361
2448
  (isOpen) => {
2362
2449
  if (!isOpen)
2363
2450
  setOpen(false);
@@ -2725,7 +2812,7 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
2725
2812
  })(ClassValue || {});
2726
2813
 
2727
2814
  // src/components/FillPreviewBackground.tsx
2728
- import React25, { memo as memo16, useMemo as useMemo12 } from "react";
2815
+ import React25, { memo as memo16, useMemo as useMemo13 } from "react";
2729
2816
  import styled18, { useTheme as useTheme3 } from "styled-components";
2730
2817
 
2731
2818
  // src/contexts/ImageDataContext.tsx
@@ -2733,7 +2820,7 @@ import React24, {
2733
2820
  createContext as createContext5,
2734
2821
  memo as memo15,
2735
2822
  useContext as useContext5,
2736
- useMemo as useMemo10
2823
+ useMemo as useMemo11
2737
2824
  } from "react";
2738
2825
  var ImageDataContext = createContext5(
2739
2826
  void 0
@@ -2742,7 +2829,7 @@ var ImageDataProvider = memo15(function ImageDataProvider2({
2742
2829
  children,
2743
2830
  getImageData
2744
2831
  }) {
2745
- const contextValue = useMemo10(
2832
+ const contextValue = useMemo11(
2746
2833
  () => ({ getImageData: getImageData ?? (() => void 0) }),
2747
2834
  [getImageData]
2748
2835
  );
@@ -2757,9 +2844,9 @@ function useImageData(ref) {
2757
2844
  }
2758
2845
 
2759
2846
  // src/hooks/useObjectURL.ts
2760
- import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo11 } from "react";
2847
+ import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo12 } from "react";
2761
2848
  function useObjectURL(object) {
2762
- const objectURL = useMemo11(() => {
2849
+ const objectURL = useMemo12(() => {
2763
2850
  if (object instanceof Blob)
2764
2851
  return URL.createObjectURL(object);
2765
2852
  const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
@@ -2827,7 +2914,7 @@ var Background = styled18.span(({ background }) => ({
2827
2914
  }));
2828
2915
  var HorizontalDotsBackground = memo16(function HorizontalDotsBackground2() {
2829
2916
  const { inputBackground, placeholderDots } = useTheme3().colors;
2830
- const background = useMemo12(
2917
+ const background = useMemo13(
2831
2918
  () => [
2832
2919
  `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
2833
2920
  placeholderDots
@@ -2858,7 +2945,7 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
2858
2945
  const image = useImageData(imageRef);
2859
2946
  const url = useObjectURL(image);
2860
2947
  const size2 = getPatternSizeAndPosition(fillType, tileScale);
2861
- const background = useMemo12(
2948
+ const background = useMemo13(
2862
2949
  () => [
2863
2950
  size2,
2864
2951
  `url(${url})`,
@@ -2871,13 +2958,13 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
2871
2958
  var ColorPreviewBackground = memo16(function ColorPreviewBackground2({
2872
2959
  color
2873
2960
  }) {
2874
- const background = useMemo12(() => sketchColorToRgbaString(color), [color]);
2961
+ const background = useMemo13(() => sketchColorToRgbaString(color), [color]);
2875
2962
  return /* @__PURE__ */ React25.createElement(Background, { background });
2876
2963
  });
2877
2964
  var GradientPreviewBackground = memo16(function GradientPreviewBackground2({
2878
2965
  gradient
2879
2966
  }) {
2880
- const background = useMemo12(
2967
+ const background = useMemo13(
2881
2968
  () => getGradientBackground(gradient.stops, gradient.gradientType, 180),
2882
2969
  [gradient.gradientType, gradient.stops]
2883
2970
  );
@@ -2943,7 +3030,7 @@ import {
2943
3030
  hsvaToRgba,
2944
3031
  rgbaToHsva as rgbaToHsva2
2945
3032
  } from "@noya-app/noya-colorpicker";
2946
- import React27, { memo as memo18, useCallback as useCallback14, useMemo as useMemo13 } from "react";
3033
+ import React27, { memo as memo18, useCallback as useCallback15, useMemo as useMemo14 } from "react";
2947
3034
  var GradientPicker = memo18(function GradientPicker2({
2948
3035
  value,
2949
3036
  selectedStop,
@@ -2953,7 +3040,7 @@ var GradientPicker = memo18(function GradientPicker2({
2953
3040
  onDelete,
2954
3041
  onSelectStop
2955
3042
  }) {
2956
- const colorModel = useMemo13(
3043
+ const colorModel = useMemo14(
2957
3044
  () => ({
2958
3045
  defaultColor: { r: 0, g: 0, b: 0, a: 1 },
2959
3046
  toHsva: rgbaToHsva2,
@@ -2962,17 +3049,17 @@ var GradientPicker = memo18(function GradientPicker2({
2962
3049
  }),
2963
3050
  []
2964
3051
  );
2965
- const rgbaColor = useMemo13(
3052
+ const rgbaColor = useMemo14(
2966
3053
  () => sketchColorToRgba(value[selectedStop].color),
2967
3054
  [value, selectedStop]
2968
3055
  );
2969
- const handleChangeColor = useCallback14(
3056
+ const handleChangeColor = useCallback15(
2970
3057
  (value2) => {
2971
3058
  onChangeColor(rgbaToSketchColor(value2));
2972
3059
  },
2973
3060
  [onChangeColor]
2974
3061
  );
2975
- const handleAddGradientStop = useCallback14(
3062
+ const handleAddGradientStop = useCallback15(
2976
3063
  (value2, position) => {
2977
3064
  onAdd(rgbaToSketchColor(value2), position);
2978
3065
  },
@@ -3037,15 +3124,15 @@ import React29, {
3037
3124
  createContext as createContext6,
3038
3125
  forwardRef as forwardRef9,
3039
3126
  memo as memo20,
3040
- useCallback as useCallback16,
3127
+ useCallback as useCallback17,
3041
3128
  useContext as useContext6,
3042
- useMemo as useMemo14
3129
+ useMemo as useMemo15
3043
3130
  } from "react";
3044
3131
  import styled22, { keyframes as keyframes2 } from "styled-components";
3045
3132
 
3046
3133
  // src/components/ScrollArea.tsx
3047
3134
  import * as RadixScrollArea from "@radix-ui/react-scroll-area";
3048
- import React28, { memo as memo19, useCallback as useCallback15, useState as useState13 } from "react";
3135
+ import React28, { memo as memo19, useCallback as useCallback16, useState as useState14 } from "react";
3049
3136
  import styled21 from "styled-components";
3050
3137
  var SCROLLBAR_SIZE = 10;
3051
3138
  var StyledViewport = styled21(RadixScrollArea.Viewport)({
@@ -3074,11 +3161,11 @@ var Container2 = styled21.div({
3074
3161
  minHeight: 0
3075
3162
  });
3076
3163
  var ScrollArea = memo19(function ScrollArea2({ children }) {
3077
- const [scrollElementRef, setScrollElementRef] = useState13(null);
3164
+ const [scrollElementRef, setScrollElementRef] = useState14(null);
3078
3165
  return /* @__PURE__ */ React28.createElement(Container2, null, /* @__PURE__ */ React28.createElement(RadixScrollArea.Root, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ React28.createElement(
3079
3166
  StyledViewport,
3080
3167
  {
3081
- ref: useCallback15(
3168
+ ref: useCallback16(
3082
3169
  (ref) => setScrollElementRef(ref),
3083
3170
  []
3084
3171
  )
@@ -3288,7 +3375,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
3288
3375
  }
3289
3376
  });
3290
3377
  const { textPosition, bordered, disabled } = useContext6(GridViewContext);
3291
- const handleClick = useCallback16(
3378
+ const handleClick = useCallback17(
3292
3379
  (event) => {
3293
3380
  event.stopPropagation();
3294
3381
  event.preventDefault();
@@ -3297,7 +3384,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
3297
3384
  },
3298
3385
  [onClick, onPress]
3299
3386
  );
3300
- const handleKeyDown = useCallback16(
3387
+ const handleKeyDown = useCallback17(
3301
3388
  (event) => {
3302
3389
  if (event.key === "Enter" || event.key === " ") {
3303
3390
  event.stopPropagation();
@@ -3365,7 +3452,7 @@ function GridViewRoot({
3365
3452
  bordered = false,
3366
3453
  disabled = false
3367
3454
  }) {
3368
- const handleClick = useCallback16(
3455
+ const handleClick = useCallback17(
3369
3456
  (event) => {
3370
3457
  event.stopPropagation();
3371
3458
  event.preventDefault();
@@ -3373,7 +3460,7 @@ function GridViewRoot({
3373
3460
  },
3374
3461
  [onClick]
3375
3462
  );
3376
- const contextValue = useMemo14(
3463
+ const contextValue = useMemo15(
3377
3464
  () => ({
3378
3465
  size: size2,
3379
3466
  textPosition,
@@ -3411,13 +3498,13 @@ import { chunkBy, partition } from "@noya-app/noya-utils";
3411
3498
  import React33, {
3412
3499
  forwardRef as forwardRef12,
3413
3500
  memo as memo23,
3414
- useCallback as useCallback19,
3415
- useEffect as useEffect11,
3501
+ useCallback as useCallback20,
3502
+ useEffect as useEffect12,
3416
3503
  useImperativeHandle as useImperativeHandle3,
3417
3504
  useLayoutEffect as useLayoutEffect7,
3418
- useMemo as useMemo17,
3505
+ useMemo as useMemo18,
3419
3506
  useRef as useRef15,
3420
- useState as useState15
3507
+ useState as useState16
3421
3508
  } from "react";
3422
3509
  import styled25 from "styled-components";
3423
3510
 
@@ -3501,11 +3588,11 @@ import React31, {
3501
3588
  forwardRef as forwardRef10,
3502
3589
  isValidElement as isValidElement3,
3503
3590
  memo as memo22,
3504
- useCallback as useCallback18,
3591
+ useCallback as useCallback19,
3505
3592
  useContext as useContext8,
3506
3593
  useImperativeHandle as useImperativeHandle2,
3507
3594
  useLayoutEffect as useLayoutEffect6,
3508
- useMemo as useMemo16,
3595
+ useMemo as useMemo17,
3509
3596
  useRef as useRef14
3510
3597
  } from "react";
3511
3598
  import { WindowScroller } from "react-virtualized";
@@ -3552,11 +3639,11 @@ import {
3552
3639
  import React30, {
3553
3640
  createContext as createContext7,
3554
3641
  memo as memo21,
3555
- useCallback as useCallback17,
3642
+ useCallback as useCallback18,
3556
3643
  useContext as useContext7,
3557
- useMemo as useMemo15,
3644
+ useMemo as useMemo16,
3558
3645
  useRef as useRef13,
3559
- useState as useState14
3646
+ useState as useState15
3560
3647
  } from "react";
3561
3648
  import { createPortal } from "react-dom";
3562
3649
  var normalizeListDestinationIndex = (index, position) => {
@@ -3613,7 +3700,7 @@ function SortableItem({
3613
3700
  const eventY = activatorEvent?.clientY ?? 0;
3614
3701
  const offsetLeft = eventX + position.x;
3615
3702
  const offsetTop = eventY + position.y;
3616
- const ref = useCallback17((node) => setNodeRef(node), [setNodeRef]);
3703
+ const ref = useCallback18((node) => setNodeRef(node), [setNodeRef]);
3617
3704
  return children({
3618
3705
  ref,
3619
3706
  ...attributes,
@@ -3644,22 +3731,22 @@ function SortableRoot({
3644
3731
  }
3645
3732
  })
3646
3733
  );
3647
- const [activeIndex, setActiveIndex] = useState14();
3734
+ const [activeIndex, setActiveIndex] = useState15();
3648
3735
  const activatorEvent = useRef13(null);
3649
- const setActivatorEvent = useCallback17((event) => {
3736
+ const setActivatorEvent = useCallback18((event) => {
3650
3737
  activatorEvent.current = event;
3651
3738
  }, []);
3652
- const [position, setPosition] = useState14({ x: 0, y: 0 });
3653
- const handleDragStart = useCallback17(
3739
+ const [position, setPosition] = useState15({ x: 0, y: 0 });
3740
+ const handleDragStart = useCallback18(
3654
3741
  (event) => {
3655
3742
  setActiveIndex(keys.indexOf(event.active.id));
3656
3743
  },
3657
3744
  [keys]
3658
3745
  );
3659
- const handleDragMove = useCallback17((event) => {
3746
+ const handleDragMove = useCallback18((event) => {
3660
3747
  setPosition({ ...event.delta });
3661
3748
  }, []);
3662
- const handleDragEnd = useCallback17(
3749
+ const handleDragEnd = useCallback18(
3663
3750
  (event) => {
3664
3751
  const { active, over } = event;
3665
3752
  setActiveIndex(void 0);
@@ -3689,7 +3776,7 @@ function SortableRoot({
3689
3776
  return /* @__PURE__ */ React30.createElement(
3690
3777
  SortableItemContext.Provider,
3691
3778
  {
3692
- value: useMemo15(
3779
+ value: useMemo16(
3693
3780
  () => ({
3694
3781
  keys,
3695
3782
  acceptsDrop,
@@ -3929,7 +4016,7 @@ var ListViewRow = forwardRef10(function ListViewRow2({
3929
4016
  onHoverChange
3930
4017
  });
3931
4018
  const { indentation, isDragging } = useContext8(DraggingContext);
3932
- const handlePress = useCallback18(
4019
+ const handlePress = useCallback19(
3933
4020
  (event) => {
3934
4021
  event.preventDefault();
3935
4022
  if (event.button !== 0)
@@ -3938,14 +4025,14 @@ var ListViewRow = forwardRef10(function ListViewRow2({
3938
4025
  },
3939
4026
  [onPress]
3940
4027
  );
3941
- const handleDoubleClick = useCallback18(
4028
+ const handleDoubleClick = useCallback19(
3942
4029
  (event) => {
3943
4030
  event.stopPropagation();
3944
4031
  onDoubleClick?.();
3945
4032
  },
3946
4033
  [onDoubleClick]
3947
4034
  );
3948
- const mergedStyle = useMemo16(() => {
4035
+ const mergedStyle = useMemo17(() => {
3949
4036
  return isDragging ? {
3950
4037
  // TODO: Where do these offsets actually come from?
3951
4038
  transform: `translate3d(-36px, -6px, 0)`,
@@ -4049,7 +4136,7 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
4049
4136
  // since it doesn't currently support row height changes
4050
4137
  items
4051
4138
  ]);
4052
- const listStyle = useMemo16(
4139
+ const listStyle = useMemo17(
4053
4140
  () => ({
4054
4141
  overflowX: "initial",
4055
4142
  overflowY: "initial",
@@ -4061,9 +4148,9 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
4061
4148
  WindowScroller,
4062
4149
  {
4063
4150
  scrollElement,
4064
- style: useMemo16(() => ({ flex: "1 1 auto" }), [])
4151
+ style: useMemo17(() => ({ flex: "1 1 auto" }), [])
4065
4152
  },
4066
- useCallback18(
4153
+ useCallback19(
4067
4154
  ({
4068
4155
  registerChild,
4069
4156
  onChildScroll,
@@ -4128,7 +4215,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4128
4215
  colorScheme = "primary",
4129
4216
  gap = 0
4130
4217
  }, forwardedRef) {
4131
- const handleClick = useCallback18(
4218
+ const handleClick = useCallback19(
4132
4219
  (event) => {
4133
4220
  if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
4134
4221
  return;
@@ -4138,11 +4225,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4138
4225
  },
4139
4226
  [onPress]
4140
4227
  );
4141
- const renderChild = useCallback18(
4228
+ const renderChild = useCallback19(
4142
4229
  (index) => renderItem(data[index], index, { isDragging: false }),
4143
4230
  [data, renderItem]
4144
4231
  );
4145
- const getItemContextValue = useCallback18(
4232
+ const getItemContextValue = useCallback19(
4146
4233
  (i) => {
4147
4234
  const current = renderChild(i);
4148
4235
  if (!isValidElement3(current))
@@ -4202,15 +4289,15 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4202
4289
  gap
4203
4290
  ]
4204
4291
  );
4205
- const draggingContextOverlayValue = useMemo16(
4292
+ const draggingContextOverlayValue = useMemo17(
4206
4293
  () => ({ indentation, isDragging: true }),
4207
4294
  [indentation]
4208
4295
  );
4209
- const renderOverlay = useCallback18(
4296
+ const renderOverlay = useCallback19(
4210
4297
  (index) => /* @__PURE__ */ React31.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragging: true }))),
4211
4298
  [draggingContextOverlayValue, renderItem, data]
4212
4299
  );
4213
- const renderWrappedChild = useCallback18(
4300
+ const renderWrappedChild = useCallback19(
4214
4301
  (index) => {
4215
4302
  const contextValue = getItemContextValue(index);
4216
4303
  const current = renderChild(index);
@@ -4220,7 +4307,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4220
4307
  },
4221
4308
  [getItemContextValue, renderChild]
4222
4309
  );
4223
- const ids = useMemo16(() => data.map(keyExtractor), [keyExtractor, data]);
4310
+ const ids = useMemo17(() => data.map(keyExtractor), [keyExtractor, data]);
4224
4311
  const withSortable = (children) => sortable ? /* @__PURE__ */ React31.createElement(
4225
4312
  Sortable.Root,
4226
4313
  {
@@ -4232,7 +4319,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4232
4319
  children
4233
4320
  ) : children;
4234
4321
  const withScrollable = (children) => scrollable ? /* @__PURE__ */ React31.createElement(ScrollArea, null, children) : children(null);
4235
- const getItemHeight = useCallback18(
4322
+ const getItemHeight = useCallback19(
4236
4323
  (index) => {
4237
4324
  const child = getItemContextValue(index);
4238
4325
  const margin = child?.marginType ? getPositionMargin(child.marginType) : { top: 0, bottom: 0 };
@@ -4241,11 +4328,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4241
4328
  },
4242
4329
  [getItemContextValue, variant]
4243
4330
  );
4244
- const getKey = useCallback18(
4331
+ const getKey = useCallback19(
4245
4332
  (index) => keyExtractor(data[index], index),
4246
4333
  [data, keyExtractor]
4247
4334
  );
4248
- const draggingContextValue = useMemo16(() => ({ indentation }), [indentation]);
4335
+ const draggingContextValue = useMemo17(() => ({ indentation }), [indentation]);
4249
4336
  return /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ React31.createElement(
4250
4337
  RootContainer2,
4251
4338
  {
@@ -4275,7 +4362,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
4275
4362
  });
4276
4363
  var ListViewRoot = memo22(ListViewRootInner);
4277
4364
  var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
4278
- const items = useMemo16(
4365
+ const items = useMemo17(
4279
4366
  () => Children4.toArray(children).flatMap(
4280
4367
  (child) => isValidElement3(child) ? [child] : []
4281
4368
  ),
@@ -4287,11 +4374,11 @@ var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ child
4287
4374
  ref: forwardedRef,
4288
4375
  ...rest,
4289
4376
  data: items,
4290
- keyExtractor: useCallback18(
4377
+ keyExtractor: useCallback19(
4291
4378
  ({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
4292
4379
  []
4293
4380
  ),
4294
- renderItem: useCallback18((item) => item, [])
4381
+ renderItem: useCallback19((item) => item, [])
4295
4382
  }
4296
4383
  );
4297
4384
  });
@@ -4499,12 +4586,12 @@ var InputFieldWithCompletions = memo23(
4499
4586
  hideMenuWhenEmptyValue = false
4500
4587
  }, forwardedRef) {
4501
4588
  const ref = useRef15(null);
4502
- const [isFocused, setIsFocused] = useState15(false);
4503
- const [state, _setState] = useState15({
4589
+ const [isFocused, setIsFocused] = useState16(false);
4590
+ const [state, _setState] = useState16({
4504
4591
  filter: initialValue,
4505
4592
  selectedIndex: 0
4506
4593
  });
4507
- const updateState = useCallback19(
4594
+ const updateState = useCallback20(
4508
4595
  (newState, hoverItem) => {
4509
4596
  const nextState = { ...state, ...newState };
4510
4597
  const nextItems = filterWithGroupedSections(items, nextState.filter);
@@ -4542,7 +4629,7 @@ var InputFieldWithCompletions = memo23(
4542
4629
  }, [initialValue, updateState]);
4543
4630
  const { filter, selectedIndex } = state;
4544
4631
  const listRef = React33.useRef(null);
4545
- const filteredItems = useMemo17(
4632
+ const filteredItems = useMemo18(
4546
4633
  () => filterWithGroupedSections(items, filter),
4547
4634
  [items, filter]
4548
4635
  );
@@ -4558,13 +4645,13 @@ var InputFieldWithCompletions = memo23(
4558
4645
  ),
4559
4646
  ListView.rowHeight * 10.5
4560
4647
  );
4561
- useEffect11(() => {
4648
+ useEffect12(() => {
4562
4649
  if (listRef.current) {
4563
4650
  listRef.current.scrollToIndex(selectedIndex);
4564
4651
  }
4565
4652
  }, [selectedIndex]);
4566
4653
  const lastSubmittedValueRef = useRef15(void 0);
4567
- const selectItem = useCallback19(
4654
+ const selectItem = useCallback20(
4568
4655
  (item) => {
4569
4656
  if (item.type === "sectionHeader")
4570
4657
  return;
@@ -4580,17 +4667,17 @@ var InputFieldWithCompletions = memo23(
4580
4667
  },
4581
4668
  [filter, onSelectItem, onHoverItem, ref]
4582
4669
  );
4583
- const handleChange = useCallback19(
4670
+ const handleChange = useCallback20(
4584
4671
  (value) => updateState({ selectedIndex: 0, filter: value }),
4585
4672
  [updateState]
4586
4673
  );
4587
- const handleBlur = useCallback19(() => {
4674
+ const handleBlur = useCallback20(() => {
4588
4675
  setIsFocused(false);
4589
4676
  const didSubmit = lastSubmittedValueRef.current?.filter === filter;
4590
4677
  updateState({ selectedIndex: 0, filter: initialValue }, "resetHover");
4591
4678
  onBlur?.(didSubmit, filter);
4592
4679
  }, [filter, initialValue, onBlur, updateState]);
4593
- const handleFocus = useCallback19(
4680
+ const handleFocus = useCallback20(
4594
4681
  (event) => {
4595
4682
  setIsFocused(true);
4596
4683
  updateState({ selectedIndex: 0, filter: initialValue });
@@ -4598,11 +4685,11 @@ var InputFieldWithCompletions = memo23(
4598
4685
  },
4599
4686
  [initialValue, onFocus, updateState]
4600
4687
  );
4601
- const handleIndexChange = useCallback19(
4688
+ const handleIndexChange = useCallback20(
4602
4689
  (index) => updateState({ selectedIndex: index }),
4603
4690
  [updateState]
4604
4691
  );
4605
- const handleKeyDown = useCallback19(
4692
+ const handleKeyDown = useCallback20(
4606
4693
  (event) => {
4607
4694
  let handled = false;
4608
4695
  switch (event.key) {
@@ -4800,7 +4887,7 @@ import React35, {
4800
4887
  isValidElement as isValidElement4,
4801
4888
  memo as memo25,
4802
4889
  useLayoutEffect as useLayoutEffect8,
4803
- useMemo as useMemo18,
4890
+ useMemo as useMemo19,
4804
4891
  useRef as useRef16
4805
4892
  } from "react";
4806
4893
  import styled27 from "styled-components";
@@ -4832,12 +4919,12 @@ var LabeledElementView = memo25(function LabeledElementView2({
4832
4919
  ).filter((id) => !!id);
4833
4920
  const serializedIds = elementIds.join(",");
4834
4921
  const containerRef = useRef16(null);
4835
- const refs = useMemo18(() => {
4922
+ const refs = useMemo19(() => {
4836
4923
  return Object.fromEntries(
4837
4924
  serializedIds.split(",").map((id) => [id, createRef()])
4838
4925
  );
4839
4926
  }, [serializedIds]);
4840
- const labelElements = useMemo18(() => {
4927
+ const labelElements = useMemo19(() => {
4841
4928
  return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React35.createElement(
4842
4929
  "span",
4843
4930
  {
@@ -4961,9 +5048,9 @@ import React37, {
4961
5048
  createContext as createContext9,
4962
5049
  forwardRef as forwardRef13,
4963
5050
  memo as memo26,
4964
- useCallback as useCallback20,
5051
+ useCallback as useCallback21,
4965
5052
  useContext as useContext9,
4966
- useMemo as useMemo19
5053
+ useMemo as useMemo20
4967
5054
  } from "react";
4968
5055
  import styled29 from "styled-components";
4969
5056
  var ignoredProps3 = /* @__PURE__ */ new Set(["colorScheme"]);
@@ -5042,8 +5129,8 @@ function ToggleGroupRoot({
5042
5129
  allowEmpty,
5043
5130
  children
5044
5131
  }) {
5045
- const contextValue = useMemo19(() => ({ colorScheme }), [colorScheme]);
5046
- const handleValueChange = useCallback20(
5132
+ const contextValue = useMemo20(() => ({ colorScheme }), [colorScheme]);
5133
+ const handleValueChange = useCallback21(
5047
5134
  (value2) => {
5048
5135
  if (!allowEmpty && !value2)
5049
5136
  return;
@@ -5074,10 +5161,10 @@ import { memoize as memoize2 } from "@noya-app/noya-utils";
5074
5161
  import React38, {
5075
5162
  createContext as createContext10,
5076
5163
  memo as memo27,
5077
- useCallback as useCallback21,
5164
+ useCallback as useCallback22,
5078
5165
  useContext as useContext10,
5079
- useEffect as useEffect12,
5080
- useMemo as useMemo20,
5166
+ useEffect as useEffect13,
5167
+ useMemo as useMemo21,
5081
5168
  useRef as useRef17
5082
5169
  } from "react";
5083
5170
  import styled30 from "styled-components";
@@ -5088,7 +5175,7 @@ var SelectOption = memo27(function SelectOption2({
5088
5175
  onSelect
5089
5176
  }) {
5090
5177
  const { addListener, removeListener } = useContext10(SelectContext);
5091
- useEffect12(() => {
5178
+ useEffect13(() => {
5092
5179
  if (!onSelect)
5093
5180
  return;
5094
5181
  addListener(value, onSelect);
@@ -5144,7 +5231,7 @@ var Select = memo27(function Select2({
5144
5231
  const getTitle = "options" in rest ? rest.getTitle : void 0;
5145
5232
  const onChange = "options" in rest ? rest.onChange : void 0;
5146
5233
  const children = "options" in rest ? void 0 : rest.children;
5147
- const optionElements = useMemo20(
5234
+ const optionElements = useMemo21(
5148
5235
  () => options ? options.map((option, index) => /* @__PURE__ */ React38.createElement(
5149
5236
  SelectOption,
5150
5237
  {
@@ -5157,7 +5244,7 @@ var Select = memo27(function Select2({
5157
5244
  [children, getTitle, onChange, options]
5158
5245
  );
5159
5246
  const listeners = useRef17(/* @__PURE__ */ new Map());
5160
- const contextValue = useMemo20(
5247
+ const contextValue = useMemo21(
5161
5248
  () => ({
5162
5249
  addListener: (value2, listener) => listeners.current.set(value2, listener),
5163
5250
  removeListener: (value2) => listeners.current.delete(value2)
@@ -5170,7 +5257,7 @@ var Select = memo27(function Select2({
5170
5257
  id,
5171
5258
  flex,
5172
5259
  value,
5173
- onChange: useCallback21(
5260
+ onChange: useCallback22(
5174
5261
  (event) => listeners.current.get(event.target.value)?.(),
5175
5262
  [listeners]
5176
5263
  ),
@@ -5182,7 +5269,7 @@ var Select = memo27(function Select2({
5182
5269
 
5183
5270
  // src/components/Slider.tsx
5184
5271
  import * as RadixSlider from "@radix-ui/react-slider";
5185
- import React39, { useCallback as useCallback22, useMemo as useMemo21 } from "react";
5272
+ import React39, { useCallback as useCallback23, useMemo as useMemo22 } from "react";
5186
5273
  import styled31 from "styled-components";
5187
5274
  var StyledSlider = styled31(RadixSlider.Root)({
5188
5275
  flex: "1",
@@ -5223,11 +5310,11 @@ var Slider = function Slider2({
5223
5310
  min,
5224
5311
  max
5225
5312
  }) {
5226
- const arrayValue = useMemo21(
5313
+ const arrayValue = useMemo22(
5227
5314
  () => [Math.min(Math.max(value, min), max)],
5228
5315
  [value, min, max]
5229
5316
  );
5230
- const handleValueChange = useCallback22(
5317
+ const handleValueChange = useCallback23(
5231
5318
  (arrayValue2) => {
5232
5319
  onValueChange(arrayValue2[0]);
5233
5320
  },
@@ -5302,7 +5389,7 @@ var Switch = function Switch2({
5302
5389
  import React41, {
5303
5390
  forwardRef as forwardRef14,
5304
5391
  memo as memo28,
5305
- useCallback as useCallback23,
5392
+ useCallback as useCallback24,
5306
5393
  useContext as useContext11
5307
5394
  } from "react";
5308
5395
  var TreeRow = forwardRef14(function TreeRow2({
@@ -5313,7 +5400,7 @@ var TreeRow = forwardRef14(function TreeRow2({
5313
5400
  ...rest
5314
5401
  }, forwardedRef) {
5315
5402
  const { expandable } = useContext11(ListView.RowContext);
5316
- const handleClickChevron = useCallback23(
5403
+ const handleClickChevron = useCallback24(
5317
5404
  (event) => {
5318
5405
  event.stopPropagation();
5319
5406
  onClickChevron?.({ altKey: event.altKey });
@@ -5642,7 +5729,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
5642
5729
 
5643
5730
  // src/components/ArrayController.tsx
5644
5731
  import { range as range2 } from "@noya-app/noya-utils";
5645
- import React43, { memo as memo30, useCallback as useCallback24, useMemo as useMemo22 } from "react";
5732
+ import React43, { memo as memo30, useCallback as useCallback25, useMemo as useMemo23 } from "react";
5646
5733
  import styled34, { useTheme as useTheme5 } from "styled-components";
5647
5734
 
5648
5735
  // src/components/InspectorPrimitives.tsx
@@ -5774,12 +5861,12 @@ var ArrayController = memo30(function ArrayController2({
5774
5861
  }) {
5775
5862
  const iconColor = useTheme5().colors.icon;
5776
5863
  const primaryLightColor = useTheme5().colors.primaryLight;
5777
- const keys = useMemo22(
5864
+ const keys = useMemo23(
5778
5865
  () => items.map((item, index) => getKey?.(item) ?? index.toString()),
5779
5866
  [getKey, items]
5780
5867
  );
5781
5868
  const indexes = reversed ? range2(0, items.length).reverse() : range2(0, items.length);
5782
- const handleMoveItem = useCallback24(
5869
+ const handleMoveItem = useCallback25(
5783
5870
  (sourceIndex, destinationIndex, position) => {
5784
5871
  if (reversed) {
5785
5872
  if (position === "above") {
@@ -5850,7 +5937,7 @@ var ArrayController = memo30(function ArrayController2({
5850
5937
 
5851
5938
  // src/components/DimensionInput.tsx
5852
5939
  import { round } from "@noya-app/noya-utils";
5853
- import React44, { memo as memo31, useCallback as useCallback25 } from "react";
5940
+ import React44, { memo as memo31, useCallback as useCallback26 } from "react";
5854
5941
  function getNewValue(value, mode, delta) {
5855
5942
  return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
5856
5943
  }
@@ -5864,11 +5951,11 @@ var DimensionInput = memo31(function DimensionInput2({
5864
5951
  disabled,
5865
5952
  trigger = "submit"
5866
5953
  }) {
5867
- const handleNudgeValue = useCallback25(
5954
+ const handleNudgeValue = useCallback26(
5868
5955
  (value2) => onSetValue(value2, "adjust"),
5869
5956
  [onSetValue]
5870
5957
  );
5871
- const handleSetValue = useCallback25(
5958
+ const handleSetValue = useCallback26(
5872
5959
  (value2) => onSetValue(value2, "replace"),
5873
5960
  [onSetValue]
5874
5961
  );