@noirmd/previewer 1.2.0 → 2.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.
Files changed (53) hide show
  1. package/dist/NReditor.cjs +851 -895
  2. package/dist/NReditor.cjs.map +1 -1
  3. package/dist/NReditor.d.cts +1 -1
  4. package/dist/NReditor.d.ts +1 -1
  5. package/dist/NReditor.js +852 -896
  6. package/dist/NReditor.js.map +1 -1
  7. package/dist/admonition.css +55 -0
  8. package/dist/{markdown.css → base.css} +96 -126
  9. package/dist/blockquote.css +16 -0
  10. package/dist/button.css +32 -0
  11. package/dist/card.css +143 -0
  12. package/dist/codeblock.css +59 -0
  13. package/dist/core.cjs +9 -1
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.js +9 -1
  16. package/dist/core.js.map +1 -1
  17. package/dist/details.css +45 -0
  18. package/dist/editor.css +56 -9
  19. package/dist/fonts/material-icons-round.woff2 +0 -0
  20. package/dist/index.cjs +852 -883
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +41 -70
  23. package/dist/index.d.ts +41 -70
  24. package/dist/index.js +851 -877
  25. package/dist/index.js.map +1 -1
  26. package/dist/list.css +18 -0
  27. package/dist/modal.css +82 -0
  28. package/dist/react.cjs +852 -886
  29. package/dist/react.cjs.map +1 -1
  30. package/dist/react.d.cts +44 -73
  31. package/dist/react.d.ts +44 -73
  32. package/dist/react.js +851 -880
  33. package/dist/react.js.map +1 -1
  34. package/dist/slide.css +21 -0
  35. package/dist/table.css +36 -0
  36. package/dist/toc.css +45 -0
  37. package/dist/vanilla.cjs +42 -28
  38. package/dist/vanilla.cjs.map +1 -1
  39. package/dist/vanilla.css +32 -677
  40. package/dist/vanilla.d.cts +8 -2
  41. package/dist/vanilla.d.ts +8 -2
  42. package/dist/vanilla.js +41 -28
  43. package/dist/vanilla.js.map +1 -1
  44. package/dist/variables.css +53 -0
  45. package/dist/vue.cjs +931 -1121
  46. package/dist/vue.cjs.map +1 -1
  47. package/dist/vue.d.cts +63 -214
  48. package/dist/vue.d.ts +63 -214
  49. package/dist/vue.js +930 -1120
  50. package/dist/vue.js.map +1 -1
  51. package/editor.css +56 -9
  52. package/package.json +5 -10
  53. package/markdown.css +0 -344
package/dist/vue.js CHANGED
@@ -1564,10 +1564,10 @@ var require_core = __commonJS({
1564
1564
  });
1565
1565
 
1566
1566
  // vue/NRpreviewer.ts
1567
- import { defineComponent as defineComponent12, h as h13, ref as ref6 } from "vue";
1567
+ import { defineComponent as defineComponent3, h as h3, ref as ref3 } from "vue";
1568
1568
 
1569
1569
  // vue/CustomMarkdownRenderer.ts
1570
- import { defineComponent as defineComponent11, h as h12, ref as ref5, computed, onMounted as onMounted4, onUnmounted as onUnmounted3, provide } from "vue";
1570
+ import { defineComponent, h, onMounted as onMounted2, onUnmounted as onUnmounted2, ref, watch as watch2 } from "vue";
1571
1571
 
1572
1572
  // core/utils.ts
1573
1573
  function parseCssString(cssText) {
@@ -1613,9 +1613,6 @@ function extractAttributes(text) {
1613
1613
  return { text: cleanedText, classes: classList.join(" "), id };
1614
1614
  }
1615
1615
  var _scopeCounter = 0;
1616
- function resetScopeCounter() {
1617
- _scopeCounter = 0;
1618
- }
1619
1616
  function generateScopeId() {
1620
1617
  return `scope-${++_scopeCounter}`;
1621
1618
  }
@@ -1663,6 +1660,7 @@ function parseMarkdown(markdown2) {
1663
1660
  if (!markdown2) return [];
1664
1661
  const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
1665
1662
  const result = [];
1663
+ const usedIds = /* @__PURE__ */ new Set();
1666
1664
  let i = 0;
1667
1665
  while (i < lines.length) {
1668
1666
  const line = lines[i];
@@ -1672,7 +1670,14 @@ function parseMarkdown(markdown2) {
1672
1670
  const level = match[1].length;
1673
1671
  const rawText = match[2];
1674
1672
  const { text: text2, classes: classes2, id: customId } = extractAttributes(rawText);
1675
- const id2 = customId || generateId(text2.replace(/->|<-/g, ""));
1673
+ const baseId = customId || generateId(text2.replace(/->|<-/g, ""));
1674
+ let id2 = baseId;
1675
+ let n = 1;
1676
+ while (usedIds.has(id2)) {
1677
+ n++;
1678
+ id2 = `${baseId}-${n}`;
1679
+ }
1680
+ usedIds.add(id2);
1676
1681
  result.push({ type: "header", level, text: text2, id: id2, classes: classes2 || void 0 });
1677
1682
  i++;
1678
1683
  continue;
@@ -1987,156 +1992,6 @@ function splitSlots(rawContent) {
1987
1992
  return slots;
1988
1993
  }
1989
1994
 
1990
- // vue/renderers.ts
1991
- import { h } from "vue";
1992
- function renderInline(text) {
1993
- if (!text) return [];
1994
- const parsePart = (part, key) => {
1995
- let match2;
1996
- if (match2 = part.match(/^\|\[([^\]]+)\]\|$/)) {
1997
- return h("span", {
1998
- class: "nr-icon material-symbols-rounded",
1999
- "aria-hidden": "true",
2000
- innerHTML: /^[eE][0-9a-fA-F]{3,4}$/.test(match2[1]) ? `&#x${match2[1]};` : void 0,
2001
- key
2002
- }, /^[eE][0-9a-fA-F]{3,4}$/.test(match2[1]) ? void 0 : match2[1]);
2003
- }
2004
- if (match2 = part.match(/^!~(.+?)~!$/)) {
2005
- const content = match2[1];
2006
- const parts = content.split(";");
2007
- let color = "currentColor";
2008
- let decorationStyle = "solid";
2009
- let type = "underline";
2010
- let textIndex = 0;
2011
- if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
2012
- color = parts[textIndex++];
2013
- }
2014
- if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
2015
- decorationStyle = parts[textIndex++];
2016
- }
2017
- if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
2018
- type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
2019
- }
2020
- const innerText = parts.slice(textIndex).join(";");
2021
- return h("span", {
2022
- key,
2023
- style: { textDecoration: `${type} ${decorationStyle} ${color}`, textDecorationThickness: "auto" }
2024
- }, renderInline(innerText));
2025
- }
2026
- if (match2 = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
2027
- return h("span", { key, style: { color: match2[1] } }, renderInline(match2[2]));
2028
- }
2029
- if (match2 = part.match(/^!>([^<]+?)<!$/)) {
2030
- return h("span", {
2031
- key,
2032
- class: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer"
2033
- }, renderInline(match2[1]));
2034
- }
2035
- if (match2 = part.match(/^==(.+?)==$/)) {
2036
- return h("mark", {
2037
- key,
2038
- class: "bg-yellow-500/20 text-inherit px-0.5 rounded"
2039
- }, renderInline(match2[1]));
2040
- }
2041
- if (match2 = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
2042
- return h("strong", { key }, h("em", renderInline(match2[1])));
2043
- }
2044
- if (match2 = part.match(/^\*\*(.+?)\*\*$/)) {
2045
- return h("strong", { key }, renderInline(match2[1]));
2046
- }
2047
- if (match2 = part.match(/^_(.+?)_$/)) {
2048
- return h("em", { key }, renderInline(match2[1]));
2049
- }
2050
- if (match2 = part.match(/^~~(.+?)~~$/)) {
2051
- return h("del", { key }, renderInline(match2[1]));
2052
- }
2053
- if (match2 = part.match(/^`([^`]+)`$/)) {
2054
- return h("code", {
2055
- key,
2056
- class: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary"
2057
- }, match2[1]);
2058
- }
2059
- if (match2 = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
2060
- return h("a", {
2061
- key,
2062
- href: match2[2],
2063
- class: "text-accent-primary underline decoration-accent-primary/40 hover:decoration-accent-primary transition-colors",
2064
- target: "_blank",
2065
- rel: "noopener noreferrer"
2066
- }, renderInline(match2[1]));
2067
- }
2068
- if (part.startsWith("<") && part.endsWith(">")) {
2069
- return h("span", { key, innerHTML: part });
2070
- }
2071
- return h("span", { key }, part);
2072
- };
2073
- const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
2074
- const elements = [];
2075
- let lastIndex = 0;
2076
- let match;
2077
- let keyCounter = 0;
2078
- while ((match = regex.exec(text)) !== null) {
2079
- if (match.index > lastIndex) {
2080
- elements.push(h("span", { key: `text-${keyCounter++}` }, text.slice(lastIndex, match.index)));
2081
- }
2082
- elements.push(parsePart(match[0], `inline-${keyCounter++}`));
2083
- lastIndex = regex.lastIndex;
2084
- }
2085
- if (lastIndex < text.length) {
2086
- elements.push(h("span", { key: `text-${keyCounter++}` }, text.slice(lastIndex)));
2087
- }
2088
- return elements;
2089
- }
2090
- function renderTable(content) {
2091
- const rows = content.split("\n").filter((r) => r.trim());
2092
- if (rows.length < 2) return h("p", content);
2093
- const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
2094
- const headerCells = parseRow(rows[0]);
2095
- const bodyRows = rows.slice(2).map(parseRow);
2096
- return h("div", { class: "overflow-x-auto" }, [
2097
- h("table", { class: "w-full text-sm sm:text-base border-collapse my-4" }, [
2098
- h("thead", [
2099
- h("tr", headerCells.map(
2100
- (cell, ci) => h("th", {
2101
- key: ci,
2102
- class: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold"
2103
- }, renderInline(cell))
2104
- ))
2105
- ]),
2106
- h("tbody", bodyRows.map(
2107
- (cells, ri) => h("tr", { key: ri }, cells.map(
2108
- (cell, ci) => h("td", { key: ci, class: "border border-border px-3 py-2" }, renderInline(cell))
2109
- ))
2110
- ))
2111
- ])
2112
- ]);
2113
- }
2114
- function renderList(content) {
2115
- const lines = content.split("\n");
2116
- const items = [];
2117
- for (const line of lines) {
2118
- if (!line.trim()) continue;
2119
- const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.+)$/);
2120
- if (match) {
2121
- items.push({ indent: match[1].length, marker: match[2], text: match[3] });
2122
- }
2123
- }
2124
- if (items.length === 0) return h("p", content);
2125
- const isOrdered = /^\d+\.$/.test(items[0].marker);
2126
- const tag = isOrdered ? "ol" : "ul";
2127
- return h(tag, {
2128
- class: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`
2129
- }, items.map(
2130
- (item, index) => h("li", { key: index, class: "leading-relaxed" }, renderInline(item.text))
2131
- ));
2132
- }
2133
- function extractHeaders(elements) {
2134
- return elements.filter((el) => el.type === "header");
2135
- }
2136
-
2137
- // vue/ui-components.ts
2138
- import { h as h2, ref, defineComponent } from "vue";
2139
-
2140
1995
  // node_modules/highlight.js/es/core.js
2141
1996
  var import_core = __toESM(require_core(), 1);
2142
1997
  var core_default = import_core.default;
@@ -11033,7 +10888,7 @@ function shell(hljs) {
11033
10888
  };
11034
10889
  }
11035
10890
 
11036
- // vue/highlightSetup.ts
10891
+ // vanilla/highlightSetup.ts
11037
10892
  core_default.registerLanguage("javascript", javascript);
11038
10893
  core_default.registerLanguage("js", javascript);
11039
10894
  core_default.registerLanguage("jsx", javascript);
@@ -11071,754 +10926,908 @@ core_default.registerLanguage("diff", diff);
11071
10926
  core_default.registerLanguage("shell", shell);
