@micrio/client 6.1.6 → 6.1.8

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
@@ -97,7 +97,7 @@ declare module '@micrio/client' {
97
97
  */
98
98
  getView: () => Models.Camera.View;
99
99
  /**
100
- * Gets the current image view rectangle [centerX, centerY, width, height] relative to the image (0-1).
100
+ * Gets the current image view rectangle [x0, y0, width, height] relative to the image (0-1).
101
101
  * @returns A copy of the current screen viewport array, or undefined if not initialized.
102
102
  */
103
103
  getViewRaw: () => Float64Array;
@@ -114,7 +114,7 @@ declare module '@micrio/client' {
114
114
  /** If true, prevents triggering a render after setting the view. */
115
115
  noRender?: boolean;
116
116
  /** If provided, interprets `view` relative to this sub-area instead of the full image. */
117
- area?: Models.Camera.ViewRect;
117
+ area?: Models.Camera.View;
118
118
  }): void;
119
119
  /**
120
120
  * Gets the relative image coordinates [x, y, scale, depth, yaw?, pitch?] corresponding to a screen coordinate.
@@ -196,7 +196,7 @@ declare module '@micrio/client' {
196
196
  * @param opts Optional animation settings.
197
197
  * @returns A Promise that resolves when the animation completes, or rejects if aborted.
198
198
  */
