@micrio/client 6.1.3 → 6.1.4

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
@@ -12,10 +12,23 @@ 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
+ /**
16
+ * Mathematical utility functions.
17
+ * @author Marcel Duin <marcel@micr.io>
18
+ */
15
19
  /**
16
20
  * Calculates the positive modulo (floored division remainder).
17
21
  */
18
22
  export const mod: (n: number, m?: number) => number;
23
+ /**
24
+ * Converts a Camera.View tuple `[x, y, w, h]` to a center-based JSON object.
25
+ */
26
+ export const toCenterJSON: (v: Models.Camera.View) => {
27
+ centerX: number;
28
+ centerY: number;
29
+ width: number;
30
+ height: number;
31
+ };
19
32
  /**
20
33
  * Defines various enums used throughout the Micrio application,
21
34
  * primarily for standardizing action types and option values.
@@ -402,12 +415,6 @@ declare module '@micrio/client' {
402
415
  */
403
416
  animateTo(idx: number): void;
404
417
  }
405
- /**
406
- * Converts seconds into a human-readable time string (hh?:mm:ss).
407
- * @param s Time in seconds. Can be negative for remaining time display.
408
- * @returns Formatted time string (e.g., "1:23", "1:05:09", "-0:15").
409
- */
410
- export function parseTime(s: number): string;
411
418
  /**
412
419
  * Centralized data loading controller.
413
420
  * Uses the `bundle.json` endpoint which returns info + data for multiple
@@ -600,36 +607,6 @@ declare module '@micrio/client' {
600
607
  /** Fades out the image smoothly or instantly. */
601
608
  fadeOut(direct?: boolean): void;
602
609
  }
603
- /**
604
- * Direction-keyed area rectangles for grid/gallery slide and swipe transitions.
605
- * Areas use [x0, y0, x1, y1] in normalized parent-canvas coordinates and
606
- * extend outside [0,1] to represent off-screen positions.
607
- *
608
- * Direction conventions (degrees of motion of the entering image):
609
- * 0 = enters from top
610
- * 90 = enters from right
611
- * 180 = enters from bottom
612
- * 270 = enters from left
613
- *
614
- * @author Marcel Duin <marcel@micr.io>
615
- */
616
- /** Slide transition entry areas (entering image starts half-off-screen). */
617
- export const slideAreas: Record<number, Models.Camera.ViewRect>;
618
- /** Swipe transition entry areas (entering image starts fully off-screen). */
619
- export const swipeAreas: Record<number, Models.Camera.ViewRect>;
620
- /** Swipe transition exit areas (leaving image moves fully off-screen). */
621
- export const swipeExitAreas: Record<number, Models.Camera.ViewRect>;
622
- /** Centered visible slot. */
623
- export const centerArea: Models.Camera.ViewRect;
624
- /** Off-screen slot to the left, same height. */
625
- export const leftSlot: Models.Camera.ViewRect;
626
- /** Off-screen slot to the right, same height. */
627
- export const rightSlot: Models.Camera.ViewRect;
628
- /**
629
- * Returns the horizontal slot area for an integer offset from the active slot.
630
- * offset=0 → centered visible; positive → off to the right; negative → off to the left.
631
- */
632
- export const horizontalSlot: (offset: number) => Models.Camera.ViewRect;
633
610
  /**
634
611
  * Micrio grid display controller
635
612
  * @author Marcel Duin <marcel@micr.io>
@@ -2466,101 +2443,6 @@ declare module '@micrio/client' {
2466
2443
  /** Has touch support */
2467
2444
  hasTouch: boolean;
2468
2445
  }
