@nebula-spatial/studio 0.1.1 → 0.1.2

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.
Files changed (42) hide show
  1. package/README.md +2 -0
  2. package/dist/{builders-BAXRR5o5.js → builders-lydx4-Rh.js} +1 -1
  3. package/dist/core/session-persistence-controller.d.ts +55 -0
  4. package/dist/doc/placement-policy.d.ts +4 -0
  5. package/dist/editor/editor.d.ts +3 -1
  6. package/dist/editor/index.d.ts +2 -0
  7. package/dist/editor/session-persistence.d.ts +54 -0
  8. package/dist/editor.js +727 -490
  9. package/dist/{export-evidence-DMNRhgL9.js → export-evidence-z2Ne7Trf.js} +654 -972
  10. package/dist/generalization.js +2 -2
  11. package/dist/index.d.ts +4 -2
  12. package/dist/index.js +226 -219
  13. package/dist/{mjcf-visual-Bt4bUxd1.js → mjcf-visual-IOy-ucto.js} +1 -1
  14. package/dist/persist/indexeddb-store.d.ts +22 -2
  15. package/dist/persist/session.d.ts +22 -0
  16. package/dist/persist/snapshot.d.ts +24 -0
  17. package/dist/{physics-facts-tfQYyNTD.js → physics-facts-D-URIBrt.js} +8 -7
  18. package/dist/{placement-policy-DY_FNRDu.js → placement-policy-C6dV6Tf-.js} +161 -141
  19. package/dist/ports/persistence.d.ts +45 -1
  20. package/dist/project/contracts.d.ts +3 -0
  21. package/dist/remote-asset-resolver-D-UeyDMD.js +311 -0
  22. package/dist/{scene-graph-DBLKAhxa.js → scene-graph-DVOXjMmp.js} +2 -2
  23. package/dist/{scene-session-Cy6vDJ1l.js → scene-session-PhoFXFCY.js} +3365 -3340
  24. package/dist/scene.js +2 -2
  25. package/dist/{session-BRBrCLdd.js → session-2bp8YOA4.js} +2 -2
  26. package/dist/{session-q3uuG7OP.js → session-B3WbC7Y2.js} +1 -1
  27. package/dist/session-B9kEf4xN.js +915 -0
  28. package/dist/{session-DI5tPJxn.js → session-DYThdzLZ.js} +4 -4
  29. package/dist/studio/index.d.ts +5 -0
  30. package/dist/studio/indexeddb-persistence.d.ts +2 -0
  31. package/dist/studio/indexeddb-session-persistence.d.ts +11 -0
  32. package/dist/studio/scene-package-asset-sources.d.ts +14 -0
  33. package/dist/studio.js +1422 -1220
  34. package/dist/{urdf-session-CQir2nb2.js → urdf-session-CRXL4bHf.js} +3 -3
  35. package/dist/{usd-session-DZJnEEOs.js → usd-session-CTzInpNy.js} +2 -2
  36. package/dist/version.d.ts +1 -1
  37. package/dist/view/scene-session.d.ts +5 -1
  38. package/dist/{xacro-DLRXyk60.js → xacro-IpPHTMYs.js} +1 -1
  39. package/package.json +1 -1
  40. package/dist/asset-source-BExlEcRt.js +0 -444
  41. package/dist/editorial-BkAFWfbg.js +0 -83
  42. package/dist/remote-asset-resolver-Cb8cfNmw.js +0 -136
@@ -1,4 +1,4 @@
1
- import { k as v, s as E, b as z } from "./scene-session-Cy6vDJ1l.js";
1
+ import { k as v, s as E, b as z } from "./scene-session-PhoFXFCY.js";
2
2
  import { Group as q, Euler as G, BoxGeometry as N, SphereGeometry as P, CylinderGeometry as $, CapsuleGeometry as I, PlaneGeometry as X, Mesh as j } from "three";
