@micrio/client 6.1.5 → 6.1.7

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. */
@@ -445,7 +445,7 @@ declare module '@micrio/client' {
445
445
  /** Returns the organisation data from the bundle, or undefined. */
446
446
  getOrganisation(): Models.ImageInfo.Organisation | undefined;
447
447
  /** Returns the album info for an album ID from the bundle cache. */
448
- getAlbum(id: string): Models.ImageInfo.GallerySettings | undefined;
448
+ getAlbum(id: string): Models.GalleryConfig | undefined;
449
449
  /**
450
450
  * Returns the full bundle entry (info + data) for a single image ID,
451
451
  * fetching the bundle once if not cached.
@@ -508,7 +508,7 @@ declare module '@micrio/client' {
508
508
  */
509
509
  class Image {
510
510
  private image;
511
- /** Writable Svelte store holding the current viewport [centerX, centerY, width, height] of this image. */
511
+ /** Writable Svelte store holding the current viewport [x0, y0, width, height] of this image. */
512
512
  readonly view: Writable<Models.Camera.View | undefined>;
513
513
  /** Getter for the current value of the {@link view} store. */
514
514
  get $view(): Models.Camera.View | undefined;
@@ -537,8 +537,8 @@ declare module '@micrio/client' {
537
537
  engine: Engine;
538
538
  private attr;
539
539
  opts: {
540
- /** Optional sub area [x0, y0, x1, y1] defining placement within a parent canvas (for embeds/galleries). */
541
- area?: Models.Camera.ViewRect;
540
+ /** Optional sub area [x, y, width, height] defining placement within a parent canvas (for embeds/galleries). */
541
+ area?: Models.Camera.View;
542
542
  /** For split screen, the primary image this one is secondary to. */
543
543
  secondaryTo?: MicrioImage;
544
544
  /** If true, passively follows the view changes of the primary split-screen image. */
@@ -587,7 +587,7 @@ declare module '@micrio/client' {
587
587
  /** Stores an error message if loading failed. */
588
588
  error: string | undefined;
589
589
  /** 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>;
590
+ readonly viewport: Writable<Models.Camera.View>;
591
591
  /** Array of child {@link MicrioImage} instances embedded within this image. */
592
592
  readonly embeds: MicrioImage[];
593
593
  /** Grid controller instance, if this image is a grid container. */
@@ -597,11 +597,11 @@ declare module '@micrio/client' {
597
597
  /**
598
598
  * Adds an embedded MicrioImage (representing another Micrio image or video) within this image.
599
599
  * @param info Partial info data for the embed.
600
- * @param area The placement area `[x0, y0, x1, y1]` within the parent image.
600
+ * @param area The placement area `[x, y, width, height]` within the parent image.
601
601
  * @param opts Embedding options (opacity, fit, etc.).
602
602
  * @returns The newly created embedded {@link MicrioImage} instance.
603
603
  */
604
- addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.ViewRect, opts?: Models.Embeds.EmbedOptions): MicrioImage;
604
+ addEmbed(info: Partial<Models.ImageInfo.ImageInfo>, area: Models.Camera.View, opts?: Models.Embeds.EmbedOptions): MicrioImage;
605
605
  /** Gets the HTMLMediaElement associated with a video embed ID. */
606
606
  getEmbedMediaElement(id: string): HTMLMediaElement | undefined;
607
607
  /** Fades in the image smoothly or instantly. */
@@ -747,7 +747,7 @@ declare module '@micrio/client' {
747
747
  /** Returns the grid image under the given screen coordinates (clientX, clientY).
748
748
  * If the current image is a focused grid child, returns it directly. */
749
749
  getImageAt(clientX: number, clientY: number): MicrioImage | undefined;
750
- getRelativeView(image: MicrioImage, view: Models.Camera.ViewRect): Models.Camera.ViewRect;
750
+ getRelativeView(image: MicrioImage, view: Models.Camera.View): Models.Camera.View;
751
751
  }
752
752
  /**
753
753
  * Video tour controller. Manages playback and camera animation for video tours
@@ -950,22 +950,8 @@ declare module '@micrio/client' {
950
950
  isSingle?: boolean;
951
951
  /** A custom format (`dz` for DeepZoom, `iiif` for IIIF) */
952
952
  format?: string;
953
- /** Optional IIIF source for tiles */
954
- iiifManifest?: string;
955
953
  /** The album (V5+) ID */
956
954
  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
955
  /** The 360 tour space ID */
970
956
  spacesId?: string;
971
957
  };
@@ -1121,7 +1107,7 @@ declare module '@micrio/client' {
1121
1107
  /** All markers are scaled with the image */
1122
1108
  markersScale?: boolean;
1123
1109
  /** Albums */
1124
- gallery?: GallerySettings;
1110
+ gallery?: GalleryConfig;
1125
1111
  /** FOR OMNI OBJECTS */
1126
1112
  omni?: OmniSettings;
1127
1113
  /** Optional marker settings */
@@ -1169,31 +1155,6 @@ declare module '@micrio/client' {
1169
1155
  /** Watermark opacity, defaults to 0.075 */
1170
1156
  watermarkOpacity?: number;
1171
1157
  };
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
1158
  type OmniSettings = {
1198
1159
  /** Number of frames */
1199
1160
  frames: number;
@@ -1777,7 +1738,7 @@ declare module '@micrio/client' {
1777
1738
  id: string;
1778
1739
  data: Models.Spaces.Space;
1779
1740
  }[];
1780
- album?: ImageInfo.GallerySettings;
1741
+ album?: GalleryConfig;
1781
1742
  };
1782
1743
  }
1783
1744
  namespace Assets {
@@ -1927,7 +1888,7 @@ declare module '@micrio/client' {
1927
1888
  baseTileIdx: number;
1928
1889
  ptr: number;
1929
1890
  opts: {
1930
- area: Camera.ViewRect;
1891
+ area: Camera.View;
1931
1892
  };
1932
1893
  }
1933
1894
  }
@@ -1938,8 +1899,8 @@ declare module '@micrio/client' {
1938
1899
  /** Virtual ImageInfo extension to support grid logic */
1939
1900
  interface GridImage extends Partial<ImageInfo.ImageInfo> {
1940
1901
  size: [number, number?];
1941
- area?: Camera.ViewRect;
1942
- view?: Camera.ViewRect;
1902
+ area?: Camera.View;
1903
+ view?: Camera.View;
1943
1904
  }
1944
1905
  interface GridHistory {
1945
1906
  layout: string;
@@ -1948,7 +1909,7 @@ declare module '@micrio/client' {
1948
1909
  }
1949
1910
  interface GridImageOptions {
1950
1911
  view?: Camera.View;
1951
- area?: Camera.ViewRect;
1912
+ area?: Camera.View;
1952
1913
  size?: number[];
1953
1914
  }
1954
1915
  interface FocusOptions {
@@ -1976,7 +1937,7 @@ declare module '@micrio/client' {
1976
1937
  /** The current page index */
1977
1938
  currentIndex: number;
1978
1939
  /** The album info */
1979
- info?: ImageInfo.GallerySettings;
1940
+ info?: GalleryConfig;
1980
1941
  /** Go to previous page */
1981
1942
  prev: () => void;
1982
1943
  /** Go to next page */
@@ -1990,12 +1951,39 @@ declare module '@micrio/client' {
1990
1951
  * controls to the image under focus instead of the virtual parent. */
1991
1952
  currentImage?: Writable<import("ts/image").MicrioImage>;
1992
1953
  }
1954
+ /** Gallery item representing a single image within a gallery or grid */
1955
+ type GalleryItem = {
1956
+ id: string;
1957
+ width: number;
1958
+ height: number;
1959
+ path?: string;
1960
+ tileSize?: number;
1961
+ isDeepZoom?: boolean;
1962
+ isPng?: boolean;
1963
+ isWebP?: boolean;
1964
+ };
1965
+ /** Gallery configuration */
1966
+ type GalleryConfig = {
1967
+ type: 'swipe' | 'switch' | 'grid';
1968
+ startId?: string;
1969
+ sort?: 'name' | '-name' | 'created' | '-created' | 'random';
1970
+ isSpreads?: boolean;
1971
+ coverPages?: number;
1972
+ archive?: string;
1973
+ archiveLayerOffset?: number;
1974
+ revisions?: Record<string, Record<string, any>>;
1975
+ settings?: Partial<ImageInfo.Settings>;
1976
+ id?: string;
1977
+ name?: string;
1978
+ grid?: {
1979
+ clickable?: 'focus' | 'zoom' | false;
1980
+ panZoom?: 'cells' | 'grid';
1981
+ };
1982
+ };
1993
1983
  namespace Camera {
1994
1984
  /** A numeric array or Float64Array used for camera geometry. */
1995
1985
  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). */
1986
+ /** A viewport/area definition `[x, y, width, height]` (origin + size). */
1999
1987
  type View = CameraArray;
2000
1988
  /** Coordinate tuple, [x, y, scale] */
2001
1989
  type Coords = [number, number, number?] | Float64Array;
@@ -2673,6 +2661,60 @@ declare module '@micrio/client' {
2673
2661
  /** Unhooks pointer listeners for drag panning. */
2674
2662
  unhookDrag(): void;
2675
2663
  }
2664
+ export class Gallery {
2665
+ readonly config: Models.GalleryConfig;
2666
+ readonly images: MicrioImage[];
2667
+ readonly engine: Engine;
2668
+ readonly micrio: HTMLMicrioElement;
2669
+ parent: MicrioImage | null;
2670
+ swiper: any;
2671
+ grid: Grid | null;
2672
+ readonly currentIndex: Writable<number>;
2673
+ /** For grid-type galleries, the processed grid string for Grid controller. */
2674
+ _gridString: string | undefined;
2675
+ /** Max width for the virtual container canvas (switch/omni galleries). */
2676
+ containerWidth: number;
2677
+ /** Max height for the virtual container canvas (switch/omni galleries). */
2678
+ containerHeight: number;
2679
+ get type(): Models.GalleryConfig['type'];
2680
+ constructor(items: Models.GalleryItem[], engine: Engine, micrio: HTMLMicrioElement, config: Models.GalleryConfig);
2681
+ /** Create a gallery from a IIIF Presentation API 3 manifest. Returns null for single-image manifests and raw Image API responses. */
2682
+ static fromIIIF(url: string, engine: Engine, micrio: HTMLMicrioElement): Promise<Gallery | null>;
2683
+ /** Extract single-image gallery item from a IIIF response URL */
2684
+ static singleIIIFInfo(url: string): Promise<Models.GalleryItem>;
2685
+ static fromAssets(assets: Models.Assets.Image[], engine: Engine, micrio: HTMLMicrioElement, opts?: {
2686
+ startId?: string;
2687
+ basePath?: string;
2688
+ }): Gallery;
2689
+ static fromArchive(archiveId: string, path: string, engine: Engine, micrio: HTMLMicrioElement, config?: Partial<Models.GalleryConfig>): Promise<Gallery>;
2690
+ static fromGrid(gridData: string, engine: Engine, micrio: HTMLMicrioElement, config?: Partial<Models.GalleryConfig & {
2691
+ path?: string;
2692
+ }>): Promise<Gallery | null>;
2693
+ static fromAlbum(albumId: string, engine: Engine, micrio: HTMLMicrioElement, opts?: {
2694
+ startId?: string;
2695
+ path?: string;
2696
+ onProgress?: (n: number) => void;
2697
+ }): Promise<Gallery | null>;
2698
+ private static getArchiveIndex;
2699
+ private static sortArchiveImages;
2700
+ /** Compute the page layout for Gallery.svelte. Returns pages (camera views) and
2701
+ * the mapping from page index to image index(es). For strip-swipe galleries each
2702
+ * image fills the full viewport; for switch/grid the per-image `opts.area` is used
2703
+ * and spreads are merged into single pages. */
2704
+ getPageLayout(): {
2705
+ pages: Models.Camera.View[];
2706
+ pageIdxes: number[][];
2707
+ };
2708
+ attach(parent: MicrioImage): void;
2709
+ detach(): void;
2710
+ destroy(): void;
2711
+ /** Go to a specific page index. */
2712
+ goto(index: number): void;
2713
+ /** Go to the next page. */
2714
+ next(): void;
2715
+ /** Go to the previous page. */
2716
+ prev(): void;
2717
+ }
2676
2718
  /**
2677
2719
  * Language-related constants and utilities.
2678
2720
  */
@@ -2802,6 +2844,8 @@ declare module '@micrio/client' {
2802
2844
  defaultSettings?: Partial<Models.ImageInfo.Settings>;
2803
2845
  /** Holds data for the current 360 space, if applicable (loaded via `data-space` attribute or API). */
2804
2846
  spaceData: Models.Spaces.Space | undefined;
2847
+ /** The current active gallery controller, if any. */
2848
+ readonly gallery: Writable<Gallery | undefined>;
2805
2849
  addEventListener<K extends keyof Models.MicrioEventMap>(type: K, listener: (this: HTMLMicrioElement, ev: Models.MicrioEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2806
2850
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLMicrioElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
2807
2851
  addEventListener(type: string, listener: (this: HTMLMicrioElement, ev: Event) => any, options?: boolean | AddEventListenerOptions): void;
@@ -2831,6 +2875,8 @@ declare module '@micrio/client' {
2831
2875
  startView?: Models.Camera.View;
2832
2876
  /** For 360 transitions, provides the direction vector from the previous image. */
2833
2877
  vector?: Models.Camera.Vector;
2878
+ /** Optional Gallery controller, used for gallery/grid views. */
2879
+ gallery?: Gallery;
2834
2880
  }): MicrioImage;
2835
2881
  /**
2836
2882
  * Closes an opened MicrioImage.
@@ -2839,11 +2885,6 @@ declare module '@micrio/client' {
2839
2885
  * @param img The {@link MicrioImage} instance to close.
2840
2886
  */
2841
2887
  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
2888
  /** Getter for the current language code. */
2848
2889
  get lang(): string;
2849
2890
  /** Setter for the current language code. Triggers language change logic. */