@tradalab/lyra 3.4.0 → 3.6.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/dist/blocks/index.d.ts +22 -71
- package/dist/blocks/index.js +18 -179
- package/dist/blocks/index.js.map +1 -1
- package/dist/chunk-7MZ73OVI.js +3776 -0
- package/dist/chunk-7MZ73OVI.js.map +1 -0
- package/dist/chunk-AIULLZYM.js +21 -0
- package/dist/chunk-AIULLZYM.js.map +1 -0
- package/dist/{chunk-FHM6VOPQ.js → chunk-AM6UJ666.js} +105 -3
- package/dist/chunk-AM6UJ666.js.map +1 -0
- package/dist/chunk-D7DMRCDY.js +115 -0
- package/dist/chunk-D7DMRCDY.js.map +1 -0
- package/dist/{chunk-VDO6PQ5L.js → chunk-L4LQCVOF.js} +144 -8
- package/dist/chunk-L4LQCVOF.js.map +1 -0
- package/dist/{chunk-BTZYRWFX.js → chunk-RNKXFELK.js} +223 -17
- package/dist/chunk-RNKXFELK.js.map +1 -0
- package/dist/{chunk-2HDU26FC.js → chunk-VXW3K5O5.js} +99 -3
- package/dist/chunk-VXW3K5O5.js.map +1 -0
- package/dist/data-table/index.js +1 -2
- package/dist/data-table/index.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +2 -1
- package/dist/people/index.js +2 -4
- package/dist/people/index.js.map +1 -1
- package/dist/plate-BJ19iaVV.d.ts +38 -0
- package/dist/plate-picker-CXxUGyNz.d.ts +20 -0
- package/dist/preference-script-Dm-LEoYX.d.ts +5 -0
- package/dist/shell/index.d.ts +19 -5
- package/dist/shell/index.js +39 -13
- package/dist/shell/index.js.map +1 -1
- package/dist/ui/index.d.ts +5 -2
- package/dist/ui/index.js +7 -3176
- package/dist/ui/index.js.map +1 -1
- package/dist/use-compact-BvI4sJf9.d.ts +15 -0
- package/package.json +1 -1
- package/dist/chunk-2HDU26FC.js.map +0 -1
- package/dist/chunk-BTZYRWFX.js.map +0 -1
- package/dist/chunk-CV3UXQBT.js +0 -110
- package/dist/chunk-CV3UXQBT.js.map +0 -1
- package/dist/chunk-EJP7F42V.js +0 -679
- package/dist/chunk-EJP7F42V.js.map +0 -1
- package/dist/chunk-F2ET7EL2.js +0 -104
- package/dist/chunk-F2ET7EL2.js.map +0 -1
- package/dist/chunk-FHM6VOPQ.js.map +0 -1
- package/dist/chunk-QYA2HGKW.js +0 -20
- package/dist/chunk-QYA2HGKW.js.map +0 -1
- package/dist/chunk-VDO6PQ5L.js.map +0 -1
- package/dist/chunk-XJJQAQWJ.js +0 -119
- package/dist/chunk-XJJQAQWJ.js.map +0 -1
- package/dist/chunk-XWGYXLIA.js +0 -147
- package/dist/chunk-XWGYXLIA.js.map +0 -1
- package/dist/{breadcrumb-CgEcSonR.d.ts → account-menu-D9M_kEzN.d.ts} +12 -12
package/dist/blocks/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import * as React from 'react';
|
|
|
4
4
|
import { ReactNode, HTMLAttributes } from 'react';
|
|
5
5
|
import { Slot, Label } from 'radix-ui';
|
|
6
6
|
import { LucideIcon } from 'lucide-react';
|
|
7
|
+
export { B as BEARING_PLATES, a as BearingPlate, P as PLATES, b as Plate, d as derivePlate, i as isPlate } from '../plate-BJ19iaVV.js';
|
|
8
|
+
export { u as useCompact, a as usePlate } from '../use-compact-BvI4sJf9.js';
|
|
9
|
+
export { P as PlatePicker, a as PlatePickerProps } from '../plate-picker-CXxUGyNz.js';
|
|
10
|
+
export { P as PreferenceScript } from '../preference-script-Dm-LEoYX.js';
|
|
7
11
|
|
|
8
12
|
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, handleSubmit, unregister, control, register, setFocus, subscribe, }: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
9
13
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
@@ -33,10 +37,17 @@ type PanelItemType = {
|
|
|
33
37
|
hasError?: boolean;
|
|
34
38
|
content: ReactNode;
|
|
35
39
|
};
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
/**
|
|
41
|
+
* No URL binding, on purpose.
|
|
42
|
+
*
|
|
43
|
+
* An `enable_url` prop used to mirror the open item into a query param, and that made this file
|
|
44
|
+
* import `next/navigation` at module scope. Since the `blocks` barrel re-exports everything, one
|
|
45
|
+
* import here made the WHOLE barrel require Next, so anything that is not itself a Next app could
|
|
46
|
+
* not import any block at all - which is how nekit broke. The prop had no caller in any of the 26
|
|
47
|
+
* consumers, and `name` existed only to build its query key, so both came out with the router.
|
|
48
|
+
*/
|
|
49
|
+
declare function Panel({ items }: {
|
|
38
50
|
items: PanelItemType[];
|
|
39
|
-
enable_url?: boolean;
|
|
40
51
|
}): React.JSX.Element | null;
|
|
41
52
|
interface PanelItemProps {
|
|
42
53
|
children: ReactNode;
|
|
@@ -373,6 +384,13 @@ interface LlmSettingsApi {
|
|
|
373
384
|
onPull?(cb: (p: LlmPullProgress) => void): () => void;
|
|
374
385
|
/** Runtimes already running on this machine, offered as providers to add. */
|
|
375
386
|
detect?(): Promise<LlmFound[]>;
|
|
387
|
+
/**
|
|
388
|
+
* An extra line under one slot, for a fact only the app knows - loom warns that N chunks were
|
|
389
|
+
* indexed by a different embedding model than the one now bound. Without a hook for it, adopting
|
|
390
|
+
* this block means silently dropping such a warning, which is what kept loom on its own 687-line
|
|
391
|
+
* copy of this screen.
|
|
392
|
+
*/
|
|
393
|
+
slotNote?(slot: string): React.ReactNode;
|
|
376
394
|
}
|
|
377
395
|
interface LlmSettingsLabels {
|
|
378
396
|
slots?: string;
|
|
@@ -414,71 +432,4 @@ declare function LlmSettings({ api, labels, className, }: {
|
|
|
414
432
|
className?: string;
|
|
415
433
|
}): React.JSX.Element;
|
|
416
434
|
|
|
417
|
-
|
|
418
|
-
* Plates: the palette a reader picks, applied by putting `data-plate` on any element.
|
|
419
|
-
*
|
|
420
|
-
* This module holds NAMES and nothing else. The colours live once, in `styles/globals.css`, and a
|
|
421
|
-
* swatch reads them the same way the rest of the UI does - by sitting inside a `data-plate` scope
|
|
422
|
-
* and using `bg-primary`. Copying the values here would be the second table that drifts.
|
|
423
|
-
*
|
|
424
|
-
* Absent `data-plate`, `--primary` is lyra's neutral. That is the default every app ships with, so
|
|
425
|
-
* adopting plates costs an app nothing until a reader chooses.
|
|
426
|
-
*/
|
|
427
|
-
declare const PLATES: readonly ["pink", "rose", "crimson", "rust", "orange", "ochre", "amber", "honey", "gold", "olive", "lime", "green", "teal", "cyan", "azure", "blue", "indigo", "violet", "magenta"];
|
|
428
|
-
type Plate = (typeof PLATES)[number];
|
|
429
|
-
/**
|
|
430
|
-
* The plates certified to be told apart from each other, not merely from the status tokens.
|
|
431
|
-
*
|
|
432
|
-
* Only these may carry MEANING. The distinction is not decorative: a plate a reader picks for
|
|
433
|
-
* pleasure needs no relation to anyone else's, but a plate that says "which space you are typing
|
|
434
|
-
* into" stops working the moment two of them look alike - so that use gets the subset measured at
|
|
435
|
-
* dE76 >= 29.7 pairwise, in both themes.
|
|
436
|
-
*/
|
|
437
|
-
declare const BEARING_PLATES: readonly ["pink", "rust", "amber", "olive", "green", "teal", "azure", "blue", "violet"];
|
|
438
|
-
type BearingPlate = (typeof BEARING_PLATES)[number];
|
|
439
|
-
declare function isPlate(s: string): s is Plate;
|
|
440
|
-
/**
|
|
441
|
-
* The plate for an id, from the certified subset.
|
|
442
|
-
*
|
|
443
|
-
* Derived, never chosen, and that is the point when the colour is a fence rather than a preference:
|
|
444
|
-
* if two organisations could both pick blue the signal stops working for both of them. Deriving on
|
|
445
|
-
* the CLIENT is deliberate too - the alternative is every server that shows a coloured surface
|
|
446
|
-
* keeping its own copy of the name list, which is the shape chat ended up in (a Go slice, a CSS
|
|
447
|
-
* block and a TS union, with nothing holding them together).
|
|
448
|
-
*
|
|
449
|
-
* FNV-1a rather than a cryptographic hash: this picks a colour, so spreading matters and secrecy
|
|
450
|
-
* does not, and it stays synchronous - SubtleCrypto would make every call site async for nothing.
|
|
451
|
-
*/
|
|
452
|
-
declare function derivePlate(id: string): BearingPlate;
|
|
453
|
-
|
|
454
|
-
interface PlatePickerProps {
|
|
455
|
-
value: Plate | null;
|
|
456
|
-
onChange: (plate: Plate | null) => void;
|
|
457
|
-
/** Accessible name for the group, e.g. "Accent colour". */
|
|
458
|
-
label: string;
|
|
459
|
-
/** Accessible name for the neutral option, e.g. "Default". */
|
|
460
|
-
resetLabel: string;
|
|
461
|
-
/**
|
|
462
|
-
* Translated name per plate. Falls back to the plate's own key, which is English - fine for a
|
|
463
|
-
* developer tool, wrong for a product, and the reason this is a prop rather than a table in here.
|
|
464
|
-
*/
|
|
465
|
-
plateLabels?: Partial<Record<Plate, string>>;
|
|
466
|
-
className?: string;
|
|
467
|
-
}
|
|
468
|
-
declare function PlatePicker({ value, onChange, label, resetLabel, plateLabels, className }: PlatePickerProps): React.JSX.Element;
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* The plate this device is set to, and a way to change it.
|
|
472
|
-
*
|
|
473
|
-
* A stored name that is no longer a plate - a rename, a downgrade to an older lyra - reads as no
|
|
474
|
-
* plate. The alternative is an attribute no rule matches, which looks identical to the neutral
|
|
475
|
-
* default on screen while the picker shows nothing selected at all, so the reader cannot tell that
|
|
476
|
-
* their choice was dropped or get back to a known state.
|
|
477
|
-
*/
|
|
478
|
-
declare function usePlate(): [Plate | null, (plate: Plate | null) => void];
|
|
479
|
-
|
|
480
|
-
declare function useCompact(): [boolean, (compact: boolean) => void];
|
|
481
|
-
|
|
482
|
-
declare function PreferenceScript(): React.JSX.Element;
|
|
483
|
-
|
|
484
|
-
export { BEARING_PLATES, type BearingPlate, ConfirmContext, ConfirmDialog, type ConfirmFn, type ConfirmOptions, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type LlmCapability, type LlmDriver, type LlmField, type LlmFound, type LlmModel, type LlmProvider, type LlmProviderInput, type LlmPullProgress, LlmSettings, type LlmSettingsApi, type LlmSettingsLabels, type LlmSlot, type LlmState, type McpCall, type McpClient, McpSettings, type McpSettingsApi, type McpSettingsLabels, type McpStatus, type McpTool, OptionPicker, type OptionPickerLabels, PLATES, Panel, PanelCard, type PanelCardProps, type PanelItemProps, type PickOption, type Plate, PlatePicker, type PlatePickerProps, PreferenceScript, TreeExpander, type TreeExpanderProps, TreeIcon, type TreeIconProps, TreeLabel, type TreeLabelProps, TreeLines, TreeNode, TreeNodeContent, type TreeNodeContentProps, type TreeNodeProps, TreeNodeTrigger, type TreeNodeTriggerProps, TreeProvider, type TreeProviderProps, TreeView, type TreeViewProps, TzPicker, type TzPickerLabels, type TzPickerProps, derivePlate, isPlate, useCompact, useConfirm, useFormField, usePlate };
|
|
435
|
+
export { ConfirmContext, ConfirmDialog, type ConfirmFn, type ConfirmOptions, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type LlmCapability, type LlmDriver, type LlmField, type LlmFound, type LlmModel, type LlmProvider, type LlmProviderInput, type LlmPullProgress, LlmSettings, type LlmSettingsApi, type LlmSettingsLabels, type LlmSlot, type LlmState, type McpCall, type McpClient, McpSettings, type McpSettingsApi, type McpSettingsLabels, type McpStatus, type McpTool, OptionPicker, type OptionPickerLabels, Panel, PanelCard, type PanelCardProps, type PanelItemProps, type PickOption, TreeExpander, type TreeExpanderProps, TreeIcon, type TreeIconProps, TreeLabel, type TreeLabelProps, TreeLines, TreeNode, TreeNodeContent, type TreeNodeContentProps, type TreeNodeProps, TreeNodeTrigger, type TreeNodeTriggerProps, TreeProvider, type TreeProviderProps, TreeView, type TreeViewProps, TzPicker, type TzPickerLabels, type TzPickerProps, useConfirm, useFormField };
|
package/dist/blocks/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Label, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, Badge,
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import '../chunk-
|
|
2
|
+
import { Label, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, Badge, FieldSeparator, Progress } from '../chunk-7MZ73OVI.js';
|
|
3
|
+
export { PreferenceScript } from '../chunk-7MZ73OVI.js';
|
|
4
|
+
import { NativeSelect, NativeSelectOption } from '../chunk-AM6UJ666.js';
|
|
5
|
+
export { useCompact, usePlate } from '../chunk-AIULLZYM.js';
|
|
6
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Switch } from '../chunk-RNKXFELK.js';
|
|
7
|
+
export { PlatePicker } from '../chunk-RNKXFELK.js';
|
|
8
|
+
export { BEARING_PLATES, PLATES, derivePlate, isPlate } from '../chunk-D7DMRCDY.js';
|
|
9
|
+
import '../chunk-VEWKPOMS.js';
|
|
10
|
+
import { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription } from '../chunk-L4LQCVOF.js';
|
|
11
|
+
import '../chunk-VXW3K5O5.js';
|
|
7
12
|
import { Button, Input } from '../chunk-VGOGWZCF.js';
|
|
8
13
|
import { cn } from '../chunk-XH55BHUU.js';
|
|
9
14
|
import * as React5 from 'react';
|
|
10
|
-
import { createContext,
|
|
11
|
-
import { Slot
|
|
15
|
+
import { createContext, useState, useContext, useCallback, useId } from 'react';
|
|
16
|
+
import { Slot } from 'radix-ui';
|
|
12
17
|
import { FormProvider, Controller, useFormContext } from 'react-hook-form';
|
|
13
18
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import { useRouter, useSearchParams } from 'next/navigation';
|
|
15
19
|
import { ChevronRight, CheckIcon, CopyIcon, PlusIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
16
20
|
|
|
17
21
|
var Form = FormProvider;
|
|
@@ -73,33 +77,15 @@ function FormMessage({ className, ...props }) {
|
|
|
73
77
|
}
|
|
74
78
|
return /* @__PURE__ */ jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-destructive text-sm", className), ...props, children: body });
|
|
75
79
|
}
|
|
76
|
-
function Panel({
|
|
77
|
-
const
|
|
78
|
-
const params = useSearchParams();
|
|
79
|
-
const defaultKey = items[0]?.key;
|
|
80
|
-
const panelKey = useMemo(() => `panel${name ? "-" + name : ""}`, [name]);
|
|
81
|
-
const panelFromUrl = useMemo(() => {
|
|
82
|
-
if (!enable_url) return defaultKey;
|
|
83
|
-
return params.get(panelKey) ?? defaultKey;
|
|
84
|
-
}, [enable_url, params, defaultKey, panelKey]);
|
|
85
|
-
const [active, setActive] = useState(panelFromUrl);
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (!enable_url) return;
|
|
88
|
-
setActive(panelFromUrl);
|
|
89
|
-
}, [panelFromUrl, enable_url]);
|
|
80
|
+
function Panel({ items }) {
|
|
81
|
+
const [active, setActive] = useState(items[0]?.key);
|
|
90
82
|
const current = items.find((s) => s.key === active) ?? items[0];
|
|
91
83
|
if (!current) return null;
|
|
92
|
-
const navigate = (key) => {
|
|
93
|
-
if (key === active) return;
|
|
94
|
-
setActive(key);
|
|
95
|
-
if (!enable_url) return;
|
|
96
|
-
router.replace(`?${panelKey}=${key}`, { scroll: false });
|
|
97
|
-
};
|
|
98
84
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6 h-full min-h-0 flex flex-col", children: [
|
|
99
85
|
/* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-lg bg-muted p-1", children: items?.map((s) => /* @__PURE__ */ jsx(
|
|
100
86
|
"button",
|
|
101
87
|
{
|
|
102
|
-
onClick: () =>
|
|
88
|
+
onClick: () => setActive(s.key),
|
|
103
89
|
className: cn(
|
|
104
90
|
"rounded-md px-3 py-1.5 text-sm transition-all",
|
|
105
91
|
active === s.key ? "bg-background text-foreground shadow-sm" : s.danger ? "text-destructive" : "text-muted-foreground hover:text-foreground"
|
|
@@ -113,7 +99,7 @@ function Panel({ name, items, enable_url }) {
|
|
|
113
99
|
s.key
|
|
114
100
|
)) }) }),
|
|
115
101
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-8 lg:grid-cols-[240px_1fr] flex-1 min-h-0", children: [
|
|
116
|
-
/* @__PURE__ */ jsx("aside", { className: "hidden space-y-1 lg:block overflow-y-auto min-h-0 pr-1 [overflow:overlay]", children: items?.map((s) => /* @__PURE__ */ jsx(PanelItem, { active: active === s.key, icon: s.icon, danger: s.danger, hasError: s.hasError, onClick: () =>
|
|
102
|
+
/* @__PURE__ */ jsx("aside", { className: "hidden space-y-1 lg:block overflow-y-auto min-h-0 pr-1 [overflow:overlay]", children: items?.map((s) => /* @__PURE__ */ jsx(PanelItem, { active: active === s.key, icon: s.icon, danger: s.danger, hasError: s.hasError, onClick: () => setActive(s.key), children: s.label }, s.key)) }),
|
|
117
103
|
/* @__PURE__ */ jsx("div", { className: "space-y-6 overflow-y-auto min-h-0 pr-1 [overflow:overlay]", children: current.content })
|
|
118
104
|
] })
|
|
119
105
|
] });
|
|
@@ -1163,6 +1149,7 @@ function LlmSettings({
|
|
|
1163
1149
|
] })
|
|
1164
1150
|
] }),
|
|
1165
1151
|
slot.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: slot.error }) : null,
|
|
1152
|
+
api.slotNote?.(slot.name),
|
|
1166
1153
|
current?.manages && api.pull && missing && !pulling ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-3", children: [
|
|
1167
1154
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: t.notDownloaded }),
|
|
1168
1155
|
/* @__PURE__ */ jsxs(
|
|
@@ -1302,154 +1289,6 @@ function LlmSettings({
|
|
|
1302
1289
|
);
|
|
1303
1290
|
}
|
|
1304
1291
|
|
|
1305
|
-
|
|
1306
|
-
var PLATES = [
|
|
1307
|
-
"pink",
|
|
1308
|
-
"rose",
|
|
1309
|
-
"crimson",
|
|
1310
|
-
"rust",
|
|
1311
|
-
"orange",
|
|
1312
|
-
"ochre",
|
|
1313
|
-
"amber",
|
|
1314
|
-
"honey",
|
|
1315
|
-
"gold",
|
|
1316
|
-
"olive",
|
|
1317
|
-
"lime",
|
|
1318
|
-
"green",
|
|
1319
|
-
"teal",
|
|
1320
|
-
"cyan",
|
|
1321
|
-
"azure",
|
|
1322
|
-
"blue",
|
|
1323
|
-
"indigo",
|
|
1324
|
-
"violet",
|
|
1325
|
-
"magenta"
|
|
1326
|
-
];
|
|
1327
|
-
var BEARING_PLATES = [
|
|
1328
|
-
"pink",
|
|
1329
|
-
"rust",
|
|
1330
|
-
"amber",
|
|
1331
|
-
"olive",
|
|
1332
|
-
"green",
|
|
1333
|
-
"teal",
|
|
1334
|
-
"azure",
|
|
1335
|
-
"blue",
|
|
1336
|
-
"violet"
|
|
1337
|
-
];
|
|
1338
|
-
function isPlate(s) {
|
|
1339
|
-
return PLATES.includes(s);
|
|
1340
|
-
}
|
|
1341
|
-
function derivePlate(id) {
|
|
1342
|
-
let h = 2166136261;
|
|
1343
|
-
for (let i = 0; i < id.length; i++) {
|
|
1344
|
-
h ^= id.charCodeAt(i);
|
|
1345
|
-
h = Math.imul(h, 16777619) >>> 0;
|
|
1346
|
-
}
|
|
1347
|
-
return BEARING_PLATES[h % BEARING_PLATES.length];
|
|
1348
|
-
}
|
|
1349
|
-
var NONE = "none";
|
|
1350
|
-
function PlatePicker({ value, onChange, label, resetLabel, plateLabels, className }) {
|
|
1351
|
-
const swatch = "size-7 shrink-0 rounded-none border outline-2 -outline-offset-[3px] outline-transparent focus-visible:ring-2 focus-visible:ring-ring";
|
|
1352
|
-
return /* @__PURE__ */ jsxs(
|
|
1353
|
-
RadioGroup,
|
|
1354
|
-
{
|
|
1355
|
-
"aria-label": label,
|
|
1356
|
-
value: value ?? NONE,
|
|
1357
|
-
onValueChange: (v) => onChange(isPlate(v) ? v : null),
|
|
1358
|
-
className: cn("flex w-auto flex-wrap gap-2", className),
|
|
1359
|
-
children: [
|
|
1360
|
-
/* @__PURE__ */ jsx(
|
|
1361
|
-
RadioGroup$1.Item,
|
|
1362
|
-
{
|
|
1363
|
-
value: NONE,
|
|
1364
|
-
"aria-label": resetLabel,
|
|
1365
|
-
title: resetLabel,
|
|
1366
|
-
className: cn(swatch, "bg-muted border-border data-checked:outline-foreground")
|
|
1367
|
-
}
|
|
1368
|
-
),
|
|
1369
|
-
PLATES.map((p) => /* @__PURE__ */ jsx(
|
|
1370
|
-
RadioGroup$1.Item,
|
|
1371
|
-
{
|
|
1372
|
-
value: p,
|
|
1373
|
-
"aria-label": plateLabels?.[p] ?? p,
|
|
1374
|
-
title: plateLabels?.[p] ?? p,
|
|
1375
|
-
"data-plate": p,
|
|
1376
|
-
className: cn(swatch, "bg-primary border-transparent data-checked:outline-primary-foreground")
|
|
1377
|
-
},
|
|
1378
|
-
p
|
|
1379
|
-
))
|
|
1380
|
-
]
|
|
1381
|
-
}
|
|
1382
|
-
);
|
|
1383
|
-
}
|
|
1384
|
-
var PLATE_KEY = "lyra.plate";
|
|
1385
|
-
var COMPACT_KEY = "lyra.compact";
|
|
1386
|
-
var listeners = /* @__PURE__ */ new Map();
|
|
1387
|
-
function read(key) {
|
|
1388
|
-
try {
|
|
1389
|
-
return localStorage.getItem(key);
|
|
1390
|
-
} catch {
|
|
1391
|
-
return null;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
function useStoredSetting(key) {
|
|
1395
|
-
const subscribe = useCallback(
|
|
1396
|
-
(onChange) => {
|
|
1397
|
-
const set = listeners.get(key) ?? /* @__PURE__ */ new Set();
|
|
1398
|
-
listeners.set(key, set);
|
|
1399
|
-
set.add(onChange);
|
|
1400
|
-
const onStorage = (e) => {
|
|
1401
|
-
if (e.key === key) onChange();
|
|
1402
|
-
};
|
|
1403
|
-
window.addEventListener("storage", onStorage);
|
|
1404
|
-
return () => {
|
|
1405
|
-
set.delete(onChange);
|
|
1406
|
-
window.removeEventListener("storage", onStorage);
|
|
1407
|
-
};
|
|
1408
|
-
},
|
|
1409
|
-
[key]
|
|
1410
|
-
);
|
|
1411
|
-
const value = useSyncExternalStore(
|
|
1412
|
-
subscribe,
|
|
1413
|
-
() => read(key),
|
|
1414
|
-
() => null
|
|
1415
|
-
);
|
|
1416
|
-
const store = useCallback((next) => {
|
|
1417
|
-
try {
|
|
1418
|
-
if (next === null) localStorage.removeItem(key);
|
|
1419
|
-
else localStorage.setItem(key, next);
|
|
1420
|
-
} catch {
|
|
1421
|
-
}
|
|
1422
|
-
listeners.get(key)?.forEach((l) => l());
|
|
1423
|
-
}, [key]);
|
|
1424
|
-
return [value, store];
|
|
1425
|
-
}
|
|
1426
|
-
function useRootAttribute(name, value) {
|
|
1427
|
-
useEffect(() => {
|
|
1428
|
-
const root = document.documentElement;
|
|
1429
|
-
if (value === null) root.removeAttribute(name);
|
|
1430
|
-
else root.setAttribute(name, value);
|
|
1431
|
-
}, [name, value]);
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
// src/blocks/use-plate.ts
|
|
1435
|
-
function usePlate() {
|
|
1436
|
-
const [stored, store] = useStoredSetting(PLATE_KEY);
|
|
1437
|
-
const plate = stored !== null && isPlate(stored) ? stored : null;
|
|
1438
|
-
useRootAttribute("data-plate", plate);
|
|
1439
|
-
return [plate, store];
|
|
1440
|
-
}
|
|
1441
|
-
function useCompact() {
|
|
1442
|
-
const [stored, store] = useStoredSetting(COMPACT_KEY);
|
|
1443
|
-
const compact = stored === "true";
|
|
1444
|
-
const setCompact = useCallback((next) => store(next ? "true" : null), [store]);
|
|
1445
|
-
useRootAttribute("data-compact", compact ? "true" : null);
|
|
1446
|
-
return [compact, setCompact];
|
|
1447
|
-
}
|
|
1448
|
-
var SCRIPT = `try{var d=document.documentElement,p=localStorage.getItem("${PLATE_KEY}");if(p)d.setAttribute("data-plate",p);if(localStorage.getItem("${COMPACT_KEY}")==="true")d.setAttribute("data-compact","true")}catch(e){}`;
|
|
1449
|
-
function PreferenceScript() {
|
|
1450
|
-
return /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: SCRIPT } });
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
export { BEARING_PLATES, ConfirmContext, ConfirmDialog, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, McpSettings, OptionPicker, PLATES, Panel, PanelCard, PlatePicker, PreferenceScript, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, derivePlate, isPlate, useCompact, useConfirm, useFormField, usePlate };
|
|
1292
|
+
export { ConfirmContext, ConfirmDialog, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, McpSettings, OptionPicker, Panel, PanelCard, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, useConfirm, useFormField };
|
|
1454
1293
|
//# sourceMappingURL=index.js.map
|
|
1455
1294
|
//# sourceMappingURL=index.js.map
|