@noya-app/noya-designsystem 0.1.6 → 0.1.8
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 +9 -9
- package/CHANGELOG.md +17 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +502 -491
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +184 -168
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/Button.tsx +1 -1
- package/src/components/DraggableMenuButton.tsx +21 -15
- package/src/components/InspectorPrimitives.tsx +1 -0
- package/src/components/ListView.tsx +10 -5
- package/src/components/Select.tsx +1 -1
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
|
|
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
|
|
362
|
+
useCallback as useCallback12,
|
|
363
363
|
useContext as useContext3,
|
|
364
|
-
useMemo as
|
|
364
|
+
useMemo as useMemo7,
|
|
365
365
|
useRef as useRef11,
|
|
366
|
-
useState as
|
|
366
|
+
useState as useState11
|
|
367
367
|
} from "react";
|
|
368
368
|
import styled13 from "styled-components";
|
|
369
369
|
|
|
@@ -678,22 +678,30 @@ 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
|
|
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
|
|
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
|
|
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
|
|
704
|
+
import { useEffect as useEffect7, useState as useState9 } from "react";
|
|
697
705
|
|
|
698
706
|
// ../noya-react-utils/src/utils/assignRef.ts
|
|
699
707
|
function assignRef(ref, value) {
|
|
@@ -711,11 +719,11 @@ import React16, {
|
|
|
711
719
|
forwardRef as forwardRef7,
|
|
712
720
|
isValidElement as isValidElement2,
|
|
713
721
|
memo as memo9,
|
|
714
|
-
useCallback as
|
|
722
|
+
useCallback as useCallback11,
|
|
715
723
|
useContext as useContext2,
|
|
716
|
-
useEffect as
|
|
724
|
+
useEffect as useEffect10,
|
|
717
725
|
useLayoutEffect as useLayoutEffect4,
|
|
718
|
-
useMemo as
|
|
726
|
+
useMemo as useMemo6,
|
|
719
727
|
useRef as useRef10
|
|
720
728
|
} from "react";
|
|
721
729
|
import styled12 from "styled-components";
|
|
@@ -751,8 +759,8 @@ import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
|
751
759
|
import React12, {
|
|
752
760
|
forwardRef as forwardRef4,
|
|
753
761
|
memo as memo7,
|
|
754
|
-
useCallback as
|
|
755
|
-
useMemo as
|
|
762
|
+
useCallback as useCallback9,
|
|
763
|
+
useMemo as useMemo5
|
|
756
764
|
} from "react";
|
|
757
765
|
import styled9 from "styled-components";
|
|
758
766
|
|
|
@@ -912,7 +920,7 @@ var DropdownMenuItem = memo7(function ContextMenuItem({
|
|
|
912
920
|
items,
|
|
913
921
|
shortcut
|
|
914
922
|
}) {
|
|
915
|
-
const handleSelectItem =
|
|
923
|
+
const handleSelectItem = useCallback9(() => {
|
|
916
924
|
if (!value)
|
|
917
925
|
return;
|
|
918
926
|
onSelect(value);
|
|
@@ -952,7 +960,7 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
|
|
|
952
960
|
const hasCheckedItem = items.some(
|
|
953
961
|
(item) => item !== SEPARATOR_ITEM && item.checked
|
|
954
962
|
);
|
|
955
|
-
const keymap =
|
|
963
|
+
const keymap = useMemo5(
|
|
956
964
|
() => isNested || shouldBindKeyboardShortcuts === false ? {} : getKeyboardShortcutsForMenuItems(items, onSelect),
|
|
957
965
|
[isNested, items, onSelect, shouldBindKeyboardShortcuts]
|
|
958
966
|
);
|
|
@@ -960,7 +968,7 @@ var DropdownMenuRoot = forwardRef4(function DropdownMenuRoot2({
|
|
|
960
968
|
const RootComponent = isNested ? RadixDropdownMenu.Sub : RadixDropdownMenu.Root;
|
|
961
969
|
const TriggerComponent = isNested ? RadixDropdownMenu.SubTrigger : RadixDropdownMenu.Trigger;
|
|
962
970
|
const ContentComponent = isNested ? SubContent2 : Content5;
|
|
963
|
-
const contentStyle =
|
|
971
|
+
const contentStyle = useMemo5(() => ({ zIndex: 1e3 }), []);
|
|
964
972
|
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
973
|
ContentComponent,
|
|
966
974
|
{
|
|
@@ -994,15 +1002,15 @@ var DropdownMenu = memo7(DropdownMenuRoot);
|
|
|
994
1002
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
995
1003
|
import React13, {
|
|
996
1004
|
forwardRef as forwardRef5,
|
|
997
|
-
useCallback as
|
|
998
|
-
useEffect as
|
|
1005
|
+
useCallback as useCallback10,
|
|
1006
|
+
useEffect as useEffect9,
|
|
999
1007
|
useLayoutEffect as useLayoutEffect3,
|
|
1000
1008
|
useRef as useRef9,
|
|
1001
|
-
useState as
|
|
1009
|
+
useState as useState10
|
|
1002
1010
|
} from "react";
|
|
1003
1011
|
|
|
1004
1012
|
// src/contexts/GlobalInputBlurContext.tsx
|
|
1005
|
-
import { createContext, useContext, useEffect as
|
|
1013
|
+
import { createContext, useContext, useEffect as useEffect8 } from "react";
|
|
1006
1014
|
var defaultValue = /* @__PURE__ */ (() => {
|
|
1007
1015
|
const listeners = [];
|
|
1008
1016
|
const value = {
|
|
@@ -1030,7 +1038,7 @@ var useGlobalInputBlur = () => {
|
|
|
1030
1038
|
};
|
|
1031
1039
|
function useGlobalInputBlurListener(f) {
|
|
1032
1040
|
const context = useGlobalInputBlur();
|
|
1033
|
-
|
|
1041
|
+
useEffect8(() => {
|
|
1034
1042
|
context.addListener(f);
|
|
1035
1043
|
return () => {
|
|
1036
1044
|
context.removeListener(f);
|
|
@@ -1063,14 +1071,14 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
|
|
|
1063
1071
|
onFocusCapture,
|
|
1064
1072
|
...rest
|
|
1065
1073
|
}, forwardedRef) {
|
|
1066
|
-
const handleBlur =
|
|
1074
|
+
const handleBlur = useCallback10(
|
|
1067
1075
|
(event) => {
|
|
1068
1076
|
onBlur?.(event);
|
|
1069
1077
|
onFocusChange?.(false);
|
|
1070
1078
|
},
|
|
1071
1079
|
[onBlur, onFocusChange]
|
|
1072
1080
|
);
|
|
1073
|
-
const handleFocusCapture =
|
|
1081
|
+
const handleFocusCapture = useCallback10(
|
|
1074
1082
|
(event) => {
|
|
1075
1083
|
onFocusCapture?.(event);
|
|
1076
1084
|
onFocusChange?.(true);
|
|
@@ -1084,7 +1092,7 @@ var ControlledTextInput = forwardRef5(function ControlledTextInput2({
|
|
|
1084
1092
|
...rest,
|
|
1085
1093
|
value,
|
|
1086
1094
|
onKeyDown,
|
|
1087
|
-
onChange:
|
|
1095
|
+
onChange: useCallback10(
|
|
1088
1096
|
(event) => onChange(event.target.value),
|
|
1089
1097
|
[onChange]
|
|
1090
1098
|
),
|
|
@@ -1109,11 +1117,11 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1109
1117
|
latestValue.current = value;
|
|
1110
1118
|
const userDidEdit = useRef9(false);
|
|
1111
1119
|
const isSubmitTriggeredByEscapeKey = useRef9(false);
|
|
1112
|
-
const [internalValue, setInternalValue] =
|
|
1120
|
+
const [internalValue, setInternalValue] = useState10("");
|
|
1113
1121
|
useLayoutEffect3(() => {
|
|
1114
1122
|
setInternalValue(value);
|
|
1115
1123
|
}, [value]);
|
|
1116
|
-
const handleSubmit =
|
|
1124
|
+
const handleSubmit = useCallback10(() => {
|
|
1117
1125
|
const submissionValue = isSubmitTriggeredByEscapeKey.current ? value : internalValue;
|
|
1118
1126
|
isSubmitTriggeredByEscapeKey.current = false;
|
|
1119
1127
|
if (submissionValue === value && !allowSubmittingWithSameValue)
|
|
@@ -1123,13 +1131,13 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1123
1131
|
setInternalValue(latestValue.current);
|
|
1124
1132
|
}, [allowSubmittingWithSameValue, value, internalValue, onSubmit]);
|
|
1125
1133
|
useGlobalInputBlurListener(
|
|
1126
|
-
|
|
1134
|
+
useCallback10(() => {
|
|
1127
1135
|
if (ref.current !== document.activeElement)
|
|
1128
1136
|
return;
|
|
1129
1137
|
handleSubmit();
|
|
1130
1138
|
}, [handleSubmit])
|
|
1131
1139
|
);
|
|
1132
|
-
const handleKeyDown =
|
|
1140
|
+
const handleKeyDown = useCallback10(
|
|
1133
1141
|
(event) => {
|
|
1134
1142
|
if (event.key === "Enter") {
|
|
1135
1143
|
handleSubmit();
|
|
@@ -1144,14 +1152,14 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1144
1152
|
},
|
|
1145
1153
|
[onKeyDown, handleSubmit]
|
|
1146
1154
|
);
|
|
1147
|
-
const handleChange =
|
|
1155
|
+
const handleChange = useCallback10(
|
|
1148
1156
|
(event) => {
|
|
1149
1157
|
userDidEdit.current = true;
|
|
1150
1158
|
setInternalValue(event.target.value);
|
|
1151
1159
|
},
|
|
1152
1160
|
[]
|
|
1153
1161
|
);
|
|
1154
|
-
const handleBlur =
|
|
1162
|
+
const handleBlur = useCallback10(
|
|
1155
1163
|
(event) => {
|
|
1156
1164
|
onBlur?.(event);
|
|
1157
1165
|
onFocusChange?.(false);
|
|
@@ -1159,7 +1167,7 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1159
1167
|
},
|
|
1160
1168
|
[onBlur, onFocusChange, handleSubmit]
|
|
1161
1169
|
);
|
|
1162
|
-
const handleFocusCapture =
|
|
1170
|
+
const handleFocusCapture = useCallback10(
|
|
1163
1171
|
(event) => {
|
|
1164
1172
|
onFocusCapture?.(event);
|
|
1165
1173
|
onFocusChange?.(true);
|
|
@@ -1171,7 +1179,7 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1171
1179
|
);
|
|
1172
1180
|
const latestHandleSubmit = useRef9(handleSubmit);
|
|
1173
1181
|
latestHandleSubmit.current = handleSubmit;
|
|
1174
|
-
|
|
1182
|
+
useEffect9(() => {
|
|
1175
1183
|
if (submitAutomaticallyAfterDelay) {
|
|
1176
1184
|
if (autoSubmitTimeoutRef.current) {
|
|
1177
1185
|
clearTimeout(autoSubmitTimeoutRef.current);
|
|
@@ -1203,11 +1211,11 @@ var SubmittableTextInput = forwardRef5(function SubmittableTextInput2({
|
|
|
1203
1211
|
});
|
|
1204
1212
|
var TextInput_default = forwardRef5(function TextInput(props, forwardedRef) {
|
|
1205
1213
|
const commonProps = {
|
|
1206
|
-
onPointerDown:
|
|
1214
|
+
onPointerDown: useCallback10(
|
|
1207
1215
|
(event) => event.stopPropagation(),
|
|
1208
1216
|
[]
|
|
1209
1217
|
),
|
|
1210
|
-
onClick:
|
|
1218
|
+
onClick: useCallback10(
|
|
1211
1219
|
(event) => event.stopPropagation(),
|
|
1212
1220
|
[]
|
|
1213
1221
|
),
|
|
@@ -1438,7 +1446,7 @@ var DropdownContainer = styled12.span(({ theme }) => ({
|
|
|
1438
1446
|
}));
|
|
1439
1447
|
var InputFieldDropdownMenu = memo9(function InputFieldDropdownMenu2({ id, items, onSelect, children }) {
|
|
1440
1448
|
const { size: size2 } = useContext2(InputFieldContext);
|
|
1441
|
-
const contentStyle =
|
|
1449
|
+
const contentStyle = useMemo6(
|
|
1442
1450
|
() => ({
|
|
1443
1451
|
margin: "-4px 0",
|
|
1444
1452
|
minHeight: size2 === "small" ? "15px" : void 0
|
|
@@ -1459,7 +1467,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
|
|
|
1459
1467
|
onClick
|
|
1460
1468
|
}) {
|
|
1461
1469
|
const { size: size2, inputRef } = useContext2(InputFieldContext);
|
|
1462
|
-
const defaultHandleClick =
|
|
1470
|
+
const defaultHandleClick = useCallback11(
|
|
1463
1471
|
(event) => {
|
|
1464
1472
|
if (inputRef && typeof inputRef !== "function") {
|
|
1465
1473
|
inputRef.current?.focus();
|
|
@@ -1470,7 +1478,7 @@ var InputFieldButton = memo9(function InputFieldButton2({
|
|
|
1470
1478
|
},
|
|
1471
1479
|
[inputRef]
|
|
1472
1480
|
);
|
|
1473
|
-
const handlePointerDown =
|
|
1481
|
+
const handlePointerDown = useCallback11((event) => {
|
|
1474
1482
|
event.preventDefault();
|
|
1475
1483
|
event.stopPropagation();
|
|
1476
1484
|
}, []);
|
|
@@ -1571,7 +1579,7 @@ var InputFieldInput = forwardRef7(function InputFieldInput2(props, forwardedRef)
|
|
|
1571
1579
|
onFocusChange,
|
|
1572
1580
|
setInputRef
|
|
1573
1581
|
} = useContext2(InputFieldContext);
|
|
1574
|
-
const handleFocusChange =
|
|
1582
|
+
const handleFocusChange = useCallback11(
|
|
1575
1583
|
(isFocused) => {
|
|
1576
1584
|
onFocusChange(isFocused);
|
|
1577
1585
|
},
|
|
@@ -1637,7 +1645,7 @@ function InputFieldNumberInput(props) {
|
|
|
1637
1645
|
const { value, placeholder, onNudge } = props;
|
|
1638
1646
|
const onSubmit = "onSubmit" in props ? props.onSubmit : void 0;
|
|
1639
1647
|
const onChange = "onChange" in props ? props.onChange : void 0;
|
|
1640
|
-
const handleSubmit =
|
|
1648
|
+
const handleSubmit = useCallback11(
|
|
1641
1649
|
(value2) => {
|
|
1642
1650
|
const newValue = parseNumber(value2);
|
|
1643
1651
|
if (!isNaN(newValue)) {
|
|
@@ -1646,7 +1654,7 @@ function InputFieldNumberInput(props) {
|
|
|
1646
1654
|
},
|
|
1647
1655
|
[onSubmit]
|
|
1648
1656
|
);
|
|
1649
|
-
const handleKeyDown =
|
|
1657
|
+
const handleKeyDown = useCallback11(
|
|
1650
1658
|
(event) => {
|
|
1651
1659
|
const amount = handleNudge(event);
|
|
1652
1660
|
if (!amount)
|
|
@@ -1657,7 +1665,7 @@ function InputFieldNumberInput(props) {
|
|
|
1657
1665
|
},
|
|
1658
1666
|
[onNudge]
|
|
1659
1667
|
);
|
|
1660
|
-
const handleChange =
|
|
1668
|
+
const handleChange = useCallback11(
|
|
1661
1669
|
(value2) => {
|
|
1662
1670
|
onChange?.(parseNumber(value2));
|
|
1663
1671
|
},
|
|
@@ -1704,7 +1712,7 @@ function InputFieldRoot({
|
|
|
1704
1712
|
const [isFocused, setIsFocused] = React16.useState(false);
|
|
1705
1713
|
const [measuredLabelSize, setMeasuredLabelSize] = React16.useState();
|
|
1706
1714
|
const [measuredWidth, setMeasuredWidth] = React16.useState();
|
|
1707
|
-
const handleFocusChange =
|
|
1715
|
+
const handleFocusChange = useCallback11(
|
|
1708
1716
|
(isFocused2) => {
|
|
1709
1717
|
setIsFocused(isFocused2);
|
|
1710
1718
|
onFocusChange?.(isFocused2);
|
|
@@ -1712,14 +1720,14 @@ function InputFieldRoot({
|
|
|
1712
1720
|
[onFocusChange]
|
|
1713
1721
|
);
|
|
1714
1722
|
const [inputRef, setInputRef] = React16.useState();
|
|
1715
|
-
|
|
1723
|
+
useEffect10(() => {
|
|
1716
1724
|
if (inputRef && typeof inputRef !== "function") {
|
|
1717
1725
|
setMeasuredWidth?.(
|
|
1718
1726
|
isFocused ? inputRef?.current?.getBoundingClientRect().width : void 0
|
|
1719
1727
|
);
|
|
1720
1728
|
}
|
|
1721
1729
|
}, [inputRef, isFocused]);
|
|
1722
|
-
const contextValue =
|
|
1730
|
+
const contextValue = useMemo6(
|
|
1723
1731
|
() => ({
|
|
1724
1732
|
labelPosition,
|
|
1725
1733
|
labelSize: measuredLabelSize ?? labelSize ?? 6,
|
|
@@ -1797,20 +1805,20 @@ var DialogContext = createContext3(void 0);
|
|
|
1797
1805
|
var DialogProvider = function DialogProvider2({
|
|
1798
1806
|
children
|
|
1799
1807
|
}) {
|
|
1800
|
-
const [contents, setContents] =
|
|
1808
|
+
const [contents, setContents] = useState11();
|
|
1801
1809
|
const isOpen = !!contents;
|
|
1802
|
-
const close =
|
|
1810
|
+
const close = useCallback12(() => {
|
|
1803
1811
|
if (!contents)
|
|
1804
1812
|
return;
|
|
1805
1813
|
contents.resolve(void 0);
|
|
1806
1814
|
}, [contents]);
|
|
1807
|
-
const submit =
|
|
1815
|
+
const submit = useCallback12(() => {
|
|
1808
1816
|
if (!contents || !contents.inputValue)
|
|
1809
1817
|
return;
|
|
1810
1818
|
contents.resolve(contents.inputValue);
|
|
1811
1819
|
setContents(void 0);
|
|
1812
1820
|
}, [contents]);
|
|
1813
|
-
const open =
|
|
1821
|
+
const open = useCallback12(
|
|
1814
1822
|
(title, inputValue = "") => {
|
|
1815
1823
|
const { promise, resolve } = createDeferredPromise();
|
|
1816
1824
|
setContents({
|
|
@@ -1825,7 +1833,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1825
1833
|
},
|
|
1826
1834
|
[]
|
|
1827
1835
|
);
|
|
1828
|
-
const handleKeyDown =
|
|
1836
|
+
const handleKeyDown = useCallback12(
|
|
1829
1837
|
(event) => {
|
|
1830
1838
|
if (event.key !== "Enter")
|
|
1831
1839
|
return;
|
|
@@ -1837,7 +1845,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1837
1845
|
);
|
|
1838
1846
|
const inputRef = useRef11(null);
|
|
1839
1847
|
const dialogRef = useRef11(null);
|
|
1840
|
-
const containsElement =
|
|
1848
|
+
const containsElement = useCallback12((element) => {
|
|
1841
1849
|
if (!dialogRef.current)
|
|
1842
1850
|
return false;
|
|
1843
1851
|
return dialogRef.current.containsElement(element);
|
|
@@ -1845,7 +1853,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1845
1853
|
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
|
|
1846
1854
|
DialogContext.Provider,
|
|
1847
1855
|
{
|
|
1848
|
-
value:
|
|
1856
|
+
value: useMemo7(
|
|
1849
1857
|
() => ({ openInputDialog: open, containsElement }),
|
|
1850
1858
|
[containsElement, open]
|
|
1851
1859
|
)
|
|
@@ -1857,7 +1865,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1857
1865
|
ref: dialogRef,
|
|
1858
1866
|
title: contents?.title,
|
|
1859
1867
|
open: isOpen,
|
|
1860
|
-
onOpenChange:
|
|
1868
|
+
onOpenChange: useCallback12(
|
|
1861
1869
|
(isOpen2) => {
|
|
1862
1870
|
if (!isOpen2) {
|
|
1863
1871
|
close();
|
|
@@ -1865,7 +1873,7 @@ var DialogProvider = function DialogProvider2({
|
|
|
1865
1873
|
},
|
|
1866
1874
|
[close]
|
|
1867
1875
|
),
|
|
1868
|
-
onOpenAutoFocus:
|
|
1876
|
+
onOpenAutoFocus: useCallback12((event) => {
|
|
1869
1877
|
event.stopPropagation();
|
|
1870
1878
|
event.preventDefault();
|
|
1871
1879
|
inputRef.current?.focus();
|
|
@@ -1914,7 +1922,7 @@ var DesignSystemConfigurationProvider = memo10(
|
|
|
1914
1922
|
theme,
|
|
1915
1923
|
platform
|
|
1916
1924
|
}) {
|
|
1917
|
-
const contextValue =
|
|
1925
|
+
const contextValue = useMemo8(() => ({ platform }), [platform]);
|
|
1918
1926
|
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
1927
|
}
|
|
1920
1928
|
);
|
|
@@ -2174,8 +2182,8 @@ import { useKeyboardShortcuts as useKeyboardShortcuts2 } from "@noya-app/noya-ke
|
|
|
2174
2182
|
import * as RadixContextMenu from "@radix-ui/react-context-menu";
|
|
2175
2183
|
import React21, {
|
|
2176
2184
|
memo as memo12,
|
|
2177
|
-
useCallback as
|
|
2178
|
-
useMemo as
|
|
2185
|
+
useCallback as useCallback13,
|
|
2186
|
+
useMemo as useMemo10
|
|
2179
2187
|
} from "react";
|
|
2180
2188
|
import styled15 from "styled-components";
|
|
2181
2189
|
var SeparatorElement2 = styled15(RadixContextMenu.Separator)(
|
|
@@ -2199,11 +2207,11 @@ var ContextMenuItem2 = memo12(function ContextMenuItem3({
|
|
|
2199
2207
|
items,
|
|
2200
2208
|
shortcut
|
|
2201
2209
|
}) {
|
|
2202
|
-
const handlePointerDown =
|
|
2210
|
+
const handlePointerDown = useCallback13(
|
|
2203
2211
|
(event) => event.stopPropagation(),
|
|
2204
2212
|
[]
|
|
2205
2213
|
);
|
|
2206
|
-
const handleSelectItem =
|
|
2214
|
+
const handleSelectItem = useCallback13(() => {
|
|
2207
2215
|
if (!value)
|
|
2208
2216
|
return;
|
|
2209
2217
|
onSelect(value);
|
|
@@ -2252,12 +2260,12 @@ function ContextMenuRoot({
|
|
|
2252
2260
|
const hasCheckedItem = items.some(
|
|
2253
2261
|
(item) => item !== SEPARATOR_ITEM && item.checked
|
|
2254
2262
|
);
|
|
2255
|
-
const keymap =
|
|
2263
|
+
const keymap = useMemo10(
|
|
2256
2264
|
() => isNested || shouldBindKeyboardShortcuts === false ? {} : getKeyboardShortcutsForMenuItems(items, onSelect),
|
|
2257
2265
|
[isNested, items, onSelect, shouldBindKeyboardShortcuts]
|
|
2258
2266
|
);
|
|
2259
2267
|
useKeyboardShortcuts2(keymap);
|
|
2260
|
-
const onPointerDown =
|
|
2268
|
+
const onPointerDown = useCallback13((event) => {
|
|
2261
2269
|
event.preventDefault();
|
|
2262
2270
|
}, []);
|
|
2263
2271
|
const RootComponent = isNested ? RadixContextMenu.Sub : RadixContextMenu.Root;
|
|
@@ -2300,7 +2308,7 @@ var DividerVertical = memo13(function DividerVertical2(props) {
|
|
|
2300
2308
|
|
|
2301
2309
|
// src/components/DraggableMenuButton.tsx
|
|
2302
2310
|
import { DragHandleDots2Icon } from "@noya-app/noya-icons";
|
|
2303
|
-
import React23, { memo as memo14, useCallback as
|
|
2311
|
+
import React23, { memo as memo14, useCallback as useCallback14, useState as useState13 } from "react";
|
|
2304
2312
|
import styled17 from "styled-components";
|
|
2305
2313
|
var DotButtonElement = styled17.div(({ theme }) => ({
|
|
2306
2314
|
cursor: "pointer",
|
|
@@ -2326,9 +2334,9 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2326
2334
|
isVisible = true
|
|
2327
2335
|
}) {
|
|
2328
2336
|
const color = useDesignSystemTheme().colors.icon;
|
|
2329
|
-
const [open, setOpen] =
|
|
2337
|
+
const [open, setOpen] = useState13(false);
|
|
2330
2338
|
const [downPosition, setDownPosition] = React23.useState(null);
|
|
2331
|
-
const handlePointerDownCapture =
|
|
2339
|
+
const handlePointerDownCapture = useCallback14(
|
|
2332
2340
|
(event) => {
|
|
2333
2341
|
if (open) {
|
|
2334
2342
|
setDownPosition(null);
|
|
@@ -2341,7 +2349,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2341
2349
|
},
|
|
2342
2350
|
[open]
|
|
2343
2351
|
);
|
|
2344
|
-
const handlePointerUp =
|
|
2352
|
+
const handlePointerUp = useCallback14(
|
|
2345
2353
|
(event) => {
|
|
2346
2354
|
if (open || !downPosition) {
|
|
2347
2355
|
setDownPosition(null);
|
|
@@ -2357,7 +2365,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2357
2365
|
},
|
|
2358
2366
|
[downPosition, open]
|
|
2359
2367
|
);
|
|
2360
|
-
const handleOpenChange =
|
|
2368
|
+
const handleOpenChange = useCallback14(
|
|
2361
2369
|
(isOpen) => {
|
|
2362
2370
|
if (!isOpen)
|
|
2363
2371
|
setOpen(false);
|
|
@@ -2374,7 +2382,7 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2374
2382
|
event.preventDefault();
|
|
2375
2383
|
}
|
|
2376
2384
|
},
|
|
2377
|
-
/* @__PURE__ */ React23.createElement(
|
|
2385
|
+
items && onSelect ? /* @__PURE__ */ React23.createElement(
|
|
2378
2386
|
DropdownMenu,
|
|
2379
2387
|
{
|
|
2380
2388
|
open,
|
|
@@ -2389,6 +2397,11 @@ var DraggableMenuButton = memo14(function DraggableMenuButton2({
|
|
|
2389
2397
|
color: isVisible || open ? color : "transparent"
|
|
2390
2398
|
}
|
|
2391
2399
|
))
|
|
2400
|
+
) : /* @__PURE__ */ React23.createElement(
|
|
2401
|
+
DragHandleDots2Icon,
|
|
2402
|
+
{
|
|
2403
|
+
color: isVisible || open ? color : "transparent"
|
|
2404
|
+
}
|
|
2392
2405
|
)
|
|
2393
2406
|
);
|
|
2394
2407
|
});
|
|
@@ -2720,7 +2733,7 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
2720
2733
|
})(ClassValue || {});
|
|
2721
2734
|
|
|
2722
2735
|
// src/components/FillPreviewBackground.tsx
|
|
2723
|
-
import React25, { memo as memo16, useMemo as
|
|
2736
|
+
import React25, { memo as memo16, useMemo as useMemo13 } from "react";
|
|
2724
2737
|
import styled18, { useTheme as useTheme3 } from "styled-components";
|
|
2725
2738
|
|
|
2726
2739
|
// src/contexts/ImageDataContext.tsx
|
|
@@ -2728,7 +2741,7 @@ import React24, {
|
|
|
2728
2741
|
createContext as createContext5,
|
|
2729
2742
|
memo as memo15,
|
|
2730
2743
|
useContext as useContext5,
|
|
2731
|
-
useMemo as
|
|
2744
|
+
useMemo as useMemo11
|
|
2732
2745
|
} from "react";
|
|
2733
2746
|
var ImageDataContext = createContext5(
|
|
2734
2747
|
void 0
|
|
@@ -2737,7 +2750,7 @@ var ImageDataProvider = memo15(function ImageDataProvider2({
|
|
|
2737
2750
|
children,
|
|
2738
2751
|
getImageData
|
|
2739
2752
|
}) {
|
|
2740
|
-
const contextValue =
|
|
2753
|
+
const contextValue = useMemo11(
|
|
2741
2754
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
2742
2755
|
[getImageData]
|
|
2743
2756
|
);
|
|
@@ -2752,9 +2765,9 @@ function useImageData(ref) {
|
|
|
2752
2765
|
}
|
|
2753
2766
|
|
|
2754
2767
|
// src/hooks/useObjectURL.ts
|
|
2755
|
-
import { useLayoutEffect as useLayoutEffect5, useMemo as
|
|
2768
|
+
import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo12 } from "react";
|
|
2756
2769
|
function useObjectURL(object) {
|
|
2757
|
-
const objectURL =
|
|
2770
|
+
const objectURL = useMemo12(() => {
|
|
2758
2771
|
if (object instanceof Blob)
|
|
2759
2772
|
return URL.createObjectURL(object);
|
|
2760
2773
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
@@ -2822,7 +2835,7 @@ var Background = styled18.span(({ background }) => ({
|
|
|
2822
2835
|
}));
|
|
2823
2836
|
var HorizontalDotsBackground = memo16(function HorizontalDotsBackground2() {
|
|
2824
2837
|
const { inputBackground, placeholderDots } = useTheme3().colors;
|
|
2825
|
-
const background =
|
|
2838
|
+
const background = useMemo13(
|
|
2826
2839
|
() => [
|
|
2827
2840
|
`center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
2828
2841
|
placeholderDots
|
|
@@ -2853,7 +2866,7 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
|
|
|
2853
2866
|
const image = useImageData(imageRef);
|
|
2854
2867
|
const url = useObjectURL(image);
|
|
2855
2868
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
2856
|
-
const background =
|
|
2869
|
+
const background = useMemo13(
|
|
2857
2870
|
() => [
|
|
2858
2871
|
size2,
|
|
2859
2872
|
`url(${url})`,
|
|
@@ -2866,13 +2879,13 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
|
|
|
2866
2879
|
var ColorPreviewBackground = memo16(function ColorPreviewBackground2({
|
|
2867
2880
|
color
|
|
2868
2881
|
}) {
|
|
2869
|
-
const background =
|
|
2882
|
+
const background = useMemo13(() => sketchColorToRgbaString(color), [color]);
|
|
2870
2883
|
return /* @__PURE__ */ React25.createElement(Background, { background });
|
|
2871
2884
|
});
|
|
2872
2885
|
var GradientPreviewBackground = memo16(function GradientPreviewBackground2({
|
|
2873
2886
|
gradient
|
|
2874
2887
|
}) {
|
|
2875
|
-
const background =
|
|
2888
|
+
const background = useMemo13(
|
|
2876
2889
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
2877
2890
|
[gradient.gradientType, gradient.stops]
|
|
2878
2891
|
);
|
|
@@ -2938,7 +2951,7 @@ import {
|
|
|
2938
2951
|
hsvaToRgba,
|
|
2939
2952
|
rgbaToHsva as rgbaToHsva2
|
|
2940
2953
|
} from "@noya-app/noya-colorpicker";
|
|
2941
|
-
import React27, { memo as memo18, useCallback as
|
|
2954
|
+
import React27, { memo as memo18, useCallback as useCallback15, useMemo as useMemo14 } from "react";
|
|
2942
2955
|
var GradientPicker = memo18(function GradientPicker2({
|
|
2943
2956
|
value,
|
|
2944
2957
|
selectedStop,
|
|
@@ -2948,7 +2961,7 @@ var GradientPicker = memo18(function GradientPicker2({
|
|
|
2948
2961
|
onDelete,
|
|
2949
2962
|
onSelectStop
|
|
2950
2963
|
}) {
|
|
2951
|
-
const colorModel =
|
|
2964
|
+
const colorModel = useMemo14(
|
|
2952
2965
|
() => ({
|
|
2953
2966
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
2954
2967
|
toHsva: rgbaToHsva2,
|
|
@@ -2957,17 +2970,17 @@ var GradientPicker = memo18(function GradientPicker2({
|
|
|
2957
2970
|
}),
|
|
2958
2971
|
[]
|
|
2959
2972
|
);
|
|
2960
|
-
const rgbaColor =
|
|
2973
|
+
const rgbaColor = useMemo14(
|
|
2961
2974
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
2962
2975
|
[value, selectedStop]
|
|
2963
2976
|
);
|
|
2964
|
-
const handleChangeColor =
|
|
2977
|
+
const handleChangeColor = useCallback15(
|
|
2965
2978
|
(value2) => {
|
|
2966
2979
|
onChangeColor(rgbaToSketchColor(value2));
|
|
2967
2980
|
},
|
|
2968
2981
|
[onChangeColor]
|
|
2969
2982
|
);
|
|
2970
|
-
const handleAddGradientStop =
|
|
2983
|
+
const handleAddGradientStop = useCallback15(
|
|
2971
2984
|
(value2, position) => {
|
|
2972
2985
|
onAdd(rgbaToSketchColor(value2), position);
|
|
2973
2986
|
},
|
|
@@ -3032,15 +3045,15 @@ import React29, {
|
|
|
3032
3045
|
createContext as createContext6,
|
|
3033
3046
|
forwardRef as forwardRef9,
|
|
3034
3047
|
memo as memo20,
|
|
3035
|
-
useCallback as
|
|
3048
|
+
useCallback as useCallback17,
|
|
3036
3049
|
useContext as useContext6,
|
|
3037
|
-
useMemo as
|
|
3050
|
+
useMemo as useMemo15
|
|
3038
3051
|
} from "react";
|
|
3039
3052
|
import styled22, { keyframes as keyframes2 } from "styled-components";
|
|
3040
3053
|
|
|
3041
3054
|
// src/components/ScrollArea.tsx
|
|
3042
3055
|
import * as RadixScrollArea from "@radix-ui/react-scroll-area";
|
|
3043
|
-
import React28, { memo as memo19, useCallback as
|
|
3056
|
+
import React28, { memo as memo19, useCallback as useCallback16, useState as useState14 } from "react";
|
|
3044
3057
|
import styled21 from "styled-components";
|
|
3045
3058
|
var SCROLLBAR_SIZE = 10;
|
|
3046
3059
|
var StyledViewport = styled21(RadixScrollArea.Viewport)({
|
|
@@ -3069,11 +3082,11 @@ var Container2 = styled21.div({
|
|
|
3069
3082
|
minHeight: 0
|
|
3070
3083
|
});
|
|
3071
3084
|
var ScrollArea = memo19(function ScrollArea2({ children }) {
|
|
3072
|
-
const [scrollElementRef, setScrollElementRef] =
|
|
3085
|
+
const [scrollElementRef, setScrollElementRef] = useState14(null);
|
|
3073
3086
|
return /* @__PURE__ */ React28.createElement(Container2, null, /* @__PURE__ */ React28.createElement(RadixScrollArea.Root, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ React28.createElement(
|
|
3074
3087
|
StyledViewport,
|
|
3075
3088
|
{
|
|
3076
|
-
ref:
|
|
3089
|
+
ref: useCallback16(
|
|
3077
3090
|
(ref) => setScrollElementRef(ref),
|
|
3078
3091
|
[]
|
|
3079
3092
|
)
|
|
@@ -3283,7 +3296,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3283
3296
|
}
|
|
3284
3297
|
});
|
|
3285
3298
|
const { textPosition, bordered, disabled } = useContext6(GridViewContext);
|
|
3286
|
-
const handleClick =
|
|
3299
|
+
const handleClick = useCallback17(
|
|
3287
3300
|
(event) => {
|
|
3288
3301
|
event.stopPropagation();
|
|
3289
3302
|
event.preventDefault();
|
|
@@ -3292,7 +3305,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3292
3305
|
},
|
|
3293
3306
|
[onClick, onPress]
|
|
3294
3307
|
);
|
|
3295
|
-
const handleKeyDown =
|
|
3308
|
+
const handleKeyDown = useCallback17(
|
|
3296
3309
|
(event) => {
|
|
3297
3310
|
if (event.key === "Enter" || event.key === " ") {
|
|
3298
3311
|
event.stopPropagation();
|
|
@@ -3360,7 +3373,7 @@ function GridViewRoot({
|
|
|
3360
3373
|
bordered = false,
|
|
3361
3374
|
disabled = false
|
|
3362
3375
|
}) {
|
|
3363
|
-
const handleClick =
|
|
3376
|
+
const handleClick = useCallback17(
|
|
3364
3377
|
(event) => {
|
|
3365
3378
|
event.stopPropagation();
|
|
3366
3379
|
event.preventDefault();
|
|
@@ -3368,7 +3381,7 @@ function GridViewRoot({
|
|
|
3368
3381
|
},
|
|
3369
3382
|
[onClick]
|
|
3370
3383
|
);
|
|
3371
|
-
const contextValue =
|
|
3384
|
+
const contextValue = useMemo15(
|
|
3372
3385
|
() => ({
|
|
3373
3386
|
size: size2,
|
|
3374
3387
|
textPosition,
|
|
@@ -3406,13 +3419,13 @@ import { chunkBy, partition } from "@noya-app/noya-utils";
|
|
|
3406
3419
|
import React33, {
|
|
3407
3420
|
forwardRef as forwardRef12,
|
|
3408
3421
|
memo as memo23,
|
|
3409
|
-
useCallback as
|
|
3410
|
-
useEffect as
|
|
3422
|
+
useCallback as useCallback20,
|
|
3423
|
+
useEffect as useEffect12,
|
|
3411
3424
|
useImperativeHandle as useImperativeHandle3,
|
|
3412
3425
|
useLayoutEffect as useLayoutEffect7,
|
|
3413
|
-
useMemo as
|
|
3426
|
+
useMemo as useMemo18,
|
|
3414
3427
|
useRef as useRef15,
|
|
3415
|
-
useState as
|
|
3428
|
+
useState as useState16
|
|
3416
3429
|
} from "react";
|
|
3417
3430
|
import styled25 from "styled-components";
|
|
3418
3431
|
|
|
@@ -3496,11 +3509,11 @@ import React31, {
|
|
|
3496
3509
|
forwardRef as forwardRef10,
|
|
3497
3510
|
isValidElement as isValidElement3,
|
|
3498
3511
|
memo as memo22,
|
|
3499
|
-
useCallback as
|
|
3512
|
+
useCallback as useCallback19,
|
|
3500
3513
|
useContext as useContext8,
|
|
3501
3514
|
useImperativeHandle as useImperativeHandle2,
|
|
3502
3515
|
useLayoutEffect as useLayoutEffect6,
|
|
3503
|
-
useMemo as
|
|
3516
|
+
useMemo as useMemo17,
|
|
3504
3517
|
useRef as useRef14
|
|
3505
3518
|
} from "react";
|
|
3506
3519
|
import { WindowScroller } from "react-virtualized";
|
|
@@ -3547,11 +3560,11 @@ import {
|
|
|
3547
3560
|
import React30, {
|
|
3548
3561
|
createContext as createContext7,
|
|
3549
3562
|
memo as memo21,
|
|
3550
|
-
useCallback as
|
|
3563
|
+
useCallback as useCallback18,
|
|
3551
3564
|
useContext as useContext7,
|
|
3552
|
-
useMemo as
|
|
3565
|
+
useMemo as useMemo16,
|
|
3553
3566
|
useRef as useRef13,
|
|
3554
|
-
useState as
|
|
3567
|
+
useState as useState15
|
|
3555
3568
|
} from "react";
|
|
3556
3569
|
import { createPortal } from "react-dom";
|
|
3557
3570
|
var normalizeListDestinationIndex = (index, position) => {
|
|
@@ -3608,7 +3621,7 @@ function SortableItem({
|
|
|
3608
3621
|
const eventY = activatorEvent?.clientY ?? 0;
|
|
3609
3622
|
const offsetLeft = eventX + position.x;
|
|
3610
3623
|
const offsetTop = eventY + position.y;
|
|
3611
|
-
const ref =
|
|
3624
|
+
const ref = useCallback18((node) => setNodeRef(node), [setNodeRef]);
|
|
3612
3625
|
return children({
|
|
3613
3626
|
ref,
|
|
3614
3627
|
...attributes,
|
|
@@ -3639,22 +3652,22 @@ function SortableRoot({
|
|
|
3639
3652
|
}
|
|
3640
3653
|
})
|
|
3641
3654
|
);
|
|
3642
|
-
const [activeIndex, setActiveIndex] =
|
|
3655
|
+
const [activeIndex, setActiveIndex] = useState15();
|
|
3643
3656
|
const activatorEvent = useRef13(null);
|
|
3644
|
-
const setActivatorEvent =
|
|
3657
|
+
const setActivatorEvent = useCallback18((event) => {
|
|
3645
3658
|
activatorEvent.current = event;
|
|
3646
3659
|
}, []);
|
|
3647
|
-
const [position, setPosition] =
|
|
3648
|
-
const handleDragStart =
|
|
3660
|
+
const [position, setPosition] = useState15({ x: 0, y: 0 });
|
|
3661
|
+
const handleDragStart = useCallback18(
|
|
3649
3662
|
(event) => {
|
|
3650
3663
|
setActiveIndex(keys.indexOf(event.active.id));
|
|
3651
3664
|
},
|
|
3652
3665
|
[keys]
|
|
3653
3666
|
);
|
|
3654
|
-
const handleDragMove =
|
|
3667
|
+
const handleDragMove = useCallback18((event) => {
|
|
3655
3668
|
setPosition({ ...event.delta });
|
|
3656
3669
|
}, []);
|
|
3657
|
-
const handleDragEnd =
|
|
3670
|
+
const handleDragEnd = useCallback18(
|
|
3658
3671
|
(event) => {
|
|
3659
3672
|
const { active, over } = event;
|
|
3660
3673
|
setActiveIndex(void 0);
|
|
@@ -3684,7 +3697,7 @@ function SortableRoot({
|
|
|
3684
3697
|
return /* @__PURE__ */ React30.createElement(
|
|
3685
3698
|
SortableItemContext.Provider,
|
|
3686
3699
|
{
|
|
3687
|
-
value:
|
|
3700
|
+
value: useMemo16(
|
|
3688
3701
|
() => ({
|
|
3689
3702
|
keys,
|
|
3690
3703
|
acceptsDrop,
|
|
@@ -3905,7 +3918,8 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3905
3918
|
onContextMenu,
|
|
3906
3919
|
onSelectMenuItem,
|
|
3907
3920
|
onMenuOpenChange,
|
|
3908
|
-
onKeyDown
|
|
3921
|
+
onKeyDown,
|
|
3922
|
+
style: style3
|
|
3909
3923
|
}, forwardedRef) {
|
|
3910
3924
|
depth = Math.max(0, depth);
|
|
3911
3925
|
const {
|
|
@@ -3923,7 +3937,7 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3923
3937
|
onHoverChange
|
|
3924
3938
|
});
|
|
3925
3939
|
const { indentation, isDragging } = useContext8(DraggingContext);
|
|
3926
|
-
const handlePress =
|
|
3940
|
+
const handlePress = useCallback19(
|
|
3927
3941
|
(event) => {
|
|
3928
3942
|
event.preventDefault();
|
|
3929
3943
|
if (event.button !== 0)
|
|
@@ -3932,20 +3946,21 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3932
3946
|
},
|
|
3933
3947
|
[onPress]
|
|
3934
3948
|
);
|
|
3935
|
-
const handleDoubleClick =
|
|
3949
|
+
const handleDoubleClick = useCallback19(
|
|
3936
3950
|
(event) => {
|
|
3937
3951
|
event.stopPropagation();
|
|
3938
3952
|
onDoubleClick?.();
|
|
3939
3953
|
},
|
|
3940
3954
|
[onDoubleClick]
|
|
3941
3955
|
);
|
|
3942
|
-
const
|
|
3956
|
+
const mergedStyle = useMemo17(() => {
|
|
3943
3957
|
return isDragging ? {
|
|
3944
3958
|
// TODO: Where do these offsets actually come from?
|
|
3945
3959
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
3946
|
-
width: `calc(100% + 48px)
|
|
3947
|
-
|
|
3948
|
-
|
|
3960
|
+
width: `calc(100% + 48px)`,
|
|
3961
|
+
...style3
|
|
3962
|
+
} : style3;
|
|
3963
|
+
}, [isDragging, style3]);
|
|
3949
3964
|
const renderContent = ({
|
|
3950
3965
|
relativeDropPosition,
|
|
3951
3966
|
...renderProps
|
|
@@ -3973,7 +3988,7 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3973
3988
|
"aria-selected": selected,
|
|
3974
3989
|
divider: !isDragging && divider,
|
|
3975
3990
|
onKeyDown,
|
|
3976
|
-
style:
|
|
3991
|
+
style: mergedStyle,
|
|
3977
3992
|
...renderProps,
|
|
3978
3993
|
...mergeEventHandlers(
|
|
3979
3994
|
{ onPointerDown: renderProps.onPointerDown },
|
|
@@ -4042,7 +4057,7 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4042
4057
|
// since it doesn't currently support row height changes
|
|
4043
4058
|
items
|
|
4044
4059
|
]);
|
|
4045
|
-
const listStyle =
|
|
4060
|
+
const listStyle = useMemo17(
|
|
4046
4061
|
() => ({
|
|
4047
4062
|
overflowX: "initial",
|
|
4048
4063
|
overflowY: "initial",
|
|
@@ -4054,9 +4069,9 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4054
4069
|
WindowScroller,
|
|
4055
4070
|
{
|
|
4056
4071
|
scrollElement,
|
|
4057
|
-
style:
|
|
4072
|
+
style: useMemo17(() => ({ flex: "1 1 auto" }), [])
|
|
4058
4073
|
},
|
|
4059
|
-
|
|
4074
|
+
useCallback19(
|
|
4060
4075
|
({
|
|
4061
4076
|
registerChild,
|
|
4062
4077
|
onChildScroll,
|
|
@@ -4121,7 +4136,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4121
4136
|
colorScheme = "primary",
|
|
4122
4137
|
gap = 0
|
|
4123
4138
|
}, forwardedRef) {
|
|
4124
|
-
const handleClick =
|
|
4139
|
+
const handleClick = useCallback19(
|
|
4125
4140
|
(event) => {
|
|
4126
4141
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
4127
4142
|
return;
|
|
@@ -4131,11 +4146,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4131
4146
|
},
|
|
4132
4147
|
[onPress]
|
|
4133
4148
|
);
|
|
4134
|
-
const renderChild =
|
|
4149
|
+
const renderChild = useCallback19(
|
|
4135
4150
|
(index) => renderItem(data[index], index, { isDragging: false }),
|
|
4136
4151
|
[data, renderItem]
|
|
4137
4152
|
);
|
|
4138
|
-
const getItemContextValue =
|
|
4153
|
+
const getItemContextValue = useCallback19(
|
|
4139
4154
|
(i) => {
|
|
4140
4155
|
const current = renderChild(i);
|
|
4141
4156
|
if (!isValidElement3(current))
|
|
@@ -4195,15 +4210,15 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4195
4210
|
gap
|
|
4196
4211
|
]
|
|
4197
4212
|
);
|
|
4198
|
-
const draggingContextOverlayValue =
|
|
4213
|
+
const draggingContextOverlayValue = useMemo17(
|
|
4199
4214
|
() => ({ indentation, isDragging: true }),
|
|
4200
4215
|
[indentation]
|
|
4201
4216
|
);
|
|
4202
|
-
const renderOverlay =
|
|
4217
|
+
const renderOverlay = useCallback19(
|
|
4203
4218
|
(index) => /* @__PURE__ */ React31.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragging: true }))),
|
|
4204
4219
|
[draggingContextOverlayValue, renderItem, data]
|
|
4205
4220
|
);
|
|
4206
|
-
const renderWrappedChild =
|
|
4221
|
+
const renderWrappedChild = useCallback19(
|
|
4207
4222
|
(index) => {
|
|
4208
4223
|
const contextValue = getItemContextValue(index);
|
|
4209
4224
|
const current = renderChild(index);
|
|
@@ -4213,7 +4228,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4213
4228
|
},
|
|
4214
4229
|
[getItemContextValue, renderChild]
|
|
4215
4230
|
);
|
|
4216
|
-
const ids =
|
|
4231
|
+
const ids = useMemo17(() => data.map(keyExtractor), [keyExtractor, data]);
|
|
4217
4232
|
const withSortable = (children) => sortable ? /* @__PURE__ */ React31.createElement(
|
|
4218
4233
|
Sortable.Root,
|
|
4219
4234
|
{
|
|
@@ -4225,7 +4240,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4225
4240
|
children
|
|
4226
4241
|
) : children;
|
|
4227
4242
|
const withScrollable = (children) => scrollable ? /* @__PURE__ */ React31.createElement(ScrollArea, null, children) : children(null);
|
|
4228
|
-
const getItemHeight =
|
|
4243
|
+
const getItemHeight = useCallback19(
|
|
4229
4244
|
(index) => {
|
|
4230
4245
|
const child = getItemContextValue(index);
|
|
4231
4246
|
const margin = child?.marginType ? getPositionMargin(child.marginType) : { top: 0, bottom: 0 };
|
|
@@ -4234,11 +4249,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4234
4249
|
},
|
|
4235
4250
|
[getItemContextValue, variant]
|
|
4236
4251
|
);
|
|
4237
|
-
const getKey =
|
|
4252
|
+
const getKey = useCallback19(
|
|
4238
4253
|
(index) => keyExtractor(data[index], index),
|
|
4239
4254
|
[data, keyExtractor]
|
|
4240
4255
|
);
|
|
4241
|
-
const draggingContextValue =
|
|
4256
|
+
const draggingContextValue = useMemo17(() => ({ indentation }), [indentation]);
|
|
4242
4257
|
return /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ React31.createElement(
|
|
4243
4258
|
RootContainer2,
|
|
4244
4259
|
{
|
|
@@ -4268,7 +4283,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4268
4283
|
});
|
|
4269
4284
|
var ListViewRoot = memo22(ListViewRootInner);
|
|
4270
4285
|
var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
|
|
4271
|
-
const items =
|
|
4286
|
+
const items = useMemo17(
|
|
4272
4287
|
() => Children4.toArray(children).flatMap(
|
|
4273
4288
|
(child) => isValidElement3(child) ? [child] : []
|
|
4274
4289
|
),
|
|
@@ -4280,11 +4295,11 @@ var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ child
|
|
|
4280
4295
|
ref: forwardedRef,
|
|
4281
4296
|
...rest,
|
|
4282
4297
|
data: items,
|
|
4283
|
-
keyExtractor:
|
|
4298
|
+
keyExtractor: useCallback19(
|
|
4284
4299
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
4285
4300
|
[]
|
|
4286
4301
|
),
|
|
4287
|
-
renderItem:
|
|
4302
|
+
renderItem: useCallback19((item) => item, [])
|
|
4288
4303
|
}
|
|
4289
4304
|
);
|
|
4290
4305
|
});
|
|
@@ -4492,12 +4507,12 @@ var InputFieldWithCompletions = memo23(
|
|
|
4492
4507
|
hideMenuWhenEmptyValue = false
|
|
4493
4508
|
}, forwardedRef) {
|
|
4494
4509
|
const ref = useRef15(null);
|
|
4495
|
-
const [isFocused, setIsFocused] =
|
|
4496
|
-
const [state, _setState] =
|
|
4510
|
+
const [isFocused, setIsFocused] = useState16(false);
|
|
4511
|
+
const [state, _setState] = useState16({
|
|
4497
4512
|
filter: initialValue,
|
|
4498
4513
|
selectedIndex: 0
|
|
4499
4514
|
});
|
|
4500
|
-
const updateState =
|
|
4515
|
+
const updateState = useCallback20(
|
|
4501
4516
|
(newState, hoverItem) => {
|
|
4502
4517
|
const nextState = { ...state, ...newState };
|
|
4503
4518
|
const nextItems = filterWithGroupedSections(items, nextState.filter);
|
|
@@ -4535,7 +4550,7 @@ var InputFieldWithCompletions = memo23(
|
|
|
4535
4550
|
}, [initialValue, updateState]);
|
|
4536
4551
|
const { filter, selectedIndex } = state;
|
|
4537
4552
|
const listRef = React33.useRef(null);
|
|
4538
|
-
const filteredItems =
|
|
4553
|
+
const filteredItems = useMemo18(
|
|
4539
4554
|
() => filterWithGroupedSections(items, filter),
|
|
4540
4555
|
[items, filter]
|
|
4541
4556
|
);
|
|
@@ -4551,13 +4566,13 @@ var InputFieldWithCompletions = memo23(
|
|
|
4551
4566
|
),
|
|
4552
4567
|
ListView.rowHeight * 10.5
|
|
4553
4568
|
);
|
|
4554
|
-
|
|
4569
|
+
useEffect12(() => {
|
|
4555
4570
|
if (listRef.current) {
|
|
4556
4571
|
listRef.current.scrollToIndex(selectedIndex);
|
|
4557
4572
|
}
|
|
4558
4573
|
}, [selectedIndex]);
|
|
4559
4574
|
const lastSubmittedValueRef = useRef15(void 0);
|
|
4560
|
-
const selectItem =
|
|
4575
|
+
const selectItem = useCallback20(
|
|
4561
4576
|
(item) => {
|
|
4562
4577
|
if (item.type === "sectionHeader")
|
|
4563
4578
|
return;
|
|
@@ -4573,17 +4588,17 @@ var InputFieldWithCompletions = memo23(
|
|
|
4573
4588
|
},
|
|
4574
4589
|
[filter, onSelectItem, onHoverItem, ref]
|
|
4575
4590
|
);
|
|
4576
|
-
const handleChange =
|
|
4591
|
+
const handleChange = useCallback20(
|
|
4577
4592
|
(value) => updateState({ selectedIndex: 0, filter: value }),
|
|
4578
4593
|
[updateState]
|
|
4579
4594
|
);
|
|
4580
|
-
const handleBlur =
|
|
4595
|
+
const handleBlur = useCallback20(() => {
|
|
4581
4596
|
setIsFocused(false);
|
|
4582
4597
|
const didSubmit = lastSubmittedValueRef.current?.filter === filter;
|
|
4583
4598
|
updateState({ selectedIndex: 0, filter: initialValue }, "resetHover");
|
|
4584
4599
|
onBlur?.(didSubmit, filter);
|
|
4585
4600
|
}, [filter, initialValue, onBlur, updateState]);
|
|
4586
|
-
const handleFocus =
|
|
4601
|
+
const handleFocus = useCallback20(
|
|
4587
4602
|
(event) => {
|
|
4588
4603
|
setIsFocused(true);
|
|
4589
4604
|
updateState({ selectedIndex: 0, filter: initialValue });
|
|
@@ -4591,11 +4606,11 @@ var InputFieldWithCompletions = memo23(
|
|
|
4591
4606
|
},
|
|
4592
4607
|
[initialValue, onFocus, updateState]
|
|
4593
4608
|
);
|
|
4594
|
-
const handleIndexChange =
|
|
4609
|
+
const handleIndexChange = useCallback20(
|
|
4595
4610
|
(index) => updateState({ selectedIndex: index }),
|
|
4596
4611
|
[updateState]
|
|
4597
4612
|
);
|
|
4598
|
-
const handleKeyDown =
|
|
4613
|
+
const handleKeyDown = useCallback20(
|
|
4599
4614
|
(event) => {
|
|
4600
4615
|
let handled = false;
|
|
4601
4616
|
switch (event.key) {
|
|
@@ -4793,7 +4808,7 @@ import React35, {
|
|
|
4793
4808
|
isValidElement as isValidElement4,
|
|
4794
4809
|
memo as memo25,
|
|
4795
4810
|
useLayoutEffect as useLayoutEffect8,
|
|
4796
|
-
useMemo as
|
|
4811
|
+
useMemo as useMemo19,
|
|
4797
4812
|
useRef as useRef16
|
|
4798
4813
|
} from "react";
|
|
4799
4814
|
import styled27 from "styled-components";
|
|
@@ -4825,12 +4840,12 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
4825
4840
|
).filter((id) => !!id);
|
|
4826
4841
|
const serializedIds = elementIds.join(",");
|
|
4827
4842
|
const containerRef = useRef16(null);
|
|
4828
|
-
const refs =
|
|
4843
|
+
const refs = useMemo19(() => {
|
|
4829
4844
|
return Object.fromEntries(
|
|
4830
4845
|
serializedIds.split(",").map((id) => [id, createRef()])
|
|
4831
4846
|
);
|
|
4832
4847
|
}, [serializedIds]);
|
|
4833
|
-
const labelElements =
|
|
4848
|
+
const labelElements = useMemo19(() => {
|
|
4834
4849
|
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React35.createElement(
|
|
4835
4850
|
"span",
|
|
4836
4851
|
{
|
|
@@ -4954,9 +4969,9 @@ import React37, {
|
|
|
4954
4969
|
createContext as createContext9,
|
|
4955
4970
|
forwardRef as forwardRef13,
|
|
4956
4971
|
memo as memo26,
|
|
4957
|
-
useCallback as
|
|
4972
|
+
useCallback as useCallback21,
|
|
4958
4973
|
useContext as useContext9,
|
|
4959
|
-
useMemo as
|
|
4974
|
+
useMemo as useMemo20
|
|
4960
4975
|
} from "react";
|
|
4961
4976
|
import styled29 from "styled-components";
|
|
4962
4977
|
var ignoredProps3 = /* @__PURE__ */ new Set(["colorScheme"]);
|
|
@@ -5035,8 +5050,8 @@ function ToggleGroupRoot({
|
|
|
5035
5050
|
allowEmpty,
|
|
5036
5051
|
children
|
|
5037
5052
|
}) {
|
|
5038
|
-
const contextValue =
|
|
5039
|
-
const handleValueChange =
|
|
5053
|
+
const contextValue = useMemo20(() => ({ colorScheme }), [colorScheme]);
|
|
5054
|
+
const handleValueChange = useCallback21(
|
|
5040
5055
|
(value2) => {
|
|
5041
5056
|
if (!allowEmpty && !value2)
|
|
5042
5057
|
return;
|
|
@@ -5067,10 +5082,10 @@ import { memoize as memoize2 } from "@noya-app/noya-utils";
|
|
|
5067
5082
|
import React38, {
|
|
5068
5083
|
createContext as createContext10,
|
|
5069
5084
|
memo as memo27,
|
|
5070
|
-
useCallback as
|
|
5085
|
+
useCallback as useCallback22,
|
|
5071
5086
|
useContext as useContext10,
|
|
5072
|
-
useEffect as
|
|
5073
|
-
useMemo as
|
|
5087
|
+
useEffect as useEffect13,
|
|
5088
|
+
useMemo as useMemo21,
|
|
5074
5089
|
useRef as useRef17
|
|
5075
5090
|
} from "react";
|
|
5076
5091
|
import styled30 from "styled-components";
|
|
@@ -5081,7 +5096,7 @@ var SelectOption = memo27(function SelectOption2({
|
|
|
5081
5096
|
onSelect
|
|
5082
5097
|
}) {
|
|
5083
5098
|
const { addListener, removeListener } = useContext10(SelectContext);
|
|
5084
|
-
|
|
5099
|
+
useEffect13(() => {
|
|
5085
5100
|
if (!onSelect)
|
|
5086
5101
|
return;
|
|
5087
5102
|
addListener(value, onSelect);
|
|
@@ -5137,7 +5152,7 @@ var Select = memo27(function Select2({
|
|
|
5137
5152
|
const getTitle = "options" in rest ? rest.getTitle : void 0;
|
|
5138
5153
|
const onChange = "options" in rest ? rest.onChange : void 0;
|
|
5139
5154
|
const children = "options" in rest ? void 0 : rest.children;
|
|
5140
|
-
const optionElements =
|
|
5155
|
+
const optionElements = useMemo21(
|
|
5141
5156
|
() => options ? options.map((option, index) => /* @__PURE__ */ React38.createElement(
|
|
5142
5157
|
SelectOption,
|
|
5143
5158
|
{
|
|
@@ -5150,7 +5165,7 @@ var Select = memo27(function Select2({
|
|
|
5150
5165
|
[children, getTitle, onChange, options]
|
|
5151
5166
|
);
|
|
5152
5167
|
const listeners = useRef17(/* @__PURE__ */ new Map());
|
|
5153
|
-
const contextValue =
|
|
5168
|
+
const contextValue = useMemo21(
|
|
5154
5169
|
() => ({
|
|
5155
5170
|
addListener: (value2, listener) => listeners.current.set(value2, listener),
|
|
5156
5171
|
removeListener: (value2) => listeners.current.delete(value2)
|
|
@@ -5163,7 +5178,7 @@ var Select = memo27(function Select2({
|
|
|
5163
5178
|
id,
|
|
5164
5179
|
flex,
|
|
5165
5180
|
value,
|
|
5166
|
-
onChange:
|
|
5181
|
+
onChange: useCallback22(
|
|
5167
5182
|
(event) => listeners.current.get(event.target.value)?.(),
|
|
5168
5183
|
[listeners]
|
|
5169
5184
|
),
|
|
@@ -5175,7 +5190,7 @@ var Select = memo27(function Select2({
|
|
|
5175
5190
|
|
|
5176
5191
|
// src/components/Slider.tsx
|
|
5177
5192
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
5178
|
-
import React39, { useCallback as
|
|
5193
|
+
import React39, { useCallback as useCallback23, useMemo as useMemo22 } from "react";
|
|
5179
5194
|
import styled31 from "styled-components";
|
|
5180
5195
|
var StyledSlider = styled31(RadixSlider.Root)({
|
|
5181
5196
|
flex: "1",
|
|
@@ -5216,11 +5231,11 @@ var Slider = function Slider2({
|
|
|
5216
5231
|
min,
|
|
5217
5232
|
max
|
|
5218
5233
|
}) {
|
|
5219
|
-
const arrayValue =
|
|
5234
|
+
const arrayValue = useMemo22(
|
|
5220
5235
|
() => [Math.min(Math.max(value, min), max)],
|
|
5221
5236
|
[value, min, max]
|
|
5222
5237
|
);
|
|
5223
|
-
const handleValueChange =
|
|
5238
|
+
const handleValueChange = useCallback23(
|
|
5224
5239
|
(arrayValue2) => {
|
|
5225
5240
|
onValueChange(arrayValue2[0]);
|
|
5226
5241
|
},
|
|
@@ -5295,7 +5310,7 @@ var Switch = function Switch2({
|
|
|
5295
5310
|
import React41, {
|
|
5296
5311
|
forwardRef as forwardRef14,
|
|
5297
5312
|
memo as memo28,
|
|
5298
|
-
useCallback as
|
|
5313
|
+
useCallback as useCallback24,
|
|
5299
5314
|
useContext as useContext11
|
|
5300
5315
|
} from "react";
|
|
5301
5316
|
var TreeRow = forwardRef14(function TreeRow2({
|
|
@@ -5306,7 +5321,7 @@ var TreeRow = forwardRef14(function TreeRow2({
|
|
|
5306
5321
|
...rest
|
|
5307
5322
|
}, forwardedRef) {
|
|
5308
5323
|
const { expandable } = useContext11(ListView.RowContext);
|
|
5309
|
-
const handleClickChevron =
|
|
5324
|
+
const handleClickChevron = useCallback24(
|
|
5310
5325
|
(event) => {
|
|
5311
5326
|
event.stopPropagation();
|
|
5312
5327
|
onClickChevron?.({ altKey: event.altKey });
|
|
@@ -5635,7 +5650,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
5635
5650
|
|
|
5636
5651
|
// src/components/ArrayController.tsx
|
|
5637
5652
|
import { range as range2 } from "@noya-app/noya-utils";
|
|
5638
|
-
import React43, { memo as memo30, useCallback as
|
|
5653
|
+
import React43, { memo as memo30, useCallback as useCallback25, useMemo as useMemo23 } from "react";
|
|
5639
5654
|
import styled34, { useTheme as useTheme5 } from "styled-components";
|
|
5640
5655
|
|
|
5641
5656
|
// src/components/InspectorPrimitives.tsx
|
|
@@ -5718,8 +5733,9 @@ var RowLabel = styled33.span(({ theme, textStyle }) => ({
|
|
|
5718
5733
|
color: theme.colors.textSubtle,
|
|
5719
5734
|
fontWeight: "bold"
|
|
5720
5735
|
},
|
|
5721
|
-
lineHeight: "19px"
|
|
5736
|
+
lineHeight: "19px",
|
|
5722
5737
|
// Button height
|
|
5738
|
+
alignItems: "center"
|
|
5723
5739
|
}));
|
|
5724
5740
|
var LabeledRow = memo29(function LabeledRow2({
|
|
5725
5741
|
id,
|
|
@@ -5766,12 +5782,12 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5766
5782
|
}) {
|
|
5767
5783
|
const iconColor = useTheme5().colors.icon;
|
|
5768
5784
|
const primaryLightColor = useTheme5().colors.primaryLight;
|
|
5769
|
-
const keys =
|
|
5785
|
+
const keys = useMemo23(
|
|
5770
5786
|
() => items.map((item, index) => getKey?.(item) ?? index.toString()),
|
|
5771
5787
|
[getKey, items]
|
|
5772
5788
|
);
|
|
5773
5789
|
const indexes = reversed ? range2(0, items.length).reverse() : range2(0, items.length);
|
|
5774
|
-
const handleMoveItem =
|
|
5790
|
+
const handleMoveItem = useCallback25(
|
|
5775
5791
|
(sourceIndex, destinationIndex, position) => {
|
|
5776
5792
|
if (reversed) {
|
|
5777
5793
|
if (position === "above") {
|
|
@@ -5842,7 +5858,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5842
5858
|
|
|
5843
5859
|
// src/components/DimensionInput.tsx
|
|
5844
5860
|
import { round } from "@noya-app/noya-utils";
|
|
5845
|
-
import React44, { memo as memo31, useCallback as
|
|
5861
|
+
import React44, { memo as memo31, useCallback as useCallback26 } from "react";
|
|
5846
5862
|
function getNewValue(value, mode, delta) {
|
|
5847
5863
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
5848
5864
|
}
|
|
@@ -5856,11 +5872,11 @@ var DimensionInput = memo31(function DimensionInput2({
|
|
|
5856
5872
|
disabled,
|
|
5857
5873
|
trigger = "submit"
|
|
5858
5874
|
}) {
|
|
5859
|
-
const handleNudgeValue =
|
|
5875
|
+
const handleNudgeValue = useCallback26(
|
|
5860
5876
|
(value2) => onSetValue(value2, "adjust"),
|
|
5861
5877
|
[onSetValue]
|
|
5862
5878
|
);
|
|
5863
|
-
const handleSetValue =
|
|
5879
|
+
const handleSetValue = useCallback26(
|
|
5864
5880
|
(value2) => onSetValue(value2, "replace"),
|
|
5865
5881
|
[onSetValue]
|
|
5866
5882
|
);
|