@micrio/client 7.4.8 → 7.5.0-alpha.2

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
@@ -68,6 +68,8 @@ declare module '@micrio/client' {
68
68
  lang?: string;
69
69
  /** For custom hosted Micrio images, specify the root URL. Default: Based on image */
70
70
  'data-path'?: string;
71
+ /** Target Micrio API domain (`'micrio.dev'` or `'micr.io'`). Default: auto-detected from hostname */
72
+ 'data-env'?: 'micrio.dev' | 'micr.io';
71
73
  /** Set this to 'cover' to start the image using the full viewport. Default: undefined */
72
74
  'data-inittype'?: string;
73
75
  /** The user cannot zoom out further than the full viewport. Default: undefined */
@@ -414,6 +416,10 @@ declare module '@micrio/client' {
414
416
  isPng?: boolean;
415
417
  /** The tiled image is in DeepZoom format */
416
418
  isDeepZoom?: boolean;
419
+ /** The image tiles are stored in a single-file bundle served via IIIF tile endpoints */
420
+ isBundle?: boolean;
421
+ /** Optional IIIF service base URL override for bundled tile images */
422
+ iiifBase?: string;
417
423
  /** The image has a IIIF source */
418
424
  isIIIF?: boolean;
419
425
  /** Use a custom, single source uri for the zoomable image / video */
@@ -474,6 +480,8 @@ declare module '@micrio/client' {
474
480
  embedFadeDuration?: number;
475
481
  /** When being re-shown, always restart */
476
482
  embedRestartWhenShown?: boolean;
483
+ /** How embedded images/videos are rendered: `'auto'` (default heuristics), `'true'` (force WebGL), or `'false'` (force HTML). */
484
+ embedsInsideGl?: Attributes.EmbedGLMode;
477
485
  /** Don't stop drawing frames when idle */
478
486
  keepRendering?: boolean;
479
487
  /** Skip the deepest zoom levels */
@@ -594,14 +602,22 @@ declare module '@micrio/client' {
594
602
  ui?: Partial<UserInterfaceSettings>;
595
603
  /** Grid display and interaction settings */
596
604
  grid?: {
597
- /** Click behavior for grid images: `'focus'` expands to full view, `'zoom'` zooms to the image's viewport */
598
- clickable?: 'focus' | 'zoom';
605
+ /** Click behavior for grid images: `'focus'` expands to full view, `'zoom'` zooms to the image's viewport, `false` disables tile clicks */
606
+ clickable?: 'focus' | 'zoom' | false;
599
607
  /** Pan/zoom behavior: `'cells'` operates on the individual cell under the cursor, `'grid'` operates on the main grid container */
600
608
  panZoom?: 'cells' | 'grid';
601
609
  /** Transition duration for grid animations, in seconds */
602
610
  transitionDuration?: number;
603
611
  /** Transition duration when going back, in seconds */
604
612
  transitionDurationOut?: number;
613
+ /** Optional image ID to start the grid immediately focussed on (single-image full view, zero flash) */
614
+ initialFocusId?: string;
615
+ /** When true, omits the built-in floating close button while an image is focussed */
616
+ noCloseButton?: boolean;
617
+ /** Named reusable Grid Effects authored for this grid album */
618
+ effects?: Grid.GridEffect[];
619
+ /** Optional ID of a GridEffect in `effects` to open the grid on immediately (without animating) */
620
+ startEffectId?: string;
605
621
  };
606
622
  /** ADVANCED: A fragment shader for WebGL postprocessing
607
623
  * This shader MUST have and use:
@@ -632,6 +648,14 @@ declare module '@micrio/client' {
632
648
  /** File size in bytes */
633
649
  fileSize: number;
634
650
  }
651
+ /** Live comparison state between two layers of a multi-layer Omni object. */
652
+ interface OmniLayerCompare {
653
+ mode: 'wipe' | 'blend';
654
+ layerA: number;
655
+ layerB: number;
656
+ /** Curtain split fraction `[0..1]` (for `wipe`) or blend alpha `[0..1]` (for `blend`). */
657
+ position: number;
658
+ }
635
659
  interface OmniSettings {
636
660
  /** Number of frames */
637
661
  frames: number;
@@ -645,8 +669,8 @@ declare module '@micrio/client' {
645
669
  distance: number;
646
670
  /** Adjust the center for an object */
647
671
  offsetX: number;
648
- /** Put the labels on the side of the object */
649
- sideLabels?: boolean;
672
+ /** Derive camera distance, FOV, vertical angle and horizontal offset automatically from embedded SOG metadata */
673
+ autoCamera?: boolean;
650
674
  /**
651
675
  * Which frame is 0deg rotation.
652
676
  * @deprecated Read nowhere in this client, and exposed by no dashboard page — a legacy
@@ -664,6 +688,8 @@ declare module '@micrio/client' {
664
688
  sog?: SogInfo[];
665
689
  /** Optional starting layer idx */
666
690
  layerStartIndex?: number;
691
+ /** Layer switching / comparison presentation for multi-layer Omni objects */
692
+ layerMode?: 'switch' | 'crossfade' | 'wipe' | 'blend';
667
693
  /** Hide the rotation dial */
668
694
  noDial?: boolean;
669
695
  /** Show degrees on dial */
@@ -754,6 +780,8 @@ declare module '@micrio/client' {
754
780
  type?: 'swipe' | 'switch' | 'grid' | 'book3d';
755
781
  startId?: string;
756
782
  sort?: 'name' | '-name' | 'created' | '-created' | 'random';
783
+ /** Optional explicit page order (image IDs) overriding `sort`; any unlisted images follow in `sort` order. */
784
+ pageOrder?: string[];
757
785
  isSpreads?: boolean;
758
786
  coverPages?: number;
759
787
  archive?: string;
@@ -766,6 +794,10 @@ declare module '@micrio/client' {
766
794
  grid?: {
767
795
  clickable?: 'focus' | 'zoom' | false;
768
796
  panZoom?: 'cells' | 'grid';
797
+ initialFocusId?: string;
798
+ noCloseButton?: boolean;
799
+ effects?: Grid.GridEffect[];
800
+ startEffectId?: string;
769
801
  };
770
802
  }
771
803
 
@@ -788,6 +820,8 @@ declare module '@micrio/client' {
788
820
  from?: string;
789
821
  /** Optional stacking order override (higher values render on top). */
790
822
  z?: number;
823
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
824
+ cover?: boolean;
791
825
  }
792
826
  /** An empty placeholder cell in a grid layout, occupying grid space without an image */
793
827
  interface GridEmptyCell {
@@ -817,6 +851,137 @@ declare module '@micrio/client' {
817
851
  /** Blur the image during transition, in pixels */
818
852
  blur?: number;
819
853
  }
854
+ /** How a `layout` step selects which images participate. */
855
+ type GridImageSource = {
856
+ mode: 'all';
857
+ } | {
858
+ mode: 'current';
859
+ } | {
860
+ mode: 'select';
861
+ ids: string[];
862
+ } | {
863
+ mode: 'tags';
864
+ tags: string[];
865
+ match?: 'any' | 'all';
866
+ zoomToMarker?: boolean;
867
+ } | {
868
+ mode: 'tour';
869
+ };
870
+ /** Per-image modifier rule layered on top of a `layout` step's matched images. */
871
+ interface GridLayoutRule {
872
+ /** Target image ID, `'$current'` (owning image of the trigger), or `'$first'` (first matched image). */
873
+ target: string;
874
+ /** Override cell span `[columns, rows?]`. */
875
+ size?: [number, number?];
876
+ /** Source image ID (or `'$current'` / `'$first'`) to grow from when `transition === 'in-from-id'`. */
877
+ from?: string;
878
+ /** Stacking order override. */
879
+ z?: number;
880
+ /** Optional camera view inside this image. */
881
+ view?: Camera.View;
882
+ /** Optional marker ID on this image to zoom into. */
883
+ markerId?: string;
884
+ /** Pin to start (`'prepend'`), end (`'append'`), or keep natural position (`'keep'`). */
885
+ position?: 'keep' | 'prepend' | 'append';
886
+ /** Include this image even if it was not matched by `source`. */
887
+ include?: boolean;
888
+ /** Exclude this image from the matched set. */
889
+ exclude?: boolean;
890
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
891
+ cover?: boolean;
892
+ }
893
+ /** Explicit cell entry for direct visual mosaic authoring (supports exact order and empty spacers). */
894
+ interface GridEffectCell {
895
+ /** Image ID (or `'$current'`); omitted when `empty: true`. */
896
+ id?: string;
897
+ empty?: boolean;
898
+ size?: [number, number?];
899
+ from?: string;
900
+ z?: number;
901
+ view?: Camera.View;
902
+ markerId?: string;
903
+ /** Optional per-tile cover-fill override (`true` = cover cell, `false` = full image with margins). */
904
+ cover?: boolean;
905
+ }
906
+ /** One executable step inside a {@link GridEffect}. */
907
+ type GridEffectStep = {
908
+ type: 'layout';
909
+ source?: GridImageSource;
910
+ rules?: GridLayoutRule[];
911
+ /** Explicit ordered cells (including empty spacers); overrides `source` when provided. */
912
+ cells?: GridEffectCell[];
913
+ arrangement?: 'auto' | 'row' | 'columns';
914
+ columns?: number;
915
+ scale?: number;
916
+ transition?: GridSetTransition;
917
+ duration?: number;
918
+ view?: Camera.View;
919
+ cover?: boolean;
920
+ noHistory?: boolean;
921
+ } | {
922
+ type: 'focus';
923
+ /** Target image ID or `'$current'`. */
924
+ imageId: string;
925
+ transition?: MarkerFocusTransition;
926
+ duration?: number;
927
+ view?: Camera.View;
928
+ markerId?: string;
929
+ blur?: number;
930
+ cover?: boolean;
931
+ coverLimit?: boolean;
932
+ } | {
933
+ type: 'flyTo';
934
+ imageIds?: string[];
935
+ tags?: string[];
936
+ match?: 'any' | 'all';
937
+ duration?: number;
938
+ } | {
939
+ type: 'resize';
940
+ /** Target image ID or `'$current'`. */
941
+ imageId: string;
942
+ size: [number, number];
943
+ duration?: number;
944
+ } | {
945
+ type: 'reset';
946
+ duration?: number;
947
+ } | {
948
+ type: 'back';
949
+ duration?: number;
950
+ } | {
951
+ type: 'switchToGrid';
952
+ } | {
953
+ type: 'delay';
954
+ seconds: number;
955
+ } | {
956
+ type: 'fadeDuration';
957
+ seconds: number;
958
+ };
959
+ /** A named, reusable Grid Action / Effect executed by `grid.runEffect()`. */
960
+ interface GridEffect {
961
+ /** Stable unique identifier referenced by Video Tour events and Markers. */
962
+ id: string;
963
+ /** Human-readable name displayed in pickers and timelines. */
964
+ name: string;
965
+ /** Optional description of what this effect does. */
966
+ description?: string;
967
+ /** Optional accent color token for editor badges. */
968
+ color?: string;
969
+ /** Ordered sequence of steps executed by this effect. */
970
+ steps: GridEffectStep[];
971
+ }
972
+ /** Context options passed to `grid.runEffect()`. */
973
+ interface RunEffectOptions {
974
+ /** Default transition duration in seconds when a step omits `duration`. */
975
+ duration?: number;
976
+ /** When true, applies the effect's final configuration immediately with zero animation/delays (used for opening/starting effects). */
977
+ instant?: boolean;
978
+ /** Owning image ID used to resolve `'$current'` targets. */
979
+ sourceImageId?: string;
980
+ /** Triggering marker ID, if triggered by a marker. */
981
+ sourceMarkerId?: string;
982
+ /** Fallback focus transition (e.g. a marker's `gridTourTransition`). */
983
+ focusTransition?: MarkerFocusTransition;
984
+ }
820
985
  }
821
986
 
822
987
  /**
@@ -964,6 +1129,8 @@ declare module '@micrio/client' {
964
1129
  view?: Camera.View;
965
1130
  /** If an image has multiple layers, switch to this layer */
966
1131
  imageLayer?: number;
1132
+ /** Omni-objects with multiple layers: only display this marker on the specified layer indices (omitted/empty = all layers) */
1133
+ visibleLayers?: number[];
967
1134
  /** Content type, for displaying */
968
1135
  type?: 'default' | 'image' | 'audio' | 'video' | 'media' | 'link' | 'waypoint' | 'cluster';
969
1136
  /** Popup type */
@@ -988,11 +1155,20 @@ declare module '@micrio/client' {
988
1155
  videoTour?: VideoTour;
989
1156
  /** Positional audio asset */
990
1157
  positionalAudio?: Assets.AudioLocation;
1158
+ /** Marker tours that include this marker (used to auto-start cross-image tours and auto-bundle tour owners) */
1159
+ tours?: MarkerTourRef[];
991
1160
  /** Optional function that overrides all behavior */
992
1161
  onclick?: (m: ImageData.Marker) => void;
993
1162
  /** Additional options */
994
1163
  data?: MarkerData;
995
1164
  }
1165
+ /** Reference from a marker to a marker tour that includes it */
1166
+ interface MarkerTourRef {
1167
+ /** The Micrio ID of the image that owns the marker tour */
1168
+ micrioId: string;
1169
+ /** The ID of the marker tour */
1170
+ tourId: string;
1171
+ }
996
1172
  /** Optional individual marker settings */
997
1173
  interface MarkerData {
998
1174
  /** A custom marker icon image */
@@ -1024,6 +1200,10 @@ declare module '@micrio/client' {
1024
1200
  micrioSplitLink?: string;
1025
1201
  /** Grid tour transition animation */
1026
1202
  gridTourTransition?: Grid.MarkerFocusTransition;
1203
+ /** Named album GridEffect ID or inline GridEffect executed when this marker opens inside a grid */
1204
+ gridEffect?: string | Grid.GridEffect;
1205
+ /** Optional grid behavior when this marker closes (`'keep'` default, `'back'`, or `'reset'`) */
1206
+ gridEffectOnClose?: 'keep' | 'back' | 'reset';
1027
1207
  /** Optional custom settings. This is the "Custom JSON" field in the marker editor */
1028
1208
  _meta?: {
1029
1209
  /** For in grid multi-image tour, this step is in grid view */
@@ -1182,6 +1362,8 @@ declare module '@micrio/client' {
1182
1362
  scrollable?: boolean;
1183
1363
  /** Don't reset view when tour ends */
1184
1364
  keepLastStep?: boolean;
1365
+ /** Zoom out to full view before transitioning to another image/page in multi-image or album tours */
1366
+ zoomOutBeforeTransition?: boolean;
1185
1367
  /** Chapter-based multi-video serial tour */
1186
1368
  isSerialTour?: boolean;
1187
1369
  /** Print the chapters in the interface */
@@ -1223,7 +1405,7 @@ declare module '@micrio/client' {
1223
1405
  [key: string]: string;
1224
1406
  };
1225
1407
  /** Button action type */
1226
- type: 'close' | 'marker' | 'mtour' | 'vtour' | 'link';
1408
+ type: 'close' | 'marker' | 'mtour' | 'vtour' | 'gridEffect' | 'link';
1227
1409
  /** The action value */
1228
1410
  action?: string;
1229
1411
  /** Link opens in net tab */
@@ -1416,7 +1598,6 @@ declare module '@micrio/client' {
1416
1598
  }
1417
1599
 
1418
1600
 
1419
- /** Manages spatial audio, playlist playback, and user interaction for Micrio images. */
1420
1601
  export class MicrioAudioController {
1421
1602
  #private;
1422
1603
  constructor(micrio: HTMLMicrioElement, image: MicrioImage);
@@ -1434,631 +1615,67 @@ declare module '@micrio/client' {
1434
1615
  export {};
1435
1616
 
1436
1617
 
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
- }
1618
+ export {};
1504
1619
 
1505
1620
 
1506
1621
  export {};
1507
1622
 
1508
1623
 
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
- }
1624
+ export {};
1531
1625
 
1532
1626
 
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;
1627
+ export {};
1537
1628
 
1538
1629
 
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];
1630
+ export {};
1585
1631
 
1586
1632
 
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
- }
1633
+ export {};
1641
1634
 
1642
1635
 
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
- }
1636
+ export {};
1756
1637
 
1757
1638
 
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
- }
1639
+ export {};
1774
1640
 
1775
1641
 
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
- }
1642
+ export {};
1790
1643
 
1791
1644
 
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
- }
1645
+ export {};
1843
1646
 
1844
1647
 
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;
1648
+ export {};
1906
1649
 
1907
1650
 
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
- }
1651
+ export {};
1926
1652
 
1927
1653
 
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;
1654
+ export {};
1952
1655
 
1953
1656
 
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;
1657
+ export {};
1968
1658
 
1969
1659
 
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;
1660
+ export {};
1974
1661
 
1975
1662
 
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
- }
1663
+ export {};
1985
1664
 
1986
1665
 
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;
1666
+ export {};
2009
1667
 
2010
1668
 
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
- }
1669
+ export {};
1670
+
1671
+
1672
+ export {};
1673
+
1674
+
1675
+ export {};
1676
+
1677
+
1678
+ export {};
2062
1679
 
2063
1680
 
2064
1681
  /**
@@ -2127,6 +1744,48 @@ declare module '@micrio/client' {
2127
1744
  * @returns A Float64Array containing the screen coordinates [x, y, scale, depth].
2128
1745
  */
2129
1746
  getXY(x: number, y: number, abs?: boolean, radius?: number, rotation?: number, noTrueNorth?: boolean): Float64Array;
1747
+ /**
1748
+ * Projects a normalized image-space area `[x, y, width, height]` to screen-space CSS pixels,
1749
+ * returning its axis-aligned bounding rectangle and 4 projected corner coordinates
1750
+ * (top-left, top-right, bottom-right, bottom-left).
1751
+ * Returns `undefined` when the camera is not ready or the area is obscured / behind the camera.
1752
+ * @param area The normalized image area `[x0, y0, width, height]`.
1753
+ */
1754
+ getAreaScreenRect(area: Models.Camera.View): {
1755
+ x: number;
1756
+ y: number;
1757
+ width: number;
1758
+ height: number;
1759
+ corners: [number, number][];
1760
+ } | undefined;
1761
+ /**
1762
+ * Returns this image's rendered viewport `[left, top, width, height]` in CSS pixels
1763
+ * relative to the host `<micr-io>` element (matching the tile rect inside a grid,
1764
+ * or `[0, 0, offsetWidth, offsetHeight]` for a standalone canvas).
1765
+ */
1766
+ getViewportRect(): [number, number, number, number];
1767
+ /**
1768
+ * Converts normalized image coordinates `[0..1]` into CSS pixel coordinates `[x, y]`
1769
+ * relative to the host `<micr-io>` element (adding the tile viewport offset when inside a grid).
1770
+ * Returns `undefined` when the camera is not ready or the point is obscured.
1771
+ */
1772
+ getElementXY(x: number, y: number): [number, number] | undefined;
1773
+ /**
1774
+ * Projects a normalized image-space area `[x, y, width, height]` into CSS pixels
1775
+ * relative to the host `<micr-io>` element (adding the tile viewport offset when inside a grid).
1776
+ */
1777
+ getElementAreaRect(area: Models.Camera.View): {
1778
+ x: number;
1779
+ y: number;
1780
+ width: number;
1781
+ height: number;
1782
+ corners: [number, number][];
1783
+ } | undefined;
1784
+ /**
1785
+ * Converts CSS pixel coordinates relative to the host `<micr-io>` element into
1786
+ * normalized image coordinates `[x, y, scale, ...]`, accounting for grid tile offsets.
1787
+ */
1788
+ getCooFromElement(elX: number, elY: number, noLimit?: boolean): Float64Array;
2130
1789
  /**
2131
1790
  * Sets the center of the screen to the specified image coordinates and scale instantly.
2132
1791
  * @param x The target image X coordinate (0-1).
@@ -2158,6 +1817,12 @@ declare module '@micrio/client' {
2158
1817
  * @param pitch The target pitch in radians (defaults to current pitch).
2159
1818
  */
2160
1819
  setDirection(yaw: number, pitch?: number): void;
1820
+ /**
1821
+ * Updates the Y-axis sphere rotation (in radians) for 360° images,
1822
+ * syncing compass / true-north alignment immediately and triggering a re-render.
1823
+ * @param rad The target Y-axis rotation in radians.
1824
+ */
1825
+ setRotationY(rad: number): void;
2161
1826
  /**
2162
1827
  * Sets a rectangular limit for camera navigation within the image.
2163
1828
  * @param v The viewport limit [x, y, width, height] in image-relative coordinates.
@@ -2362,6 +2027,8 @@ declare module '@micrio/client' {
2362
2027
  readonly state: State.Main;
2363
2028
  /** Writable store indicating if barebone texture downloading is enabled (lower quality, less bandwidth). */
2364
2029
  readonly barebone: Writable<boolean>;
2030
+ /** Writable store indicating if the viewer is in editor mode (intercepts marker, waypoint, and embed clicks). */
2031
+ readonly editMode: Writable<boolean>;
2365
2032
  /** Custom settings object provided programmatically, overriding server-fetched settings. */
2366
2033
  defaultSettings?: Partial<Models.ImageInfo.Settings>;
2367
2034
  /** Holds data for the current 360 space, if applicable (loaded via `data-space` attribute or API). */
@@ -2392,6 +2059,31 @@ declare module '@micrio/client' {
2392
2059
  /** Optional Gallery controller, used for gallery/grid views. */
2393
2060
  gallery?: Gallery;
2394
2061
  }): Promise<MicrioImage | undefined>;
