@micrio/client 7.4.7 → 7.5.0-alpha.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
@@ -414,6 +414,10 @@ declare module '@micrio/client' {
414
414
  isPng?: boolean;
415
415
  /** The tiled image is in DeepZoom format */
416
416
  isDeepZoom?: boolean;
417
+ /** The image tiles are stored in a single-file bundle served via IIIF tile endpoints */
418
+ isBundle?: boolean;
419
+ /** Optional IIIF service base URL override for bundled tile images */
420
+ iiifBase?: string;
417
421
  /** The image has a IIIF source */
418
422
  isIIIF?: boolean;
419
423
  /** Use a custom, single source uri for the zoomable image / video */
@@ -474,6 +478,8 @@ declare module '@micrio/client' {
474
478
  embedFadeDuration?: number;
475
479
  /** When being re-shown, always restart */
476
480
  embedRestartWhenShown?: boolean;
481
+ /** How embedded images/videos are rendered: `'auto'` (default heuristics), `'true'` (force WebGL), or `'false'` (force HTML). */
482
+ embedsInsideGl?: Attributes.EmbedGLMode;
477
483
  /** Don't stop drawing frames when idle */
478
484
  keepRendering?: boolean;
479
485
  /** Skip the deepest zoom levels */
@@ -594,14 +600,22 @@ declare module '@micrio/client' {
594
600
  ui?: Partial<UserInterfaceSettings>;
595
601
  /** Grid display and interaction settings */
596
602
  grid?: {
597
- /** Click behavior for grid images: `'focus'` expands to full view, `'zoom'` zooms to the image's viewport */
598
- clickable?: 'focus' | 'zoom';
603
+ /** Click behavior for grid images: `'focus'` expands to full view, `'zoom'` zooms to the image's viewport, `false` disables tile clicks */
604
+ clickable?: 'focus' | 'zoom' | false;
599
605
  /** Pan/zoom behavior: `'cells'` operates on the individual cell under the cursor, `'grid'` operates on the main grid container */
600
606
  panZoom?: 'cells' | 'grid';
601
607
  /** Transition duration for grid animations, in seconds */
602
608
  transitionDuration?: number;
603
609
  /** Transition duration when going back, in seconds */
604
610
  transitionDurationOut?: number;
611
+ /** Optional image ID to start the grid immediately focussed on (single-image full view, zero flash) */
612
+ initialFocusId?: string;
613
+ /** When true, omits the built-in floating close button while an image is focussed */
614
+ noCloseButton?: boolean;
615
+ /** Named reusable Grid Effects authored for this grid album */
616
+ effects?: Grid.GridEffect[];
617
+ /** Optional ID of a GridEffect in `effects` to open the grid on immediately (without animating) */
618
+ startEffectId?: string;
605
619
  };
606
620
  /** ADVANCED: A fragment shader for WebGL postprocessing
607
621
  * This shader MUST have and use:
@@ -632,6 +646,14 @@ declare module '@micrio/client' {
632
646
  /** File size in bytes */
633
647
  fileSize: number;
634
648
  }
649
+ /** Live comparison state between two layers of a multi-layer Omni object. */
650
+ interface OmniLayerCompare {
651
+ mode: 'wipe' | 'blend';
652
+ layerA: number;
653
+ layerB: number;
654
+ /** Curtain split fraction `[0..1]` (for `wipe`) or blend alpha `[0..1]` (for `blend`). */
655
+ position: number;
656
+ }
635
657
  interface OmniSettings {
636
658
  /** Number of frames */
637
659
  frames: number;
@@ -645,8 +667,8 @@ declare module '@micrio/client' {
645
667
  distance: number;
646
668
  /** Adjust the center for an object */
647
669
  offsetX: number;
648
- /** Put the labels on the side of the object */
649
- sideLabels?: boolean;
670
+ /** Derive camera distance, FOV, vertical angle and horizontal offset automatically from embedded SOG metadata */
671
+ autoCamera?: boolean;
650
672
  /**
651
673
  * Which frame is 0deg rotation.
652
674
  * @deprecated Read nowhere in this client, and exposed by no dashboard page — a legacy
@@ -664,6 +686,8 @@ declare module '@micrio/client' {
664
686
  sog?: SogInfo[];
665
687
  /** Optional starting layer idx */
666
688
  layerStartIndex?: number;
689
+ /** Layer switching / comparison presentation for multi-layer Omni objects */
690
+ layerMode?: 'switch' | 'crossfade' | 'wipe' | 'blend';
667
691
  /** Hide the rotation dial */
668
692
  noDial?: boolean;
669
693
  /** Show degrees on dial */
@@ -754,6 +778,8 @@ declare module '@micrio/client' {
754
778
  type?: 'swipe' | 'switch' | 'grid' | 'book3d';
755
779
  startId?: string;
756
780
  sort?: 'name' | '-name' | 'created' | '-created' | 'random';
781
+ /** Optional explicit page order (image IDs) overriding `sort`; any unlisted images follow in `sort` order. */
782
+ pageOrder?: string[];
757
783
  isSpreads?: boolean;
758
784
  coverPages?: number;
759
785
  archive?: string;
@@ -766,6 +792,10 @@ declare module '@micrio/client' {
766
792
  grid?: {
767
793
  clickable?: 'focus' | 'zoom' | false;
768
794
  panZoom?: 'cells' | 'grid';
795
+ initialFocusId?: string;
796
+ noCloseButton?: boolean;
797
+ effects?: Grid.GridEffect[];
798
+ startEffectId?: string;
769
799
  };
770
800
  }
771
801
 
@@ -788,6 +818,8 @@ declare module '@micrio/client' {
788
818
  from?: string;
789
819
  /** Optional stacking order override (higher values render on top). */
790
820
  z?: number;
821
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
822
+ cover?: boolean;
791
823
  }
792
824
  /** An empty placeholder cell in a grid layout, occupying grid space without an image */
793
825
  interface GridEmptyCell {
@@ -817,6 +849,137 @@ declare module '@micrio/client' {
817
849
  /** Blur the image during transition, in pixels */
818
850
  blur?: number;
819
851
  }
852
+ /** How a `layout` step selects which images participate. */
853
+ type GridImageSource = {
854
+ mode: 'all';
855
+ } | {
856
+ mode: 'current';
857
+ } | {
858
+ mode: 'select';
859
+ ids: string[];
860
+ } | {
861
+ mode: 'tags';
862
+ tags: string[];
863
+ match?: 'any' | 'all';
864
+ zoomToMarker?: boolean;
865
+ } | {
866
+ mode: 'tour';
867
+ };
868
+ /** Per-image modifier rule layered on top of a `layout` step's matched images. */
869
+ interface GridLayoutRule {
870
+ /** Target image ID, `'$current'` (owning image of the trigger), or `'$first'` (first matched image). */
871
+ target: string;
872
+ /** Override cell span `[columns, rows?]`. */
873
+ size?: [number, number?];
874
+ /** Source image ID (or `'$current'` / `'$first'`) to grow from when `transition === 'in-from-id'`. */
875
+ from?: string;
876
+ /** Stacking order override. */
877
+ z?: number;
878
+ /** Optional camera view inside this image. */
879
+ view?: Camera.View;
880
+ /** Optional marker ID on this image to zoom into. */
881
+ markerId?: string;
882
+ /** Pin to start (`'prepend'`), end (`'append'`), or keep natural position (`'keep'`). */
883
+ position?: 'keep' | 'prepend' | 'append';
884
+ /** Include this image even if it was not matched by `source`. */
885
+ include?: boolean;
886
+ /** Exclude this image from the matched set. */
887
+ exclude?: boolean;
888
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
889
+ cover?: boolean;
890
+ }
891
+ /** Explicit cell entry for direct visual mosaic authoring (supports exact order and empty spacers). */
892
+ interface GridEffectCell {
893
+ /** Image ID (or `'$current'`); omitted when `empty: true`. */
894
+ id?: string;
895
+ empty?: boolean;
896
+ size?: [number, number?];
897
+ from?: string;
898
+ z?: number;
899
+ view?: Camera.View;
900
+ markerId?: string;
901
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
902
+ cover?: boolean;
903
+ }
904
+ /** One executable step inside a {@link GridEffect}. */
905
+ type GridEffectStep = {
906
+ type: 'layout';
907
+ source?: GridImageSource;
908
+ rules?: GridLayoutRule[];
909
+ /** Explicit ordered cells (including empty spacers); overrides `source` when provided. */
910
+ cells?: GridEffectCell[];
911
+ arrangement?: 'auto' | 'row' | 'columns';
912
+ columns?: number;
913
+ scale?: number;
914
+ transition?: GridSetTransition;
915
+ duration?: number;
916
+ view?: Camera.View;
917
+ cover?: boolean;
918
+ noHistory?: boolean;
919
+ } | {
920
+ type: 'focus';
921
+ /** Target image ID or `'$current'`. */
922
+ imageId: string;
923
+ transition?: MarkerFocusTransition;
924
+ duration?: number;
925
+ view?: Camera.View;
926
+ markerId?: string;
927
+ blur?: number;
928
+ cover?: boolean;
929
+ coverLimit?: boolean;
930
+ } | {
931
+ type: 'flyTo';
932
+ imageIds?: string[];
933
+ tags?: string[];
934
+ match?: 'any' | 'all';
935
+ duration?: number;
936
+ } | {
937
+ type: 'resize';
938
+ /** Target image ID or `'$current'`. */
939
+ imageId: string;
940
+ size: [number, number];
941
+ duration?: number;
942
+ } | {
943
+ type: 'reset';
944
+ duration?: number;
945
+ } | {
946
+ type: 'back';
947
+ duration?: number;
948
+ } | {
949
+ type: 'switchToGrid';
950
+ } | {
951
+ type: 'delay';
952
+ seconds: number;
953
+ } | {
954
+ type: 'fadeDuration';
955
+ seconds: number;
956
+ };
957
+ /** A named, reusable Grid Action / Effect executed by `grid.runEffect()`. */
958
+ interface GridEffect {
959
+ /** Stable unique identifier referenced by Video Tour events and Markers. */
960
+ id: string;
961
+ /** Human-readable name displayed in pickers and timelines. */
962
+ name: string;
963
+ /** Optional description of what this effect does. */
964
+ description?: string;
965
+ /** Optional accent color token for editor badges. */
966
+ color?: string;
967
+ /** Ordered sequence of steps executed by this effect. */
968
+ steps: GridEffectStep[];
969
+ }
970
+ /** Context options passed to `grid.runEffect()`. */
971
+ interface RunEffectOptions {
972
+ /** Default transition duration in seconds when a step omits `duration`. */
973
+ duration?: number;
974
+ /** When true, applies the effect's final configuration immediately with zero animation/delays (used for opening/starting effects). */
975
+ instant?: boolean;
976
+ /** Owning image ID used to resolve `'$current'` targets. */
977
+ sourceImageId?: string;
978
+ /** Triggering marker ID, if triggered by a marker. */
979
+ sourceMarkerId?: string;
980
+ /** Fallback focus transition (e.g. a marker's `gridTourTransition`). */
981
+ focusTransition?: MarkerFocusTransition;
982
+ }
820
983
  }
821
984
 
822
985
  /**
@@ -964,6 +1127,8 @@ declare module '@micrio/client' {
964
1127
  view?: Camera.View;
965
1128
  /** If an image has multiple layers, switch to this layer */
966
1129
  imageLayer?: number;
1130
+ /** Omni-objects with multiple layers: only display this marker on the specified layer indices (omitted/empty = all layers) */
1131
+ visibleLayers?: number[];
967
1132
  /** Content type, for displaying */
968
1133
  type?: 'default' | 'image' | 'audio' | 'video' | 'media' | 'link' | 'waypoint' | 'cluster';
969
1134
  /** Popup type */
@@ -988,11 +1153,20 @@ declare module '@micrio/client' {
988
1153
  videoTour?: VideoTour;
989
1154
  /** Positional audio asset */
990
1155
  positionalAudio?: Assets.AudioLocation;
1156
+ /** Marker tours that include this marker (used to auto-start cross-image tours and auto-bundle tour owners) */
1157
+ tours?: MarkerTourRef[];
991
1158
  /** Optional function that overrides all behavior */
992
1159
  onclick?: (m: ImageData.Marker) => void;
993
1160
  /** Additional options */
994
1161
  data?: MarkerData;
995
1162
  }
1163
+ /** Reference from a marker to a marker tour that includes it */
1164
+ interface MarkerTourRef {
1165
+ /** The Micrio ID of the image that owns the marker tour */
1166
+ micrioId: string;
1167
+ /** The ID of the marker tour */
1168
+ tourId: string;
1169
+ }
996
1170
  /** Optional individual marker settings */
997
1171
  interface MarkerData {
998
1172
  /** A custom marker icon image */
@@ -1024,6 +1198,10 @@ declare module '@micrio/client' {
1024
1198
  micrioSplitLink?: string;
1025
1199
  /** Grid tour transition animation */
1026
1200
  gridTourTransition?: Grid.MarkerFocusTransition;
1201
+ /** Named album GridEffect ID or inline GridEffect executed when this marker opens inside a grid */
1202
+ gridEffect?: string | Grid.GridEffect;
1203
+ /** Optional grid behavior when this marker closes (`'keep'` default, `'back'`, or `'reset'`) */
1204
+ gridEffectOnClose?: 'keep' | 'back' | 'reset';
1027
1205
  /** Optional custom settings. This is the "Custom JSON" field in the marker editor */
1028
1206
  _meta?: {
1029
1207
  /** For in grid multi-image tour, this step is in grid view */
@@ -1182,6 +1360,8 @@ declare module '@micrio/client' {
1182
1360
  scrollable?: boolean;
1183
1361
  /** Don't reset view when tour ends */
1184
1362
  keepLastStep?: boolean;
1363
+ /** Zoom out to full view before transitioning to another image/page in multi-image or album tours */
1364
+ zoomOutBeforeTransition?: boolean;
1185
1365
  /** Chapter-based multi-video serial tour */
1186
1366
  isSerialTour?: boolean;
1187
1367
  /** Print the chapters in the interface */
@@ -1416,7 +1596,6 @@ declare module '@micrio/client' {
1416
1596
  }
1417
1597
 
1418
1598
 
1419
- /** Manages spatial audio, playlist playback, and user interaction for Micrio images. */
1420
1599
  export class MicrioAudioController {
1421
1600
  #private;
1422
1601
  constructor(micrio: HTMLMicrioElement, image: MicrioImage);
@@ -1434,631 +1613,67 @@ declare module '@micrio/client' {
1434
1613
  export {};
1435
1614
 
1436
1615
 
1437
- export interface DrawnImage {
1438
- /** The micrio image id. */
1439
- id: string;
1440
- /**
1441
- * A rough axis-aligned rectangle `[u, v, w, h]` in the image's texture UV
1442
- * space (0..1) covering the part currently visible in the viewport. The
1443
- * full texture visible is `[0, 0, 1, 1]`.
1444
- */
1445
- bounds: [number, number, number, number];
1446
- }
1447
- export interface BookViewerOptions {
1448
- /** The WebGL2 canvas to render into. Must be present in the document and sized by its host. */
1449
- _canvas: HTMLCanvasElement;
1450
- /** The already-loaded book index JSON. */
1451
- _images: Models.ImageInfo.ImageInfo[];
1452
- /** Called whenever the current reading position changes. */
1453
- _onPageChange?: (pageIdx: number) => void;
1454
- /** Called whenever the camera moves (rotate/zoom/pan, including smoothing). */
1455
- _onViewChange?: (images: DrawnImage[]) => void;
1456
- /** Called after every frame that is drawn to the canvas, with the micrioIds of the images visible in the current spread (plus any page mid-flip), each with a rough `[u, v, w, h]` rectangle (in texture UV space 0..1) of the part visible in the viewport. */
1457
- _onDraw?: (images: DrawnImage[]) => void;
1458
- _hardCover?: boolean;
1459
- _tiltShift?: boolean;
1460
- _lightingPreset?: string;
1461
- _useIndividualAspects?: boolean;
1462
- /** When true, page margins without a texture are discarded instead of drawn as
1463
- * transparent: they no longer block the pages behind them and you can see
1464
- * through to the underlying spread. */
1465
- _seeThroughMargins?: boolean;
1466
- /** When false, the 90° rotate-view feature is disabled and its UI is hidden. Defaults to true. */
1467
- _allowRotation?: boolean;
1468
- _startPageIdx?: number;
1469
- /** Base URL for the IIIF image server (hi-res streaming). */
1470
- _iiifBaseUrl?: string;
1471
- }
1472
- export class BookViewer {
1473
- #private;
1474
- static _getPresets: typeof getPresets;
1475
- readonly _ready: Promise<void>;
1476
- constructor(options: BookViewerOptions);
1477
- goto(pageIdx: number): Promise<void>;
1478
- zoom(delta: number): void;
1479
- /**
1480
- * Rotates the view by a 90° increment around the vertical axis: `1` turns
1481
- * the book to the right (clockwise), `-1` to the left (counter-clockwise).
1482
- */
1483
- rotateView(direction: 1 | -1): void;
1484
- /** Whether the 90° rotate-view feature is enabled. */
1485
- _allowRotation(): boolean;
1486
- /**
1487
- * Returns whether the camera is zoomed in beyond the fit view. This is the
1488
- * complement of "the whole spread fits the viewport": when every currently
1489
- * visible image shows its full texture (`[0, 0, 1, 1]` bounds) the view is
1490
- * zoomed out, and any image cut off by the viewport means it is zoomed in.
1491
- * A page that is part of the current view but entirely out of the viewport
1492
- * (e.g. one page of a spread fills the screen while the other is off-screen)
1493
- * also counts as zoomed in. Based on the last rendered frame's on-screen
1494
- * bounds, so it stays accurate after zooming back out.
1495
- */
1496
- isZoomedIn(): boolean;
1497
- setLightingPreset(name: string): void;
1498
- _getCurrentPage(): number;
1499
- _getPageCount(): number;
1500
- _nextPage(grabRow?: number): void;
1501
- _prevPage(grabRow?: number): void;
1502
- _hookImageBook3d(img: MicrioImage): void;
1503
- }
1616
+ export {};
1504
1617
 
1505
1618
 
1506
1619
  export {};
1507
1620
 
1508
1621
 
1509
- export class PageFlipAnimator {
1510
- #private;
1511
- _hardCoverPages: Set<number>;
1512
- get _animating(): boolean;
1513
- _isPageAnimating(pageIndex: number): boolean;
1514
- /** -1 = flipping back (left→right), +1 = flipping forward (right→left), 0 = idle/dragging. */
1515
- _getPageDirection(pageIndex: number): number;
1516
- _getPageProgress(pageIndex: number): number;
1517
- _setPageProgress(pageIndex: number, value: number): void;
1518
- _instantFlip(mesh: PaperMesh, pageIndex: number): void;
1519
- _initSlots(pageCount: number): void;
1520
- _flipLeft(pageIndex?: number, grabRow?: number): void;
1521
- _flipRight(pageIndex?: number, grabRow?: number): void;
1522
- _beginDrag(pageIndex: number, grabRow: number): void;
1523
- _setDragProgress(pageIndex: number, progress: number): void;
1524
- _endDrag(pageIndex: number, direction: number): void;
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;
1528
- _reset(meshes: PaperMesh[]): void;
1529
- _update(dt: number, meshes: PaperMesh[], selectedPage: number, totalStackHeight: number, pageCount: number, pageThickness: number): void;
1530
- }
1622
+ export {};
1531
1623
 
1532
1624
 
1533
- export function computeWeightFactor(progress: Float32Array, pageCount: number): number;
1534
- export function computePageSpineY(pageIndex: number, progress: number, weightFactor: number, totalStackHeight: number, pageCount: number, pageThickness: number): number;
1535
- export function computeAllPageFloors(progress: Float32Array, weightFactor: number, totalStackHeight: number, pageCount: number, pageThickness: number): Float32Array;
1536
- export function applySpineDelta(positions: Float32Array, delta: number): void;
1625
+ export {};
1537
1626
 
1538
1627
 
1539
- /**
1540
- * The page layout of a book: how the images are paired onto physical pages and
1541
- * the aspect ratios each page (and each face) is initialised with.
1542
- */
1543
- export interface PageLayout {
1544
- /** Number of physical pages: `ceil(images.length / 2)`. */
1545
- pageCnt: number;
1546
- /** The image indices displayed on each page: `[0]`, then `[1, 2]`, `[3, 4]`, … */
1547
- pageIdxes: number[][];
1548
- /** The number of images in the book. */
1549
- totalImagePages: number;
1550
- /** The page aspect (height / width) every page's geometry is built with. */
1551
- aspectsForInit: Float32Array;
1552
- /** Per-page front face aspect (height / width) of the front image. */
1553
- frontAspects: Float32Array;
1554
- /** Per-page back face aspect, falling back to the front's when there is no back image. */
1555
- backAspects: Float32Array;
1556
- /** The book-wide average aspect every page is built with. */
1557
- avgAspect: number;
1558
- }
1559
- /**
1560
- * Pairs the book's images onto pages and computes the aspect ratios each page is
1561
- * initialised with.
1562
- *
1563
- * Page 0 holds image 0 alone; every following page holds the pair `2p-1, 2p`, so
1564
- * the covers are the outer pages of the book. Images with no usable dimensions
1565
- * (`width`/`height` <= 0, or missing) contribute the default aspect instead of
1566
- * skewing the average.
1567
- *
1568
- * Note that every page shares one geometry (the book-wide average aspect);
1569
- * per-image aspects are honoured by rendering each texture in its own region of
1570
- * the page (see `computeTexRegion`) rather than by resizing the page.
1571
- */
1572
- export function computePageLayout(images: Models.ImageInfo.ImageInfo[]): PageLayout;
1573
- /**
1574
- * The sub-rectangle of a page's UV space in which a texture with `texAspect`
1575
- * (height / width) is drawn without distortion on a page of aspect `pageAspect`.
1576
- * Returns `[uMin, vMin, fU, fV]`; the leftover page space is transparent.
1577
- *
1578
- * The image is always anchored to the book's spine. When `spineAtHigh` is true
1579
- * the spine lies at sampled u = 1 (a single-grid page's back face, sampled
1580
- * mirrored), so the image's far edge sits on the spine (`uMin = 1 - fU`).
1581
- * Otherwise the spine lies at sampled u = 0 and the image's near edge sits on it
1582
- * (`uMin = 0`). Vertically the image stays centered.
1583
- */
1584
- export function computeTexRegion(texAspect: number, pageAspect: number, spineAtHigh: boolean): [number, number, number, number];
1628
+ export {};
1585
1629
 
1586
1630
 
1587
- export class OrbitCamera {
1588
- #private;
1589
- _theta: number;
1590
- _phi: number;
1591
- _radius: number;
1592
- _target: Vec3;
1593
- _rotateSpeed: number;
1594
- _zoomSpeed: number;
1595
- _minRadius: number;
1596
- _maxRadius: number;
1597
- _panBoundsMin: Vec3 | null;
1598
- _panBoundsMax: Vec3 | null;
1599
- _freeCamMode: boolean;
1600
- _canPanLeft: boolean;
1601
- _canPanRight: boolean;
1602
- _canPanUp: boolean;
1603
- _canPanDown: boolean;
1604
- _manualZoomActive: boolean;
1605
- _isZoomedIn(): boolean;
1606
- _fov: number;
1607
- _setCanvasSize(w: number, h: number): void;
1608
- _initContainRadius(bounds: {
1609
- minX: number;
1610
- maxX: number;
1611
- minZ: number;
1612
- maxZ: number;
1613
- }, margin: number): void;
1614
- _snap(): void;
1615
- _update(dt: number): void;
1616
- _isMoving(): boolean;
1617
- _getEye(): Vec3;
1618
- _getViewMatrix(): Mat4;
1619
- _setFreeCamMode(on: boolean): void;
1620
- _rotate(deltaTheta: number, deltaPhi: number, clampPhi?: boolean): void;
1621
- /**
1622
- * Rotates the view by a 90° step (`π/2`) around the vertical axis to either
1623
- * side: `+1` turns clockwise (right), `-1` counter-clockwise (left). The
1624
- * current target azimuth is snapped to the nearest 90° grid point first, so
1625
- * the view always rests on a 90° increment even after a free-drag orbit.
1626
- */
1627
- _rotateViewStep(direction: 1 | -1): void;
1628
- _getPickRay(screenX: number, screenY: number): {
1629
- origin: Vec3;
1630
- direction: Vec3;
1631
- };
1632
- _zoom(delta: number, hitPoint?: Vec3): void;
1633
- _pan(deltaX: number, deltaY: number): void;
1634
- _clampViewport(screenBounds: {
1635
- minX: number;
1636
- maxX: number;
1637
- minY: number;
1638
- maxY: number;
1639
- }, viewportW: number, viewportH: number, margin: number): void;
1640
- }
1631
+ export {};
1641
1632
 
1642
1633
 
1643
- /** Thickness of a single paper page in world-space units */
1644
- export const PAGE_THICKNESS = 0.0012;
1645
- /** Width of every page in world-space units: the book shares one page geometry,
1646
- * and a page's own shape comes from its aspect (`aspectsForInit`). */
1647
- export const PAGE_WIDTH = 1;
1648
- /** Default page aspect ratio (height / width) — √2 ≅ A4 paper */
1649
- export const DEFAULT_ASPECT: number;
1650
- /** Use each page's own aspect ratio from source images instead of the book-wide average */
1651
- export const USE_INDIVIDUAL_ASPECTS = false;
1652
- /** Whether the first/last pages are rendered as hard covers */
1653
- export const HARD_COVER = false;
1654
- /** Cover thickness relative to a regular paper page */
1655
- export const COVER_THICKNESS_MULTIPLIER = 16;
1656
- /** Cover face scale relative to paper face (1.04 = 4% larger on width) */
1657
- export const COVER_SCALE_X = 1.04;
1658
- /** Cover face scale relative to paper face on height axis (1.08 = 8% taller) */
1659
- export const COVER_SCALE_Y = 1.08;
1660
- /** Number of vertex columns in the paper/cover face grid */
1661
- export const GRID_COLS = 10;
1662
- /** Number of vertex rows in the paper/cover face grid */
1663
- export const GRID_ROWS = 14;
1664
- /** Total vertex count per face grid */
1665
- export const VERTEX_COUNT: number;
1666
- /** Flip speed multiplier (1.0 = baseline, higher = faster flip) */
1667
- export const FLIP_SPEED = 0.6;
1668
- /** How far from the top edge to grab the corner during a flip (0.0 = top, 1.0 = bottom) */
1669
- export const GRAB_ROW = 0.35;
1670
- /** Maximum random offset added to GRAB_ROW each flip, to make the transition more natural */
1671
- export const GRAB_ROW_MAX_OFFSET = 0.12;
1672
- /** Tighter max random offset used during rapid .goto() flips for a more uniform look */
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;
1680
- /** Peak arc height of the flipped corner above the rest position */
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;
1684
- /** Base duration (seconds) for a full page flip at speed 1.0 */
1685
- export const BASE_FLIP_DURATION = 0.6;
1686
- /** Number of constraint solver iterations per substep */
1687
- export const SOLVER_ITERATIONS = 64;
1688
- /** Number of physics substeps per frame */
1689
- export const SOLVER_SUBSTEPS = 3;
1690
- /** Distance constraint compliance (0.0 = perfectly stiff) */
1691
- export const DISTANCE_COMPLIANCE = 0;
1692
- /** Bending constraint compliance (lower = stiffer) */
1693
- export const BENDING_COMPLIANCE = 0.000041;
1694
- /** Velocity damping per substep (0.92 = 8% velocity loss per substep) */
1695
- export const DAMPING = 0.975;
1696
- /** Damping used while a rapid .goto() still has pages turning (higher = livelier, slower to settle) */
1697
- export const GOTO_DAMPING = 0.995;
1698
- /** Gravitational acceleration in world-space units */
1699
- export const GRAVITY = 9.81;
1700
- /** Whether gravity is active */
1701
- export const GRAVITY_ENABLED = true;
1702
- /** Minimum vertex position delta to consider a page still "active" — below this it goes idle */
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;
1707
- /** Margin around the book as a fraction of the smaller viewport dimension (0.05 = 5%) */
1708
- export const VIEWPORT_MARGIN_PCT = 0.05;
1709
- /** Default camera polar angle in radians (0 = side view, π/2 = directly overhead) */
1710
- export const DEFAULT_CAMERA_PHI: number;
1711
- /** When true, page margins without a texture are discarded instead of drawn as
1712
- * transparent: they no longer block the pages behind them and you can see
1713
- * through to the underlying spread. */
1714
- export const SEE_THROUGH_MARGINS = false;
1715
- /** RGB tint for the front face of each page */
1716
- export const FRONT_COLOR: [number, number, number];
1717
- /** RGB tint for the back face of each page */
1718
- export const BACK_COLOR: [number, number, number];
1719
- /** Base URL for IIIF image server */
1720
- export const IIIF_BASE_URL = "https://iiif.micr.io";
1721
- /** Base debounce before starting a download for the currently viewed spread (ms) */
1722
- export const IIIF_DEBOUNCE_BASE_MS = 500;
1723
- /** Additional debounce per page distance from the spread center (ms) */
1724
- export const IIIF_DEBOUNCE_PER_DISTANCE_MS = 2000;
1725
- /** Duration of the cross-fade from low-res to hi-res texture (ms) */
1726
- export const IIIF_CROSSFADE_DURATION = 500;
1727
- /** Spreads away from the current spread before hi-res textures are pre-loaded */
1728
- export const IIIF_PRELOAD_DISTANCE = 1;
1729
- /** Spreads away from the current spread before hi-res textures are evicted from GPU */
1730
- export const IIIF_GPU_EVICT_DISTANCE = 5;
1731
- /** Default camera radius (used as baseline for zoom-aware IIIF resolution choice) */
1732
- export const DEFAULT_CAMERA_RADIUS = 2.2;
1733
- /** Master toggle for the tilt-shift blur effect */
1734
- export const TILT_SHIFT_ENABLED = true;
1735
- /** Normalised screen-space Y coordinate of the in-focus band centre (0 = bottom, 1 = top) */
1736
- export const TILT_SHIFT_FOCUS_CENTER = 0.55;
1737
- /** Vertical height of the sharp in-focus band as a fraction of the viewport */
1738
- export const TILT_SHIFT_FOCUS_WIDTH = 0.25;
1739
- /** Maximum blur radius in screen pixels (applied at the furthest distance from the focus band) */
1740
- export const TILT_SHIFT_BLUR_RADIUS = 4;
1741
- /** Sharpness of the transition between in-focus and blurred regions (higher = sharper) */
1742
- export const TILT_SHIFT_BLUR_FALLOFF = 1;
1743
- /** Active lighting preset name. Available: 'daylight', 'incandescent', 'candlelight', 'rainy day', 'moonlight', 'fireplace', 'haunted' */
1744
- export const LIGHTING_PRESET = "daylight";
1745
-
1746
-
1747
- export interface PageClickResult {
1748
- direction: 'prev' | 'next';
1749
- grabRow: number;
1750
- }
1751
- export interface PageDragResult {
1752
- pageIndex: number;
1753
- grabRow: number;
1754
- worldX: number;
1755
- }
1634
+ export {};
1756
1635
 
1757
1636
 
1758
- export class Vec3 {
1759
- #private;
1760
- _x: number;
1761
- _y: number;
1762
- _z: number;
1763
- constructor(_x?: number, _y?: number, _z?: number);
1764
- _clone(): Vec3;
1765
- _set(x: number, y: number, z: number): Vec3;
1766
- _copy(v: Vec3): Vec3;
1767
- _add(v: Vec3): Vec3;
1768
- _sub(v: Vec3): Vec3;
1769
- _length(): number;
1770
- _normalize(): Vec3;
1771
- _dot(v: Vec3): number;
1772
- _cross(v: Vec3): Vec3;
1773
- }
1637
+ export {};
1774
1638
 
1775
1639
 
1776
- export class CoverMesh extends PaperMesh {
1777
- #private;
1778
- readonly _coverThickness: number;
1779
- readonly _coverScale: number;
1780
- readonly _coverScaleY: number;
1781
- constructor(yOffset?: number, paperWidth?: number, aspectRatio?: number, coverThickness?: number, coverScale?: number, coverScaleY?: number);
1782
- protected _generateGrid(): void;
1783
- protected _generateTexCoords(): void;
1784
- protected _generateTriangles(): void;
1785
- protected _generateDistanceConstraints(): void;
1786
- protected _generateBendingConstraints(): void;
1787
- protected _identifyBoundEdges(): void;
1788
- _computeNormals(): Float32Array;
1789
- }
1640
+ export {};
1790
1641
 
1791
1642
 
1792
- export interface EdgeConstraint {
1793
- _i: number;
1794
- _j: number;
1795
- _restLength: number;
1796
- }
1797
- export interface BendingConstraint {
1798
- _i: number;
1799
- _j: number;
1800
- _restLength: number;
1801
- }
1802
- export interface TriangleData {
1803
- _indices: [number, number, number];
1804
- }
1805
- export function buildIndexBuffer(triangles: TriangleData[]): Uint32Array;
1806
- export function computeVertexNormals(positions: Float32Array, triangles: TriangleData[], vertexCount: number): Float32Array;
1807
- export function addEdgeConstraint(i: number, j: number, restPositions: Float32Array, added: Set<string>, constrs: EdgeConstraint[]): void;
1808
- export function addGridConstraints(baseIdx: number, add: (i: number, j: number) => void): void;
1809
-
1810
-
1811
- export class PaperMesh {
1812
- _restPositions: Float32Array;
1813
- _positions: Float32Array;
1814
- _velocities: Float32Array;
1815
- _invMasses: Float32Array;
1816
- _texCoords: Float32Array;
1817
- _triangles: TriangleData[];
1818
- _indexBuffer: Uint32Array;
1819
- _distanceConstraints: EdgeConstraint[];
1820
- _bendingConstraints: BendingConstraint[];
1821
- _boundLeft: number[];
1822
- readonly _yOffset: number;
1823
- readonly _paperWidth: number;
1824
- readonly _paperHeight: number;
1825
- /**
1826
- * `generate` exists so a subclass can opt out of the grid/constraint build:
1827
- * this constructor calls the virtual `_generate*` methods, and a subclass
1828
- * override that uses private members cannot run before its own constructor
1829
- * body (the private brand is only installed after `super` returns). Such a
1830
- * subclass passes `false` and builds its geometry itself afterwards.
1831
- */
1832
- constructor(yOffset?: number, paperWidth?: number, aspectRatio?: number, generate?: boolean);
1833
- protected _generateGrid(paperHeight: number): void;
1834
- protected _generateTexCoords(): void;
1835
- protected _generateTriangles(): void;
1836
- protected _generateDistanceConstraints(): void;
1837
- protected _generateBendingConstraints(): void;
1838
- protected _identifyBoundEdges(): void;
1839
- _reset(): void;
1840
- _setBinding(): void;
1841
- _computeNormals(): Float32Array;
1842
- }
1643
+ export {};
1843
1644
 
1844
1645
 
1845
- export interface RayHit {
1846
- _t: number;
1847
- _point: Vec3;
1848
- _meshIndex: number;
1849
- }
1850
- export function rayIntersectMeshes(meshes: readonly PaperMesh[], origin: Vec3, direction: Vec3): RayHit | null;
1851
-
1852
-
1853
- export interface UvWorldResult {
1854
- /** Interpolated world-space position on the deformed mesh. */
1855
- _point: Vec3;
1856
- /** Interpolated (normalized) world-space surface normal at that point. */
1857
- _normal: Vec3;
1858
- /** World-space direction of increasing image u (not normalized). */
1859
- _tangentU: Vec3;
1860
- /** World-space direction of increasing image v (not normalized). */
1861
- _tangentV: Vec3;
1862
- }
1863
- /**
1864
- * The sub-rectangle of a page's UV space in which a texture is displayed with
1865
- * its native aspect ratio. `uMin`/`vMin` are the lower-left corner and
1866
- * `fU`/`fV` the fraction of the page's u/v range the texture occupies. A region
1867
- * of `(0, 0, 1, 1)` stretches the texture over the whole page.
1868
- */
1869
- export interface TexRegion {
1870
- uMin: number;
1871
- vMin: number;
1872
- fU: number;
1873
- fV: number;
1874
- }
1875
- /**
1876
- * Returns the world-space position, surface normal and UV tangents of a
1877
- * relative texture coordinate (u, v) on a page mesh, using the mesh's *current*
1878
- * (possibly animated/displaced) positions.
1879
- *
1880
- * `side` is the page side the image is displayed on:
1881
- * 0 = front face (sampled at uv directly),
1882
- * 1 = back face (sampled with the U axis mirrored on a single-grid PaperMesh,
1883
- * or on the separate back-face grid of a CoverMesh).
1884
- *
1885
- * `region` restricts the image to a sub-rectangle of the page (see
1886
- * {@link TexRegion}); the tangents are scaled accordingly. When omitted the
1887
- * image is stretched over the whole page.
1888
- *
1889
- * Returns null when (u, v) falls outside [0, 1].
1890
- */
1891
- export function uvToWorldPosition(mesh: PaperMesh, u: number, v: number, side: 0 | 1, region?: TexRegion | null): UvWorldResult | null;
1892
- /**
1893
- * Like `uvToWorldPosition` but returns only the interpolated world-space
1894
- * position, skipping the surface normal and tangent computation.
1895
- */
1896
- export function sampleMeshPosition(mesh: PaperMesh, u: number, v: number, side: 0 | 1, region?: TexRegion | null): Vec3 | null;
1897
- /**
1898
- * Projects a world-space point through the given view-projection matrix to CSS
1899
- * pixel coordinates relative to the canvas top-left. Returns null when the point
1900
- * is behind the camera.
1901
- */
1902
- export function projectWorldToScreen(point: Vec3, viewProj: Mat4, clientWidth: number, clientHeight: number): {
1903
- x: number;
1904
- y: number;
1905
- } | null;
1646
+ export {};
1906
1647
 
1907
1648
 
1908
- export class InputHandler {
1909
- #private;
1910
- _onPrevPage: (() => void) | null;
1911
- _onNextPage: (() => void) | null;
1912
- _onPageClick: ((x: number, y: number) => {
1913
- direction: 'prev' | 'next';
1914
- grabRow: number;
1915
- } | null) | null;
1916
- _lastClickGrabRow: number | null;
1917
- _onWheelZoom: ((screenX: number, screenY: number) => Vec3 | null) | null;
1918
- /** Override for the zoomed-in check, e.g. wired to the viewer's own viewport-fit logic. */
1919
- _isZoomedInFn: (() => boolean) | null;
1920
- _onPageDragStart: ((startX: number, startY: number) => void) | null;
1921
- _onPageDragMove: ((currentX: number, currentY: number) => void) | null;
1922
- _onPageDragEnd: (() => void) | null;
1923
- _operation: 'none' | 'orbit' | 'pan';
1924
- constructor(canvas: HTMLCanvasElement, camera: OrbitCamera, onActivity: () => void);
1925
- }
1649
+ export {};
1926
1650
 
1927
1651
 
1928
- /** Structure-of-arrays constraint layout for cache-friendly iteration. */
1929
- export interface ConstraintSet {
1930
- count: number;
1931
- i: Int32Array;
1932
- j: Int32Array;
1933
- restLength: Float32Array;
1934
- }
1935
- export interface SubstepParams {
1936
- dt: number;
1937
- solverIterations: number;
1938
- distanceCompliance: number;
1939
- bendingCompliance: number;
1940
- damping: number;
1941
- gravity: number;
1942
- gravityEnabled: boolean;
1943
- }
1944
- /** Flatten a mesh's {_i, _j, _restLength} constraint list into SoA buffers. */
1945
- export function buildConstraintSet(constraints: EdgeConstraint[] | BendingConstraint[]): ConstraintSet;
1946
- /**
1947
- * Run one XPBD substep over all vertices and constraints.
1948
- * Mutates `positions` / `velocities` in place and writes the start-of-step
1949
- * position backup into `prevPositions`.
1950
- */
1951
- export function runSubstep(positions: Float32Array, velocities: Float32Array, prevPositions: Float32Array, invMasses: Float32Array, N: number, distanceConstraints: ConstraintSet, bendingConstraints: ConstraintSet, distanceLambda: Float64Array, bendingLambda: Float64Array, params: SubstepParams, pageFloor: number): void;
1652
+ export {};
1952
1653
 
1953
1654
 
1954
- export interface SolverSettings {
1955
- _solverIterations: number;
1956
- _substeps: number;
1957
- _distanceCompliance: number;
1958
- _bendingCompliance: number;
1959
- _damping: number;
1960
- _gravity: number;
1961
- _gravityEnabled: boolean;
1962
- }
1963
- export function isSolverReady(): boolean;
1964
- export function initSolver(meshes: PaperMesh[], pageCount: number): Promise<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;
1655
+ export {};
1968
1656
 
1969
1657
 
1970
- export function compileShader(gl: WebGL2RenderingContext, type: number, src: string): WebGLShader;
1971
- export function createGLProgram(gl: WebGL2RenderingContext, vertSrc: string, fragSrc: string): WebGLProgram;
1972
- export function setupTextureParams(gl: WebGL2RenderingContext, tex: WebGLTexture): void;
1973
- export function createWhiteTexture(gl: WebGL2RenderingContext): WebGLTexture;
1658
+ export {};
1974
1659
 
1975
1660
 
1976
- export class IIIFTextureManager {
1977
- #private;
1978
- /** Set by the host so the manager can request a redraw when it has something new to show. */
1979
- _onRequestFrame: (() => void) | null;
1980
- constructor(renderer: PaperRenderer, baseUrl?: string);
1981
- _init(images: Models.ImageInfo.ImageInfo[], pageCount: number, pageIdxes: number[][]): void;
1982
- _onFrame(now: number, spreadCenter: number, cameraRadius: number): boolean;
1983
- _hasPendingWork(): boolean;
1984
- }
1661
+ export {};
1985
1662
 
1986
1663
 
1987
- export interface LightingParam {
1988
- key: string;
1989
- default: number;
1990
- }
1991
- export interface LightingPreset {
1992
- name: string;
1993
- isAnimated: boolean;
1994
- params: LightingParam[];
1995
- }
1996
- export interface LightingState {
1997
- _lightDir: [number, number, number];
1998
- _lightColor: [number, number, number];
1999
- _ambientColor: [number, number, number];
2000
- _numPointLights: number;
2001
- _pointLightPos: Float32Array;
2002
- _pointLightColor: Float32Array;
2003
- _pointLightIntensity: Float32Array;
2004
- _bumpStrength: number;
2005
- }
2006
- export function getPresets(): LightingPreset[];
2007
- export function getPreset(name: string): LightingPreset | undefined;
2008
- export function computeLighting(presetName: string, params: Record<string, number>, time: number): LightingState;
1664
+ export {};
2009
1665
 
2010
1666
 
2011
- export class PaperRenderer {
2012
- #private;
2013
- _tiltShiftEnabled: boolean;
2014
- /** When true, page margins without a texture are discarded (see-through) instead of drawn as transparent, so pages behind remain visible. */
2015
- _seeThroughMargins: boolean;
2016
- constructor(gl: WebGL2RenderingContext);
2017
- _initialize(meshes: PaperMesh[]): void;
2018
- _setPageTextures(pageIndex: number, frontBitmap: TexImageSource, backBitmap: TexImageSource): void;
2019
- _setPageHiResTexture(pageIdx: number, side: 0 | 1, slot: 0 | 1, bitmap: ImageBitmap): void;
2020
- _setPageBlend(pageIdx: number, frontBlendA: number, frontBlendB: number, backBlendA: number, backBlendB: number): void;
2021
- /**
2022
- * Sets the per-page texture regions (see the fragment shader): each page's
2023
- * front/back texture only occupies a sub-rectangle `[uMin, vMin, fU, fV]` of
2024
- * the page UV space. Pass regions of `(0, 0, 1, 1)` to stretch textures over
2025
- * the whole page. Each array has `4 · pageCount` floats.
2026
- */
2027
- _setAspectRegions(frontRegions: Float32Array, backRegions: Float32Array): void;
2028
- _evictPageHiRes(pageIdx: number, side: 0 | 1, slot: 0 | 1): void;
2029
- _getCanvas(): HTMLCanvasElement;
2030
- _setLightingPreset(name: string, params: Record<string, number>): void;
2031
- _isLightingAnimated(): boolean;
2032
- _resize(): void;
2033
- _updateVertexBuffer(meshIndex: number, mesh: PaperMesh): void;
2034
- _updateNormalBuffer(meshIndex: number, mesh: PaperMesh): void;
2035
- _getBoundingBoxCorners(): Float32Array | null;
2036
- _getCanvasSize(): {
2037
- width: number;
2038
- height: number;
2039
- };
2040
- /**
2041
- * Projects the 8 bounding box corners to screen CSS pixel coordinates.
2042
- * Returns { minX, maxX, minY, maxY } or null if no corners are visible.
2043
- */
2044
- _getBoundingBoxScreenBounds(viewProj: Mat4): {
2045
- minX: number;
2046
- maxX: number;
2047
- minY: number;
2048
- maxY: number;
2049
- } | null;
2050
- _setFlipProgress(progress: Float32Array): void;
2051
- _setBoundingBox(min: {
2052
- x: number;
2053
- y: number;
2054
- z: number;
2055
- }, max: {
2056
- x: number;
2057
- y: number;
2058
- z: number;
2059
- }): void;
2060
- _render(camera: OrbitCamera): void;
2061
- }
1667
+ export {};
1668
+
1669
+
1670
+ export {};
1671
+
1672
+
1673
+ export {};
1674
+
1675
+
1676
+ export {};
2062
1677
 
2063
1678
 
2064
1679
  /**
@@ -2127,6 +1742,48 @@ declare module '@micrio/client' {
2127
1742
  * @returns A Float64Array containing the screen coordinates [x, y, scale, depth].
2128
1743
  */
2129
1744
  getXY(x: number, y: number, abs?: boolean, radius?: number, rotation?: number, noTrueNorth?: boolean): Float64Array;
1745
+ /**
1746
+ * Projects a normalized image-space area `[x, y, width, height]` to screen-space CSS pixels,
1747
+ * returning its axis-aligned bounding rectangle and 4 projected corner coordinates
1748
+ * (top-left, top-right, bottom-right, bottom-left).
1749
+ * Returns `undefined` when the camera is not ready or the area is obscured / behind the camera.
1750
+ * @param area The normalized image area `[x0, y0, width, height]`.
1751
+ */
1752
+ getAreaScreenRect(area: Models.Camera.View): {
1753
+ x: number;
1754
+ y: number;
1755
+ width: number;
1756
+ height: number;
1757
+ corners: [number, number][];
1758
+ } | undefined;
1759
+ /**
1760
+ * Returns this image's rendered viewport `[left, top, width, height]` in CSS pixels
1761
+ * relative to the host `<micr-io>` element (matching the tile rect inside a grid,
1762
+ * or `[0, 0, offsetWidth, offsetHeight]` for a standalone canvas).
1763
+ */
1764
+ getViewportRect(): [number, number, number, number];
1765
+ /**
1766
+ * Converts normalized image coordinates `[0..1]` into CSS pixel coordinates `[x, y]`
1767
+ * relative to the host `<micr-io>` element (adding the tile viewport offset when inside a grid).
1768
+ * Returns `undefined` when the camera is not ready or the point is obscured.
1769
+ */
1770
+ getElementXY(x: number, y: number): [number, number] | undefined;
1771
+ /**
1772
+ * Projects a normalized image-space area `[x, y, width, height]` into CSS pixels
1773
+ * relative to the host `<micr-io>` element (adding the tile viewport offset when inside a grid).
1774
+ */
1775
+ getElementAreaRect(area: Models.Camera.View): {
1776
+ x: number;
1777
+ y: number;
1778
+ width: number;
1779
+ height: number;
1780
+ corners: [number, number][];
1781
+ } | undefined;
1782
+ /**
1783
+ * Converts CSS pixel coordinates relative to the host `<micr-io>` element into
1784
+ * normalized image coordinates `[x, y, scale, ...]`, accounting for grid tile offsets.
1785
+ */
1786
+ getCooFromElement(elX: number, elY: number, noLimit?: boolean): Float64Array;
2130
1787
  /**
2131
1788
  * Sets the center of the screen to the specified image coordinates and scale instantly.
2132
1789
  * @param x The target image X coordinate (0-1).
@@ -2158,6 +1815,12 @@ declare module '@micrio/client' {
2158
1815
  * @param pitch The target pitch in radians (defaults to current pitch).
2159
1816
  */
2160
1817
  setDirection(yaw: number, pitch?: number): void;
1818
+ /**
1819
+ * Updates the Y-axis sphere rotation (in radians) for 360° images,
1820
+ * syncing compass / true-north alignment immediately and triggering a re-render.
1821
+ * @param rad The target Y-axis rotation in radians.
1822
+ */
1823
+ setRotationY(rad: number): void;
2161
1824
  /**
2162
1825
  * Sets a rectangular limit for camera navigation within the image.
2163
1826
  * @param v The viewport limit [x, y, width, height] in image-relative coordinates.
@@ -2362,6 +2025,8 @@ declare module '@micrio/client' {
2362
2025
  readonly state: State.Main;
2363
2026
  /** Writable store indicating if barebone texture downloading is enabled (lower quality, less bandwidth). */
2364
2027
  readonly barebone: Writable<boolean>;
2028
+ /** Writable store indicating if the viewer is in editor mode (intercepts marker, waypoint, and embed clicks). */
2029
+ readonly editMode: Writable<boolean>;
2365
2030
  /** Custom settings object provided programmatically, overriding server-fetched settings. */
2366
2031
  defaultSettings?: Partial<Models.ImageInfo.Settings>;
2367
2032
  /** Holds data for the current 360 space, if applicable (loaded via `data-space` attribute or API). */
@@ -2392,6 +2057,31 @@ declare module '@micrio/client' {
2392
2057
  /** Optional Gallery controller, used for gallery/grid views. */
2393
2058
  gallery?: Gallery;
2394
2059
  }): Promise<MicrioImage | undefined>;
2060
+ /**
2061
+ * Tears down any active gallery/grid and closes its canvases so the element
2062
+ * can cleanly transition back to standalone single-image viewing or a new gallery.
2063
+ */
2064
+ closeGallery(): void;
2065
+ /**
2066
+ * Opens a multi-image gallery/album (`swipe`, `switch`, `book3d`, `grid`) directly from
2067
+ * in-memory {@link Models.ImageBundle.BundleImage} items and a {@link Models.GalleryConfig},
2068
+ * without requiring a published `bundle.json`.
2069
+ * @param items The bundle images to display in the gallery.
2070
+ * @param config Gallery layout and behavior configuration.
2071
+ * @returns The created {@link Gallery} controller, or `undefined` if disconnected or `items` is empty.
2072
+ */
2073
+ openGallery(items: Models.ImageBundle.BundleImage[], config: Models.GalleryConfig): Promise<Gallery | undefined>;
2074
+ /**
2075
+ * Sets or updates the 360° space data dynamically, syncing the current image's
2076
+ * `rotationY` if applicable and rebuilding all waypoints.
2077
+ * @param space The updated space data, or `undefined` to clear.
2078
+ */
2079
+ setSpaceData(space: Models.Spaces.Space | undefined): void;
2080
+ /**
2081
+ * Forces `<micrio-markers>` to rebuild/update all `<micrio-waypoint>` elements from
2082
+ * the current {@link spaceData}, even when `targetId` is unchanged.
2083
+ */
2084
+ refreshWaypoints(): void;
2395
2085
  /**
2396
2086
  * Closes an opened MicrioImage and removes its canvas from the engine.
2397
2087
  *
@@ -2460,6 +2150,8 @@ declare module '@micrio/client' {
2460
2150
  * @readonly
2461
2151
  */
2462
2152
  get $info(): Models.ImageInfo.ImageInfo;
2153
+ /** Reactive writable store holding the image's settings. See {@link Models.ImageInfo.Settings}. */
2154
+ get settings(): Writable<Models.ImageInfo.Settings>;
2463
2155
  /** Getter for the current value of the {@link settings} store. */
2464
2156
  get $settings(): Models.ImageInfo.Settings;
2465
2157
  /** Writable store holding the image's cultural data (markers, tours, text content for the current language). See {@link Models.ImageData.ImageData}. */
@@ -2484,6 +2176,8 @@ declare module '@micrio/client' {
2484
2176
  grid: Grid | undefined;
2485
2177
  /** Stores an error message if loading failed. */
2486
2178
  error: string | undefined;
2179
+ /** Reactive readable store holding the calculated pixel viewport `[left, top, width, height]` of this image within the main canvas. */
2180
+ get viewport(): Readable<Models.Camera.View>;
2487
2181
  /** Options controlling this image instance's behaviour (embedding, area, parent camera usage). */
2488
2182
  opts: {
2489
2183
  /** Optional sub area [x, y, width, height] defining placement within a parent canvas (for embeds/galleries). */
@@ -2511,76 +2205,10 @@ declare module '@micrio/client' {
2511
2205
  }
2512
2206
 
2513
2207
 
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
- }
2208
+ export {};
2565
2209
 
2566
2210
 
2567
- export interface MicrioSplitLink {
2568
- micrioId: string;
2569
- markerId?: string;
2570
- follows?: boolean;
2571
- }
2572
- export function parseSplitLink(raw?: string): MicrioSplitLink | undefined;
2573
- export function hasSplit(primary: MicrioImage): boolean;
2574
- export function getSplitSecondary(primary: MicrioImage): MicrioImage | undefined;
2575
- export function isSplitSecondary(image: MicrioImage): boolean;
2576
- export function openSplit(micrio: HTMLMicrioElement, primary: MicrioImage, link: MicrioSplitLink, opts?: {
2577
- isPassive?: boolean;
2578
- }): Promise<void>;
2579
- export function closeSplit(micrio: HTMLMicrioElement, primary: MicrioImage, opts?: {
2580
- keepSecondaryCanvas?: boolean;
2581
- immediate?: boolean;
2582
- }): void;
2583
- export function closeAllSplits(micrio: HTMLMicrioElement, immediate?: boolean): void;
2211
+ export {};
2584
2212
 
2585
2213
 
2586
2214
  /**
@@ -2642,6 +2270,8 @@ declare module '@micrio/client' {
2642
2270
  get $marker(): Models.ImageData.Marker | undefined;
2643
2271
  /** Writable store holding the currently displayed layer index (for Omni objects). */
2644
2272
  readonly layer: Writable<number>;
2273
+ /** Writable store holding an active live layer comparison (curtain wipe or opacity blend) for multi-layer Omni objects. */
2274
+ readonly layerCompare: Writable<Models.ImageInfo.OmniLayerCompare | undefined>;
2645
2275
  /**
2646
2276
  * Continuous omni rotation in degrees, 0 at the first frame.
2647
2277
  * Seamless (SOG) mode uses the full value; legacy tile mode snaps it to a frame.
@@ -2846,13 +2476,48 @@ declare module '@micrio/client' {
2846
2476
  export {};
2847
2477
 
2848
2478
 
2479
+ export type EditorSelectKind = 'marker' | 'embed' | 'waypoint';
2480
+ /**
2481
+ * When `<micr-io>` is in `editMode`, intercepts click/activate interactions and dispatches
2482
+ * the corresponding bubbling `editor-*-select` event for the host editor.
2483
+ * Returns `true` if `editMode` consumed the interaction.
2484
+ */
2485
+ export function interceptEditorSelect(micrio: HTMLMicrioElement, kind: EditorSelectKind, detail: unknown): boolean;
2486
+ /**
2487
+ * Attaches the realtime `'change'` CustomEvent bridge to a `<micrio-marker>` element.
2488
+ * Mutates live marker placement/audio fields in-place and triggers a synchronous reposition
2489
+ * + `'audio-update'` without tearing down DOM or interrupting WebAudio playback.
2490
+ */
2491
+ export function attachMarkerEditorBridge(el: HTMLElement, marker: Models.ImageData.Marker, micrio: HTMLMicrioElement, onMoved: () => void): () => void;
2492
+ /**
2493
+ * Applies a realtime `'change'` CustomEvent payload onto a mounted `<micrio-embed>` element
2494
+ * (area, transforms, opacity, and live `<video>` muted/loop state without restarting playback).
2495
+ */
2496
+ export function applyEmbedEditorChange(el: HTMLElement, embed: Models.ImageData.Embed | undefined, container: HTMLElement | undefined, e: Event): void;
2497
+ /**
2498
+ * Applies a realtime `'change'` CustomEvent patch onto a `<micrio-waypoint>` settings object.
2499
+ * Returns `{ settings, needsRender }` so the waypoint knows whether to re-render DOM or only reposition.
2500
+ */
2501
+ export function applyWaypointEditorChange(e: Event, existing: Models.Spaces.WayPointSettings | undefined, iface: Models.Spaces.WaypointInterface | undefined): {
2502
+ settings: Models.Spaces.WayPointSettings | undefined;
2503
+ needsRender: boolean;
2504
+ };
2505
+
2506
+
2849
2507
  export {};
2850
2508
 
2851
2509
 
2852
2510
  /** Manages a collection of gallery images with navigation (swipe, switch, grid, album). */
2853
2511
  export class Gallery {
2854
2512
  #private;
2855
- readonly _items: Models.ImageInfo.ImageInfo[];
2513
+ /** Read-only list of all {@link MicrioImage} instances in this gallery. */
2514
+ get images(): readonly MicrioImage[];
2515
+ /** The synthetic parent {@link MicrioImage} hosting this gallery/grid canvas, if attached. */
2516
+ get hostImage(): MicrioImage | undefined;
2517
+ /** The {@link Grid} controller for this gallery, when `type === 'grid'` and attached. */
2518
+ get grid(): Grid | undefined;
2519
+ /** Finds a {@link MicrioImage} in this gallery by its Micrio ID. */
2520
+ getImage(id: string): MicrioImage | undefined;
2856
2521
  gotoId: (id: string) => Promise<MicrioImage | undefined>;
2857
2522
  goto: (index: number) => Promise<MicrioImage | undefined>;
2858
2523
  next: () => void;
@@ -2860,7 +2525,6 @@ declare module '@micrio/client' {
2860
2525
  }
2861
2526
 
2862
2527
 
2863
- /** Manages omni 3D object rotation UI: dial, swipe gestures, frame navigation, and layer menu. */
2864
2528
  export class OmniUI {
2865
2529
  #private;
2866
2530
  /** Navigate to a specific frame index. Seamless mode converts it to degrees. */
@@ -2908,13 +2572,18 @@ declare module '@micrio/client' {
2908
2572
  /** Filter the grid to show only images that are part of the currently active marker tour. */
2909
2573
  filterTourImages = 7,
2910
2574
  /** Set a one-time crossfade duration for the *next* grid transition. Data: duration in seconds. */
2911
- nextFadeDuration = 8
2575
+ nextFadeDuration = 8,
2576
+ /** Execute a named or inline GridEffect. Data: effect ID or JSON-serialized GridEffect. */
2577
+ effect = 9
2912
2578
  }
2913
2579
 
2914
2580
 
2915
2581
  export {};
2916
2582
 
2917
2583
 
2584
+ export {};
2585
+
2586
+
2918
2587
  /** Props injected into a `<micrio-grid>` element by the gallery controller. */
2919
2588
  interface GridProps {
2920
2589
  micrio: HTMLMicrioElement;
@@ -2926,8 +2595,21 @@ declare module '@micrio/client' {
2926
2595
  #private;
2927
2596
  /** All {@link MicrioImage} instances managed by this grid. */
2928
2597
  get images(): readonly MicrioImage[];
2598
+ /** Currently displayed {@link MicrioImage} tiles in the active grid layout. */
2599
+ get currentImages(): readonly MicrioImage[];
2929
2600
  /** Get a grid {@link MicrioImage} instance by its image ID, if it is part of this grid. */
2930
2601
  getImage(id: string): MicrioImage | undefined;
2602
+ /**
2603
+ * Dynamically registers a new image bundle into this live grid without tearing down WebGL.
2604
+ * Idempotent: returns the existing {@link MicrioImage} if `bundle.id` is already tracked.
2605
+ */
2606
+ addImage(bundle: Models.ImageBundle.BundleImage): MicrioImage;
2607
+ /** All named {@link Models.Grid.GridEffect} definitions available on this grid. */
2608
+ get effects(): readonly Models.Grid.GridEffect[];
2609
+ /** Replace the live list of named {@link Models.Grid.GridEffect} definitions without rebuilding WebGL. */
2610
+ setEffects(effects: Models.Grid.GridEffect[]): void;
2611
+ /** Returns the current grid layout entries (including empty placeholders). */
2612
+ getLayout(): readonly Models.Grid.GridEntry[];
2931
2613
  /** The currently focussed (single-view) image, if any. */
2932
2614
  get $focussed(): MicrioImage | undefined;
2933
2615
  /** The parent `<micrio-*>` element this grid is bound to. */
@@ -2965,10 +2647,30 @@ declare module '@micrio/client' {
2965
2647
  gridFocus(img: MicrioImage | undefined, opts?: Models.Grid.FocusOptions): Promise<void>;
2966
2648
  /** Remove focus from the currently focussed image and return to the grid overview. */
2967
2649
  blur(): void;
2968
- /** Execute a grid action by type (e.g. `focus`, `reset`, `back`) with optional data and duration. */
2650
+ /** Execute a grid action by type (e.g. `focus`, `reset`, `back`, `effect`) with optional data and duration. */
2969
2651
  action(action: GridActionType | string, data?: string, duration?: number, focusTransition?: Models.Grid.MarkerFocusTransition): void;
2652
+ /**
2653
+ * Execute a named album {@link Models.Grid.GridEffect} (by ID) or an inline {@link Models.Grid.GridEffect} object.
2654
+ * Supersedes any currently running multi-step effect.
2655
+ */
2656
+ runEffect(effectOrId: string | Models.Grid.GridEffect, opts?: Models.Grid.RunEffectOptions): Promise<void>;
2970
2657
  /** Enlarge a specific grid cell to span the given number of columns/rows, re-laying out without history. */
2971
2658
  enlarge(idx: number, width: number, height?: number): Promise<MicrioImage[]>;
2659
+ /**
2660
+ * Controls which grid tiles display their interactive marker layers while in overview mode.
2661
+ * Pass `'all'` to show markers on every image, `'none'` to clear, or an explicit list of images.
2662
+ */
2663
+ showMarkers(target: MicrioImage[] | 'all' | 'none'): void;
2664
+ /**
2665
+ * Hit-tests `<micr-io>`-relative CSS pixel coordinates `(elX, elY)` against the visible grid tiles
2666
+ * (in descending `zIndex` order), returning the hit image and normalized `[0..1]` coordinates when
2667
+ * the point lands inside the rendered image bounds (excluding grid gutters / letterbox margins).
2668
+ */
2669
+ getImageAtPoint(elX: number, elY: number): {
2670
+ image: MicrioImage;
2671
+ x: number;
2672
+ y: number;
2673
+ } | undefined;
2972
2674
  }
2973
2675
  export {};
2974
2676
 
@@ -3044,7 +2746,7 @@ declare module '@micrio/client' {
3044
2746
  updateEvents(time: number): void;
3045
2747
  /** Getter for the total duration of the tour in seconds. */
3046
2748
  get duration(): number;
3047
- /** Setter for the total duration (updates internal content). */
2749
+ /** Setter for the total duration (updates internal content and state machine context). */
3048
2750
  set duration(v: number);
3049
2751
  /** Getter for the current paused state. */
3050
2752
  get paused(): boolean;
@@ -3185,26 +2887,7 @@ declare module '@micrio/client' {
3185
2887
  *
3186
2888
  * @license MIT
3187
2889
  */
3188
- /**
3189
- * Represents a 4x4 matrix, tailored for WebGL operations.
3190
- *
3191
- * The matrix is stored as a single `Float32Array(16)` in column-major order,
3192
- * directly usable with WebGL `uniformMatrix4fv` (via {@link Mat4.arr}):
3193
- * ```
3194
- * arr[0] arr[4] arr[8] arr[12]
3195
- * arr[1] arr[5] arr[9] arr[13]
3196
- * arr[2] arr[6] arr[10] arr[14]
3197
- * arr[3] arr[7] arr[11] arr[15]
3198
- * ```
3199
- */
3200
- export class Mat4 {
3201
- /** Float32Array holding the matrix, for direct use with WebGL uniformMatrix4fv. */
3202
- readonly arr: Float32Array;
3203
- /**
3204
- * Creates a new Mat4 (defaults to the identity matrix).
3205
- */
3206
- constructor(a0?: number, a1?: number, a2?: number, a3?: number, a4?: number, a5?: number, a6?: number, a7?: number, a8?: number, a9?: number, a10?: number, a11?: number, a12?: number, a13?: number, a14?: number, a15?: number);
3207
- }
2890
+ export {};
3208
2891
 
3209
2892
 
3210
2893
  export {};
@@ -3261,17 +2944,6 @@ declare module '@micrio/client' {
3261
2944
  /** Set by the page (or loaded below) from the PlayCanvas SOG bundle. */
3262
2945
  var createMicrioSogViewer: CreateMicrioSogViewer | undefined;
3263
2946
  }
3264
- /** True when this bundle should use the SOG viewer, alone or as the hybrid overlay. */
3265
- export const isSogBundle: (micrio: HTMLMicrioElement, bundle: Models.ImageBundle.BundleImage) => boolean;
3266
- /**
3267
- * True when `data-sog` asks for the overlay: the SOG is drawn on a transparent
3268
- * canvas over the normal photo renderer, whose background is cut away with the
3269
- * SOG's alpha. Navigation runs on the SOG; when it stops, the rotation snaps to
3270
- * the nearest photographed frame and the SOG drops behind the photo, filling
3271
- * the target tiles that are still loading. `data-prefer-sog` keeps forcing the
3272
- * SOG-only renderer, so it wins when both are set.
3273
- */
3274
- export const isSogHybrid: (micrio: HTMLMicrioElement) => boolean;
3275
2947
  export {};
3276
2948
 
3277
2949
 
@@ -3305,6 +2977,9 @@ declare module '@micrio/client' {
3305
2977
  export {};
3306
2978
 
3307
2979
 
2980
+ export {};
2981
+
2982
+
3308
2983
  /** Names of all icons available in the Micrio UI icon library. */
3309
2984
  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';
3310
2985