@elmethis/core 1.0.0-alpha.180 → 1.0.0-alpha.182

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.
@@ -1,10 +1,12 @@
1
- import { ElmImageProps } from './ElmImage.vue';
2
- export type ElmBlockImageProps = {
3
- rounded?: boolean;
4
- shadow?: boolean;
5
- } & ElmImageProps;
6
- declare const _default: import('vue').DefineComponent<ElmBlockImageProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ElmBlockImageProps> & Readonly<{}>, {
7
- rounded: boolean;
8
- shadow: boolean;
9
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
1
+ export interface ElmBlockImageProps {
2
+ /**
3
+ * Image source URL
4
+ */
5
+ src: string;
6
+ /**
7
+ * Image alt text
8
+ */
9
+ alt?: string;
10
+ }
11
+ declare const _default: import('vue').DefineComponent<ElmBlockImageProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ElmBlockImageProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
12
  export default _default;
@@ -0,0 +1,22 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode(".v-enter-to[data-v-50369c29],.v-leave-from[data-v-50369c29]{opacity:1}.v-enter-active[data-v-50369c29],.v-leave-active[data-v-50369c29]{transition:opacity .3s}.v-enter-from[data-v-50369c29],.v-leave-to[data-v-50369c29]{opacity:0}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ import _sfc_main from "./ElmBlockImage.vue2.mjs";
14
+ import style0 from "./ElmBlockImage.vue3.mjs";
15
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
16
+ const cssModules = {
17
+ "$style": style0
18
+ };
19
+ const ElmBlockImage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-50369c29"]]);
20
+ export {
21
+ ElmBlockImage as default
22
+ };
@@ -0,0 +1,91 @@
1
+ import { defineComponent, ref, createElementBlock, openBlock, Fragment, createElementVNode, createVNode, Transition, withCtx, unref, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
2
+ import ElmRectangleWave from "../fallback/ElmRectangleWave.vue.mjs";
3
+ import ElmDotLoadingIcon from "../icon/ElmDotLoadingIcon.vue.mjs";
4
+ import { useImage, onKeyStroke } from "@vueuse/core";
5
+ import ElmInlineText from "../inline/ElmInlineText.vue.mjs";
6
+ const _hoisted_1 = { style: { marginBlock: "2rem" } };
7
+ const _hoisted_2 = ["src", "alt"];
8
+ const _hoisted_3 = ["src", "alt"];
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "ElmBlockImage",
11
+ props: {
12
+ src: {},
13
+ alt: {}
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const { isLoading, error } = useImage({ src: props.src });
18
+ const isModalOpen = ref(false);
19
+ onKeyStroke("Escape", (e) => {
20
+ e.preventDefault();
21
+ isModalOpen.value = false;
22
+ });
23
+ return (_ctx, _cache) => {
24
+ return openBlock(), createElementBlock(Fragment, null, [
25
+ createElementVNode("div", _hoisted_1, [
26
+ createVNode(Transition, { mode: "out-in" }, {
27
+ default: withCtx(() => [
28
+ unref(error) ? (openBlock(), createElementBlock("div", {
29
+ key: 0,
30
+ class: normalizeClass(_ctx.$style.error)
31
+ }, [
32
+ createVNode(ElmInlineText, {
33
+ text: "Error loading image",
34
+ color: "#c56565",
35
+ size: "1.5rem"
36
+ })
37
+ ], 2)) : unref(isLoading) ? (openBlock(), createElementBlock("div", {
38
+ key: 1,
39
+ class: normalizeClass(_ctx.$style.fallback)
40
+ }, [
41
+ createVNode(ElmRectangleWave),
42
+ createElementVNode("div", null, [
43
+ createVNode(ElmDotLoadingIcon)
44
+ ])
45
+ ], 2)) : (openBlock(), createElementBlock("div", {
46
+ key: 2,
47
+ class: normalizeClass(_ctx.$style.container)
48
+ }, [
49
+ createElementVNode("img", {
50
+ class: normalizeClass(_ctx.$style.image),
51
+ src: _ctx.src,
52
+ alt: _ctx.alt,
53
+ onClick: _cache[0] || (_cache[0] = () => {
54
+ isModalOpen.value = true;
55
+ }),
56
+ style: normalizeStyle({
57
+ "--height": unref(isLoading) ? "0" : "auto",
58
+ "--opacity": unref(isLoading) ? 0 : 1,
59
+ display: unref(isLoading) ? "none" : "block"
60
+ })
61
+ }, null, 14, _hoisted_2)
62
+ ], 2))
63
+ ]),
64
+ _: 1
65
+ })
66
+ ]),
67
+ createVNode(Transition, null, {
68
+ default: withCtx(() => [
69
+ isModalOpen.value ? (openBlock(), createElementBlock("div", {
70
+ key: 0,
71
+ class: normalizeClass(_ctx.$style.modal)
72
+ }, [
73
+ createElementVNode("img", {
74
+ class: normalizeClass(_ctx.$style["modal-image"]),
75
+ src: _ctx.src,
76
+ alt: _ctx.alt,
77
+ onClick: _cache[1] || (_cache[1] = () => {
78
+ isModalOpen.value = false;
79
+ })
80
+ }, null, 10, _hoisted_3)
81
+ ], 2)) : createCommentVNode("", true)
82
+ ]),
83
+ _: 1
84
+ })
85
+ ], 64);
86
+ };
87
+ }
88
+ });
89
+ export {
90
+ _sfc_main as default
91
+ };
@@ -0,0 +1,33 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("._container_7f0ob_1{overflow:hidden;border-radius:.25rem;box-shadow:0 0 .25rem #0000004d}._image_7f0ob_7{display:block;max-width:100%;height:var(--height);opacity:var(--opacity);transition:opacity .4s;cursor:zoom-in}._error_7f0ob_16{display:flex;justify-content:center;align-items:center;gap:1rem;width:100%;height:100%;min-height:10rem;line-height:1.5rem;color:#c56565}._fallback_7f0ob_28{margin-block:1rem;margin:0;padding:0;position:relative;width:100%;z-index:1;display:flex;justify-content:center;align-items:center;aspect-ratio:1200/630}._modal_7f0ob_41{z-index:1000;position:fixed;width:100%;height:100vh;top:0;left:0;background-color:#000000b3;display:flex;justify-content:center;align-items:center;cursor:zoom-out}._modal_7f0ob_41 ._modal-image_7f0ob_54{width:100vw;height:100vh;-o-object-fit:contain;object-fit:contain}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const container = "_container_7f0ob_1";
14
+ const image = "_image_7f0ob_7";
15
+ const error = "_error_7f0ob_16";
16
+ const fallback = "_fallback_7f0ob_28";
17
+ const modal = "_modal_7f0ob_41";
18
+ const style0 = {
19
+ container,
20
+ image,
21
+ error,
22
+ fallback,
23
+ modal,
24
+ "modal-image": "_modal-image_7f0ob_54"
25
+ };
26
+ export {
27
+ container,
28
+ style0 as default,
29
+ error,
30
+ fallback,
31
+ image,
32
+ modal
33
+ };
@@ -22,14 +22,15 @@ import { ElmTableRowProps } from '../table/ElmTableRow.vue';
22
22
  import { ElmTableCellProps } from '../table/ElmTableCell.vue';
23
23
  import { ElmKatexProps } from '../code/ElmKatex.vue';
24
24
  import { ElmImageProps } from '../media/ElmImage.vue';
25
+ import { ElmBlockImageProps } from '../media/ElmBlockImage.vue';
25
26
  import { ElmBookmarkProps } from '../navigation/ElmBookmark.vue';
26
27
  import { ElmToggleProps } from '../containments/ElmToggle.vue';
27
28
  import { ElmCheckboxProps } from '../form/ElmCheckbox.vue';
28
29
  import { ElmFileProps } from '../media/ElmFile.vue';
29
30
  import { ElmColumnProps } from '../containments/ElmColumn.vue';
30
31
  import { ElmColumnListProps } from '../containments/ElmColumnList.vue';
31
- type ComponentType = 'ElmInlineText' | 'ElmInlineLink' | 'ElmInlineIcon' | 'ElmCallout' | 'ElmBulletedList' | 'ElmNumberedList' | 'ElmListItem' | 'ElmBlockQuote' | 'ElmDivider' | 'ElmHeading1' | 'ElmHeading2' | 'ElmHeading3' | 'ElmHeading4' | 'ElmHeading5' | 'ElmHeading6' | 'ElmCodeBlock' | 'ElmParagraph' | 'ElmTable' | 'ElmTableHeader' | 'ElmTableBody' | 'ElmTableRow' | 'ElmTableCell' | 'ElmKatex' | 'ElmImage' | 'ElmBookmark' | 'ElmToggle' | 'ElmCheckbox' | 'ElmFile' | 'ElmColumn' | 'ElmColumnList';
32
- type ComponentProps = ElmInlineTextProps | ElmInlineLinkProps | ElmInlineIconProps | ElmCalloutProps | ElmBulletedListProps | ElmNumberedListProps | ElmListItemProps | ElmBlockQuoteProps | ElmDividerProps | ElmHeading1Props | ElmHeading2Props | ElmHeading3Props | ElmHeading4Props | ElmHeading5Props | ElmHeading6Props | ElmCodeBlockProps | ElmParagraphProps | ElmTableProps | ElmTableHeaderProps | ElmTableBodyProps | ElmTableRowProps | ElmTableCellProps | ElmKatexProps | ElmImageProps | ElmBookmarkProps | ElmToggleProps | ElmCheckboxProps | ElmFileProps | ElmColumnProps | ElmColumnListProps;
32
+ type ComponentType = 'ElmInlineText' | 'ElmInlineLink' | 'ElmInlineIcon' | 'ElmCallout' | 'ElmBulletedList' | 'ElmNumberedList' | 'ElmListItem' | 'ElmBlockQuote' | 'ElmDivider' | 'ElmHeading1' | 'ElmHeading2' | 'ElmHeading3' | 'ElmHeading4' | 'ElmHeading5' | 'ElmHeading6' | 'ElmCodeBlock' | 'ElmParagraph' | 'ElmTable' | 'ElmTableHeader' | 'ElmTableBody' | 'ElmTableRow' | 'ElmTableCell' | 'ElmKatex' | 'ElmImage' | 'ElmBlockImage' | 'ElmBookmark' | 'ElmToggle' | 'ElmCheckbox' | 'ElmFile' | 'ElmColumn' | 'ElmColumnList';
33
+ type ComponentProps = ElmInlineTextProps | ElmInlineLinkProps | ElmInlineIconProps | ElmCalloutProps | ElmBulletedListProps | ElmNumberedListProps | ElmListItemProps | ElmBlockQuoteProps | ElmDividerProps | ElmHeading1Props | ElmHeading2Props | ElmHeading3Props | ElmHeading4Props | ElmHeading5Props | ElmHeading6Props | ElmCodeBlockProps | ElmParagraphProps | ElmTableProps | ElmTableHeaderProps | ElmTableBodyProps | ElmTableRowProps | ElmTableCellProps | ElmKatexProps | ElmImageProps | ElmBlockImageProps | ElmBookmarkProps | ElmToggleProps | ElmCheckboxProps | ElmFileProps | ElmColumnProps | ElmColumnListProps;
33
34
  interface JsonComponentBase {
34
35
  type: ComponentType;
35
36
  id?: string;
@@ -156,6 +157,11 @@ interface ElmImageJsonComponent extends JsonComponentBase {
156
157
  id?: string;
157
158
  props?: ElmImageProps;
158
159
  }
160
+ interface ElmBlockImageJsonComponent extends JsonComponentBase {
161
+ type: 'ElmBlockImage';
162
+ id?: string;
163
+ props?: ElmBlockImageProps;
164
+ }
159
165
  interface ElmBookmarkJsonComponent extends JsonComponentBase {
160
166
  type: 'ElmBookmark';
161
167
  id?: string;
@@ -186,7 +192,7 @@ interface ElmColumnListJsonComponent extends JsonComponentBase {
186
192
  id?: string;
187
193
  props?: ElmColumnListProps;
188
194
  }
189
- type JsonComponent = ElmInlineTextJsonComponent | ElmInlineLinkJsonComponent | ElmInlineIconJsonComponent | ElmCalloutJsonComponent | ElmBulletedListJsonComponent | ElmNumberedListJsonComponent | ElmListItemJsonComponent | ElmBlockQuoteJsonComponent | ElmDividerJsonComponent | ElmHeading1JsonComponent | ElmHeading2JsonComponent | ElmHeading3JsonComponent | ElmHeading4JsonComponent | ElmHeading5JsonComponent | ElmHeading6JsonComponent | ElmCodeBlockJsonComponent | ElmParagraphJsonComponent | ElmTableJsonComponent | ElmTableHeaderJsonComponent | ElmTableBodyJsonComponent | ElmTableRowJsonComponent | ElmTableCellJsonComponent | ElmKatexJsonComponent | ElmImageJsonComponent | ElmBookmarkJsonComponent | ElmToggleJsonComponent | ElmCheckboxJsonComponent | ElmFileJsonComponent | ElmColumnJsonComponent | ElmColumnListJsonComponent;
195
+ type JsonComponent = ElmInlineTextJsonComponent | ElmInlineLinkJsonComponent | ElmInlineIconJsonComponent | ElmCalloutJsonComponent | ElmBulletedListJsonComponent | ElmNumberedListJsonComponent | ElmListItemJsonComponent | ElmBlockQuoteJsonComponent | ElmDividerJsonComponent | ElmHeading1JsonComponent | ElmHeading2JsonComponent | ElmHeading3JsonComponent | ElmHeading4JsonComponent | ElmHeading5JsonComponent | ElmHeading6JsonComponent | ElmCodeBlockJsonComponent | ElmParagraphJsonComponent | ElmTableJsonComponent | ElmTableHeaderJsonComponent | ElmTableBodyJsonComponent | ElmTableRowJsonComponent | ElmTableCellJsonComponent | ElmKatexJsonComponent | ElmImageJsonComponent | ElmBlockImageJsonComponent | ElmBookmarkJsonComponent | ElmToggleJsonComponent | ElmCheckboxJsonComponent | ElmFileJsonComponent | ElmColumnJsonComponent | ElmColumnListJsonComponent;
190
196
  export interface ElmJsonRendererProps {
191
197
  json: JsonComponent[];
192
198
  }
@@ -71,6 +71,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
71
71
  );
72
72
  const ElmKatex = defineAsyncComponent(() => import("../code/ElmKatex.vue.mjs"));
73
73
  const ElmImage = defineAsyncComponent(() => import("../media/ElmImage.vue.mjs"));
74
+ const ElmBlockImage = defineAsyncComponent(
75
+ () => import("../media/ElmBlockImage.vue.mjs")
76
+ );
74
77
  const ElmBookmark = defineAsyncComponent(
75
78
  () => import("../navigation/ElmBookmark.vue.mjs")
76
79
  );
@@ -112,6 +115,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
112
115
  ElmTableCell: markRaw(ElmTableCell),
113
116
  ElmKatex: markRaw(ElmKatex),
114
117
  ElmImage: markRaw(ElmImage),
118
+ ElmBlockImage: markRaw(ElmBlockImage),
115
119
  ElmBookmark: markRaw(ElmBookmark),
116
120
  ElmToggle: markRaw(ElmToggle),
117
121
  ElmCheckbox: markRaw(ElmCheckbox),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elmethis/core",
3
- "version": "1.0.0-alpha.180",
3
+ "version": "1.0.0-alpha.182",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },