@elmethis/vue 0.2.4 → 0.2.6
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.
|
@@ -17,6 +17,8 @@ export interface ElmImageProps {
|
|
|
17
17
|
* The margin of the image.
|
|
18
18
|
*/
|
|
19
19
|
margin?: Property.MarginBlock;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
20
22
|
}
|
|
21
23
|
declare const _default: import('vue').DefineComponent<ElmImageProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ElmImageProps> & Readonly<{}>, {
|
|
22
24
|
block: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, createElementBlock, openBlock, normalizeClass, createVNode, createElementVNode, Transition, unref, withCtx, createCommentVNode, normalizeStyle } from "vue";
|
|
2
2
|
import ElmRectangleWave from "../fallback/ElmRectangleWave.vue.mjs";
|
|
3
3
|
import ElmDotLoadingIcon from "../icon/ElmDotLoadingIcon.vue.mjs";
|
|
4
4
|
import { useImage, onKeyStroke, useIntersectionObserver } from "@vueuse/core";
|
|
@@ -6,8 +6,8 @@ import ElmInlineText from "../typography/ElmInlineText.vue.mjs";
|
|
|
6
6
|
import fadeStyle from "../../styles/transition-fade.module.scss.mjs";
|
|
7
7
|
import { mdiMessageImageOutline } from "@mdi/js";
|
|
8
8
|
import ElmMdiIcon from "../icon/ElmMdiIcon.vue.mjs";
|
|
9
|
-
const _hoisted_1 = ["src", "alt"];
|
|
10
|
-
const _hoisted_2 = ["src", "alt"];
|
|
9
|
+
const _hoisted_1 = ["src", "alt", "width", "height"];
|
|
10
|
+
const _hoisted_2 = ["src", "alt", "width", "height"];
|
|
11
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
12
|
__name: "ElmImage",
|
|
13
13
|
props: {
|
|
@@ -15,18 +15,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
alt: {},
|
|
16
16
|
block: { type: Boolean, default: false },
|
|
17
17
|
enableModal: { type: Boolean, default: false },
|
|
18
|
-
margin: {}
|
|
18
|
+
margin: {},
|
|
19
|
+
width: {},
|
|
20
|
+
height: {}
|
|
19
21
|
},
|
|
20
22
|
setup(__props) {
|
|
21
23
|
const props = __props;
|
|
22
24
|
const { isLoading, error } = useImage({ src: props.src });
|
|
23
|
-
const isLoaded = ref(false);
|
|
24
|
-
watch(
|
|
25
|
-
() => props.src,
|
|
26
|
-
() => {
|
|
27
|
-
isLoaded.value = false;
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
25
|
const isModalOpen = ref(false);
|
|
31
26
|
onKeyStroke("Escape", (e) => {
|
|
32
27
|
e.preventDefault();
|
|
@@ -44,6 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
39
|
ref: target
|
|
45
40
|
}, [
|
|
46
41
|
createVNode(Transition, {
|
|
42
|
+
mode: "out-in",
|
|
47
43
|
"enter-from-class": unref(fadeStyle)["fade-enter-from"],
|
|
48
44
|
"enter-active-class": unref(fadeStyle)["fade-enter-active"],
|
|
49
45
|
"enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
|
|
@@ -52,7 +48,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
48
|
"leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
|
|
53
49
|
}, {
|
|
54
50
|
default: withCtx(() => [
|
|
55
|
-
|
|
51
|
+
unref(error) ? (openBlock(), createElementBlock("div", {
|
|
52
|
+
key: 0,
|
|
56
53
|
class: normalizeClass(_ctx.$style.error)
|
|
57
54
|
}, [
|
|
58
55
|
createVNode(ElmInlineText, {
|
|
@@ -60,9 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
60
57
|
color: "#c56565",
|
|
61
58
|
size: "1.5rem"
|
|
62
59
|
})
|
|
63
|
-
], 2),
|
|
64
|
-
[vShow, unref(error)]
|
|
65
|
-
])
|
|
60
|
+
], 2)) : createCommentVNode("", true)
|
|
66
61
|
]),
|
|
67
62
|
_: 1
|
|
68
63
|
}, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
|
|
@@ -73,6 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
73
68
|
})
|
|
74
69
|
}, [
|
|
75
70
|
createVNode(Transition, {
|
|
71
|
+
mode: "out-in",
|
|
76
72
|
"enter-from-class": unref(fadeStyle)["fade-enter-from"],
|
|
77
73
|
"enter-active-class": unref(fadeStyle)["fade-enter-active"],
|
|
78
74
|
"enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
|
|
@@ -81,50 +77,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
81
77
|
"leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
|
|
82
78
|
}, {
|
|
83
79
|
default: withCtx(() => [
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
unref(isLoading) ? (openBlock(), createElementBlock("div", {
|
|
81
|
+
key: 0,
|
|
82
|
+
class: normalizeClass(_ctx.$style.fallback),
|
|
83
|
+
style: normalizeStyle({
|
|
84
|
+
"aspect-ratio": __props.width && __props.height ? `${__props.width} / ${__props.height}` : "1200 / 630",
|
|
85
|
+
width: __props.width && `${__props.width}px`,
|
|
86
|
+
height: __props.height && `${__props.height}px`
|
|
87
|
+
})
|
|
86
88
|
}, [
|
|
87
89
|
createVNode(ElmRectangleWave),
|
|
88
90
|
createElementVNode("div", null, [
|
|
89
91
|
createVNode(ElmDotLoadingIcon)
|
|
90
92
|
])
|
|
91
|
-
],
|
|
92
|
-
[vShow, unref(isLoading)]
|
|
93
|
-
])
|
|
93
|
+
], 6)) : createCommentVNode("", true)
|
|
94
94
|
]),
|
|
95
95
|
_: 1
|
|
96
96
|
}, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
style: normalizeStyle({
|
|
116
|
-
cursor: __props.enableModal ? "zoom-in" : void 0,
|
|
117
|
-
"--margin-block": __props.margin,
|
|
118
|
-
opacity: isLoaded.value && !unref(error) ? 1 : 0,
|
|
119
|
-
transition: "opacity 220ms ease",
|
|
120
|
-
pointerEvents: isLoaded.value && !unref(error) ? void 0 : "none"
|
|
121
|
-
})
|
|
122
|
-
}, null, 46, _hoisted_1)
|
|
123
|
-
]),
|
|
124
|
-
_: 1
|
|
125
|
-
}, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"])
|
|
97
|
+
createElementVNode("img", {
|
|
98
|
+
class: normalizeClass(__props.block ? _ctx.$style["image-block"] : _ctx.$style["image-inline"]),
|
|
99
|
+
src: __props.src,
|
|
100
|
+
alt: __props.alt,
|
|
101
|
+
width: __props.width,
|
|
102
|
+
height: __props.height,
|
|
103
|
+
onClick: _cache[0] || (_cache[0] = ($event) => {
|
|
104
|
+
if (__props.enableModal) isModalOpen.value = true;
|
|
105
|
+
}),
|
|
106
|
+
style: normalizeStyle({
|
|
107
|
+
"--margin-block": __props.margin,
|
|
108
|
+
"--width": __props.width && `${__props.width}px`,
|
|
109
|
+
"--height": __props.width && `${__props.height}px`,
|
|
110
|
+
cursor: __props.enableModal ? "zoom-in" : void 0,
|
|
111
|
+
opacity: !unref(isLoading) && !unref(error) ? 1 : 0,
|
|
112
|
+
pointerEvents: !unref(isLoading) && !unref(error) ? void 0 : "none"
|
|
113
|
+
})
|
|
114
|
+
}, null, 14, _hoisted_1)
|
|
126
115
|
], 6),
|
|
127
116
|
createVNode(Transition, {
|
|
117
|
+
mode: "out-in",
|
|
128
118
|
"enter-from-class": unref(fadeStyle)["fade-enter-from"],
|
|
129
119
|
"enter-active-class": unref(fadeStyle)["fade-enter-active"],
|
|
130
120
|
"enter-to-class": unref(fadeStyle)["fade-enter-to"],
|
|
@@ -139,7 +129,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
139
129
|
}, [
|
|
140
130
|
createVNode(ElmMdiIcon, {
|
|
141
131
|
d: unref(mdiMessageImageOutline),
|
|
142
|
-
color: "#
|
|
132
|
+
color: "#b69545",
|
|
143
133
|
style: { "flex-shrink": "0" }
|
|
144
134
|
}, null, 8, ["d"]),
|
|
145
135
|
createElementVNode("div", {
|
|
@@ -155,6 +145,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
155
145
|
_: 1
|
|
156
146
|
}, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
|
|
157
147
|
createVNode(Transition, {
|
|
148
|
+
mode: "out-in",
|
|
158
149
|
"enter-from-class": unref(fadeStyle)["fade-enter-from"],
|
|
159
150
|
"enter-active-class": unref(fadeStyle)["fade-enter-active"],
|
|
160
151
|
"enter-to-class": unref(fadeStyle)["fade-enter-to"],
|
|
@@ -166,12 +157,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
166
157
|
isModalOpen.value ? (openBlock(), createElementBlock("div", {
|
|
167
158
|
key: 0,
|
|
168
159
|
class: normalizeClass(_ctx.$style.modal),
|
|
169
|
-
onClick: _cache[
|
|
160
|
+
onClick: _cache[1] || (_cache[1] = ($event) => isModalOpen.value = false)
|
|
170
161
|
}, [
|
|
171
162
|
createElementVNode("img", {
|
|
172
163
|
class: normalizeClass(_ctx.$style["modal-image"]),
|
|
173
164
|
src: __props.src,
|
|
174
|
-
alt: __props.alt
|
|
165
|
+
alt: __props.alt,
|
|
166
|
+
width: __props.width,
|
|
167
|
+
height: __props.height
|
|
175
168
|
}, null, 10, _hoisted_2)
|
|
176
169
|
], 2)) : createCommentVNode("", true)
|
|
177
170
|
]),
|
|
@@ -3,34 +3,32 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode(".
|
|
6
|
+
elementStyle.appendChild(document.createTextNode("._wrapper_14s6t_1{display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;opacity:var(--opacity)}._error_14s6t_10{display:flex;justify-content:center;align-items:center;gap:1rem;width:100%;height:100%;min-height:10rem;line-height:1.5rem;color:#c56565}._image-frame_14s6t_22{position:relative;width:100%;display:grid;place-items:center;transition:opacity .2s}._fallback_14s6t_30{min-height:8rem;max-width:100%;z-index:2;display:flex;justify-content:center;align-items:center;grid-area:1/1}._image-block_14s6t_40,._image-inline_14s6t_40{display:block;grid-area:1/1;transition:opacity .2s ease .1s;z-index:0;width:auto;width:var(--width, auto);max-width:100%;height:auto;height:var(--height, auto)}._image-inline_14s6t_40{margin-block:0;margin-block:var(--margin-block, 0)}._image-block_14s6t_40{border-radius:.25rem;box-shadow:0 0 .125rem #0000004d}._alt-container_14s6t_59{max-width:80%;margin:1rem;display:flex;justify-content:center;align-items:center;gap:1rem;color:#6987b8;opacity:.8}._modal_14s6t_70{position:fixed;z-index:10;top:0;left:0;width:100%;height:100vh;display:flex;justify-content:center;align-items:center;background-color:#23262acc;cursor:zoom-out}._modal-image_14s6t_84{display:block;max-width:100%;cursor:zoom-out}"));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
const wrapper = "
|
|
14
|
-
const error = "
|
|
15
|
-
const fallback = "
|
|
16
|
-
const
|
|
17
|
-
const modal = "_modal_yva5m_74";
|
|
13
|
+
const wrapper = "_wrapper_14s6t_1";
|
|
14
|
+
const error = "_error_14s6t_10";
|
|
15
|
+
const fallback = "_fallback_14s6t_30";
|
|
16
|
+
const modal = "_modal_14s6t_70";
|
|
18
17
|
const style0 = {
|
|
19
18
|
wrapper,
|
|
20
19
|
error,
|
|
21
|
-
"image-frame": "_image-
|
|
20
|
+
"image-frame": "_image-frame_14s6t_22",
|
|
22
21
|
fallback,
|
|
23
|
-
image,
|
|
24
|
-
"image-
|
|
25
|
-
"alt-container": "_alt-
|
|
22
|
+
"image-block": "_image-block_14s6t_40",
|
|
23
|
+
"image-inline": "_image-inline_14s6t_40",
|
|
24
|
+
"alt-container": "_alt-container_14s6t_59",
|
|
26
25
|
modal,
|
|
27
|
-
"modal-image": "_modal-
|
|
26
|
+
"modal-image": "_modal-image_14s6t_84"
|
|
28
27
|
};
|
|
29
28
|
export {
|
|
30
29
|
style0 as default,
|
|
31
30
|
error,
|
|
32
31
|
fallback,
|
|
33
|
-
image,
|
|
34
32
|
modal,
|
|
35
33
|
wrapper
|
|
36
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elmethis/vue",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"mermaid": "^11.12.2",
|
|
32
32
|
"nanoid": "^5.1.6",
|
|
33
33
|
"polished": "^4.3.1",
|
|
34
|
-
"shiki": "^3.
|
|
34
|
+
"shiki": "^3.21.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@ag-ui/core": "^0.0.42",
|
|
38
38
|
"@notionhq/client": "^5.6.0",
|
|
39
|
-
"@storybook/vue3-vite": "10.1.
|
|
39
|
+
"@storybook/vue3-vite": "10.1.11",
|
|
40
40
|
"@types/json-schema": "^7.0.15",
|
|
41
41
|
"@types/katex": "^0.16.7",
|
|
42
42
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"jarkup-ts": "^0.6.0",
|
|
47
47
|
"openapi-types": "^12.1.3",
|
|
48
48
|
"postcss": "^8.5.6",
|
|
49
|
-
"postcss-preset-env": "^10.
|
|
50
|
-
"sass": "^1.97.
|
|
51
|
-
"vite": "^7.3.
|
|
49
|
+
"postcss-preset-env": "^10.6.0",
|
|
50
|
+
"sass": "^1.97.2",
|
|
51
|
+
"vite": "^7.3.1",
|
|
52
52
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
53
53
|
"vite-plugin-dts": "^4.5.4",
|
|
54
|
-
"vue-tsc": "^3.2.
|
|
54
|
+
"vue-tsc": "^3.2.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vue": "^3.4.0"
|