@elmethis/vue 0.2.10 → 0.2.12

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.
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".v-enter-to[data-v-92929132],.v-leave-from[data-v-92929132]{opacity:1}.v-enter-active[data-v-92929132],.v-leave-active[data-v-92929132]{transition:opacity .15s}.v-enter-from[data-v-92929132],.v-leave-to[data-v-92929132]{opacity:0}"));
6
+ elementStyle.appendChild(document.createTextNode(".v-enter-to[data-v-514e4afd],.v-leave-from[data-v-514e4afd]{opacity:1}.v-enter-active[data-v-514e4afd],.v-leave-active[data-v-514e4afd]{transition:opacity .15s}.v-enter-from[data-v-514e4afd],.v-leave-to[data-v-514e4afd]{opacity:0}"));
7
7
  document.head.appendChild(elementStyle);
8
8
  }
9
9
  } catch (e) {
@@ -17,7 +17,7 @@ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
17
17
  const cssModules = {
18
18
  "$style": style0
19
19
  };
20
- const ElmCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-92929132"]]);
20
+ const ElmCodeBlock = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-514e4afd"]]);
21
21
  export {
22
22
  ElmCodeBlock as default
23
23
  };
@@ -3,7 +3,7 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".fade-enter-active[data-v-cbf6ab16],.fade-leave-active[data-v-cbf6ab16]{transition:all .1s ease}.fade-enter-from[data-v-cbf6ab16],.fade-leave-to[data-v-cbf6ab16]{opacity:0;transform:translate(.5rem)}"));
6
+ elementStyle.appendChild(document.createTextNode(".fade-enter-active[data-v-e975d67d],.fade-leave-active[data-v-e975d67d]{transition:all .1s ease}.fade-enter-from[data-v-e975d67d],.fade-leave-to[data-v-e975d67d]{opacity:0;transform:translate(.5rem)}"));
7
7
  document.head.appendChild(elementStyle);
8
8
  }
9
9
  } catch (e) {
@@ -17,7 +17,7 @@ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
17
17
  const cssModules = {
18
18
  "$style": style0
19
19
  };
20
- const ElmCommandPalette = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-cbf6ab16"]]);
20
+ const ElmCommandPalette = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules], ["__scopeId", "data-v-e975d67d"]]);
21
21
  export {
22
22
  ElmCommandPalette as default
23
23
  };
@@ -21,3 +21,4 @@ export declare const Katex: Story;
21
21
  export declare const Table: Story;
22
22
  export declare const ColumnList: Story;
23
23
  export declare const Unsupported: Story;
24
+ export declare const Unified: Story;
@@ -10,7 +10,7 @@
10
10
  console.error("vite-plugin-css-injected-by-js", e);
11
11
  }
12
12
  })();
13
- import { defineComponent, useCssModule, ref, computed, watch, createElementBlock, openBlock, createBlock, resolveDynamicComponent, h } from "vue";
13
+ import { defineComponent, useCssModule, ref, computed, watch, createElementBlock, openBlock, normalizeClass, createBlock, resolveDynamicComponent, h } from "vue";
14
14
  import ElmInlineText from "../typography/ElmInlineText.vue.mjs";
15
15
  import ElmKatex from "../code/ElmKatex.vue.mjs";
16
16
  import ElmMermaid from "../code/ElmMermaid.vue.mjs";
@@ -178,9 +178,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
178
178
  }
179
179
  );
180
180
  return (_ctx, _cache) => {
181
- return openBlock(), createElementBlock("div", null, [
181
+ return openBlock(), createElementBlock("div", {
182
+ class: normalizeClass(_ctx.$style["jarkup-body"])
183
+ }, [
182
184
  (openBlock(), createBlock(resolveDynamicComponent(components.value)))
183
- ]);
185
+ ], 2);
184
186
  };
185
187
  }
186
188
  });
@@ -3,16 +3,17 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode("._column-list_1at6s_1{box-sizing:content-box;padding-block:.25rem;width:100%;display:flex;flex-direction:row;gap:.5rem;justify-content:space-around;overflow:auto}._column_1at6s_1{flex:1}"));
6
+ elementStyle.appendChild(document.createTextNode("._jarkup-body_18xt2_1>*+*{margin-block-start:2em}._column-list_18xt2_5{box-sizing:content-box;padding-block:.25rem;width:100%;display:flex;flex-direction:row;gap:.5rem;justify-content:space-around;overflow:auto}._column_18xt2_5{flex:1}"));
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 column = "_column_1at6s_1";
13
+ const column = "_column_18xt2_5";
14
14
  const style0 = {
15
- "column-list": "_column-list_1at6s_1",
15
+ "jarkup-body": "_jarkup-body_18xt2_1",
16
+ "column-list": "_column-list_18xt2_5",
16
17
  column
17
18
  };
