@micrio/client 7.3.19 → 7.4.1

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/micrio.min.d.ts CHANGED
@@ -622,6 +622,16 @@ declare module '@micrio/client' {
622
622
  /** Split-screen: if false, the secondary image is display-only (no user interaction). */
623
623
  secondaryInteractive?: boolean;
624
624
  }
625
+ interface SogInfo {
626
+ /** SOG quality/name (for example `l`, `m`, `s`, `xs`) */
627
+ name: string;
628
+ /** Number of gaussian splats in the file */
629
+ numSplats: number;
630
+ /** Build timestamp of the file, in ms */
631
+ timestamp: number;
632
+ /** File size in bytes */
633
+ fileSize: number;
634
+ }
625
635
  interface OmniSettings {
626
636
  /** Number of frames */
627
637
  frames: number;
@@ -650,6 +660,8 @@ declare module '@micrio/client' {
650
660
  [key: string]: string | undefined;
651
661
  };
652
662
  }[];
663
+ /** Available Gaussian splat captures for this object */
664
+ sog?: SogInfo[];
653
665
  /** Optional starting layer idx */
654
666
  layerStartIndex?: number;
655
667
  /** Hide the rotation dial */
@@ -1419,6 +1431,9 @@ declare module '@micrio/client' {
1419
1431
  }
1420
1432
 
1421
1433
 