2062
+ /**
2063
+ * Tears down any active gallery/grid and closes its canvases so the element
2064
+ * can cleanly transition back to standalone single-image viewing or a new gallery.
2065
+ */
2066
+ closeGallery(): void;
2067
+ /**
2068
+ * Opens a multi-image gallery/album (`swipe`, `switch`, `book3d`, `grid`) directly from
2069
+ * in-memory {@link Models.ImageBundle.BundleImage} items and a {@link Models.GalleryConfig},
2070
+ * without requiring a published `bundle.json`.
2071
+ * @param items The bundle images to display in the gallery.
2072
+ * @param config Gallery layout and behavior configuration.
2073
+ * @returns The created {@link Gallery} controller, or `undefined` if disconnected or `items` is empty.
2074
+ */
2075
+ openGallery(items: Models.ImageBundle.BundleImage[], config: Models.GalleryConfig): Promise<Gallery | undefined>;
2076
+ /**
2077
+ * Sets or updates the 360° space data dynamically, syncing the current image's
2078
+ * `rotationY` if applicable and rebuilding all waypoints.
2079
+ * @param space The updated space data, or `undefined` to clear.
2080
+ */
2081
+ setSpaceData(space: Models.Spaces.Space | undefined): void;
2082
+ /**
2083
+ * Forces `<micrio-markers>` to rebuild/update all `<micrio-waypoint>` elements from
2084
+ * the current {@link spaceData}, even when `targetId` is unchanged.
2085
+ */
2086
+ refreshWaypoints(): void;
2395
2087
  /**
2396
2088
  * Closes an opened MicrioImage and removes its canvas from the engine.
2397
2089
  *
@@ -2460,6 +2152,8 @@ declare module '@micrio/client' {
2460
2152
  * @readonly
2461
2153
  */
