@tradalab/lyra 3.14.0 → 3.16.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.
@@ -1,7 +1,7 @@
1
1
  import * as react_hook_form from 'react-hook-form';
2
2
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
3
3
  import * as React$1 from 'react';
4
- import { ReactNode, HTMLAttributes, ReactElement } from 'react';
4
+ import { ReactNode, DragEvent, HTMLAttributes, ReactElement } from 'react';
5
5
  import { Slot, Label } from 'radix-ui';
6
6
  import { LucideIcon } from 'lucide-react';
7
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';
@@ -112,6 +112,63 @@ declare function flattenTree<T extends TreeData<T>>(items: T[], expandedIds: Set
112
112
  /** `ids` with `id` moved next to `targetId`, for a drag-to-reorder drop. */
113
113
  declare function moveId(ids: string[], id: string, targetId: string, pos: "before" | "after"): string[];
114
114
  declare const sameOrder: (a: string[], b: string[]) => boolean;
115
+ type DropPosition = "before" | "after" | "inside";
116
+ /** What a drop changes: the new order of the groups, or of one group's leaves ("" is the top level). */
117
+ type DropPlan = {
118
+ kind: "group";
119
+ ids: string[];
120
+ } | {
121
+ kind: "leaf";
122
+ groupId: string;
123
+ ids: string[];
124
+ };
125
+ /**
126
+ * Turns a drop on a two-level tree (groups at the top holding leaves, plus loose leaves) into a
127
+ * plan, or null when the drop is not allowed or changes nothing. `targetId` "" is the empty space
128
+ * below the tree, which takes a leaf out of its group.
129
+ */
130
+ declare function planDrop<T extends TreeData<T>>(tree: T[], dragId: string, targetId: string, pos: DropPosition): DropPlan | null;
131
+
132
+ type TreeDndProviderProps<T extends TreeData<T>> = {
133
+ /** The tree as shown, which `planDrop` reads the current order from. */
134
+ tree: T[];
135
+ /** Off while the tree is filtered: hidden siblings leave a drop no place among them. */
136
+ enabled?: boolean;
137
+ onDrop: (plan: DropPlan) => void;
138
+ children: ReactNode;
139
+ };
140
+ /** Drag to reorder a two-level tree; `onDrop` gets the plan only when a drop changes something. */
141
+ declare function TreeDndProvider<T extends TreeData<T>>({ tree, enabled, onDrop, children }: TreeDndProviderProps<T>): React$1.JSX.Element;
142
+ /**
143
+ * Props for the area around the tree, where dropping a leaf takes it out of its group, and for the
144
+ * tree itself, so the area can tell a drop on a node from one on the space below.
145
+ */
146
+ declare function useTreeDndRoot(): {
147
+ className: string;
148
+ treeProps: {
149
+ "data-tree-dnd": string;
150
+ };
151
+ rootProps: {
152
+ onDragOver: (e: DragEvent<HTMLElement>) => void;
153
+ onDragLeave: (e: DragEvent<HTMLElement>) => void;
154
+ onDrop: (e: DragEvent<HTMLElement>) => void;
155
+ } | null;
156
+ };
157
+ /** Props and the drop-marker class for one node's trigger row. */
158
+ declare function useTreeDndNode(item: {
159
+ id: string;
160
+ isGroup?: boolean;
161
+ }): {
162
+ className: string;
163
+ props: {
164
+ draggable: boolean;
165
+ onDragStart: (e: DragEvent<HTMLElement>) => void;
166
+ onDragEnd: () => void;
167
+ onDragLeave: (e: DragEvent<HTMLElement>) => void;
168
+ onDragOver: (e: DragEvent<HTMLElement>) => void;
169
+ onDrop: (e: DragEvent<HTMLElement>) => void;
170
+ } | null;
171
+ };
115
172
 
116
173
  type TreeProviderProps = {
117
174
  children: ReactNode;
@@ -241,6 +298,25 @@ interface AvatarTileProps {
241
298
  */
242
299
  declare function AvatarTile({ src, alt, fallback, className }: AvatarTileProps): React$1.JSX.Element;
243
300
 
301
+ interface AuthCardProps {
302
+ title: ReactNode;
303
+ description?: ReactNode;
304
+ /** The product mark above the card, as an element: an `<img>`, an icon, or a framework image. */
305
+ logo?: ReactNode;
306
+ /** The product name beside `logo`. The row is left out when both are absent. */
307
+ brand?: ReactNode;
308
+ /** Below the card, e.g. language links, terms, a link back to the app. */
309
+ footer?: ReactNode;
310
+ /** The form. A card with none (a failure, a "check your mail") renders its header alone. */
311
+ children?: ReactNode;
312
+ className?: string;
313
+ }
314
+ /**
315
+ * The full-page frame of a sign-in, sign-up or recovery screen: brand, one card, a footer.
316
+ * Renders a `<main>`, so use it as the page itself, not inside another layout's main.
317
+ */
318
+ declare function AuthCard({ title, description, logo, brand, footer, children, className }: AuthCardProps): React$1.JSX.Element;
319
+
244
320
  interface MobileSheetProps {
245
321
  title: ReactNode;
246
322
  description?: ReactNode;
@@ -422,6 +498,8 @@ interface LlmSlot {
422
498
  interface LlmState {
423
499
  providers: LlmProvider[];
424
500
  slots: LlmSlot[];
501
+ /** The settings file was written by a newer app and every write would be refused. */
502
+ read_only?: boolean;
425
503
  }
426
504
  interface LlmModel {
427
505
  id: string;
@@ -448,6 +526,8 @@ interface LlmPullProgress {
448
526
  status: string;
449
527
  done: number;
450
528
  total: number;
529
+ /** The layer this event counts; layers with different digests add up to the model. */
530
+ digest?: string;
451
531
  }
452
532
  interface LlmSettingsApi {
453
533
  state(): Promise<LlmState>;
@@ -470,6 +550,18 @@ interface LlmSettingsApi {
470
550
  * copy of this screen.
471
551
  */
472
552
  slotNote?(slot: string): React$1.ReactNode;
553
+ /** Deletes a downloaded model; without it the model list offers no delete. */
554
+ deleteModel?(provider: string, model: string): Promise<boolean>;
555
+ /** The api asks the user itself before a delete, as scorix's `mod:llm` does, so the screen does not. */
556
+ confirmsDelete?: boolean;
557
+ /** An error that only means the user declined a confirmation; it is not shown as a failure. */
558
+ isCanceled?(err: unknown): boolean;
559
+ /** The name to show for a provider id; the id is shown when this returns nothing. */
560
+ providerName?(id: string): string | undefined;
561
+ /** App-owned status and actions on a provider's row, e.g. installing an engine the app runs. */
562
+ providerExtra?(provider: LlmProvider): React$1.ReactNode;
563
+ /** Called after a slot was bound, e.g. to offer re-indexing when the embedding model changed. */
564
+ onBound?(slot: string, provider: string, model: string): void;
473
565
  }
474
566
  interface LlmSettingsLabels {
475
567
  slots?: string;
@@ -503,12 +595,43 @@ interface LlmSettingsLabels {
503
595
  running?: string;
504
596
  addFound?: string;
505
597
  retry?: string;
598
+ readOnly?: string;
599
+ driversFailed?: string;
600
+ driverUnknown?: string;
601
+ refresh?: string;
602
+ models?: string;
603
+ modelsEmpty?: string;
604
+ deleteModel?: string;
605
+ pullPlaceholder?: string;
506
606
  capabilities?: Partial<Record<string, string>>;
607
+ /** Labels that carry a value, so a translation can put it where its grammar wants it. */
608
+ format?: LlmSettingsFormat;
507
609
  }
508
- declare function LlmSettings({ api, labels, className, }: {
610
+ interface LlmSettingsFormat {
611
+ downloadModel?(model: string): string;
612
+ editProvider?(name: string): string;
613
+ removeProvider?(name: string): string;
614
+ addFound?(name: string): string;
615
+ useFor?(slotLabel: string): string;
616
+ slotProvider?(slotLabel: string): string;
617
+ slotModel?(slotLabel: string): string;
618
+ /** Slot and field texts come from the app's Go side; these translate them. */
619
+ slotLabel?(slot: LlmSlot): string;
620
+ slotDescription?(slot: LlmSlot): string | undefined;
621
+ fieldLabel?(driver: string, field: LlmField): string;
622
+ fieldDescription?(driver: string, field: LlmField): string | undefined;
623
+ size?(bytes: number): string;
624
+ pullStatus?(status: string): string;
625
+ }
626
+ interface LlmSettingsProps {
509
627
  api: LlmSettingsApi;
510
628
  labels?: LlmSettingsLabels;
511
629
  className?: string;
512
- }): React$1.JSX.Element;
630
+ /** Rendered above the slots, e.g. an onboarding notice. */
631
+ header?: React$1.ReactNode;
632
+ /** Rendered below the providers, e.g. settings the app owns. */
633
+ footer?: React$1.ReactNode;
634
+ }
635
+ declare function LlmSettings({ api, labels, className, header, footer }: LlmSettingsProps): React$1.JSX.Element;
513
636
 
514
- export { AvatarTile, type AvatarTileProps, ChoiceDrawer, type ChoiceDrawerProps, type ChoiceOption, ConfirmContext, ConfirmDialog, type ConfirmFn, type ConfirmOptions, ConfirmProvider, type FlatTreeNode, 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, MobileSheet, type MobileSheetProps, OptionPicker, type OptionPickerLabels, Panel, PanelCard, type PanelCardProps, type PanelItemProps, type PickOption, type TreeData, 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, filterTree, flattenTree, moveId, sameOrder, sortTree, useConfirm, useFormField };
637
+ export { AuthCard, type AuthCardProps, AvatarTile, type AvatarTileProps, ChoiceDrawer, type ChoiceDrawerProps, type ChoiceOption, ConfirmContext, ConfirmDialog, type ConfirmFn, type ConfirmOptions, ConfirmProvider, type DropPlan, type DropPosition, type FlatTreeNode, 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 LlmSettingsFormat, type LlmSettingsLabels, type LlmSettingsProps, type LlmSlot, type LlmState, type McpCall, type McpClient, McpSettings, type McpSettingsApi, type McpSettingsLabels, type McpStatus, type McpTool, MobileSheet, type MobileSheetProps, OptionPicker, type OptionPickerLabels, Panel, PanelCard, type PanelCardProps, type PanelItemProps, type PickOption, type TreeData, TreeDndProvider, type TreeDndProviderProps, 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, filterTree, flattenTree, moveId, planDrop, sameOrder, sortTree, useConfirm, useFormField, useTreeDndNode, useTreeDndRoot };