@empathyco/x-components 10.4.0 → 10.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"base-teleport.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../src/components/base-teleport.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;;IAe/B,6EAA6E;;cAEjD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;IAGtD;;;;;;;OAOG;;cAEe,QAAQ,CACtB,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACtE;;;IAGH,2DAA2D;;;;;IAK3D,kDAAkD;eAC7B,QAAQ,CAAC,MAAM,GAAG,mBAAmB,CAAC;;;;IAzB3D,6EAA6E;;cAEjD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;IAGtD;;;;;;;OAOG;;cAEe,QAAQ,CACtB,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACtE;;;IAGH,2DAA2D;;;;;IAK3D,kDAAkD;eAC7B,QAAQ,CAAC,MAAM,GAAG,mBAAmB,CAAC;;;;;AA5B/D,wBAuJE"}
1
+ {"version":3,"file":"base-teleport.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../src/components/base-teleport.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;;IAe/B,6EAA6E;;cAEjD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;IAGtD;;;;;;;OAOG;;cAEe,QAAQ,CACtB,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACtE;;;IAGH,2DAA2D;;;;;IAK3D,kDAAkD;eAC7B,QAAQ,CAAC,MAAM,GAAG,mBAAmB,CAAC;;;;IAzB3D,6EAA6E;;cAEjD,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;IAGtD;;;;;;;OAOG;;cAEe,QAAQ,CACtB,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,CACtE;;;IAGH,2DAA2D;;;;;IAK3D,kDAAkD;eAC7B,QAAQ,CAAC,MAAM,GAAG,mBAAmB,CAAC;;;;;AA5B/D,wBA2JE"}
@@ -1,8 +1,27 @@
1
1
  import type { Result } from '@empathyco/x-types';
2
- import type { PropType, Ref } from 'vue';
2
+ import type { PropType, Ref, StyleValue } from 'vue';
3
+ /**
4
+ * An entry of the images queue: the image `src` and its optional `srcset`.
5
+ *
6
+ * @internal
7
+ */
8
+ interface ImageEntry {
9
+ /** Index of the image inside `result.images`. */
10
+ index: number;
11
+ /** The image URL. */
12
+ src: string;
13
+ /** Responsive candidates for the image, if provided. */
14
+ srcset?: string;
15
+ }
3
16
  /**
4
17
  * Component to be reused that renders an `<img>`.
5
18
  *
19
+ * Additional `<img>` attributes passed to the component (e.g. `decoding`, `crossorigin`,
20
+ * `referrerpolicy`, `fetchpriority`, `width` and `height`) are forwarded to the rendered
21
+ * images, while `class`, `style` and event listeners keep falling through to the root
22
+ * element, as before. Use the `imageLoaded` and `imageError` events to observe the image
23
+ * loading state.
24
+ *
6
25
  * @public
7
26
  */
8
27
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
@@ -32,18 +51,60 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
32
51
  type: BooleanConstructor;
33
52
  default: boolean;
34
53
  };
54
+ /**
55
+ * Responsive image candidates (`srcset`).
56
+ *
57
+ * - A single string is applied to every image of the result (e.g.
58
+ * `"image-480.jpg 480w, image-1024.jpg 1024w"`).
59
+ * - An array is parallel to `result.images`, so each image can have its own candidates.
60
+ *
61
+ * When provided, the `src` is kept as a fallback for browsers without `srcset` support.
62
+ *
63
+ * @public
64
+ */
65
+ srcset: {
66
+ type: PropType<string | (string | undefined)[]>;
67
+ };
68
+ /**
69
+ * The sizes of the image for different page layouts (`sizes`).
70
+ *
71
+ * It is shared by all the images of the result, since it depends on the layout and not on
72
+ * the image. Pass it together with `srcset`, since it is ignored otherwise.
73
+ *
74
+ * @public
75
+ */
76
+ sizes: {
77
+ type: StringConstructor;
78
+ };
79
+ /**
80
+ * Image loading mode.
81
+ *
82
+ * @public
83
+ */
84
+ loading: {
85
+ type: PropType<"lazy" | "eager">;
86
+ default: string;
87
+ };
35
88
  }>, {
36
- pendingImages: Ref<string[], string[]>;
37
- loadedImages: Ref<string[], string[]>;
89
+ imageAttrs: import("vue").ComputedRef<{
90
+ [k: string]: unknown;
91
+ }>;
92
+ rootAttrs: import("vue").ComputedRef<{
93
+ class: import("vue").ClassValue;
94
+ style: StyleValue;
95
+ }>;
96
+ pendingImages: Ref<ImageEntry[], ImageEntry[]>;
97
+ loadedImages: Ref<ImageEntry[], ImageEntry[]>;
38
98
  isHovering: Ref<boolean, boolean>;
39
99
  userHasHoveredImage: Ref<boolean, boolean>;
40
100
  loaderStyles: import("vue").CSSProperties;
41
101
  animation: import("vue").ComputedRef<string | Function | Record<string, any>>;
42
102
  imageSrc: import("vue").ComputedRef<string>;
103
+ imageSrcset: import("vue").ComputedRef<string | undefined>;
43
104
  shouldLoadNextImage: import("vue").ComputedRef<boolean>;
44
105
  flagImageAsFailed: () => void;
45
- flagImageLoaded: () => void;
46
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
106
+ flagImageLoaded: (event: Event) => void;
107
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("imageLoaded" | "imageError")[], "imageLoaded" | "imageError", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
47
108
  /** (Required) The {@link @empathyco/x-types#Result} information. */
48
109
  result: {
49
110
  type: PropType<Result>;
@@ -70,9 +131,47 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
70
131
  type: BooleanConstructor;
71
132
  default: boolean;
72
133
  };
73
- }>> & Readonly<{}>, {
134
+ /**
135
+ * Responsive image candidates (`srcset`).
136
+ *
137
+ * - A single string is applied to every image of the result (e.g.
138
+ * `"image-480.jpg 480w, image-1024.jpg 1024w"`).
139
+ * - An array is parallel to `result.images`, so each image can have its own candidates.
140
+ *
141
+ * When provided, the `src` is kept as a fallback for browsers without `srcset` support.
142
+ *
143
+ * @public
144
+ */
145
+ srcset: {
146
+ type: PropType<string | (string | undefined)[]>;
147
+ };
148
+ /**
149
+ * The sizes of the image for different page layouts (`sizes`).
150
+ *
151
+ * It is shared by all the images of the result, since it depends on the layout and not on
152
+ * the image. Pass it together with `srcset`, since it is ignored otherwise.
153
+ *
154
+ * @public
155
+ */
156
+ sizes: {
157
+ type: StringConstructor;
158
+ };
159
+ /**
160
+ * Image loading mode.
161
+ *
162
+ * @public
163
+ */
164
+ loading: {
165
+ type: PropType<"lazy" | "eager">;
166
+ default: string;
167
+ };
168
+ }>> & Readonly<{
169
+ onImageLoaded?: ((...args: any[]) => any) | undefined;
170
+ onImageError?: ((...args: any[]) => any) | undefined;
171
+ }>, {
74
172
  loadAnimation: string | Function | Record<string, any>;
75
173
  showNextImageOnHover: boolean;
174
+ loading: "lazy" | "eager";
76
175
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
77
176
  export default _default;
78
177
  //# sourceMappingURL=base-result-image.vue?vue&type=script&lang.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-image.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-image.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAc,MAAM,KAAK,CAAA;AAKpD;;;;GAIG;;IAIC,oEAAoE;;cAElD,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;OAGG;;;;;IAKH,oFAAoF;;;;IAIpF;;;;OAIG;;;;;;;;;;;;;;;;;IArBH,oEAAoE;;cAElD,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;OAGG;;;;;IAKH,oFAAoF;;;;IAIpF;;;;OAIG;;;;;;;;;AAxBP,wBAoKE"}
1
+ {"version":3,"file":"base-result-image.vue?vue&type=script&lang.d.ts","sourceRoot":"","sources":["../../../../../src/components/result/base-result-image.vue?vue&type=script&lang.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAMpD;;;;GAIG;AACH,UAAU,UAAU;IAClB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;GAUG;;IAKC,oEAAoE;;cAElD,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;OAGG;;;;;IAKH,oFAAoF;;;;IAIpF;;;;OAIG;;;;;IAKH;;;;;;;;;;OAUG;;cAEwB,QAAQ,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;;IAEpE;;;;;;;OAOG;;;;IAIH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;6BAiMZ,KAAK;;IA1PrC,oEAAoE;;cAElD,QAAQ,CAAC,MAAM,CAAC;;;IAGlC;;;OAGG;;;;;IAKH,oFAAoF;;;;IAIpF;;;;OAIG;;;;;IAKH;;;;;;;;;;OAUG;;cAEwB,QAAQ,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;;IAEpE;;;;;;;OAOG;;;;IAIH;;;;OAIG;;cAEe,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC;;;;;;;;;;;AA7DhD,wBA6RE"}