1434
+ export {};
1435
+
1436
+
1422
1437
  export interface DrawnImage {
1423
1438
  /** The micrio image id. */
1424
1439
  id: string;
@@ -1488,6 +1503,9 @@ declare module '@micrio/client' {
1488
1503
  }
1489
1504
 
1490
1505
 
1506
+ export {};
1507
+
1508
+
1491
1509
  export class PageFlipAnimator {
1492
1510
  #private;
1493
1511
  _hardCoverPages: Set<number>;
@@ -1505,6 +1523,8 @@ declare module '@micrio/client' {
1505
1523
  _setDragProgress(pageIndex: number, progress: number): void;
1506
1524
  _endDrag(pageIndex: number, direction: number): void;
1507
1525
  _isPageDragging(pageIndex: number): boolean;
1526
+ /** Releases a drag without settling it, returning the page to rest for another navigation. */
1527
+ _cancelDrag(pageIndex: number, mesh: PaperMesh): void;
1508
1528
  _reset(meshes: PaperMesh[]): void;
1509
1529
  _update(dt: number, meshes: PaperMesh[], selectedPage: number, totalStackHeight: number, pageCount: number, pageThickness: number): void;
1510
1530
  }
@@ -1651,8 +1671,16 @@ declare module '@micrio/client' {
1651
1671
  export const GRAB_ROW_MAX_OFFSET = 0.12;
1652
1672
  /** Tighter max random offset used during rapid .goto() flips for a more uniform look */
1653
1673
  export const GOTO_GRAB_ROW_MAX_OFFSET = 0.02;
1674
+ /** Page distance from which a .goto() starts new flips closer together than one per frame */
1675
+ export const GOTO_STACK_MIN_DISTANCE = 4;
1676
+ /** Pages whose flips may start in the same frame during a long .goto(); each keeps its own full flip */
1677
+ export const GOTO_STACK_PAGES_PER_STEP = 3;
1678
+ /** Final pages of a long .goto() that still start one per frame, so each lands on a settled stack */
1679
+ export const GOTO_STACK_TAIL_PAGES = 4;
1654
1680
  /** Peak arc height of the flipped corner above the rest position */
1655
1681
  export const ARC_PEAK = 0.7;
1682
+ /** Velocity retained when a flip lands (lower = less bounce after the page hits the stack) */
1683
+ export const LANDING_VELOCITY_SCALE = 0.2;
1656
1684
  /** Base duration (seconds) for a full page flip at speed 1.0 */
1657
1685
  export const BASE_FLIP_DURATION = 0.6;
1658
1686
  /** Number of constraint solver iterations per substep */
@@ -1665,14 +1693,17 @@ declare module '@micrio/client' {
1665
1693
  export const BENDING_COMPLIANCE = 0.000041;
1666
1694
  /** Velocity damping per substep (0.92 = 8% velocity loss per substep) */
1667
1695
  export const DAMPING = 0.975;
1668
- /** Damping used during rapid .goto() page-flip cascades (higher = faster settling) */
1696
+ /** Damping used while a rapid .goto() still has pages turning (higher = livelier, slower to settle) */
1669
1697
  export const GOTO_DAMPING = 0.995;
1670
1698
  /** Gravitational acceleration in world-space units */
1671
1699
  export const GRAVITY = 9.81;
1672
1700
  /** Whether gravity is active */
1673
1701
  export const GRAVITY_ENABLED = true;
1674
1702
  /** Minimum vertex position delta to consider a page still "active" — below this it goes idle */
1675
- export const DELTA_IDLE_THRESHOLD = 0.000001;
1703
+ export const DELTA_IDLE_THRESHOLD = 0.001;
1704
+ /** Depth-buffer units of polygon offset per animating page, so later pages win ties without
1705
+ * reordering the whole stack. One page thickness is roughly 400 units at the default view. */
1706
+ export const ANIM_PAGE_DEPTH_OFFSET = 500;
1676
1707
  /** Margin around the book as a fraction of the smaller viewport dimension (0.05 = 5%) */
1677
1708
  export const VIEWPORT_MARGIN_PCT = 0.05;
1678
1709
  /** Default camera polar angle in radians (0 = side view, π/2 = directly overhead) */
@@ -1931,7 +1962,9 @@ declare module '@micrio/client' {
1931
1962
  }
1932
1963
  export function isSolverReady(): boolean;
1933
1964
  export function initSolver(meshes: PaperMesh[], pageCount: number): Promise<void>;
1934
- export function dispatchSolve(subDt: number, activeIndices: number[], substeps: number, solverSettings: SolverSettings, meshes: PaperMesh[], progress: Float32Array, totalStackHeight: number, pageCount: number, pageThickness: number): void;
1965
+ export function dispatchSolve(subDt: number, activeIndices: number[], substeps: number, solverSettings: SolverSettings, meshes: PaperMesh[], progress: Float32Array, totalStackHeight: number, pageCount: number, pageThickness: number,
1966
+ /** Total active pages when the solve is split by damping; keeps the iteration policy global. */
1967
+ iterationBasis?: number): void;
1935
1968
 
1936
1969
 
1937
1970
  export function compileShader(gl: WebGL2RenderingContext, type: number, src: string): WebGLShader;
@@ -2042,8 +2075,11 @@ declare module '@micrio/client' {
2042
2075
  _zoomOverride: ((n: number) => void) | undefined;
2043
2076
  /** Possible override for Book3D */
2044
2077
  _isZoomedInOverride: (() => boolean) | undefined;
2045
- /** Possible override for `_getXYDirect` for Book3D */
2046
- _getXYDirectOverride: ((x: number, y: number) => Float64Array) | undefined;
2078
+ /** Possible override for `_getXYDirect` for Book3D and the SOG viewer */
2079
+ _getXYDirectOverride: ((x: number, y: number, opts?: {
2080
+ radius?: number;
2081
+ rotation?: number;
2082
+ }) => Float64Array) | undefined;
2047
2083
  /** getMatrix book3d override */
2048
2084
  _getMatrixOverride: ((x: number, y: number, scale: number, rotX?: number, rotY?: number, rotZ?: number, scaleX?: number, scaleY?: number,
2049
2085
  /** The element's content width in CSS pixels (used to convert `scale` to a world size). */
@@ -2195,6 +2231,8 @@ declare module '@micrio/client' {
2195
2231
  isJump?: boolean;
2196
2232
  /** For Omni objects: the target image frame index to animate to. */
2197
2233
  omniIndex?: number;
2234
+ /** For Omni objects: the target rotation in degrees (continuous renderers). */
2235
+ omniRotation?: number;
2198
2236
  /** If true, respects the image's maximum zoom limit during animation. */
2199
2237
  limitZoom?: boolean;
2200
2238
  /** If provided, adds a margin to the view. */
@@ -2473,6 +2511,59 @@ declare module '@micrio/client' {
2473
2511
  }
2474
2512
 
2475
2513
 
2514
+ /**
2515
+ * # Minimal typed state machine
2516
+ *
2517
+ * A component-level reducer with explicit phases, queued events and cancellable effects.
2518
+ * It is deliberately small: there is no statechart layer, no global registry and no
2519
+ * dependency. The state is a plain object whose `phase` discriminant makes the legal
2520
+ * combinations explicit; the reducer is a pure `(state, event) => next | null` function.
2521
+ *
2522
+ * Effects run after subscribers and are split by lifetime:
2523
+ *
2524
+ * - `effect` runs on every accepted transition. Its signal aborts on the next transition
2525
+ * (or disposal), which suits one-shot async work such as a fetch or a public event.
2526
+ * - `enter[phase]` runs on entering a phase. Its signal survives same-phase transitions and
2527
+ * aborts only when that phase is left (or the machine is disposed), which suits a ticker
2528
+ * or an adapter listener.
2529
+ *
2530
+ * This is for component state, not hot paths: a machine per tile or a state object per
2531
+ * animation frame would cost more than the flags it replaces.
2532
+ *
2533
+ * @author Marcel Duin <marcel@micr.io>
2534
+ */
2535
+ /** The only shape the runtime requires: a discriminant that effects can key on. */
2536
+ export interface MachineState {
2537
+ readonly phase: string;
2538
+ }
2539
+ /** Returns the next state, or `null` when the event does not apply. */
2540
+ export type MachineReducer<S extends MachineState, E, C> = (state: Readonly<S>, event: E, context: C) => S | null;
2541
+ /** The arguments every effect receives. */
2542
+ export interface MachineArgs<S extends MachineState, E, C> {
2543
+ readonly state: Readonly<S>;
2544
+ readonly previous: Readonly<S>;
2545
+ readonly event: E;
2546
+ readonly context: C;
2547
+ readonly signal: AbortSignal;
2548
+ }
2549
+ /** Configuration for {@link createMachine}. */
2550
+ export interface MachineOptions<S extends MachineState, E, C> {
2551
+ initial: S;
2552
+ context: C;
2553
+ reduce: MachineReducer<S, E, C>;
2554
+ /** Runs after every accepted transition; signal aborts on the next transition. */
2555
+ effect?: (args: MachineArgs<S, E, C>) => void | Promise<void>;
2556
+ /** Runs when entering a phase; signal aborts on leaving the phase or disposal. */
2557
+ enter?: Partial<Record<S['phase'], (args: MachineArgs<S, E, C>) => void | Promise<void>>>;
2558
+ }
2559
+ /** The read-only machine surface. */
2560
+ export interface Machine<S extends MachineState, E> extends Readable<S> {
2561
+ readonly $state: S;
2562
+ send: (event: E) => void;
2563
+ dispose: () => void;
2564
+ }
2565
+
2566
+
2476
2567
  export interface MicrioSplitLink {
2477
2568
  micrioId: string;
2478
2569
  markerId?: string;
@@ -2551,6 +2642,13 @@ declare module '@micrio/client' {
2551
2642
  get $marker(): Models.ImageData.Marker | undefined;
2552
2643
  /** Writable store holding the currently displayed layer index (for Omni objects). */
2553
2644
  readonly layer: Writable<number>;
2645
+ /**
2646
+ * Continuous omni rotation in degrees, 0 at the first frame.
2647
+ * Seamless (SOG) mode uses the full value; legacy tile mode snaps it to a frame.
2648
+ */
2649
+ readonly omniRotation: Writable<number>;
2650
+ /** Getter for the current omni rotation in degrees. */
2651
+ get $omniRotation(): number;
2554
2652
  /** Creates an Image state controller and subscribes to view/marker changes to synchronise with the main element state. @param image The parent MicrioImage instance. */
2555
2653
  constructor(image: MicrioImage);
2556
2654
  }
@@ -2748,6 +2846,9 @@ declare module '@micrio/client' {
2748
2846
  export {};
2749
2847
 
2750
2848
 
2849
+ export {};
2850
+
2851
+
2751
2852
  /** Manages a collection of gallery images with navigation (swipe, switch, grid, album). */
2752
2853
  export class Gallery {
2753
2854
  #private;
@@ -2762,9 +2863,13 @@ declare module '@micrio/client' {
2762
2863
  /** Manages omni 3D object rotation UI: dial, swipe gestures, frame navigation, and layer menu. */
2763
2864
  export class OmniUI {
2764
2865
  #private;
2765
- /** Navigate to a specific frame index. */
2866
+ /** Navigate to a specific frame index. Seamless mode converts it to degrees. */
2766
2867
  goto(i: number): void;
2767
- /** Active frame index currently displayed. */
2868
+ /** Set the object rotation in degrees. Legacy mode snaps it to the nearest frame. */
2869
+ setRotation(deg: number): void;
2870
+ /** Continuous rotation in degrees, 0 at the first frame. */
2871
+ get rotation(): number;
2872
+ /** Active frame index currently displayed (derived from the rotation when seamless). */
2768
2873
  get currentIndex(): number;
2769
2874
  /** Initialize the omni UI: create frame objects, set up dial, swipe gestures, and layer menu. */
2770
2875
  setup(): Promise<void>;
@@ -2884,6 +2989,9 @@ declare module '@micrio/client' {
2884
2989
  export {};
2885
2990
 
2886
2991
 
2992
+ export {};
2993
+
2994
+
2887
2995
  /**
2888
2996
  * HLS.js Player adapter.
2889
2997
  * Extends HTML5PlayerAdapter to add HLS.js streaming support.
@@ -2900,6 +3008,12 @@ declare module '@micrio/client' {
2900
3008
  export {};
2901
3009
 
2902
3010
 
3011
+ export {};
3012
+
3013
+
3014
+ export {};
3015
+
3016
+
2903
3017
  /**
2904
3018
  * Video tour controller. Manages playback and camera animation for video tours
2905
3019
  * defined by a timeline of view rectangles and durations.
@@ -2999,7 +3113,7 @@ declare module '@micrio/client' {
2999
3113
  export class Canvas {
3000
3114
  #private;
3001
3115
  /** The main WebGL rendering `<canvas>` element. */
3002
- readonly element: HTMLCanvasElement;
3116
+ element: HTMLCanvasElement;
3003
3117
  /** Object containing current viewport dimensions, position, and ratios. */
3004
3118
  readonly viewport: Models.Canvas.ViewRect;
3005
3119
  /** Writable store indicating if the client is likely a mobile device. */
@@ -3104,6 +3218,39 @@ declare module '@micrio/client' {
3104
3218
  export {};
3105
3219
 
3106
3220
 
3221
+ /** The subset of the SOG viewer handle this integration calls. */
3222
+ interface MicrioSogViewer {
3223
+ canvas: HTMLCanvasElement;
3224
+ setView: (view: {
3225
+ degrees?: number;
3226
+ view?: Models.Camera.View;
3227
+ yaw?: number;
3228
+ pitch?: number;
3229
+ distance?: number;
3230
+ target?: {
3231
+ x: number;
3232
+ y: number;
3233
+ z: number;
3234
+ };
3235
+ }) => void;
3236
+ resize: () => void;
3237
+ dispose: () => void;
3238
+ }
3239
+ type CreateMicrioSogViewer = (options: {
3240
+ canvas: HTMLCanvasElement;
3241
+ url: string;
3242
+ filename?: string;
3243
+ startFrameFraction?: number;
3244
+ }) => Promise<MicrioSogViewer>;
3245
+ declare global {
3246
+ /** Set by the page (or loaded below) from the PlayCanvas SOG bundle. */
3247
+ var createMicrioSogViewer: CreateMicrioSogViewer | undefined;
3248
+ }
3249
+ /** True when this bundle should be rendered by the SOG viewer instead of the tile engine. */
3250
+ export const isSogBundle: (micrio: HTMLMicrioElement, bundle: Models.ImageBundle.BundleImage) => boolean;
3251
+ export {};
3252
+
3253
+
3107
3254
  /**
3108
3255
  * Manages downloading and processing image textures for WebGL using Web Workers.
3109
3256
  * @internal
@@ -3131,6 +3278,9 @@ declare module '@micrio/client' {
3131
3278
  export {};
3132
3279
 
3133
3280
 
3281
+ export {};
3282
+
3283
+
3134
3284
  /** Names of all icons available in the Micrio UI icon library. */
3135
3285
  export type IconName = 'zoomIn' | 'zoomOut' | 'fullscreenEnter' | 'fullscreenLeave' | 'close' | 'next' | 'down' | 'prev' | 'up' | 'rotateLeft' | 'rotateRight' | 'play' | 'pause' | 'subtitles' | 'subtitlesOff' | 'muted' | 'unmuted' | 'playFilled' | 'a11y' | 'menu' | 'audio' | 'video' | 'share' | 'error' | 'chevronDown' | 'link' | 'linkExt' | 'ellipsisVertical' | 'image' | 'layerGroup';
3136
3286