@micrio/client 7.3.18 → 7.4.0

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
@@ -1419,6 +1419,9 @@ declare module '@micrio/client' {
1419
1419
  }
1420
1420
 
1421
1421
 
1422
+ export {};
1423
+
1424
+
1422
1425
  export interface DrawnImage {
1423
1426
  /** The micrio image id. */
1424
1427
  id: string;
@@ -1488,6 +1491,9 @@ declare module '@micrio/client' {
1488
1491
  }
1489
1492
 
1490
1493
 
1494
+ export {};
1495
+
1496
+
1491
1497
  export class PageFlipAnimator {
1492
1498
  #private;
1493
1499
  _hardCoverPages: Set<number>;
@@ -1505,6 +1511,8 @@ declare module '@micrio/client' {
1505
1511
  _setDragProgress(pageIndex: number, progress: number): void;
1506
1512
  _endDrag(pageIndex: number, direction: number): void;
1507
1513
  _isPageDragging(pageIndex: number): boolean;
1514
+ /** Releases a drag without settling it, returning the page to rest for another navigation. */
1515
+ _cancelDrag(pageIndex: number, mesh: PaperMesh): void;
1508
1516
  _reset(meshes: PaperMesh[]): void;
1509
1517
  _update(dt: number, meshes: PaperMesh[], selectedPage: number, totalStackHeight: number, pageCount: number, pageThickness: number): void;
1510
1518
  }
@@ -1651,8 +1659,16 @@ declare module '@micrio/client' {
1651
1659
  export const GRAB_ROW_MAX_OFFSET = 0.12;
1652
1660
  /** Tighter max random offset used during rapid .goto() flips for a more uniform look */
1653
1661
  export const GOTO_GRAB_ROW_MAX_OFFSET = 0.02;
1662
+ /** Page distance from which a .goto() starts new flips closer together than one per frame */
1663
+ export const GOTO_STACK_MIN_DISTANCE = 4;
1664
+ /** Pages whose flips may start in the same frame during a long .goto(); each keeps its own full flip */
1665
+ export const GOTO_STACK_PAGES_PER_STEP = 3;
1666
+ /** Final pages of a long .goto() that still start one per frame, so each lands on a settled stack */
1667
+ export const GOTO_STACK_TAIL_PAGES = 4;
1654
1668
  /** Peak arc height of the flipped corner above the rest position */
1655
1669
  export const ARC_PEAK = 0.7;
1670
+ /** Velocity retained when a flip lands (lower = less bounce after the page hits the stack) */
1671
+ export const LANDING_VELOCITY_SCALE = 0.2;
1656
1672
  /** Base duration (seconds) for a full page flip at speed 1.0 */
1657
1673
  export const BASE_FLIP_DURATION = 0.6;
1658
1674
  /** Number of constraint solver iterations per substep */
@@ -1665,14 +1681,17 @@ declare module '@micrio/client' {
1665
1681
  export const BENDING_COMPLIANCE = 0.000041;
1666
1682
  /** Velocity damping per substep (0.92 = 8% velocity loss per substep) */
1667
1683
  export const DAMPING = 0.975;
1668
- /** Damping used during rapid .goto() page-flip cascades (higher = faster settling) */
1684
+ /** Damping used while a rapid .goto() still has pages turning (higher = livelier, slower to settle) */
1669
1685
  export const GOTO_DAMPING = 0.995;
1670
1686
  /** Gravitational acceleration in world-space units */
1671
1687
  export const GRAVITY = 9.81;
1672
1688
  /** Whether gravity is active */
1673
1689
  export const GRAVITY_ENABLED = true;
1674
1690
  /** Minimum vertex position delta to consider a page still "active" — below this it goes idle */
1675
- export const DELTA_IDLE_THRESHOLD = 0.000001;
1691
+ export const DELTA_IDLE_THRESHOLD = 0.001;
1692
+ /** Depth-buffer units of polygon offset per animating page, so later pages win ties without
1693
+ * reordering the whole stack. One page thickness is roughly 400 units at the default view. */
1694
+ export const ANIM_PAGE_DEPTH_OFFSET = 500;
1676
1695
  /** Margin around the book as a fraction of the smaller viewport dimension (0.05 = 5%) */
1677
1696
  export const VIEWPORT_MARGIN_PCT = 0.05;
1678
1697
  /** Default camera polar angle in radians (0 = side view, π/2 = directly overhead) */
@@ -1931,7 +1950,9 @@ declare module '@micrio/client' {
1931
1950
  }
1932
1951
  export function isSolverReady(): boolean;
1933
1952
  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;
1953
+ export function dispatchSolve(subDt: number, activeIndices: number[], substeps: number, solverSettings: SolverSettings, meshes: PaperMesh[], progress: Float32Array, totalStackHeight: number, pageCount: number, pageThickness: number,
1954
+ /** Total active pages when the solve is split by damping; keeps the iteration policy global. */
1955
+ iterationBasis?: number): void;
1935
1956
 
1936
1957
 
1937
1958
  export function compileShader(gl: WebGL2RenderingContext, type: number, src: string): WebGLShader;
@@ -2473,6 +2494,59 @@ declare module '@micrio/client' {
2473
2494
  }
2474
2495
 
2475
2496
 
2497
+ /**
2498
+ * # Minimal typed state machine
2499
+ *
2500
+ * A component-level reducer with explicit phases, queued events and cancellable effects.
2501
+ * It is deliberately small: there is no statechart layer, no global registry and no
2502
+ * dependency. The state is a plain object whose `phase` discriminant makes the legal
2503
+ * combinations explicit; the reducer is a pure `(state, event) => next | null` function.
2504
+ *
2505
+ * Effects run after subscribers and are split by lifetime:
2506
+ *
2507
+ * - `effect` runs on every accepted transition. Its signal aborts on the next transition
2508
+ * (or disposal), which suits one-shot async work such as a fetch or a public event.
2509
+ * - `enter[phase]` runs on entering a phase. Its signal survives same-phase transitions and
2510
+ * aborts only when that phase is left (or the machine is disposed), which suits a ticker
2511
+ * or an adapter listener.
2512
+ *
2513
+ * This is for component state, not hot paths: a machine per tile or a state object per
2514
+ * animation frame would cost more than the flags it replaces.
2515
+ *
2516
+ * @author Marcel Duin <marcel@micr.io>
2517
+ */
2518
+ /** The only shape the runtime requires: a discriminant that effects can key on. */
2519
+ export interface MachineState {
2520
+ readonly phase: string;
2521
+ }
2522
+ /** Returns the next state, or `null` when the event does not apply. */
2523
+ export type MachineReducer<S extends MachineState, E, C> = (state: Readonly<S>, event: E, context: C) => S | null;
2524
+ /** The arguments every effect receives. */
2525
+ export interface MachineArgs<S extends MachineState, E, C> {
2526
+ readonly state: Readonly<S>;
2527
+ readonly previous: Readonly<S>;
2528
+ readonly event: E;
2529
+ readonly context: C;
2530
+ readonly signal: AbortSignal;
2531
+ }
2532
+ /** Configuration for {@link createMachine}. */
2533
+ export interface MachineOptions<S extends MachineState, E, C> {
2534
+ initial: S;
2535
+ context: C;
2536
+ reduce: MachineReducer<S, E, C>;
2537
+ /** Runs after every accepted transition; signal aborts on the next transition. */
2538
+ effect?: (args: MachineArgs<S, E, C>) => void | Promise<void>;
2539
+ /** Runs when entering a phase; signal aborts on leaving the phase or disposal. */
2540
+ enter?: Partial<Record<S['phase'], (args: MachineArgs<S, E, C>) => void | Promise<void>>>;
2541
+ }
2542
+ /** The read-only machine surface. */
2543
+ export interface Machine<S extends MachineState, E> extends Readable<S> {
2544
+ readonly $state: S;
2545
+ send: (event: E) => void;
2546
+ dispose: () => void;
2547
+ }
2548
+
2549
+
2476
2550
  export interface MicrioSplitLink {
2477
2551
  micrioId: string;
2478
2552
  markerId?: string;
@@ -2748,6 +2822,9 @@ declare module '@micrio/client' {
2748
2822
  export {};
2749
2823
 
2750
2824
 
2825
+ export {};
2826
+
2827
+
2751
2828
  /** Manages a collection of gallery images with navigation (swipe, switch, grid, album). */
2752
2829
  export class Gallery {
2753
2830
  #private;
@@ -2884,6 +2961,9 @@ declare module '@micrio/client' {
2884
2961
  export {};
2885
2962
 
2886
2963
 
2964
+ export {};
2965
+
2966
+
2887
2967
  /**
2888
2968
  * HLS.js Player adapter.
2889
2969
  * Extends HTML5PlayerAdapter to add HLS.js streaming support.
@@ -2900,6 +2980,12 @@ declare module '@micrio/client' {
2900
2980
  export {};
2901
2981
 
2902
2982
 
2983
+ export {};
2984
+
2985
+
2986
+ export {};
2987
+
2988
+
2903
2989
  /**
2904
2990
  * Video tour controller. Manages playback and camera animation for video tours
2905
2991
  * defined by a timeline of view rectangles and durations.
@@ -3131,6 +3217,9 @@ declare module '@micrio/client' {
3131
3217
  export {};
3132
3218
 
3133
3219
 
3220
+ export {};
3221
+
3222
+
3134
3223
  /** Names of all icons available in the Micrio UI icon library. */
3135
3224
  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
3225