11072
10927
  var highlightSetup_default = core_default;
11073
10928
 
11074
- // vue/ui-components.ts
11075
- var IconRenderer = defineComponent({
11076
- name: "IconRenderer",
11077
- props: {
11078
- iconName: { type: String, required: true },
11079
- extraClasses: { type: String, default: "" }
11080
- },
11081
- setup(props) {
11082
- return () => {
11083
- if (!props.iconName) return null;
11084
- const baseClass = `material-symbols-rounded !text-[1em] leading-none align-top ${props.extraClasses}`;
11085
- const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(props.iconName);
11086
- if (isCodepoint) {
11087
- return h2("span", {
11088
- class: baseClass,
11089
- innerHTML: `&#x${props.iconName};`,
11090
- "aria-hidden": "true"
11091
- });
11092
- }
11093
- return h2("span", { class: baseClass, "aria-hidden": "true" }, props.iconName);
11094
- };
10929
+ // vanilla/components.ts
10930
+ function createIcon(iconName, extraClasses) {
10931
+ const span = document.createElement("span");
10932
+ const cls = `nr-icon material-icons-round${extraClasses ? ` ${extraClasses}` : ""}`;
10933
+ span.className = cls;
10934
+ span.setAttribute("aria-hidden", "true");
10935
+ const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
10936
+ if (isCodepoint) {
10937
+ span.innerHTML = `&#x${iconName};`;
10938
+ } else {
10939
+ span.textContent = iconName;
11095
10940
  }
11096
- });
11097
- var CodeBlock = defineComponent({
11098
- name: "CodeBlock",
11099
- props: {
11100
- code: { type: String, required: true },
11101
- language: { type: String, default: "" },
11102
- title: { type: String, default: void 0 }
11103
- },
11104
- setup(props) {
11105
- const copied = ref(false);
11106
- let timer = null;
11107
- const lang = () => props.language?.split(/[\s{]/)[0]?.trim() || "";
11108
- const html = () => {
11109
- try {
11110
- if (lang() && highlightSetup_default.getLanguage(lang())) {
11111
- return highlightSetup_default.highlight(props.code, { language: lang() }).value;
11112
- }
11113
- return highlightSetup_default.highlightAuto(props.code).value;
11114
- } catch {
11115
- return "";
11116
- }
11117
- };
11118
- const handleCopy = () => {
11119
- navigator.clipboard.writeText(props.code);
11120
- copied.value = true;
11121
- if (timer) clearTimeout(timer);
11122
- timer = setTimeout(() => {
11123
- copied.value = false;
11124
- }, 1800);
11125
- };
11126
- return () => h2("div", { class: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5 relative" }, [
11127
- props.title && h2("div", { class: "flex items-center gap-2 px-4 py-2 border-b border-border bg-background-secondary-solid/10 text-xs sm:text-sm font-mono text-text-secondary" }, [
11128
- h2("span", { class: "material-symbols-rounded text-base" }, "description"),
11129
- props.title
11130
- ]),
11131
- h2("div", { class: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm" }, [
11132
- h2("pre", { class: "m-0" }, [
11133
- h2("code", {
11134
- class: `language-${lang() || "plaintext"}`,
11135
- innerHTML: html()
11136
- })
11137
- ])
11138
- ]),
11139
- h2("button", {
11140
- class: "absolute top-2 right-2 p-1.5 rounded-lg bg-background-secondary-solid/20 hover:bg-background-secondary-solid/40 transition-colors cursor-pointer border-none text-text-secondary hover:text-text-primary",
11141
- onClick: handleCopy,
11142
- title: "Copy code"
11143
- }, [
11144
- h2(
11145
- "span",
11146
- { class: "material-symbols-rounded", style: { fontSize: "1rem" } },
11147
- copied.value ? "check" : "content_copy"
11148
- )
11149
- ])
11150
- ]);
10941
+ return span;
10942
+ }
10943
+ function createCodeBlock(code, language, title) {
10944
+ const wrapper = document.createElement("div");
10945
+ wrapper.className = "nr-codeblock";
10946
+ const lang = language?.split(/[\s{]/)[0]?.trim() || "";
10947
+ if (title) {
10948
+ const header = document.createElement("div");
10949
+ header.className = "nr-codeblock__header";
10950
+ header.appendChild(createIcon("description"));
10951
+ const titleSpan = document.createElement("span");
10952
+ titleSpan.textContent = title;
10953
+ header.appendChild(titleSpan);
10954
+ wrapper.appendChild(header);
11151
10955
  }
11152
- });
11153
- var defaultIcons = {
10956
+ const pre = document.createElement("pre");
10957
+ pre.className = "nr-codeblock__pre";
10958
+ const codeEl = document.createElement("code");
10959
+ codeEl.className = `language-${lang || "plaintext"}`;
10960
+ try {
10961
+ if (lang && highlightSetup_default.getLanguage(lang)) {
10962
+ codeEl.innerHTML = highlightSetup_default.highlight(code, { language: lang }).value;
10963
+ } else {
10964
+ codeEl.innerHTML = highlightSetup_default.highlightAuto(code).value;
10965
+ }
10966
+ } catch {
10967
+ codeEl.textContent = code;
10968
+ }
10969
+ pre.appendChild(codeEl);
10970
+ wrapper.appendChild(pre);
10971
+ const copyBtn = document.createElement("button");
10972
+ copyBtn.className = "nr-codeblock__copy";
10973
+ copyBtn.title = "Copy code";
10974
+ const copyIcon = createIcon("content_copy");
10975
+ copyIcon.style.fontSize = "1rem";
10976
+ copyBtn.appendChild(copyIcon);
10977
+ let timer = null;
10978
+ copyBtn.addEventListener("click", () => {
10979
+ navigator.clipboard.writeText(code);
10980
+ copyIcon.textContent = "check";
10981
+ if (timer) clearTimeout(timer);
10982
+ timer = setTimeout(() => {
10983
+ copyIcon.textContent = "content_copy";
10984
+ }, 1800);
10985
+ });
10986
+ wrapper.appendChild(copyBtn);
10987
+ return wrapper;
10988
+ }
10989
+ var DEFAULT_ADMONITION_ICONS = {
11154
10990
  note: "info",
11155
10991
  info: "lightbulb",
11156
10992
  warning: "warning",
11157
10993
  danger: "report",
11158
- greentext: "subdirectory_play_arrow"
11159
- };
11160
- var typeClasses = {
11161
- note: "border-info/20 bg-info/5 text-info",
11162
- info: "border-info/30 bg-info/10 text-info",
11163
- warning: "border-amber-500/30 bg-amber-500/10 text-amber-500",
11164
- danger: "border-danger/30 bg-danger/10 text-danger",
11165
- greentext: "border-success/30 bg-success/10 text-success"
10994
+ greentext: "subdirectory_arrow_right"
11166
10995
  };
11167
- var Admonition = defineComponent({
11168
- name: "Admonition",
11169
- props: {
11170
- type: { type: String, default: "note" },
11171
- title: { type: String, default: void 0 },
11172
- icon: { type: String, default: void 0 },
11173
- class: { type: String, default: "" },
11174
- style: { type: Object, default: void 0 }
11175
- },
11176
- setup(props, { slots }) {
11177
- return () => {
11178
- const iconToRender = props.icon || defaultIcons[props.type] || "info";
11179
- const cls = `not-prose rounded-2xl mb-6 border shadow-xs p-4 ${typeClasses[props.type] || typeClasses.note} ${props.class}`;
11180
- return h2("div", { class: cls, style: props.style }, [
11181
- props.title && h2("h5", { class: "font-bold text-base mb-2 m-0 flex items-center gap-2" }, [
11182
- h2(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
11183
- h2("span", props.title)
11184
- ]),
11185
- h2("div", { class: "text-sm leading-relaxed opacity-90" }, slots.default?.())
11186
- ]);
11187
- };
10996
+ function createAdmonition(type, title, icon) {
10997
+ const el = document.createElement("div");
10998
+ el.className = `nr-admonition nr-admonition--${type || "note"}`;
10999
+ if (title) {
11000
+ const header = document.createElement("h5");
11001
+ header.className = "nr-admonition__title";
11002
+ const iconToRender = icon || DEFAULT_ADMONITION_ICONS[type] || "info";
11003
+ header.appendChild(createIcon(iconToRender, "nr-admonition__icon"));
11004
+ const titleSpan = document.createElement("span");
11005
+ titleSpan.textContent = title;
11006
+ header.appendChild(titleSpan);
11007
+ el.appendChild(header);
11188
11008
  }
11189
- });
11190
- var Details = defineComponent({
11191
- name: "Details",
11192
- props: {
11193
- title: { type: String, required: true },
11194
- icon: { type: String, default: void 0 },
11195
- defaultOpen: { type: Boolean, default: false },
11196
- class: { type: String, default: "" },
11197
- style: { type: Object, default: void 0 }
11198
- },
11199
- setup(props, { slots }) {
11200
- const isOpen = ref(props.defaultOpen);
11201
- const iconToRender = props.icon || "play_arrow";
11202
- return () => h2("details", {
11203
- class: `not-prose rounded-2xl border border-border mb-4 bg-background-primary/5 ${props.class}`,
11204
- open: isOpen.value,
11205
- style: props.style
11206
- }, [
11207
- h2("summary", {
11208
- class: "cursor-pointer p-4 font-bold flex items-center gap-2 list-none [&::-webkit-details-marker]:hidden hover:text-accent-primary transition-colors",
11209
- onClick: (e) => {
11210
- e.preventDefault();
11211
- isOpen.value = !isOpen.value;
11212
- }
11213
- }, [
11214
- h2(IconRenderer, {
11215
- iconName: iconToRender,
11216
- extraClasses: `transition-transform ${isOpen.value ? "rotate-90" : ""}`
11217
- }),
11218
- h2("span", props.title)
11219
- ]),
11220
- isOpen.value && h2("div", {
11221
- class: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0"
11222
- }, slots.default?.())
11223
- ]);
11009
+ const body = document.createElement("div");
11010
+ body.className = "nr-admonition__body";
11011
+ el.appendChild(body);
11012
+ return el;
11013
+ }
11014
+ function createDetails(title, icon, defaultOpen) {
11015
+ const details = document.createElement("details");
11016
+ details.className = "nr-details";
11017
+ if (defaultOpen) details.open = true;
11018
+ const summary = document.createElement("summary");
11019
+ summary.className = "nr-details__summary";
11020
+ const iconToRender = icon || "play_arrow";
11021
+ const iconEl = createIcon(iconToRender, "nr-details__icon");
11022
+ summary.appendChild(iconEl);
11023
+ const titleSpan = document.createElement("span");
11024
+ titleSpan.textContent = title || "Details";
11025
+ summary.appendChild(titleSpan);
11026
+ details.addEventListener("toggle", () => {
11027
+ iconEl.classList.toggle("nr-details__icon--open", details.open);
11028
+ });
11029
+ details.appendChild(summary);
11030
+ const body = document.createElement("div");
11031
+ body.className = "nr-details__body";
11032
+ details.appendChild(body);
11033
+ return details;
11034
+ }
11035
+ function createModal(title) {
11036
+ const dialog = document.createElement("dialog");
11037
+ dialog.className = "nr-modal";
11038
+ dialog.addEventListener("click", (e) => {
11039
+ if (e.target === dialog) {
11040
+ dialog.close();
11041
+ }
11042
+ });
11043
+ const popup = document.createElement("div");
11044
+ popup.className = "nr-modal__popup";
11045
+ const header = document.createElement("div");
11046
+ header.className = "nr-modal__header";
11047
+ const titleEl = document.createElement("h2");
11048
+ titleEl.className = "nr-modal__title";
11049
+ titleEl.textContent = title;
11050
+ header.appendChild(titleEl);
11051
+ const closeBtn = document.createElement("button");
11052
+ closeBtn.className = "nr-modal__close";
11053
+ closeBtn.appendChild(createIcon("close"));
11054
+ closeBtn.addEventListener("click", () => dialog.close());
11055
+ header.appendChild(closeBtn);
11056
+ popup.appendChild(header);
11057
+ const body = document.createElement("div");
11058
+ body.className = "nr-modal__body";
11059
+ popup.appendChild(body);
11060
+ dialog.appendChild(popup);
11061
+ return dialog;
11062
+ }
11063
+ function createTable(content, renderInline2) {
11064
+ const rows = content.split("\n").filter((r) => r.trim());
11065
+ if (rows.length < 2) {
11066
+ const p = document.createElement("p");
11067
+ p.textContent = content;
11068
+ return p;
11224
11069
  }
11225
- });
11226
- var Modal = defineComponent({
11227
- name: "Modal",
11228
- props: {
11229
- title: { type: String, required: true },
11230
- isOpen: { type: Boolean, required: true },
11231
- onClose: { type: Function, required: true }
11232
- },
11233
- setup(props, { slots }) {
11234
- let dialogEl = null;
11235
- const showDialog = () => {
11236
- if (dialogEl && !dialogEl.open) {
11237
- document.body.appendChild(dialogEl);
11238
- dialogEl.showModal();
11239
- }
11240
- };
11241
- const closeDialog = () => {
11242
- if (dialogEl) {
11243
- dialogEl.close();
11244
- }
11245
- };
11246
- return () => {
11247
- const dialog = h2("dialog", {
11248
- ref: (el) => {
11249
- dialogEl = el?.$el || el;
11250
- },
11251
- class: "nr-modal",
11252
- onClick: (e) => {
11253
- if (e.target === dialogEl) closeDialog();
11254
- },
11255
- onClosed: () => {
11256
- dialogEl?.remove();
11257
- props.onClose();
11258
- }
11259
- }, [
11260
- h2("div", { class: "nr-modal__popup" }, [
11261
- h2("div", { class: "nr-modal__header" }, [
11262
- h2("h2", { class: "nr-modal__title" }, props.title),
11263
- h2("button", {
11264
- class: "nr-modal__close",
11265
- onClick: closeDialog
11266
- }, [
11267
- h2("span", { class: "material-symbols-rounded" }, "close")
11268
- ])
11269
- ]),
11270
- h2("div", { class: "nr-modal__body" }, slots.default?.())
11271
- ])
11272
- ]);
11273
- if (props.isOpen) {
11274
- Promise.resolve().then(showDialog);
11275
- }
11276
- return dialog;
11277
- };
11070
+ const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
11071
+ const headerCells = parseRow(rows[0]);
11072
+ const bodyRows = rows.slice(2).map(parseRow);
11073
+ const wrapper = document.createElement("div");
11074
+ wrapper.className = "nr-table-wrap";
11075
+ const table = document.createElement("table");
11076
+ table.className = "nr-table";
11077
+ const thead = document.createElement("thead");
11078
+ const tr = document.createElement("tr");
11079
+ for (const cell of headerCells) {
11080
+ const th = document.createElement("th");
11081
+ th.className = "nr-table__th";
11082
+ th.appendChild(renderInline2(cell));
11083
+ tr.appendChild(th);
11278
11084
  }
11279
- });
11280
-
11281
- // vue/DirectiveRenderer.ts
11282
- import { defineComponent as defineComponent9, h as h10 } from "vue";
11283
-
11284
- // vue/directives/AdmonitionDirective.ts
11285
- import { defineComponent as defineComponent2, h as h3 } from "vue";
11286
- var AdmonitionDirective = defineComponent2({
11287
- name: "AdmonitionDirective",
11288
- props: {
11289
- directiveType: String,
11290
- props: Object,
11291
- slots: Object,
11292
- renderSlot: Function,
11293
- context: Object,
11294
- index: [String, Number],
11295
- allElements: Array,
11296
- options: Object
11297
- },
11298
- setup(props) {
11299
- return () => {
11300
- const p = props;
11301
- return h3(Admonition, {
11302
- type: p.directiveType,
11303
- title: p.props.title,
11304
- icon: p.props.icon,
11305
- class: p.props.class,
11306
- style: p.props.style ? parseCssString(p.props.style) : void 0
11307
- }, p.renderSlot("default"));
11308
- };
11085
+ thead.appendChild(tr);
11086
+ table.appendChild(thead);
11087
+ const tbody = document.createElement("tbody");
11088
+ for (const cells of bodyRows) {
11089
+ const tr2 = document.createElement("tr");
11090
+ for (const cell of cells) {
11091
+ const td = document.createElement("td");
11092
+ td.className = "nr-table__td";
11093
+ td.appendChild(renderInline2(cell));
11094
+ tr2.appendChild(td);
11095
+ }
11096
+ tbody.appendChild(tr2);
11309
11097
  }
11310
- });
11311
- var AdmonitionDirective_default = AdmonitionDirective;
11312
-
11313
- // vue/directives/CardDirective.ts
11314
- import { defineComponent as defineComponent3, h as h4 } from "vue";
11098
+ table.appendChild(tbody);
11099
+ wrapper.appendChild(table);
11100
+ return wrapper;
11101
+ }
11102
+ function createList(content, renderInline2) {
11103
+ const lines = content.split("\n");
11104
+ const items = [];
11105
+ for (const line of lines) {
11106
+ if (!line.trim()) continue;
11107
+ const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.+)$/);
11108
+ if (match) {
11109
+ items.push({ indent: match[1].length, marker: match[2], text: match[3] });
11110
+ }
11111
+ }
11112
+ if (items.length === 0) {
11113
+ const p = document.createElement("p");
11114
+ p.textContent = content;
11115
+ return p;
11116
+ }
11117
+ const isOrdered = /^\d+\.$/.test(items[0].marker);
11118
+ const list = document.createElement(isOrdered ? "ol" : "ul");
11119
+ list.className = "nr-list";
11120
+ for (const item of items) {
11121
+ const li = document.createElement("li");
11122
+ li.className = "nr-list__item";
11123
+ li.appendChild(renderInline2(item.text));
11124
+ list.appendChild(li);
11125
+ }
11126
+ return list;
11127
+ }
11128
+ function createTOC(headers, renderInline2) {
11129
+ const nav = document.createElement("nav");
11130
+ nav.className = "nr-toc";
11131
+ const title = document.createElement("div");
11132
+ title.className = "nr-toc__title";
11133
+ title.textContent = "Table of Contents";
11134
+ nav.appendChild(title);
11135
+ const ul = document.createElement("ul");
11136
+ ul.className = "nr-toc__list";
11137
+ for (const h4 of headers) {
11138
+ const li = document.createElement("li");
11139
+ li.className = `nr-toc__item nr-toc__item--h${h4.level}`;
11140
+ const a = document.createElement("a");
11141
+ a.className = "nr-toc__link";
11142
+ a.href = `#${h4.id}`;
11143
+ a.appendChild(renderInline2(h4.text.replace(/->|<-/g, "").trim()));
11144
+ a.addEventListener("click", (e) => {
11145
+ e.preventDefault();
11146
+ const target = document.getElementById(h4.id);
11147
+ if (target) target.scrollIntoView({ behavior: "smooth", block: "start" });
11148
+ });
11149
+ li.appendChild(a);
11150
+ ul.appendChild(li);
11151
+ }
11152
+ nav.appendChild(ul);
11153
+ return nav;
11154
+ }
11155
+ function createBlockquote(content, classes, renderInline2) {
11156
+ const el = document.createElement("blockquote");
11157
+ el.className = `nr-blockquote${classes ? ` ${classes}` : ""}`;
11158
+ el.appendChild(renderInline2(content));
11159
+ return el;
11160
+ }
11315
11161
 
11316
- // vue/context.ts
11317
- import { inject } from "vue";
11318
- var RenderContextKey = /* @__PURE__ */ Symbol("RenderContext");
11319
- function useRenderContext() {
11320
- const ctx = inject(RenderContextKey);
11321
- if (!ctx) {
11322
- throw new Error("useRenderContext must be used within a RenderContextProvider");
11162
+ // vanilla/inline.ts
11163
+ function renderInline(text) {
11164
+ const fragment = document.createDocumentFragment();
11165
+ if (!text) return fragment;
11166
+ const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
11167
+ let lastIndex = 0;
11168
+ let match;
11169
+ while ((match = regex.exec(text)) !== null) {
11170
+ if (match.index > lastIndex) {
11171
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex, match.index)));
11172
+ }
11173
+ fragment.appendChild(parseInlinePart(match[0]));
11174
+ lastIndex = regex.lastIndex;
11323
11175
  }
11324
- return ctx;
11176
+ if (lastIndex < text.length) {
11177
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex)));
11178
+ }
11179
+ return fragment;
11180
+ }
11181
+ function parseInlinePart(part) {
11182
+ let match;
11183
+ if (match = part.match(/^\|\[([^\]]+)\]\|$/)) {
11184
+ return createIcon(match[1]);
11185
+ }
11186
+ if (match = part.match(/^!~(.+?)~!$/)) {
11187
+ const content = match[1];
11188
+ const parts = content.split(";");
11189
+ let color = "currentColor";
11190
+ let decorationStyle = "solid";
11191
+ let type = "underline";
11192
+ let textIndex = 0;
11193
+ if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
11194
+ color = parts[textIndex++];
11195
+ }
11196
+ if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
11197
+ decorationStyle = parts[textIndex++];
11198
+ }
11199
+ if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
11200
+ type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
11201
+ }
11202
+ const innerText = parts.slice(textIndex).join(";");
11203
+ const span = document.createElement("span");
11204
+ span.className = "nr-underline";
11205
+ span.style.textDecoration = `${type} ${decorationStyle} ${color}`;
11206
+ span.style.textDecorationThickness = "auto";
11207
+ span.appendChild(renderInline(innerText));
11208
+ return span;
11209
+ }
11210
+ if (match = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
11211
+ const span = document.createElement("span");
11212
+ span.style.color = match[1];
11213
+ span.appendChild(renderInline(match[2]));
11214
+ return span;
11215
+ }
11216
+ if (match = part.match(/^!>([^<]+?)<!$/)) {
11217
+ const span = document.createElement("span");
11218
+ span.className = "nr-spoiler";
11219
+ span.appendChild(renderInline(match[1]));
11220
+ return span;
11221
+ }
11222
+ if (match = part.match(/^==(.+?)==$/)) {
11223
+ const mark = document.createElement("mark");
11224
+ mark.className = "nr-highlight";
11225
+ mark.appendChild(renderInline(match[1]));
11226
+ return mark;
11227
+ }
11228
+ if (match = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
11229
+ const strong = document.createElement("strong");
11230
+ const em = document.createElement("em");
11231
+ em.appendChild(renderInline(match[1]));
11232
+ strong.appendChild(em);
11233
+ return strong;
11234
+ }
11235
+ if (match = part.match(/^\*\*(.+?)\*\*$/)) {
11236
+ const strong = document.createElement("strong");
11237
+ strong.appendChild(renderInline(match[1]));
11238
+ return strong;
11239
+ }
11240
+ if (match = part.match(/^_(.+?)_$/)) {
11241
+ const em = document.createElement("em");
11242
+ em.appendChild(renderInline(match[1]));
11243
+ return em;
11244
+ }
11245
+ if (match = part.match(/^~~(.+?)~~$/)) {
11246
+ const del = document.createElement("del");
11247
+ del.appendChild(renderInline(match[1]));
11248
+ return del;
11249
+ }
11250
+ if (match = part.match(/^`([^`]+)`$/)) {
11251
+ const code = document.createElement("code");
11252
+ code.className = "nr-inline-code";
11253
+ code.textContent = match[1];
11254
+ return code;
11255
+ }
11256
+ if (match = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
11257
+ const a = document.createElement("a");
11258
+ a.className = "nr-link";
11259
+ a.href = match[2];
11260
+ a.target = "_blank";
11261
+ a.rel = "noopener noreferrer";
11262
+ a.appendChild(renderInline(match[1]));
11263
+ return a;
11264
+ }
11265
+ if (part.startsWith("<") && part.endsWith(">")) {
11266
+ const span = document.createElement("span");
11267
+ span.innerHTML = part;
11268
+ return span;
11269
+ }
11270
+ return document.createTextNode(part);
11325
11271
  }
11326
11272
 
11327
- // vue/directives/CardDirective.ts
11328
- var CardDirective = defineComponent3({
11329
- name: "CardDirective",
11330
- props: {
11331
- directiveType: String,
11332
- props: Object,
11333
- slots: Object,
11334
- renderSlot: Function,
11335
- context: Object,
11336
- index: [String, Number],
11337
- allElements: Array,
11338
- options: { type: Object, default: () => ({}) }
11339
- },
11340
- setup(props) {
11341
- return () => {
11342
- const p = props;
11343
- const ctx = useRenderContext();
11344
- const { title, image, icon, class: customClass, url, target } = p.props;
11345
- const hasDescription = !!p.slots.description;
11346
- const { isSingleCard } = p.options || {};
11347
- const isModal = p.directiveType === "card-m";
11348
- const isLink = p.directiveType === "card-b";
11349
- const modalId = `modal-card-${p.props.id || Math.random().toString(36).slice(2, 9)}`;
11350
- const inlineStyles = p.props.style ? parseCssString(p.props.style) : {};
11351
- const description = hasDescription ? p.renderSlot("description") : null;
11352
- const content = p.renderSlot("content") || p.renderSlot("default");
11353
- const handleClick = isModal ? (e) => {
11354
- e.preventDefault();
11355
- e.stopPropagation();
11356
- ctx.setModals((prev) => ({ ...prev, [modalId]: true }));
11357
- } : isLink && url ? () => window.open(url, "_blank") : void 0;
11358
- const card = h4("div", {
11359
- class: `flex flex-col h-full rounded-3xl transition-all relative overflow-hidden group border min-w-[18rem] w-[18rem] max-w-[20rem] ${isModal || isLink ? "cursor-pointer !border-accent-primary/10 hover:border-accent-primary/50" : "border-border"} ${customClass || ""}`.trim(),
11360
- style: inlineStyles,
11361
- onClick: handleClick,
11362
- role: isModal ? "button" : void 0,
11363
- tabIndex: isModal ? 0 : void 0,
11364
- onKeyDown: isModal ? (e) => {
11365
- if (e.key === "Enter" || e.key === " ") {
11366
- ctx.setModals((prev) => ({ ...prev, [modalId]: true }));
11367
- }
11368
- } : void 0
11369
- }, [
11370
- // Image banner
11371
- image && h4("div", {
11372
- class: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`
11373
- }, [
11374
- h4("img", { src: image, alt: title || "", class: "w-full h-full object-cover !m-0" }),
11375
- h4("div", { class: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
11376
- ]),
11377
- // Content body
11378
- h4("div", {
11379
- class: `flex flex-col flex-1 bg-background-primary/80 rounded-t-xl p-6 relative ${image ? "-mt-10" : ""} border-t border-white/5 shadow-2xl`
11380
- }, [
11381
- // Header: Icon + Title
11382
- (icon || title) && h4("div", { class: "flex items-center gap-3 mb-3" }, [
11383
- icon && h4("div", {
11384
- class: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary"
11385
- }, h4(IconRenderer, { iconName: icon })),
11386
- h4("h3", { class: "text-base font-black tracking-tight leading-tight !m-0" }, title)
11387
- ]),
11388
- // Content Body
11389
- h4("div", { class: "flex-1 flex flex-col gap-2" }, [
11390
- description && h4("div", { class: "text-sm opacity-80 leading-relaxed font-medium" }, description),
11391
- p.directiveType === "card" && content && content.length > 0 ? h4("div", { class: "mt-2" }, content) : null
11392
- ]),
11393
- // Bottom: Action Link
11394
- (isModal || isLink) && h4("div", { class: "mt-6 flex justify-end" }, [
11395
- isLink && url ? h4("a", {
11396
- href: url,
11397
- target: "_blank",
11398
- rel: "noopener noreferrer",
11399
- class: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all no-underline",
11400
- onClick: (e) => e.stopPropagation()
11401
- }, [h4(IconRenderer, { iconName: "open_in_new" }), " Link"]) : isModal ? h4("div", {
11402
- class: "bg-accent-primary/20 hover:bg-accent-primary/30 px-4 py-2 cursor-pointer rounded-xl flex items-center gap-1.5 text-[10px] font-black uppercase tracking-widest opacity-50 group-hover:opacity-100 group-hover:text-accent-primary transition-all"
11403
- }, [h4(IconRenderer, { iconName: "arrow_forward" }), " Abrir"]) : null
11404
- ])
11405
- ])
11406
- ]);
11407
- if (isModal) {
11408
- const modalContent = p.renderSlot("content") || p.renderSlot("default");
11409
- return h4("div", null, [
11410
- card,
11411
- h4(Modal, {
11412
- title: title || "Detalles",
11413
- isOpen: !!ctx.modals.value[modalId],
11414
- onClose: () => ctx.setModals((prev) => ({ ...prev, [modalId]: false }))
11415
- }, [
11416
- h4("div", { class: "prose prose-sm max-w-none" }, modalContent)
11417
- ])
11418
- ]);
11419
- }
11420
- return card;
11421
- };
11273
+ // vanilla/directives/admonition.ts
11274
+ var admonitionDirective = ({ directiveType, props, renderSlot }) => {
11275
+ const el = createAdmonition(directiveType, props.title, props.icon);
11276
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
11277
+ if (props.style) el.setAttribute("style", props.style);
11278
+ const body = el.querySelector(".nr-admonition__body");
11279
+ if (body) {
11280
+ body.appendChild(renderSlot("default"));
11422
11281
  }
11423
- });
11424
- var CardDirective_default = CardDirective;
11282
+ return el;
11283
+ };
11284
+ var admonition_default = admonitionDirective;
11425
11285
 
