@sit-onyx/mdc 0.3.1 → 0.3.2-dev-20261123100908

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,15 +1,15 @@
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";
1
+ import { c as e, d as t, g as n, h as r, i, n as a, p as o, t as s, u as c } from "./props-D9WqZr0-.js";
2
+ import { Comment as l, Text as u, computed as d, defineAsyncComponent as f, defineComponent as p, getCurrentInstance as m, h, reactive as g, resolveComponent as _, toRaw as v, watch as y } from "vue";
3
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);
4
+ var b = /"(?:_|\\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*:/, x = /"(?: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 S(e, t) {
6
+ if (e === "__proto__" || e === "constructor" && t && typeof t == "object" && "prototype" in t) te(e);
7
7
  else return t;
8
8
  }
9
- function S(e) {
9
+ function te(e) {
10
10
  console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);
11
11
  }
12
- function te(e, t = {}) {
12
+ function C(e, t = {}) {
13
13
  if (typeof e != "string") return e;
14
14
  if (e[0] === "\"" && e[e.length - 1] === "\"" && e.indexOf("\\") === -1) return e.slice(1, -1);
15
15
  let n = e.trim();
@@ -27,9 +27,9 @@ function te(e, t = {}) {
27
27
  return e;
28
28
  }
29
29
  try {
30
- if (y.test(e) || b.test(e)) {
30
+ if (b.test(e) || x.test(e)) {
31
31
  if (t.strict) throw Error("[destr] Possible prototype pollution");
32
- return JSON.parse(e, x);
32
+ return JSON.parse(e, S);
33
33
  }
34
34
  return JSON.parse(e);
35
35
  } catch (n) {
@@ -37,23 +37,23 @@ function te(e, t = {}) {
37
37
  return e;
38
38
  }
39
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) {
40
+ // ../../node_modules/.pnpm/@nuxtjs+mdc@0.23.4_@nuxt+schema@4.6.4_confbox@0.3.2_dotenv@17.4.2_giget@3.3.1_jiti@2.7._8aa46dd70d56c1a2fed2f05572323d85/node_modules/@nuxtjs/mdc/dist/runtime/utils/index.js
41
+ function w(e, t) {
42
42
  return t.reduce((t, n) => {
43
- let r = w(e, n);
43
+ let r = T(e, n);
44
44
  return r !== void 0 && (t[n] = r), t;
45
45
  }, {});
46
46
  }
47
- function w(e, t) {
47
+ function T(e, t) {
48
48
  return t.split(".").reduce((e, t) => e && e[t], e);
49
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 = [
50
+ // ../../node_modules/.pnpm/@nuxtjs+mdc@0.23.4_@nuxt+schema@4.6.4_confbox@0.3.2_dotenv@17.4.2_giget@3.3.1_jiti@2.7._8aa46dd70d56c1a2fed2f05572323d85/node_modules/@nuxtjs/mdc/dist/runtime/components/MDCRenderer.vue
51
+ var E = "default", D = /^@|^v-on:/, O = /^:|^v-bind:/, k = /^v-model/, A = [
52
52
  "select",
53
53
  "textarea",
54
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,
55
+ ], j = /* @__PURE__ */ new Set(["math", "svg"]), M = /* @__PURE__ */ new Set(), N = 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}`])), P = ["script", "base"], F = /* @__PURE__ */ new Set([
56
+ ...P,
57
57
  "iframe",
58
58
  "frame",
59
59
  "frameset",
@@ -62,7 +62,7 @@ var T = "default", E = /^@|^v-on:/, D = /^:|^v-bind:/, O = /^v-model/, k = [
62
62
  "style",
63
63
  "link",
64
64
  "meta"
65
- ]), F = /^[a-z][\w-]*$/i, I = f({
65
+ ]), I = /^[a-z][\w-]*$/i, L = p({
66
66
  name: "MDCRenderer",
67
67
  props: {
68
68
  body: {
@@ -95,33 +95,33 @@ var T = "default", E = /^@|^v-on:/, D = /^:|^v-bind:/, O = /^v-model/, k = [
95
95
  }
96
96
  },
97
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 : {},
98
+ let t = m()?.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) => M.add(e));
100
+ let o = d(() => ({
101
+ ...r?.components?.prose && e.prose !== !1 ? N : {},
102
102
  ...r?.components?.map || {},
103
- ..._(e.data?.mdc?.components || {}),
103
+ ...Object.fromEntries(Object.entries(v(e.data?.mdc?.components || {})).filter(([, e]) => typeof e == "string")),
104
104
  ...e.components
105
- })), s = u(() => {
105
+ })), s = d(() => {
106
106
  let t = (e.body?.children || []).map((e) => e.tag || e.type).filter((e) => !$(e));
107
107
  return Array.from(new Set(t)).sort().join(".");
108
- }), c = h({ ...e.data });
109
- v(() => e.data, (e) => {
108
+ }), c = g({ ...e.data });
109
+ y(() => e.data, (e) => {
110
110
  Object.assign(c, e);
111
- }), await Z(e.body, { tags: a.value });
111
+ }), await ne(e.body, { tags: o.value });
112
112
  function l(e, t) {
113
113
  let n = e.split(".").length - 1;
114
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
115
  }
116
116
  return {
117
- tags: a,
117
+ tags: o,
118
118
  contentKey: s,
119
119
  route: n,
120
120
  runtimeData: c,
121
121
  updateRuntimeData: l,
122
- root: u(() => {
122
+ root: d(() => {
123
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)), {
124
+ return !e.tag && t && ((typeof n != "string" || !I.test(n) || F.has(n.toLowerCase())) && (n = "div"), r &&= a(n, r)), {
125
125
  tag: n,
126
126
  props: r
127
127
  };
@@ -137,35 +137,37 @@ var T = "default", E = /^@|^v-on:/, D = /^:|^v-bind:/, O = /^v-model/, k = [
137
137
  $route: s,
138
138
  runtimeData: l,
139
139
  updateRuntimeData: u
140
- }, { tag: f, props: p } = e.root, h = n === !1 ? void 0 : G(f);
141
- return h ? m(h, {
140
+ }, { tag: f, props: p } = e.root, m = n === !1 ? void 0 : K(f);
141
+ return m ? h(m, {
142
142
  ...p,
143
143
  class: e.class,
144
144
  ...this.$attrs,
145
145
  key: o
146
146
  }, { default: g }) : g?.();
147
147
  function g() {
148
- let e = R(r, m, {
148
+ let e = z(r, h, {
149
149
  documentMeta: d,
150
150
  parentScope: d,
151
- resolveComponent: G
151
+ resolveComponent: K
152
152
  });
153
153
  return e?.default ? c ? i(e.default(), typeof c == "string" ? c.split(" ") : ["*"]) : e.default() : null;
154
154
  }
155
155
  }
156
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 + ">");
157
+ function R(t, r, i, a) {
158
+ let { documentMeta: o, parentScope: s, resolveComponent: c } = i;
159
+ if (t.type === "text") return r(u, t.value);
160
+ if (t.type === "comment") return r(l, null, t.value);
161
+ let d = t.tag;
162
+ if (typeof d != "string") return r(l, null, "invalid tag");
163
+ let f = Q(t, o.tags);
164
+ if (t.tag === "binding") return B(t, r, o, s);
165
+ let p = X(f) ? (e) => e : c;
166
+ if (P.includes(n(f).toLowerCase())) return r("pre", { class: "mdc-renderer-dangerous-tag" }, "<" + f + ">" + e(t) + "</" + f + ">");
165
167
  let m = p(f);
166
168
  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
+ let h = V(t, o);
170
+ return a && (h.key = a), r(m, h, z(t, r, {
169
171
  documentMeta: o,
170
172
  parentScope: {
171
173
  ...s,
@@ -174,20 +176,20 @@ function L(e, n, r, i) {
174
176
  resolveComponent: p
175
177
  }));
176
178
  }
177
- function R(e, t, n) {
179
+ function z(e, t, n) {
178
180
  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
+ if (!Y(t)) return e[E].children.push(t), e;
182
+ let n = J(t);
181
183
  return e[n] = e[n] || {
182
184
  props: {},
183
185
  children: []
184
186
  }, t.type === "element" && (e[n].props = t.props, e[n].children.push(...t.children || [])), e;
185
- }, { [T]: {
187
+ }, { [E]: {
186
188
  props: {},
187
189
  children: []
188
190
  } });
189
191
  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, {
192
+ let n = w(e, Object.keys(s || {})), l = c.map((e, i) => R(e, t, {
191
193
  documentMeta: r,
192
194
  parentScope: {
193
195
  ...a,
@@ -195,10 +197,10 @@ function R(e, t, n) {
195
197
  },
196
198
  resolveComponent: o
197
199
  }, String(e.props?.key || i)));
198
- return s?.unwrap && (l = i(l, s.unwrap)), X(l);
200
+ return s?.unwrap && (l = i(l, s.unwrap)), Z(l);
199
201
  }), e), {});
200
202
  }
201
- function z(e, t, n, r = {}) {
203
+ function B(e, t, n, r = {}) {
202
204
  let i = {
203
205
  ...n.runtimeData,
204
206
  ...r,
@@ -207,95 +209,95 @@ function z(e, t, n, r = {}) {
207
209
  }, a = (e.props?.value.trim().split(/\.|\[(\d+)\]/).filter(Boolean)).reduce((e, t) => {
208
210
  if (e && t in e) return typeof e[t] == "function" ? e[t]() : e[t];
209
211
  }, i), o = e.props?.defaultValue;
210
- return t(l, a ?? o ?? "");
212
+ return t(u, a ?? o ?? "");
211
213
  }
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);
214
+ function V(e, n) {
215
+ let { tag: r = "", props: i = {} } = e, a = Object.keys(i).reduce(function(e, a) {
216
+ if (a === "__ignoreMap") return e;
217
+ let s = i[a];
218
+ if (k.test(a)) return H(a, s, e, n, { native: A.includes(r) });
219
+ if (a === "v-bind") return U(a, s, e, n);
220
+ if (D.test(a)) return W(a, s, e, n);
221
+ if (O.test(a)) return G(a, s, e, n);
222
+ let { attribute: c } = o(t, a);
223
+ return Array.isArray(s) && s.every((e) => typeof e == "string") ? (e[c] = s.join(" "), e) : (e[c] = s, e);
223
224
  }, {});
225
+ return Object.fromEntries(Object.entries(a).filter(([e, t]) => !s(e, t)));
224
226
  }
225
- function V(e, t, n, r, { native: i }) {
227
+ function H(e, t, n, r, { native: i }) {
226
228
  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) => {
229
+ return n[o] = q(t, r.runtimeData), n[s] = (e) => {
228
230
  r.updateRuntimeData(t, i ? e.target?.value : e);
229
231
  }, n;
230
232
  }
231
- function H(e, t, n, r) {
232
- let i = K(t, r);
233
- return n = Object.assign(n, i), n;
234
- }
235
233
  function U(e, t, n, r) {
236
- return e = e.replace(E, ""), n.on = n.on || {}, n.on[e] = () => K(t, r), n;
234
+ let i = q(t, r);
235
+ return n = Object.assign(n, i), n;
237
236
  }
238
237
  function W(e, t, n, r) {
239
- return e = e.replace(D, ""), n[e] = K(t, r), n;
238
+ return e = e.replace(D, ""), n.on = n.on || {}, n.on[e] = () => q(t, r), n;
239
+ }
240
+ function G(e, t, n, r) {
241
+ return e = e.replace(O, ""), n[e] = q(t, r), n;
240
242
  }
241
- var G = (e) => {
243
+ var K = (e) => {
242
244
  if (typeof e == "string") {
243
245
  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
+ let t = _(n(e), !1);
247
+ return !e || t?.name === "AsyncComponentWrapper" || typeof t == "string" ? t : "setup" in t ? f(() => new Promise((e) => e(t))) : t;
246
248
  }
247
249
  return e;
248
250
  };
249
- function K(e, t) {
251
+ function q(e, t) {
250
252
  let n = e.split(".").reduce((e, t) => typeof e == "object" ? e[t] : void 0, t);
251
- return n === void 0 ? te(e) : n;
253
+ return n === void 0 ? C(e) : n;
252
254
  }
253
- function q(e) {
255
+ function J(e) {
254
256
  let t = "";
255
257
  for (let n of Object.keys(e.props || {})) if (n.startsWith("#") || n.startsWith("v-slot:")) {
256
258
  t = n.split(/[:#]/, 2)[1];
257
259
  break;
258
260
  }
259
- return t || T;
260
- }
261
- function J(e) {
262
- return e.tag === "template";
261
+ return t || E;
263
262
  }
264
263
  function Y(e) {
265
- return A.has(e);
264
+ return e.tag === "template";
266
265
  }
267
266
  function X(e) {
267
+ return j.has(e);
268
+ }
269
+ function Z(e) {
268
270
  let t = [];
269
271
  for (let n of e) {
270
272
  let e = t[t.length - 1];
271
- n.type === l && e?.type === l ? e.children += n.children : t.push(n);
273
+ n.type === u && e?.type === u ? e.children += n.children : t.push(n);
272
274
  }
273
275
  return t;
274
276
  }
275
- async function Z(e, t) {
277
+ async function ne(e, t) {
276
278
  if (!e) return;
277
279
  let n = Array.from(new Set(r(e, t)));
278
280
  await Promise.all(n.map(async (e) => {
279
281
  if (e?.render || e?.ssrRender || e?.__ssrInlineRender) return;
280
- let t = G(e);
282
+ let t = K(e);
281
283
  t?.__asyncLoader && !t.__asyncResolved && await t.__asyncLoader();
282
284
  }));
283
285
  function r(e, t) {
284
286
  let n = e.tag;
285
- if (e.type === "text" || n === "binding" || e.type === "comment") return [];
287
+ if (e.type === "text" || n === "binding" || e.type === "comment" || e.type !== "root" && typeof n != "string") return [];
286
288
  let i = Q(e, t.tags);
287
- if (Y(i)) return [];
289
+ if (X(i)) return [];
288
290
  let a = [];
289
291
  e.type !== "root" && !$(i) && a.push(i);
290
292
  for (let n of e.children || []) a.push(...r(n, t));
291
293
  return a;
292
294
  }
293
295
  }
294
- function Q(e, n) {
296
+ function Q(e, t) {
295
297
  let i = e.tag;
296
- return !i || e.props?.__ignoreMap !== void 0 ? i : n[i] || n[t(i)] || n[r(e.tag)] || i;
298
+ return !i || e.props?.__ignoreMap !== void 0 ? i : t[i] || t[n(i)] || t[r(e.tag)] || i;
297
299
  }
298
300
  function $(e) {
299
- return typeof e == "string" && j.has(e) || n.has(e);
301
+ return typeof e == "string" && M.has(e) || c.has(e);
300
302
  }
301
- export { I as default };
303
+ export { L as default };
package/dist/index.js CHANGED
@@ -253,9 +253,9 @@ var A = /*#__PURE__*/ k(le, [["render", de], ["__scopeId", "data-v-d52859e7"]]),
253
253
  emits: ["resolve"],
254
254
  setup(t, { expose: n, emit: a }) {
255
255
  let o = t, s = a, { densityClass: c } = ce(o), l = g(!1), u = g(), f = async () => {
256
- let { parseMarkdown: e } = await import("./runtime-Cmxarge9.js");
256
+ let { parseMarkdown: e } = await import("./runtime-R-aI3I9T.js");
257
257
  return e;
258
- }, p = ee(() => import("./MDCRenderer-Bd04ujwA.js"));
258
+ }, p = ee(() => import("./MDCRenderer-BonoinDm.js"));
259
259
  ne(() => o.markdown, async () => {
260
260
  l.value = !0;
261
261
  try {