18
19
  export {
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof ElmMarkdown>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Primary: Story;
7
+ export declare const CodeBlock: Story;
@@ -1,255 +1,10 @@
1
- (function() {
2
- "use strict";
3
- try {
4
- if (typeof document != "undefined") {
5
- var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode(".elmethis-list-common{margin-block:1rem;opacity:var(--opacity);transition:opacity .8s;box-sizing:border-box;padding-left:1.25rem}.elmethis-bulleted-list li{box-sizing:border-box;padding-left:.5rem;margin-block:.75rem}.elmethis-bulleted-list li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMTYgMTYnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICA+CiAgICA8cGF0aAogICAgICBmaWxsPScjNDQ5NzYzJwogICAgICBvcGFjaXR5PScwLjgnCiAgICAgIGQ9J00zIDMuNzMyYTEuNSAxLjUgMCAwIDEgMi4zMDUtMS4yNjVsNi43MDYgNC4yNjdhMS41IDEuNSAwIDAgMSAwIDIuNTMxbC02LjcwNiA0LjI2OEExLjUgMS41IDAgMCAxIDMgMTIuMjY3VjMuNzMyWicKICAgIC8+CiAgPC9zdmc+)}.elmethis-bulleted-list li ul li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMjQgMjQnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICAgIHN0cm9rZT0nIzQ0OTc2MycKICAgIGZpbGw9J3RyYW5zcGFyZW50JwogID4KICAgIDxwYXRoCiAgICAgIHN0cm9rZUxpbmVjYXA9J3JvdW5kJwogICAgICBzdHJva2VMaW5lam9pbj0ncm91bmQnCiAgICAgIGQ9J001LjI1IDUuNjUzYzAtLjg1Ni45MTctMS4zOTggMS42NjctLjk4NmwxMS41NCA2LjM0N2ExLjEyNSAxLjEyNSAwIDAgMSAwIDEuOTcybC0xMS41NCA2LjM0N2ExLjEyNSAxLjEyNSAwIDAgMS0xLjY2Ny0uOTg2VjUuNjUzWicKICAgIC8+CiAgPC9zdmc+)}.elmethis-bulleted-list li ul li ul li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMjAgMjAnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICAgIHN0cm9rZT0nIzQ0OTc2MycKICAgIGZpbGw9JyM0NDk3NjMnCiAgPgogICAgPHBhdGgKICAgICAgZmlsbFJ1bGU9J2V2ZW5vZGQnCiAgICAgIGQ9J004LjIyIDUuMjJhLjc1Ljc1IDAgMCAxIDEuMDYgMGw0LjI1IDQuMjVhLjc1Ljc1IDAgMCAxIDAgMS4wNmwtNC4yNSA0LjI1YS43NS43NSAwIDAgMS0xLjA2LTEuMDZMMTEuOTQgMTAgOC4yMiA2LjI4YS43NS43NSAwIDAgMSAwLTEuMDZaJwogICAgICBjbGlwUnVsZT0nZXZlbm9kZCcKICAgIC8+CiAgPC9zdmc+)}.elmethis-numbered-list li{box-sizing:border-box;padding-left:.25rem;margin-block:.75rem;margin-left:.25rem;list-style-type:decimal}.elmethis-numbered-list li::marker{font-weight:700;color:#9771bd}.elmethis-numbered-list li ol li{list-style-type:lower-alpha}.elmethis-numbered-list li ol li ol li{list-style-type:lower-roman}.elmethis-numbered-list li ol li ol li ol li{list-style-type:lower-greek}"));
7
- document.head.appendChild(elementStyle);
8
- }
9
- } catch (e) {
10
- console.error("vite-plugin-css-injected-by-js", e);
11
- }
12
- })();
13
- import { defineComponent, ref, computed, watch, createElementBlock, openBlock, Fragment, renderList, createBlock, resolveDynamicComponent, h } from "vue";
14
- import { marked } from "marked";
15
- import ElmInlineText from "../typography/ElmInlineText.vue.mjs";
16
- import ElmHeading from "../typography/ElmHeading.vue.mjs";
17
- import ElmParagraph from "../typography/ElmParagraph.vue.mjs";
18
- import _sfc_main$2 from "../typography/ElmList.vue.mjs";
19
-
20
- import ElmBlockQuote from "../typography/ElmBlockQuote.vue.mjs";
21
- import ElmDivider from "../typography/ElmDivider.vue.mjs";
22
- import ElmImage from "../media/ElmImage.vue.mjs";
23
- import ElmCodeBlock from "../code/ElmCodeBlock.vue.mjs";
24
- import ElmTable from "../table/ElmTable.vue.mjs";
25
- import ElmTableHeader from "../table/ElmTableHeader.vue.mjs";
26
- import _sfc_main$1 from "../table/ElmTableBody.vue.mjs";
27
- import ElmTableRow from "../table/ElmTableRow.vue.mjs";
28
- import ElmTableCell from "../table/ElmTableCell.vue.mjs";
29
- const _sfc_main = /* @__PURE__ */ defineComponent({
30
- __name: "ElmMarkdown",
31
- props: {
32
- markdown: {}
33
- },
34
- setup(__props) {
35
- const props = __props;
36
- const renderByToken = ({ tokens }) => {
37
- const results = [];
38
- for (const token of tokens) {
39
- switch (token.type) {
40
- case "blockquote":
41
- if (token.tokens != null && token.tokens.length !== 0) {
42
- results.push(
43
- h(
44
- ElmBlockQuote,
45
- {},
46
- {
47
- default: () => renderByToken({ tokens: token.tokens })
48
- }
49
- )
50
- );
51
- }
52
- break;
53
- case "br":
54
- results.push(h("br"));
55
- break;
56
- case "code":
57
- results.push(
58
- h(ElmCodeBlock, {
59
- code: token.text.trim(),
60
- language: token.lang
61
- })
62
- );
63
- break;
64
- case "codespan":
65
- results.push(h(ElmInlineText, { text: token.text, code: true }));
66
- break;
67
- case "def":
68
- h("span", "aaa");
69
- break;
70
- case "del":
71
- results.push(
72
- token.tokens != null && token.tokens.length !== 0 ? h(
73
- ElmInlineText,
74
- { strikethrough: true },
75
- {
76
- default: () => renderByToken({ tokens: token.tokens })
77
- }
78
- ) : h(ElmInlineText, { text: token.text, strikethrough: true })
79
- );
80
- break;
81
- case "em":
82
- results.push(
83
- token.tokens != null && token.tokens.length !== 0 ? h(
84
- ElmInlineText,
85
- { italic: true },
86
- {
87
- default: () => renderByToken({ tokens: token.tokens })
88
- }
89
- ) : h(ElmInlineText, { text: token.text, italic: true })
90
- );
91
- break;
92
- case "escape":
93
- break;
94
- case "heading":
95
- if (token.tokens && token.tokens.length !== 0) {
96
- results.push(
97
- h(
98
- ElmHeading,
99
- { level: token.depth },
100
- {
101
- default: () => renderByToken({ tokens: token.tokens })
102
- }
103
- )
104
- );
105
- } else {
106
- results.push(h(ElmHeading, { level: token.depth, text: token.text }));
107
- }
108
- break;
109
- case "hr":
110
- results.push(h(ElmDivider));
111
- break;
112
- case "html":
113
- break;
114
- case "image":
115
- results.push(
116
- h(ElmImage, {
117
- block: true,
118
- enableModal: true,
119
- src: token.href,
120
- alt: token.text
121
- })
122
- );
123
- break;
124
- case "link":
125
- results.push(
126
- token.tokens != null && token.tokens.length !== 0 ? h(ElmInlineText, {
127
- text: token.text,
128
- href: token.href
129
- }) : h(ElmInlineText, { text: token.text, href: token.href })
130
- );
131
- break;
132
- case "list":
133
- const listItems = token.items.map(
134
- (item) => h("li", {}, renderByToken({ tokens: item.tokens }))
135
- );
136
- results.push(
137
- h(
138
- _sfc_main$2,
139
- {
140
- listStyle: token.ordered ? "ordered" : "unordered"
141
- },
142
- { default: () => listItems }
143
- )
144
- );
145
- break;
146
- case "list_item":
147
- results.push(
148
- token.tokens != null && token.tokens.length !== 0 ? h(
149
- "li",
150
- {},
151
- {
152
- default: () => renderByToken({ tokens: token.tokens })
153
- }
154
- ) : h("li", { text: token.text })
155
- );
156
- break;
157
- case "paragraph":
158
- if (token.tokens && token.tokens.length !== 0) {
159
- results.push(
160
- h(
161
- ElmParagraph,
162
- {},
163
- {
164
- default: () => renderByToken({ tokens: token.tokens })
165
- }
166
- )
167
- );
168
- }
169
- break;
170
- case "space":
171
- break;
172
- case "strong":
173
- results.push(
174
- token.tokens != null && token.tokens.length !== 0 ? h(
175
- ElmInlineText,
176
- { bold: true },
177
- {
178
- default: () => renderByToken({ tokens: token.tokens })
179
- }
180
- ) : h(ElmInlineText, { text: token.text, bold: true })
181
- );
182
- break;
183
- case "table":
184
- const renderTableCells = ({
185
- cells
186
- }) => cells.map(
187
- (cell) => h(
188
- ElmTableCell,
189
- {},
190
- { default: () => renderByToken({ tokens: cell.tokens }) }
191
- )
192
- );
193
- const headerRow = h(
194
- ElmTableRow,
195
- {},
196
- { default: () => renderTableCells({ cells: token.header }) }
197
- );
198
- const bodyRows = token.rows.map(
199
- (row) => h(
200
- ElmTableRow,
201
- {},
202
- { default: () => renderTableCells({ cells: row }) }
203
- )
204
- );
205
- const table = h(
206
- ElmTable,
207
- {},
208
- {
209
- header: () => h(ElmTableHeader, {}, { default: () => headerRow }),
210
- body: () => h(_sfc_main$1, {}, { default: () => bodyRows })
211
- }
212
- );
213
- results.push(table);
214
- break;
215
- case "text":
216
- results.push(
217
- token.tokens != null && token.tokens.length !== 0 ? h(
218
- ElmInlineText,
219
- {},
220
- {
221
- default: () => renderByToken({ tokens: token.tokens })
222
- }
223
- ) : h(ElmInlineText, { text: token.text })
224
- );
225
- break;
226
- }
227
- }
228
- return results;
229
- };
230
- const renderMarkdown = ({ markdown }) => {
231
- const tokens = marked.setOptions({ gfm: true }).lexer(markdown);
232
- return renderByToken({ tokens });
233
- };
234
- const renderResult = ref(renderMarkdown({ markdown: props.markdown }));
235
- const components = computed(() => ({
236
- render: () => renderResult.value
237
- }));
238
- watch(
239
- () => props.markdown,
240
- (md) => {
241
- if (md != null) renderResult.value = renderMarkdown({ markdown: md });
242
- }
243
- );
244
- return (_ctx, _cache) => {
245
- return openBlock(), createElementBlock("div", null, [
246
- (openBlock(true), createElementBlock(Fragment, null, renderList(components.value, (component) => {
247
- return openBlock(), createBlock(resolveDynamicComponent(component));
248
- }), 256))
249
- ]);
250
- };
251
- }
252
- });
1
+ import _sfc_main from "./ElmMarkdown.vue2.mjs";
2
+ import style0 from "./ElmMarkdown.vue3.mjs";
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const cssModules = {
5
+ "$style": style0
6
+ };
7
+ const ElmMarkdown = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
253
8
  export {
254
- _sfc_main as default
9
+ ElmMarkdown as default
255
10
  };
