lumiverse-spindle-types 0.5.2 → 0.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
@@ -0,0 +1,568 @@
1
+ /**
2
+ * Host-provided shared UI components.
3
+ *
4
+ * These types describe an API surface that lets a frontend extension mount
5
+ * instances of Lumiverse's first-party React components inside extension-owned
6
+ * DOM nodes (drawer tabs, float widgets, dock panels, app mounts, message
7
+ * widgets, etc.). The host renders the real React component into the supplied
8
+ * target element — extensions never need to depend on React themselves.
9
+ *
10
+ * Common shape:
11
+ * - Each `mountX(target, options)` call returns a `SpindleMountedComponent`
12
+ * handle scoped to the supplied target.
13
+ * - Options carry initial values plus user-event callbacks (e.g. `onChange`).
14
+ * - The host owns internal state and re-renders on user interaction. To
15
+ * programmatically change inputs from the extension side, call
16
+ * `handle.update({ ... })`. To read current state, call `handle.getValue()`
17
+ * where available.
18
+ * - Calling `handle.destroy()` unmounts the React tree and removes any host
19
+ * resources. The supplied target element is not removed from the DOM —
20
+ * extensions own placement and lifetime of the container.
21
+ *
22
+ * Components inherit the active Lumiverse theme via CSS variables, so they
23
+ * visually match the rest of the host UI without any additional wiring.
24
+ */
25
+
26
+ // ──────────────────────────────────────────────────────────────────────────
27
+ // Shared base shapes
28
+ // ──────────────────────────────────────────────────────────────────────────
29
+
30
+ /**
31
+ * Common handle shape returned by every `ctx.components.mount*` call.
32
+ *
33
+ * @template TOptions Options shape used at mount time. `update()` accepts a
34
+ * partial of the same shape so callers get IntelliSense for every field they
35
+ * are allowed to change post-mount.
36
+ */
37
+ export interface SpindleMountedComponent<TOptions> {
38
+ /** Host-assigned component instance ID, unique per extension. */
39
+ readonly componentId: string;
40
+ /** The container element the component was mounted into. Same node passed as `target`. */
41
+ readonly element: HTMLElement;
42
+ /**
43
+ * Merge a partial set of options into the live component. Pass any subset of
44
+ * the original mount options — undefined fields are ignored.
45
+ */
46
+ update(patch: Partial<TOptions>): void;
47
+ /** Unmount the React tree and release host resources. The target element is left in place. */
48
+ destroy(): void;
49
+ }
50
+
51
+ /** Mount-time target. Either a CSS selector resolved against the extension-owned DOM, or an Element. */
52
+ export type SpindleComponentTarget = string | Element;
53
+
54
+ /** Connection kinds the host can wire shared pickers up to. */
55
+ export type SpindleConnectionKind = "llm" | "image" | "tts" | "embedding";
56
+
57
+ /**
58
+ * Reference to a host-managed connection profile.
59
+ *
60
+ * When supplied to a connection-aware picker (e.g. {@link SpindleModelComboboxOptions}),
61
+ * the host populates available choices, loading state, and refresh behavior
62
+ * from its own connection registry. The extension does not need to fetch or
63
+ * cache anything itself.
64
+ */
65
+ export interface SpindleConnectionRef {
66
+ /** Which connection family the picker should bind to. */
67
+ kind: SpindleConnectionKind;
68
+ /**
69
+ * Specific connection ID. If omitted, the host binds to the currently
70
+ * active connection of the given `kind` and follows live changes when the
71
+ * user switches active connections.
72
+ */
73
+ id?: string;
74
+ }
75
+
76
+ // ──────────────────────────────────────────────────────────────────────────
77
+ // Text inputs
78
+ // ──────────────────────────────────────────────────────────────────────────
79
+
80
+ export interface SpindleTextInputOptions {
81
+ /** Initial value. */
82
+ value?: string;
83
+ /** Fired whenever the user changes the input. */
84
+ onChange?: (value: string) => void;
85
+ /** Placeholder text shown when value is empty. */
86
+ placeholder?: string;
87
+ /** Focus the input on mount. */
88
+ autoFocus?: boolean;
89
+ /** Disable user interaction. */
90
+ disabled?: boolean;
91
+ /** Additional CSS class merged onto the input element. */
92
+ className?: string;
93
+ /** Optional accessible label. Surfaces as `aria-label` on the input. */
94
+ ariaLabel?: string;
95
+ }
96
+
97
+ export interface SpindleTextInputHandle extends SpindleMountedComponent<SpindleTextInputOptions> {
98
+ /** Read the current value. */
99
+ getValue(): string;
100
+ /** Programmatically focus the input. */
101
+ focus(): void;
102
+ /** Programmatically blur the input. */
103
+ blur(): void;
104
+ }
105
+
106
+ export interface SpindleTextAreaOptions {
107
+ value?: string;
108
+ onChange?: (value: string) => void;
109
+ placeholder?: string;
110
+ /** Visible row count. Default: `4`. */
111
+ rows?: number;
112
+ disabled?: boolean;
113
+ className?: string;
114
+ ariaLabel?: string;
115
+ }
116
+
117
+ export interface SpindleTextAreaHandle extends SpindleMountedComponent<SpindleTextAreaOptions> {
118
+ getValue(): string;
119
+ focus(): void;
120
+ blur(): void;
121
+ }
122
+
123
+ // ──────────────────────────────────────────────────────────────────────────
124
+ // Numeric inputs
125
+ // ──────────────────────────────────────────────────────────────────────────
126
+
127
+ export interface SpindleNumericInputOptions {
128
+ /** Initial value, or `null` for empty. */
129
+ value?: number | null;
130
+ /** Fired whenever the value changes. `null` means the field is empty. */
131
+ onChange?: (value: number | null) => void;
132
+ /** Allow the field to be empty (`null`). Default: `false`. */
133
+ allowEmpty?: boolean;
134
+ /** Restrict input to integers. Default: `false`. */
135
+ integer?: boolean;
136
+ /** Minimum allowed value. */
137
+ min?: number;
138
+ /** Maximum allowed value. */
139
+ max?: number;
140
+ /** Step size used by the underlying `<input type="number">`. */
141
+ step?: number;
142
+ placeholder?: string;
143
+ disabled?: boolean;
144
+ className?: string;
145
+ ariaLabel?: string;
146
+ }
147
+
148
+ export interface SpindleNumericInputHandle extends SpindleMountedComponent<SpindleNumericInputOptions> {
149
+ getValue(): number | null;
150
+ focus(): void;
151
+ blur(): void;
152
+ }
153
+
154
+ export interface SpindleNumberStepperOptions {
155
+ value?: number | null;
156
+ onChange?: (value: number | null) => void;
157
+ min?: number;
158
+ max?: number;
159
+ /** Increment/decrement step. Default: `1`. */
160
+ step?: number;
161
+ allowEmpty?: boolean;
162
+ integer?: boolean;
163
+ placeholder?: string;
164
+ disabled?: boolean;
165
+ className?: string;
166
+ }
167
+
168
+ export interface SpindleNumberStepperHandle extends SpindleMountedComponent<SpindleNumberStepperOptions> {
169
+ getValue(): number | null;
170
+ }
171
+
172
+ // ──────────────────────────────────────────────────────────────────────────
173
+ // Boolean inputs
174
+ // ──────────────────────────────────────────────────────────────────────────
175
+
176
+ export interface SpindleCheckboxOptions {
177
+ checked?: boolean;
178
+ onChange?: (checked: boolean) => void;
179
+ /** Label rendered next to the checkbox. */
180
+ label?: string;
181
+ /** Optional helper text rendered below the label. */
182
+ hint?: string;
183
+ disabled?: boolean;
184
+ className?: string;
185
+ }
186
+
187
+ export interface SpindleCheckboxHandle extends SpindleMountedComponent<SpindleCheckboxOptions> {
188
+ getValue(): boolean;
189
+ }
190
+
191
+ export interface SpindleSwitchOptions {
192
+ checked?: boolean;
193
+ onChange?: (checked: boolean) => void;
194
+ /** Visual size. Default: `"md"`. */
195
+ size?: "sm" | "md";
196
+ disabled?: boolean;
197
+ className?: string;
198
+ ariaLabel?: string;
199
+ }
200
+
201
+ export interface SpindleSwitchHandle extends SpindleMountedComponent<SpindleSwitchOptions> {
202
+ getValue(): boolean;
203
+ }
204
+
205
+ // ──────────────────────────────────────────────────────────────────────────
206
+ // Pickers & selects
207
+ // ──────────────────────────────────────────────────────────────────────────
208
+
209
+ /**
210
+ * Declarative leading-cell content for a select option (avatar, icon, swatch, initial).
211
+ *
212
+ * Rendered by the host in the fixed leading slot of both the dropdown row and
213
+ * the selected-value trigger. Extensions describe what they want declaratively
214
+ * — they do not pass React nodes themselves.
215
+ *
216
+ * Common patterns:
217
+ * - Persona/character avatars with initial fallback: pick `{ type: "image", src, fallback }`.
218
+ * The host shows the image when it loads successfully; if `src` is empty or
219
+ * the image fails to load, the host falls back to the supplied initial.
220
+ * - Provider icons / brand marks: `{ type: "icon-svg" }` or `{ type: "icon-url" }`.
221
+ * - Color tags / category swatches: `{ type: "swatch", color }`.
222
+ * - Plain text bubble (initials, single emoji): `{ type: "initial", text }`.
223
+ */
224
+ export type SpindleSelectOptionLeading =
225
+ | {
226
+ type: "image";
227
+ /** Image URL. Anything `<img src>` accepts, including data URLs. */
228
+ src: string;
229
+ /** Alt text for accessibility. Defaults to empty (decorative). */
230
+ alt?: string;
231
+ /** Render the image as a circle. Default: `true`. Useful for avatars. */
232
+ rounded?: boolean;
233
+ /**
234
+ * Fallback rendered when `src` is empty or fails to load. Typically a
235
+ * one-character initial. If omitted, the slot collapses on failure.
236
+ */
237
+ fallback?: {
238
+ /** Fallback text — usually a single character / initial. */
239
+ text: string;
240
+ /** Optional background color for the fallback bubble. */
241
+ background?: string;
242
+ /** Optional text color for the fallback bubble. */
243
+ color?: string;
244
+ };
245
+ }
246
+ | {
247
+ type: "icon-svg";
248
+ /** Inline SVG string. The host sanitizes and inlines the SVG. */
249
+ svg: string;
250
+ /** Optional foreground color applied via `currentColor`. */
251
+ color?: string;
252
+ }
253
+ | {
254
+ type: "icon-url";
255
+ /** URL to an icon image (PNG / SVG / WebP). */
256
+ url: string;
257
+ alt?: string;
258
+ }
259
+ | {
260
+ type: "swatch";
261
+ /** Any CSS color string. Rendered as a small filled circle. */
262
+ color: string;
263
+ }
264
+ | {
265
+ type: "initial";
266
+ /** Text shown inside the leading bubble — typically one character. */
267
+ text: string;
268
+ /** Background color for the bubble. */
269
+ background?: string;
270
+ /** Text color inside the bubble. */
271
+ color?: string;
272
+ };
273
+
274
+ /** A single option in a select-style picker. */
275
+ export interface SpindleSelectOption {
276
+ /** Stable value emitted to `onChange`. */
277
+ value: string;
278
+ /** Display label. */
279
+ label: string;
280
+ /** Secondary text rendered beneath the label. */
281
+ sublabel?: string;
282
+ /**
283
+ * Optional leading-cell content rendered before the label in both the
284
+ * dropdown row and the selected-value trigger. See {@link SpindleSelectOptionLeading}
285
+ * for the supported variants (avatar image with initial fallback, inline
286
+ * SVG icon, icon URL, color swatch, plain initial bubble).
287
+ */
288
+ leading?: SpindleSelectOptionLeading;
289
+ /** Group key. Options sharing a group are visually clustered with a header. */
290
+ group?: string;
291
+ /** Render as disabled. */
292
+ disabled?: boolean;
293
+ }
294
+
295
+ export interface SpindleSelectOptionsBase {
296
+ /** Available options. */
297
+ options?: SpindleSelectOption[];
298
+ /** Placeholder text shown when no value is selected. */
299
+ placeholder?: string;
300
+ /** Placeholder for the search field inside the dropdown. */
301
+ searchPlaceholder?: string;
302
+ /** Minimum option count before the search field is shown. Default: `8`. */
303
+ searchThreshold?: number;
304
+ /** Message rendered when the filtered option list is empty. */
305
+ emptyMessage?: string;
306
+ /**
307
+ * Render the dropdown into a React portal anchored to `document.body` so it
308
+ * escapes containers with `overflow:hidden`. Default: `true`.
309
+ */
310
+ portal?: boolean;
311
+ /** Dropdown horizontal alignment relative to the trigger. Default: `"left"`. */
312
+ align?: "left" | "right";
313
+ /** Maximum dropdown height in CSS pixels. */
314
+ maxHeight?: number;
315
+ /** Minimum dropdown width in CSS pixels. */
316
+ minWidth?: number;
317
+ disabled?: boolean;
318
+ className?: string;
319
+ }
320
+
321
+ export interface SpindleSelectOptions extends SpindleSelectOptionsBase {
322
+ /** Initial value. */
323
+ value?: string;
324
+ onChange?: (value: string) => void;
325
+ }
326
+
327
+ export interface SpindleSelectHandle extends SpindleMountedComponent<SpindleSelectOptions> {
328
+ getValue(): string;
329
+ /** Open the dropdown programmatically. */
330
+ open(): void;
331
+ /** Close the dropdown programmatically. */
332
+ close(): void;
333
+ }
334
+
335
+ export interface SpindleMultiSelectOptions extends SpindleSelectOptionsBase {
336
+ /** Initial value. */
337
+ value?: string[];
338
+ onChange?: (value: string[]) => void;
339
+ }
340
+
341
+ export interface SpindleMultiSelectHandle extends SpindleMountedComponent<SpindleMultiSelectOptions> {
342
+ getValue(): string[];
343
+ open(): void;
344
+ close(): void;
345
+ }
346
+
347
+ /**
348
+ * Connection-aware model picker.
349
+ *
350
+ * **Recommended (connection-bound) mode:** supply `connection` and the host
351
+ * will populate `models`, drive the refresh button, manage loading state, and
352
+ * react to live connection changes.
353
+ *
354
+ * **Manual mode:** supply `models`, `loading`, and `onRefresh` directly. Use
355
+ * this when the extension fetches model lists from its own backend or proxy.
356
+ *
357
+ * The two modes are mutually exclusive. If both `connection` and `models` are
358
+ * supplied, `connection` wins and the manual fields are ignored.
359
+ */
360
+ export interface SpindleModelComboboxOptions {
361
+ /** Currently entered model ID. */
362
+ value?: string;
363
+ /** Fired when the user types or selects a model. */
364
+ onChange?: (value: string) => void;
365
+
366
+ /**
367
+ * Bind to a host-managed connection. The host populates the model list,
368
+ * handles the refresh affordance, and reports loading state automatically.
369
+ *
370
+ * Pass just `{ kind }` to follow the user's currently active connection of
371
+ * that kind. Pass `{ kind, id }` to pin to a specific connection.
372
+ */
373
+ connection?: SpindleConnectionRef;
374
+
375
+ /** Manual mode: explicit model list. Ignored when `connection` is set. */
376
+ models?: string[];
377
+ /** Manual mode: optional map of model ID → human-readable label. */
378
+ modelLabels?: Record<string, string>;
379
+ /** Manual mode: surface the host spinner inside the refresh affordance. */
380
+ loading?: boolean;
381
+ /** Manual mode: render a refresh button that invokes this handler when clicked. */
382
+ onRefresh?: () => void;
383
+
384
+ /** Trigger an auto-refresh the first time the input gains focus (manual mode only). */
385
+ autoRefreshOnFocus?: boolean;
386
+ /** Opaque key — when it changes, the host re-arms the autoRefreshOnFocus guard. */
387
+ refreshKey?: string;
388
+
389
+ /** Visual density. `"compact"` matches inline rows; `"standard"` matches form rows; `"editor"` matches the prompt editor. */
390
+ appearance?: "compact" | "standard" | "editor";
391
+ placeholder?: string;
392
+ emptyMessage?: string;
393
+ loadingMessage?: string;
394
+ /** Optional hint shown beneath the input (e.g. "Search the catalog"). */
395
+ browseHint?: string;
396
+ disabled?: boolean;
397
+ className?: string;
398
+ }
399
+
400
+ export interface SpindleModelComboboxHandle extends SpindleMountedComponent<SpindleModelComboboxOptions> {
401
+ getValue(): string;
402
+ /** Force a refresh of the host-managed model list. No-op in manual mode unless `onRefresh` is set. */
403
+ refresh(): void;
404
+ }
405
+
406
+ export interface SpindleFolderDropdownOptions {
407
+ /** Available folder names. */
408
+ folders?: string[];
409
+ /** Currently selected folder. */
410
+ value?: string;
411
+ onChange?: (folder: string) => void;
412
+ /** Fired when the user creates a new folder via the inline affordance. */
413
+ onCreateFolder?: (name: string) => void;
414
+ placeholder?: string;
415
+ disabled?: boolean;
416
+ className?: string;
417
+ }
418
+
419
+ export interface SpindleFolderDropdownHandle extends SpindleMountedComponent<SpindleFolderDropdownOptions> {
420
+ getValue(): string;
421
+ }
422
+
423
+ // ──────────────────────────────────────────────────────────────────────────
424
+ // Display & layout
425
+ // ──────────────────────────────────────────────────────────────────────────
426
+
427
+ export type SpindleBadgeColor = "neutral" | "primary" | "success" | "warning" | "danger" | "info";
428
+
429
+ export interface SpindleBadgeOptions {
430
+ /** Badge text. */
431
+ text?: string;
432
+ /** Accent color. Default: `"neutral"`. */
433
+ color?: SpindleBadgeColor;
434
+ /** Visual size. Default: `"md"`. */
435
+ size?: "sm" | "md" | "pill";
436
+ className?: string;
437
+ }
438
+
439
+ export type SpindleBadgeHandle = SpindleMountedComponent<SpindleBadgeOptions>;
440
+
441
+ export interface SpindleSpinnerOptions {
442
+ /** Diameter in CSS pixels. Default: `16`. */
443
+ size?: number;
444
+ /** Use the faster rotation variant for impatient contexts. */
445
+ fast?: boolean;
446
+ className?: string;
447
+ }
448
+
449
+ export type SpindleSpinnerHandle = SpindleMountedComponent<SpindleSpinnerOptions>;
450
+
451
+ export interface SpindleCollapsibleSectionOptions {
452
+ /** Section title rendered in the collapsible header. */
453
+ title: string;
454
+ /** Inline SVG string for an optional leading icon. */
455
+ iconSvg?: string;
456
+ /** URL to an icon image. Mutually exclusive with `iconSvg`. */
457
+ iconUrl?: string;
458
+ /** Optional badge text shown next to the title. */
459
+ badge?: string | number;
460
+ /** Initial expanded state. Default: `true`. */
461
+ defaultExpanded?: boolean;
462
+ /** Fired whenever the user toggles the section. */
463
+ onToggle?: (expanded: boolean) => void;
464
+ className?: string;
465
+ }
466
+
467
+ export interface SpindleCollapsibleSectionHandle extends SpindleMountedComponent<SpindleCollapsibleSectionOptions> {
468
+ /**
469
+ * Body container the extension owns. Append child elements here — the host
470
+ * renders the collapsible chrome around them.
471
+ */
472
+ readonly body: HTMLElement;
473
+ /** Returns the current expanded state. */
474
+ isExpanded(): boolean;
475
+ /** Expand the section. */
476
+ expand(): void;
477
+ /** Collapse the section. */
478
+ collapse(): void;
479
+ /** Toggle the section. */
480
+ toggle(): void;
481
+ }
482
+
483
+ export interface SpindlePaginationOptions {
484
+ currentPage: number;
485
+ totalPages: number;
486
+ onPageChange: (page: number) => void;
487
+ /** Optional items-per-page selector. Omit to hide the selector entirely. */
488
+ perPage?: number;
489
+ perPageOptions?: number[];
490
+ onPerPageChange?: (perPage: number) => void;
491
+ /** Total item count for the "Showing X–Y of N" summary. Omit to hide the summary. */
492
+ totalItems?: number;
493
+ className?: string;
494
+ }
495
+
496
+ export type SpindlePaginationHandle = SpindleMountedComponent<SpindlePaginationOptions>;
497
+
498
+ export interface SpindleCloseButtonOptions {
499
+ onClick?: () => void;
500
+ /** Visual size. Default: `"md"`. */
501
+ size?: "sm" | "md";
502
+ /** Visual variant. Default: `"subtle"`. */
503
+ variant?: "subtle" | "solid";
504
+ /** Positioning behavior. Default: `"static"`. */
505
+ position?: "static" | "absolute";
506
+ /** Icon size override in CSS pixels. */
507
+ iconSize?: number;
508
+ ariaLabel?: string;
509
+ className?: string;
510
+ }
511
+
512
+ export type SpindleCloseButtonHandle = SpindleMountedComponent<SpindleCloseButtonOptions>;
513
+
514
+ // ──────────────────────────────────────────────────────────────────────────
515
+ // Aggregator
516
+ // ──────────────────────────────────────────────────────────────────────────
517
+
518
+ /**
519
+ * Mount points for host-rendered shared components.
520
+ *
521
+ * Each method takes a `target` (the DOM node or selector inside the
522
+ * extension-owned tree to render into) and an `options` object. The returned
523
+ * handle exposes `update()`, `destroy()`, and component-specific helpers.
524
+ *
525
+ * @example
526
+ * ```ts
527
+ * // Inside a drawer tab
528
+ * const tab = ctx.ui.registerDrawerTab({ id: "settings", title: "My Tab" })
529
+ * const wrap = ctx.dom.createElement("div")
530
+ * tab.root.appendChild(wrap)
531
+ *
532
+ * const picker = ctx.components.mountModelCombobox(wrap, {
533
+ * value: "",
534
+ * connection: { kind: "llm" },
535
+ * appearance: "standard",
536
+ * onChange: (model) => ctx.sendToBackend({ type: "set_model", model }),
537
+ * })
538
+ *
539
+ * // Later — force the input to a specific value
540
+ * picker.update({ value: "claude-opus-4-7" })
541
+ * ```
542
+ */
543
+ export interface SpindleComponentsHelper {
544
+ // Text inputs
545
+ mountTextInput(target: SpindleComponentTarget, options?: SpindleTextInputOptions): SpindleTextInputHandle;
546
+ mountTextArea(target: SpindleComponentTarget, options?: SpindleTextAreaOptions): SpindleTextAreaHandle;
547
+
548
+ // Numeric inputs
549
+ mountNumericInput(target: SpindleComponentTarget, options?: SpindleNumericInputOptions): SpindleNumericInputHandle;
550
+ mountNumberStepper(target: SpindleComponentTarget, options?: SpindleNumberStepperOptions): SpindleNumberStepperHandle;
551
+
552
+ // Boolean inputs
553
+ mountCheckbox(target: SpindleComponentTarget, options?: SpindleCheckboxOptions): SpindleCheckboxHandle;
554
+ mountSwitch(target: SpindleComponentTarget, options?: SpindleSwitchOptions): SpindleSwitchHandle;
555
+
556
+ // Pickers & selects
557
+ mountSelect(target: SpindleComponentTarget, options: SpindleSelectOptions): SpindleSelectHandle;
558
+ mountMultiSelect(target: SpindleComponentTarget, options: SpindleMultiSelectOptions): SpindleMultiSelectHandle;
559
+ mountModelCombobox(target: SpindleComponentTarget, options: SpindleModelComboboxOptions): SpindleModelComboboxHandle;
560
+ mountFolderDropdown(target: SpindleComponentTarget, options: SpindleFolderDropdownOptions): SpindleFolderDropdownHandle;
561
+
562
+ // Display & layout
563
+ mountBadge(target: SpindleComponentTarget, options: SpindleBadgeOptions): SpindleBadgeHandle;
564
+ mountSpinner(target: SpindleComponentTarget, options?: SpindleSpinnerOptions): SpindleSpinnerHandle;
565
+ mountCollapsibleSection(target: SpindleComponentTarget, options: SpindleCollapsibleSectionOptions): SpindleCollapsibleSectionHandle;
566
+ mountPagination(target: SpindleComponentTarget, options: SpindlePaginationOptions): SpindlePaginationHandle;
567
+ mountCloseButton(target: SpindleComponentTarget, options?: SpindleCloseButtonOptions): SpindleCloseButtonHandle;
568
+ }
package/src/dom.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { RequestInitDTO } from "./api";
2
+ import type { SpindleComponentsHelper } from "./components";
2
3
 
3
4
  /** DOM helper API provided to frontend extension modules. */
4
5
  export interface SpindleDOMHelper {
@@ -598,6 +599,14 @@ export interface SpindleFrontendContext {
598
599
  */
599
600
  showConfirm(options: SpindleConfirmOptions): Promise<SpindleConfirmResult>;
600
601
  };
602
+ /**
603
+ * Mount instances of Lumiverse's first-party shared UI components (form
604
+ * atoms, model picker, select, pagination, etc.) inside extension-owned DOM.
605
+ * The host renders real React components into the supplied container — the
606
+ * extension never needs to depend on React directly. See
607
+ * {@link SpindleComponentsHelper} for the full surface.
608
+ */
609
+ components: SpindleComponentsHelper;
601
610
  uploads: {
602
611
  pickFile(options?: {
603
612
  accept?: string[];
package/src/index.ts CHANGED
@@ -214,6 +214,48 @@ export type {
214
214
  SpindleFrontendProcessRegistry,
215
215
  } from "./dom";
216
216
 
217
+ export type {
218
+ SpindleMountedComponent,
219
+ SpindleComponentTarget,
220
+ SpindleConnectionKind,
221
+ SpindleConnectionRef,
222
+ SpindleTextInputOptions,
223
+ SpindleTextInputHandle,
224
+ SpindleTextAreaOptions,
225
+ SpindleTextAreaHandle,
226
+ SpindleNumericInputOptions,
227
+ SpindleNumericInputHandle,
228
+ SpindleNumberStepperOptions,
229
+ SpindleNumberStepperHandle,
230
+ SpindleCheckboxOptions,
231
+ SpindleCheckboxHandle,
232
+ SpindleSwitchOptions,
233
+ SpindleSwitchHandle,
234
+ SpindleSelectOption,
235
+ SpindleSelectOptionLeading,
236
+ SpindleSelectOptionsBase,
237
+ SpindleSelectOptions,
238
+ SpindleSelectHandle,
239
+ SpindleMultiSelectOptions,
240
+ SpindleMultiSelectHandle,
241
+ SpindleModelComboboxOptions,
242
+ SpindleModelComboboxHandle,
243
+ SpindleFolderDropdownOptions,
244
+ SpindleFolderDropdownHandle,
245
+ SpindleBadgeColor,
246
+ SpindleBadgeOptions,
247
+ SpindleBadgeHandle,
248
+ SpindleSpinnerOptions,
249
+ SpindleSpinnerHandle,
250
+ SpindleCollapsibleSectionOptions,
251
+ SpindleCollapsibleSectionHandle,
252
+ SpindlePaginationOptions,
253
+ SpindlePaginationHandle,
254
+ SpindleCloseButtonOptions,
255
+ SpindleCloseButtonHandle,
256
+ SpindleComponentsHelper,
257
+ } from "./components";
258
+
217
259
  export type { ExtensionInfo } from "./extension-info";
218
260
 
219
261
  export type {