vira 2.4.0 → 2.5.1
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.
|
@@ -39,4 +39,7 @@ export declare const ViraImage: import("element-vir").DeclarativeElementDefiniti
|
|
|
39
39
|
erroredUrls: Readonly<{
|
|
40
40
|
[url: string]: true;
|
|
41
41
|
}>;
|
|
42
|
-
}, {
|
|
42
|
+
}, {
|
|
43
|
+
imageLoad: import("element-vir").DefinedTypedEventNameDefinition<void>;
|
|
44
|
+
imageError: import("element-vir").DefinedTypedEventNameDefinition<unknown>;
|
|
45
|
+
}, "vira-image-height-constrained", `vira-image-${string}`, import("lit-html").HTMLTemplateResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { wait } from '@augment-vir/common';
|
|
2
|
-
import { classMap, css, html, listen, renderIf } from 'element-vir';
|
|
2
|
+
import { classMap, css, defineElementEvent, html, listen, renderIf } from 'element-vir';
|
|
3
3
|
import { LoaderAnimated24Icon, StatusFailure24Icon } from '../../icons';
|
|
4
4
|
import { defineViraElement } from '../define-vira-element';
|
|
5
5
|
import { ViraIcon } from '../vira-icon/vira-icon.element';
|
|
@@ -20,6 +20,10 @@ export const ViraImage = defineViraElement()({
|
|
|
20
20
|
hostClasses: {
|
|
21
21
|
'vira-image-height-constrained': ({ inputs }) => inputs.dominantDimension === 'height',
|
|
22
22
|
},
|
|
23
|
+
events: {
|
|
24
|
+
imageLoad: defineElementEvent(),
|
|
25
|
+
imageError: defineElementEvent(),
|
|
26
|
+
},
|
|
23
27
|
styles: ({ hostClasses }) => css `
|
|
24
28
|
:host {
|
|
25
29
|
display: inline-flex;
|
|
@@ -79,7 +83,7 @@ export const ViraImage = defineViraElement()({
|
|
|
79
83
|
*/
|
|
80
84
|
erroredUrls: {},
|
|
81
85
|
},
|
|
82
|
-
renderCallback({ inputs, state, updateState }) {
|
|
86
|
+
renderCallback({ inputs, state, updateState, dispatch, events }) {
|
|
83
87
|
/**
|
|
84
88
|
* Saved off for use in the image listeners. This is used to eliminate race conditions
|
|
85
89
|
* between image events and the input URL changing.
|
|
@@ -93,10 +97,10 @@ export const ViraImage = defineViraElement()({
|
|
|
93
97
|
`
|
|
94
98
|
: !state.loadedUrls[imageUrl]
|
|
95
99
|
? html `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
<slot class="status-wrapper" name=${ViraImageSlotNameEnum.Loading}>
|
|
101
|
+
<${ViraIcon.assign({ icon: LoaderAnimated24Icon })}></${ViraIcon}>
|
|
102
|
+
</slot>
|
|
103
|
+
`
|
|
100
104
|
: undefined;
|
|
101
105
|
return html `
|
|
102
106
|
${renderIf(!!statusTemplate, statusTemplate)}
|
|
@@ -114,8 +118,9 @@ export const ViraImage = defineViraElement()({
|
|
|
114
118
|
[imageUrl]: true,
|
|
115
119
|
},
|
|
116
120
|
});
|
|
121
|
+
dispatch(new events.imageLoad());
|
|
117
122
|
})}
|
|
118
|
-
${listen('error', async () => {
|
|
123
|
+
${listen('error', async (event) => {
|
|
119
124
|
if (inputs._debugLoadDelay) {
|
|
120
125
|
await wait(inputs._debugLoadDelay.milliseconds);
|
|
121
126
|
}
|
|
@@ -125,6 +130,7 @@ export const ViraImage = defineViraElement()({
|
|
|
125
130
|
[imageUrl]: true,
|
|
126
131
|
},
|
|
127
132
|
});
|
|
133
|
+
dispatch(new events.imageError(event.error));
|
|
128
134
|
})}
|
|
129
135
|
src=${imageUrl}
|
|
130
136
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -40,27 +40,27 @@
|
|
|
40
40
|
"test:docs": "virmator docs check"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@augment-vir/browser": "^21.
|
|
44
|
-
"@augment-vir/common": "^21.
|
|
43
|
+
"@augment-vir/browser": "^21.6.0",
|
|
44
|
+
"@augment-vir/common": "^21.6.0",
|
|
45
45
|
"colorjs.io": "^0.4.5",
|
|
46
|
-
"date-vir": "^
|
|
46
|
+
"date-vir": "^4.1.0",
|
|
47
47
|
"element-vir": "^16.5.2",
|
|
48
48
|
"lit-css-vars": "^3.0.2",
|
|
49
49
|
"spa-router-vir": "^3.0.2",
|
|
50
|
-
"type-fest": "^4.
|
|
50
|
+
"type-fest": "^4.7.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@augment-vir/browser-testing": "^21.
|
|
54
|
-
"@augment-vir/node-js": "^21.
|
|
53
|
+
"@augment-vir/browser-testing": "^21.6.0",
|
|
54
|
+
"@augment-vir/node-js": "^21.6.0",
|
|
55
55
|
"@open-wc/testing": "^4.0.0",
|
|
56
|
-
"@types/chai": "^4.3.
|
|
56
|
+
"@types/chai": "^4.3.10",
|
|
57
57
|
"@types/mocha": "^10.0.4",
|
|
58
|
-
"@web/dev-server-esbuild": "^1.0.
|
|
58
|
+
"@web/dev-server-esbuild": "^1.0.1",
|
|
59
59
|
"@web/test-runner": "^0.18.0",
|
|
60
60
|
"@web/test-runner-commands": "^0.9.0",
|
|
61
61
|
"@web/test-runner-playwright": "^0.11.0",
|
|
62
62
|
"@web/test-runner-visual-regression": "^0.9.0",
|
|
63
|
-
"dependency-cruiser": "^15.
|
|
63
|
+
"dependency-cruiser": "^15.3.0",
|
|
64
64
|
"element-book": "^10.1.5",
|
|
65
65
|
"esbuild": "^0.19.5",
|
|
66
66
|
"istanbul-smart-text-reporter": "^1.1.2",
|