@micrio/client 6.0.14 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/micrio.min.d.ts +155 -116
- package/micrio.min.js +3 -3
- package/package.json +1 -1
package/micrio.min.d.ts
CHANGED
|
@@ -12,119 +12,10 @@ declare module '@micrio/client' {
|
|
|
12
12
|
* @returns A Promise resolving to the loaded TextureBitmap.
|
|
13
13
|
*/
|
|
14
14
|
export const loadTexture: (src: string) => Promise<TextureBitmap>;
|
|
15
|
-
/** Type for error codes */
|
|
16
|
-
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
17
15
|
/**
|
|
18
16
|
* Calculates the positive modulo (floored division remainder).
|
|
19
17
|
*/
|
|
20
18
|
export const mod: (n: number, m?: number) => number;
|
|
21
|
-
/**
|
|
22
|
-
* Converts seconds into a human-readable time string (hh?:mm:ss).
|
|
23
|
-
* @param s Time in seconds. Can be negative for remaining time display.
|
|
24
|
-
* @returns Formatted time string (e.g., "1:23", "1:05:09", "-0:15").
|
|
25
|
-
*/
|
|
26
|
-
export function parseTime(s: number): string;
|
|
27
|
-
export type PREDEFINED = [string, Models.ImageInfo.ImageInfo, Models.ImageData.ImageData | undefined];
|
|
28
|
-
/** Enum for identifying media type. */
|
|
29
|
-
export enum MediaType {
|
|
30
|
-
None = 0,
|
|
31
|
-
IFrame = 1,
|
|
32
|
-
Video = 2,
|
|
33
|
-
Audio = 3,
|
|
34
|
-
VideoTour = 4,
|
|
35
|
-
Micrio = 5
|
|
36
|
-
}
|
|
37
|
-
/** Enum for identifying iframe player type. */
|
|
38
|
-
export enum FrameType {
|
|
39
|
-
YouTube = 1,
|
|
40
|
-
Vimeo = 2
|
|
41
|
-
}
|
|
42
|
-
export { isLegacyViews };
|
|
43
|
-
/**
|
|
44
|
-
* Marker clustering algorithm for calculating overlapping markers
|
|
45
|
-
* and generating cluster marker objects.
|
|
46
|
-
* @author Marcel Duin <marcel@micr.io>
|
|
47
|
-
*/
|
|
48
|
-
type MarkerData = Models.ImageData.Marker;
|
|
49
|
-
export type MarkerCoords = [x: number, y: number, w?: number, h?: number];
|
|
50
|
-
export interface ClusterResult {
|
|
51
|
-
overlapped: number[];
|
|
52
|
-
clusterMarkers: MarkerData[];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Calculates which markers overlap and generates synthetic cluster markers.
|
|
56
|
-
*/
|
|
57
|
-
export function calcClusters(visibleMarkers: MarkerData[] | undefined, coords: Map<string, MarkerCoords>, r: number, isOmni: boolean): ClusterResult;
|
|
58
|
-
/**
|
|
59
|
-
* Media utilities for source parsing, type detection, and player management.
|
|
60
|
-
* @author Marcel Duin <marcel@micr.io>
|
|
61
|
-
*/
|
|
62
|
-
/** YouTube no-cookies host */
|
|
63
|
-
export const YOUTUBE_HOST = "https://www.youtube-nocookie.com";
|
|
64
|
-
/**
|
|
65
|
-
* Parsed media source information.
|
|
66
|
-
*/
|
|
67
|
-
export interface ParsedMediaSource {
|
|
68
|
-
/** The detected media type */
|
|
69
|
-
type: MediaType;
|
|
70
|
-
/** The frame type for iframe embeds (YouTube/Vimeo) */
|
|
71
|
-
frameType?: FrameType;
|
|
72
|
-
/** The normalized/processed source URL */
|
|
73
|
-
src?: string;
|
|
74
|
-
/** YouTube video ID (if applicable) */
|
|
75
|
-
youtubeId?: string;
|
|
76
|
-
/** Vimeo video ID (if applicable) */
|
|
77
|
-
vimeoId?: string;
|
|
78
|
-
/** Vimeo hash token (if applicable) */
|
|
79
|
-
vimeoToken?: string;
|
|
80
|
-
/** Cloudflare video ID (if applicable) */
|
|
81
|
-
cloudflareId?: string;
|
|
82
|
-
/** Micrio embed data [id, width?, height?, lang?] */
|
|
83
|
-
micrioEmbed?: string[];
|
|
84
|
-
/** Start time extracted from URL (seconds) */
|
|
85
|
-
startTime?: number;
|
|
86
|
-
/** Whether the source is a Cloudflare stream */
|
|
87
|
-
isCloudflare: boolean;
|
|
88
|
-
/** M3U8 URL for HLS streams */
|
|
89
|
-
hlsSrc?: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Parses a media source URL and determines its type and configuration.
|
|
93
|
-
*/
|
|
94
|
-
export function parseMediaSource(src: string | undefined, tour: Models.ImageData.VideoTour | null, useNativeFrames?: boolean, currentTime?: number): ParsedMediaSource;
|
|
95
|
-
/**
|
|
96
|
-
* Checks if the browser natively supports HLS playback.
|
|
97
|
-
*/
|
|
98
|
-
export function hasNativeHLS(el?: HTMLMediaElement): boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Returns a shared Audio element instance for iOS.
|
|
101
|
-
* This is a workaround for iOS audio playback restrictions where user
|
|
102
|
-
* interaction is required per audio element.
|
|
103
|
-
*/
|
|
104
|
-
export function getIOSAudioElement(): HTMLAudioElement;
|
|
105
|
-
/**
|
|
106
|
-
* Global utility functions used throughout the Micrio application.
|
|
107
|
-
* Re-exports all utility modules for convenient importing.
|
|
108
|
-
* @author Marcel Duin <marcel@micr.io>
|
|
109
|
-
*/
|
|
110
|
-
export { MicrioError, ErrorCodes, UserErrorMessages } from "ts/utils/error";
|
|
111
|
-
export type { ErrorCode } from "ts/utils/error";
|
|
112
|
-
export { pyth, mod, limitView } from "ts/utils/math";
|
|
113
|
-
export { clone, deepCopy } from "ts/utils/object";
|
|
114
|
-
export { createGUID, slugify, parseTime } from "ts/utils/string";
|
|
115
|
-
export { Browser } from "ts/utils/browser";
|
|
116
|
-
export { sleep, notypecheck, loadScript } from "ts/utils/dom";
|
|
117
|
-
export { once, after } from "ts/utils/store";
|
|
118
|
-
export { View } from "ts/utils/view";
|
|
119
|
-
export { sanitizeAsset, isLegacyViews, sanitizeImageInfo, sanitizeImageData, sanitizeSpaceData, sanitizeMarker, sanitizeVideoTour } from "ts/utils/sanitize";
|
|
120
|
-
export { jsonCache, fetchJson, isFetching, getLocalData, fetchInfo, fetchAlbumInfo } from "ts/utils/fetch";
|
|
121
|
-
export { loadSerialTour } from "ts/utils/tour";
|
|
122
|
-
export { getIdVal, idIsV5 } from "ts/utils/id";
|
|
123
|
-
export { getSpaceVector } from "ts/utils/space";
|
|
124
|
-
export { calcClusters } from "ts/utils/clustering";
|
|
125
|
-
export type { MarkerCoords, ClusterResult } from "ts/utils/clustering";
|
|
126
|
-
export { hasNativeHLS, parseMediaSource, getIOSAudioElement, getAudioSrc, getMarkerCulture, getMenuCulture, YOUTUBE_HOST } from "ts/utils/media";
|
|
127
|
-
export type { ParsedMediaSource } from "ts/utils/media";
|
|
128
19
|
/**
|
|
129
20
|
* Defines various enums used throughout the Micrio application,
|
|
130
21
|
* primarily for standardizing action types and option values.
|
|
@@ -277,9 +168,9 @@ declare module '@micrio/client' {
|
|
|
277
168
|
isZoomedOut: (full?: boolean) => boolean;
|
|
278
169
|
/**
|
|
279
170
|
* Sets a rectangular limit for camera navigation within the image.
|
|
280
|
-
* @param v The viewport limit
|
|
171
|
+
* @param v The viewport limit [x, y, width, height] in image-relative coordinates.
|
|
281
172
|
*/
|
|
282
|
-
setLimit(v: Models.Camera.
|
|
173
|
+
setLimit(v: Models.Camera.View): void;
|
|
283
174
|
/**
|
|
284
175
|
* Sets whether the camera view should be limited to always cover the viewport.
|
|
285
176
|
* @param b If true, limits the view to cover the screen.
|
|
@@ -516,6 +407,61 @@ declare module '@micrio/client' {
|
|
|
516
407
|
*/
|
|
517
408
|
animateTo(idx: number): void;
|
|
518
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Converts seconds into a human-readable time string (hh?:mm:ss).
|
|
412
|
+
* @param s Time in seconds. Can be negative for remaining time display.
|
|
413
|
+
* @returns Formatted time string (e.g., "1:23", "1:05:09", "-0:15").
|
|
414
|
+
*/
|
|
415
|
+
export function parseTime(s: number): string;
|
|
416
|
+
/** Type for error codes */
|
|
417
|
+
export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
|
|
418
|
+
/**
|
|
419
|
+
* Centralized data loading controller.
|
|
420
|
+
* Uses the `bundle.json` endpoint which returns info + data for multiple
|
|
421
|
+
* related images in a single request.
|
|
422
|
+
*
|
|
423
|
+
* If the bundle fails the image is simply unavailable — there are no
|
|
424
|
+
* individual `info.json` / `data.json` fallbacks.
|
|
425
|
+
*
|
|
426
|
+
* This is the single source of truth for image info & data fetches.
|
|
427
|
+
*
|
|
428
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
429
|
+
*/
|
|
430
|
+
export const DataLoader: {
|
|
431
|
+
/** Returns the info for an image ID, or undefined if not found in its bundle. */
|
|
432
|
+
getInfo(id: string): Promise<Models.ImageInfo.ImageInfo | undefined>;
|
|
433
|
+
/** Returns the data for an image ID, or undefined if not found in its bundle. */
|
|
434
|
+
getData(id: string): Promise<Models.ImageData.ImageData | undefined>;
|
|
435
|
+
/** Synchronous accessor for already-cached bundle data. */
|
|
436
|
+
getDataSync(id: string): Models.ImageData.ImageData | undefined;
|
|
437
|
+
/**
|
|
438
|
+
* Resolves the marker for a tour step from the already-loaded bundle cache.
|
|
439
|
+
* This replaces the earlier static `.marker` JSON that was inlined in stepInfo.
|
|
440
|
+
*/
|
|
441
|
+
getStepMarker(step: Models.ImageData.MarkerTourStepInfo): Models.ImageData.Marker | undefined;
|
|
442
|
+
/** Returns the space data for a space ID, or undefined if not found in its bundle. */
|
|
443
|
+
getSpaceData(id: string): Models.Spaces.Space | undefined;
|
|
444
|
+
/** Returns the organisation data from the bundle, or undefined. */
|
|
445
|
+
getOrganisation(): Models.ImageInfo.Organisation | undefined;
|
|
446
|
+
/**
|
|
447
|
+
* Returns both info + data for a single image ID, or undefined if the image
|
|
448
|
+
* is not present in its bundle.
|
|
449
|
+
*/
|
|
450
|
+
getBundleImage(id: string): Promise<{
|
|
451
|
+
data: Models.ImageData.ImageData;
|
|
452
|
+
info: Models.ImageInfo.ImageInfo;
|
|
453
|
+
} | undefined>;
|
|
454
|
+
/**
|
|
455
|
+
* Bulk variant of {@link getBundleImage}.
|
|
456
|
+
*
|
|
457
|
+
* Fetches the bundle for the first non‑IIIF ID, then resolves every requested
|
|
458
|
+
* image from the cached bundle results.
|
|
459
|
+
*/
|
|
460
|
+
getBundleImages(ids: string[]): Promise<Map<string, {
|
|
461
|
+
info: Models.ImageInfo.ImageInfo;
|
|
462
|
+
data: Models.ImageData.ImageData;
|
|
463
|
+
}>>;
|
|
464
|
+
};
|
|
519
465
|
/**
|
|
520
466
|
* # Micrio State management
|
|
521
467
|
*
|
|
@@ -1083,10 +1029,10 @@ declare module '@micrio/client' {
|
|
|
1083
1029
|
* NOTE: to modify this at runtime, use the MicrioImage.settings Writable store.
|
|
1084
1030
|
*/
|
|
1085
1031
|
settings?: Partial<ImageInfo.Settings>;
|
|
1086
|
-
/** Optional organisation data */
|
|
1087
|
-
organisation?: ImageInfo.Organisation;
|
|
1088
1032
|
/** The image title (default: autoloaded) */
|
|
1089
1033
|
title?: string;
|
|
1034
|
+
/** @deprecated Moved to `bundle.json` top-level `organisation` */
|
|
1035
|
+
organisation?: ImageInfo.Organisation;
|
|
1090
1036
|
/** The initial data language */
|
|
1091
1037
|
lang?: string;
|
|
1092
1038
|
/** The image is 360 degrees */
|
|
@@ -1147,8 +1093,6 @@ declare module '@micrio/client' {
|
|
|
1147
1093
|
};
|
|
1148
1094
|
/** Use a custom uri for the info json file */
|
|
1149
1095
|
infoUrl?: string;
|
|
1150
|
-
/** Force refresh for published data JSON file */
|
|
1151
|
-
forceDataRefresh?: boolean;
|
|
1152
1096
|
/** Render this image as a static image */
|
|
1153
1097
|
static?: boolean;
|
|
1154
1098
|
/** Use a custom thumbnail image uri */
|
|
@@ -1855,7 +1799,6 @@ declare module '@micrio/client' {
|
|
|
1855
1799
|
/** Auto generated metadata for marker tours */
|
|
1856
1800
|
type MarkerTourStepInfo = {
|
|
1857
1801
|
markerId: string;
|
|
1858
|
-
marker: Marker;
|
|
1859
1802
|
micrioId: string;
|
|
1860
1803
|
duration: number;
|
|
1861
1804
|
imageHasOtherMarkers?: boolean;
|
|
@@ -1915,6 +1858,25 @@ declare module '@micrio/client' {
|
|
|
1915
1858
|
buttons?: MenuPageButton[];
|
|
1916
1859
|
};
|
|
1917
1860
|
}
|
|
1861
|
+
/**
|
|
1862
|
+
* A bundled image response from the `bundle.json` endpoint.
|
|
1863
|
+
* Contains both info and data for one or more related images in a single response.
|
|
1864
|
+
*/
|
|
1865
|
+
namespace ImageBundle {
|
|
1866
|
+
type BundleImage = {
|
|
1867
|
+
id: string;
|
|
1868
|
+
info: Models.ImageInfo.ImageInfo;
|
|
1869
|
+
data: Models.ImageData.ImageData;
|
|
1870
|
+
};
|
|
1871
|
+
type BundleResponse = {
|
|
1872
|
+
images: BundleImage[];
|
|
1873
|
+
organisation?: ImageInfo.Organisation;
|
|
1874
|
+
spaces?: {
|
|
1875
|
+
id: string;
|
|
1876
|
+
data: Models.Spaces.Space;
|
|
1877
|
+
}[];
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1918
1880
|
namespace Assets {
|
|
1919
1881
|
type BaseAsset = {
|
|
1920
1882
|
/** The asset title (not filename) */
|
|
@@ -3222,6 +3184,68 @@ declare module '@micrio/client' {
|
|
|
3222
3184
|
setVolume(volume: number): void;
|
|
3223
3185
|
destroy(): void;
|
|
3224
3186
|
}
|
|
3187
|
+
export type PREDEFINED = [string, Models.ImageInfo.ImageInfo, Models.ImageData.ImageData | undefined];
|
|
3188
|
+
/** Enum for identifying media type. */
|
|
3189
|
+
export enum MediaType {
|
|
3190
|
+
None = 0,
|
|
3191
|
+
IFrame = 1,
|
|
3192
|
+
Video = 2,
|
|
3193
|
+
Audio = 3,
|
|
3194
|
+
VideoTour = 4,
|
|
3195
|
+
Micrio = 5
|
|
3196
|
+
}
|
|
3197
|
+
/** Enum for identifying iframe player type. */
|
|
3198
|
+
export enum FrameType {
|
|
3199
|
+
YouTube = 1,
|
|
3200
|
+
Vimeo = 2
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* Media utilities for source parsing, type detection, and player management.
|
|
3204
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
3205
|
+
*/
|
|
3206
|
+
/** YouTube no-cookies host */
|
|
3207
|
+
export const YOUTUBE_HOST = "https://www.youtube-nocookie.com";
|
|
3208
|
+
/**
|
|
3209
|
+
* Parsed media source information.
|
|
3210
|
+
*/
|
|
3211
|
+
export interface ParsedMediaSource {
|
|
3212
|
+
/** The detected media type */
|
|
3213
|
+
type: MediaType;
|
|
3214
|
+
/** The frame type for iframe embeds (YouTube/Vimeo) */
|
|
3215
|
+
frameType?: FrameType;
|
|
3216
|
+
/** The normalized/processed source URL */
|
|
3217
|
+
src?: string;
|
|
3218
|
+
/** YouTube video ID (if applicable) */
|
|
3219
|
+
youtubeId?: string;
|
|
3220
|
+
/** Vimeo video ID (if applicable) */
|
|
3221
|
+
vimeoId?: string;
|
|
3222
|
+
/** Vimeo hash token (if applicable) */
|
|
3223
|
+
vimeoToken?: string;
|
|
3224
|
+
/** Cloudflare video ID (if applicable) */
|
|
3225
|
+
cloudflareId?: string;
|
|
3226
|
+
/** Micrio embed data [id, width?, height?, lang?] */
|
|
3227
|
+
micrioEmbed?: string[];
|
|
3228
|
+
/** Start time extracted from URL (seconds) */
|
|
3229
|
+
startTime?: number;
|
|
3230
|
+
/** Whether the source is a Cloudflare stream */
|
|
3231
|
+
isCloudflare: boolean;
|
|
3232
|
+
/** M3U8 URL for HLS streams */
|
|
3233
|
+
hlsSrc?: string;
|
|
3234
|
+
}
|
|
3235
|
+
/**
|
|
3236
|
+
* Parses a media source URL and determines its type and configuration.
|
|
3237
|
+
*/
|
|
3238
|
+
export function parseMediaSource(src: string | undefined, tour: Models.ImageData.VideoTour | null, useNativeFrames?: boolean, currentTime?: number): ParsedMediaSource;
|
|
3239
|
+
/**
|
|
3240
|
+
* Checks if the browser natively supports HLS playback.
|
|
3241
|
+
*/
|
|
3242
|
+
export function hasNativeHLS(el?: HTMLMediaElement): boolean;
|
|
3243
|
+
/**
|
|
3244
|
+
* Returns a shared Audio element instance for iOS.
|
|
3245
|
+
* This is a workaround for iOS audio playback restrictions where user
|
|
3246
|
+
* interaction is required per audio element.
|
|
3247
|
+
*/
|
|
3248
|
+
export function getIOSAudioElement(): HTMLAudioElement;
|
|
3225
3249
|
/**
|
|
3226
3250
|
* Adapter for YouTube IFrame Player API.
|
|
3227
3251
|
*/
|
|
@@ -3295,6 +3319,21 @@ declare module '@micrio/client' {
|
|
|
3295
3319
|
export { archive } from "ts/render/archive";
|
|
3296
3320
|
export { loadTexture, runningThreads, numThreads, abortDownload } from "ts/render/textures";
|
|
3297
3321
|
export type { TextureBitmap } from "ts/render/textures";
|
|
3322
|
+
/**
|
|
3323
|
+
* Marker clustering algorithm for calculating overlapping markers
|
|
3324
|
+
* and generating cluster marker objects.
|
|
3325
|
+
* @author Marcel Duin <marcel@micr.io>
|
|
3326
|
+
*/
|
|
3327
|
+
type MarkerData = Models.ImageData.Marker;
|
|
3328
|
+
export type MarkerCoords = [x: number, y: number, w?: number, h?: number];
|
|
3329
|
+
export interface ClusterResult {
|
|
3330
|
+
overlapped: number[];
|
|
3331
|
+
clusterMarkers: MarkerData[];
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* Calculates which markers overlap and generates synthetic cluster markers.
|
|
3335
|
+
*/
|
|
3336
|
+
export function calcClusters(visibleMarkers: MarkerData[] | undefined, coords: Map<string, MarkerCoords>, r: number, isOmni: boolean): ClusterResult;
|
|
3298
3337
|
}declare module "svelte/store" {
|
|
3299
3338
|
/** Callback to inform of a value updates.
|
|
3300
3339
|
*/
|