@volter/editor-live 0.5.65 → 0.5.67
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/BUNDLED_NOTICES +4 -4
- package/dist/editor-document.d.ts +7 -0
- package/dist/editor.d.ts +18 -4
- package/dist/index.js +92 -10
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
- package/src/editor-document.ts +14 -1
- package/src/editor.ts +28 -5
package/BUNDLED_NOTICES
CHANGED
|
@@ -3,9 +3,9 @@ Bundled license notices
|
|
|
3
3
|
These notices accompany code incorporated into this package. Separate npm dependencies retain their own licenses.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
@volter/editor-project@0.5.
|
|
6
|
+
@volter/editor-project@0.5.67
|
|
7
7
|
Declared license: Apache-2.0
|
|
8
|
-
Source: the unmodified npm package @volter/editor-project@0.5.
|
|
8
|
+
Source: the unmodified npm package @volter/editor-project@0.5.67, from https://github.com/volter-ai/editor.git
|
|
9
9
|
|
|
10
10
|
--- packages/editor-project/LICENSE ---
|
|
11
11
|
|
|
@@ -213,9 +213,9 @@ Source: the unmodified npm package @volter/editor-project@0.5.65, from https://g
|
|
|
213
213
|
limitations under the License.
|
|
214
214
|
|
|
215
215
|
|
|
216
|
-
@volter/editor-sdk@0.5.
|
|
216
|
+
@volter/editor-sdk@0.5.67
|
|
217
217
|
Declared license: Apache-2.0
|
|
218
|
-
Source: the unmodified npm package @volter/editor-sdk@0.5.
|
|
218
|
+
Source: the unmodified npm package @volter/editor-sdk@0.5.67, from https://github.com/volter-ai/editor.git
|
|
219
219
|
|
|
220
220
|
--- packages/editor-sdk/LICENSE ---
|
|
221
221
|
|
|
@@ -50,6 +50,8 @@ export interface DocumentKeyOptions extends DocumentGestureOptions {
|
|
|
50
50
|
metaKey?: boolean;
|
|
51
51
|
shiftKey?: boolean;
|
|
52
52
|
altKey?: boolean;
|
|
53
|
+
/** Hold the key this long before releasing it (a person holding W). */
|
|
54
|
+
holdMs?: number;
|
|
53
55
|
}
|
|
54
56
|
export interface DocumentPasteOptions extends DocumentGestureOptions {
|
|
55
57
|
selector?: string;
|
|
@@ -89,6 +91,7 @@ export declare class LiveEditorDocument {
|
|
|
89
91
|
* — not `element.click()`, which a `pointerdown` listener never sees. */
|
|
90
92
|
click(selector: string, options?: DocumentGestureOptions & {
|
|
91
93
|
clicks?: number;
|
|
94
|
+
at?: [number, number];
|
|
92
95
|
}): Promise<DocumentProbeResult>;
|
|
93
96
|
/**
|
|
94
97
|
* TYPE into a field and commit with Enter, the way a person does — one
|
|
@@ -123,6 +126,10 @@ export declare class LiveEditorDocument {
|
|
|
123
126
|
ctrlKey?: boolean;
|
|
124
127
|
metaKey?: boolean;
|
|
125
128
|
shiftKey?: boolean;
|
|
129
|
+
/** 0 primary (default), 1 middle, 2 secondary. */
|
|
130
|
+
button?: 0 | 1 | 2;
|
|
131
|
+
/** `via`/`to` may leave the element's box after the press (a handle drag). */
|
|
132
|
+
leave?: boolean;
|
|
126
133
|
}): Promise<DocumentProbeResult>;
|
|
127
134
|
/** A real keydown/keyup on the target, or on whatever inside the document has focus. */
|
|
128
135
|
key(key: string, options?: DocumentKeyOptions): Promise<DocumentProbeResult>;
|
package/dist/editor.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare class LiveEditor {
|
|
|
28
28
|
readonly document: LiveEditorDocument;
|
|
29
29
|
constructor(client: EditorClient);
|
|
30
30
|
/**
|
|
31
|
-
* THE BLENDER LANE'S VERBS, from `volter-editor eval`.
|
|
31
|
+
* THE BLENDER LANE'S VERBS, from `volter-model-editor eval`.
|
|
32
32
|
*
|
|
33
33
|
* Blender runs headless in the editor tab's worker (ARCHITECTURE-CORE, "THE
|
|
34
34
|
* BLENDER IN THE TAB IS BLENDER") and answers `blender-start`,
|
|
@@ -40,7 +40,7 @@ export declare class LiveEditor {
|
|
|
40
40
|
* per question — the same discovery failure `eval-surface.ts`'s header
|
|
41
41
|
* records, in a lane that had not noticed it yet.
|
|
42
42
|
*
|
|
43
|
-
* volter-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
43
|
+
* volter-model-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
44
44
|
*
|
|
45
45
|
* `blender-status` is the only verb that creates nothing: it answers whether
|
|
46
46
|
* this tab already has a session without starting one.
|
|
@@ -70,6 +70,9 @@ export declare class LiveEditor {
|
|
|
70
70
|
* `@volter/editor-sdk`'s `CaptureDimensions`.
|
|
71
71
|
* Supply a view to present and photograph it in one editor request.
|
|
72
72
|
*/
|
|
73
|
+
/** The active document's RENDER alone, at the size asked for: what the document draws,
|
|
74
|
+
* without what the viewport draws over it (its navigation gizmo, its readouts). To see a
|
|
75
|
+
* stage as the person does, use `captureEditorChrome({ region: 'document' })`. */
|
|
73
76
|
captureActiveDocument(size?: CaptureDimensions, view?: EditorView): Promise<ActiveDocumentCapture>;
|
|
74
77
|
/**
|
|
75
78
|
* Photograph the editor PAGE — every panel, tab strip and viewport as the
|
|
@@ -159,12 +162,21 @@ export declare class LiveEditor {
|
|
|
159
162
|
*/
|
|
160
163
|
workspace(id: EditorWorkspaceName): Promise<void>;
|
|
161
164
|
/**
|
|
162
|
-
* Apply a STYLE BUNDLE by id — the chrome's palette, material
|
|
163
|
-
*
|
|
165
|
+
* Apply a STYLE BUNDLE by id — the chrome's palette, material and icon set in
|
|
166
|
+
* one gesture, the session door beside
|
|
164
167
|
* `View → <Style> Style`. A bundle the open project does not offer refuses
|
|
165
168
|
* and names the vocabulary; `currentView().style` reports the one worn.
|
|
166
169
|
*/
|
|
167
170
|
style(id: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* A document stage's viewport PRESENTATION — its draw mode, lighting, backdrop and overlays
|
|
173
|
+
* (`@volter/editor-sdk/kit/viewport-presentation`) — resolved. With `layer`, that choice is
|
|
174
|
+
* recorded for the view first, as a person's toolbar change would be, e.g.
|
|
175
|
+
* `presentation('model:src/models/cube.blend', { all: { lighting: { studioPreset: 'kit' } } })`.
|
|
176
|
+
* With a STRING, the named view of that id (`*.view.ts`, e.g. `'godot'`) is put on the view
|
|
177
|
+
* whole; the answer's `viewPresets` lists the ones registered.
|
|
178
|
+
*/
|
|
179
|
+
presentation(documentId: string, layer?: Parameters<EditorClient['viewportPresentation']>[1]): ReturnType<EditorClient['viewportPresentation']>;
|
|
168
180
|
/**
|
|
169
181
|
* Set the MATERIAL apart from the bundle that usually carries it.
|
|
170
182
|
* Appearance is palette × material, independent axes by ruling, so
|
|
@@ -392,6 +404,8 @@ export declare class LiveEditor {
|
|
|
392
404
|
* queue — the same one the keyboard shortcut drives. */
|
|
393
405
|
undo(): Promise<HistoryStep>;
|
|
394
406
|
redo(): Promise<HistoryStep>;
|
|
407
|
+
/** Reload the editor's page and resolve once the new document answers. */
|
|
408
|
+
reloadPage(): Promise<void>;
|
|
395
409
|
/** Mirrors `vgai status` — the full live editor state as JSON. */
|
|
396
410
|
status(): Promise<EditorState>;
|
|
397
411
|
/** A live viewport PNG (`EditorClient.captureViewport`) — no direct CLI verb exists; this is the closest wire read. */
|
package/dist/index.js
CHANGED
|
@@ -558,10 +558,21 @@ var EditorClient = class {
|
|
|
558
558
|
}
|
|
559
559
|
/** Apply a STYLE BUNDLE — palette, material, icon set and region defaults
|
|
560
560
|
* in one gesture (`classic`/`glass`/`maya`/`substance`, or one a package
|
|
561
|
-
* the project
|
|
561
|
+
* the project or product composes carries, such as `blender`). */
|
|
562
562
|
async setStyle(style) {
|
|
563
563
|
await this.command({ type: "set-style", style });
|
|
564
564
|
}
|
|
565
|
+
/** A document stage's viewport PRESENTATION (`kit/viewport-presentation`), resolved; with a
|
|
566
|
+
* `layer`, that choice is recorded for the view first, as the toolbar records it. */
|
|
567
|
+
/** A view's presentation, answered resolved. With a LAYER the person's choice is recorded
|
|
568
|
+
* first; with a STRING, the named view (`*.view.ts`) of that id is put on the view whole. */
|
|
569
|
+
async viewportPresentation(documentId, layer) {
|
|
570
|
+
return this.command({
|
|
571
|
+
type: "viewport-presentation",
|
|
572
|
+
documentId,
|
|
573
|
+
...typeof layer === "string" ? { preset: layer } : layer ? { layer } : {}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
565
576
|
/** Set the MATERIAL apart from the bundle that usually carries it.
|
|
566
577
|
* Answers with what the chrome wears afterwards. */
|
|
567
578
|
async setAppearance(appearance) {
|
|
@@ -772,7 +783,8 @@ var EditorClient = class {
|
|
|
772
783
|
async captureEditorChrome(options) {
|
|
773
784
|
return this.command({
|
|
774
785
|
type: "capture-editor-chrome",
|
|
775
|
-
...options?.scale === void 0 ? {} : { scale: options.scale }
|
|
786
|
+
...options?.scale === void 0 ? {} : { scale: options.scale },
|
|
787
|
+
...options?.region === void 0 ? {} : { region: options.region }
|
|
776
788
|
});
|
|
777
789
|
}
|
|
778
790
|
/** With a view, present and capture it in one request so document discovery
|
|
@@ -960,6 +972,50 @@ var EditorClient = class {
|
|
|
960
972
|
async documentTable() {
|
|
961
973
|
return this.command({ type: "document-table" });
|
|
962
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* Reload the editor's page and wait until the new document answers — the
|
|
977
|
+
* host's `page-reload`, for a product with no game client (`@volter/game-live`'s
|
|
978
|
+
* `page.reload()` is the same order with the same two witnesses). A tab's
|
|
979
|
+
* epoch count rising proves a new document loaded; a host command answering
|
|
980
|
+
* proves it can be driven. It is sent only once that tab reports its command
|
|
981
|
+
* listener ready, because a command sent before is filed as a stall.
|
|
982
|
+
*/
|
|
983
|
+
async reloadPage(timeoutMs = 6e4) {
|
|
984
|
+
const epochs = async () => {
|
|
985
|
+
const tabs = (await this.getState().catch(() => ({ tabs: [] }))).tabs ?? [];
|
|
986
|
+
const byTab = tabs;
|
|
987
|
+
return new Map(byTab.map((tab) => [tab.tabId8, tab]));
|
|
988
|
+
};
|
|
989
|
+
const pause = () => new Promise((settle) => setTimeout(settle, 250));
|
|
990
|
+
const before = await epochs();
|
|
991
|
+
const deadline = Date.now() + timeoutMs;
|
|
992
|
+
await this.command({ type: "page-reload" });
|
|
993
|
+
let reloaded = [];
|
|
994
|
+
while (reloaded.length === 0) {
|
|
995
|
+
if (Date.now() > deadline) throw new Error("The reload was ordered and no tab of this session reported a new page load.");
|
|
996
|
+
await pause();
|
|
997
|
+
const now = await epochs();
|
|
998
|
+
reloaded = [...now].filter(([tabId, tab]) => tab.epochCount > (before.get(tabId)?.epochCount ?? 0)).map(([tabId]) => tabId);
|
|
999
|
+
}
|
|
1000
|
+
for (; ; ) {
|
|
1001
|
+
if (Date.now() > deadline) throw new Error("A new page loaded, but its command listener did not become ready.");
|
|
1002
|
+
const now = await epochs();
|
|
1003
|
+
if (reloaded.some((tabId) => {
|
|
1004
|
+
const listener = now.get(tabId)?.commandListener;
|
|
1005
|
+
return typeof listener !== "string" || listener === "ready";
|
|
1006
|
+
})) break;
|
|
1007
|
+
await pause();
|
|
1008
|
+
}
|
|
1009
|
+
for (; ; ) {
|
|
1010
|
+
try {
|
|
1011
|
+
await this.command({ type: "current-view" });
|
|
1012
|
+
return;
|
|
1013
|
+
} catch (error) {
|
|
1014
|
+
if (Date.now() > deadline) throw error;
|
|
1015
|
+
await pause();
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
963
1019
|
async getState() {
|
|
964
1020
|
const res = await this.httpFetch(`${this.baseUrl}/__editor/state`);
|
|
965
1021
|
const state = await this.readJson(res);
|
|
@@ -1114,12 +1170,15 @@ var LiveEditorDocument = class {
|
|
|
1114
1170
|
/** A REAL pointer gesture (pointerdown/mousedown/focus/pointerup/mouseup/click)
|
|
1115
1171
|
* — not `element.click()`, which a `pointerdown` listener never sees. */
|
|
1116
1172
|
async click(selector, options) {
|
|
1173
|
+
const unknown = Object.keys(options ?? {}).filter((key) => !["scope", "index", "clicks", "at"].includes(key));
|
|
1174
|
+
if (unknown.length > 0) throw new Error(`click has no option ${unknown.map((key) => `\`${key}\``).join(", ")}; its options are scope, index, clicks and at ([x, y] fractions of the element's box).`);
|
|
1117
1175
|
return this.#probe({
|
|
1118
1176
|
action: "click",
|
|
1119
1177
|
selector,
|
|
1120
1178
|
...options?.scope === void 0 ? {} : { scope: options.scope },
|
|
1121
1179
|
...options?.index === void 0 ? {} : { index: options.index },
|
|
1122
|
-
...options?.clicks === void 0 ? {} : { clicks: options.clicks }
|
|
1180
|
+
...options?.clicks === void 0 ? {} : { clicks: options.clicks },
|
|
1181
|
+
...options?.at === void 0 ? {} : { at: options.at }
|
|
1123
1182
|
});
|
|
1124
1183
|
}
|
|
1125
1184
|
/**
|
|
@@ -1161,7 +1220,9 @@ var LiveEditorDocument = class {
|
|
|
1161
1220
|
...options.altKey === void 0 ? {} : { altKey: options.altKey },
|
|
1162
1221
|
...options.ctrlKey === void 0 ? {} : { ctrlKey: options.ctrlKey },
|
|
1163
1222
|
...options.metaKey === void 0 ? {} : { metaKey: options.metaKey },
|
|
1164
|
-
...options.shiftKey === void 0 ? {} : { shiftKey: options.shiftKey }
|
|
1223
|
+
...options.shiftKey === void 0 ? {} : { shiftKey: options.shiftKey },
|
|
1224
|
+
...options.button === void 0 ? {} : { button: options.button },
|
|
1225
|
+
...options.leave === void 0 ? {} : { leave: options.leave }
|
|
1165
1226
|
});
|
|
1166
1227
|
}
|
|
1167
1228
|
/** A real keydown/keyup on the target, or on whatever inside the document has focus. */
|
|
@@ -1252,7 +1313,7 @@ function inferAssetKind(path) {
|
|
|
1252
1313
|
return EXTENSION_KIND[ext] ?? "json";
|
|
1253
1314
|
}
|
|
1254
1315
|
var LiveEditor = class {
|
|
1255
|
-
/** `#`-private, not `private`: `volter-editor eval --list` enumerates this object's
|
|
1316
|
+
/** `#`-private, not `private`: `volter-model-editor eval --list` enumerates this object's
|
|
1256
1317
|
* real runtime members, and TypeScript's erased `private` would leave the
|
|
1257
1318
|
* raw `EditorClient` advertised beside them. */
|
|
1258
1319
|
#client;
|
|
@@ -1270,7 +1331,7 @@ var LiveEditor = class {
|
|
|
1270
1331
|
this.document = new LiveEditorDocument(client);
|
|
1271
1332
|
}
|
|
1272
1333
|
/**
|
|
1273
|
-
* THE BLENDER LANE'S VERBS, from `volter-editor eval`.
|
|
1334
|
+
* THE BLENDER LANE'S VERBS, from `volter-model-editor eval`.
|
|
1274
1335
|
*
|
|
1275
1336
|
* Blender runs headless in the editor tab's worker (ARCHITECTURE-CORE, "THE
|
|
1276
1337
|
* BLENDER IN THE TAB IS BLENDER") and answers `blender-start`,
|
|
@@ -1282,7 +1343,7 @@ var LiveEditor = class {
|
|
|
1282
1343
|
* per question — the same discovery failure `eval-surface.ts`'s header
|
|
1283
1344
|
* records, in a lane that had not noticed it yet.
|
|
1284
1345
|
*
|
|
1285
|
-
* volter-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
1346
|
+
* volter-model-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
1286
1347
|
*
|
|
1287
1348
|
* `blender-status` is the only verb that creates nothing: it answers whether
|
|
1288
1349
|
* this tab already has a session without starting one.
|
|
@@ -1321,6 +1382,9 @@ var LiveEditor = class {
|
|
|
1321
1382
|
* `@volter/editor-sdk`'s `CaptureDimensions`.
|
|
1322
1383
|
* Supply a view to present and photograph it in one editor request.
|
|
1323
1384
|
*/
|
|
1385
|
+
/** The active document's RENDER alone, at the size asked for: what the document draws,
|
|
1386
|
+
* without what the viewport draws over it (its navigation gizmo, its readouts). To see a
|
|
1387
|
+
* stage as the person does, use `captureEditorChrome({ region: 'document' })`. */
|
|
1324
1388
|
async captureActiveDocument(size, view) {
|
|
1325
1389
|
return this.#client.captureActiveDocument(size, view);
|
|
1326
1390
|
}
|
|
@@ -1420,14 +1484,25 @@ var LiveEditor = class {
|
|
|
1420
1484
|
await this.#client.setWorkspace(id);
|
|
1421
1485
|
}
|
|
1422
1486
|
/**
|
|
1423
|
-
* Apply a STYLE BUNDLE by id — the chrome's palette, material
|
|
1424
|
-
*
|
|
1487
|
+
* Apply a STYLE BUNDLE by id — the chrome's palette, material and icon set in
|
|
1488
|
+
* one gesture, the session door beside
|
|
1425
1489
|
* `View → <Style> Style`. A bundle the open project does not offer refuses
|
|
1426
1490
|
* and names the vocabulary; `currentView().style` reports the one worn.
|
|
1427
1491
|
*/
|
|
1428
1492
|
async style(id) {
|
|
1429
1493
|
await this.#client.setStyle(id);
|
|
1430
1494
|
}
|
|
1495
|
+
/**
|
|
1496
|
+
* A document stage's viewport PRESENTATION — its draw mode, lighting, backdrop and overlays
|
|
1497
|
+
* (`@volter/editor-sdk/kit/viewport-presentation`) — resolved. With `layer`, that choice is
|
|
1498
|
+
* recorded for the view first, as a person's toolbar change would be, e.g.
|
|
1499
|
+
* `presentation('model:src/models/cube.blend', { all: { lighting: { studioPreset: 'kit' } } })`.
|
|
1500
|
+
* With a STRING, the named view of that id (`*.view.ts`, e.g. `'godot'`) is put on the view
|
|
1501
|
+
* whole; the answer's `viewPresets` lists the ones registered.
|
|
1502
|
+
*/
|
|
1503
|
+
async presentation(documentId, layer) {
|
|
1504
|
+
return this.#client.viewportPresentation(documentId, layer);
|
|
1505
|
+
}
|
|
1431
1506
|
/**
|
|
1432
1507
|
* Set the MATERIAL apart from the bundle that usually carries it.
|
|
1433
1508
|
* Appearance is palette × material, independent axes by ruling, so
|
|
@@ -1710,6 +1785,10 @@ var LiveEditor = class {
|
|
|
1710
1785
|
async redo() {
|
|
1711
1786
|
return this.#client.redo();
|
|
1712
1787
|
}
|
|
1788
|
+
/** Reload the editor's page and resolve once the new document answers. */
|
|
1789
|
+
async reloadPage() {
|
|
1790
|
+
await this.#client.reloadPage();
|
|
1791
|
+
}
|
|
1713
1792
|
/** Mirrors `vgai status` — the full live editor state as JSON. */
|
|
1714
1793
|
async status() {
|
|
1715
1794
|
return this.#client.getState();
|
|
@@ -1818,7 +1897,10 @@ import { createRequire } from "node:module";
|
|
|
1818
1897
|
import { dirname, join as join2 } from "node:path";
|
|
1819
1898
|
import { pathToFileURL } from "node:url";
|
|
1820
1899
|
var PRODUCT_DECLARATION_KEY = "vgai.product";
|
|
1821
|
-
var PRODUCT_INSTALL_LINES = [
|
|
1900
|
+
var PRODUCT_INSTALL_LINES = [
|
|
1901
|
+
" npm install --save-dev @volter/model-editor",
|
|
1902
|
+
" npm install --save-dev @volter/game-editor"
|
|
1903
|
+
];
|
|
1822
1904
|
var PRODUCT_CREATE_LINES = [" npx @volter/editor create <name>"];
|
|
1823
1905
|
var PRODUCT_COLOR_THEMES = ["dark", "light"];
|
|
1824
1906
|
function readProductManifest(packageDir) {
|