2469
- /**
2470
- * List of internal Micrio event types that should trigger a debounced 'update' event.
2471
- * The 'update' event signals that the overall state relevant for external integrations might have changed.
2472
- * @readonly
2473
- */
2474
- export const UpdateEvents: (keyof Models.MicrioEventMap)[];
2475
- /**
2476
- * Update event handler module.
2477
- * Manages debounced 'update' event dispatching when internal state changes.
2478
- */
2479
- export class UpdateHandler {
2480
- private ctx;
2481
- constructor(ctx: EventContext);
2482
- /** Hooks listeners for events that should trigger a debounced 'update' event. */
2483
- hook(): void;
2484
- /** Unhooks listeners for the debounced 'update' event. */
2485
- unhook(): void;
2486
- /**
2487
- * Event listener callback that queues the event type and triggers the debounced dispatch.
2488
- * @param e The Event object.
2489
- */
2490
- private handleEvent;
2491
- /**
2492
- * Dispatches the 'update' event with the accumulated event types and current state.
2493
- * Clears the event stack.
2494
- */
2495
- private dispatch;
2496
- }
2497
- export { UpdateEvents } from "ts/events/update";
2498
- /**
2499
- * Handles user input events (mouse, touch, keyboard, wheel, gestures) for the Micrio viewer.
2500
- * Translates browser events into camera movements (pan, zoom), dispatches custom Micrio events,
2501
- * and manages interaction states like panning, pinching, and enabled/disabled states.
2502
- * Accessed via `micrio.events`.
2503
- * @author Marcel Duin <marcel@micr.io>
2504
- */
2505
- export class Events implements EventContext {
2506
- /** Writable Svelte store indicating if event handling is currently enabled. Set to false during tours or animations. */
2507
- enabled: Writable<boolean>;
2508
- /** Getter for the current value of the {@link enabled} store. */
2509
- get $enabled(): boolean;
2510
- /** Current pinch zoom factor relative to the start of the pinch. Undefined when not pinching. */
2511
- pinchFactor: number | undefined;
2512
- private dragHandler;
2513
- private pinchHandler;
2514
- private pointerPinchHandler;
2515
- private gestureHandler;
2516
- private wheelHandler;
2517
- private keyboardHandler;
2518
- private doubleTapHandler;
2519
- private updateHandler;
2520
- isEnabled(): boolean;
2521
- isPanning(): boolean;
2522
- isPinching(): boolean;
2523
- setPanning(value: boolean): void;
2524
- setPinching(value: boolean): void;
2525
- isWheeling(): boolean;
2526
- setWheeling(value: boolean): void;
2527
- isControlZoom(): boolean;
2528
- isTwoFingerPan(): boolean;
2529
- getVisible(): MicrioImage[] | undefined;
2530
- setCapturedPointerId(id: number | undefined): void;
2531
- setPinchFactor(value: number | undefined): void;
2532
- setPScale(value: number): void;
2533
- setHasUsedCtrl(value: boolean): void;
2534
- /**
2535
- * Checks if the user is currently interacting with the map via panning, pinching, or wheeling.
2536
- * @returns True if the user is actively navigating.
2537
- */
2538
- get isNavigating(): boolean;
2539
- /** Hooks all necessary event listeners based on current settings. */
2540
- hook(): void;
2541
- /** Unhooks all attached event listeners. */
2542
- unhook(): void;
2543
- /** Hooks keyboard event listeners. */
2544
- hookKeys(): void;
2545
- /** Unhooks keyboard event listeners. */
2546
- unhookKeys(): void;
2547
- /** Hooks zoom-related event listeners (pinch, scroll, double-tap/click). */
2548
- hookZoom(): void;
2549
- /** Unhooks zoom-related event listeners. */
2550
- unhookZoom(): void;
2551
- /** Hooks mouse wheel/scroll event listeners. */
2552
- hookScroll(): void;
2553
- /** Unhooks mouse wheel/scroll event listeners. */
2554
- unhookScroll(): void;
2555
- /** Hooks touch pinch and macOS gesture event listeners. */
2556
- hookPinch(): void;
2557
- /** Unhooks touch pinch and macOS gesture event listeners. */
2558
- unhookPinch(): void;
2559
- /** Hooks pointer down/move/up listeners for drag panning. */
2560
- hookDrag(): void;
2561
- /** Unhooks pointer listeners for drag panning. */
2562
- unhookDrag(): void;
2563
- }
2564
2446
  /**
2565
2447
  * Drag/pan event handler module.
2566
2448
  * Handles pointer down/move/up events for panning the image.
@@ -2750,16 +2632,100 @@ declare module '@micrio/client' {
2750
2632
  */
2751
2633
  private click;
2752
2634
  }
