@noya-app/noya-designsystem 0.1.69 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +16 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +38 -4
- package/dist/index.d.ts +38 -4
- package/dist/index.js +314 -179
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +294 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/Button.tsx +2 -1
- package/src/components/Combobox.tsx +3 -0
- package/src/components/DraggableMenuButton.tsx +5 -0
- package/src/components/InputField.tsx +20 -4
- package/src/components/ListMenu.tsx +1 -1
- package/src/components/TreeView.tsx +1 -3
- package/src/components/UserPicker.tsx +128 -0
- package/src/components/workspace/DrawerWorkspaceLayout.tsx +97 -55
- package/src/components/workspace/PanelWorkspaceLayout.tsx +12 -4
- package/src/components/workspace/WorkspaceLayout.tsx +7 -0
- package/src/components/workspace/types.ts +7 -0
- package/src/index.css +1 -1
- package/src/index.tsx +1 -0
package/dist/index.mjs
CHANGED
|
@@ -3973,7 +3973,8 @@ var variantStyles = {
|
|
|
3973
3973
|
floating: "n-bg-floating-button n-text-text n-shadow-[0_1px_2px_rgba(0,0,0,0.1)] hover:n-opacity-80 active:n-opacity-90",
|
|
3974
3974
|
thin: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
3975
3975
|
none: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
3976
|
-
ghost: "n-bg-transparent n-text-text hover:n-bg-input-background-light"
|
|
3976
|
+
ghost: "n-bg-transparent n-text-text hover:n-bg-input-background-light",
|
|
3977
|
+
link: "n-bg-transparent n-text-text hover:n-bg-input-background-light"
|
|
3977
3978
|
};
|
|
3978
3979
|
var sizeStyles = {
|
|
3979
3980
|
small: "n-px-[2px] n-font-sans n-text-[10px] n-font-medium",
|
|
@@ -4950,7 +4951,15 @@ function parseNumber(value) {
|
|
|
4950
4951
|
return value ? Number(value) : NaN;
|
|
4951
4952
|
}
|
|
4952
4953
|
function InputFieldNumberInput(props) {
|
|
4953
|
-
const {
|
|
4954
|
+
const {
|
|
4955
|
+
value,
|
|
4956
|
+
placeholder,
|
|
4957
|
+
onNudge,
|
|
4958
|
+
onBlur,
|
|
4959
|
+
readOnly,
|
|
4960
|
+
triggersOnEmpty,
|
|
4961
|
+
...rest
|
|
4962
|
+
} = props;
|
|
4954
4963
|
const onSubmit = "onSubmit" in props ? props.onSubmit : void 0;
|
|
4955
4964
|
const onChange = "onChange" in props ? props.onChange : void 0;
|
|
4956
4965
|
const [internalValue, setInternalValue] = useState15();
|
|
@@ -4978,6 +4987,9 @@ function InputFieldNumberInput(props) {
|
|
|
4978
4987
|
(value2) => {
|
|
4979
4988
|
if (value2 === "" || value2 === "-" || value2 === ".") {
|
|
4980
4989
|
setInternalValue(value2);
|
|
4990
|
+
if (triggersOnEmpty) {
|
|
4991
|
+
onChange?.(0, { isEmpty: true });
|
|
4992
|
+
}
|
|
4981
4993
|
return;
|
|
4982
4994
|
}
|
|
4983
4995
|
if (value2.endsWith(".")) {
|
|
@@ -4987,10 +4999,10 @@ function InputFieldNumberInput(props) {
|
|
|
4987
4999
|
setInternalValue(void 0);
|
|
4988
5000
|
const newValue = parseNumber(value2);
|
|
4989
5001
|
if (!isNaN(newValue)) {
|
|
4990
|
-
onChange?.(newValue);
|
|
5002
|
+
onChange?.(newValue, { isEmpty: false });
|
|
4991
5003
|
}
|
|
4992
5004
|
},
|
|
4993
|
-
[onChange]
|
|
5005
|
+
[onChange, triggersOnEmpty]
|
|
4994
5006
|
);
|
|
4995
5007
|
const handleBlur = useCallback13(
|
|
4996
5008
|
(event) => {
|
|
@@ -9781,7 +9793,7 @@ var TreeRow = forwardRefGeneric(function TreeRow2({
|
|
|
9781
9793
|
onClick: handleClickChevron,
|
|
9782
9794
|
selected: rest.selected
|
|
9783
9795
|
}
|
|
9784
|
-
), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React59.createElement(React59.Fragment, null, renderIcon(icon), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 10 })), children, expandable && chevronPosition === "end" && /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 }), expanded === void 0 ? /* @__PURE__ */ React59.createElement(React59.Fragment, null
|
|
9796
|
+
), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 })), icon && /* @__PURE__ */ React59.createElement(React59.Fragment, null, renderIcon(icon), /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 10 })), children, expandable && chevronPosition === "end" && /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(Spacer.Horizontal, { size: 6 }), expanded === void 0 ? /* @__PURE__ */ React59.createElement(React59.Fragment, null) : /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(
|
|
9785
9797
|
IconButton,
|
|
9786
9798
|
{
|
|
9787
9799
|
as: chevronAs,
|
|
@@ -10919,6 +10931,7 @@ var Combobox = memoGeneric(
|
|
|
10919
10931
|
openMenuBehavior = "showFilteredItems",
|
|
10920
10932
|
onFocus,
|
|
10921
10933
|
onDeleteWhenEmpty,
|
|
10934
|
+
iconPosition = "right",
|
|
10922
10935
|
...rest
|
|
10923
10936
|
}, forwardedRef) {
|
|
10924
10937
|
const props = useMemo27(() => {
|
|
@@ -11259,6 +11272,7 @@ var Combobox = memoGeneric(
|
|
|
11259
11272
|
onSelectItem: handleUpdateSelection,
|
|
11260
11273
|
onHoverIndex: handleIndexChange,
|
|
11261
11274
|
listSize: adjustedListSize,
|
|
11275
|
+
iconPosition,
|
|
11262
11276
|
style: {
|
|
11263
11277
|
flex: `0 0 ${computedHeight}px`
|
|
11264
11278
|
},
|
|
@@ -11580,6 +11594,9 @@ var DraggableMenuButton = memoGeneric(function DraggableMenuButton2({
|
|
|
11580
11594
|
(event) => {
|
|
11581
11595
|
if (open || !downPosition) {
|
|
11582
11596
|
setDownPosition(null);
|
|
11597
|
+
if (open && event.target === event.currentTarget) {
|
|
11598
|
+
setOpen(false);
|
|
11599
|
+
}
|
|
11583
11600
|
return;
|
|
11584
11601
|
}
|
|
11585
11602
|
const dx = event.clientX - downPosition.x;
|
|
@@ -15013,7 +15030,7 @@ function ListMenu({
|
|
|
15013
15030
|
}) {
|
|
15014
15031
|
const selectedIds = items.flatMap(
|
|
15015
15032
|
(item) => isSelectableMenuItem(item) && item.checked ? [item.value] : []
|
|
15016
|
-
).concat(selectedIdsProp);
|
|
15033
|
+
).concat(selectedIdsProp ?? []);
|
|
15017
15034
|
let chunks = chunkBy2(
|
|
15018
15035
|
items,
|
|
15019
15036
|
(a, b) => a.type !== "separator" && b.type !== "separator"
|
|
@@ -16818,8 +16835,97 @@ function Tabs({
|
|
|
16818
16835
|
)), /* @__PURE__ */ React101.createElement(Divider, null), renderContent({ value: activeTab }));
|
|
16819
16836
|
}
|
|
16820
16837
|
|
|
16838
|
+
// src/components/UserPicker.tsx
|
|
16839
|
+
import React102, { useCallback as useCallback37, useMemo as useMemo43, useState as useState34 } from "react";
|
|
16840
|
+
function UserPicker({
|
|
16841
|
+
users,
|
|
16842
|
+
value,
|
|
16843
|
+
defaultValue: defaultValue2,
|
|
16844
|
+
onChangeUserId,
|
|
16845
|
+
onSelectUser,
|
|
16846
|
+
placeholder = "Search users...",
|
|
16847
|
+
...rest
|
|
16848
|
+
}) {
|
|
16849
|
+
const sortedUsers = useMemo43(() => {
|
|
16850
|
+
return [...users].sort(
|
|
16851
|
+
(a, b) => getUserDisplayName(a).localeCompare(getUserDisplayName(b), void 0, {
|
|
16852
|
+
sensitivity: "base"
|
|
16853
|
+
})
|
|
16854
|
+
);
|
|
16855
|
+
}, [users]);
|
|
16856
|
+
const usersById = useMemo43(() => {
|
|
16857
|
+
return new Map(sortedUsers.map((user) => [user.id, user]));
|
|
16858
|
+
}, [sortedUsers]);
|
|
16859
|
+
const items = useMemo43(() => {
|
|
16860
|
+
return sortedUsers.map(createUserMenuItem);
|
|
16861
|
+
}, [sortedUsers]);
|
|
16862
|
+
const isControlled = value !== void 0;
|
|
16863
|
+
const [uncontrolledValue, setUncontrolledValue] = useState34(defaultValue2);
|
|
16864
|
+
const selectedUserId = isControlled ? value : uncontrolledValue;
|
|
16865
|
+
const selectedItem = useMemo43(() => {
|
|
16866
|
+
if (!selectedUserId) return void 0;
|
|
16867
|
+
return items.find((item) => item.value === selectedUserId);
|
|
16868
|
+
}, [items, selectedUserId]);
|
|
16869
|
+
const updateSelectedUserId = useCallback37(
|
|
16870
|
+
(userId) => {
|
|
16871
|
+
if (!isControlled) {
|
|
16872
|
+
setUncontrolledValue(userId);
|
|
16873
|
+
}
|
|
16874
|
+
onChangeUserId?.(userId);
|
|
16875
|
+
},
|
|
16876
|
+
[isControlled, onChangeUserId]
|
|
16877
|
+
);
|
|
16878
|
+
const handleSelectItem = useCallback37(
|
|
16879
|
+
(item) => {
|
|
16880
|
+
updateSelectedUserId(item.value);
|
|
16881
|
+
onSelectUser?.(usersById.get(item.value));
|
|
16882
|
+
},
|
|
16883
|
+
[updateSelectedUserId, onSelectUser, usersById]
|
|
16884
|
+
);
|
|
16885
|
+
return /* @__PURE__ */ React102.createElement(
|
|
16886
|
+
Combobox,
|
|
16887
|
+
{
|
|
16888
|
+
...rest,
|
|
16889
|
+
placeholder,
|
|
16890
|
+
mode: "option",
|
|
16891
|
+
items,
|
|
16892
|
+
value: selectedItem,
|
|
16893
|
+
onSelectItem: handleSelectItem,
|
|
16894
|
+
iconPosition: "left"
|
|
16895
|
+
}
|
|
16896
|
+
);
|
|
16897
|
+
}
|
|
16898
|
+
function getUserDisplayName(user) {
|
|
16899
|
+
const name = user.name?.trim();
|
|
16900
|
+
const email = user.email?.trim();
|
|
16901
|
+
return name || email || "Anonymous user";
|
|
16902
|
+
}
|
|
16903
|
+
function createUserMenuItem(user) {
|
|
16904
|
+
const title = getUserDisplayName(user);
|
|
16905
|
+
const overflow = 3;
|
|
16906
|
+
return {
|
|
16907
|
+
value: user.id,
|
|
16908
|
+
title,
|
|
16909
|
+
icon: /* @__PURE__ */ React102.createElement("div", { className: "n-relative n-w-[15px] n-h-[15px]" }, /* @__PURE__ */ React102.createElement(
|
|
16910
|
+
Avatar,
|
|
16911
|
+
{
|
|
16912
|
+
size: 15 + overflow * 2,
|
|
16913
|
+
name: title,
|
|
16914
|
+
userId: user.id,
|
|
16915
|
+
image: user.image ?? void 0,
|
|
16916
|
+
className: "n-pointer-events-none",
|
|
16917
|
+
variant: "bare",
|
|
16918
|
+
style: {
|
|
16919
|
+
position: "absolute",
|
|
16920
|
+
inset: -overflow
|
|
16921
|
+
}
|
|
16922
|
+
}
|
|
16923
|
+
))
|
|
16924
|
+
};
|
|
16925
|
+
}
|
|
16926
|
+
|
|
16821
16927
|
// src/components/UserPointer.tsx
|
|
16822
|
-
import
|
|
16928
|
+
import React103, { memo as memo35, useMemo as useMemo44 } from "react";
|
|
16823
16929
|
var UserPointerContainer = memo35(function UserPointerContainer2({
|
|
16824
16930
|
point,
|
|
16825
16931
|
visible,
|
|
@@ -16827,7 +16933,7 @@ var UserPointerContainer = memo35(function UserPointerContainer2({
|
|
|
16827
16933
|
className,
|
|
16828
16934
|
style: style2
|
|
16829
16935
|
}) {
|
|
16830
|
-
return /* @__PURE__ */
|
|
16936
|
+
return /* @__PURE__ */ React103.createElement(
|
|
16831
16937
|
"div",
|
|
16832
16938
|
{
|
|
16833
16939
|
style: {
|
|
@@ -16853,7 +16959,7 @@ var UserNameTag = memo35(function UserNameTag2({
|
|
|
16853
16959
|
size = "medium",
|
|
16854
16960
|
bordered = true
|
|
16855
16961
|
}) {
|
|
16856
|
-
return /* @__PURE__ */
|
|
16962
|
+
return /* @__PURE__ */ React103.createElement(
|
|
16857
16963
|
"span",
|
|
16858
16964
|
{
|
|
16859
16965
|
className: cx(
|
|
@@ -16879,7 +16985,7 @@ var UserPointerIcon = memo35(function PointerIcon({
|
|
|
16879
16985
|
style: style2
|
|
16880
16986
|
}) {
|
|
16881
16987
|
const points = "0,5 10,0 10,10";
|
|
16882
|
-
return /* @__PURE__ */
|
|
16988
|
+
return /* @__PURE__ */ React103.createElement(
|
|
16883
16989
|
"svg",
|
|
16884
16990
|
{
|
|
16885
16991
|
width: size,
|
|
@@ -16894,7 +17000,7 @@ var UserPointerIcon = memo35(function PointerIcon({
|
|
|
16894
17000
|
...style2
|
|
16895
17001
|
}
|
|
16896
17002
|
},
|
|
16897
|
-
/* @__PURE__ */
|
|
17003
|
+
/* @__PURE__ */ React103.createElement(
|
|
16898
17004
|
"polygon",
|
|
16899
17005
|
{
|
|
16900
17006
|
points,
|
|
@@ -16920,22 +17026,22 @@ var UserPointer = memo35(function UserPointer2({
|
|
|
16920
17026
|
labelSize = "medium",
|
|
16921
17027
|
bordered = true
|
|
16922
17028
|
}) {
|
|
16923
|
-
const userBackgroundColor =
|
|
17029
|
+
const userBackgroundColor = useMemo44(
|
|
16924
17030
|
() => backgroundColor ?? colorFromString(userId ?? name ?? ""),
|
|
16925
17031
|
[backgroundColor, userId, name]
|
|
16926
17032
|
);
|
|
16927
|
-
const pointerOverlapStyle =
|
|
17033
|
+
const pointerOverlapStyle = useMemo44(
|
|
16928
17034
|
() => ({
|
|
16929
17035
|
marginRight: `-${POINTER_OVERLAP}px`,
|
|
16930
17036
|
marginBottom: `-${POINTER_OVERLAP}px`
|
|
16931
17037
|
}),
|
|
16932
17038
|
[]
|
|
16933
17039
|
);
|
|
16934
|
-
const nameTagOverlapStyle =
|
|
17040
|
+
const nameTagOverlapStyle = useMemo44(
|
|
16935
17041
|
() => ({ marginLeft: `${POINTER_SIZE - POINTER_OVERLAP + 1}px` }),
|
|
16936
17042
|
[]
|
|
16937
17043
|
);
|
|
16938
|
-
return /* @__PURE__ */
|
|
17044
|
+
return /* @__PURE__ */ React103.createElement(
|
|
16939
17045
|
UserPointerContainer,
|
|
16940
17046
|
{
|
|
16941
17047
|
point,
|
|
@@ -16943,14 +17049,14 @@ var UserPointer = memo35(function UserPointer2({
|
|
|
16943
17049
|
className,
|
|
16944
17050
|
style: style2
|
|
16945
17051
|
},
|
|
16946
|
-
name && /* @__PURE__ */
|
|
17052
|
+
name && /* @__PURE__ */ React103.createElement("div", { className: "n-relative" }, showPointerIcon && /* @__PURE__ */ React103.createElement(
|
|
16947
17053
|
UserPointerIcon,
|
|
16948
17054
|
{
|
|
16949
17055
|
size: POINTER_SIZE,
|
|
16950
17056
|
color: userBackgroundColor,
|
|
16951
17057
|
style: pointerOverlapStyle
|
|
16952
17058
|
}
|
|
16953
|
-
), /* @__PURE__ */
|
|
17059
|
+
), /* @__PURE__ */ React103.createElement(
|
|
16954
17060
|
UserNameTag,
|
|
16955
17061
|
{
|
|
16956
17062
|
backgroundColor: userBackgroundColor,
|
|
@@ -16966,16 +17072,16 @@ var UserPointer = memo35(function UserPointer2({
|
|
|
16966
17072
|
|
|
16967
17073
|
// src/components/workspace/WorkspaceLayout.tsx
|
|
16968
17074
|
import { useKeyboardShortcuts as useKeyboardShortcuts4 } from "@noya-app/noya-keymap";
|
|
16969
|
-
import
|
|
17075
|
+
import React109, {
|
|
16970
17076
|
memo as memo37,
|
|
16971
|
-
useCallback as
|
|
17077
|
+
useCallback as useCallback39,
|
|
16972
17078
|
useImperativeHandle as useImperativeHandle9,
|
|
16973
|
-
useMemo as
|
|
17079
|
+
useMemo as useMemo48,
|
|
16974
17080
|
useRef as useRef30
|
|
16975
17081
|
} from "react";
|
|
16976
17082
|
|
|
16977
17083
|
// src/components/workspace/DrawerWorkspaceLayout.tsx
|
|
16978
|
-
import
|
|
17084
|
+
import React107, { useMemo as useMemo46, useRef as useRef28, useState as useState35 } from "react";
|
|
16979
17085
|
|
|
16980
17086
|
// src/components/workspace/constants.ts
|
|
16981
17087
|
var EDITOR_PANEL_GROUP_ID = "editor-panel-group";
|
|
@@ -16984,20 +17090,20 @@ var RIGHT_SIDEBAR_ID = "editor-3-right-sidebar";
|
|
|
16984
17090
|
var CONTENT_AREA_ID = "editor-2-content-area";
|
|
16985
17091
|
|
|
16986
17092
|
// src/components/workspace/VerticalTabMenu.tsx
|
|
16987
|
-
import
|
|
17093
|
+
import React106, { useMemo as useMemo45 } from "react";
|
|
16988
17094
|
|
|
16989
17095
|
// src/components/Toolbar.tsx
|
|
16990
17096
|
import { useKeyboardShortcuts as useKeyboardShortcuts3 } from "@noya-app/noya-keymap";
|
|
16991
|
-
import
|
|
17097
|
+
import React105, {
|
|
16992
17098
|
createContext as createContext15,
|
|
16993
17099
|
useContext as useContext16
|
|
16994
17100
|
} from "react";
|
|
16995
17101
|
|
|
16996
17102
|
// src/components/ToolbarDrawer.tsx
|
|
16997
|
-
import
|
|
17103
|
+
import React104, { forwardRef as forwardRef28, memo as memo36 } from "react";
|
|
16998
17104
|
var ToolbarDrawer = memo36(
|
|
16999
17105
|
forwardRef28(function ToolbarDrawer2({ children, trigger, sideOffset = 8 }, ref) {
|
|
17000
|
-
return /* @__PURE__ */
|
|
17106
|
+
return /* @__PURE__ */ React104.createElement("div", { className: "n-relative", ref }, /* @__PURE__ */ React104.createElement(
|
|
17001
17107
|
"div",
|
|
17002
17108
|
{
|
|
17003
17109
|
className: "n-absolute n-bottom-full n-left-1/2 -n-translate-x-1/2 n-rounded-t-lg n-border n-border-toolbar-drawer-border n-border-b-transparent n-bg-toolbar-drawer-background -n-z-10",
|
|
@@ -17018,8 +17124,8 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
17018
17124
|
item,
|
|
17019
17125
|
onSelectMenuItem
|
|
17020
17126
|
}) {
|
|
17021
|
-
const [open, setOpen] =
|
|
17022
|
-
return /* @__PURE__ */
|
|
17127
|
+
const [open, setOpen] = React105.useState(false);
|
|
17128
|
+
return /* @__PURE__ */ React105.createElement(
|
|
17023
17129
|
DropdownMenu,
|
|
17024
17130
|
{
|
|
17025
17131
|
open,
|
|
@@ -17031,7 +17137,7 @@ var ToolbarMenuDropdown = memoGeneric(function ToolbarMenuDropdown2({
|
|
|
17031
17137
|
}
|
|
17032
17138
|
}
|
|
17033
17139
|
},
|
|
17034
|
-
/* @__PURE__ */
|
|
17140
|
+
/* @__PURE__ */ React105.createElement(
|
|
17035
17141
|
Button,
|
|
17036
17142
|
{
|
|
17037
17143
|
disabled: item.disabled,
|
|
@@ -17047,7 +17153,7 @@ var ToolbarShortcut = ({
|
|
|
17047
17153
|
shortcut,
|
|
17048
17154
|
label
|
|
17049
17155
|
}) => {
|
|
17050
|
-
return /* @__PURE__ */
|
|
17156
|
+
return /* @__PURE__ */ React105.createElement("div", { className: "n-flex n-items-center" }, label, /* @__PURE__ */ React105.createElement(Spacer.Horizontal, { size: 6 }), /* @__PURE__ */ React105.createElement(KeyboardShortcut, { shortcut }));
|
|
17051
17157
|
};
|
|
17052
17158
|
var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
17053
17159
|
item,
|
|
@@ -17061,8 +17167,8 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
17061
17167
|
content: itemContent,
|
|
17062
17168
|
checked
|
|
17063
17169
|
} = item;
|
|
17064
|
-
const [open, setOpen] =
|
|
17065
|
-
const content = /* @__PURE__ */
|
|
17170
|
+
const [open, setOpen] = React105.useState(false);
|
|
17171
|
+
const content = /* @__PURE__ */ React105.createElement("span", null, /* @__PURE__ */ React105.createElement(
|
|
17066
17172
|
Popover,
|
|
17067
17173
|
{
|
|
17068
17174
|
open,
|
|
@@ -17071,7 +17177,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
17071
17177
|
showArrow: false,
|
|
17072
17178
|
sideOffset: SIDE_OFFSET,
|
|
17073
17179
|
portalContainer,
|
|
17074
|
-
trigger: /* @__PURE__ */
|
|
17180
|
+
trigger: /* @__PURE__ */ React105.createElement(
|
|
17075
17181
|
Button,
|
|
17076
17182
|
{
|
|
17077
17183
|
disabled,
|
|
@@ -17084,7 +17190,7 @@ var ToolbarMenuPopover = memoGeneric(function ToolbarMenuPopover2({
|
|
|
17084
17190
|
},
|
|
17085
17191
|
typeof itemContent === "function" ? itemContent({ close: () => setOpen(false) }) : itemContent
|
|
17086
17192
|
));
|
|
17087
|
-
return tooltip && !open ? /* @__PURE__ */
|
|
17193
|
+
return tooltip && !open ? /* @__PURE__ */ React105.createElement(
|
|
17088
17194
|
Tooltip,
|
|
17089
17195
|
{
|
|
17090
17196
|
sideOffset: SIDE_OFFSET,
|
|
@@ -17104,7 +17210,7 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
17104
17210
|
displayFilter
|
|
17105
17211
|
}) {
|
|
17106
17212
|
const isActive = item.checked || activeValue === item.value;
|
|
17107
|
-
const content = /* @__PURE__ */
|
|
17213
|
+
const content = /* @__PURE__ */ React105.createElement(
|
|
17108
17214
|
Button,
|
|
17109
17215
|
{
|
|
17110
17216
|
as,
|
|
@@ -17121,7 +17227,7 @@ var ToolbarMenuButton = memoGeneric(function ToolbarMenuButton2({
|
|
|
17121
17227
|
displayFilter === "iconOnly" ? void 0 : item.title
|
|
17122
17228
|
);
|
|
17123
17229
|
const tooltip = item.tooltip ?? (displayFilter === "iconOnly" && item.title ? item.title : void 0);
|
|
17124
|
-
return item.drawer && isActive ? /* @__PURE__ */
|
|
17230
|
+
return item.drawer && isActive ? /* @__PURE__ */ React105.createElement(ToolbarDrawer, { trigger: content }, item.drawer) : tooltip ? /* @__PURE__ */ React105.createElement(Tooltip, { sideOffset: SIDE_OFFSET, content: tooltip, side: tooltipSide }, content) : content;
|
|
17125
17231
|
});
|
|
17126
17232
|
var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
17127
17233
|
item,
|
|
@@ -17137,13 +17243,13 @@ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
|
17137
17243
|
const dividerOverflow = dividerOverflowProp ?? contextDividerOverflow ?? 4;
|
|
17138
17244
|
if (item.type === "sectionHeader") return null;
|
|
17139
17245
|
if (item.type === "separator") {
|
|
17140
|
-
return /* @__PURE__ */
|
|
17246
|
+
return /* @__PURE__ */ React105.createElement(DividerVertical, { overflow: dividerOverflow });
|
|
17141
17247
|
}
|
|
17142
17248
|
if (item.type === "popover") {
|
|
17143
|
-
return /* @__PURE__ */
|
|
17249
|
+
return /* @__PURE__ */ React105.createElement(ToolbarMenuPopover, { item, portalContainer });
|
|
17144
17250
|
}
|
|
17145
17251
|
if (isSelectableMenuItem(item)) {
|
|
17146
|
-
return /* @__PURE__ */
|
|
17252
|
+
return /* @__PURE__ */ React105.createElement(
|
|
17147
17253
|
ToolbarMenuButton,
|
|
17148
17254
|
{
|
|
17149
17255
|
item,
|
|
@@ -17155,7 +17261,7 @@ var ToolbarMenuItem = memoGeneric(function ToolbarMenuItem2({
|
|
|
17155
17261
|
}
|
|
17156
17262
|
);
|
|
17157
17263
|
}
|
|
17158
|
-
return /* @__PURE__ */
|
|
17264
|
+
return /* @__PURE__ */ React105.createElement(ToolbarMenuDropdown, { item, onSelectMenuItem });
|
|
17159
17265
|
});
|
|
17160
17266
|
var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
17161
17267
|
items,
|
|
@@ -17167,8 +17273,8 @@ var ToolbarMenu = memoGeneric(function ToolbarMenu2({
|
|
|
17167
17273
|
displayFilter = "iconAndText",
|
|
17168
17274
|
dividerOverflow
|
|
17169
17275
|
}) {
|
|
17170
|
-
return /* @__PURE__ */
|
|
17171
|
-
return /* @__PURE__ */
|
|
17276
|
+
return /* @__PURE__ */ React105.createElement(React105.Fragment, null, items.map((item, i) => {
|
|
17277
|
+
return /* @__PURE__ */ React105.createElement(
|
|
17172
17278
|
ToolbarMenuItem,
|
|
17173
17279
|
{
|
|
17174
17280
|
key: i,
|
|
@@ -17193,21 +17299,21 @@ function Toolbar({
|
|
|
17193
17299
|
shouldBindKeyboardShortcuts = true,
|
|
17194
17300
|
dividerOverflow
|
|
17195
17301
|
}) {
|
|
17196
|
-
const allMenuItems =
|
|
17302
|
+
const allMenuItems = React105.useMemo(
|
|
17197
17303
|
() => [...leftMenuItems, ...rightMenuItems],
|
|
17198
17304
|
[leftMenuItems, rightMenuItems]
|
|
17199
17305
|
);
|
|
17200
17306
|
useKeyboardShortcuts3(
|
|
17201
|
-
|
|
17307
|
+
React105.useMemo(
|
|
17202
17308
|
() => onSelectMenuItem && shouldBindKeyboardShortcuts ? getKeyboardShortcutsForMenuItems(allMenuItems, onSelectMenuItem) : {},
|
|
17203
17309
|
[allMenuItems, onSelectMenuItem, shouldBindKeyboardShortcuts]
|
|
17204
17310
|
)
|
|
17205
17311
|
);
|
|
17206
|
-
return /* @__PURE__ */
|
|
17312
|
+
return /* @__PURE__ */ React105.createElement(
|
|
17207
17313
|
BaseToolbar,
|
|
17208
17314
|
{
|
|
17209
17315
|
logo,
|
|
17210
|
-
left: leftMenuItems.length > 0 && /* @__PURE__ */
|
|
17316
|
+
left: leftMenuItems.length > 0 && /* @__PURE__ */ React105.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ React105.createElement(
|
|
17211
17317
|
ToolbarMenu,
|
|
17212
17318
|
{
|
|
17213
17319
|
items: leftMenuItems,
|
|
@@ -17215,7 +17321,7 @@ function Toolbar({
|
|
|
17215
17321
|
dividerOverflow
|
|
17216
17322
|
}
|
|
17217
17323
|
)),
|
|
17218
|
-
right: rightMenuItems.length > 0 && /* @__PURE__ */
|
|
17324
|
+
right: rightMenuItems.length > 0 && /* @__PURE__ */ React105.createElement("div", { className: "n-flex n-gap-2" }, /* @__PURE__ */ React105.createElement(
|
|
17219
17325
|
ToolbarMenu,
|
|
17220
17326
|
{
|
|
17221
17327
|
items: rightMenuItems,
|
|
@@ -17236,19 +17342,19 @@ var VerticalTabMenu = memoGeneric(function VerticalTabMenu2({
|
|
|
17236
17342
|
onChange,
|
|
17237
17343
|
tooltipSide
|
|
17238
17344
|
}) {
|
|
17239
|
-
const style2 =
|
|
17345
|
+
const style2 = useMemo45(() => {
|
|
17240
17346
|
return {
|
|
17241
17347
|
[cssVarNames.colors.inputBackground]: "transparent",
|
|
17242
17348
|
[cssVarNames.colors.buttonBackground]: "transparent"
|
|
17243
17349
|
};
|
|
17244
17350
|
}, []);
|
|
17245
|
-
return /* @__PURE__ */
|
|
17351
|
+
return /* @__PURE__ */ React106.createElement(
|
|
17246
17352
|
"div",
|
|
17247
17353
|
{
|
|
17248
17354
|
className: "n-w-[calc(var(--n-toolbar-height)+1px)] n-h-full n-bg-sidebar-background n-flex n-flex-col n-items-center n-py-3 n-gap-3",
|
|
17249
17355
|
style: style2
|
|
17250
17356
|
},
|
|
17251
|
-
/* @__PURE__ */
|
|
17357
|
+
/* @__PURE__ */ React106.createElement(
|
|
17252
17358
|
ToolbarMenu,
|
|
17253
17359
|
{
|
|
17254
17360
|
items,
|
|
@@ -17273,14 +17379,15 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
17273
17379
|
rightTabItems,
|
|
17274
17380
|
rightTabValue,
|
|
17275
17381
|
onChangeRightTab,
|
|
17276
|
-
onChangeLeftTab
|
|
17382
|
+
onChangeLeftTab,
|
|
17383
|
+
compactDrawerMenu
|
|
17277
17384
|
}) {
|
|
17278
17385
|
const portalContainer = useRef28(null);
|
|
17279
|
-
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] =
|
|
17386
|
+
const [{ leftSidebarCollapsed, rightSidebarCollapsed }, setLayoutState] = useState35({
|
|
17280
17387
|
leftSidebarCollapsed: true,
|
|
17281
17388
|
rightSidebarCollapsed: true
|
|
17282
17389
|
});
|
|
17283
|
-
const allTabItems =
|
|
17390
|
+
const allTabItems = useMemo46(
|
|
17284
17391
|
() => [
|
|
17285
17392
|
...leftPanel ? leftTabItems ?? [] : [],
|
|
17286
17393
|
...rightPanel ? rightTabItems ?? [] : []
|
|
@@ -17288,77 +17395,100 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
17288
17395
|
[leftTabItems, rightTabItems, leftPanel, rightPanel]
|
|
17289
17396
|
);
|
|
17290
17397
|
const hasTabs = allTabItems.length > 0;
|
|
17291
|
-
const
|
|
17398
|
+
const allSelectableTabItems = useMemo46(
|
|
17399
|
+
() => allTabItems.filter(isSelectableMenuItem),
|
|
17400
|
+
[allTabItems]
|
|
17401
|
+
);
|
|
17402
|
+
const useCompactInToolbar = !!compactDrawerMenu && allSelectableTabItems.length <= 1;
|
|
17403
|
+
const leftSelectableTabItems = useMemo46(
|
|
17292
17404
|
() => (leftTabItems ?? []).filter(isSelectableMenuItem),
|
|
17293
17405
|
[leftTabItems]
|
|
17294
17406
|
);
|
|
17295
|
-
const rightSelectableTabItems =
|
|
17407
|
+
const rightSelectableTabItems = useMemo46(
|
|
17296
17408
|
() => (rightTabItems ?? []).filter(isSelectableMenuItem),
|
|
17297
17409
|
[rightTabItems]
|
|
17298
17410
|
);
|
|
17411
|
+
const toggleSidebar = (ref) => {
|
|
17412
|
+
if (ref.current?.isExpanded()) {
|
|
17413
|
+
ref.current?.collapse();
|
|
17414
|
+
} else {
|
|
17415
|
+
ref.current?.expand();
|
|
17416
|
+
}
|
|
17417
|
+
};
|
|
17418
|
+
const ensureExpanded = (ref) => {
|
|
17419
|
+
if (!ref.current?.isExpanded()) {
|
|
17420
|
+
ref.current?.expand();
|
|
17421
|
+
}
|
|
17422
|
+
};
|
|
17423
|
+
const handleSelectTab = (value) => {
|
|
17424
|
+
if (leftSelectableTabItems.some((item) => item.value === value)) {
|
|
17425
|
+
if (value === leftTabValue) {
|
|
17426
|
+
toggleSidebar(leftSidebarRef);
|
|
17427
|
+
} else {
|
|
17428
|
+
ensureExpanded(leftSidebarRef);
|
|
17429
|
+
onChangeLeftTab?.(value);
|
|
17430
|
+
}
|
|
17431
|
+
} else if (rightSelectableTabItems.some((item) => item.value === value)) {
|
|
17432
|
+
if (value === rightTabValue) {
|
|
17433
|
+
toggleSidebar(rightSidebarRef);
|
|
17434
|
+
} else {
|
|
17435
|
+
ensureExpanded(rightSidebarRef);
|
|
17436
|
+
onChangeRightTab?.(value);
|
|
17437
|
+
}
|
|
17438
|
+
}
|
|
17439
|
+
};
|
|
17299
17440
|
const { activeValue, isSidebarCollapsed } = leftSelectableTabItems.length > 0 && !leftSidebarCollapsed ? { activeValue: leftTabValue, isSidebarCollapsed: leftSidebarCollapsed } : rightSelectableTabItems.length > 0 && !rightSidebarCollapsed ? {
|
|
17300
17441
|
activeValue: rightTabValue,
|
|
17301
17442
|
isSidebarCollapsed: rightSidebarCollapsed
|
|
17302
17443
|
} : { activeValue: void 0, isSidebarCollapsed: true };
|
|
17303
|
-
return /* @__PURE__ */
|
|
17444
|
+
return /* @__PURE__ */ React107.createElement(
|
|
17304
17445
|
"div",
|
|
17305
17446
|
{
|
|
17306
17447
|
ref: portalContainer,
|
|
17307
17448
|
id: EDITOR_PANEL_GROUP_ID,
|
|
17308
17449
|
className: "n-flex n-flex-1 n-relative focus:n-outline-none"
|
|
17309
17450
|
},
|
|
17310
|
-
hasTabs && /* @__PURE__ */
|
|
17451
|
+
hasTabs && !useCompactInToolbar && /* @__PURE__ */ React107.createElement(React107.Fragment, null, /* @__PURE__ */ React107.createElement(
|
|
17311
17452
|
VerticalTabMenu,
|
|
17312
17453
|
{
|
|
17313
17454
|
tooltipSide: "right",
|
|
17314
17455
|
items: allTabItems,
|
|
17315
17456
|
activeValue,
|
|
17316
17457
|
isSidebarCollapsed,
|
|
17317
|
-
onChange: (value) =>
|
|
17318
|
-
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
rightSidebarRef.current?.expand();
|
|
17341
|
-
}
|
|
17342
|
-
onChangeRightTab?.(value);
|
|
17343
|
-
}
|
|
17344
|
-
}
|
|
17458
|
+
onChange: (value) => handleSelectTab(value)
|
|
17459
|
+
}
|
|
17460
|
+
), /* @__PURE__ */ React107.createElement(DividerVertical, { className: "n-h-full" })),
|
|
17461
|
+
useCompactInToolbar && /* @__PURE__ */ React107.createElement("div", { className: "n-absolute n-top-0 n-left-0 n-h-[calc(var(--n-toolbar-height)+1px)] n-w-[calc(var(--n-toolbar-height)+1px)] n-bg-sidebar-background n-border-r n-border-b n-border-divider-strong n-z-10 n-flex n-items-center n-justify-center" }, allSelectableTabItems[0] && /* @__PURE__ */ React107.createElement(
|
|
17462
|
+
Button,
|
|
17463
|
+
{
|
|
17464
|
+
variant: "none",
|
|
17465
|
+
className: "n-rounded",
|
|
17466
|
+
style: {
|
|
17467
|
+
width: "var(--n-input-height)",
|
|
17468
|
+
height: "var(--n-input-height)"
|
|
17469
|
+
},
|
|
17470
|
+
icon: allSelectableTabItems[0].icon,
|
|
17471
|
+
tooltip: allSelectableTabItems[0].tooltip ?? allSelectableTabItems[0].title,
|
|
17472
|
+
active: (() => {
|
|
17473
|
+
const value = allSelectableTabItems[0].value;
|
|
17474
|
+
const isLeftItem = leftSelectableTabItems.some((i) => i.value === value);
|
|
17475
|
+
const isRightItem = rightSelectableTabItems.some((i) => i.value === value);
|
|
17476
|
+
return isLeftItem ? !leftSidebarCollapsed : isRightItem ? !rightSidebarCollapsed : false;
|
|
17477
|
+
})(),
|
|
17478
|
+
onClick: () => {
|
|
17479
|
+
const value = allSelectableTabItems[0].value;
|
|
17480
|
+
handleSelectTab(value);
|
|
17345
17481
|
}
|
|
17346
17482
|
}
|
|
17347
|
-
),
|
|
17348
|
-
|
|
17349
|
-
/* @__PURE__ */
|
|
17350
|
-
leftPanel && /* @__PURE__ */ React106.createElement(
|
|
17483
|
+
)),
|
|
17484
|
+
/* @__PURE__ */ React107.createElement("div", { className: "n-flex-1 n-flex n-relative" }, centerPanel),
|
|
17485
|
+
leftPanel && /* @__PURE__ */ React107.createElement(
|
|
17351
17486
|
Drawer,
|
|
17352
17487
|
{
|
|
17353
17488
|
ref: leftSidebarRef,
|
|
17354
17489
|
className: "n-flex-1",
|
|
17355
|
-
style: {
|
|
17356
|
-
|
|
17357
|
-
maxWidth: "calc(100% - 48px)"
|
|
17358
|
-
},
|
|
17359
|
-
overlayStyle: {
|
|
17360
|
-
left: 48
|
|
17361
|
-
},
|
|
17490
|
+
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
17491
|
+
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
17362
17492
|
open: !leftSidebarCollapsed,
|
|
17363
17493
|
positioning: "absolute",
|
|
17364
17494
|
side: "left",
|
|
@@ -17373,19 +17503,14 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
17373
17503
|
},
|
|
17374
17504
|
leftPanel
|
|
17375
17505
|
),
|
|
17376
|
-
rightPanel && /* @__PURE__ */
|
|
17506
|
+
rightPanel && /* @__PURE__ */ React107.createElement(
|
|
17377
17507
|
Drawer,
|
|
17378
17508
|
{
|
|
17379
17509
|
id: RIGHT_SIDEBAR_ID,
|
|
17380
17510
|
ref: rightSidebarRef,
|
|
17381
17511
|
className: "n-flex-1",
|
|
17382
|
-
style: {
|
|
17383
|
-
|
|
17384
|
-
maxWidth: "calc(100% - 48px)"
|
|
17385
|
-
},
|
|
17386
|
-
overlayStyle: {
|
|
17387
|
-
left: 48
|
|
17388
|
-
},
|
|
17512
|
+
style: useCompactInToolbar ? void 0 : { left: 48, maxWidth: "calc(100% - 48px)" },
|
|
17513
|
+
overlayStyle: useCompactInToolbar ? void 0 : { left: 48 },
|
|
17389
17514
|
open: !rightSidebarCollapsed,
|
|
17390
17515
|
positioning: "absolute",
|
|
17391
17516
|
side: "left",
|
|
@@ -17404,7 +17529,7 @@ var DrawerWorkspaceLayout = memoGeneric(function DrawerWorkspaceLayout2({
|
|
|
17404
17529
|
});
|
|
17405
17530
|
|
|
17406
17531
|
// src/components/workspace/PanelWorkspaceLayout.tsx
|
|
17407
|
-
import
|
|
17532
|
+
import React108, { useCallback as useCallback38, useMemo as useMemo47, useRef as useRef29 } from "react";
|
|
17408
17533
|
import {
|
|
17409
17534
|
Panel,
|
|
17410
17535
|
PanelGroup,
|
|
@@ -17571,13 +17696,14 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17571
17696
|
leftTabValue,
|
|
17572
17697
|
rightTabValue,
|
|
17573
17698
|
onChangeLeftTab,
|
|
17574
|
-
onChangeRightTab
|
|
17699
|
+
onChangeRightTab,
|
|
17700
|
+
compactDrawerMenu
|
|
17575
17701
|
}) {
|
|
17576
17702
|
const panelGroupRef = useRef29(null);
|
|
17577
17703
|
const hasLeftPanel = !!leftPanel;
|
|
17578
17704
|
const hasRightPanel = !!rightPanel;
|
|
17579
17705
|
const hasCenterPanel = !!centerPanel;
|
|
17580
|
-
const autoSaveId =
|
|
17706
|
+
const autoSaveId = useMemo47(() => {
|
|
17581
17707
|
return autoSavePrefix ? `${autoSavePrefix}--v2--${EDITOR_PANEL_GROUP_ID}` : Math.random().toString(36).substring(2, 15);
|
|
17582
17708
|
}, [autoSavePrefix]);
|
|
17583
17709
|
const layoutIds = getLayoutIds({
|
|
@@ -17604,7 +17730,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17604
17730
|
});
|
|
17605
17731
|
const [data, setData] = usePersistentStateObject(clientStorage, storageKey, {});
|
|
17606
17732
|
const layoutGroup = data?.[propertyKey];
|
|
17607
|
-
const { leftSidebarCollapsed, rightSidebarCollapsed } =
|
|
17733
|
+
const { leftSidebarCollapsed, rightSidebarCollapsed } = useMemo47(() => {
|
|
17608
17734
|
return getLayoutCollapsedState({
|
|
17609
17735
|
layoutGroup,
|
|
17610
17736
|
propertyKey,
|
|
@@ -17613,7 +17739,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17613
17739
|
hasRightPanel
|
|
17614
17740
|
});
|
|
17615
17741
|
}, [layoutGroup, propertyKey, layoutIds, hasLeftPanel, hasRightPanel]);
|
|
17616
|
-
const handleLeftTabChange =
|
|
17742
|
+
const handleLeftTabChange = useCallback38(
|
|
17617
17743
|
(value) => {
|
|
17618
17744
|
if (value === leftTabValue) {
|
|
17619
17745
|
if (leftSidebarRef.current?.isExpanded()) {
|
|
@@ -17630,7 +17756,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17630
17756
|
},
|
|
17631
17757
|
[leftSidebarRef, leftTabValue, onChangeLeftTab]
|
|
17632
17758
|
);
|
|
17633
|
-
const handleRightTabChange =
|
|
17759
|
+
const handleRightTabChange = useCallback38(
|
|
17634
17760
|
(value) => {
|
|
17635
17761
|
if (value === rightTabValue) {
|
|
17636
17762
|
if (rightSidebarRef.current?.isExpanded()) {
|
|
@@ -17647,7 +17773,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17647
17773
|
},
|
|
17648
17774
|
[onChangeRightTab, rightSidebarRef, rightTabValue]
|
|
17649
17775
|
);
|
|
17650
|
-
const handleLayoutChange =
|
|
17776
|
+
const handleLayoutChange = useCallback38(
|
|
17651
17777
|
(layout) => {
|
|
17652
17778
|
setData((prev) => {
|
|
17653
17779
|
const newData = {
|
|
@@ -17662,7 +17788,10 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17662
17788
|
},
|
|
17663
17789
|
[setData, propertyKey]
|
|
17664
17790
|
);
|
|
17665
|
-
|
|
17791
|
+
const showLeftTabs = !!leftSidebarOptions.showTabs && !!leftTabItems && // When compact drawer UI is enabled, only show the rail when the
|
|
17792
|
+
// sidebar is collapsed (for large screens/panel layout).
|
|
17793
|
+
(!compactDrawerMenu || leftSidebarCollapsed);
|
|
17794
|
+
return /* @__PURE__ */ React108.createElement(
|
|
17666
17795
|
PanelGroup,
|
|
17667
17796
|
{
|
|
17668
17797
|
ref: panelGroupRef,
|
|
@@ -17673,7 +17802,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17673
17802
|
autoSaveId,
|
|
17674
17803
|
onLayout: handleLayoutChange
|
|
17675
17804
|
},
|
|
17676
|
-
leftPanel && /* @__PURE__ */
|
|
17805
|
+
leftPanel && /* @__PURE__ */ React108.createElement(React108.Fragment, null, showLeftTabs && /* @__PURE__ */ React108.createElement(
|
|
17677
17806
|
VerticalTabMenu,
|
|
17678
17807
|
{
|
|
17679
17808
|
tooltipSide: "right",
|
|
@@ -17682,7 +17811,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17682
17811
|
isSidebarCollapsed: leftSidebarCollapsed,
|
|
17683
17812
|
onChange: handleLeftTabChange
|
|
17684
17813
|
}
|
|
17685
|
-
),
|
|
17814
|
+
), showLeftTabs && !leftSidebarCollapsed && /* @__PURE__ */ React108.createElement(DividerVertical, { className: "n-h-full" }), /* @__PURE__ */ React108.createElement(
|
|
17686
17815
|
Panel,
|
|
17687
17816
|
{
|
|
17688
17817
|
id: LEFT_SIDEBAR_ID,
|
|
@@ -17695,8 +17824,8 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17695
17824
|
collapsible: true
|
|
17696
17825
|
},
|
|
17697
17826
|
leftSidebarCollapsed ? null : leftPanel
|
|
17698
|
-
), /* @__PURE__ */
|
|
17699
|
-
/* @__PURE__ */
|
|
17827
|
+
), /* @__PURE__ */ React108.createElement(PanelResizeHandle, { className: "n-cursor-col-resize n-w-px n-h-full n-bg-divider" })),
|
|
17828
|
+
/* @__PURE__ */ React108.createElement(
|
|
17700
17829
|
Panel,
|
|
17701
17830
|
{
|
|
17702
17831
|
id: CONTENT_AREA_ID,
|
|
@@ -17707,7 +17836,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17707
17836
|
},
|
|
17708
17837
|
centerPanel
|
|
17709
17838
|
),
|
|
17710
|
-
rightPanel && /* @__PURE__ */
|
|
17839
|
+
rightPanel && /* @__PURE__ */ React108.createElement(React108.Fragment, null, /* @__PURE__ */ React108.createElement(PanelResizeHandle, { className: "n-cursor-col-resize n-w-px n-h-full n-bg-divider" }), /* @__PURE__ */ React108.createElement(
|
|
17711
17840
|
Panel,
|
|
17712
17841
|
{
|
|
17713
17842
|
id: RIGHT_SIDEBAR_ID,
|
|
@@ -17720,7 +17849,7 @@ var PanelWorkspaceLayout = memoGeneric(function PanelWorkspaceLayout2({
|
|
|
17720
17849
|
collapsible: true
|
|
17721
17850
|
},
|
|
17722
17851
|
rightSidebarCollapsed ? null : rightPanel
|
|
17723
|
-
), rightSidebarOptions.showTabs && rightTabItems && !rightSidebarCollapsed && /* @__PURE__ */
|
|
17852
|
+
), rightSidebarOptions.showTabs && rightTabItems && !rightSidebarCollapsed && /* @__PURE__ */ React108.createElement(DividerVertical, { className: "n-h-full" }), rightSidebarOptions.showTabs && rightTabItems && /* @__PURE__ */ React108.createElement(
|
|
17724
17853
|
VerticalTabMenu,
|
|
17725
17854
|
{
|
|
17726
17855
|
tooltipSide: "left",
|
|
@@ -17806,9 +17935,10 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
17806
17935
|
defaultCollapsed: rightDefaultCollapsed = false,
|
|
17807
17936
|
showTabs: rightShowTabs = true
|
|
17808
17937
|
} = {},
|
|
17809
|
-
theme
|
|
17938
|
+
theme,
|
|
17939
|
+
compactDrawerMenu
|
|
17810
17940
|
}, forwardedRef) {
|
|
17811
|
-
const containerRef =
|
|
17941
|
+
const containerRef = React109.useRef(null);
|
|
17812
17942
|
const containerSize = useSize(containerRef);
|
|
17813
17943
|
const windowSize = useWindowSize();
|
|
17814
17944
|
const parentSize = detectSize === "window" ? windowSize : containerSize && containerSize.width > 0 ? containerSize : windowSize;
|
|
@@ -17909,56 +18039,56 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
17909
18039
|
});
|
|
17910
18040
|
const centerPanelPercentage = 100 - (left ? leftSidebarPercentage : 0) - (right ? rightSidebarPercentage : 0);
|
|
17911
18041
|
const isDrawerActive = sideType === "drawer" || sideType === "auto" && parentSize.width <= sideTypeBreakpoint;
|
|
17912
|
-
const closeLeftSidebar =
|
|
18042
|
+
const closeLeftSidebar = useCallback39(() => {
|
|
17913
18043
|
if (isDrawerActive) {
|
|
17914
18044
|
leftSidebarRef.current?.collapse();
|
|
17915
18045
|
}
|
|
17916
18046
|
}, [isDrawerActive]);
|
|
17917
|
-
const closeRightSidebar =
|
|
18047
|
+
const closeRightSidebar = useCallback39(() => {
|
|
17918
18048
|
if (isDrawerActive) {
|
|
17919
18049
|
rightSidebarRef.current?.collapse();
|
|
17920
18050
|
}
|
|
17921
18051
|
}, [isDrawerActive]);
|
|
17922
|
-
const leftChildrenProps =
|
|
18052
|
+
const leftChildrenProps = useMemo48(() => {
|
|
17923
18053
|
return {
|
|
17924
18054
|
activeTabValue: leftTabValue,
|
|
17925
18055
|
closeSidebar: closeLeftSidebar
|
|
17926
18056
|
};
|
|
17927
18057
|
}, [leftTabValue, closeLeftSidebar]);
|
|
17928
|
-
const rightChildrenProps =
|
|
18058
|
+
const rightChildrenProps = useMemo48(() => {
|
|
17929
18059
|
return {
|
|
17930
18060
|
activeTabValue: rightTabValue,
|
|
17931
18061
|
closeSidebar: closeRightSidebar
|
|
17932
18062
|
};
|
|
17933
18063
|
}, [rightTabValue, closeRightSidebar]);
|
|
17934
|
-
const leftSidebarProviderValue =
|
|
18064
|
+
const leftSidebarProviderValue = useMemo48(() => {
|
|
17935
18065
|
return {
|
|
17936
18066
|
closeSidebar: closeLeftSidebar
|
|
17937
18067
|
};
|
|
17938
18068
|
}, [closeLeftSidebar]);
|
|
17939
|
-
const rightSidebarProviderValue =
|
|
18069
|
+
const rightSidebarProviderValue = useMemo48(() => {
|
|
17940
18070
|
return {
|
|
17941
18071
|
closeSidebar: closeRightSidebar
|
|
17942
18072
|
};
|
|
17943
18073
|
}, [closeRightSidebar]);
|
|
17944
|
-
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */
|
|
18074
|
+
const leftPanel = left && leftVisible !== false ? /* @__PURE__ */ React109.createElement(
|
|
17945
18075
|
PanelInner,
|
|
17946
18076
|
{
|
|
17947
18077
|
style: leftStyle,
|
|
17948
18078
|
className: cx("n-bg-sidebar-background n-flex-col", leftClassName)
|
|
17949
18079
|
},
|
|
17950
|
-
/* @__PURE__ */
|
|
18080
|
+
/* @__PURE__ */ React109.createElement(WorkspaceSideProvider, { value: leftSidebarProviderValue }, leftTabValue ? renderPanelChildren(left, leftChildrenProps) : null)
|
|
17951
18081
|
) : null;
|
|
17952
|
-
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */
|
|
18082
|
+
const rightPanel = right && rightVisible !== false ? /* @__PURE__ */ React109.createElement(
|
|
17953
18083
|
PanelInner,
|
|
17954
18084
|
{
|
|
17955
18085
|
style: rightStyle,
|
|
17956
18086
|
className: cx("n-bg-sidebar-background n-flex-col", rightClassName)
|
|
17957
18087
|
},
|
|
17958
|
-
/* @__PURE__ */
|
|
18088
|
+
/* @__PURE__ */ React109.createElement(WorkspaceSideProvider, { value: rightSidebarProviderValue }, rightTabValue ? renderPanelChildren(right, rightChildrenProps) : null)
|
|
17959
18089
|
) : null;
|
|
17960
|
-
const centerPanel = /* @__PURE__ */
|
|
17961
|
-
const leftSidebarOptions =
|
|
18090
|
+
const centerPanel = /* @__PURE__ */ React109.createElement(PanelInner, { className: "n-bg-canvas-background" }, children);
|
|
18091
|
+
const leftSidebarOptions = useMemo48(
|
|
17962
18092
|
() => ({
|
|
17963
18093
|
minSize: leftSidebarMinPercentage,
|
|
17964
18094
|
maxSize: leftSidebarMaxPercentage,
|
|
@@ -17976,7 +18106,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
17976
18106
|
leftShowTabs
|
|
17977
18107
|
]
|
|
17978
18108
|
);
|
|
17979
|
-
const rightSidebarOptions =
|
|
18109
|
+
const rightSidebarOptions = useMemo48(
|
|
17980
18110
|
() => ({
|
|
17981
18111
|
minSize: rightSidebarMinPercentage,
|
|
17982
18112
|
maxSize: rightSidebarMaxPercentage,
|
|
@@ -17996,7 +18126,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
17996
18126
|
);
|
|
17997
18127
|
const LayoutComponent = sideType === "panel" ? PanelWorkspaceLayout : sideType === "drawer" ? DrawerWorkspaceLayout : parentSize.width > sideTypeBreakpoint ? PanelWorkspaceLayout : DrawerWorkspaceLayout;
|
|
17998
18128
|
const readyToRender = detectSize === "window" || containerSize && containerSize.width > 0;
|
|
17999
|
-
return /* @__PURE__ */
|
|
18129
|
+
return /* @__PURE__ */ React109.createElement(
|
|
18000
18130
|
"div",
|
|
18001
18131
|
{
|
|
18002
18132
|
ref: containerRef,
|
|
@@ -18009,7 +18139,7 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
18009
18139
|
"data-theme": theme
|
|
18010
18140
|
},
|
|
18011
18141
|
toolbar,
|
|
18012
|
-
/* @__PURE__ */
|
|
18142
|
+
/* @__PURE__ */ React109.createElement("div", { className: "n-flex n-flex-row n-flex-1 n-relative" }, readyToRender && /* @__PURE__ */ React109.createElement(
|
|
18013
18143
|
LayoutComponent,
|
|
18014
18144
|
{
|
|
18015
18145
|
leftPanel,
|
|
@@ -18026,7 +18156,8 @@ var WorkspaceLayout = forwardRefGeneric(function WorkspaceLayout2({
|
|
|
18026
18156
|
centerPanelPercentage,
|
|
18027
18157
|
autoSavePrefix,
|
|
18028
18158
|
leftSidebarRef,
|
|
18029
|
-
rightSidebarRef
|
|
18159
|
+
rightSidebarRef,
|
|
18160
|
+
compactDrawerMenu
|
|
18030
18161
|
}
|
|
18031
18162
|
))
|
|
18032
18163
|
);
|
|
@@ -18036,7 +18167,7 @@ var PanelInner = memo37(function PanelInner2({
|
|
|
18036
18167
|
style: style2,
|
|
18037
18168
|
className
|
|
18038
18169
|
}) {
|
|
18039
|
-
return /* @__PURE__ */
|
|
18170
|
+
return /* @__PURE__ */ React109.createElement(
|
|
18040
18171
|
"div",
|
|
18041
18172
|
{
|
|
18042
18173
|
style: style2,
|
|
@@ -18051,22 +18182,22 @@ function getFirstTabValue(items, defaultValue2) {
|
|
|
18051
18182
|
}
|
|
18052
18183
|
|
|
18053
18184
|
// src/contexts/ImageDataContext.tsx
|
|
18054
|
-
import * as
|
|
18055
|
-
var ImageDataContext =
|
|
18185
|
+
import * as React110 from "react";
|
|
18186
|
+
var ImageDataContext = React110.createContext(
|
|
18056
18187
|
void 0
|
|
18057
18188
|
);
|
|
18058
|
-
var ImageDataProvider =
|
|
18189
|
+
var ImageDataProvider = React110.memo(function ImageDataProvider2({
|
|
18059
18190
|
children,
|
|
18060
18191
|
getImageData
|
|
18061
18192
|
}) {
|
|
18062
|
-
const contextValue =
|
|
18193
|
+
const contextValue = React110.useMemo(
|
|
18063
18194
|
() => ({ getImageData: getImageData ?? (() => void 0) }),
|
|
18064
18195
|
[getImageData]
|
|
18065
18196
|
);
|
|
18066
|
-
return /* @__PURE__ */
|
|
18197
|
+
return /* @__PURE__ */ React110.createElement(ImageDataContext.Provider, { value: contextValue }, children);
|
|
18067
18198
|
});
|
|
18068
18199
|
function useImageData(ref) {
|
|
18069
|
-
const value =
|
|
18200
|
+
const value = React110.useContext(ImageDataContext);
|
|
18070
18201
|
if (!value) {
|
|
18071
18202
|
throw new Error("Missing ImageDataProvider");
|
|
18072
18203
|
}
|
|
@@ -18083,9 +18214,9 @@ function usePlatformModKey() {
|
|
|
18083
18214
|
}
|
|
18084
18215
|
|
|
18085
18216
|
// src/hooks/useTheme.ts
|
|
18086
|
-
import { useEffect as useEffect23, useState as
|
|
18217
|
+
import { useEffect as useEffect23, useState as useState36 } from "react";
|
|
18087
18218
|
function useTheme() {
|
|
18088
|
-
const [theme, setTheme] =
|
|
18219
|
+
const [theme, setTheme] = useState36("light");
|
|
18089
18220
|
const checkTheme = () => {
|
|
18090
18221
|
const currentTheme = document.body.getAttribute("data-theme");
|
|
18091
18222
|
switch (currentTheme) {
|
|
@@ -18220,11 +18351,11 @@ var SUPPORTED_CANVAS_UPLOAD_TYPES = [
|
|
|
18220
18351
|
|
|
18221
18352
|
// src/components/DimensionInput.tsx
|
|
18222
18353
|
import { round as round2 } from "@noya-app/noya-utils";
|
|
18223
|
-
import * as
|
|
18354
|
+
import * as React111 from "react";
|
|
18224
18355
|
function getNewValue(value, mode, delta) {
|
|
18225
18356
|
return delta === void 0 ? value : mode === "replace" ? delta : value + delta;
|
|
18226
18357
|
}
|
|
18227
|
-
var DimensionInput =
|
|
18358
|
+
var DimensionInput = React111.memo(function DimensionInput2({
|
|
18228
18359
|
id,
|
|
18229
18360
|
value,
|
|
18230
18361
|
onSetValue,
|
|
@@ -18234,15 +18365,15 @@ var DimensionInput = React110.memo(function DimensionInput2({
|
|
|
18234
18365
|
disabled,
|
|
18235
18366
|
trigger = "submit"
|
|
18236
18367
|
}) {
|
|
18237
|
-
const handleNudgeValue =
|
|
18368
|
+
const handleNudgeValue = React111.useCallback(
|
|
18238
18369
|
(value2) => onSetValue(value2, "adjust"),
|
|
18239
18370
|
[onSetValue]
|
|
18240
18371
|
);
|
|
18241
|
-
const handleSetValue =
|
|
18372
|
+
const handleSetValue = React111.useCallback(
|
|
18242
18373
|
(value2) => onSetValue(value2, "replace"),
|
|
18243
18374
|
[onSetValue]
|
|
18244
18375
|
);
|
|
18245
|
-
return /* @__PURE__ */
|
|
18376
|
+
return /* @__PURE__ */ React111.createElement(LabeledField, { label, labelType: "inset" }, /* @__PURE__ */ React111.createElement(InputField2.Root, { id, width: size }, /* @__PURE__ */ React111.createElement(
|
|
18246
18377
|
InputField2.NumberInput,
|
|
18247
18378
|
{
|
|
18248
18379
|
value: value === void 0 ? value : round2(value, 2),
|
|
@@ -18269,11 +18400,11 @@ __export(InspectorPrimitives_exports, {
|
|
|
18269
18400
|
Title: () => Title,
|
|
18270
18401
|
VerticalSeparator: () => VerticalSeparator
|
|
18271
18402
|
});
|
|
18272
|
-
import
|
|
18403
|
+
import React112, {
|
|
18273
18404
|
forwardRef as forwardRef29,
|
|
18274
18405
|
memo as memo40
|
|
18275
18406
|
} from "react";
|
|
18276
|
-
var Section2 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18407
|
+
var Section2 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18277
18408
|
"div",
|
|
18278
18409
|
{
|
|
18279
18410
|
ref,
|
|
@@ -18281,8 +18412,8 @@ var Section2 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ Re
|
|
|
18281
18412
|
...props
|
|
18282
18413
|
}
|
|
18283
18414
|
));
|
|
18284
|
-
var SectionHeader2 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18285
|
-
var Title = forwardRef29(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */
|
|
18415
|
+
var SectionHeader2 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement("div", { ref, className: cx(`n-flex n-items-center`, className), ...props }));
|
|
18416
|
+
var Title = forwardRef29(({ className, $textStyle, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18286
18417
|
"div",
|
|
18287
18418
|
{
|
|
18288
18419
|
ref,
|
|
@@ -18293,7 +18424,7 @@ var Title = forwardRef29(({ className, $textStyle, ...props }, ref) => /* @__PUR
|
|
|
18293
18424
|
...props
|
|
18294
18425
|
}
|
|
18295
18426
|
));
|
|
18296
|
-
var Row = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18427
|
+
var Row = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18297
18428
|
"div",
|
|
18298
18429
|
{
|
|
18299
18430
|
ref,
|
|
@@ -18301,7 +18432,7 @@ var Row = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React11
|
|
|
18301
18432
|
...props
|
|
18302
18433
|
}
|
|
18303
18434
|
));
|
|
18304
|
-
var Column = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18435
|
+
var Column = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18305
18436
|
"div",
|
|
18306
18437
|
{
|
|
18307
18438
|
ref,
|
|
@@ -18309,7 +18440,7 @@ var Column = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ Reac
|
|
|
18309
18440
|
...props
|
|
18310
18441
|
}
|
|
18311
18442
|
));
|
|
18312
|
-
var Checkbox3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18443
|
+
var Checkbox3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18313
18444
|
"input",
|
|
18314
18445
|
{
|
|
18315
18446
|
ref,
|
|
@@ -18318,7 +18449,7 @@ var Checkbox3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ R
|
|
|
18318
18449
|
...props
|
|
18319
18450
|
}
|
|
18320
18451
|
));
|
|
18321
|
-
var Text3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */
|
|
18452
|
+
var Text3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React112.createElement(
|
|
18322
18453
|
"span",
|
|
18323
18454
|
{
|
|
18324
18455
|
ref,
|
|
@@ -18326,14 +18457,14 @@ var Text3 = forwardRef29(({ className, ...props }, ref) => /* @__PURE__ */ React
|
|
|
18326
18457
|
...props
|
|
18327
18458
|
}
|
|
18328
18459
|
));
|
|
18329
|
-
var VerticalSeparator = () => /* @__PURE__ */
|
|
18330
|
-
var HorizontalSeparator = () => /* @__PURE__ */
|
|
18460
|
+
var VerticalSeparator = () => /* @__PURE__ */ React112.createElement(Spacer.Vertical, { size: "inspector-v-separator" });
|
|
18461
|
+
var HorizontalSeparator = () => /* @__PURE__ */ React112.createElement(Spacer.Horizontal, { size: "inspector-h-separator" });
|
|
18331
18462
|
var RowLabel = forwardRef29(function RowLabel2({
|
|
18332
18463
|
className,
|
|
18333
18464
|
$textStyle,
|
|
18334
18465
|
...props
|
|
18335
18466
|
}, ref) {
|
|
18336
|
-
return /* @__PURE__ */
|
|
18467
|
+
return /* @__PURE__ */ React112.createElement(
|
|
18337
18468
|
"label",
|
|
18338
18469
|
{
|
|
18339
18470
|
ref,
|
|
@@ -18353,7 +18484,7 @@ var LabeledRow = memo40(function LabeledRow2({
|
|
|
18353
18484
|
right,
|
|
18354
18485
|
className
|
|
18355
18486
|
}) {
|
|
18356
|
-
return /* @__PURE__ */
|
|
18487
|
+
return /* @__PURE__ */ React112.createElement(Row, { id, className }, /* @__PURE__ */ React112.createElement(Column, null, /* @__PURE__ */ React112.createElement(RowLabel, { $textStyle: labelTextStyle }, label, right && /* @__PURE__ */ React112.createElement(Spacer.Horizontal, null), right), /* @__PURE__ */ React112.createElement(Row, null, children)));
|
|
18357
18488
|
});
|
|
18358
18489
|
export {
|
|
18359
18490
|
AIAssistantInput,
|
|
@@ -18492,6 +18623,7 @@ export {
|
|
|
18492
18623
|
Tooltip,
|
|
18493
18624
|
TreeView,
|
|
18494
18625
|
UserAvatar,
|
|
18626
|
+
UserPicker,
|
|
18495
18627
|
UserPointer,
|
|
18496
18628
|
WorkspaceLayout,
|
|
18497
18629
|
WorkspaceSideProvider,
|
|
@@ -18525,6 +18657,7 @@ export {
|
|
|
18525
18657
|
getNextIndex,
|
|
18526
18658
|
getPipelineResultLink,
|
|
18527
18659
|
getThumbnailColors,
|
|
18660
|
+
getUserDisplayName,
|
|
18528
18661
|
isMenuItemSectionHeader,
|
|
18529
18662
|
isNonSelectableMenuItem,
|
|
18530
18663
|
isPopoverMenuItem,
|