@noya-app/noya-designsystem 0.1.7 → 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 +7 -7
- package/CHANGELOG.md +7 -0
- package/dist/index.js +489 -486
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/Button.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);
|
|
@@ -2725,7 +2733,7 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
2725
2733
|
})(ClassValue || {});
|
|
2726
2734
|
|
|
2727
2735
|
// src/components/FillPreviewBackground.tsx
|
|
2728
|
-
import React25, { memo as memo16, useMemo as
|
|
2736
|
+
import React25, { memo as memo16, useMemo as useMemo13 } from "react";
|
|
2729
2737
|
import styled18, { useTheme as useTheme3 } from "styled-components";
|
|
2730
2738
|
|
|
2731
2739
|
// src/contexts/ImageDataContext.tsx
|
|
@@ -2733,7 +2741,7 @@ import React24, {
|
|
|
2733
2741
|
createContext as createContext5,
|
|
2734
2742
|
memo as memo15,
|
|
2735
2743
|
useContext as useContext5,
|
|
2736
|
-
useMemo as
|
|
2744
|
+
useMemo as useMemo11
|
|
2737
2745
|
} from "react";
|
|
2738
2746
|
var ImageDataContext = createContext5(
|
|
2739
2747
|
void 0
|
|
@@ -2742,7 +2750,7 @@ var ImageDataProvider = memo15(function ImageDataProvider2({
|
|
|
2742
2750
|
children,
|
|
2743
2751
|
getImageData
|
|
2744
2752
|
}) {
|
|
2745
|
-
const contextValue =
|
|
2753
|
+
const contextValue = useMemo11(
|
|
2746
2754
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
2747
2755
|
[getImageData]
|
|
2748
2756
|
);
|
|
@@ -2757,9 +2765,9 @@ function useImageData(ref) {
|
|
|
2757
2765
|
}
|
|
2758
2766
|
|
|
2759
2767
|
// src/hooks/useObjectURL.ts
|
|
2760
|
-
import { useLayoutEffect as useLayoutEffect5, useMemo as
|
|
2768
|
+
import { useLayoutEffect as useLayoutEffect5, useMemo as useMemo12 } from "react";
|
|
2761
2769
|
function useObjectURL(object) {
|
|
2762
|
-
const objectURL =
|
|
2770
|
+
const objectURL = useMemo12(() => {
|
|
2763
2771
|
if (object instanceof Blob)
|
|
2764
2772
|
return URL.createObjectURL(object);
|
|
2765
2773
|
const bytes = object instanceof Uint8Array ? object : object !== void 0 ? new Uint8Array(object) : new Uint8Array();
|
|
@@ -2827,7 +2835,7 @@ var Background = styled18.span(({ background }) => ({
|
|
|
2827
2835
|
}));
|
|
2828
2836
|
var HorizontalDotsBackground = memo16(function HorizontalDotsBackground2() {
|
|
2829
2837
|
const { inputBackground, placeholderDots } = useTheme3().colors;
|
|
2830
|
-
const background =
|
|
2838
|
+
const background = useMemo13(
|
|
2831
2839
|
() => [
|
|
2832
2840
|
`center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
2833
2841
|
placeholderDots
|
|
@@ -2858,7 +2866,7 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
|
|
|
2858
2866
|
const image = useImageData(imageRef);
|
|
2859
2867
|
const url = useObjectURL(image);
|
|
2860
2868
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
2861
|
-
const background =
|
|
2869
|
+
const background = useMemo13(
|
|
2862
2870
|
() => [
|
|
2863
2871
|
size2,
|
|
2864
2872
|
`url(${url})`,
|
|
@@ -2871,13 +2879,13 @@ var PatternPreviewBackground = memo16(function PatternPreviewBackground2({
|
|
|
2871
2879
|
var ColorPreviewBackground = memo16(function ColorPreviewBackground2({
|
|
2872
2880
|
color
|
|
2873
2881
|
}) {
|
|
2874
|
-
const background =
|
|
2882
|
+
const background = useMemo13(() => sketchColorToRgbaString(color), [color]);
|
|
2875
2883
|
return /* @__PURE__ */ React25.createElement(Background, { background });
|
|
2876
2884
|
});
|
|
2877
2885
|
var GradientPreviewBackground = memo16(function GradientPreviewBackground2({
|
|
2878
2886
|
gradient
|
|
2879
2887
|
}) {
|
|
2880
|
-
const background =
|
|
2888
|
+
const background = useMemo13(
|
|
2881
2889
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
2882
2890
|
[gradient.gradientType, gradient.stops]
|
|
2883
2891
|
);
|
|
@@ -2943,7 +2951,7 @@ import {
|
|
|
2943
2951
|
hsvaToRgba,
|
|
2944
2952
|
rgbaToHsva as rgbaToHsva2
|
|
2945
2953
|
} from "@noya-app/noya-colorpicker";
|
|
2946
|
-
import React27, { memo as memo18, useCallback as
|
|
2954
|
+
import React27, { memo as memo18, useCallback as useCallback15, useMemo as useMemo14 } from "react";
|
|
2947
2955
|
var GradientPicker = memo18(function GradientPicker2({
|
|
2948
2956
|
value,
|
|
2949
2957
|
selectedStop,
|
|
@@ -2953,7 +2961,7 @@ var GradientPicker = memo18(function GradientPicker2({
|
|
|
2953
2961
|
onDelete,
|
|
2954
2962
|
onSelectStop
|
|
2955
2963
|
}) {
|
|
2956
|
-
const colorModel =
|
|
2964
|
+
const colorModel = useMemo14(
|
|
2957
2965
|
() => ({
|
|
2958
2966
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
2959
2967
|
toHsva: rgbaToHsva2,
|
|
@@ -2962,17 +2970,17 @@ var GradientPicker = memo18(function GradientPicker2({
|
|
|
2962
2970
|
}),
|
|
2963
2971
|
[]
|
|
2964
2972
|
);
|
|
2965
|
-
const rgbaColor =
|
|
2973
|
+
const rgbaColor = useMemo14(
|
|
2966
2974
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
2967
2975
|
[value, selectedStop]
|
|
2968
2976
|
);
|
|
2969
|
-
const handleChangeColor =
|
|
2977
|
+
const handleChangeColor = useCallback15(
|
|
2970
2978
|
(value2) => {
|
|
2971
2979
|
onChangeColor(rgbaToSketchColor(value2));
|
|
2972
2980
|
},
|
|
2973
2981
|
[onChangeColor]
|
|
2974
2982
|
);
|
|
2975
|
-
const handleAddGradientStop =
|
|
2983
|
+
const handleAddGradientStop = useCallback15(
|
|
2976
2984
|
(value2, position) => {
|
|
2977
2985
|
onAdd(rgbaToSketchColor(value2), position);
|
|
2978
2986
|
},
|
|
@@ -3037,15 +3045,15 @@ import React29, {
|
|
|
3037
3045
|
createContext as createContext6,
|
|
3038
3046
|
forwardRef as forwardRef9,
|
|
3039
3047
|
memo as memo20,
|
|
3040
|
-
useCallback as
|
|
3048
|
+
useCallback as useCallback17,
|
|
3041
3049
|
useContext as useContext6,
|
|
3042
|
-
useMemo as
|
|
3050
|
+
useMemo as useMemo15
|
|
3043
3051
|
} from "react";
|
|
3044
3052
|
import styled22, { keyframes as keyframes2 } from "styled-components";
|
|
3045
3053
|
|
|
3046
3054
|
// src/components/ScrollArea.tsx
|
|
3047
3055
|
import * as RadixScrollArea from "@radix-ui/react-scroll-area";
|
|
3048
|
-
import React28, { memo as memo19, useCallback as
|
|
3056
|
+
import React28, { memo as memo19, useCallback as useCallback16, useState as useState14 } from "react";
|
|
3049
3057
|
import styled21 from "styled-components";
|
|
3050
3058
|
var SCROLLBAR_SIZE = 10;
|
|
3051
3059
|
var StyledViewport = styled21(RadixScrollArea.Viewport)({
|
|
@@ -3074,11 +3082,11 @@ var Container2 = styled21.div({
|
|
|
3074
3082
|
minHeight: 0
|
|
3075
3083
|
});
|
|
3076
3084
|
var ScrollArea = memo19(function ScrollArea2({ children }) {
|
|
3077
|
-
const [scrollElementRef, setScrollElementRef] =
|
|
3085
|
+
const [scrollElementRef, setScrollElementRef] = useState14(null);
|
|
3078
3086
|
return /* @__PURE__ */ React28.createElement(Container2, null, /* @__PURE__ */ React28.createElement(RadixScrollArea.Root, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ React28.createElement(
|
|
3079
3087
|
StyledViewport,
|
|
3080
3088
|
{
|
|
3081
|
-
ref:
|
|
3089
|
+
ref: useCallback16(
|
|
3082
3090
|
(ref) => setScrollElementRef(ref),
|
|
3083
3091
|
[]
|
|
3084
3092
|
)
|
|
@@ -3288,7 +3296,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3288
3296
|
}
|
|
3289
3297
|
});
|
|
3290
3298
|
const { textPosition, bordered, disabled } = useContext6(GridViewContext);
|
|
3291
|
-
const handleClick =
|
|
3299
|
+
const handleClick = useCallback17(
|
|
3292
3300
|
(event) => {
|
|
3293
3301
|
event.stopPropagation();
|
|
3294
3302
|
event.preventDefault();
|
|
@@ -3297,7 +3305,7 @@ var GridViewItem = forwardRef9(function GridViewItem2({
|
|
|
3297
3305
|
},
|
|
3298
3306
|
[onClick, onPress]
|
|
3299
3307
|
);
|
|
3300
|
-
const handleKeyDown =
|
|
3308
|
+
const handleKeyDown = useCallback17(
|
|
3301
3309
|
(event) => {
|
|
3302
3310
|
if (event.key === "Enter" || event.key === " ") {
|
|
3303
3311
|
event.stopPropagation();
|
|
@@ -3365,7 +3373,7 @@ function GridViewRoot({
|
|
|
3365
3373
|
bordered = false,
|
|
3366
3374
|
disabled = false
|
|
3367
3375
|
}) {
|
|
3368
|
-
const handleClick =
|
|
3376
|
+
const handleClick = useCallback17(
|
|
3369
3377
|
(event) => {
|
|
3370
3378
|
event.stopPropagation();
|
|
3371
3379
|
event.preventDefault();
|
|
@@ -3373,7 +3381,7 @@ function GridViewRoot({
|
|
|
3373
3381
|
},
|
|
3374
3382
|
[onClick]
|
|
3375
3383
|
);
|
|
3376
|
-
const contextValue =
|
|
3384
|
+
const contextValue = useMemo15(
|
|
3377
3385
|
() => ({
|
|
3378
3386
|
size: size2,
|
|
3379
3387
|
textPosition,
|
|
@@ -3411,13 +3419,13 @@ import { chunkBy, partition } from "@noya-app/noya-utils";
|
|
|
3411
3419
|
import React33, {
|
|
3412
3420
|
forwardRef as forwardRef12,
|
|
3413
3421
|
memo as memo23,
|
|
3414
|
-
useCallback as
|
|
3415
|
-
useEffect as
|
|
3422
|
+
useCallback as useCallback20,
|
|
3423
|
+
useEffect as useEffect12,
|
|
3416
3424
|
useImperativeHandle as useImperativeHandle3,
|
|
3417
3425
|
useLayoutEffect as useLayoutEffect7,
|
|
3418
|
-
useMemo as
|
|
3426
|
+
useMemo as useMemo18,
|
|
3419
3427
|
useRef as useRef15,
|
|
3420
|
-
useState as
|
|
3428
|
+
useState as useState16
|
|
3421
3429
|
} from "react";
|
|
3422
3430
|
import styled25 from "styled-components";
|
|
3423
3431
|
|
|
@@ -3501,11 +3509,11 @@ import React31, {
|
|
|
3501
3509
|
forwardRef as forwardRef10,
|
|
3502
3510
|
isValidElement as isValidElement3,
|
|
3503
3511
|
memo as memo22,
|
|
3504
|
-
useCallback as
|
|
3512
|
+
useCallback as useCallback19,
|
|
3505
3513
|
useContext as useContext8,
|
|
3506
3514
|
useImperativeHandle as useImperativeHandle2,
|
|
3507
3515
|
useLayoutEffect as useLayoutEffect6,
|
|
3508
|
-
useMemo as
|
|
3516
|
+
useMemo as useMemo17,
|
|
3509
3517
|
useRef as useRef14
|
|
3510
3518
|
} from "react";
|
|
3511
3519
|
import { WindowScroller } from "react-virtualized";
|
|
@@ -3552,11 +3560,11 @@ import {
|
|
|
3552
3560
|
import React30, {
|
|
3553
3561
|
createContext as createContext7,
|
|
3554
3562
|
memo as memo21,
|
|
3555
|
-
useCallback as
|
|
3563
|
+
useCallback as useCallback18,
|
|
3556
3564
|
useContext as useContext7,
|
|
3557
|
-
useMemo as
|
|
3565
|
+
useMemo as useMemo16,
|
|
3558
3566
|
useRef as useRef13,
|
|
3559
|
-
useState as
|
|
3567
|
+
useState as useState15
|
|
3560
3568
|
} from "react";
|
|
3561
3569
|
import { createPortal } from "react-dom";
|
|
3562
3570
|
var normalizeListDestinationIndex = (index, position) => {
|
|
@@ -3613,7 +3621,7 @@ function SortableItem({
|
|
|
3613
3621
|
const eventY = activatorEvent?.clientY ?? 0;
|
|
3614
3622
|
const offsetLeft = eventX + position.x;
|
|
3615
3623
|
const offsetTop = eventY + position.y;
|
|
3616
|
-
const ref =
|
|
3624
|
+
const ref = useCallback18((node) => setNodeRef(node), [setNodeRef]);
|
|
3617
3625
|
return children({
|
|
3618
3626
|
ref,
|
|
3619
3627
|
...attributes,
|
|
@@ -3644,22 +3652,22 @@ function SortableRoot({
|
|
|
3644
3652
|
}
|
|
3645
3653
|
})
|
|
3646
3654
|
);
|
|
3647
|
-
const [activeIndex, setActiveIndex] =
|
|
3655
|
+
const [activeIndex, setActiveIndex] = useState15();
|
|
3648
3656
|
const activatorEvent = useRef13(null);
|
|
3649
|
-
const setActivatorEvent =
|
|
3657
|
+
const setActivatorEvent = useCallback18((event) => {
|
|
3650
3658
|
activatorEvent.current = event;
|
|
3651
3659
|
}, []);
|
|
3652
|
-
const [position, setPosition] =
|
|
3653
|
-
const handleDragStart =
|
|
3660
|
+
const [position, setPosition] = useState15({ x: 0, y: 0 });
|
|
3661
|
+
const handleDragStart = useCallback18(
|
|
3654
3662
|
(event) => {
|
|
3655
3663
|
setActiveIndex(keys.indexOf(event.active.id));
|
|
3656
3664
|
},
|
|
3657
3665
|
[keys]
|
|
3658
3666
|
);
|
|
3659
|
-
const handleDragMove =
|
|
3667
|
+
const handleDragMove = useCallback18((event) => {
|
|
3660
3668
|
setPosition({ ...event.delta });
|
|
3661
3669
|
}, []);
|
|
3662
|
-
const handleDragEnd =
|
|
3670
|
+
const handleDragEnd = useCallback18(
|
|
3663
3671
|
(event) => {
|
|
3664
3672
|
const { active, over } = event;
|
|
3665
3673
|
setActiveIndex(void 0);
|
|
@@ -3689,7 +3697,7 @@ function SortableRoot({
|
|
|
3689
3697
|
return /* @__PURE__ */ React30.createElement(
|
|
3690
3698
|
SortableItemContext.Provider,
|
|
3691
3699
|
{
|
|
3692
|
-
value:
|
|
3700
|
+
value: useMemo16(
|
|
3693
3701
|
() => ({
|
|
3694
3702
|
keys,
|
|
3695
3703
|
acceptsDrop,
|
|
@@ -3929,7 +3937,7 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3929
3937
|
onHoverChange
|
|
3930
3938
|
});
|
|
3931
3939
|
const { indentation, isDragging } = useContext8(DraggingContext);
|
|
3932
|
-
const handlePress =
|
|
3940
|
+
const handlePress = useCallback19(
|
|
3933
3941
|
(event) => {
|
|
3934
3942
|
event.preventDefault();
|
|
3935
3943
|
if (event.button !== 0)
|
|
@@ -3938,14 +3946,14 @@ var ListViewRow = forwardRef10(function ListViewRow2({
|
|
|
3938
3946
|
},
|
|
3939
3947
|
[onPress]
|
|
3940
3948
|
);
|
|
3941
|
-
const handleDoubleClick =
|
|
3949
|
+
const handleDoubleClick = useCallback19(
|
|
3942
3950
|
(event) => {
|
|
3943
3951
|
event.stopPropagation();
|
|
3944
3952
|
onDoubleClick?.();
|
|
3945
3953
|
},
|
|
3946
3954
|
[onDoubleClick]
|
|
3947
3955
|
);
|
|
3948
|
-
const mergedStyle =
|
|
3956
|
+
const mergedStyle = useMemo17(() => {
|
|
3949
3957
|
return isDragging ? {
|
|
3950
3958
|
// TODO: Where do these offsets actually come from?
|
|
3951
3959
|
transform: `translate3d(-36px, -6px, 0)`,
|
|
@@ -4049,7 +4057,7 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4049
4057
|
// since it doesn't currently support row height changes
|
|
4050
4058
|
items
|
|
4051
4059
|
]);
|
|
4052
|
-
const listStyle =
|
|
4060
|
+
const listStyle = useMemo17(
|
|
4053
4061
|
() => ({
|
|
4054
4062
|
overflowX: "initial",
|
|
4055
4063
|
overflowY: "initial",
|
|
@@ -4061,9 +4069,9 @@ var VirtualizedListInner = forwardRef10(function VirtualizedListInner2({
|
|
|
4061
4069
|
WindowScroller,
|
|
4062
4070
|
{
|
|
4063
4071
|
scrollElement,
|
|
4064
|
-
style:
|
|
4072
|
+
style: useMemo17(() => ({ flex: "1 1 auto" }), [])
|
|
4065
4073
|
},
|
|
4066
|
-
|
|
4074
|
+
useCallback19(
|
|
4067
4075
|
({
|
|
4068
4076
|
registerChild,
|
|
4069
4077
|
onChildScroll,
|
|
@@ -4128,7 +4136,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4128
4136
|
colorScheme = "primary",
|
|
4129
4137
|
gap = 0
|
|
4130
4138
|
}, forwardedRef) {
|
|
4131
|
-
const handleClick =
|
|
4139
|
+
const handleClick = useCallback19(
|
|
4132
4140
|
(event) => {
|
|
4133
4141
|
if (event.target instanceof HTMLElement && event.target.classList.contains("scroll-component"))
|
|
4134
4142
|
return;
|
|
@@ -4138,11 +4146,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4138
4146
|
},
|
|
4139
4147
|
[onPress]
|
|
4140
4148
|
);
|
|
4141
|
-
const renderChild =
|
|
4149
|
+
const renderChild = useCallback19(
|
|
4142
4150
|
(index) => renderItem(data[index], index, { isDragging: false }),
|
|
4143
4151
|
[data, renderItem]
|
|
4144
4152
|
);
|
|
4145
|
-
const getItemContextValue =
|
|
4153
|
+
const getItemContextValue = useCallback19(
|
|
4146
4154
|
(i) => {
|
|
4147
4155
|
const current = renderChild(i);
|
|
4148
4156
|
if (!isValidElement3(current))
|
|
@@ -4202,15 +4210,15 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4202
4210
|
gap
|
|
4203
4211
|
]
|
|
4204
4212
|
);
|
|
4205
|
-
const draggingContextOverlayValue =
|
|
4213
|
+
const draggingContextOverlayValue = useMemo17(
|
|
4206
4214
|
() => ({ indentation, isDragging: true }),
|
|
4207
4215
|
[indentation]
|
|
4208
4216
|
);
|
|
4209
|
-
const renderOverlay =
|
|
4217
|
+
const renderOverlay = useCallback19(
|
|
4210
4218
|
(index) => /* @__PURE__ */ React31.createElement("div", { style: { opacity: 0.25 } }, /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextOverlayValue }, renderItem(data[index], index, { isDragging: true }))),
|
|
4211
4219
|
[draggingContextOverlayValue, renderItem, data]
|
|
4212
4220
|
);
|
|
4213
|
-
const renderWrappedChild =
|
|
4221
|
+
const renderWrappedChild = useCallback19(
|
|
4214
4222
|
(index) => {
|
|
4215
4223
|
const contextValue = getItemContextValue(index);
|
|
4216
4224
|
const current = renderChild(index);
|
|
@@ -4220,7 +4228,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4220
4228
|
},
|
|
4221
4229
|
[getItemContextValue, renderChild]
|
|
4222
4230
|
);
|
|
4223
|
-
const ids =
|
|
4231
|
+
const ids = useMemo17(() => data.map(keyExtractor), [keyExtractor, data]);
|
|
4224
4232
|
const withSortable = (children) => sortable ? /* @__PURE__ */ React31.createElement(
|
|
4225
4233
|
Sortable.Root,
|
|
4226
4234
|
{
|
|
@@ -4232,7 +4240,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4232
4240
|
children
|
|
4233
4241
|
) : children;
|
|
4234
4242
|
const withScrollable = (children) => scrollable ? /* @__PURE__ */ React31.createElement(ScrollArea, null, children) : children(null);
|
|
4235
|
-
const getItemHeight =
|
|
4243
|
+
const getItemHeight = useCallback19(
|
|
4236
4244
|
(index) => {
|
|
4237
4245
|
const child = getItemContextValue(index);
|
|
4238
4246
|
const margin = child?.marginType ? getPositionMargin(child.marginType) : { top: 0, bottom: 0 };
|
|
@@ -4241,11 +4249,11 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4241
4249
|
},
|
|
4242
4250
|
[getItemContextValue, variant]
|
|
4243
4251
|
);
|
|
4244
|
-
const getKey =
|
|
4252
|
+
const getKey = useCallback19(
|
|
4245
4253
|
(index) => keyExtractor(data[index], index),
|
|
4246
4254
|
[data, keyExtractor]
|
|
4247
4255
|
);
|
|
4248
|
-
const draggingContextValue =
|
|
4256
|
+
const draggingContextValue = useMemo17(() => ({ indentation }), [indentation]);
|
|
4249
4257
|
return /* @__PURE__ */ React31.createElement(DraggingContext.Provider, { value: draggingContextValue }, /* @__PURE__ */ React31.createElement(
|
|
4250
4258
|
RootContainer2,
|
|
4251
4259
|
{
|
|
@@ -4275,7 +4283,7 @@ var ListViewRootInner = forwardRef10(function ListViewRootInner2({
|
|
|
4275
4283
|
});
|
|
4276
4284
|
var ListViewRoot = memo22(ListViewRootInner);
|
|
4277
4285
|
var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ children, ...rest }, forwardedRef) {
|
|
4278
|
-
const items =
|
|
4286
|
+
const items = useMemo17(
|
|
4279
4287
|
() => Children4.toArray(children).flatMap(
|
|
4280
4288
|
(child) => isValidElement3(child) ? [child] : []
|
|
4281
4289
|
),
|
|
@@ -4287,11 +4295,11 @@ var ChildrenListViewInner = forwardRef10(function ChildrenListViewInner2({ child
|
|
|
4287
4295
|
ref: forwardedRef,
|
|
4288
4296
|
...rest,
|
|
4289
4297
|
data: items,
|
|
4290
|
-
keyExtractor:
|
|
4298
|
+
keyExtractor: useCallback19(
|
|
4291
4299
|
({ key }, index) => typeof key === "string" ? key : (key ?? index).toString(),
|
|
4292
4300
|
[]
|
|
4293
4301
|
),
|
|
4294
|
-
renderItem:
|
|
4302
|
+
renderItem: useCallback19((item) => item, [])
|
|
4295
4303
|
}
|
|
4296
4304
|
);
|
|
4297
4305
|
});
|
|
@@ -4499,12 +4507,12 @@ var InputFieldWithCompletions = memo23(
|
|
|
4499
4507
|
hideMenuWhenEmptyValue = false
|
|
4500
4508
|
}, forwardedRef) {
|
|
4501
4509
|
const ref = useRef15(null);
|
|
4502
|
-
const [isFocused, setIsFocused] =
|
|
4503
|
-
const [state, _setState] =
|
|
4510
|
+
const [isFocused, setIsFocused] = useState16(false);
|
|
4511
|
+
const [state, _setState] = useState16({
|
|
4504
4512
|
filter: initialValue,
|
|
4505
4513
|
selectedIndex: 0
|
|
4506
4514
|
});
|
|
4507
|
-
const updateState =
|
|
4515
|
+
const updateState = useCallback20(
|
|
4508
4516
|
(newState, hoverItem) => {
|
|
4509
4517
|
const nextState = { ...state, ...newState };
|
|
4510
4518
|
const nextItems = filterWithGroupedSections(items, nextState.filter);
|
|
@@ -4542,7 +4550,7 @@ var InputFieldWithCompletions = memo23(
|
|
|
4542
4550
|
}, [initialValue, updateState]);
|
|
4543
4551
|
const { filter, selectedIndex } = state;
|
|
4544
4552
|
const listRef = React33.useRef(null);
|
|
4545
|
-
const filteredItems =
|
|
4553
|
+
const filteredItems = useMemo18(
|
|
4546
4554
|
() => filterWithGroupedSections(items, filter),
|
|
4547
4555
|
[items, filter]
|
|
4548
4556
|
);
|
|
@@ -4558,13 +4566,13 @@ var InputFieldWithCompletions = memo23(
|
|
|
4558
4566
|
),
|
|
4559
4567
|
ListView.rowHeight * 10.5
|
|
4560
4568
|
);
|
|
4561
|
-
|
|
4569
|
+
useEffect12(() => {
|
|
4562
4570
|
if (listRef.current) {
|
|
4563
4571
|
listRef.current.scrollToIndex(selectedIndex);
|
|
4564
4572
|
}
|
|
4565
4573
|
}, [selectedIndex]);
|
|
4566
4574
|
const lastSubmittedValueRef = useRef15(void 0);
|
|
4567
|
-
const selectItem =
|
|
4575
|
+
const selectItem = useCallback20(
|
|
4568
4576
|
(item) => {
|
|
4569
4577
|
if (item.type === "sectionHeader")
|
|
4570
4578
|
return;
|
|
@@ -4580,17 +4588,17 @@ var InputFieldWithCompletions = memo23(
|
|
|
4580
4588
|
},
|
|
4581
4589
|
[filter, onSelectItem, onHoverItem, ref]
|
|
4582
4590
|
);
|
|
4583
|
-
const handleChange =
|
|
4591
|
+
const handleChange = useCallback20(
|
|
4584
4592
|
(value) => updateState({ selectedIndex: 0, filter: value }),
|
|
4585
4593
|
[updateState]
|
|
4586
4594
|
);
|
|
4587
|
-
const handleBlur =
|
|
4595
|
+
const handleBlur = useCallback20(() => {
|
|
4588
4596
|
setIsFocused(false);
|
|
4589
4597
|
const didSubmit = lastSubmittedValueRef.current?.filter === filter;
|
|
4590
4598
|
updateState({ selectedIndex: 0, filter: initialValue }, "resetHover");
|
|
4591
4599
|
onBlur?.(didSubmit, filter);
|
|
4592
4600
|
}, [filter, initialValue, onBlur, updateState]);
|
|
4593
|
-
const handleFocus =
|
|
4601
|
+
const handleFocus = useCallback20(
|
|
4594
4602
|
(event) => {
|
|
4595
4603
|
setIsFocused(true);
|
|
4596
4604
|
updateState({ selectedIndex: 0, filter: initialValue });
|
|
@@ -4598,11 +4606,11 @@ var InputFieldWithCompletions = memo23(
|
|
|
4598
4606
|
},
|
|
4599
4607
|
[initialValue, onFocus, updateState]
|
|
4600
4608
|
);
|
|
4601
|
-
const handleIndexChange =
|
|
4609
|
+
const handleIndexChange = useCallback20(
|
|
4602
4610
|
(index) => updateState({ selectedIndex: index }),
|
|
4603
4611
|
[updateState]
|
|
4604
4612
|
);
|
|
4605
|
-
const handleKeyDown =
|
|
4613
|
+
const handleKeyDown = useCallback20(
|
|
4606
4614
|
(event) => {
|
|
4607
4615
|
let handled = false;
|
|
4608
4616
|
switch (event.key) {
|
|
@@ -4800,7 +4808,7 @@ import React35, {
|
|
|
4800
4808
|
isValidElement as isValidElement4,
|
|
4801
4809
|
memo as memo25,
|
|
4802
4810
|
useLayoutEffect as useLayoutEffect8,
|
|
4803
|
-
useMemo as
|
|
4811
|
+
useMemo as useMemo19,
|
|
4804
4812
|
useRef as useRef16
|
|
4805
4813
|
} from "react";
|
|
4806
4814
|
import styled27 from "styled-components";
|
|
@@ -4832,12 +4840,12 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
4832
4840
|
).filter((id) => !!id);
|
|
4833
4841
|
const serializedIds = elementIds.join(",");
|
|
4834
4842
|
const containerRef = useRef16(null);
|
|
4835
|
-
const refs =
|
|
4843
|
+
const refs = useMemo19(() => {
|
|
4836
4844
|
return Object.fromEntries(
|
|
4837
4845
|
serializedIds.split(",").map((id) => [id, createRef()])
|
|
4838
4846
|
);
|
|
4839
4847
|
}, [serializedIds]);
|
|
4840
|
-
const labelElements =
|
|
4848
|
+
const labelElements = useMemo19(() => {
|
|
4841
4849
|
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React35.createElement(
|
|
4842
4850
|
"span",
|
|
4843
4851
|
{
|
|
@@ -4961,9 +4969,9 @@ import React37, {
|
|
|
4961
4969
|
createContext as createContext9,
|
|
4962
4970
|
forwardRef as forwardRef13,
|
|
4963
4971
|
memo as memo26,
|
|
4964
|
-
useCallback as
|
|
4972
|
+
useCallback as useCallback21,
|
|
4965
4973
|
useContext as useContext9,
|
|
4966
|
-
useMemo as
|
|
4974
|
+
useMemo as useMemo20
|
|
4967
4975
|
} from "react";
|
|
4968
4976
|
import styled29 from "styled-components";
|
|
4969
4977
|
var ignoredProps3 = /* @__PURE__ */ new Set(["colorScheme"]);
|
|
@@ -5042,8 +5050,8 @@ function ToggleGroupRoot({
|
|
|
5042
5050
|
allowEmpty,
|
|
5043
5051
|
children
|
|
5044
5052
|
}) {
|
|
5045
|
-
const contextValue =
|
|
5046
|
-
const handleValueChange =
|
|
5053
|
+
const contextValue = useMemo20(() => ({ colorScheme }), [colorScheme]);
|
|
5054
|
+
const handleValueChange = useCallback21(
|
|
5047
5055
|
(value2) => {
|
|
5048
5056
|
if (!allowEmpty && !value2)
|
|
5049
5057
|
return;
|
|
@@ -5074,10 +5082,10 @@ import { memoize as memoize2 } from "@noya-app/noya-utils";
|
|
|
5074
5082
|
import React38, {
|
|
5075
5083
|
createContext as createContext10,
|
|
5076
5084
|
memo as memo27,
|
|
5077
|
-
useCallback as
|
|
5085
|
+
useCallback as useCallback22,
|
|
5078
5086
|
useContext as useContext10,
|
|
5079
|
-
useEffect as
|
|
5080
|
-
useMemo as
|
|
5087
|
+
useEffect as useEffect13,
|
|
5088
|
+
useMemo as useMemo21,
|
|
5081
5089
|
useRef as useRef17
|
|
5082
5090
|
} from "react";
|
|
5083
5091
|
import styled30 from "styled-components";
|
|
@@ -5088,7 +5096,7 @@ var SelectOption = memo27(function SelectOption2({
|
|
|
5088
5096
|
onSelect
|
|
5089
5097
|
}) {
|
|
5090
5098
|
const { addListener, removeListener } = useContext10(SelectContext);
|
|
5091
|
-
|
|
5099
|
+
useEffect13(() => {
|
|
5092
5100
|
if (!onSelect)
|
|
5093
5101
|
return;
|
|
5094
5102
|
addListener(value, onSelect);
|
|
@@ -5144,7 +5152,7 @@ var Select = memo27(function Select2({
|
|
|
5144
5152
|
const getTitle = "options" in rest ? rest.getTitle : void 0;
|
|
5145
5153
|
const onChange = "options" in rest ? rest.onChange : void 0;
|
|
5146
5154
|
const children = "options" in rest ? void 0 : rest.children;
|
|
5147
|
-
const optionElements =
|
|
5155
|
+
const optionElements = useMemo21(
|
|
5148
5156
|
() => options ? options.map((option, index) => /* @__PURE__ */ React38.createElement(
|
|
5149
5157
|
SelectOption,
|
|
5150
5158
|
{
|
|
@@ -5157,7 +5165,7 @@ var Select = memo27(function Select2({
|
|
|
5157
5165
|
[children, getTitle, onChange, options]
|
|
5158
5166
|
);
|
|
5159
5167
|
const listeners = useRef17(/* @__PURE__ */ new Map());
|
|
5160
|
-
const contextValue =
|
|
5168
|
+
const contextValue = useMemo21(
|
|
5161
5169
|
() => ({
|
|
5162
5170
|
addListener: (value2, listener) => listeners.current.set(value2, listener),
|
|
5163
5171
|
removeListener: (value2) => listeners.current.delete(value2)
|
|
@@ -5170,7 +5178,7 @@ var Select = memo27(function Select2({
|
|
|
5170
5178
|
id,
|
|
5171
5179
|
flex,
|
|
5172
5180
|
value,
|
|
5173
|
-
onChange:
|
|
5181
|
+
onChange: useCallback22(
|
|
5174
5182
|
(event) => listeners.current.get(event.target.value)?.(),
|
|
5175
5183
|
[listeners]
|
|
5176
5184
|
),
|
|
@@ -5182,7 +5190,7 @@ var Select = memo27(function Select2({
|
|
|
5182
5190
|
|
|
5183
5191
|
// src/components/Slider.tsx
|
|
5184
5192
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
5185
|
-
import React39, { useCallback as
|
|
5193
|
+
import React39, { useCallback as useCallback23, useMemo as useMemo22 } from "react";
|
|
5186
5194
|
import styled31 from "styled-components";
|
|
5187
5195
|
var StyledSlider = styled31(RadixSlider.Root)({
|
|
5188
5196
|
flex: "1",
|
|
@@ -5223,11 +5231,11 @@ var Slider = function Slider2({
|
|
|
5223
5231
|
min,
|
|
5224
5232
|
max
|
|
5225
5233
|
}) {
|
|
5226
|
-
const arrayValue =
|
|
5234
|
+
const arrayValue = useMemo22(
|
|
5227
5235
|
() => [Math.min(Math.max(value, min), max)],
|
|
5228
5236
|
[value, min, max]
|
|
5229
5237
|
);
|
|
5230
|
-
const handleValueChange =
|
|
5238
|
+
const handleValueChange = useCallback23(
|
|
5231
5239
|
(arrayValue2) => {
|
|
5232
5240
|
onValueChange(arrayValue2[0]);
|
|
5233
5241
|
},
|
|
@@ -5302,7 +5310,7 @@ var Switch = function Switch2({
|
|
|
5302
5310
|
import React41, {
|
|
5303
5311
|
forwardRef as forwardRef14,
|
|
5304
5312
|
memo as memo28,
|
|
5305
|
-
useCallback as
|
|
5313
|
+
useCallback as useCallback24,
|
|
5306
5314
|
useContext as useContext11
|
|
5307
5315
|
} from "react";
|
|
5308
5316
|
var TreeRow = forwardRef14(function TreeRow2({
|
|
@@ -5313,7 +5321,7 @@ var TreeRow = forwardRef14(function TreeRow2({
|
|
|
5313
5321
|
...rest
|
|
5314
5322
|
}, forwardedRef) {
|
|
5315
5323
|
const { expandable } = useContext11(ListView.RowContext);
|
|
5316
|
-
const handleClickChevron =
|
|
5324
|
+
const handleClickChevron = useCallback24(
|
|
5317
5325
|
(event) => {
|
|
5318
5326
|
event.stopPropagation();
|
|
5319
5327
|
onClickChevron?.({ altKey: event.altKey });
|
|
@@ -5642,7 +5650,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
5642
5650
|
|
|
5643
5651
|
// src/components/ArrayController.tsx
|
|
5644
5652
|
import { range as range2 } from "@noya-app/noya-utils";
|
|
5645
|
-
import React43, { memo as memo30, useCallback as
|
|
5653
|
+
import React43, { memo as memo30, useCallback as useCallback25, useMemo as useMemo23 } from "react";
|
|
5646
5654
|
import styled34, { useTheme as useTheme5 } from "styled-components";
|
|
5647
5655
|
|
|
5648
5656
|
// src/components/InspectorPrimitives.tsx
|
|
@@ -5774,12 +5782,12 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5774
5782
|
}) {
|
|
5775
5783
|
const iconColor = useTheme5().colors.icon;
|
|
5776
5784
|
const primaryLightColor = useTheme5().colors.primaryLight;
|
|
5777
|
-
const keys =
|
|
5785
|
+
const keys = useMemo23(
|
|
5778
5786
|
() => items.map((item, index) => getKey?.(item) ?? index.toString()),
|
|
5779
5787
|
[getKey, items]
|
|
5780
5788
|
);
|
|
5781
5789
|
const indexes = reversed ? range2(0, items.length).reverse() : range2(0, items.length);
|
|
5782
|
-
const handleMoveItem =
|
|
5790
|
+
const handleMoveItem = useCallback25(
|
|
5783
5791
|
(sourceIndex, destinationIndex, position) => {
|
|
5784
5792
|
if (reversed) {
|
|
5785
5793
|
if (position === "above") {
|
|
@@ -5850,7 +5858,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
5850
5858
|
|
|
5851
5859
|
// src/components/DimensionInput.tsx
|
|
5852
5860
|
import { round } from "@noya-app/noya-utils";
|
|
5853
|
-
import React44, { memo as memo31, useCallback as
|
|
5861
|
+
import React44, { memo as memo31, useCallback as useCallback26 } from "react";
|
|
5854
5862
|
function getNewValue(value, mode, delta) {
|
|
5855
5863
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
5856
5864
|
}
|
|
@@ -5864,11 +5872,11 @@ var DimensionInput = memo31(function DimensionInput2({
|
|
|
5864
5872
|
disabled,
|
|
5865
5873
|
trigger = "submit"
|
|
5866
5874
|
}) {
|
|
5867
|
-
const handleNudgeValue =
|
|
5875
|
+
const handleNudgeValue = useCallback26(
|
|
5868
5876
|
(value2) => onSetValue(value2, "adjust"),
|
|
5869
5877
|
[onSetValue]
|
|
5870
5878
|
);
|
|
5871
|
-
const handleSetValue =
|
|
5879
|
+
const handleSetValue = useCallback26(
|
|
5872
5880
|
(value2) => onSetValue(value2, "replace"),
|
|
5873
5881
|
[onSetValue]
|
|
5874
5882
|
);
|