2753
- export { Events } from "ts/events/facade";
2754
- export { DragHandler } from "ts/events/drag";
2755
- export { PinchHandler } from "ts/events/pinch";
2756
- export { PointerPinchHandler } from "ts/events/pointer-pinch";
2757
- export { GestureHandler } from "ts/events/gesture";
2758
- export { WheelHandler } from "ts/events/wheel";
2759
- export { KeyboardHandler } from "ts/events/keyboard";
2760
- export { DoubleTapHandler } from "ts/events/doubletap";
2761
- export { UpdateHandler } from "ts/events/update";
2762
- export { type AllEvents, type EventStateVars, type EventContext, eventPassive, eventPassiveCapture, noEventPassive, cancelPrevent, } from "ts/events/shared";
2635
+ /**
2636
+ * List of internal Micrio event types that should trigger a debounced 'update' event.
2637
+ * The 'update' event signals that the overall state relevant for external integrations might have changed.
2638
+ * @readonly
2639
+ */
2640
+ export const UpdateEvents: (keyof Models.MicrioEventMap)[];
2641
+ /**
2642
+ * Update event handler module.
2643
+ * Manages debounced 'update' event dispatching when internal state changes.
2644
+ */
2645
+ export class UpdateHandler {
2646
+ private ctx;
2647
+ constructor(ctx: EventContext);
2648
+ /** Hooks listeners for events that should trigger a debounced 'update' event. */
2649
+ hook(): void;
2650
+ /** Unhooks listeners for the debounced 'update' event. */
2651
+ unhook(): void;
2652
+ /**
2653
+ * Event listener callback that queues the event type and triggers the debounced dispatch.
2654
+ * @param e The Event object.
2655
+ */
2656
+ private handleEvent;
2657
+ /**
2658
+ * Dispatches the 'update' event with the accumulated event types and current state.
2659
+ * Clears the event stack.
2660
+ */
2661
+ private dispatch;
2662
+ }
2663
+ /**
2664
+ * Handles user input events (mouse, touch, keyboard, wheel, gestures) for the Micrio viewer.
2665
+ * Translates browser events into camera movements (pan, zoom), dispatches custom Micrio events,
2666
+ * and manages interaction states like panning, pinching, and enabled/disabled states.
2667
+ * Accessed via `micrio.events`.
2668
+ * @author Marcel Duin <marcel@micr.io>
2669
+ */
2670
+ export class Events implements EventContext {
2671
+ /** Writable Svelte store indicating if event handling is currently enabled. Set to false during tours or animations. */
2672
+ enabled: Writable<boolean>;
2673
+ /** Getter for the current value of the {@link enabled} store. */
2674
+ get $enabled(): boolean;
2675
+ /** Current pinch zoom factor relative to the start of the pinch. Undefined when not pinching. */
2676
+ pinchFactor: number | undefined;
2677
+ private dragHandler;
2678
+ private pinchHandler;
2679
+ private pointerPinchHandler;
2680
+ private gestureHandler;
2681
+ private wheelHandler;
2682
+ private keyboardHandler;
2683
+ private doubleTapHandler;
2684
+ private updateHandler;
2685
+ isEnabled(): boolean;
2686
+ isPanning(): boolean;
2687
+ isPinching(): boolean;
2688
+ setPanning(value: boolean): void;
2689
+ setPinching(value: boolean): void;
2690
+ isWheeling(): boolean;
2691
+ setWheeling(value: boolean): void;
2692
+ isControlZoom(): boolean;
2693
+ isTwoFingerPan(): boolean;
2694
+ getVisible(): MicrioImage[] | undefined;
2695
+ setCapturedPointerId(id: number | undefined): void;
2696
+ setPinchFactor(value: number | undefined): void;
2697
+ setPScale(value: number): void;
2698
+ setHasUsedCtrl(value: boolean): void;
2699
+ /**
2700
+ * Checks if the user is currently interacting with the map via panning, pinching, or wheeling.
2701
+ * @returns True if the user is actively navigating.
2702
+ */
2703
+ get isNavigating(): boolean;
2704
+ /** Hooks all necessary event listeners based on current settings. */
2705
+ hook(): void;
2706
+ /** Unhooks all attached event listeners. */
2707
+ unhook(): void;
2708
+ /** Hooks keyboard event listeners. */
2709
+ hookKeys(): void;
2710
+ /** Unhooks keyboard event listeners. */
2711
+ unhookKeys(): void;
2712
+ /** Hooks zoom-related event listeners (pinch, scroll, double-tap/click). */
2713
+ hookZoom(): void;
2714
+ /** Unhooks zoom-related event listeners. */
2715
+ unhookZoom(): void;
2716
+ /** Hooks mouse wheel/scroll event listeners. */
2717
+ hookScroll(): void;
2718
+ /** Unhooks mouse wheel/scroll event listeners. */
2719
+ unhookScroll(): void;
2720
+ /** Hooks touch pinch and macOS gesture event listeners. */
2721
+ hookPinch(): void;
2722
+ /** Unhooks touch pinch and macOS gesture event listeners. */
2723
+ unhookPinch(): void;
2724
+ /** Hooks pointer down/move/up listeners for drag panning. */
2725
+ hookDrag(): void;
2726
+ /** Unhooks pointer listeners for drag panning. */
2727
+ unhookDrag(): void;
2728
+ }
2763
2729
  /**
2764
2730
  * Language-related constants and utilities.
2765
2731
  */
