@car-cutter/react-webplayer 0.6.1 → 0.8.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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
+ import { PropsWithChildren } from 'react';
2
3
 
3
4
  declare type AspectRatio = `${number}:${number}`;
4
5
 
@@ -10,12 +11,12 @@ declare type Category = {
10
11
 
11
12
  export declare type Composition = {
12
13
  aspectRatio: AspectRatio;
13
- imageHdWidth: ImageWidth;
14
- imageSubWidths: ImageWidth[];
14
+ imageHdWidth: MediaWidth_2;
15
+ imageSubWidths: MediaWidth_2[];
15
16
  categories: Category[];
16
17
  };
17
18
 
18
- export declare const DEFAULT_EVENT_PREFIX: string = "cc-webplayer:";
19
+ export declare const DEFAULT_EVENT_PREFIX = "cc-webplayer:" satisfies string;
19
20
 
20
21
  export declare const EVENT_COMPOSITION_LOAD_ERROR = "composition-load-error";
21
22
 
@@ -35,6 +36,8 @@ export declare const EVENT_HOTSPOTS_OFF = "hotspots-off";
35
36
 
36
37
  export declare const EVENT_HOTSPOTS_ON = "hotspots-on";
37
38
 
39
+ export declare const EVENT_ITEM_CHANGE = "item-change";
40
+
38
41
  /**
39
42
  * Generates a URL for fetching the composition JSON for a given customer and vehicle.
40
43
  *
@@ -65,16 +68,20 @@ declare type Hotspot = {
65
68
 
66
69
  declare type ImageItem = { type: "image" } & ImageWithHotspots;
67
70
 
68
- declare type ImageLoadStrategy = "quality" | "speed";
69
-
70
- declare type ImageWidth = number;
71
-
72
71
  declare type ImageWithHotspots = {
73
72
  src: string;
74
73
  hotspots?: Hotspot[];
75
74
  };
76
75
 
77
- declare type Item = ImageItem | VideoItem | ThreeSixtyItem;
76
+ export declare type Item = ImageItem | VideoItem | ThreeSixtyItem;
77
+
78
+ export declare type MediaLoadStrategy = "quality" | "balanced" | "speed";
79
+
80
+ declare type MediaLoadStrategy_2 = "quality" | "balanced" | "speed";
81
+
82
+ declare type MediaWidth = number;
83
+
84
+ declare type MediaWidth_2 = number;
78
85
 
79
86
  declare type ThreeSixtyItem = {
80
87
  type: "360";
@@ -84,7 +91,7 @@ declare type ThreeSixtyItem = {
84
91
  declare type VideoItem = {
85
92
  type: "video";
86
93
  src: string;
87
- poster: string;
94
+ poster?: string;
88
95
  };
89
96
 
90
97
  export declare const WEB_PLAYER_ICON_WC_TAG = "cc-webplayer-icon";
@@ -93,33 +100,46 @@ export declare const WEB_PLAYER_WC_TAG = "cc-webplayer";
93
100
 
94
101
  export declare const WebPlayer: FC<WebPlayerProps>;
95
102
 
96
- export declare const WebPlayerIcon: FC<WebPlayerIconProps>;
103
+ export declare const WebPlayerCustomMedia: FC<PropsWithChildren<WebPlayerCustomMediaProps>>;
104
+
105
+ export declare type WebPlayerCustomMediaProps = {
106
+ index: number;
107
+ thumbnailSrc?: string;
108
+ };
109
+
110
+ export declare const WebPlayerIcon: FC<PropsWithChildren<WebPlayerIconProps>>;
111
+
112
+ declare type WebPlayerIconName = "UI_ARROW_RIGHT" | "UI_BURGER" | "UI_CLOSE" | "UI_EXTEND" | "UI_GALLERY" | "UI_HOTSPOTS" | "UI_IMAGE" | "UI_MINUS" | "UI_PAUSE" | "UI_PLAY" | "UI_PLUS" | "UI_REDUCE" | "UI_360" | "UI_VOLUME" | "UI_VOLUME_OFF" | "CONTROLS_PREV" | "CONTROLS_NEXT" | (string & {});
97
113
 
98
114
  export declare type WebPlayerIconProps = {
99
- name: string;
100
- color?: string;
115
+ name: WebPlayerIconName;
101
116
  };
102
117
 
103
- export declare type WebPlayerProps = WebPlayerProps_2 & {
118
+ export declare type WebPlayerProps = PropsWithChildren<WebPlayerProps_2> & {
104
119
  onCompositionLoading?: (url: string) => void;
105
120
  onCompositionLoaded?: (composition: Composition) => void;
106
121
  onCompositionLoadError?: (error: unknown) => void;
122
+ onItemChange?: (props: {
123
+ index: number;
124
+ item: Item;
125
+ }) => void;
107
126
  onExtendModeOn?: () => void;
108
127
  onExtendModeOff?: () => void;
109
128
  onHotspotsOn?: () => void;
110
129
  onHotspotsOff?: () => void;
111
130
  onGalleryOpen?: () => void;
112
131
  onGalleryClose?: () => void;
113
- };
132
+ } & Pick<React.HTMLAttributes<HTMLElement>, "className" | "style">;
114
133
 
115
134
  declare type WebPlayerProps_2 = {
116
135
  compositionUrl: string;
117
136
  hideCategories?: boolean;
118
137
  infiniteCarrousel?: boolean;
119
138
  permanentGallery?: boolean;
120
- imageLoadStrategy?: ImageLoadStrategy;
121
- minImageWidth?: number;
122
- maxImageWidth?: number;
139
+ mediaLoadStrategy?: MediaLoadStrategy_2;
140
+ minMediaWidth?: MediaWidth;
141
+ maxMediaWidth?: MediaWidth;
142
+ preloadRange?: number;
123
143
  preventFullScreen?: boolean;
124
144
  eventPrefix?: string;
125
145
  reverse360?: boolean;