@omrips/viewstl 2.0.0-rc.7 → 2.0.0-rc.9
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 +5 -3
- package/build/stl_viewer.min.js +6 -6
- package/build/viewstl.cjs +479 -2392
- package/build/viewstl.d.cts +95 -45
- package/build/viewstl.d.ts +95 -45
- package/build/viewstl.js +479 -2392
- package/build/viewstl.min.js +6 -6
- package/docs/releases/2.0.0-rc.9.md +20 -0
- package/docs/v2-usage.md +80 -125
- package/docs/v2-verification.md +743 -698
- package/package.json +2 -2
- package/docs/releases/2.0.0-rc.7.md +0 -16
package/build/viewstl.d.cts
CHANGED
|
@@ -426,59 +426,109 @@ export class StlViewer {
|
|
|
426
426
|
}
|
|
427
427
|
export default StlViewer;
|
|
428
428
|
|
|
429
|
-
export
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
429
|
+
export type SessionArrangement = "original" | "side-by-side" | "custom";
|
|
430
|
+
export interface SessionModel {
|
|
431
|
+
id: number;
|
|
432
|
+
name: string;
|
|
433
|
+
size: number | null;
|
|
434
|
+
units: string | null;
|
|
435
|
+
bounds: { min: number[]; max: number[] };
|
|
436
|
+
position: Vector3;
|
|
437
|
+
/** Euler XYZ in degrees, rotated around the model center. */
|
|
438
|
+
rotation: Vector3;
|
|
439
|
+
originalPosition: Vector3;
|
|
440
|
+
originalRotation: Vector3;
|
|
441
|
+
embedded: boolean;
|
|
442
|
+
color: string | null;
|
|
443
|
+
originalColor: string | null;
|
|
444
|
+
animationPivot?: boolean;
|
|
445
|
+
animation: AnimationPlaybackState | null;
|
|
446
|
+
animationDefinition: Animation | null;
|
|
447
|
+
}
|
|
448
|
+
export type SessionEvent =
|
|
449
|
+
| { type: "ready" }
|
|
450
|
+
| { type: "busy"; busy: boolean }
|
|
451
|
+
| { type: "opening" | "load-failed"; name: string }
|
|
452
|
+
| { type: "loaded"; name: string; id: number }
|
|
453
|
+
| { type: "scene-loaded"; name: string; ids: number[] }
|
|
454
|
+
| { type: "error"; code: string; message: string; source?: string }
|
|
455
|
+
| {
|
|
456
|
+
type: "animation";
|
|
457
|
+
id: number;
|
|
458
|
+
state: AnimationPlaybackState;
|
|
459
|
+
reason: AnimationStateReason;
|
|
460
|
+
}
|
|
461
|
+
| {
|
|
462
|
+
type: "progress";
|
|
463
|
+
scene: boolean;
|
|
464
|
+
progress: { phase?: string; loaded?: number; total?: number };
|
|
465
|
+
};
|
|
466
|
+
export interface ViewerSessionOptions {
|
|
467
|
+
/** Initial models are added through openFiles/openURL, not viewer_options. */
|
|
468
|
+
viewer_options?: Omit<ViewerOptions, "models" | "allow_drag_and_drop">;
|
|
469
|
+
device_memory?: number;
|
|
470
|
+
/** Optional fallback colors for models with no embedded colors. */
|
|
471
|
+
colors?: string[];
|
|
472
|
+
on_event?: (event: SessionEvent) => void;
|
|
473
|
+
}
|
|
474
|
+
export interface ManipulationOptions {
|
|
475
|
+
/** Event is absent for wheel input. Return null to ignore an empty hit. */
|
|
476
|
+
getModelId(event?: PointerEvent): number | null;
|
|
477
|
+
getTool(): "move" | "rotate" | "depth";
|
|
478
|
+
onChange?(id: number): void;
|
|
479
|
+
onStart?(id: number): void;
|
|
480
|
+
onEnd?(id: number, cancelled: boolean): void;
|
|
481
|
+
}
|
|
482
|
+
export interface ManipulationBinding {
|
|
483
|
+
setEnabled(enabled: boolean): void;
|
|
484
|
+
dispose(): void;
|
|
459
485
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
486
|
+
/** UI-independent queue/scene/editor session. Mounting creates no WebGL context.
|
|
487
|
+
* Use viewer for existing rendering, saving, analysis, resize and camera APIs.
|
|
488
|
+
* Methods taking angles use degrees; StlViewer's original methods retain radians.
|
|
489
|
+
*/
|
|
490
|
+
export class ViewerSession {
|
|
491
|
+
constructor(container: HTMLElement, options?: ViewerSessionOptions);
|
|
492
|
+
readonly viewer: StlViewer | null;
|
|
493
|
+
readonly busy: boolean;
|
|
494
|
+
readonly arrangement: SessionArrangement;
|
|
495
|
+
readonly grid: { enabled: boolean; spacing: number; height: number };
|
|
496
|
+
readonly memoryPolicy: {
|
|
497
|
+
budget: number;
|
|
498
|
+
estimated: number;
|
|
499
|
+
reported: boolean;
|
|
500
|
+
limits: {
|
|
501
|
+
max_memory_bytes: number;
|
|
502
|
+
max_file_bytes: number;
|
|
503
|
+
max_triangles: number;
|
|
504
|
+
max_uncompressed_bytes: number;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
ready(): Promise<StlViewer>;
|
|
464
508
|
openFiles(
|
|
465
509
|
files: Iterable<File | { name: string; url: string; size?: number }>,
|
|
466
510
|
): Promise<void>;
|
|
511
|
+
openURL(
|
|
512
|
+
url: string,
|
|
513
|
+
format?: ModelOptions["remote_format"] | "vsb" | "vsj",
|
|
514
|
+
): Promise<void>;
|
|
467
515
|
cancelLoading(): void;
|
|
468
|
-
|
|
469
|
-
|
|
516
|
+
/** Detached constant-size metadata; no geometry copies or mesh scans. */
|
|
517
|
+
getModel(id: number): SessionModel | null;
|
|
518
|
+
getModels(): SessionModel[];
|
|
519
|
+
setPosition(id: number, position: Vector3): boolean;
|
|
520
|
+
setRotation(id: number, degrees: Vector3): boolean;
|
|
521
|
+
prepareManual(id: number): void;
|
|
522
|
+
centerPivot(id: number): void;
|
|
523
|
+
moveDepth(id: number, amount: number): boolean;
|
|
524
|
+
bindManipulation(options: ManipulationOptions): ManipulationBinding;
|
|
525
|
+
setArrangement(mode: SessionArrangement): void;
|
|
526
|
+
setGrid(enabled: boolean, spacing?: number, height?: number): void;
|
|
527
|
+
duplicate(id: number): number;
|
|
470
528
|
remove(id: number): void;
|
|
471
|
-
|
|
472
|
-
getState(): ViewstlAppState;
|
|
473
|
-
/** Cancels pending work and releases listeners, workers, and WebGL resources. */
|
|
529
|
+
clear(): void;
|
|
474
530
|
dispose(): void;
|
|
475
531
|
}
|
|
476
|
-
/** Optional complete app controller for the documented HTML control template.
|
|
477
|
-
* No WebGL context, workers or CAD assets are created until a file is opened. */
|
|
478
|
-
export function mountViewstlApp(
|
|
479
|
-
root: Document | HTMLElement,
|
|
480
|
-
options?: ViewstlAppOptions,
|
|
481
|
-
): ViewstlApp;
|
|
482
532
|
|
|
483
533
|
export interface PrintProfile {
|
|
484
534
|
technology: "fdm";
|
package/build/viewstl.d.ts
CHANGED
|
@@ -426,59 +426,109 @@ export class StlViewer {
|
|
|
426
426
|
}
|
|
427
427
|
export default StlViewer;
|
|
428
428
|
|
|
429
|
-
export
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
429
|
+
export type SessionArrangement = "original" | "side-by-side" | "custom";
|
|
430
|
+
export interface SessionModel {
|
|
431
|
+
id: number;
|
|
432
|
+
name: string;
|
|
433
|
+
size: number | null;
|
|
434
|
+
units: string | null;
|
|
435
|
+
bounds: { min: number[]; max: number[] };
|
|
436
|
+
position: Vector3;
|
|
437
|
+
/** Euler XYZ in degrees, rotated around the model center. */
|
|
438
|
+
rotation: Vector3;
|
|
439
|
+
originalPosition: Vector3;
|
|
440
|
+
originalRotation: Vector3;
|
|
441
|
+
embedded: boolean;
|
|
442
|
+
color: string | null;
|
|
443
|
+
originalColor: string | null;
|
|
444
|
+
animationPivot?: boolean;
|
|
445
|
+
animation: AnimationPlaybackState | null;
|
|
446
|
+
animationDefinition: Animation | null;
|
|
447
|
+
}
|
|
448
|
+
export type SessionEvent =
|
|
449
|
+
| { type: "ready" }
|
|
450
|
+
| { type: "busy"; busy: boolean }
|
|
451
|
+
| { type: "opening" | "load-failed"; name: string }
|
|
452
|
+
| { type: "loaded"; name: string; id: number }
|
|
453
|
+
| { type: "scene-loaded"; name: string; ids: number[] }
|
|
454
|
+
| { type: "error"; code: string; message: string; source?: string }
|
|
455
|
+
| {
|
|
456
|
+
type: "animation";
|
|
457
|
+
id: number;
|
|
458
|
+
state: AnimationPlaybackState;
|
|
459
|
+
reason: AnimationStateReason;
|
|
460
|
+
}
|
|
461
|
+
| {
|
|
462
|
+
type: "progress";
|
|
463
|
+
scene: boolean;
|
|
464
|
+
progress: { phase?: string; loaded?: number; total?: number };
|
|
465
|
+
};
|
|
466
|
+
export interface ViewerSessionOptions {
|
|
467
|
+
/** Initial models are added through openFiles/openURL, not viewer_options. */
|
|
468
|
+
viewer_options?: Omit<ViewerOptions, "models" | "allow_drag_and_drop">;
|
|
469
|
+
device_memory?: number;
|
|
470
|
+
/** Optional fallback colors for models with no embedded colors. */
|
|
471
|
+
colors?: string[];
|
|
472
|
+
on_event?: (event: SessionEvent) => void;
|
|
473
|
+
}
|
|
474
|
+
export interface ManipulationOptions {
|
|
475
|
+
/** Event is absent for wheel input. Return null to ignore an empty hit. */
|
|
476
|
+
getModelId(event?: PointerEvent): number | null;
|
|
477
|
+
getTool(): "move" | "rotate" | "depth";
|
|
478
|
+
onChange?(id: number): void;
|
|
479
|
+
onStart?(id: number): void;
|
|
480
|
+
onEnd?(id: number, cancelled: boolean): void;
|
|
481
|
+
}
|
|
482
|
+
export interface ManipulationBinding {
|
|
483
|
+
setEnabled(enabled: boolean): void;
|
|
484
|
+
dispose(): void;
|
|
459
485
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
486
|
+
/** UI-independent queue/scene/editor session. Mounting creates no WebGL context.
|
|
487
|
+
* Use viewer for existing rendering, saving, analysis, resize and camera APIs.
|
|
488
|
+
* Methods taking angles use degrees; StlViewer's original methods retain radians.
|
|
489
|
+
*/
|
|
490
|
+
export class ViewerSession {
|
|
491
|
+
constructor(container: HTMLElement, options?: ViewerSessionOptions);
|
|
492
|
+
readonly viewer: StlViewer | null;
|
|
493
|
+
readonly busy: boolean;
|
|
494
|
+
readonly arrangement: SessionArrangement;
|
|
495
|
+
readonly grid: { enabled: boolean; spacing: number; height: number };
|
|
496
|
+
readonly memoryPolicy: {
|
|
497
|
+
budget: number;
|
|
498
|
+
estimated: number;
|
|
499
|
+
reported: boolean;
|
|
500
|
+
limits: {
|
|
501
|
+
max_memory_bytes: number;
|
|
502
|
+
max_file_bytes: number;
|
|
503
|
+
max_triangles: number;
|
|
504
|
+
max_uncompressed_bytes: number;
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
ready(): Promise<StlViewer>;
|
|
464
508
|
openFiles(
|
|
465
509
|
files: Iterable<File | { name: string; url: string; size?: number }>,
|
|
466
510
|
): Promise<void>;
|
|
511
|
+
openURL(
|
|
512
|
+
url: string,
|
|
513
|
+
format?: ModelOptions["remote_format"] | "vsb" | "vsj",
|
|
514
|
+
): Promise<void>;
|
|
467
515
|
cancelLoading(): void;
|
|
468
|
-
|
|
469
|
-
|
|
516
|
+
/** Detached constant-size metadata; no geometry copies or mesh scans. */
|
|
517
|
+
getModel(id: number): SessionModel | null;
|
|
518
|
+
getModels(): SessionModel[];
|
|
519
|
+
setPosition(id: number, position: Vector3): boolean;
|
|
520
|
+
setRotation(id: number, degrees: Vector3): boolean;
|
|
521
|
+
prepareManual(id: number): void;
|
|
522
|
+
centerPivot(id: number): void;
|
|
523
|
+
moveDepth(id: number, amount: number): boolean;
|
|
524
|
+
bindManipulation(options: ManipulationOptions): ManipulationBinding;
|
|
525
|
+
setArrangement(mode: SessionArrangement): void;
|
|
526
|
+
setGrid(enabled: boolean, spacing?: number, height?: number): void;
|
|
527
|
+
duplicate(id: number): number;
|
|
470
528
|
remove(id: number): void;
|
|
471
|
-
|
|
472
|
-
getState(): ViewstlAppState;
|
|
473
|
-
/** Cancels pending work and releases listeners, workers, and WebGL resources. */
|
|
529
|
+
clear(): void;
|
|
474
530
|
dispose(): void;
|
|
475
531
|
}
|
|
476
|
-
/** Optional complete app controller for the documented HTML control template.
|
|
477
|
-
* No WebGL context, workers or CAD assets are created until a file is opened. */
|
|
478
|
-
export function mountViewstlApp(
|
|
479
|
-
root: Document | HTMLElement,
|
|
480
|
-
options?: ViewstlAppOptions,
|
|
481
|
-
): ViewstlApp;
|
|
482
532
|
|
|
483
533
|
export interface PrintProfile {
|
|
484
534
|
technology: "fdm";
|