@@ -2960,8 +2926,6 @@ declare module '@micrio/client' {
2960
2926
  */
2961
2927
  constructor(micrio: HTMLMicrioElement);
2962
2928
  }
2963
- export { i18n, langs } from "ts/i18n/strings";
2964
- export { locale, languageNames, rtlLanguageCodes } from "ts/i18n/locale";
2965
2929
  /**
2966
2930
  * Manages the loading, playback, and WebGL integration of embedded videos
2967
2931
  * that are rendered directly onto the Micrio canvas texture (not as HTML elements).
@@ -3098,80 +3062,21 @@ declare module '@micrio/client' {
3098
3062
  setVolume(volume: number): void;
3099
3063
  destroy(): void;
3100
3064
  }
3101
- export type PREDEFINED = [string, Models.ImageInfo.ImageInfo, Models.ImageData.ImageData | undefined];
3102
- /** Enum for identifying media type. */
3103
- export enum MediaType {
3104
- None = 0,
3105
- IFrame = 1,
3106
- Video = 2,
3107
- Audio = 3,
3108
- VideoTour = 4,
3109
- Micrio = 5
3110
- }
3111
- /** Enum for identifying iframe player type. */
3112
- export enum FrameType {
3113
- YouTube = 1,
3114
- Vimeo = 2
3115
- }
3116
- /**
3117
- * Media utilities for source parsing, type detection, and player management.
3118
- * @author Marcel Duin <marcel@micr.io>
3119
- */
3120
- /** YouTube no-cookies host */
3121
- export const YOUTUBE_HOST = "https://www.youtube-nocookie.com";
3122
- /**
3123
- * Parsed media source information.
3124
- */
3125
- interface ParsedMediaSource {
3126
- /** The detected media type */
3127
- type: MediaType;
3128
- /** The frame type for iframe embeds (YouTube/Vimeo) */
3129
- frameType?: FrameType;
3130
- /** The normalized/processed source URL */
3131
- src?: string;
3132
- /** YouTube video ID (if applicable) */
3133
- youtubeId?: string;
3134
- /** Vimeo video ID (if applicable) */
3135
- vimeoId?: string;
3136
- /** Vimeo hash token (if applicable) */
3137
- vimeoToken?: string;
3138
- /** Cloudflare video ID (if applicable) */
3139
- cloudflareId?: string;
3140
- /** Micrio embed data [id, width?, height?, lang?] */
3141
- micrioEmbed?: string[];
3142
- /** Start time extracted from URL (seconds) */
3143
- startTime?: number;
3144
- /** Whether the source is a Cloudflare stream */
3145
- isCloudflare: boolean;
3146
- /** M3U8 URL for HLS streams */
3147
- hlsSrc?: string;
3148
- }
3149
- /**
3150
- * Parses a media source URL and determines its type and configuration.
3151
- */
3152
- export function parseMediaSource(src: string | undefined, tour: Models.ImageData.VideoTour | null, useNativeFrames?: boolean, currentTime?: number): ParsedMediaSource;
3153
3065
  /**
3154
- * Returns a shared Audio element instance for iOS.
3155
- * This is a workaround for iOS audio playback restrictions where user
3156
- * interaction is required per audio element.
3157
- */
3158
- export function getIOSAudioElement(): HTMLAudioElement;
3159
- /**
3160
- * Adapter for YouTube IFrame Player API.
3066
+ * Adapter for Vimeo Player API.
3161
3067
  */
