@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.
@@ -7,3 +7,6 @@ export declare const Primary: Story;
7
7
  export declare const Svg: Story;
8
8
  export declare const LongAlt: Story;
9
9
  export declare const Invalid: Story;
10
+ export declare const Landscape: Story;
11
+ export declare const Portrait: Story;
12
+ export declare const Square: Story;
@@ -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, watch, createElementBlock, openBlock, normalizeClass, createVNode, createElementVNode, Transition, unref, withCtx, withDirectives, vShow, normalizeStyle, createCommentVNode } from "vue";
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
- withDirectives(createElementVNode("div", {
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
- withDirectives(createElementVNode("div", {
85
- class: normalizeClass(_ctx.$style.fallback)
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
- ], 2), [
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
- createVNode(Transition, {
98
- "enter-from-class": unref(fadeStyle)["fade-enter-from"],
99
- "enter-active-class": unref(fadeStyle)["fade-enter-active"],
100
- "enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
101
- "leave-from-class": unref(fadeStyle)["fade-fast-leave-from"],
102
- "leave-active-class": unref(fadeStyle)["fade-fast-leave-active"],
103
- "leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
104
- }, {
105
- default: withCtx(() => [
106
- createElementVNode("img", {
107
- class: normalizeClass(__props.block ? _ctx.$style["image-block"] : _ctx.$style.image),
108
- src: __props.src,
109
- alt: __props.alt,
110
- onClick: _cache[0] || (_cache[0] = ($event) => {
111
- if (__props.enableModal) isModalOpen.value = true;
112
- }),
113
- onLoad: _cache[1] || (_cache[1] = ($event) => isLoaded.value = true),
114
- onError: _cache[2] || (_cache[2] = ($event) => isLoaded.value = false),
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: "#6987b8",
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[3] || (_cache[3] = ($event) => isModalOpen.value = false)
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("._wrapper_yva5m_1{width:100%;display:flex;flex-direction:column;align-items:center;opacity:var(--opacity);transition:opacity .4s}._error_yva5m_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_yva5m_22{position:relative;width:100%;aspect-ratio:1200/630}._fallback_yva5m_28{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2;display:flex;justify-content:center;align-items:center;aspect-ratio:1200/630}._image_yva5m_22{display:block;margin-block:var(--margin-block);max-width:100%;max-height:100vh;transition:opacity .22s ease;z-index:0}._image-block_yva5m_50{position:absolute;inset:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden;border-radius:.25rem;box-shadow:0 0 .125rem #0000004d;z-index:0;transition:opacity .22s ease}._alt-container_yva5m_63{max-width:80%;margin:1rem;display:flex;justify-content:center;align-items:center;gap:1rem;color:#6987b8;opacity:.8}._modal_yva5m_74{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_yva5m_88{display:block;max-width:100%;cursor:zoom-out}"));
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 = "_wrapper_yva5m_1";
14
- const error = "_error_yva5m_10";
15
- const fallback = "_fallback_yva5m_28";
16
- const image = "_image_yva5m_22";
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-frame_yva5m_22",
20
+ "image-frame": "_image-frame_14s6t_22",
22
21
  fallback,
23
- image,
24
- "image-block": "_image-block_yva5m_50",
25
- "alt-container": "_alt-container_yva5m_63",
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-image_yva5m_88"
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.4",
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.20.0"
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.10",
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.5.0",
50
- "sass": "^1.97.1",
51
- "vite": "^7.3.0",
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.1"
54
+ "vue-tsc": "^3.2.2"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vue": "^3.4.0"