@markdown-next/vue 0.0.2-alpha → 1.0.0
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.
- package/dist/components/MarkdownRenderer.d.ts +12 -1
- package/dist/index.mjs +151 -139
- package/dist/types.d.ts +3 -1
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
2
|
import type { ParserOptions } from '@markdown-next/parser';
|
|
3
|
-
import type { MarkdownComponent, MarkdownComponents } from '../types';
|
|
3
|
+
import type { LoadingSlot, MarkdownComponent, MarkdownComponents } from '../types';
|
|
4
4
|
export declare const MarkdownRenderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
markdown: {
|
|
6
6
|
type: StringConstructor;
|
|
@@ -29,6 +29,11 @@ export declare const MarkdownRenderer: import("vue").DefineComponent<import("vue
|
|
|
29
29
|
type: NumberConstructor;
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
+
loadingSlot: {
|
|
33
|
+
type: PropType<LoadingSlot>;
|
|
34
|
+
required: false;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
32
37
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
38
|
markdown: {
|
|
34
39
|
type: StringConstructor;
|
|
@@ -57,10 +62,16 @@ export declare const MarkdownRenderer: import("vue").DefineComponent<import("vue
|
|
|
57
62
|
type: NumberConstructor;
|
|
58
63
|
default: number;
|
|
59
64
|
};
|
|
65
|
+
loadingSlot: {
|
|
66
|
+
type: PropType<LoadingSlot>;
|
|
67
|
+
required: false;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
60
70
|
}>> & Readonly<{}>, {
|
|
61
71
|
parserOptions: ParserOptions;
|
|
62
72
|
codeRenderer: MarkdownComponent;
|
|
63
73
|
components: MarkdownComponents;
|
|
64
74
|
dynamic: boolean;
|
|
65
75
|
debounceMs: number;
|
|
76
|
+
loadingSlot: LoadingSlot;
|
|
66
77
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { h, Fragment as
|
|
2
|
-
import { createParser as
|
|
3
|
-
const
|
|
1
|
+
import { h, Fragment as O, shallowRef as j, ref as k, watch as C, unref as x, onBeforeUnmount as R, defineComponent as T, useAttrs as E, toRef as L, inject as H, computed as b, onErrorCaptured as J, createVNode as y, mergeProps as G, createTextVNode as S, provide as D } from "vue";
|
|
2
|
+
import { createParser as I, createWorkerPool as U } from "@markdown-next/parser";
|
|
3
|
+
const M = Symbol("MarkdownWorkerPoll"), V = {
|
|
4
4
|
color: "#1f2328",
|
|
5
5
|
backgroundColor: "#ffffff",
|
|
6
6
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif',
|
|
7
7
|
fontSize: "16px",
|
|
8
8
|
lineHeight: "1.5",
|
|
9
9
|
wordWrap: "break-word"
|
|
10
|
-
},
|
|
10
|
+
}, P = {
|
|
11
11
|
h1: {
|
|
12
12
|
fontSize: "2em",
|
|
13
13
|
fontWeight: 600,
|
|
@@ -124,47 +124,47 @@ const R = Symbol("MarkdownWorkerPoll"), I = {
|
|
|
124
124
|
del: {
|
|
125
125
|
color: "#656d76"
|
|
126
126
|
}
|
|
127
|
-
},
|
|
128
|
-
function
|
|
127
|
+
}, _ = "mjx-", K = /* @__PURE__ */ new Set(["math"]);
|
|
128
|
+
function N(e) {
|
|
129
129
|
if (!e) return {};
|
|
130
130
|
const n = { ...e };
|
|
131
131
|
return "className" in n && (n.class = n.className, delete n.className), "htmlFor" in n && (n.for = n.htmlFor, delete n.htmlFor), n;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function q(e, n) {
|
|
134
134
|
return n ? Array.isArray(n) ? [e ?? {}, ...n] : [e ?? {}, n] : e;
|
|
135
135
|
}
|
|
136
136
|
function c(e) {
|
|
137
137
|
return (n) => {
|
|
138
|
-
const { children:
|
|
138
|
+
const { children: t, style: r, ...l } = n, i = { ...l };
|
|
139
139
|
delete i.node;
|
|
140
|
-
const d =
|
|
141
|
-
return d === void 0 ? h(e,
|
|
140
|
+
const d = t ?? void 0, u = { ...i, style: q(P[e], r) };
|
|
141
|
+
return d === void 0 ? h(e, u) : h(e, u, d);
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function X() {
|
|
145
145
|
return (e) => {
|
|
146
146
|
const {
|
|
147
147
|
children: n,
|
|
148
|
-
style:
|
|
149
|
-
class:
|
|
150
|
-
className:
|
|
148
|
+
style: t,
|
|
149
|
+
class: r,
|
|
150
|
+
className: l,
|
|
151
151
|
...i
|
|
152
152
|
} = e, d = { ...i };
|
|
153
153
|
delete d.node;
|
|
154
|
-
const
|
|
155
|
-
fontFamily:
|
|
156
|
-
fontSize:
|
|
154
|
+
const u = r ?? l, m = typeof u == "string" ? u : void 0, p = !!(m && m.includes("language-")), f = P.code ?? {}, s = p ? {
|
|
155
|
+
fontFamily: f.fontFamily,
|
|
156
|
+
fontSize: f.fontSize,
|
|
157
157
|
padding: 0,
|
|
158
158
|
backgroundColor: "transparent"
|
|
159
|
-
} :
|
|
159
|
+
} : f, g = n ?? void 0, o = {
|
|
160
160
|
...d,
|
|
161
|
-
class:
|
|
162
|
-
style:
|
|
161
|
+
class: u,
|
|
162
|
+
style: q(s, t)
|
|
163
163
|
};
|
|
164
|
-
return
|
|
164
|
+
return g === void 0 ? h("code", o) : h("code", o, g);
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Q() {
|
|
168
168
|
return {
|
|
169
169
|
h1: c("h1"),
|
|
170
170
|
h2: c("h2"),
|
|
@@ -181,7 +181,7 @@ function _() {
|
|
|
181
181
|
th: c("th"),
|
|
182
182
|
td: c("td"),
|
|
183
183
|
pre: c("pre"),
|
|
184
|
-
code:
|
|
184
|
+
code: X(),
|
|
185
185
|
a: c("a"),
|
|
186
186
|
hr: c("hr"),
|
|
187
187
|
img: c("img"),
|
|
@@ -189,52 +189,52 @@ function _() {
|
|
|
189
189
|
del: c("del")
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
const
|
|
193
|
-
function
|
|
192
|
+
const Y = Q();
|
|
193
|
+
function Z(e) {
|
|
194
194
|
const n = { ...e };
|
|
195
|
-
for (const
|
|
196
|
-
(
|
|
195
|
+
for (const t of Object.keys(n))
|
|
196
|
+
(t.startsWith(_) || K.has(t)) && delete n[t];
|
|
197
197
|
return n;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function $(e) {
|
|
200
200
|
const n = {
|
|
201
|
-
...
|
|
201
|
+
...Y,
|
|
202
202
|
...(e == null ? void 0 : e.components) ?? {}
|
|
203
203
|
};
|
|
204
|
-
return e != null && e.codeRenderer && (n.code = e.codeRenderer),
|
|
204
|
+
return e != null && e.codeRenderer && (n.code = e.codeRenderer), Z(n);
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
const
|
|
206
|
+
const w = (e, n, t) => {
|
|
207
|
+
const r = N(n), { children: l, ...i } = r, d = t == null ? i : { ...i, key: t };
|
|
208
208
|
if (typeof e == "string") {
|
|
209
|
-
const
|
|
210
|
-
return delete
|
|
209
|
+
const m = { ...d };
|
|
210
|
+
return delete m.node, l == null ? h(e, m) : h(e, m, l);
|
|
211
211
|
}
|
|
212
|
-
if (
|
|
212
|
+
if (l == null)
|
|
213
213
|
return h(e, d);
|
|
214
|
-
const
|
|
215
|
-
return h(e,
|
|
214
|
+
const u = { ...d, children: l };
|
|
215
|
+
return h(e, u, l);
|
|
216
216
|
};
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
for (let
|
|
220
|
-
const
|
|
221
|
-
|
|
217
|
+
function v(e, n) {
|
|
218
|
+
const t = [];
|
|
219
|
+
for (let r = 0; r < e.children.length; r += 1) {
|
|
220
|
+
const l = z(e.children[r], n, r);
|
|
221
|
+
l != null && t.push(l);
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return t;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function z(e, n, t) {
|
|
226
226
|
switch (e.type) {
|
|
227
227
|
case "root": {
|
|
228
|
-
const
|
|
229
|
-
return
|
|
228
|
+
const r = v(e, n);
|
|
229
|
+
return r.length ? w(O, { children: r }, void 0) : null;
|
|
230
230
|
}
|
|
231
231
|
case "element": {
|
|
232
|
-
const
|
|
233
|
-
|
|
232
|
+
const r = e, l = n[r.tagName] ?? r.tagName, i = N(
|
|
233
|
+
r.properties ?? {}
|
|
234
234
|
);
|
|
235
|
-
i.node =
|
|
236
|
-
const d =
|
|
237
|
-
return
|
|
235
|
+
i.node = r;
|
|
236
|
+
const d = r.tagName === "template" && r.content ? r.content : r, u = v(d, n);
|
|
237
|
+
return u.length && (i.children = u), w(l, i, t == null ? void 0 : t.toString());
|
|
238
238
|
}
|
|
239
239
|
case "text":
|
|
240
240
|
return e.value;
|
|
@@ -244,11 +244,11 @@ function q(e, n, r) {
|
|
|
244
244
|
return null;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
249
|
-
return
|
|
247
|
+
function A(e, n) {
|
|
248
|
+
const t = $(n);
|
|
249
|
+
return z(e, t);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function B(e) {
|
|
252
252
|
if (e instanceof Error) return e;
|
|
253
253
|
if (typeof e == "string") return new Error(e);
|
|
254
254
|
try {
|
|
@@ -257,79 +257,79 @@ function A(e) {
|
|
|
257
257
|
return new Error("Unknown error");
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
const
|
|
262
|
-
let d = null,
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
260
|
+
function W(e, n, t) {
|
|
261
|
+
const r = j(null), l = k(!1), i = k(null);
|
|
262
|
+
let d = null, u = 0;
|
|
263
|
+
const m = async (f, s) => {
|
|
264
|
+
const g = ++u;
|
|
265
|
+
l.value = !0, i.value = null;
|
|
266
266
|
try {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
} catch (
|
|
270
|
-
|
|
267
|
+
const o = await n(f, s);
|
|
268
|
+
g === u && (r.value = o);
|
|
269
|
+
} catch (o) {
|
|
270
|
+
g === u && (i.value = B(o));
|
|
271
271
|
} finally {
|
|
272
|
-
|
|
272
|
+
g === u && (l.value = !1);
|
|
273
273
|
}
|
|
274
|
-
}, p = (
|
|
275
|
-
const
|
|
276
|
-
if (d != null && (globalThis.clearTimeout(d), d = null),
|
|
274
|
+
}, p = (f, s) => {
|
|
275
|
+
const g = (s == null ? void 0 : s.dynamic) ?? !1, o = (s == null ? void 0 : s.debounceMs) ?? 250;
|
|
276
|
+
if (d != null && (globalThis.clearTimeout(d), d = null), g) {
|
|
277
277
|
d = globalThis.setTimeout(() => {
|
|
278
|
-
f
|
|
279
|
-
},
|
|
278
|
+
m(f, s);
|
|
279
|
+
}, o);
|
|
280
280
|
return;
|
|
281
281
|
}
|
|
282
|
-
f
|
|
282
|
+
m(f, s);
|
|
283
283
|
};
|
|
284
|
-
return
|
|
285
|
-
() => [x(e),
|
|
286
|
-
([
|
|
287
|
-
p(
|
|
284
|
+
return C(
|
|
285
|
+
() => [x(e), t ? x(t) : void 0],
|
|
286
|
+
([f, s]) => {
|
|
287
|
+
p(f ?? "", s);
|
|
288
288
|
},
|
|
289
289
|
{ immediate: !0, deep: !0 }
|
|
290
|
-
),
|
|
290
|
+
), R(() => {
|
|
291
291
|
d != null && globalThis.clearTimeout(d);
|
|
292
292
|
}), {
|
|
293
|
-
content:
|
|
294
|
-
loading:
|
|
293
|
+
content: r,
|
|
294
|
+
loading: l,
|
|
295
295
|
error: i
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
const
|
|
300
|
-
return
|
|
298
|
+
function ee(e, n, t) {
|
|
299
|
+
const r = I(n ?? {});
|
|
300
|
+
return W(
|
|
301
301
|
e,
|
|
302
|
-
async (
|
|
303
|
-
const d = await
|
|
304
|
-
return
|
|
302
|
+
async (l, i) => {
|
|
303
|
+
const d = await r.parseToHAST(l);
|
|
304
|
+
return A(d, i);
|
|
305
305
|
},
|
|
306
|
-
|
|
306
|
+
t
|
|
307
307
|
);
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
309
|
+
function ne(e, n, t) {
|
|
310
|
+
return W(
|
|
311
311
|
e,
|
|
312
|
-
async (
|
|
313
|
-
const i = await n.parseToHAST(
|
|
314
|
-
return
|
|
312
|
+
async (r, l) => {
|
|
313
|
+
const i = await n.parseToHAST(r);
|
|
314
|
+
return A(i, l);
|
|
315
315
|
},
|
|
316
|
-
|
|
316
|
+
t
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
|
-
const
|
|
319
|
+
const re = {
|
|
320
320
|
display: "inline-flex",
|
|
321
321
|
alignItems: "center",
|
|
322
322
|
gap: "8px",
|
|
323
323
|
color: "#57606a",
|
|
324
324
|
fontSize: "14px"
|
|
325
|
-
},
|
|
325
|
+
}, te = {
|
|
326
326
|
padding: "12px 16px",
|
|
327
327
|
borderRadius: "8px",
|
|
328
328
|
backgroundColor: "#ffebe9",
|
|
329
329
|
color: "#cf222e",
|
|
330
330
|
border: "1px solid #ff8182",
|
|
331
331
|
fontSize: "14px"
|
|
332
|
-
},
|
|
332
|
+
}, le = /* @__PURE__ */ T({
|
|
333
333
|
name: "MarkdownRenderer",
|
|
334
334
|
inheritAttrs: !1,
|
|
335
335
|
props: {
|
|
@@ -359,36 +359,45 @@ const ee = {
|
|
|
359
359
|
debounceMs: {
|
|
360
360
|
type: Number,
|
|
361
361
|
default: 250
|
|
362
|
+
},
|
|
363
|
+
loadingSlot: {
|
|
364
|
+
type: [Object, Function],
|
|
365
|
+
required: !1,
|
|
366
|
+
default: void 0
|
|
362
367
|
}
|
|
363
368
|
},
|
|
364
369
|
setup(e) {
|
|
365
|
-
const n =
|
|
370
|
+
const n = E(), t = L(e, "markdown"), r = H(M, null), l = k(null), i = b(() => {
|
|
366
371
|
const o = {
|
|
367
372
|
dynamic: e.dynamic,
|
|
368
373
|
debounceMs: e.debounceMs
|
|
369
374
|
};
|
|
370
|
-
if (
|
|
371
|
-
const
|
|
372
|
-
return
|
|
375
|
+
if (r != null && r.forceRenderOptions.value) {
|
|
376
|
+
const a = r.renderOptions.value;
|
|
377
|
+
return a != null && a.components && (o.components = a.components), a != null && a.codeRenderer && (o.codeRenderer = a.codeRenderer), a != null && a.loadingSlot && (o.loadingSlot = a.loadingSlot), o.dynamic = (a == null ? void 0 : a.dynamic) ?? !1, o.debounceMs = (a == null ? void 0 : a.debounceMs) ?? 250, o;
|
|
373
378
|
}
|
|
374
|
-
return e.components && (o.components = e.components), e.codeRenderer && (o.codeRenderer = e.codeRenderer), o;
|
|
375
|
-
}), d =
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
return e.components && (o.components = e.components), e.codeRenderer && (o.codeRenderer = e.codeRenderer), e.loadingSlot && (o.loadingSlot = e.loadingSlot), o;
|
|
380
|
+
}), d = r ? ne(t, r.pool, i) : ee(t, e.parserOptions, i);
|
|
381
|
+
J((o) => (l.value = B(o), !1)), C(t, () => {
|
|
382
|
+
l.value = null;
|
|
378
383
|
});
|
|
379
|
-
const
|
|
380
|
-
const
|
|
384
|
+
const u = b(() => [V, n.style]), m = b(() => {
|
|
385
|
+
const a = {
|
|
381
386
|
...n
|
|
382
387
|
};
|
|
383
|
-
return delete
|
|
384
|
-
}), p = () =>
|
|
385
|
-
|
|
386
|
-
|
|
388
|
+
return delete a.style, a;
|
|
389
|
+
}), p = b(() => {
|
|
390
|
+
var a;
|
|
391
|
+
const o = (a = r == null ? void 0 : r.renderOptions.value) == null ? void 0 : a.loadingSlot;
|
|
392
|
+
return o || e.loadingSlot;
|
|
393
|
+
}), f = () => y("div", {
|
|
394
|
+
style: re
|
|
395
|
+
}, [y("svg", {
|
|
387
396
|
width: "16",
|
|
388
397
|
height: "16",
|
|
389
398
|
viewBox: "0 0 50 50",
|
|
390
399
|
"aria-hidden": "true"
|
|
391
|
-
}, [
|
|
400
|
+
}, [y("circle", {
|
|
392
401
|
cx: "25",
|
|
393
402
|
cy: "25",
|
|
394
403
|
r: "20",
|
|
@@ -397,24 +406,27 @@ const ee = {
|
|
|
397
406
|
"stroke-width": "4",
|
|
398
407
|
"stroke-linecap": "round",
|
|
399
408
|
"stroke-dasharray": "31.4 31.4"
|
|
400
|
-
}, [
|
|
409
|
+
}, [y("animateTransform", {
|
|
401
410
|
attributeName: "transform",
|
|
402
411
|
type: "rotate",
|
|
403
412
|
from: "0 25 25",
|
|
404
413
|
to: "360 25 25",
|
|
405
414
|
dur: "1s",
|
|
406
415
|
repeatCount: "indefinite"
|
|
407
|
-
}, null)])]),
|
|
408
|
-
|
|
409
|
-
|
|
416
|
+
}, null)])]), y("span", null, [S("Rendering markdown...")])]), s = () => {
|
|
417
|
+
const o = p.value;
|
|
418
|
+
return o ? h(o) : f();
|
|
419
|
+
}, g = (o) => y("div", {
|
|
420
|
+
style: te
|
|
421
|
+
}, [y("strong", null, [S("Markdown render error:")]), S(" "), o.message]);
|
|
410
422
|
return () => {
|
|
411
|
-
const o =
|
|
412
|
-
return
|
|
413
|
-
style:
|
|
414
|
-
}), [o ?
|
|
423
|
+
const o = l.value ?? d.error.value, a = d.content.value, F = d.loading.value && !a && !o;
|
|
424
|
+
return y("div", G(m.value, {
|
|
425
|
+
style: u.value
|
|
426
|
+
}), [o ? g(o) : F ? s() : a]);
|
|
415
427
|
};
|
|
416
428
|
}
|
|
417
|
-
}),
|
|
429
|
+
}), ae = /* @__PURE__ */ T({
|
|
418
430
|
name: "MarkdownWorkerPoll",
|
|
419
431
|
props: {
|
|
420
432
|
parserOptions: {
|
|
@@ -451,11 +463,6 @@ const ee = {
|
|
|
451
463
|
required: !1,
|
|
452
464
|
default: void 0
|
|
453
465
|
},
|
|
454
|
-
supportsLaTeX: {
|
|
455
|
-
type: Boolean,
|
|
456
|
-
required: !1,
|
|
457
|
-
default: void 0
|
|
458
|
-
},
|
|
459
466
|
components: {
|
|
460
467
|
type: Object,
|
|
461
468
|
required: !1,
|
|
@@ -475,30 +482,35 @@ const ee = {
|
|
|
475
482
|
type: Number,
|
|
476
483
|
required: !1,
|
|
477
484
|
default: void 0
|
|
485
|
+
},
|
|
486
|
+
loadingSlot: {
|
|
487
|
+
type: [Object, Function],
|
|
488
|
+
required: !1,
|
|
489
|
+
default: void 0
|
|
478
490
|
}
|
|
479
491
|
},
|
|
480
492
|
setup(e, {
|
|
481
493
|
slots: n
|
|
482
494
|
}) {
|
|
483
|
-
const
|
|
495
|
+
const t = {
|
|
484
496
|
...e.parserOptions ?? {}
|
|
485
497
|
};
|
|
486
|
-
e.workerCount != null && (
|
|
487
|
-
const
|
|
488
|
-
if (e.components == null && e.codeRenderer == null && e.dynamic == null && e.debounceMs == null)
|
|
498
|
+
e.workerCount != null && (t.workerCount = e.workerCount), e.customTags && (t.customTags = e.customTags), e.extendedGrammar && (t.extendedGrammar = e.extendedGrammar), e.remarkPlugins && (t.remarkPlugins = e.remarkPlugins), e.rehypePlugins && (t.rehypePlugins = e.rehypePlugins), e.mathJaxConfig && (t.mathJaxConfig = e.mathJaxConfig);
|
|
499
|
+
const r = U(t), l = b(() => {
|
|
500
|
+
if (e.components == null && e.codeRenderer == null && e.dynamic == null && e.debounceMs == null && e.loadingSlot == null)
|
|
489
501
|
return;
|
|
490
502
|
const d = {
|
|
491
503
|
dynamic: e.dynamic ?? !1,
|
|
492
504
|
debounceMs: e.debounceMs ?? 250
|
|
493
505
|
};
|
|
494
|
-
return e.components && (d.components = e.components), e.codeRenderer && (d.codeRenderer = e.codeRenderer), d;
|
|
495
|
-
}), i =
|
|
496
|
-
return
|
|
497
|
-
pool:
|
|
498
|
-
renderOptions:
|
|
506
|
+
return e.components && (d.components = e.components), e.codeRenderer && (d.codeRenderer = e.codeRenderer), e.loadingSlot && (d.loadingSlot = e.loadingSlot), d;
|
|
507
|
+
}), i = b(() => l.value !== void 0);
|
|
508
|
+
return D(M, {
|
|
509
|
+
pool: r,
|
|
510
|
+
renderOptions: l,
|
|
499
511
|
forceRenderOptions: i
|
|
500
|
-
}),
|
|
501
|
-
|
|
512
|
+
}), R(() => {
|
|
513
|
+
r.destroy();
|
|
502
514
|
}), () => {
|
|
503
515
|
var d;
|
|
504
516
|
return (d = n.default) == null ? void 0 : d.call(n);
|
|
@@ -506,8 +518,8 @@ const ee = {
|
|
|
506
518
|
}
|
|
507
519
|
});
|
|
508
520
|
export {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
521
|
+
le as MarkdownRenderer,
|
|
522
|
+
ae as MarkdownWorkerPoll,
|
|
523
|
+
ee as useMarkdownParser,
|
|
524
|
+
ne as useMarkdownWorkerPool
|
|
513
525
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { Component, FunctionalComponent, Ref } from 'vue';
|
|
1
|
+
import type { Component, FunctionalComponent, Ref, VNodeChild } from 'vue';
|
|
2
2
|
import type { ParserOptions } from '@markdown-next/parser';
|
|
3
3
|
export type MarkdownComponent = Component | FunctionalComponent | string;
|
|
4
4
|
export type MarkdownComponents = Record<string, MarkdownComponent>;
|
|
5
|
+
export type LoadingSlot = Component | FunctionalComponent | (() => VNodeChild);
|
|
5
6
|
export interface MarkdownRenderOptions {
|
|
6
7
|
components?: MarkdownComponents;
|
|
7
8
|
codeRenderer?: MarkdownComponent;
|
|
8
9
|
dynamic?: boolean;
|
|
9
10
|
debounceMs?: number;
|
|
11
|
+
loadingSlot?: LoadingSlot;
|
|
10
12
|
}
|
|
11
13
|
export interface MarkdownRendererProps extends MarkdownRenderOptions {
|
|
12
14
|
markdown: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markdown-next/vue",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue renderer for markdown-next",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/
|
|
29
|
+
"url": "https://github.com/UnboundedWeb/vue-markdown-next.git",
|
|
30
30
|
"directory": "packages/vue"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
33
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/UnboundedWeb/vue-markdown-next/issues"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=16.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"hast-util-to-jsx-runtime": "^2.3.0",
|
|
40
|
-
"@markdown-next/parser": "0.0
|
|
40
|
+
"@markdown-next/parser": "1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/hast": "^3.0.4",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"dev": "vite",
|
|
56
56
|
"build": "vite build && tsc -p tsconfig.build.json",
|
|
57
|
-
"typecheck": "tsc -
|
|
57
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
58
58
|
"lint": "eslint src --ext .ts,.tsx",
|
|
59
59
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
60
|
-
"test": "vitest"
|
|
60
|
+
"test": "vitest --run --passWithNoTests"
|
|
61
61
|
}
|
|
62
62
|
}
|