3162
- export class YouTubePlayerAdapter implements MediaPlayerAdapter {
3068
+ export class VimeoPlayerAdapter implements MediaPlayerAdapter {
3163
3069
  private frame;
3164
3070
  private config;
3165
3071
  private callbacks;
3166
- readonly requiresTimeTick = true;
3072
+ readonly requiresTimeTick = false;
3167
3073
  private player;
3168
3074
  private destroyed;
3169
3075
  constructor(frame: HTMLIFrameElement, config: PlayerConfig, callbacks?: PlayerEventCallbacks);
3170
3076
  /**
3171
- * Loads the YouTube API and initializes the player.
3077
+ * Loads the Vimeo API and initializes the player.
3172
3078
  */
3173
3079
  initialize(): Promise<void>;
3174
- private handleStateChange;
3175
3080
  play(): Promise<void>;
3176
3081
  pause(): void;
3177
3082
  getCurrentTime(): Promise<number>;
@@ -3179,24 +3084,25 @@ declare module '@micrio/client' {
3179
3084
  getDuration(): Promise<number>;
3180
3085
  isPaused(): Promise<boolean>;
3181
3086
  setMuted(muted: boolean): void;
3182
- setVolume(_volume: number): void;
3087
+ setVolume(volume: number): void;
3183
3088
  destroy(): void;
3184
3089
  }
3185
3090
  /**
3186
- * Adapter for Vimeo Player API.
3091
+ * Adapter for YouTube IFrame Player API.
3187
3092
  */
3188
- export class VimeoPlayerAdapter implements MediaPlayerAdapter {
3093
+ export class YouTubePlayerAdapter implements MediaPlayerAdapter {
3189
3094
  private frame;
3190
3095
  private config;
3191
3096
  private callbacks;
3192
- readonly requiresTimeTick = false;
3097
+ readonly requiresTimeTick = true;
3193
3098
  private player;
3194
3099
  private destroyed;
3195
3100
  constructor(frame: HTMLIFrameElement, config: PlayerConfig, callbacks?: PlayerEventCallbacks);
3196
3101
  /**
3197
- * Loads the Vimeo API and initializes the player.
3102
+ * Loads the YouTube API and initializes the player.
3198
3103
  */
3199
3104
  initialize(): Promise<void>;
3105
+ private handleStateChange;
3200
3106
  play(): Promise<void>;
3201
3107
  pause(): void;
3202
3108
  getCurrentTime(): Promise<number>;
@@ -3204,45 +3110,24 @@ declare module '@micrio/client' {
3204
3110
  getDuration(): Promise<number>;
3205
3111
  isPaused(): Promise<boolean>;
3206
3112
  setMuted(muted: boolean): void;
3207
- setVolume(volume: number): void;
3113
+ setVolume(_volume: number): void;
3208
3114
  destroy(): void;
3209
3115
  }
3210
- /**
3211
- * Media player adapters module.
3212
- * Provides unified interfaces for different media player types.
3213
- * @author Marcel Duin <marcel@micr.io>
3214
- */
3215
- export type { MediaPlayerAdapter, PlayerEventCallbacks, PlayerConfig } from "ts/media/types";
3216
- export { HTML5PlayerAdapter } from "ts/media/html5-adapter";
3217
- export { YouTubePlayerAdapter } from "ts/media/youtube-adapter";
3218
- export { VimeoPlayerAdapter } from "ts/media/vimeo-adapter";
3219
- export { HLSPlayerAdapter } from "ts/media/hls-adapter";
3220
- export { GLEmbedVideo } from "ts/media/embedvideo";
3221
- export { VideoTourInstance } from "ts/media/videotour";
3222
- export { Grid } from "ts/nav/grid";
3223
- export { GallerySwiper } from "ts/nav/swiper";
3224
- export { Engine } from "ts/render/engine";
3225
- export { WebGL } from "ts/render/webgl";
3226
- export { Canvas } from "ts/render/canvas";
3227
- export { PostProcessor } from "ts/render/postprocess";
3228
- export { archive } from "ts/render/archive";
3229
- export { loadTexture, runningThreads, numThreads, abortDownload } from "ts/render/textures";
3230
- export type { TextureBitmap } from "ts/render/textures";
3231
- /**
3232
- * Marker clustering algorithm for calculating overlapping markers
3233
- * and generating cluster marker objects.
3234
- * @author Marcel Duin <marcel@micr.io>
3235
- */
3236
- type MarkerData = Models.ImageData.Marker;
3237
- export type MarkerCoords = [x: number, y: number, w?: number, h?: number];
3238
- interface ClusterResult {
3239
- overlapped: number[];
3240
- clusterMarkers: MarkerData[];
3116
+ export type PREDEFINED = [string, Models.ImageInfo.ImageInfo, Models.ImageData.ImageData | undefined];
3117
+ /** Enum for identifying media type. */
3118
+ export enum MediaType {
3119
+ None = 0,
3120
+ IFrame = 1,
3121
+ Video = 2,
3122
+ Audio = 3,
3123
+ VideoTour = 4,
3124
+ Micrio = 5
3125
+ }
3126
+ /** Enum for identifying iframe player type. */
3127
+ export enum FrameType {
3128
+ YouTube = 1,
3129
+ Vimeo = 2
3241
3130
  }
3242
- /**
3243
- * Calculates which markers overlap and generates synthetic cluster markers.
3244
- */
3245
- export function calcClusters(visibleMarkers: MarkerData[] | undefined, coords: Map<string, MarkerCoords>, r: number, isOmni: boolean): ClusterResult;
3246
3131
  }declare module "svelte/store" {
3247
3132
  /** Callback to inform of a value updates.
3248
3133
  */