11426
- // vue/directives/DetailsDirective.ts
11427
- import { defineComponent as defineComponent4, h as h5 } from "vue";
11428
- var DetailsDirective = defineComponent4({
11429
- name: "DetailsDirective",
11430
- props: {
11431
- directiveType: String,
11432
- props: Object,
11433
- slots: Object,
11434
- renderSlot: Function,
11435
- context: Object,
11436
- index: [String, Number],
11437
- allElements: Array,
11438
- options: Object
11439
- },
11440
- setup(props) {
11441
- return () => {
11442
- const p = props;
11443
- return h5(Details, {
11444
- title: p.props.title || "Details",
11445
- icon: p.props.icon,
11446
- defaultOpen: p.props.defaultOpen === "true",
11447
- class: p.props.class,
11448
- style: p.props.style ? parseCssString(p.props.style) : void 0
11449
- }, p.renderSlot("default"));
11450
- };
11286
+ // vanilla/directives/details.ts
11287
+ var detailsDirective = ({ props, renderSlot }) => {
11288
+ const el = createDetails(
11289
+ props.title || "Details",
11290
+ props.icon,
11291
+ props.defaultOpen === "true"
11292
+ );
11293
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
11294
+ if (props.style) el.setAttribute("style", props.style);
11295
+ const body = el.querySelector(".nr-details__body");
11296
+ if (body) {
11297
+ body.appendChild(renderSlot("default"));
11451
11298
  }
11452
- });
11453
- var DetailsDirective_default = DetailsDirective;
11299
+ return el;
11300
+ };
11301
+ var details_default = detailsDirective;
11454
11302
 
11455
- // vue/directives/ModalDirective.ts
11456
- import { defineComponent as defineComponent5, h as h6 } from "vue";
11457
- var ModalDirective = defineComponent5({
11458
- name: "ModalDirective",
11459
- props: {
11460
- directiveType: String,
11461
- props: Object,
11462
- slots: Object,
11463
- renderSlot: Function,
11464
- context: Object,
11465
- index: [String, Number],
11466
- allElements: Array,
11467
- options: Object
11468
- },
11469
- setup(props) {
11470
- return () => {
11471
- const p = props;
11472
- const ctx = useRenderContext();
11473
- const modalId = `modal-${p.props.id || Math.random().toString(36).slice(2, 9)}`;
11474
- const label = p.props.label || p.props.title || "Open";
11475
- const modalTitle = p.props.title || "Modal";
11476
- const customClass = p.props.class || "";
11477
- const hasSizeClass = /\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/.test(customClass);
11478
- const sizeClass = hasSizeClass ? "" : "text-sm";
11479
- const hasDisplayClass = /\b(flex|inline-flex|block|inline-block|grid|inline-grid|hidden)\b/.test(customClass);
11480
- const displayClass = hasDisplayClass ? "" : "inline-flex";
11481
- const isInlineFlex = /\binline-flex\b/.test(customClass);
11482
- const marginClass = isInlineFlex ? "my-1 mx-1" : "my-4";
11483
- const btnBase = `${displayClass} items-center w-fit ${marginClass} ${sizeClass} px-4 py-2 rounded-xl font-bold no-underline gap-2 transition-all hover:scale-105 active:scale-95 border border-border bg-background-primary/5 hover:bg-background-primary/10 text-text-primary hover:text-text-primary`.replace(/\s+/g, " ");
11484
- const btnClass = `${btnBase} ${customClass}`.trim();
11485
- const positionMap = {
11486
- "#left": "text-left",
11487
- "#center": "text-center",
11488
- "#right": "text-right"
11489
- };
11490
- const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
11491
- const handleOpen = () => {
11492
- ctx.setModals((prev) => ({ ...prev, [modalId]: true }));
11493
- };
11494
- const handleClose = () => {
11495
- ctx.setModals((prev) => ({ ...prev, [modalId]: false }));
11496
- };
11497
- return h6("div", { class: `not-prose ${wrapperClass}`.trim() }, [
11498
- h6("button", { class: btnClass, onClick: handleOpen }, [
11499
- p.props.icon && h6(IconRenderer, { iconName: p.props.icon }),
11500
- label
11501
- ]),
11502
- h6(Modal, {
11503
- title: modalTitle,
11504
- isOpen: !!ctx.modals.value[modalId],
11505
- onClose: handleClose
11506
- }, p.renderSlot("default"))
11507
- ]);
11508
- };
11303
+ // vanilla/directives/modal.ts
11304
+ var modalDirective = ({ props, renderSlot }) => {
11305
+ const label = props.label || props.title || "Open";
11306
+ const modalTitle = props.title || "Modal";
11307
+ const customClass = props.class || "";
11308
+ const wrapper = document.createElement("div");
11309
+ wrapper.className = "nr-modal-trigger";
11310
+ const btn = document.createElement("button");
11311
+ btn.className = `nr-button nr-button--default`;
11312
+ if (customClass) btn.classList.add(...customClass.split(/\s+/).filter(Boolean));
11313
+ const icon = props.icon || "open_in_new";
11314
+ if (icon) btn.appendChild(createIcon(icon));
11315
+ btn.appendChild(document.createTextNode(label));
11316
+ const dialog = createModal(modalTitle);
11317
+ const body = dialog.querySelector(".nr-modal__body");
11318
+ if (body) {
11319
+ body.appendChild(renderSlot("default"));
11509
11320
  }
11510
- });
11511
- var ModalDirective_default = ModalDirective;
11321
+ btn.addEventListener("click", () => {
11322
+ if (!dialog.open) {
11323
+ document.body.appendChild(dialog);
11324
+ dialog.showModal();
11325
+ dialog.addEventListener("close", () => {
11326
+ dialog.remove();
11327
+ }, { once: true });
11328
+ }
11329
+ });
11330
+ wrapper.appendChild(btn);
11331
+ wrapper.appendChild(dialog);
11332
+ return wrapper;
11333
+ };
11334
+ var modal_default = modalDirective;
11512
11335
 
11513
- // vue/directives/ButtonDirective.ts
11514
- import { defineComponent as defineComponent6, h as h7 } from "vue";
11515
- var ButtonDirective = defineComponent6({
11516
- name: "ButtonDirective",
11517
- props: {
11518
- directiveType: String,
11519
- props: Object,
11520
- slots: Object,
11521
- renderSlot: Function,
11522
- context: Object,
11523
- index: [String, Number],
11524
- allElements: Array,
11525
- options: Object
11526
- },
11527
- setup(props) {
11528
- return () => {
11529
- const p = props;
11530
- const url = p.props.url || p.props.href || "#";
11531
- const label = p.props.label;
11532
- const icon = p.props.icon || "near_me";
11533
- const target = p.props.target || "_blank";
11534
- const customClass = p.props.class || "";
11535
- const hasSizeClass = /\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/.test(customClass);
11536
- const sizeClass = hasSizeClass ? "" : "text-sm";
11537
- const hasDisplayClass = /\b(flex|inline-flex|block|inline-block|grid|inline-grid|hidden)\b/.test(customClass);
11538
- const displayClass = hasDisplayClass ? "" : "inline-flex";
11539
- const isInline = !customClass || !/\b(flex|block|grid)\b/.test(customClass) || /\binline-flex\b/.test(customClass);
11540
- const marginClass = isInline ? "my-1 mx-1" : "my-4";
11541
- const btnBase = `${displayClass} items-center w-fit ${marginClass} ${sizeClass} px-4 py-2 rounded-xl font-bold no-underline gap-2 transition-all hover:scale-105 active:scale-95 border border-border bg-background-primary/5 hover:bg-background-primary/10 text-text-primary hover:text-text-primary`.replace(/\s+/g, " ");
11542
- const btnClass = `${btnBase} ${customClass}`.trim();
11543
- const positionMap = {
11544
- "#left": "flex justify-start",
11545
- "#center": "flex justify-center",
11546
- "#right": "flex justify-end"
11547
- };
11548
- const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
11549
- if (label) {
11550
- return h7("div", { class: `not-prose ${wrapperClass}`.trim() }, [
11551
- h7("a", {
11552
- href: url,
11553
- target,
11554
- rel: "noopener noreferrer",
11555
- class: btnClass
11556
- }, [
11557
- h7(IconRenderer, { iconName: icon }),
11558
- label
11559
- ])
11560
- ]);
11561
- }
11562
- const slotContent = p.renderSlot("default");
11563
- const findLinks = (vnodes) => {
11564
- const links2 = [];
11565
- for (const vnode of vnodes) {
11566
- if (!vnode) continue;
11567
- if (typeof vnode.type === "string" && vnode.type === "a") {
11568
- links2.push(vnode);
11569
- }
11570
- if (vnode.children && Array.isArray(vnode.children)) {
11571
- links2.push(...findLinks(vnode.children));
11572
- }
11573
- }
11574
- return links2;
11575
- };
11576
- const links = findLinks(Array.isArray(slotContent) ? slotContent : [slotContent]);
11577
- if (links.length > 0) {
11578
- return h7("div", { class: `not-prose ${wrapperClass}`.trim() }, links.map((link, i) => {
11579
- const linkChildren = Array.isArray(link.children) ? link.children : link.children != null ? [link.children] : [];
11580
- return h7("a", {
11581
- key: i,
11582
- ...link.props || {},
11583
- class: `${link.props?.class || ""} ${btnClass}`.trim(),
11584
- target,
11585
- rel: "noopener noreferrer"
11586
- }, [
11587
- h7(IconRenderer, { iconName: icon }),
11588
- ...linkChildren
11589
- ]);
11590
- }));
11591
- }
11592
- return h7("div", { class: `not-prose ${wrapperClass}`.trim() }, [
11593
- h7("a", {
11594
- href: url,
11595
- target,
11596
- rel: "noopener noreferrer",
11597
- class: btnClass
11598
- }, [
11599
- h7(IconRenderer, { iconName: icon }),
11600
- slotContent
11601
- ])
11602
- ]);
11603
- };
11336
+ // vanilla/directives/button.ts
11337
+ var buttonDirective = ({ props, renderSlot }) => {
11338
+ const url = props.url || props.href || "#";
11339
+ const label = props.label;
11340
+ const icon = props.icon || "near_me";
11341
+ const target = props.target || "_blank";
11342
+ const customClass = props.class || "";
11343
+ const wrapper = document.createElement("div");
11344
+ wrapper.className = "nr-button-wrap";
11345
+ if (label) {
11346
+ const a = document.createElement("a");
11347
+ a.href = url;
11348
+ a.target = target;
11349
+ a.rel = "noopener noreferrer";
11350
+ a.className = "nr-button nr-button--default";
11351
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
11352
+ a.appendChild(createIcon(icon));
11353
+ a.appendChild(document.createTextNode(label));
11354
+ wrapper.appendChild(a);
11355
+ return wrapper;
11604
11356
  }
11605
- });
11606
- var ButtonDirective_default = ButtonDirective;
11357
+ const slotContent = renderSlot("default");
11358
+ const links = slotContent.querySelectorAll("a");
11359
+ if (links.length > 0) {
11360
+ links.forEach((link) => {
11361
+ link.classList.add("nr-button", "nr-button--default");
11362
+ if (customClass) link.classList.add(...customClass.split(/\s+/).filter(Boolean));
11363
+ });
11364
+ wrapper.appendChild(slotContent);
11365
+ } else {
11366
+ const a = document.createElement("a");
11367
+ a.href = url;
11368
+ a.target = target;
11369
+ a.rel = "noopener noreferrer";
11370
+ a.className = "nr-button nr-button--default";
11371
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
11372
+ a.appendChild(createIcon(icon));
11373
+ a.appendChild(slotContent);
11374
+ wrapper.appendChild(a);
11375
+ }
11376
+ return wrapper;
11377
+ };
11378
+ var button_default = buttonDirective;
11607
11379
 
11608
- // vue/directives/WrapperDirective.ts
11609
- import { defineComponent as defineComponent7, h as h8 } from "vue";
11610
- var WrapperDirective = defineComponent7({
11611
- name: "WrapperDirective",
11612
- props: {
11613
- directiveType: String,
11614
- props: Object,
11615
- slots: Object,
11616
- renderSlot: Function,
11617
- context: Object,
11618
- index: [String, Number],
11619
- allElements: Array,
11620
- options: Object
11621
- },
11622
- setup(props) {
11623
- return () => {
11624
- const p = props;
11625
- const className = p.props.class || "";
11626
- const id = p.props.id || "";
11627
- const inlineStyle = p.props.style ? parseCssString(p.props.style) : {};
11628
- const wrapperProps = {};
11629
- if (className) wrapperProps.class = className;
11630
- if (id) wrapperProps.id = id;
11631
- if (Object.keys(inlineStyle).length > 0) wrapperProps.style = inlineStyle;
11632
- for (const [key, value] of Object.entries(p.props)) {
11633
- if (key.startsWith("data-")) {
11634
- wrapperProps[key] = value;
11635
- }
11380
+ // vanilla/directives/card.ts
11381
+ var cardDirective = ({
11382
+ directiveType,
11383
+ props,
11384
+ slots,
11385
+ renderSlot,
11386
+ options
11387
+ }) => {
11388
+ const { title, image, icon, url, target } = props;
11389
+ const customClass = props.class || "";
11390
+ const hasDescription = !!slots.description;
11391
+ const { isSingleCard } = options || {};
11392
+ const isModal = directiveType === "card-m";
11393
+ const isLink = directiveType === "card-b";
11394
+ const inlineStyles = props.style ? parseCssString(props.style) : {};
11395
+ const card = document.createElement("div");
11396
+ card.className = `nr-card${isModal || isLink ? " nr-card--interactive" : ""} ${customClass}`.trim();
11397
+ for (const [key, value] of Object.entries(inlineStyles)) {
11398
+ card.style.setProperty(key, String(value));
11399
+ }
11400
+ if (image) {
11401
+ const imgWrap = document.createElement("div");
11402
+ imgWrap.className = `nr-card__image${isSingleCard ? " nr-card__image--tall" : ""}`;
11403
+ const img = document.createElement("img");
11404
+ img.src = image;
11405
+ img.alt = title || "";
11406
+ img.className = "nr-card__img";
11407
+ imgWrap.appendChild(img);
11408
+ const gradient = document.createElement("div");
11409
+ gradient.className = "nr-card__gradient";
11410
+ imgWrap.appendChild(gradient);
11411
+ card.appendChild(imgWrap);
11412
+ }
11413
+ const body = document.createElement("div");
11414
+ body.className = `nr-card__body${image ? " nr-card__body--overlap" : ""}`;
11415
+ if (icon || title) {
11416
+ const header = document.createElement("div");
11417
+ header.className = "nr-card__header";
11418
+ if (icon) {
11419
+ const iconWrap = document.createElement("div");
11420
+ iconWrap.className = "nr-card__icon-wrap";
11421
+ iconWrap.appendChild(createIcon(icon));
11422
+ header.appendChild(iconWrap);
11423
+ }
11424
+ if (title) {
11425
+ const h32 = document.createElement("h3");
11426
+ h32.className = "nr-card__title";
11427
+ h32.textContent = title;
11428
+ header.appendChild(h32);
11429
+ }
11430
+ body.appendChild(header);
11431
+ }
11432
+ if (hasDescription) {
11433
+ const desc = document.createElement("div");
11434
+ desc.className = "nr-card__description";
11435
+ desc.appendChild(renderSlot("description"));
11436
+ body.appendChild(desc);
11437
+ }
11438
+ if (directiveType === "card") {
11439
+ const contentSlot = renderSlot("content") || renderSlot("default");
11440
+ if (contentSlot.childNodes.length > 0) {
11441
+ const contentDiv = document.createElement("div");
11442
+ contentDiv.className = "nr-card__content";
11443
+ contentDiv.appendChild(contentSlot);
11444
+ body.appendChild(contentDiv);
11445
+ }
11446
+ }
11447
+ if (isModal || isLink) {
11448
+ const action = document.createElement("div");
11449
+ action.className = "nr-card__action";
11450
+ if (isLink && url) {
11451
+ const a = document.createElement("a");
11452
+ a.href = url;
11453
+ a.target = target || "_blank";
11454
+ a.rel = "noopener noreferrer";
11455
+ a.className = "nr-card__action-link";
11456
+ a.appendChild(createIcon("open_in_new"));
11457
+ a.appendChild(document.createTextNode(" Link"));
11458
+ action.appendChild(a);
11459
+ } else if (isModal) {
11460
+ const modalBtn = document.createElement("div");
11461
+ modalBtn.className = "nr-card__action-link";
11462
+ modalBtn.appendChild(createIcon("arrow_forward"));
11463
+ modalBtn.appendChild(document.createTextNode(" Abrir"));
11464
+ action.appendChild(modalBtn);
11465
+ }
11466
+ body.appendChild(action);
11467
+ }
11468
+ card.appendChild(body);
11469
+ if (isModal) {
11470
+ const dialog = createModal(title || "Detalles");
11471
+ const modalBody = dialog.querySelector(".nr-modal__body");
11472
+ if (modalBody) {
11473
+ const contentSlot = renderSlot("content") || renderSlot("default");
11474
+ modalBody.appendChild(contentSlot);
11475
+ }
11476
+ card.addEventListener("click", () => {
11477
+ if (!dialog.open) {
11478
+ document.body.appendChild(dialog);
11479
+ dialog.showModal();
11480
+ dialog.addEventListener("close", () => dialog.remove(), { once: true });
11636
11481
  }
11637
- return h8("div", wrapperProps, p.renderSlot("default"));
11638
- };
11482
+ });
11483
+ const frag = document.createDocumentFragment();
11484
+ frag.appendChild(card);
11485
+ frag.appendChild(dialog);
11486
+ return frag;
11639
11487
  }
11640
- });
11641
- var WrapperDirective_default = WrapperDirective;
11488
+ if (isLink && url) {
11489
+ card.addEventListener("click", () => window.open(url, target || "_blank"));
11490
+ }
11491
+ return card;
11492
+ };
11493
+ var card_default = cardDirective;
11642
11494
 
11643
- // vue/directives/SlideDirective.ts
11644
- import { defineComponent as defineComponent8, h as h9, ref as ref3, onMounted, onUnmounted, nextTick } from "vue";
11495
+ // vanilla/directives/wrapper.ts
11496
+ var wrapperDirective = ({ props, renderSlot }) => {
11497
+ const el = document.createElement("div");
11498
+ el.className = "nr-wrapper";
11499
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
11500
+ if (props.id) el.id = props.id;
11501
+ if (props.style) {
11502
+ const styles = parseCssString(props.style);
11503
+ for (const [key, value] of Object.entries(styles)) {
11504
+ el.style.setProperty(key, String(value));
11505
+ }
11506
+ }
11507
+ for (const [key, value] of Object.entries(props)) {
11508
+ if (key.startsWith("data-")) {
11509
+ el.setAttribute(key, value);
11510
+ }
11511
+ }
11512
+ el.appendChild(renderSlot("default"));
11513
+ return el;
11514
+ };
11515
+ var wrapper_default = wrapperDirective;
11516
+
11517
+ // vanilla/directives/slide.ts
11645
11518
  var slideCounter = 0;
11646
- var SlideDirective = defineComponent8({
11647
- name: "SlideDirective",
11648
- props: {
11649
- directiveType: String,
11650
- props: Object,
11651
- slots: Object,
11652
- renderSlot: Function,
11653
- context: Object,
11654
- index: [String, Number],
11655
- allElements: Array,
11656
- options: Object
11657
- },
11658
- setup(props) {
11659
- const current = ref3(0);
11660
- const maxH = ref3(0);
11661
- let intervalId = null;
11662
- let slideEls = [];
11663
- const measureAndSetHeight = () => {
11664
- let h14 = 0;
11519
+ var slideDirective = ({
11520
+ props,
11521
+ slots,
11522
+ renderInline: renderInline2,
11523
+ renderMarkdown
11524
+ }) => {
11525
+ const rawContent = slots.default || "";
11526
+ const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
11527
+ if (lines.length === 0) {
11528
+ return document.createDocumentFragment();
11529
+ }
11530
+ const interval = parseInt(props.interval || "3000", 10);
11531
+ const speed = parseInt(props.speed || "500", 10);
11532
+ const rawClass = props.class || "";
11533
+ const inlineStyle = props.style ? parseCssString(props.style) : {};
11534
+ const scopeClass = `sld-${++slideCounter}`;
11535
+ const container = document.createElement("div");
11536
+ container.className = "nr-slide";
11537
+ Object.assign(container.style, {
11538
+ position: "relative",
11539
+ overflow: "hidden",
11540
+ ...inlineStyle
11541
+ });
11542
+ const track = document.createElement("div");
11543
+ track.className = "nr-slide__track";
11544
+ track.style.transition = `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`;
11545
+ const slideEls = [];
11546
+ for (const line of lines) {
11547
+ const slideEl = document.createElement("div");
11548
+ slideEl.className = `nr-slide__item ${scopeClass} ${rawClass}`.trim();
11549
+ slideEl.style.display = "flex";
11550
+ slideEl.style.alignItems = "center";
11551
+ if (renderMarkdown) {
11552
+ const tokens = renderMarkdown(line);
11553
+ slideEl.appendChild(tokens);
11554
+ } else if (renderInline2) {
11555
+ slideEl.appendChild(renderInline2(line));
11556
+ }
11557
+ track.appendChild(slideEl);
11558
+ slideEls.push(slideEl);
11559
+ }
11560
+ container.appendChild(track);
11561
+ let current = 0;
11562
+ let maxH = 0;
11563
+ const measureAndSetHeight = () => {
11564
+ maxH = 0;
11565
+ for (const el of slideEls) {
11566
+ maxH = Math.max(maxH, el.offsetHeight);
11567
+ }
11568
+ if (maxH > 0) {
11569
+ container.style.height = `${maxH}px`;
11665
11570
  for (const el of slideEls) {
11666
- h14 = Math.max(h14, el.offsetHeight);
11571
+ el.style.height = `${maxH}px`;
11667
11572
  }
11668
- if (h14 > 0) maxH.value = h14;
11669
- };
11670
- onMounted(() => {
11671
- nextTick(() => {
11672
- measureAndSetHeight();
11673
- if (document.fonts?.ready) {
11674
- document.fonts.ready.then(measureAndSetHeight);
11675
- }
11676
- });
11677
- });
11678
- onUnmounted(() => {
11679
- if (intervalId) clearInterval(intervalId);
11680
- });
11681
- return () => {
11682
- const p = props;
11683
- const ctx = p.context;
11684
- const rawContent = p.slots.default || "";
11685
- const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
11686
- if (lines.length === 0) return h9("div");
11687
- const elements = lines.map((line) => ctx.parseMarkdown(line));
11688
- const interval = parseInt(p.props.interval || "3000", 10);
11689
- const speed = parseInt(p.props.speed || "500", 10);
11690
- const rawClass = p.props.class || "";
11691
- const inlineStyle = p.props.style ? parseCssString(p.props.style) : {};
11692
- const scopeClass = `sld-${++slideCounter}`;
11693
- if (lines.length > 1 && !intervalId) {
11694
- intervalId = setInterval(() => {
11695
- current.value = (current.value + 1) % elements.length;
11696
- }, interval);
11697
- }
11698
- const textSizeMap = {
11699
- "text-xs": "0.75rem",
11700
- "text-sm": "0.875rem",
11701
- "text-base": "1rem",
11702
- "text-lg": "1.125rem",
11703
- "text-xl": "1.25rem",
11704
- "text-2xl": "1.5rem",
11705
- "text-3xl": "1.875rem",
11706
- "text-4xl": "2.25rem",
11707
- "text-5xl": "3rem",
11708
- "text-6xl": "3.75rem",
11709
- "text-7xl": "4.5rem",
11710
- "text-8xl": "6rem",
11711
- "text-9xl": "8rem"
11712
- };
11713
- const textSizeMatch = rawClass.match(/\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/);
11714
- const forcedFontSize = textSizeMatch ? textSizeMap[textSizeMatch[0]] : null;
11715
- const className = textSizeMatch ? rawClass.replace(textSizeMatch[0], "").replace(/\s+/g, " ").trim() : rawClass;
11716
- return h9("div", {
11717
- class: "not-prose",
11718
- style: { height: maxH.value || "auto", position: "relative", overflow: "hidden", ...inlineStyle }
11719
- }, [
11720
- forcedFontSize && h9("style", `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }`),
11721
- h9("div", {
11722
- style: {
11723
- position: "absolute",
11724
- left: 0,
11725
- right: 0,
11726
- top: 0,
11727
- transition: `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`,
11728
- transform: `translateY(${-current.value * maxH.value}px)`
11729
- }
11730
- }, elements.map(
11731
- (tokens, i) => h9("div", {
11732
- key: i,
11733
- ref: (el) => {
11734
- slideEls[i] = el?.$el || el;
11735
- },
11736
- style: maxH.value ? { height: maxH.value, display: "flex", alignItems: "center", overflow: "hidden" } : { display: "flex", alignItems: "center" }
11737
- }, [
11738
- h9("div", {
11739
- class: `${scopeClass} ${className}`.trim(),
11740
- style: { width: "100%" }
11741
- }, ctx.processAndRenderElements(tokens))
11742
- ])
11743
- ))
11744
- ]);
11745
- };
11573
+ }
11574
+ };
11575
+ requestAnimationFrame(() => {
11576
+ measureAndSetHeight();
11577
+ if (document.fonts?.ready) {
11578
+ document.fonts.ready.then(measureAndSetHeight);
11579
+ }
11580
+ });
11581
+ if (lines.length > 1) {
11582
+ setInterval(() => {
11583
+ current = (current + 1) % lines.length;
11584
+ track.style.transform = `translateY(${-current * maxH}px)`;
11585
+ }, interval);
11746
11586
  }
11747
- });
11748
- var SlideDirective_default = SlideDirective;
11587
+ return container;
11588
+ };
11589
+ var slide_default = slideDirective;
11749
11590
 
11750
- // vue/directives/index.ts
11591
+ // vanilla/directives/index.ts
11751
11592
  var directiveRegistry = {
11752
11593
  // Admonitions
11753
- note: AdmonitionDirective_default,
11754
- info: AdmonitionDirective_default,
11755
- warning: AdmonitionDirective_default,
11756
- danger: AdmonitionDirective_default,
11757
- greentext: AdmonitionDirective_default,
11594
+ note: admonition_default,
11595
+ info: admonition_default,
11596
+ warning: admonition_default,
11597
+ danger: admonition_default,
11598
+ greentext: admonition_default,
11758
11599
  // Cards
11759
- card: CardDirective_default,
11760
- "card-m": CardDirective_default,
11761
- "card-b": CardDirective_default,
11600
+ card: card_default,
11601
+ "card-m": card_default,
11602
+ "card-b": card_default,
11762
11603
  // Interactive
11763
- details: DetailsDirective_default,
11764
- modal: ModalDirective_default,
11765
- button: ButtonDirective_default,
11604
+ details: details_default,
11605
+ modal: modal_default,
11606
+ button: button_default,
11766
11607
  // Layout / generic wrappers
11767
- div: WrapperDirective_default,
11768
- style: WrapperDirective_default,
11769
- custom: WrapperDirective_default,
11770
- raw: WrapperDirective_default,
11608
+ div: wrapper_default,
11609
+ style: wrapper_default,
11610
+ custom: wrapper_default,
11611
+ raw: wrapper_default,
11771
11612
  // Animation
11772
- slide: SlideDirective_default
11613
+ slide: slide_default
11773
11614
  };
11774
11615
  var directives_default = directiveRegistry;
11775
11616
 
11776
- // vue/DirectiveRenderer.ts
11777
- var DirectiveRenderer = defineComponent9({
11778
- name: "DirectiveRenderer",
11779
- props: {
11780
- element: { type: Object, required: true },
11781
- context: { type: Object, required: true },
11782
- index: { type: Number, required: true },
11783
- allElements: { type: Array, required: true }
11784
- },
11785
- setup(props) {
11786
- return () => {
11787
- const { element, context, index, allElements } = props;
11788
- const { directiveType, props: directiveProps, slots, scopeId } = element;
11789
- const Component = directives_default[directiveType];
11790
- const renderSlot = (name) => {
11791
- const slotContent = slots[name];
11792
- if (!slotContent) return [];
11793
- const parsed = context.parseMarkdown(slotContent);
11794
- return context.processAndRenderElements(parsed);
11795
- };
11796
- const componentProps = {
11797
- directiveType,
11798
- props: directiveProps,
11799
- slots,
11800
- renderSlot,
11801
- context,
11802
- index,
11803
- allElements
11804
- };
11805
- if (Component) {
11806
- return h10(Component, componentProps);
11617
+ // vanilla/renderer.ts
11618
+ function renderTokens(tokens) {
11619
+ const article = document.createElement("article");
11620
+ article.className = "nr-prose";
11621
+ const ctx = {
11622
+ parseMarkdown,
11623
+ renderElements: (tks) => renderTokensInner(tks, ctx),
11624
+ renderInline,
11625
+ renderMarkdown: (md) => renderTokensInner(parseMarkdown(md), ctx)
11626
+ };
11627
+ article.appendChild(processElements(tokens, ctx, tokens));
11628
+ return article;
11629
+ }
11630
+ function renderMarkdownString(markdown2) {
11631
+ const tokens = parseMarkdown(markdown2);
11632
+ return renderTokens(tokens);
11633
+ }
11634
+ function renderHtmlString(html) {
11635
+ let processedContent = html;
11636
+ processedContent = processedContent.replace(
11637
+ /<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
11638
+ (_match, cssContent) => {
11639
+ const styleEl = document.createElement("style");
11640
+ styleEl.setAttribute("data-nr-global", "");
11641
+ styleEl.textContent = cssContent;
11642
+ document.head.appendChild(styleEl);
11643
+ return "";
11644
+ }
11645
+ );
11646
+ const wrapper = document.createElement("div");
11647
+ wrapper.className = "nr-raw-html";
11648
+ wrapper.innerHTML = processedContent;
11649
+ const scripts = wrapper.querySelectorAll("script");
11650
+ scripts.forEach((oldScript) => {
11651
+ const newScript = document.createElement("script");
11652
+ Array.from(oldScript.attributes).forEach(
11653
+ (attr) => newScript.setAttribute(attr.name, attr.value)
11654
+ );
11655
+ newScript.textContent = oldScript.textContent;
11656
+ oldScript.parentNode?.replaceChild(newScript, oldScript);
11657
+ });
11658
+ return wrapper;
11659
+ }
11660
+ function renderTokensInner(tokens, ctx) {
11661
+ const container = document.createElement("div");
11662
+ container.appendChild(processElements(tokens, ctx, tokens));
11663
+ return container;
11664
+ }
11665
+ function processElements(elements, ctx, allElements) {
11666
+ const fragment = document.createDocumentFragment();
11667
+ let i = 0;
11668
+ while (i < elements.length) {
11669
+ const el = elements[i];
11670
+ if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
11671
+ const cards = [];
11672
+ while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
11673
+ cards.push(elements[i]);
11674
+ i++;
11807
11675
  }
11808
- return h10("div", {
11809
- key: index,
11810
- class: "my-4 p-4 rounded-2xl border border-border bg-background-primary/5"
11811
- }, renderSlot("default"));
11812
- };
11676
+ if (cards.length === 1 || cards[0].props?.batch === "off") {
11677
+ for (const card of cards) {
11678
+ const rendered = renderElement(card, ctx, allElements);
11679
+ if (rendered) fragment.appendChild(rendered);
11680
+ }
11681
+ } else {
11682
+ const grid = document.createElement("div");
11683
+ grid.className = "nr-card-grid";
11684
+ for (const card of cards) {
11685
+ const rendered = renderElement(card, ctx, allElements);
11686
+ if (rendered) grid.appendChild(rendered);
11687
+ }
11688
+ fragment.appendChild(grid);
11689
+ }
11690
+ } else {
11691
+ const rendered = renderElement(el, ctx, allElements);
11692
+ if (rendered) fragment.appendChild(rendered);
11693
+ i++;
11694
+ }
11813
11695
  }
11814
- });
11815
- var DirectiveRenderer_default = DirectiveRenderer;
11816
-
11817
- // vue/RawHtmlRenderer.ts
11818
- import { defineComponent as defineComponent10, h as h11, ref as ref4, onMounted as onMounted3 } from "vue";
11696
+ return fragment;
11697
+ }
11698
+ function renderElement(element, ctx, allElements) {
11699
+ switch (element.type) {
11700
+ case "header": {
11701
+ const tag = `h${element.level}`;
11702
+ let text = element.text;
11703
+ const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
11704
+ const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
11705
+ if (alignCenter) text = alignCenter[1];
11706
+ else if (alignRight) text = alignRight[1];
11707
+ const h4 = document.createElement(tag);
11708
+ h4.id = element.id;
11709
+ let cls = `md-h${element.level}`;
11710
+ if (alignCenter) cls += " text-center";
11711
+ if (alignRight) cls += " text-right";
11712
+ if (element.classes) cls += ` ${element.classes}`;
11713
+ h4.className = cls;
11714
+ h4.appendChild(renderInline(text));
11715
+ return h4;
11716
+ }
11717
+ case "paragraph": {
11718
+ const p = document.createElement("p");
11719
+ let cls = "md-p";
11720
+ if (element.classes) cls += ` ${element.classes}`;
11721
+ if (element.align) cls += ` text-${element.align}`;
11722
+ p.className = cls;
11723
+ if (element.id) p.id = element.id;
11724
+ const lines = element.content.split("\n");
11725
+ for (let li = 0; li < lines.length; li++) {
11726
+ const line = lines[li];
11727
+ const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
11728
+ if (hardBreakMatch) {
11729
+ p.appendChild(renderInline(hardBreakMatch[1]));
11730
+ p.appendChild(document.createElement("br"));
11731
+ } else {
11732
+ p.appendChild(renderInline(line));
11733
+ if (li < lines.length - 1) {
11734
+ p.appendChild(document.createTextNode(" "));
11735
+ }
11736
+ }
11737
+ }
11738
+ return p;
11739
+ }
11740
+ case "codeblock":
11741
+ return createCodeBlock(element.content, element.language, element.title);
11742
+ case "directive":
11743
+ return renderDirective(element, ctx, allElements);
11744
+ case "html": {
11745
+ const el = element;
11746
+ return renderHtmlString(el.content);
11747
+ }
11748
+ case "html-block": {
11749
+ const htmlBlock = element;
11750
+ const rawProps = parseHtmlAttrs(htmlBlock.attrs);
11751
+ const el = document.createElement(htmlBlock.tag);
11752
+ for (const [key, value] of Object.entries(rawProps)) {
11753
+ if (key === "style" && typeof value === "object") {
11754
+ for (const [prop, val] of Object.entries(value)) {
11755
+ el.style.setProperty(prop, String(val));
11756
+ }
11757
+ } else if (value === true) {
11758
+ el.setAttribute(key, "");
11759
+ } else {
11760
+ el.setAttribute(key, String(value));
11761
+ }
11762
+ }
11763
+ const childFrag = processElements(htmlBlock.children, ctx, allElements);
11764
+ el.appendChild(childFrag);
11765
+ return el;
11766
+ }
11767
+ case "image": {
11768
+ const img = document.createElement("img");
11769
+ img.src = element.src;
11770
+ img.alt = element.alt;
11771
+ img.className = "nr-image";
11772
+ if (element.style) {
11773
+ for (const [key, value] of Object.entries(element.style)) {
11774
+ img.style.setProperty(key, String(value));
11775
+ }
11776
+ }
11777
+ return img;
11778
+ }
11779
+ case "table":
11780
+ return createTable(element.content, renderInline);
11781
+ case "list":
11782
+ return createList(element.content, renderInline);
11783
+ case "blockquote":
11784
+ return createBlockquote(element.content, element.classes, renderInline);
11785
+ case "hr": {
11786
+ const hr = document.createElement("hr");
11787
+ hr.className = "nr-hr";
11788
+ return hr;
11789
+ }
11790
+ case "toc": {
11791
+ const headers = allElements.filter((e) => e.type === "header");
11792
+ return createTOC(headers.map((h4) => ({ level: h4.level, text: h4.text, id: h4.id })), renderInline);
11793
+ }
11794
+ default:
11795
+ return null;
11796
+ }
11797
+ }
11798
+ function renderDirective(element, ctx, allElements) {
11799
+ const { directiveType, props, slots, scopeId } = element;
11800
+ const renderer = directives_default[directiveType];
11801
+ const renderSlot = (name) => {
11802
+ const frag = document.createDocumentFragment();
11803
+ const slotContent = slots[name];
11804
+ if (!slotContent) return frag;
11805
+ const tokens = ctx.parseMarkdown(slotContent);
11806
+ frag.appendChild(ctx.renderElements(tokens));
11807
+ return frag;
11808
+ };
11809
+ const directiveProps = {
11810
+ directiveType,
11811
+ props,
11812
+ slots,
11813
+ renderSlot,
11814
+ context: ctx,
11815
+ index: 0,
11816
+ allElements,
11817
+ renderInline,
11818
+ renderMarkdown: ctx.renderMarkdown
11819
+ };
11820
+ if (renderer) {
11821
+ return renderer(directiveProps);
11822
+ }
11823
+ const fallback = document.createElement("div");
11824
+ fallback.className = "nr-unknown-directive";
11825
+ fallback.appendChild(renderSlot("default"));
11826
+ return fallback;
11827
+ }
11819
11828
 
11820
11829
  // vue/useTailwindCDN.ts
11821
- import { onMounted as onMounted2, onUnmounted as onUnmounted2, watch } from "vue";
11830
+ import { onMounted, onUnmounted, watch } from "vue";
11822
11831
  var CDN_URL = "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4";
11823
11832
  var SCRIPT_ID = "tailwind-cdn-v4-runtime";
11824
11833
  var CONFIG_ID = "tailwind-cdn-v4-config";
@@ -11858,10 +11867,10 @@ function useLazyTailwindCDN(enabled) {
11858
11867
  }
11859
11868
  };
11860
11869
  if (typeof enabled === "boolean") {
11861
- onMounted2(() => {
11870
+ onMounted(() => {
11862
11871
  if (enabled) injectCDN();
11863
11872
  });
11864
- onUnmounted2(() => {
11873
+ onUnmounted(() => {
11865
11874
  if (enabled) removeCDN();
11866
11875
  });
11867
11876
  } else {
@@ -11869,7 +11878,7 @@ function useLazyTailwindCDN(enabled) {
11869
11878
  if (newVal && !oldVal) injectCDN();
11870
11879
  if (!newVal && oldVal) removeCDN();
11871
11880
  }, { immediate: true });
11872
- onUnmounted2(() => {
11881
+ onUnmounted(() => {
11873
11882
  if (enabled.value) removeCDN();
11874
11883
  });
11875
11884
  }
@@ -11882,7 +11891,7 @@ function scanTailwindCDN() {
11882
11891
  function preloadTailwindCDN() {
11883
11892
  if (typeof window === "undefined" || typeof document === "undefined") return;
11884
11893
  if (document.getElementById(SCRIPT_ID)) return;
11885
- const inject2 = () => {
11894
+ const inject = () => {
11886
11895
  if (document.getElementById(SCRIPT_ID)) return;
11887
11896
  if (!document.getElementById(CONFIG_ID)) {
11888
11897
  const configScript = document.createElement("script");
@@ -11897,267 +11906,76 @@ function preloadTailwindCDN() {
11897
11906
  window.__twCDNRefs = (window.__twCDNRefs ?? 0) + 1;
11898
11907
  };
11899
11908
  if ("requestIdleCallback" in window) {
11900
- window.requestIdleCallback(inject2, { timeout: 2e3 });
11909
+ window.requestIdleCallback(inject, { timeout: 2e3 });
11901
11910
  } else {
11902
- setTimeout(inject2, 200);
11911
+ setTimeout(inject, 200);
11903
11912
  }
11904
11913
  }
11905
11914
 
11906
- // vue/RawHtmlRenderer.ts
11907
- var RawHtmlRenderer = defineComponent10({
11908
- name: "RawHtmlRenderer",
11909
- props: {
11910
- content: { type: String, required: true },
11911
- globalStyles: { type: String, default: void 0 },
11912
- wrapperClassName: { type: String, required: true }
11913
- },
11914
- setup(props) {
11915
- const containerRef = ref4(null);
11916
- onMounted3(() => {
11917
- if (!containerRef.value) return;
11918
- const scripts = containerRef.value.querySelectorAll("script");
11919
- scripts.forEach((oldScript) => {
11920
- const newScript = document.createElement("script");
11921
- Array.from(oldScript.attributes).forEach(
11922
- (attr) => newScript.setAttribute(attr.name, attr.value)
11923
- );
11924
- newScript.textContent = oldScript.textContent;
11925
- oldScript.parentNode?.replaceChild(newScript, oldScript);
11926
- });
11927
- scanTailwindCDN();
11928
- });
11929
- return () => {
11930
- const children = [
11931
- h11("div", { innerHTML: props.content })
11932
- ];
11933
- return h11("div", { ref: containerRef, class: props.wrapperClassName }, children);
11934
- };
11935
- }
11936
- });
11937
- var RawHtmlRenderer_default = RawHtmlRenderer;
11938
-
11939
11915
  // vue/CustomMarkdownRenderer.ts
11940
- var CustomMarkdownRenderer = defineComponent11({
11916
+ var CustomMarkdownRenderer = defineComponent({
11941
11917
  name: "CustomMarkdownRenderer",
11942
11918
  props: {
11943
11919
  content: { type: String, required: true }
11944
11920
  },
11945
11921
  setup(props) {
11946
- const modals = ref5({});
11947
- const baseId = Math.random().toString(36).slice(2, 9);
11948
- const articleClass = `scope-${baseId}`;
11949
- resetScopeCounter();
11950
- const allElements = computed(() => parseMarkdown(props.content));
11951
- const handleHashChange = () => {
11952
- const hash = window.location.hash;
11953
- if (hash) {
11954
- const parts = hash.split("#");
11955
- const id = parts[parts.length - 1];
11956
- scrollToId(id);
11957
- }
11922
+ const container = ref(null);
11923
+ const render = () => {
11924
+ const el = container.value;
11925
+ if (!el) return;
11926
+ el.replaceChildren();
11927
+ el.appendChild(renderMarkdownString(props.content));
11928
+ scanTailwindCDN();
11958
11929
  };
11959
- onMounted4(() => {
11930
+ let cleanupHash = null;
11931
+ onMounted2(() => {
11932
+ render();
11933
+ const handleHashChange = () => {
11934
+ const hash = window.location.hash;
11935
+ if (hash) {
11936
+ const parts = hash.split("#");
11937
+ scrollToId(parts[parts.length - 1]);
11938
+ }
11939
+ };
11960
11940
  handleHashChange();
11961
11941
  window.addEventListener("hashchange", handleHashChange);
11942
+ cleanupHash = () => window.removeEventListener("hashchange", handleHashChange);
11962
11943
  });
11963
- onUnmounted3(() => {
11964
- window.removeEventListener("hashchange", handleHashChange);
11944
+ watch2(() => props.content, render);
11945
+ onUnmounted2(() => {
11946
+ cleanupHash?.();
11965
11947
  });
11966
- const generateToc = (elements) => {
11967
- const headers = extractHeaders(elements);
11968
- if (headers.length === 0) return null;
11969
- return h12("nav", { class: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5" }, [
11970
- h12("div", { class: "text-base font-bold mb-3" }, "Table of Contents"),
11971
- h12("ul", { class: "space-y-1 list-none p-0 m-0" }, headers.map((h_token, i) => {
11972
- if (h_token.type !== "header") return null;
11973
- const indentClass = h_token.level <= 2 ? "pl-0" : h_token.level === 3 ? "pl-4" : h_token.level === 4 ? "pl-8" : "pl-12";
11974
- return h12("li", { key: i, class: `${indentClass} text-sm sm:text-base` }, [
11975
- h12("a", {
11976
- href: `#${h_token.id}`,
11977
- class: "text-accent-primary hover:text-accent-primary/80 no-underline hover:underline transition-colors",
11978
- onClick: (e) => {
11979
- e.preventDefault();
11980
- scrollToId(h_token.id);
11981
- }
11982
- }, renderInline(h_token.text.replace(/->|<-/g, "").trim()))
11983
- ]);
11984
- }))
11985
- ]);
11986
- };
11987
- const renderElement = (element, index, _depth = 0) => {
11988
- switch (element.type) {
11989
- case "header": {
11990
- const tag = `h${element.level}`;
11991
- let text = element.text;
11992
- const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
11993
- const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
11994
- if (alignCenter) text = alignCenter[1];
11995
- else if (alignRight) text = alignRight[1];
11996
- const userClasses = element.classes || "";
11997
- let headerClasses = `md-h${element.level}`;
11998
- if (alignCenter) headerClasses += " text-center";
11999
- if (alignRight) headerClasses += " text-right";
12000
- if (userClasses) headerClasses += ` ${userClasses}`;
12001
- return h12(tag, { key: index, id: element.id, class: headerClasses }, renderInline(text));
12002
- }
12003
- case "paragraph": {
12004
- const lines = element.content.split("\n");
12005
- const processedContent = lines.map((line, lineIndex) => {
12006
- const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
12007
- if (hardBreakMatch) {
12008
- return h12("span", { key: lineIndex }, [
12009
- renderInline(hardBreakMatch[1]),
12010
- h12("br")
12011
- ]);
12012
- }
12013
- const isLastLine = lineIndex === lines.length - 1;
12014
- return h12("span", { key: lineIndex }, [
12015
- renderInline(line),
12016
- !isLastLine && " "
12017
- ]);
12018
- });
12019
- const pUserClasses = element.classes || "";
12020
- let pClasses = "md-p";
12021
- if (pUserClasses) pClasses += ` ${pUserClasses}`;
12022
- if (element.align) pClasses += ` text-${element.align}`;
12023
- return h12("p", { key: index, id: element.id, class: pClasses }, processedContent);
12024
- }
12025
- case "codeblock":
12026
- return h12(CodeBlock, {
12027
- key: index,
12028
- code: element.content,
12029
- language: element.language,
12030
- title: element.title
12031
- });
12032
- case "directive":
12033
- return h12(DirectiveRenderer_default, {
12034
- key: index,
12035
- element,
12036
- context: contextForDirectives,
12037
- index,
12038
- allElements: allElements.value
12039
- });
12040
- case "html": {
12041
- let processedContent = element.content;
12042
- let globalStyles = "";
12043
- processedContent = processedContent.replace(
12044
- /<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
12045
- (_match, cssContent) => {
12046
- globalStyles += cssContent + "\n";
12047
- return "";
12048
- }
12049
- );
12050
- return h12(RawHtmlRenderer_default, {
12051
- key: index,
12052
- content: processedContent,
12053
- globalStyles: globalStyles || void 0,
12054
- wrapperClassName: "w-full my-4"
12055
- });
12056
- }
12057
- case "html-block": {
12058
- const htmlBlock = element;
12059
- const rawProps = parseHtmlAttrs(htmlBlock.attrs);
12060
- const props2 = {};
12061
- for (const [key, value] of Object.entries(rawProps)) {
12062
- if (key === "class") props2["class"] = value;
12063
- else props2[key] = value;
12064
- }
12065
- return h12(
12066
- htmlBlock.tag,
12067
- { key: index, ...props2 },
12068
- processAndRenderElements(htmlBlock.children, _depth + 1)
12069
- );
12070
- }
12071
- case "image":
12072
- return h12("img", {
12073
- key: index,
12074
- alt: element.alt,
12075
- src: element.src,
12076
- style: element.style,
12077
- class: "max-w-full h-auto"
12078
- });
12079
- case "table":
12080
- return h12("div", { key: index }, renderTable(element.content));
12081
- case "list":
12082
- return h12("div", { key: index }, renderList(element.content));
12083
- case "blockquote":
12084
- return h12("blockquote", {
12085
- key: index,
12086
- class: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`
12087
- }, renderInline(element.content));
12088
- case "hr":
12089
- return h12("hr", { key: index, class: "my-8 border-border" });
12090
- case "toc": {
12091
- const toc = generateToc(allElements.value);
12092
- return toc ? h12("div", { key: index }, toc) : null;
12093
- }
12094
- default:
12095
- return null;
12096
- }
12097
- };
12098
- const processAndRenderElements = (elements, depth = 0) => {
12099
- const result = [];
12100
- let i = 0;
12101
- while (i < elements.length) {
12102
- const el = elements[i];
12103
- if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
12104
- const cards = [];
12105
- while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
12106
- cards.push(elements[i]);
12107
- i++;
12108
- }
12109
- if (cards.length === 1 || cards[0].props?.batch === "off") {
12110
- for (let c = 0; c < cards.length; c++) {
12111
- result.push(renderElement(cards[c], result.length, depth));
12112
- }
12113
- } else {
12114
- const firstCardClass = cards[0].props?.["class"] || "";
12115
- const justifyClasses = firstCardClass.match(/\bjustify-\S+/g) || [];
12116
- const wrapperJustify = justifyClasses.length > 0 ? justifyClasses.join(" ") : "";
12117
- result.push(h12("div", {
12118
- key: `card-grid-${result.length}`,
12119
- class: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`
12120
- }, cards.map((card, ci) => {
12121
- const rendered = renderElement(card, ci, depth);
12122
- return rendered ? h12("span", { key: ci }, rendered) : null;
12123
- })));
12124
- }
12125
- } else {
12126
- result.push(renderElement(el, result.length, depth));
12127
- i++;
12128
- }
12129
- }
12130
- return result;
12131
- };
12132
- const setModals = (value) => {
12133
- if (typeof value === "function") {
12134
- modals.value = value(modals.value);
12135
- } else {
12136
- modals.value = value;
12137
- }
12138
- };
12139
- const contextForDirectives = {
12140
- modals,
12141
- setModals,
12142
- articleClass,
12143
- allElements: allElements.value,
12144
- parseMarkdown,
12145
- renderElement,
12146
- renderInline,
12147
- processAndRenderElements
12148
- };
12149
- provide(RenderContextKey, contextForDirectives);
12150
- return () => h12(
12151
- "div",
12152
- { class: articleClass },
12153
- processAndRenderElements(allElements.value)
12154
- );
11948
+ return () => h("div", { ref: container });
12155
11949
  }
12156
11950
  });
12157
11951
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
12158
11952
 
11953
+ // vue/RawHtmlRenderer.ts
11954
+ import { defineComponent as defineComponent2, h as h2, onMounted as onMounted3, ref as ref2, watch as watch3 } from "vue";
11955
+ var RawHtmlRenderer = defineComponent2({
11956
+ name: "RawHtmlRenderer",
11957
+ props: {
11958
+ content: { type: String, required: true },
11959
+ wrapperClassName: { type: String, default: "nr-raw-html" }
11960
+ },
11961
+ setup(props) {
11962
+ const container = ref2(null);
11963
+ const render = () => {
11964
+ const el = container.value;
11965
+ if (!el) return;
11966
+ el.replaceChildren();
11967
+ el.appendChild(renderHtmlString(props.content));
11968
+ scanTailwindCDN();
11969
+ };
11970
+ onMounted3(render);
11971
+ watch3(() => props.content, render);
11972
+ return () => h2("div", { ref: container, class: props.wrapperClassName });
11973
+ }
11974
+ });
11975
+ var RawHtmlRenderer_default = RawHtmlRenderer;
11976
+
12159
11977
  // vue/NRpreviewer.ts
12160
- var NRpreviewer = defineComponent12({
11978
+ var NRpreviewer = defineComponent3({
12161
11979
  name: "NRpreviewer",
12162
11980
  props: {
12163
11981
  content: { type: String, default: void 0 },
@@ -12167,23 +11985,20 @@ var NRpreviewer = defineComponent12({
12167
11985
  style: { type: Object, default: void 0 }
12168
11986
  },
12169
11987
  setup(props) {
12170
- const tailwindEnabled = ref6(props.tailwindCDN);
11988
+ const tailwindEnabled = ref3(props.tailwindCDN);
12171
11989
  if (typeof window !== "undefined") {
12172
11990
  useLazyTailwindCDN(tailwindEnabled);
12173
11991
  }
12174
11992
  return () => {
12175
11993
  const wrapperClass = `nr-prose${props.className ? ` ${props.className}` : ""}`;
12176
11994
  if (props.content) {
12177
- return h13("div", { class: wrapperClass, style: props.style }, [
12178
- h13(CustomMarkdownRenderer_default, { content: props.content })
11995
+ return h3("div", { class: wrapperClass, style: props.style }, [
11996
+ h3(CustomMarkdownRenderer_default, { content: props.content })
12179
11997
  ]);
12180
11998
  }
12181
11999
  if (props.html) {
12182
- return h13("div", { class: wrapperClass, style: props.style }, [
12183
- h13(RawHtmlRenderer_default, {
12184
- content: props.html,
12185
- wrapperClassName: "nr-preview-html"
12186
- })
12000
+ return h3("div", { class: wrapperClass, style: props.style }, [
12001
+ h3(RawHtmlRenderer_default, { content: props.html })
12187
12002
  ]);
12188
12003
  }
12189
12004
  return null;
@@ -12192,14 +12007,9 @@ var NRpreviewer = defineComponent12({
12192
12007
  });
12193
12008
  var NRpreviewer_default = NRpreviewer;
12194
12009
  export {
12195
- Admonition,
12196
- CodeBlock,
12197
12010
  CustomMarkdownRenderer_default as CustomMarkdownRenderer,
12198
- Details,
12199
- IconRenderer,
12200
- Modal,
12201
12011
  NRpreviewer_default as NRpreviewer,
12202
- extractHeaders,
12012
+ RawHtmlRenderer_default as RawHtmlRenderer,
12203
12013
  parseMarkdown,
12204
12014
  preloadTailwindCDN,
12205
12015
  scanTailwindCDN,