@elmethis/core 0.5.0 → 0.5.2
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,5 +1,8 @@
|
|
|
1
1
|
export interface ElmMarkdownProps {
|
|
2
2
|
markdown: string;
|
|
3
|
+
tag?: keyof HTMLElementTagNameMap;
|
|
3
4
|
}
|
|
4
|
-
declare const _default: import('vue').DefineComponent<ElmMarkdownProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ElmMarkdownProps> & Readonly<{}>, {
|
|
5
|
+
declare const _default: import('vue').DefineComponent<ElmMarkdownProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ElmMarkdownProps> & Readonly<{}>, {
|
|
6
|
+
tag: keyof HTMLElementTagNameMap;
|
|
7
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
5
8
|
export default _default;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
import { defineComponent, defineAsyncComponent,
|
|
13
|
+
import { defineComponent, defineAsyncComponent, createBlock, openBlock, resolveDynamicComponent, withCtx, unref, h } from "vue";
|
|
14
14
|
import { marked as d } from "../../node_modules/.pnpm/marked@16.2.0/node_modules/marked/lib/marked.esm.mjs";
|
|
15
15
|
import "@mdi/js";
|
|
16
16
|
import "polished";
|
|
@@ -27,9 +27,11 @@ import "nanoid";
|
|
|
27
27
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
28
28
|
__name: "ElmMarkdown",
|
|
29
29
|
props: {
|
|
30
|
-
markdown: {}
|
|
30
|
+
markdown: {},
|
|
31
|
+
tag: { default: "div" }
|
|
31
32
|
},
|
|
32
33
|
setup(__props) {
|
|
34
|
+
const props = __props;
|
|
33
35
|
const AsyncElmInlineText = defineAsyncComponent({
|
|
34
36
|
loader: () => import("../typography/ElmInlineText.vue.mjs")
|
|
35
37
|
});
|
|
@@ -91,7 +93,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
91
93
|
h(
|
|
92
94
|
AsyncElmBlockQuote,
|
|
93
95
|
{},
|
|
94
|
-
{
|
|
96
|
+
{
|
|
97
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
98
|
+
}
|
|
95
99
|
)
|
|
96
100
|
);
|
|
97
101
|
}
|
|
@@ -118,7 +122,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
118
122
|
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
119
123
|
AsyncElmInlineText,
|
|
120
124
|
{ strikethrough: true },
|
|
121
|
-
{
|
|
125
|
+
{
|
|
126
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
127
|
+
}
|
|
122
128
|
) : h(AsyncElmInlineText, { text: token.text, strikethrough: true })
|
|
123
129
|
);
|
|
124
130
|
break;
|
|
@@ -127,7 +133,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
127
133
|
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
128
134
|
AsyncElmInlineText,
|
|
129
135
|
{ italic: true },
|
|
130
|
-
{
|
|
136
|
+
{
|
|
137
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
138
|
+
}
|
|
131
139
|
) : h(AsyncElmInlineText, { text: token.text, italic: true })
|
|
132
140
|
);
|
|
133
141
|
break;
|
|
@@ -139,7 +147,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
139
147
|
h(
|
|
140
148
|
AsyncElmHeading,
|
|
141
149
|
{ level: token.depth },
|
|
142
|
-
{
|
|
150
|
+
{
|
|
151
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
152
|
+
}
|
|
143
153
|
)
|
|
144
154
|
);
|
|
145
155
|
} else {
|
|
@@ -168,7 +178,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
168
178
|
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
169
179
|
AsyncElmInlineText,
|
|
170
180
|
{ href: token.href },
|
|
171
|
-
{
|
|
181
|
+
{
|
|
182
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
183
|
+
}
|
|
172
184
|
) : h(AsyncElmInlineText, { text: token.text, href: token.href })
|
|
173
185
|
);
|
|
174
186
|
break;
|
|
@@ -182,13 +194,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
182
194
|
{
|
|
183
195
|
listStyle: token.ordered ? "ordered" : "unordered"
|
|
184
196
|
},
|
|
185
|
-
{ default: listItems }
|
|
197
|
+
{ default: () => listItems }
|
|
186
198
|
)
|
|
187
199
|
);
|
|
188
200
|
break;
|
|
189
201
|
case "list_item":
|
|
190
202
|
results.push(
|
|
191
|
-
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
203
|
+
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
204
|
+
"li",
|
|
205
|
+
{},
|
|
206
|
+
{
|
|
207
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
208
|
+
}
|
|
209
|
+
) : h("li", { text: token.text })
|
|
192
210
|
);
|
|
193
211
|
break;
|
|
194
212
|
case "paragraph":
|
|
@@ -197,7 +215,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
197
215
|
h(
|
|
198
216
|
AsyncElmParagraph,
|
|
199
217
|
{},
|
|
200
|
-
{
|
|
218
|
+
{
|
|
219
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
220
|
+
}
|
|
201
221
|
)
|
|
202
222
|
);
|
|
203
223
|
}
|
|
@@ -209,7 +229,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
209
229
|
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
210
230
|
AsyncElmInlineText,
|
|
211
231
|
{ bold: true },
|
|
212
|
-
{
|
|
232
|
+
{
|
|
233
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
234
|
+
}
|
|
213
235
|
) : h(AsyncElmInlineText, { text: token.text, bold: true })
|
|
214
236
|
);
|
|
215
237
|
break;
|
|
@@ -220,23 +242,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
220
242
|
(cell) => h(
|
|
221
243
|
AsyncElmTableCell,
|
|
222
244
|
{},
|
|
223
|
-
{ default: renderByToken({ tokens: cell.tokens }) }
|
|
245
|
+
{ default: () => renderByToken({ tokens: cell.tokens }) }
|
|
224
246
|
)
|
|
225
247
|
);
|
|
226
248
|
const headerRow = h(
|
|
227
249
|
AsyncElmTableRow,
|
|
228
250
|
{},
|
|
229
|
-
{ default: renderTableCells({ cells: token.header }) }
|
|
251
|
+
{ default: () => renderTableCells({ cells: token.header }) }
|
|
230
252
|
);
|
|
231
253
|
const bodyRows = token.rows.map(
|
|
232
|
-
(row) => h(
|
|
254
|
+
(row) => h(
|
|
255
|
+
AsyncElmTableRow,
|
|
256
|
+
{},
|
|
257
|
+
{ default: () => renderTableCells({ cells: row }) }
|
|
258
|
+
)
|
|
233
259
|
);
|
|
234
260
|
const table = h(
|
|
235
261
|
AsyncElmTable,
|
|
236
262
|
{},
|
|
237
263
|
{
|
|
238
|
-
header: h(AsyncElmTableHeader, {}, { default: headerRow }),
|
|
239
|
-
body: h(AsyncElmTableBody, {}, { default: bodyRows })
|
|
264
|
+
header: () => h(AsyncElmTableHeader, {}, { default: () => headerRow }),
|
|
265
|
+
body: () => h(AsyncElmTableBody, {}, { default: () => bodyRows })
|
|
240
266
|
}
|
|
241
267
|
);
|
|
242
268
|
results.push(table);
|
|
@@ -246,7 +272,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
246
272
|
token.tokens != null && token.tokens.length !== 0 ? h(
|
|
247
273
|
AsyncElmInlineText,
|
|
248
274
|
{},
|
|
249
|
-
{
|
|
275
|
+
{
|
|
276
|
+
default: () => renderByToken({ tokens: token.tokens })
|
|
277
|
+
}
|
|
250
278
|
) : h(AsyncElmInlineText, { text: token.text })
|
|
251
279
|
);
|
|
252
280
|
break;
|
|
@@ -258,10 +286,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
258
286
|
const tokens = d.setOptions({ gfm: true }).lexer(markdown);
|
|
259
287
|
return renderByToken({ tokens });
|
|
260
288
|
};
|
|
289
|
+
const renderResult = render({ markdown: props.markdown });
|
|
261
290
|
return (_ctx, _cache) => {
|
|
262
|
-
return openBlock(),
|
|
263
|
-
|
|
264
|
-
|
|
291
|
+
return openBlock(), createBlock(resolveDynamicComponent(), null, {
|
|
292
|
+
default: withCtx(() => [
|
|
293
|
+
(openBlock(), createBlock(resolveDynamicComponent(() => unref(renderResult))))
|
|
294
|
+
]),
|
|
295
|
+
_: 1
|
|
296
|
+
});
|
|
265
297
|
};
|
|
266
298
|
}
|
|
267
299
|
});
|