@mekari/pixel3-image 0.0.7-dev.5
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/chunk-DPFH2SO2.mjs +77 -0
- package/dist/chunk-LQRQ2LTW.mjs +48 -0
- package/dist/chunk-MC3PU33I.mjs +240 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/image.d.mts +167 -0
- package/dist/image.d.ts +167 -0
- package/dist/image.js +373 -0
- package/dist/image.mjs +9 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +375 -0
- package/dist/index.mjs +9 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/image.hooks.d.mts +76 -0
- package/dist/modules/image.hooks.d.ts +76 -0
- package/dist/modules/image.hooks.js +261 -0
- package/dist/modules/image.hooks.mjs +7 -0
- package/dist/modules/image.props.d.mts +78 -0
- package/dist/modules/image.props.d.ts +78 -0
- package/dist/modules/image.props.js +102 -0
- package/dist/modules/image.props.mjs +9 -0
- package/dist/modules/image.type.d.mts +4 -0
- package/dist/modules/image.type.d.ts +4 -0
- package/dist/modules/image.type.js +18 -0
- package/dist/modules/image.type.mjs +0 -0
- package/package.json +42 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
MpImage: () => MpImage
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/image.tsx
|
|
29
|
+
var import_vue2 = require("vue");
|
|
30
|
+
var import_vue3 = require("vue");
|
|
31
|
+
var import_pixel3_spinner = require("@mekari/pixel3-spinner");
|
|
32
|
+
var import_patterns = require("@mekari/pixel3-styled-system/patterns");
|
|
33
|
+
|
|
34
|
+
// src/modules/image.props.ts
|
|
35
|
+
var imageProps = {
|
|
36
|
+
id: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
},
|
|
40
|
+
src: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: ""
|
|
43
|
+
},
|
|
44
|
+
alt: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: ""
|
|
47
|
+
},
|
|
48
|
+
layout: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "intrinsic"
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 0
|
|
55
|
+
},
|
|
56
|
+
height: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 0
|
|
59
|
+
},
|
|
60
|
+
sizes: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: ""
|
|
63
|
+
},
|
|
64
|
+
srcPlaceholder: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
67
|
+
},
|
|
68
|
+
srcset: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
typeSrcset: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ""
|
|
75
|
+
},
|
|
76
|
+
mediaSrcset: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: ""
|
|
79
|
+
},
|
|
80
|
+
maxSrcset: {
|
|
81
|
+
type: Number,
|
|
82
|
+
default: 5
|
|
83
|
+
},
|
|
84
|
+
objectFit: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: "fill"
|
|
87
|
+
},
|
|
88
|
+
objectPosition: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: ""
|
|
91
|
+
},
|
|
92
|
+
errorText: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: "Failed load image"
|
|
95
|
+
},
|
|
96
|
+
isLazy: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
isShowLoading: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: true
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/modules/image.hooks.ts
|
|
107
|
+
var import_vue = require("vue");
|
|
108
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
109
|
+
function useImage(props, emit) {
|
|
110
|
+
const {
|
|
111
|
+
id,
|
|
112
|
+
src,
|
|
113
|
+
alt,
|
|
114
|
+
srcPlaceholder,
|
|
115
|
+
srcset,
|
|
116
|
+
typeSrcset,
|
|
117
|
+
mediaSrcset,
|
|
118
|
+
layout,
|
|
119
|
+
width,
|
|
120
|
+
height,
|
|
121
|
+
sizes,
|
|
122
|
+
objectFit,
|
|
123
|
+
objectPosition,
|
|
124
|
+
errorText,
|
|
125
|
+
isLazy,
|
|
126
|
+
isShowLoading
|
|
127
|
+
} = (0, import_vue.toRefs)(props);
|
|
128
|
+
const intersected = (0, import_vue.ref)(false);
|
|
129
|
+
const loaded = (0, import_vue.ref)(false);
|
|
130
|
+
const failed = (0, import_vue.ref)(false);
|
|
131
|
+
const imageWrapperNode = (0, import_vue.ref)();
|
|
132
|
+
const imgNode = (0, import_vue.ref)();
|
|
133
|
+
const {
|
|
134
|
+
stop: disableIntersectionObserver
|
|
135
|
+
} = (0, import_pixel3_utils.useIntersectionObserver)(imageWrapperNode, ([{
|
|
136
|
+
isIntersecting
|
|
137
|
+
}]) => {
|
|
138
|
+
if (isIntersecting) {
|
|
139
|
+
intersected.value = true;
|
|
140
|
+
emit("intersect", getId);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const getId = id.value || (0, import_pixel3_utils.getUniqueId)("", "image").value;
|
|
144
|
+
const isVisible = (0, import_vue.computed)(() => {
|
|
145
|
+
return intersected.value || !isLazy.value;
|
|
146
|
+
});
|
|
147
|
+
const isLoading = (0, import_vue.computed)(() => {
|
|
148
|
+
return isShowLoading.value && isVisible.value && !loaded.value && !failed.value;
|
|
149
|
+
});
|
|
150
|
+
const srcImage = (0, import_vue.computed)(() => {
|
|
151
|
+
return isVisible.value && src.value ? src.value : srcPlaceholder.value;
|
|
152
|
+
});
|
|
153
|
+
const srcsetImage = (0, import_vue.computed)(() => {
|
|
154
|
+
return isVisible.value && srcset.value ? srcset.value : void 0;
|
|
155
|
+
});
|
|
156
|
+
const sizerSvg = (0, import_vue.computed)(() => {
|
|
157
|
+
if (layout.value !== "intrinsic") {
|
|
158
|
+
return "";
|
|
159
|
+
}
|
|
160
|
+
const backgroundColor = !intersected.value ? "background-color:#ffffff;" : "";
|
|
161
|
+
return `<svg
|
|
162
|
+
width="${width.value}"
|
|
163
|
+
height="${height.value}"
|
|
164
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
165
|
+
style="${backgroundColor}"
|
|
166
|
+
>
|
|
167
|
+
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle">${errorText.value}</text>
|
|
168
|
+
</svg>`;
|
|
169
|
+
});
|
|
170
|
+
const sizerStyle = (0, import_vue.computed)(() => {
|
|
171
|
+
let style;
|
|
172
|
+
if (layout.value === "responsive") {
|
|
173
|
+
const quotient = height.value / width.value;
|
|
174
|
+
const paddingTop = isNaN(quotient) ? "100%" : `${quotient * 100}%`;
|
|
175
|
+
style = {
|
|
176
|
+
display: "block",
|
|
177
|
+
boxSizing: "border-box",
|
|
178
|
+
paddingTop
|
|
179
|
+
};
|
|
180
|
+
} else if (layout.value === "intrinsic") {
|
|
181
|
+
style = {
|
|
182
|
+
boxSizing: "border-box",
|
|
183
|
+
display: "block",
|
|
184
|
+
maxWidth: "100%"
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
return style;
|
|
188
|
+
});
|
|
189
|
+
const wrapperStyle = (0, import_vue.computed)(() => {
|
|
190
|
+
let style = {};
|
|
191
|
+
if (layout.value === "responsive") {
|
|
192
|
+
style = {
|
|
193
|
+
position: "relative",
|
|
194
|
+
display: "block",
|
|
195
|
+
overflow: "hidden",
|
|
196
|
+
boxSizing: "border-box",
|
|
197
|
+
margin: 0
|
|
198
|
+
};
|
|
199
|
+
} else if (layout.value === "intrinsic") {
|
|
200
|
+
style = {
|
|
201
|
+
position: "relative",
|
|
202
|
+
display: "inline-block",
|
|
203
|
+
overflow: "hidden",
|
|
204
|
+
boxSizing: "border-box",
|
|
205
|
+
maxWidth: "100%",
|
|
206
|
+
margin: 0
|
|
207
|
+
};
|
|
208
|
+
} else if (layout.value === "fixed") {
|
|
209
|
+
style = {
|
|
210
|
+
position: "relative",
|
|
211
|
+
display: "inline-block",
|
|
212
|
+
overflow: "hidden",
|
|
213
|
+
boxSizing: "border-box",
|
|
214
|
+
width: `${width.value}px`,
|
|
215
|
+
height: `${height.value}px`
|
|
216
|
+
};
|
|
217
|
+
} else if (layout.value === "fill") {
|
|
218
|
+
style = {
|
|
219
|
+
position: "absolute",
|
|
220
|
+
display: "block",
|
|
221
|
+
overflow: "hidden",
|
|
222
|
+
boxSizing: "border-box",
|
|
223
|
+
top: 0,
|
|
224
|
+
left: 0,
|
|
225
|
+
bottom: 0,
|
|
226
|
+
right: 0,
|
|
227
|
+
margin: 0
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
return style;
|
|
231
|
+
});
|
|
232
|
+
const rootAttrs = (0, import_vue.computed)(() => {
|
|
233
|
+
return {
|
|
234
|
+
"data-pixel-component": "MpImage",
|
|
235
|
+
ref: imageWrapperNode,
|
|
236
|
+
id: getId,
|
|
237
|
+
style: {
|
|
238
|
+
...wrapperStyle.value
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
const sizerAttrs = (0, import_vue.computed)(() => {
|
|
243
|
+
return {
|
|
244
|
+
style: {
|
|
245
|
+
...sizerStyle.value
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
const imgSizerAttrs = (0, import_vue.computed)(() => {
|
|
250
|
+
return {
|
|
251
|
+
src: `data:image/svg+xml;base64,${toBase64(sizerSvg.value)}`,
|
|
252
|
+
alt: "",
|
|
253
|
+
ariaHidden: true,
|
|
254
|
+
style: {
|
|
255
|
+
maxWidth: "100%",
|
|
256
|
+
display: "block",
|
|
257
|
+
border: "none",
|
|
258
|
+
margin: 0,
|
|
259
|
+
padding: 0
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
const sourceAttrs = (0, import_vue.computed)(() => {
|
|
264
|
+
return {
|
|
265
|
+
srcset: srcsetImage.value,
|
|
266
|
+
type: typeSrcset.value,
|
|
267
|
+
media: mediaSrcset.value
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
const imgAttrs = (0, import_vue.computed)(() => {
|
|
271
|
+
return {
|
|
272
|
+
ref: imgNode,
|
|
273
|
+
alt: alt.value ? alt.value : void 0,
|
|
274
|
+
src: srcImage.value ? srcImage.value : void 0,
|
|
275
|
+
sizes: sizes.value ? sizes.value : void 0,
|
|
276
|
+
decoding: "async",
|
|
277
|
+
// eslint-disable-next-line
|
|
278
|
+
style: {
|
|
279
|
+
position: "absolute",
|
|
280
|
+
display: "block",
|
|
281
|
+
top: 0,
|
|
282
|
+
left: 0,
|
|
283
|
+
bottom: 0,
|
|
284
|
+
right: 0,
|
|
285
|
+
boxSizing: "border-box",
|
|
286
|
+
padding: 0,
|
|
287
|
+
border: "none",
|
|
288
|
+
margin: "auto",
|
|
289
|
+
width: "0",
|
|
290
|
+
height: "0",
|
|
291
|
+
minWidth: "100%",
|
|
292
|
+
maxWidth: "100%",
|
|
293
|
+
minHeight: "100%",
|
|
294
|
+
maxHeight: "100%",
|
|
295
|
+
objectFit: objectFit.value ? objectFit.value : void 0,
|
|
296
|
+
objectPosition: objectPosition.value ? objectPosition.value : void 0
|
|
297
|
+
},
|
|
298
|
+
onLoad: handleLoad,
|
|
299
|
+
onError: handleError
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
function toBase64(str) {
|
|
303
|
+
console.log("STR", str);
|
|
304
|
+
if (typeof window === "undefined") {
|
|
305
|
+
return Buffer.from(str).toString("base64");
|
|
306
|
+
} else {
|
|
307
|
+
return window.btoa(str);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
__name(toBase64, "toBase64");
|
|
311
|
+
function handleLoad() {
|
|
312
|
+
if (imgNode.value && imgNode.value.getAttribute("src") !== srcPlaceholder.value && !loaded.value) {
|
|
313
|
+
loaded.value = true;
|
|
314
|
+
emit("load", getId);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
__name(handleLoad, "handleLoad");
|
|
318
|
+
function handleError(e) {
|
|
319
|
+
emit("error", getId, e);
|
|
320
|
+
failed.value = true;
|
|
321
|
+
}
|
|
322
|
+
__name(handleError, "handleError");
|
|
323
|
+
(0, import_vue.onUnmounted)(() => {
|
|
324
|
+
disableIntersectionObserver();
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
rootAttrs,
|
|
328
|
+
sizerAttrs,
|
|
329
|
+
imgSizerAttrs,
|
|
330
|
+
sourceAttrs,
|
|
331
|
+
imgAttrs,
|
|
332
|
+
isLoading,
|
|
333
|
+
sizerStyle,
|
|
334
|
+
sizerSvg
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
__name(useImage, "useImage");
|
|
338
|
+
|
|
339
|
+
// src/image.tsx
|
|
340
|
+
var MpImage = (0, import_vue3.defineComponent)({
|
|
341
|
+
name: "MpImage",
|
|
342
|
+
props: imageProps,
|
|
343
|
+
emits: ["intersect", "load", "error"],
|
|
344
|
+
setup(props, {
|
|
345
|
+
slots,
|
|
346
|
+
emit
|
|
347
|
+
}) {
|
|
348
|
+
const {
|
|
349
|
+
rootAttrs,
|
|
350
|
+
sizerAttrs,
|
|
351
|
+
imgSizerAttrs,
|
|
352
|
+
sourceAttrs,
|
|
353
|
+
imgAttrs,
|
|
354
|
+
isLoading,
|
|
355
|
+
sizerStyle
|
|
356
|
+
} = useImage(props, emit);
|
|
357
|
+
return () => {
|
|
358
|
+
const children = slots.default && slots.default();
|
|
359
|
+
return (0, import_vue2.createVNode)("div", rootAttrs.value, [isLoading.value && (0, import_vue2.createVNode)("div", {
|
|
360
|
+
"class": (0, import_patterns.flex)({
|
|
361
|
+
alignItems: "center",
|
|
362
|
+
justifyContent: "center",
|
|
363
|
+
zIndex: "1",
|
|
364
|
+
position: "absolute",
|
|
365
|
+
width: "full",
|
|
366
|
+
height: "full"
|
|
367
|
+
})
|
|
368
|
+
}, [children ? children : (0, import_vue2.createVNode)(import_pixel3_spinner.MpSpinner, null, null)]), sizerStyle.value && (0, import_vue2.createVNode)("div", sizerAttrs.value, [(0, import_vue2.createVNode)("img", imgSizerAttrs.value, null)]), (0, import_vue2.createVNode)("picture", null, [(0, import_vue2.createVNode)("source", sourceAttrs.value, null), (0, import_vue2.createVNode)("img", imgAttrs.value, null)])]);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
373
|
+
0 && (module.exports = {
|
|
374
|
+
MpImage
|
|
375
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/image.props.ts":{"bytes":1864,"imports":[],"format":"esm"},"src/modules/image.hooks.ts":{"bytes":6253,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/image.tsx":{"bytes":1422,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/patterns","kind":"import-statement","external":true},{"path":"src/modules/image.props.ts","kind":"import-statement","original":"./modules/image.props"},{"path":"src/modules/image.hooks.ts","kind":"import-statement","original":"./modules/image.hooks"}],"format":"esm"},"src/index.ts":{"bytes":119,"imports":[{"path":"src/image.tsx","kind":"import-statement","original":"./image"}],"format":"esm"},"src/modules/image.type.ts":{"bytes":240,"imports":[],"format":"esm"}},"outputs":{"dist/image.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/patterns","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/image.tsx","inputs":{"src/image.tsx":{"bytesInOutput":1539},"src/modules/image.props.ts":{"bytesInOutput":1028},"src/modules/image.hooks.ts":{"bytesInOutput":6144}},"bytes":9799},"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/patterns","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":119},"src/image.tsx":{"bytesInOutput":1414},"src/modules/image.props.ts":{"bytesInOutput":1028},"src/modules/image.hooks.ts":{"bytesInOutput":6144}},"bytes":9810},"dist/modules/image.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/image.hooks.ts","inputs":{"src/modules/image.hooks.ts":{"bytesInOutput":6289}},"bytes":7311},"dist/modules/image.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/image.props.ts","inputs":{"src/modules/image.props.ts":{"bytesInOutput":1255}},"bytes":2202},"dist/modules/image.type.js":{"imports":[],"exports":[],"entryPoint":"src/modules/image.type.ts","inputs":{"src/modules/image.type.ts":{"bytesInOutput":80}},"bytes":781}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/image.props.ts":{"bytes":1864,"imports":[],"format":"esm"},"src/modules/image.hooks.ts":{"bytes":6253,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/image.tsx":{"bytes":1422,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/patterns","kind":"import-statement","external":true},{"path":"src/modules/image.props.ts","kind":"import-statement","original":"./modules/image.props"},{"path":"src/modules/image.hooks.ts","kind":"import-statement","original":"./modules/image.hooks"}],"format":"esm"},"src/index.ts":{"bytes":119,"imports":[{"path":"src/image.tsx","kind":"import-statement","original":"./image"}],"format":"esm"},"src/modules/image.type.ts":{"bytes":240,"imports":[],"format":"esm"}},"outputs":{"dist/image.mjs":{"imports":[{"path":"dist/chunk-LQRQ2LTW.mjs","kind":"import-statement"},{"path":"dist/chunk-MC3PU33I.mjs","kind":"import-statement"},{"path":"dist/chunk-DPFH2SO2.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpImage"],"entryPoint":"src/image.tsx","inputs":{},"bytes":165},"dist/index.mjs":{"imports":[{"path":"dist/chunk-LQRQ2LTW.mjs","kind":"import-statement"},{"path":"dist/chunk-MC3PU33I.mjs","kind":"import-statement"},{"path":"dist/chunk-DPFH2SO2.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpImage"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":165},"dist/chunk-LQRQ2LTW.mjs":{"imports":[{"path":"dist/chunk-MC3PU33I.mjs","kind":"import-statement"},{"path":"dist/chunk-DPFH2SO2.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/patterns","kind":"import-statement","external":true}],"exports":["MpImage"],"inputs":{"src/image.tsx":{"bytesInOutput":1227}},"bytes":1372},"dist/modules/image.hooks.mjs":{"imports":[{"path":"dist/chunk-MC3PU33I.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useImage"],"entryPoint":"src/modules/image.hooks.ts","inputs":{},"bytes":107},"dist/chunk-MC3PU33I.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["useImage"],"inputs":{"src/modules/image.hooks.ts":{"bytesInOutput":5833}},"bytes":5937},"dist/modules/image.props.mjs":{"imports":[{"path":"dist/chunk-DPFH2SO2.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["imageEmit","imageProps"],"entryPoint":"src/modules/image.props.ts","inputs":{},"bytes":137},"dist/chunk-DPFH2SO2.mjs":{"imports":[],"exports":["imageEmit","imageProps"],"inputs":{"src/modules/image.props.ts":{"bytesInOutput":1076}},"bytes":1145},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151},"dist/modules/image.type.mjs":{"imports":[],"exports":[],"entryPoint":"src/modules/image.type.ts","inputs":{"src/modules/image.type.ts":{"bytesInOutput":0}},"bytes":0}}}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ImageObjectFit } from './image.type.mjs';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { ImageProps, ImageEmit } from './image.props.mjs';
|
|
4
|
+
|
|
5
|
+
declare function useImage(props: ImageProps, emit: ImageEmit): {
|
|
6
|
+
rootAttrs: vue.ComputedRef<{
|
|
7
|
+
'data-pixel-component': string;
|
|
8
|
+
ref: vue.Ref<any>;
|
|
9
|
+
id: string | undefined;
|
|
10
|
+
style: {};
|
|
11
|
+
}>;
|
|
12
|
+
sizerAttrs: vue.ComputedRef<{
|
|
13
|
+
style: {};
|
|
14
|
+
}>;
|
|
15
|
+
imgSizerAttrs: vue.ComputedRef<{
|
|
16
|
+
src: string;
|
|
17
|
+
alt: string;
|
|
18
|
+
ariaHidden: boolean;
|
|
19
|
+
style: {
|
|
20
|
+
maxWidth: string;
|
|
21
|
+
display: string;
|
|
22
|
+
border: string;
|
|
23
|
+
margin: number;
|
|
24
|
+
padding: number;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
sourceAttrs: vue.ComputedRef<{
|
|
28
|
+
srcset: string | undefined;
|
|
29
|
+
type: string;
|
|
30
|
+
media: string;
|
|
31
|
+
}>;
|
|
32
|
+
imgAttrs: vue.ComputedRef<{
|
|
33
|
+
ref: vue.Ref<any>;
|
|
34
|
+
alt: string | undefined;
|
|
35
|
+
src: string | undefined;
|
|
36
|
+
sizes: string | undefined;
|
|
37
|
+
decoding: "async";
|
|
38
|
+
style: {
|
|
39
|
+
position: "absolute";
|
|
40
|
+
display: string;
|
|
41
|
+
top: number;
|
|
42
|
+
left: number;
|
|
43
|
+
bottom: number;
|
|
44
|
+
right: number;
|
|
45
|
+
boxSizing: "border-box";
|
|
46
|
+
padding: number;
|
|
47
|
+
border: string;
|
|
48
|
+
margin: string;
|
|
49
|
+
width: string;
|
|
50
|
+
height: string;
|
|
51
|
+
minWidth: string;
|
|
52
|
+
maxWidth: string;
|
|
53
|
+
minHeight: string;
|
|
54
|
+
maxHeight: string;
|
|
55
|
+
objectFit: ImageObjectFit | undefined;
|
|
56
|
+
objectPosition: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
onLoad: () => void;
|
|
59
|
+
onError: (e: Event) => void;
|
|
60
|
+
}>;
|
|
61
|
+
isLoading: vue.ComputedRef<boolean>;
|
|
62
|
+
sizerStyle: vue.ComputedRef<{
|
|
63
|
+
display: string;
|
|
64
|
+
boxSizing: string;
|
|
65
|
+
paddingTop: string;
|
|
66
|
+
maxWidth?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
boxSizing: string;
|
|
69
|
+
display: string;
|
|
70
|
+
maxWidth: string;
|
|
71
|
+
paddingTop?: undefined;
|
|
72
|
+
} | undefined>;
|
|
73
|
+
sizerSvg: vue.ComputedRef<string>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { useImage };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ImageObjectFit } from './image.type.js';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { ImageProps, ImageEmit } from './image.props.js';
|
|
4
|
+
|
|
5
|
+
declare function useImage(props: ImageProps, emit: ImageEmit): {
|
|
6
|
+
rootAttrs: vue.ComputedRef<{
|
|
7
|
+
'data-pixel-component': string;
|
|
8
|
+
ref: vue.Ref<any>;
|
|
9
|
+
id: string | undefined;
|
|
10
|
+
style: {};
|
|
11
|
+
}>;
|
|
12
|
+
sizerAttrs: vue.ComputedRef<{
|
|
13
|
+
style: {};
|
|
14
|
+
}>;
|
|
15
|
+
imgSizerAttrs: vue.ComputedRef<{
|
|
16
|
+
src: string;
|
|
17
|
+
alt: string;
|
|
18
|
+
ariaHidden: boolean;
|
|
19
|
+
style: {
|
|
20
|
+
maxWidth: string;
|
|
21
|
+
display: string;
|
|
22
|
+
border: string;
|
|
23
|
+
margin: number;
|
|
24
|
+
padding: number;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
sourceAttrs: vue.ComputedRef<{
|
|
28
|
+
srcset: string | undefined;
|
|
29
|
+
type: string;
|
|
30
|
+
media: string;
|
|
31
|
+
}>;
|
|
32
|
+
imgAttrs: vue.ComputedRef<{
|
|
33
|
+
ref: vue.Ref<any>;
|
|
34
|
+
alt: string | undefined;
|
|
35
|
+
src: string | undefined;
|
|
36
|
+
sizes: string | undefined;
|
|
37
|
+
decoding: "async";
|
|
38
|
+
style: {
|
|
39
|
+
position: "absolute";
|
|
40
|
+
display: string;
|
|
41
|
+
top: number;
|
|
42
|
+
left: number;
|
|
43
|
+
bottom: number;
|
|
44
|
+
right: number;
|
|
45
|
+
boxSizing: "border-box";
|
|
46
|
+
padding: number;
|
|
47
|
+
border: string;
|
|
48
|
+
margin: string;
|
|
49
|
+
width: string;
|
|
50
|
+
height: string;
|
|
51
|
+
minWidth: string;
|
|
52
|
+
maxWidth: string;
|
|
53
|
+
minHeight: string;
|
|
54
|
+
maxHeight: string;
|
|
55
|
+
objectFit: ImageObjectFit | undefined;
|
|
56
|
+
objectPosition: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
onLoad: () => void;
|
|
59
|
+
onError: (e: Event) => void;
|
|
60
|
+
}>;
|
|
61
|
+
isLoading: vue.ComputedRef<boolean>;
|
|
62
|
+
sizerStyle: vue.ComputedRef<{
|
|
63
|
+
display: string;
|
|
64
|
+
boxSizing: string;
|
|
65
|
+
paddingTop: string;
|
|
66
|
+
maxWidth?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
boxSizing: string;
|
|
69
|
+
display: string;
|
|
70
|
+
maxWidth: string;
|
|
71
|
+
paddingTop?: undefined;
|
|
72
|
+
} | undefined>;
|
|
73
|
+
sizerSvg: vue.ComputedRef<string>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { useImage };
|