lumiverse-spindle-types 0.5.25 → 0.5.27

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.25",
3
+ "version": "0.5.27",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/dom.ts CHANGED
@@ -151,6 +151,57 @@ export interface SpindleDrawerTabHandle {
151
151
  onActivate(handler: () => void): () => void;
152
152
  }
153
153
 
154
+ // ── Character Editor Tab ──
155
+
156
+ export interface SpindleCharacterEditorTabOptions {
157
+ /** Unique tab identifier within the current extension. */
158
+ id: string;
159
+ /** Label shown in the character editor tab bar. */
160
+ title: string;
161
+ }
162
+
163
+ export interface SpindleCharacterEditorTabHandle {
164
+ root: HTMLElement;
165
+ tabId: string;
166
+ setTitle(title: string): void;
167
+ activate(): void;
168
+ destroy(): void;
169
+ /** Register a callback fired when the active character-editor tab switches to this tab. */
170
+ onActivate(handler: () => void): () => void;
171
+ }
172
+
173
+ export interface SpindleCharacterEditorState {
174
+ /** Whether the character editor modal is currently open. */
175
+ open: boolean;
176
+ /** Character currently being edited, or `null` when the modal is closed. */
177
+ characterId: string | null;
178
+ /** Active built-in or extension tab id inside the editor modal. */
179
+ activeTabId: string | null;
180
+ /** Current draft extensions blob visible to the editor. */
181
+ extensions: Record<string, any>;
182
+ }
183
+
184
+ export interface SpindleCharacterEditorSaveOptions {
185
+ /** Persist immediately instead of using the host's debounced save path. */
186
+ immediate?: boolean;
187
+ }
188
+
189
+ export interface SpindleCharacterEditorHelper {
190
+ /** Read the current editor snapshot. */
191
+ getState(): SpindleCharacterEditorState;
192
+ /** Subscribe to editor open/close, tab, character, and extensions changes. */
193
+ onChange(handler: (state: SpindleCharacterEditorState) => void): () => void;
194
+ /** Replace the draft extensions object shown in the editor. */
195
+ setExtensions(extensions: Record<string, any>, options?: SpindleCharacterEditorSaveOptions): void;
196
+ /** Atomically derive the next draft extensions object from the current one. */
197
+ updateExtensions(
198
+ mutator: (extensions: Record<string, any>) => Record<string, any>,
199
+ options?: SpindleCharacterEditorSaveOptions,
200
+ ): void;
201
+ /** Immediately persist any pending draft extension changes. */
202
+ flush(): Promise<void>;
203
+ }
204
+
154
205
  // ── Float Widget ──
155
206
 
156
207
  export interface SpindleFloatWidgetOptions {
@@ -711,6 +762,8 @@ export interface SpindleFrontendContext {
711
762
  events: SpindleUIEventsHelper;
712
763
  mount(point: SpindleMountPoint): Element;
713
764
  registerDrawerTab(options: SpindleDrawerTabOptions): SpindleDrawerTabHandle;
765
+ registerCharacterEditorTab(options: SpindleCharacterEditorTabOptions): SpindleCharacterEditorTabHandle;
766
+ characterEditor: SpindleCharacterEditorHelper;
714
767
  createFloatWidget(options?: SpindleFloatWidgetOptions): SpindleFloatWidgetHandle;
715
768
  requestDockPanel(options: SpindleDockPanelOptions): SpindleDockPanelHandle;
716
769
  mountApp(options?: SpindleAppMountOptions): SpindleAppMountHandle;
@@ -810,6 +863,17 @@ export interface SpindleFrontendContext {
810
863
  * ```
811
864
  */
812
865
  getActiveChat(): { chatId: string | null; characterId: string | null };
866
+ /**
867
+ * Signal that the frontend is ready to receive any startup messages that
868
+ * were queued while the bundle was loading.
869
+ */
870
+ ready(): void;
871
+ /**
872
+ * Opt out of legacy auto-ready behavior. Call during setup() before it
873
+ * returns if initialization continues asynchronously and startup messages
874
+ * should remain queued until a later `ready()` call.
875
+ */
876
+ deferReady(): void;
813
877
  sendToBackend(payload: unknown): void;
814
878
  onBackendMessage(handler: (payload: unknown) => void): () => void;
815
879
  /** Structured lifecycle hooks for backend-spawned frontend processes. */
package/src/index.ts CHANGED
@@ -193,6 +193,11 @@ export type {
193
193
  SpindleFrontendModule,
194
194
  SpindleDrawerTabOptions,
195
195
  SpindleDrawerTabHandle,
196
+ SpindleCharacterEditorTabOptions,
197
+ SpindleCharacterEditorTabHandle,
198
+ SpindleCharacterEditorState,
199
+ SpindleCharacterEditorSaveOptions,
200
+ SpindleCharacterEditorHelper,
196
201
  SpindleFloatWidgetOptions,
197
202
  SpindleFloatWidgetHandle,
198
203
  SpindleDockEdge,