199
- flyToView: (view: Models.Camera.ViewRect | Models.Camera.View, opts?: Models.Camera.AnimationOptions & {
199
+ flyToView: (view: Models.Camera.View, opts?: Models.Camera.AnimationOptions & {
200
200
  /** Set the starting animation progress percentage (0-1). */
201
201
  progress?: number;
202
202
  /** Base the progress override on this starting view. */
@@ -206,7 +206,7 @@ declare module '@micrio/client' {
206
206
  /** For Omni objects: the target image frame index to animate to. */
207
207
  omniIndex?: number;
208
208
  /** If provided, interprets `view` relative to this sub-area. */
209
- area?: Models.Camera.ViewRect;
209
+ area?: Models.Camera.View;
210
210
  /** If true, respects the image's maximum zoom limit during animation. */
211
211
  limitZoom?: boolean;
212
212
  /** If provided, adds a margin to the view. */
@@ -278,10 +278,10 @@ declare module '@micrio/client' {
278
278
  /**
279
279
  * Sets the rendering area for this image within the main canvas.
280
280
  * Used for split-screen and potentially other layout effects. Animates by default.
281
- * @param v The target area rectangle [x0, y0, x1, y1] relative to the main canvas (0-1).
281
+ * @param v The target area rectangle [x0, y0, width, height] relative to the main canvas (0-1).
282
282
  * @param opts Options for setting the area.
283
283
  */
284
- setArea(v: Models.Camera.ViewRect, opts?: {
284
+ setArea(v: Models.Camera.View, opts?: {
285
285
  /** If true, sets the area instantly without animation. */
286
286
  direct?: boolean;
287
287
  /** If true, prevents dispatching view updates during the animation. */
@@ -435,6 +435,8 @@ declare module '@micrio/client' {
435
435
  getData(id: string): Promise<Models.ImageData.ImageData | undefined>;
436
436
  /** Synchronous accessor for already-cached bundle data. */
437
437
  getDataSync(id: string): Models.ImageData.ImageData | undefined;
438
+ /** Synchronous accessor for the full bundle entry (info + data) when it is already cached. */
439
+ getBundleImageSync(id: string): Models.ImageBundle.BundleImage | undefined;
438
440
  /**
439
441
  * Resolves the marker for a tour step from the already-loaded bundle cache.
440
442
  * This replaces the earlier static `.marker` JSON that was inlined in stepInfo.
@@ -445,7 +447,7 @@ declare module '@micrio/client' {
445
447
  /** Returns the organisation data from the bundle, or undefined. */
446
448
  getOrganisation(): Models.ImageInfo.Organisation | undefined;
447
449
  /** Returns the album info for an album ID from the bundle cache. */
448
- getAlbum(id: string): Models.ImageInfo.GallerySettings | undefined;
450
+ getAlbum(id: string): Models.GalleryConfig | undefined;
449
451
  /**
450
452
  * Returns the full bundle entry (info + data) for a single image ID,
451
453
  * fetching the bundle once if not cached.
@@ -508,7 +510,7 @@ declare module '@micrio/client' {
508
510
  */
509
511
  class Image {
510
512
  private image;
511
- /** Writable Svelte store holding the current viewport [centerX, centerY, width, height] of this image. */
513
+ /** Writable Svelte store holding the current viewport [x0, y0, width, height] of this image. */
512
514
  readonly view: Writable<Models.Camera.View | undefined>;
513
515
  /** Getter for the current value of the {@link view} store. */
514
516
  get $view(): Models.Camera.View | undefined;
@@ -537,8 +539,8 @@ declare module '@micrio/client' {
537
539
  engine: Engine;
538
540
  private attr;
539
541
  opts: {
540
- /** Optional sub area [x0, y0, x1, y1] defining placement within a parent canvas (for embeds/galleries). */
541
- area?: Models.Camera.ViewRect;
542
+ /** Optional sub area [x, y, width, height] defining placement within a parent canvas (for embeds/galleries). */
543
+ area?: Models.Camera.View;
542
544
  /** For split screen, the primary image this one is secondary to. */
543
545
  secondaryTo?: MicrioImage;
544
546
  /** If true, passively follows the view changes of the primary split-screen image. */
@@ -587,7 +589,7 @@ declare module '@micrio/client' {
587
589
  /** Stores an error message if loading failed. */
588
590
  error: string | undefined;
589
591
  /** Svelte Writable store holding the calculated pixel viewport [left, top, width, height] of this image within the main canvas. */
590
- readonly viewport: Writable<Models.Camera.ViewRect>;
592
+ readonly viewport: Writable<Models.Camera.View>;
591
593
  /** Array of child {@link MicrioImage} instances embedded within this image. */
592
594
  readonly embeds: MicrioImage[];
593
595
  /** Grid controller instance, if this image is a grid container. */
@@ -597,17 +599,22 @@ declare module '@micrio/client' {
597
599
  /**
598
600
  * Adds an embedded MicrioImage (representing another Micrio image or video) within this image.
599
601
  * @param info Partial info data for the embed.
600
- * @param area The placement area `[x0, y0, x1, y1]` within the parent image.
602
+ * @param area The placement area `[x, y, width, height]` within the parent image.
601
603
  * @param opts Embedding options (opacity, fit, etc.).
602
604
  * @returns The newly created embedded {@link MicrioImage} instance.
603
605
  */
604
- addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.ViewRect, opts?: Models.Embeds.EmbedOptions): MicrioImage;
606
+ addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.View, opts?: Models.Embeds.EmbedOptions): MicrioImage;
605
607
  /** Gets the HTMLMediaElement associated with a video embed ID. */
606
608
  getEmbedMediaElement(id: string): HTMLMediaElement | undefined;
607
609
  /** Fades in the image smoothly or instantly. */
608
610
  fadeIn(direct?: boolean): void;
609
611
  /** Fades out the image smoothly or instantly. */
610
612
  fadeOut(direct?: boolean): void;
613
+ /** Loads image-specific data (markers, tours, etc.) from the bundle cache.
614
+ * Safe to call on gallery children and other non-current images —
615
+ * does not trigger auto-start or other main-image side effects.
616
+ * The bundle is typically already cached from the parent image's load. */
617
+ loadBundleData(): void;
611
618
  }
612
619
  /**
613
620
  * Micrio grid display controller
@@ -747,7 +754,7 @@ declare module '@micrio/client' {
747
754
  /** Returns the grid image under the given screen coordinates (clientX, clientY).
748
755
  * If the current image is a focused grid child, returns it directly. */
749
756
  getImageAt(clientX: number, clientY: number): MicrioImage | undefined;
750
- getRelativeView(image: MicrioImage, view: Models.Camera.ViewRect): Models.Camera.ViewRect;
757
+ getRelativeView(image: MicrioImage, view: Models.Camera.View): Models.Camera.View;
751
758
  }
752
759
  /**
753
760
  * Video tour controller. Manages playback and camera animation for video tours
@@ -950,22 +957,8 @@ declare module '@micrio/client' {
950
957
  isSingle?: boolean;
951
958
  /** A custom format (`dz` for DeepZoom, `iiif` for IIIF) */
952
959
  format?: string;
953
- /** Optional IIIF source for tiles */
954
- iiifManifest?: string;
955
960
  /** The album (V5+) ID */
956
961
  albumId?: string;
957
- /** Single-canvas sequence -- IIIF Presentation API 3 */
958
- type?: ('Manifest' | 'Canvas' | 'AnnotationPage' | 'Annotation' | 'Image');
959
- items?: Partial<ImageInfo.ImageInfo>[];
960
- body?: Partial<ImageInfo.ImageInfo> & {
961
- format: string;
962
- width: number;
963
- height: number;
964
- service: {
965
- id: string;
966
- type: 'ImageService3';
967
- }[];
968
- };
969
962
  /** The 360 tour space ID */
970
963
  spacesId?: string;
971
964
  };
@@ -1121,7 +1114,7 @@ declare module '@micrio/client' {
1121
1114
  /** All markers are scaled with the image */
1122
1115
  markersScale?: boolean;
1123
1116
  /** Albums */
1124
- gallery?: GallerySettings;
1117
+ gallery?: GalleryConfig;
1125
1118
  /** FOR OMNI OBJECTS */
1126
1119
  omni?: OmniSettings;
1127
1120
  /** Optional marker settings */
@@ -1169,31 +1162,6 @@ declare module '@micrio/client' {
1169
1162
  /** Watermark opacity, defaults to 0.075 */
1170
1163
  watermarkOpacity?: number;
1171
1164
  };
1172
- type GallerySettings = {
1173
- /** Album/image ID for the gallery */
1174
- id?: string;
1175
- /** Gallery name */
1176
- name?: string;
1177
- /** Gallery has an associated .bin archive with thumbnails */
1178
- archive?: string;
1179
- /** Archive layer offset */
1180
- archiveLayerOffset?: number;
1181
- /** Gallery sorting */
1182
- sort?: ('name' | '-name' | 'created' | '-created' | 'random');
1183
- /** Gallery type */
1184
- type?: ('swipe' | 'swipe-full' | 'switch' | 'omni' | 'grid');
1185
- /** The gallery opening image ID */
1186
- startId?: string;
1187
- /** Pages are combined to 2x1 spreads */
1188
- isSpreads?: boolean;
1189
- /** For spreads, number of cover pages to show as single page */
1190
- coverPages?: number;
1191
- /** Optional viewer settings that override/merge with defaults */
1192
- settings?: Partial<ImageInfo.Settings>;
1193
- revisions?: {
1194
- [key: string]: RevisionType;
1195
- };
1196
- };
1197
1165
  type OmniSettings = {
1198
1166
  /** Number of frames */
1199
1167
  frames: number;
@@ -1777,7 +1745,7 @@ declare module '@micrio/client' {
1777
1745
  id: string;
1778
1746
  data: Models.Spaces.Space;
1779
1747
  }[];
1780
- album?: ImageInfo.GallerySettings;
1748
+ album?: GalleryConfig;
1781
1749
  };
1782
1750
  }
1783
1751
  namespace Assets {
@@ -1927,7 +1895,7 @@ declare module '@micrio/client' {
1927
1895
  baseTileIdx: number;
1928
1896
  ptr: number;
1929
1897
  opts: {
1930
- area: Camera.ViewRect;
1898
+ area: Camera.View;
1931
1899
  };
1932
1900
  }
1933
1901
  }
@@ -1938,8 +1906,8 @@ declare module '@micrio/client' {
1938
1906
  /** Virtual ImageInfo extension to support grid logic */
1939
1907
  interface GridImage extends Partial<ImageInfo.ImageInfo> {
1940
1908
  size: [number, number?];
1941
- area?: Camera.ViewRect;
1942
- view?: Camera.ViewRect;
1909
+ area?: Camera.View;
1910
+ view?: Camera.View;
1943
1911
  }
1944
1912
  interface GridHistory {
1945
1913
  layout: string;
@@ -1948,7 +1916,7 @@ declare module '@micrio/client' {
1948
1916
  }
1949
1917
  interface GridImageOptions {
1950
1918
  view?: Camera.View;
1951
- area?: Camera.ViewRect;
1919
+ area?: Camera.View;
1952
1920
  size?: number[];
1953
1921
  }
1954
1922
  interface FocusOptions {
@@ -1976,7 +1944,7 @@ declare module '@micrio/client' {
1976
1944
  /** The current page index */
1977
1945
  currentIndex: number;
1978
1946
  /** The album info */
1979
- info?: ImageInfo.GallerySettings;
1947
+ info?: GalleryConfig;
1980
1948
  /** Go to previous page */
1981
1949
  prev: () => void;
1982
1950
  /** Go to next page */
@@ -1990,12 +1958,39 @@ declare module '@micrio/client' {
1990
1958
  * controls to the image under focus instead of the virtual parent. */
1991
1959
  currentImage?: Writable<import("ts/image").MicrioImage>;
1992
1960
  }
1961
+ /** Gallery item representing a single image within a gallery or grid */
1962
+ type GalleryItem = {
1963
+ id: string;
1964
+ width: number;
1965
+ height: number;
1966
+ path?: string;
1967
+ tileSize?: number;
1968
+ isDeepZoom?: boolean;
1969
+ isPng?: boolean;
1970
+ isWebP?: boolean;
1971
+ };
1972
+ /** Gallery configuration */
1973
+ type GalleryConfig = {
1974
+ type: 'swipe' | 'switch' | 'grid';
1975
+ startId?: string;
1976
+ sort?: 'name' | '-name' | 'created' | '-created' | 'random';
1977
+ isSpreads?: boolean;
1978
+ coverPages?: number;
1979
+ archive?: string;
1980
+ archiveLayerOffset?: number;
1981
+ revisions?: Record<string, Record<string, any>>;
1982
+ settings?: Partial<ImageInfo.Settings>;
1983
+ id?: string;
1984
+ name?: string;
1985
+ grid?: {
1986
+ clickable?: 'focus' | 'zoom' | false;
1987
+ panZoom?: 'cells' | 'grid';
1988
+ };
1989
+ };
1993
1990
  namespace Camera {
1994
1991
  /** A numeric array or Float64Array used for camera geometry. */
1995
1992
  type CameraArray = number[] | Float64Array;
1996
- /** A viewport rectangle `[x0, y0, x1, y1]` (corners). */
1997
- type ViewRect = CameraArray;
1998
- /** An area definition `[x0, y0, width, height]` (origin + size). */
1993
+ /** A viewport/area definition `[x, y, width, height]` (origin + size). */
1999
1994
  type View = CameraArray;
2000
1995
  /** Coordinate tuple, [x, y, scale] */
2001
1996
  type Coords = [number, number, number?] | Float64Array;
@@ -2673,6 +2668,60 @@ declare module '@micrio/client' {
2673
2668
  /** Unhooks pointer listeners for drag panning. */
2674
2669
  unhookDrag(): void;
2675
2670
  }
2671
+ export class Gallery {
2672
+ readonly config: Models.GalleryConfig;
2673
+ readonly images: MicrioImage[];
2674
+ readonly engine: Engine;
2675
+ readonly micrio: HTMLMicrioElement;
2676
+ parent: MicrioImage | null;
2677
+ swiper: any;
2678
+ grid: Grid | null;
2679
+ readonly currentIndex: Writable<number>;
2680
+ /** For grid-type galleries, the processed grid string for Grid controller. */
2681
+ _gridString: string | undefined;
2682
+ /** Max width for the virtual container canvas (switch/omni galleries). */
2683
+ containerWidth: number;
2684
+ /** Max height for the virtual container canvas (switch/omni galleries). */
2685
+ containerHeight: number;
2686
+ get type(): Models.GalleryConfig['type'];
2687
+ constructor(items: Models.GalleryItem[], engine: Engine, micrio: HTMLMicrioElement, config: Models.GalleryConfig);
2688
+ /** Create a gallery from a IIIF Presentation API 3 manifest. Returns null for single-image manifests and raw Image API responses. */
2689
+ static fromIIIF(url: string, engine: Engine, micrio: HTMLMicrioElement): Promise<Gallery | null>;
2690
+ /** Extract single-image gallery item from a IIIF response URL */
2691
+ static singleIIIFInfo(url: string): Promise<Models.GalleryItem>;
2692
+ static fromAssets(assets: Models.Assets.Image[], engine: Engine, micrio: HTMLMicrioElement, opts?: {
2693
+ startId?: string;
2694
+ basePath?: string;
2695
+ }): Gallery;
2696
+ static fromArchive(archiveId: string, path: string, engine: Engine, micrio: HTMLMicrioElement, config?: Partial<Models.GalleryConfig>): Promise<Gallery>;
2697
+ static fromGrid(gridData: string, engine: Engine, micrio: HTMLMicrioElement, config?: Partial<Models.GalleryConfig & {
2698
+ path?: string;
2699
+ }>): Promise<Gallery | null>;
2700
+ static fromAlbum(albumId: string, engine: Engine, micrio: HTMLMicrioElement, opts?: {
2701
+ startId?: string;
2702
+ path?: string;
2703
+ onProgress?: (n: number) => void;
2704
+ }): Promise<Gallery | null>;
2705
+ private static getArchiveIndex;
2706
+ private static sortArchiveImages;
2707
+ /** Compute the page layout for Gallery.svelte. Returns pages (camera views) and
2708
+ * the mapping from page index to image index(es). For strip-swipe galleries each
2709
+ * image fills the full viewport; for switch/grid the per-image `opts.area` is used
2710
+ * and spreads are merged into single pages. */
2711
+ getPageLayout(): {
2712
+ pages: Models.Camera.View[];
2713
+ pageIdxes: number[][];
2714
+ };
2715
+ attach(parent: MicrioImage): void;
2716
+ detach(): void;
2717
+ destroy(): void;
2718
+ /** Go to a specific page index. */
2719
+ goto(index: number): void;
2720
+ /** Go to the next page. */
2721
+ next(): void;
2722
+ /** Go to the previous page. */
2723
+ prev(): void;
2724
+ }
2676
2725
  /**
2677
2726
  * Language-related constants and utilities.
2678
2727
  */
@@ -2802,6 +2851,8 @@ declare module '@micrio/client' {
2802
2851
  defaultSettings?: Partial<Models.ImageInfo.Settings>;
2803
2852
  /** Holds data for the current 360 space, if applicable (loaded via `data-space` attribute or API). */
2804
2853
  spaceData: Models.Spaces.Space | undefined;
2854
+ /** The current active gallery controller, if any. */
2855
+ readonly gallery: Writable<Gallery | undefined>;
2805
2856
  addEventListener<K extends keyof Models.MicrioEventMap>(type: K, listener: (this: HTMLMicrioElement, ev: Models.MicrioEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2806
2857
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLMicrioElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2807
2858
  addEventListener(type: string, listener: (this: HTMLMicrioElement, ev: Event) => any, options?: boolean | AddEventListenerOptions): void;
@@ -2831,6 +2882,8 @@ declare module '@micrio/client' {
2831
2882
  startView?: Models.Camera.View;
2832
2883
  /** For 360 transitions, provides the direction vector from the previous image. */
2833
2884
  vector?: Models.Camera.Vector;
2885
+ /** Optional Gallery controller, used for gallery/grid views. */
2886
+ gallery?: Gallery;
2834
2887
  }): MicrioImage;
2835
2888
  /**
2836
2889
  * Closes an opened MicrioImage.
@@ -2839,11 +2892,6 @@ declare module '@micrio/client' {
2839
2892
  * @param img The {@link MicrioImage} instance to close.
2840
2893
  */
2841
2894
  close(img: MicrioImage): void;
2842
- /** Holds loaded grid info data if applicable. */
2843
- gridInfoData: {
2844
- images: Models.ImageInfo.ImageInfo[];
2845
- } | undefined;
2846
- private sortArchiveImages;
2847
2895
  /** Getter for the current language code. */
2848
2896
  get lang(): string;
2849
2897
  /** Setter for the current language code. Triggers language change logic. */