@tradalab/lyra 3.16.0 → 3.18.0
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/README.md +3 -3
- package/dist/blocks/index.d.ts +140 -7
- package/dist/blocks/index.js +485 -72
- package/dist/blocks/index.js.map +1 -1
- package/dist/chunk-A3T2BEQH.js +45 -0
- package/dist/chunk-A3T2BEQH.js.map +1 -0
- package/dist/{chunk-AIULLZYM.js → chunk-D2O4GTCC.js} +12 -3
- package/dist/chunk-D2O4GTCC.js.map +1 -0
- package/dist/chunk-UAZAKUTL.js +65 -0
- package/dist/chunk-UAZAKUTL.js.map +1 -0
- package/dist/connection-color-DxEs04ll.d.ts +54 -0
- package/dist/hooks/index.d.ts +10 -3
- package/dist/hooks/index.js +1 -1
- package/dist/people/index.js +2 -1
- package/dist/people/index.js.map +1 -1
- package/dist/{plate-BJ19iaVV.d.ts → plate-iXwbupLU.d.ts} +1 -1
- package/dist/{plate-picker-CXxUGyNz.d.ts → plate-picker-DdC2HFo6.d.ts} +2 -2
- package/dist/shell/index.d.ts +2 -2
- package/dist/shell/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/{use-compact-BvI4sJf9.d.ts → use-compact-ahmJWpSH.d.ts} +1 -1
- package/dist/utils/index.d.ts +24 -1
- package/dist/utils/index.js +2 -1
- package/package.json +1 -1
- package/dist/chunk-AIULLZYM.js.map +0 -1
- package/dist/chunk-DRBRT57F.js +0 -3
- package/dist/chunk-DRBRT57F.js.map +0 -1
package/dist/blocks/index.js
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Label, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel,
|
|
2
|
+
import { Label, Badge, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Calendar, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, FieldSeparator, Progress } from '../chunk-ASSRDIKG.js';
|
|
3
3
|
export { PreferenceScript } from '../chunk-ASSRDIKG.js';
|
|
4
4
|
import { NativeSelect, NativeSelectOption } from '../chunk-KSF233MC.js';
|
|
5
|
-
export { useCompact, usePlate } from '../chunk-
|
|
5
|
+
export { useCompact, usePlate } from '../chunk-D2O4GTCC.js';
|
|
6
6
|
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, RadioGroup, RadioGroupItem, Switch } from '../chunk-UNRT3B6P.js';
|
|
7
7
|
export { PlatePicker } from '../chunk-UNRT3B6P.js';
|
|
8
8
|
export { BEARING_PLATES, PLATES, derivePlate, isPlate } from '../chunk-D7DMRCDY.js';
|
|
9
9
|
import '../chunk-OH3OMK7A.js';
|
|
10
|
-
import {
|
|
10
|
+
import { isConnectionColor, CONNECTION_COLOR_NAMES, CONNECTION_COLORS, addTag } from '../chunk-A3T2BEQH.js';
|
|
11
|
+
import { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription, Popover, PopoverTrigger, PopoverContent } from '../chunk-L4LQCVOF.js';
|
|
11
12
|
import { foldText } from '../chunk-5XFDQRXV.js';
|
|
12
|
-
import { Avatar, AvatarImage, AvatarFallback } from '../chunk-VXW3K5O5.js';
|
|
13
|
+
import { Textarea, InputGroup, InputGroupInput, InputGroupAddon, Avatar, AvatarImage, AvatarFallback, InputGroupButton } from '../chunk-VXW3K5O5.js';
|
|
13
14
|
import { Button, Input } from '../chunk-VGOGWZCF.js';
|
|
14
15
|
import { cn } from '../chunk-XH55BHUU.js';
|
|
15
|
-
import * as
|
|
16
|
-
import { createContext, useState, useContext, useCallback, useMemo, useId } from 'react';
|
|
16
|
+
import * as React6 from 'react';
|
|
17
|
+
import { createContext, useState, useRef, useContext, useCallback, useMemo, useId } from 'react';
|
|
17
18
|
import { Slot } from 'radix-ui';
|
|
18
19
|
import { FormProvider, Controller, useFormContext } from 'react-hook-form';
|
|
19
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
-
import { ChevronRight, CheckIcon, CopyIcon, RefreshCwIcon, PlusIcon, ListIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
21
|
+
import { ChevronRight, XIcon, LockIcon, CheckIcon, CopyIcon, RefreshCwIcon, PlusIcon, ListIcon, CalendarIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
22
|
+
import { format } from 'date-fns';
|
|
23
|
+
import { enUS } from 'date-fns/locale/en-US';
|
|
24
|
+
import { ja } from 'date-fns/locale/ja';
|
|
25
|
+
import { vi } from 'date-fns/locale/vi';
|
|
21
26
|
|
|
22
27
|
var Form = FormProvider;
|
|
23
|
-
var FormFieldContext =
|
|
28
|
+
var FormFieldContext = React6.createContext(null);
|
|
24
29
|
var FormField = ({
|
|
25
30
|
...props
|
|
26
31
|
}) => {
|
|
27
32
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
28
33
|
};
|
|
29
34
|
var useFormField = () => {
|
|
30
|
-
const fieldContext =
|
|
31
|
-
const itemContext =
|
|
35
|
+
const fieldContext = React6.useContext(FormFieldContext);
|
|
36
|
+
const itemContext = React6.useContext(FormItemContext);
|
|
32
37
|
const { getFieldState, formState } = useFormContext();
|
|
33
38
|
if (!fieldContext) {
|
|
34
39
|
throw new Error("useFormField should be used within <FormField>");
|
|
@@ -44,9 +49,9 @@ var useFormField = () => {
|
|
|
44
49
|
...fieldState
|
|
45
50
|
};
|
|
46
51
|
};
|
|
47
|
-
var FormItemContext =
|
|
52
|
+
var FormItemContext = React6.createContext(null);
|
|
48
53
|
function FormItem({ className, ...props }) {
|
|
49
|
-
const id =
|
|
54
|
+
const id = React6.useId();
|
|
50
55
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
51
56
|
}
|
|
52
57
|
function FormLabel({ className, ...props }) {
|
|
@@ -137,31 +142,92 @@ function PanelCard({ title, description, hint, action, children }) {
|
|
|
137
142
|
] })
|
|
138
143
|
] });
|
|
139
144
|
}
|
|
145
|
+
var shell = cn("fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2", "p-4 w-[min(400px,calc(100vw-2rem))]", "focus:outline-none");
|
|
146
|
+
function Lines({ items }) {
|
|
147
|
+
return /* @__PURE__ */ jsx("ul", { className: "mt-2 list-disc space-y-1 pl-5 text-sm", children: items.map((item, i) => /* @__PURE__ */ jsx("li", { children: item }, i)) });
|
|
148
|
+
}
|
|
140
149
|
function ConfirmDialog({ options, onConfirm, onCancel }) {
|
|
150
|
+
const [reason, setReason] = useState("");
|
|
151
|
+
const missing = !!options.reason?.required && reason.trim() === "";
|
|
141
152
|
return /* @__PURE__ */ jsxs(Dialog, { open: true, onOpenChange: (val) => !val && onCancel(), children: [
|
|
142
153
|
/* @__PURE__ */ jsx(DialogOverlay, { className: "fixed inset-0 bg-white/10" }),
|
|
143
|
-
/* @__PURE__ */ jsxs(DialogContent, { className:
|
|
154
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: shell, children: [
|
|
144
155
|
/* @__PURE__ */ jsx(DialogTitle, { className: "text-sm font-medium", children: options.title }),
|
|
145
156
|
options.description != null && /* @__PURE__ */ jsx(DialogDescription, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "mt-2 text-sm text-muted-foreground", children: options.description }) }),
|
|
146
|
-
/* @__PURE__ */
|
|
157
|
+
options.consequences && options.consequences.length > 0 && /* @__PURE__ */ jsx(Lines, { items: options.consequences }),
|
|
158
|
+
options.reversible != null && /* @__PURE__ */ jsx("p", { className: cn("mt-2 text-xs", options.reversible ? "text-muted-foreground" : "text-destructive"), children: options.reversible ? options.reversibleText ?? "This can be undone." : options.irreversibleText ?? "This cannot be undone." }),
|
|
159
|
+
options.reason && /* @__PURE__ */ jsxs("label", { className: "mt-3 grid gap-1.5 text-sm", children: [
|
|
160
|
+
/* @__PURE__ */ jsx("span", { children: options.reason.label }),
|
|
161
|
+
/* @__PURE__ */ jsx(Textarea, { value: reason, placeholder: options.reason.placeholder, onChange: (e) => setReason(e.target.value), rows: 3 })
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
147
164
|
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, children: options.cancelText ?? "Cancel" }),
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
165
|
+
/* @__PURE__ */ jsx(
|
|
166
|
+
Button,
|
|
167
|
+
{
|
|
168
|
+
size: "sm",
|
|
169
|
+
disabled: missing,
|
|
170
|
+
onClick: () => onConfirm(reason.trim()),
|
|
171
|
+
className: cn(options.danger && "bg-red-600 hover:bg-red-700 text-white"),
|
|
172
|
+
children: options.confirmText ?? "Confirm"
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] })
|
|
176
|
+
] })
|
|
177
|
+
] });
|
|
178
|
+
}
|
|
179
|
+
function BlockedDialog({ options, onClose }) {
|
|
180
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: true, onOpenChange: (val) => !val && onClose(), children: [
|
|
181
|
+
/* @__PURE__ */ jsx(DialogOverlay, { className: "fixed inset-0 bg-white/10" }),
|
|
182
|
+
/* @__PURE__ */ jsxs(DialogContent, { className: shell, children: [
|
|
183
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-sm font-medium", children: options.title }),
|
|
184
|
+
options.description != null && /* @__PURE__ */ jsx(DialogDescription, { asChild: true, children: /* @__PURE__ */ jsx("div", { className: "mt-2 text-sm text-muted-foreground", children: options.description }) }),
|
|
185
|
+
/* @__PURE__ */ jsx(Lines, { items: options.blockers }),
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onClose, children: options.closeText ?? "Close" }),
|
|
188
|
+
options.action && /* @__PURE__ */ jsx(
|
|
189
|
+
Button,
|
|
190
|
+
{
|
|
191
|
+
size: "sm",
|
|
192
|
+
onClick: () => {
|
|
193
|
+
onClose();
|
|
194
|
+
options.action.onClick();
|
|
195
|
+
},
|
|
196
|
+
children: options.action.label
|
|
197
|
+
}
|
|
198
|
+
)
|
|
149
199
|
] })
|
|
150
200
|
] })
|
|
151
201
|
] });
|
|
152
202
|
}
|
|
153
203
|
var ConfirmContext = createContext(null);
|
|
204
|
+
var ConfirmReasonContext = createContext(null);
|
|
205
|
+
var BlockedContext = createContext(null);
|
|
154
206
|
function ConfirmProvider({ children }) {
|
|
155
207
|
const [state, setState] = useState(null);
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
|
|
208
|
+
const open = useRef(null);
|
|
209
|
+
const next = useRef(0);
|
|
210
|
+
const show = (o) => {
|
|
211
|
+
open.current?.dismiss();
|
|
212
|
+
open.current = o;
|
|
213
|
+
setState(o);
|
|
214
|
+
};
|
|
215
|
+
const confirm = (options) => new Promise((resolve) => show({ id: ++next.current, kind: "confirm", options, resolve, dismiss: () => resolve(false) }));
|
|
216
|
+
const confirmReason = (options) => new Promise(
|
|
217
|
+
(resolve) => show({ id: ++next.current, kind: "reason", options, resolve, dismiss: () => resolve(null) })
|
|
218
|
+
);
|
|
219
|
+
const blocked = (options) => new Promise((resolve) => show({ id: ++next.current, kind: "blocked", options, resolve, dismiss: () => resolve() }));
|
|
220
|
+
const done = (fn) => {
|
|
221
|
+
fn();
|
|
222
|
+
open.current = null;
|
|
159
223
|
setState(null);
|
|
160
224
|
};
|
|
161
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ jsx(ConfirmContext.Provider, { value: confirm, children: /* @__PURE__ */ jsx(ConfirmReasonContext.Provider, { value: confirmReason, children: /* @__PURE__ */ jsxs(BlockedContext.Provider, { value: blocked, children: [
|
|
162
226
|
children,
|
|
163
|
-
state && /* @__PURE__ */ jsx(ConfirmDialog, { options: state.options, onConfirm: () =>
|
|
164
|
-
|
|
227
|
+
state?.kind === "confirm" && /* @__PURE__ */ jsx(ConfirmDialog, { options: state.options, onConfirm: () => done(() => state.resolve(true)), onCancel: () => done(() => state.resolve(false)) }, state.id),
|
|
228
|
+
state?.kind === "reason" && /* @__PURE__ */ jsx(ConfirmDialog, { options: state.options, onConfirm: (r) => done(() => state.resolve(r)), onCancel: () => done(() => state.resolve(null)) }, state.id),
|
|
229
|
+
state?.kind === "blocked" && /* @__PURE__ */ jsx(BlockedDialog, { options: state.options, onClose: () => done(() => state.resolve()) }, state.id)
|
|
230
|
+
] }) }) });
|
|
165
231
|
}
|
|
166
232
|
var useConfirm = () => {
|
|
167
233
|
const ctx = useContext(ConfirmContext);
|
|
@@ -170,6 +236,20 @@ var useConfirm = () => {
|
|
|
170
236
|
}
|
|
171
237
|
return ctx;
|
|
172
238
|
};
|
|
239
|
+
var useConfirmReason = () => {
|
|
240
|
+
const ctx = useContext(ConfirmReasonContext);
|
|
241
|
+
if (!ctx) {
|
|
242
|
+
throw new Error("useConfirmReason must be used inside ConfirmProvider");
|
|
243
|
+
}
|
|
244
|
+
return ctx;
|
|
245
|
+
};
|
|
246
|
+
var useBlocked = () => {
|
|
247
|
+
const ctx = useContext(BlockedContext);
|
|
248
|
+
if (!ctx) {
|
|
249
|
+
throw new Error("useBlocked must be used inside ConfirmProvider");
|
|
250
|
+
}
|
|
251
|
+
return ctx;
|
|
252
|
+
};
|
|
173
253
|
|
|
174
254
|
// src/blocks/tree/data.ts
|
|
175
255
|
var DIGITS = /\d+/g;
|
|
@@ -582,6 +662,145 @@ var TreeIcon = ({ icon, hasChildren = false, className, ...props }) => {
|
|
|
582
662
|
return /* @__PURE__ */ jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center text-muted-foreground transition-transform", className), ...props, children: icon || getDefaultIcon() });
|
|
583
663
|
};
|
|
584
664
|
var TreeLabel = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { className: cn("font flex-1 truncate text-sm", className), ...props });
|
|
665
|
+
function StatTile({ label, value, tone = "default", className }) {
|
|
666
|
+
const bad = tone === "bad";
|
|
667
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "stat-tile", "data-tone": tone, className: cn("border p-2", bad && "border-destructive", className), children: [
|
|
668
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: label }),
|
|
669
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-mono text-lg tabular-nums", bad && "text-destructive"), children: value })
|
|
670
|
+
] });
|
|
671
|
+
}
|
|
672
|
+
function BarList({ items, className }) {
|
|
673
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "bar-list", className: cn("grid content-start gap-1", className), children: items.map((item) => {
|
|
674
|
+
const ratio = Number.isNaN(item.ratio) ? 0 : Math.min(1, Math.max(0, item.ratio));
|
|
675
|
+
const width = `${Math.round(ratio * 100)}%`;
|
|
676
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
677
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 bg-primary/10", style: { width } }),
|
|
678
|
+
/* @__PURE__ */ jsx("span", { className: "relative min-w-0 flex-1 truncate font-mono text-xs", children: item.label }),
|
|
679
|
+
/* @__PURE__ */ jsx("span", { className: "relative font-mono text-xs tabular-nums", children: item.value })
|
|
680
|
+
] });
|
|
681
|
+
const cls = "relative flex items-center gap-2 px-1 py-0.5 text-left";
|
|
682
|
+
return item.onSelect ? /* @__PURE__ */ jsx("button", { type: "button", title: item.label, className: cn(cls, "hover:bg-muted/50"), onClick: item.onSelect, children: body }, item.key) : /* @__PURE__ */ jsx("div", { title: item.label, className: cls, children: body }, item.key);
|
|
683
|
+
}) });
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// src/blocks/connection/storage.ts
|
|
687
|
+
function loadExpanded(key) {
|
|
688
|
+
try {
|
|
689
|
+
const raw = JSON.parse(globalThis.localStorage?.getItem(key) ?? "[]");
|
|
690
|
+
return new Set(Array.isArray(raw) ? raw.filter((x) => typeof x === "string") : []);
|
|
691
|
+
} catch {
|
|
692
|
+
return /* @__PURE__ */ new Set();
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function saveExpanded(key, ids) {
|
|
696
|
+
try {
|
|
697
|
+
globalThis.localStorage?.setItem(key, JSON.stringify([...ids]));
|
|
698
|
+
} catch {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
function ColorSwatches({ value, onChange, emptyLabel, labels, className, ...aria }) {
|
|
703
|
+
const current = isConnectionColor(value) ? value : "";
|
|
704
|
+
return /* @__PURE__ */ jsxs("div", { role: "group", ...aria, className: cn("flex flex-wrap items-center gap-2", className), children: [
|
|
705
|
+
/* @__PURE__ */ jsx(
|
|
706
|
+
Swatch,
|
|
707
|
+
{
|
|
708
|
+
label: emptyLabel,
|
|
709
|
+
selected: current === "",
|
|
710
|
+
onSelect: () => onChange(""),
|
|
711
|
+
className: "border border-dashed border-muted-foreground/50"
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
CONNECTION_COLOR_NAMES.map((color) => /* @__PURE__ */ jsx(
|
|
715
|
+
Swatch,
|
|
716
|
+
{
|
|
717
|
+
label: labels?.[color] ?? color,
|
|
718
|
+
selected: current === color,
|
|
719
|
+
onSelect: () => onChange(color),
|
|
720
|
+
className: CONNECTION_COLORS[color].swatch
|
|
721
|
+
},
|
|
722
|
+
color
|
|
723
|
+
))
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
726
|
+
function Swatch({ label, selected, onSelect, className }) {
|
|
727
|
+
return /* @__PURE__ */ jsx(
|
|
728
|
+
"button",
|
|
729
|
+
{
|
|
730
|
+
type: "button",
|
|
731
|
+
"aria-pressed": selected,
|
|
732
|
+
"aria-label": label,
|
|
733
|
+
title: label,
|
|
734
|
+
onClick: onSelect,
|
|
735
|
+
className: cn(
|
|
736
|
+
"size-5 shrink-0 cursor-pointer rounded-full ring-offset-background transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
737
|
+
selected && "ring-2 ring-foreground ring-offset-2",
|
|
738
|
+
className
|
|
739
|
+
)
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
function TagInput({ value, onChange, suggestions = [], placeholder, removeLabel, className, disabled, ...aria }) {
|
|
744
|
+
const listId = useId();
|
|
745
|
+
const [draft, setDraft] = useState("");
|
|
746
|
+
const tags = useMemo(() => (value ?? []).reduce(addTag, []), [value]);
|
|
747
|
+
const commit = () => {
|
|
748
|
+
const next = draft.split(",").reduce(addTag, tags);
|
|
749
|
+
if (next !== tags) onChange([...next]);
|
|
750
|
+
setDraft("");
|
|
751
|
+
};
|
|
752
|
+
const onKeyDown = (e) => {
|
|
753
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
754
|
+
if (e.key === "Enter" || e.key === ",") {
|
|
755
|
+
e.preventDefault();
|
|
756
|
+
commit();
|
|
757
|
+
} else if (e.key === "Backspace" && draft === "" && tags.length > 0) {
|
|
758
|
+
onChange(tags.slice(0, -1));
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
return /* @__PURE__ */ jsxs(
|
|
762
|
+
"div",
|
|
763
|
+
{
|
|
764
|
+
className: cn(
|
|
765
|
+
"flex min-h-8 w-full flex-wrap items-center gap-1 border border-input bg-transparent px-2 py-1 text-xs dark:bg-input/30",
|
|
766
|
+
"focus-within:border-ring focus-within:ring-1 focus-within:ring-ring/50",
|
|
767
|
+
"has-[input[aria-invalid=true]]:border-destructive has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50",
|
|
768
|
+
className
|
|
769
|
+
),
|
|
770
|
+
children: [
|
|
771
|
+
tags.map((tag) => /* @__PURE__ */ jsxs(Badge, { variant: "secondary", className: "gap-1 pr-1", children: [
|
|
772
|
+
tag,
|
|
773
|
+
/* @__PURE__ */ jsx(
|
|
774
|
+
"button",
|
|
775
|
+
{
|
|
776
|
+
type: "button",
|
|
777
|
+
"aria-label": removeLabel ? removeLabel(tag) : `Remove ${tag}`,
|
|
778
|
+
disabled,
|
|
779
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
780
|
+
onClick: () => onChange(tags.filter((x) => x !== tag)),
|
|
781
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "size-3" })
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
] }, tag)),
|
|
785
|
+
/* @__PURE__ */ jsx(
|
|
786
|
+
"input",
|
|
787
|
+
{
|
|
788
|
+
...aria,
|
|
789
|
+
disabled,
|
|
790
|
+
value: draft,
|
|
791
|
+
list: listId,
|
|
792
|
+
onChange: (e) => setDraft(e.target.value),
|
|
793
|
+
onKeyDown,
|
|
794
|
+
onBlur: commit,
|
|
795
|
+
placeholder: tags.length === 0 ? placeholder : void 0,
|
|
796
|
+
className: "min-w-24 flex-1 bg-transparent outline-none placeholder:text-muted-foreground"
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
/* @__PURE__ */ jsx("datalist", { id: listId, children: suggestions.reduce(addTag, []).filter((s) => !tags.some((x) => x.toLowerCase() === s.toLowerCase())).map((s) => /* @__PURE__ */ jsx("option", { value: s }, s)) })
|
|
800
|
+
]
|
|
801
|
+
}
|
|
802
|
+
);
|
|
803
|
+
}
|
|
585
804
|
var FALLBACK_ZONES = [
|
|
586
805
|
"UTC",
|
|
587
806
|
"Asia/Ho_Chi_Minh",
|
|
@@ -597,14 +816,22 @@ var FALLBACK_ZONES = [
|
|
|
597
816
|
"America/Los_Angeles"
|
|
598
817
|
];
|
|
599
818
|
var IANA_PRIMARY = {
|
|
819
|
+
"Africa/Asmera": "Africa/Asmara",
|
|
600
820
|
"America/Buenos_Aires": "America/Argentina/Buenos_Aires",
|
|
821
|
+
"America/Catamarca": "America/Argentina/Catamarca",
|
|
822
|
+
"America/Cordoba": "America/Argentina/Cordoba",
|
|
601
823
|
"America/Godthab": "America/Nuuk",
|
|
824
|
+
"America/Indianapolis": "America/Indiana/Indianapolis",
|
|
825
|
+
"America/Jujuy": "America/Argentina/Jujuy",
|
|
826
|
+
"America/Louisville": "America/Kentucky/Louisville",
|
|
827
|
+
"America/Mendoza": "America/Argentina/Mendoza",
|
|
602
828
|
"Asia/Calcutta": "Asia/Kolkata",
|
|
603
829
|
"Asia/Katmandu": "Asia/Kathmandu",
|
|
604
830
|
"Asia/Rangoon": "Asia/Yangon",
|
|
605
831
|
"Asia/Saigon": "Asia/Ho_Chi_Minh",
|
|
606
832
|
"Atlantic/Faeroe": "Atlantic/Faroe",
|
|
607
833
|
"Europe/Kiev": "Europe/Kyiv",
|
|
834
|
+
"Pacific/Enderbury": "Pacific/Kanton",
|
|
608
835
|
"Pacific/Ponape": "Pacific/Pohnpei",
|
|
609
836
|
"Pacific/Truk": "Pacific/Chuuk"
|
|
610
837
|
};
|
|
@@ -657,8 +884,8 @@ function TzPicker({
|
|
|
657
884
|
search: labels?.search ?? "Search timezone",
|
|
658
885
|
noMatch: labels?.noMatch ?? "No match"
|
|
659
886
|
};
|
|
660
|
-
const own =
|
|
661
|
-
const entries =
|
|
887
|
+
const own = React6.useMemo(() => browserTz(), []);
|
|
888
|
+
const entries = React6.useMemo(() => {
|
|
662
889
|
const zones = allZones();
|
|
663
890
|
const out = [];
|
|
664
891
|
if (allowInherit) out.push({ tz: "", name: l.inherit, offset: "" });
|
|
@@ -705,6 +932,204 @@ function TzPicker({
|
|
|
705
932
|
}
|
|
706
933
|
);
|
|
707
934
|
}
|
|
935
|
+
function MobileSheet({ title, description, trigger, open, onOpenChange, className, children }) {
|
|
936
|
+
return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange, children: [
|
|
937
|
+
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
|
|
938
|
+
/* @__PURE__ */ jsxs(DrawerContent, { children: [
|
|
939
|
+
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
940
|
+
/* @__PURE__ */ jsx(DrawerTitle, { className: "text-base", children: title }),
|
|
941
|
+
description && /* @__PURE__ */ jsx(DrawerDescription, { className: "text-sm", children: description })
|
|
942
|
+
] }),
|
|
943
|
+
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 overflow-y-auto px-4 pb-[calc(1.5rem+env(safe-area-inset-bottom))] text-sm", className), children })
|
|
944
|
+
] })
|
|
945
|
+
] });
|
|
946
|
+
}
|
|
947
|
+
var CALENDAR_LOCALES = { vi, ja, en: enUS };
|
|
948
|
+
function datePattern(locale) {
|
|
949
|
+
const parts = new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }).formatToParts(
|
|
950
|
+
new Date(2001, 10, 22)
|
|
951
|
+
);
|
|
952
|
+
const order = [];
|
|
953
|
+
let sep = "/";
|
|
954
|
+
for (const p of parts) {
|
|
955
|
+
if (p.type === "day") order.push("d");
|
|
956
|
+
else if (p.type === "month") order.push("m");
|
|
957
|
+
else if (p.type === "year") order.push("y");
|
|
958
|
+
else if (p.type === "literal" && order.length === 1) sep = p.value.trim() || p.value;
|
|
959
|
+
}
|
|
960
|
+
return order.length === 3 ? { order, sep } : { order: ["d", "m", "y"], sep: "/" };
|
|
961
|
+
}
|
|
962
|
+
var pad = (n, w) => String(n).padStart(w, "0");
|
|
963
|
+
function isoOf(y, m, d) {
|
|
964
|
+
const dt = new Date(Date.UTC(y, m - 1, d));
|
|
965
|
+
if (dt.getUTCFullYear() !== y || dt.getUTCMonth() !== m - 1 || dt.getUTCDate() !== d) return null;
|
|
966
|
+
return `${pad(y, 4)}-${pad(m, 2)}-${pad(d, 2)}`;
|
|
967
|
+
}
|
|
968
|
+
function formatDate(iso, pattern) {
|
|
969
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
970
|
+
if (!m) return "";
|
|
971
|
+
const by = { y: m[1], m: m[2], d: m[3] };
|
|
972
|
+
return pattern.order.map((p) => by[p]).join(pattern.sep);
|
|
973
|
+
}
|
|
974
|
+
function parseDate(text, pattern) {
|
|
975
|
+
const t = text.trim();
|
|
976
|
+
if (/^\d{4}-\d{1,2}-\d{1,2}$/.test(t)) {
|
|
977
|
+
const [y2, mo, d] = t.split("-").map(Number);
|
|
978
|
+
return isoOf(y2, mo, d);
|
|
979
|
+
}
|
|
980
|
+
const nums = t.split(/\D+/).filter(Boolean);
|
|
981
|
+
if (nums.length !== 3) return null;
|
|
982
|
+
const by = {};
|
|
983
|
+
pattern.order.forEach((p, i) => by[p] = Number(nums[i]));
|
|
984
|
+
let y = by.y;
|
|
985
|
+
if (nums[pattern.order.indexOf("y")].length <= 2) y += y <= (/* @__PURE__ */ new Date()).getFullYear() % 100 + 10 ? 2e3 : 1900;
|
|
986
|
+
return isoOf(y, by.m, by.d);
|
|
987
|
+
}
|
|
988
|
+
function toDate(iso) {
|
|
989
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
990
|
+
return m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : void 0;
|
|
991
|
+
}
|
|
992
|
+
function fromDate(d) {
|
|
993
|
+
return `${pad(d.getFullYear(), 4)}-${pad(d.getMonth() + 1, 2)}-${pad(d.getDate(), 2)}`;
|
|
994
|
+
}
|
|
995
|
+
function useCoarsePointer() {
|
|
996
|
+
const [coarse, setCoarse] = React6.useState(false);
|
|
997
|
+
React6.useEffect(() => {
|
|
998
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
999
|
+
const mql = window.matchMedia("(pointer: coarse)");
|
|
1000
|
+
const onChange = () => setCoarse(mql.matches);
|
|
1001
|
+
onChange();
|
|
1002
|
+
mql.addEventListener("change", onChange);
|
|
1003
|
+
return () => mql.removeEventListener("change", onChange);
|
|
1004
|
+
}, []);
|
|
1005
|
+
return coarse;
|
|
1006
|
+
}
|
|
1007
|
+
function DateField({
|
|
1008
|
+
value,
|
|
1009
|
+
onChange,
|
|
1010
|
+
locale,
|
|
1011
|
+
id,
|
|
1012
|
+
disabled,
|
|
1013
|
+
required,
|
|
1014
|
+
min,
|
|
1015
|
+
max,
|
|
1016
|
+
todayLabel = "Today",
|
|
1017
|
+
clearLabel = "Clear",
|
|
1018
|
+
pickLabel = "Pick a date",
|
|
1019
|
+
className,
|
|
1020
|
+
...aria
|
|
1021
|
+
}) {
|
|
1022
|
+
const pattern = React6.useMemo(() => datePattern(locale), [locale]);
|
|
1023
|
+
const placeholder = pattern.order.map((p) => p === "y" ? "yyyy" : p === "m" ? "mm" : "dd").join(pattern.sep);
|
|
1024
|
+
const [text, setText] = React6.useState(() => formatDate(value, pattern));
|
|
1025
|
+
const [bad, setBad] = React6.useState(false);
|
|
1026
|
+
const [open, setOpen] = React6.useState(false);
|
|
1027
|
+
const coarse = useCoarsePointer();
|
|
1028
|
+
const [seen, setSeen] = React6.useState(value);
|
|
1029
|
+
if (seen !== value) {
|
|
1030
|
+
setSeen(value);
|
|
1031
|
+
setText(formatDate(value, pattern));
|
|
1032
|
+
setBad(false);
|
|
1033
|
+
}
|
|
1034
|
+
const inRange = (iso) => (!min || iso >= min) && (!max || iso <= max);
|
|
1035
|
+
const commit = () => {
|
|
1036
|
+
if (text.trim() === "") {
|
|
1037
|
+
setBad(false);
|
|
1038
|
+
if (value !== "") onChange("");
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
const iso = parseDate(text, pattern);
|
|
1042
|
+
if (!iso || !inRange(iso)) {
|
|
1043
|
+
setBad(true);
|
|
1044
|
+
setText(formatDate(value, pattern));
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
setBad(false);
|
|
1048
|
+
setText(formatDate(iso, pattern));
|
|
1049
|
+
if (iso !== value) onChange(iso);
|
|
1050
|
+
};
|
|
1051
|
+
const pick = (iso) => {
|
|
1052
|
+
setOpen(false);
|
|
1053
|
+
setBad(false);
|
|
1054
|
+
setText(formatDate(iso, pattern));
|
|
1055
|
+
if (iso !== value) onChange(iso);
|
|
1056
|
+
};
|
|
1057
|
+
const lang = locale.split("-")[0];
|
|
1058
|
+
const calendarLocale = CALENDAR_LOCALES[lang] ?? enUS;
|
|
1059
|
+
const today = fromDate(/* @__PURE__ */ new Date());
|
|
1060
|
+
const selected = toDate(value);
|
|
1061
|
+
const calendar = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1062
|
+
/* @__PURE__ */ jsx(
|
|
1063
|
+
Calendar,
|
|
1064
|
+
{
|
|
1065
|
+
mode: "single",
|
|
1066
|
+
locale: calendarLocale,
|
|
1067
|
+
formatters: { formatWeekdayName: (d) => format(d, lang === "vi" ? "EEEEE" : "EEEEEE", { locale: calendarLocale }) },
|
|
1068
|
+
selected,
|
|
1069
|
+
defaultMonth: selected,
|
|
1070
|
+
captionLayout: "dropdown",
|
|
1071
|
+
disabled: [...min ? [{ before: toDate(min) }] : [], ...max ? [{ after: toDate(max) }] : []],
|
|
1072
|
+
onSelect: (d) => d && pick(fromDate(d))
|
|
1073
|
+
}
|
|
1074
|
+
),
|
|
1075
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-2 px-2 pb-2", children: [
|
|
1076
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => pick(""), disabled: required, children: clearLabel }),
|
|
1077
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => pick(today), disabled: !inRange(today), children: todayLabel })
|
|
1078
|
+
] })
|
|
1079
|
+
] });
|
|
1080
|
+
const trigger = /* @__PURE__ */ jsx(InputGroupButton, { type: "button", size: "icon-xs", "aria-label": pickLabel, disabled, children: /* @__PURE__ */ jsx(CalendarIcon, {}) });
|
|
1081
|
+
return /* @__PURE__ */ jsxs(InputGroup, { className, "data-disabled": disabled || void 0, children: [
|
|
1082
|
+
/* @__PURE__ */ jsx(
|
|
1083
|
+
InputGroupInput,
|
|
1084
|
+
{
|
|
1085
|
+
id,
|
|
1086
|
+
inputMode: "numeric",
|
|
1087
|
+
autoComplete: "off",
|
|
1088
|
+
placeholder,
|
|
1089
|
+
value: text,
|
|
1090
|
+
disabled,
|
|
1091
|
+
required,
|
|
1092
|
+
"aria-label": aria["aria-label"],
|
|
1093
|
+
"aria-invalid": bad || aria["aria-invalid"] || void 0,
|
|
1094
|
+
onChange: (e) => {
|
|
1095
|
+
setText(e.target.value);
|
|
1096
|
+
setBad(false);
|
|
1097
|
+
},
|
|
1098
|
+
onBlur: commit,
|
|
1099
|
+
onKeyDown: (e) => {
|
|
1100
|
+
if (e.key === "Enter") {
|
|
1101
|
+
e.preventDefault();
|
|
1102
|
+
commit();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
/* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: coarse ? /* @__PURE__ */ jsx(MobileSheet, { title: pickLabel, open, onOpenChange: setOpen, trigger, children: /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: calendar }) }) : /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
1108
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: trigger }),
|
|
1109
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "end", children: calendar })
|
|
1110
|
+
] }) })
|
|
1111
|
+
] });
|
|
1112
|
+
}
|
|
1113
|
+
function LockedReason({ children, className }) {
|
|
1114
|
+
return /* @__PURE__ */ jsxs("p", { "data-slot": "locked-reason", className: cn("text-muted-foreground flex items-start gap-1 text-xs", className), children: [
|
|
1115
|
+
/* @__PURE__ */ jsx(LockIcon, { "aria-hidden": true, className: "mt-px size-3 shrink-0" }),
|
|
1116
|
+
/* @__PURE__ */ jsx("span", { children })
|
|
1117
|
+
] });
|
|
1118
|
+
}
|
|
1119
|
+
function UnsavedBadge({ children, className }) {
|
|
1120
|
+
return /* @__PURE__ */ jsxs(
|
|
1121
|
+
"span",
|
|
1122
|
+
{
|
|
1123
|
+
"data-slot": "unsaved-badge",
|
|
1124
|
+
role: "status",
|
|
1125
|
+
className: cn("inline-flex items-center gap-1.5 text-xs font-medium text-amber-700 dark:text-amber-400", className),
|
|
1126
|
+
children: [
|
|
1127
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-current" }),
|
|
1128
|
+
children
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
708
1133
|
var FALLBACK = {
|
|
709
1134
|
placeholder: "Select\u2026",
|
|
710
1135
|
search: "Search",
|
|
@@ -721,7 +1146,7 @@ function OptionPicker({
|
|
|
721
1146
|
}) {
|
|
722
1147
|
const t = (k) => labels?.[k] ?? FALLBACK[k];
|
|
723
1148
|
const placeholder = labels?.placeholder ?? FALLBACK.placeholder;
|
|
724
|
-
const entries =
|
|
1149
|
+
const entries = React6.useMemo(() => {
|
|
725
1150
|
const out = [{ id: "", label: placeholder, none: true }, ...options];
|
|
726
1151
|
if (value !== "" && !options.some((o) => o.id === value)) {
|
|
727
1152
|
out.push({ id: value, label: value });
|
|
@@ -773,18 +1198,6 @@ function AuthCard({ title, description, logo, brand, footer, children, className
|
|
|
773
1198
|
footer
|
|
774
1199
|
] }) });
|
|
775
1200
|
}
|
|
776
|
-
function MobileSheet({ title, description, trigger, open, onOpenChange, className, children }) {
|
|
777
|
-
return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange, children: [
|
|
778
|
-
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
|
|
779
|
-
/* @__PURE__ */ jsxs(DrawerContent, { children: [
|
|
780
|
-
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
781
|
-
/* @__PURE__ */ jsx(DrawerTitle, { className: "text-base", children: title }),
|
|
782
|
-
description && /* @__PURE__ */ jsx(DrawerDescription, { className: "text-sm", children: description })
|
|
783
|
-
] }),
|
|
784
|
-
/* @__PURE__ */ jsx("div", { className: cn("min-h-0 overflow-y-auto px-4 pb-[calc(1.5rem+env(safe-area-inset-bottom))] text-sm", className), children })
|
|
785
|
-
] })
|
|
786
|
-
] });
|
|
787
|
-
}
|
|
788
1201
|
function ChoiceDrawer({ options, value, onValueChange, ...sheet }) {
|
|
789
1202
|
return /* @__PURE__ */ jsx(MobileSheet, { ...sheet, children: /* @__PURE__ */ jsx(RadioGroup, { value: value ?? "", onValueChange: (v) => onValueChange(v), className: "-mx-4 gap-0 divide-y divide-border", children: options.map((option) => /* @__PURE__ */ jsxs("label", { className: "flex min-h-12 cursor-pointer items-center justify-between gap-4 px-4 py-3 active:bg-muted", children: [
|
|
790
1203
|
/* @__PURE__ */ jsx("span", { children: option.label }),
|
|
@@ -836,21 +1249,21 @@ function McpSettings({
|
|
|
836
1249
|
className
|
|
837
1250
|
}) {
|
|
838
1251
|
const t = { ...FALLBACK2, ...labels };
|
|
839
|
-
const id =
|
|
840
|
-
const [status, setStatus] =
|
|
841
|
-
const [loadError, setLoadError] =
|
|
842
|
-
const [error, setError] =
|
|
843
|
-
const [busy, setBusy] =
|
|
844
|
-
const [copied, setCopied] =
|
|
845
|
-
const [calls, setCalls] =
|
|
846
|
-
const changes =
|
|
847
|
-
const callKey =
|
|
848
|
-
const load =
|
|
1252
|
+
const id = React6.useId();
|
|
1253
|
+
const [status, setStatus] = React6.useState(null);
|
|
1254
|
+
const [loadError, setLoadError] = React6.useState(null);
|
|
1255
|
+
const [error, setError] = React6.useState(null);
|
|
1256
|
+
const [busy, setBusy] = React6.useState(false);
|
|
1257
|
+
const [copied, setCopied] = React6.useState(false);
|
|
1258
|
+
const [calls, setCalls] = React6.useState([]);
|
|
1259
|
+
const changes = React6.useRef(0);
|
|
1260
|
+
const callKey = React6.useRef(0);
|
|
1261
|
+
const load = React6.useCallback(() => {
|
|
849
1262
|
setLoadError(null);
|
|
850
1263
|
api.status().then(setStatus, (err) => setLoadError(messageOf(err)));
|
|
851
1264
|
}, [api]);
|
|
852
|
-
|
|
853
|
-
|
|
1265
|
+
React6.useEffect(load, [load]);
|
|
1266
|
+
React6.useEffect(() => {
|
|
854
1267
|
if (!api.onCall) return;
|
|
855
1268
|
return api.onCall((call) => {
|
|
856
1269
|
setCalls((prev) => [{ ...call, key: ++callKey.current, at: /* @__PURE__ */ new Date() }, ...prev].slice(0, RECENT_CALLS));
|
|
@@ -865,7 +1278,7 @@ function McpSettings({
|
|
|
865
1278
|
);
|
|
866
1279
|
});
|
|
867
1280
|
}, [api]);
|
|
868
|
-
|
|
1281
|
+
React6.useEffect(() => {
|
|
869
1282
|
if (!copied) return;
|
|
870
1283
|
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
871
1284
|
return () => clearTimeout(timer);
|
|
@@ -1128,26 +1541,26 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
1128
1541
|
const size = (bytes) => f.size?.(bytes) ?? sizeOf(bytes);
|
|
1129
1542
|
const nameOf = (pid) => api.providerName?.(pid) ?? pid;
|
|
1130
1543
|
const slotLabel = (s) => f.slotLabel?.(s) ?? s.label;
|
|
1131
|
-
const id =
|
|
1132
|
-
const [state, setState] =
|
|
1133
|
-
const [drivers, setDrivers] =
|
|
1134
|
-
const [driversError, setDriversError] =
|
|
1135
|
-
const [found, setFound] =
|
|
1136
|
-
const [loadError, setLoadError] =
|
|
1137
|
-
const [error, setError] =
|
|
1138
|
-
const [busy, setBusy] =
|
|
1139
|
-
const [draft, setDraft] =
|
|
1140
|
-
const [draftError, setDraftError] =
|
|
1141
|
-
const [removing, setRemoving] =
|
|
1142
|
-
const [models, setModels] =
|
|
1143
|
-
const [typed, setTyped] =
|
|
1144
|
-
const [pulls, setPulls] =
|
|
1145
|
-
const [library, setLibrary] =
|
|
1146
|
-
const [pullName, setPullName] =
|
|
1544
|
+
const id = React6.useId();
|
|
1545
|
+
const [state, setState] = React6.useState(null);
|
|
1546
|
+
const [drivers, setDrivers] = React6.useState([]);
|
|
1547
|
+
const [driversError, setDriversError] = React6.useState(null);
|
|
1548
|
+
const [found, setFound] = React6.useState([]);
|
|
1549
|
+
const [loadError, setLoadError] = React6.useState(null);
|
|
1550
|
+
const [error, setError] = React6.useState(null);
|
|
1551
|
+
const [busy, setBusy] = React6.useState(false);
|
|
1552
|
+
const [draft, setDraft] = React6.useState(null);
|
|
1553
|
+
const [draftError, setDraftError] = React6.useState(null);
|
|
1554
|
+
const [removing, setRemoving] = React6.useState(null);
|
|
1555
|
+
const [models, setModels] = React6.useState({});
|
|
1556
|
+
const [typed, setTyped] = React6.useState({});
|
|
1557
|
+
const [pulls, setPulls] = React6.useState({});
|
|
1558
|
+
const [library, setLibrary] = React6.useState(null);
|
|
1559
|
+
const [pullName, setPullName] = React6.useState("");
|
|
1147
1560
|
const failed = (err) => {
|
|
1148
1561
|
if (!api.isCanceled?.(err)) setError(messageOf2(err));
|
|
1149
1562
|
};
|
|
1150
|
-
const load =
|
|
1563
|
+
const load = React6.useCallback(() => {
|
|
1151
1564
|
setLoadError(null);
|
|
1152
1565
|
setDriversError(null);
|
|
1153
1566
|
api.state().then(setState, (err) => setLoadError(messageOf2(err)));
|
|
@@ -1155,8 +1568,8 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
1155
1568
|
api.detect?.().then(setFound, () => {
|
|
1156
1569
|
});
|
|
1157
1570
|
}, [api]);
|
|
1158
|
-
|
|
1159
|
-
|
|
1571
|
+
React6.useEffect(load, [load]);
|
|
1572
|
+
React6.useEffect(() => {
|
|
1160
1573
|
if (!api.onPull) return;
|
|
1161
1574
|
return api.onPull(
|
|
1162
1575
|
(p) => setPulls((prev) => {
|
|
@@ -1166,7 +1579,7 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
1166
1579
|
})
|
|
1167
1580
|
);
|
|
1168
1581
|
}, [api]);
|
|
1169
|
-
const listModels =
|
|
1582
|
+
const listModels = React6.useCallback(
|
|
1170
1583
|
(provider2) => {
|
|
1171
1584
|
api.models(provider2).then(
|
|
1172
1585
|
(ms) => setModels((prev) => ({ ...prev, [provider2]: ms })),
|
|
@@ -1176,8 +1589,8 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
1176
1589
|
},
|
|
1177
1590
|
[api]
|
|
1178
1591
|
);
|
|
1179
|
-
const bound =
|
|
1180
|
-
|
|
1592
|
+
const bound = React6.useMemo(() => new Set((state?.slots ?? []).map((s) => s.provider).filter(Boolean)), [state]);
|
|
1593
|
+
React6.useEffect(() => {
|
|
1181
1594
|
for (const p of bound) if (!(p in models)) listModels(p);
|
|
1182
1595
|
}, [bound, models, listModels]);
|
|
1183
1596
|
const change = async (action) => {
|
|
@@ -1670,6 +2083,6 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
1670
2083
|
);
|
|
1671
2084
|
}
|
|
1672
2085
|
|
|
1673
|
-
export { AuthCard, AvatarTile, ChoiceDrawer, ConfirmContext, ConfirmDialog, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, McpSettings, MobileSheet, OptionPicker, Panel, PanelCard, TreeDndProvider, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, filterTree, flattenTree, moveId, planDrop, sameOrder, sortTree, useConfirm, useFormField, useTreeDndNode, useTreeDndRoot };
|
|
2086
|
+
export { AuthCard, AvatarTile, BarList, BlockedContext, BlockedDialog, ChoiceDrawer, ColorSwatches, ConfirmContext, ConfirmDialog, ConfirmProvider, ConfirmReasonContext, DateField, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, LockedReason, McpSettings, MobileSheet, OptionPicker, Panel, PanelCard, StatTile, TagInput, TreeDndProvider, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, UnsavedBadge, datePattern, filterTree, flattenTree, formatDate, loadExpanded, moveId, parseDate, planDrop, sameOrder, saveExpanded, sortTree, useBlocked, useConfirm, useConfirmReason, useFormField, useTreeDndNode, useTreeDndRoot };
|
|
1674
2087
|
//# sourceMappingURL=index.js.map
|
|
1675
2088
|
//# sourceMappingURL=index.js.map
|