2462
2154
  get $info(): Models.ImageInfo.ImageInfo;
2155
+ /** Reactive writable store holding the image's settings. See {@link Models.ImageInfo.Settings}. */
2156
+ get settings(): Writable<Models.ImageInfo.Settings>;
2463
2157
  /** Getter for the current value of the {@link settings} store. */
2464
2158
  get $settings(): Models.ImageInfo.Settings;
2465
2159
  /** Writable store holding the image's cultural data (markers, tours, text content for the current language). See {@link Models.ImageData.ImageData}. */
@@ -2484,6 +2178,8 @@ declare module '@micrio/client' {
2484
2178
  grid: Grid | undefined;
2485
2179
  /** Stores an error message if loading failed. */
2486
2180
  error: string | undefined;
2181
+ /** Reactive readable store holding the calculated pixel viewport `[left, top, width, height]` of this image within the main canvas. */
2182
+ get viewport(): Readable<Models.Camera.View>;
2487
2183
  /** Options controlling this image instance's behaviour (embedding, area, parent camera usage). */
2488
2184
  opts: {
2489
2185
  /** Optional sub area [x, y, width, height] defining placement within a parent canvas (for embeds/galleries). */
@@ -2511,76 +2207,10 @@ declare module '@micrio/client' {
2511
2207
  }
2512
2208
 
2513
2209
 
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
- }
2210
+ export {};
2565
2211
 
2566
2212
 
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;
2213
+ export {};
2584
2214
 
2585
2215
 
2586
2216
  /**
@@ -2642,6 +2272,8 @@ declare module '@micrio/client' {
2642
2272
  get $marker(): Models.ImageData.Marker | undefined;
2643
2273
  /** Writable store holding the currently displayed layer index (for Omni objects). */
2644
2274
  readonly layer: Writable<number>;
2275
+ /** Writable store holding an active live layer comparison (curtain wipe or opacity blend) for multi-layer Omni objects. */
2276
+ readonly layerCompare: Writable<Models.ImageInfo.OmniLayerCompare | undefined>;
2645
2277
  /**
2646
2278
  * Continuous omni rotation in degrees, 0 at the first frame.
2647
2279
  * Seamless (SOG) mode uses the full value; legacy tile mode snaps it to a frame.
@@ -2846,13 +2478,48 @@ declare module '@micrio/client' {
2846
2478
  export {};
2847
2479
 
2848
2480
 
2481
+ export type EditorSelectKind = 'marker' | 'embed' | 'waypoint';
2482
+ /**
2483
+ * When `<micr-io>` is in `editMode`, intercepts click/activate interactions and dispatches
2484
+ * the corresponding bubbling `editor-*-select` event for the host editor.
2485
+ * Returns `true` if `editMode` consumed the interaction.
2486
+ */
2487
+ export function interceptEditorSelect(micrio: HTMLMicrioElement, kind: EditorSelectKind, detail: unknown): boolean;
2488
+ /**
2489
+ * Attaches the realtime `'change'` CustomEvent bridge to a `<micrio-marker>` element.
2490
+ * Mutates live marker placement/audio fields in-place and triggers a synchronous reposition
2491
+ * + `'audio-update'` without tearing down DOM or interrupting WebAudio playback.
2492
+ */
2493
+ export function attachMarkerEditorBridge(el: HTMLElement, marker: Models.ImageData.Marker, micrio: HTMLMicrioElement, onMoved: () => void): () => void;
2494
+ /**
2495
+ * Applies a realtime `'change'` CustomEvent payload onto a mounted `<micrio-embed>` element
2496
+ * (area, transforms, opacity, and live `<video>` muted/loop state without restarting playback).
2497
+ */
2498
+ export function applyEmbedEditorChange(el: HTMLElement, embed: Models.ImageData.Embed | undefined, container: HTMLElement | undefined, e: Event): void;
2499
+ /**
2500
+ * Applies a realtime `'change'` CustomEvent patch onto a `<micrio-waypoint>` settings object.
2501
+ * Returns `{ settings, needsRender }` so the waypoint knows whether to re-render DOM or only reposition.
2502
+ */
2503
+ export function applyWaypointEditorChange(e: Event, existing: Models.Spaces.WayPointSettings | undefined, iface: Models.Spaces.WaypointInterface | undefined): {
2504
+ settings: Models.Spaces.WayPointSettings | undefined;
2505
+ needsRender: boolean;
2506
+ };
2507
+
2508
+
2849
2509
  export {};
2850
2510
 
2851
2511
 
2852
2512
  /** Manages a collection of gallery images with navigation (swipe, switch, grid, album). */
2853
2513
  export class Gallery {
2854
2514
  #private;
2855
- readonly _items: Models.ImageInfo.ImageInfo[];
2515
+ /** Read-only list of all {@link MicrioImage} instances in this gallery. */
2516
+ get images(): readonly MicrioImage[];
2517
+ /** The synthetic parent {@link MicrioImage} hosting this gallery/grid canvas, if attached. */
2518
+ get hostImage(): MicrioImage | undefined;
2519
+ /** The {@link Grid} controller for this gallery, when `type === 'grid'` and attached. */
2520
+ get grid(): Grid | undefined;
2521
+ /** Finds a {@link MicrioImage} in this gallery by its Micrio ID. */
2522
+ getImage(id: string): MicrioImage | undefined;
2856
2523
  gotoId: (id: string) => Promise<MicrioImage | undefined>;
2857
2524
  goto: (index: number) => Promise<MicrioImage | undefined>;
2858
2525
  next: () => void;
@@ -2860,7 +2527,6 @@ declare module '@micrio/client' {
2860
2527
  }
2861
2528
 
2862
2529
 
2863
- /** Manages omni 3D object rotation UI: dial, swipe gestures, frame navigation, and layer menu. */
2864
2530
  export class OmniUI {
2865
2531
  #private;
2866
2532
  /** Navigate to a specific frame index. Seamless mode converts it to degrees. */
@@ -2908,13 +2574,18 @@ declare module '@micrio/client' {
2908
2574
  /** Filter the grid to show only images that are part of the currently active marker tour. */
2909
2575
  filterTourImages = 7,
2910
2576
  /** Set a one-time crossfade duration for the *next* grid transition. Data: duration in seconds. */
2911
- nextFadeDuration = 8
2577
+ nextFadeDuration = 8,
2578
+ /** Execute a named or inline GridEffect. Data: effect ID or JSON-serialized GridEffect. */
2579
+ effect = 9
2912
2580
  }
2913
2581
 
2914
2582
 
2915
2583
  export {};
2916
2584
 
2917
2585
 
2586
+ export {};
2587
+
2588
+
2918
2589
  /** Props injected into a `<micrio-grid>` element by the gallery controller. */
2919
2590
  interface GridProps {
2920
2591
  micrio: HTMLMicrioElement;
@@ -2926,8 +2597,21 @@ declare module '@micrio/client' {
2926
2597
  #private;
2927
2598
  /** All {@link MicrioImage} instances managed by this grid. */
2928
2599
  get images(): readonly MicrioImage[];
2600
+ /** Currently displayed {@link MicrioImage} tiles in the active grid layout. */
2601
+ get currentImages(): readonly MicrioImage[];
2929
2602
  /** Get a grid {@link MicrioImage} instance by its image ID, if it is part of this grid. */
2930
2603
  getImage(id: string): MicrioImage | undefined;
2604
+ /**
2605
+ * Dynamically registers a new image bundle into this live grid without tearing down WebGL.
2606
+ * Idempotent: returns the existing {@link MicrioImage} if `bundle.id` is already tracked.
2607
+ */
2608
+ addImage(bundle: Models.ImageBundle.BundleImage): MicrioImage;
2609
+ /** All named {@link Models.Grid.GridEffect} definitions available on this grid. */
2610
+ get effects(): readonly Models.Grid.GridEffect[];
2611
+ /** Replace the live list of named {@link Models.Grid.GridEffect} definitions without rebuilding WebGL. */
2612
+ setEffects(effects: Models.Grid.GridEffect[]): void;
2613
+ /** Returns the current grid layout entries (including empty placeholders). */
2614
+ getLayout(): readonly Models.Grid.GridEntry[];
2931
2615
  /** The currently focussed (single-view) image, if any. */
2932
2616
  get $focussed(): MicrioImage | undefined;
2933
2617
  /** The parent `<micrio-*>` element this grid is bound to. */
@@ -2965,10 +2649,30 @@ declare module '@micrio/client' {
2965
2649
  gridFocus(img: MicrioImage | undefined, opts?: Models.Grid.FocusOptions): Promise<void>;
2966
2650
  /** Remove focus from the currently focussed image and return to the grid overview. */
2967
2651
  blur(): void;
2968
- /** Execute a grid action by type (e.g. `focus`, `reset`, `back`) with optional data and duration. */
2652
+ /** Execute a grid action by type (e.g. `focus`, `reset`, `back`, `effect`) with optional data and duration. */
2969
2653
  action(action: GridActionType | string, data?: string, duration?: number, focusTransition?: Models.Grid.MarkerFocusTransition): void;
2654
+ /**
2655
+ * Execute a named album {@link Models.Grid.GridEffect} (by ID) or an inline {@link Models.Grid.GridEffect} object.
2656
+ * Supersedes any currently running multi-step effect.
2657
+ */
2658
+ runEffect(effectOrId: string | Models.Grid.GridEffect, opts?: Models.Grid.RunEffectOptions): Promise<void>;
2970
2659
  /** Enlarge a specific grid cell to span the given number of columns/rows, re-laying out without history. */
2971
2660
  enlarge(idx: number, width: number, height?: number): Promise<MicrioImage[]>;
2661
+ /**
2662
+ * Controls which grid tiles display their interactive marker layers while in overview mode.
2663
+ * Pass `'all'` to show markers on every image, `'none'` to clear, or an explicit list of images.
2664
+ */
2665
+ showMarkers(target: MicrioImage[] | 'all' | 'none'): void;
2666
+ /**
2667
+ * Hit-tests `<micr-io>`-relative CSS pixel coordinates `(elX, elY)` against the visible grid tiles
2668
+ * (in descending `zIndex` order), returning the hit image and normalized `[0..1]` coordinates when
2669
+ * the point lands inside the rendered image bounds (excluding grid gutters / letterbox margins).
2670
+ */
2671
+ getImageAtPoint(elX: number, elY: number): {
2672
+ image: MicrioImage;
2673
+ x: number;
2674
+ y: number;
2675
+ } | undefined;
2972
2676
  }
2973
2677
  export {};
2974
2678
 
@@ -3044,7 +2748,7 @@ declare module '@micrio/client' {
3044
2748
  updateEvents(time: number): void;
3045
2749
  /** Getter for the total duration of the tour in seconds. */
3046
2750
  get duration(): number;
3047
- /** Setter for the total duration (updates internal content). */
2751
+ /** Setter for the total duration (updates internal content and state machine context). */
3048
2752
  set duration(v: number);
3049
2753
  /** Getter for the current paused state. */
3050
2754
  get paused(): boolean;
@@ -3185,26 +2889,7 @@ declare module '@micrio/client' {
3185
2889
  *
3186
2890
  * @license MIT
3187
2891
  */
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
- }
2892
+ export {};
3208
2893
 
3209
2894
 
3210
2895
  export {};
@@ -3261,17 +2946,6 @@ declare module '@micrio/client' {
3261
2946
  /** Set by the page (or loaded below) from the PlayCanvas SOG bundle. */
3262
2947
  var createMicrioSogViewer: CreateMicrioSogViewer | undefined;
3263
2948
  }
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
2949
  export {};
3276
2950
 
3277
2951
 
@@ -3305,6 +2979,9 @@ declare module '@micrio/client' {
3305
2979
  export {};
3306
2980
 
3307
2981
 
2982
+ export {};
2983
+
2984
+
3308
2985
  /** Names of all icons available in the Micrio UI icon library. */
3309
2986
  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
2987