3
3
  function D(f) {
4
4
  const y = f.extension.documents, l = new q();
@@ -4,17 +4,19 @@
4
4
  * implement the same boundaries as a remote asset platform.
5
5
  */
6
6
  import { type ContentAddressedResource } from './content-addressed';
7
- import type { StudioStateSnapshot } from './snapshot';
7
+ import type { StudioSessionSnapshot, StudioStateSnapshot } from './snapshot';
8
8
  import type { StudioAssetResourceLocator } from '../doc/schema';
9
9
  export interface IndexedDbStudioStoreOptions {
10
10
  readonly dbName?: string;
11
11
  readonly indexedDB?: IDBFactory;
12
12
  }
13
13
  export declare const INDEXED_DB_STUDIO_NAME = "sim-studio.indexeddb";
14
- export declare const INDEXED_DB_STUDIO_VERSION = 3;
14
+ export declare const INDEXED_DB_STUDIO_VERSION = 4;
15
15
  export declare const INDEXED_DB_DOCUMENT_STORE = "documents";
16
16
  export declare const INDEXED_DB_RESOURCE_STORE = "resources";
17
17
  export declare const INDEXED_DB_SOURCE_STORE = "asset-sources";
18
+ export declare const INDEXED_DB_SESSION_STORE = "sessions";
19
+ declare const SESSION_FORMAT = "sim-studio.indexeddb-session@1";
18
20
  export declare const INDEXED_DB_STORE_ERROR: {
19
21
  readonly unavailable: "INDEXED_DB_STORE_UNAVAILABLE";
20
22
  readonly openFailed: "INDEXED_DB_STORE_OPEN_FAILED";
@@ -28,6 +30,21 @@ export declare class IndexedDbStoreError extends Error {
28
30
  readonly cause?: unknown;
29
31
  constructor(code: string, message: string, cause?: unknown);
30
32
  }
33
+ export interface IndexedDbSessionRecord {
34
+ readonly format: typeof SESSION_FORMAT;
35
+ readonly schemaVersion: 1;
36
+ readonly snapshot: StudioSessionSnapshot;
37
+ readonly revision: string;
38
+ readonly etag: string;
39
+ readonly savedAt: string;
40
+ }
41
+ export type IndexedDbSessionCommitResult = {
42
+ readonly status: 'saved';
43
+ readonly record: IndexedDbSessionRecord;
44
+ } | {
45
+ readonly status: 'conflict';
46
+ readonly current: IndexedDbSessionRecord;
47
+ };
31
48
  export interface IndexedDbAssetSourceFile {
32
49
  readonly locator: StudioAssetResourceLocator;
33
50
  readonly mediaType?: string;
@@ -59,6 +76,8 @@ export declare class IndexedDbStudioStore {
59
76
  constructor(options?: IndexedDbStudioStoreOptions);
60
77
  load(): Promise<StudioStateSnapshot | null>;
61
78
  save(snapshot: StudioStateSnapshot): Promise<void>;
79
+ loadSessionRecord(): Promise<IndexedDbSessionRecord | null>;
80
+ commitSessionRecord(record: IndexedDbSessionRecord, expectedRevision: string | null): Promise<IndexedDbSessionCommitResult>;
62
81
  loadResources(hashes: readonly string[]): Promise<readonly ContentAddressedResource[]>;
63
82
  saveResources(resources: readonly ContentAddressedResource[]): Promise<void>;
64
83
  loadAssetSource(revisionId: string): Promise<IndexedDbAssetSourceRecord | null>;
@@ -67,3 +86,4 @@ export declare class IndexedDbStudioStore {
67
86
  close(): void;
68
87
  private open;
69
88
  }
89
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { AssetCatalogV3, ResourceManifestV2 } from '../project/contracts';
2
+ import type { StudioAssetClosureRef, StudioSessionSnapshot } from './snapshot';
3
+ export declare const STUDIO_SESSION_ERROR: {
4
+ readonly invalidSnapshot: "STUDIO_SESSION_INVALID_SNAPSHOT";
5
+ readonly documentHashMismatch: "STUDIO_SESSION_DOCUMENT_HASH_MISMATCH";
6
+ readonly unsupportedFormat: "STUDIO_SESSION_UNSUPPORTED_FORMAT";
7
+ };
8
+ export declare class StudioSessionSnapshotError extends Error {
9
+ readonly code: string;
10
+ constructor(code: string, message: string);
11
+ }
12
+ /**
13
+ * Validates the document and editorial halves as one recoverable session.
14
+ * Adapters should call this before persisting and after loading untrusted data.
15
+ */
16
+ export declare function assertStudioSessionSnapshot(snapshot: StudioSessionSnapshot): void;
17
+ export declare function studioSessionSnapshotDigest(snapshot: StudioSessionSnapshot): string;
18
+ export declare function createStudioAssetClosureRef(input: {
19
+ readonly closureId: string;
20
+ readonly assetCatalog: AssetCatalogV3;
21
+ readonly resourceManifest: ResourceManifestV2;
22
+ }): StudioAssetClosureRef;
@@ -1,5 +1,29 @@
1
+ import type { EditorialStateV1 } from '../project/contracts';
2
+ export declare const STUDIO_SESSION_SNAPSHOT_FORMAT: "sim-studio.session@1";
1
3
  /** Scene state shared by browser-local and remote persistence adapters. */
2
4
  export interface StudioStateSnapshot {
3
5
  readonly documentText: string;
4
6
  readonly documentHash: string;
5
7
  }
8
+ /**
9
+ * Stable reference to an immutable asset catalog/resource closure.
10
+ * Resource bytes and source-provider state stay outside the scene snapshot.
11
+ */
12
+ export interface StudioAssetClosureRef {
13
+ readonly closureId: string;
14
+ readonly catalogDigest: string;
15
+ readonly manifestDigest: string;
16
+ }
17
+ /**
18
+ * Complete editor recovery state. The document must be opened before the
19
+ * editorial state is applied because selection and node states reference the
20
+ * document graph.
21
+ */
22
+ export interface StudioSessionSnapshot {
23
+ readonly format: typeof STUDIO_SESSION_SNAPSHOT_FORMAT;
24
+ readonly schemaVersion: 1;
25
+ readonly documentText: string;
26
+ readonly documentHash: string;
27
+ readonly editorial: EditorialStateV1;
28
+ readonly assetClosure: StudioAssetClosureRef | null;
29
+ }
@@ -1,4 +1,4 @@
1
- import { z as w, U, Z as D, _ as M, h as L, a7 as P, E as C, u as z, d as v, a as _, a3 as W, x as V } from "./scene-graph-DBLKAhxa.js";
1
+ import { z as w, U, Z as D, $ as M, h as L, a7 as P, E as C, u as z, d as v, a as _, a3 as W, x as V } from "./scene-graph-DVOXjMmp.js";
2
2
  const G = Object.freeze({
3
3
  local: Object.freeze([0, 0, 0])
4
4
  });
@@ -204,7 +204,7 @@ function X(n, s) {
204
204
  (t) => !W(n.root, t).slice(0, -1).some((a) => e.has(a.nodeId))
205
205
  );
206
206
  }
207
- function H(n, s, o) {
207
+ function $(n, s, o) {
208
208
  const e = X(n, s), t = x(
209
209
  e.flatMap((l) => {
210
210
  var m;
@@ -219,7 +219,7 @@ function H(n, s, o) {
219
219
  pivot: { value: a, source: a ? "bounds-center" : "unknown" }
220
220
  });
221
221
  }
222
- function Q(n, s, o) {
222
+ function H(n, s, o) {
223
223
  const e = w(n.root, s);
224
224
  if (!e) return null;
225
225
  const t = o ?? E(n, e), a = t ? T(t) : null, l = e.nodeType === "group" ? "GROUP_DIMENSIONS" : t ? a.some((u) => !Number.isFinite(u) || u <= 1e-12) ? "DEGENERATE_BOUNDS" : null : "BOUNDS_UNAVAILABLE";
@@ -254,7 +254,7 @@ function j(n) {
254
254
  const o = n.map((t) => t / s), e = 1e-6;
255
255
  return Math.abs(o[0] - 1) <= e && Math.abs(o[1]) <= e && Math.abs(o[2]) <= e ? "+X" : Math.abs(o[0]) <= e && Math.abs(o[1] - 1) <= e && Math.abs(o[2]) <= e ? "+Y" : Math.abs(o[0]) <= e && Math.abs(o[1]) <= e && Math.abs(o[2] - 1) <= e ? "+Z" : null;
256
256
  }
257
- function $(n, s, o) {
257
+ function Q(n, s, o) {
258
258
  var b, f, g;
259
259
  const e = V(n, s);
260
260
  if (!e) return null;
@@ -324,13 +324,14 @@ export {
324
324
  G as D,
325
325
  Z as N,
326
326
  I as a,
327
- $ as b,
328
- H as c,
327
+ Q as b,
328
+ $ as c,
329
329
  J as d,
330
330
  E as e,
331
331
  O as f,
332
- Q as g,
332
+ H as g,
333
333
  Y as h,
334
+ N as i,
334
335
  K as n,
335
336
  k as r,
336
337
  F as t