@sit-onyx/mdc 0.3.0-dev-20260715161231 → 0.3.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.
- package/README.md +1 -1
- package/dist/MDCRenderer-Bd04ujwA.js +301 -0
- package/dist/components/prose/ProsePre.d.vue.ts +2 -1
- package/dist/index.js +86 -86
- package/dist/{node-Oi5de8aj.js → props-BDcmuO0J.js} +299 -280
- package/dist/{runtime-B-YpCpS_.js → runtime-Cmxarge9.js} +4814 -5380
- package/dist/stub-mdc-imports-CGrl_Mo3.js +3 -0
- package/dist/style.css +1 -1
- package/package.json +11 -12
- package/dist/MDCRenderer-CC1RH5BK.js +0 -290
package/README.md
CHANGED
|
@@ -12,4 +12,4 @@ Wrapper for the [@nuxtjs/mdc](https://github.com/nuxt-content/mdc) package using
|
|
|
12
12
|
|
|
13
13
|
## Documentation
|
|
14
14
|
|
|
15
|
-
You can find our documentation [here](https://
|
|
15
|
+
You can find our documentation [here](https://onyx.schwarz/components/docs/markdown).
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { f as e, h as t, l as n, m as r, r as i, s as a, t as o, u as s } from "./props-BDcmuO0J.js";
|
|
2
|
+
import { Comment as c, Text as l, computed as u, defineAsyncComponent as d, defineComponent as f, getCurrentInstance as p, h as m, reactive as h, resolveComponent as g, toRaw as _, watch as v } from "vue";
|
|
3
|
+
// ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
|
|
4
|
+
var y = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/, b = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/, ee = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
5
|
+
function x(e, t) {
|
|
6
|
+
if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) S(e);
|
|
7
|
+
else return t;
|
|
8
|
+
}
|
|
9
|
+
function S(e) {
|
|
10
|
+
console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);
|
|
11
|
+
}
|
|
12
|
+
function te(e, t = {}) {
|
|
13
|
+
if (typeof e != "string") return e;
|
|
14
|
+
if (e[0] === "\"" && e[e.length - 1] === "\"" && e.indexOf("\\") === -1) return e.slice(1, -1);
|
|
15
|
+
let n = e.trim();
|
|
16
|
+
if (n.length <= 9) switch (n.toLowerCase()) {
|
|
17
|
+
case "true": return !0;
|
|
18
|
+
case "false": return !1;
|
|
19
|
+
case "undefined": return;
|
|
20
|
+
case "null": return null;
|
|
21
|
+
case "nan": return NaN;
|
|
22
|
+
case "infinity": return Infinity;
|
|
23
|
+
case "-infinity": return -Infinity;
|
|
24
|
+
}
|
|
25
|
+
if (!ee.test(e)) {
|
|
26
|
+
if (t.strict) throw SyntaxError("[destr] Invalid JSON");
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
if (y.test(e) || b.test(e)) {
|
|
31
|
+
if (t.strict) throw Error("[destr] Possible prototype pollution");
|
|
32
|
+
return JSON.parse(e, x);
|
|
33
|
+
}
|
|
34
|
+
return JSON.parse(e);
|
|
35
|
+
} catch (n) {
|
|
36
|
+
if (t.strict) throw n;
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ../../node_modules/.pnpm/@nuxtjs+mdc@0.23.2_@nuxt+schema@4.6.2_confbox@0.3.1_dotenv@17.4.2_giget@3.3.1_jiti@2.7._0234d74d52180426a5ac8e712d0222d6/node_modules/@nuxtjs/mdc/dist/runtime/utils/index.js
|
|
41
|
+
function C(e, t) {
|
|
42
|
+
return t.reduce((t, n) => {
|
|
43
|
+
let r = w(e, n);
|
|
44
|
+
return r !== void 0 && (t[n] = r), t;
|
|
45
|
+
}, {});
|
|
46
|
+
}
|
|
47
|
+
function w(e, t) {
|
|
48
|
+
return t.split(".").reduce((e, t) => e && e[t], e);
|
|
49
|
+
}
|
|
50
|
+
// ../../node_modules/.pnpm/@nuxtjs+mdc@0.23.2_@nuxt+schema@4.6.2_confbox@0.3.1_dotenv@17.4.2_giget@3.3.1_jiti@2.7._0234d74d52180426a5ac8e712d0222d6/node_modules/@nuxtjs/mdc/dist/runtime/components/MDCRenderer.vue
|
|
51
|
+
var T = "default", E = /^@|^v-on:/, D = /^:|^v-bind:/, O = /^v-model/, k = [
|
|
52
|
+
"select",
|
|
53
|
+
"textarea",
|
|
54
|
+
"input"
|
|
55
|
+
], A = /* @__PURE__ */ new Set(["math", "svg"]), j = /* @__PURE__ */ new Set(), M = Object.fromEntries((/* @__PURE__ */ "p.a.blockquote.code.pre.code.em.h1.h2.h3.h4.h5.h6.hr.img.ul.ol.li.strong.table.thead.tbody.td.th.tr.script".split(".")).map((e) => [e, `prose-${e}`])), N = ["script", "base"], P = /* @__PURE__ */ new Set([
|
|
56
|
+
...N,
|
|
57
|
+
"iframe",
|
|
58
|
+
"frame",
|
|
59
|
+
"frameset",
|
|
60
|
+
"embed",
|
|
61
|
+
"object",
|
|
62
|
+
"style",
|
|
63
|
+
"link",
|
|
64
|
+
"meta"
|
|
65
|
+
]), F = /^[a-z][\w-]*$/i, I = f({
|
|
66
|
+
name: "MDCRenderer",
|
|
67
|
+
props: {
|
|
68
|
+
body: {
|
|
69
|
+
type: Object,
|
|
70
|
+
required: !0
|
|
71
|
+
},
|
|
72
|
+
data: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({})
|
|
75
|
+
},
|
|
76
|
+
class: {
|
|
77
|
+
type: [String, Object],
|
|
78
|
+
default: void 0
|
|
79
|
+
},
|
|
80
|
+
tag: {
|
|
81
|
+
type: [String, Boolean],
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
prose: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: void 0
|
|
87
|
+
},
|
|
88
|
+
components: {
|
|
89
|
+
type: Object,
|
|
90
|
+
default: () => ({})
|
|
91
|
+
},
|
|
92
|
+
unwrap: {
|
|
93
|
+
type: [Boolean, String],
|
|
94
|
+
default: !1
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
async setup(e) {
|
|
98
|
+
let t = p()?.appContext?.app?.$nuxt, n = t?.$route || t?._route, { mdc: r } = t?.$config?.public || {}, i = r?.components?.customElements || r?.components?.custom;
|
|
99
|
+
i && i.forEach((e) => j.add(e));
|
|
100
|
+
let a = u(() => ({
|
|
101
|
+
...r?.components?.prose && e.prose !== !1 ? M : {},
|
|
102
|
+
...r?.components?.map || {},
|
|
103
|
+
..._(e.data?.mdc?.components || {}),
|
|
104
|
+
...e.components
|
|
105
|
+
})), s = u(() => {
|
|
106
|
+
let t = (e.body?.children || []).map((e) => e.tag || e.type).filter((e) => !$(e));
|
|
107
|
+
return Array.from(new Set(t)).sort().join(".");
|
|
108
|
+
}), c = h({ ...e.data });
|
|
109
|
+
v(() => e.data, (e) => {
|
|
110
|
+
Object.assign(c, e);
|
|
111
|
+
}), await Z(e.body, { tags: a.value });
|
|
112
|
+
function l(e, t) {
|
|
113
|
+
let n = e.split(".").length - 1;
|
|
114
|
+
return e.split(".").reduce((e, r, i) => i == n && e ? (e[r] = t, e[r]) : typeof e == "object" ? e[r] : void 0, c);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
tags: a,
|
|
118
|
+
contentKey: s,
|
|
119
|
+
route: n,
|
|
120
|
+
runtimeData: c,
|
|
121
|
+
updateRuntimeData: l,
|
|
122
|
+
root: u(() => {
|
|
123
|
+
let t = e.data?.component, n = e.tag || t?.name || t || "div", r = t?.props;
|
|
124
|
+
return !e.tag && t && (typeof n == "string" && (!F.test(n) || P.has(n.toLowerCase())) && (n = "div"), r &&= o(typeof n == "string" ? n : "", r)), {
|
|
125
|
+
tag: n,
|
|
126
|
+
props: r
|
|
127
|
+
};
|
|
128
|
+
})
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
render(e) {
|
|
132
|
+
let { tags: t, tag: n, body: r, data: a, contentKey: o, route: s, unwrap: c, runtimeData: l, updateRuntimeData: u } = e;
|
|
133
|
+
if (!r) return null;
|
|
134
|
+
let d = {
|
|
135
|
+
...a,
|
|
136
|
+
tags: t,
|
|
137
|
+
$route: s,
|
|
138
|
+
runtimeData: l,
|
|
139
|
+
updateRuntimeData: u
|
|
140
|
+
}, { tag: f, props: p } = e.root, h = n === !1 ? void 0 : G(f);
|
|
141
|
+
return h ? m(h, {
|
|
142
|
+
...p,
|
|
143
|
+
class: e.class,
|
|
144
|
+
...this.$attrs,
|
|
145
|
+
key: o
|
|
146
|
+
}, { default: g }) : g?.();
|
|
147
|
+
function g() {
|
|
148
|
+
let e = R(r, m, {
|
|
149
|
+
documentMeta: d,
|
|
150
|
+
parentScope: d,
|
|
151
|
+
resolveComponent: G
|
|
152
|
+
});
|
|
153
|
+
return e?.default ? c ? i(e.default(), typeof c == "string" ? c.split(" ") : ["*"]) : e.default() : null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
function L(e, n, r, i) {
|
|
158
|
+
let { documentMeta: o, parentScope: s, resolveComponent: u } = r;
|
|
159
|
+
if (e.type === "text") return n(l, e.value);
|
|
160
|
+
if (e.type === "comment") return n(c, null, e.value);
|
|
161
|
+
let d = e.tag, f = Q(e, o.tags);
|
|
162
|
+
if (e.tag === "binding") return z(e, n, o, s);
|
|
163
|
+
let p = Y(f) ? (e) => e : u;
|
|
164
|
+
if (N.includes(t(f).toLowerCase())) return n("pre", { class: "mdc-renderer-dangerous-tag" }, "<" + f + ">" + a(e) + "</" + f + ">");
|
|
165
|
+
let m = p(f);
|
|
166
|
+
typeof m == "object" && (m.tag = d);
|
|
167
|
+
let h = B(e, o);
|
|
168
|
+
return i && (h.key = i), n(m, h, R(e, n, {
|
|
169
|
+
documentMeta: o,
|
|
170
|
+
parentScope: {
|
|
171
|
+
...s,
|
|
172
|
+
...h
|
|
173
|
+
},
|
|
174
|
+
resolveComponent: p
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
function R(e, t, n) {
|
|
178
|
+
let { documentMeta: r, parentScope: a, resolveComponent: o } = n, s = (e.children || []).reduce((e, t) => {
|
|
179
|
+
if (!J(t)) return e[T].children.push(t), e;
|
|
180
|
+
let n = q(t);
|
|
181
|
+
return e[n] = e[n] || {
|
|
182
|
+
props: {},
|
|
183
|
+
children: []
|
|
184
|
+
}, t.type === "element" && (e[n].props = t.props, e[n].children.push(...t.children || [])), e;
|
|
185
|
+
}, { [T]: {
|
|
186
|
+
props: {},
|
|
187
|
+
children: []
|
|
188
|
+
} });
|
|
189
|
+
return Object.entries(s).reduce((e, [n, { props: s, children: c }]) => (c.length && (e[n] = (e = {}) => {
|
|
190
|
+
let n = C(e, Object.keys(s || {})), l = c.map((e, i) => L(e, t, {
|
|
191
|
+
documentMeta: r,
|
|
192
|
+
parentScope: {
|
|
193
|
+
...a,
|
|
194
|
+
...n
|
|
195
|
+
},
|
|
196
|
+
resolveComponent: o
|
|
197
|
+
}, String(e.props?.key || i)));
|
|
198
|
+
return s?.unwrap && (l = i(l, s.unwrap)), X(l);
|
|
199
|
+
}), e), {});
|
|
200
|
+
}
|
|
201
|
+
function z(e, t, n, r = {}) {
|
|
202
|
+
let i = {
|
|
203
|
+
...n.runtimeData,
|
|
204
|
+
...r,
|
|
205
|
+
$document: n,
|
|
206
|
+
$doc: n
|
|
207
|
+
}, a = (e.props?.value.trim().split(/\.|\[(\d+)\]/).filter(Boolean)).reduce((e, t) => {
|
|
208
|
+
if (e && t in e) return typeof e[t] == "function" ? e[t]() : e[t];
|
|
209
|
+
}, i), o = e.props?.defaultValue;
|
|
210
|
+
return t(l, a ?? o ?? "");
|
|
211
|
+
}
|
|
212
|
+
function B(t, n) {
|
|
213
|
+
let { tag: r = "", props: i = {} } = t;
|
|
214
|
+
return Object.keys(i).reduce(function(t, a) {
|
|
215
|
+
if (a === "__ignoreMap") return t;
|
|
216
|
+
let o = i[a];
|
|
217
|
+
if (O.test(a)) return V(a, o, t, n, { native: k.includes(r) });
|
|
218
|
+
if (a === "v-bind") return H(a, o, t, n);
|
|
219
|
+
if (E.test(a)) return U(a, o, t, n);
|
|
220
|
+
if (D.test(a)) return W(a, o, t, n);
|
|
221
|
+
let { attribute: c } = e(s, a);
|
|
222
|
+
return Array.isArray(o) && o.every((e) => typeof e == "string") ? (t[c] = o.join(" "), t) : (t[c] = o, t);
|
|
223
|
+
}, {});
|
|
224
|
+
}
|
|
225
|
+
function V(e, t, n, r, { native: i }) {
|
|
226
|
+
let a = e.match(/^v-model:([^=]+)/)?.[1] || "modelValue", o = i ? "value" : a, s = i ? "onInput" : `onUpdate:${a}`;
|
|
227
|
+
return n[o] = K(t, r.runtimeData), n[s] = (e) => {
|
|
228
|
+
r.updateRuntimeData(t, i ? e.target?.value : e);
|
|
229
|
+
}, n;
|
|
230
|
+
}
|
|
231
|
+
function H(e, t, n, r) {
|
|
232
|
+
let i = K(t, r);
|
|
233
|
+
return n = Object.assign(n, i), n;
|
|
234
|
+
}
|
|
235
|
+
function U(e, t, n, r) {
|
|
236
|
+
return e = e.replace(E, ""), n.on = n.on || {}, n.on[e] = () => K(t, r), n;
|
|
237
|
+
}
|
|
238
|
+
function W(e, t, n, r) {
|
|
239
|
+
return e = e.replace(D, ""), n[e] = K(t, r), n;
|
|
240
|
+
}
|
|
241
|
+
var G = (e) => {
|
|
242
|
+
if (typeof e == "string") {
|
|
243
|
+
if ($(e)) return e;
|
|
244
|
+
let n = g(t(e), !1);
|
|
245
|
+
return !e || n?.name === "AsyncComponentWrapper" || typeof n == "string" ? n : "setup" in n ? d(() => new Promise((e) => e(n))) : n;
|
|
246
|
+
}
|
|
247
|
+
return e;
|
|
248
|
+
};
|
|
249
|
+
function K(e, t) {
|
|
250
|
+
let n = e.split(".").reduce((e, t) => typeof e == "object" ? e[t] : void 0, t);
|
|
251
|
+
return n === void 0 ? te(e) : n;
|
|
252
|
+
}
|
|
253
|
+
function q(e) {
|
|
254
|
+
let t = "";
|
|
255
|
+
for (let n of Object.keys(e.props || {})) if (n.startsWith("#") || n.startsWith("v-slot:")) {
|
|
256
|
+
t = n.split(/[:#]/, 2)[1];
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
return t || T;
|
|
260
|
+
}
|
|
261
|
+
function J(e) {
|
|
262
|
+
return e.tag === "template";
|
|
263
|
+
}
|
|
264
|
+
function Y(e) {
|
|
265
|
+
return A.has(e);
|
|
266
|
+
}
|
|
267
|
+
function X(e) {
|
|
268
|
+
let t = [];
|
|
269
|
+
for (let n of e) {
|
|
270
|
+
let e = t[t.length - 1];
|
|
271
|
+
n.type === l && e?.type === l ? e.children += n.children : t.push(n);
|
|
272
|
+
}
|
|
273
|
+
return t;
|
|
274
|
+
}
|
|
275
|
+
async function Z(e, t) {
|
|
276
|
+
if (!e) return;
|
|
277
|
+
let n = Array.from(new Set(r(e, t)));
|
|
278
|
+
await Promise.all(n.map(async (e) => {
|
|
279
|
+
if (e?.render || e?.ssrRender || e?.__ssrInlineRender) return;
|
|
280
|
+
let t = G(e);
|
|
281
|
+
t?.__asyncLoader && !t.__asyncResolved && await t.__asyncLoader();
|
|
282
|
+
}));
|
|
283
|
+
function r(e, t) {
|
|
284
|
+
let n = e.tag;
|
|
285
|
+
if (e.type === "text" || n === "binding" || e.type === "comment") return [];
|
|
286
|
+
let i = Q(e, t.tags);
|
|
287
|
+
if (Y(i)) return [];
|
|
288
|
+
let a = [];
|
|
289
|
+
e.type !== "root" && !$(i) && a.push(i);
|
|
290
|
+
for (let n of e.children || []) a.push(...r(n, t));
|
|
291
|
+
return a;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function Q(e, n) {
|
|
295
|
+
let i = e.tag;
|
|
296
|
+
return !i || e.props?.__ignoreMap !== void 0 ? i : n[i] || n[t(i)] || n[r(e.tag)] || i;
|
|
297
|
+
}
|
|
298
|
+
function $(e) {
|
|
299
|
+
return typeof e == "string" && j.has(e) || n.has(e);
|
|
300
|
+
}
|
|
301
|
+
export { I as default };
|