@lvce-editor/api 8.67.0 → 8.69.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.
- package/README.md +10 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/parts/SecretStorage/SecretStorage.d.ts +3 -0
- package/dist/parts/SecretStorage/SecretStorage.js +10 -0
- package/dist/parts/View/View.d.ts +3 -0
- package/dist/parts/ViewRegistry/ViewRegistry.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,3 +31,13 @@ const view = await createElectronWebContentsView({ url: 'https://example.com' })
|
|
|
31
31
|
const title = await view.executeJavaScript<string>('document.title')
|
|
32
32
|
await view.dispose()
|
|
33
33
|
```
|
|
34
|
+
|
|
35
|
+
Extensions can persist sensitive strings without depending on the editor's browser cache. Values are scoped to the calling extension.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { deleteSecret, getSecret, storeSecret } from '@lvce-editor/api'
|
|
39
|
+
|
|
40
|
+
await storeSecret('access-token', token)
|
|
41
|
+
const savedToken = await getSecret('access-token')
|
|
42
|
+
await deleteSecret('access-token')
|
|
43
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { createElectronWebContentsView } from './parts/ElectronWebContentsView/E
|
|
|
4
4
|
export { executeCommand } from './parts/ExecuteCommand/ExecuteCommand.ts';
|
|
5
5
|
export { showQuickPick } from './parts/QuickPick/QuickPick.ts';
|
|
6
6
|
export { getPreference, setPreference } from './parts/Preferences/Preferences.ts';
|
|
7
|
+
export { deleteSecret, getSecret, storeSecret } from './parts/SecretStorage/SecretStorage.ts';
|
|
7
8
|
export { registerCommand } from './parts/CommandRegistry/CommandRegistry.ts';
|
|
8
9
|
export { registerDebugProvider, resetDebugProviderRegistry } from './parts/Debug/Debug.ts';
|
|
9
10
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from './parts/Completion/Completion.ts';
|
|
@@ -21,7 +22,7 @@ export { executeSourceControlAcceptInput, executeSourceControlAdd, executeSource
|
|
|
21
22
|
export { createViewInstance, dispatchViewEvent, disposeViewInstance, executeViewProvider, getViewRegistrySnapshot, renderViewInstance, registerView, resetViewRegistry, saveViewInstanceState, } from './parts/ViewRegistry/ViewRegistry.ts';
|
|
22
23
|
export { createOutputChannel, getOutputChannelRegistrySnapshot, resetOutputChannelRegistry } from './parts/OutputChannel/OutputChannel.ts';
|
|
23
24
|
export { getStatusBarItemProviderRegistrySnapshot, registerStatusBarItemProvider, resetStatusBarItemProviderRegistry, } from './parts/StatusBar/StatusBar.ts';
|
|
24
|
-
export type { RegisteredView, View, ViewAction, ViewCommand, ViewContext, ViewEvent, ViewKind, MenuEntry, ViewRegistrySnapshot, ViewRenderResult, ViewScrollPosition, ViewSelection, VirtualDomViewInstance, } from './parts/View/View.ts';
|
|
25
|
+
export type { RegisteredView, View, ViewAction, ViewCommand, ViewContext, ViewEvent, ViewKind, ViewPreferredLocation, MenuEntry, ViewRegistrySnapshot, ViewRenderResult, ViewScrollPosition, ViewSelection, VirtualDomViewInstance, } from './parts/View/View.ts';
|
|
25
26
|
export { handleExtensionManagementMessagePort } from './parts/HandleExtensionManagementMessagePort/HandleExtensionManagementMessagePort.ts';
|
|
26
27
|
export { createNodeRpc, createRpc } from './parts/Rpc/Rpc.ts';
|
|
27
28
|
export type { Command } from './parts/Command/Command.ts';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { createElectronWebContentsView } from "./parts/ElectronWebContentsView/E
|
|
|
4
4
|
export { executeCommand } from "./parts/ExecuteCommand/ExecuteCommand.js";
|
|
5
5
|
export { showQuickPick } from "./parts/QuickPick/QuickPick.js";
|
|
6
6
|
export { getPreference, setPreference } from "./parts/Preferences/Preferences.js";
|
|
7
|
+
export { deleteSecret, getSecret, storeSecret } from "./parts/SecretStorage/SecretStorage.js";
|
|
7
8
|
export { registerCommand } from "./parts/CommandRegistry/CommandRegistry.js";
|
|
8
9
|
export { registerDebugProvider, resetDebugProviderRegistry } from "./parts/Debug/Debug.js";
|
|
9
10
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from "./parts/Completion/Completion.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExtensionManagementWorker } from '@lvce-editor/rpc-registry';
|
|
2
|
+
export const deleteSecret = async (key) => {
|
|
3
|
+
await ExtensionManagementWorker.invoke('Extensions.deleteSecret', key);
|
|
4
|
+
};
|
|
5
|
+
export const getSecret = async (key) => {
|
|
6
|
+
return ExtensionManagementWorker.invoke('Extensions.getSecret', key);
|
|
7
|
+
};
|
|
8
|
+
export const storeSecret = async (key, value) => {
|
|
9
|
+
await ExtensionManagementWorker.invoke('Extensions.storeSecret', key, value);
|
|
10
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { VirtualDomNode } from '@lvce-editor/virtual-dom-worker';
|
|
2
2
|
export type ViewKind = 'virtualDom';
|
|
3
|
+
export type ViewPreferredLocation = 'preview' | 'sideBar';
|
|
3
4
|
export interface ViewContext {
|
|
4
5
|
readonly requestRerender: () => Promise<void>;
|
|
5
6
|
readonly showContextMenu: (menuId: string, x: number, y: number) => Promise<void>;
|
|
@@ -68,6 +69,7 @@ export interface View<State = unknown> {
|
|
|
68
69
|
readonly id: string;
|
|
69
70
|
readonly kind?: ViewKind;
|
|
70
71
|
readonly name?: string;
|
|
72
|
+
readonly preferredLocation?: ViewPreferredLocation;
|
|
71
73
|
readonly title?: string;
|
|
72
74
|
}
|
|
73
75
|
export interface RegisteredView {
|
|
@@ -77,6 +79,7 @@ export interface RegisteredView {
|
|
|
77
79
|
readonly id: string;
|
|
78
80
|
readonly kind?: ViewKind;
|
|
79
81
|
readonly name?: string;
|
|
82
|
+
readonly preferredLocation: ViewPreferredLocation;
|
|
80
83
|
readonly title?: string;
|
|
81
84
|
}
|
|
82
85
|
export interface ViewRegistrySnapshot {
|
|
@@ -86,6 +86,9 @@ const assertView = (view) => {
|
|
|
86
86
|
if (view.id in views) {
|
|
87
87
|
throw new ExtensionApiError(`view ${view.id} is already registered`);
|
|
88
88
|
}
|
|
89
|
+
if (view.preferredLocation !== undefined && view.preferredLocation !== 'preview' && view.preferredLocation !== 'sideBar') {
|
|
90
|
+
throw new ExtensionApiError(`view ${view.id} has invalid preferredLocation`);
|
|
91
|
+
}
|
|
89
92
|
assertCommands(view);
|
|
90
93
|
assertEventListeners(view);
|
|
91
94
|
};
|
|
@@ -97,6 +100,7 @@ const toRegisteredView = (view) => {
|
|
|
97
100
|
icon: view.icon,
|
|
98
101
|
id: view.id,
|
|
99
102
|
name: view.name,
|
|
103
|
+
preferredLocation: view.preferredLocation || 'sideBar',
|
|
100
104
|
title: displayName,
|
|
101
105
|
};
|
|
102
106
|
if (view.kind) {
|