@@ -1,4 +1,257 @@
1
- import _sfc_main from "./ElmMarkdown.vue.mjs";
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode(".elmethis-list-common{margin-block:1rem;opacity:var(--opacity);transition:opacity .8s;box-sizing:border-box;padding-left:1.25rem}.elmethis-bulleted-list li{box-sizing:border-box;padding-left:.5rem;margin-block:.75rem}.elmethis-bulleted-list li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMTYgMTYnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICA+CiAgICA8cGF0aAogICAgICBmaWxsPScjNDQ5NzYzJwogICAgICBvcGFjaXR5PScwLjgnCiAgICAgIGQ9J00zIDMuNzMyYTEuNSAxLjUgMCAwIDEgMi4zMDUtMS4yNjVsNi43MDYgNC4yNjdhMS41IDEuNSAwIDAgMSAwIDIuNTMxbC02LjcwNiA0LjI2OEExLjUgMS41IDAgMCAxIDMgMTIuMjY3VjMuNzMyWicKICAgIC8+CiAgPC9zdmc+)}.elmethis-bulleted-list li ul li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMjQgMjQnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICAgIHN0cm9rZT0nIzQ0OTc2MycKICAgIGZpbGw9J3RyYW5zcGFyZW50JwogID4KICAgIDxwYXRoCiAgICAgIHN0cm9rZUxpbmVjYXA9J3JvdW5kJwogICAgICBzdHJva2VMaW5lam9pbj0ncm91bmQnCiAgICAgIGQ9J001LjI1IDUuNjUzYzAtLjg1Ni45MTctMS4zOTggMS42NjctLjk4NmwxMS41NCA2LjM0N2ExLjEyNSAxLjEyNSAwIDAgMSAwIDEuOTcybC0xMS41NCA2LjM0N2ExLjEyNSAxLjEyNSAwIDAgMS0xLjY2Ny0uOTg2VjUuNjUzWicKICAgIC8+CiAgPC9zdmc+)}.elmethis-bulleted-list li ul li ul li::marker{content:url(data:image/svg+xml;base64,ICA8c3ZnCiAgICB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnCiAgICB2aWV3Qm94PScwIDAgMjAgMjAnCiAgICB3aWR0aD0nMTJweCcKICAgIGhlaWdodD0nMTJweCcKICAgIHN0cm9rZT0nIzQ0OTc2MycKICAgIGZpbGw9JyM0NDk3NjMnCiAgPgogICAgPHBhdGgKICAgICAgZmlsbFJ1bGU9J2V2ZW5vZGQnCiAgICAgIGQ9J004LjIyIDUuMjJhLjc1Ljc1IDAgMCAxIDEuMDYgMGw0LjI1IDQuMjVhLjc1Ljc1IDAgMCAxIDAgMS4wNmwtNC4yNSA0LjI1YS43NS43NSAwIDAgMS0xLjA2LTEuMDZMMTEuOTQgMTAgOC4yMiA2LjI4YS43NS43NSAwIDAgMSAwLTEuMDZaJwogICAgICBjbGlwUnVsZT0nZXZlbm9kZCcKICAgIC8+CiAgPC9zdmc+)}.elmethis-numbered-list li{box-sizing:border-box;padding-left:.25rem;margin-block:.75rem;margin-left:.25rem;list-style-type:decimal}.elmethis-numbered-list li::marker{font-weight:700;color:#9771bd}.elmethis-numbered-list li ol li{list-style-type:lower-alpha}.elmethis-numbered-list li ol li ol li{list-style-type:lower-roman}.elmethis-numbered-list li ol li ol li ol li{list-style-type:lower-greek}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ import { defineComponent, ref, computed, watch, createElementBlock, openBlock, normalizeClass, Fragment, renderList, createBlock, resolveDynamicComponent, h } from "vue";
14
+ import { marked } from "marked";
15
+ import ElmInlineText from "../typography/ElmInlineText.vue.mjs";
16
+ import ElmHeading from "../typography/ElmHeading.vue.mjs";
17
+ import ElmParagraph from "../typography/ElmParagraph.vue.mjs";
18
+ import _sfc_main$2 from "../typography/ElmList.vue.mjs";
19
+
20
+ import ElmBlockQuote from "../typography/ElmBlockQuote.vue.mjs";
21
+ import ElmDivider from "../typography/ElmDivider.vue.mjs";
22
+ import ElmImage from "../media/ElmImage.vue.mjs";
23
+ import ElmCodeBlock from "../code/ElmCodeBlock.vue.mjs";
24
+ import ElmTable from "../table/ElmTable.vue.mjs";
25
+ import ElmTableHeader from "../table/ElmTableHeader.vue.mjs";
26
+ import _sfc_main$1 from "../table/ElmTableBody.vue.mjs";
27
+ import ElmTableRow from "../table/ElmTableRow.vue.mjs";
28
+ import ElmTableCell from "../table/ElmTableCell.vue.mjs";
29
+ const _sfc_main = /* @__PURE__ */ defineComponent({
30
+ __name: "ElmMarkdown",
31
+ props: {
32
+ markdown: {}
33
+ },
34
+ setup(__props) {
35
+ const props = __props;
36
+ const renderByToken = ({ tokens }) => {
37
+ const results = [];
38
+ for (const token of tokens) {
39
+ switch (token.type) {
40
+ case "blockquote":
41
+ if (token.tokens != null && token.tokens.length !== 0) {
42
+ results.push(
43
+ h(
44
+ ElmBlockQuote,
45
+ {},
46
+ {
47
+ default: () => renderByToken({ tokens: token.tokens })
48
+ }
49
+ )
50
+ );
51
+ }
52
+ break;
53
+ case "br":
54
+ results.push(h("br"));
55
+ break;
56
+ case "code":
57
+ results.push(
58
+ h(ElmCodeBlock, {
59
+ code: token.text.trim(),
60
+ language: token.lang
61
+ })
62
+ );
63
+ break;
64
+ case "codespan":
65
+ results.push(h(ElmInlineText, { text: token.text, code: true }));
66
+ break;
67
+ case "def":
68
+ h("span", "aaa");
69
+ break;
70
+ case "del":
71
+ results.push(
72
+ token.tokens != null && token.tokens.length !== 0 ? h(
73
+ ElmInlineText,
74
+ { strikethrough: true },
75
+ {
76
+ default: () => renderByToken({ tokens: token.tokens })
77
+ }
78
+ ) : h(ElmInlineText, { text: token.text, strikethrough: true })
79
+ );
80
+ break;
81
+ case "em":
82
+ results.push(
83
+ token.tokens != null && token.tokens.length !== 0 ? h(
84
+ ElmInlineText,
85
+ { italic: true },
86
+ {
87
+ default: () => renderByToken({ tokens: token.tokens })
88
+ }
89
+ ) : h(ElmInlineText, { text: token.text, italic: true })
90
+ );
91
+ break;
92
+ case "escape":
93
+ break;
94
+ case "heading":
95
+ if (token.tokens && token.tokens.length !== 0) {
96
+ results.push(
97
+ h(
98
+ ElmHeading,
99
+ { level: token.depth },
100
+ {
101
+ default: () => renderByToken({ tokens: token.tokens })
102
+ }
103
+ )
104
+ );
105
+ } else {
106
+ results.push(h(ElmHeading, { level: token.depth, text: token.text }));
107
+ }
108
+ break;
109
+ case "hr":
110
+ results.push(h(ElmDivider));
111
+ break;
112
+ case "html":
113
+ break;
114
+ case "image":
115
+ results.push(
116
+ h(ElmImage, {
117
+ block: true,
118
+ enableModal: true,
119
+ src: token.href,
120
+ alt: token.text
121
+ })
122
+ );
123
+ break;
124
+ case "link":
125
+ results.push(
126
+ token.tokens != null && token.tokens.length !== 0 ? h(ElmInlineText, {
127
+ text: token.text,
128
+ href: token.href
129
+ }) : h(ElmInlineText, { text: token.text, href: token.href })
130
+ );
131
+ break;
132
+ case "list":
133
+ const listItems = token.items.map(
134
+ (item) => h("li", {}, renderByToken({ tokens: item.tokens }))
135
+ );
136
+ results.push(
137
+ h(
138
+ _sfc_main$2,
139
+ {
140
+ listStyle: token.ordered ? "ordered" : "unordered"
141
+ },
142
+ { default: () => listItems }
143
+ )
144
+ );
145
+ break;
146
+ case "list_item":
147
+ results.push(
148
+ token.tokens != null && token.tokens.length !== 0 ? h(
149
+ "li",
150
+ {},
151
+ {
152
+ default: () => renderByToken({ tokens: token.tokens })
153
+ }
154
+ ) : h("li", { text: token.text })
155
+ );
156
+ break;
157
+ case "paragraph":
158
+ if (token.tokens && token.tokens.length !== 0) {
159
+ results.push(
160
+ h(
161
+ ElmParagraph,
162
+ {},
163
+ {
164
+ default: () => renderByToken({ tokens: token.tokens })
165
+ }
166
+ )
167
+ );
168
+ }
169
+ break;
170
+ case "space":
171
+ break;
172
+ case "strong":
173
+ results.push(
174
+ token.tokens != null && token.tokens.length !== 0 ? h(
175
+ ElmInlineText,
176
+ { bold: true },
177
+ {
178
+ default: () => renderByToken({ tokens: token.tokens })
179
+ }
180
+ ) : h(ElmInlineText, { text: token.text, bold: true })
181
+ );
182
+ break;
183
+ case "table":
184
+ const renderTableCells = ({
185
+ cells
186
+ }) => cells.map(
187
+ (cell) => h(
188
+ ElmTableCell,
189
+ {},
190
+ { default: () => renderByToken({ tokens: cell.tokens }) }
191
+ )
192
+ );
193
+ const headerRow = h(
194
+ ElmTableRow,
195
+ {},
196
+ { default: () => renderTableCells({ cells: token.header }) }
197
+ );
198
+ const bodyRows = token.rows.map(
199
+ (row) => h(
200
+ ElmTableRow,
201
+ {},
202
+ { default: () => renderTableCells({ cells: row }) }
203
+ )
204
+ );
205
+ const table = h(
206
+ ElmTable,
207
+ {},
208
+ {
209
+ header: () => h(ElmTableHeader, {}, { default: () => headerRow }),
210
+ body: () => h(_sfc_main$1, {}, { default: () => bodyRows })
211
+ }
212
+ );
213
+ results.push(table);
214
+ break;
215
+ case "text":
216
+ results.push(
217
+ token.tokens != null && token.tokens.length !== 0 ? h(
218
+ ElmInlineText,
219
+ {},
220
+ {
221
+ default: () => renderByToken({ tokens: token.tokens })
222
+ }
223
+ ) : h(ElmInlineText, { text: token.text })
224
+ );
225
+ break;
226
+ }
227
+ }
228
+ return results;
229
+ };
230
+ const renderMarkdown = ({ markdown }) => {
231
+ const tokens = marked.setOptions({ gfm: true }).lexer(markdown);
232
+ return renderByToken({ tokens });
233
+ };
234
+ const renderResult = ref(renderMarkdown({ markdown: props.markdown }));
235
+ const components = computed(() => ({
236
+ render: () => renderResult.value
237
+ }));
238
+ watch(
239
+ () => props.markdown,
240
+ (md) => {
241
+ if (md != null) renderResult.value = renderMarkdown({ markdown: md });
242
+ }
243
+ );
244
+ return (_ctx, _cache) => {
245
+ return openBlock(), createElementBlock("div", {
246
+ class: normalizeClass(_ctx.$style["markdown-body"])
247
+ }, [
248
+ (openBlock(true), createElementBlock(Fragment, null, renderList(components.value, (component) => {
249
+ return openBlock(), createBlock(resolveDynamicComponent(component));
250
+ }), 256))
251
+ ], 2);
252
+ };
253
+ }
254
+ });
2
255
  export {
3
256
  _sfc_main as default
4
257
  };
@@ -0,0 +1,18 @@
1
+ (function() {
2
+ "use strict";
3
+ try {
4
+ if (typeof document != "undefined") {
5
+ var elementStyle = document.createElement("style");
6
+ elementStyle.appendChild(document.createTextNode("._markdown-body_grhpg_1>*+*{margin-block-start:2em}"));
7
+ document.head.appendChild(elementStyle);
8
+ }
9
+ } catch (e) {
10
+ console.error("vite-plugin-css-injected-by-js", e);
11
+ }
12
+ })();
13
+ const style0 = {
14
+ "markdown-body": "_markdown-body_grhpg_1"
15
+ };
16
+ export {
17
+ style0 as default
18
+ };
@@ -63,23 +63,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
63
  let vnode = slots.default ? h(
64
64
  "span",
65
65
  {
66
- class: [style.text, textStyle.text],
67
- style: {
68
- "--color": props.color ?? backgroundColor,
69
- "--font-size": props.size,
70
- "--background-color": props.backgroundColor
71
- }
66
+ class: [style.text, textStyle.text]
72
67
  },
73
68
  { default: slots.default }
74
69
  ) : h(
75
70
  "span",
76
71
  {
77
- class: [style.text, textStyle.text],
78
- style: {
79
- "--color": props.color ?? backgroundColor,
80
- "--font-size": props.size,
81
- "--background-color": props.backgroundColor
82
- }
72
+ class: [style.text, textStyle.text]
83
73
  },
84
74
  props.text
85
75
  );
@@ -87,28 +77,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
77
  vnode = h("kbd", { class: style.kbd }, vnode);
88
78
  }
