@noya-app/noya-designsystem 0.1.17 → 0.1.19
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 +14 -0
- package/dist/index.d.mts +77 -41
- package/dist/index.d.ts +77 -41
- package/dist/index.js +469 -136
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +450 -115
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- 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/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ __export(src_exports, {
|
|
|
69
69
|
InputElement: () => InputElement,
|
|
70
70
|
InputField: () => InputField,
|
|
71
71
|
InputFieldWithCompletions: () => InputFieldWithCompletions,
|
|
72
|
+
InspectorContainer: () => InspectorContainer,
|
|
72
73
|
InspectorPrimitives: () => InspectorPrimitives_exports,
|
|
73
74
|
Italic: () => Italic,
|
|
74
75
|
KeyboardShortcut: () => KeyboardShortcut,
|
|
@@ -97,6 +98,7 @@ __export(src_exports, {
|
|
|
97
98
|
ToastProvider: () => ToastProvider,
|
|
98
99
|
Tooltip: () => Tooltip,
|
|
99
100
|
TreeView: () => TreeView,
|
|
101
|
+
WorkspaceLayout: () => WorkspaceLayout,
|
|
100
102
|
createSectionedMenu: () => createSectionedMenu,
|
|
101
103
|
darkTheme: () => dark_exports,
|
|
102
104
|
fuzzyFilter: () => fuzzyFilter,
|
|
@@ -596,6 +598,17 @@ var Toast = ({
|
|
|
596
598
|
};
|
|
597
599
|
var ToastProvider = ({ children }) => /* @__PURE__ */ import_react8.default.createElement(ToastPrimitive.Provider, null, children, /* @__PURE__ */ import_react8.default.createElement(ToastViewport, null));
|
|
598
600
|
|
|
601
|
+
// src/theme/dark.ts
|
|
602
|
+
var dark_exports = {};
|
|
603
|
+
__export(dark_exports, {
|
|
604
|
+
colors: () => colors2,
|
|
605
|
+
fonts: () => fonts,
|
|
606
|
+
name: () => name2,
|
|
607
|
+
sizes: () => sizes,
|
|
608
|
+
textStyles: () => textStyles
|
|
609
|
+
});
|
|
610
|
+
var import_immer = __toESM(require("immer"));
|
|
611
|
+
|
|
599
612
|
// src/theme/light.ts
|
|
600
613
|
var light_exports = {};
|
|
601
614
|
__export(light_exports, {
|
|
@@ -822,6 +835,47 @@ var sizes = {
|
|
|
822
835
|
}
|
|
823
836
|
};
|
|
824
837
|
|
|
838
|
+
// src/theme/dark.ts
|
|
839
|
+
var name2 = "dark";
|
|
840
|
+
var colors2 = (0, import_immer.default)(colors, (colors3) => {
|
|
841
|
+
colors3.logo.fill = "rgb(248,248,250)";
|
|
842
|
+
colors3.logo.highlight = "rgb(248,248,250)";
|
|
843
|
+
colors3.text = "rgb(248,248,250)";
|
|
844
|
+
colors3.textMuted = "rgb(180,179,182)";
|
|
845
|
+
colors3.textDisabled = "rgb(100,99,102)";
|
|
846
|
+
colors3.inputBackground = "rgba(181,178,255,0.08)";
|
|
847
|
+
colors3.inputBackgroundLight = "rgba(181,178,255,0.10)";
|
|
848
|
+
colors3.codeBackground = "rgb(20,19,23)";
|
|
849
|
+
colors3.dividerSubtle = "rgba(255,255,255,0.04)";
|
|
850
|
+
colors3.divider = "rgba(255,255,255,0.08)";
|
|
851
|
+
colors3.dividerStrong = "rgba(0,0,0,1)";
|
|
852
|
+
colors3.primary = "rgb(119, 66, 255)";
|
|
853
|
+
colors3.primaryLight = "rgb(134, 86, 255)";
|
|
854
|
+
colors3.secondaryBright = "#36fe91";
|
|
855
|
+
colors3.canvas.background = "rgb(20,19,23)";
|
|
856
|
+
colors3.canvas.sliceOutline = "rgb(150,150,150)";
|
|
857
|
+
colors3.canvas.grid = "rgba(0,0,0,0.1)";
|
|
858
|
+
colors3.sidebar.background = "rgb(34,33,39)";
|
|
859
|
+
colors3.sidebar.backgroundTransparent = "rgba(34,33,39,0.95)";
|
|
860
|
+
colors3.popover.background = "rgba(34,33,39,1)";
|
|
861
|
+
colors3.popover.divider = colors3.divider;
|
|
862
|
+
colors3.listView.raisedBackground = "rgba(181,178,255,0.1)";
|
|
863
|
+
colors3.listView.editingBackground = "#000";
|
|
864
|
+
colors3.slider.background = "#BBB";
|
|
865
|
+
colors3.radioGroup.background = colors3.inputBackground;
|
|
866
|
+
colors3.mask = "rgb(102,187,106)";
|
|
867
|
+
colors3.transparentChecker = "rgba(255,255,255,0.3)";
|
|
868
|
+
colors3.scrollbar = "rgba(199,199,199,0.2)";
|
|
869
|
+
colors3.placeholderDots = "rgba(255,255,255,0.3)";
|
|
870
|
+
colors3.dragOutline = "white";
|
|
871
|
+
colors3.activeBackground = "rgba(181,178,255,0.08)";
|
|
872
|
+
colors3.thumbnailBackground = "#1f1d33";
|
|
873
|
+
colors3.thumbnailShadow = "#1f1d3366";
|
|
874
|
+
colors3.breadcrumb.text = colors3.textMuted;
|
|
875
|
+
colors3.breadcrumb.textHover = colors3.textSubtle;
|
|
876
|
+
colors3.breadcrumb.icon = colors3.icon;
|
|
877
|
+
});
|
|
878
|
+
|
|
825
879
|
// src/contexts/DialogContext.tsx
|
|
826
880
|
var import_react33 = __toESM(require("react"));
|
|
827
881
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
@@ -2408,7 +2462,7 @@ var DesignSystemConfigurationContext = (0, import_react35.createContext)({
|
|
|
2408
2462
|
var DesignSystemConfigurationProvider = (0, import_react35.memo)(
|
|
2409
2463
|
function DesignSystemConfigurationProvider2({
|
|
2410
2464
|
children,
|
|
2411
|
-
theme
|
|
2465
|
+
theme,
|
|
2412
2466
|
platform
|
|
2413
2467
|
}) {
|
|
2414
2468
|
const [internalPlatform, setInternalPlatform] = (0, import_react35.useState)(
|
|
@@ -2425,7 +2479,8 @@ var DesignSystemConfigurationProvider = (0, import_react35.memo)(
|
|
|
2425
2479
|
() => ({ platform: platform ?? internalPlatform }),
|
|
2426
2480
|
[platform, internalPlatform]
|
|
2427
2481
|
);
|
|
2428
|
-
|
|
2482
|
+
const resolvedTheme = theme === "light" ? light_exports : theme === "dark" ? dark_exports : theme ?? light_exports;
|
|
2483
|
+
return /* @__PURE__ */ import_react35.default.createElement(DesignSystemConfigurationContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react35.default.createElement(import_styled_components15.ThemeProvider, { theme: resolvedTheme }, /* @__PURE__ */ import_react35.default.createElement(DialogProvider, null, /* @__PURE__ */ import_react35.default.createElement(ToastProvider, null, /* @__PURE__ */ import_react35.default.createElement(FloatingWindowProvider, null, children)))));
|
|
2429
2484
|
}
|
|
2430
2485
|
);
|
|
2431
2486
|
function useDesignSystemConfiguration() {
|
|
@@ -5491,8 +5546,41 @@ function getNextIndex(items, currentIndex, direction, isDisabled) {
|
|
|
5491
5546
|
return nextIndex;
|
|
5492
5547
|
}
|
|
5493
5548
|
|
|
5494
|
-
// src/components/
|
|
5549
|
+
// src/components/InspectorContainer.tsx
|
|
5495
5550
|
var import_react52 = __toESM(require("react"));
|
|
5551
|
+
var InspectorContainer = (0, import_react52.memo)(
|
|
5552
|
+
(0, import_react52.forwardRef)(function InspectorContainer2({
|
|
5553
|
+
header,
|
|
5554
|
+
children,
|
|
5555
|
+
fallback,
|
|
5556
|
+
showDividers,
|
|
5557
|
+
id,
|
|
5558
|
+
className,
|
|
5559
|
+
style: style3
|
|
5560
|
+
}, forwardedRef) {
|
|
5561
|
+
const theme = useDesignSystemTheme();
|
|
5562
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
5563
|
+
"div",
|
|
5564
|
+
{
|
|
5565
|
+
ref: forwardedRef,
|
|
5566
|
+
id,
|
|
5567
|
+
className,
|
|
5568
|
+
style: {
|
|
5569
|
+
display: "flex",
|
|
5570
|
+
flexDirection: "column",
|
|
5571
|
+
position: "relative",
|
|
5572
|
+
background: theme.colors.sidebar.background,
|
|
5573
|
+
...style3
|
|
5574
|
+
}
|
|
5575
|
+
},
|
|
5576
|
+
header,
|
|
5577
|
+
children ? /* @__PURE__ */ import_react52.default.createElement(ScrollArea, null, /* @__PURE__ */ import_react52.default.createElement(Stack.V, { position: "relative" }, showDividers ? withSeparatorElements(children, /* @__PURE__ */ import_react52.default.createElement(Divider, null)) : children)) : fallback ? /* @__PURE__ */ import_react52.default.createElement(Stack.V, { position: "relative", height: "100%" }, fallback) : null
|
|
5578
|
+
);
|
|
5579
|
+
})
|
|
5580
|
+
);
|
|
5581
|
+
|
|
5582
|
+
// src/components/Label.tsx
|
|
5583
|
+
var import_react53 = __toESM(require("react"));
|
|
5496
5584
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
5497
5585
|
var LabelLabel = import_styled_components28.default.label(
|
|
5498
5586
|
({ theme, $selected }) => ({
|
|
@@ -5521,17 +5609,17 @@ var LabelContainer2 = import_styled_components28.default.span(({ theme }) => ({
|
|
|
5521
5609
|
alignItems: "center"
|
|
5522
5610
|
}));
|
|
5523
5611
|
function LabelRoot({ label, children }) {
|
|
5524
|
-
return /* @__PURE__ */
|
|
5612
|
+
return /* @__PURE__ */ import_react53.default.createElement(LabelContainer2, null, children, label && /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, /* @__PURE__ */ import_react53.default.createElement(Spacer.Vertical, { size: 2 }), /* @__PURE__ */ import_react53.default.createElement(LabelLabel, null, label)));
|
|
5525
5613
|
}
|
|
5526
5614
|
var Label;
|
|
5527
5615
|
((_Label) => {
|
|
5528
|
-
_Label.Label = (0,
|
|
5529
|
-
_Label.Root = (0,
|
|
5616
|
+
_Label.Label = (0, import_react53.memo)(LabelLabel);
|
|
5617
|
+
_Label.Root = (0, import_react53.memo)(LabelRoot);
|
|
5530
5618
|
})(Label || (Label = {}));
|
|
5531
5619
|
|
|
5532
5620
|
// src/components/LabeledElementView.tsx
|
|
5533
5621
|
var kiwi = __toESM(require("kiwi.js"));
|
|
5534
|
-
var
|
|
5622
|
+
var import_react54 = __toESM(require("react"));
|
|
5535
5623
|
var import_styled_components29 = __toESM(require("styled-components"));
|
|
5536
5624
|
var Container4 = import_styled_components29.default.div(({ theme }) => ({
|
|
5537
5625
|
display: "flex",
|
|
@@ -5550,24 +5638,24 @@ var Labels = import_styled_components29.default.div(({ theme }) => ({
|
|
|
5550
5638
|
overflow: "hidden",
|
|
5551
5639
|
userSelect: "none"
|
|
5552
5640
|
}));
|
|
5553
|
-
var LabeledElementView = (0,
|
|
5641
|
+
var LabeledElementView = (0, import_react54.memo)(function LabeledElementView2({
|
|
5554
5642
|
children,
|
|
5555
5643
|
renderLabel
|
|
5556
5644
|
}) {
|
|
5557
|
-
const elementIds =
|
|
5558
|
-
(child) => (0,
|
|
5645
|
+
const elementIds = import_react54.Children.toArray(children).flatMap(
|
|
5646
|
+
(child) => (0, import_react54.isValidElement)(child) && child.type === import_react54.Fragment ? child.props.children : [child]
|
|
5559
5647
|
).map(
|
|
5560
|
-
(child) => (0,
|
|
5648
|
+
(child) => (0, import_react54.isValidElement)(child) && "id" in child.props ? child.props.id : null
|
|
5561
5649
|
).filter((id) => !!id);
|
|
5562
5650
|
const serializedIds = elementIds.join(",");
|
|
5563
|
-
const containerRef = (0,
|
|
5564
|
-
const refs = (0,
|
|
5651
|
+
const containerRef = (0, import_react54.useRef)(null);
|
|
5652
|
+
const refs = (0, import_react54.useMemo)(() => {
|
|
5565
5653
|
return Object.fromEntries(
|
|
5566
|
-
serializedIds.split(",").map((id) => [id, (0,
|
|
5654
|
+
serializedIds.split(",").map((id) => [id, (0, import_react54.createRef)()])
|
|
5567
5655
|
);
|
|
5568
5656
|
}, [serializedIds]);
|
|
5569
|
-
const labelElements = (0,
|
|
5570
|
-
return serializedIds.split(",").map((id, index) => /* @__PURE__ */
|
|
5657
|
+
const labelElements = (0, import_react54.useMemo)(() => {
|
|
5658
|
+
return serializedIds.split(",").map((id, index) => /* @__PURE__ */ import_react54.default.createElement(
|
|
5571
5659
|
"span",
|
|
5572
5660
|
{
|
|
5573
5661
|
key: id,
|
|
@@ -5580,7 +5668,7 @@ var LabeledElementView = (0, import_react53.memo)(function LabeledElementView2({
|
|
|
5580
5668
|
})
|
|
5581
5669
|
));
|
|
5582
5670
|
}, [refs, serializedIds, renderLabel]);
|
|
5583
|
-
(0,
|
|
5671
|
+
(0, import_react54.useLayoutEffect)(() => {
|
|
5584
5672
|
if (!containerRef.current)
|
|
5585
5673
|
return;
|
|
5586
5674
|
const containerRect = containerRef.current.getBoundingClientRect();
|
|
@@ -5645,13 +5733,13 @@ var LabeledElementView = (0, import_react53.memo)(function LabeledElementView2({
|
|
|
5645
5733
|
`${Math.max(...heights)}px`
|
|
5646
5734
|
);
|
|
5647
5735
|
}, [refs, labelElements]);
|
|
5648
|
-
return /* @__PURE__ */
|
|
5736
|
+
return /* @__PURE__ */ import_react54.default.createElement(Container4, { ref: containerRef }, /* @__PURE__ */ import_react54.default.createElement(Tools, null, children), /* @__PURE__ */ import_react54.default.createElement(Labels, null, labelElements));
|
|
5649
5737
|
});
|
|
5650
5738
|
|
|
5651
5739
|
// src/components/Progress.tsx
|
|
5652
5740
|
var import_noya_utils9 = require("@noya-app/noya-utils");
|
|
5653
5741
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
5654
|
-
var
|
|
5742
|
+
var import_react55 = __toESM(require("react"));
|
|
5655
5743
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
5656
5744
|
function Progress({
|
|
5657
5745
|
value,
|
|
@@ -5661,7 +5749,7 @@ function Progress({
|
|
|
5661
5749
|
variant = "normal"
|
|
5662
5750
|
}) {
|
|
5663
5751
|
const clampedValue = (0, import_noya_utils9.clamp)(value, 0, 100);
|
|
5664
|
-
return /* @__PURE__ */
|
|
5752
|
+
return /* @__PURE__ */ import_react55.default.createElement(ProgressRoot, { value: clampedValue, style: { width, flex, height } }, /* @__PURE__ */ import_react55.default.createElement(
|
|
5665
5753
|
ProgressIndicator,
|
|
5666
5754
|
{
|
|
5667
5755
|
variant,
|
|
@@ -5686,7 +5774,7 @@ var ProgressIndicator = (0, import_styled_components30.default)(ProgressPrimitiv
|
|
|
5686
5774
|
|
|
5687
5775
|
// src/components/RadioGroup.tsx
|
|
5688
5776
|
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"));
|
|
5689
|
-
var
|
|
5777
|
+
var import_react56 = __toESM(require("react"));
|
|
5690
5778
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
5691
5779
|
var ignoredProps2 = /* @__PURE__ */ new Set(["colorScheme"]);
|
|
5692
5780
|
var StyledRoot = (0, import_styled_components31.default)(ToggleGroupPrimitive.Root).withConfig({
|
|
@@ -5739,9 +5827,9 @@ var StyledItem = (0, import_styled_components31.default)(ToggleGroupPrimitive.It
|
|
|
5739
5827
|
boxShadow: `0 0 0 1px ${theme.colors.sidebar.background}, 0 0 0 3px ${theme.colors[colorScheme ?? "primary"]}`
|
|
5740
5828
|
}
|
|
5741
5829
|
}));
|
|
5742
|
-
var ToggleGroupItem = (0,
|
|
5743
|
-
const { colorScheme } = (0,
|
|
5744
|
-
const itemElement = /* @__PURE__ */
|
|
5830
|
+
var ToggleGroupItem = (0, import_react56.forwardRef)(function ToggleGroupItem2({ value, tooltip, children, disabled = false }, forwardedRef) {
|
|
5831
|
+
const { colorScheme } = (0, import_react56.useContext)(RadioGroupContext);
|
|
5832
|
+
const itemElement = /* @__PURE__ */ import_react56.default.createElement(
|
|
5745
5833
|
StyledItem,
|
|
5746
5834
|
{
|
|
5747
5835
|
ref: forwardedRef,
|
|
@@ -5751,9 +5839,9 @@ var ToggleGroupItem = (0, import_react55.forwardRef)(function ToggleGroupItem2({
|
|
|
5751
5839
|
},
|
|
5752
5840
|
children
|
|
5753
5841
|
);
|
|
5754
|
-
return tooltip ? /* @__PURE__ */
|
|
5842
|
+
return tooltip ? /* @__PURE__ */ import_react56.default.createElement(Tooltip, { content: tooltip }, itemElement) : itemElement;
|
|
5755
5843
|
});
|
|
5756
|
-
var RadioGroupContext = (0,
|
|
5844
|
+
var RadioGroupContext = (0, import_react56.createContext)({
|
|
5757
5845
|
colorScheme: "primary"
|
|
5758
5846
|
});
|
|
5759
5847
|
function ToggleGroupRoot({
|
|
@@ -5764,8 +5852,8 @@ function ToggleGroupRoot({
|
|
|
5764
5852
|
allowEmpty,
|
|
5765
5853
|
children
|
|
5766
5854
|
}) {
|
|
5767
|
-
const contextValue = (0,
|
|
5768
|
-
const handleValueChange = (0,
|
|
5855
|
+
const contextValue = (0, import_react56.useMemo)(() => ({ colorScheme }), [colorScheme]);
|
|
5856
|
+
const handleValueChange = (0, import_react56.useCallback)(
|
|
5769
5857
|
(value2) => {
|
|
5770
5858
|
if (!allowEmpty && !value2)
|
|
5771
5859
|
return;
|
|
@@ -5773,7 +5861,7 @@ function ToggleGroupRoot({
|
|
|
5773
5861
|
},
|
|
5774
5862
|
[allowEmpty, onValueChange]
|
|
5775
5863
|
);
|
|
5776
|
-
return /* @__PURE__ */
|
|
5864
|
+
return /* @__PURE__ */ import_react56.default.createElement(RadioGroupContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react56.default.createElement(
|
|
5777
5865
|
StyledRoot,
|
|
5778
5866
|
{
|
|
5779
5867
|
id,
|
|
@@ -5787,28 +5875,28 @@ function ToggleGroupRoot({
|
|
|
5787
5875
|
}
|
|
5788
5876
|
var RadioGroup;
|
|
5789
5877
|
((RadioGroup2) => {
|
|
5790
|
-
RadioGroup2.Root = (0,
|
|
5791
|
-
RadioGroup2.Item = (0,
|
|
5878
|
+
RadioGroup2.Root = (0, import_react56.memo)(ToggleGroupRoot);
|
|
5879
|
+
RadioGroup2.Item = (0, import_react56.memo)(ToggleGroupItem);
|
|
5792
5880
|
})(RadioGroup || (RadioGroup = {}));
|
|
5793
5881
|
|
|
5794
5882
|
// src/components/Select.tsx
|
|
5795
5883
|
var import_noya_utils10 = require("@noya-app/noya-utils");
|
|
5796
|
-
var
|
|
5884
|
+
var import_react57 = __toESM(require("react"));
|
|
5797
5885
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
5798
|
-
var SelectContext = (0,
|
|
5799
|
-
var SelectOption = (0,
|
|
5886
|
+
var SelectContext = (0, import_react57.createContext)(void 0);
|
|
5887
|
+
var SelectOption = (0, import_react57.memo)(function SelectOption2({
|
|
5800
5888
|
value,
|
|
5801
5889
|
title,
|
|
5802
5890
|
onSelect
|
|
5803
5891
|
}) {
|
|
5804
|
-
const { addListener, removeListener } = (0,
|
|
5805
|
-
(0,
|
|
5892
|
+
const { addListener, removeListener } = (0, import_react57.useContext)(SelectContext);
|
|
5893
|
+
(0, import_react57.useEffect)(() => {
|
|
5806
5894
|
if (!onSelect)
|
|
5807
5895
|
return;
|
|
5808
5896
|
addListener(value, onSelect);
|
|
5809
5897
|
return () => removeListener(value);
|
|
5810
5898
|
}, [addListener, onSelect, removeListener, value]);
|
|
5811
|
-
return /* @__PURE__ */
|
|
5899
|
+
return /* @__PURE__ */ import_react57.default.createElement("option", { value }, title ?? value);
|
|
5812
5900
|
});
|
|
5813
5901
|
var createChevronSVGString = (0, import_noya_utils10.memoize)(
|
|
5814
5902
|
(color) => `
|
|
@@ -5870,7 +5958,7 @@ var SelectLabel = import_styled_components32.default.label(({ theme }) => ({
|
|
|
5870
5958
|
justifyContent: "end",
|
|
5871
5959
|
paddingRight: "24px"
|
|
5872
5960
|
}));
|
|
5873
|
-
var Select = (0,
|
|
5961
|
+
var Select = (0, import_react57.memo)(function Select2({
|
|
5874
5962
|
id,
|
|
5875
5963
|
flex,
|
|
5876
5964
|
value,
|
|
@@ -5881,8 +5969,8 @@ var Select = (0, import_react56.memo)(function Select2({
|
|
|
5881
5969
|
const getTitle = "options" in rest ? rest.getTitle : void 0;
|
|
5882
5970
|
const onChange = "options" in rest ? rest.onChange : void 0;
|
|
5883
5971
|
const children = "options" in rest ? void 0 : rest.children;
|
|
5884
|
-
const optionElements = (0,
|
|
5885
|
-
() => options ? options.map((option, index) => /* @__PURE__ */
|
|
5972
|
+
const optionElements = (0, import_react57.useMemo)(
|
|
5973
|
+
() => options ? options.map((option, index) => /* @__PURE__ */ import_react57.default.createElement(
|
|
5886
5974
|
SelectOption,
|
|
5887
5975
|
{
|
|
5888
5976
|
key: option,
|
|
@@ -5893,33 +5981,33 @@ var Select = (0, import_react56.memo)(function Select2({
|
|
|
5893
5981
|
)) : children,
|
|
5894
5982
|
[children, getTitle, onChange, options]
|
|
5895
5983
|
);
|
|
5896
|
-
const listeners = (0,
|
|
5897
|
-
const contextValue = (0,
|
|
5984
|
+
const listeners = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
5985
|
+
const contextValue = (0, import_react57.useMemo)(
|
|
5898
5986
|
() => ({
|
|
5899
5987
|
addListener: (value2, listener) => listeners.current.set(value2, listener),
|
|
5900
5988
|
removeListener: (value2) => listeners.current.delete(value2)
|
|
5901
5989
|
}),
|
|
5902
5990
|
[]
|
|
5903
5991
|
);
|
|
5904
|
-
return /* @__PURE__ */
|
|
5992
|
+
return /* @__PURE__ */ import_react57.default.createElement(SelectContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react57.default.createElement(SelectContainer, { $flex: flex }, /* @__PURE__ */ import_react57.default.createElement(
|
|
5905
5993
|
SelectElement,
|
|
5906
5994
|
{
|
|
5907
5995
|
id,
|
|
5908
5996
|
$flex: flex,
|
|
5909
5997
|
value,
|
|
5910
|
-
onChange: (0,
|
|
5998
|
+
onChange: (0, import_react57.useCallback)(
|
|
5911
5999
|
(event) => listeners.current.get(event.target.value)?.(),
|
|
5912
6000
|
[listeners]
|
|
5913
6001
|
),
|
|
5914
6002
|
onPointerDown: (event) => event.stopPropagation()
|
|
5915
6003
|
},
|
|
5916
6004
|
optionElements
|
|
5917
|
-
)), label && /* @__PURE__ */
|
|
6005
|
+
)), label && /* @__PURE__ */ import_react57.default.createElement(SelectLabel, { htmlFor: id }, label));
|
|
5918
6006
|
});
|
|
5919
6007
|
|
|
5920
6008
|
// src/components/Slider.tsx
|
|
5921
6009
|
var RadixSlider = __toESM(require("@radix-ui/react-slider"));
|
|
5922
|
-
var
|
|
6010
|
+
var import_react58 = __toESM(require("react"));
|
|
5923
6011
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
5924
6012
|
var StyledSlider = (0, import_styled_components33.default)(RadixSlider.Root)({
|
|
5925
6013
|
flex: "1",
|
|
@@ -5960,17 +6048,17 @@ var Slider = function Slider2({
|
|
|
5960
6048
|
min,
|
|
5961
6049
|
max
|
|
5962
6050
|
}) {
|
|
5963
|
-
const arrayValue = (0,
|
|
6051
|
+
const arrayValue = (0, import_react58.useMemo)(
|
|
5964
6052
|
() => [Math.min(Math.max(value, min), max)],
|
|
5965
6053
|
[value, min, max]
|
|
5966
6054
|
);
|
|
5967
|
-
const handleValueChange = (0,
|
|
6055
|
+
const handleValueChange = (0, import_react58.useCallback)(
|
|
5968
6056
|
(arrayValue2) => {
|
|
5969
6057
|
onValueChange(arrayValue2[0]);
|
|
5970
6058
|
},
|
|
5971
6059
|
[onValueChange]
|
|
5972
6060
|
);
|
|
5973
|
-
return /* @__PURE__ */
|
|
6061
|
+
return /* @__PURE__ */ import_react58.default.createElement(
|
|
5974
6062
|
StyledSlider,
|
|
5975
6063
|
{
|
|
5976
6064
|
min,
|
|
@@ -5979,14 +6067,14 @@ var Slider = function Slider2({
|
|
|
5979
6067
|
value: arrayValue,
|
|
5980
6068
|
onValueChange: handleValueChange
|
|
5981
6069
|
},
|
|
5982
|
-
/* @__PURE__ */
|
|
5983
|
-
/* @__PURE__ */
|
|
6070
|
+
/* @__PURE__ */ import_react58.default.createElement(StyledTrack, null, /* @__PURE__ */ import_react58.default.createElement(StyledRange, null)),
|
|
6071
|
+
/* @__PURE__ */ import_react58.default.createElement(StyledThumb2, null)
|
|
5984
6072
|
);
|
|
5985
6073
|
};
|
|
5986
6074
|
|
|
5987
6075
|
// src/components/Switch.tsx
|
|
5988
6076
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
5989
|
-
var
|
|
6077
|
+
var import_react59 = __toESM(require("react"));
|
|
5990
6078
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
5991
6079
|
var SwitchRoot = (0, import_styled_components34.default)(SwitchPrimitive.Root)(({ theme, $colorScheme }) => ({
|
|
5992
6080
|
all: "unset",
|
|
@@ -6021,7 +6109,7 @@ var Switch = function Switch2({
|
|
|
6021
6109
|
onChange,
|
|
6022
6110
|
colorScheme = "normal"
|
|
6023
6111
|
}) {
|
|
6024
|
-
return /* @__PURE__ */
|
|
6112
|
+
return /* @__PURE__ */ import_react59.default.createElement(
|
|
6025
6113
|
SwitchRoot,
|
|
6026
6114
|
{
|
|
6027
6115
|
$colorScheme: colorScheme,
|
|
@@ -6030,44 +6118,337 @@ var Switch = function Switch2({
|
|
|
6030
6118
|
onChange(newValue);
|
|
6031
6119
|
}
|
|
6032
6120
|
},
|
|
6033
|
-
/* @__PURE__ */
|
|
6121
|
+
/* @__PURE__ */ import_react59.default.createElement(SwitchThumb, null)
|
|
6034
6122
|
);
|
|
6035
6123
|
};
|
|
6036
6124
|
|
|
6037
6125
|
// src/components/TreeView.tsx
|
|
6038
|
-
var
|
|
6039
|
-
var TreeRow = (0,
|
|
6126
|
+
var import_react60 = __toESM(require("react"));
|
|
6127
|
+
var TreeRow = (0, import_react60.forwardRef)(function TreeRow2({
|
|
6040
6128
|
icon,
|
|
6041
6129
|
expanded,
|
|
6042
6130
|
onClickChevron,
|
|
6043
6131
|
children,
|
|
6044
6132
|
...rest
|
|
6045
6133
|
}, forwardedRef) {
|
|
6046
|
-
const { expandable } = (0,
|
|
6047
|
-
const handleClickChevron = (0,
|
|
6134
|
+
const { expandable } = (0, import_react60.useContext)(ListView.RowContext);
|
|
6135
|
+
const handleClickChevron = (0, import_react60.useCallback)(
|
|
6048
6136
|
(event) => {
|
|
6049
6137
|
event.stopPropagation();
|
|
6050
6138
|
onClickChevron?.({ altKey: event.altKey });
|
|
6051
6139
|
},
|
|
6052
6140
|
[onClickChevron]
|
|
6053
6141
|
);
|
|
6054
|
-
return /* @__PURE__ */
|
|
6142
|
+
return /* @__PURE__ */ import_react60.default.createElement(ListView.Row, { ref: forwardedRef, ...rest }, expandable && /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, expanded === void 0 ? /* @__PURE__ */ import_react60.default.createElement(Spacer.Horizontal, { size: 19 }) : /* @__PURE__ */ import_react60.default.createElement(
|
|
6055
6143
|
IconButton,
|
|
6056
6144
|
{
|
|
6057
6145
|
iconName: expanded ? "ChevronDownIcon" : "ChevronRightIcon",
|
|
6058
6146
|
onClick: handleClickChevron,
|
|
6059
6147
|
selected: rest.selected
|
|
6060
6148
|
}
|
|
6061
|
-
), /* @__PURE__ */
|
|
6149
|
+
), /* @__PURE__ */ import_react60.default.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, icon, /* @__PURE__ */ import_react60.default.createElement(Spacer.Horizontal, { size: 10 })), children);
|
|
6062
6150
|
});
|
|
6063
6151
|
var TreeView;
|
|
6064
6152
|
((TreeView2) => {
|
|
6065
6153
|
TreeView2.Root = ListView.Root;
|
|
6066
6154
|
TreeView2.RowTitle = ListView.RowTitle;
|
|
6067
6155
|
TreeView2.EditableRowTitle = ListView.EditableRowTitle;
|
|
6068
|
-
TreeView2.Row = (0,
|
|
6156
|
+
TreeView2.Row = (0, import_react60.memo)(TreeRow);
|
|
6069
6157
|
})(TreeView || (TreeView = {}));
|
|
6070
6158
|
|
|
6159
|
+
// src/components/WorkspaceLayout.tsx
|
|
6160
|
+
var import_noya_keymap5 = require("@noya-app/noya-keymap");
|
|
6161
|
+
var import_react63 = __toESM(require("react"));
|
|
6162
|
+
var import_react_resizable_panels = require("react-resizable-panels");
|
|
6163
|
+
|
|
6164
|
+
// src/hooks/usePreservePanelSize.tsx
|
|
6165
|
+
var import_react62 = require("react");
|
|
6166
|
+
|
|
6167
|
+
// src/hooks/useWindowSize.tsx
|
|
6168
|
+
var import_react61 = require("react");
|
|
6169
|
+
function useWindowSize() {
|
|
6170
|
+
const [size2, setSize] = (0, import_react61.useState)(
|
|
6171
|
+
typeof window === "undefined" ? { width: 0, height: 0 } : {
|
|
6172
|
+
width: window.innerWidth,
|
|
6173
|
+
height: window.innerHeight
|
|
6174
|
+
}
|
|
6175
|
+
);
|
|
6176
|
+
(0, import_react61.useEffect)(() => {
|
|
6177
|
+
const handleResize = () => setSize({
|
|
6178
|
+
width: window.innerWidth,
|
|
6179
|
+
height: window.innerHeight
|
|
6180
|
+
});
|
|
6181
|
+
window.addEventListener("resize", handleResize);
|
|
6182
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
6183
|
+
}, []);
|
|
6184
|
+
return size2;
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6187
|
+
// src/hooks/usePreservePanelSize.tsx
|
|
6188
|
+
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
6189
|
+
var LEFT_SIDEBAR_ID = "editor-left-sidebar";
|
|
6190
|
+
var RIGHT_SIDEBAR_ID = "editor-right-sidebar";
|
|
6191
|
+
var CONTENT_AREA_ID = "editor-content-area";
|
|
6192
|
+
function usePreservePanelSize(panelGroupRef, setPanelLayoutState) {
|
|
6193
|
+
const windowSize = useWindowSize();
|
|
6194
|
+
const layoutRef = (0, import_react62.useRef)();
|
|
6195
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
6196
|
+
const panelGroup = document.querySelector(
|
|
6197
|
+
`[data-panel-group-id="${EDITOR_PANEL_GROUP_ID}"]`
|
|
6198
|
+
);
|
|
6199
|
+
function observePanels() {
|
|
6200
|
+
const panels = [
|
|
6201
|
+
...panelGroup.querySelectorAll("[data-panel]")
|
|
6202
|
+
];
|
|
6203
|
+
const panelObserver = new ResizeObserver(() => {
|
|
6204
|
+
const layout = {
|
|
6205
|
+
windowWidth: panelGroup.offsetWidth,
|
|
6206
|
+
panelPercentages: panelGroupRef.current?.getLayout() ?? []
|
|
6207
|
+
};
|
|
6208
|
+
layoutRef.current = layout;
|
|
6209
|
+
const leftSidebar = panels.find(
|
|
6210
|
+
(panel) => panel.id === LEFT_SIDEBAR_ID
|
|
6211
|
+
);
|
|
6212
|
+
const rightSidebar = panels.find(
|
|
6213
|
+
(panel) => panel.id === RIGHT_SIDEBAR_ID
|
|
6214
|
+
);
|
|
6215
|
+
setPanelLayoutState?.({
|
|
6216
|
+
leftSidebarCollapsed: leftSidebar?.offsetWidth === 0,
|
|
6217
|
+
rightSidebarCollapsed: rightSidebar?.offsetWidth === 0
|
|
6218
|
+
});
|
|
6219
|
+
});
|
|
6220
|
+
panels.forEach((panel) => panelObserver.observe(panel));
|
|
6221
|
+
return () => {
|
|
6222
|
+
panelObserver.disconnect();
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
let disconnectPanelObserver = observePanels();
|
|
6226
|
+
const panelGroupObserver = new MutationObserver(() => {
|
|
6227
|
+
disconnectPanelObserver();
|
|
6228
|
+
disconnectPanelObserver = observePanels();
|
|
6229
|
+
});
|
|
6230
|
+
panelGroupObserver.observe(panelGroup, {
|
|
6231
|
+
childList: true
|
|
6232
|
+
});
|
|
6233
|
+
return () => {
|
|
6234
|
+
disconnectPanelObserver();
|
|
6235
|
+
panelGroupObserver.disconnect();
|
|
6236
|
+
};
|
|
6237
|
+
}, [panelGroupRef, setPanelLayoutState]);
|
|
6238
|
+
(0, import_react62.useLayoutEffect)(() => {
|
|
6239
|
+
if (!layoutRef.current)
|
|
6240
|
+
return;
|
|
6241
|
+
const {
|
|
6242
|
+
windowWidth: oldWindowWidth,
|
|
6243
|
+
panelPercentages: oldPanelPercentages
|
|
6244
|
+
} = layoutRef.current;
|
|
6245
|
+
if (oldPanelPercentages.some(
|
|
6246
|
+
(value) => typeof value !== "number" || isNaN(value)
|
|
6247
|
+
) || oldWindowWidth === 0) {
|
|
6248
|
+
return;
|
|
6249
|
+
}
|
|
6250
|
+
const currentLayout = panelGroupRef.current?.getLayout();
|
|
6251
|
+
if (!currentLayout || currentLayout.length !== oldPanelPercentages.length) {
|
|
6252
|
+
return;
|
|
6253
|
+
}
|
|
6254
|
+
if (currentLayout.length === 3) {
|
|
6255
|
+
const leftSidebarWidth = oldPanelPercentages[0] / 100 * oldWindowWidth;
|
|
6256
|
+
const rightSidebarWidth = oldPanelPercentages[2] / 100 * oldWindowWidth;
|
|
6257
|
+
const newLeftSidebarPercentage = leftSidebarWidth / windowSize.width * 100;
|
|
6258
|
+
const newRightSidebarPercentage = rightSidebarWidth / windowSize.width * 100;
|
|
6259
|
+
const newLayout = [
|
|
6260
|
+
newLeftSidebarPercentage,
|
|
6261
|
+
100 - newLeftSidebarPercentage - newRightSidebarPercentage,
|
|
6262
|
+
newRightSidebarPercentage
|
|
6263
|
+
];
|
|
6264
|
+
try {
|
|
6265
|
+
panelGroupRef.current?.setLayout(newLayout);
|
|
6266
|
+
} catch (e) {
|
|
6267
|
+
console.error(e);
|
|
6268
|
+
console.info("snapshot on error", {
|
|
6269
|
+
oldWindowWidth,
|
|
6270
|
+
oldPanelPercentages,
|
|
6271
|
+
newLayout,
|
|
6272
|
+
currentLayout
|
|
6273
|
+
});
|
|
6274
|
+
}
|
|
6275
|
+
} else if (currentLayout.length === 2) {
|
|
6276
|
+
const leftSidebarWidth = oldPanelPercentages[0] / 100 * oldWindowWidth;
|
|
6277
|
+
const newLeftSidebarPercentage = leftSidebarWidth / windowSize.width * 100;
|
|
6278
|
+
const newLayout = [
|
|
6279
|
+
newLeftSidebarPercentage,
|
|
6280
|
+
100 - newLeftSidebarPercentage
|
|
6281
|
+
];
|
|
6282
|
+
try {
|
|
6283
|
+
panelGroupRef.current?.setLayout(newLayout);
|
|
6284
|
+
} catch (e) {
|
|
6285
|
+
console.error(e);
|
|
6286
|
+
console.info("snapshot on error", {
|
|
6287
|
+
oldWindowWidth,
|
|
6288
|
+
oldPanelPercentages,
|
|
6289
|
+
newLayout,
|
|
6290
|
+
currentLayout
|
|
6291
|
+
});
|
|
6292
|
+
}
|
|
6293
|
+
}
|
|
6294
|
+
}, [panelGroupRef, windowSize.width]);
|
|
6295
|
+
}
|
|
6296
|
+
|
|
6297
|
+
// src/components/WorkspaceLayout.tsx
|
|
6298
|
+
var WorkspaceLayout = (0, import_react63.forwardRef)(function WorkspaceLayout2({
|
|
6299
|
+
autoSavePrefix,
|
|
6300
|
+
leftSidebarContent: leftPanelContent,
|
|
6301
|
+
children: centerPanelContent,
|
|
6302
|
+
rightSidebarContent: rightPanelContent,
|
|
6303
|
+
hasLeftSidebar = !!leftPanelContent,
|
|
6304
|
+
hasRightSidebar = !!rightPanelContent,
|
|
6305
|
+
onChangeLayoutState,
|
|
6306
|
+
leftSidebarInitialSize = 280,
|
|
6307
|
+
rightSidebarInitialSize = 400,
|
|
6308
|
+
leftSidebarCanResize = false
|
|
6309
|
+
}, forwardedRef) {
|
|
6310
|
+
const windowSize = useWindowSize();
|
|
6311
|
+
const leftSidebarPercentage = leftSidebarInitialSize / windowSize.width * 100;
|
|
6312
|
+
const rightSidebarPercentage = rightSidebarInitialSize / windowSize.width * 100;
|
|
6313
|
+
const panelGroupRef = (0, import_react63.useRef)(null);
|
|
6314
|
+
const leftSidebarRef = (0, import_react63.useRef)(null);
|
|
6315
|
+
const rightSidebarRef = (0, import_react63.useRef)(null);
|
|
6316
|
+
usePreservePanelSize(panelGroupRef, onChangeLayoutState);
|
|
6317
|
+
const theme = useDesignSystemTheme();
|
|
6318
|
+
(0, import_react63.useImperativeHandle)(forwardedRef, () => ({
|
|
6319
|
+
setLeftSidebarExpanded: (expanded) => {
|
|
6320
|
+
if (expanded) {
|
|
6321
|
+
leftSidebarRef.current?.expand();
|
|
6322
|
+
} else {
|
|
6323
|
+
leftSidebarRef.current?.collapse();
|
|
6324
|
+
}
|
|
6325
|
+
},
|
|
6326
|
+
setRightSidebarExpanded: (expanded) => {
|
|
6327
|
+
if (expanded) {
|
|
6328
|
+
rightSidebarRef.current?.expand();
|
|
6329
|
+
} else {
|
|
6330
|
+
rightSidebarRef.current?.collapse();
|
|
6331
|
+
}
|
|
6332
|
+
},
|
|
6333
|
+
toggleAllSidebars: () => {
|
|
6334
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6335
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6336
|
+
if (isLeftSidebarExpanded || isRightSidebarExpanded) {
|
|
6337
|
+
leftSidebarRef.current?.collapse();
|
|
6338
|
+
rightSidebarRef.current?.collapse();
|
|
6339
|
+
} else {
|
|
6340
|
+
leftSidebarRef.current?.expand();
|
|
6341
|
+
rightSidebarRef.current?.expand();
|
|
6342
|
+
}
|
|
6343
|
+
},
|
|
6344
|
+
toggleLeftSidebar: () => {
|
|
6345
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6346
|
+
if (isLeftSidebarExpanded) {
|
|
6347
|
+
leftSidebarRef.current?.collapse();
|
|
6348
|
+
} else {
|
|
6349
|
+
leftSidebarRef.current?.expand();
|
|
6350
|
+
}
|
|
6351
|
+
},
|
|
6352
|
+
toggleRightSidebar: () => {
|
|
6353
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6354
|
+
if (isRightSidebarExpanded) {
|
|
6355
|
+
rightSidebarRef.current?.collapse();
|
|
6356
|
+
} else {
|
|
6357
|
+
rightSidebarRef.current?.expand();
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6360
|
+
}));
|
|
6361
|
+
(0, import_noya_keymap5.useKeyboardShortcuts)({
|
|
6362
|
+
"Mod-.": () => {
|
|
6363
|
+
const isLeftSidebarExpanded = leftSidebarRef.current?.isExpanded();
|
|
6364
|
+
const isRightSidebarExpanded = rightSidebarRef.current?.isExpanded();
|
|
6365
|
+
if (isLeftSidebarExpanded || isRightSidebarExpanded) {
|
|
6366
|
+
leftSidebarRef.current?.collapse();
|
|
6367
|
+
rightSidebarRef.current?.collapse();
|
|
6368
|
+
} else {
|
|
6369
|
+
leftSidebarRef.current?.expand();
|
|
6370
|
+
rightSidebarRef.current?.expand();
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6373
|
+
});
|
|
6374
|
+
return /* @__PURE__ */ import_react63.default.createElement(Stack.H, { flex: "1" }, /* @__PURE__ */ import_react63.default.createElement(
|
|
6375
|
+
import_react_resizable_panels.PanelGroup,
|
|
6376
|
+
{
|
|
6377
|
+
ref: panelGroupRef,
|
|
6378
|
+
id: EDITOR_PANEL_GROUP_ID,
|
|
6379
|
+
direction: "horizontal",
|
|
6380
|
+
autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0,
|
|
6381
|
+
style: { flex: "1" }
|
|
6382
|
+
},
|
|
6383
|
+
hasLeftSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
|
|
6384
|
+
import_react_resizable_panels.Panel,
|
|
6385
|
+
{
|
|
6386
|
+
id: LEFT_SIDEBAR_ID,
|
|
6387
|
+
order: 1,
|
|
6388
|
+
ref: leftSidebarRef,
|
|
6389
|
+
defaultSize: leftSidebarPercentage,
|
|
6390
|
+
minSize: leftSidebarPercentage,
|
|
6391
|
+
...!leftSidebarCanResize && { maxSize: leftSidebarPercentage },
|
|
6392
|
+
collapsible: true,
|
|
6393
|
+
style: {
|
|
6394
|
+
display: "flex",
|
|
6395
|
+
flexDirection: "row"
|
|
6396
|
+
}
|
|
6397
|
+
},
|
|
6398
|
+
leftPanelContent
|
|
6399
|
+
), /* @__PURE__ */ import_react63.default.createElement(
|
|
6400
|
+
import_react_resizable_panels.PanelResizeHandle,
|
|
6401
|
+
{
|
|
6402
|
+
style: {
|
|
6403
|
+
cursor: "col-resize",
|
|
6404
|
+
width: "1px",
|
|
6405
|
+
height: "100%",
|
|
6406
|
+
backgroundColor: theme.colors.divider
|
|
6407
|
+
}
|
|
6408
|
+
}
|
|
6409
|
+
)),
|
|
6410
|
+
/* @__PURE__ */ import_react63.default.createElement(
|
|
6411
|
+
import_react_resizable_panels.Panel,
|
|
6412
|
+
{
|
|
6413
|
+
id: CONTENT_AREA_ID,
|
|
6414
|
+
order: 2,
|
|
6415
|
+
minSize: 10,
|
|
6416
|
+
style: {
|
|
6417
|
+
display: "flex",
|
|
6418
|
+
flexDirection: "row"
|
|
6419
|
+
}
|
|
6420
|
+
},
|
|
6421
|
+
centerPanelContent
|
|
6422
|
+
),
|
|
6423
|
+
hasRightSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
|
|
6424
|
+
import_react_resizable_panels.PanelResizeHandle,
|
|
6425
|
+
{
|
|
6426
|
+
style: {
|
|
6427
|
+
cursor: "col-resize",
|
|
6428
|
+
width: "1px",
|
|
6429
|
+
height: "100%",
|
|
6430
|
+
backgroundColor: theme.colors.divider
|
|
6431
|
+
}
|
|
6432
|
+
}
|
|
6433
|
+
), /* @__PURE__ */ import_react63.default.createElement(
|
|
6434
|
+
import_react_resizable_panels.Panel,
|
|
6435
|
+
{
|
|
6436
|
+
id: RIGHT_SIDEBAR_ID,
|
|
6437
|
+
order: 3,
|
|
6438
|
+
ref: rightSidebarRef,
|
|
6439
|
+
minSize: rightSidebarPercentage,
|
|
6440
|
+
defaultSize: rightSidebarPercentage,
|
|
6441
|
+
collapsible: true,
|
|
6442
|
+
style: {
|
|
6443
|
+
display: "flex",
|
|
6444
|
+
flexDirection: "row"
|
|
6445
|
+
}
|
|
6446
|
+
},
|
|
6447
|
+
rightPanelContent
|
|
6448
|
+
))
|
|
6449
|
+
));
|
|
6450
|
+
});
|
|
6451
|
+
|
|
6071
6452
|
// src/hooks/usePlatform.ts
|
|
6072
6453
|
function usePlatform() {
|
|
6073
6454
|
return useDesignSystemConfiguration().platform;
|
|
@@ -6077,56 +6458,6 @@ function usePlatformModKey() {
|
|
|
6077
6458
|
return platform === "mac" ? "metaKey" : "ctrlKey";
|
|
6078
6459
|
}
|
|
6079
6460
|
|
|
6080
|
-
// src/theme/dark.ts
|
|
6081
|
-
var dark_exports = {};
|
|
6082
|
-
__export(dark_exports, {
|
|
6083
|
-
colors: () => colors2,
|
|
6084
|
-
fonts: () => fonts,
|
|
6085
|
-
name: () => name2,
|
|
6086
|
-
sizes: () => sizes,
|
|
6087
|
-
textStyles: () => textStyles
|
|
6088
|
-
});
|
|
6089
|
-
var import_immer = __toESM(require("immer"));
|
|
6090
|
-
var name2 = "dark";
|
|
6091
|
-
var colors2 = (0, import_immer.default)(colors, (colors3) => {
|
|
6092
|
-
colors3.logo.fill = "rgb(248,248,250)";
|
|
6093
|
-
colors3.logo.highlight = "rgb(248,248,250)";
|
|
6094
|
-
colors3.text = "rgb(248,248,250)";
|
|
6095
|
-
colors3.textMuted = "rgb(180,179,182)";
|
|
6096
|
-
colors3.textDisabled = "rgb(100,99,102)";
|
|
6097
|
-
colors3.inputBackground = "rgba(181,178,255,0.08)";
|
|
6098
|
-
colors3.inputBackgroundLight = "rgba(181,178,255,0.10)";
|
|
6099
|
-
colors3.codeBackground = "rgb(20,19,23)";
|
|
6100
|
-
colors3.dividerSubtle = "rgba(255,255,255,0.04)";
|
|
6101
|
-
colors3.divider = "rgba(255,255,255,0.08)";
|
|
6102
|
-
colors3.dividerStrong = "rgba(0,0,0,1)";
|
|
6103
|
-
colors3.primary = "rgb(119, 66, 255)";
|
|
6104
|
-
colors3.primaryLight = "rgb(134, 86, 255)";
|
|
6105
|
-
colors3.secondaryBright = "#36fe91";
|
|
6106
|
-
colors3.canvas.background = "rgb(20,19,23)";
|
|
6107
|
-
colors3.canvas.sliceOutline = "rgb(150,150,150)";
|
|
6108
|
-
colors3.canvas.grid = "rgba(0,0,0,0.1)";
|
|
6109
|
-
colors3.sidebar.background = "rgb(34,33,39)";
|
|
6110
|
-
colors3.sidebar.backgroundTransparent = "rgba(34,33,39,0.95)";
|
|
6111
|
-
colors3.popover.background = "rgba(34,33,39,1)";
|
|
6112
|
-
colors3.popover.divider = colors3.divider;
|
|
6113
|
-
colors3.listView.raisedBackground = "rgba(181,178,255,0.1)";
|
|
6114
|
-
colors3.listView.editingBackground = "#000";
|
|
6115
|
-
colors3.slider.background = "#BBB";
|
|
6116
|
-
colors3.radioGroup.background = colors3.inputBackground;
|
|
6117
|
-
colors3.mask = "rgb(102,187,106)";
|
|
6118
|
-
colors3.transparentChecker = "rgba(255,255,255,0.3)";
|
|
6119
|
-
colors3.scrollbar = "rgba(199,199,199,0.2)";
|
|
6120
|
-
colors3.placeholderDots = "rgba(255,255,255,0.3)";
|
|
6121
|
-
colors3.dragOutline = "white";
|
|
6122
|
-
colors3.activeBackground = "rgba(181,178,255,0.08)";
|
|
6123
|
-
colors3.thumbnailBackground = "#1f1d33";
|
|
6124
|
-
colors3.thumbnailShadow = "#1f1d3366";
|
|
6125
|
-
colors3.breadcrumb.text = colors3.textMuted;
|
|
6126
|
-
colors3.breadcrumb.textHover = colors3.textSubtle;
|
|
6127
|
-
colors3.breadcrumb.icon = colors3.icon;
|
|
6128
|
-
});
|
|
6129
|
-
|
|
6130
6461
|
// src/utils/createSectionedMenu.ts
|
|
6131
6462
|
function withSeparators(elements2, separator) {
|
|
6132
6463
|
const result = [];
|
|
@@ -6160,7 +6491,7 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
6160
6491
|
|
|
6161
6492
|
// src/components/ArrayController.tsx
|
|
6162
6493
|
var import_noya_utils11 = require("@noya-app/noya-utils");
|
|
6163
|
-
var
|
|
6494
|
+
var import_react65 = __toESM(require("react"));
|
|
6164
6495
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
6165
6496
|
|
|
6166
6497
|
// src/components/InspectorPrimitives.tsx
|
|
@@ -6179,7 +6510,7 @@ __export(InspectorPrimitives_exports, {
|
|
|
6179
6510
|
Title: () => Title3,
|
|
6180
6511
|
VerticalSeparator: () => VerticalSeparator
|
|
6181
6512
|
});
|
|
6182
|
-
var
|
|
6513
|
+
var import_react64 = __toESM(require("react"));
|
|
6183
6514
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
6184
6515
|
var Section = import_styled_components35.default.div(({ theme, $padding = "10px", $gap }) => ({
|
|
6185
6516
|
flex: "0 0 auto",
|
|
@@ -6226,8 +6557,8 @@ var Checkbox = import_styled_components35.default.input(({ theme }) => ({
|
|
|
6226
6557
|
var Text3 = import_styled_components35.default.span(({ theme }) => ({
|
|
6227
6558
|
...theme.textStyles.small
|
|
6228
6559
|
}));
|
|
6229
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
6230
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
6560
|
+
var VerticalSeparator = () => /* @__PURE__ */ import_react64.default.createElement(Spacer.Vertical, { size: (0, import_styled_components35.useTheme)().sizes.inspector.verticalSeparator });
|
|
6561
|
+
var HorizontalSeparator = () => /* @__PURE__ */ import_react64.default.createElement(Spacer.Horizontal, { size: (0, import_styled_components35.useTheme)().sizes.inspector.horizontalSeparator });
|
|
6231
6562
|
var SliderRowLabel = import_styled_components35.default.span(({ theme }) => ({
|
|
6232
6563
|
...theme.textStyles.small,
|
|
6233
6564
|
color: theme.colors.textMuted,
|
|
@@ -6247,7 +6578,7 @@ var RowLabel = import_styled_components35.default.span(({ theme, $textStyle }) =
|
|
|
6247
6578
|
// Button height
|
|
6248
6579
|
alignItems: "center"
|
|
6249
6580
|
}));
|
|
6250
|
-
var LabeledRow = (0,
|
|
6581
|
+
var LabeledRow = (0, import_react64.memo)(function LabeledRow2({
|
|
6251
6582
|
id,
|
|
6252
6583
|
children,
|
|
6253
6584
|
label,
|
|
@@ -6255,13 +6586,13 @@ var LabeledRow = (0, import_react60.memo)(function LabeledRow2({
|
|
|
6255
6586
|
gap,
|
|
6256
6587
|
right
|
|
6257
6588
|
}) {
|
|
6258
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ import_react64.default.createElement(Row2, { id }, /* @__PURE__ */ import_react64.default.createElement(Column, null, /* @__PURE__ */ import_react64.default.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ import_react64.default.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ import_react64.default.createElement(Row2, { $gap: gap }, children)));
|
|
6259
6590
|
});
|
|
6260
|
-
var LabeledSliderRow = (0,
|
|
6591
|
+
var LabeledSliderRow = (0, import_react64.memo)(function LabeledRow3({
|
|
6261
6592
|
children,
|
|
6262
6593
|
label
|
|
6263
6594
|
}) {
|
|
6264
|
-
return /* @__PURE__ */
|
|
6595
|
+
return /* @__PURE__ */ import_react64.default.createElement(Row2, null, /* @__PURE__ */ import_react64.default.createElement(Column, null, /* @__PURE__ */ import_react64.default.createElement(SliderRowLabel, null, label), /* @__PURE__ */ import_react64.default.createElement(Row2, null, children)));
|
|
6265
6596
|
});
|
|
6266
6597
|
|
|
6267
6598
|
// src/components/ArrayController.tsx
|
|
@@ -6274,7 +6605,7 @@ var ElementRow = import_styled_components36.default.div({
|
|
|
6274
6605
|
var ItemContainer2 = import_styled_components36.default.div({
|
|
6275
6606
|
position: "relative"
|
|
6276
6607
|
});
|
|
6277
|
-
var ArrayController = (0,
|
|
6608
|
+
var ArrayController = (0, import_react65.memo)(function ArrayController2({
|
|
6278
6609
|
id,
|
|
6279
6610
|
items,
|
|
6280
6611
|
title,
|
|
@@ -6292,12 +6623,12 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6292
6623
|
}) {
|
|
6293
6624
|
const iconColor = (0, import_styled_components36.useTheme)().colors.icon;
|
|
6294
6625
|
const primaryLightColor = (0, import_styled_components36.useTheme)().colors.primaryLight;
|
|
6295
|
-
const keys = (0,
|
|
6626
|
+
const keys = (0, import_react65.useMemo)(
|
|
6296
6627
|
() => items.map((item, index) => getKey?.(item) ?? index.toString()),
|
|
6297
6628
|
[getKey, items]
|
|
6298
6629
|
);
|
|
6299
6630
|
const indexes = reversed ? (0, import_noya_utils11.range)(0, items.length).reverse() : (0, import_noya_utils11.range)(0, items.length);
|
|
6300
|
-
const handleMoveItem = (0,
|
|
6631
|
+
const handleMoveItem = (0, import_react65.useCallback)(
|
|
6301
6632
|
(sourceIndex, destinationIndex, position) => {
|
|
6302
6633
|
if (reversed) {
|
|
6303
6634
|
if (position === "above") {
|
|
@@ -6314,11 +6645,11 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6314
6645
|
[onMoveItem, reversed]
|
|
6315
6646
|
);
|
|
6316
6647
|
const renderRow = (index) => {
|
|
6317
|
-
return /* @__PURE__ */
|
|
6648
|
+
return /* @__PURE__ */ import_react65.default.createElement(ElementRow, { key: keys[index] }, renderItem({ item: items[index], index }));
|
|
6318
6649
|
};
|
|
6319
|
-
return /* @__PURE__ */
|
|
6650
|
+
return /* @__PURE__ */ import_react65.default.createElement(Section, { id, $padding: padding, $gap: "2px" }, /* @__PURE__ */ import_react65.default.createElement(SectionHeader, null, /* @__PURE__ */ import_react65.default.createElement(Button, { variant: "none", onClick: onClickPlus }, /* @__PURE__ */ import_react65.default.createElement(Title3, null, title)), /* @__PURE__ */ import_react65.default.createElement(Spacer.Horizontal, null), withSeparatorElements(
|
|
6320
6651
|
[
|
|
6321
|
-
onClickTrash && /* @__PURE__ */
|
|
6652
|
+
onClickTrash && /* @__PURE__ */ import_react65.default.createElement(
|
|
6322
6653
|
IconButton,
|
|
6323
6654
|
{
|
|
6324
6655
|
id: `${id}-trash`,
|
|
@@ -6327,7 +6658,7 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6327
6658
|
onClick: onClickTrash
|
|
6328
6659
|
}
|
|
6329
6660
|
),
|
|
6330
|
-
onClickExpand && /* @__PURE__ */
|
|
6661
|
+
onClickExpand && /* @__PURE__ */ import_react65.default.createElement(
|
|
6331
6662
|
IconButton,
|
|
6332
6663
|
{
|
|
6333
6664
|
id: `${id}-gear`,
|
|
@@ -6336,7 +6667,7 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6336
6667
|
onClick: onClickExpand
|
|
6337
6668
|
}
|
|
6338
6669
|
),
|
|
6339
|
-
onClickPlus && /* @__PURE__ */
|
|
6670
|
+
onClickPlus && /* @__PURE__ */ import_react65.default.createElement(
|
|
6340
6671
|
IconButton,
|
|
6341
6672
|
{
|
|
6342
6673
|
id: `${id}-add`,
|
|
@@ -6346,15 +6677,15 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6346
6677
|
}
|
|
6347
6678
|
)
|
|
6348
6679
|
],
|
|
6349
|
-
/* @__PURE__ */
|
|
6350
|
-
)), /* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ import_react65.default.createElement(Spacer.Horizontal, { size: 8 })
|
|
6681
|
+
)), /* @__PURE__ */ import_react65.default.createElement(Stack.V, { gap: "4px" }, sortable ? /* @__PURE__ */ import_react65.default.createElement(
|
|
6351
6682
|
Sortable.Root,
|
|
6352
6683
|
{
|
|
6353
6684
|
keys,
|
|
6354
6685
|
renderOverlay: renderRow,
|
|
6355
6686
|
onMoveItem: handleMoveItem
|
|
6356
6687
|
},
|
|
6357
|
-
indexes.map((index) => /* @__PURE__ */
|
|
6688
|
+
indexes.map((index) => /* @__PURE__ */ import_react65.default.createElement(Sortable.Item, { id: keys[index], key: keys[index] }, ({ relativeDropPosition, ...sortableProps }) => /* @__PURE__ */ import_react65.default.createElement(ItemContainer2, { ...sortableProps }, renderRow(index), relativeDropPosition && /* @__PURE__ */ import_react65.default.createElement(
|
|
6358
6689
|
ListView.DragIndicator,
|
|
6359
6690
|
{
|
|
6360
6691
|
$gap: 0,
|
|
@@ -6368,11 +6699,11 @@ var ArrayController = (0, import_react61.memo)(function ArrayController2({
|
|
|
6368
6699
|
|
|
6369
6700
|
// src/components/DimensionInput.tsx
|
|
6370
6701
|
var import_noya_utils12 = require("@noya-app/noya-utils");
|
|
6371
|
-
var
|
|
6702
|
+
var import_react66 = __toESM(require("react"));
|
|
6372
6703
|
function getNewValue(value, mode, delta) {
|
|
6373
6704
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
6374
6705
|
}
|
|
6375
|
-
var DimensionInput = (0,
|
|
6706
|
+
var DimensionInput = (0, import_react66.memo)(function DimensionInput2({
|
|
6376
6707
|
id,
|
|
6377
6708
|
value,
|
|
6378
6709
|
onSetValue,
|
|
@@ -6382,15 +6713,15 @@ var DimensionInput = (0, import_react62.memo)(function DimensionInput2({
|
|
|
6382
6713
|
disabled,
|
|
6383
6714
|
trigger = "submit"
|
|
6384
6715
|
}) {
|
|
6385
|
-
const handleNudgeValue = (0,
|
|
6716
|
+
const handleNudgeValue = (0, import_react66.useCallback)(
|
|
6386
6717
|
(value2) => onSetValue(value2, "adjust"),
|
|
6387
6718
|
[onSetValue]
|
|
6388
6719
|
);
|
|
6389
|
-
const handleSetValue = (0,
|
|
6720
|
+
const handleSetValue = (0, import_react66.useCallback)(
|
|
6390
6721
|
(value2) => onSetValue(value2, "replace"),
|
|
6391
6722
|
[onSetValue]
|
|
6392
6723
|
);
|
|
6393
|
-
return /* @__PURE__ */
|
|
6724
|
+
return /* @__PURE__ */ import_react66.default.createElement(InputField.Root, { id, width: size2 }, /* @__PURE__ */ import_react66.default.createElement(
|
|
6394
6725
|
InputField.NumberInput,
|
|
6395
6726
|
{
|
|
6396
6727
|
value: value === void 0 ? value : (0, import_noya_utils12.round)(value, 2),
|
|
@@ -6399,7 +6730,7 @@ var DimensionInput = (0, import_react62.memo)(function DimensionInput2({
|
|
|
6399
6730
|
disabled,
|
|
6400
6731
|
...trigger === "change" ? { onChange: handleSetValue } : { onSubmit: handleSetValue }
|
|
6401
6732
|
}
|
|
6402
|
-
), label && /* @__PURE__ */
|
|
6733
|
+
), label && /* @__PURE__ */ import_react66.default.createElement(InputField.Label, null, label));
|
|
6403
6734
|
});
|
|
6404
6735
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6405
6736
|
0 && (module.exports = {
|
|
@@ -6442,6 +6773,7 @@ var DimensionInput = (0, import_react62.memo)(function DimensionInput2({
|
|
|
6442
6773
|
InputElement,
|
|
6443
6774
|
InputField,
|
|
6444
6775
|
InputFieldWithCompletions,
|
|
6776
|
+
InspectorContainer,
|
|
6445
6777
|
InspectorPrimitives,
|
|
6446
6778
|
Italic,
|
|
6447
6779
|
KeyboardShortcut,
|
|
@@ -6470,6 +6802,7 @@ var DimensionInput = (0, import_react62.memo)(function DimensionInput2({
|
|
|
6470
6802
|
ToastProvider,
|
|
6471
6803
|
Tooltip,
|
|
6472
6804
|
TreeView,
|
|
6805
|
+
WorkspaceLayout,
|
|
6473
6806
|
createSectionedMenu,
|
|
6474
6807
|
darkTheme,
|
|
6475
6808
|
fuzzyFilter,
|