@car-cutter/wc-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,6 +1,6 @@
1
1
  declare type AspectRatio = `${number}:${number}`;
2
2
 
3
- declare type CamelToKebab<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Lowercase<T> ? "" : "-"}${Lowercase<T>}${CamelToKebab<U>}` : S;
3
+ declare type CamelToDashed<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Lowercase<T> ? "" : "-"}${Lowercase<T>}${CamelToDashed<U>}` : S;
4
4
 
5
5
  declare type Category = {
6
6
  id: string;
@@ -15,12 +15,12 @@ export declare function checkCustomElementsDefinition(): boolean;
15
15
 
16
16
  export declare type Composition = {
17
17
  aspectRatio: AspectRatio;
18
- imageHdWidth: ImageWidth;
19
- imageSubWidths: ImageWidth[];
18
+ imageHdWidth: MediaWidth;
19
+ imageSubWidths: MediaWidth[];
20
20
  categories: Category[];
21
21
  };
22
22
 
23
- export declare const DEFAULT_EVENT_PREFIX: string = "cc-webplayer:";
23
+ export declare const DEFAULT_EVENT_PREFIX = "cc-webplayer:" satisfies string;
24
24
 
25
25
  /**
26
26
  * Defines WebPlayer's custom elements in the DOM.
@@ -51,6 +51,8 @@ export declare const EVENT_HOTSPOTS_OFF = "hotspots-off";
51
51
 
52
52
  export declare const EVENT_HOTSPOTS_ON = "hotspots-on";
53
53
 
54
+ export declare const EVENT_ITEM_CHANGE = "item-change";
55
+
54
56
  /**
55
57
  * Generates a URL for fetching the composition JSON for a given customer and vehicle.
56
58
  *
@@ -81,76 +83,79 @@ declare type Hotspot = {
81
83
 
82
84
  declare type ImageItem = { type: "image" } & ImageWithHotspots;
83
85
 
84
- declare type ImageLoadStrategy = "quality" | "speed";
85
-
86
- declare type ImageLoadStrategy_2 = "quality" | "speed";
87
-
88
- declare type ImageWidth = number;
89
-
90
86
  declare type ImageWithHotspots = {
91
87
  src: string;
92
88
  hotspots?: Hotspot[];
93
89
  };
94
90
 
95
- declare type Item = ImageItem | VideoItem | ThreeSixtyItem;
91
+ export declare type Item = ImageItem | VideoItem | ThreeSixtyItem;
92
+
93
+ export declare type MediaLoadStrategy = "quality" | "balanced" | "speed";
94
+
95
+ declare type MediaLoadStrategy_2 = "quality" | "balanced" | "speed";
96
+
97
+ declare type MediaWidth = number;
98
+
99
+ declare type MediaWidth_2 = number;
100
+
101
+ declare type PropsToAttributes<T> = {
102
+ [K in keyof T as CamelToDashed<string & K>]: ToStringOrOptional<T[K]>;
103
+ };
96
104
 
97
105
  declare type ThreeSixtyItem = {
98
106
  type: "360";
99
107
  images: ImageWithHotspots[];
100
108
  };
101
109
 
110
+ declare type ToStringOrOptional<T> = T extends undefined ? string | undefined : string;
111
+
102
112
  declare type VideoItem = {
103
113
  type: "video";
104
114
  src: string;
105
- poster: string;
115
+ poster?: string;
106
116
  };
107
117
 
118
+ export declare const WEB_PLAYER_CUSTOM_MEDIA_WC_TAG = "cc-webplayer-custom-media";
119
+
108
120
  export declare const WEB_PLAYER_ICON_WC_TAG = "cc-webplayer-icon";
109
121
 
110
122
  export declare const WEB_PLAYER_WC_TAG = "cc-webplayer";
111
123
 
112
- export declare type WebPlayerAttributes = Record<CamelToKebab<keyof WebPlayerProps_2>, string>;
124
+ export declare type WebPlayerAttributes = PropsToAttributes<WebPlayerProps>;
113
125
 
114
- export declare type WebPlayerIconAttributes = Record<CamelToKebab<keyof WebPlayerIconProps_2>, string>;
126
+ export declare type WebPlayerCustomMediaAttributes = PropsToAttributes<WebPlayerCustomMediaProps>;
115
127
 
116
- export declare type WebPlayerIconProps = {
117
- name: string;
118
- color?: string;
128
+ declare type WebPlayerCustomMediaProps = {
129
+ index: number;
130
+ thumbnailSrc?: string;
119
131
  };
120
132
 
121
- declare type WebPlayerIconProps_2 = {
122
- name: string;
123
- color?: string;
124
- };
133
+ export declare const webPlayerCustomMediaPropsToAttributes: (props: WebPlayerCustomMediaProps) => WebPlayerCustomMediaAttributes;
125
134
 
126
- export declare const webPlayerIconPropsToAttributes: (props: WebPlayerIconProps_2) => WebPlayerIconAttributes;
135
+ export declare type WebPlayerIconAttributes = PropsToAttributes<WebPlayerIconProps>;
127
136
 
128
- export declare type WebPlayerProps = {
129
- compositionUrl: string;
130
- hideCategories?: boolean;
131
- infiniteCarrousel?: boolean;
132
- permanentGallery?: boolean;
133
- imageLoadStrategy?: ImageLoadStrategy;
134
- minImageWidth?: number;
135
- maxImageWidth?: number;
136
- preventFullScreen?: boolean;
137
- eventPrefix?: string;
138
- reverse360?: boolean;
137
+ 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 & {});
138
+
139
+ declare type WebPlayerIconProps = {
140
+ name: WebPlayerIconName;
139
141
  };
140
142
 
141
- declare type WebPlayerProps_2 = {
143
+ export declare const webPlayerIconPropsToAttributes: (props: WebPlayerIconProps) => WebPlayerIconAttributes;
144
+
145
+ declare type WebPlayerProps = {
142
146
  compositionUrl: string;
143
147
  hideCategories?: boolean;
144
148
  infiniteCarrousel?: boolean;
145
149
  permanentGallery?: boolean;
146
- imageLoadStrategy?: ImageLoadStrategy_2;
147
- minImageWidth?: number;
148
- maxImageWidth?: number;
150
+ mediaLoadStrategy?: MediaLoadStrategy_2;
151
+ minMediaWidth?: MediaWidth_2;
152
+ maxMediaWidth?: MediaWidth_2;
153
+ preloadRange?: number;
149
154
  preventFullScreen?: boolean;
150
155
  eventPrefix?: string;
151
156
  reverse360?: boolean;
152
157
  };
153
158
 
154
- export declare const webPlayerPropsToAttributes: (props: WebPlayerProps_2) => WebPlayerAttributes;
159
+ export declare const webPlayerPropsToAttributes: (props: WebPlayerProps) => WebPlayerAttributes;
155
160
 
156
161
  export { }