@lvce-editor/api 8.68.0 → 8.70.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/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { executeSourceControlAcceptInput, executeSourceControlAdd, executeSource
|
|
|
22
22
|
export { createViewInstance, dispatchViewEvent, disposeViewInstance, executeViewProvider, getViewRegistrySnapshot, renderViewInstance, registerView, resetViewRegistry, saveViewInstanceState, } from './parts/ViewRegistry/ViewRegistry.ts';
|
|
23
23
|
export { createOutputChannel, getOutputChannelRegistrySnapshot, resetOutputChannelRegistry } from './parts/OutputChannel/OutputChannel.ts';
|
|
24
24
|
export { getStatusBarItemProviderRegistrySnapshot, registerStatusBarItemProvider, resetStatusBarItemProviderRegistry, } from './parts/StatusBar/StatusBar.ts';
|
|
25
|
-
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';
|
|
26
26
|
export { handleExtensionManagementMessagePort } from './parts/HandleExtensionManagementMessagePort/HandleExtensionManagementMessagePort.ts';
|
|
27
27
|
export { createNodeRpc, createRpc } from './parts/Rpc/Rpc.ts';
|
|
28
28
|
export type { Command } from './parts/Command/Command.ts';
|
|
@@ -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) {
|