@cocoar/vue-markdown 1.6.4 → 1.6.5

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/index.css CHANGED
@@ -1 +1,2 @@
1
- .coar-markdown{display:block;--coar-markdown-text: var(--coar-text-neutral-primary);--coar-markdown-link: var(--coar-text-brand-primary, var(--coar-text-neutral-primary));--coar-markdown-muted-text: var(--coar-text-neutral-tertiary);--coar-markdown-border: var(--coar-border-neutral-tertiary);--coar-markdown-surface: var(--coar-background-neutral-primary);--coar-markdown-surface-muted: var( --coar-background-neutral-tertiary, var(--coar-background-neutral-primary) );--coar-markdown-radius: var(--coar-radius-xs);--coar-markdown-space-1: var(--coar-spacing-s, .5rem);--coar-markdown-space-2: var(--coar-spacing-m, 1rem);--coar-markdown-heading-block-start: var(--coar-spacing-xxxl, 4rem);color:var(--coar-markdown-text)}.coar-markdown :where(h1,h2,h3,h4,h5,h6){font-family:var(--coar-font-family-title, inherit);color:var(--coar-markdown-text)}.coar-markdown h1{font-size:var(--coar-font-size-xl);font-weight:var(--coar-font-weight-bold);line-height:var(--coar-line-height-tight)}.coar-markdown h2{font-size:var(--coar-font-size-l);font-weight:var(--coar-font-weight-bold);line-height:1.25}.coar-markdown h3{font-size:var(--coar-font-size-m);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-snug)}.coar-markdown h4{font-size:var(--coar-font-size-s);font-weight:var(--coar-font-weight-semi-bold);line-height:1.35}.coar-markdown h5{font-size:var(--coar-font-size-xs);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-normal)}.coar-markdown h6{font-size:var(--coar-font-size-xxs);font-weight:var(--coar-font-weight-medium);line-height:1.45}.coar-markdown-heading,.coar-markdown-paragraph,.coar-markdown-blockquote,.coar-markdown-list,.coar-markdown-code-block,.coar-markdown-table,.coar-markdown-hr{margin:0}.coar-markdown>:where(h1,h2,h3,h4,h5,h6,p,blockquote,ul,ol,pre,table,hr,.coar-code-block-host,.coar-table-host){margin-block:0 var(--coar-markdown-space-2)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-heading-block-start)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6)+:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-space-1)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6):first-child{margin-block-start:0}.coar-markdown-blockquote{padding-inline:var(--coar-markdown-space-2);border-left:2px solid var(--coar-markdown-border)}.coar-markdown-list{padding-inline-start:var(--coar-spacing-l, 1.5rem);list-style-position:outside}.coar-markdown-list--unordered{list-style-type:disc}.coar-markdown-list--ordered{list-style-type:decimal}.coar-markdown-list-item{display:list-item;margin-block:.25em}.coar-markdown-list-item--task{list-style:none;display:flex;align-items:flex-start;gap:var(--coar-spacing-s, .5rem)}.coar-markdown-list-item-content{min-width:0}.coar-markdown-task-checkbox{margin-top:.15em}.coar-markdown-code-block,.coar-markdown-code{display:block}.coar-markdown-inline-code{padding:0;border:0;border-radius:0;background:transparent;color:var(--coar-text-accent-secondary, var(--coar-markdown-link))}.coar-markdown-link{text-decoration:underline;color:var(--coar-markdown-link)}.coar-markdown-image{max-width:100%;height:auto;vertical-align:middle}.coar-markdown-table{width:100%;border:1px solid var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);border-collapse:separate;border-spacing:0;overflow:hidden}.coar-markdown-table-cell{padding:var(--coar-markdown-space-1);vertical-align:top;border-right:1px solid var(--coar-markdown-border);border-bottom:1px solid var(--coar-markdown-border)}.coar-markdown-table :where(tr) .coar-markdown-table-cell:last-child{border-right:0}.coar-markdown-table :where(tbody) tr:last-child .coar-markdown-table-cell{border-bottom:0}.coar-markdown-table :where(thead) .coar-markdown-table-cell{background:var(--coar-markdown-surface-muted);font-weight:600}.coar-markdown-hr{border:0;border-top:1px solid var(--coar-markdown-border)}.coar-markdown-unsupported,.coar-markdown-unsupported-inline{font-style:italic;color:var(--coar-markdown-muted-text)}.coar-markdown-unsupported{padding:var(--coar-markdown-space-1);border:1px dashed var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);background:var(--coar-markdown-surface)}
1
+ .coar-markdown{--coar-markdown-text:var(--coar-text-neutral-primary);--coar-markdown-link:var(--coar-text-brand-primary,var(--coar-text-neutral-primary));--coar-markdown-muted-text:var(--coar-text-neutral-tertiary);--coar-markdown-border:var(--coar-border-neutral-tertiary);--coar-markdown-surface:var(--coar-background-neutral-primary);--coar-markdown-surface-muted:var(--coar-background-neutral-tertiary,var(--coar-background-neutral-primary));--coar-markdown-radius:var(--coar-radius-xs);--coar-markdown-space-1:var(--coar-spacing-s,.5rem);--coar-markdown-space-2:var(--coar-spacing-m,1rem);--coar-markdown-heading-block-start:var(--coar-spacing-xxxl,4rem);color:var(--coar-markdown-text);display:block}.coar-markdown :where(h1,h2,h3,h4,h5,h6){font-family:var(--coar-font-family-title,inherit);color:var(--coar-markdown-text)}.coar-markdown h1{font-size:var(--coar-font-size-xl);font-weight:var(--coar-font-weight-bold);line-height:var(--coar-line-height-tight)}.coar-markdown h2{font-size:var(--coar-font-size-l);font-weight:var(--coar-font-weight-bold);line-height:1.25}.coar-markdown h3{font-size:var(--coar-font-size-m);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-snug)}.coar-markdown h4{font-size:var(--coar-font-size-s);font-weight:var(--coar-font-weight-semi-bold);line-height:1.35}.coar-markdown h5{font-size:var(--coar-font-size-xs);font-weight:var(--coar-font-weight-semi-bold);line-height:var(--coar-line-height-normal)}.coar-markdown h6{font-size:var(--coar-font-size-xxs);font-weight:var(--coar-font-weight-medium);line-height:1.45}.coar-markdown-heading,.coar-markdown-paragraph,.coar-markdown-blockquote,.coar-markdown-list,.coar-markdown-code-block,.coar-markdown-table,.coar-markdown-hr{margin:0}.coar-markdown>:where(h1,h2,h3,h4,h5,h6,p,blockquote,ul,ol,pre,table,hr,.coar-code-block-host,.coar-table-host){margin-block:0 var(--coar-markdown-space-2)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-heading-block-start)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6)+:where(h1,h2,h3,h4,h5,h6){margin-block-start:var(--coar-markdown-space-1)}.coar-markdown>:where(h1,h2,h3,h4,h5,h6):first-child{margin-block-start:0}.coar-markdown-blockquote{padding-inline:var(--coar-markdown-space-2);border-left:2px solid var(--coar-markdown-border)}.coar-markdown-list{padding-inline-start:var(--coar-spacing-l,1.5rem);list-style-position:outside}.coar-markdown-list--unordered{list-style-type:disc}.coar-markdown-list--ordered{list-style-type:decimal}.coar-markdown-list-item{margin-block:.25em;display:list-item}.coar-markdown-list-item--task{align-items:flex-start;gap:var(--coar-spacing-s,.5rem);list-style:none;display:flex}.coar-markdown-list-item-content{min-width:0}.coar-markdown-task-checkbox{margin-top:.15em}.coar-markdown-code-block,.coar-markdown-code{display:block}.coar-markdown-inline-code{color:var(--coar-text-accent-secondary,var(--coar-markdown-link));background:0 0;border:0;border-radius:0;padding:0}.coar-markdown-link{color:var(--coar-markdown-link);text-decoration:underline}.coar-markdown-image{vertical-align:middle;max-width:100%;height:auto}.coar-markdown-table{border:1px solid var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);border-collapse:separate;border-spacing:0;width:100%;overflow:hidden}.coar-markdown-table-cell{padding:var(--coar-markdown-space-1);vertical-align:top;border-right:1px solid var(--coar-markdown-border);border-bottom:1px solid var(--coar-markdown-border)}.coar-markdown-table :where(tr) .coar-markdown-table-cell:last-child{border-right:0}.coar-markdown-table :where(tbody) tr:last-child .coar-markdown-table-cell{border-bottom:0}.coar-markdown-table :where(thead) .coar-markdown-table-cell{background:var(--coar-markdown-surface-muted);font-weight:600}.coar-markdown-hr{border:0;border-top:1px solid var(--coar-markdown-border)}.coar-markdown-unsupported,.coar-markdown-unsupported-inline{color:var(--coar-markdown-muted-text);font-style:italic}.coar-markdown-unsupported{padding:var(--coar-markdown-space-1);border:1px dashed var(--coar-markdown-border);border-radius:var(--coar-markdown-radius);background:var(--coar-markdown-surface)}
2
+ /*$vite$:1*/
package/dist/index.js CHANGED
@@ -1,293 +1,209 @@
1
- import { defineComponent as g, resolveComponent as T, openBlock as n, createElementBlock as l, Fragment as a, renderList as k, createTextVNode as A, toDisplayString as f, createVNode as i, unref as s, createBlock as p, createCommentVNode as _, resolveDynamicComponent as L, withCtx as C, normalizeClass as y, createElementVNode as m } from "vue";
2
- import { CoarCodeBlock as S, CoarTable as V } from "@cocoar/vue-ui";
3
- function q(r) {
4
- const e = r.attrs?.depth;
5
- if (typeof e != "number") return 1;
6
- const c = Math.trunc(e);
7
- return c <= 1 ? 1 : c === 2 ? 2 : c === 3 ? 3 : c === 4 ? 4 : c === 5 ? 5 : 6;
8
- }
9
- function D(r) {
10
- const e = r.attrs?.anchor;
11
- return typeof e == "string" && e.length > 0 ? e : null;
12
- }
13
- function E(r) {
14
- const e = r.attrs?.language;
15
- return typeof e == "string" && e.trim().length > 0 ? e.trim() : "text";
16
- }
17
- function I(r) {
18
- return !!r.attrs?.ordered;
19
- }
20
- function R(r) {
21
- const e = r.attrs?.start;
22
- return typeof e == "number" ? e : null;
23
- }
24
- function x(r) {
25
- return typeof r.attrs?.checked == "boolean";
26
- }
27
- function z(r) {
28
- return r.attrs?.checked === !0;
29
- }
30
- function w(r) {
31
- const e = r.attrs?.url;
32
- return typeof e == "string" && e.length > 0 ? e : null;
33
- }
34
- function v(r) {
35
- const e = w(r);
36
- return e ? e.startsWith("#") && typeof window < "u" ? `${window.location.pathname}${window.location.search}${e}` : e : null;
37
- }
38
- function U(r) {
39
- const e = w(r);
40
- return e && W(e) ? "_blank" : null;
41
- }
42
- function F(r) {
43
- const e = w(r);
44
- return e && W(e) ? "noopener noreferrer" : null;
45
- }
46
- function $(r) {
47
- const e = r.attrs?.url;
48
- return typeof e == "string" && e.trim().length > 0 ? e.trim() : null;
49
- }
50
- function H(r) {
51
- const e = r.attrs?.alt;
52
- return typeof e == "string" ? e : "";
53
- }
54
- function O(r) {
55
- const e = r.attrs?.title;
56
- return typeof e == "string" && e.trim().length > 0 ? e.trim() : null;
57
- }
58
- function B(r, e) {
59
- return M(r, e) === "right";
60
- }
61
- function N(r, e) {
62
- return M(r, e) === "center";
63
- }
64
- function j(r) {
65
- const e = r.attrs?.originalType;
66
- return typeof e == "string" ? e : String(r.type);
67
- }
68
- function M(r, e) {
69
- const c = r.attrs?.align;
70
- if (!Array.isArray(c)) return null;
71
- const o = c[e];
72
- return o === "left" || o === "right" || o === "center" ? o : null;
73
- }
74
- function W(r) {
75
- const e = r.trim();
76
- return e.startsWith("#") || e.startsWith("/") || e.startsWith("./") || e.startsWith("../") || e.startsWith("mailto:") || e.startsWith("tel:") ? !1 : e.startsWith("http://") || e.startsWith("https://");
77
- }
78
- const G = { key: 1 }, J = { key: 2 }, K = { key: 3 }, P = {
79
- key: 4,
80
- class: "coar-markdown-inline-code"
81
- }, Q = { key: 5 }, X = ["href", "target", "rel"], Y = ["src", "alt", "title"], Z = {
82
- key: 8,
83
- class: "coar-markdown-unsupported-inline"
84
- }, h = /* @__PURE__ */ g({
85
- __name: "MarkdownInlineNode",
86
- props: {
87
- nodes: {}
88
- },
89
- setup(r) {
90
- return (e, c) => {
91
- const o = T("MarkdownInlineNode", !0);
92
- return n(!0), l(a, null, k(r.nodes, (t) => (n(), l(a, {
93
- key: t.id
94
- }, [
95
- t.type === "text" ? (n(), l(a, { key: 0 }, [
96
- A(f(t.text ?? ""), 1)
97
- ], 64)) : t.type === "emphasis" ? (n(), l("em", G, [
98
- i(o, {
99
- nodes: t.children ?? []
100
- }, null, 8, ["nodes"])
101
- ])) : t.type === "strong" ? (n(), l("strong", J, [
102
- i(o, {
103
- nodes: t.children ?? []
104
- }, null, 8, ["nodes"])
105
- ])) : t.type === "strikethrough" ? (n(), l("del", K, [
106
- i(o, {
107
- nodes: t.children ?? []
108
- }, null, 8, ["nodes"])
109
- ])) : t.type === "inlineCode" ? (n(), l("code", P, f(t.text ?? ""), 1)) : t.type === "lineBreak" ? (n(), l("br", Q)) : t.type === "link" ? (n(), l(a, { key: 6 }, [
110
- s(v)(t) ? (n(), l("a", {
111
- key: 0,
112
- class: "coar-markdown-link",
113
- href: s(v)(t),
114
- target: s(U)(t) ?? void 0,
115
- rel: s(F)(t) ?? void 0
116
- }, [
117
- i(o, {
118
- nodes: t.children ?? []
119
- }, null, 8, ["nodes"])
120
- ], 8, X)) : (n(), p(o, {
121
- key: 1,
122
- nodes: t.children ?? []
123
- }, null, 8, ["nodes"]))
124
- ], 64)) : t.type === "image" ? (n(), l(a, { key: 7 }, [
125
- s($)(t) ? (n(), l("img", {
126
- key: 0,
127
- class: "coar-markdown-image",
128
- src: s($)(t),
129
- alt: s(H)(t),
130
- title: s(O)(t) ?? void 0,
131
- loading: "lazy"
132
- }, null, 8, Y)) : _("", !0)
133
- ], 64)) : (n(), l("span", Z, "[unsupported]"))
134
- ], 64))), 128);
135
- };
136
- }
137
- }), tt = {
138
- key: 1,
139
- class: "coar-markdown-paragraph"
140
- }, et = {
141
- key: 2,
142
- class: "coar-markdown-blockquote"
143
- }, rt = ["start"], nt = {
144
- key: 1,
145
- class: "coar-markdown-list coar-markdown-list--unordered"
146
- }, lt = ["checked"], st = { class: "coar-markdown-list-item-content" }, ot = {
147
- key: 6,
148
- class: "coar-markdown-hr"
149
- }, it = {
150
- key: 9,
151
- class: "coar-markdown-table-cell"
152
- }, at = {
153
- key: 10,
154
- class: "coar-markdown-unsupported"
155
- }, ct = /* @__PURE__ */ g({
156
- __name: "MarkdownBlockNode",
157
- props: {
158
- nodes: {},
159
- tableNode: {}
160
- },
161
- setup(r) {
162
- return (e, c) => {
163
- const o = T("MarkdownBlockNode", !0);
164
- return n(!0), l(a, null, k(r.nodes, (t) => (n(), l(a, {
165
- key: t.id
166
- }, [
167
- t.type === "heading" ? (n(), p(L("h" + s(q)(t)), {
168
- key: 0,
169
- id: s(D)(t) ?? void 0,
170
- class: "coar-markdown-heading"
171
- }, {
172
- default: C(() => [
173
- i(h, {
174
- nodes: t.children ?? []
175
- }, null, 8, ["nodes"])
176
- ]),
177
- _: 2
178
- }, 1032, ["id"])) : t.type === "paragraph" ? (n(), l("p", tt, [
179
- i(h, {
180
- nodes: t.children ?? []
181
- }, null, 8, ["nodes"])
182
- ])) : t.type === "blockquote" ? (n(), l("blockquote", et, [
183
- i(o, {
184
- nodes: t.children ?? []
185
- }, null, 8, ["nodes"])
186
- ])) : t.type === "list" ? (n(), l(a, { key: 3 }, [
187
- s(I)(t) ? (n(), l("ol", {
188
- key: 0,
189
- class: "coar-markdown-list coar-markdown-list--ordered",
190
- start: s(R)(t) ?? void 0
191
- }, [
192
- i(o, {
193
- nodes: t.children ?? []
194
- }, null, 8, ["nodes"])
195
- ], 8, rt)) : (n(), l("ul", nt, [
196
- i(o, {
197
- nodes: t.children ?? []
198
- }, null, 8, ["nodes"])
199
- ]))
200
- ], 64)) : t.type === "listItem" ? (n(), l("li", {
201
- key: 4,
202
- class: y(["coar-markdown-list-item", { "coar-markdown-list-item--task": s(x)(t) }])
203
- }, [
204
- s(x)(t) ? (n(), l("input", {
205
- key: 0,
206
- class: "coar-markdown-task-checkbox",
207
- type: "checkbox",
208
- checked: s(z)(t),
209
- disabled: "",
210
- "aria-hidden": "true",
211
- tabindex: "-1"
212
- }, null, 8, lt)) : _("", !0),
213
- m("div", st, [
214
- i(o, {
215
- nodes: t.children ?? []
216
- }, null, 8, ["nodes"])
217
- ])
218
- ], 2)) : t.type === "codeBlock" ? (n(), p(s(S), {
219
- key: 5,
220
- class: "coar-markdown-code-block",
221
- code: t.text ?? "",
222
- language: s(E)(t),
223
- collapsible: !1,
224
- "show-copy": !0
225
- }, null, 8, ["code", "language"])) : t.type === "thematicBreak" ? (n(), l("hr", ot)) : t.type === "table" ? (n(), p(s(V), {
226
- key: 7,
227
- variant: "plain",
228
- hover: ""
229
- }, {
230
- default: C(() => [
231
- (t.children ?? []).length > 0 ? (n(), l(a, { key: 0 }, [
232
- m("thead", null, [
233
- m("tr", null, [
234
- (n(!0), l(a, null, k((t.children ?? [])[0]?.children ?? [], (u, d) => (n(), l("th", {
235
- key: u.id,
236
- class: y({
237
- "text-right": s(B)(t, d),
238
- "text-center": s(N)(t, d)
239
- })
240
- }, [
241
- i(h, {
242
- nodes: u.children ?? []
243
- }, null, 8, ["nodes"])
244
- ], 2))), 128))
245
- ])
246
- ]),
247
- m("tbody", null, [
248
- (n(!0), l(a, null, k((t.children ?? []).slice(1), (u) => (n(), l("tr", {
249
- key: u.id
250
- }, [
251
- (n(!0), l(a, null, k(u.children ?? [], (d, b) => (n(), l("td", {
252
- key: d.id,
253
- class: y({
254
- "text-right": s(B)(t, b),
255
- "text-center": s(N)(t, b)
256
- })
257
- }, [
258
- i(h, {
259
- nodes: d.children ?? []
260
- }, null, 8, ["nodes"])
261
- ], 2))), 128))
262
- ]))), 128))
263
- ])
264
- ], 64)) : _("", !0)
265
- ]),
266
- _: 2
267
- }, 1024)) : t.type === "tableRow" ? (n(), p(o, {
268
- key: 8,
269
- nodes: t.children ?? []
270
- }, null, 8, ["nodes"])) : t.type === "tableCell" ? (n(), l("td", it, [
271
- i(h, {
272
- nodes: t.children ?? []
273
- }, null, 8, ["nodes"])
274
- ])) : (n(), l("div", at, " Unsupported markdown node: " + f(s(j)(t)), 1))
275
- ], 64))), 128);
276
- };
277
- }
278
- }), ut = { class: "coar-markdown" }, kt = /* @__PURE__ */ g({
279
- __name: "CoarMarkdown",
280
- props: {
281
- doc: {}
282
- },
283
- setup(r) {
284
- return (e, c) => (n(), l("div", ut, [
285
- i(ct, {
286
- nodes: r.doc.nodes
287
- }, null, 8, ["nodes"])
288
- ]));
289
- }
1
+ import { Fragment as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderList as u, resolveComponent as d, resolveDynamicComponent as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
2
+ import { CoarCodeBlock as g, CoarTable as _ } from "@cocoar/vue-ui";
3
+ //#region src/helpers.ts
4
+ function v(e) {
5
+ let t = e.attrs?.depth;
6
+ if (typeof t != "number") return 1;
7
+ let n = Math.trunc(t);
8
+ return n <= 1 ? 1 : n === 2 ? 2 : n === 3 ? 3 : n === 4 ? 4 : n === 5 ? 5 : 6;
9
+ }
10
+ function y(e) {
11
+ let t = e.attrs?.anchor;
12
+ return typeof t == "string" && t.length > 0 ? t : null;
13
+ }
14
+ function b(e) {
15
+ let t = e.attrs?.language;
16
+ return typeof t == "string" && t.trim().length > 0 ? t.trim() : "text";
17
+ }
18
+ function x(e) {
19
+ return !!e.attrs?.ordered;
20
+ }
21
+ function S(e) {
22
+ let t = e.attrs?.start;
23
+ return typeof t == "number" ? t : null;
24
+ }
25
+ function C(e) {
26
+ return typeof e.attrs?.checked == "boolean";
27
+ }
28
+ function w(e) {
29
+ return e.attrs?.checked === !0;
30
+ }
31
+ function T(e) {
32
+ let t = e.attrs?.url;
33
+ return typeof t == "string" && t.length > 0 ? t : null;
34
+ }
35
+ function E(e) {
36
+ let t = T(e);
37
+ return t ? t.startsWith("#") && typeof window < "u" ? `${window.location.pathname}${window.location.search}${t}` : t : null;
38
+ }
39
+ function D(e) {
40
+ let t = T(e);
41
+ return t && I(t) ? "_blank" : null;
42
+ }
43
+ function O(e) {
44
+ let t = T(e);
45
+ return t && I(t) ? "noopener noreferrer" : null;
46
+ }
47
+ function k(e) {
48
+ let t = e.attrs?.url;
49
+ return typeof t == "string" && t.trim().length > 0 ? t.trim() : null;
50
+ }
51
+ function A(e) {
52
+ let t = e.attrs?.alt;
53
+ return typeof t == "string" ? t : "";
54
+ }
55
+ function j(e) {
56
+ let t = e.attrs?.title;
57
+ return typeof t == "string" && t.trim().length > 0 ? t.trim() : null;
58
+ }
59
+ function M(e, t) {
60
+ return F(e, t) === "right";
61
+ }
62
+ function N(e, t) {
63
+ return F(e, t) === "center";
64
+ }
65
+ function P(e) {
66
+ let t = e.attrs?.originalType;
67
+ return typeof t == "string" ? t : String(e.type);
68
+ }
69
+ function F(e, t) {
70
+ let n = e.attrs?.align;
71
+ if (!Array.isArray(n)) return null;
72
+ let r = n[t];
73
+ return r === "left" || r === "right" || r === "center" ? r : null;
74
+ }
75
+ function I(e) {
76
+ let t = e.trim();
77
+ return t.startsWith("#") || t.startsWith("/") || t.startsWith("./") || t.startsWith("../") || t.startsWith("mailto:") || t.startsWith("tel:") ? !1 : t.startsWith("http://") || t.startsWith("https://");
78
+ }
79
+ //#endregion
80
+ //#region src/MarkdownInlineNode.vue?vue&type=script&setup=true&lang.ts
81
+ var L = { key: 1 }, R = { key: 2 }, z = { key: 3 }, B = {
82
+ key: 4,
83
+ class: "coar-markdown-inline-code"
84
+ }, V = { key: 5 }, H = [
85
+ "href",
86
+ "target",
87
+ "rel"
88
+ ], U = [
89
+ "src",
90
+ "alt",
91
+ "title"
92
+ ], W = {
93
+ key: 8,
94
+ class: "coar-markdown-unsupported-inline"
95
+ }, G = /* @__PURE__ */ s({
96
+ __name: "MarkdownInlineNode",
97
+ props: { nodes: {} },
98
+ setup(i) {
99
+ return (s, c) => {
100
+ let f = d("MarkdownInlineNode", !0);
101
+ return l(!0), r(e, null, u(i.nodes, (i) => (l(), r(e, { key: i.id }, [i.type === "text" ? (l(), r(e, { key: 0 }, [a(p(i.text ?? ""), 1)], 64)) : i.type === "emphasis" ? (l(), r("em", L, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "strong" ? (l(), r("strong", R, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "strikethrough" ? (l(), r("del", z, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])])) : i.type === "inlineCode" ? (l(), r("code", B, p(i.text ?? ""), 1)) : i.type === "lineBreak" ? (l(), r("br", V)) : i.type === "link" ? (l(), r(e, { key: 6 }, [m(E)(i) ? (l(), r("a", {
102
+ key: 0,
103
+ class: "coar-markdown-link",
104
+ href: m(E)(i),
105
+ target: m(D)(i) ?? void 0,
106
+ rel: m(O)(i) ?? void 0
107
+ }, [o(f, { nodes: i.children ?? [] }, null, 8, ["nodes"])], 8, H)) : (l(), t(f, {
108
+ key: 1,
109
+ nodes: i.children ?? []
110
+ }, null, 8, ["nodes"]))], 64)) : i.type === "image" ? (l(), r(e, { key: 7 }, [m(k)(i) ? (l(), r("img", {
111
+ key: 0,
112
+ class: "coar-markdown-image",
113
+ src: m(k)(i),
114
+ alt: m(A)(i),
115
+ title: m(j)(i) ?? void 0,
116
+ loading: "lazy"
117
+ }, null, 8, U)) : n("", !0)], 64)) : (l(), r("span", W, "[unsupported]"))], 64))), 128);
118
+ };
119
+ }
120
+ }), K = {
121
+ key: 1,
122
+ class: "coar-markdown-paragraph"
123
+ }, q = {
124
+ key: 2,
125
+ class: "coar-markdown-blockquote"
126
+ }, J = ["start"], Y = {
127
+ key: 1,
128
+ class: "coar-markdown-list coar-markdown-list--unordered"
129
+ }, X = ["checked"], Z = { class: "coar-markdown-list-item-content" }, Q = {
130
+ key: 6,
131
+ class: "coar-markdown-hr"
132
+ }, $ = {
133
+ key: 9,
134
+ class: "coar-markdown-table-cell"
135
+ }, ee = {
136
+ key: 10,
137
+ class: "coar-markdown-unsupported"
138
+ }, te = /* @__PURE__ */ s({
139
+ __name: "MarkdownBlockNode",
140
+ props: {
141
+ nodes: {},
142
+ tableNode: {}
143
+ },
144
+ setup(a) {
145
+ return (s, T) => {
146
+ let E = d("MarkdownBlockNode", !0);
147
+ return l(!0), r(e, null, u(a.nodes, (a) => (l(), r(e, { key: a.id }, [a.type === "heading" ? (l(), t(f("h" + m(v)(a)), {
148
+ key: 0,
149
+ id: m(y)(a) ?? void 0,
150
+ class: "coar-markdown-heading"
151
+ }, {
152
+ default: h(() => [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])]),
153
+ _: 2
154
+ }, 1032, ["id"])) : a.type === "paragraph" ? (l(), r("p", K, [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : a.type === "blockquote" ? (l(), r("blockquote", q, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : a.type === "list" ? (l(), r(e, { key: 3 }, [m(x)(a) ? (l(), r("ol", {
155
+ key: 0,
156
+ class: "coar-markdown-list coar-markdown-list--ordered",
157
+ start: m(S)(a) ?? void 0
158
+ }, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])], 8, J)) : (l(), r("ul", Y, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])]))], 64)) : a.type === "listItem" ? (l(), r("li", {
159
+ key: 4,
160
+ class: c(["coar-markdown-list-item", { "coar-markdown-list-item--task": m(C)(a) }])
161
+ }, [m(C)(a) ? (l(), r("input", {
162
+ key: 0,
163
+ class: "coar-markdown-task-checkbox",
164
+ type: "checkbox",
165
+ checked: m(w)(a),
166
+ disabled: "",
167
+ "aria-hidden": "true",
168
+ tabindex: "-1"
169
+ }, null, 8, X)) : n("", !0), i("div", Z, [o(E, { nodes: a.children ?? [] }, null, 8, ["nodes"])])], 2)) : a.type === "codeBlock" ? (l(), t(m(g), {
170
+ key: 5,
171
+ class: "coar-markdown-code-block",
172
+ code: a.text ?? "",
173
+ language: m(b)(a),
174
+ collapsible: !1,
175
+ "show-copy": !0
176
+ }, null, 8, ["code", "language"])) : a.type === "thematicBreak" ? (l(), r("hr", Q)) : a.type === "table" ? (l(), t(m(_), {
177
+ key: 7,
178
+ variant: "plain",
179
+ hover: ""
180
+ }, {
181
+ default: h(() => [(a.children ?? []).length > 0 ? (l(), r(e, { key: 0 }, [i("thead", null, [i("tr", null, [(l(!0), r(e, null, u((a.children ?? [])[0]?.children ?? [], (e, t) => (l(), r("th", {
182
+ key: e.id,
183
+ class: c({
184
+ "text-right": m(M)(a, t),
185
+ "text-center": m(N)(a, t)
186
+ })
187
+ }, [o(G, { nodes: e.children ?? [] }, null, 8, ["nodes"])], 2))), 128))])]), i("tbody", null, [(l(!0), r(e, null, u((a.children ?? []).slice(1), (t) => (l(), r("tr", { key: t.id }, [(l(!0), r(e, null, u(t.children ?? [], (e, t) => (l(), r("td", {
188
+ key: e.id,
189
+ class: c({
190
+ "text-right": m(M)(a, t),
191
+ "text-center": m(N)(a, t)
192
+ })
193
+ }, [o(G, { nodes: e.children ?? [] }, null, 8, ["nodes"])], 2))), 128))]))), 128))])], 64)) : n("", !0)]),
194
+ _: 2
195
+ }, 1024)) : a.type === "tableRow" ? (l(), t(E, {
196
+ key: 8,
197
+ nodes: a.children ?? []
198
+ }, null, 8, ["nodes"])) : a.type === "tableCell" ? (l(), r("td", $, [o(G, { nodes: a.children ?? [] }, null, 8, ["nodes"])])) : (l(), r("div", ee, " Unsupported markdown node: " + p(m(P)(a)), 1))], 64))), 128);
199
+ };
200
+ }
201
+ }), ne = { class: "coar-markdown" }, re = /* @__PURE__ */ s({
202
+ __name: "CoarMarkdown",
203
+ props: { doc: {} },
204
+ setup(e) {
205
+ return (t, n) => (l(), r("div", ne, [o(te, { nodes: e.doc.nodes }, null, 8, ["nodes"])]));
206
+ }
290
207
  });
291
- export {
292
- kt as CoarMarkdown
293
- };
208
+ //#endregion
209
+ export { re as CoarMarkdown };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/vue-markdown",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Markdown viewer component for Vue 3 with Cocoar Design System styling",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,14 +38,14 @@
38
38
  "lint": "eslint src/"
39
39
  },
40
40
  "dependencies": {
41
- "@cocoar/vue-markdown-core": "1.6.4"
41
+ "@cocoar/vue-markdown-core": "1.6.5"
42
42
  },
43
43
  "peerDependencies": {
44
- "@cocoar/vue-ui": "1.6.4",
44
+ "@cocoar/vue-ui": "1.6.5",
45
45
  "vue": "^3.5.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@cocoar/vue-ui": "workspace:*",
49
- "vue": "^3.5.0"
49
+ "vue": "^3.5.32"
50
50
  }
51
51
  }