@noya-app/noya-designsystem 0.1.2 → 0.1.3
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/.turbo/turbo-build.log +10 -11
- package/.turbo/turbo-lint.log +1 -2
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +6 -27
- package/dist/index.d.ts +6 -27
- package/dist/index.js +490 -501
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -141
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/src/components/ListView.tsx +2 -2
- package/src/hooks/__tests__/mergeEventHandlers.test.ts +8 -2
- package/src/hooks/mergeEventHandlers.ts +10 -37
- package/src/index.tsx +0 -2
- package/src/utils/mouseEvent.ts +0 -7
package/dist/index.mjs
CHANGED
|
@@ -359,10 +359,10 @@ 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
|
|
362
|
+
useCallback as useCallback11,
|
|
363
363
|
useContext as useContext3,
|
|
364
364
|
useMemo as useMemo6,
|
|
365
|
-
useRef as
|
|
365
|
+
useRef as useRef11,
|
|
366
366
|
useState as useState10
|
|
367
367
|
} from "react";
|
|
368
368
|
import styled13 from "styled-components";
|
|
@@ -665,21 +665,24 @@ import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
|
665
665
|
// ../noya-react-utils/src/hooks/useIsMounted.ts
|
|
666
666
|
import { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
667
667
|
|
|
668
|
+
// ../noya-react-utils/src/hooks/useLateReference.ts
|
|
669
|
+
import { useCallback as useCallback5, useLayoutEffect, useRef as useRef5 } from "react";
|
|
670
|
+
|
|
668
671
|
// ../noya-react-utils/src/hooks/useLazyValue.ts
|
|
669
|
-
import { useRef as
|
|
672
|
+
import { useRef as useRef6 } from "react";
|
|
670
673
|
|
|
671
674
|
// ../noya-react-utils/src/hooks/useMutableState.ts
|
|
672
|
-
import { useCallback as
|
|
675
|
+
import { useCallback as useCallback6, useMemo as useMemo3, useState as useState5 } from "react";
|
|
673
676
|
|
|
674
677
|
// ../noya-react-utils/src/hooks/usePixelRatio.ts
|
|
675
678
|
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
676
679
|
|
|
677
680
|
// ../noya-react-utils/src/hooks/useShallowArray.ts
|
|
678
681
|
import { isShallowEqual } from "@noya-app/noya-utils";
|
|
679
|
-
import { useRef as
|
|
682
|
+
import { useRef as useRef7 } from "react";
|
|
680
683
|
|
|
681
684
|
// ../noya-react-utils/src/hooks/useStableCallback.ts
|
|
682
|
-
import { useCallback as
|
|
685
|
+
import { useCallback as useCallback7, useLayoutEffect as useLayoutEffect2, useRef as useRef8 } from "react";
|
|
683
686
|
|
|
684
687
|
// ../noya-react-utils/src/hooks/useSystemColorScheme.ts
|
|
685
688
|
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
@@ -704,12 +707,12 @@ import React16, {
|
|
|
704
707
|
forwardRef as forwardRef7,
|
|
705
708
|
isValidElement as isValidElement2,
|
|
706
709
|
memo as memo9,
|
|
707
|
-
useCallback as
|
|
710
|
+
useCallback as useCallback10,
|
|
708
711
|
useContext as useContext2,
|
|
709
712
|
useEffect as useEffect9,
|
|
710
|
-
useLayoutEffect as
|
|
713
|
+
useLayoutEffect as useLayoutEffect4,
|
|
711
714
|
useMemo as useMemo5,
|
|
712
|
-
useRef as
|
|
715
|
+
useRef as useRef10
|
|
713
716
|
} from "react";
|
|
714
717
|
import styled12 from "styled-components";
|
|
715
718
|
|
|
@@ -744,7 +747,7 @@ import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
|
744
747
|
import React12, {
|
|
745
748
|
forwardRef as forwardRef4,
|
|
746
749
|
memo as memo7,
|
|
747
|
-
useCallback as
|
|
750
|
+
useCallback as useCallback8,
|
|
748
751
|
useMemo as useMemo4
|
|
749
752
|
} from "react";
|
|
750
753
|
import styled9 from "styled-components";
|
|
@@ -905,7 +908,7 @@ var DropdownMenuItem = memo7(function ContextMenuItem({
|
|
|
905
908
|
items,
|
|
906
909
|
shortcut
|
|
907
910
|
}) {
|
|
908
|
-
const handleSelectItem =
|
|
911
|
+
const handleSelectItem = useCallback8(() => {
|
|
909
912
|
if (!value)
|
|
910
913
|
return;
|
|
911
914
|
onSelect(value);
|
|
@@ -987,10 +990,10 @@ var DropdownMenu = memo7(DropdownMenuRoot);
|
|
|
987
990
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
988
991
|
import React13, {
|
|
989
992
|
forwardRef as forwardRef5,
|
|
990
|
-
useCallback as
|
|
993
|
+
useCallback as useCallback9,
|
|
991
994
|
useEffect as useEffect8,
|
|
992
|
-
useLayoutEffect as
|
|
993
|
-
useRef as
|
|
995
|
+
useLayoutEffect as useLayoutEffect3,
|
|
996
|
+
useRef as useRef9,
|
|
994
997
|
useState as useState9
|
|
995
998
|
} from "react";
|
|
996
999
|
|
|
@@ -1056,14 +1059,14 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
|
|
|
1056
1059
|
onFocusCapture,
|
|
1057
1060
|
...rest
|
|
1058
1061
|
}, forwardedRef) {
|
|
1059
|
-
const handleBlur =
|
|
1062
|
+
const handleBlur = useCallback9(
|
|
1060
1063
|
(event) => {
|
|
1061
1064
|
onBlur?.(event);
|
|
1062
1065
|
onFocusChange?.(false);
|
|
1063
1066
|
},
|
|
1064
1067
|
[onBlur, onFocusChange]
|
|
1065
1068
|
);
|
|
1066
|
-
const handleFocusCapture =
|
|
1069
|
+
const handleFocusCapture = useCallback9(
|
|
1067
1070
|
(event) => {
|
|
1068
1071
|
onFocusCapture?.(event);
|
|
1069
1072
|
onFocusChange?.(true);
|
|
@@ -1077,7 +1080,7 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
|
|
|
1077
1080
|
...rest,
|
|
1078
1081
|
value,
|
|
1079
1082
|
onKeyDown,
|
|
1080
|
-
onChange:
|
|
1083
|
+
onChange: useCallback9(
|
|
1081
1084
|
(event) => onChange(event.target.value),
|
|
1082
1085
|
[onChange]
|
|
1083
1086
|
),
|
|
@@ -1098,15 +1101,15 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1098
1101
|
...rest
|
|
1099
1102
|
}, forwardedRef) {
|
|
1100
1103
|
const ref = React13.useRef(null);
|
|
1101
|
-
const latestValue =
|
|
1104
|
+
const latestValue = useRef9(value);
|
|
1102
1105
|
latestValue.current = value;
|
|
1103
|
-
const userDidEdit =
|
|
1104
|
-
const isSubmitTriggeredByEscapeKey =
|
|
1106
|
+
const userDidEdit = useRef9(false);
|
|
1107
|
+
const isSubmitTriggeredByEscapeKey = useRef9(false);
|
|
1105
1108
|
const [internalValue, setInternalValue] = useState9("");
|
|
1106
|
-
|
|
1109
|
+
useLayoutEffect3(() => {
|
|
1107
1110
|
setInternalValue(value);
|
|
1108
1111
|
}, [value]);
|
|
1109
|
-
const handleSubmit =
|
|
1112
|
+
const handleSubmit = useCallback9(() => {
|
|
1110
1113
|
const submissionValue = isSubmitTriggeredByEscapeKey.current ? value : internalValue;
|
|
1111
1114
|
isSubmitTriggeredByEscapeKey.current = false;
|
|
1112
1115
|
if (submissionValue === value && !allowSubmittingWithSameValue)
|
|
@@ -1116,13 +1119,13 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1116
1119
|
setInternalValue(latestValue.current);
|
|
1117
1120
|
}, [allowSubmittingWithSameValue, value, internalValue, onSubmit]);
|
|
1118
1121
|
useGlobalInputBlurListener(
|
|
1119
|
-
|
|
1122
|
+
useCallback9(() => {
|
|
1120
1123
|
if (ref.current !== document.activeElement)
|
|
1121
1124
|
return;
|
|
1122
1125
|
handleSubmit();
|
|
1123
1126
|
}, [handleSubmit])
|
|
1124
1127
|
);
|
|
1125
|
-
const handleKeyDown =
|
|
1128
|
+
const handleKeyDown = useCallback9(
|
|
1126
1129
|
(event) => {
|
|
1127
1130
|
if (event.key === "Enter") {
|
|
1128
1131
|
handleSubmit();
|
|
@@ -1137,14 +1140,14 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1137
1140
|
},
|
|
1138
1141
|
[onKeyDown, handleSubmit]
|
|
1139
1142
|
);
|
|
1140
|
-
const handleChange =
|
|
1143
|
+
const handleChange = useCallback9(
|
|
1141
1144
|
(event) => {
|
|
1142
1145
|
userDidEdit.current = true;
|
|
1143
1146
|
setInternalValue(event.target.value);
|
|
1144
1147
|
},
|
|
1145
1148
|
[]
|
|
1146
1149
|
);
|
|
1147
|
-
const handleBlur =
|
|
1150
|
+
const handleBlur = useCallback9(
|
|
1148
1151
|
(event) => {
|
|
1149
1152
|
onBlur?.(event);
|
|
1150
1153
|
onFocusChange?.(false);
|
|
@@ -1152,17 +1155,17 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1152
1155
|
},
|
|
1153
1156
|
[onBlur, onFocusChange, handleSubmit]
|
|
1154
1157
|
);
|
|
1155
|
-
const handleFocusCapture =
|
|
1158
|
+
const handleFocusCapture = useCallback9(
|
|
1156
1159
|
(event) => {
|
|
1157
1160
|
onFocusCapture?.(event);
|
|
1158
1161
|
onFocusChange?.(true);
|
|
1159
1162
|
},
|
|
1160
1163
|
[onFocusCapture, onFocusChange]
|
|
1161
1164
|
);
|
|
1162
|
-
const autoSubmitTimeoutRef =
|
|
1165
|
+
const autoSubmitTimeoutRef = useRef9(
|
|
1163
1166
|
null
|
|
1164
1167
|
);
|
|
1165
|
-
const latestHandleSubmit =
|
|
1168
|
+
const latestHandleSubmit = useRef9(handleSubmit);
|
|
1166
1169
|
latestHandleSubmit.current = handleSubmit;
|
|
1167
1170
|
useEffect8(() => {
|
|
1168
1171
|
if (submitAutomaticallyAfterDelay) {
|
|
@@ -1196,11 +1199,11 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1196
1199
|
});
|
|
1197
1200
|
var TextInput_default = forwardRef5(function TextInput(props, forwardedRef) {
|
|
1198
1201
|
const commonProps = {
|
|
1199
|
-
onPointerDown:
|
|
1202
|
+
onPointerDown: useCallback9(
|
|
1200
1203
|
(event) => event.stopPropagation(),
|
|
1201
1204
|
[]
|
|
1202
1205
|
),
|
|
1203
|
-
onClick:
|
|
1206
|
+
onClick: useCallback9(
|
|
1204
1207
|
(event) => event.stopPropagation(),
|
|
1205
1208
|
[]
|
|
1206
1209
|
),
|
|
@@ -1396,8 +1399,8 @@ var LabelContainer = styled12.label(({ theme, labelPosition, hasDropdown, pointe
|
|
|
1396
1399
|
var InputFieldLabel = memo9(
|
|
1397
1400
|
forwardRef7(function InputFieldLabel2({ children = false, pointerEvents = "none", style: style3 }, forwardedRef) {
|
|
1398
1401
|
const { labelPosition, hasDropdown, setLabelWidth } = useContext2(InputFieldContext);
|
|
1399
|
-
const ref =
|
|
1400
|
-
|
|
1402
|
+
const ref = useRef10(null);
|
|
1403
|
+
useLayoutEffect4(() => {
|
|
1401
1404
|
if (!setLabelWidth)
|
|
1402
1405
|
return;
|
|
1403
1406
|
const width = ref.current?.getBoundingClientRect().width;
|
|
@@ -1452,7 +1455,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
|
|
|
1452
1455
|
onClick
|
|
1453
1456
|
}) {
|
|
1454
1457
|
const { size: size2, inputRef } = useContext2(InputFieldContext);
|
|
1455
|
-
const defaultHandleClick =
|
|
1458
|
+
const defaultHandleClick = useCallback10(
|
|
1456
1459
|
(event) => {
|
|
1457
1460
|
if (inputRef && typeof inputRef !== "function") {
|
|
1458
1461
|
inputRef.current?.focus();
|
|
@@ -1463,7 +1466,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
|
|
|
1463
1466
|
},
|
|
1464
1467
|
[inputRef]
|
|
1465
1468
|
);
|
|
1466
|
-
const handlePointerDown =
|
|
1469
|
+
const handlePointerDown = useCallback10((event) => {
|
|
1467
1470
|
event.preventDefault();
|
|
1468
1471
|
event.stopPropagation();
|
|
1469
1472
|
}, []);
|
|
@@ -1564,13 +1567,13 @@ var InputFieldInput = forwardRef7(function InputFieldInput2(props, forwardedRef)
|
|
|
1564
1567
|
onFocusChange,
|
|
1565
1568
|
setInputRef
|
|
1566
1569
|
} = useContext2(InputFieldContext);
|
|
1567
|
-
const handleFocusChange =
|
|
1570
|
+
const handleFocusChange = useCallback10(
|
|
1568
1571
|
(isFocused) => {
|
|
1569
1572
|
onFocusChange(isFocused);
|
|
1570
1573
|
},
|
|
1571
1574
|
[onFocusChange]
|
|
1572
1575
|
);
|
|
1573
|
-
|
|
1576
|
+
useLayoutEffect4(() => {
|
|
1574
1577
|
setInputRef?.(forwardedRef);
|
|
1575
1578
|
}, [forwardedRef, setInputRef]);
|
|
1576
1579
|
return /* @__PURE__ */ React16.createElement(
|
|
@@ -1630,7 +1633,7 @@ function InputFieldNumberInput(props) {
|
|
|
1630
1633
|
const { value, placeholder, onNudge } = props;
|
|
1631
1634
|
const onSubmit = "onSubmit" in props ? props.onSubmit : void 0;
|
|
1632
1635
|
const onChange = "onChange" in props ? props.onChange : void 0;
|
|
1633
|
-
const handleSubmit =
|
|
1636
|
+
const handleSubmit = useCallback10(
|
|
1634
1637
|
(value2) => {
|
|
1635
1638
|
const newValue = parseNumber(value2);
|
|
1636
1639
|
if (!isNaN(newValue)) {
|
|
@@ -1639,7 +1642,7 @@ function InputFieldNumberInput(props) {
|
|
|
1639
1642
|
},
|
|
1640
1643
|
[onSubmit]
|
|
1641
1644
|
);
|
|
1642
|
-
const handleKeyDown =
|
|
1645
|
+
const handleKeyDown = useCallback10(
|
|
1643
1646
|
(event) => {
|
|
1644
1647
|
const amount = handleNudge(event);
|
|
1645
1648
|
if (!amount)
|
|
@@ -1650,7 +1653,7 @@ function InputFieldNumberInput(props) {
|
|
|
1650
1653
|
},
|
|
1651
1654
|
[onNudge]
|
|
1652
1655
|
);
|
|
1653
|
-
const handleChange =
|
|
1656
|
+
const handleChange = useCallback10(
|
|
1654
1657
|
(value2) => {
|
|
1655
1658
|
onChange?.(parseNumber(value2));
|
|
1656
1659
|
},
|
|
@@ -1697,7 +1700,7 @@ function InputFieldRoot({
|
|
|
1697
1700
|
const [isFocused, setIsFocused] = React16.useState(false);
|
|
1698
1701
|
const [measuredLabelSize, setMeasuredLabelSize] = React16.useState();
|
|
1699
1702
|
const [measuredWidth, setMeasuredWidth] = React16.useState();
|
|
1700
|
-
const handleFocusChange =
|
|
1703
|
+
const handleFocusChange = useCallback10(
|
|
1701
1704
|
(isFocused2) => {
|
|
1702
1705
|
setIsFocused(isFocused2);
|
|
1703
1706
|
onFocusChange?.(isFocused2);
|
|
@@ -1792,18 +1795,18 @@ var DialogProvider = function DialogProvider2({
|
|
|
1792
1795
|
}) {
|
|
1793
1796
|
const [contents, setContents] = useState10();
|
|
1794
1797
|
const isOpen = !!contents;
|
|
1795
|
-
const close =
|
|
1798
|
+
const close = useCallback11(() => {
|
|
1796
1799
|
if (!contents)
|
|
1797
1800
|
return;
|
|
1798
1801
|
contents.resolve(void 0);
|
|
1799
1802
|
}, [contents]);
|
|
1800
|
-
const submit =
|
|
1803
|
+
const submit = useCallback11(() => {
|
|
1801
1804
|
if (!contents || !contents.inputValue)
|
|
1802
1805
|
return;
|
|
1803
1806
|
contents.resolve(contents.inputValue);
|
|
1804
1807
|
setContents(void 0);
|
|
1805
1808
|
}, [contents]);
|
|
1806
|
-
const open =
|
|
1809
|
+
const open = useCallback11(
|
|
1807
1810
|
(title, inputValue = "") => {
|
|
1808
1811
|
const { promise, resolve } = createDeferredPromise();
|
|
1809
1812
|
setContents({
|
|
@@ -1818,7 +1821,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1818
1821
|
},
|
|
1819
1822
|
[]
|
|
1820
1823
|
);
|
|
1821
|
-
const handleKeyDown =
|
|
1824
|
+
const handleKeyDown = useCallback11(
|
|
1822
1825
|
(event) => {
|
|
1823
1826
|
if (event.key !== "Enter")
|
|
1824
1827
|
return;
|
|
@@ -1828,9 +1831,9 @@ var DialogProvider = function DialogProvider2({
|
|
|
1828
1831
|
},
|
|
1829
1832
|
[submit]
|
|
1830
1833
|
);
|
|
1831
|
-
const inputRef =
|
|
1832
|
-
const dialogRef =
|
|
1833
|
-
const containsElement =
|
|
1834
|
+
const inputRef = useRef11(null);
|
|
1835
|
+
const dialogRef = useRef11(null);
|
|
1836
|
+
const containsElement = useCallback11((element) => {
|
|
1834
1837
|
if (!dialogRef.current)
|
|
1835
1838
|
return false;
|
|
1836
1839
|
return dialogRef.current.containsElement(element);
|
|
@@ -1850,7 +1853,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1850
1853
|
ref: dialogRef,
|
|
1851
1854
|
title: contents?.title,
|
|
1852
1855
|
open: isOpen,
|
|
1853
|
-
onOpenChange:
|
|
1856
|
+
onOpenChange: useCallback11(
|
|
1854
1857
|
(isOpen2) => {
|
|
1855
1858
|
if (!isOpen2) {
|
|
1856
1859
|
close();
|
|
@@ -1858,7 +1861,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1858
1861
|
},
|
|
1859
1862
|
[close]
|
|
1860
1863
|
),
|
|
1861
|
-
onOpenAutoFocus:
|
|
1864
|
+
onOpenAutoFocus: useCallback11((event) => {
|
|
1862
1865
|
event.stopPropagation();
|
|
1863
1866
|
event.preventDefault();
|
|
1864
1867
|
inputRef.current?.focus();
|
|
@@ -2167,7 +2170,7 @@ import { useKeyboardShortcuts as useKeyboardShortcuts2 } from "@noya-app/noya-ke
|
|
|
2167
2170
|
import * as RadixContextMenu from "@radix-ui/react-context-menu";
|
|
2168
2171
|
import React21, {
|
|
2169
2172
|
memo as memo12,
|
|
2170
|
-
useCallback as
|
|
2173
|
+
useCallback as useCallback12,
|
|
2171
2174
|
useMemo as useMemo9
|
|
2172
2175
|
} from "react";
|
|
2173
2176
|
import styled15 from "styled-components";
|
|
@@ -2192,11 +2195,11 @@ var ContextMenuItem2 = memo12(function ContextMenuItem3({
|
|
|
2192
2195
|
items,
|
|
2193
2196
|
shortcut
|
|
2194
2197
|
}) {
|
|
2195
|
-
const handlePointerDown =
|
|
2198
|
+
const handlePointerDown = useCallback12(
|
|
2196
2199
|
(event) => event.stopPropagation(),
|
|
2197
2200
|
[]
|
|
2198
2201
|
);
|
|
2199
|
-
const handleSelectItem =
|
|
2202
|
+
const handleSelectItem = useCallback12(() => {
|
|
2200
2203
|
if (!value)
|
|
2201
2204
|
return;
|
|
2202
2205
|
onSelect(value);
|
|
@@ -2250,7 +2253,7 @@ function ContextMenuRoot({
|
|
|
2250
2253
|
[isNested, items, onSelect, shouldBindKeyboardShortcuts]
|
|
2251
2254
|
);
|
|
2252
2255
|
useKeyboardShortcuts2(keymap);
|
|
2253
|
-
const onPointerDown =
|
|
2256
|
+
const onPointerDown = useCallback12((event) => {
|
|
2254
2257
|
event.preventDefault();
|
|
2255
2258
|
}, []);
|
|
2256
2259
|
const RootComponent = isNested ? RadixContextMenu.Sub : RadixContextMenu.Root;
|
|
@@ -2293,7 +2296,7 @@ var DividerVertical = memo13(function DividerVertical2(props) {
|
|
|
2293
2296
|
|
|
2294
2297
|
// src/components/DraggableMenuButton.tsx
|
|
2295
2298
|
import { DragHandleDots2Icon } from "@noya-app/noya-icons";
|
|
2296
|
-
import React23, { memo as memo14, useCallback as
|
|
2299
|
+
import React23, { memo as memo14, useCallback as useCallback13, useState as useState12 } from "react";
|
|
2297
2300
|
import styled17 from "styled-components";
|
|
2298
2301
|
var DotButtonElement = styled17.div(({ theme }) => ({
|
|
2299
2302
|
cursor: "pointer",
|
|
@@ -2321,7 +2324,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2321
2324
|
const color = useDesignSystemTheme().colors.icon;
|
|
2322
2325
|
const [open, setOpen] = useState12(false);
|
|
2323
2326
|
const [downPosition, setDownPosition] = React23.useState(null);
|
|
2324
|
-
const handlePointerDownCapture =
|
|
2327
|
+
const handlePointerDownCapture = useCallback13(
|
|
2325
2328
|
(event) => {
|
|
2326
2329
|
if (open) {
|
|
2327
2330
|
setDownPosition(null);
|
|
@@ -2334,7 +2337,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2334
2337
|
},
|
|
2335
2338
|
[open]
|
|
2336
2339
|
);
|
|
2337
|
-
const handlePointerUp =
|
|
2340
|
+
const handlePointerUp = useCallback13(
|
|
2338
2341
|
(event) => {
|
|
2339
2342
|
if (open || !downPosition) {
|
|
2340
2343
|
setDownPosition(null);
|
|
@@ -2350,7 +2353,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2350
2353
|
},
|
|
2351
2354
|
[downPosition, open]
|
|
2352
2355
|
);
|
|
2353
|
-
const handleOpenChange =
|
|
2356
|
+
const handleOpenChange = useCallback13(
|
|
2354
2357
|
(isOpen) => {
|
|
2355
2358
|
if (!isOpen)
|
|
2356
2359
|
setOpen(false);
|
|
@@ -2745,7 +2748,7 @@ function useImageData(ref) {
|
|
|
2745
2748
|
}
|
|
2746
2749
|
|
|
2747
2750
|
// src/hooks/useObjectURL.ts
|
|
2748
|
-
import { useLayoutEffect as
|
|
2751
|
+
import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo11 } from "react";
|
|
2749
2752
|
function useObjectURL(object) {
|
|
2750
2753
|
const objectURL = useMemo11(() => {
|
|
2751
2754
|
if (object instanceof Blob)
|
|
@@ -2753,7 +2756,7 @@ function useObjectURL(object) {
|
|
|
2753
2756
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
2754
2757
|
return URL.createObjectURL(new Blob([bytes]));
|
|
2755
2758
|
}, [object]);
|
|
2756
|
-
|
|
2759
|
+
useLayoutEffect5(() => {
|
|
2757
2760
|
return () => URL.revokeObjectURL(objectURL);
|
|
2758
2761
|
}, [objectURL]);
|
|
2759
2762
|
return objectURL;
|
|
@@ -2931,7 +2934,7 @@ import {
|
|
|
2931
2934
|
hsvaToRgba,
|
|
2932
2935
|
rgbaToHsva as rgbaToHsva2
|
|
2933
2936
|
} from "@noya-app/noya-colorpicker";
|
|
2934
|
-
import React27, { memo as memo18, useCallback as
|
|
2937
|
+
import React27, { memo as memo18, useCallback as useCallback14, useMemo as useMemo13 } from "react";
|
|
2935
2938
|
var GradientPicker = memo18(function GradientPicker2({
|
|
2936
2939
|
value,
|
|
2937
2940
|
selectedStop,
|
|
@@ -2954,13 +2957,13 @@ var GradientPicker = memo18(function GradientPicker2({
|
|
|
2954
2957
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
2955
2958
|
[value, selectedStop]
|
|
2956
2959
|
);
|
|
2957
|
-
const handleChangeColor =
|
|
2960
|
+
const handleChangeColor = useCallback14(
|
|
2958
2961
|
(value2) => {
|
|
2959
2962
|
onChangeColor(rgbaToSketchColor(value2));
|
|
2960
2963
|
},
|
|
2961
2964
|
[onChangeColor]
|
|
2962
2965
|
);
|
|
2963
|
-
const handleAddGradientStop =
|
|
2966
|
+
const handleAddGradientStop = useCallback14(
|
|
2964
2967
|
(value2, position) => {
|
|
2965
2968
|
onAdd(rgbaToSketchColor(value2), position);
|
|
2966
2969
|
},
|
|
@@ -3025,7 +3028,7 @@ import React29, {
|
|
|
3025
3028
|
createContext as createContext6,
|
|
3026
3029
|
forwardRef as forwardRef9,
|
|
3027
3030
|
memo as memo20,
|
|
3028
|
-
useCallback as
|
|
3031
|
+
useCallback as useCallback16,
|
|
3029
3032
|
useContext as useContext6,
|
|
3030
3033
|
useMemo as useMemo14
|
|
3031
3034
|
} from "react";
|
|
@@ -3033,7 +3036,7 @@ import styled22, { keyframes as keyframes2 } from "styled-components";
|
|
|
3033
3036
|
|
|
3034
3037
|
// src/components/ScrollArea.tsx
|
|
3035
3038
|
import * as RadixScrollArea from "@radix-ui/react-scroll-area";
|
|
3036
|
-
import React28, { memo as memo19, useCallback as
|
|
3039
|
+
import React28, { memo as memo19, useCallback as useCallback15, useState as useState13 } from "react";
|
|
3037
3040
|
import styled21 from "styled-components";
|
|
3038
3041
|
var SCROLLBAR_SIZE = 10;
|
|
3039
3042
|
var StyledViewport = styled21(RadixScrollArea.Viewport)({
|
|
@@ -3066,7 +3069,7 @@ var ScrollArea = memo19(function ScrollArea2({ children }) {
|
|
|
3066
3069
|
return /* @__PURE__ */ React28.createElement(Container2, null, /* @__PURE__ */ React28.createElement(RadixScrollArea.Root, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ React28.createElement(
|
|
3067
3070
|
StyledViewport,
|
|
3068
3071
|
{
|
|
3069
|
-
ref:
|
|
3072
|
+
ref: useCallback15(
|
|
3070
3073
|
(ref) => setScrollElementRef(ref),
|
|
3071
3074
|
[]
|
|
3072
3075
|
)
|
|
@@ -3276,7 +3279,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3276
3279
|
}
|
|
3277
3280
|
});
|
|
3278
3281
|
const { textPosition, bordered, disabled } = useContext6(GridViewContext);
|
|
3279
|
-
const handleClick =
|
|
3282
|
+
const handleClick = useCallback16(
|
|
3280
3283
|
(event) => {
|
|
3281
3284
|
event.stopPropagation();
|
|
3282
3285
|
event.preventDefault();
|
|
@@ -3285,7 +3288,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3285
3288
|
},
|
|
3286
3289
|
[onClick, onPress]
|
|
3287
3290
|
);
|
|
3288
|
-
const handleKeyDown =
|
|
3291
|
+
const handleKeyDown = useCallback16(
|
|
3289
3292
|
(event) => {
|
|
3290
3293
|
if (event.key === "Enter" || event.key === " ") {
|
|
3291
3294
|
event.stopPropagation();
|
|
@@ -3353,7 +3356,7 @@ function GridViewRoot({
|
|
|
3353
3356
|
bordered = false,
|
|
3354
3357
|
disabled = false
|
|
3355
3358
|
}) {
|
|
3356
|
-
const handleClick =
|
|
3359
|
+
const handleClick = useCallback16(
|
|
3357
3360
|
(event) => {
|
|
3358
3361
|
event.stopPropagation();
|
|
3359
3362
|
event.preventDefault();
|
|
@@ -3399,12 +3402,12 @@ import { chunkBy, partition } from "@noya-app/noya-utils";
|
|
|
3399
3402
|
import React33, {
|
|
3400
3403
|
forwardRef as forwardRef12,
|
|
3401
3404
|
memo as memo23,
|
|
3402
|
-
useCallback as
|
|
3405
|
+
useCallback as useCallback19,
|
|
3403
3406
|
useEffect as useEffect11,
|
|
3404
3407
|
useImperativeHandle as useImperativeHandle3,
|
|
3405
|
-
useLayoutEffect as
|
|
3408
|
+
useLayoutEffect as useLayoutEffect7,
|
|
3406
3409
|
useMemo as useMemo17,
|
|
3407
|
-
useRef as
|
|
3410
|
+
useRef as useRef15,
|
|
3408
3411
|
useState as useState15
|
|
3409
3412
|
} from "react";
|
|
3410
3413
|
import styled25 from "styled-components";
|
|
@@ -3489,12 +3492,12 @@ import React31, {
|
|
|
3489
3492
|
forwardRef as forwardRef10,
|
|
3490
3493
|
isValidElement as isValidElement3,
|
|
3491
3494
|
memo as memo22,
|
|
3492
|
-
useCallback as
|
|
3495
|
+
useCallback as useCallback18,
|
|
3493
3496
|
useContext as useContext8,
|
|
3494
3497
|
useImperativeHandle as useImperativeHandle2,
|
|
3495
|
-
useLayoutEffect as
|
|
3498
|
+
useLayoutEffect as useLayoutEffect6,
|
|
3496
3499
|
useMemo as useMemo16,
|
|
3497
|
-
useRef as
|
|
3500
|
+
useRef as useRef14
|
|
3498
3501
|
} from "react";
|
|
3499
3502
|
import { WindowScroller } from "react-virtualized";
|
|
3500
3503
|
import { VariableSizeList } from "react-window";
|
|
@@ -3523,14 +3526,6 @@ function mergeEventHandlers(...handlerMaps) {
|
|
|
3523
3526
|
);
|
|
3524
3527
|
}
|
|
3525
3528
|
|
|
3526
|
-
// src/utils/mouseEvent.ts
|
|
3527
|
-
function isLeftButtonClicked(event) {
|
|
3528
|
-
return event.button === 0;
|
|
3529
|
-
}
|
|
3530
|
-
function isRightButtonClicked(event) {
|
|
3531
|
-
return event.button === 2;
|
|
3532
|
-
}
|
|
3533
|
-
|
|
3534
3529
|
// src/components/Sortable.tsx
|
|
3535
3530
|
import {
|
|
3536
3531
|
closestCenter,
|
|
@@ -3548,10 +3543,10 @@ import {
|
|
|
3548
3543
|
import React30, {
|
|
3549
3544
|
createContext as createContext7,
|
|
3550
3545
|
memo as memo21,
|
|
3551
|
-
useCallback as
|
|
3546
|
+
useCallback as useCallback17,
|
|
3552
3547
|
useContext as useContext7,
|
|
3553
3548
|
useMemo as useMemo15,
|
|
3554
|
-
useRef as
|
|
3549
|
+
useRef as useRef13,
|
|
3555
3550
|
useState as useState14
|
|
3556
3551
|
} from "react";
|
|
3557
3552
|
import { createPortal } from "react-dom";
|
|
@@ -3609,7 +3604,7 @@ function SortableItem({
|
|
|
3609
3604
|
const eventY = activatorEvent?.clientY ?? 0;
|
|
3610
3605
|
const offsetLeft = eventX + position.x;
|
|
3611
3606
|
const offsetTop = eventY + position.y;
|
|
3612
|
-
const ref =
|
|
3607
|
+
const ref = useCallback17((node) => setNodeRef(node), [setNodeRef]);
|
|
3613
3608
|
return children({
|
|
3614
3609
|
ref,
|
|
3615
3610
|
...attributes,
|
|
@@ -3641,21 +3636,21 @@ function SortableRoot({
|
|
|
3641
3636
|
})
|
|
3642
3637
|
);
|
|
3643
3638
|
const [activeIndex, setActiveIndex] = useState14();
|
|
3644
|
-
const activatorEvent =
|
|
3645
|
-
const setActivatorEvent =
|
|
3639
|
+
const activatorEvent = useRef13(null);
|
|
3640
|
+
const setActivatorEvent = useCallback17((event) => {
|
|
3646
3641
|
activatorEvent.current = event;
|
|
3647
3642
|
}, []);
|
|
3648
3643
|
const [position, setPosition] = useState14({ x: 0, y: 0 });
|
|
3649
|
-
const handleDragStart =
|
|
3644
|
+
const handleDragStart = useCallback17(
|
|
3650
3645
|
(event) => {
|
|
3651
3646
|
setActiveIndex(keys.indexOf(event.active.id));
|
|
3652
3647
|
},
|
|
3653
3648
|
[keys]
|
|
3654
3649
|
);
|
|
3655
|
-
const handleDragMove =
|
|
3650
|
+
const handleDragMove = useCallback17((event) => {
|
|
3656
3651
|
setPosition({ ...event.delta });
|
|
3657
3652
|
}, []);
|
|
3658
|
-
const handleDragEnd =
|
|
3653
|
+
const handleDragEnd = useCallback17(
|
|
3659
3654
|
(event) => {
|
|
3660
3655
|
const { active, over } = event;
|
|
3661
3656
|
setActiveIndex(void 0);
|
|
@@ -3755,8 +3750,8 @@ function ListViewEditableRowTitle({
|
|
|
3755
3750
|
autoFocus,
|
|
3756
3751
|
placeholder
|
|
3757
3752
|
}) {
|
|
3758
|
-
const inputRef =
|
|
3759
|
-
|
|
3753
|
+
const inputRef = useRef14(null);
|
|
3754
|
+
useLayoutEffect6(() => {
|
|
3760
3755
|
const element = inputRef.current;
|
|
3761
3756
|
if (!element || !autoFocus)
|
|
3762
3757
|
return;
|
|
@@ -3924,16 +3919,16 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3924
3919
|
onHoverChange
|
|
3925
3920
|
});
|
|
3926
3921
|
const { indentation, isDragging } = useContext8(DraggingContext);
|
|
3927
|
-
const handlePress =
|
|
3922
|
+
const handlePress = useCallback18(
|
|
3928
3923
|
(event) => {
|
|
3929
3924
|
event.preventDefault();
|
|
3930
|
-
if (
|
|
3925
|
+
if (event.button !== 0)
|
|
3931
3926
|
return;
|
|
3932
3927
|
onPress?.(event);
|
|
3933
3928
|
},
|
|
3934
3929
|
[onPress]
|
|
3935
3930
|
);
|
|
3936
|
-
const handleDoubleClick =
|
|
3931
|
+
const handleDoubleClick = useCallback18(
|
|
3937
3932
|
(event) => {
|
|
3938
3933
|
event.stopPropagation();
|
|
3939
3934
|
onDoubleClick?.();
|
|
@@ -4030,13 +4025,13 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4030
4025
|
keyExtractor,
|
|
4031
4026
|
renderItem
|
|
4032
4027
|
}, ref) {
|
|
4033
|
-
const listRef =
|
|
4028
|
+
const listRef = useRef14(null);
|
|
4034
4029
|
useImperativeHandle2(ref, () => ({
|
|
4035
4030
|
scrollToIndex(index) {
|
|
4036
4031
|
listRef.current?.scrollToItem(index);
|
|
4037
4032
|
}
|
|
4038
4033
|
}));
|
|
4039
|
-
|
|
4034
|
+
useLayoutEffect6(() => {
|
|
4040
4035
|
listRef.current?.resetAfterIndex(0);
|
|
4041
4036
|
}, [
|
|
4042
4037
|
// When items change, we need to re-render the virtualized list,
|
|
@@ -4057,7 +4052,7 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4057
4052
|
scrollElement,
|
|
4058
4053
|
style: useMemo16(() => ({ flex: "1 1 auto" }), [])
|
|
4059
4054
|
},
|
|
4060
|
-
|
|
4055
|
+
useCallback18(
|
|
4061
4056
|
({
|
|
4062
4057
|
registerChild,
|
|
4063
4058
|
onChildScroll,
|
|
@@ -4122,7 +4117,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4122
4117
|
colorScheme = "primary",
|
|
4123
4118
|
gap = 0
|
|
4124
4119
|
}, forwardedRef) {
|
|
4125
|
-
const handleClick =
|
|
4120
|
+
const handleClick = useCallback18(
|
|
4126
4121
|
(event) => {
|
|
4127
4122
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
4128
4123
|
return;
|
|
@@ -4132,11 +4127,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4132
4127
|
},
|
|
4133
4128
|
[onPress]
|
|
4134
4129
|
);
|
|
4135
|
-
const renderChild =
|
|
4130
|
+
const renderChild = useCallback18(
|
|
4136
4131
|
(index) => renderItem(data[index], index, { isDragging: false }),
|
|
4137
4132
|
[data, renderItem]
|
|
4138
4133
|
);
|
|
4139
|
-
const getItemContextValue =
|
|
4134
|
+
const getItemContextValue = useCallback18(
|
|
4140
4135
|
(i) => {
|
|
4141
4136
|
const current = renderChild(i);
|
|
4142
4137
|
if (!isValidElement3(current))
|
|
@@ -4200,11 +4195,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4200
4195
|
() => ({ indentation, isDragging: true }),
|
|
4201
4196
|
[indentation]
|
|
4202
4197
|
);
|
|
4203
|
-
const renderOverlay =
|
|
4198
|
+
const renderOverlay = useCallback18(
|
|
4204
4199
|
(index) => /* @__PURE__ */ React31.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragging: true }))),
|
|
4205
4200
|
[draggingContextOverlayValue, renderItem, data]
|
|
4206
4201
|
);
|
|
4207
|
-
const renderWrappedChild =
|
|
4202
|
+
const renderWrappedChild = useCallback18(
|
|
4208
4203
|
(index) => {
|
|
4209
4204
|
const contextValue = getItemContextValue(index);
|
|
4210
4205
|
const current = renderChild(index);
|
|
@@ -4226,7 +4221,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4226
4221
|
children
|
|
4227
4222
|
) : children;
|
|
4228
4223
|
const withScrollable = (children) => scrollable ? /* @__PURE__ */ React31.createElement(ScrollArea, null, children) : children(null);
|
|
4229
|
-
const getItemHeight =
|
|
4224
|
+
const getItemHeight = useCallback18(
|
|
4230
4225
|
(index) => {
|
|
4231
4226
|
const child = getItemContextValue(index);
|
|
4232
4227
|
const margin = child?.marginType ? getPositionMargin(child.marginType) : { top: 0, bottom: 0 };
|
|
@@ -4235,7 +4230,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4235
4230
|
},
|
|
4236
4231
|
[getItemContextValue, variant]
|
|
4237
4232
|
);
|
|
4238
|
-
const getKey =
|
|
4233
|
+
const getKey = useCallback18(
|
|
4239
4234
|
(index) => keyExtractor(data[index], index),
|
|
4240
4235
|
[data, keyExtractor]
|
|
4241
4236
|
);
|
|
@@ -4281,11 +4276,11 @@ var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ child
|
|
|
4281
4276
|
ref: forwardedRef,
|
|
4282
4277
|
...rest,
|
|
4283
4278
|
data: items,
|
|
4284
|
-
keyExtractor:
|
|
4279
|
+
keyExtractor: useCallback18(
|
|
4285
4280
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
4286
4281
|
[]
|
|
4287
4282
|
),
|
|
4288
|
-
renderItem:
|
|
4283
|
+
renderItem: useCallback18((item) => item, [])
|
|
4289
4284
|
}
|
|
4290
4285
|
);
|
|
4291
4286
|
});
|
|
@@ -4492,13 +4487,13 @@ var InputFieldWithCompletions = memo23(
|
|
|
4492
4487
|
hideChildrenWhenFocused = false,
|
|
4493
4488
|
hideMenuWhenEmptyValue = false
|
|
4494
4489
|
}, forwardedRef) {
|
|
4495
|
-
const ref =
|
|
4490
|
+
const ref = useRef15(null);
|
|
4496
4491
|
const [isFocused, setIsFocused] = useState15(false);
|
|
4497
4492
|
const [state, _setState] = useState15({
|
|
4498
4493
|
filter: initialValue,
|
|
4499
4494
|
selectedIndex: 0
|
|
4500
4495
|
});
|
|
4501
|
-
const updateState =
|
|
4496
|
+
const updateState = useCallback19(
|
|
4502
4497
|
(newState, hoverItem) => {
|
|
4503
4498
|
const nextState = { ...state, ...newState };
|
|
4504
4499
|
const nextItems = filterWithGroupedSections(items, nextState.filter);
|
|
@@ -4527,8 +4522,8 @@ var InputFieldWithCompletions = memo23(
|
|
|
4527
4522
|
},
|
|
4528
4523
|
[items, onChange, onHoverItem, state]
|
|
4529
4524
|
);
|
|
4530
|
-
const initialValueRef =
|
|
4531
|
-
|
|
4525
|
+
const initialValueRef = useRef15(initialValue);
|
|
4526
|
+
useLayoutEffect7(() => {
|
|
4532
4527
|
if (initialValueRef.current === initialValue)
|
|
4533
4528
|
return;
|
|
4534
4529
|
initialValueRef.current = initialValue;
|
|
@@ -4557,8 +4552,8 @@ var InputFieldWithCompletions = memo23(
|
|
|
4557
4552
|
listRef.current.scrollToIndex(selectedIndex);
|
|
4558
4553
|
}
|
|
4559
4554
|
}, [selectedIndex]);
|
|
4560
|
-
const lastSubmittedValueRef =
|
|
4561
|
-
const selectItem =
|
|
4555
|
+
const lastSubmittedValueRef = useRef15(void 0);
|
|
4556
|
+
const selectItem = useCallback19(
|
|
4562
4557
|
(item) => {
|
|
4563
4558
|
if (item.type === "sectionHeader")
|
|
4564
4559
|
return;
|
|
@@ -4574,17 +4569,17 @@ var InputFieldWithCompletions = memo23(
|
|
|
4574
4569
|
},
|
|
4575
4570
|
[filter, onSelectItem, onHoverItem, ref]
|
|
4576
4571
|
);
|
|
4577
|
-
const handleChange =
|
|
4572
|
+
const handleChange = useCallback19(
|
|
4578
4573
|
(value) => updateState({ selectedIndex: 0, filter: value }),
|
|
4579
4574
|
[updateState]
|
|
4580
4575
|
);
|
|
4581
|
-
const handleBlur =
|
|
4576
|
+
const handleBlur = useCallback19(() => {
|
|
4582
4577
|
setIsFocused(false);
|
|
4583
4578
|
const didSubmit = lastSubmittedValueRef.current?.filter === filter;
|
|
4584
4579
|
updateState({ selectedIndex: 0, filter: initialValue }, "resetHover");
|
|
4585
4580
|
onBlur?.(didSubmit, filter);
|
|
4586
4581
|
}, [filter, initialValue, onBlur, updateState]);
|
|
4587
|
-
const handleFocus =
|
|
4582
|
+
const handleFocus = useCallback19(
|
|
4588
4583
|
(event) => {
|
|
4589
4584
|
setIsFocused(true);
|
|
4590
4585
|
updateState({ selectedIndex: 0, filter: initialValue });
|
|
@@ -4592,11 +4587,11 @@ var InputFieldWithCompletions = memo23(
|
|
|
4592
4587
|
},
|
|
4593
4588
|
[initialValue, onFocus, updateState]
|
|
4594
4589
|
);
|
|
4595
|
-
const handleIndexChange =
|
|
4590
|
+
const handleIndexChange = useCallback19(
|
|
4596
4591
|
(index) => updateState({ selectedIndex: index }),
|
|
4597
4592
|
[updateState]
|
|
4598
4593
|
);
|
|
4599
|
-
const handleKeyDown =
|
|
4594
|
+
const handleKeyDown = useCallback19(
|
|
4600
4595
|
(event) => {
|
|
4601
4596
|
let handled = false;
|
|
4602
4597
|
switch (event.key) {
|
|
@@ -4793,9 +4788,9 @@ import React35, {
|
|
|
4793
4788
|
Fragment,
|
|
4794
4789
|
isValidElement as isValidElement4,
|
|
4795
4790
|
memo as memo25,
|
|
4796
|
-
useLayoutEffect as
|
|
4791
|
+
useLayoutEffect as useLayoutEffect8,
|
|
4797
4792
|
useMemo as useMemo18,
|
|
4798
|
-
useRef as
|
|
4793
|
+
useRef as useRef16
|
|
4799
4794
|
} from "react";
|
|
4800
4795
|
import styled27 from "styled-components";
|
|
4801
4796
|
var Container4 = styled27.div(({ theme }) => ({
|
|
@@ -4825,7 +4820,7 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
4825
4820
|
(child) => isValidElement4(child) && "id" in child.props ? child.props.id : null
|
|
4826
4821
|
).filter((id) => !!id);
|
|
4827
4822
|
const serializedIds = elementIds.join(",");
|
|
4828
|
-
const containerRef =
|
|
4823
|
+
const containerRef = useRef16(null);
|
|
4829
4824
|
const refs = useMemo18(() => {
|
|
4830
4825
|
return Object.fromEntries(
|
|
4831
4826
|
serializedIds.split(",").map((id) => [id, createRef()])
|
|
@@ -4845,7 +4840,7 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
4845
4840
|
})
|
|
4846
4841
|
));
|
|
4847
4842
|
}, [refs, serializedIds, renderLabel]);
|
|
4848
|
-
|
|
4843
|
+
useLayoutEffect8(() => {
|
|
4849
4844
|
if (!containerRef.current)
|
|
4850
4845
|
return;
|
|
4851
4846
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -4955,7 +4950,7 @@ import React37, {
|
|
|
4955
4950
|
createContext as createContext9,
|
|
4956
4951
|
forwardRef as forwardRef13,
|
|
4957
4952
|
memo as memo26,
|
|
4958
|
-
useCallback as
|
|
4953
|
+
useCallback as useCallback20,
|
|
4959
4954
|
useContext as useContext9,
|
|
4960
4955
|
useMemo as useMemo19
|
|
4961
4956
|
} from "react";
|
|
@@ -5036,7 +5031,7 @@ function ToggleGroupRoot({
|
|
|
5036
5031
|
children
|
|
5037
5032
|
}) {
|
|
5038
5033
|
const contextValue = useMemo19(() => ({ colorScheme }), [colorScheme]);
|
|
5039
|
-
const handleValueChange =
|
|
5034
|
+
const handleValueChange = useCallback20(
|
|
5040
5035
|
(value2) => {
|
|
5041
5036
|
if (!allowEmpty && !value2)
|
|
5042
5037
|
return;
|
|
@@ -5067,11 +5062,11 @@ import { memoize as memoize2 } from "@noya-app/noya-utils";
|
|
|
5067
5062
|
import React38, {
|
|
5068
5063
|
createContext as createContext10,
|
|
5069
5064
|
memo as memo27,
|
|
5070
|
-
useCallback as
|
|
5065
|
+
useCallback as useCallback21,
|
|
5071
5066
|
useContext as useContext10,
|
|
5072
5067
|
useEffect as useEffect12,
|
|
5073
5068
|
useMemo as useMemo20,
|
|
5074
|
-
useRef as
|
|
5069
|
+
useRef as useRef17
|
|
5075
5070
|
} from "react";
|
|
5076
5071
|
import styled30 from "styled-components";
|
|
5077
5072
|
var SelectContext = createContext10(void 0);
|
|
@@ -5149,7 +5144,7 @@ var Select = memo27(function Select2({
|
|
|
5149
5144
|
)) : children,
|
|
5150
5145
|
[children, getTitle, onChange, options]
|
|
5151
5146
|
);
|
|
5152
|
-
const listeners =
|
|
5147
|
+
const listeners = useRef17(/* @__PURE__ */ new Map());
|
|
5153
5148
|
const contextValue = useMemo20(
|
|
5154
5149
|
() => ({
|
|
5155
5150
|
addListener: (value2, listener) => listeners.current.set(value2, listener),
|
|
@@ -5163,7 +5158,7 @@ var Select = memo27(function Select2({
|
|
|
5163
5158
|
id,
|
|
5164
5159
|
flex,
|
|
5165
5160
|
value,
|
|
5166
|
-
onChange:
|
|
5161
|
+
onChange: useCallback21(
|
|
5167
5162
|
(event) => listeners.current.get(event.target.value)?.(),
|
|
5168
5163
|
[listeners]
|
|
5169
5164
|
),
|
|
@@ -5175,7 +5170,7 @@ var Select = memo27(function Select2({
|
|
|
5175
5170
|
|
|
5176
5171
|
// src/components/Slider.tsx
|
|
5177
5172
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
5178
|
-
import React39, { useCallback as
|
|
5173
|
+
import React39, { useCallback as useCallback22, useMemo as useMemo21 } from "react";
|
|
5179
5174
|
import styled31 from "styled-components";
|
|
5180
5175
|
var StyledSlider = styled31(RadixSlider.Root)({
|
|
5181
5176
|
flex: "1",
|
|
@@ -5220,7 +5215,7 @@ var Slider = function Slider2({
|
|
|
5220
5215
|
() => [Math.min(Math.max(value, min), max)],
|
|
5221
5216
|
[value, min, max]
|
|
5222
5217
|
);
|
|
5223
|
-
const handleValueChange =
|
|
5218
|
+
const handleValueChange = useCallback22(
|
|
5224
5219
|
(arrayValue2) => {
|
|
5225
5220
|
onValueChange(arrayValue2[0]);
|
|
5226
5221
|
},
|
|
@@ -5295,7 +5290,7 @@ var Switch = function Switch2({
|
|
|
5295
5290
|
import React41, {
|
|
5296
5291
|
forwardRef as forwardRef14,
|
|
5297
5292
|
memo as memo28,
|
|
5298
|
-
useCallback as
|
|
5293
|
+
useCallback as useCallback23,
|
|
5299
5294
|
useContext as useContext11
|
|
5300
5295
|
} from "react";
|
|
5301
5296
|
var TreeRow = forwardRef14(function TreeRow2({
|
|
@@ -5306,7 +5301,7 @@ var TreeRow = forwardRef14(function TreeRow2({
|
|
|
5306
5301
|
...rest
|
|
5307
5302
|
}, forwardedRef) {
|
|
5308
5303
|
const { expandable } = useContext11(ListView.RowContext);
|
|
5309
|
-
const handleClickChevron =
|
|
5304
|
+
const handleClickChevron = useCallback23(
|
|
5310
5305
|
(event) => {
|
|
5311
5306
|
event.stopPropagation();
|
|
5312
5307
|
onClickChevron?.({ altKey: event.altKey });
|
|
@@ -5621,7 +5616,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
5621
5616
|
|
|
5622
5617
|
// src/components/ArrayController.tsx
|
|
5623
5618
|
import { range as range2 } from "@noya-app/noya-utils";
|
|
5624
|
-
import React43, { memo as memo30, useCallback as
|
|
5619
|
+
import React43, { memo as memo30, useCallback as useCallback24, useMemo as useMemo22 } from "react";
|
|
5625
5620
|
import styled34, { useTheme as useTheme5 } from "styled-components";
|
|
5626
5621
|
|
|
5627
5622
|
// src/components/InspectorPrimitives.tsx
|
|
@@ -5757,7 +5752,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5757
5752
|
[getKey, items]
|
|
5758
5753
|
);
|
|
5759
5754
|
const indexes = reversed ? range2(0, items.length).reverse() : range2(0, items.length);
|
|
5760
|
-
const handleMoveItem =
|
|
5755
|
+
const handleMoveItem = useCallback24(
|
|
5761
5756
|
(sourceIndex, destinationIndex, position) => {
|
|
5762
5757
|
if (reversed) {
|
|
5763
5758
|
if (position === "above") {
|
|
@@ -5828,7 +5823,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5828
5823
|
|
|
5829
5824
|
// src/components/DimensionInput.tsx
|
|
5830
5825
|
import { round } from "@noya-app/noya-utils";
|
|
5831
|
-
import React44, { memo as memo31, useCallback as
|
|
5826
|
+
import React44, { memo as memo31, useCallback as useCallback25 } from "react";
|
|
5832
5827
|
function getNewValue(value, mode, delta) {
|
|
5833
5828
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
5834
5829
|
}
|
|
@@ -5842,11 +5837,11 @@ var DimensionInput = memo31(function DimensionInput2({
|
|
|
5842
5837
|
disabled,
|
|
5843
5838
|
trigger = "submit"
|
|
5844
5839
|
}) {
|
|
5845
|
-
const handleNudgeValue =
|
|
5840
|
+
const handleNudgeValue = useCallback25(
|
|
5846
5841
|
(value2) => onSetValue(value2, "adjust"),
|
|
5847
5842
|
[onSetValue]
|
|
5848
5843
|
);
|
|
5849
|
-
const handleSetValue =
|
|
5844
|
+
const handleSetValue = useCallback25(
|
|
5850
5845
|
(value2) => onSetValue(value2, "replace"),
|
|
5851
5846
|
[onSetValue]
|
|
5852
5847
|
);
|
|
@@ -5932,11 +5927,8 @@ export {
|
|
|
5932
5927
|
fuzzyTokenize,
|
|
5933
5928
|
getGradientBackground,
|
|
5934
5929
|
getNewValue,
|
|
5935
|
-
isLeftButtonClicked,
|
|
5936
|
-
isRightButtonClicked,
|
|
5937
5930
|
light_exports as lightTheme,
|
|
5938
5931
|
mediaQuery,
|
|
5939
|
-
mergeEventHandlers,
|
|
5940
5932
|
normalizeListDestinationIndex,
|
|
5941
5933
|
rgbaToSketchColor,
|
|
5942
5934
|
size,
|