@noya-app/noya-designsystem 0.1.57 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +15 -6
- package/dist/index.d.ts +15 -6
- package/dist/index.js +300 -253
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +789 -743
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/validateDropIndicator.test.ts +64 -31
- package/src/components/sorting/SharedDragProvider.tsx +79 -25
- package/src/components/sorting/Sortable.tsx +19 -26
- package/src/components/sorting/sorting.ts +32 -63
- package/src/utils/moveTreeItem.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -163,6 +163,7 @@ __export(src_exports, {
|
|
|
163
163
|
cssVars: () => cssVars,
|
|
164
164
|
cx: () => cx,
|
|
165
165
|
defaultAcceptsDrop: () => defaultAcceptsDrop,
|
|
166
|
+
dragItemKeySeparator: () => dragItemKeySeparator,
|
|
166
167
|
filterWithGroupedSections: () => filterWithGroupedSections,
|
|
167
168
|
fuzzyFilter: () => fuzzyFilter,
|
|
168
169
|
fuzzyScore: () => fuzzyScore,
|
|
@@ -449,6 +450,9 @@ var import_react7 = require("react");
|
|
|
449
450
|
// ../noya-react-utils/src/hooks/useIsMounted.ts
|
|
450
451
|
var import_react8 = require("react");
|
|
451
452
|
|
|
453
|
+
// ../noya-react-utils/src/hooks/useIsomorphicLayoutEffect.ts
|
|
454
|
+
var React5 = __toESM(require("react"));
|
|
455
|
+
|
|
452
456
|
// ../noya-react-utils/src/hooks/useLateReference.ts
|
|
453
457
|
var import_react9 = require("react");
|
|
454
458
|
|
|
@@ -520,6 +524,18 @@ var import_react15 = require("react");
|
|
|
520
524
|
|
|
521
525
|
// ../noya-react-utils/src/hooks/useStableCallback.ts
|
|
522
526
|
var import_react16 = require("react");
|
|
527
|
+
var noop2 = () => {
|
|
528
|
+
};
|
|
529
|
+
function useStableCallback(callback) {
|
|
530
|
+
const callbackRef = (0, import_react16.useRef)(callback || noop2);
|
|
531
|
+
(0, import_react16.useLayoutEffect)(() => {
|
|
532
|
+
callbackRef.current = callback || noop2;
|
|
533
|
+
}, [callback]);
|
|
534
|
+
return (0, import_react16.useCallback)(
|
|
535
|
+
(...args) => callbackRef.current(...args),
|
|
536
|
+
[callbackRef]
|
|
537
|
+
);
|
|
538
|
+
}
|
|
523
539
|
|
|
524
540
|
// ../noya-react-utils/src/hooks/useSystemColorScheme.ts
|
|
525
541
|
var import_react17 = require("react");
|
|
@@ -651,16 +667,16 @@ var RadixDropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
|
651
667
|
var import_react35 = __toESM(require("react"));
|
|
652
668
|
|
|
653
669
|
// src/contexts/PortalScopeContext.tsx
|
|
654
|
-
var
|
|
655
|
-
var PortalScopeContext =
|
|
656
|
-
var PortalScopeProvider =
|
|
670
|
+
var React6 = __toESM(require("react"));
|
|
671
|
+
var PortalScopeContext = React6.createContext(void 0);
|
|
672
|
+
var PortalScopeProvider = React6.memo(function PortalScopeProvider2({
|
|
657
673
|
children,
|
|
658
674
|
portalScopeId
|
|
659
675
|
}) {
|
|
660
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ React6.createElement(PortalScopeContext.Provider, { value: portalScopeId }, children);
|
|
661
677
|
});
|
|
662
678
|
function usePortalScopeId() {
|
|
663
|
-
return
|
|
679
|
+
return React6.useContext(PortalScopeContext) ?? "";
|
|
664
680
|
}
|
|
665
681
|
var portalScopeDataSetName = "noyaPortalScope";
|
|
666
682
|
var portalScopePropName = `data-noya-portal-scope`;
|
|
@@ -686,14 +702,14 @@ var import_react32 = __toESM(require("react"));
|
|
|
686
702
|
|
|
687
703
|
// src/contexts/DesignSystemConfiguration.tsx
|
|
688
704
|
var import_noya_keymap = require("@noya-app/noya-keymap");
|
|
689
|
-
var
|
|
705
|
+
var React23 = __toESM(require("react"));
|
|
690
706
|
|
|
691
707
|
// src/components/Toast.tsx
|
|
692
708
|
var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
|
|
693
709
|
var import_react21 = __toESM(require("react"));
|
|
694
710
|
|
|
695
711
|
// src/components/IconButton.tsx
|
|
696
|
-
var
|
|
712
|
+
var React12 = __toESM(require("react"));
|
|
697
713
|
|
|
698
714
|
// src/components/Button.tsx
|
|
699
715
|
var import_react20 = __toESM(require("react"));
|
|
@@ -763,20 +779,20 @@ function mergeConflictingClassNames(classNames, options) {
|
|
|
763
779
|
|
|
764
780
|
// src/components/Icons.tsx
|
|
765
781
|
var Icons = __toESM(require("@noya-app/noya-icons"));
|
|
766
|
-
var
|
|
782
|
+
var React7 = __toESM(require("react"));
|
|
767
783
|
function renderIcon(iconName) {
|
|
768
784
|
if (typeof iconName === "string") {
|
|
769
785
|
const Icon = Icons[iconName];
|
|
770
|
-
return /* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ React7.createElement(Icon, null);
|
|
771
787
|
}
|
|
772
788
|
return iconName;
|
|
773
789
|
}
|
|
774
790
|
|
|
775
791
|
// src/components/Spacer.tsx
|
|
776
|
-
var
|
|
777
|
-
var SpacerVertical =
|
|
792
|
+
var React8 = __toESM(require("react"));
|
|
793
|
+
var SpacerVertical = React8.forwardRef(
|
|
778
794
|
({ size: size2, inline, ...props }, ref) => {
|
|
779
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ React8.createElement(
|
|
780
796
|
"span",
|
|
781
797
|
{
|
|
782
798
|
className: `${inline ? "inline-block" : "block"} ${size2 === void 0 ? "flex flex-1" : ""}`,
|
|
@@ -789,9 +805,9 @@ var SpacerVertical = React7.forwardRef(
|
|
|
789
805
|
);
|
|
790
806
|
}
|
|
791
807
|
);
|
|
792
|
-
var SpacerHorizontal =
|
|
808
|
+
var SpacerHorizontal = React8.forwardRef(
|
|
793
809
|
({ size: size2, inline, ...props }, ref) => {
|
|
794
|
-
return /* @__PURE__ */
|
|
810
|
+
return /* @__PURE__ */ React8.createElement(
|
|
795
811
|
"span",
|
|
796
812
|
{
|
|
797
813
|
className: `${inline ? "inline-block" : "block"} ${size2 === void 0 ? "flex flex-1" : ""}`,
|
|
@@ -812,7 +828,7 @@ var Spacer;
|
|
|
812
828
|
|
|
813
829
|
// src/components/Tooltip.tsx
|
|
814
830
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
815
|
-
var
|
|
831
|
+
var React10 = __toESM(require("react"));
|
|
816
832
|
|
|
817
833
|
// src/components/Text.tsx
|
|
818
834
|
var import_react19 = __toESM(require("react"));
|
|
@@ -908,13 +924,13 @@ var Italic = ({ children }) => /* @__PURE__ */ import_react19.default.createElem
|
|
|
908
924
|
);
|
|
909
925
|
|
|
910
926
|
// src/components/Tooltip.tsx
|
|
911
|
-
var Tooltip =
|
|
927
|
+
var Tooltip = React10.memo(function Tooltip2({
|
|
912
928
|
children,
|
|
913
929
|
content,
|
|
914
930
|
sideOffset = 2
|
|
915
931
|
}) {
|
|
916
932
|
const portalScopeId = usePortalScopeId();
|
|
917
|
-
return /* @__PURE__ */
|
|
933
|
+
return /* @__PURE__ */ React10.createElement(TooltipPrimitive.Provider, null, /* @__PURE__ */ React10.createElement(TooltipPrimitive.Root, null, /* @__PURE__ */ React10.createElement(TooltipPrimitive.Trigger, { asChild: true }, children), /* @__PURE__ */ React10.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React10.createElement(
|
|
918
934
|
TooltipPrimitive.Content,
|
|
919
935
|
{
|
|
920
936
|
...portalScopeProps(portalScopeId),
|
|
@@ -1009,17 +1025,17 @@ var Button = (0, import_react20.forwardRef)(function Button2({
|
|
|
1009
1025
|
var Button_default = Button;
|
|
1010
1026
|
|
|
1011
1027
|
// src/components/IconButton.tsx
|
|
1012
|
-
var IconButton =
|
|
1013
|
-
|
|
1028
|
+
var IconButton = React12.memo(
|
|
1029
|
+
React12.forwardRef(function IconButton2({ selected, iconName, color, size: size2, contentStyle, ...props }, forwardedRef) {
|
|
1014
1030
|
const Icon = Icons[iconName];
|
|
1015
|
-
const style2 =
|
|
1031
|
+
const style2 = React12.useMemo(() => {
|
|
1016
1032
|
return {
|
|
1017
1033
|
padding: "0 2px",
|
|
1018
1034
|
...size2 && { minHeight: size2 },
|
|
1019
1035
|
...contentStyle
|
|
1020
1036
|
};
|
|
1021
1037
|
}, [contentStyle, size2]);
|
|
1022
|
-
return /* @__PURE__ */
|
|
1038
|
+
return /* @__PURE__ */ React12.createElement(Button, { ref: forwardedRef, ...props, variant: "none", contentStyle: style2 }, /* @__PURE__ */ React12.createElement(
|
|
1023
1039
|
Icon,
|
|
1024
1040
|
{
|
|
1025
1041
|
color: color ?? (selected ? cssVars.colors.iconSelected : cssVars.colors.icon),
|
|
@@ -1517,25 +1533,25 @@ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
|
1517
1533
|
var import_react27 = __toESM(require("react"));
|
|
1518
1534
|
|
|
1519
1535
|
// src/contexts/OpenPortalsContext.tsx
|
|
1520
|
-
var
|
|
1521
|
-
var OpenPortalsContext =
|
|
1536
|
+
var React18 = __toESM(require("react"));
|
|
1537
|
+
var OpenPortalsContext = React18.createContext({
|
|
1522
1538
|
hasOpenPortals: false
|
|
1523
1539
|
});
|
|
1524
|
-
var OpenPortalControlsContext =
|
|
1540
|
+
var OpenPortalControlsContext = React18.createContext({
|
|
1525
1541
|
addOpenPortal: () => {
|
|
1526
1542
|
},
|
|
1527
1543
|
removeOpenPortal: () => {
|
|
1528
1544
|
}
|
|
1529
1545
|
});
|
|
1530
|
-
var OpenPortalsProvider =
|
|
1546
|
+
var OpenPortalsProvider = React18.memo(function OpenPortalsProvider2({
|
|
1531
1547
|
children
|
|
1532
1548
|
}) {
|
|
1533
|
-
const [openPortals, setOpenPortals] =
|
|
1534
|
-
const value =
|
|
1549
|
+
const [openPortals, setOpenPortals] = React18.useState([]);
|
|
1550
|
+
const value = React18.useMemo(
|
|
1535
1551
|
() => ({ hasOpenPortals: openPortals.length > 0 }),
|
|
1536
1552
|
[openPortals]
|
|
1537
1553
|
);
|
|
1538
|
-
const controlsValue =
|
|
1554
|
+
const controlsValue = React18.useMemo(
|
|
1539
1555
|
() => ({
|
|
1540
1556
|
addOpenPortal: (portal) => {
|
|
1541
1557
|
setOpenPortals((prev) => [...prev, portal]);
|
|
@@ -1546,13 +1562,13 @@ var OpenPortalsProvider = React17.memo(function OpenPortalsProvider2({
|
|
|
1546
1562
|
}),
|
|
1547
1563
|
[]
|
|
1548
1564
|
);
|
|
1549
|
-
return /* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ React18.createElement(OpenPortalsContext.Provider, { value }, /* @__PURE__ */ React18.createElement(OpenPortalControlsContext.Provider, { value: controlsValue }, children));
|
|
1550
1566
|
});
|
|
1551
1567
|
function useHasOpenPortals() {
|
|
1552
|
-
return
|
|
1568
|
+
return React18.useContext(OpenPortalsContext).hasOpenPortals;
|
|
1553
1569
|
}
|
|
1554
1570
|
function useOpenPortalsControls() {
|
|
1555
|
-
return
|
|
1571
|
+
return React18.useContext(OpenPortalControlsContext);
|
|
1556
1572
|
}
|
|
1557
1573
|
|
|
1558
1574
|
// src/components/Popover.tsx
|
|
@@ -1668,7 +1684,7 @@ var InputFieldContext = (0, import_react28.createContext)({
|
|
|
1668
1684
|
endRef: null
|
|
1669
1685
|
});
|
|
1670
1686
|
var useInputFieldContext = () => (0, import_react28.useContext)(InputFieldContext);
|
|
1671
|
-
var
|
|
1687
|
+
var noop3 = () => {
|
|
1672
1688
|
};
|
|
1673
1689
|
var getFieldSpacing = ({
|
|
1674
1690
|
endWidth = 0,
|
|
@@ -1918,7 +1934,7 @@ function InputFieldNumberInput(props) {
|
|
|
1918
1934
|
onKeyDown: !readOnly ? handleKeyDown : void 0,
|
|
1919
1935
|
onBlur: handleBlur,
|
|
1920
1936
|
...readOnly ? { readOnly: true } : {},
|
|
1921
|
-
..."onChange" in props ? { onChange: readOnly ?
|
|
1937
|
+
..."onChange" in props ? { onChange: readOnly ? noop3 : handleChange } : { onSubmit: readOnly ? noop3 : handleSubmit }
|
|
1922
1938
|
}
|
|
1923
1939
|
);
|
|
1924
1940
|
}
|
|
@@ -2380,30 +2396,30 @@ var useCurrentFloatingWindowInternal = () => {
|
|
|
2380
2396
|
};
|
|
2381
2397
|
|
|
2382
2398
|
// src/contexts/DesignSystemConfiguration.tsx
|
|
2383
|
-
var DesignSystemConfigurationContext =
|
|
2399
|
+
var DesignSystemConfigurationContext = React23.createContext({
|
|
2384
2400
|
platform: "key"
|
|
2385
2401
|
});
|
|
2386
|
-
var DesignSystemConfigurationProvider =
|
|
2402
|
+
var DesignSystemConfigurationProvider = React23.memo(
|
|
2387
2403
|
function DesignSystemConfigurationProvider2({
|
|
2388
2404
|
children,
|
|
2389
2405
|
platform
|
|
2390
2406
|
}) {
|
|
2391
|
-
const [internalPlatform, setInternalPlatform] =
|
|
2392
|
-
|
|
2407
|
+
const [internalPlatform, setInternalPlatform] = React23.useState(platform ?? "key");
|
|
2408
|
+
React23.useEffect(() => {
|
|
2393
2409
|
if (platform !== void 0) return;
|
|
2394
2410
|
if (typeof navigator !== "undefined") {
|
|
2395
2411
|
setInternalPlatform((0, import_noya_keymap.getCurrentPlatform)(navigator));
|
|
2396
2412
|
}
|
|
2397
2413
|
}, [platform]);
|
|
2398
|
-
const contextValue =
|
|
2414
|
+
const contextValue = React23.useMemo(
|
|
2399
2415
|
() => ({ platform: platform ?? internalPlatform }),
|
|
2400
2416
|
[platform, internalPlatform]
|
|
2401
2417
|
);
|
|
2402
|
-
return /* @__PURE__ */
|
|
2418
|
+
return /* @__PURE__ */ React23.createElement(DesignSystemConfigurationContext.Provider, { value: contextValue }, /* @__PURE__ */ React23.createElement(OpenPortalsProvider, null, /* @__PURE__ */ React23.createElement(DialogProvider, null, /* @__PURE__ */ React23.createElement(ToastProvider, null, /* @__PURE__ */ React23.createElement(FloatingWindowProvider, null, children)))));
|
|
2403
2419
|
}
|
|
2404
2420
|
);
|
|
2405
2421
|
function useDesignSystemConfiguration() {
|
|
2406
|
-
return
|
|
2422
|
+
return React23.useContext(DesignSystemConfigurationContext);
|
|
2407
2423
|
}
|
|
2408
2424
|
|
|
2409
2425
|
// src/utils/withSeparatorElements.ts
|
|
@@ -2864,16 +2880,16 @@ var ActionMenu = memoGeneric(function ActionMenu2({
|
|
|
2864
2880
|
});
|
|
2865
2881
|
|
|
2866
2882
|
// src/components/ActivityIndicator.tsx
|
|
2867
|
-
var
|
|
2868
|
-
var ActivityIndicator =
|
|
2883
|
+
var React29 = __toESM(require("react"));
|
|
2884
|
+
var ActivityIndicator = React29.memo(function ActivityIndicator2({
|
|
2869
2885
|
size: size2 = 16,
|
|
2870
2886
|
opacity = 1,
|
|
2871
2887
|
color = "black",
|
|
2872
2888
|
trackColor = "rgba(0, 0, 0, 0.1)",
|
|
2873
2889
|
className
|
|
2874
2890
|
}) {
|
|
2875
|
-
const opacityStyle =
|
|
2876
|
-
const dynamicStyles =
|
|
2891
|
+
const opacityStyle = React29.useMemo(() => ({ opacity }), [opacity]);
|
|
2892
|
+
const dynamicStyles = React29.useMemo(
|
|
2877
2893
|
() => ({
|
|
2878
2894
|
border: `2px solid ${trackColor}`,
|
|
2879
2895
|
borderTopColor: color,
|
|
@@ -2882,13 +2898,13 @@ var ActivityIndicator = React28.memo(function ActivityIndicator2({
|
|
|
2882
2898
|
}),
|
|
2883
2899
|
[size2, color, trackColor]
|
|
2884
2900
|
);
|
|
2885
|
-
return /* @__PURE__ */
|
|
2901
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2886
2902
|
"div",
|
|
2887
2903
|
{
|
|
2888
2904
|
className: cx("flex justify-center items-center", className),
|
|
2889
2905
|
style: opacityStyle
|
|
2890
2906
|
},
|
|
2891
|
-
/* @__PURE__ */
|
|
2907
|
+
/* @__PURE__ */ React29.createElement("div", { style: dynamicStyles, className: "animate-spin rounded-[50%]" })
|
|
2892
2908
|
);
|
|
2893
2909
|
});
|
|
2894
2910
|
|
|
@@ -3534,16 +3550,16 @@ var BreadcrumbSlash = () => {
|
|
|
3534
3550
|
};
|
|
3535
3551
|
|
|
3536
3552
|
// src/components/Checkbox.tsx
|
|
3537
|
-
var
|
|
3553
|
+
var React37 = __toESM(require("react"));
|
|
3538
3554
|
var colorSchemeStyles = {
|
|
3539
3555
|
normal: "text-text-subtle",
|
|
3540
3556
|
primary: "text-primary",
|
|
3541
3557
|
secondary: "text-secondary"
|
|
3542
3558
|
};
|
|
3543
|
-
var Checkbox =
|
|
3544
|
-
|
|
3559
|
+
var Checkbox = React37.memo(
|
|
3560
|
+
React37.forwardRef(function Checkbox2({ className, style: style2, colorScheme = "secondary", ...props }, ref) {
|
|
3545
3561
|
const { fieldId: id } = useLabel({ fieldId: props.id });
|
|
3546
|
-
return /* @__PURE__ */
|
|
3562
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3547
3563
|
"div",
|
|
3548
3564
|
{
|
|
3549
3565
|
className: cx(
|
|
@@ -3553,7 +3569,7 @@ var Checkbox = React36.memo(
|
|
|
3553
3569
|
),
|
|
3554
3570
|
style: style2
|
|
3555
3571
|
},
|
|
3556
|
-
/* @__PURE__ */
|
|
3572
|
+
/* @__PURE__ */ React37.createElement(
|
|
3557
3573
|
"input",
|
|
3558
3574
|
{
|
|
3559
3575
|
ref,
|
|
@@ -3582,7 +3598,7 @@ var Checkbox = React36.memo(
|
|
|
3582
3598
|
id
|
|
3583
3599
|
}
|
|
3584
3600
|
),
|
|
3585
|
-
/* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ React37.createElement(
|
|
3586
3602
|
"svg",
|
|
3587
3603
|
{
|
|
3588
3604
|
className: `
|
|
@@ -3602,7 +3618,7 @@ var Checkbox = React36.memo(
|
|
|
3602
3618
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3603
3619
|
"aria-hidden": "true"
|
|
3604
3620
|
},
|
|
3605
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ React37.createElement(
|
|
3606
3622
|
"path",
|
|
3607
3623
|
{
|
|
3608
3624
|
d: "M3 6L4.5 7.5L8 4",
|
|
@@ -3621,7 +3637,7 @@ var import_noya_icons3 = require("@noya-app/noya-icons");
|
|
|
3621
3637
|
var import_react45 = __toESM(require("react"));
|
|
3622
3638
|
|
|
3623
3639
|
// src/hooks/useHover.ts
|
|
3624
|
-
var
|
|
3640
|
+
var React38 = __toESM(require("react"));
|
|
3625
3641
|
var globalIgnoreEmulatedMouseEvents = false;
|
|
3626
3642
|
var hoverCount = 0;
|
|
3627
3643
|
function setGlobalIgnoreEmulatedMouseEvents() {
|
|
@@ -3651,13 +3667,13 @@ function setupGlobalTouchEvents() {
|
|
|
3651
3667
|
}
|
|
3652
3668
|
function useHover(props = {}) {
|
|
3653
3669
|
const { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
|
|
3654
|
-
const [isHovered, setHovered] =
|
|
3655
|
-
const state =
|
|
3670
|
+
const [isHovered, setHovered] = React38.useState(false);
|
|
3671
|
+
const state = React38.useRef({
|
|
3656
3672
|
isHovered: false,
|
|
3657
3673
|
ignoreEmulatedMouseEvents: false
|
|
3658
3674
|
}).current;
|
|
3659
|
-
|
|
3660
|
-
const hoverProps =
|
|
3675
|
+
React38.useEffect(setupGlobalTouchEvents, []);
|
|
3676
|
+
const hoverProps = React38.useMemo(
|
|
3661
3677
|
function getHoverProps() {
|
|
3662
3678
|
function triggerHoverStart(event, pointerType) {
|
|
3663
3679
|
if (isDisabled || pointerType === "touch" || state.isHovered) {
|
|
@@ -4056,26 +4072,26 @@ var ContextMenu = memoGeneric(ContextMenuRoot);
|
|
|
4056
4072
|
|
|
4057
4073
|
// src/components/ScrollArea.tsx
|
|
4058
4074
|
var RadixScrollArea = __toESM(require("@radix-ui/react-scroll-area"));
|
|
4059
|
-
var
|
|
4060
|
-
var ScrollArea =
|
|
4061
|
-
const [scrollElementRef, setScrollElementRef] =
|
|
4062
|
-
return /* @__PURE__ */
|
|
4075
|
+
var React42 = __toESM(require("react"));
|
|
4076
|
+
var ScrollArea = React42.memo(function ScrollArea2({ children }) {
|
|
4077
|
+
const [scrollElementRef, setScrollElementRef] = React42.useState(null);
|
|
4078
|
+
return /* @__PURE__ */ React42.createElement("div", { className: "flex-1 min-h-0" }, /* @__PURE__ */ React42.createElement(RadixScrollArea.Root, { style: { width: "100%", height: "100%" } }, /* @__PURE__ */ React42.createElement(
|
|
4063
4079
|
RadixScrollArea.Viewport,
|
|
4064
4080
|
{
|
|
4065
4081
|
className: "w-full h-full [&>div]:block",
|
|
4066
|
-
ref:
|
|
4082
|
+
ref: React42.useCallback(
|
|
4067
4083
|
(ref) => setScrollElementRef(ref),
|
|
4068
4084
|
[]
|
|
4069
4085
|
)
|
|
4070
4086
|
},
|
|
4071
4087
|
typeof children === "function" ? scrollElementRef ? children(scrollElementRef) : null : children
|
|
4072
|
-
), /* @__PURE__ */
|
|
4088
|
+
), /* @__PURE__ */ React42.createElement(
|
|
4073
4089
|
RadixScrollArea.Scrollbar,
|
|
4074
4090
|
{
|
|
4075
4091
|
orientation: "vertical",
|
|
4076
4092
|
className: "scroll-component flex p-[3px] data-[orientation=vertical]:w-[10px]"
|
|
4077
4093
|
},
|
|
4078
|
-
/* @__PURE__ */
|
|
4094
|
+
/* @__PURE__ */ React42.createElement(RadixScrollArea.Thumb, { className: "scroll-component flex-1 rounded-[10px] bg-scrollbar" })
|
|
4079
4095
|
)));
|
|
4080
4096
|
});
|
|
4081
4097
|
|
|
@@ -4572,7 +4588,7 @@ var Grid = memoGeneric(
|
|
|
4572
4588
|
var import_react54 = __toESM(require("react"));
|
|
4573
4589
|
|
|
4574
4590
|
// src/components/ListView.tsx
|
|
4575
|
-
var
|
|
4591
|
+
var import_noya_utils9 = require("@noya-app/noya-utils");
|
|
4576
4592
|
var import_react_compose_refs2 = require("@radix-ui/react-compose-refs");
|
|
4577
4593
|
var import_react52 = __toESM(require("react"));
|
|
4578
4594
|
var import_react_virtualized = require("react-virtualized");
|
|
@@ -4604,7 +4620,7 @@ function mergeEventHandlers(...handlerMaps) {
|
|
|
4604
4620
|
// src/components/sorting/Sortable.tsx
|
|
4605
4621
|
var import_core2 = require("@dnd-kit/core");
|
|
4606
4622
|
var import_sortable = require("@dnd-kit/sortable");
|
|
4607
|
-
var
|
|
4623
|
+
var React48 = __toESM(require("react"));
|
|
4608
4624
|
|
|
4609
4625
|
// src/components/sorting/DragRegistration.tsx
|
|
4610
4626
|
var import_react50 = __toESM(require("react"));
|
|
@@ -4644,11 +4660,14 @@ var AnyDragContext = import_react50.default.createContext(false);
|
|
|
4644
4660
|
|
|
4645
4661
|
// src/components/sorting/SharedDragProvider.tsx
|
|
4646
4662
|
var import_core = require("@dnd-kit/core");
|
|
4647
|
-
var
|
|
4663
|
+
var import_noya_geometry = require("@noya-app/noya-geometry");
|
|
4664
|
+
var import_noya_utils8 = require("@noya-app/noya-utils");
|
|
4665
|
+
var React46 = __toESM(require("react"));
|
|
4648
4666
|
var import_react51 = require("react");
|
|
4649
4667
|
var import_react_dom2 = require("react-dom");
|
|
4650
4668
|
function SharedDragProvider({
|
|
4651
4669
|
children,
|
|
4670
|
+
onMoveItem,
|
|
4652
4671
|
sharedDragProps = {
|
|
4653
4672
|
dragRegistrationContext: DragRegistrationContext,
|
|
4654
4673
|
activeDragContext: ActiveDragContext
|
|
@@ -4662,14 +4681,14 @@ function SharedDragProvider({
|
|
|
4662
4681
|
})
|
|
4663
4682
|
);
|
|
4664
4683
|
const mounted = useMounted();
|
|
4665
|
-
const [dragState, setDragState] =
|
|
4684
|
+
const [dragState, setDragState] = React46.useState({
|
|
4666
4685
|
source: null,
|
|
4667
4686
|
target: null,
|
|
4668
4687
|
indicator: null
|
|
4669
4688
|
});
|
|
4670
4689
|
const { registerList, unregisterList, registeredLists } = useDragRegistrationManager();
|
|
4671
|
-
const activatorEventRef =
|
|
4672
|
-
const handleDragStart =
|
|
4690
|
+
const activatorEventRef = React46.useRef(null);
|
|
4691
|
+
const handleDragStart = React46.useCallback(
|
|
4673
4692
|
(event) => {
|
|
4674
4693
|
activatorEventRef.current = event.activatorEvent;
|
|
4675
4694
|
for (const [listId, list] of registeredLists) {
|
|
@@ -4691,7 +4710,7 @@ function SharedDragProvider({
|
|
|
4691
4710
|
},
|
|
4692
4711
|
[registeredLists]
|
|
4693
4712
|
);
|
|
4694
|
-
const handleDragMove =
|
|
4713
|
+
const handleDragMove = React46.useCallback(
|
|
4695
4714
|
(event) => {
|
|
4696
4715
|
const { active, over } = event;
|
|
4697
4716
|
if (!activatorEventRef.current || !dragState.source) return;
|
|
@@ -4714,7 +4733,8 @@ function SharedDragProvider({
|
|
|
4714
4733
|
},
|
|
4715
4734
|
[registeredLists, dragState.source]
|
|
4716
4735
|
);
|
|
4717
|
-
const
|
|
4736
|
+
const stableOnMoveItem = useStableCallback(onMoveItem);
|
|
4737
|
+
const handleDragEnd = React46.useCallback(
|
|
4718
4738
|
(event) => {
|
|
4719
4739
|
const { active, over } = event;
|
|
4720
4740
|
if (!activatorEventRef.current || !dragState.source) return;
|
|
@@ -4739,17 +4759,22 @@ function SharedDragProvider({
|
|
|
4739
4759
|
const sourceList = registeredLists.get(dropTarget.source.listId);
|
|
4740
4760
|
const targetList = registeredLists.get(dropTarget.target.listId);
|
|
4741
4761
|
if (!sourceList || !targetList) return;
|
|
4742
|
-
|
|
4743
|
-
dropTarget.source.index,
|
|
4744
|
-
dropTarget.target.index,
|
|
4745
|
-
dropTarget.indicator,
|
|
4746
|
-
dropTarget.source.listId,
|
|
4747
|
-
dropTarget.target.listId
|
|
4748
|
-
|
|
4762
|
+
const parameters = {
|
|
4763
|
+
sourceIndex: dropTarget.source.index,
|
|
4764
|
+
targetIndex: dropTarget.target.index,
|
|
4765
|
+
position: dropTarget.indicator,
|
|
4766
|
+
sourceListId: dropTarget.source.listId,
|
|
4767
|
+
targetListId: dropTarget.target.listId
|
|
4768
|
+
};
|
|
4769
|
+
sourceList.onMoveItem(parameters);
|
|
4770
|
+
if (dropTarget.target.listId !== dropTarget.source.listId) {
|
|
4771
|
+
targetList.onMoveItem(parameters);
|
|
4772
|
+
}
|
|
4773
|
+
stableOnMoveItem?.(parameters);
|
|
4749
4774
|
},
|
|
4750
|
-
[registeredLists, dragState.source]
|
|
4775
|
+
[registeredLists, dragState.source, stableOnMoveItem]
|
|
4751
4776
|
);
|
|
4752
|
-
const contextValue =
|
|
4777
|
+
const contextValue = React46.useMemo(
|
|
4753
4778
|
() => ({
|
|
4754
4779
|
registerList,
|
|
4755
4780
|
unregisterList
|
|
@@ -4757,19 +4782,19 @@ function SharedDragProvider({
|
|
|
4757
4782
|
[registerList, unregisterList]
|
|
4758
4783
|
);
|
|
4759
4784
|
const activeList = dragState.source ? registeredLists.get(dragState.source.listId) : null;
|
|
4760
|
-
const activeDragContextValue =
|
|
4785
|
+
const activeDragContextValue = React46.useMemo(
|
|
4761
4786
|
() => dragState,
|
|
4762
4787
|
[dragState]
|
|
4763
4788
|
);
|
|
4764
4789
|
const collisionDetection = (0, import_react51.useMemo)(() => {
|
|
4765
|
-
return getItemFirstCollisionDetection(
|
|
4790
|
+
return getItemFirstCollisionDetection(registeredLists);
|
|
4766
4791
|
}, [registeredLists]);
|
|
4767
|
-
return /* @__PURE__ */
|
|
4792
|
+
return /* @__PURE__ */ React46.createElement(AnyDragContext.Provider, { value: true }, /* @__PURE__ */ React46.createElement(sharedDragProps.dragRegistrationContext.Provider, { value: contextValue }, /* @__PURE__ */ React46.createElement(
|
|
4768
4793
|
sharedDragProps.activeDragContext.Provider,
|
|
4769
4794
|
{
|
|
4770
4795
|
value: activeDragContextValue
|
|
4771
4796
|
},
|
|
4772
|
-
/* @__PURE__ */
|
|
4797
|
+
/* @__PURE__ */ React46.createElement(
|
|
4773
4798
|
import_core.DndContext,
|
|
4774
4799
|
{
|
|
4775
4800
|
sensors,
|
|
@@ -4780,33 +4805,33 @@ function SharedDragProvider({
|
|
|
4780
4805
|
},
|
|
4781
4806
|
children,
|
|
4782
4807
|
mounted && activeList?.renderOverlay && dragState.source && (0, import_react_dom2.createPortal)(
|
|
4783
|
-
/* @__PURE__ */
|
|
4808
|
+
/* @__PURE__ */ React46.createElement(import_core.DragOverlay, { dropAnimation: null }, activeList.renderOverlay(dragState.source.itemId)),
|
|
4784
4809
|
document.body
|
|
4785
4810
|
)
|
|
4786
4811
|
)
|
|
4787
4812
|
)));
|
|
4788
4813
|
}
|
|
4789
4814
|
function useMounted() {
|
|
4790
|
-
const [mounted, setMounted] =
|
|
4791
|
-
|
|
4815
|
+
const [mounted, setMounted] = React46.useState(false);
|
|
4816
|
+
React46.useEffect(() => {
|
|
4792
4817
|
setMounted(true);
|
|
4793
4818
|
}, []);
|
|
4794
4819
|
return mounted;
|
|
4795
4820
|
}
|
|
4796
4821
|
function withDragProvider(Component) {
|
|
4797
4822
|
return function WithDragProvider(props) {
|
|
4798
|
-
const anyDragContext =
|
|
4823
|
+
const anyDragContext = React46.useContext(AnyDragContext);
|
|
4799
4824
|
if (!anyDragContext) {
|
|
4800
|
-
return /* @__PURE__ */
|
|
4825
|
+
return /* @__PURE__ */ React46.createElement(SharedDragProvider, null, /* @__PURE__ */ React46.createElement(Component, { ...props }));
|
|
4801
4826
|
}
|
|
4802
|
-
return /* @__PURE__ */
|
|
4827
|
+
return /* @__PURE__ */ React46.createElement(Component, { ...props });
|
|
4803
4828
|
};
|
|
4804
4829
|
}
|
|
4805
|
-
var getItemFirstCollisionDetection = (
|
|
4830
|
+
var getItemFirstCollisionDetection = (registeredLists) => (parameters) => {
|
|
4806
4831
|
const pointerCollisions = (0, import_core.pointerWithin)(parameters);
|
|
4807
4832
|
if (pointerCollisions.length > 0) {
|
|
4808
4833
|
const itemCollisions = pointerCollisions.filter((collision) => {
|
|
4809
|
-
for (const listId of
|
|
4834
|
+
for (const listId of registeredLists.keys()) {
|
|
4810
4835
|
if (collision.id === listId) {
|
|
4811
4836
|
return false;
|
|
4812
4837
|
}
|
|
@@ -4817,7 +4842,33 @@ var getItemFirstCollisionDetection = (registeredListIds) => (parameters) => {
|
|
|
4817
4842
|
return itemCollisions;
|
|
4818
4843
|
}
|
|
4819
4844
|
}
|
|
4820
|
-
|
|
4845
|
+
const listCollision = pointerCollisions.at(0);
|
|
4846
|
+
const nearestCenters = (0, import_core.closestCenter)(parameters);
|
|
4847
|
+
if (parameters.pointerCoordinates && listCollision) {
|
|
4848
|
+
const list = registeredLists.get(listCollision.id);
|
|
4849
|
+
if (list) {
|
|
4850
|
+
const pairs = (0, import_noya_utils8.windowsOf)(list.keys, 2);
|
|
4851
|
+
for (const pair of pairs) {
|
|
4852
|
+
const clientRects = pair.map(
|
|
4853
|
+
(key) => parameters.droppableRects.get(key)
|
|
4854
|
+
);
|
|
4855
|
+
const merged = (0, import_noya_geometry.unionRects)(
|
|
4856
|
+
...clientRects.map((rect) => ({
|
|
4857
|
+
x: rect.left,
|
|
4858
|
+
y: rect.top,
|
|
4859
|
+
width: rect.width,
|
|
4860
|
+
height: rect.height
|
|
4861
|
+
}))
|
|
4862
|
+
);
|
|
4863
|
+
if ((0, import_noya_geometry.rectContainsPoint)(merged, parameters.pointerCoordinates)) {
|
|
4864
|
+
return nearestCenters.filter(
|
|
4865
|
+
(center) => pair.some((id) => id === center.id)
|
|
4866
|
+
);
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
return pointerCollisions;
|
|
4821
4872
|
};
|
|
4822
4873
|
function findDropTarget({
|
|
4823
4874
|
activationPoint,
|
|
@@ -4852,14 +4903,14 @@ function findDropTarget({
|
|
|
4852
4903
|
return;
|
|
4853
4904
|
}
|
|
4854
4905
|
if (over.id === targetList.id) {
|
|
4855
|
-
const canDrop = targetList.acceptsDrop(
|
|
4856
|
-
source.index,
|
|
4857
|
-
Math.max(0, targetList.keys.length - 1),
|
|
4906
|
+
const canDrop = targetList.acceptsDrop({
|
|
4907
|
+
sourceIndex: source.index,
|
|
4908
|
+
targetIndex: Math.max(0, targetList.keys.length - 1),
|
|
4858
4909
|
// Use last valid index or 0 for empty lists
|
|
4859
|
-
"below",
|
|
4860
|
-
sourceList.id,
|
|
4861
|
-
targetList.id
|
|
4862
|
-
);
|
|
4910
|
+
position: "below",
|
|
4911
|
+
sourceListId: sourceList.id,
|
|
4912
|
+
targetListId: targetList.id
|
|
4913
|
+
});
|
|
4863
4914
|
if (canDrop) {
|
|
4864
4915
|
return {
|
|
4865
4916
|
source,
|
|
@@ -4898,11 +4949,15 @@ function findDropTarget({
|
|
|
4898
4949
|
}
|
|
4899
4950
|
|
|
4900
4951
|
// src/components/sorting/sorting.ts
|
|
4901
|
-
var
|
|
4952
|
+
var React47 = __toESM(require("react"));
|
|
4902
4953
|
var normalizeListTargetIndex = (index, position) => {
|
|
4903
4954
|
return position === "above" ? index : index + 1;
|
|
4904
4955
|
};
|
|
4905
|
-
var defaultAcceptsDrop = (
|
|
4956
|
+
var defaultAcceptsDrop = ({
|
|
4957
|
+
sourceIndex,
|
|
4958
|
+
targetIndex,
|
|
4959
|
+
position
|
|
4960
|
+
}) => {
|
|
4906
4961
|
if (position === "inside") return false;
|
|
4907
4962
|
const normalized = normalizeListTargetIndex(targetIndex, position);
|
|
4908
4963
|
if (sourceIndex === normalized || sourceIndex + 1 === normalized) {
|
|
@@ -4910,7 +4965,7 @@ var defaultAcceptsDrop = (sourceIndex, targetIndex, position) => {
|
|
|
4910
4965
|
}
|
|
4911
4966
|
return true;
|
|
4912
4967
|
};
|
|
4913
|
-
var SortableItemContext =
|
|
4968
|
+
var SortableItemContext = React47.createContext({
|
|
4914
4969
|
keys: [],
|
|
4915
4970
|
acceptsDrop: defaultAcceptsDrop,
|
|
4916
4971
|
axis: "y",
|
|
@@ -4935,13 +4990,13 @@ function validateDropIndicator({
|
|
|
4935
4990
|
const overIndex = keys.findIndex((id) => id === overId);
|
|
4936
4991
|
if (overIndex === -1) return void 0;
|
|
4937
4992
|
if (activeIndex === -1 && sourceListId === targetListId) return void 0;
|
|
4938
|
-
const acceptsDropInside = acceptsDrop2(
|
|
4939
|
-
activeIndex,
|
|
4940
|
-
overIndex,
|
|
4941
|
-
"inside",
|
|
4993
|
+
const acceptsDropInside = acceptsDrop2({
|
|
4994
|
+
sourceIndex: activeIndex,
|
|
4995
|
+
targetIndex: overIndex,
|
|
4996
|
+
position: "inside",
|
|
4942
4997
|
sourceListId,
|
|
4943
4998
|
targetListId
|
|
4944
|
-
);
|
|
4999
|
+
});
|
|
4945
5000
|
if (isContainedInMiddleThird(elementStart, elementSize, offsetStart) && acceptsDropInside) {
|
|
4946
5001
|
return "inside";
|
|
4947
5002
|
}
|
|
@@ -4950,16 +5005,13 @@ function validateDropIndicator({
|
|
|
4950
5005
|
elementSize,
|
|
4951
5006
|
offsetStart
|
|
4952
5007
|
);
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
activeIndex,
|
|
4958
|
-
overIndex,
|
|
4959
|
-
containingHalf,
|
|
5008
|
+
const acceptedHalf = acceptsDrop2({
|
|
5009
|
+
sourceIndex: activeIndex,
|
|
5010
|
+
targetIndex: overIndex,
|
|
5011
|
+
position: containingHalf,
|
|
4960
5012
|
sourceListId,
|
|
4961
5013
|
targetListId
|
|
4962
|
-
);
|
|
5014
|
+
});
|
|
4963
5015
|
return acceptedHalf ? containingHalf : (
|
|
4964
5016
|
// Lastly, check if inside but not middle third
|
|
4965
5017
|
acceptsDropInside ? "inside" : void 0
|
|
@@ -4968,23 +5020,21 @@ function validateDropIndicator({
|
|
|
4968
5020
|
function isContainedInMiddleThird(elementStart, elementSize, offsetStart) {
|
|
4969
5021
|
return offsetStart >= elementStart + elementSize / 3 && offsetStart <= elementStart + elementSize * 2 / 3;
|
|
4970
5022
|
}
|
|
4971
|
-
function isContained(elementStart, elementSize, offsetStart) {
|
|
4972
|
-
return offsetStart >= elementStart && offsetStart <= elementStart + elementSize;
|
|
4973
|
-
}
|
|
4974
5023
|
function getContainingHalf(elementStart, elementSize, offsetStart) {
|
|
4975
5024
|
if (offsetStart < elementStart + elementSize / 2) return "above";
|
|
4976
5025
|
return "below";
|
|
4977
5026
|
}
|
|
5027
|
+
var dragItemKeySeparator = "-~-";
|
|
4978
5028
|
function createDragItemKey(listId, itemId) {
|
|
4979
|
-
return `${listId}
|
|
5029
|
+
return `${listId}${dragItemKeySeparator}${itemId}`;
|
|
4980
5030
|
}
|
|
4981
5031
|
function parseDragItemKey(key) {
|
|
4982
|
-
const [listId, itemId] = key.split(
|
|
5032
|
+
const [listId, itemId] = key.split(dragItemKeySeparator);
|
|
4983
5033
|
return { listId, itemId };
|
|
4984
5034
|
}
|
|
4985
5035
|
|
|
4986
5036
|
// src/components/sorting/Sortable.tsx
|
|
4987
|
-
var SortableItemContext2 =
|
|
5037
|
+
var SortableItemContext2 = React48.createContext({
|
|
4988
5038
|
acceptsDrop: defaultAcceptsDrop,
|
|
4989
5039
|
listId: "",
|
|
4990
5040
|
getDropTargetParentIndex: void 0,
|
|
@@ -4997,42 +5047,44 @@ function useSortableDropIndicator({
|
|
|
4997
5047
|
acceptsDrop: acceptsDrop2,
|
|
4998
5048
|
getDropTargetParentIndex
|
|
4999
5049
|
}) {
|
|
5000
|
-
const { activeDragContext } =
|
|
5050
|
+
const { activeDragContext } = React48.useContext(SortableItemContext2);
|
|
5001
5051
|
const activeDrag = useActiveDrag(activeDragContext);
|
|
5002
5052
|
const { source, target } = activeDrag;
|
|
5003
5053
|
if (!source || !target) return;
|
|
5004
|
-
|
|
5054
|
+
if (target.listId === listId && target.itemId === itemId) {
|
|
5055
|
+
return activeDrag.indicator ?? void 0;
|
|
5056
|
+
}
|
|
5005
5057
|
const targetParentIndex = target.index === -1 ? void 0 : getDropTargetParentIndex?.(target.index);
|
|
5006
|
-
const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2(
|
|
5007
|
-
source.index,
|
|
5008
|
-
targetParentIndex,
|
|
5009
|
-
"inside",
|
|
5010
|
-
source.listId,
|
|
5011
|
-
target.listId
|
|
5012
|
-
);
|
|
5013
|
-
const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2(
|
|
5014
|
-
source.index,
|
|
5015
|
-
target.index,
|
|
5016
|
-
"inside",
|
|
5017
|
-
source.listId,
|
|
5018
|
-
target.listId
|
|
5019
|
-
);
|
|
5058
|
+
const isValidParent = targetParentIndex === void 0 || targetParentIndex === -1 ? false : acceptsDrop2({
|
|
5059
|
+
sourceIndex: source.index,
|
|
5060
|
+
targetIndex: targetParentIndex,
|
|
5061
|
+
position: "inside",
|
|
5062
|
+
sourceListId: source.listId,
|
|
5063
|
+
targetListId: target.listId
|
|
5064
|
+
});
|
|
5065
|
+
const overIdAcceptsDrop = target.index === -1 ? void 0 : acceptsDrop2({
|
|
5066
|
+
sourceIndex: source.index,
|
|
5067
|
+
targetIndex: target.index,
|
|
5068
|
+
position: "inside",
|
|
5069
|
+
sourceListId: source.listId,
|
|
5070
|
+
targetListId: target.listId
|
|
5071
|
+
});
|
|
5020
5072
|
const thisItemIsTargetParent = targetParentIndex === index;
|
|
5021
|
-
const
|
|
5022
|
-
return
|
|
5073
|
+
const showIndicatorOnParent = !overIdAcceptsDrop && isValidParent && thisItemIsTargetParent;
|
|
5074
|
+
return showIndicatorOnParent ? "inside" : void 0;
|
|
5023
5075
|
}
|
|
5024
5076
|
function SortableItem({
|
|
5025
5077
|
id,
|
|
5026
5078
|
disabled,
|
|
5027
5079
|
children
|
|
5028
5080
|
}) {
|
|
5029
|
-
const { acceptsDrop: acceptsDrop2, listId, getDropTargetParentIndex } =
|
|
5081
|
+
const { acceptsDrop: acceptsDrop2, listId, getDropTargetParentIndex } = React48.useContext(SortableItemContext2);
|
|
5030
5082
|
const dragItemKey = createDragItemKey(listId, id);
|
|
5031
5083
|
const { attributes, listeners, setNodeRef, isDragging, index } = (0, import_sortable.useSortable)({
|
|
5032
5084
|
id: dragItemKey,
|
|
5033
5085
|
disabled
|
|
5034
5086
|
});
|
|
5035
|
-
const ref =
|
|
5087
|
+
const ref = React48.useCallback(
|
|
5036
5088
|
(node) => setNodeRef(node),
|
|
5037
5089
|
[setNodeRef]
|
|
5038
5090
|
);
|
|
@@ -5066,24 +5118,18 @@ function SortableRoot_({
|
|
|
5066
5118
|
sharedDragProps,
|
|
5067
5119
|
containerRef
|
|
5068
5120
|
}) {
|
|
5069
|
-
const defaultId =
|
|
5121
|
+
const defaultId = React48.useId();
|
|
5070
5122
|
const id = idProp ?? defaultId;
|
|
5071
|
-
const keys =
|
|
5123
|
+
const keys = React48.useMemo(() => {
|
|
5072
5124
|
return keysProp.map((key) => createDragItemKey(id, key));
|
|
5073
5125
|
}, [keysProp, id]);
|
|
5074
5126
|
const { registerList, unregisterList } = useDragRegistration(
|
|
5075
5127
|
sharedDragProps?.dragRegistrationContext ?? DragRegistrationContext
|
|
5076
5128
|
);
|
|
5077
5129
|
const { setNodeRef: setDroppableRef } = (0, import_core2.useDroppable)({
|
|
5078
|
-
id
|
|
5079
|
-
// Make the container droppable only when the list is empty
|
|
5080
|
-
// This avoids conflicts with individual sortable items.
|
|
5081
|
-
// This isn't strictly necessary since we also use a custom collision detection
|
|
5082
|
-
// that prioritizes items over containers, but it helps with dropping into
|
|
5083
|
-
// the best position (either above or below, rather than always below).
|
|
5084
|
-
disabled: keys.length > 0
|
|
5130
|
+
id
|
|
5085
5131
|
});
|
|
5086
|
-
|
|
5132
|
+
React48.useEffect(() => {
|
|
5087
5133
|
const listConfig = {
|
|
5088
5134
|
id,
|
|
5089
5135
|
keys,
|
|
@@ -5129,7 +5175,7 @@ function SortableRoot_({
|
|
|
5129
5175
|
unregisterList,
|
|
5130
5176
|
keys
|
|
5131
5177
|
]);
|
|
5132
|
-
const contextValue =
|
|
5178
|
+
const contextValue = React48.useMemo(
|
|
5133
5179
|
() => ({
|
|
5134
5180
|
keys,
|
|
5135
5181
|
acceptsDrop: acceptsDrop2,
|
|
@@ -5139,12 +5185,12 @@ function SortableRoot_({
|
|
|
5139
5185
|
}),
|
|
5140
5186
|
[keys, acceptsDrop2, id, getDropTargetParentIndex, sharedDragProps]
|
|
5141
5187
|
);
|
|
5142
|
-
|
|
5188
|
+
React48.useEffect(() => {
|
|
5143
5189
|
if (containerRef) {
|
|
5144
5190
|
setDroppableRef(containerRef.current);
|
|
5145
5191
|
}
|
|
5146
5192
|
});
|
|
5147
|
-
return /* @__PURE__ */
|
|
5193
|
+
return /* @__PURE__ */ React48.createElement(SortableItemContext2.Provider, { value: contextValue }, /* @__PURE__ */ React48.createElement(
|
|
5148
5194
|
import_sortable.SortableContext,
|
|
5149
5195
|
{
|
|
5150
5196
|
items: keys,
|
|
@@ -5161,11 +5207,11 @@ var Sortable_ = function Sortable_2({
|
|
|
5161
5207
|
renderItem,
|
|
5162
5208
|
...rest
|
|
5163
5209
|
}) {
|
|
5164
|
-
const keys =
|
|
5210
|
+
const keys = React48.useMemo(
|
|
5165
5211
|
() => items.map(keyExtractor),
|
|
5166
5212
|
[items, keyExtractor]
|
|
5167
5213
|
);
|
|
5168
|
-
const renderOverlay =
|
|
5214
|
+
const renderOverlay = React48.useCallback(
|
|
5169
5215
|
(index) => {
|
|
5170
5216
|
return renderItem(
|
|
5171
5217
|
items[index],
|
|
@@ -5185,14 +5231,14 @@ var Sortable_ = function Sortable_2({
|
|
|
5185
5231
|
},
|
|
5186
5232
|
[renderItem, items]
|
|
5187
5233
|
);
|
|
5188
|
-
return /* @__PURE__ */
|
|
5234
|
+
return /* @__PURE__ */ React48.createElement(
|
|
5189
5235
|
SortableRoot,
|
|
5190
5236
|
{
|
|
5191
5237
|
...rest,
|
|
5192
5238
|
keys,
|
|
5193
5239
|
renderOverlay: shouldRenderOverlay ? renderOverlay : void 0
|
|
5194
5240
|
},
|
|
5195
|
-
keys.map((key, index) => /* @__PURE__ */
|
|
5241
|
+
keys.map((key, index) => /* @__PURE__ */ React48.createElement(SortableItem, { key, id: key }, (props) => {
|
|
5196
5242
|
return renderItem(items[index], props, { isOverlay: false });
|
|
5197
5243
|
}))
|
|
5198
5244
|
);
|
|
@@ -5852,7 +5898,7 @@ var ListViewRootInner = forwardRefGeneric(function ListViewRootInner2({
|
|
|
5852
5898
|
keyExtractor: getKey,
|
|
5853
5899
|
renderItem: renderWrappedChild
|
|
5854
5900
|
}
|
|
5855
|
-
) : (0,
|
|
5901
|
+
) : (0, import_noya_utils9.range)(0, data.length).map(renderWrappedChild)
|
|
5856
5902
|
)
|
|
5857
5903
|
)
|
|
5858
5904
|
));
|
|
@@ -6336,7 +6382,7 @@ var import_noya_icons5 = require("@noya-app/noya-icons");
|
|
|
6336
6382
|
var import_react60 = __toESM(require("react"));
|
|
6337
6383
|
|
|
6338
6384
|
// src/utils/combobox.ts
|
|
6339
|
-
var
|
|
6385
|
+
var import_noya_utils10 = require("@noya-app/noya-utils");
|
|
6340
6386
|
var import_react58 = require("react");
|
|
6341
6387
|
|
|
6342
6388
|
// src/utils/fuzzyScorer.ts
|
|
@@ -6589,7 +6635,7 @@ var ComboboxState = class {
|
|
|
6589
6635
|
}
|
|
6590
6636
|
};
|
|
6591
6637
|
function filterWithGroupedSections(items, query) {
|
|
6592
|
-
const sections = (0,
|
|
6638
|
+
const sections = (0, import_noya_utils10.chunkBy)(items, (_a, b) => isSelectableMenuItem(b));
|
|
6593
6639
|
let result = [];
|
|
6594
6640
|
let currentIndex = 0;
|
|
6595
6641
|
const createExtraItem = (item, index) => ({
|
|
@@ -6606,7 +6652,7 @@ function filterWithGroupedSections(items, query) {
|
|
|
6606
6652
|
};
|
|
6607
6653
|
};
|
|
6608
6654
|
for (const section of sections) {
|
|
6609
|
-
const [sectionHeaders, selectableItems] = (0,
|
|
6655
|
+
const [sectionHeaders, selectableItems] = (0, import_noya_utils10.partition)(
|
|
6610
6656
|
section.filter(
|
|
6611
6657
|
(item) => item.type !== "submenu" && item.type !== "separator"
|
|
6612
6658
|
),
|
|
@@ -7522,10 +7568,10 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
7522
7568
|
|
|
7523
7569
|
// src/components/Drawer.tsx
|
|
7524
7570
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
7525
|
-
var
|
|
7571
|
+
var React62 = __toESM(require("react"));
|
|
7526
7572
|
var import_react66 = require("react");
|
|
7527
|
-
var Drawer =
|
|
7528
|
-
|
|
7573
|
+
var Drawer = React62.memo(
|
|
7574
|
+
React62.forwardRef(function Drawer2({
|
|
7529
7575
|
open,
|
|
7530
7576
|
onOpenChange,
|
|
7531
7577
|
trigger,
|
|
@@ -7555,7 +7601,7 @@ var Drawer = React61.memo(
|
|
|
7555
7601
|
return internalOpen;
|
|
7556
7602
|
}
|
|
7557
7603
|
}));
|
|
7558
|
-
const inner = /* @__PURE__ */
|
|
7604
|
+
const inner = /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
|
|
7559
7605
|
Dialog3.Overlay,
|
|
7560
7606
|
{
|
|
7561
7607
|
className: cx(
|
|
@@ -7563,7 +7609,7 @@ var Drawer = React61.memo(
|
|
|
7563
7609
|
positioning === "absolute" ? "absolute" : "fixed"
|
|
7564
7610
|
)
|
|
7565
7611
|
}
|
|
7566
|
-
), /* @__PURE__ */
|
|
7612
|
+
), /* @__PURE__ */ React62.createElement(
|
|
7567
7613
|
Dialog3.Content,
|
|
7568
7614
|
{
|
|
7569
7615
|
id,
|
|
@@ -7575,18 +7621,18 @@ var Drawer = React61.memo(
|
|
|
7575
7621
|
className
|
|
7576
7622
|
)
|
|
7577
7623
|
},
|
|
7578
|
-
title && /* @__PURE__ */
|
|
7624
|
+
title && /* @__PURE__ */ React62.createElement(Dialog3.Title, null, title),
|
|
7579
7625
|
children
|
|
7580
7626
|
));
|
|
7581
|
-
return /* @__PURE__ */
|
|
7627
|
+
return /* @__PURE__ */ React62.createElement(
|
|
7582
7628
|
Dialog3.Root,
|
|
7583
7629
|
{
|
|
7584
7630
|
key: "dialog",
|
|
7585
7631
|
open: internalOpen,
|
|
7586
7632
|
onOpenChange: setInternalOpen
|
|
7587
7633
|
},
|
|
7588
|
-
/* @__PURE__ */
|
|
7589
|
-
portalled ? /* @__PURE__ */
|
|
7634
|
+
/* @__PURE__ */ React62.createElement(Dialog3.Trigger, { key: "trigger" }, trigger),
|
|
7635
|
+
portalled ? /* @__PURE__ */ React62.createElement(Dialog3.Portal, { container: portalContainer }, inner) : inner
|
|
7590
7636
|
);
|
|
7591
7637
|
})
|
|
7592
7638
|
);
|
|
@@ -8002,25 +8048,25 @@ var ClassValue = /* @__PURE__ */ ((ClassValue2) => {
|
|
|
8002
8048
|
})(ClassValue || {});
|
|
8003
8049
|
|
|
8004
8050
|
// src/components/FillPreviewBackground.tsx
|
|
8005
|
-
var
|
|
8051
|
+
var React66 = __toESM(require("react"));
|
|
8006
8052
|
|
|
8007
8053
|
// src/contexts/ImageDataContext.tsx
|
|
8008
|
-
var
|
|
8009
|
-
var ImageDataContext =
|
|
8054
|
+
var React65 = __toESM(require("react"));
|
|
8055
|
+
var ImageDataContext = React65.createContext(
|
|
8010
8056
|
void 0
|
|
8011
8057
|
);
|
|
8012
|
-
var ImageDataProvider =
|
|
8058
|
+
var ImageDataProvider = React65.memo(function ImageDataProvider2({
|
|
8013
8059
|
children,
|
|
8014
8060
|
getImageData
|
|
8015
8061
|
}) {
|
|
8016
|
-
const contextValue =
|
|
8062
|
+
const contextValue = React65.useMemo(
|
|
8017
8063
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
8018
8064
|
[getImageData]
|
|
8019
8065
|
);
|
|
8020
|
-
return /* @__PURE__ */
|
|
8066
|
+
return /* @__PURE__ */ React65.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
8021
8067
|
});
|
|
8022
8068
|
function useImageData(ref) {
|
|
8023
|
-
const value =
|
|
8069
|
+
const value = React65.useContext(ImageDataContext);
|
|
8024
8070
|
if (!value) {
|
|
8025
8071
|
throw new Error("Missing ImageDataProvider");
|
|
8026
8072
|
}
|
|
@@ -8086,10 +8132,10 @@ var dotsHorizontalSvg = (fillColor) => `
|
|
|
8086
8132
|
<path d='M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z'></path>
|
|
8087
8133
|
</svg>
|
|
8088
8134
|
`;
|
|
8089
|
-
var Background =
|
|
8135
|
+
var Background = React66.memo(function Background2({
|
|
8090
8136
|
background: background2
|
|
8091
8137
|
}) {
|
|
8092
|
-
return /* @__PURE__ */
|
|
8138
|
+
return /* @__PURE__ */ React66.createElement(
|
|
8093
8139
|
"span",
|
|
8094
8140
|
{
|
|
8095
8141
|
className: `${background2 ? `bg-[${background2}]` : "bg-input-background"} absolute inset-0`
|
|
@@ -8108,7 +8154,7 @@ function getPatternSizeAndPosition(fillType, tileScale) {
|
|
|
8108
8154
|
return "center / 100% 100%";
|
|
8109
8155
|
}
|
|
8110
8156
|
}
|
|
8111
|
-
var PatternPreviewBackground =
|
|
8157
|
+
var PatternPreviewBackground = React66.memo(
|
|
8112
8158
|
function PatternPreviewBackground2({
|
|
8113
8159
|
fillType,
|
|
8114
8160
|
tileScale,
|
|
@@ -8117,7 +8163,7 @@ var PatternPreviewBackground = React65.memo(
|
|
|
8117
8163
|
const image = useImageData(imageRef);
|
|
8118
8164
|
const url = useObjectURL(image);
|
|
8119
8165
|
const size2 = getPatternSizeAndPosition(fillType, tileScale);
|
|
8120
|
-
const background2 =
|
|
8166
|
+
const background2 = React66.useMemo(
|
|
8121
8167
|
() => [
|
|
8122
8168
|
size2,
|
|
8123
8169
|
`url(${url})`,
|
|
@@ -8125,44 +8171,44 @@ var PatternPreviewBackground = React65.memo(
|
|
|
8125
8171
|
].join(" "),
|
|
8126
8172
|
[fillType, size2, url]
|
|
8127
8173
|
);
|
|
8128
|
-
return /* @__PURE__ */
|
|
8174
|
+
return /* @__PURE__ */ React66.createElement(Background, { background: background2 });
|
|
8129
8175
|
}
|
|
8130
8176
|
);
|
|
8131
|
-
var ColorPreviewBackground =
|
|
8177
|
+
var ColorPreviewBackground = React66.memo(function ColorPreviewBackground2({
|
|
8132
8178
|
color
|
|
8133
8179
|
}) {
|
|
8134
|
-
const background2 =
|
|
8180
|
+
const background2 = React66.useMemo(
|
|
8135
8181
|
() => sketchColorToRgbaString(color),
|
|
8136
8182
|
[color]
|
|
8137
8183
|
);
|
|
8138
|
-
return /* @__PURE__ */
|
|
8184
|
+
return /* @__PURE__ */ React66.createElement(Background, { background: background2 });
|
|
8139
8185
|
});
|
|
8140
|
-
var GradientPreviewBackground =
|
|
8186
|
+
var GradientPreviewBackground = React66.memo(
|
|
8141
8187
|
function GradientPreviewBackground2({
|
|
8142
8188
|
gradient
|
|
8143
8189
|
}) {
|
|
8144
|
-
const background2 =
|
|
8190
|
+
const background2 = React66.useMemo(
|
|
8145
8191
|
() => getGradientBackground(gradient.stops, gradient.gradientType, 180),
|
|
8146
8192
|
[gradient.gradientType, gradient.stops]
|
|
8147
8193
|
);
|
|
8148
|
-
return /* @__PURE__ */
|
|
8194
|
+
return /* @__PURE__ */ React66.createElement(Background, { background: background2 });
|
|
8149
8195
|
}
|
|
8150
8196
|
);
|
|
8151
8197
|
var background = `center url("data:image/svg+xml;utf8,${dotsHorizontalSvg(
|
|
8152
8198
|
cssVars.colors.placeholderDots
|
|
8153
8199
|
)}") no-repeat`;
|
|
8154
|
-
var FillPreviewBackground =
|
|
8200
|
+
var FillPreviewBackground = React66.memo(function FillPreviewBackground2({
|
|
8155
8201
|
value
|
|
8156
8202
|
}) {
|
|
8157
|
-
if (!value) return /* @__PURE__ */
|
|
8203
|
+
if (!value) return /* @__PURE__ */ React66.createElement(Background, { background });
|
|
8158
8204
|
switch (value._class) {
|
|
8159
8205
|
case "color":
|
|
8160
|
-
return /* @__PURE__ */
|
|
8206
|
+
return /* @__PURE__ */ React66.createElement(ColorPreviewBackground, { color: value });
|
|
8161
8207
|
case "gradient":
|
|
8162
|
-
return /* @__PURE__ */
|
|
8208
|
+
return /* @__PURE__ */ React66.createElement(GradientPreviewBackground, { gradient: value });
|
|
8163
8209
|
case "pattern":
|
|
8164
8210
|
if (!value.image) return null;
|
|
8165
|
-
return /* @__PURE__ */
|
|
8211
|
+
return /* @__PURE__ */ React66.createElement(
|
|
8166
8212
|
PatternPreviewBackground,
|
|
8167
8213
|
{
|
|
8168
8214
|
fillType: value.patternFillType,
|
|
@@ -8462,8 +8508,8 @@ var FloatingWindow = ({
|
|
|
8462
8508
|
|
|
8463
8509
|
// src/components/GradientPicker.tsx
|
|
8464
8510
|
var import_noya_colorpicker2 = require("@noya-app/noya-colorpicker");
|
|
8465
|
-
var
|
|
8466
|
-
var GradientPicker =
|
|
8511
|
+
var React69 = __toESM(require("react"));
|
|
8512
|
+
var GradientPicker = React69.memo(function GradientPicker2({
|
|
8467
8513
|
value,
|
|
8468
8514
|
selectedStop,
|
|
8469
8515
|
onChangeColor,
|
|
@@ -8472,7 +8518,7 @@ var GradientPicker = React68.memo(function GradientPicker2({
|
|
|
8472
8518
|
onDelete,
|
|
8473
8519
|
onSelectStop
|
|
8474
8520
|
}) {
|
|
8475
|
-
const colorModel =
|
|
8521
|
+
const colorModel = React69.useMemo(
|
|
8476
8522
|
() => ({
|
|
8477
8523
|
defaultColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
8478
8524
|
toHsva: import_noya_colorpicker2.rgbaToHsva,
|
|
@@ -8481,30 +8527,30 @@ var GradientPicker = React68.memo(function GradientPicker2({
|
|
|
8481
8527
|
}),
|
|
8482
8528
|
[]
|
|
8483
8529
|
);
|
|
8484
|
-
const rgbaColor =
|
|
8530
|
+
const rgbaColor = React69.useMemo(
|
|
8485
8531
|
() => sketchColorToRgba(value[selectedStop].color),
|
|
8486
8532
|
[value, selectedStop]
|
|
8487
8533
|
);
|
|
8488
|
-
const handleChangeColor =
|
|
8534
|
+
const handleChangeColor = React69.useCallback(
|
|
8489
8535
|
(value2) => {
|
|
8490
8536
|
onChangeColor(rgbaToSketchColor(value2));
|
|
8491
8537
|
},
|
|
8492
8538
|
[onChangeColor]
|
|
8493
8539
|
);
|
|
8494
|
-
const handleAddGradientStop =
|
|
8540
|
+
const handleAddGradientStop = React69.useCallback(
|
|
8495
8541
|
(value2, position) => {
|
|
8496
8542
|
onAdd(rgbaToSketchColor(value2), position);
|
|
8497
8543
|
},
|
|
8498
8544
|
[onAdd]
|
|
8499
8545
|
);
|
|
8500
|
-
return /* @__PURE__ */
|
|
8546
|
+
return /* @__PURE__ */ React69.createElement(
|
|
8501
8547
|
import_noya_colorpicker2.ColorPicker,
|
|
8502
8548
|
{
|
|
8503
8549
|
onChange: handleChangeColor,
|
|
8504
8550
|
colorModel,
|
|
8505
8551
|
color: rgbaColor
|
|
8506
8552
|
},
|
|
8507
|
-
/* @__PURE__ */
|
|
8553
|
+
/* @__PURE__ */ React69.createElement(
|
|
8508
8554
|
import_noya_colorpicker2.Gradient,
|
|
8509
8555
|
{
|
|
8510
8556
|
gradients: value,
|
|
@@ -8515,12 +8561,12 @@ var GradientPicker = React68.memo(function GradientPicker2({
|
|
|
8515
8561
|
onDelete
|
|
8516
8562
|
}
|
|
8517
8563
|
),
|
|
8518
|
-
/* @__PURE__ */
|
|
8519
|
-
/* @__PURE__ */
|
|
8520
|
-
/* @__PURE__ */
|
|
8521
|
-
/* @__PURE__ */
|
|
8522
|
-
/* @__PURE__ */
|
|
8523
|
-
/* @__PURE__ */
|
|
8564
|
+
/* @__PURE__ */ React69.createElement(Spacer.Vertical, { size: 10 }),
|
|
8565
|
+
/* @__PURE__ */ React69.createElement(import_noya_colorpicker2.Saturation, null),
|
|
8566
|
+
/* @__PURE__ */ React69.createElement(Spacer.Vertical, { size: 12 }),
|
|
8567
|
+
/* @__PURE__ */ React69.createElement(import_noya_colorpicker2.Hue, null),
|
|
8568
|
+
/* @__PURE__ */ React69.createElement(Spacer.Vertical, { size: 5 }),
|
|
8569
|
+
/* @__PURE__ */ React69.createElement(import_noya_colorpicker2.Alpha, null)
|
|
8524
8570
|
);
|
|
8525
8571
|
});
|
|
8526
8572
|
|
|
@@ -8558,25 +8604,25 @@ var InspectorContainer = (0, import_react72.memo)(
|
|
|
8558
8604
|
|
|
8559
8605
|
// src/components/LabeledElementView.tsx
|
|
8560
8606
|
var kiwi = __toESM(require("kiwi.js"));
|
|
8561
|
-
var
|
|
8562
|
-
var LabeledElementView =
|
|
8607
|
+
var React71 = __toESM(require("react"));
|
|
8608
|
+
var LabeledElementView = React71.memo(function LabeledElementView2({
|
|
8563
8609
|
children,
|
|
8564
8610
|
renderLabel
|
|
8565
8611
|
}) {
|
|
8566
|
-
const elementIds =
|
|
8567
|
-
(child) =>
|
|
8612
|
+
const elementIds = React71.Children.toArray(children).flatMap(
|
|
8613
|
+
(child) => React71.isValidElement(child) && child.type === React71.Fragment ? child.props.children : [child]
|
|
8568
8614
|
).map(
|
|
8569
|
-
(child) =>
|
|
8615
|
+
(child) => React71.isValidElement(child) && "id" in child.props ? child.props.id : null
|
|
8570
8616
|
).filter((id) => !!id);
|
|
8571
8617
|
const serializedIds = elementIds.join(",");
|
|
8572
|
-
const containerRef =
|
|
8573
|
-
const refs =
|
|
8618
|
+
const containerRef = React71.useRef(null);
|
|
8619
|
+
const refs = React71.useMemo(() => {
|
|
8574
8620
|
return Object.fromEntries(
|
|
8575
|
-
serializedIds.split(",").map((id) => [id,
|
|
8621
|
+
serializedIds.split(",").map((id) => [id, React71.createRef()])
|
|
8576
8622
|
);
|
|
8577
8623
|
}, [serializedIds]);
|
|
8578
|
-
const labelElements =
|
|
8579
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
8624
|
+
const labelElements = React71.useMemo(() => {
|
|
8625
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React71.createElement(
|
|
8580
8626
|
"span",
|
|
8581
8627
|
{
|
|
8582
8628
|
key: id,
|
|
@@ -8589,7 +8635,7 @@ var LabeledElementView = React70.memo(function LabeledElementView2({
|
|
|
8589
8635
|
})
|
|
8590
8636
|
));
|
|
8591
8637
|
}, [refs, serializedIds, renderLabel]);
|
|
8592
|
-
|
|
8638
|
+
React71.useLayoutEffect(() => {
|
|
8593
8639
|
if (!containerRef.current) return;
|
|
8594
8640
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
8595
8641
|
const solver = new kiwi.Solver();
|
|
@@ -8651,7 +8697,7 @@ var LabeledElementView = React70.memo(function LabeledElementView2({
|
|
|
8651
8697
|
`${Math.max(...heights)}px`
|
|
8652
8698
|
);
|
|
8653
8699
|
}, [refs, labelElements]);
|
|
8654
|
-
return /* @__PURE__ */
|
|
8700
|
+
return /* @__PURE__ */ React71.createElement("div", { className: "flex flex-1 flex-col relative", ref: containerRef }, /* @__PURE__ */ React71.createElement("div", { className: "flex flex-1 items-center" }, children), /* @__PURE__ */ React71.createElement("div", { className: "relative overflow-hidden select-none" }, labelElements));
|
|
8655
8701
|
});
|
|
8656
8702
|
|
|
8657
8703
|
// src/components/LabeledField.tsx
|
|
@@ -11360,29 +11406,29 @@ function getPipelineResultLink(value) {
|
|
|
11360
11406
|
}
|
|
11361
11407
|
|
|
11362
11408
|
// src/components/Progress.tsx
|
|
11363
|
-
var
|
|
11409
|
+
var import_noya_utils11 = require("@noya-app/noya-utils");
|
|
11364
11410
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
11365
|
-
var
|
|
11411
|
+
var React77 = __toESM(require("react"));
|
|
11366
11412
|
function Progress({
|
|
11367
11413
|
value,
|
|
11368
11414
|
variant = "normal",
|
|
11369
11415
|
className
|
|
11370
11416
|
}) {
|
|
11371
|
-
const clampedValue = (0,
|
|
11372
|
-
const transformStyles =
|
|
11417
|
+
const clampedValue = (0, import_noya_utils11.clamp)(value, 0, 100);
|
|
11418
|
+
const transformStyles = React77.useMemo(
|
|
11373
11419
|
() => ({
|
|
11374
11420
|
transform: `translateX(-${100 - clampedValue}%)`
|
|
11375
11421
|
}),
|
|
11376
11422
|
[clampedValue]
|
|
11377
11423
|
);
|
|
11378
|
-
return /* @__PURE__ */
|
|
11424
|
+
return /* @__PURE__ */ React77.createElement(
|
|
11379
11425
|
ProgressPrimitive.Root,
|
|
11380
11426
|
{
|
|
11381
11427
|
className: cx(`relative hidden bg-input-background h-[5px] `, className),
|
|
11382
11428
|
style: { transform: "translateZ(0)" },
|
|
11383
11429
|
value: clampedValue
|
|
11384
11430
|
},
|
|
11385
|
-
/* @__PURE__ */
|
|
11431
|
+
/* @__PURE__ */ React77.createElement(
|
|
11386
11432
|
ProgressPrimitive.Indicator,
|
|
11387
11433
|
{
|
|
11388
11434
|
className: `${variant === "primary" ? "bg-primary" : variant === "secondary" ? "bg-secondary" : variant === "warning" ? "bg-warning" : "bg-text"} transition-[transform_660ms_cubic-bezier(0.65,0,0.35,1) w-full h-full`,
|
|
@@ -11901,27 +11947,27 @@ var Slider = (0, import_react82.memo)(function Slider2({
|
|
|
11901
11947
|
});
|
|
11902
11948
|
|
|
11903
11949
|
// src/components/sorting/createSharedDrag.tsx
|
|
11904
|
-
var
|
|
11950
|
+
var React83 = __toESM(require("react"));
|
|
11905
11951
|
function createSharedDrag() {
|
|
11906
|
-
const dragRegistrationContext =
|
|
11907
|
-
const activeDragContext =
|
|
11952
|
+
const dragRegistrationContext = React83.createContext(null);
|
|
11953
|
+
const activeDragContext = React83.createContext(
|
|
11908
11954
|
null
|
|
11909
11955
|
);
|
|
11910
11956
|
const sharedDragProps = {
|
|
11911
11957
|
dragRegistrationContext,
|
|
11912
11958
|
activeDragContext
|
|
11913
11959
|
};
|
|
11914
|
-
const Provider3 = ({ children }) => /* @__PURE__ */
|
|
11960
|
+
const Provider3 = ({ children }) => /* @__PURE__ */ React83.createElement(SharedDragProvider, { sharedDragProps }, children);
|
|
11915
11961
|
return {
|
|
11916
11962
|
Provider: Provider3,
|
|
11917
|
-
Sortable: (props) => /* @__PURE__ */
|
|
11963
|
+
Sortable: (props) => /* @__PURE__ */ React83.createElement(Sortable, { sharedDragProps, ...props }),
|
|
11918
11964
|
props: sharedDragProps
|
|
11919
11965
|
};
|
|
11920
11966
|
}
|
|
11921
11967
|
|
|
11922
11968
|
// src/components/Switch.tsx
|
|
11923
11969
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
11924
|
-
var
|
|
11970
|
+
var React84 = __toESM(require("react"));
|
|
11925
11971
|
var Switch = function Switch2({
|
|
11926
11972
|
id,
|
|
11927
11973
|
value,
|
|
@@ -11933,7 +11979,7 @@ var Switch = function Switch2({
|
|
|
11933
11979
|
style: style2,
|
|
11934
11980
|
className
|
|
11935
11981
|
}) {
|
|
11936
|
-
return /* @__PURE__ */
|
|
11982
|
+
return /* @__PURE__ */ React84.createElement(
|
|
11937
11983
|
SwitchPrimitive.Root,
|
|
11938
11984
|
{
|
|
11939
11985
|
id,
|
|
@@ -11952,7 +11998,7 @@ var Switch = function Switch2({
|
|
|
11952
11998
|
onFocus,
|
|
11953
11999
|
onBlur
|
|
11954
12000
|
},
|
|
11955
|
-
/* @__PURE__ */
|
|
12001
|
+
/* @__PURE__ */ React84.createElement(SwitchPrimitive.Thumb, { className: "block w-[15px] h-[15px] bg-background rounded-full transition-transform translate-x-[2px] data-[state=checked]:translate-x-[15px]" })
|
|
11956
12002
|
);
|
|
11957
12003
|
};
|
|
11958
12004
|
|
|
@@ -12667,7 +12713,7 @@ function createSectionedMenu(...sections) {
|
|
|
12667
12713
|
}
|
|
12668
12714
|
|
|
12669
12715
|
// src/utils/moveTreeItem.ts
|
|
12670
|
-
var
|
|
12716
|
+
var import_noya_utils12 = require("@noya-app/noya-utils");
|
|
12671
12717
|
function moveTreeItem({
|
|
12672
12718
|
root,
|
|
12673
12719
|
move,
|
|
@@ -12704,13 +12750,13 @@ function acceptsDrop({
|
|
|
12704
12750
|
allowRecursion
|
|
12705
12751
|
}) {
|
|
12706
12752
|
if (!allowRecursion) {
|
|
12707
|
-
const targetIsDescendantOfSource = (0,
|
|
12753
|
+
const targetIsDescendantOfSource = (0, import_noya_utils12.isDeepEqual)(
|
|
12708
12754
|
sourceIndexPath,
|
|
12709
12755
|
targetIndexPath.slice(0, sourceIndexPath.length)
|
|
12710
12756
|
);
|
|
12711
12757
|
if (targetIsDescendantOfSource) return false;
|
|
12712
12758
|
}
|
|
12713
|
-
const areSiblings = (0,
|
|
12759
|
+
const areSiblings = (0, import_noya_utils12.isDeepEqual)(
|
|
12714
12760
|
sourceIndexPath.slice(0, -1),
|
|
12715
12761
|
targetIndexPath.slice(0, -1)
|
|
12716
12762
|
);
|
|
@@ -12718,13 +12764,13 @@ function acceptsDrop({
|
|
|
12718
12764
|
if (!allowSiblings) {
|
|
12719
12765
|
return false;
|
|
12720
12766
|
}
|
|
12721
|
-
return defaultAcceptsDrop(
|
|
12722
|
-
sourceIndexPath.at(-1),
|
|
12723
|
-
targetIndexPath.at(-1),
|
|
12767
|
+
return defaultAcceptsDrop({
|
|
12768
|
+
sourceIndex: sourceIndexPath.at(-1),
|
|
12769
|
+
targetIndex: targetIndexPath.at(-1),
|
|
12724
12770
|
position,
|
|
12725
|
-
"",
|
|
12726
|
-
""
|
|
12727
|
-
);
|
|
12771
|
+
sourceListId: "",
|
|
12772
|
+
targetListId: ""
|
|
12773
|
+
});
|
|
12728
12774
|
}
|
|
12729
12775
|
return true;
|
|
12730
12776
|
}
|
|
@@ -12743,12 +12789,12 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
12743
12789
|
];
|
|
12744
12790
|
|
|
12745
12791
|
// src/components/DimensionInput.tsx
|
|
12746
|
-
var
|
|
12747
|
-
var
|
|
12792
|
+
var import_noya_utils13 = require("@noya-app/noya-utils");
|
|
12793
|
+
var React90 = __toESM(require("react"));
|
|
12748
12794
|
function getNewValue(value, mode, delta) {
|
|
12749
12795
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
12750
12796
|
}
|
|
12751
|
-
var DimensionInput =
|
|
12797
|
+
var DimensionInput = React90.memo(function DimensionInput2({
|
|
12752
12798
|
id,
|
|
12753
12799
|
value,
|
|
12754
12800
|
onSetValue,
|
|
@@ -12758,18 +12804,18 @@ var DimensionInput = React89.memo(function DimensionInput2({
|
|
|
12758
12804
|
disabled,
|
|
12759
12805
|
trigger = "submit"
|
|
12760
12806
|
}) {
|
|
12761
|
-
const handleNudgeValue =
|
|
12807
|
+
const handleNudgeValue = React90.useCallback(
|
|
12762
12808
|
(value2) => onSetValue(value2, "adjust"),
|
|
12763
12809
|
[onSetValue]
|
|
12764
12810
|
);
|
|
12765
|
-
const handleSetValue =
|
|
12811
|
+
const handleSetValue = React90.useCallback(
|
|
12766
12812
|
(value2) => onSetValue(value2, "replace"),
|
|
12767
12813
|
[onSetValue]
|
|
12768
12814
|
);
|
|
12769
|
-
return /* @__PURE__ */
|
|
12815
|
+
return /* @__PURE__ */ React90.createElement(LabeledField, { label, labelPosition: "inset" }, /* @__PURE__ */ React90.createElement(InputField2.Root, { id, width: size2 }, /* @__PURE__ */ React90.createElement(
|
|
12770
12816
|
InputField2.NumberInput,
|
|
12771
12817
|
{
|
|
12772
|
-
value: value === void 0 ? value : (0,
|
|
12818
|
+
value: value === void 0 ? value : (0, import_noya_utils13.round)(value, 2),
|
|
12773
12819
|
placeholder: value === void 0 ? placeholder : void 0,
|
|
12774
12820
|
onNudge: handleNudgeValue,
|
|
12775
12821
|
disabled,
|
|
@@ -13192,6 +13238,7 @@ function Toolbar({
|
|
|
13192
13238
|
cssVars,
|
|
13193
13239
|
cx,
|
|
13194
13240
|
defaultAcceptsDrop,
|
|
13241
|
+
dragItemKeySeparator,
|
|
13195
13242
|
filterWithGroupedSections,
|
|
13196
13243
|
fuzzyFilter,
|
|
13197
13244
|
fuzzyScore,
|