@vscode/web-editors 0.0.2-105 → 0.0.2-107

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/index.d.ts CHANGED
@@ -2751,6 +2751,19 @@ declare class VsCodeAppHostClient {
2751
2751
  configureEditorAssociation(extension: string, options?: {
2752
2752
  dismissable?: boolean;
2753
2753
  }): Promise<EditorAssociationResult>;
2754
+ /**
2755
+ * This editor tab's view state, or `undefined` when none is set. VS Code
2756
+ * restores it with the tab (for example after a window reload); a newly
2757
+ * opened tab starts without one. Validate it like any other persisted
2758
+ * input, since it may come from an older version of the app.
2759
+ */
2760
+ getViewState(): Promise<unknown>;
2761
+ /**
2762
+ * Replace this editor tab's view state with a JSON value, for example
2763
+ * scroll positions or selections. Use per-app storage for state shared by
2764
+ * every tab. Rejects for values too large to persist and in embedded apps.
2765
+ */
2766
+ setViewState(value: unknown): Promise<void>;
2754
2767
  }
2755
2768
  //#endregion
2756
2769
  export { AppContext, type ConnectionInput, ContentEdit, ContentType, EditorAssociationResult, EditorCapabilities, EditorRegistrationStatus, EditorScope, EmbeddedAppAccessOptions, EmbeddedAppDescriptor, EmbeddedAppHandle, EmbeddingContext, type Event, HostCapabilities, HostTransport, type IDisposable, JsonFormatOptions, JsonValue, type MessageEndpoint, type MessageLikeEvent, PresentationMode, PresentationPreferences, ScopeRegistration, TextEdit, VsCodeAppEmbeddingEventsProxy, VsCodeAppHostClient, VsCodeAppHostClientOptions, VsCodeAppHostProxy, WebEditorClient, WebEditorClientOptions, WebEditorClientState, WebEditorClientTransportProxy, WebEditorHost, WebEditorHostOptions, WebEditorHostProxy, WebEditorHostTransportProxy, WebEditorPresentationHostProxy, WebEditorPresentationProxy, WebEditorProxy, WebEditorUpdate, WindowMessageTransport, applyContentEdits, applyTextEdits, createWindowParentConnection, decodeFromEditor, encodeForEditor, vscodeAppEmbeddingEventsInterface, vscodeAppHostInterface, webEditorClientTransportInterface, webEditorHostInterface, webEditorHostTransportInterface, webEditorInterface, webEditorPresentationHostInterface, webEditorPresentationInterface };
package/dist/index.js CHANGED
@@ -4315,7 +4315,21 @@ const vscodeAppHostInterface = defineInterface({
4315
4315
  workspace: zScopeRegistration,
4316
4316
  hasWorkspace: boolean(),
4317
4317
  changed: boolean()
4318
- }))
4318
+ })),
4319
+ /**
4320
+ * The view state of this editor tab, such as scroll positions or
4321
+ * selections, as last set by {@link setViewState}. `value` is omitted
4322
+ * when none is set. VS Code restores it when it restores the tab (for
4323
+ * example after a window reload), but a newly opened tab starts
4324
+ * without one. Only the top-level app of a tab has view state.
4325
+ */
4326
+ getViewState: requestType(object({}), object({ value: zJsonValue.optional() })),
4327
+ /**
4328
+ * Replace this editor tab's view state with a JSON value. The host
4329
+ * rejects values too large to persist with the tab, and calls from
4330
+ * embedded apps.
4331
+ */
4332
+ setViewState: requestType(object({ value: zJsonValue }), object({}))
4319
4333
  });
4320
4334
  /** Host-to-parent notifications for loaded child runtime changes. */
4321
4335
  const vscodeAppEmbeddingEventsInterface = defineInterface({
@@ -5215,6 +5229,23 @@ var VsCodeAppHostClient = class {
5215
5229
  dismissable: options?.dismissable
5216
5230
  });
5217
5231
  }
5232
+ /**
5233
+ * This editor tab's view state, or `undefined` when none is set. VS Code
5234
+ * restores it with the tab (for example after a window reload); a newly
5235
+ * opened tab starts without one. Validate it like any other persisted
5236
+ * input, since it may come from an older version of the app.
5237
+ */
5238
+ async getViewState() {
5239
+ return (await this._host.getViewState({})).value;
5240
+ }
5241
+ /**
5242
+ * Replace this editor tab's view state with a JSON value, for example
5243
+ * scroll positions or selections. Use per-app storage for state shared by
5244
+ * every tab. Rejects for values too large to persist and in embedded apps.
5245
+ */
5246
+ async setViewState(value) {
5247
+ await this._host.setViewState({ value });
5248
+ }
5218
5249
  };
5219
5250
  //#endregion
5220
5251
  export { EmbeddedAppHandle, VsCodeAppHostClient, WebEditorClient, WebEditorHost, WindowMessageTransport, applyContentEdits, applyTextEdits, createWindowParentConnection, decodeFromEditor, encodeForEditor, vscodeAppEmbeddingEventsInterface, vscodeAppHostInterface, webEditorClientTransportInterface, webEditorHostInterface, webEditorHostTransportInterface, webEditorInterface, webEditorPresentationHostInterface, webEditorPresentationInterface };