89
79
  if (props.strikethrough) {
90
- vnode = h(
91
- "del",
92
- {
93
- class: style.del,
94
- style: {
95
- "--color": props.color ?? backgroundColor
96
- }
97
- },
98
- vnode
99
- );
80
+ vnode = h("del", {}, vnode);
100
81
  }
101
82
  if (props.italic) {
102
- vnode = h(
103
- "em",
104
- {
105
- class: style.em,
106
- style: {
107
- "--color": props.color ?? backgroundColor
108
- }
109
- },
110
- vnode
111
- );
83
+ vnode = h("em", {}, vnode);
112
84
  }
113
85
  if (props.underline) {
114
86
  vnode = h("ins", {}, vnode);
@@ -123,17 +95,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
123
95
  vnode = h(
124
96
  "ruby",
125
97
  {
126
- class: style.text,
127
- style: {
128
- "--color": props.color ?? backgroundColor,
129
- "--font-size": props.size,
130
- "--background-color": props.backgroundColor
131
- }
98
+ class: style.text
132
99
  },
133
100
  [h("span", {}, vnode), h("rt", {}, props.ruby)]
134
101
  );
135
102
  }
136
- return vnode;
103
+ const wrappedVnode = h(
104
+ "span",
105
+ {
106
+ class: [style.text, textStyle.text],
107
+ style: {
108
+ "--color": props.color ?? backgroundColor,
109
+ "--font-size": props.size,
110
+ "--background-color": props.backgroundColor
111
+ }
112
+ },
113
+ [vnode]
114
+ );
115
+ return wrappedVnode;
137
116
  };
