lumiverse-spindle-types 0.2.6 → 0.2.8

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.2.6",
3
+ "version": "0.2.8",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/dom.ts CHANGED
@@ -185,6 +185,35 @@ export interface SpindleTextEditorResult {
185
185
  cancelled: boolean;
186
186
  }
187
187
 
188
+ // ── Context Menu ──
189
+
190
+ export interface SpindleContextMenuOptions {
191
+ /** Screen position to render the menu at. */
192
+ position: { x: number; y: number };
193
+ /** Menu items. Items with `type: 'divider'` render as visual separators. */
194
+ items: SpindleContextMenuItemDef[];
195
+ }
196
+
197
+ export interface SpindleContextMenuItemDef {
198
+ /** Unique key returned when this item is selected. */
199
+ key: string;
200
+ /** Display label. Ignored for dividers. */
201
+ label: string;
202
+ /** Render as disabled (greyed out, not clickable). */
203
+ disabled?: boolean;
204
+ /** Render in danger/red style. */
205
+ danger?: boolean;
206
+ /** Render with active/highlighted style. */
207
+ active?: boolean;
208
+ /** Set to `'divider'` for a visual separator. Default: `'item'`. */
209
+ type?: "item" | "divider";
210
+ }
211
+
212
+ export interface SpindleContextMenuResult {
213
+ /** The `key` of the selected item, or `null` if the menu was dismissed without selection. */
214
+ selectedKey: string | null;
215
+ }
216
+
188
217
  /** Context object provided to frontend extension modules */
189
218
  export interface SpindleFrontendContext {
190
219
  dom: SpindleDOMHelper;
@@ -199,26 +228,9 @@ export interface SpindleFrontendContext {
199
228
  requestDockPanel(options: SpindleDockPanelOptions): SpindleDockPanelHandle;
200
229
  mountApp(options?: SpindleAppMountOptions): SpindleAppMountHandle;
201
230
  registerInputBarAction(options: SpindleInputBarActionOptions): SpindleInputBarActionHandle;
202
- /**
203
- * Open the native Lumiverse expanded text editor modal.
204
- * Provides macro syntax highlighting, macro insertion panel with search,
205
- * and a full-screen editing experience.
206
- *
207
- * Returns a Promise that resolves when the user closes the editor.
208
- *
209
- * @example
210
- * ```ts
211
- * const result = await ctx.ui.openTextEditor({
212
- * title: 'Edit System Prompt',
213
- * value: currentText,
214
- * macros: true,
215
- * })
216
- * if (!result.cancelled) {
217
- * currentText = result.text
218
- * }
219
- * ```
220
- */
221
- openTextEditor(options?: SpindleTextEditorOptions): Promise<SpindleTextEditorResult>;
231
+ /** Show a themed context menu at the given position and wait for the user's selection.
232
+ * Returns the `key` of the selected item, or `null` if the menu was dismissed. */
233
+ showContextMenu(options: SpindleContextMenuOptions): Promise<SpindleContextMenuResult>;
222
234
  };
223
235
  uploads: {
224
236
  pickFile(options?: {
package/src/index.ts CHANGED
@@ -72,6 +72,9 @@ export type {
72
72
  SpindleAppMountHandle,
73
73
  SpindleInputBarActionOptions,
74
74
  SpindleInputBarActionHandle,
75
+ SpindleContextMenuOptions,
76
+ SpindleContextMenuItemDef,
77
+ SpindleContextMenuResult,
75
78
  } from "./dom";
76
79
 
77
80
  export type { ExtensionInfo } from "./extension-info";
@@ -391,6 +391,10 @@ export interface SpindleAPI {
391
391
  body: string;
392
392
  tag?: string;
393
393
  url?: string;
394
+ /** Relative URL path to an icon image (e.g. `/api/v1/images/{id}?size=sm`). Must start with `/`. */
395
+ icon?: string;
396
+ /** When true, the notification title is used as-is without the extension name prefix. */
397
+ rawTitle?: boolean;
394
398
  }, userId?: string): Promise<{ sent: number }>;
395
399
  /**
396
400
  * Check if push notifications are available for a user.
@@ -402,6 +406,39 @@ export interface SpindleAPI {
402
406
  }>;
403
407
  };
404
408
 
409
+ /**
410
+ * Text editor (free tier — no permission needed).
411
+ * Opens the native Lumiverse expanded text editor modal on the user's
412
+ * frontend. Provides macro syntax highlighting, insertion panel, and
413
+ * full-screen editing. The call blocks until the user closes the editor.
414
+ */
415
+ textEditor: {
416
+ /**
417
+ * Open the text editor and wait for the user to close it.
418
+ *
419
+ * @example
420
+ * ```ts
421
+ * const result = await spindle.textEditor.open({
422
+ * title: 'Edit System Prompt',
423
+ * value: currentText,
424
+ * })
425
+ * if (!result.cancelled) {
426
+ * currentText = result.text
427
+ * }
428
+ * ```
429
+ */
430
+ open(options?: {
431
+ title?: string;
432
+ value?: string;
433
+ placeholder?: string;
434
+ /** For operator-scoped extensions only. */
435
+ userId?: string;
436
+ }): Promise<{
437
+ text: string;
438
+ cancelled: boolean;
439
+ }>;
440
+ };
441
+
405
442
  /**
406
443
  * Macro resolution (free tier — no permission needed).
407
444
  * Resolve `{{macro}}` placeholders in arbitrary text using