@nebula-spatial/cad-loader 0.2.2 → 0.2.3
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/CHANGELOG.md +8 -0
- package/dist/core/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1743 -1582
- package/dist/loader/internal/external-variant-sidecar-fetch.d.ts +1 -0
- package/dist/loader/internal/geo-loader-pipeline.d.ts +9 -0
- package/dist/loader/internal/geo-loader-worker-adapter.d.ts +6 -0
- package/dist/loader/internal/geo-node-builder.d.ts +4 -0
- package/dist/loader/internal/geo-prepare-worker-types.d.ts +7 -1
- package/dist/session/cad-document-session.d.ts +21 -0
- package/dist/workers/geo-prepare.worker.js +696 -672
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ export type FetchExternalVariantSidecarsOptions = {
|
|
|
6
6
|
readonly fetchImpl?: typeof fetch;
|
|
7
7
|
readonly signal?: AbortSignal;
|
|
8
8
|
readonly concurrency?: number;
|
|
9
|
+
readonly onBuffer?: (variantId: number, buffer: ArrayBuffer) => void | Promise<void>;
|
|
9
10
|
};
|
|
10
11
|
export declare function fetchExternalVariantSidecars(options: FetchExternalVariantSidecarsOptions): Promise<{
|
|
11
12
|
readonly buffers: ReadonlyMap<number, ArrayBuffer>;
|
|
@@ -43,6 +43,7 @@ export interface GeoLoaderPipelineAdapterInput {
|
|
|
43
43
|
externalVariantBuffers?: ReadonlyMap<number, ArrayBuffer>;
|
|
44
44
|
requiredExternalVariantIds?: ReadonlySet<number>;
|
|
45
45
|
externalVariantGeometryFetchIds?: ReadonlySet<number>;
|
|
46
|
+
deferExternalVariantGeometry?: boolean;
|
|
46
47
|
externalVariantDeltaOnly?: boolean;
|
|
47
48
|
}
|
|
48
49
|
export interface GeoLoaderPipelineSession {
|
|
@@ -53,6 +54,12 @@ export interface GeoLoaderPipelineSession {
|
|
|
53
54
|
dispose: () => void;
|
|
54
55
|
}
|
|
55
56
|
export interface GeoLoaderPipelineAdapter {
|
|
57
|
+
/**
|
|
58
|
+
* Reusable worker adapters expose this once the worker owns the document's
|
|
59
|
+
* main buffer. Builders may then pass the caller-owned buffer by reference;
|
|
60
|
+
* the adapter will omit it from the parse message and use its retained copy.
|
|
61
|
+
*/
|
|
62
|
+
readonly mainBufferReuseReady?: boolean;
|
|
56
63
|
start(input: GeoLoaderPipelineAdapterInput, emit: GeoLoaderPipelineEmit): GeoLoaderPipelineSession;
|
|
57
64
|
}
|
|
58
65
|
export interface RunGeoLoaderPipelineOptions {
|
|
@@ -62,6 +69,7 @@ export interface RunGeoLoaderPipelineOptions {
|
|
|
62
69
|
signal?: AbortSignal;
|
|
63
70
|
beforeTextAppend?: BeforeTextAppend;
|
|
64
71
|
beforeFinalize?: () => void | Promise<void>;
|
|
72
|
+
onFirstRenderableAppend?: () => void;
|
|
65
73
|
hiddenInstanceIds?: ReadonlySet<number>;
|
|
66
74
|
keepTextsForHiddenInstances?: boolean;
|
|
67
75
|
loadBlocks?: boolean;
|
|
@@ -71,6 +79,7 @@ export interface RunGeoLoaderPipelineOptions {
|
|
|
71
79
|
externalVariantBuffers?: ReadonlyMap<number, ArrayBuffer>;
|
|
72
80
|
requiredExternalVariantIds?: ReadonlySet<number>;
|
|
73
81
|
externalVariantGeometryFetchIds?: ReadonlySet<number>;
|
|
82
|
+
deferExternalVariantGeometry?: boolean;
|
|
74
83
|
externalVariantDeltaOnly?: boolean;
|
|
75
84
|
appendExternalVariantDelta?: boolean;
|
|
76
85
|
onYield?: YieldCallback;
|
|
@@ -3,5 +3,11 @@ export interface WorkerGeoLoaderAdapterOptions {
|
|
|
3
3
|
workerUrl?: string | URL;
|
|
4
4
|
workerFactory?: () => Worker;
|
|
5
5
|
}
|
|
6
|
+
export interface DisposableGeoLoaderPipelineAdapter extends GeoLoaderPipelineAdapter {
|
|
7
|
+
/** True when a reusable worker owns the main buffer for the current document. */
|
|
8
|
+
readonly mainBufferReuseReady: boolean;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
6
11
|
export declare function canUsePrepareWorker(workerFactory?: () => Worker): boolean;
|
|
7
12
|
export declare function createWorkerGeoLoaderAdapter(options?: WorkerGeoLoaderAdapterOptions): GeoLoaderPipelineAdapter;
|
|
13
|
+
export declare function createReusableWorkerGeoLoaderAdapter(options?: WorkerGeoLoaderAdapterOptions): DisposableGeoLoaderPipelineAdapter;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FrameBudgetSchedulerOptions } from './frame-budget-scheduler';
|
|
2
2
|
import type { LoaderFlowControlOptions } from './flow-control';
|
|
3
|
+
import { type GeoLoaderPipelineAdapter } from './geo-loader-pipeline';
|
|
3
4
|
import { GeoNode } from './geo-node';
|
|
4
5
|
import type { TextEntity } from '../../shared/types';
|
|
5
6
|
import type { ExternalVariantFetchSource } from '../geo-loader';
|
|
@@ -15,6 +16,7 @@ export interface BuildGeoNodeOptions {
|
|
|
15
16
|
preferWorker?: boolean;
|
|
16
17
|
workerUrl?: string | URL;
|
|
17
18
|
workerFactory?: () => Worker;
|
|
19
|
+
workerAdapter?: GeoLoaderPipelineAdapter;
|
|
18
20
|
keepTextsForHiddenInstances?: boolean;
|
|
19
21
|
loadBlocks?: boolean;
|
|
20
22
|
maxExpandedInstanceVertices?: number;
|
|
@@ -22,7 +24,9 @@ export interface BuildGeoNodeOptions {
|
|
|
22
24
|
externalVariantBuffers?: ReadonlyMap<number, ArrayBuffer>;
|
|
23
25
|
requiredExternalVariantIds?: ReadonlySet<number> | readonly number[];
|
|
24
26
|
externalVariantGeometryFetchIds?: ReadonlySet<number> | readonly number[];
|
|
27
|
+
deferExternalVariantGeometry?: boolean;
|
|
25
28
|
externalVariantDeltaOnly?: boolean;
|
|
29
|
+
onFirstRenderableAppend?: () => void;
|
|
26
30
|
}
|
|
27
31
|
export declare function buildGeoNodeFromBuffer(node: GeoNode, buf: ArrayBuffer, onYield?: YieldCallback, options?: BuildGeoNodeOptions): Promise<void>;
|
|
28
32
|
export declare function appendExternalVariantDeltaToGeoNode(node: GeoNode, buf: ArrayBuffer, onYield?: YieldCallback, options?: BuildGeoNodeOptions): Promise<void>;
|
|
@@ -5,7 +5,13 @@ import type { ExternalVariantFetchSource } from '../geo-loader';
|
|
|
5
5
|
export type { GeometryKind, PreparedLayerChunk } from './geo-prepare';
|
|
6
6
|
export interface GeoPrepareParseRequest {
|
|
7
7
|
type: 'parse';
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Main DXB3 payload. Omitted when the worker already retained the document
|
|
10
|
+
* buffer from an earlier parse in the same document session.
|
|
11
|
+
*/
|
|
12
|
+
buffer?: ArrayBuffer;
|
|
13
|
+
/** Use the main buffer retained by the worker instead of transferring one. */
|
|
14
|
+
useRetainedMainBuffer?: boolean;
|
|
9
15
|
hiddenInstanceIds?: number[];
|
|
10
16
|
keepTextsForHiddenInstances?: boolean;
|
|
11
17
|
loadBlocks?: boolean;
|
|
@@ -80,6 +80,23 @@ export interface CadSessionDemandProgressEvent {
|
|
|
80
80
|
readonly loaded: number;
|
|
81
81
|
readonly settled: boolean;
|
|
82
82
|
}
|
|
83
|
+
/** A monotonic start clock plus load milestones elapsed from session creation. */
|
|
84
|
+
export interface CadSessionLoadTiming {
|
|
85
|
+
readonly startedAtMs: number;
|
|
86
|
+
readonly mainBufferLoadedMs?: number;
|
|
87
|
+
readonly headerReadyMs?: number;
|
|
88
|
+
readonly initialSidecarFetchStartedMs?: number;
|
|
89
|
+
readonly firstRenderableReadyMs?: number;
|
|
90
|
+
readonly baseGeometryReadyMs?: number;
|
|
91
|
+
readonly initialContentReadyMs?: number;
|
|
92
|
+
readonly initialSidecarFetchSettledMs?: number;
|
|
93
|
+
readonly initialExternalContentReadyMs?: number;
|
|
94
|
+
readonly initialViewportSettledMs?: number;
|
|
95
|
+
readonly failedMs?: number;
|
|
96
|
+
readonly initialRequiredVariantCount: number;
|
|
97
|
+
readonly initialSidecarLoadedCount: number;
|
|
98
|
+
readonly initialSidecarBytes: number;
|
|
99
|
+
}
|
|
83
100
|
export interface CadSessionPhaseChangeEvent {
|
|
84
101
|
readonly phase: CadSessionPhase;
|
|
85
102
|
}
|
|
@@ -91,6 +108,9 @@ export interface CadSessionEventMap {
|
|
|
91
108
|
'content-appended': CadSessionContentAppendedEvent;
|
|
92
109
|
'initial-content-ready': void;
|
|
93
110
|
'demand-progress': CadSessionDemandProgressEvent;
|
|
111
|
+
'load-timing': {
|
|
112
|
+
readonly timing: CadSessionLoadTiming;
|
|
113
|
+
};
|
|
94
114
|
'phase-change': CadSessionPhaseChangeEvent;
|
|
95
115
|
'non-fatal-error': CadSessionErrorEvent;
|
|
96
116
|
'fatal-error': CadSessionErrorEvent;
|
|
@@ -124,6 +144,7 @@ export interface CadInsertUsageSummary {
|
|
|
124
144
|
}
|
|
125
145
|
export interface CadDocumentSession {
|
|
126
146
|
readonly phase: CadSessionPhase;
|
|
147
|
+
readonly loadTiming: CadSessionLoadTiming;
|
|
127
148
|
readonly headerReady: Promise<CadDocumentHeader>;
|
|
128
149
|
readonly initialContentReady: Promise<void>;
|
|
129
150
|
setViewportDemand(demand: CadViewportDemand): void;
|