@elmethis/vue 0.2.5 → 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, 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,7 +15,9 @@ 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;
@@ -37,6 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
39
  ref: target
38
40
  }, [
39
41
  createVNode(Transition, {
42
+ mode: "out-in",
40
43
  "enter-from-class": unref(fadeStyle)["fade-enter-from"],
41
44
  "enter-active-class": unref(fadeStyle)["fade-enter-active"],
42
45
  "enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
@@ -45,7 +48,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
48
  "leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
46
49
  }, {
47
50
  default: withCtx(() => [
48
- withDirectives(createElementVNode("div", {
51
+ unref(error) ? (openBlock(), createElementBlock("div", {
52
+ key: 0,
49
53
  class: normalizeClass(_ctx.$style.error)
50
54
  }, [
51
55
  createVNode(ElmInlineText, {
@@ -53,9 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
53
57
  color: "#c56565",
54
58
  size: "1.5rem"
55
59
  })
56
- ], 2), [
57
- [vShow, unref(error)]
58
- ])
60
+ ], 2)) : createCommentVNode("", true)
59
61
  ]),
60
62
  _: 1
61
63
  }, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
@@ -66,6 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
66
68
  })
67
69
  }, [
68
70
  createVNode(Transition, {
71
+ mode: "out-in",
69
72
  "enter-from-class": unref(fadeStyle)["fade-enter-from"],
70
73
  "enter-active-class": unref(fadeStyle)["fade-enter-active"],
71
74
  "enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
@@ -74,48 +77,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
74
77
  "leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
75
78
  }, {
76
79
  default: withCtx(() => [
77
- withDirectives(createElementVNode("div", {
78
- 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
+ })
79
88
  }, [
80
89
  createVNode(ElmRectangleWave),
81
90
  createElementVNode("div", null, [
82
91
  createVNode(ElmDotLoadingIcon)
83
92
  ])
84
- ], 2), [
85
- [vShow, unref(isLoading)]
86
- ])
93
+ ], 6)) : createCommentVNode("", true)
87
94
  ]),
88
95
  _: 1
89
96
  }, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
90
- createVNode(Transition, {
91
- "enter-from-class": unref(fadeStyle)["fade-enter-from"],
92
- "enter-active-class": unref(fadeStyle)["fade-enter-active"],
93
- "enter-to-class": unref(fadeStyle)["fade-fast-enter-to"],
94
- "leave-from-class": unref(fadeStyle)["fade-fast-leave-from"],
95
- "leave-active-class": unref(fadeStyle)["fade-fast-leave-active"],
96
- "leave-to-class": unref(fadeStyle)["fade-fast-leave-to"]
97
- }, {
98
- default: withCtx(() => [
99
- createElementVNode("img", {
100
- class: normalizeClass(__props.block ? _ctx.$style["image-block"] : _ctx.$style.image),
101
- src: __props.src,
102
- alt: __props.alt,
103
- onClick: _cache[0] || (_cache[0] = ($event) => {
104
- if (__props.enableModal) isModalOpen.value = true;
105
- }),
106
- style: normalizeStyle({
107
- cursor: __props.enableModal ? "zoom-in" : void 0,
108
- "--margin-block": __props.margin,
109
- opacity: !unref(isLoading) && !unref(error) ? 1 : 0,
110
- transition: "opacity 220ms ease",
111
- pointerEvents: !unref(isLoading) && !unref(error) ? void 0 : "none"
112
- })
113
- }, null, 14, _hoisted_1)
114
- ]),
115
- _: 1
116
- }, 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)
117
115
  ], 6),
118
116
  createVNode(Transition, {
117
+ mode: "out-in",
119
118
  "enter-from-class": unref(fadeStyle)["fade-enter-from"],
120
119
  "enter-active-class": unref(fadeStyle)["fade-enter-active"],
121
120
  "enter-to-class": unref(fadeStyle)["fade-enter-to"],
@@ -130,7 +129,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
130
129
  }, [
131
130
  createVNode(ElmMdiIcon, {
132
131
  d: unref(mdiMessageImageOutline),
133
- color: "#6987b8",
132
+ color: "#b69545",
134
133
  style: { "flex-shrink": "0" }
135
134
  }, null, 8, ["d"]),
136
135
  createElementVNode("div", {
@@ -146,6 +145,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
146
145
  _: 1
147
146
  }, 8, ["enter-from-class", "enter-active-class", "enter-to-class", "leave-from-class", "leave-active-class", "leave-to-class"]),
148
147
  createVNode(Transition, {
148
+ mode: "out-in",
149
149
  "enter-from-class": unref(fadeStyle)["fade-enter-from"],
150
150
  "enter-active-class": unref(fadeStyle)["fade-enter-active"],
151
151
  "enter-to-class": unref(fadeStyle)["fade-enter-to"],
@@ -162,7 +162,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
162
162
  createElementVNode("img", {
163
163
  class: normalizeClass(_ctx.$style["modal-image"]),
164
164
  src: __props.src,
165
- alt: __props.alt
165
+ alt: __props.alt,
166
+ width: __props.width,
167
+ height: __props.height
166
168
  }, null, 10, _hoisted_2)
167
169
  ], 2)) : createCommentVNode("", true)
168
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.5",
3
+ "version": "0.2.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,7 +31,7 @@
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",
@@ -47,11 +47,11 @@
47
47
  "openapi-types": "^12.1.3",
48
48
  "postcss": "^8.5.6",
49
49
  "postcss-preset-env": "^10.6.0",
50
- "sass": "^1.97.1",
51
- "vite": "^7.3.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"