@elmethis/react 0.2.0 → 0.2.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.
@@ -0,0 +1,52 @@
1
+ import { j as jsxRuntimeExports } from "../../_virtual/jsx-runtime.mjs";
2
+ import { c as compilerRuntimeExports } from "../../_virtual/compiler-runtime.mjs";
3
+ import "react";
4
+ import style from "./ElmMdiIcon.module.scss.mjs";
5
+ const ElmMdiIcon = (t0) => {
6
+ const $ = compilerRuntimeExports.c(9);
7
+ const {
8
+ size: t1,
9
+ d,
10
+ color,
11
+ lightColor,
12
+ darkColor
13
+ } = t0;
14
+ const size = t1 === void 0 ? "1rem" : t1;
15
+ const t2 = lightColor ?? color;
16
+ const t3 = darkColor ?? color;
17
+ let t4;
18
+ if ($[0] !== t2 || $[1] !== t3) {
19
+ t4 = {
20
+ "--color": t2,
21
+ "--dark-color": t3
22
+ };
23
+ $[0] = t2;
24
+ $[1] = t3;
25
+ $[2] = t4;
26
+ } else {
27
+ t4 = $[2];
28
+ }
29
+ const t5 = t4;
30
+ let t6;
31
+ if ($[3] !== d) {
32
+ t6 = /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d });
33
+ $[3] = d;
34
+ $[4] = t6;
35
+ } else {
36
+ t6 = $[4];
37
+ }
38
+ let t7;
39
+ if ($[5] !== size || $[6] !== t5 || $[7] !== t6) {
40
+ t7 = /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: style.icon, viewBox: "0 0 24 24", width: size, height: size, focusable: "false", role: "img", style: t5, children: t6 });
41
+ $[5] = size;
42
+ $[6] = t5;
43
+ $[7] = t6;
44
+ $[8] = t7;
45
+ } else {
46
+ t7 = $[8];
47
+ }
48
+ return t7;
49
+ };
50
+ export {
51
+ ElmMdiIcon
52
+ };
@@ -0,0 +1,20 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("._icon_67eyp_1{fill:#555b67;fill:var(--color, #555b67);transition:fill .2s;flex-shrink:0}[data-theme=dark] ._icon_67eyp_1{fill:#b0b5be;fill:var(--dark-color, #b0b5be)}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const icon = "_icon_67eyp_1";
14
+ const style = {
15
+ icon
16
+ };
17
+ export {
18
+ style as default,
19
+ icon
20
+ };
@@ -0,0 +1,164 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode('@charset "UTF-8";.fade-enter{opacity:0}.fade-enter-active{opacity:1;transition:opacity .3s}.fade-exit{opacity:1}.fade-exit-active{opacity:0;transition:opacity .3s}'));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ import { j as jsxRuntimeExports } from "../../_virtual/jsx-runtime.mjs";
14
+ import { c as compilerRuntimeExports } from "../../_virtual/compiler-runtime.mjs";
15
+ import { useRef, useState, useEffect } from "react";
16
+ import style from "./ElmImage.module.scss.mjs";
17
+ import { ElmInlineText } from "../typography/ElmInlineText.mjs";
18
+ import { mdiTooltipImage } from "@mdi/js";
19
+ import { ElmMdiIcon } from "../icon/ElmMdiIcon.mjs";
20
+ import { CSSTransition } from "react-transition-group";
21
+
22
+ const ElmImage = (t0) => {
23
+ const $ = compilerRuntimeExports.c(37);
24
+ let alt;
25
+ let args;
26
+ let block;
27
+ let margin;
28
+ let src;
29
+ let t1;
30
+ if ($[0] !== t0) {
31
+ ({
32
+ src,
33
+ alt,
34
+ block,
35
+ enableModal: t1,
36
+ margin,
37
+ ...args
38
+ } = t0);
39
+ $[0] = t0;
40
+ $[1] = alt;
41
+ $[2] = args;
42
+ $[3] = block;
43
+ $[4] = margin;
44
+ $[5] = src;
45
+ $[6] = t1;
46
+ } else {
47
+ alt = $[1];
48
+ args = $[2];
49
+ block = $[3];
50
+ margin = $[4];
51
+ src = $[5];
52
+ t1 = $[6];
53
+ }
54
+ const enableModal = t1 === void 0 ? false : t1;
55
+ const nodeRef = useRef(null);
56
+ const [isShowModal, setIsShowModal] = useState(false);
57
+ const [isMounted, setIsMounted] = useState(false);
58
+ let t2;
59
+ let t3;
60
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
61
+ t2 = () => {
62
+ setIsMounted(true);
63
+ };
64
+ t3 = [];
65
+ $[7] = t2;
66
+ $[8] = t3;
67
+ } else {
68
+ t2 = $[7];
69
+ t3 = $[8];
70
+ }
71
+ useEffect(t2, t3);
72
+ let t4;
73
+ if ($[9] !== enableModal || $[10] !== isShowModal) {
74
+ t4 = () => {
75
+ if (enableModal) {
76
+ setIsShowModal(!isShowModal);
77
+ }
78
+ };
79
+ $[9] = enableModal;
80
+ $[10] = isShowModal;
81
+ $[11] = t4;
82
+ } else {
83
+ t4 = $[11];
84
+ }
85
+ const handleClick = t4;
86
+ const t5 = enableModal && !isShowModal ? "zoom-in" : "unset";
87
+ let t6;
88
+ if ($[12] !== t5) {
89
+ t6 = {
90
+ cursor: t5
91
+ };
92
+ $[12] = t5;
93
+ $[13] = t6;
94
+ } else {
95
+ t6 = $[13];
96
+ }
97
+ let t7;
98
+ if ($[14] !== alt || $[15] !== args || $[16] !== handleClick || $[17] !== src || $[18] !== t6) {
99
+ t7 = /* @__PURE__ */ jsxRuntimeExports.jsx("img", { className: style.image, src, alt, style: t6, ...args, onClick: handleClick });
100
+ $[14] = alt;
101
+ $[15] = args;
102
+ $[16] = handleClick;
103
+ $[17] = src;
104
+ $[18] = t6;
105
+ $[19] = t7;
106
+ } else {
107
+ t7 = $[19];
108
+ }
109
+ const image = t7;
110
+ let t8;
111
+ if ($[20] !== margin) {
112
+ t8 = {
113
+ marginBlock: margin
114
+ };
115
+ $[20] = margin;
116
+ $[21] = t8;
117
+ } else {
118
+ t8 = $[21];
119
+ }
120
+ let t9;
121
+ if ($[22] !== alt || $[23] !== block) {
122
+ t9 = alt && block && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.caption, children: [
123
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ElmMdiIcon, { d: mdiTooltipImage, color: "#bfa056", size: "1.25rem" }),
124
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ElmInlineText, { text: alt })
125
+ ] });
126
+ $[22] = alt;
127
+ $[23] = block;
128
+ $[24] = t9;
129
+ } else {
130
+ t9 = $[24];
131
+ }
132
+ let t10;
133
+ if ($[25] !== enableModal || $[26] !== handleClick || $[27] !== image || $[28] !== isMounted || $[29] !== isShowModal) {
134
+ t10 = isMounted && enableModal && /* @__PURE__ */ jsxRuntimeExports.jsx(CSSTransition, { classNames: "fade", in: isShowModal, timeout: 300, unmountOnExit: true, nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.modal, onClick: handleClick, ref: nodeRef, children: image }) });
135
+ $[25] = enableModal;
136
+ $[26] = handleClick;
137
+ $[27] = image;
138
+ $[28] = isMounted;
139
+ $[29] = isShowModal;
140
+ $[30] = t10;
141
+ } else {
142
+ t10 = $[30];
143
+ }
144
+ let t11;
145
+ if ($[31] !== args || $[32] !== image || $[33] !== t10 || $[34] !== t8 || $[35] !== t9) {
146
+ t11 = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: t8, ...args, children: [
147
+ image,
148
+ t9,
149
+ t10
150
+ ] });
151
+ $[31] = args;
152
+ $[32] = image;
153
+ $[33] = t10;
154
+ $[34] = t8;
155
+ $[35] = t9;
156
+ $[36] = t11;
157
+ } else {
158
+ t11 = $[36];
159
+ }
160
+ return t11;
161
+ };
162
+ export {
163
+ ElmImage
164
+ };
@@ -0,0 +1,26 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("._image_z5fgk_1{width:100%}._block-image_z5fgk_5{border-radius:.25rem;box-shadow:0 0 .125rem #000}._caption_z5fgk_10{margin-block:.5rem;display:flex;justify-content:center;align-items:center;gap:.5rem}._modal_z5fgk_18{position:fixed;z-index:10000;top:0;left:0;width:100%;height:100%;display:flex;justify-self:center;align-items:center;background-color:#3e434bcc;cursor:zoom-out}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const image = "_image_z5fgk_1";
14
+ const caption = "_caption_z5fgk_10";
15
+ const modal = "_modal_z5fgk_18";
16
+ const style = {
17
+ image,
18
+ caption,
19
+ modal
20
+ };
21
+ export {
22
+ caption,
23
+ style as default,
24
+ image,
25
+ modal
26
+ };
@@ -0,0 +1,48 @@
1
+ import { j as jsxRuntimeExports } from "../../_virtual/jsx-runtime.mjs";
2
+ import { c as compilerRuntimeExports } from "../../_virtual/compiler-runtime.mjs";
3
+ import "react";
4
+ import { clsx } from "../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs";
5
+ import style from "./ElmBlockQuote.module.scss.mjs";
6
+ import textStyle from "../../styles/text.module.scss.mjs";
7
+ const ElmBlockQuote = (props) => {
8
+ const $ = compilerRuntimeExports.c(8);
9
+ let t0;
10
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
+ t0 = clsx([style.blockquote, textStyle.text]);
12
+ $[0] = t0;
13
+ } else {
14
+ t0 = $[0];
15
+ }
16
+ let t1;
17
+ if ($[1] !== props.cite || $[2] !== props.source) {
18
+ t1 = props.source != null && (props.cite ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: props.cite, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("cite", { children: [
19
+ "- ",
20
+ props.source
21
+ ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("cite", { children: [
22
+ "- ",
23
+ props.source
24
+ ] }));
25
+ $[1] = props.cite;
26
+ $[2] = props.source;
27
+ $[3] = t1;
28
+ } else {
29
+ t1 = $[3];
30
+ }
31
+ let t2;
32
+ if ($[4] !== props.children || $[5] !== props.cite || $[6] !== t1) {
33
+ t2 = /* @__PURE__ */ jsxRuntimeExports.jsxs("blockquote", { className: t0, cite: props.cite, children: [
34
+ props.children,
35
+ t1
36
+ ] });
37
+ $[4] = props.children;
38
+ $[5] = props.cite;
39
+ $[6] = t1;
40
+ $[7] = t2;
41
+ } else {
42
+ t2 = $[7];
43
+ }
44
+ return t2;
45
+ };
46
+ export {
47
+ ElmBlockQuote
48
+ };
@@ -0,0 +1,20 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("._blockquote_1msat_1{box-sizing:border-box;padding:.5rem 2rem;background-color:#e3e5e7;border-left:4px solid #606875}[data-theme=dark] ._blockquote_1msat_1{background-color:#3e434b;border-color:#b0b5be}._blockquote_1msat_1 a{all:unset;cursor:pointer;transition:color .1s}._blockquote_1msat_1 a:hover{color:#5879b0}._blockquote_1msat_1 cite{display:block;margin-block:1rem;text-align:right}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const blockquote = "_blockquote_1msat_1";
14
+ const style = {
15
+ blockquote
16
+ };
17
+ export {
18
+ blockquote,
19
+ style as default
20
+ };
@@ -0,0 +1,107 @@
1
+ import { j as jsxRuntimeExports } from "../../_virtual/jsx-runtime.mjs";
2
+ import { c as compilerRuntimeExports } from "../../_virtual/compiler-runtime.mjs";
3
+ import { mdiAlertOctagram, mdiAlert, mdiShieldAlert, mdiLightbulbOn, mdiInformation } from "@mdi/js";
4
+ import { ElmMdiIcon } from "../icon/ElmMdiIcon.mjs";
5
+ import "react";
6
+ import style from "./ElmCallout.module.scss.mjs";
7
+ import { ElmInlineText } from "./ElmInlineText.mjs";
8
+ const colors = {
9
+ note: {
10
+ code: "#6987b8",
11
+ icon: mdiInformation
12
+ },
13
+ tip: {
14
+ code: "#59b57c",
15
+ icon: mdiLightbulbOn
16
+ },
17
+ important: {
18
+ code: "#9771bd",
19
+ icon: mdiShieldAlert
20
+ },
21
+ warning: {
22
+ code: "#b8a36e",
23
+ icon: mdiAlert
24
+ },
25
+ caution: {
26
+ code: "#b36472",
27
+ icon: mdiAlertOctagram
28
+ }
29
+ };
30
+ const ElmCallout = (t0) => {
31
+ const $ = compilerRuntimeExports.c(17);
32
+ const {
33
+ type: t1,
34
+ children
35
+ } = t0;
36
+ const type = t1 === void 0 ? "note" : t1;
37
+ const t2 = colors[type];
38
+ let t3;
39
+ if ($[0] !== t2.code) {
40
+ t3 = {
41
+ "--callout-color": t2.code
42
+ };
43
+ $[0] = t2.code;
44
+ $[1] = t3;
45
+ } else {
46
+ t3 = $[1];
47
+ }
48
+ const t4 = t3;
49
+ const t5 = colors[type];
50
+ const t6 = colors[type];
51
+ let t7;
52
+ if ($[2] !== t5.icon || $[3] !== t6.code) {
53
+ t7 = /* @__PURE__ */ jsxRuntimeExports.jsx(ElmMdiIcon, { d: t5.icon, color: t6.code });
54
+ $[2] = t5.icon;
55
+ $[3] = t6.code;
56
+ $[4] = t7;
57
+ } else {
58
+ t7 = $[4];
59
+ }
60
+ let t8;
61
+ if ($[5] !== type) {
62
+ t8 = type.toUpperCase();
63
+ $[5] = type;
64
+ $[6] = t8;
65
+ } else {
66
+ t8 = $[6];
67
+ }
68
+ const t9 = colors[type];
69
+ let t10;
70
+ if ($[7] !== t8 || $[8] !== t9.code) {
71
+ t10 = /* @__PURE__ */ jsxRuntimeExports.jsx(ElmInlineText, { text: t8, color: t9.code });
72
+ $[7] = t8;
73
+ $[8] = t9.code;
74
+ $[9] = t10;
75
+ } else {
76
+ t10 = $[9];
77
+ }
78
+ let t11;
79
+ if ($[10] !== t10 || $[11] !== t7) {
80
+ t11 = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.header, children: [
81
+ t7,
82
+ t10
83
+ ] });
84
+ $[10] = t10;
85
+ $[11] = t7;
86
+ $[12] = t11;
87
+ } else {
88
+ t11 = $[12];
89
+ }
90
+ let t12;
91
+ if ($[13] !== children || $[14] !== t11 || $[15] !== t4) {
92
+ t12 = /* @__PURE__ */ jsxRuntimeExports.jsxs("aside", { className: style.callout, style: t4, children: [
93
+ t11,
94
+ children
95
+ ] });
96
+ $[13] = children;
97
+ $[14] = t11;
98
+ $[15] = t4;
99
+ $[16] = t12;
100
+ } else {
101
+ t12 = $[16];
102
+ }
103
+ return t12;
104
+ };
105
+ export {
106
+ ElmCallout
107
+ };
@@ -0,0 +1,23 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode('._callout_pqkj1_1{box-sizing:border-box;padding:1rem 1rem 1rem 1.5rem;position:relative}._callout_pqkj1_1:after{position:absolute;content:"";top:0;left:0;width:4px;height:100%;background-color:var(--callout-color);z-index:-1}._callout_pqkj1_1:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background-color:var(--callout-color);opacity:.15;z-index:-1}._header_pqkj1_28{display:flex;justify-content:flex-start;align-items:center;gap:.5rem;margin-block-end:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}'));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const callout = "_callout_pqkj1_1";
14
+ const header = "_header_pqkj1_28";
15
+ const style = {
16
+ callout,
17
+ header
18
+ };
19
+ export {
20
+ callout,
21
+ style as default,
22
+ header
23
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export { ElmInlineIcon, type ElmInlineIconProps, } from './components/icon/ElmInlineIcon';
2
+ export { ElmImage, type ElmImageProps } from './components/media/ElmImage';
3
+ export { ElmBlockQuote, type ElmBlockQuoteProps, } from './components/typography/ElmBlockQuote';
4
+ export { ElmCallout, type ElmCalloutProps, } from './components/typography/ElmCallout';
2
5
  export { ElmInlineText, type ElmInlineTextProps, } from './components/typography/ElmInlineText';
3
6
  export { ElmParagraph, type ElmParagraphProps, } from './components/typography/ElmParagraph';
package/dist/index.mjs CHANGED
@@ -1,7 +1,13 @@
1
1
  import { ElmInlineIcon } from "./components/icon/ElmInlineIcon.mjs";
2
+ import { ElmImage } from "./components/media/ElmImage.mjs";
3
+ import { ElmBlockQuote } from "./components/typography/ElmBlockQuote.mjs";
4
+ import { ElmCallout } from "./components/typography/ElmCallout.mjs";
2
5
  import { ElmInlineText } from "./components/typography/ElmInlineText.mjs";
3
6
  import { ElmParagraph } from "./components/typography/ElmParagraph.mjs";
4
7
  export {
8
+ ElmBlockQuote,
9
+ ElmCallout,
10
+ ElmImage,
5
11
  ElmInlineIcon,
6
12
  ElmInlineText,
7
13
  ElmParagraph
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elmethis/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },