@powerhousedao/design-system 6.2.2-dev.6 → 6.2.2-dev.60
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/dist/connect/components/toast/toast.d.ts +2 -1
- package/dist/connect/components/toast/toast.d.ts.map +1 -1
- package/dist/connect/components/toast/toast.js +6 -3
- package/dist/connect/components/toast/toast.js.map +1 -1
- package/dist/connect/index.d.ts +205 -42
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +770 -384
- package/dist/connect/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-DpUTb0dJ.js → src-CVV6HzQZ.js} +2 -2
- package/dist/src-CVV6HzQZ.js.map +1 -0
- package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts +1 -1
- package/dist/ui/components/sidebar/subcomponents/status-icon.d.ts.map +1 -1
- package/package.json +6 -6
- package/theme.css +9 -0
- package/dist/src-DpUTb0dJ.js.map +0 -1
package/dist/connect/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { _ as DropdownMenuTrigger, c as SidebarHeader, d as PackageAnimation, f as Modal, h as DropdownMenuItem, l as SidebarPanel, m as DropdownMenuContent, n as usePagination, o as Sidebar, p as DropdownMenu, s as SidebarFooter, u as Pagination, v as PowerhouseButton } from "../src-
|
|
1
|
+
import { _ as DropdownMenuTrigger, c as SidebarHeader, d as PackageAnimation, f as Modal, h as DropdownMenuItem, l as SidebarPanel, m as DropdownMenuContent, n as usePagination, o as Sidebar, p as DropdownMenu, s as SidebarFooter, u as Pagination, v as PowerhouseButton } from "../src-CVV6HzQZ.js";
|
|
2
2
|
import { n as getDimensions, t as Icon } from "../icon-C4QOpsdI.js";
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/components/popover/popover.js";
|
|
4
4
|
import { SelectFieldRaw } from "../ui/components/select-field/select-field.js";
|
|
5
5
|
import { Input } from "../ui/components/input/input.js";
|
|
6
6
|
import { JsonViewer } from "../ui/components/json-viewer/json-viewer.js";
|
|
7
|
-
import { SearchAutocomplete } from "../ui/components/search-autocomplete/search-autocomplete.js";
|
|
8
7
|
import React, { Fragment, createElement, forwardRef, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
9
8
|
import { twJoin, twMerge } from "tailwind-merge";
|
|
10
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -13,7 +12,8 @@ import { Controller, useForm } from "react-hook-form";
|
|
|
13
12
|
import { Anchor, Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
|
|
14
13
|
import { format, formatDistanceToNow, parseISO } from "date-fns";
|
|
15
14
|
import { useCopyToClipboard, useDebounceValue, useEventListener, useOnClickOutside } from "usehooks-ts";
|
|
16
|
-
import {
|
|
15
|
+
import { Loader2, Mail, Monitor, Moon, Settings, Smartphone, Sun, Wallet } from "lucide-react";
|
|
16
|
+
import { SyncOperationStatus, addFolder, getSyncStatusSync, preloadEditorModule, setSelectedDrive, setSelectedNode, showDeleteNodeModal, showPHModal, showRevisionHistory, useDocumentById, useDocumentVersionStatus, useDownloadDocument, useDragNode, useDropFile, useDropNode, useEditorModulesForDocumentType, useGetSwitchboardLink, useIsDragAndDropEnabled, useNodeActions, useNodeById, useNodeParentFolderById, useOnDropFile, useSelectedDocumentSafe, useSelectedDriveId, useSelectedDriveSafe, useSelectedNodePath, useTheme, useUserPermissions } from "@powerhousedao/reactor-browser";
|
|
17
17
|
import Select, { components } from "react-select";
|
|
18
18
|
import { Content as Content$2, List, Root as Root$2, Trigger as Trigger$2 } from "@radix-ui/react-tabs";
|
|
19
19
|
import { addProp, defaultTo, entries, filter, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isStrictEqual, isString, isTruthy, keys, map, pipe, prop, values } from "remeda";
|
|
@@ -25,22 +25,152 @@ import { lightTheme } from "@uiw/react-json-view/light";
|
|
|
25
25
|
import { isValidName } from "@powerhousedao/shared/document-drive";
|
|
26
26
|
import { capitalCase } from "change-case";
|
|
27
27
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
28
|
-
import { Monitor, Moon, Settings, Sun } from "lucide-react";
|
|
29
28
|
//#region src/connect/components/account-popover/account-popover.tsx
|
|
30
|
-
const AccountPopover = ({ children, content }) => {
|
|
31
|
-
return /* @__PURE__ */ jsxs(Popover, {
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const AccountPopover = ({ children, content, open, onOpenChange }) => {
|
|
30
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
31
|
+
open,
|
|
32
|
+
onOpenChange,
|
|
33
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
34
|
+
asChild: true,
|
|
35
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
"aria-label": "Open Account",
|
|
38
|
+
className: "cursor-pointer",
|
|
39
|
+
children
|
|
40
|
+
})
|
|
41
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
42
|
+
className: "w-52 p-0",
|
|
43
|
+
align: "start",
|
|
44
|
+
children: content
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/connect/components/account-popover/account-popover-login.tsx
|
|
50
|
+
const AccountPopoverLogin = ({ onLogin }) => {
|
|
51
|
+
const allowLogin = !!onLogin;
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "p-4",
|
|
54
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "mb-4 flex justify-center",
|
|
56
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: "flex h-5.5 w-20.75 items-center justify-center overflow-hidden text-foreground",
|
|
58
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
59
|
+
name: "RenownLight",
|
|
60
|
+
size: 83
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
64
|
+
onClick: allowLogin ? onLogin : void 0,
|
|
65
|
+
className: allowLogin ? "mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground active:active-effect" : "mt-4 flex h-7 w-full cursor-wait items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground",
|
|
34
66
|
type: "button",
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
children: /* @__PURE__ */ jsx("span", { children: "Connect" })
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/connect/components/renown-login/renown-login-methods.tsx
|
|
73
|
+
const GoogleMark = () => /* @__PURE__ */ jsxs("svg", {
|
|
74
|
+
width: "18",
|
|
75
|
+
height: "18",
|
|
76
|
+
viewBox: "0 0 18 18",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx("path", {
|
|
80
|
+
fill: "#4285F4",
|
|
81
|
+
d: "M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z"
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("path", {
|
|
84
|
+
fill: "#34A853",
|
|
85
|
+
d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.859-3.048.859-2.344 0-4.328-1.583-5.036-3.71H.957v2.332A8.997 8.997 0 0 0 9 18z"
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("path", {
|
|
88
|
+
fill: "#FBBC05",
|
|
89
|
+
d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.997 8.997 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z"
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx("path", {
|
|
92
|
+
fill: "#EA4335",
|
|
93
|
+
d: "M9 3.58c1.321 0 2.508.454 3.44 1.346l2.582-2.581C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z"
|
|
38
94
|
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
const AppleMark = () => /* @__PURE__ */ jsx("svg", {
|
|
98
|
+
width: "18",
|
|
99
|
+
height: "18",
|
|
100
|
+
viewBox: "0 0 24 24",
|
|
101
|
+
fill: "currentColor",
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
children: /* @__PURE__ */ jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.51 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" })
|
|
104
|
+
});
|
|
105
|
+
const METHOD_ICONS = {
|
|
106
|
+
wallet: /* @__PURE__ */ jsx(Wallet, {
|
|
107
|
+
size: 18,
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
}),
|
|
110
|
+
email: /* @__PURE__ */ jsx(Mail, {
|
|
111
|
+
size: 18,
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
}),
|
|
114
|
+
sms: /* @__PURE__ */ jsx(Smartphone, {
|
|
115
|
+
size: 18,
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
}),
|
|
118
|
+
google: /* @__PURE__ */ jsx(GoogleMark, {}),
|
|
119
|
+
apple: /* @__PURE__ */ jsx(AppleMark, {})
|
|
120
|
+
};
|
|
121
|
+
const baseButton = "relative flex h-10 w-full items-center justify-center gap-2 rounded-lg px-3 text-sm font-semibold transition-colors disabled:pointer-events-none disabled:opacity-60";
|
|
122
|
+
const primaryButton = "bg-primary text-primary-foreground hover:bg-primary/85";
|
|
123
|
+
const secondaryButton = "border border-border bg-card text-foreground hover:bg-muted";
|
|
124
|
+
const RenownLoginMethods = ({ methods, loading = false, error, className }) => {
|
|
125
|
+
const [pendingId, setPendingId] = useState(null);
|
|
126
|
+
const wallet = methods.find((method) => method.id === "wallet");
|
|
127
|
+
const others = methods.filter((method) => method.id !== "wallet");
|
|
128
|
+
const renderButton = (method, primary) => {
|
|
129
|
+
const isPending = loading && pendingId === method.id;
|
|
130
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
disabled: loading,
|
|
133
|
+
onClick: () => {
|
|
134
|
+
setPendingId(method.id);
|
|
135
|
+
method.onSelect();
|
|
136
|
+
},
|
|
137
|
+
className: twMerge(baseButton, primary ? primaryButton : secondaryButton, isPending && "animate-pulse"),
|
|
138
|
+
children: [
|
|
139
|
+
isPending ? /* @__PURE__ */ jsx(Loader2, {
|
|
140
|
+
size: 18,
|
|
141
|
+
className: "animate-spin",
|
|
142
|
+
"aria-hidden": "true"
|
|
143
|
+
}) : METHOD_ICONS[method.id],
|
|
144
|
+
/* @__PURE__ */ jsx("span", { children: method.label }),
|
|
145
|
+
method.lastUsed ? /* @__PURE__ */ jsx("span", {
|
|
146
|
+
className: "absolute -top-2 right-2 rounded-full bg-foreground px-1.5 py-0.5 text-[10px] leading-none font-semibold text-background shadow-sm",
|
|
147
|
+
children: "Last used"
|
|
148
|
+
}) : null
|
|
149
|
+
]
|
|
150
|
+
}, method.id);
|
|
151
|
+
};
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: twMerge("flex w-full flex-col gap-3", className),
|
|
154
|
+
children: [
|
|
155
|
+
wallet ? renderButton(wallet, true) : null,
|
|
156
|
+
wallet && others.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
157
|
+
className: "my-1 flex items-center gap-3",
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" }),
|
|
160
|
+
/* @__PURE__ */ jsx("span", {
|
|
161
|
+
className: "text-xs tracking-wider text-muted-foreground uppercase",
|
|
162
|
+
children: "or"
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ jsx("div", { className: "h-px flex-1 bg-border" })
|
|
165
|
+
]
|
|
166
|
+
}) : null,
|
|
167
|
+
others.map((method) => renderButton(method, false)),
|
|
168
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
169
|
+
className: "text-center text-xs text-destructive",
|
|
170
|
+
children: error
|
|
171
|
+
}) : null
|
|
172
|
+
]
|
|
173
|
+
});
|
|
44
174
|
};
|
|
45
175
|
//#endregion
|
|
46
176
|
//#region assets/connect-loader.mp4
|
|
@@ -574,8 +704,17 @@ function fixedForwardRef(render) {
|
|
|
574
704
|
return /* @__PURE__ */ forwardRef(render);
|
|
575
705
|
}
|
|
576
706
|
const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref) {
|
|
577
|
-
const { items, value, id, onChange, containerClassName, menuClassName, itemClassName, absolutePositionMenu = false, borderRadius = "6px" } = props;
|
|
707
|
+
const { items, value, id, onChange, containerClassName, menuClassName, itemClassName, absolutePositionMenu = false, borderRadius = "6px", listClassName } = props;
|
|
578
708
|
const [showItems, setShowItems] = useState(false);
|
|
709
|
+
const containerRef = useRef(null);
|
|
710
|
+
useEffect(() => {
|
|
711
|
+
if (!showItems) return;
|
|
712
|
+
function onPointerDown(event) {
|
|
713
|
+
if (!containerRef.current?.contains(event.target)) setShowItems(false);
|
|
714
|
+
}
|
|
715
|
+
window.addEventListener("pointerdown", onPointerDown);
|
|
716
|
+
return () => window.removeEventListener("pointerdown", onPointerDown);
|
|
717
|
+
}, [showItems]);
|
|
579
718
|
const selectedItem = getItemByValue(value) ?? items[0];
|
|
580
719
|
function onItemClick(item) {
|
|
581
720
|
if (item.disabled) return;
|
|
@@ -589,7 +728,11 @@ const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref
|
|
|
589
728
|
return /* @__PURE__ */ jsxs("div", {
|
|
590
729
|
className: twMerge("border border-border bg-background text-foreground transition-[border-radius]", absolutePositionMenu && "relative", containerClassName),
|
|
591
730
|
"data-open": showItems,
|
|
592
|
-
ref
|
|
731
|
+
ref: (node) => {
|
|
732
|
+
containerRef.current = node;
|
|
733
|
+
if (typeof ref === "function") ref(node);
|
|
734
|
+
else if (ref) ref.current = node;
|
|
735
|
+
},
|
|
593
736
|
style: { borderRadius },
|
|
594
737
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
595
738
|
className: twMerge("flex min-w-[360px] cursor-pointer items-center justify-between pr-3 text-foreground outline-none", menuClassName),
|
|
@@ -603,7 +746,7 @@ const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref
|
|
|
603
746
|
name: "ChevronDown"
|
|
604
747
|
})]
|
|
605
748
|
}), /* @__PURE__ */ jsx("div", {
|
|
606
|
-
className: twMerge("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out", showItems && "max-h-screen", absolutePositionMenu && "absolute"),
|
|
749
|
+
className: twMerge("max-h-0 w-full overflow-hidden bg-inherit transition-[max-height] ease-in-out", showItems && "max-h-screen", absolutePositionMenu && "absolute", showItems && listClassName),
|
|
607
750
|
style: { borderRadius: `0 0 ${borderRadius} ${borderRadius}` },
|
|
608
751
|
children: itemsToShow.map((item) => /* @__PURE__ */ jsx(ItemContainer, {
|
|
609
752
|
...item,
|
|
@@ -616,7 +759,7 @@ const ConnectSelect = /* @__PURE__ */ fixedForwardRef(function Select(props, ref
|
|
|
616
759
|
function ItemContainer(props) {
|
|
617
760
|
const { className, disabled, onItemClick, icon, displayValue, value, description } = props;
|
|
618
761
|
return /* @__PURE__ */ jsxs("div", {
|
|
619
|
-
className: twMerge(disabled ? "cursor-not-allowed text-muted-foreground" : "text-foreground", "flex size-full cursor-pointer items-center gap-2 bg-inherit py-3 pl-3 text-start outline-none", className),
|
|
762
|
+
className: twMerge(disabled ? "cursor-not-allowed text-muted-foreground" : "text-foreground", "flex size-full cursor-pointer items-center gap-2 bg-inherit py-3 pl-3 text-start outline-none", onItemClick && !disabled && "hover:bg-muted", className),
|
|
620
763
|
onClick: onItemClick,
|
|
621
764
|
children: [icon, /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
622
765
|
className: "text-inherit capitalize",
|
|
@@ -1643,33 +1786,35 @@ function TabContent(props) {
|
|
|
1643
1786
|
//#endregion
|
|
1644
1787
|
//#region src/connect/components/tabs/tabs.tsx
|
|
1645
1788
|
const toTabValue = (label) => label.trim().replace(/\s+/g, "-");
|
|
1646
|
-
|
|
1789
|
+
const resolveTabValue = (props) => props.value ?? toTabValue(props.label);
|
|
1790
|
+
function Tabs({ children, defaultValue, onValueChange, listClassName }) {
|
|
1647
1791
|
return /* @__PURE__ */ jsxs(Root$2, {
|
|
1648
1792
|
defaultValue: toTabValue(defaultValue),
|
|
1793
|
+
onValueChange,
|
|
1649
1794
|
className: "flex min-h-0 flex-1 flex-col gap-2",
|
|
1650
1795
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1651
|
-
className: "flex w-full shrink-0 justify-between",
|
|
1796
|
+
className: twMerge("flex w-full shrink-0 justify-between", listClassName),
|
|
1652
1797
|
children: /* @__PURE__ */ jsx(List, {
|
|
1653
1798
|
className: "flex w-full gap-x-2 rounded-xl p-1 text-sm font-semibold text-foreground outline-none",
|
|
1654
1799
|
children: React.Children.map(children, (child, _i) => {
|
|
1655
1800
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1656
|
-
const
|
|
1801
|
+
const props = child.props;
|
|
1802
|
+
const value = resolveTabValue(props);
|
|
1657
1803
|
return /* @__PURE__ */ jsx(Trigger$2, {
|
|
1658
1804
|
className: "flex min-h-7 flex-1 items-center justify-center rounded-lg border border-border bg-background py-2 text-foreground transition duration-300 data-disabled:disabled-effect data-[state=active]:bg-accent data-[state=active]:text-foreground",
|
|
1659
|
-
value
|
|
1660
|
-
disabled: disabled ?? false,
|
|
1661
|
-
children: label
|
|
1662
|
-
},
|
|
1805
|
+
value,
|
|
1806
|
+
disabled: props.disabled ?? false,
|
|
1807
|
+
children: props.label
|
|
1808
|
+
}, value);
|
|
1663
1809
|
})
|
|
1664
1810
|
})
|
|
1665
1811
|
}), /* @__PURE__ */ jsx("div", {
|
|
1666
1812
|
className: "mt-3 min-h-0 flex-1 rounded-md bg-background",
|
|
1667
1813
|
children: React.Children.map(children, (child, i) => {
|
|
1668
1814
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1669
|
-
const { label } = child.props;
|
|
1670
1815
|
return /* @__PURE__ */ jsx(Content$2, {
|
|
1671
1816
|
className: "h-full",
|
|
1672
|
-
value:
|
|
1817
|
+
value: resolveTabValue(child.props),
|
|
1673
1818
|
children: child
|
|
1674
1819
|
}, i);
|
|
1675
1820
|
})
|
|
@@ -2189,6 +2334,33 @@ function ToolbarCloseButton(props) {
|
|
|
2189
2334
|
});
|
|
2190
2335
|
}
|
|
2191
2336
|
/**
|
|
2337
|
+
* Toolbar control for upgrading the document to the latest installed
|
|
2338
|
+
* document model version. Renders nothing when the document is already
|
|
2339
|
+
* current or no upgrade path is registered.
|
|
2340
|
+
*/
|
|
2341
|
+
function ToolbarUpgradeButton(props) {
|
|
2342
|
+
const { className, onClick: onClickOverride, document, children } = props;
|
|
2343
|
+
const versionStatus = useDocumentVersionStatus(document);
|
|
2344
|
+
const runUpgrade = () => {
|
|
2345
|
+
if (document) showPHModal({
|
|
2346
|
+
type: "confirmDocumentUpgrade",
|
|
2347
|
+
documentId: document.header.id
|
|
2348
|
+
});
|
|
2349
|
+
};
|
|
2350
|
+
const onClick = makeOnClick(document, onClickOverride, runUpgrade);
|
|
2351
|
+
if (!versionStatus || versionStatus.kind !== "upgrade-available" || !versionStatus.canUpgrade) return null;
|
|
2352
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
2353
|
+
"data-testid": "toolbar-upgrade-button",
|
|
2354
|
+
"aria-label": "Update document",
|
|
2355
|
+
className,
|
|
2356
|
+
onClick,
|
|
2357
|
+
children: children ?? /* @__PURE__ */ jsx("span", {
|
|
2358
|
+
className: "px-1 text-xs",
|
|
2359
|
+
children: "Update available"
|
|
2360
|
+
})
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2192
2364
|
* Creates a toolbar button click handler.
|
|
2193
2365
|
*
|
|
2194
2366
|
* If an override is provided, it is called with the current document. Otherwise,
|
|
@@ -2273,6 +2445,7 @@ const defaultControlSlots = {
|
|
|
2273
2445
|
],
|
|
2274
2446
|
second: ["name"],
|
|
2275
2447
|
third: [
|
|
2448
|
+
"update",
|
|
2276
2449
|
"history",
|
|
2277
2450
|
"switchboard",
|
|
2278
2451
|
"close"
|
|
@@ -2303,6 +2476,7 @@ const defaultControlComponents = {
|
|
|
2303
2476
|
redo: ToolbarRedoButton,
|
|
2304
2477
|
download: ToolbarDownloadButton,
|
|
2305
2478
|
name: ToolbarName,
|
|
2479
|
+
update: ToolbarUpgradeButton,
|
|
2306
2480
|
switchboard: ToolbarSwitchboardButton,
|
|
2307
2481
|
history: ToolbarHistoryButton,
|
|
2308
2482
|
close: ToolbarCloseButton
|
|
@@ -2441,11 +2615,6 @@ function ControlsContainerSlot(props) {
|
|
|
2441
2615
|
}
|
|
2442
2616
|
//#endregion
|
|
2443
2617
|
//#region src/connect/components/drive-auth-gate/drive-auth-gate.tsx
|
|
2444
|
-
/**
|
|
2445
|
-
* Reusable "log in to access this drive" card. Used both as the content of the
|
|
2446
|
-
* drive-add auth modal and as the full-page gate shown when the user logs out
|
|
2447
|
-
* while inside a protected drive — so the two stay visually identical.
|
|
2448
|
-
*/
|
|
2449
2618
|
function DriveAuthGate(props) {
|
|
2450
2619
|
const { mode = "login", onLogin, onLogout, className } = props;
|
|
2451
2620
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -4662,19 +4831,19 @@ function AddDriveModal(props) {
|
|
|
4662
4831
|
}
|
|
4663
4832
|
//#endregion
|
|
4664
4833
|
//#region src/connect/components/modal/create-document-modal.tsx
|
|
4665
|
-
const CLOSE_ANIMATION_DURATION = 300;
|
|
4834
|
+
const CLOSE_ANIMATION_DURATION$1 = 300;
|
|
4666
4835
|
function CreateDocumentModal(props) {
|
|
4667
4836
|
const { onOpenChange, onContinue, overlayProps, contentProps, ...restProps } = props;
|
|
4668
4837
|
const [nodeName, setNodeName] = useState("");
|
|
4669
4838
|
const [isValid, setIsValid] = useState(false);
|
|
4670
4839
|
const handleCancel = () => {
|
|
4671
4840
|
onOpenChange?.(false);
|
|
4672
|
-
setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION);
|
|
4841
|
+
setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
|
|
4673
4842
|
};
|
|
4674
4843
|
const handleCreate = useCallback(() => {
|
|
4675
4844
|
if (!isValid) return;
|
|
4676
4845
|
onContinue(nodeName);
|
|
4677
|
-
setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION);
|
|
4846
|
+
setTimeout(() => setNodeName(""), CLOSE_ANIMATION_DURATION$1);
|
|
4678
4847
|
}, [
|
|
4679
4848
|
isValid,
|
|
4680
4849
|
nodeName,
|
|
@@ -4737,6 +4906,135 @@ function CreateDocumentModal(props) {
|
|
|
4737
4906
|
});
|
|
4738
4907
|
}
|
|
4739
4908
|
//#endregion
|
|
4909
|
+
//#region src/connect/components/modal/create-document-with-type-modal.tsx
|
|
4910
|
+
const CLOSE_ANIMATION_DURATION = 300;
|
|
4911
|
+
const PLACEHOLDER_KEY = "";
|
|
4912
|
+
function optionKey(option) {
|
|
4913
|
+
return `${option.documentType}::${option.version ?? "latest"}`;
|
|
4914
|
+
}
|
|
4915
|
+
function optionDisplayName(option) {
|
|
4916
|
+
return option.version ? `${option.name} v${option.version}` : option.name;
|
|
4917
|
+
}
|
|
4918
|
+
function CreateDocumentWithTypeModal(props) {
|
|
4919
|
+
const { documentTypes, onCreate, onTypeSelected, onOpenChange, overlayProps, contentProps, ...restProps } = props;
|
|
4920
|
+
const [documentName, setDocumentName] = useState("");
|
|
4921
|
+
const [isNameValid, setIsNameValid] = useState(false);
|
|
4922
|
+
const [selectedKey, setSelectedKey] = useState(PLACEHOLDER_KEY);
|
|
4923
|
+
const selectedOption = documentTypes.find((option) => optionKey(option) === selectedKey);
|
|
4924
|
+
const canCreate = isNameValid && selectedOption !== void 0;
|
|
4925
|
+
const typeItems = documentTypes.map((option) => ({
|
|
4926
|
+
value: optionKey(option),
|
|
4927
|
+
displayValue: optionDisplayName(option)
|
|
4928
|
+
}));
|
|
4929
|
+
const items = selectedKey === PLACEHOLDER_KEY ? [{
|
|
4930
|
+
value: PLACEHOLDER_KEY,
|
|
4931
|
+
displayValue: "Select document type…"
|
|
4932
|
+
}, ...typeItems] : typeItems;
|
|
4933
|
+
const resetAfterClose = useCallback(() => {
|
|
4934
|
+
setTimeout(() => {
|
|
4935
|
+
setDocumentName("");
|
|
4936
|
+
setIsNameValid(false);
|
|
4937
|
+
setSelectedKey(PLACEHOLDER_KEY);
|
|
4938
|
+
}, CLOSE_ANIMATION_DURATION);
|
|
4939
|
+
}, []);
|
|
4940
|
+
const handleOpenChange = (open) => {
|
|
4941
|
+
onOpenChange?.(open);
|
|
4942
|
+
if (!open) resetAfterClose();
|
|
4943
|
+
};
|
|
4944
|
+
const handleCancel = () => {
|
|
4945
|
+
handleOpenChange(false);
|
|
4946
|
+
};
|
|
4947
|
+
const handleTypeChange = (value) => {
|
|
4948
|
+
if (value === PLACEHOLDER_KEY) return;
|
|
4949
|
+
setSelectedKey(value);
|
|
4950
|
+
const option = documentTypes.find((o) => optionKey(o) === value);
|
|
4951
|
+
if (option) onTypeSelected?.(option.documentType);
|
|
4952
|
+
};
|
|
4953
|
+
const handleCreate = useCallback(() => {
|
|
4954
|
+
if (!canCreate) return;
|
|
4955
|
+
onCreate({
|
|
4956
|
+
name: documentName,
|
|
4957
|
+
documentType: selectedOption.documentType,
|
|
4958
|
+
version: selectedOption.version
|
|
4959
|
+
});
|
|
4960
|
+
resetAfterClose();
|
|
4961
|
+
}, [
|
|
4962
|
+
canCreate,
|
|
4963
|
+
documentName,
|
|
4964
|
+
onCreate,
|
|
4965
|
+
resetAfterClose,
|
|
4966
|
+
selectedOption
|
|
4967
|
+
]);
|
|
4968
|
+
const handleSubmit = useCallback((e) => {
|
|
4969
|
+
e.preventDefault();
|
|
4970
|
+
handleCreate();
|
|
4971
|
+
}, [handleCreate]);
|
|
4972
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
4973
|
+
contentProps,
|
|
4974
|
+
onOpenChange: handleOpenChange,
|
|
4975
|
+
overlayProps,
|
|
4976
|
+
title: "Create a new document",
|
|
4977
|
+
...restProps,
|
|
4978
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
4979
|
+
name: "create-document-with-type",
|
|
4980
|
+
className: "max-h-[85vh] w-100 overflow-y-auto rounded-xl bg-background p-6 text-foreground",
|
|
4981
|
+
onSubmit: handleSubmit,
|
|
4982
|
+
children: [
|
|
4983
|
+
/* @__PURE__ */ jsx("div", {
|
|
4984
|
+
className: "pb-2 text-2xl font-bold text-foreground",
|
|
4985
|
+
children: "Create a new document"
|
|
4986
|
+
}),
|
|
4987
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4988
|
+
className: "my-6",
|
|
4989
|
+
children: [!isNameValid && documentName ? /* @__PURE__ */ jsx("div", {
|
|
4990
|
+
className: "mb-2 text-destructive",
|
|
4991
|
+
children: "Document name must not be empty or contain control characters."
|
|
4992
|
+
}) : null, /* @__PURE__ */ jsx(FormInput, {
|
|
4993
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "BrickGlobe" }),
|
|
4994
|
+
onChange: (e) => {
|
|
4995
|
+
const name = e.target.value;
|
|
4996
|
+
setDocumentName(name);
|
|
4997
|
+
setIsNameValid(isValidName(name));
|
|
4998
|
+
},
|
|
4999
|
+
placeholder: "Document name",
|
|
5000
|
+
required: true,
|
|
5001
|
+
value: documentName
|
|
5002
|
+
})]
|
|
5003
|
+
}),
|
|
5004
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5005
|
+
className: "my-6",
|
|
5006
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
5007
|
+
className: "mb-2 text-sm font-medium text-foreground",
|
|
5008
|
+
htmlFor: "document-type",
|
|
5009
|
+
children: "Document type"
|
|
5010
|
+
}), /* @__PURE__ */ jsx(ConnectSelect, {
|
|
5011
|
+
id: "document-type",
|
|
5012
|
+
items,
|
|
5013
|
+
listClassName: "max-h-80 overflow-y-auto overscroll-contain",
|
|
5014
|
+
menuClassName: "min-w-0",
|
|
5015
|
+
onChange: handleTypeChange,
|
|
5016
|
+
value: selectedKey
|
|
5017
|
+
})]
|
|
5018
|
+
}),
|
|
5019
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5020
|
+
className: "mt-8 flex justify-between gap-3",
|
|
5021
|
+
children: [/* @__PURE__ */ jsx(ModalButton, {
|
|
5022
|
+
onClick: handleCancel,
|
|
5023
|
+
type: "button",
|
|
5024
|
+
variant: "cancel",
|
|
5025
|
+
children: "Cancel"
|
|
5026
|
+
}), /* @__PURE__ */ jsx(ModalButton, {
|
|
5027
|
+
disabled: !canCreate,
|
|
5028
|
+
type: "submit",
|
|
5029
|
+
variant: "confirm",
|
|
5030
|
+
children: "Create"
|
|
5031
|
+
})]
|
|
5032
|
+
})
|
|
5033
|
+
]
|
|
5034
|
+
})
|
|
5035
|
+
});
|
|
5036
|
+
}
|
|
5037
|
+
//#endregion
|
|
4740
5038
|
//#region src/connect/components/modal/delete-drive-modal.tsx
|
|
4741
5039
|
const ConnectDeleteDriveModal = (props) => {
|
|
4742
5040
|
const { inputPlaceholder, body, driveName, ...confirmationModalProps } = props;
|
|
@@ -6814,6 +7112,10 @@ function WorkerInspector({ getInfo, onRestart }) {
|
|
|
6814
7112
|
/* @__PURE__ */ jsx(Field, {
|
|
6815
7113
|
label: "RPC protocol",
|
|
6816
7114
|
value: String(info.rpcProtocolVersion)
|
|
7115
|
+
}),
|
|
7116
|
+
/* @__PURE__ */ jsx(Field, {
|
|
7117
|
+
label: "Enforcement flags",
|
|
7118
|
+
value: info.featureFlags === void 0 || info.featureFlags === "" ? "none" : info.featureFlags
|
|
6817
7119
|
})
|
|
6818
7120
|
]
|
|
6819
7121
|
})]
|
|
@@ -7373,6 +7675,76 @@ function buildPackageSpec(name, tag) {
|
|
|
7373
7675
|
return tag ? `${name}@${tag}` : name;
|
|
7374
7676
|
}
|
|
7375
7677
|
//#endregion
|
|
7678
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/filter-packages.ts
|
|
7679
|
+
/**
|
|
7680
|
+
* Client-side package filter used by both Package Manager tabs. Matches the
|
|
7681
|
+
* query's name part (any `@tag` suffix is ignored for matching — it drives
|
|
7682
|
+
* version preselection instead) against the package name only.
|
|
7683
|
+
*
|
|
7684
|
+
* This is the seam a future registry search endpoint replaces: when the
|
|
7685
|
+
* Available tab searches server-side, its panel skips this function and
|
|
7686
|
+
* renders the API results as-is.
|
|
7687
|
+
*/
|
|
7688
|
+
function filterPackages(packages, query) {
|
|
7689
|
+
const { name } = parsePackageSpec(query);
|
|
7690
|
+
const needle = name.toLowerCase();
|
|
7691
|
+
if (!needle) return packages;
|
|
7692
|
+
return packages.filter((pkg) => pkg.name.toLowerCase().includes(needle));
|
|
7693
|
+
}
|
|
7694
|
+
//#endregion
|
|
7695
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/npm-fallback-row.tsx
|
|
7696
|
+
/**
|
|
7697
|
+
* Shown in the Available tab when the search query matches nothing in the
|
|
7698
|
+
* registry but looks like a valid npm package name: the registry's verdaccio
|
|
7699
|
+
* backend proxies npmjs.org, so the install can still succeed. Replaces the
|
|
7700
|
+
* old SearchAutocomplete fallback option. The button label is "Install from
|
|
7701
|
+
* npm" (not "Install") so it doesn't collide with the row-kebab menu item.
|
|
7702
|
+
*/
|
|
7703
|
+
const NpmFallbackRow = (props) => {
|
|
7704
|
+
const { query, onInstall, disabled } = props;
|
|
7705
|
+
const [isInstalling, setIsInstalling] = useState(false);
|
|
7706
|
+
const { name, tag } = parsePackageSpec(query);
|
|
7707
|
+
const spec = buildPackageSpec(name, tag);
|
|
7708
|
+
function handleInstall() {
|
|
7709
|
+
setIsInstalling(true);
|
|
7710
|
+
onInstall(spec).catch(console.error).finally(() => setIsInstalling(false));
|
|
7711
|
+
}
|
|
7712
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7713
|
+
className: "flex items-start justify-between gap-3 rounded-md border border-dashed border-border bg-background p-3 text-sm/5",
|
|
7714
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7715
|
+
className: "min-w-0 flex-1",
|
|
7716
|
+
children: [
|
|
7717
|
+
/* @__PURE__ */ jsx("p", {
|
|
7718
|
+
className: "truncate font-semibold text-foreground",
|
|
7719
|
+
children: tag ? `${name} @ ${tag}` : name
|
|
7720
|
+
}),
|
|
7721
|
+
/* @__PURE__ */ jsx("p", {
|
|
7722
|
+
className: "text-xs text-foreground",
|
|
7723
|
+
children: "Not published to this registry. Install via the npmjs.org uplink."
|
|
7724
|
+
}),
|
|
7725
|
+
/* @__PURE__ */ jsx("p", {
|
|
7726
|
+
className: "text-xs text-muted-foreground",
|
|
7727
|
+
children: "npm fallback"
|
|
7728
|
+
})
|
|
7729
|
+
]
|
|
7730
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
7731
|
+
className: "shrink-0 self-center",
|
|
7732
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
7733
|
+
onClick: handleInstall,
|
|
7734
|
+
disabled: disabled || isInstalling,
|
|
7735
|
+
className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
|
|
7736
|
+
children: isInstalling ? "Installing..." : "Install from npm"
|
|
7737
|
+
})
|
|
7738
|
+
})]
|
|
7739
|
+
});
|
|
7740
|
+
};
|
|
7741
|
+
//#endregion
|
|
7742
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/npm-name.ts
|
|
7743
|
+
const NPM_NAME_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$|^[a-z0-9][a-z0-9._-]*$/i;
|
|
7744
|
+
function isPlausiblePackageName(name) {
|
|
7745
|
+
return name.length >= 2 && NPM_NAME_RE.test(name);
|
|
7746
|
+
}
|
|
7747
|
+
//#endregion
|
|
7376
7748
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/version-picker.tsx
|
|
7377
7749
|
function resolveDefaultVersionSelection(options) {
|
|
7378
7750
|
const { distTags, versions, version, preferredTag } = options;
|
|
@@ -7516,147 +7888,6 @@ const VersionPicker = (props) => {
|
|
|
7516
7888
|
});
|
|
7517
7889
|
};
|
|
7518
7890
|
//#endregion
|
|
7519
|
-
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager-input.tsx
|
|
7520
|
-
const NPM_NAME_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$|^[a-z0-9][a-z0-9._-]*$/i;
|
|
7521
|
-
function isPlausiblePackageName(name) {
|
|
7522
|
-
return name.length >= 2 && NPM_NAME_RE.test(name);
|
|
7523
|
-
}
|
|
7524
|
-
function PackageResultCard(props) {
|
|
7525
|
-
const { option, ctx, typedTag } = props;
|
|
7526
|
-
const { selectingValue, selectLabel, selectingContent, handleSelect } = ctx;
|
|
7527
|
-
const baseName = option.label.split(" @ ")[0] ?? option.value;
|
|
7528
|
-
const hasVersionMetadata = option.distTags && Object.keys(option.distTags).length > 0 || (option.versions?.length ?? 0) > 0;
|
|
7529
|
-
const [selected, setSelected] = useState(() => resolveDefaultVersionSelection({
|
|
7530
|
-
distTags: option.distTags,
|
|
7531
|
-
versions: option.versions,
|
|
7532
|
-
version: option.version,
|
|
7533
|
-
preferredTag: typedTag
|
|
7534
|
-
}));
|
|
7535
|
-
useEffect(() => {
|
|
7536
|
-
if (!typedTag) return;
|
|
7537
|
-
if (option.distTags && typedTag in option.distTags) setSelected({
|
|
7538
|
-
kind: "tag",
|
|
7539
|
-
value: typedTag
|
|
7540
|
-
});
|
|
7541
|
-
else if (option.versions?.includes(typedTag)) setSelected({
|
|
7542
|
-
kind: "version",
|
|
7543
|
-
value: typedTag
|
|
7544
|
-
});
|
|
7545
|
-
}, [
|
|
7546
|
-
typedTag,
|
|
7547
|
-
option.distTags,
|
|
7548
|
-
option.versions
|
|
7549
|
-
]);
|
|
7550
|
-
const installSpec = hasVersionMetadata ? buildPackageSpec(baseName, selected.value) : option.value;
|
|
7551
|
-
const isSelecting = selectingValue === installSpec;
|
|
7552
|
-
const isDisabled = option.disabled === true;
|
|
7553
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
7554
|
-
className: "flex items-start justify-between gap-3 rounded-md p-2 hover:hover-effect",
|
|
7555
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
7556
|
-
className: "min-w-0 flex-1",
|
|
7557
|
-
children: [
|
|
7558
|
-
/* @__PURE__ */ jsx("p", {
|
|
7559
|
-
className: "truncate text-sm font-medium text-foreground",
|
|
7560
|
-
children: baseName
|
|
7561
|
-
}),
|
|
7562
|
-
option.description && /* @__PURE__ */ jsx("p", {
|
|
7563
|
-
className: "truncate text-xs text-foreground",
|
|
7564
|
-
children: option.description
|
|
7565
|
-
}),
|
|
7566
|
-
option.meta && /* @__PURE__ */ jsx("p", {
|
|
7567
|
-
className: "truncate text-xs text-foreground",
|
|
7568
|
-
children: option.meta
|
|
7569
|
-
}),
|
|
7570
|
-
hasVersionMetadata && /* @__PURE__ */ jsx("div", {
|
|
7571
|
-
className: "mt-2",
|
|
7572
|
-
children: /* @__PURE__ */ jsx(VersionPicker, {
|
|
7573
|
-
distTags: option.distTags,
|
|
7574
|
-
versions: option.versions,
|
|
7575
|
-
selected,
|
|
7576
|
-
onChange: setSelected,
|
|
7577
|
-
disabled: isDisabled
|
|
7578
|
-
})
|
|
7579
|
-
})
|
|
7580
|
-
]
|
|
7581
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
7582
|
-
className: "shrink-0 self-center",
|
|
7583
|
-
children: isSelecting && selectingContent ? /* @__PURE__ */ jsx("div", {
|
|
7584
|
-
className: "flex items-center justify-center",
|
|
7585
|
-
children: selectingContent
|
|
7586
|
-
}) : isDisabled ? /* @__PURE__ */ jsx("span", {
|
|
7587
|
-
className: "rounded-md bg-muted px-3 py-1 text-xs font-medium text-muted-foreground",
|
|
7588
|
-
children: option.disabledLabel ?? "Unavailable"
|
|
7589
|
-
}) : /* @__PURE__ */ jsx("button", {
|
|
7590
|
-
onClick: () => handleSelect(installSpec),
|
|
7591
|
-
disabled: isSelecting,
|
|
7592
|
-
className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
|
|
7593
|
-
children: isSelecting ? "..." : selectLabel
|
|
7594
|
-
})
|
|
7595
|
-
})]
|
|
7596
|
-
});
|
|
7597
|
-
}
|
|
7598
|
-
const PackageManagerInput = (props) => {
|
|
7599
|
-
const { registryPackageList, onInstall, disabled, className } = props;
|
|
7600
|
-
const [typedTag, setTypedTag] = useState(void 0);
|
|
7601
|
-
const fetchOptions = async (query) => {
|
|
7602
|
-
const { name: namePart, tag } = parsePackageSpec(query);
|
|
7603
|
-
setTypedTag(tag);
|
|
7604
|
-
const needle = namePart.toLowerCase();
|
|
7605
|
-
const localOptions = registryPackageList.filter((pkg) => pkg.name.toLowerCase().includes(needle) || pkg.manifest?.description?.toLowerCase().includes(needle)).map((pkg) => {
|
|
7606
|
-
const isInstalled = pkg.status === "local-install" || pkg.status === "registry-install";
|
|
7607
|
-
return {
|
|
7608
|
-
value: pkg.name,
|
|
7609
|
-
label: pkg.name,
|
|
7610
|
-
version: pkg.version,
|
|
7611
|
-
description: pkg.manifest?.description,
|
|
7612
|
-
meta: pkg.manifest?.publisher?.name,
|
|
7613
|
-
disabled: isInstalled,
|
|
7614
|
-
disabledLabel: isInstalled ? "Installed" : void 0,
|
|
7615
|
-
distTags: pkg.distTags,
|
|
7616
|
-
versions: pkg.versions
|
|
7617
|
-
};
|
|
7618
|
-
});
|
|
7619
|
-
if (!isPlausiblePackageName(namePart) || localOptions.length > 0) return Promise.resolve(localOptions);
|
|
7620
|
-
const fallbackOption = {
|
|
7621
|
-
value: buildPackageSpec(namePart, tag),
|
|
7622
|
-
label: tag ? `${namePart} @ ${tag}` : namePart,
|
|
7623
|
-
version: tag,
|
|
7624
|
-
description: "Not published to this registry. Install via the npmjs.org uplink.",
|
|
7625
|
-
meta: "npm fallback"
|
|
7626
|
-
};
|
|
7627
|
-
return Promise.resolve([fallbackOption]);
|
|
7628
|
-
};
|
|
7629
|
-
const handleSelect = useCallback((value) => {
|
|
7630
|
-
return onInstall(value);
|
|
7631
|
-
}, [onInstall]);
|
|
7632
|
-
const renderRow = useCallback((option, ctx) => /* @__PURE__ */ jsx(PackageResultCard, {
|
|
7633
|
-
option,
|
|
7634
|
-
ctx,
|
|
7635
|
-
typedTag
|
|
7636
|
-
}), [typedTag]);
|
|
7637
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
7638
|
-
className,
|
|
7639
|
-
children: [/* @__PURE__ */ jsx("h3", {
|
|
7640
|
-
className: "mb-4 font-semibold text-foreground",
|
|
7641
|
-
children: "Install Package"
|
|
7642
|
-
}), /* @__PURE__ */ jsx(SearchAutocomplete, {
|
|
7643
|
-
fetchOptions,
|
|
7644
|
-
onSelect: handleSelect,
|
|
7645
|
-
selectLabel: "Install",
|
|
7646
|
-
selectingContent: /* @__PURE__ */ jsx(PackageAnimation, {
|
|
7647
|
-
animate: true,
|
|
7648
|
-
loop: true,
|
|
7649
|
-
color: "#6b7280",
|
|
7650
|
-
size: 48
|
|
7651
|
-
}),
|
|
7652
|
-
placeholder: "Search packages (e.g. my-pkg, my-pkg@dev, my-pkg@1.2.3)...",
|
|
7653
|
-
disabled,
|
|
7654
|
-
renderRow,
|
|
7655
|
-
keepOpenSelector: "[data-version-picker],[data-version-picker-trigger]"
|
|
7656
|
-
})]
|
|
7657
|
-
});
|
|
7658
|
-
};
|
|
7659
|
-
//#endregion
|
|
7660
7891
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager-list.tsx
|
|
7661
7892
|
const PackageDetail = ({ label, value }) => {
|
|
7662
7893
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -7671,15 +7902,31 @@ const PackageDetail = ({ label, value }) => {
|
|
|
7671
7902
|
});
|
|
7672
7903
|
};
|
|
7673
7904
|
const PackageManagerListItem = (props) => {
|
|
7674
|
-
const { registryPackage, onInstall, onUninstall, className } = props;
|
|
7905
|
+
const { registryPackage, onInstall, onUninstall, preferredTag, className } = props;
|
|
7675
7906
|
const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
|
|
7676
7907
|
const canPickVersion = registryPackage.status === "available" || registryPackage.status === "dismissed";
|
|
7677
7908
|
const hasVersionMetadata = registryPackage.distTags && Object.keys(registryPackage.distTags).length > 0 || (registryPackage.versions?.length ?? 0) > 0;
|
|
7678
7909
|
const [selected, setSelected] = useState(() => resolveDefaultVersionSelection({
|
|
7679
7910
|
distTags: registryPackage.distTags,
|
|
7680
7911
|
versions: registryPackage.versions,
|
|
7681
|
-
version: registryPackage.version
|
|
7912
|
+
version: registryPackage.version,
|
|
7913
|
+
preferredTag
|
|
7682
7914
|
}));
|
|
7915
|
+
useEffect(() => {
|
|
7916
|
+
if (!preferredTag) return;
|
|
7917
|
+
if (registryPackage.distTags && preferredTag in registryPackage.distTags) setSelected({
|
|
7918
|
+
kind: "tag",
|
|
7919
|
+
value: preferredTag
|
|
7920
|
+
});
|
|
7921
|
+
else if (registryPackage.versions?.includes(preferredTag)) setSelected({
|
|
7922
|
+
kind: "version",
|
|
7923
|
+
value: preferredTag
|
|
7924
|
+
});
|
|
7925
|
+
}, [
|
|
7926
|
+
preferredTag,
|
|
7927
|
+
registryPackage.distTags,
|
|
7928
|
+
registryPackage.versions
|
|
7929
|
+
]);
|
|
7683
7930
|
const installDropdownItem = {
|
|
7684
7931
|
id: "install",
|
|
7685
7932
|
label: "Install",
|
|
@@ -7716,31 +7963,38 @@ const PackageManagerListItem = (props) => {
|
|
|
7716
7963
|
}),
|
|
7717
7964
|
registryPackage.manifest !== null && (() => {
|
|
7718
7965
|
const { description, category, publisher } = registryPackage.manifest;
|
|
7719
|
-
|
|
7966
|
+
const publisherName = publisher?.name;
|
|
7967
|
+
const publisherUrl = publisher?.url;
|
|
7968
|
+
const hasText = (value) => typeof value === "string" && value.trim() !== "";
|
|
7969
|
+
const showDescription = hasText(description);
|
|
7970
|
+
const showCategory = hasText(category);
|
|
7971
|
+
const showPublisher = hasText(publisherName);
|
|
7972
|
+
const showPublisherUrl = hasText(publisherUrl);
|
|
7973
|
+
if (!showDescription && !showCategory && !showPublisher && !showPublisherUrl) return null;
|
|
7720
7974
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
7721
|
-
|
|
7975
|
+
showDescription && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7722
7976
|
label: "Description",
|
|
7723
7977
|
value: description
|
|
7724
7978
|
}),
|
|
7725
|
-
|
|
7979
|
+
showCategory && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7726
7980
|
label: "Category",
|
|
7727
7981
|
value: category
|
|
7728
7982
|
}),
|
|
7729
|
-
|
|
7983
|
+
showPublisher && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7730
7984
|
label: "Publisher",
|
|
7731
|
-
value:
|
|
7985
|
+
value: publisherName
|
|
7732
7986
|
}),
|
|
7733
|
-
|
|
7987
|
+
showPublisherUrl && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7734
7988
|
label: "Publisher URL",
|
|
7735
7989
|
value: /* @__PURE__ */ jsx("a", {
|
|
7736
7990
|
className: "underline",
|
|
7737
|
-
href:
|
|
7738
|
-
children:
|
|
7991
|
+
href: publisherUrl,
|
|
7992
|
+
children: publisherUrl
|
|
7739
7993
|
})
|
|
7740
7994
|
})
|
|
7741
7995
|
] });
|
|
7742
7996
|
})(),
|
|
7743
|
-
/* @__PURE__ */ jsx(ConnectDropdownMenu, {
|
|
7997
|
+
dropdownItems.length > 0 && /* @__PURE__ */ jsx(ConnectDropdownMenu, {
|
|
7744
7998
|
items: dropdownItems,
|
|
7745
7999
|
onItemClick: (id) => {
|
|
7746
8000
|
if (id === "install") {
|
|
@@ -7766,141 +8020,46 @@ const PackageManagerListItem = (props) => {
|
|
|
7766
8020
|
]
|
|
7767
8021
|
});
|
|
7768
8022
|
};
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
return () => window.removeEventListener("resize", calculateMaxHeight);
|
|
7784
|
-
}, []);
|
|
7785
|
-
const hasLocallyInstalled = locallyInstalledPackages.length > 0;
|
|
7786
|
-
const hasRegistryInstalled = registryInstalledPackages.length > 0;
|
|
7787
|
-
const hasAnyInstalled = hasLocallyInstalled || hasRegistryInstalled;
|
|
7788
|
-
const hasAvailable = availablePackages.length > 0;
|
|
7789
|
-
const hasDismissed = dismissedPackages.length > 0;
|
|
7790
|
-
const installedCount = locallyInstalledPackages.length + registryInstalledPackages.length;
|
|
7791
|
-
return /* @__PURE__ */ jsx("div", {
|
|
7792
|
-
className: twMerge("flex flex-col items-stretch overflow-hidden", className),
|
|
7793
|
-
style: { maxHeight },
|
|
7794
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
7795
|
-
className: "flex-1 overflow-y-auto pr-2",
|
|
7796
|
-
children: [
|
|
7797
|
-
/* @__PURE__ */ jsxs(PackageSection, {
|
|
7798
|
-
sectionId: "installed",
|
|
7799
|
-
title: "Installed Packages",
|
|
7800
|
-
count: installedCount,
|
|
7801
|
-
isEmpty: !hasAnyInstalled,
|
|
7802
|
-
emptyText: "No packages installed.",
|
|
7803
|
-
children: [hasLocallyInstalled && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
7804
|
-
title: "Locally installed",
|
|
7805
|
-
count: locallyInstalledPackages.length,
|
|
7806
|
-
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7807
|
-
packages: locallyInstalledPackages,
|
|
7808
|
-
onInstall,
|
|
7809
|
-
onUninstall
|
|
7810
|
-
})
|
|
7811
|
-
}), hasRegistryInstalled && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
7812
|
-
title: "Installed from registry",
|
|
7813
|
-
count: registryInstalledPackages.length,
|
|
7814
|
-
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7815
|
-
packages: registryInstalledPackages,
|
|
7816
|
-
onInstall,
|
|
7817
|
-
onUninstall
|
|
7818
|
-
})
|
|
7819
|
-
})]
|
|
7820
|
-
}),
|
|
7821
|
-
/* @__PURE__ */ jsx(PackageSection, {
|
|
7822
|
-
sectionId: "available",
|
|
7823
|
-
title: "Available Packages",
|
|
7824
|
-
count: availablePackages.length,
|
|
7825
|
-
isEmpty: !hasAvailable,
|
|
7826
|
-
emptyText: "No packages available to install.",
|
|
7827
|
-
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7828
|
-
packages: availablePackages,
|
|
7829
|
-
onInstall,
|
|
7830
|
-
onUninstall
|
|
7831
|
-
})
|
|
7832
|
-
}),
|
|
7833
|
-
hasDismissed && /* @__PURE__ */ jsx(PackageSection, {
|
|
7834
|
-
sectionId: "dismissed",
|
|
7835
|
-
title: "Dismissed Packages",
|
|
7836
|
-
count: dismissedPackages.length,
|
|
7837
|
-
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7838
|
-
packages: dismissedPackages,
|
|
7839
|
-
onInstall,
|
|
7840
|
-
onUninstall
|
|
7841
|
-
})
|
|
7842
|
-
})
|
|
7843
|
-
]
|
|
7844
|
-
})
|
|
8023
|
+
/**
|
|
8024
|
+
* Scroll region shared by both Package Manager tab panels. Fills the space
|
|
8025
|
+
* the panel gives it and scrolls its overflow. This works because the tab
|
|
8026
|
+
* panel sits inside the settings content card, which has a bounded height
|
|
8027
|
+
* (`m-6 ... h-full flex-1 overflow-hidden`); the flex chain down to here is
|
|
8028
|
+
* unbroken (`min-h-0` + `flex-1`/`h-full` at every level), so no
|
|
8029
|
+
* viewport-measuring hack is needed.
|
|
8030
|
+
*/
|
|
8031
|
+
const PackagePanelScrollArea = ({ children, className, onReachEnd }) => {
|
|
8032
|
+
const scrollRef = useRef(null);
|
|
8033
|
+
const sentinelRef = useRef(null);
|
|
8034
|
+
const onReachEndRef = useRef(onReachEnd);
|
|
8035
|
+
useEffect(() => {
|
|
8036
|
+
onReachEndRef.current = onReachEnd;
|
|
7845
8037
|
});
|
|
7846
|
-
|
|
7847
|
-
const STORAGE_KEY = "ph:package-manager:collapsed-sections";
|
|
7848
|
-
function loadCollapsedSections() {
|
|
7849
|
-
if (typeof window === "undefined") return {};
|
|
7850
|
-
try {
|
|
7851
|
-
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
7852
|
-
return raw ? JSON.parse(raw) : {};
|
|
7853
|
-
} catch {
|
|
7854
|
-
return {};
|
|
7855
|
-
}
|
|
7856
|
-
}
|
|
7857
|
-
function useCollapsedSection(sectionId) {
|
|
7858
|
-
const [collapsed, setCollapsed] = useState(() => loadCollapsedSections()[sectionId] ?? true);
|
|
8038
|
+
const hasHandler = onReachEnd !== void 0;
|
|
7859
8039
|
useEffect(() => {
|
|
7860
|
-
if (
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
7884
|
-
name: "ChevronDown",
|
|
7885
|
-
size: 16,
|
|
7886
|
-
className: twMerge("shrink-0 text-foreground transition-transform", collapsed && "-rotate-90")
|
|
7887
|
-
}),
|
|
7888
|
-
/* @__PURE__ */ jsx("span", { children: title }),
|
|
7889
|
-
/* @__PURE__ */ jsx("span", {
|
|
7890
|
-
className: "text-xs font-medium text-foreground",
|
|
7891
|
-
children: count
|
|
7892
|
-
})
|
|
7893
|
-
]
|
|
7894
|
-
})
|
|
7895
|
-
}), !collapsed && /* @__PURE__ */ jsx("div", {
|
|
7896
|
-
id: contentId,
|
|
7897
|
-
children: isEmpty ? /* @__PURE__ */ jsx("p", {
|
|
7898
|
-
className: "text-sm text-foreground",
|
|
7899
|
-
children: emptyText
|
|
7900
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
7901
|
-
className: "flex flex-col gap-4",
|
|
7902
|
-
children
|
|
7903
|
-
})
|
|
8040
|
+
if (!hasHandler) return;
|
|
8041
|
+
const root = scrollRef.current;
|
|
8042
|
+
const sentinel = sentinelRef.current;
|
|
8043
|
+
if (!root || !sentinel) return;
|
|
8044
|
+
const observer = new IntersectionObserver((entries) => {
|
|
8045
|
+
if (entries.some((e) => e.isIntersecting)) onReachEndRef.current?.();
|
|
8046
|
+
}, {
|
|
8047
|
+
root,
|
|
8048
|
+
rootMargin: "200px"
|
|
8049
|
+
});
|
|
8050
|
+
observer.observe(sentinel);
|
|
8051
|
+
return () => observer.disconnect();
|
|
8052
|
+
}, [hasHandler]);
|
|
8053
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8054
|
+
ref: scrollRef,
|
|
8055
|
+
className: twMerge("min-h-0 flex-1 overflow-y-auto", className),
|
|
8056
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
8057
|
+
className: "pr-3 pb-3",
|
|
8058
|
+
children
|
|
8059
|
+
}), hasHandler && /* @__PURE__ */ jsx("div", {
|
|
8060
|
+
ref: sentinelRef,
|
|
8061
|
+
"aria-hidden": true,
|
|
8062
|
+
className: "h-px w-full"
|
|
7904
8063
|
})]
|
|
7905
8064
|
});
|
|
7906
8065
|
};
|
|
@@ -7917,31 +8076,286 @@ const PackageSubSection = ({ title, count, children }) => {
|
|
|
7917
8076
|
})]
|
|
7918
8077
|
}), children] });
|
|
7919
8078
|
};
|
|
7920
|
-
const PackageList = ({ packages, onInstall, onUninstall }) => {
|
|
8079
|
+
const PackageList = ({ packages, onInstall, onUninstall, preferredTag }) => {
|
|
7921
8080
|
return /* @__PURE__ */ jsx("ul", {
|
|
7922
|
-
className: "flex flex-col items-stretch gap-4
|
|
8081
|
+
className: "flex flex-col items-stretch gap-4",
|
|
7923
8082
|
children: packages.map((pkg) => /* @__PURE__ */ jsx(PackageManagerListItem, {
|
|
7924
8083
|
registryPackage: pkg,
|
|
7925
8084
|
onInstall,
|
|
7926
|
-
onUninstall
|
|
8085
|
+
onUninstall,
|
|
8086
|
+
preferredTag
|
|
7927
8087
|
}, pkg.name))
|
|
7928
8088
|
});
|
|
7929
8089
|
};
|
|
7930
8090
|
//#endregion
|
|
8091
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-registry-error.tsx
|
|
8092
|
+
/**
|
|
8093
|
+
* Friendly registry-error banner. Never surfaces raw API / network messages —
|
|
8094
|
+
* those stay in the console for debugging.
|
|
8095
|
+
*/
|
|
8096
|
+
const PackageRegistryError = ({ variant, onRetry }) => {
|
|
8097
|
+
const isEmpty = variant === "empty";
|
|
8098
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8099
|
+
className: isEmpty ? "flex items-start gap-3 rounded-lg border border-destructive bg-destructive/10 p-4" : "flex items-start gap-3 rounded-lg border border-destructive bg-destructive/10 px-3 py-2.5",
|
|
8100
|
+
role: "alert",
|
|
8101
|
+
children: [
|
|
8102
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
8103
|
+
name: "Error",
|
|
8104
|
+
size: 16,
|
|
8105
|
+
className: "mt-0.5 shrink-0 text-destructive"
|
|
8106
|
+
}),
|
|
8107
|
+
/* @__PURE__ */ jsxs("div", {
|
|
8108
|
+
className: "min-w-0 flex-1",
|
|
8109
|
+
children: [
|
|
8110
|
+
/* @__PURE__ */ jsx("p", {
|
|
8111
|
+
className: "text-sm font-medium text-destructive",
|
|
8112
|
+
children: isEmpty ? "Couldn't load packages" : "Couldn't refresh packages"
|
|
8113
|
+
}),
|
|
8114
|
+
/* @__PURE__ */ jsx("p", {
|
|
8115
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
8116
|
+
children: isEmpty ? "We couldn't reach the package registry. Check your connection and try again." : "Showing previously loaded packages. Check your connection and try again."
|
|
8117
|
+
}),
|
|
8118
|
+
isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
|
|
8119
|
+
type: "button",
|
|
8120
|
+
onClick: onRetry,
|
|
8121
|
+
className: "mt-3 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect",
|
|
8122
|
+
children: "Try again"
|
|
8123
|
+
})
|
|
8124
|
+
]
|
|
8125
|
+
}),
|
|
8126
|
+
!isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
|
|
8127
|
+
type: "button",
|
|
8128
|
+
onClick: onRetry,
|
|
8129
|
+
className: "shrink-0 self-center rounded-md border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:hover-effect",
|
|
8130
|
+
children: "Try again"
|
|
8131
|
+
})
|
|
8132
|
+
]
|
|
8133
|
+
});
|
|
8134
|
+
};
|
|
8135
|
+
//#endregion
|
|
8136
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-search-input.tsx
|
|
8137
|
+
/**
|
|
8138
|
+
* Plain controlled search box shared by the Installed/Available tabs. It only
|
|
8139
|
+
* reports the query — filtering happens in the panels (client-side today, a
|
|
8140
|
+
* registry search endpoint later).
|
|
8141
|
+
*/
|
|
8142
|
+
const PackageSearchInput = (props) => {
|
|
8143
|
+
const { value, onChange, placeholder, disabled, className } = props;
|
|
8144
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8145
|
+
className: twMerge("relative", className),
|
|
8146
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
8147
|
+
name: "Search",
|
|
8148
|
+
size: 14,
|
|
8149
|
+
className: "absolute top-1/2 left-2 -translate-y-1/2 text-muted-foreground"
|
|
8150
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
8151
|
+
value,
|
|
8152
|
+
onChange: (e) => onChange(e.target.value),
|
|
8153
|
+
placeholder,
|
|
8154
|
+
disabled,
|
|
8155
|
+
className: "pl-7"
|
|
8156
|
+
})]
|
|
8157
|
+
});
|
|
8158
|
+
};
|
|
8159
|
+
//#endregion
|
|
8160
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/available-packages-panel.tsx
|
|
8161
|
+
const LoadingRow = ({ label, center }) => /* @__PURE__ */ jsxs("div", {
|
|
8162
|
+
className: `flex items-center gap-2 text-sm text-muted-foreground ${center ? "justify-center" : ""}`,
|
|
8163
|
+
children: [/* @__PURE__ */ jsx(PackageAnimation, {
|
|
8164
|
+
animate: true,
|
|
8165
|
+
loop: true,
|
|
8166
|
+
color: "#6b7280",
|
|
8167
|
+
size: 24
|
|
8168
|
+
}), /* @__PURE__ */ jsx("span", { children: label })]
|
|
8169
|
+
});
|
|
8170
|
+
const AvailablePackagesPanel = (props) => {
|
|
8171
|
+
const { packages, installedNames, query, onQueryChange, serverSearch, isLoading, isLoadingMore, hasMore, onLoadMore, error, onRetry, mutable, onInstall, onUninstall, disabled } = props;
|
|
8172
|
+
const filtered = serverSearch ? packages : filterPackages(packages, query);
|
|
8173
|
+
const available = filtered.filter((p) => p.status === "available");
|
|
8174
|
+
const dismissed = filtered.filter((p) => p.status === "dismissed");
|
|
8175
|
+
const { name: queryName, tag: queryTag } = parsePackageSpec(query);
|
|
8176
|
+
const showNpmFallback = mutable && filtered.length === 0 && isPlausiblePackageName(queryName) && !installedNames.includes(queryName);
|
|
8177
|
+
const isEmpty = filtered.length === 0;
|
|
8178
|
+
const paginated = onLoadMore !== void 0;
|
|
8179
|
+
function renderContent() {
|
|
8180
|
+
if (isEmpty && isLoading) return /* @__PURE__ */ jsx(LoadingRow, {
|
|
8181
|
+
label: "Loading packages…",
|
|
8182
|
+
center: true
|
|
8183
|
+
});
|
|
8184
|
+
if (isEmpty && error) return /* @__PURE__ */ jsx(PackageRegistryError, {
|
|
8185
|
+
variant: "empty",
|
|
8186
|
+
onRetry
|
|
8187
|
+
});
|
|
8188
|
+
if (isEmpty) {
|
|
8189
|
+
if (showNpmFallback) return /* @__PURE__ */ jsx(NpmFallbackRow, {
|
|
8190
|
+
query,
|
|
8191
|
+
onInstall,
|
|
8192
|
+
disabled
|
|
8193
|
+
});
|
|
8194
|
+
return /* @__PURE__ */ jsx("p", {
|
|
8195
|
+
className: "text-sm text-foreground",
|
|
8196
|
+
children: query ? "No packages match your search." : "No packages available to install."
|
|
8197
|
+
});
|
|
8198
|
+
}
|
|
8199
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8200
|
+
className: "flex flex-col gap-4",
|
|
8201
|
+
children: [
|
|
8202
|
+
available.length > 0 && /* @__PURE__ */ jsx(PackageList, {
|
|
8203
|
+
packages: available,
|
|
8204
|
+
onInstall,
|
|
8205
|
+
onUninstall,
|
|
8206
|
+
preferredTag: queryTag
|
|
8207
|
+
}),
|
|
8208
|
+
dismissed.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
8209
|
+
title: "Dismissed",
|
|
8210
|
+
count: dismissed.length,
|
|
8211
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
8212
|
+
packages: dismissed,
|
|
8213
|
+
onInstall,
|
|
8214
|
+
onUninstall,
|
|
8215
|
+
preferredTag: queryTag
|
|
8216
|
+
})
|
|
8217
|
+
}),
|
|
8218
|
+
isLoadingMore && /* @__PURE__ */ jsx(LoadingRow, {
|
|
8219
|
+
label: "Loading more…",
|
|
8220
|
+
center: true
|
|
8221
|
+
}),
|
|
8222
|
+
paginated && !hasMore && !isLoadingMore && /* @__PURE__ */ jsx("p", {
|
|
8223
|
+
className: "py-2 text-center text-sm text-muted-foreground",
|
|
8224
|
+
children: "You’ve reached the end of the list."
|
|
8225
|
+
})
|
|
8226
|
+
]
|
|
8227
|
+
});
|
|
8228
|
+
}
|
|
8229
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8230
|
+
className: "flex h-full flex-col gap-3",
|
|
8231
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8232
|
+
className: "pr-3",
|
|
8233
|
+
children: [
|
|
8234
|
+
/* @__PURE__ */ jsx(PackageSearchInput, {
|
|
8235
|
+
value: query,
|
|
8236
|
+
onChange: onQueryChange,
|
|
8237
|
+
placeholder: "Search available packages",
|
|
8238
|
+
disabled
|
|
8239
|
+
}),
|
|
8240
|
+
!isEmpty && isLoading && /* @__PURE__ */ jsx("div", {
|
|
8241
|
+
className: "mt-3",
|
|
8242
|
+
children: /* @__PURE__ */ jsx(LoadingRow, { label: "Refreshing packages…" })
|
|
8243
|
+
}),
|
|
8244
|
+
!isEmpty && error && /* @__PURE__ */ jsx("div", {
|
|
8245
|
+
className: "mt-3",
|
|
8246
|
+
children: /* @__PURE__ */ jsx(PackageRegistryError, {
|
|
8247
|
+
variant: "refresh",
|
|
8248
|
+
onRetry
|
|
8249
|
+
})
|
|
8250
|
+
})
|
|
8251
|
+
]
|
|
8252
|
+
}), /* @__PURE__ */ jsx(PackagePanelScrollArea, {
|
|
8253
|
+
onReachEnd: hasMore && onLoadMore ? onLoadMore : void 0,
|
|
8254
|
+
children: renderContent()
|
|
8255
|
+
})]
|
|
8256
|
+
});
|
|
8257
|
+
};
|
|
8258
|
+
//#endregion
|
|
8259
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/installed-packages-panel.tsx
|
|
8260
|
+
const InstalledPackagesPanel = (props) => {
|
|
8261
|
+
const { packages, query, onQueryChange, onInstall, onUninstall, disabled } = props;
|
|
8262
|
+
const filtered = filterPackages(packages, query);
|
|
8263
|
+
const locallyInstalled = filtered.filter((p) => p.status === "local-install");
|
|
8264
|
+
const registryInstalled = filtered.filter((p) => p.status === "registry-install");
|
|
8265
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8266
|
+
className: "flex h-full flex-col gap-3",
|
|
8267
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
8268
|
+
className: "pr-3",
|
|
8269
|
+
children: /* @__PURE__ */ jsx(PackageSearchInput, {
|
|
8270
|
+
value: query,
|
|
8271
|
+
onChange: onQueryChange,
|
|
8272
|
+
placeholder: "Search installed packages",
|
|
8273
|
+
disabled
|
|
8274
|
+
})
|
|
8275
|
+
}), /* @__PURE__ */ jsx(PackagePanelScrollArea, { children: packages.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
8276
|
+
className: "text-sm text-foreground",
|
|
8277
|
+
children: "No packages installed."
|
|
8278
|
+
}) : filtered.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
8279
|
+
className: "text-sm text-foreground",
|
|
8280
|
+
children: "No installed packages match your search."
|
|
8281
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
8282
|
+
className: "flex flex-col gap-4",
|
|
8283
|
+
children: [locallyInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
8284
|
+
title: "Locally installed",
|
|
8285
|
+
count: locallyInstalled.length,
|
|
8286
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
8287
|
+
packages: locallyInstalled,
|
|
8288
|
+
onInstall,
|
|
8289
|
+
onUninstall
|
|
8290
|
+
})
|
|
8291
|
+
}), registryInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
8292
|
+
title: "Installed from registry",
|
|
8293
|
+
count: registryInstalled.length,
|
|
8294
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
8295
|
+
packages: registryInstalled,
|
|
8296
|
+
onInstall,
|
|
8297
|
+
onUninstall
|
|
8298
|
+
})
|
|
8299
|
+
})]
|
|
8300
|
+
}) })]
|
|
8301
|
+
});
|
|
8302
|
+
};
|
|
8303
|
+
//#endregion
|
|
7931
8304
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager.tsx
|
|
7932
8305
|
const PackageManager = (props) => {
|
|
7933
|
-
const {
|
|
8306
|
+
const { installedPackages, availablePackages, isAvailableLoading, isLoadingMoreAvailable, hasMoreAvailable, onLoadMoreAvailable, availableError, onAvailableRetry, onAvailableSearchChange, onInstall, onUninstall, onAvailableTabOpen, initialTab = "installed", mutable, disabled, className } = props;
|
|
8307
|
+
const [installedQuery, setInstalledQuery] = useState("");
|
|
8308
|
+
const [availableQuery, setAvailableQuery] = useState("");
|
|
8309
|
+
useEffect(() => {
|
|
8310
|
+
if (initialTab === "available") onAvailableTabOpen?.();
|
|
8311
|
+
}, []);
|
|
8312
|
+
const installedNames = installedPackages.map((p) => p.name);
|
|
7934
8313
|
return /* @__PURE__ */ jsxs("div", {
|
|
7935
|
-
className: twMerge("flex h-
|
|
7936
|
-
children: [
|
|
7937
|
-
className: "mb-4",
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
8314
|
+
className: twMerge("flex min-h-0 flex-1 flex-col rounded-lg bg-background pt-3 pl-3 text-foreground", className),
|
|
8315
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
8316
|
+
className: "mb-4 shrink-0 pr-3 font-semibold text-foreground",
|
|
8317
|
+
children: "Packages"
|
|
8318
|
+
}), /* @__PURE__ */ jsxs(Tabs, {
|
|
8319
|
+
defaultValue: initialTab,
|
|
8320
|
+
listClassName: "pr-3",
|
|
8321
|
+
onValueChange: (value) => {
|
|
8322
|
+
if (value === "available") onAvailableTabOpen?.();
|
|
8323
|
+
},
|
|
8324
|
+
children: [/* @__PURE__ */ jsx(TabContent, {
|
|
8325
|
+
value: "installed",
|
|
8326
|
+
label: `Installed (${installedPackages.length})`,
|
|
8327
|
+
children: /* @__PURE__ */ jsx(InstalledPackagesPanel, {
|
|
8328
|
+
packages: installedPackages,
|
|
8329
|
+
query: installedQuery,
|
|
8330
|
+
onQueryChange: setInstalledQuery,
|
|
8331
|
+
onInstall,
|
|
8332
|
+
onUninstall,
|
|
8333
|
+
disabled
|
|
8334
|
+
})
|
|
8335
|
+
}), /* @__PURE__ */ jsx(TabContent, {
|
|
8336
|
+
value: "available",
|
|
8337
|
+
label: "Available",
|
|
8338
|
+
children: /* @__PURE__ */ jsx(AvailablePackagesPanel, {
|
|
8339
|
+
packages: availablePackages,
|
|
8340
|
+
installedNames,
|
|
8341
|
+
query: availableQuery,
|
|
8342
|
+
onQueryChange: (q) => {
|
|
8343
|
+
setAvailableQuery(q);
|
|
8344
|
+
onAvailableSearchChange?.(q);
|
|
8345
|
+
},
|
|
8346
|
+
serverSearch: onAvailableSearchChange !== void 0,
|
|
8347
|
+
isLoading: isAvailableLoading,
|
|
8348
|
+
isLoadingMore: isLoadingMoreAvailable,
|
|
8349
|
+
hasMore: hasMoreAvailable,
|
|
8350
|
+
onLoadMore: onLoadMoreAvailable,
|
|
8351
|
+
error: availableError,
|
|
8352
|
+
onRetry: onAvailableRetry,
|
|
8353
|
+
mutable,
|
|
8354
|
+
onInstall,
|
|
8355
|
+
onUninstall,
|
|
8356
|
+
disabled
|
|
8357
|
+
})
|
|
8358
|
+
})]
|
|
7945
8359
|
})]
|
|
7946
8360
|
});
|
|
7947
8361
|
};
|
|
@@ -7950,19 +8364,21 @@ const PackageManager = (props) => {
|
|
|
7950
8364
|
function SettingsModal(props) {
|
|
7951
8365
|
const { title, overlayProps, contentProps, onOpenChange, tabs, defaultTab, navFooter, ...restProps } = props;
|
|
7952
8366
|
const [selectedTab, setSelectedTab] = useState(defaultTab ?? tabs.at(0)?.id);
|
|
7953
|
-
const tabsContent = tabs.map((tab) =>
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
8367
|
+
const tabsContent = tabs.map((tab) => {
|
|
8368
|
+
const isActive = selectedTab === tab.id;
|
|
8369
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
8370
|
+
type: "button",
|
|
8371
|
+
"aria-current": isActive ? "page" : void 0,
|
|
8372
|
+
onClick: isActive ? void 0 : () => setSelectedTab(tab.id),
|
|
8373
|
+
className: twMerge("flex h-9 w-48 items-center gap-x-2 rounded-md pl-3 text-left text-foreground", isActive ? "cursor-default bg-accent" : "cursor-pointer bg-transparent hover:bg-accent"),
|
|
7958
8374
|
children: [tab.icon, /* @__PURE__ */ jsx("span", { children: tab.label })]
|
|
7959
|
-
})
|
|
7960
|
-
}
|
|
8375
|
+
}, tab.id);
|
|
8376
|
+
});
|
|
7961
8377
|
const SelectedTabComponent = tabs.find((tab) => tab.id === selectedTab)?.content;
|
|
7962
8378
|
return /* @__PURE__ */ jsxs(Modal, {
|
|
7963
8379
|
contentProps: {
|
|
7964
8380
|
...contentProps,
|
|
7965
|
-
className: twMerge("min-h-full w-full max-w-4xl rounded-xl", contentProps?.className)
|
|
8381
|
+
className: twMerge("flex max-h-[calc(100dvh-14rem)] min-h-full w-full max-w-4xl flex-col rounded-xl", contentProps?.className)
|
|
7966
8382
|
},
|
|
7967
8383
|
onOpenChange,
|
|
7968
8384
|
overlayProps: {
|
|
@@ -7986,7 +8402,7 @@ function SettingsModal(props) {
|
|
|
7986
8402
|
})
|
|
7987
8403
|
})]
|
|
7988
8404
|
}), /* @__PURE__ */ jsxs("div", {
|
|
7989
|
-
className: "flex flex-1",
|
|
8405
|
+
className: "flex min-h-0 flex-1",
|
|
7990
8406
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
7991
8407
|
className: "flex flex-col p-3 pt-6",
|
|
7992
8408
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -7997,7 +8413,7 @@ function SettingsModal(props) {
|
|
|
7997
8413
|
children: navFooter
|
|
7998
8414
|
})]
|
|
7999
8415
|
}), /* @__PURE__ */ jsx("div", {
|
|
8000
|
-
className: "m-6 flex h-
|
|
8416
|
+
className: "m-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-background",
|
|
8001
8417
|
children: typeof SelectedTabComponent === "function" ? /* @__PURE__ */ jsx(SelectedTabComponent, {}) : SelectedTabComponent
|
|
8002
8418
|
})]
|
|
8003
8419
|
})]
|
|
@@ -8772,50 +9188,20 @@ var renown_short_hover_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA
|
|
|
8772
9188
|
//#region assets/renown-short.png
|
|
8773
9189
|
var renown_short_default = "data:image/png;base64,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";
|
|
8774
9190
|
//#endregion
|
|
8775
|
-
//#region src/connect/components/account-popover/account-popover-login.tsx
|
|
8776
|
-
const AccountPopoverLogin = ({ onLogin }) => {
|
|
8777
|
-
const [loading, setLoading] = useState(false);
|
|
8778
|
-
const allowLogin = !loading && !!onLogin;
|
|
8779
|
-
const content = loading ? /* @__PURE__ */ jsx(Icon, {
|
|
8780
|
-
name: "Reload",
|
|
8781
|
-
size: 14,
|
|
8782
|
-
className: "animate-spin"
|
|
8783
|
-
}) : /* @__PURE__ */ jsx("span", { children: "Connect" });
|
|
8784
|
-
const handleLogin = () => {
|
|
8785
|
-
if (onLogin) {
|
|
8786
|
-
setLoading(true);
|
|
8787
|
-
onLogin();
|
|
8788
|
-
}
|
|
8789
|
-
};
|
|
8790
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
8791
|
-
className: "p-4",
|
|
8792
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
8793
|
-
className: "mb-4 flex justify-center",
|
|
8794
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
8795
|
-
className: "flex h-5.5 w-20.75 items-center justify-center overflow-hidden text-foreground",
|
|
8796
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
8797
|
-
name: "RenownLight",
|
|
8798
|
-
size: 83
|
|
8799
|
-
})
|
|
8800
|
-
})
|
|
8801
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
8802
|
-
onClick: allowLogin ? handleLogin : void 0,
|
|
8803
|
-
className: twMerge("mt-4 flex h-7 w-full cursor-pointer items-center justify-center rounded-lg border border-border bg-transparent text-sm text-foreground active:active-effect", allowLogin ? "cursor-pointer" : "cursor-wait"),
|
|
8804
|
-
type: "button",
|
|
8805
|
-
children: content
|
|
8806
|
-
})]
|
|
8807
|
-
});
|
|
8808
|
-
};
|
|
8809
|
-
//#endregion
|
|
8810
9191
|
//#region src/connect/components/sidebar/sidebar-login.tsx
|
|
8811
9192
|
const SidebarLogin = ({ onLogin }) => {
|
|
8812
|
-
const
|
|
9193
|
+
const [open, setOpen] = useState(false);
|
|
8813
9194
|
const { theme } = useTheme();
|
|
8814
9195
|
const isDark = theme === "dark";
|
|
8815
9196
|
const src = isDark ? renown_short_dark_default : renown_short_default;
|
|
8816
9197
|
const hoverSrc = isDark ? renown_short_hover_dark_default : renown_short_hover_default;
|
|
8817
9198
|
return /* @__PURE__ */ jsx(AccountPopover, {
|
|
8818
|
-
|
|
9199
|
+
open,
|
|
9200
|
+
onOpenChange: setOpen,
|
|
9201
|
+
content: /* @__PURE__ */ jsx(AccountPopoverLogin, { onLogin: onLogin ? () => {
|
|
9202
|
+
setOpen(false);
|
|
9203
|
+
onLogin();
|
|
9204
|
+
} : void 0 }),
|
|
8819
9205
|
children: /* @__PURE__ */ jsxs("div", {
|
|
8820
9206
|
className: twMerge("group/sidebar-footer flex w-full items-baseline justify-start text-sm/10 font-semibold text-foreground", onLogin ? "cursor-pointer" : "cursor-wait"),
|
|
8821
9207
|
children: [/* @__PURE__ */ jsx("img", {
|
|
@@ -9139,6 +9525,6 @@ const removeSuccessFiles = (files) => {
|
|
|
9139
9525
|
return files.filter((file) => file.status !== "SUCCESS");
|
|
9140
9526
|
};
|
|
9141
9527
|
//#endregion
|
|
9142
|
-
export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager,
|
|
9528
|
+
export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
|
|
9143
9529
|
|
|
9144
9530
|
//# sourceMappingURL=index.js.map
|