138
117
  return (_ctx, _cache) => {
139
118
  const _component_ElmInlineText = resolveComponent("ElmInlineText", true);
@@ -3,37 +3,31 @@
3
3
  try {
4
4
  if (typeof document != "undefined") {
5
5
  var elementStyle = document.createElement("style");
6
- elementStyle.appendChild(document.createTextNode('._text_vgrys_1{padding:0;margin:0;white-space:pre-line;font-size:1em;font-size:var(--font-size, 1em);line-height:1em;line-height:var(--font-size, 1em);background-color:var(--background-color);transition:color .2s}._del_vgrys_11,._em_vgrys_15{text-decoration-color:var(--color)}._code_vgrys_19{margin-inline:.25rem;padding:2px .5em;font-size:calc(1em - 2px);border-radius:.125rem;background-color:#00000013;font-family:"Source Code Pro" monospace}._kbd_vgrys_28{padding:.125rem .25rem;position:relative;border-radius:.125rem;background-color:#e6e6e6}[data-theme=dark] ._kbd_vgrys_28{background-color:#404040}._kbd_vgrys_28:before{z-index:-1;position:absolute;content:"";bottom:-.25em;left:0;height:100%;width:100%;background-color:#ccc;border-radius:0 0 .125rem .125rem;box-shadow:0 0 .125em #00000080}[data-theme=dark] ._kbd_vgrys_28:before{background-color:#595959;box-shadow:0 0 .125em #ffffff80}._link_vgrys_54{all:unset;box-sizing:border-box;padding:0 .25rem;font-size:var(--font-size);display:inline-flex;align-items:center;gap:.25rem;cursor:pointer;color:#6987b8;border-radius:.125rem;transition:background-color .2s,color .2s,opacity .2s}._link_vgrys_54:hover{background-color:#6987b833}._link_vgrys_54:active{opacity:.5}._link_vgrys_54:visited{color:#9771bd;border-bottom:dashed 1px #9771bd}._link_vgrys_54:visited:hover{background-color:#9771bd33}._ogp_vgrys_81{display:flex;flex-direction:column;gap:.25rem;overflow:hidden;border-radius:.25rem;box-shadow:0 0 .125rem #0000004d;background-color:#fffc}[data-theme=dark] ._ogp_vgrys_81{background-color:#ffffff1a}._ogp-text_vgrys_94{box-sizing:border-box;padding:.5rem}._ogp-title_vgrys_99{box-sizing:border-box;font-weight:700;padding-block-end:.25rem}._ogp-description_vgrys_105{opacity:.7;padding:.25rem}'));
6
+ elementStyle.appendChild(document.createTextNode('._text_1gswr_1{padding:0;margin:0;white-space:pre-line;font-size:1em;font-size:var(--font-size, 1em);line-height:1em;line-height:var(--font-size, 1em);background-color:var(--background-color);transition:color .2s;text-decoration-color:var(--color)}._code_1gswr_12{margin-inline:.25rem;padding:2px .5em;font-size:calc(1em - 2px);border-radius:.125rem;background-color:#00000013;font-family:"Source Code Pro" monospace}._kbd_1gswr_21{padding:.125rem .25rem;position:relative;border-radius:.125rem;background-color:#e6e6e6}[data-theme=dark] ._kbd_1gswr_21{background-color:#404040}._kbd_1gswr_21:before{z-index:-1;position:absolute;content:"";bottom:-.25em;left:0;height:100%;width:100%;background-color:#ccc;border-radius:0 0 .125rem .125rem;box-shadow:0 0 .125em #00000080}[data-theme=dark] ._kbd_1gswr_21:before{background-color:#595959;box-shadow:0 0 .125em #ffffff80}._link_1gswr_47{all:unset;box-sizing:border-box;padding:0 .25rem;font-size:var(--font-size);display:inline-flex;align-items:center;gap:.25rem;cursor:pointer;color:#6987b8;border-radius:.125rem;transition:background-color .2s,color .2s,opacity .2s}._link_1gswr_47:hover{background-color:#6987b833}._link_1gswr_47:active{opacity:.5}._link_1gswr_47:visited{color:#9771bd;border-bottom:dashed 1px #9771bd}._link_1gswr_47:visited:hover{background-color:#9771bd33}._ogp_1gswr_74{display:flex;flex-direction:column;gap:.25rem;overflow:hidden;border-radius:.25rem;box-shadow:0 0 .125rem #0000004d;background-color:#fffc}[data-theme=dark] ._ogp_1gswr_74{background-color:#ffffff1a}._ogp-text_1gswr_87{box-sizing:border-box;padding:.5rem}._ogp-title_1gswr_92{box-sizing:border-box;font-weight:700;padding-block-end:.25rem}._ogp-description_1gswr_98{opacity:.7;padding:.25rem}'));
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 text = "_text_vgrys_1";
14
- const del = "_del_vgrys_11";
15
- const em = "_em_vgrys_15";
16
- const code = "_code_vgrys_19";
17
- const kbd = "_kbd_vgrys_28";
18
- const link = "_link_vgrys_54";
19
- const ogp = "_ogp_vgrys_81";
13
+ const text = "_text_1gswr_1";
14
+ const code = "_code_1gswr_12";
15
+ const kbd = "_kbd_1gswr_21";
16
+ const link = "_link_1gswr_47";
17
+ const ogp = "_ogp_1gswr_74";
20
18
  const style0 = {
21
19
  text,
22
- del,
23
- em,
24
20
  code,
25
21
  kbd,
26
22
  link,
27
23
  ogp,
28
- "ogp-text": "_ogp-text_vgrys_94",
29
- "ogp-title": "_ogp-title_vgrys_99",
30
- "ogp-description": "_ogp-description_vgrys_105"
24
+ "ogp-text": "_ogp-text_1gswr_87",
25
+ "ogp-title": "_ogp-title_1gswr_92",
26
+ "ogp-description": "_ogp-description_1gswr_98"
31
27
  };
32
28
  export {
33
29
  code,
34
30
  style0 as default,
35
- del,
36
- em,
37
31
  kbd,
38
32
  link,
39
33
  ogp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elmethis/vue",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,32 +24,32 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@mdi/js": "^7.4.47",
27
- "@vueuse/core": "^14.1.0",
27
+ "@vueuse/core": "^14.2.1",
28
28
  "fuse.js": "^7.1.0",
29
29
  "katex": "^0.16.28",
30
30
  "lodash-es": "^4.17.23",
31
- "marked": "^17.0.1",
32
- "mermaid": "^11.12.2",
31
+ "marked": "^17.0.3",
32
+ "mermaid": "^11.12.3",
33
33
  "nanoid": "^5.1.6",
34
34
  "polished": "^4.3.1",
35
- "shiki": "^3.21.0"
35
+ "shiki": "^3.22.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@ag-ui/core": "^0.0.43",
38
+ "@ag-ui/core": "^0.0.45",
39
39
  "@notionhq/client": "^5.9.0",
40
- "storybook": "^10.2.2",
41
- "@storybook/addon-docs": "^10.2.2",
42
- "@storybook/vue3-vite": "10.2.2",
40
+ "storybook": "^10.2.10",
41
+ "@storybook/addon-docs": "^10.2.10",
42
+ "@storybook/vue3-vite": "10.2.10",
43
43
  "@types/json-schema": "^7.0.15",
44
44
  "@types/katex": "^0.16.8",
45
45
  "@types/lodash-es": "^4.17.12",
46
- "@types/prismjs": "^1.26.5",
47
- "@vitejs/plugin-vue": "^6.0.3",
46
+ "@types/prismjs": "^1.26.6",
47
+ "@vitejs/plugin-vue": "^6.0.4",
48
48
  "csstype": "^3.2.3",
49
49
  "jarkup-ts": "^0.6.0",
50
50
  "openapi-types": "^12.1.3",
51
51
  "postcss": "^8.5.6",
52
- "postcss-preset-env": "^11.1.2",
52
+ "postcss-preset-env": "^11.1.3",
53
53
  "sass": "^1.97.3",
54
54
  "vite": "^7.3.1",
55
55
  "vite-plugin-css-injected-by-js": "^3.5.2",