@omrips/viewstl 2.0.0-rc.3 → 2.0.0-rc.5
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/README.md +19 -170
- package/build/{v2/THIRD-PARTY-NOTICES.txt → THIRD-PARTY-NOTICES.txt} +1006 -1006
- package/build/{v2/cad → cad}/occt-import-js.source.txt +19 -19
- package/build/chunks/archive-JU75RPTU.js +1 -0
- package/build/{v2/chunks/cad-VY42CMP4.js → chunks/cad-4JYHORYZ.js} +1 -1
- package/build/{v2/chunks/chunk-JH3H3JWA.js → chunks/chunk-OP2L7L4N.js} +1 -1
- package/build/{v2/chunks/chunk-ZMK3UZZE.js → chunks/chunk-PQYEV7WH.js} +1 -1
- package/build/{v2/chunks/chunk-R3HNTB5A.js → chunks/chunk-Y6VY64LY.js} +1 -1
- package/build/{v2/chunks/export-7OP4ZGGJ.js → chunks/export-VM6OQCQJ.js} +3 -3
- package/build/{v2/chunks/export-cad-QPBT756V.js → chunks/export-cad-QXCB6UDU.js} +1 -1
- package/build/{v2/chunks/export-zip-EDCWH5PX.js → chunks/export-zip-PVXETVLK.js} +1 -1
- package/build/{v2/chunks/print-check-2PU7CSL3.js → chunks/print-check-NJ4IONC5.js} +1 -1
- package/build/{v2/chunks/scene-export-KQBS7VRJ.js → chunks/scene-export-ZIXMUNLI.js} +1 -1
- package/build/chunks/scene-reader-JGHERXR2.js +1 -0
- package/build/{v2/node → node}/analysis-worker.js +11 -11
- package/build/{v2/node → node}/index.cjs +7 -7
- package/build/{v2/node → node}/index.js +6 -6
- package/build/stl_viewer.min.js +51 -0
- package/build/{v2/viewstl.cjs → viewstl.cjs} +752 -125
- package/build/{v2/viewstl.d.cts → viewstl.d.cts} +50 -0
- package/build/{v2/viewstl.d.ts → viewstl.d.ts} +50 -0
- package/build/{v2/viewstl.js → viewstl.js} +752 -125
- package/build/viewstl.min.js +51 -0
- package/build/{v2/viewstl.worker.js → viewstl.worker.js} +1 -1
- package/docs/releases/2.0.0-rc.5.md +46 -0
- package/docs/v2-compatibility.md +5 -5
- package/docs/v2-usage.md +128 -21
- package/docs/v2-verification.md +158 -0
- package/legacy/README.md +14 -8
- package/package.json +18 -35
- package/build/v2/README.md +0 -15
- package/build/v2/chunks/archive-VGS4J4Z7.js +0 -1
- package/build/v2/chunks/scene-reader-APUJOPUR.js +0 -1
- package/build/v2/stl_viewer.min.js +0 -51
- package/build/v2/viewstl.min.js +0 -51
- /package/build/{v2/cad → cad}/occt-import-js.js +0 -0
- /package/build/{v2/cad → cad}/occt-import-js.wasm +0 -0
- /package/build/{v2/cad → cad}/prepare-cad.source.txt +0 -0
- /package/build/{v2/chunks/chunk-U33KANV7.js → chunks/chunk-IK3WL53C.js} +0 -0
- /package/build/{v2/chunks/chunk-JS56KC3I.js → chunks/chunk-W5KVLGVR.js} +0 -0
- /package/build/{v2/chunks → chunks}/chunk-ZSV4PTIA.js +0 -0
- /package/build/{v2/node → node}/index.d.cts +0 -0
- /package/build/{v2/node → node}/index.d.ts +0 -0
|
@@ -88,12 +88,45 @@ export interface SceneExportResult {
|
|
|
88
88
|
}
|
|
89
89
|
export interface AnimationTrack extends Transform {
|
|
90
90
|
msec?: number;
|
|
91
|
+
/** Continuous accumulation; applies to delta only. */
|
|
91
92
|
loop?: boolean;
|
|
92
93
|
}
|
|
93
94
|
export interface Animation {
|
|
94
95
|
delta?: AnimationTrack;
|
|
95
96
|
exact?: AnimationTrack;
|
|
96
97
|
}
|
|
98
|
+
export interface AnimationPlaybackState {
|
|
99
|
+
status: "idle" | "running" | "paused" | "stopped" | "completed";
|
|
100
|
+
elapsed_ms: number;
|
|
101
|
+
/** Temporarily suspended by a hidden document or lost graphics context. */
|
|
102
|
+
suspended: boolean;
|
|
103
|
+
tracks: Array<{
|
|
104
|
+
mode: "delta" | "exact";
|
|
105
|
+
msec: number;
|
|
106
|
+
loop: boolean;
|
|
107
|
+
progress: number;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
export type AnimationStateReason =
|
|
111
|
+
| "started"
|
|
112
|
+
| "restored"
|
|
113
|
+
| "replaced"
|
|
114
|
+
| "paused"
|
|
115
|
+
| "resumed"
|
|
116
|
+
| "completed"
|
|
117
|
+
| "stopped"
|
|
118
|
+
| "manual"
|
|
119
|
+
| "removed"
|
|
120
|
+
| "clean"
|
|
121
|
+
| "error";
|
|
122
|
+
/** Serialized scene playback. Normally created by get_vsj/export_scene. */
|
|
123
|
+
export interface SavedAnimationState {
|
|
124
|
+
version: 1;
|
|
125
|
+
elapsed_ms: number;
|
|
126
|
+
paused: boolean;
|
|
127
|
+
origin: Required<Omit<Transform, "scale">>;
|
|
128
|
+
center: [number, number, number];
|
|
129
|
+
}
|
|
97
130
|
export interface GeometryData {
|
|
98
131
|
positions: Float32Array | number[];
|
|
99
132
|
colors?: Float32Array | number[] | null;
|
|
@@ -116,6 +149,7 @@ export interface ModelOptions extends Transform {
|
|
|
116
149
|
view_edges?: boolean;
|
|
117
150
|
units?: Units;
|
|
118
151
|
animation?: Animation | null;
|
|
152
|
+
animation_state?: SavedAnimationState | null;
|
|
119
153
|
}
|
|
120
154
|
export type ModelClick = (
|
|
121
155
|
id: number | null,
|
|
@@ -173,6 +207,15 @@ export interface ViewerOptions {
|
|
|
173
207
|
on_model_drop?: (filename: string) => void;
|
|
174
208
|
on_model_mouseclick?: ModelClick;
|
|
175
209
|
on_model_mousedown?: ModelClick;
|
|
210
|
+
animation_state_callback?: (
|
|
211
|
+
id: number,
|
|
212
|
+
state: AnimationPlaybackState,
|
|
213
|
+
reason: AnimationStateReason,
|
|
214
|
+
) => void;
|
|
215
|
+
animation_complete_callback?: (
|
|
216
|
+
id: number,
|
|
217
|
+
state: AnimationPlaybackState,
|
|
218
|
+
) => void;
|
|
176
219
|
}
|
|
177
220
|
export interface ModelInfo {
|
|
178
221
|
name: string;
|
|
@@ -328,11 +371,17 @@ export class StlViewer {
|
|
|
328
371
|
download_vsb(filename?: string): Promise<void | null>;
|
|
329
372
|
load_vsb(source: string | File | Blob): void;
|
|
330
373
|
animate_model(id: number, animation: Animation | null): void;
|
|
374
|
+
pause_model_animation(id: number): void;
|
|
375
|
+
resume_model_animation(id: number): void;
|
|
376
|
+
get_model_animation_state(id: number): AnimationPlaybackState | null;
|
|
331
377
|
get_image_blob(type?: string): Promise<Blob>;
|
|
332
378
|
}
|
|
333
379
|
export default StlViewer;
|
|
334
380
|
|
|
335
381
|
export interface ViewstlAppOptions {
|
|
382
|
+
/** Composed with the app's own playback controls and reduced-motion policy. */
|
|
383
|
+
animation_state_callback?: ViewerOptions["animation_state_callback"];
|
|
384
|
+
animation_complete_callback?: ViewerOptions["animation_complete_callback"];
|
|
336
385
|
url_import_endpoint?: string;
|
|
337
386
|
worker_url?: string | URL;
|
|
338
387
|
worker_factory?: () => Worker;
|
|
@@ -357,6 +406,7 @@ export interface ViewstlAppState {
|
|
|
357
406
|
/** Euler XYZ angles in degrees, about the model's own center. */
|
|
358
407
|
rotation: Vector3;
|
|
359
408
|
color: string | null;
|
|
409
|
+
animation: AnimationPlaybackState;
|
|
360
410
|
}>;
|
|
361
411
|
}
|
|
362
412
|
export interface ViewstlApp {
|
|
@@ -88,12 +88,45 @@ export interface SceneExportResult {
|
|
|
88
88
|
}
|
|
89
89
|
export interface AnimationTrack extends Transform {
|
|
90
90
|
msec?: number;
|
|
91
|
+
/** Continuous accumulation; applies to delta only. */
|
|
91
92
|
loop?: boolean;
|
|
92
93
|
}
|
|
93
94
|
export interface Animation {
|
|
94
95
|
delta?: AnimationTrack;
|
|
95
96
|
exact?: AnimationTrack;
|
|
96
97
|
}
|
|
98
|
+
export interface AnimationPlaybackState {
|
|
99
|
+
status: "idle" | "running" | "paused" | "stopped" | "completed";
|
|
100
|
+
elapsed_ms: number;
|
|
101
|
+
/** Temporarily suspended by a hidden document or lost graphics context. */
|
|
102
|
+
suspended: boolean;
|
|
103
|
+
tracks: Array<{
|
|
104
|
+
mode: "delta" | "exact";
|
|
105
|
+
msec: number;
|
|
106
|
+
loop: boolean;
|
|
107
|
+
progress: number;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
export type AnimationStateReason =
|
|
111
|
+
| "started"
|
|
112
|
+
| "restored"
|
|
113
|
+
| "replaced"
|
|
114
|
+
| "paused"
|
|
115
|
+
| "resumed"
|
|
116
|
+
| "completed"
|
|
117
|
+
| "stopped"
|
|
118
|
+
| "manual"
|
|
119
|
+
| "removed"
|
|
120
|
+
| "clean"
|
|
121
|
+
| "error";
|
|
122
|
+
/** Serialized scene playback. Normally created by get_vsj/export_scene. */
|
|
123
|
+
export interface SavedAnimationState {
|
|
124
|
+
version: 1;
|
|
125
|
+
elapsed_ms: number;
|
|
126
|
+
paused: boolean;
|
|
127
|
+
origin: Required<Omit<Transform, "scale">>;
|
|
128
|
+
center: [number, number, number];
|
|
129
|
+
}
|
|
97
130
|
export interface GeometryData {
|
|
98
131
|
positions: Float32Array | number[];
|
|
99
132
|
colors?: Float32Array | number[] | null;
|
|
@@ -116,6 +149,7 @@ export interface ModelOptions extends Transform {
|
|
|
116
149
|
view_edges?: boolean;
|
|
117
150
|
units?: Units;
|
|
118
151
|
animation?: Animation | null;
|
|
152
|
+
animation_state?: SavedAnimationState | null;
|
|
119
153
|
}
|
|
120
154
|
export type ModelClick = (
|
|
121
155
|
id: number | null,
|
|
@@ -173,6 +207,15 @@ export interface ViewerOptions {
|
|
|
173
207
|
on_model_drop?: (filename: string) => void;
|
|
174
208
|
on_model_mouseclick?: ModelClick;
|
|
175
209
|
on_model_mousedown?: ModelClick;
|
|
210
|
+
animation_state_callback?: (
|
|
211
|
+
id: number,
|
|
212
|
+
state: AnimationPlaybackState,
|
|
213
|
+
reason: AnimationStateReason,
|
|
214
|
+
) => void;
|
|
215
|
+
animation_complete_callback?: (
|
|
216
|
+
id: number,
|
|
217
|
+
state: AnimationPlaybackState,
|
|
218
|
+
) => void;
|
|
176
219
|
}
|
|
177
220
|
export interface ModelInfo {
|
|
178
221
|
name: string;
|
|
@@ -328,11 +371,17 @@ export class StlViewer {
|
|
|
328
371
|
download_vsb(filename?: string): Promise<void | null>;
|
|
329
372
|
load_vsb(source: string | File | Blob): void;
|
|
330
373
|
animate_model(id: number, animation: Animation | null): void;
|
|
374
|
+
pause_model_animation(id: number): void;
|
|
375
|
+
resume_model_animation(id: number): void;
|
|
376
|
+
get_model_animation_state(id: number): AnimationPlaybackState | null;
|
|
331
377
|
get_image_blob(type?: string): Promise<Blob>;
|
|
332
378
|
}
|
|
333
379
|
export default StlViewer;
|
|
334
380
|
|
|
335
381
|
export interface ViewstlAppOptions {
|
|
382
|
+
/** Composed with the app's own playback controls and reduced-motion policy. */
|
|
383
|
+
animation_state_callback?: ViewerOptions["animation_state_callback"];
|
|
384
|
+
animation_complete_callback?: ViewerOptions["animation_complete_callback"];
|
|
336
385
|
url_import_endpoint?: string;
|
|
337
386
|
worker_url?: string | URL;
|
|
338
387
|
worker_factory?: () => Worker;
|
|
@@ -357,6 +406,7 @@ export interface ViewstlAppState {
|
|
|
357
406
|
/** Euler XYZ angles in degrees, about the model's own center. */
|
|
358
407
|
rotation: Vector3;
|
|
359
408
|
color: string | null;
|
|
409
|
+
animation: AnimationPlaybackState;
|
|
360
410
|
}>;
|
|
361
411
|
}
|
|
362
412
|
export interface ViewstlApp {
|