@powerhousedao/design-system 6.2.2-dev.1 → 6.2.2-dev.11
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/{command-BxF0i94S.d.ts → command-DR5wWsVF.d.ts} +14 -14
- package/dist/{command-BxF0i94S.d.ts.map → command-DR5wWsVF.d.ts.map} +1 -1
- package/dist/connect/index.d.ts +154 -31
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +435 -320
- package/dist/connect/index.js.map +1 -1
- package/dist/{enum-field-UxIet5Lp.d.ts → enum-field-CwZVs3Ux.d.ts} +2 -2
- package/dist/{enum-field-UxIet5Lp.d.ts.map → enum-field-CwZVs3Ux.d.ts.map} +1 -1
- package/dist/ui/components/command/command.d.ts +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/index.d.ts +2 -2
- 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/dist/ui/index.d.ts +2 -2
- package/package.json +4 -4
package/dist/connect/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { Popover, PopoverContent, PopoverTrigger } from "../ui/components/popove
|
|
|
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";
|
|
@@ -1643,33 +1642,35 @@ function TabContent(props) {
|
|
|
1643
1642
|
//#endregion
|
|
1644
1643
|
//#region src/connect/components/tabs/tabs.tsx
|
|
1645
1644
|
const toTabValue = (label) => label.trim().replace(/\s+/g, "-");
|
|
1646
|
-
|
|
1645
|
+
const resolveTabValue = (props) => props.value ?? toTabValue(props.label);
|
|
1646
|
+
function Tabs({ children, defaultValue, onValueChange, listClassName }) {
|
|
1647
1647
|
return /* @__PURE__ */ jsxs(Root$2, {
|
|
1648
1648
|
defaultValue: toTabValue(defaultValue),
|
|
1649
|
+
onValueChange,
|
|
1649
1650
|
className: "flex min-h-0 flex-1 flex-col gap-2",
|
|
1650
1651
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1651
|
-
className: "flex w-full shrink-0 justify-between",
|
|
1652
|
+
className: twMerge("flex w-full shrink-0 justify-between", listClassName),
|
|
1652
1653
|
children: /* @__PURE__ */ jsx(List, {
|
|
1653
1654
|
className: "flex w-full gap-x-2 rounded-xl p-1 text-sm font-semibold text-foreground outline-none",
|
|
1654
1655
|
children: React.Children.map(children, (child, _i) => {
|
|
1655
1656
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1656
|
-
const
|
|
1657
|
+
const props = child.props;
|
|
1658
|
+
const value = resolveTabValue(props);
|
|
1657
1659
|
return /* @__PURE__ */ jsx(Trigger$2, {
|
|
1658
1660
|
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
|
-
},
|
|
1661
|
+
value,
|
|
1662
|
+
disabled: props.disabled ?? false,
|
|
1663
|
+
children: props.label
|
|
1664
|
+
}, value);
|
|
1663
1665
|
})
|
|
1664
1666
|
})
|
|
1665
1667
|
}), /* @__PURE__ */ jsx("div", {
|
|
1666
1668
|
className: "mt-3 min-h-0 flex-1 rounded-md bg-background",
|
|
1667
1669
|
children: React.Children.map(children, (child, i) => {
|
|
1668
1670
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1669
|
-
const { label } = child.props;
|
|
1670
1671
|
return /* @__PURE__ */ jsx(Content$2, {
|
|
1671
1672
|
className: "h-full",
|
|
1672
|
-
value:
|
|
1673
|
+
value: resolveTabValue(child.props),
|
|
1673
1674
|
children: child
|
|
1674
1675
|
}, i);
|
|
1675
1676
|
})
|
|
@@ -7373,6 +7374,76 @@ function buildPackageSpec(name, tag) {
|
|
|
7373
7374
|
return tag ? `${name}@${tag}` : name;
|
|
7374
7375
|
}
|
|
7375
7376
|
//#endregion
|
|
7377
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/filter-packages.ts
|
|
7378
|
+
/**
|
|
7379
|
+
* Client-side package filter used by both Package Manager tabs. Matches the
|
|
7380
|
+
* query's name part (any `@tag` suffix is ignored for matching — it drives
|
|
7381
|
+
* version preselection instead) against the package name only.
|
|
7382
|
+
*
|
|
7383
|
+
* This is the seam a future registry search endpoint replaces: when the
|
|
7384
|
+
* Available tab searches server-side, its panel skips this function and
|
|
7385
|
+
* renders the API results as-is.
|
|
7386
|
+
*/
|
|
7387
|
+
function filterPackages(packages, query) {
|
|
7388
|
+
const { name } = parsePackageSpec(query);
|
|
7389
|
+
const needle = name.toLowerCase();
|
|
7390
|
+
if (!needle) return packages;
|
|
7391
|
+
return packages.filter((pkg) => pkg.name.toLowerCase().includes(needle));
|
|
7392
|
+
}
|
|
7393
|
+
//#endregion
|
|
7394
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/npm-fallback-row.tsx
|
|
7395
|
+
/**
|
|
7396
|
+
* Shown in the Available tab when the search query matches nothing in the
|
|
7397
|
+
* registry but looks like a valid npm package name: the registry's verdaccio
|
|
7398
|
+
* backend proxies npmjs.org, so the install can still succeed. Replaces the
|
|
7399
|
+
* old SearchAutocomplete fallback option. The button label is "Install from
|
|
7400
|
+
* npm" (not "Install") so it doesn't collide with the row-kebab menu item.
|
|
7401
|
+
*/
|
|
7402
|
+
const NpmFallbackRow = (props) => {
|
|
7403
|
+
const { query, onInstall, disabled } = props;
|
|
7404
|
+
const [isInstalling, setIsInstalling] = useState(false);
|
|
7405
|
+
const { name, tag } = parsePackageSpec(query);
|
|
7406
|
+
const spec = buildPackageSpec(name, tag);
|
|
7407
|
+
function handleInstall() {
|
|
7408
|
+
setIsInstalling(true);
|
|
7409
|
+
onInstall(spec).catch(console.error).finally(() => setIsInstalling(false));
|
|
7410
|
+
}
|
|
7411
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7412
|
+
className: "flex items-start justify-between gap-3 rounded-md border border-dashed border-border bg-background p-3 text-sm/5",
|
|
7413
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7414
|
+
className: "min-w-0 flex-1",
|
|
7415
|
+
children: [
|
|
7416
|
+
/* @__PURE__ */ jsx("p", {
|
|
7417
|
+
className: "truncate font-semibold text-foreground",
|
|
7418
|
+
children: tag ? `${name} @ ${tag}` : name
|
|
7419
|
+
}),
|
|
7420
|
+
/* @__PURE__ */ jsx("p", {
|
|
7421
|
+
className: "text-xs text-foreground",
|
|
7422
|
+
children: "Not published to this registry. Install via the npmjs.org uplink."
|
|
7423
|
+
}),
|
|
7424
|
+
/* @__PURE__ */ jsx("p", {
|
|
7425
|
+
className: "text-xs text-muted-foreground",
|
|
7426
|
+
children: "npm fallback"
|
|
7427
|
+
})
|
|
7428
|
+
]
|
|
7429
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
7430
|
+
className: "shrink-0 self-center",
|
|
7431
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
7432
|
+
onClick: handleInstall,
|
|
7433
|
+
disabled: disabled || isInstalling,
|
|
7434
|
+
className: "rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect disabled:disabled-effect",
|
|
7435
|
+
children: isInstalling ? "Installing..." : "Install from npm"
|
|
7436
|
+
})
|
|
7437
|
+
})]
|
|
7438
|
+
});
|
|
7439
|
+
};
|
|
7440
|
+
//#endregion
|
|
7441
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/npm-name.ts
|
|
7442
|
+
const NPM_NAME_RE = /^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*$|^[a-z0-9][a-z0-9._-]*$/i;
|
|
7443
|
+
function isPlausiblePackageName(name) {
|
|
7444
|
+
return name.length >= 2 && NPM_NAME_RE.test(name);
|
|
7445
|
+
}
|
|
7446
|
+
//#endregion
|
|
7376
7447
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/version-picker.tsx
|
|
7377
7448
|
function resolveDefaultVersionSelection(options) {
|
|
7378
7449
|
const { distTags, versions, version, preferredTag } = options;
|
|
@@ -7516,147 +7587,6 @@ const VersionPicker = (props) => {
|
|
|
7516
7587
|
});
|
|
7517
7588
|
};
|
|
7518
7589
|
//#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
7590
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager-list.tsx
|
|
7661
7591
|
const PackageDetail = ({ label, value }) => {
|
|
7662
7592
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -7671,15 +7601,31 @@ const PackageDetail = ({ label, value }) => {
|
|
|
7671
7601
|
});
|
|
7672
7602
|
};
|
|
7673
7603
|
const PackageManagerListItem = (props) => {
|
|
7674
|
-
const { registryPackage, onInstall, onUninstall, className } = props;
|
|
7604
|
+
const { registryPackage, onInstall, onUninstall, preferredTag, className } = props;
|
|
7675
7605
|
const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
|
|
7676
7606
|
const canPickVersion = registryPackage.status === "available" || registryPackage.status === "dismissed";
|
|
7677
7607
|
const hasVersionMetadata = registryPackage.distTags && Object.keys(registryPackage.distTags).length > 0 || (registryPackage.versions?.length ?? 0) > 0;
|
|
7678
7608
|
const [selected, setSelected] = useState(() => resolveDefaultVersionSelection({
|
|
7679
7609
|
distTags: registryPackage.distTags,
|
|
7680
7610
|
versions: registryPackage.versions,
|
|
7681
|
-
version: registryPackage.version
|
|
7611
|
+
version: registryPackage.version,
|
|
7612
|
+
preferredTag
|
|
7682
7613
|
}));
|
|
7614
|
+
useEffect(() => {
|
|
7615
|
+
if (!preferredTag) return;
|
|
7616
|
+
if (registryPackage.distTags && preferredTag in registryPackage.distTags) setSelected({
|
|
7617
|
+
kind: "tag",
|
|
7618
|
+
value: preferredTag
|
|
7619
|
+
});
|
|
7620
|
+
else if (registryPackage.versions?.includes(preferredTag)) setSelected({
|
|
7621
|
+
kind: "version",
|
|
7622
|
+
value: preferredTag
|
|
7623
|
+
});
|
|
7624
|
+
}, [
|
|
7625
|
+
preferredTag,
|
|
7626
|
+
registryPackage.distTags,
|
|
7627
|
+
registryPackage.versions
|
|
7628
|
+
]);
|
|
7683
7629
|
const installDropdownItem = {
|
|
7684
7630
|
id: "install",
|
|
7685
7631
|
label: "Install",
|
|
@@ -7716,31 +7662,38 @@ const PackageManagerListItem = (props) => {
|
|
|
7716
7662
|
}),
|
|
7717
7663
|
registryPackage.manifest !== null && (() => {
|
|
7718
7664
|
const { description, category, publisher } = registryPackage.manifest;
|
|
7719
|
-
|
|
7665
|
+
const publisherName = publisher?.name;
|
|
7666
|
+
const publisherUrl = publisher?.url;
|
|
7667
|
+
const hasText = (value) => typeof value === "string" && value.trim() !== "";
|
|
7668
|
+
const showDescription = hasText(description);
|
|
7669
|
+
const showCategory = hasText(category);
|
|
7670
|
+
const showPublisher = hasText(publisherName);
|
|
7671
|
+
const showPublisherUrl = hasText(publisherUrl);
|
|
7672
|
+
if (!showDescription && !showCategory && !showPublisher && !showPublisherUrl) return null;
|
|
7720
7673
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
7721
|
-
|
|
7674
|
+
showDescription && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7722
7675
|
label: "Description",
|
|
7723
7676
|
value: description
|
|
7724
7677
|
}),
|
|
7725
|
-
|
|
7678
|
+
showCategory && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7726
7679
|
label: "Category",
|
|
7727
7680
|
value: category
|
|
7728
7681
|
}),
|
|
7729
|
-
|
|
7682
|
+
showPublisher && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7730
7683
|
label: "Publisher",
|
|
7731
|
-
value:
|
|
7684
|
+
value: publisherName
|
|
7732
7685
|
}),
|
|
7733
|
-
|
|
7686
|
+
showPublisherUrl && /* @__PURE__ */ jsx(PackageDetail, {
|
|
7734
7687
|
label: "Publisher URL",
|
|
7735
7688
|
value: /* @__PURE__ */ jsx("a", {
|
|
7736
7689
|
className: "underline",
|
|
7737
|
-
href:
|
|
7738
|
-
children:
|
|
7690
|
+
href: publisherUrl,
|
|
7691
|
+
children: publisherUrl
|
|
7739
7692
|
})
|
|
7740
7693
|
})
|
|
7741
7694
|
] });
|
|
7742
7695
|
})(),
|
|
7743
|
-
/* @__PURE__ */ jsx(ConnectDropdownMenu, {
|
|
7696
|
+
dropdownItems.length > 0 && /* @__PURE__ */ jsx(ConnectDropdownMenu, {
|
|
7744
7697
|
items: dropdownItems,
|
|
7745
7698
|
onItemClick: (id) => {
|
|
7746
7699
|
if (id === "install") {
|
|
@@ -7766,141 +7719,46 @@ const PackageManagerListItem = (props) => {
|
|
|
7766
7719
|
]
|
|
7767
7720
|
});
|
|
7768
7721
|
};
|
|
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
|
-
})
|
|
7722
|
+
/**
|
|
7723
|
+
* Scroll region shared by both Package Manager tab panels. Fills the space
|
|
7724
|
+
* the panel gives it and scrolls its overflow. This works because the tab
|
|
7725
|
+
* panel sits inside the settings content card, which has a bounded height
|
|
7726
|
+
* (`m-6 ... h-full flex-1 overflow-hidden`); the flex chain down to here is
|
|
7727
|
+
* unbroken (`min-h-0` + `flex-1`/`h-full` at every level), so no
|
|
7728
|
+
* viewport-measuring hack is needed.
|
|
7729
|
+
*/
|
|
7730
|
+
const PackagePanelScrollArea = ({ children, className, onReachEnd }) => {
|
|
7731
|
+
const scrollRef = useRef(null);
|
|
7732
|
+
const sentinelRef = useRef(null);
|
|
7733
|
+
const onReachEndRef = useRef(onReachEnd);
|
|
7734
|
+
useEffect(() => {
|
|
7735
|
+
onReachEndRef.current = onReachEnd;
|
|
7845
7736
|
});
|
|
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);
|
|
7737
|
+
const hasHandler = onReachEnd !== void 0;
|
|
7859
7738
|
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
|
-
})
|
|
7739
|
+
if (!hasHandler) return;
|
|
7740
|
+
const root = scrollRef.current;
|
|
7741
|
+
const sentinel = sentinelRef.current;
|
|
7742
|
+
if (!root || !sentinel) return;
|
|
7743
|
+
const observer = new IntersectionObserver((entries) => {
|
|
7744
|
+
if (entries.some((e) => e.isIntersecting)) onReachEndRef.current?.();
|
|
7745
|
+
}, {
|
|
7746
|
+
root,
|
|
7747
|
+
rootMargin: "200px"
|
|
7748
|
+
});
|
|
7749
|
+
observer.observe(sentinel);
|
|
7750
|
+
return () => observer.disconnect();
|
|
7751
|
+
}, [hasHandler]);
|
|
7752
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7753
|
+
ref: scrollRef,
|
|
7754
|
+
className: twMerge("min-h-0 flex-1 overflow-y-auto", className),
|
|
7755
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
7756
|
+
className: "pr-3 pb-3",
|
|
7757
|
+
children
|
|
7758
|
+
}), hasHandler && /* @__PURE__ */ jsx("div", {
|
|
7759
|
+
ref: sentinelRef,
|
|
7760
|
+
"aria-hidden": true,
|
|
7761
|
+
className: "h-px w-full"
|
|
7904
7762
|
})]
|
|
7905
7763
|
});
|
|
7906
7764
|
};
|
|
@@ -7917,31 +7775,286 @@ const PackageSubSection = ({ title, count, children }) => {
|
|
|
7917
7775
|
})]
|
|
7918
7776
|
}), children] });
|
|
7919
7777
|
};
|
|
7920
|
-
const PackageList = ({ packages, onInstall, onUninstall }) => {
|
|
7778
|
+
const PackageList = ({ packages, onInstall, onUninstall, preferredTag }) => {
|
|
7921
7779
|
return /* @__PURE__ */ jsx("ul", {
|
|
7922
|
-
className: "flex flex-col items-stretch gap-4
|
|
7780
|
+
className: "flex flex-col items-stretch gap-4",
|
|
7923
7781
|
children: packages.map((pkg) => /* @__PURE__ */ jsx(PackageManagerListItem, {
|
|
7924
7782
|
registryPackage: pkg,
|
|
7925
7783
|
onInstall,
|
|
7926
|
-
onUninstall
|
|
7784
|
+
onUninstall,
|
|
7785
|
+
preferredTag
|
|
7927
7786
|
}, pkg.name))
|
|
7928
7787
|
});
|
|
7929
7788
|
};
|
|
7930
7789
|
//#endregion
|
|
7790
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-registry-error.tsx
|
|
7791
|
+
/**
|
|
7792
|
+
* Friendly registry-error banner. Never surfaces raw API / network messages —
|
|
7793
|
+
* those stay in the console for debugging.
|
|
7794
|
+
*/
|
|
7795
|
+
const PackageRegistryError = ({ variant, onRetry }) => {
|
|
7796
|
+
const isEmpty = variant === "empty";
|
|
7797
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7798
|
+
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",
|
|
7799
|
+
role: "alert",
|
|
7800
|
+
children: [
|
|
7801
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
7802
|
+
name: "Error",
|
|
7803
|
+
size: 16,
|
|
7804
|
+
className: "mt-0.5 shrink-0 text-destructive"
|
|
7805
|
+
}),
|
|
7806
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7807
|
+
className: "min-w-0 flex-1",
|
|
7808
|
+
children: [
|
|
7809
|
+
/* @__PURE__ */ jsx("p", {
|
|
7810
|
+
className: "text-sm font-medium text-destructive",
|
|
7811
|
+
children: isEmpty ? "Couldn't load packages" : "Couldn't refresh packages"
|
|
7812
|
+
}),
|
|
7813
|
+
/* @__PURE__ */ jsx("p", {
|
|
7814
|
+
className: "mt-0.5 text-xs text-muted-foreground",
|
|
7815
|
+
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."
|
|
7816
|
+
}),
|
|
7817
|
+
isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
|
|
7818
|
+
type: "button",
|
|
7819
|
+
onClick: onRetry,
|
|
7820
|
+
className: "mt-3 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-colors hover:hover-effect",
|
|
7821
|
+
children: "Try again"
|
|
7822
|
+
})
|
|
7823
|
+
]
|
|
7824
|
+
}),
|
|
7825
|
+
!isEmpty && onRetry && /* @__PURE__ */ jsx("button", {
|
|
7826
|
+
type: "button",
|
|
7827
|
+
onClick: onRetry,
|
|
7828
|
+
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",
|
|
7829
|
+
children: "Try again"
|
|
7830
|
+
})
|
|
7831
|
+
]
|
|
7832
|
+
});
|
|
7833
|
+
};
|
|
7834
|
+
//#endregion
|
|
7835
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-search-input.tsx
|
|
7836
|
+
/**
|
|
7837
|
+
* Plain controlled search box shared by the Installed/Available tabs. It only
|
|
7838
|
+
* reports the query — filtering happens in the panels (client-side today, a
|
|
7839
|
+
* registry search endpoint later).
|
|
7840
|
+
*/
|
|
7841
|
+
const PackageSearchInput = (props) => {
|
|
7842
|
+
const { value, onChange, placeholder, disabled, className } = props;
|
|
7843
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7844
|
+
className: twMerge("relative", className),
|
|
7845
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
7846
|
+
name: "Search",
|
|
7847
|
+
size: 14,
|
|
7848
|
+
className: "absolute top-1/2 left-2 -translate-y-1/2 text-muted-foreground"
|
|
7849
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
7850
|
+
value,
|
|
7851
|
+
onChange: (e) => onChange(e.target.value),
|
|
7852
|
+
placeholder,
|
|
7853
|
+
disabled,
|
|
7854
|
+
className: "pl-7"
|
|
7855
|
+
})]
|
|
7856
|
+
});
|
|
7857
|
+
};
|
|
7858
|
+
//#endregion
|
|
7859
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/available-packages-panel.tsx
|
|
7860
|
+
const LoadingRow = ({ label, center }) => /* @__PURE__ */ jsxs("div", {
|
|
7861
|
+
className: `flex items-center gap-2 text-sm text-muted-foreground ${center ? "justify-center" : ""}`,
|
|
7862
|
+
children: [/* @__PURE__ */ jsx(PackageAnimation, {
|
|
7863
|
+
animate: true,
|
|
7864
|
+
loop: true,
|
|
7865
|
+
color: "#6b7280",
|
|
7866
|
+
size: 24
|
|
7867
|
+
}), /* @__PURE__ */ jsx("span", { children: label })]
|
|
7868
|
+
});
|
|
7869
|
+
const AvailablePackagesPanel = (props) => {
|
|
7870
|
+
const { packages, installedNames, query, onQueryChange, serverSearch, isLoading, isLoadingMore, hasMore, onLoadMore, error, onRetry, mutable, onInstall, onUninstall, disabled } = props;
|
|
7871
|
+
const filtered = serverSearch ? packages : filterPackages(packages, query);
|
|
7872
|
+
const available = filtered.filter((p) => p.status === "available");
|
|
7873
|
+
const dismissed = filtered.filter((p) => p.status === "dismissed");
|
|
7874
|
+
const { name: queryName, tag: queryTag } = parsePackageSpec(query);
|
|
7875
|
+
const showNpmFallback = mutable && filtered.length === 0 && isPlausiblePackageName(queryName) && !installedNames.includes(queryName);
|
|
7876
|
+
const isEmpty = filtered.length === 0;
|
|
7877
|
+
const paginated = onLoadMore !== void 0;
|
|
7878
|
+
function renderContent() {
|
|
7879
|
+
if (isEmpty && isLoading) return /* @__PURE__ */ jsx(LoadingRow, {
|
|
7880
|
+
label: "Loading packages…",
|
|
7881
|
+
center: true
|
|
7882
|
+
});
|
|
7883
|
+
if (isEmpty && error) return /* @__PURE__ */ jsx(PackageRegistryError, {
|
|
7884
|
+
variant: "empty",
|
|
7885
|
+
onRetry
|
|
7886
|
+
});
|
|
7887
|
+
if (isEmpty) {
|
|
7888
|
+
if (showNpmFallback) return /* @__PURE__ */ jsx(NpmFallbackRow, {
|
|
7889
|
+
query,
|
|
7890
|
+
onInstall,
|
|
7891
|
+
disabled
|
|
7892
|
+
});
|
|
7893
|
+
return /* @__PURE__ */ jsx("p", {
|
|
7894
|
+
className: "text-sm text-foreground",
|
|
7895
|
+
children: query ? "No packages match your search." : "No packages available to install."
|
|
7896
|
+
});
|
|
7897
|
+
}
|
|
7898
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7899
|
+
className: "flex flex-col gap-4",
|
|
7900
|
+
children: [
|
|
7901
|
+
available.length > 0 && /* @__PURE__ */ jsx(PackageList, {
|
|
7902
|
+
packages: available,
|
|
7903
|
+
onInstall,
|
|
7904
|
+
onUninstall,
|
|
7905
|
+
preferredTag: queryTag
|
|
7906
|
+
}),
|
|
7907
|
+
dismissed.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
7908
|
+
title: "Dismissed",
|
|
7909
|
+
count: dismissed.length,
|
|
7910
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7911
|
+
packages: dismissed,
|
|
7912
|
+
onInstall,
|
|
7913
|
+
onUninstall,
|
|
7914
|
+
preferredTag: queryTag
|
|
7915
|
+
})
|
|
7916
|
+
}),
|
|
7917
|
+
isLoadingMore && /* @__PURE__ */ jsx(LoadingRow, {
|
|
7918
|
+
label: "Loading more…",
|
|
7919
|
+
center: true
|
|
7920
|
+
}),
|
|
7921
|
+
paginated && !hasMore && !isLoadingMore && /* @__PURE__ */ jsx("p", {
|
|
7922
|
+
className: "py-2 text-center text-sm text-muted-foreground",
|
|
7923
|
+
children: "You’ve reached the end of the list."
|
|
7924
|
+
})
|
|
7925
|
+
]
|
|
7926
|
+
});
|
|
7927
|
+
}
|
|
7928
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7929
|
+
className: "flex h-full flex-col gap-3",
|
|
7930
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
7931
|
+
className: "pr-3",
|
|
7932
|
+
children: [
|
|
7933
|
+
/* @__PURE__ */ jsx(PackageSearchInput, {
|
|
7934
|
+
value: query,
|
|
7935
|
+
onChange: onQueryChange,
|
|
7936
|
+
placeholder: "Search available packages",
|
|
7937
|
+
disabled
|
|
7938
|
+
}),
|
|
7939
|
+
!isEmpty && isLoading && /* @__PURE__ */ jsx("div", {
|
|
7940
|
+
className: "mt-3",
|
|
7941
|
+
children: /* @__PURE__ */ jsx(LoadingRow, { label: "Refreshing packages…" })
|
|
7942
|
+
}),
|
|
7943
|
+
!isEmpty && error && /* @__PURE__ */ jsx("div", {
|
|
7944
|
+
className: "mt-3",
|
|
7945
|
+
children: /* @__PURE__ */ jsx(PackageRegistryError, {
|
|
7946
|
+
variant: "refresh",
|
|
7947
|
+
onRetry
|
|
7948
|
+
})
|
|
7949
|
+
})
|
|
7950
|
+
]
|
|
7951
|
+
}), /* @__PURE__ */ jsx(PackagePanelScrollArea, {
|
|
7952
|
+
onReachEnd: hasMore && onLoadMore ? onLoadMore : void 0,
|
|
7953
|
+
children: renderContent()
|
|
7954
|
+
})]
|
|
7955
|
+
});
|
|
7956
|
+
};
|
|
7957
|
+
//#endregion
|
|
7958
|
+
//#region src/connect/components/modal/settings-modal-v2/package-manager/installed-packages-panel.tsx
|
|
7959
|
+
const InstalledPackagesPanel = (props) => {
|
|
7960
|
+
const { packages, query, onQueryChange, onInstall, onUninstall, disabled } = props;
|
|
7961
|
+
const filtered = filterPackages(packages, query);
|
|
7962
|
+
const locallyInstalled = filtered.filter((p) => p.status === "local-install");
|
|
7963
|
+
const registryInstalled = filtered.filter((p) => p.status === "registry-install");
|
|
7964
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7965
|
+
className: "flex h-full flex-col gap-3",
|
|
7966
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
7967
|
+
className: "pr-3",
|
|
7968
|
+
children: /* @__PURE__ */ jsx(PackageSearchInput, {
|
|
7969
|
+
value: query,
|
|
7970
|
+
onChange: onQueryChange,
|
|
7971
|
+
placeholder: "Search installed packages",
|
|
7972
|
+
disabled
|
|
7973
|
+
})
|
|
7974
|
+
}), /* @__PURE__ */ jsx(PackagePanelScrollArea, { children: packages.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7975
|
+
className: "text-sm text-foreground",
|
|
7976
|
+
children: "No packages installed."
|
|
7977
|
+
}) : filtered.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7978
|
+
className: "text-sm text-foreground",
|
|
7979
|
+
children: "No installed packages match your search."
|
|
7980
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
7981
|
+
className: "flex flex-col gap-4",
|
|
7982
|
+
children: [locallyInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
7983
|
+
title: "Locally installed",
|
|
7984
|
+
count: locallyInstalled.length,
|
|
7985
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7986
|
+
packages: locallyInstalled,
|
|
7987
|
+
onInstall,
|
|
7988
|
+
onUninstall
|
|
7989
|
+
})
|
|
7990
|
+
}), registryInstalled.length > 0 && /* @__PURE__ */ jsx(PackageSubSection, {
|
|
7991
|
+
title: "Installed from registry",
|
|
7992
|
+
count: registryInstalled.length,
|
|
7993
|
+
children: /* @__PURE__ */ jsx(PackageList, {
|
|
7994
|
+
packages: registryInstalled,
|
|
7995
|
+
onInstall,
|
|
7996
|
+
onUninstall
|
|
7997
|
+
})
|
|
7998
|
+
})]
|
|
7999
|
+
}) })]
|
|
8000
|
+
});
|
|
8001
|
+
};
|
|
8002
|
+
//#endregion
|
|
7931
8003
|
//#region src/connect/components/modal/settings-modal-v2/package-manager/package-manager.tsx
|
|
7932
8004
|
const PackageManager = (props) => {
|
|
7933
|
-
const {
|
|
8005
|
+
const { installedPackages, availablePackages, isAvailableLoading, isLoadingMoreAvailable, hasMoreAvailable, onLoadMoreAvailable, availableError, onAvailableRetry, onAvailableSearchChange, onInstall, onUninstall, onAvailableTabOpen, initialTab = "installed", mutable, disabled, className } = props;
|
|
8006
|
+
const [installedQuery, setInstalledQuery] = useState("");
|
|
8007
|
+
const [availableQuery, setAvailableQuery] = useState("");
|
|
8008
|
+
useEffect(() => {
|
|
8009
|
+
if (initialTab === "available") onAvailableTabOpen?.();
|
|
8010
|
+
}, []);
|
|
8011
|
+
const installedNames = installedPackages.map((p) => p.name);
|
|
7934
8012
|
return /* @__PURE__ */ jsxs("div", {
|
|
7935
|
-
className: twMerge("flex h-
|
|
7936
|
-
children: [
|
|
7937
|
-
className: "mb-4",
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
8013
|
+
className: twMerge("flex min-h-0 flex-1 flex-col rounded-lg bg-background pt-3 pl-3 text-foreground", className),
|
|
8014
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
8015
|
+
className: "mb-4 shrink-0 pr-3 font-semibold text-foreground",
|
|
8016
|
+
children: "Packages"
|
|
8017
|
+
}), /* @__PURE__ */ jsxs(Tabs, {
|
|
8018
|
+
defaultValue: initialTab,
|
|
8019
|
+
listClassName: "pr-3",
|
|
8020
|
+
onValueChange: (value) => {
|
|
8021
|
+
if (value === "available") onAvailableTabOpen?.();
|
|
8022
|
+
},
|
|
8023
|
+
children: [/* @__PURE__ */ jsx(TabContent, {
|
|
8024
|
+
value: "installed",
|
|
8025
|
+
label: `Installed (${installedPackages.length})`,
|
|
8026
|
+
children: /* @__PURE__ */ jsx(InstalledPackagesPanel, {
|
|
8027
|
+
packages: installedPackages,
|
|
8028
|
+
query: installedQuery,
|
|
8029
|
+
onQueryChange: setInstalledQuery,
|
|
8030
|
+
onInstall,
|
|
8031
|
+
onUninstall,
|
|
8032
|
+
disabled
|
|
8033
|
+
})
|
|
8034
|
+
}), /* @__PURE__ */ jsx(TabContent, {
|
|
8035
|
+
value: "available",
|
|
8036
|
+
label: "Available",
|
|
8037
|
+
children: /* @__PURE__ */ jsx(AvailablePackagesPanel, {
|
|
8038
|
+
packages: availablePackages,
|
|
8039
|
+
installedNames,
|
|
8040
|
+
query: availableQuery,
|
|
8041
|
+
onQueryChange: (q) => {
|
|
8042
|
+
setAvailableQuery(q);
|
|
8043
|
+
onAvailableSearchChange?.(q);
|
|
8044
|
+
},
|
|
8045
|
+
serverSearch: onAvailableSearchChange !== void 0,
|
|
8046
|
+
isLoading: isAvailableLoading,
|
|
8047
|
+
isLoadingMore: isLoadingMoreAvailable,
|
|
8048
|
+
hasMore: hasMoreAvailable,
|
|
8049
|
+
onLoadMore: onLoadMoreAvailable,
|
|
8050
|
+
error: availableError,
|
|
8051
|
+
onRetry: onAvailableRetry,
|
|
8052
|
+
mutable,
|
|
8053
|
+
onInstall,
|
|
8054
|
+
onUninstall,
|
|
8055
|
+
disabled
|
|
8056
|
+
})
|
|
8057
|
+
})]
|
|
7945
8058
|
})]
|
|
7946
8059
|
});
|
|
7947
8060
|
};
|
|
@@ -7950,19 +8063,21 @@ const PackageManager = (props) => {
|
|
|
7950
8063
|
function SettingsModal(props) {
|
|
7951
8064
|
const { title, overlayProps, contentProps, onOpenChange, tabs, defaultTab, navFooter, ...restProps } = props;
|
|
7952
8065
|
const [selectedTab, setSelectedTab] = useState(defaultTab ?? tabs.at(0)?.id);
|
|
7953
|
-
const tabsContent = tabs.map((tab) =>
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
8066
|
+
const tabsContent = tabs.map((tab) => {
|
|
8067
|
+
const isActive = selectedTab === tab.id;
|
|
8068
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
8069
|
+
type: "button",
|
|
8070
|
+
"aria-current": isActive ? "page" : void 0,
|
|
8071
|
+
onClick: isActive ? void 0 : () => setSelectedTab(tab.id),
|
|
8072
|
+
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
8073
|
children: [tab.icon, /* @__PURE__ */ jsx("span", { children: tab.label })]
|
|
7959
|
-
})
|
|
7960
|
-
}
|
|
8074
|
+
}, tab.id);
|
|
8075
|
+
});
|
|
7961
8076
|
const SelectedTabComponent = tabs.find((tab) => tab.id === selectedTab)?.content;
|
|
7962
8077
|
return /* @__PURE__ */ jsxs(Modal, {
|
|
7963
8078
|
contentProps: {
|
|
7964
8079
|
...contentProps,
|
|
7965
|
-
className: twMerge("min-h-full w-full max-w-4xl rounded-xl", contentProps?.className)
|
|
8080
|
+
className: twMerge("flex max-h-[calc(100dvh-14rem)] min-h-full w-full max-w-4xl flex-col rounded-xl", contentProps?.className)
|
|
7966
8081
|
},
|
|
7967
8082
|
onOpenChange,
|
|
7968
8083
|
overlayProps: {
|
|
@@ -7986,7 +8101,7 @@ function SettingsModal(props) {
|
|
|
7986
8101
|
})
|
|
7987
8102
|
})]
|
|
7988
8103
|
}), /* @__PURE__ */ jsxs("div", {
|
|
7989
|
-
className: "flex flex-1",
|
|
8104
|
+
className: "flex min-h-0 flex-1",
|
|
7990
8105
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
7991
8106
|
className: "flex flex-col p-3 pt-6",
|
|
7992
8107
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -7997,7 +8112,7 @@ function SettingsModal(props) {
|
|
|
7997
8112
|
children: navFooter
|
|
7998
8113
|
})]
|
|
7999
8114
|
}), /* @__PURE__ */ jsx("div", {
|
|
8000
|
-
className: "m-6 flex h-
|
|
8115
|
+
className: "m-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-background",
|
|
8001
8116
|
children: typeof SelectedTabComponent === "function" ? /* @__PURE__ */ jsx(SelectedTabComponent, {}) : SelectedTabComponent
|
|
8002
8117
|
})]
|
|
8003
8118
|
})]
|
|
@@ -9139,6 +9254,6 @@ const removeSuccessFiles = (files) => {
|
|
|
9139
9254
|
return files.filter((file) => file.status !== "SUCCESS");
|
|
9140
9255
|
};
|
|
9141
9256
|
//#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,
|
|
9257
|
+
export { About, AccountPopover, 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, 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, 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
9258
|
|
|
9144
9259
|
//# sourceMappingURL=index.js.map
|