@everymatrix/ui-image 0.1.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/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-bdabfcc4.js +1134 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/ui-image-e059fe64.js +69 -0
- package/dist/cjs/ui-image.cjs.entry.js +10 -0
- package/dist/cjs/ui-image.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/ui-image/index.js +1 -0
- package/dist/collection/components/ui-image/ui-image.css +13 -0
- package/dist/collection/components/ui-image/ui-image.js +204 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-b7bbd57e.js +1107 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/ui-image-38c3c15f.js +67 -0
- package/dist/esm/ui-image.entry.js +2 -0
- package/dist/esm/ui-image.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/storybook/main.js +21 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/ui-image/.stencil/packages/stencil/ui-image/stencil.config.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/ui-image/.stencil/packages/stencil/ui-image/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/ui-image/.stencil/packages/stencil/ui-image/storybook/main.d.ts +3 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/ui-image/.stencil/packages/stencil/ui-image/storybook/preview.d.ts +70 -0
- package/dist/types/components/ui-image/index.d.ts +1 -0
- package/dist/types/components/ui-image/ui-image.d.ts +23 -0
- package/dist/types/components.d.ts +93 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/ui-image/index.esm.js +1 -0
- package/dist/ui-image/p-37874c44.js +1 -0
- package/dist/ui-image/p-864b3ce6.js +2 -0
- package/dist/ui-image/p-9da68072.entry.js +1 -0
- package/dist/ui-image/p-e1255160.js +1 -0
- package/dist/ui-image/ui-image.esm.js +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +29 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-bdabfcc4.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["ui-image.cjs",[[0,"ui-image",{"src":[1],"width":[1],"height":[1],"alt":[1],"imgClass":[1,"img-class"],"styles":[8],"detectDistance":[1,"detect-distance"],"imgLoaded":[32],"shouldLoad":[32]},null,{"src":["handleSrc"]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-bdabfcc4.js');
|
|
4
|
+
|
|
5
|
+
const uiImageCss = ":host{display:block}.Hidden{opacity:0;transition:opacity 0.5s ease-in-out}.Visible{opacity:1;transition:opacity 0.5s ease-in-out}";
|
|
6
|
+
const UiImageStyle0 = uiImageCss;
|
|
7
|
+
|
|
8
|
+
const UiImage = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.src = undefined;
|
|
12
|
+
this.width = undefined;
|
|
13
|
+
this.height = undefined;
|
|
14
|
+
this.alt = undefined;
|
|
15
|
+
this.imgClass = '';
|
|
16
|
+
this.styles = undefined;
|
|
17
|
+
this.detectDistance = '200px';
|
|
18
|
+
this.imgLoaded = false;
|
|
19
|
+
this.shouldLoad = false;
|
|
20
|
+
}
|
|
21
|
+
handleSrc() {
|
|
22
|
+
if (!this.shouldLoad) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const tempImage = new Image();
|
|
26
|
+
tempImage.src = this.src;
|
|
27
|
+
tempImage.onload = () => {
|
|
28
|
+
if (this.image) {
|
|
29
|
+
this.image.src = this.src;
|
|
30
|
+
this.imgLoaded = true;
|
|
31
|
+
this.el.dispatchEvent(new CustomEvent('load', { bubbles: true }));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
componentDidLoad() {
|
|
36
|
+
if ('IntersectionObserver' in window) {
|
|
37
|
+
this.el.__uxComponent = this;
|
|
38
|
+
if (!window.EMUxObserver) {
|
|
39
|
+
window.EMUxObserver = new IntersectionObserver((entries) => {
|
|
40
|
+
entries.forEach(entry => {
|
|
41
|
+
if (entry.isIntersecting) {
|
|
42
|
+
const comp = entry.target.__uxComponent;
|
|
43
|
+
if (comp) {
|
|
44
|
+
comp.shouldLoad = true;
|
|
45
|
+
comp.handleSrc();
|
|
46
|
+
}
|
|
47
|
+
window.EMUxObserver.unobserve(entry.target);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, { rootMargin: this.detectDistance });
|
|
51
|
+
}
|
|
52
|
+
window.EMUxObserver.observe(this.el);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.shouldLoad = true;
|
|
56
|
+
this.handleSrc();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return (index.h("img", { key: '2bb4dc391fc2f753514103e91c0abf065de3236a', ref: el => (this.image = el), style: this.styles, class: `${this.imgClass} ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" }));
|
|
61
|
+
}
|
|
62
|
+
get el() { return index.getElement(this); }
|
|
63
|
+
static get watchers() { return {
|
|
64
|
+
"src": ["handleSrc"]
|
|
65
|
+
}; }
|
|
66
|
+
};
|
|
67
|
+
UiImage.style = UiImageStyle0;
|
|
68
|
+
|
|
69
|
+
exports.UiImage = UiImage;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-bdabfcc4.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Stencil Client Patch Browser v4.19.2 | MIT Licensed | https://stenciljs.com
|
|
10
|
+
*/
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('ui-image.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["ui-image.cjs",[[0,"ui-image",{"src":[1],"width":[1],"height":[1],"alt":[1],"imgClass":[1,"img-class"],"styles":[8],"detectDistance":[1,"detect-distance"],"imgLoaded":[32],"shouldLoad":[32]},null,{"src":["handleSrc"]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UiImage } from './ui-image';
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class UiImage {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.src = undefined;
|
|
5
|
+
this.width = undefined;
|
|
6
|
+
this.height = undefined;
|
|
7
|
+
this.alt = undefined;
|
|
8
|
+
this.imgClass = '';
|
|
9
|
+
this.styles = undefined;
|
|
10
|
+
this.detectDistance = '200px';
|
|
11
|
+
this.imgLoaded = false;
|
|
12
|
+
this.shouldLoad = false;
|
|
13
|
+
}
|
|
14
|
+
handleSrc() {
|
|
15
|
+
if (!this.shouldLoad) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const tempImage = new Image();
|
|
19
|
+
tempImage.src = this.src;
|
|
20
|
+
tempImage.onload = () => {
|
|
21
|
+
if (this.image) {
|
|
22
|
+
this.image.src = this.src;
|
|
23
|
+
this.imgLoaded = true;
|
|
24
|
+
this.el.dispatchEvent(new CustomEvent('load', { bubbles: true }));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
if ('IntersectionObserver' in window) {
|
|
30
|
+
this.el.__uxComponent = this;
|
|
31
|
+
if (!window.EMUxObserver) {
|
|
32
|
+
window.EMUxObserver = new IntersectionObserver((entries) => {
|
|
33
|
+
entries.forEach(entry => {
|
|
34
|
+
if (entry.isIntersecting) {
|
|
35
|
+
const comp = entry.target.__uxComponent;
|
|
36
|
+
if (comp) {
|
|
37
|
+
comp.shouldLoad = true;
|
|
38
|
+
comp.handleSrc();
|
|
39
|
+
}
|
|
40
|
+
window.EMUxObserver.unobserve(entry.target);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, { rootMargin: this.detectDistance });
|
|
44
|
+
}
|
|
45
|
+
window.EMUxObserver.observe(this.el);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.shouldLoad = true;
|
|
49
|
+
this.handleSrc();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return (h("img", { key: '2bb4dc391fc2f753514103e91c0abf065de3236a', ref: el => (this.image = el), style: this.styles, class: `${this.imgClass} ${this.imgLoaded ? 'Visible' : 'Hidden'}`, alt: this.alt, width: this.width, height: this.height, loading: "lazy" }));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "ui-image"; }
|
|
56
|
+
static get originalStyleUrls() {
|
|
57
|
+
return {
|
|
58
|
+
"$": ["ui-image.scss"]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static get styleUrls() {
|
|
62
|
+
return {
|
|
63
|
+
"$": ["ui-image.css"]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
static get properties() {
|
|
67
|
+
return {
|
|
68
|
+
"src": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "string",
|
|
73
|
+
"resolved": "string",
|
|
74
|
+
"references": {}
|
|
75
|
+
},
|
|
76
|
+
"required": false,
|
|
77
|
+
"optional": false,
|
|
78
|
+
"docs": {
|
|
79
|
+
"tags": [],
|
|
80
|
+
"text": "Source of the image"
|
|
81
|
+
},
|
|
82
|
+
"attribute": "src",
|
|
83
|
+
"reflect": false
|
|
84
|
+
},
|
|
85
|
+
"width": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "string",
|
|
90
|
+
"resolved": "string",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": "Width of the image"
|
|
98
|
+
},
|
|
99
|
+
"attribute": "width",
|
|
100
|
+
"reflect": false
|
|
101
|
+
},
|
|
102
|
+
"height": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "string",
|
|
107
|
+
"resolved": "string",
|
|
108
|
+
"references": {}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": "Height of the image"
|
|
115
|
+
},
|
|
116
|
+
"attribute": "height",
|
|
117
|
+
"reflect": false
|
|
118
|
+
},
|
|
119
|
+
"alt": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": "Alt of the image"
|
|
132
|
+
},
|
|
133
|
+
"attribute": "alt",
|
|
134
|
+
"reflect": false
|
|
135
|
+
},
|
|
136
|
+
"imgClass": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "string",
|
|
141
|
+
"resolved": "string",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "Allow external class for the inner image element"
|
|
149
|
+
},
|
|
150
|
+
"attribute": "img-class",
|
|
151
|
+
"reflect": false,
|
|
152
|
+
"defaultValue": "''"
|
|
153
|
+
},
|
|
154
|
+
"styles": {
|
|
155
|
+
"type": "any",
|
|
156
|
+
"mutable": false,
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "any",
|
|
159
|
+
"resolved": "any",
|
|
160
|
+
"references": {}
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"optional": false,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": "Allow inline styles"
|
|
167
|
+
},
|
|
168
|
+
"attribute": "styles",
|
|
169
|
+
"reflect": false
|
|
170
|
+
},
|
|
171
|
+
"detectDistance": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"mutable": false,
|
|
174
|
+
"complexType": {
|
|
175
|
+
"original": "string",
|
|
176
|
+
"resolved": "string",
|
|
177
|
+
"references": {}
|
|
178
|
+
},
|
|
179
|
+
"required": false,
|
|
180
|
+
"optional": false,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": "Distance for the image to be detected"
|
|
184
|
+
},
|
|
185
|
+
"attribute": "detect-distance",
|
|
186
|
+
"reflect": false,
|
|
187
|
+
"defaultValue": "'200px'"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static get states() {
|
|
192
|
+
return {
|
|
193
|
+
"imgLoaded": {},
|
|
194
|
+
"shouldLoad": {}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
static get elementRef() { return "el"; }
|
|
198
|
+
static get watchers() {
|
|
199
|
+
return [{
|
|
200
|
+
"propName": "src",
|
|
201
|
+
"methodName": "handleSrc"
|
|
202
|
+
}];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/ui-image';
|