@noya-app/noya-designsystem 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +79 -41
- package/dist/index.d.ts +79 -41
- package/dist/index.js +471 -136
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +452 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/components/InspectorContainer.tsx +63 -0
- package/src/components/WorkspaceLayout.tsx +212 -0
- package/src/contexts/DesignSystemConfiguration.tsx +11 -3
- package/src/hooks/usePreservePanelSize.tsx +156 -0
- package/src/hooks/useWindowSize.tsx +26 -0
- package/src/index.tsx +2 -0
- package/src/theme/dark.ts +2 -1
- package/src/theme/light.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -489,6 +489,17 @@ var Toast = ({
|
|
|
489
489
|
};
|
|
490
490
|
var ToastProvider = ({ children }) => /* @__PURE__ */ React7.createElement(ToastPrimitive.Provider, null, children, /* @__PURE__ */ React7.createElement(ToastViewport, null));
|
|
491
491
|
|
|
492
|
+
// src/theme/dark.ts
|
|
493
|
+
var dark_exports = {};
|
|
494
|
+
__export(dark_exports, {
|
|
495
|
+
colors: () => colors2,
|
|
496
|
+
fonts: () => fonts,
|
|
497
|
+
name: () => name2,
|
|
498
|
+
sizes: () => sizes,
|
|
499
|
+
textStyles: () => textStyles
|
|
500
|
+
});
|
|
501
|
+
import produce from "immer";
|
|
502
|
+
|
|
492
503
|
// src/theme/light.ts
|
|
493
504
|
var light_exports = {};
|
|
494
505
|
__export(light_exports, {
|
|
@@ -574,7 +585,8 @@ var colors = {
|
|
|
574
585
|
grid: "rgba(0,0,0,0.05)"
|
|
575
586
|
},
|
|
576
587
|
sidebar: {
|
|
577
|
-
background: "
|
|
588
|
+
background: "rgb(252,252,252)",
|
|
589
|
+
backgroundTransparent: "rgba(252,252,252,0.85)"
|
|
578
590
|
},
|
|
579
591
|
popover: {
|
|
580
592
|
background: "rgb(252,252,252)",
|
|
@@ -714,6 +726,47 @@ var sizes = {
|
|
|
714
726
|
}
|
|
715
727
|
};
|
|
716
728
|
|
|
729
|
+
// src/theme/dark.ts
|
|
730
|
+
var name2 = "dark";
|
|
731
|
+
var colors2 = produce(colors, (colors3) => {
|
|
732
|
+
colors3.logo.fill = "rgb(248,248,250)";
|
|
733
|
+
colors3.logo.highlight = "rgb(248,248,250)";
|
|
734
|
+
colors3.text = "rgb(248,248,250)";
|
|
735
|
+
colors3.textMuted = "rgb(180,179,182)";
|
|
736
|
+
colors3.textDisabled = "rgb(100,99,102)";
|
|
737
|
+
colors3.inputBackground = "rgba(181,178,255,0.08)";
|
|
738
|
+
colors3.inputBackgroundLight = "rgba(181,178,255,0.10)";
|
|
739
|
+
colors3.codeBackground = "rgb(20,19,23)";
|
|
740
|
+
colors3.dividerSubtle = "rgba(255,255,255,0.04)";
|
|
741
|
+
colors3.divider = "rgba(255,255,255,0.08)";
|
|
742
|
+
colors3.dividerStrong = "rgba(0,0,0,1)";
|
|
743
|
+
colors3.primary = "rgb(119, 66, 255)";
|
|
744
|
+
colors3.primaryLight = "rgb(134, 86, 255)";
|
|
745
|
+
colors3.secondaryBright = "#36fe91";
|
|
746
|
+
colors3.canvas.background = "rgb(20,19,23)";
|
|
747
|
+
colors3.canvas.sliceOutline = "rgb(150,150,150)";
|
|
748
|
+
colors3.canvas.grid = "rgba(0,0,0,0.1)";
|
|
749
|
+
colors3.sidebar.background = "rgb(34,33,39)";
|
|
750
|
+
colors3.sidebar.backgroundTransparent = "rgba(34,33,39,0.95)";
|
|
751
|
+
colors3.popover.background = "rgba(34,33,39,1)";
|
|
752
|
+
colors3.popover.divider = colors3.divider;
|
|
753
|
+
colors3.listView.raisedBackground = "rgba(181,178,255,0.1)";
|
|
754
|
+
colors3.listView.editingBackground = "#000";
|
|
755
|
+
colors3.slider.background = "#BBB";
|
|
756
|
+
colors3.radioGroup.background = colors3.inputBackground;
|
|
757
|
+
colors3.mask = "rgb(102,187,106)";
|
|
758
|
+
colors3.transparentChecker = "rgba(255,255,255,0.3)";
|
|
759
|
+
colors3.scrollbar = "rgba(199,199,199,0.2)";
|
|
760
|
+
colors3.placeholderDots = "rgba(255,255,255,0.3)";
|
|
761
|
+
colors3.dragOutline = "white";
|
|
762
|
+
colors3.activeBackground = "rgba(181,178,255,0.08)";
|
|
763
|
+
colors3.thumbnailBackground = "#1f1d33";
|
|
764
|
+
colors3.thumbnailShadow = "#1f1d3366";
|
|
765
|
+
colors3.breadcrumb.text = colors3.textMuted;
|
|
766
|
+
colors3.breadcrumb.textHover = colors3.textSubtle;
|
|
767
|
+
colors3.breadcrumb.icon = colors3.icon;
|
|
768
|
+
});
|
|
769
|
+
|
|
717
770
|
// src/contexts/DialogContext.tsx
|
|
718
771
|
import React18, {
|
|
719
772
|
createContext as createContext3,
|
|
@@ -2343,7 +2396,7 @@ var DesignSystemConfigurationContext = createContext5({
|
|
|
2343
2396
|
var DesignSystemConfigurationProvider = memo10(
|
|
2344
2397
|
function DesignSystemConfigurationProvider2({
|
|
2345
2398
|
children,
|
|
2346
|
-
theme
|
|
2399
|
+
theme,
|
|
2347
2400
|
platform
|
|
2348
2401
|
}) {
|
|
2349
2402
|
const [internalPlatform, setInternalPlatform] = useState13(
|
|
@@ -2360,7 +2413,8 @@ var DesignSystemConfigurationProvider = memo10(
|
|
|
2360
2413
|
() => ({ platform: platform ?? internalPlatform }),
|
|
2361
2414
|
[platform, internalPlatform]
|
|
2362
2415
|
);
|
|
2363
|
-
|
|
2416
|
+
const resolvedTheme = theme === "light" ? light_exports : theme === "dark" ? dark_exports : theme ?? light_exports;
|
|
2417
|
+
return /* @__PURE__ */ React20.createElement(DesignSystemConfigurationContext.Provider, { value: contextValue }, /* @__PURE__ */ React20.createElement(ThemeProvider, { theme: resolvedTheme }, /* @__PURE__ */ React20.createElement(DialogProvider, null, /* @__PURE__ */ React20.createElement(ToastProvider, null, /* @__PURE__ */ React20.createElement(FloatingWindowProvider, null, children)))));
|
|
2364
2418
|
}
|
|
2365
2419
|
);
|
|
2366
2420
|
function useDesignSystemConfiguration() {
|
|
@@ -5497,8 +5551,41 @@ function getNextIndex(items, currentIndex, direction, isDisabled) {
|
|
|
5497
5551
|
return nextIndex;
|
|
5498
5552
|
}
|
|
5499
5553
|
|
|
5554
|
+
// src/components/InspectorContainer.tsx
|
|
5555
|
+
import React37, { forwardRef as forwardRef15, memo as memo24 } from "react";
|
|
5556
|
+
var InspectorContainer = memo24(
|
|
5557
|
+
forwardRef15(function InspectorContainer2({
|
|
5558
|
+
header,
|
|
5559
|
+
children,
|
|
5560
|
+
fallback,
|
|
5561
|
+
showDividers,
|
|
5562
|
+
id,
|
|
5563
|
+
className,
|
|
5564
|
+
style: style3
|
|
5565
|
+
}, forwardedRef) {
|
|
5566
|
+
const theme = useDesignSystemTheme();
|
|
5567
|
+
return /* @__PURE__ */ React37.createElement(
|
|
5568
|
+
"div",
|
|
5569
|
+
{
|
|
5570
|
+
ref: forwardedRef,
|
|
5571
|
+
id,
|
|
5572
|
+
className,
|
|
5573
|
+
style: {
|
|
5574
|
+
display: "flex",
|
|
5575
|
+
flexDirection: "column",
|
|
5576
|
+
position: "relative",
|
|
5577
|
+
background: theme.colors.sidebar.background,
|
|
5578
|
+
...style3
|
|
5579
|
+
}
|
|
5580
|
+
},
|
|
5581
|
+
header,
|
|
5582
|
+
children ? /* @__PURE__ */ React37.createElement(ScrollArea, null, /* @__PURE__ */ React37.createElement(Stack.V, { position: "relative" }, showDividers ? withSeparatorElements(children, /* @__PURE__ */ React37.createElement(Divider, null)) : children)) : fallback ? /* @__PURE__ */ React37.createElement(Stack.V, { position: "relative", height: "100%" }, fallback) : null
|
|
5583
|
+
);
|
|
5584
|
+
})
|
|
5585
|
+
);
|
|
5586
|
+
|
|
5500
5587
|
// src/components/Label.tsx
|
|
5501
|
-
import
|
|
5588
|
+
import React38, { memo as memo25 } from "react";
|
|
5502
5589
|
import styled26 from "styled-components";
|
|
5503
5590
|
var LabelLabel = styled26.label(
|
|
5504
5591
|
({ theme, $selected }) => ({
|
|
@@ -5527,22 +5614,22 @@ var LabelContainer2 = styled26.span(({ theme }) => ({
|
|
|
5527
5614
|
alignItems: "center"
|
|
5528
5615
|
}));
|
|
5529
5616
|
function LabelRoot({ label, children }) {
|
|
5530
|
-
return /* @__PURE__ */
|
|
5617
|
+
return /* @__PURE__ */ React38.createElement(LabelContainer2, null, children, label && /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(Spacer.Vertical, { size: 2 }), /* @__PURE__ */ React38.createElement(LabelLabel, null, label)));
|
|
5531
5618
|
}
|
|
5532
5619
|
var Label;
|
|
5533
5620
|
((_Label) => {
|
|
5534
|
-
_Label.Label =
|
|
5535
|
-
_Label.Root =
|
|
5621
|
+
_Label.Label = memo25(LabelLabel);
|
|
5622
|
+
_Label.Root = memo25(LabelRoot);
|
|
5536
5623
|
})(Label || (Label = {}));
|
|
5537
5624
|
|
|
5538
5625
|
// src/components/LabeledElementView.tsx
|
|
5539
5626
|
import * as kiwi from "kiwi.js";
|
|
5540
|
-
import
|
|
5627
|
+
import React39, {
|
|
5541
5628
|
Children as Children5,
|
|
5542
5629
|
createRef,
|
|
5543
5630
|
Fragment,
|
|
5544
5631
|
isValidElement as isValidElement4,
|
|
5545
|
-
memo as
|
|
5632
|
+
memo as memo26,
|
|
5546
5633
|
useLayoutEffect as useLayoutEffect8,
|
|
5547
5634
|
useMemo as useMemo20,
|
|
5548
5635
|
useRef as useRef17
|
|
@@ -5565,7 +5652,7 @@ var Labels = styled27.div(({ theme }) => ({
|
|
|
5565
5652
|
overflow: "hidden",
|
|
5566
5653
|
userSelect: "none"
|
|
5567
5654
|
}));
|
|
5568
|
-
var LabeledElementView =
|
|
5655
|
+
var LabeledElementView = memo26(function LabeledElementView2({
|
|
5569
5656
|
children,
|
|
5570
5657
|
renderLabel
|
|
5571
5658
|
}) {
|
|
@@ -5582,7 +5669,7 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
5582
5669
|
);
|
|
5583
5670
|
}, [serializedIds]);
|
|
5584
5671
|
const labelElements = useMemo20(() => {
|
|
5585
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
5672
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ React39.createElement(
|
|
5586
5673
|
"span",
|
|
5587
5674
|
{
|
|
5588
5675
|
key: id,
|
|
@@ -5660,13 +5747,13 @@ var LabeledElementView = memo25(function LabeledElementView2({
|
|
|
5660
5747
|
`${Math.max(...heights)}px`
|
|
5661
5748
|
);
|
|
5662
5749
|
}, [refs, labelElements]);
|
|
5663
|
-
return /* @__PURE__ */
|
|
5750
|
+
return /* @__PURE__ */ React39.createElement(Container4, { ref: containerRef }, /* @__PURE__ */ React39.createElement(Tools, null, children), /* @__PURE__ */ React39.createElement(Labels, null, labelElements));
|
|
5664
5751
|
});
|
|
5665
5752
|
|
|
5666
5753
|
// src/components/Progress.tsx
|
|
5667
5754
|
import { clamp } from "@noya-app/noya-utils";
|
|
5668
5755
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5669
|
-
import
|
|
5756
|
+
import React40 from "react";
|
|
5670
5757
|
import styled28 from "styled-components";
|
|
5671
5758
|
function Progress({
|
|
5672
5759
|
value,
|
|
@@ -5676,7 +5763,7 @@ function Progress({
|
|
|
5676
5763
|
variant = "normal"
|
|
5677
5764
|
}) {
|
|
5678
5765
|
const clampedValue = clamp(value, 0, 100);
|
|
5679
|
-
return /* @__PURE__ */
|
|
5766
|
+
return /* @__PURE__ */ React40.createElement(ProgressRoot, { value: clampedValue, style: { width, flex, height } }, /* @__PURE__ */ React40.createElement(
|
|
5680
5767
|
ProgressIndicator,
|
|
5681
5768
|
{
|
|
5682
5769
|
variant,
|
|
@@ -5701,10 +5788,10 @@ var ProgressIndicator = styled28(ProgressPrimitive.Indicator)(({ theme, variant
|
|
|
5701
5788
|
|
|
5702
5789
|
// src/components/RadioGroup.tsx
|
|
5703
5790
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
5704
|
-
import
|
|
5791
|
+
import React41, {
|
|
5705
5792
|
createContext as createContext10,
|
|
5706
|
-
forwardRef as
|
|
5707
|
-
memo as
|
|
5793
|
+
forwardRef as forwardRef16,
|
|
5794
|
+
memo as memo27,
|
|
5708
5795
|
useCallback as useCallback22,
|
|
5709
5796
|
useContext as useContext10,
|
|
5710
5797
|
useMemo as useMemo21
|
|
@@ -5761,9 +5848,9 @@ var StyledItem = styled29(ToggleGroupPrimitive.Item).withConfig({
|
|
|
5761
5848
|
boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors[colorScheme ?? "primary"]}`
|
|
5762
5849
|
}
|
|
5763
5850
|
}));
|
|
5764
|
-
var ToggleGroupItem =
|
|
5851
|
+
var ToggleGroupItem = forwardRef16(function ToggleGroupItem2({ value, tooltip, children, disabled = false }, forwardedRef) {
|
|
5765
5852
|
const { colorScheme } = useContext10(RadioGroupContext);
|
|
5766
|
-
const itemElement = /* @__PURE__ */
|
|
5853
|
+
const itemElement = /* @__PURE__ */ React41.createElement(
|
|
5767
5854
|
StyledItem,
|
|
5768
5855
|
{
|
|
5769
5856
|
ref: forwardedRef,
|
|
@@ -5773,7 +5860,7 @@ var ToggleGroupItem = forwardRef15(function ToggleGroupItem2({ value, tooltip, c
|
|
|
5773
5860
|
},
|
|
5774
5861
|
children
|
|
5775
5862
|
);
|
|
5776
|
-
return tooltip ? /* @__PURE__ */
|
|
5863
|
+
return tooltip ? /* @__PURE__ */ React41.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
|
|
5777
5864
|
});
|
|
5778
5865
|
var RadioGroupContext = createContext10({
|
|
5779
5866
|
colorScheme: "primary"
|
|
@@ -5795,7 +5882,7 @@ function ToggleGroupRoot({
|
|
|
5795
5882
|
},
|
|
5796
5883
|
[allowEmpty, onValueChange]
|
|
5797
5884
|
);
|
|
5798
|
-
return /* @__PURE__ */
|
|
5885
|
+
return /* @__PURE__ */ React41.createElement(RadioGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ React41.createElement(
|
|
5799
5886
|
StyledRoot,
|
|
5800
5887
|
{
|
|
5801
5888
|
id,
|
|
@@ -5809,15 +5896,15 @@ function ToggleGroupRoot({
|
|
|
5809
5896
|
}
|
|
5810
5897
|
var RadioGroup;
|
|
5811
5898
|
((RadioGroup2) => {
|
|
5812
|
-
RadioGroup2.Root =
|
|
5813
|
-
RadioGroup2.Item =
|
|
5899
|
+
RadioGroup2.Root = memo27(ToggleGroupRoot);
|
|
5900
|
+
RadioGroup2.Item = memo27(ToggleGroupItem);
|
|
5814
5901
|
})(RadioGroup || (RadioGroup = {}));
|
|
5815
5902
|
|
|
5816
5903
|
// src/components/Select.tsx
|
|
5817
5904
|
import { memoize } from "@noya-app/noya-utils";
|
|
5818
|
-
import
|
|
5905
|
+
import React42, {
|
|
5819
5906
|
createContext as createContext11,
|
|
5820
|
-
memo as
|
|
5907
|
+
memo as memo28,
|
|
5821
5908
|
useCallback as useCallback23,
|
|
5822
5909
|
useContext as useContext11,
|
|
5823
5910
|
useEffect as useEffect15,
|
|
@@ -5826,7 +5913,7 @@ import React41, {
|
|
|
5826
5913
|
} from "react";
|
|
5827
5914
|
import styled30 from "styled-components";
|
|
5828
5915
|
var SelectContext = createContext11(void 0);
|
|
5829
|
-
var SelectOption =
|
|
5916
|
+
var SelectOption = memo28(function SelectOption2({
|
|
5830
5917
|
value,
|
|
5831
5918
|
title,
|
|
5832
5919
|
onSelect
|
|
@@ -5838,7 +5925,7 @@ var SelectOption = memo27(function SelectOption2({
|
|
|
5838
5925
|
addListener(value, onSelect);
|
|
5839
5926
|
return () => removeListener(value);
|
|
5840
5927
|
}, [addListener, onSelect, removeListener, value]);
|
|
5841
|
-
return /* @__PURE__ */
|
|
5928
|
+
return /* @__PURE__ */ React42.createElement("option", { value }, title ?? value);
|
|
5842
5929
|
});
|
|
5843
5930
|
var createChevronSVGString = memoize(
|
|
5844
5931
|
(color) => `
|
|
@@ -5900,7 +5987,7 @@ var SelectLabel = styled30.label(({ theme }) => ({
|
|
|
5900
5987
|
justifyContent: "end",
|
|
5901
5988
|
paddingRight: "24px"
|
|
5902
5989
|
}));
|
|
5903
|
-
var Select =
|
|
5990
|
+
var Select = memo28(function Select2({
|
|
5904
5991
|
id,
|
|
5905
5992
|
flex,
|
|
5906
5993
|
value,
|
|
@@ -5912,7 +5999,7 @@ var Select = memo27(function Select2({
|
|
|
5912
5999
|
const onChange = "options" in rest ? rest.onChange : void 0;
|
|
5913
6000
|
const children = "options" in rest ? void 0 : rest.children;
|
|
5914
6001
|
const optionElements = useMemo22(
|
|
5915
|
-
() => options ? options.map((option, index) => /* @__PURE__ */
|
|
6002
|
+
() => options ? options.map((option, index) => /* @__PURE__ */ React42.createElement(
|
|
5916
6003
|
SelectOption,
|
|
5917
6004
|
{
|
|
5918
6005
|
key: option,
|
|
@@ -5931,7 +6018,7 @@ var Select = memo27(function Select2({
|
|
|
5931
6018
|
}),
|
|
5932
6019
|
[]
|
|
5933
6020
|
);
|
|
5934
|
-
return /* @__PURE__ */
|
|
6021
|
+
return /* @__PURE__ */ React42.createElement(SelectContext.Provider, { value: contextValue }, /* @__PURE__ */ React42.createElement(SelectContainer, { $flex: flex }, /* @__PURE__ */ React42.createElement(
|
|
5935
6022
|
SelectElement,
|
|
5936
6023
|
{
|
|
5937
6024
|
id,
|
|
@@ -5944,12 +6031,12 @@ var Select = memo27(function Select2({
|
|
|
5944
6031
|
onPointerDown: (event) => event.stopPropagation()
|
|
5945
6032
|
},
|
|
5946
6033
|
optionElements
|
|
5947
|
-
)), label && /* @__PURE__ */
|
|
6034
|
+
)), label && /* @__PURE__ */ React42.createElement(SelectLabel, { htmlFor: id }, label));
|
|
5948
6035
|
});
|
|
5949
6036
|
|
|
5950
6037
|
// src/components/Slider.tsx
|
|
5951
6038
|
import * as RadixSlider from "@radix-ui/react-slider";
|
|
5952
|
-
import
|
|
6039
|
+
import React43, { useCallback as useCallback24, useMemo as useMemo23 } from "react";
|
|
5953
6040
|
import styled31 from "styled-components";
|
|
5954
6041
|
var StyledSlider = styled31(RadixSlider.Root)({
|
|
5955
6042
|
flex: "1",
|
|
@@ -6000,7 +6087,7 @@ var Slider = function Slider2({
|
|
|
6000
6087
|
},
|
|
6001
6088
|
[onValueChange]
|
|
6002
6089
|
);
|
|
6003
|
-
return /* @__PURE__ */
|
|
6090
|
+
return /* @__PURE__ */ React43.createElement(
|
|
6004
6091
|
StyledSlider,
|
|
6005
6092
|
{
|
|
6006
6093
|
min,
|
|
@@ -6009,14 +6096,14 @@ var Slider = function Slider2({
|
|
|
6009
6096
|
value: arrayValue,
|
|
6010
6097
|
onValueChange: handleValueChange
|
|
6011
6098
|
},
|
|
6012
|
-
/* @__PURE__ */
|
|
6013
|
-
/* @__PURE__ */
|
|
6099
|
+
/* @__PURE__ */ React43.createElement(StyledTrack, null, /* @__PURE__ */ React43.createElement(StyledRange, null)),
|
|
6100
|
+
/* @__PURE__ */ React43.createElement(StyledThumb2, null)
|
|
6014
6101
|
);
|
|
6015
6102
|
};
|
|
6016
6103
|
|
|
6017
6104
|
// src/components/Switch.tsx
|
|
6018
6105
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
6019
|
-
import
|
|
6106
|
+
import React44 from "react";
|
|
6020
6107
|
import styled32 from "styled-components";
|
|
6021
6108
|
var SwitchRoot = styled32(SwitchPrimitive.Root)(({ theme, $colorScheme }) => ({
|
|
6022
6109
|
all: "unset",
|
|
@@ -6051,7 +6138,7 @@ var Switch = function Switch2({
|
|
|
6051
6138
|
onChange,
|
|
6052
6139
|
colorScheme = "normal"
|
|
6053
6140
|
}) {
|
|
6054
|
-
return /* @__PURE__ */
|
|
6141
|
+
return /* @__PURE__ */ React44.createElement(
|
|
6055
6142
|
SwitchRoot,
|
|
6056
6143
|
{
|
|
6057
6144
|
$colorScheme: colorScheme,
|
|
@@ -6060,18 +6147,18 @@ var Switch = function Switch2({
|
|
|
6060
6147
|
onChange(newValue);
|
|
6061
6148
|
}
|
|
6062
6149
|
},
|
|
6063
|
-
/* @__PURE__ */
|
|
6150
|
+
/* @__PURE__ */ React44.createElement(SwitchThumb, null)
|
|
6064
6151
|
);
|
|
6065
6152
|
};
|
|
6066
6153
|
|
|
6067
6154
|
// src/components/TreeView.tsx
|
|
6068
|
-
import
|
|
6069
|
-
forwardRef as
|
|
6070
|
-
memo as
|
|
6155
|
+
import React45, {
|
|
6156
|
+
forwardRef as forwardRef17,
|
|
6157
|
+
memo as memo29,
|
|
6071
6158
|
useCallback as useCallback25,
|
|
6072
6159
|
useContext as useContext12
|
|
6073
6160
|
} from "react";
|
|
6074
|
-
var TreeRow =
|
|
6161
|
+
var TreeRow = forwardRef17(function TreeRow2({
|
|
6075
6162
|
icon,
|
|
6076
6163
|
expanded,
|
|
6077
6164
|
onClickChevron,
|
|
@@ -6086,23 +6173,320 @@ var TreeRow = forwardRef16(function TreeRow2({
|
|
|
6086
6173
|
},
|
|
6087
6174
|
[onClickChevron]
|
|
6088
6175
|
);
|
|
6089
|
-
return /* @__PURE__ */
|
|
6176
|
+
return /* @__PURE__ */ React45.createElement(ListView.Row, { ref: forwardedRef, ...rest }, expandable && /* @__PURE__ */ React45.createElement(React45.Fragment, null, expanded === void 0 ? /* @__PURE__ */ React45.createElement(Spacer.Horizontal, { size: 19 }) : /* @__PURE__ */ React45.createElement(
|
|
6090
6177
|
IconButton,
|
|
6091
6178
|
{
|
|
6092
6179
|
iconName: expanded ? "ChevronDownIcon" : "ChevronRightIcon",
|
|
6093
6180
|
onClick: handleClickChevron,
|
|
6094
6181
|
selected: rest.selected
|
|
6095
6182
|
}
|
|
6096
|
-
), /* @__PURE__ */
|
|
6183
|
+
), /* @__PURE__ */ React45.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React45.createElement(React45.Fragment, null, icon, /* @__PURE__ */ React45.createElement(Spacer.Horizontal, { size: 10 })), children);
|
|
6097
6184
|
});
|
|
6098
6185
|
var TreeView;
|
|
6099
6186
|
((TreeView2) => {
|
|
6100
6187
|
TreeView2.Root = ListView.Root;
|
|
6101
6188
|
TreeView2.RowTitle = ListView.RowTitle;
|
|
6102
6189
|
TreeView2.EditableRowTitle = ListView.EditableRowTitle;
|
|
6103
|
-
TreeView2.Row =
|
|
6190
|
+
TreeView2.Row = memo29(TreeRow);
|
|
6104
6191
|
})(TreeView || (TreeView = {}));
|
|
6105
6192
|
|
|
6193
|
+
// src/components/WorkspaceLayout.tsx
|
|
6194
|
+
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
6195
|
+
import React47, { forwardRef as forwardRef18, useImperativeHandle as useImperativeHandle4, useRef as useRef20 } from "react";
|
|
6196
|
+
import {
|
|
6197
|
+
Panel,
|
|
6198
|
+
PanelGroup,
|
|
6199
|
+
PanelResizeHandle
|
|
6200
|
+
} from "react-resizable-panels";
|
|
6201
|
+
|
|
6202
|
+
// src/hooks/usePreservePanelSize.tsx
|
|
6203
|
+
import { useLayoutEffect as useLayoutEffect9, useRef as useRef19 } from "react";
|
|
6204
|
+
|
|
6205
|
+
// src/hooks/useWindowSize.tsx
|
|
6206
|
+
import { useEffect as useEffect16, useState as useState20 } from "react";
|
|
6207
|
+
function useWindowSize() {
|
|
6208
|
+
const [size2, setSize] = useState20(
|
|
6209
|
+
typeof window === "undefined" ? { width: 0, height: 0 } : {
|
|
6210
|
+
width: window.innerWidth,
|
|
6211
|
+
height: window.innerHeight
|
|
6212
|
+
}
|
|
6213
|
+
);
|
|
6214
|
+
useEffect16(() => {
|
|
6215
|
+
const handleResize = () => setSize({
|
|
6216
|
+
width: window.innerWidth,
|
|
6217
|
+
height: window.innerHeight
|
|
6218
|
+
});
|
|
6219
|
+
window.addEventListener("resize", handleResize);
|
|
6220
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
6221
|
+
}, []);
|
|
6222
|
+
return size2;
|
|
6223
|
+
}
|
|
6224
|
+
|
|
6225
|
+
// src/hooks/usePreservePanelSize.tsx
|
|
6226
|
+
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
6227
|
+
var LEFT_SIDEBAR_ID = "editor-left-sidebar";
|
|
6228
|
+
var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
|
|
6229
|
+
var CONTENT_AREA_ID = "editor-content-area";
|
|
6230
|
+
function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
6231
|
+
const windowSize = useWindowSize();
|
|
6232
|
+
const layoutRef = useRef19();
|
|
6233
|
+
useLayoutEffect9(() => {
|
|
6234
|
+
const panelGroup = document.querySelector(
|
|
6235
|
+
`[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
|
|
6236
|
+
);
|
|
6237
|
+
function observePanels() {
|
|
6238
|
+
const panels = [
|
|
6239
|
+
...panelGroup.querySelectorAll("[data-panel]")
|
|
6240
|
+
];
|
|
6241
|
+
const panelObserver = new ResizeObserver(() => {
|
|
6242
|
+
const layout = {
|
|
6243
|
+
windowWidth: panelGroup.offsetWidth,
|
|
6244
|
+
panelPercentages: panelGroupRef.current?.getLayout() ?? []
|
|
6245
|
+
};
|
|
6246
|
+
layoutRef.current = layout;
|
|
6247
|
+
const leftSidebar = panels.find(
|
|
6248
|
+
(panel) => panel.id === LEFT_SIDEBAR_ID
|
|
6249
|
+
);
|
|
6250
|
+
const rightSidebar = panels.find(
|
|
6251
|
+
(panel) => panel.id === RIGHT_SIDEBAR_ID
|
|
6252
|
+
);
|
|
6253
|
+
setPanelLayoutState?.({
|
|
6254
|
+
leftSidebarCollapsed: leftSidebar?.offsetWidth === 0,
|
|
6255
|
+
rightSidebarCollapsed: rightSidebar?.offsetWidth === 0
|
|
6256
|
+
});
|
|
6257
|
+
});
|
|
6258
|
+
panels.forEach((panel) => panelObserver.observe(panel));
|
|
6259
|
+
return () => {
|
|
6260
|
+
panelObserver.disconnect();
|
|
6261
|
+
};
|
|
6262
|
+
}
|
|
6263
|
+
let disconnectPanelObserver = observePanels();
|
|
6264
|
+
const panelGroupObserver = new MutationObserver(() => {
|
|
6265
|
+
disconnectPanelObserver();
|
|
6266
|
+
disconnectPanelObserver = observePanels();
|
|
6267
|
+
});
|
|
6268
|
+
panelGroupObserver.observe(panelGroup, {
|
|
6269
|
+
childList: true
|
|
6270
|
+
});
|
|
6271
|
+
return () => {
|
|
6272
|
+
disconnectPanelObserver();
|
|
6273
|
+
panelGroupObserver.disconnect();
|
|
6274
|
+
};
|
|
6275
|
+
}, [panelGroupRef, setPanelLayoutState]);
|
|
6276
|
+
useLayoutEffect9(() => {
|
|
6277
|
+
if (!layoutRef.current)
|
|
6278
|
+
return;
|
|
6279
|
+
const {
|
|
6280
|
+
windowWidth: oldWindowWidth,
|
|
6281
|
+
panelPercentages: oldPanelPercentages
|
|
6282
|
+
} = layoutRef.current;
|
|
6283
|
+
if (oldPanelPercentages.some(
|
|
6284
|
+
(value) => typeof value !== "number" || isNaN(value)
|
|
6285
|
+
) || oldWindowWidth === 0) {
|
|
6286
|
+
return;
|
|
6287
|
+
}
|
|
6288
|
+
const currentLayout = panelGroupRef.current?.getLayout();
|
|
6289
|
+
if (!currentLayout || currentLayout.length !== oldPanelPercentages.length) {
|
|
6290
|
+
return;
|
|
6291
|
+
}
|
|
6292
|
+
if (currentLayout.length === 3) {
|
|
6293
|
+
const leftSidebarWidth = oldPanelPercentages[0] / 100 * oldWindowWidth;
|
|
6294
|
+
const rightSidebarWidth = oldPanelPercentages[2] / 100 * oldWindowWidth;
|
|
6295
|
+
const newLeftSidebarPercentage = leftSidebarWidth / windowSize.width * 100;
|
|
6296
|
+
const newRightSidebarPercentage = rightSidebarWidth / windowSize.width * 100;
|
|
6297
|
+
const newLayout = [
|
|
6298
|
+
newLeftSidebarPercentage,
|
|
6299
|
+
100 - newLeftSidebarPercentage - newRightSidebarPercentage,
|
|
6300
|
+
newRightSidebarPercentage
|
|
6301
|
+
];
|
|
6302
|
+
try {
|
|
6303
|
+
panelGroupRef.current?.setLayout(newLayout);
|
|
6304
|
+
} catch (e) {
|
|
6305
|
+
console.error(e);
|
|
6306
|
+
console.info("snapshot on error", {
|
|
6307
|
+
oldWindowWidth,
|
|
6308
|
+
oldPanelPercentages,
|
|
6309
|
+
newLayout,
|
|
6310
|
+
currentLayout
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6313
|
+
} else if (currentLayout.length === 2) {
|
|
6314
|
+
const leftSidebarWidth = oldPanelPercentages[0] / 100 * oldWindowWidth;
|
|
6315
|
+
const newLeftSidebarPercentage = leftSidebarWidth / windowSize.width * 100;
|
|
6316
|
+
const newLayout = [
|
|
6317
|
+
newLeftSidebarPercentage,
|
|
6318
|
+
100 - newLeftSidebarPercentage
|
|
6319
|
+
];
|
|
6320
|
+
try {
|
|
6321
|
+
panelGroupRef.current?.setLayout(newLayout);
|
|
6322
|
+
} catch (e) {
|
|
6323
|
+
console.error(e);
|
|
6324
|
+
console.info("snapshot on error", {
|
|
6325
|
+
oldWindowWidth,
|
|
6326
|
+
oldPanelPercentages,
|
|
6327
|
+
newLayout,
|
|
6328
|
+
currentLayout
|
|
6329
|
+
});
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6332
|
+
}, [panelGroupRef, windowSize.width]);
|
|
6333
|
+
}
|
|
6334
|
+
|
|
6335
|
+
// src/components/WorkspaceLayout.tsx
|
|
6336
|
+
var WorkspaceLayout = forwardRef18(function WorkspaceLayout2({
|
|
6337
|
+
autoSavePrefix,
|
|
6338
|
+
leftSidebarContent: leftPanelContent,
|
|
6339
|
+
children: centerPanelContent,
|
|
6340
|
+
rightSidebarContent: rightPanelContent,
|
|
6341
|
+
hasLeftSidebar = !!leftPanelContent,
|
|
6342
|
+
hasRightSidebar = !!rightPanelContent,
|
|
6343
|
+
onChangeLayoutState,
|
|
6344
|
+
leftSidebarInitialSize = 280,
|
|
6345
|
+
rightSidebarInitialSize = 400,
|
|
6346
|
+
leftSidebarCanResize = false
|
|
6347
|
+
}, forwardedRef) {
|
|
6348
|
+
const windowSize = useWindowSize();
|
|
6349
|
+
const leftSidebarPercentage = leftSidebarInitialSize / windowSize.width * 100;
|
|
6350
|
+
const rightSidebarPercentage = rightSidebarInitialSize / windowSize.width * 100;
|
|
6351
|
+
const panelGroupRef = useRef20(null);
|
|
6352
|
+
const leftSidebarRef = useRef20(null);
|
|
6353
|
+
const rightSidebarRef = useRef20(null);
|
|
6354
|
+
usePreservePanelSize(panelGroupRef, onChangeLayoutState);
|
|
6355
|
+
const theme = useDesignSystemTheme();
|
|
6356
|
+
useImperativeHandle4(forwardedRef, () => ({
|
|
6357
|
+
setLeftSidebarExpanded: (expanded) => {
|
|
6358
|
+
if (expanded) {
|
|
6359
|
+
leftSidebarRef.current?.expand();
|
|
6360
|
+
} else {
|
|
6361
|
+
leftSidebarRef.current?.collapse();
|
|
6362
|
+
}
|
|
6363
|
+
},
|
|
6364
|
+
setRightSidebarExpanded: (expanded) => {
|
|
6365
|
+
if (expanded) {
|
|
6366
|
+
rightSidebarRef.current?.expand();
|
|
6367
|
+
} else {
|
|
6368
|
+
rightSidebarRef.current?.collapse();
|
|
6369
|
+
}
|
|
6370
|
+
},
|
|
6371
|
+
toggleAllSidebars: () => {
|
|
6372
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6373
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6374
|
+
if (isLeftSidebarExpanded || isRightSidebarExpanded) {
|
|
6375
|
+
leftSidebarRef.current?.collapse();
|
|
6376
|
+
rightSidebarRef.current?.collapse();
|
|
6377
|
+
} else {
|
|
6378
|
+
leftSidebarRef.current?.expand();
|
|
6379
|
+
rightSidebarRef.current?.expand();
|
|
6380
|
+
}
|
|
6381
|
+
},
|
|
6382
|
+
toggleLeftSidebar: () => {
|
|
6383
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6384
|
+
if (isLeftSidebarExpanded) {
|
|
6385
|
+
leftSidebarRef.current?.collapse();
|
|
6386
|
+
} else {
|
|
6387
|
+
leftSidebarRef.current?.expand();
|
|
6388
|
+
}
|
|
6389
|
+
},
|
|
6390
|
+
toggleRightSidebar: () => {
|
|
6391
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6392
|
+
if (isRightSidebarExpanded) {
|
|
6393
|
+
rightSidebarRef.current?.collapse();
|
|
6394
|
+
} else {
|
|
6395
|
+
rightSidebarRef.current?.expand();
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
}));
|
|
6399
|
+
useKeyboardShortcuts3({
|
|
6400
|
+
"Mod-.": () => {
|
|
6401
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6402
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6403
|
+
if (isLeftSidebarExpanded || isRightSidebarExpanded) {
|
|
6404
|
+
leftSidebarRef.current?.collapse();
|
|
6405
|
+
rightSidebarRef.current?.collapse();
|
|
6406
|
+
} else {
|
|
6407
|
+
leftSidebarRef.current?.expand();
|
|
6408
|
+
rightSidebarRef.current?.expand();
|
|
6409
|
+
}
|
|
6410
|
+
}
|
|
6411
|
+
});
|
|
6412
|
+
return /* @__PURE__ */ React47.createElement(Stack.H, { flex: "1" }, /* @__PURE__ */ React47.createElement(
|
|
6413
|
+
PanelGroup,
|
|
6414
|
+
{
|
|
6415
|
+
ref: panelGroupRef,
|
|
6416
|
+
id: EDITOR_PANEL_GROUP_ID,
|
|
6417
|
+
direction: "horizontal",
|
|
6418
|
+
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : EDITOR_PANEL_GROUP_ID,
|
|
6419
|
+
style: { flex: "1" }
|
|
6420
|
+
},
|
|
6421
|
+
hasLeftSidebar && /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement(
|
|
6422
|
+
Panel,
|
|
6423
|
+
{
|
|
6424
|
+
id: LEFT_SIDEBAR_ID,
|
|
6425
|
+
order: 1,
|
|
6426
|
+
ref: leftSidebarRef,
|
|
6427
|
+
defaultSize: leftSidebarPercentage,
|
|
6428
|
+
minSize: leftSidebarPercentage,
|
|
6429
|
+
...!leftSidebarCanResize && { maxSize: leftSidebarPercentage },
|
|
6430
|
+
collapsible: true,
|
|
6431
|
+
style: {
|
|
6432
|
+
display: "flex",
|
|
6433
|
+
flexDirection: "row"
|
|
6434
|
+
}
|
|
6435
|
+
},
|
|
6436
|
+
leftPanelContent
|
|
6437
|
+
), /* @__PURE__ */ React47.createElement(
|
|
6438
|
+
PanelResizeHandle,
|
|
6439
|
+
{
|
|
6440
|
+
style: {
|
|
6441
|
+
cursor: "col-resize",
|
|
6442
|
+
width: "1px",
|
|
6443
|
+
height: "100%",
|
|
6444
|
+
backgroundColor: theme.colors.divider
|
|
6445
|
+
}
|
|
6446
|
+
}
|
|
6447
|
+
)),
|
|
6448
|
+
/* @__PURE__ */ React47.createElement(
|
|
6449
|
+
Panel,
|
|
6450
|
+
{
|
|
6451
|
+
id: CONTENT_AREA_ID,
|
|
6452
|
+
order: 2,
|
|
6453
|
+
minSize: 10,
|
|
6454
|
+
style: {
|
|
6455
|
+
display: "flex",
|
|
6456
|
+
flexDirection: "row"
|
|
6457
|
+
}
|
|
6458
|
+
},
|
|
6459
|
+
centerPanelContent
|
|
6460
|
+
),
|
|
6461
|
+
hasRightSidebar && /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement(
|
|
6462
|
+
PanelResizeHandle,
|
|
6463
|
+
{
|
|
6464
|
+
style: {
|
|
6465
|
+
cursor: "col-resize",
|
|
6466
|
+
width: "1px",
|
|
6467
|
+
height: "100%",
|
|
6468
|
+
backgroundColor: theme.colors.divider
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
), /* @__PURE__ */ React47.createElement(
|
|
6472
|
+
Panel,
|
|
6473
|
+
{
|
|
6474
|
+
id: RIGHT_SIDEBAR_ID,
|
|
6475
|
+
order: 3,
|
|
6476
|
+
ref: rightSidebarRef,
|
|
6477
|
+
minSize: rightSidebarPercentage,
|
|
6478
|
+
defaultSize: rightSidebarPercentage,
|
|
6479
|
+
collapsible: true,
|
|
6480
|
+
style: {
|
|
6481
|
+
display: "flex",
|
|
6482
|
+
flexDirection: "row"
|
|
6483
|
+
}
|
|
6484
|
+
},
|
|
6485
|
+
rightPanelContent
|
|
6486
|
+
))
|
|
6487
|
+
));
|
|
6488
|
+
});
|
|
6489
|
+
|
|
6106
6490
|
// src/hooks/usePlatform.ts
|
|
6107
6491
|
function usePlatform() {
|
|
6108
6492
|
return useDesignSystemConfiguration().platform;
|
|
@@ -6112,55 +6496,6 @@ function usePlatformModKey() {
|
|
|
6112
6496
|
return platform === "mac" ? "metaKey" : "ctrlKey";
|
|
6113
6497
|
}
|
|
6114
6498
|
|
|
6115
|
-
// src/theme/dark.ts
|
|
6116
|
-
var dark_exports = {};
|
|
6117
|
-
__export(dark_exports, {
|
|
6118
|
-
colors: () => colors2,
|
|
6119
|
-
fonts: () => fonts,
|
|
6120
|
-
name: () => name2,
|
|
6121
|
-
sizes: () => sizes,
|
|
6122
|
-
textStyles: () => textStyles
|
|
6123
|
-
});
|
|
6124
|
-
import produce from "immer";
|
|
6125
|
-
var name2 = "dark";
|
|
6126
|
-
var colors2 = produce(colors, (colors3) => {
|
|
6127
|
-
colors3.logo.fill = "rgb(248,248,250)";
|
|
6128
|
-
colors3.logo.highlight = "rgb(248,248,250)";
|
|
6129
|
-
colors3.text = "rgb(248,248,250)";
|
|
6130
|
-
colors3.textMuted = "rgb(180,179,182)";
|
|
6131
|
-
colors3.textDisabled = "rgb(100,99,102)";
|
|
6132
|
-
colors3.inputBackground = "rgba(181,178,255,0.08)";
|
|
6133
|
-
colors3.inputBackgroundLight = "rgba(181,178,255,0.10)";
|
|
6134
|
-
colors3.codeBackground = "rgb(20,19,23)";
|
|
6135
|
-
colors3.dividerSubtle = "rgba(255,255,255,0.04)";
|
|
6136
|
-
colors3.divider = "rgba(255,255,255,0.08)";
|
|
6137
|
-
colors3.dividerStrong = "rgba(0,0,0,1)";
|
|
6138
|
-
colors3.primary = "rgb(119, 66, 255)";
|
|
6139
|
-
colors3.primaryLight = "rgb(134, 86, 255)";
|
|
6140
|
-
colors3.secondaryBright = "#36fe91";
|
|
6141
|
-
colors3.canvas.background = "rgb(20,19,23)";
|
|
6142
|
-
colors3.canvas.sliceOutline = "rgb(150,150,150)";
|
|
6143
|
-
colors3.canvas.grid = "rgba(0,0,0,0.1)";
|
|
6144
|
-
colors3.sidebar.background = "rgba(34,33,39,0.95)";
|
|
6145
|
-
colors3.popover.background = "rgba(34,33,39,1)";
|
|
6146
|
-
colors3.popover.divider = colors3.divider;
|
|
6147
|
-
colors3.listView.raisedBackground = "rgba(181,178,255,0.1)";
|
|
6148
|
-
colors3.listView.editingBackground = "#000";
|
|
6149
|
-
colors3.slider.background = "#BBB";
|
|
6150
|
-
colors3.radioGroup.background = colors3.inputBackground;
|
|
6151
|
-
colors3.mask = "rgb(102,187,106)";
|
|
6152
|
-
colors3.transparentChecker = "rgba(255,255,255,0.3)";
|
|
6153
|
-
colors3.scrollbar = "rgba(199,199,199,0.2)";
|
|
6154
|
-
colors3.placeholderDots = "rgba(255,255,255,0.3)";
|
|
6155
|
-
colors3.dragOutline = "white";
|
|
6156
|
-
colors3.activeBackground = "rgba(181,178,255,0.08)";
|
|
6157
|
-
colors3.thumbnailBackground = "#1f1d33";
|
|
6158
|
-
colors3.thumbnailShadow = "#1f1d3366";
|
|
6159
|
-
colors3.breadcrumb.text = colors3.textMuted;
|
|
6160
|
-
colors3.breadcrumb.textHover = colors3.textSubtle;
|
|
6161
|
-
colors3.breadcrumb.icon = colors3.icon;
|
|
6162
|
-
});
|
|
6163
|
-
|
|
6164
6499
|
// src/utils/createSectionedMenu.ts
|
|
6165
6500
|
function withSeparators(elements2, separator) {
|
|
6166
6501
|
const result = [];
|
|
@@ -6194,7 +6529,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
6194
6529
|
|
|
6195
6530
|
// src/components/ArrayController.tsx
|
|
6196
6531
|
import { range as range2 } from "@noya-app/noya-utils";
|
|
6197
|
-
import
|
|
6532
|
+
import React49, { memo as memo31, useCallback as useCallback26, useMemo as useMemo24 } from "react";
|
|
6198
6533
|
import styled34, { useTheme as useTheme5 } from "styled-components";
|
|
6199
6534
|
|
|
6200
6535
|
// src/components/InspectorPrimitives.tsx
|
|
@@ -6213,7 +6548,7 @@ __export(InspectorPrimitives_exports, {
|
|
|
6213
6548
|
Title: () => Title3,
|
|
6214
6549
|
VerticalSeparator: () => VerticalSeparator
|
|
6215
6550
|
});
|
|
6216
|
-
import
|
|
6551
|
+
import React48, { memo as memo30 } from "react";
|
|
6217
6552
|
import styled33, { useTheme as useTheme4 } from "styled-components";
|
|
6218
6553
|
var Section = styled33.div(({ theme, $padding = "10px", $gap }) => ({
|
|
6219
6554
|
flex: "0 0 auto",
|
|
@@ -6260,8 +6595,8 @@ var Checkbox = styled33.input(({ theme }) => ({
|
|
|
6260
6595
|
var Text3 = styled33.span(({ theme }) => ({
|
|
6261
6596
|
...theme.textStyles.small
|
|
6262
6597
|
}));
|
|
6263
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
6264
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
6598
|
+
var VerticalSeparator = () => /* @__PURE__ */ React48.createElement(Spacer.Vertical, { size: useTheme4().sizes.inspector.verticalSeparator });
|
|
6599
|
+
var HorizontalSeparator = () => /* @__PURE__ */ React48.createElement(Spacer.Horizontal, { size: useTheme4().sizes.inspector.horizontalSeparator });
|
|
6265
6600
|
var SliderRowLabel = styled33.span(({ theme }) => ({
|
|
6266
6601
|
...theme.textStyles.small,
|
|
6267
6602
|
color: theme.colors.textMuted,
|
|
@@ -6281,7 +6616,7 @@ var RowLabel = styled33.span(({ theme, $textStyle }) => ({
|
|
|
6281
6616
|
// Button height
|
|
6282
6617
|
alignItems: "center"
|
|
6283
6618
|
}));
|
|
6284
|
-
var LabeledRow =
|
|
6619
|
+
var LabeledRow = memo30(function LabeledRow2({
|
|
6285
6620
|
id,
|
|
6286
6621
|
children,
|
|
6287
6622
|
label,
|
|
@@ -6289,13 +6624,13 @@ var LabeledRow = memo29(function LabeledRow2({
|
|
|
6289
6624
|
gap,
|
|
6290
6625
|
right
|
|
6291
6626
|
}) {
|
|
6292
|
-
return /* @__PURE__ */
|
|
6627
|
+
return /* @__PURE__ */ React48.createElement(Row2, { id }, /* @__PURE__ */ React48.createElement(Column, null, /* @__PURE__ */ React48.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ React48.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ React48.createElement(Row2, { $gap: gap }, children)));
|
|
6293
6628
|
});
|
|
6294
|
-
var LabeledSliderRow =
|
|
6629
|
+
var LabeledSliderRow = memo30(function LabeledRow3({
|
|
6295
6630
|
children,
|
|
6296
6631
|
label
|
|
6297
6632
|
}) {
|
|
6298
|
-
return /* @__PURE__ */
|
|
6633
|
+
return /* @__PURE__ */ React48.createElement(Row2, null, /* @__PURE__ */ React48.createElement(Column, null, /* @__PURE__ */ React48.createElement(SliderRowLabel, null, label), /* @__PURE__ */ React48.createElement(Row2, null, children)));
|
|
6299
6634
|
});
|
|
6300
6635
|
|
|
6301
6636
|
// src/components/ArrayController.tsx
|
|
@@ -6308,7 +6643,7 @@ var ElementRow = styled34.div({
|
|
|
6308
6643
|
var ItemContainer2 = styled34.div({
|
|
6309
6644
|
position: "relative"
|
|
6310
6645
|
});
|
|
6311
|
-
var ArrayController =
|
|
6646
|
+
var ArrayController = memo31(function ArrayController2({
|
|
6312
6647
|
id,
|
|
6313
6648
|
items,
|
|
6314
6649
|
title,
|
|
@@ -6348,11 +6683,11 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
6348
6683
|
[onMoveItem, reversed]
|
|
6349
6684
|
);
|
|
6350
6685
|
const renderRow = (index) => {
|
|
6351
|
-
return /* @__PURE__ */
|
|
6686
|
+
return /* @__PURE__ */ React49.createElement(ElementRow, { key: keys[index] }, renderItem({ item: items[index], index }));
|
|
6352
6687
|
};
|
|
6353
|
-
return /* @__PURE__ */
|
|
6688
|
+
return /* @__PURE__ */ React49.createElement(Section, { id, $padding: padding, $gap: "2px" }, /* @__PURE__ */ React49.createElement(SectionHeader, null, /* @__PURE__ */ React49.createElement(Button, { variant: "none", onClick: onClickPlus }, /* @__PURE__ */ React49.createElement(Title3, null, title)), /* @__PURE__ */ React49.createElement(Spacer.Horizontal, null), withSeparatorElements(
|
|
6354
6689
|
[
|
|
6355
|
-
onClickTrash && /* @__PURE__ */
|
|
6690
|
+
onClickTrash && /* @__PURE__ */ React49.createElement(
|
|
6356
6691
|
IconButton,
|
|
6357
6692
|
{
|
|
6358
6693
|
id: `${id}-trash`,
|
|
@@ -6361,7 +6696,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
6361
6696
|
onClick: onClickTrash
|
|
6362
6697
|
}
|
|
6363
6698
|
),
|
|
6364
|
-
onClickExpand && /* @__PURE__ */
|
|
6699
|
+
onClickExpand && /* @__PURE__ */ React49.createElement(
|
|
6365
6700
|
IconButton,
|
|
6366
6701
|
{
|
|
6367
6702
|
id: `${id}-gear`,
|
|
@@ -6370,7 +6705,7 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
6370
6705
|
onClick: onClickExpand
|
|
6371
6706
|
}
|
|
6372
6707
|
),
|
|
6373
|
-
onClickPlus && /* @__PURE__ */
|
|
6708
|
+
onClickPlus && /* @__PURE__ */ React49.createElement(
|
|
6374
6709
|
IconButton,
|
|
6375
6710
|
{
|
|
6376
6711
|
id: `${id}-add`,
|
|
@@ -6380,15 +6715,15 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
6380
6715
|
}
|
|
6381
6716
|
)
|
|
6382
6717
|
],
|
|
6383
|
-
/* @__PURE__ */
|
|
6384
|
-
)), /* @__PURE__ */
|
|
6718
|
+
/* @__PURE__ */ React49.createElement(Spacer.Horizontal, { size: 8 })
|
|
6719
|
+
)), /* @__PURE__ */ React49.createElement(Stack.V, { gap: "4px" }, sortable ? /* @__PURE__ */ React49.createElement(
|
|
6385
6720
|
Sortable.Root,
|
|
6386
6721
|
{
|
|
6387
6722
|
keys,
|
|
6388
6723
|
renderOverlay: renderRow,
|
|
6389
6724
|
onMoveItem: handleMoveItem
|
|
6390
6725
|
},
|
|
6391
|
-
indexes.map((index) => /* @__PURE__ */
|
|
6726
|
+
indexes.map((index) => /* @__PURE__ */ React49.createElement(Sortable.Item, { id: keys[index], key: keys[index] }, ({ relativeDropPosition, ...sortableProps }) => /* @__PURE__ */ React49.createElement(ItemContainer2, { ...sortableProps }, renderRow(index), relativeDropPosition && /* @__PURE__ */ React49.createElement(
|
|
6392
6727
|
ListView.DragIndicator,
|
|
6393
6728
|
{
|
|
6394
6729
|
$gap: 0,
|
|
@@ -6402,11 +6737,11 @@ var ArrayController = memo30(function ArrayController2({
|
|
|
6402
6737
|
|
|
6403
6738
|
// src/components/DimensionInput.tsx
|
|
6404
6739
|
import { round } from "@noya-app/noya-utils";
|
|
6405
|
-
import
|
|
6740
|
+
import React50, { memo as memo32, useCallback as useCallback27 } from "react";
|
|
6406
6741
|
function getNewValue(value, mode, delta) {
|
|
6407
6742
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
6408
6743
|
}
|
|
6409
|
-
var DimensionInput =
|
|
6744
|
+
var DimensionInput = memo32(function DimensionInput2({
|
|
6410
6745
|
id,
|
|
6411
6746
|
value,
|
|
6412
6747
|
onSetValue,
|
|
@@ -6424,7 +6759,7 @@ var DimensionInput = memo31(function DimensionInput2({
|
|
|
6424
6759
|
(value2) => onSetValue(value2, "replace"),
|
|
6425
6760
|
[onSetValue]
|
|
6426
6761
|
);
|
|
6427
|
-
return /* @__PURE__ */
|
|
6762
|
+
return /* @__PURE__ */ React50.createElement(InputField.Root, { id, width: size2 }, /* @__PURE__ */ React50.createElement(
|
|
6428
6763
|
InputField.NumberInput,
|
|
6429
6764
|
{
|
|
6430
6765
|
value: value === void 0 ? value : round(value, 2),
|
|
@@ -6433,7 +6768,7 @@ var DimensionInput = memo31(function DimensionInput2({
|
|
|
6433
6768
|
disabled,
|
|
6434
6769
|
...trigger === "change" ? { onChange: handleSetValue } : { onSubmit: handleSetValue }
|
|
6435
6770
|
}
|
|
6436
|
-
), label && /* @__PURE__ */
|
|
6771
|
+
), label && /* @__PURE__ */ React50.createElement(InputField.Label, null, label));
|
|
6437
6772
|
});
|
|
6438
6773
|
export {
|
|
6439
6774
|
ActivityIndicator,
|
|
@@ -6475,6 +6810,7 @@ export {
|
|
|
6475
6810
|
InputElement,
|
|
6476
6811
|
InputField,
|
|
6477
6812
|
InputFieldWithCompletions,
|
|
6813
|
+
InspectorContainer,
|
|
6478
6814
|
InspectorPrimitives_exports as InspectorPrimitives,
|
|
6479
6815
|
Italic,
|
|
6480
6816
|
KeyboardShortcut,
|
|
@@ -6503,6 +6839,7 @@ export {
|
|
|
6503
6839
|
ToastProvider,
|
|
6504
6840
|
Tooltip,
|
|
6505
6841
|
TreeView,
|
|
6842
|
+
WorkspaceLayout,
|
|
6506
6843
|
createSectionedMenu,
|
|
6507
6844
|
dark_exports as darkTheme,
|
|
6508
6845
|
fuzzyFilter,
|