@volter/editor-live 0.5.65 → 0.5.66

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 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.65
6
+ @volter/editor-project@0.5.66
7
7
  Declared license: Apache-2.0
8
- Source: the unmodified npm package @volter/editor-project@0.5.65, from https://github.com/volter-ai/editor.git
8
+ Source: the unmodified npm package @volter/editor-project@0.5.66, 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.65
216
+ @volter/editor-sdk@0.5.66
217
217
  Declared license: Apache-2.0
218
- Source: the unmodified npm package @volter/editor-sdk@0.5.65, from https://github.com/volter-ai/editor.git
218
+ Source: the unmodified npm package @volter/editor-sdk@0.5.66, 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;
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, icon set and
163
- * region defaults in one gesture, the session door beside
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 declares carries, `blender`). */
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);
@@ -1252,7 +1308,7 @@ function inferAssetKind(path) {
1252
1308
  return EXTENSION_KIND[ext] ?? "json";
1253
1309
  }
1254
1310
  var LiveEditor = class {
1255
- /** `#`-private, not `private`: `volter-editor eval --list` enumerates this object's
1311
+ /** `#`-private, not `private`: `volter-model-editor eval --list` enumerates this object's
1256
1312
  * real runtime members, and TypeScript's erased `private` would leave the
1257
1313
  * raw `EditorClient` advertised beside them. */
1258
1314
  #client;
@@ -1270,7 +1326,7 @@ var LiveEditor = class {
1270
1326
  this.document = new LiveEditorDocument(client);
1271
1327
  }
1272
1328
  /**
1273
- * THE BLENDER LANE'S VERBS, from `volter-editor eval`.
1329
+ * THE BLENDER LANE'S VERBS, from `volter-model-editor eval`.
1274
1330
  *
1275
1331
  * Blender runs headless in the editor tab's worker (ARCHITECTURE-CORE, "THE
1276
1332
  * BLENDER IN THE TAB IS BLENDER") and answers `blender-start`,
@@ -1282,7 +1338,7 @@ var LiveEditor = class {
1282
1338
  * per question — the same discovery failure `eval-surface.ts`'s header
1283
1339
  * records, in a lane that had not noticed it yet.
1284
1340
  *
1285
- * volter-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
1341
+ * volter-model-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
1286
1342
  *
1287
1343
  * `blender-status` is the only verb that creates nothing: it answers whether
1288
1344
  * this tab already has a session without starting one.
@@ -1321,6 +1377,9 @@ var LiveEditor = class {
1321
1377
  * `@volter/editor-sdk`'s `CaptureDimensions`.
1322
1378
  * Supply a view to present and photograph it in one editor request.
1323
1379
  */
1380
+ /** The active document's RENDER alone, at the size asked for: what the document draws,
1381
+ * without what the viewport draws over it (its navigation gizmo, its readouts). To see a
1382
+ * stage as the person does, use `captureEditorChrome({ region: 'document' })`. */
1324
1383
  async captureActiveDocument(size, view) {
1325
1384
  return this.#client.captureActiveDocument(size, view);
1326
1385
  }
@@ -1420,14 +1479,25 @@ var LiveEditor = class {
1420
1479
  await this.#client.setWorkspace(id);
1421
1480
  }
1422
1481
  /**
1423
- * Apply a STYLE BUNDLE by id — the chrome's palette, material, icon set and
1424
- * region defaults in one gesture, the session door beside
1482
+ * Apply a STYLE BUNDLE by id — the chrome's palette, material and icon set in
1483
+ * one gesture, the session door beside
1425
1484
  * `View → <Style> Style`. A bundle the open project does not offer refuses
1426
1485
  * and names the vocabulary; `currentView().style` reports the one worn.
1427
1486
  */
1428
1487
  async style(id) {
1429
1488
  await this.#client.setStyle(id);
1430
1489
  }
1490
+ /**
1491
+ * A document stage's viewport PRESENTATION — its draw mode, lighting, backdrop and overlays
1492
+ * (`@volter/editor-sdk/kit/viewport-presentation`) — resolved. With `layer`, that choice is
1493
+ * recorded for the view first, as a person's toolbar change would be, e.g.
1494
+ * `presentation('model:src/models/cube.blend', { all: { lighting: { studioPreset: 'kit' } } })`.
1495
+ * With a STRING, the named view of that id (`*.view.ts`, e.g. `'godot'`) is put on the view
1496
+ * whole; the answer's `viewPresets` lists the ones registered.
1497
+ */
1498
+ async presentation(documentId, layer) {
1499
+ return this.#client.viewportPresentation(documentId, layer);
1500
+ }
1431
1501
  /**
1432
1502
  * Set the MATERIAL apart from the bundle that usually carries it.
1433
1503
  * Appearance is palette × material, independent axes by ruling, so
@@ -1710,6 +1780,10 @@ var LiveEditor = class {
1710
1780
  async redo() {
1711
1781
  return this.#client.redo();
1712
1782
  }
1783
+ /** Reload the editor's page and resolve once the new document answers. */
1784
+ async reloadPage() {
1785
+ await this.#client.reloadPage();
1786
+ }
1713
1787
  /** Mirrors `vgai status` — the full live editor state as JSON. */
1714
1788
  async status() {
1715
1789
  return this.#client.getState();
@@ -1818,7 +1892,10 @@ import { createRequire } from "node:module";
1818
1892
  import { dirname, join as join2 } from "node:path";
1819
1893
  import { pathToFileURL } from "node:url";
1820
1894
  var PRODUCT_DECLARATION_KEY = "vgai.product";
1821
- var PRODUCT_INSTALL_LINES = [" npm install --save-dev @volter/editor"];
1895
+ var PRODUCT_INSTALL_LINES = [
1896
+ " npm install --save-dev @volter/model-editor",
1897
+ " npm install --save-dev @volter/game-editor"
1898
+ ];
1822
1899
  var PRODUCT_CREATE_LINES = [" npx @volter/editor create <name>"];
1823
1900
  var PRODUCT_COLOR_THEMES = ["dark", "light"];
1824
1901
  function readProductManifest(packageDir) {