@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/NReditor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // react/NReditor.tsx
2
- import React9, { useRef as useRef6, useState as useState5 } from "react";
2
+ import React2, { useRef as useRef3, useState as useState2 } from "react";
3
3
  import CodeMirror from "@uiw/react-codemirror";
4
- import { EditorView, Decoration, ViewPlugin, lineNumbers, scrollPastEnd, keymap } from "@codemirror/view";
4
+ import { EditorView, Decoration, ViewPlugin, lineNumbers, keymap } from "@codemirror/view";
5
5
 
6
6
  // react/custom-syntax.ts
7
7
  import { StreamLanguage } from "@codemirror/language";
@@ -370,7 +370,7 @@ function scanTailwindCDN() {
370
370
  }
371
371
 
372
372
  // react/CustomMarkdownRenderer.tsx
373
- import React8, { useState as useState4, useEffect as useEffect5, useCallback as useCallback2, useMemo, useId as useId3, useRef as useRef5 } from "react";
373
+ import { useEffect as useEffect3, useRef as useRef2 } from "react";
374
374
 
375
375
  // core/utils.ts
376
376
  function parseCssString(cssText) {
@@ -416,9 +416,6 @@ function extractAttributes(text) {
416
416
  return { text: cleanedText, classes: classList.join(" "), id };
417
417
  }
418
418
  var _scopeCounter = 0;
419
- function resetScopeCounter() {
420
- _scopeCounter = 0;
421
- }
422
419
  function generateScopeId() {
423
420
  return `scope-${++_scopeCounter}`;
424
421
  }
@@ -466,6 +463,7 @@ function parseMarkdown(markdown2) {
466
463
  if (!markdown2) return [];
467
464
  const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
468
465
  const result = [];
466
+ const usedIds = /* @__PURE__ */ new Set();
469
467
  let i = 0;
470
468
  while (i < lines.length) {
471
469
  const line = lines[i];
@@ -475,7 +473,14 @@ function parseMarkdown(markdown2) {
475
473
  const level = match[1].length;
476
474
  const rawText = match[2];
477
475
  const { text: text2, classes: classes2, id: customId } = extractAttributes(rawText);
478
- const id2 = customId || generateId(text2.replace(/->|<-/g, ""));
476
+ const baseId = customId || generateId(text2.replace(/->|<-/g, ""));
477
+ let id2 = baseId;
478
+ let n = 1;
479
+ while (usedIds.has(id2)) {
480
+ n++;
481
+ id2 = `${baseId}-${n}`;
482
+ }
483
+ usedIds.add(id2);
479
484
  result.push({ type: "header", level, text: text2, id: id2, classes: classes2 || void 0 });
480
485
  i++;
481
486
  continue;
@@ -790,10 +795,7 @@ function splitSlots(rawContent) {
790
795
  return slots;
791
796
  }
792
797
 
793
- // react/ui-components.tsx
794
- import { useState as useState2, useRef as useRef2 } from "react";
795
-
796
- // react/highlightSetup.ts
798
+ // vanilla/highlightSetup.ts
797
799
  import hljs from "highlight.js/lib/core";
798
800
  import javascript from "highlight.js/lib/languages/javascript";
799
801
  import typescript from "highlight.js/lib/languages/typescript";
@@ -842,991 +844,947 @@ hljs.registerLanguage("java", java);
842
844
  hljs.registerLanguage("csharp", csharp);
843
845
  hljs.registerLanguage("cs", csharp);
844
846
  hljs.registerLanguage("cpp", cpp);
845
- hljs.registerLanguage("c", cpp);
846
847
  hljs.registerLanguage("go", go);
847
848
  hljs.registerLanguage("rust", rust);
848
- hljs.registerLanguage("rs", rust);
849
849
  hljs.registerLanguage("php", php);
850
850
  hljs.registerLanguage("ruby", ruby);
851
- hljs.registerLanguage("rb", ruby);
852
851
  hljs.registerLanguage("swift", swift);
853
852
  hljs.registerLanguage("kotlin", kotlin);
854
- hljs.registerLanguage("kt", kotlin);
855
853
  hljs.registerLanguage("dart", dart);
856
854
  hljs.registerLanguage("yaml", yaml);
857
- hljs.registerLanguage("yml", yaml);
858
855
  hljs.registerLanguage("toml", toml);
859
- hljs.registerLanguage("ini", toml);
860
856
  hljs.registerLanguage("dockerfile", dockerfile);
861
- hljs.registerLanguage("docker", dockerfile);
862
857
  hljs.registerLanguage("diff", diff);
863
858
  hljs.registerLanguage("shell", shell);
864
859
  var highlightSetup_default = hljs;
865
860
 
866
- // react/ui-components.tsx
867
- import { Dialog } from "@base-ui/react/dialog";
868
- import { jsx, jsxs } from "react/jsx-runtime";
869
- var IconRenderer = ({ iconName, extraClasses = "" }) => {
870
- if (!iconName) return null;
871
- const baseClass = `material-symbols-rounded !text-[1em] leading-none align-top ${extraClasses}`;
861
+ // vanilla/components.ts
862
+ function createIcon(iconName, extraClasses) {
863
+ const span = document.createElement("span");
864
+ const cls = `nr-icon material-icons-round${extraClasses ? ` ${extraClasses}` : ""}`;
865
+ span.className = cls;
866
+ span.setAttribute("aria-hidden", "true");
872
867
  const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
873
868
  if (isCodepoint) {
874
- return /* @__PURE__ */ jsx(
875
- "span",
876
- {
877
- className: baseClass,
878
- dangerouslySetInnerHTML: { __html: `&#x${iconName};` },
879
- "aria-hidden": "true"
880
- }
881
- );
869
+ span.innerHTML = `&#x${iconName};`;
870
+ } else {
871
+ span.textContent = iconName;
882
872
  }
883
- return /* @__PURE__ */ jsx("span", { className: baseClass, "aria-hidden": "true", children: iconName });
884
- };
885
- var CodeBlock = ({ code, language, title }) => {
886
- const [copied, setCopied] = useState2(false);
887
- const timerRef = useRef2(null);
873
+ return span;
874
+ }
875
+ function createCodeBlock(code, language, title) {
876
+ const wrapper = document.createElement("div");
877
+ wrapper.className = "nr-codeblock";
888
878
  const lang = language?.split(/[\s{]/)[0]?.trim() || "";
889
- let html;
879
+ if (title) {
880
+ const header = document.createElement("div");
881
+ header.className = "nr-codeblock__header";
882
+ header.appendChild(createIcon("description"));
883
+ const titleSpan = document.createElement("span");
884
+ titleSpan.textContent = title;
885
+ header.appendChild(titleSpan);
886
+ wrapper.appendChild(header);
887
+ }
888
+ const pre = document.createElement("pre");
889
+ pre.className = "nr-codeblock__pre";
890
+ const codeEl = document.createElement("code");
891
+ codeEl.className = `language-${lang || "plaintext"}`;
890
892
  try {
891
893
  if (lang && highlightSetup_default.getLanguage(lang)) {
892
- html = highlightSetup_default.highlight(code, { language: lang }).value;
894
+ codeEl.innerHTML = highlightSetup_default.highlight(code, { language: lang }).value;
893
895
  } else {
894
- html = highlightSetup_default.highlightAuto(code).value;
896
+ codeEl.innerHTML = highlightSetup_default.highlightAuto(code).value;
895
897
  }
896
898
  } catch {
897
- html = "";
899
+ codeEl.textContent = code;
898
900
  }
899
- const handleCopy = () => {
901
+ pre.appendChild(codeEl);
902
+ wrapper.appendChild(pre);
903
+ const copyBtn = document.createElement("button");
904
+ copyBtn.className = "nr-codeblock__copy";
905
+ copyBtn.title = "Copy code";
906
+ const copyIcon = createIcon("content_copy");
907
+ copyIcon.style.fontSize = "1rem";
908
+ copyBtn.appendChild(copyIcon);
909
+ let timer = null;
910
+ copyBtn.addEventListener("click", () => {
900
911
  navigator.clipboard.writeText(code);
901
- setCopied(true);
902
- if (timerRef.current) clearTimeout(timerRef.current);
903
- timerRef.current = setTimeout(() => setCopied(false), 1800);
904
- };
905
- return /* @__PURE__ */ jsxs("div", { className: "not-prose my-4 rounded-2xl border border-border overflow-hidden bg-background-secondary-solid/5", children: [
906
- title && /* @__PURE__ */ jsxs("div", { className: "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", children: [
907
- /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "description" }),
908
- title
909
- ] }),
910
- /* @__PURE__ */ jsx("div", { className: "overflow-auto [&_pre]:m-0 [&_pre]:p-4 [&_pre]:text-xs sm:[&_pre]:text-sm", children: /* @__PURE__ */ jsx("pre", { className: "m-0", children: /* @__PURE__ */ jsx("code", { className: `language-${lang || "plaintext"}`, dangerouslySetInnerHTML: { __html: html } }) }) }),
911
- /* @__PURE__ */ jsx("button", { className: "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", onClick: handleCopy, title: "Copy code", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
912
- ] });
913
- };
914
- var defaultIcons = {
912
+ copyIcon.textContent = "check";
913
+ if (timer) clearTimeout(timer);
914
+ timer = setTimeout(() => {
915
+ copyIcon.textContent = "content_copy";
916
+ }, 1800);
917
+ });
918
+ wrapper.appendChild(copyBtn);
919
+ return wrapper;
920
+ }
921
+ var DEFAULT_ADMONITION_ICONS = {
915
922
  note: "info",
916
923
  info: "lightbulb",
917
924
  warning: "warning",
918
925
  danger: "report",
919
- greentext: "subdirectory_play_arrow"
920
- };
921
- var typeClasses = {
922
- note: "border-info/20 bg-info/5 text-info",
923
- info: "border-info/30 bg-info/10 text-info",
924
- warning: "border-amber-500/30 bg-amber-500/10 text-amber-500",
925
- danger: "border-danger/30 bg-danger/10 text-danger",
926
- greentext: "border-success/30 bg-success/10 text-success"
927
- };
928
- var Admonition = ({ type, title, icon, className = "", style, children }) => {
929
- const iconToRender = icon || defaultIcons[type] || "info";
930
- return /* @__PURE__ */ jsxs(
931
- "div",
932
- {
933
- className: `not-prose rounded-2xl mb-6 border shadow-xs p-4 ${typeClasses[type] || typeClasses.note} ${className}`,
934
- style,
935
- children: [
936
- title && /* @__PURE__ */ jsxs("h5", { className: "font-bold text-base mb-2 m-0 flex items-center gap-2", children: [
937
- /* @__PURE__ */ jsx(IconRenderer, { iconName: iconToRender, extraClasses: "shrink-0" }),
938
- /* @__PURE__ */ jsx("span", { children: title })
939
- ] }),
940
- /* @__PURE__ */ jsx("div", { className: "text-sm leading-relaxed opacity-90", children })
941
- ]
942
- }
943
- );
926
+ greentext: "subdirectory_arrow_right"
944
927
  };
945
- var Details = ({
946
- title,
947
- icon,
948
- defaultOpen = false,
949
- className = "",
950
- style,
951
- children
952
- }) => {
953
- const [isOpen, setIsOpen] = useState2(defaultOpen);
954
- const iconToRender = icon || "play_arrow";
955
- return /* @__PURE__ */ jsxs(
956
- "details",
957
- {
958
- className: `not-prose rounded-2xl border border-border mb-4 bg-background-primary/5 ${className}`,
959
- open: isOpen,
960
- style,
961
- children: [
962
- /* @__PURE__ */ jsxs(
963
- "summary",
964
- {
965
- className: "cursor-pointer p-4 font-bold flex items-center gap-2 list-none [&::-webkit-details-marker]:hidden hover:text-accent-primary transition-colors",
966
- onClick: (e) => {
967
- e.preventDefault();
968
- setIsOpen((prev) => !prev);
969
- },
970
- children: [
971
- /* @__PURE__ */ jsx(
972
- IconRenderer,
973
- {
974
- iconName: iconToRender,
975
- extraClasses: `transition-transform ${isOpen ? "rotate-90" : ""}`
976
- }
977
- ),
978
- /* @__PURE__ */ jsx("span", { children: title })
979
- ]
980
- }
981
- ),
982
- isOpen && /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 border-t border-border pt-3 text-sm leading-relaxed opacity-90 overflow-hidden min-w-0", children })
983
- ]
984
- }
985
- );
986
- };
987
- var Modal = ({ title, isOpen, onClose, children }) => {
988
- return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: (open) => {
989
- if (!open) onClose();
990
- }, children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
991
- /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
992
- /* @__PURE__ */ jsx(Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ jsxs(Dialog.Popup, { className: "bg-background-primary border border-border shadow-2xl rounded-3xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden", children: [
993
- /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
994
- /* @__PURE__ */ jsx(Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
995
- /* @__PURE__ */ jsx(Dialog.Close, { className: "w-8 h-8 rounded-full hover:bg-white/10 flex items-center justify-center transition-colors cursor-pointer border-none bg-transparent", children: /* @__PURE__ */ jsx("span", { className: "material-symbols-rounded text-base", children: "close" }) })
996
- ] }),
997
- /* @__PURE__ */ jsx("div", { className: "p-6 overflow-auto min-h-0 text-text-primary [&_h1:first-child]:mt-0 [&_h2:first-child]:mt-0 [&_h3:first-child]:mt-0 [&_h4:first-child]:mt-0 [&_h5:first-child]:mt-0 [&_h6:first-child]:mt-0", children })
998
- ] }) })
999
- ] }) });
1000
- };
1001
-
1002
- // react/renderers.tsx
1003
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1004
- function renderInline(text) {
1005
- if (!text) return text;
1006
- const parsePart = (part, key) => {
1007
- let match2;
1008
- if (match2 = part.match(/^\|\[([^\]]+)\]\|$/)) {
1009
- return /* @__PURE__ */ jsx2(IconRenderer, { iconName: match2[1] }, key);
1010
- }
1011
- if (match2 = part.match(/^!~(.+?)~!$/)) {
1012
- const content = match2[1];
1013
- const parts = content.split(";");
1014
- let color = "currentColor";
1015
- let decorationStyle = "solid";
1016
- let type = "underline";
1017
- let textIndex = 0;
1018
- if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
1019
- color = parts[textIndex++];
1020
- }
1021
- if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
1022
- decorationStyle = parts[textIndex++];
1023
- }
1024
- if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
1025
- type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
1026
- }
1027
- const innerText = parts.slice(textIndex).join(";");
1028
- return /* @__PURE__ */ jsx2(
1029
- "span",
1030
- {
1031
- style: {
1032
- textDecoration: `${type} ${decorationStyle} ${color}`,
1033
- textDecorationThickness: "auto"
1034
- },
1035
- children: renderInline(innerText)
1036
- },
1037
- key
1038
- );
1039
- }
1040
- if (match2 = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
1041
- return /* @__PURE__ */ jsx2("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
1042
- }
1043
- if (match2 = part.match(/^!>([^<]+?)<!$/)) {
1044
- return /* @__PURE__ */ jsx2("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
1045
- }
1046
- if (match2 = part.match(/^==(.+?)==$/)) {
1047
- return /* @__PURE__ */ jsx2("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
1048
- }
1049
- if (match2 = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
1050
- return /* @__PURE__ */ jsx2("strong", { children: /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }) }, key);
1051
- }
1052
- if (match2 = part.match(/^\*\*(.+?)\*\*$/)) {
1053
- return /* @__PURE__ */ jsx2("strong", { children: renderInline(match2[1]) }, key);
1054
- }
1055
- if (match2 = part.match(/^_(.+?)_$/)) {
1056
- return /* @__PURE__ */ jsx2("em", { children: renderInline(match2[1]) }, key);
1057
- }
1058
- if (match2 = part.match(/^~~(.+?)~~$/)) {
1059
- return /* @__PURE__ */ jsx2("del", { children: renderInline(match2[1]) }, key);
1060
- }
1061
- if (match2 = part.match(/^`([^`]+)`$/)) {
1062
- return /* @__PURE__ */ jsx2("code", { className: "text-[0.875em] font-mono bg-background-secondary/50 px-1.5 py-0.5 rounded text-text-primary", children: match2[1] }, key);
1063
- }
1064
- if (match2 = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
1065
- return /* @__PURE__ */ jsx2(
1066
- "a",
1067
- {
1068
- href: match2[2],
1069
- className: "text-accent-primary underline decoration-accent-primary/40 hover:decoration-accent-primary transition-colors",
1070
- target: "_blank",
1071
- rel: "noopener noreferrer",
1072
- children: renderInline(match2[1])
1073
- },
1074
- key
1075
- );
1076
- }
1077
- if (part.startsWith("<") && part.endsWith(">")) {
1078
- return /* @__PURE__ */ jsx2("span", { dangerouslySetInnerHTML: { __html: part } }, key);
1079
- }
1080
- return part;
1081
- };
1082
- const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
1083
- const elements = [];
1084
- let lastIndex = 0;
1085
- let match;
1086
- let keyCounter = 0;
1087
- while ((match = regex.exec(text)) !== null) {
1088
- if (match.index > lastIndex) {
1089
- elements.push(text.slice(lastIndex, match.index));
1090
- }
1091
- elements.push(parsePart(match[0], `inline-${keyCounter++}`));
1092
- lastIndex = regex.lastIndex;
1093
- }
1094
- if (lastIndex < text.length) {
1095
- elements.push(text.slice(lastIndex));
928
+ function createAdmonition(type, title, icon) {
929
+ const el = document.createElement("div");
930
+ el.className = `nr-admonition nr-admonition--${type || "note"}`;
931
+ if (title) {
932
+ const header = document.createElement("h5");
933
+ header.className = "nr-admonition__title";
934
+ const iconToRender = icon || DEFAULT_ADMONITION_ICONS[type] || "info";
935
+ header.appendChild(createIcon(iconToRender, "nr-admonition__icon"));
936
+ const titleSpan = document.createElement("span");
937
+ titleSpan.textContent = title;
938
+ header.appendChild(titleSpan);
939
+ el.appendChild(header);
1096
940
  }
1097
- return elements;
941
+ const body = document.createElement("div");
942
+ body.className = "nr-admonition__body";
943
+ el.appendChild(body);
944
+ return el;
945
+ }
946
+ function createDetails(title, icon, defaultOpen) {
947
+ const details = document.createElement("details");
948
+ details.className = "nr-details";
949
+ if (defaultOpen) details.open = true;
950
+ const summary = document.createElement("summary");
951
+ summary.className = "nr-details__summary";
952
+ const iconToRender = icon || "play_arrow";
953
+ const iconEl = createIcon(iconToRender, "nr-details__icon");
954
+ summary.appendChild(iconEl);
955
+ const titleSpan = document.createElement("span");
956
+ titleSpan.textContent = title || "Details";
957
+ summary.appendChild(titleSpan);
958
+ details.addEventListener("toggle", () => {
959
+ iconEl.classList.toggle("nr-details__icon--open", details.open);
960
+ });
961
+ details.appendChild(summary);
962
+ const body = document.createElement("div");
963
+ body.className = "nr-details__body";
964
+ details.appendChild(body);
965
+ return details;
966
+ }
967
+ function createModal(title) {
968
+ const dialog = document.createElement("dialog");
969
+ dialog.className = "nr-modal";
970
+ dialog.addEventListener("click", (e) => {
971
+ if (e.target === dialog) {
972
+ dialog.close();
973
+ }
974
+ });
975
+ const popup = document.createElement("div");
976
+ popup.className = "nr-modal__popup";
977
+ const header = document.createElement("div");
978
+ header.className = "nr-modal__header";
979
+ const titleEl = document.createElement("h2");
980
+ titleEl.className = "nr-modal__title";
981
+ titleEl.textContent = title;
982
+ header.appendChild(titleEl);
983
+ const closeBtn = document.createElement("button");
984
+ closeBtn.className = "nr-modal__close";
985
+ closeBtn.appendChild(createIcon("close"));
986
+ closeBtn.addEventListener("click", () => dialog.close());
987
+ header.appendChild(closeBtn);
988
+ popup.appendChild(header);
989
+ const body = document.createElement("div");
990
+ body.className = "nr-modal__body";
991
+ popup.appendChild(body);
992
+ dialog.appendChild(popup);
993
+ return dialog;
1098
994
  }
1099
- function renderTable(content) {
995
+ function createTable(content, renderInline2) {
1100
996
  const rows = content.split("\n").filter((r) => r.trim());
1101
- if (rows.length < 2) return /* @__PURE__ */ jsx2("p", { children: content });
997
+ if (rows.length < 2) {
998
+ const p = document.createElement("p");
999
+ p.textContent = content;
1000
+ return p;
1001
+ }
1102
1002
  const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
1103
1003
  const headerCells = parseRow(rows[0]);
1104
1004
  const bodyRows = rows.slice(2).map(parseRow);
1105
- return /* @__PURE__ */ jsx2("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs2("table", { className: "w-full text-sm sm:text-base border-collapse my-4", children: [
1106
- /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsx2("tr", { children: headerCells.map((cell, ci) => /* @__PURE__ */ jsx2("th", { className: "border border-border px-3 py-2 bg-background-secondary-solid/10 text-left font-bold", children: renderInline(cell) }, ci)) }) }),
1107
- /* @__PURE__ */ jsx2("tbody", { children: bodyRows.map((cells, ri) => /* @__PURE__ */ jsx2("tr", { children: cells.map((cell, ci) => /* @__PURE__ */ jsx2("td", { className: "border border-border px-3 py-2", children: renderInline(cell) }, ci)) }, ri)) })
1108
- ] }) });
1005
+ const wrapper = document.createElement("div");
1006
+ wrapper.className = "nr-table-wrap";
1007
+ const table = document.createElement("table");
1008
+ table.className = "nr-table";
1009
+ const thead = document.createElement("thead");
1010
+ const tr = document.createElement("tr");
1011
+ for (const cell of headerCells) {
1012
+ const th = document.createElement("th");
1013
+ th.className = "nr-table__th";
1014
+ th.appendChild(renderInline2(cell));
1015
+ tr.appendChild(th);
1016
+ }
1017
+ thead.appendChild(tr);
1018
+ table.appendChild(thead);
1019
+ const tbody = document.createElement("tbody");
1020
+ for (const cells of bodyRows) {
1021
+ const tr2 = document.createElement("tr");
1022
+ for (const cell of cells) {
1023
+ const td = document.createElement("td");
1024
+ td.className = "nr-table__td";
1025
+ td.appendChild(renderInline2(cell));
1026
+ tr2.appendChild(td);
1027
+ }
1028
+ tbody.appendChild(tr2);
1029
+ }
1030
+ table.appendChild(tbody);
1031
+ wrapper.appendChild(table);
1032
+ return wrapper;
1109
1033
  }
1110
- function renderList(content) {
1034
+ function createList(content, renderInline2) {
1111
1035
  const lines = content.split("\n");
1112
1036
  const items = [];
1113
1037
  for (const line of lines) {
1114
1038
  if (!line.trim()) continue;
1115
1039
  const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.+)$/);
1116
1040
  if (match) {
1117
- items.push({
1118
- indent: match[1].length,
1119
- marker: match[2],
1120
- text: match[3]
1121
- });
1041
+ items.push({ indent: match[1].length, marker: match[2], text: match[3] });
1122
1042
  }
1123
1043
  }
1124
- if (items.length === 0) return /* @__PURE__ */ jsx2("p", { children: content });
1044
+ if (items.length === 0) {
1045
+ const p = document.createElement("p");
1046
+ p.textContent = content;
1047
+ return p;
1048
+ }
1125
1049
  const isOrdered = /^\d+\.$/.test(items[0].marker);
1126
- const Tag = isOrdered ? "ol" : "ul";
1127
- return /* @__PURE__ */ jsx2(Tag, { className: `${isOrdered ? "list-decimal" : "list-disc"} pl-6 my-3 space-y-1 text-sm sm:text-base`, children: items.map((item, index) => /* @__PURE__ */ jsx2("li", { className: "leading-relaxed", children: renderInline(item.text) }, index)) });
1050
+ const list = document.createElement(isOrdered ? "ol" : "ul");
1051
+ list.className = "nr-list";
1052
+ for (const item of items) {
1053
+ const li = document.createElement("li");
1054
+ li.className = "nr-list__item";
1055
+ li.appendChild(renderInline2(item.text));
1056
+ list.appendChild(li);
1057
+ }
1058
+ return list;
1059
+ }
1060
+ function createTOC(headers, renderInline2) {
1061
+ const nav = document.createElement("nav");
1062
+ nav.className = "nr-toc";
1063
+ const title = document.createElement("div");
1064
+ title.className = "nr-toc__title";
1065
+ title.textContent = "Table of Contents";
1066
+ nav.appendChild(title);
1067
+ const ul = document.createElement("ul");
1068
+ ul.className = "nr-toc__list";
1069
+ for (const h of headers) {
1070
+ const li = document.createElement("li");
1071
+ li.className = `nr-toc__item nr-toc__item--h${h.level}`;
1072
+ const a = document.createElement("a");
1073
+ a.className = "nr-toc__link";
1074
+ a.href = `#${h.id}`;
1075
+ a.appendChild(renderInline2(h.text.replace(/->|<-/g, "").trim()));
1076
+ a.addEventListener("click", (e) => {
1077
+ e.preventDefault();
1078
+ const target = document.getElementById(h.id);
1079
+ if (target) target.scrollIntoView({ behavior: "smooth", block: "start" });
1080
+ });
1081
+ li.appendChild(a);
1082
+ ul.appendChild(li);
1083
+ }
1084
+ nav.appendChild(ul);
1085
+ return nav;
1128
1086
  }
1129
- function extractHeaders(elements) {
1130
- return elements.filter((el) => el.type === "header");
1087
+ function createBlockquote(content, classes, renderInline2) {
1088
+ const el = document.createElement("blockquote");
1089
+ el.className = `nr-blockquote${classes ? ` ${classes}` : ""}`;
1090
+ el.appendChild(renderInline2(content));
1091
+ return el;
1131
1092
  }
1132
1093
 
1133
- // react/directives/AdmonitionDirective.tsx
1134
- import { jsx as jsx3 } from "react/jsx-runtime";
1135
- var AdmonitionDirective = ({
1136
- directiveType,
1137
- props,
1138
- renderSlot
1139
- }) => {
1140
- return /* @__PURE__ */ jsx3(
1141
- Admonition,
1142
- {
1143
- type: directiveType,
1144
- title: props.title,
1145
- icon: props.icon,
1146
- className: props.class,
1147
- style: props.style ? parseCssString(props.style) : void 0,
1148
- children: renderSlot("default")
1094
+ // vanilla/inline.ts
1095
+ function renderInline(text) {
1096
+ const fragment = document.createDocumentFragment();
1097
+ if (!text) return fragment;
1098
+ const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
1099
+ let lastIndex = 0;
1100
+ let match;
1101
+ while ((match = regex.exec(text)) !== null) {
1102
+ if (match.index > lastIndex) {
1103
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex, match.index)));
1149
1104
  }
1150
- );
1151
- };
1152
- var AdmonitionDirective_default = AdmonitionDirective;
1105
+ fragment.appendChild(parseInlinePart(match[0]));
1106
+ lastIndex = regex.lastIndex;
1107
+ }
1108
+ if (lastIndex < text.length) {
1109
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex)));
1110
+ }
1111
+ return fragment;
1112
+ }
1113
+ function parseInlinePart(part) {
1114
+ let match;
1115
+ if (match = part.match(/^\|\[([^\]]+)\]\|$/)) {
1116
+ return createIcon(match[1]);
1117
+ }
1118
+ if (match = part.match(/^!~(.+?)~!$/)) {
1119
+ const content = match[1];
1120
+ const parts = content.split(";");
1121
+ let color = "currentColor";
1122
+ let decorationStyle = "solid";
1123
+ let type = "underline";
1124
+ let textIndex = 0;
1125
+ if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
1126
+ color = parts[textIndex++];
1127
+ }
1128
+ if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
1129
+ decorationStyle = parts[textIndex++];
1130
+ }
1131
+ if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
1132
+ type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
1133
+ }
1134
+ const innerText = parts.slice(textIndex).join(";");
1135
+ const span = document.createElement("span");
1136
+ span.className = "nr-underline";
1137
+ span.style.textDecoration = `${type} ${decorationStyle} ${color}`;
1138
+ span.style.textDecorationThickness = "auto";
1139
+ span.appendChild(renderInline(innerText));
1140
+ return span;
1141
+ }
1142
+ if (match = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
1143
+ const span = document.createElement("span");
1144
+ span.style.color = match[1];
1145
+ span.appendChild(renderInline(match[2]));
1146
+ return span;
1147
+ }
1148
+ if (match = part.match(/^!>([^<]+?)<!$/)) {
1149
+ const span = document.createElement("span");
1150
+ span.className = "nr-spoiler";
1151
+ span.appendChild(renderInline(match[1]));
1152
+ return span;
1153
+ }
1154
+ if (match = part.match(/^==(.+?)==$/)) {
1155
+ const mark = document.createElement("mark");
1156
+ mark.className = "nr-highlight";
1157
+ mark.appendChild(renderInline(match[1]));
1158
+ return mark;
1159
+ }
1160
+ if (match = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
1161
+ const strong = document.createElement("strong");
1162
+ const em = document.createElement("em");
1163
+ em.appendChild(renderInline(match[1]));
1164
+ strong.appendChild(em);
1165
+ return strong;
1166
+ }
1167
+ if (match = part.match(/^\*\*(.+?)\*\*$/)) {
1168
+ const strong = document.createElement("strong");
1169
+ strong.appendChild(renderInline(match[1]));
1170
+ return strong;
1171
+ }
1172
+ if (match = part.match(/^_(.+?)_$/)) {
1173
+ const em = document.createElement("em");
1174
+ em.appendChild(renderInline(match[1]));
1175
+ return em;
1176
+ }
1177
+ if (match = part.match(/^~~(.+?)~~$/)) {
1178
+ const del = document.createElement("del");
1179
+ del.appendChild(renderInline(match[1]));
1180
+ return del;
1181
+ }
1182
+ if (match = part.match(/^`([^`]+)`$/)) {
1183
+ const code = document.createElement("code");
1184
+ code.className = "nr-inline-code";
1185
+ code.textContent = match[1];
1186
+ return code;
1187
+ }
1188
+ if (match = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
1189
+ const a = document.createElement("a");
1190
+ a.className = "nr-link";
1191
+ a.href = match[2];
1192
+ a.target = "_blank";
1193
+ a.rel = "noopener noreferrer";
1194
+ a.appendChild(renderInline(match[1]));
1195
+ return a;
1196
+ }
1197
+ if (part.startsWith("<") && part.endsWith(">")) {
1198
+ const span = document.createElement("span");
1199
+ span.innerHTML = part;
1200
+ return span;
1201
+ }
1202
+ return document.createTextNode(part);
1203
+ }
1153
1204
 
1154
- // react/directives/CardDirective.tsx
1155
- import React2, { useId } from "react";
1156
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1157
- var CardDirective = ({
1158
- directiveType,
1159
- props,
1160
- slots,
1161
- renderSlot,
1162
- context,
1163
- options = {}
1164
- }) => {
1165
- const stableId = useId();
1166
- const { title, image, icon, class: customClass, url, target } = props;
1167
- const hasDescription = !!slots.description;
1168
- const { isSingleCard } = options;
1169
- const isModal = directiveType === "card-m";
1170
- const isLink = directiveType === "card-b";
1171
- const modalId = `modal-card-${props.id || stableId}`;
1172
- const wrapperClass = customClass || "";
1173
- const inlineStyles = props.style ? parseCssString(props.style) : {};
1174
- const description = hasDescription ? renderSlot("description") : null;
1175
- const content = renderSlot("content") || renderSlot("default");
1176
- return /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
1177
- /* @__PURE__ */ jsxs3(
1178
- "div",
1179
- {
1180
- className: `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"} ${wrapperClass}`,
1181
- style: inlineStyles,
1182
- onClick: isModal ? (e) => {
1183
- e.preventDefault();
1184
- e.stopPropagation();
1185
- context.setModals((prev) => ({ ...prev, [modalId]: true }));
1186
- } : isLink && url ? () => window.open(url, "_blank") : void 0,
1187
- role: isModal ? "button" : void 0,
1188
- tabIndex: isModal ? 0 : void 0,
1189
- onKeyDown: isModal ? (e) => {
1190
- if (e.key === "Enter" || e.key === " ") context.setModals((prev) => ({ ...prev, [modalId]: true }));
1191
- } : void 0,
1192
- children: [
1193
- image && /* @__PURE__ */ jsxs3("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
1194
- /* @__PURE__ */ jsx4("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
1195
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
1196
- ] }),
1197
- /* @__PURE__ */ jsxs3("div", { className: `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`, children: [
1198
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3 mb-3", children: [
1199
- icon && /* @__PURE__ */ jsx4("div", { className: "w-10 h-10 text-[1.6em] rounded-xl bg-accent-primary/20 flex items-center justify-center shrink-0 text-accent-primary", children: /* @__PURE__ */ jsx4(IconRenderer, { iconName: icon }) }),
1200
- /* @__PURE__ */ jsx4("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
1201
- ] }),
1202
- /* @__PURE__ */ jsxs3("div", { className: "flex-1 flex flex-col gap-2", children: [
1203
- description && /* @__PURE__ */ jsx4("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
1204
- directiveType === "card" && content && /* @__PURE__ */ jsx4("div", { className: "mt-2", children: content })
1205
- ] }),
1206
- (isModal || isLink) && /* @__PURE__ */ jsx4("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ jsxs3(
1207
- "a",
1208
- {
1209
- href: url,
1210
- target: "_blank",
1211
- rel: "noopener noreferrer",
1212
- className: "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",
1213
- onClick: (e) => e.stopPropagation(),
1214
- children: [
1215
- /* @__PURE__ */ jsx4(IconRenderer, { iconName: "open_in_new" }),
1216
- " Link"
1217
- ]
1218
- }
1219
- ) : isModal ? /* @__PURE__ */ jsxs3("div", { className: "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", children: [
1220
- /* @__PURE__ */ jsx4(IconRenderer, { iconName: "arrow_forward" }),
1221
- " Abrir"
1222
- ] }) : null })
1223
- ] })
1224
- ]
1225
- }
1226
- ),
1227
- isModal && /* @__PURE__ */ jsx4(
1228
- Modal,
1229
- {
1230
- title: title || "Detalles",
1231
- isOpen: !!context.modals[modalId],
1232
- onClose: () => context.setModals((prev) => ({ ...prev, [modalId]: false })),
1233
- children: /* @__PURE__ */ jsx4("div", { className: "prose prose-sm max-w-none", children: content })
1234
- }
1235
- )
1236
- ] });
1205
+ // vanilla/directives/admonition.ts
1206
+ var admonitionDirective = ({ directiveType, props, renderSlot }) => {
1207
+ const el = createAdmonition(directiveType, props.title, props.icon);
1208
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1209
+ if (props.style) el.setAttribute("style", props.style);
1210
+ const body = el.querySelector(".nr-admonition__body");
1211
+ if (body) {
1212
+ body.appendChild(renderSlot("default"));
1213
+ }
1214
+ return el;
1237
1215
  };
1238
- var CardDirective_default = CardDirective;
1216
+ var admonition_default = admonitionDirective;
1239
1217
 
1240
- // react/directives/DetailsDirective.tsx
1241
- import { jsx as jsx5 } from "react/jsx-runtime";
1242
- var DetailsDirective = ({
1243
- props,
1244
- renderSlot
1245
- }) => {
1246
- return /* @__PURE__ */ jsx5(
1247
- Details,
1248
- {
1249
- title: props.title || "Details",
1250
- icon: props.icon,
1251
- defaultOpen: props.defaultOpen === "true",
1252
- className: props.class,
1253
- style: props.style ? parseCssString(props.style) : void 0,
1254
- children: renderSlot("default")
1255
- }
1218
+ // vanilla/directives/details.ts
1219
+ var detailsDirective = ({ props, renderSlot }) => {
1220
+ const el = createDetails(
1221
+ props.title || "Details",
1222
+ props.icon,
1223
+ props.defaultOpen === "true"
1256
1224
  );
1225
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1226
+ if (props.style) el.setAttribute("style", props.style);
1227
+ const body = el.querySelector(".nr-details__body");
1228
+ if (body) {
1229
+ body.appendChild(renderSlot("default"));
1230
+ }
1231
+ return el;
1257
1232
  };
1258
- var DetailsDirective_default = DetailsDirective;
1233
+ var details_default = detailsDirective;
1259
1234
 
1260
- // react/directives/ModalDirective.tsx
1261
- import { useId as useId2 } from "react";
1262
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1263
- var ModalDirective = ({
1264
- props,
1265
- renderSlot,
1266
- context
1267
- }) => {
1268
- const stableId = useId2();
1269
- const modalId = `modal-${props.id || stableId}`;
1235
+ // vanilla/directives/modal.ts
1236
+ var modalDirective = ({ props, renderSlot }) => {
1270
1237
  const label = props.label || props.title || "Open";
1271
1238
  const modalTitle = props.title || "Modal";
1272
1239
  const customClass = props.class || "";
1273
- const hasSizeClass = /\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/.test(customClass);
1274
- const sizeClass = hasSizeClass ? "" : "text-sm";
1275
- const hasDisplayClass = /\b(flex|inline-flex|block|inline-block|grid|inline-grid|hidden)\b/.test(customClass);
1276
- const displayClass = hasDisplayClass ? "" : "inline-flex";
1277
- const isInlineFlex = /\binline-flex\b/.test(customClass);
1278
- const marginClass = isInlineFlex ? "my-1 mx-1" : "my-4";
1279
- 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, " ");
1280
- const btnClass = `${btnBase} ${customClass}`.trim();
1281
- const positionMap = {
1282
- "#left": "text-left",
1283
- "#center": "text-center",
1284
- "#right": "text-right"
1285
- };
1286
- const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
1287
- const handleOpen = () => {
1288
- context.setModals((prev) => ({ ...prev, [modalId]: true }));
1289
- };
1290
- const handleClose = () => {
1291
- context.setModals((prev) => ({ ...prev, [modalId]: false }));
1292
- };
1293
- return /* @__PURE__ */ jsxs4("div", { className: `not-prose ${wrapperClass}`.trim(), children: [
1294
- /* @__PURE__ */ jsxs4("button", { className: btnClass, onClick: handleOpen, children: [
1295
- props.icon && /* @__PURE__ */ jsx6(IconRenderer, { iconName: props.icon }),
1296
- label
1297
- ] }),
1298
- /* @__PURE__ */ jsx6(
1299
- Modal,
1300
- {
1301
- title: modalTitle,
1302
- isOpen: !!context.modals[modalId],
1303
- onClose: handleClose,
1304
- children: renderSlot("default")
1305
- }
1306
- )
1307
- ] });
1240
+ const wrapper = document.createElement("div");
1241
+ wrapper.className = "nr-modal-trigger";
1242
+ const btn = document.createElement("button");
1243
+ btn.className = `nr-button nr-button--default`;
1244
+ if (customClass) btn.classList.add(...customClass.split(/\s+/).filter(Boolean));
1245
+ const icon = props.icon || "open_in_new";
1246
+ if (icon) btn.appendChild(createIcon(icon));
1247
+ btn.appendChild(document.createTextNode(label));
1248
+ const dialog = createModal(modalTitle);
1249
+ const body = dialog.querySelector(".nr-modal__body");
1250
+ if (body) {
1251
+ body.appendChild(renderSlot("default"));
1252
+ }
1253
+ btn.addEventListener("click", () => {
1254
+ if (!dialog.open) {
1255
+ document.body.appendChild(dialog);
1256
+ dialog.showModal();
1257
+ dialog.addEventListener("close", () => {
1258
+ dialog.remove();
1259
+ }, { once: true });
1260
+ }
1261
+ });
1262
+ wrapper.appendChild(btn);
1263
+ wrapper.appendChild(dialog);
1264
+ return wrapper;
1308
1265
  };
1309
- var ModalDirective_default = ModalDirective;
1266
+ var modal_default = modalDirective;
1310
1267
 
1311
- // react/directives/ButtonDirective.tsx
1312
- import React4 from "react";
1313
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1314
- var ButtonDirective = ({
1315
- props,
1316
- renderSlot
1317
- }) => {
1268
+ // vanilla/directives/button.ts
1269
+ var buttonDirective = ({ props, renderSlot }) => {
1318
1270
  const url = props.url || props.href || "#";
1319
1271
  const label = props.label;
1320
1272
  const icon = props.icon || "near_me";
1321
1273
  const target = props.target || "_blank";
1322
1274
  const customClass = props.class || "";
1323
- const hasSizeClass = /\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/.test(customClass);
1324
- const sizeClass = hasSizeClass ? "" : "text-sm";
1325
- const hasDisplayClass = /\b(flex|inline-flex|block|inline-block|grid|inline-grid|hidden)\b/.test(customClass);
1326
- const displayClass = hasDisplayClass ? "" : "inline-flex";
1327
- const isInline = !customClass || !/\b(flex|block|grid)\b/.test(customClass) || /\binline-flex\b/.test(customClass);
1328
- const marginClass = isInline ? "my-1 mx-1" : "my-4";
1329
- 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, " ");
1330
- const btnClass = `${btnBase} ${customClass}`.trim();
1331
- const positionMap = {
1332
- "#left": "flex justify-start",
1333
- "#center": "flex justify-center",
1334
- "#right": "flex justify-end"
1335
- };
1336
- const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
1275
+ const wrapper = document.createElement("div");
1276
+ wrapper.className = "nr-button-wrap";
1337
1277
  if (label) {
1338
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5(
1339
- "a",
1340
- {
1341
- href: url,
1342
- target,
1343
- rel: "noopener noreferrer",
1344
- className: btnClass,
1345
- children: [
1346
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1347
- label
1348
- ]
1349
- }
1350
- ) });
1278
+ const a = document.createElement("a");
1279
+ a.href = url;
1280
+ a.target = target;
1281
+ a.rel = "noopener noreferrer";
1282
+ a.className = "nr-button nr-button--default";
1283
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
1284
+ a.appendChild(createIcon(icon));
1285
+ a.appendChild(document.createTextNode(label));
1286
+ wrapper.appendChild(a);
1287
+ return wrapper;
1351
1288
  }
1352
1289
  const slotContent = renderSlot("default");
1353
- const findLinks = (element) => {
1354
- if (!element) return [];
1355
- if (React4.isValidElement(element) && element.type === "a") {
1356
- return [element];
1357
- }
1358
- if (Array.isArray(element)) {
1359
- return element.flatMap(findLinks);
1360
- }
1361
- if (React4.isValidElement(element) && element.props.children) {
1362
- return findLinks(element.props.children);
1363
- }
1364
- return [];
1365
- };
1366
- const links = findLinks(slotContent);
1290
+ const links = slotContent.querySelectorAll("a");
1367
1291
  if (links.length > 0) {
1368
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: links.map(
1369
- (link, index) => React4.cloneElement(
1370
- link,
1371
- {
1372
- key: index,
1373
- className: `${link.props.className || ""} ${btnClass}`.trim(),
1374
- target,
1375
- rel: "noopener noreferrer"
1376
- },
1377
- /* @__PURE__ */ jsxs5(Fragment, { children: [
1378
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1379
- link.props.children
1380
- ] })
1381
- )
1382
- ) });
1292
+ links.forEach((link) => {
1293
+ link.classList.add("nr-button", "nr-button--default");
1294
+ if (customClass) link.classList.add(...customClass.split(/\s+/).filter(Boolean));
1295
+ });
1296
+ wrapper.appendChild(slotContent);
1297
+ } else {
1298
+ const a = document.createElement("a");
1299
+ a.href = url;
1300
+ a.target = target;
1301
+ a.rel = "noopener noreferrer";
1302
+ a.className = "nr-button nr-button--default";
1303
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
1304
+ a.appendChild(createIcon(icon));
1305
+ a.appendChild(slotContent);
1306
+ wrapper.appendChild(a);
1383
1307
  }
1384
- return /* @__PURE__ */ jsx7("div", { className: `not-prose ${wrapperClass}`.trim(), children: /* @__PURE__ */ jsxs5("a", { href: url, target, rel: "noopener noreferrer", className: btnClass, children: [
1385
- /* @__PURE__ */ jsx7(IconRenderer, { iconName: icon }),
1386
- slotContent
1387
- ] }) });
1308
+ return wrapper;
1388
1309
  };
1389
- var ButtonDirective_default = ButtonDirective;
1310
+ var button_default = buttonDirective;
1390
1311
 
1391
- // react/directives/WrapperDirective.tsx
1392
- import { jsx as jsx8 } from "react/jsx-runtime";
1393
- var WrapperDirective = ({
1312
+ // vanilla/directives/card.ts
1313
+ var cardDirective = ({
1314
+ directiveType,
1394
1315
  props,
1395
- renderSlot
1316
+ slots,
1317
+ renderSlot,
1318
+ options
1396
1319
  }) => {
1397
- const className = props.class || "";
1398
- const id = props.id || "";
1399
- const inlineStyle = props.style ? parseCssString(props.style) : {};
1400
- const wrapperProps = {};
1401
- if (className) wrapperProps.className = className;
1402
- if (id) wrapperProps.id = id;
1403
- if (Object.keys(inlineStyle).length > 0) wrapperProps.style = inlineStyle;
1320
+ const { title, image, icon, url, target } = props;
1321
+ const customClass = props.class || "";
1322
+ const hasDescription = !!slots.description;
1323
+ const { isSingleCard } = options || {};
1324
+ const isModal = directiveType === "card-m";
1325
+ const isLink = directiveType === "card-b";
1326
+ const inlineStyles = props.style ? parseCssString(props.style) : {};
1327
+ const card = document.createElement("div");
1328
+ card.className = `nr-card${isModal || isLink ? " nr-card--interactive" : ""} ${customClass}`.trim();
1329
+ for (const [key, value] of Object.entries(inlineStyles)) {
1330
+ card.style.setProperty(key, String(value));
1331
+ }
1332
+ if (image) {
1333
+ const imgWrap = document.createElement("div");
1334
+ imgWrap.className = `nr-card__image${isSingleCard ? " nr-card__image--tall" : ""}`;
1335
+ const img = document.createElement("img");
1336
+ img.src = image;
1337
+ img.alt = title || "";
1338
+ img.className = "nr-card__img";
1339
+ imgWrap.appendChild(img);
1340
+ const gradient = document.createElement("div");
1341
+ gradient.className = "nr-card__gradient";
1342
+ imgWrap.appendChild(gradient);
1343
+ card.appendChild(imgWrap);
1344
+ }
1345
+ const body = document.createElement("div");
1346
+ body.className = `nr-card__body${image ? " nr-card__body--overlap" : ""}`;
1347
+ if (icon || title) {
1348
+ const header = document.createElement("div");
1349
+ header.className = "nr-card__header";
1350
+ if (icon) {
1351
+ const iconWrap = document.createElement("div");
1352
+ iconWrap.className = "nr-card__icon-wrap";
1353
+ iconWrap.appendChild(createIcon(icon));
1354
+ header.appendChild(iconWrap);
1355
+ }
1356
+ if (title) {
1357
+ const h3 = document.createElement("h3");
1358
+ h3.className = "nr-card__title";
1359
+ h3.textContent = title;
1360
+ header.appendChild(h3);
1361
+ }
1362
+ body.appendChild(header);
1363
+ }
1364
+ if (hasDescription) {
1365
+ const desc = document.createElement("div");
1366
+ desc.className = "nr-card__description";
1367
+ desc.appendChild(renderSlot("description"));
1368
+ body.appendChild(desc);
1369
+ }
1370
+ if (directiveType === "card") {
1371
+ const contentSlot = renderSlot("content") || renderSlot("default");
1372
+ if (contentSlot.childNodes.length > 0) {
1373
+ const contentDiv = document.createElement("div");
1374
+ contentDiv.className = "nr-card__content";
1375
+ contentDiv.appendChild(contentSlot);
1376
+ body.appendChild(contentDiv);
1377
+ }
1378
+ }
1379
+ if (isModal || isLink) {
1380
+ const action = document.createElement("div");
1381
+ action.className = "nr-card__action";
1382
+ if (isLink && url) {
1383
+ const a = document.createElement("a");
1384
+ a.href = url;
1385
+ a.target = target || "_blank";
1386
+ a.rel = "noopener noreferrer";
1387
+ a.className = "nr-card__action-link";
1388
+ a.appendChild(createIcon("open_in_new"));
1389
+ a.appendChild(document.createTextNode(" Link"));
1390
+ action.appendChild(a);
1391
+ } else if (isModal) {
1392
+ const modalBtn = document.createElement("div");
1393
+ modalBtn.className = "nr-card__action-link";
1394
+ modalBtn.appendChild(createIcon("arrow_forward"));
1395
+ modalBtn.appendChild(document.createTextNode(" Abrir"));
1396
+ action.appendChild(modalBtn);
1397
+ }
1398
+ body.appendChild(action);
1399
+ }
1400
+ card.appendChild(body);
1401
+ if (isModal) {
1402
+ const dialog = createModal(title || "Detalles");
1403
+ const modalBody = dialog.querySelector(".nr-modal__body");
1404
+ if (modalBody) {
1405
+ const contentSlot = renderSlot("content") || renderSlot("default");
1406
+ modalBody.appendChild(contentSlot);
1407
+ }
1408
+ card.addEventListener("click", () => {
1409
+ if (!dialog.open) {
1410
+ document.body.appendChild(dialog);
1411
+ dialog.showModal();
1412
+ dialog.addEventListener("close", () => dialog.remove(), { once: true });
1413
+ }
1414
+ });
1415
+ const frag = document.createDocumentFragment();
1416
+ frag.appendChild(card);
1417
+ frag.appendChild(dialog);
1418
+ return frag;
1419
+ }
1420
+ if (isLink && url) {
1421
+ card.addEventListener("click", () => window.open(url, target || "_blank"));
1422
+ }
1423
+ return card;
1424
+ };
1425
+ var card_default = cardDirective;
1426
+
1427
+ // vanilla/directives/wrapper.ts
1428
+ var wrapperDirective = ({ props, renderSlot }) => {
1429
+ const el = document.createElement("div");
1430
+ el.className = "nr-wrapper";
1431
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1432
+ if (props.id) el.id = props.id;
1433
+ if (props.style) {
1434
+ const styles = parseCssString(props.style);
1435
+ for (const [key, value] of Object.entries(styles)) {
1436
+ el.style.setProperty(key, String(value));
1437
+ }
1438
+ }
1404
1439
  for (const [key, value] of Object.entries(props)) {
1405
1440
  if (key.startsWith("data-")) {
1406
- wrapperProps[key] = value;
1441
+ el.setAttribute(key, value);
1407
1442
  }
1408
1443
  }
1409
- return /* @__PURE__ */ jsx8("div", { ...wrapperProps, children: renderSlot("default") });
1444
+ el.appendChild(renderSlot("default"));
1445
+ return el;
1410
1446
  };
1411
- var WrapperDirective_default = WrapperDirective;
1447
+ var wrapper_default = wrapperDirective;
1412
1448
 
1413
- // react/directives/SlideDirective.tsx
1414
- import { useState as useState3, useEffect as useEffect3, useCallback, useRef as useRef3, useLayoutEffect } from "react";
1415
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1449
+ // vanilla/directives/slide.ts
1416
1450
  var slideCounter = 0;
1417
- var SlideDirective = ({
1451
+ var slideDirective = ({
1418
1452
  props,
1419
- context,
1420
- slots
1453
+ slots,
1454
+ renderInline: renderInline2,
1455
+ renderMarkdown
1421
1456
  }) => {
1422
1457
  const rawContent = slots.default || "";
1423
1458
  const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
1424
- const elements = lines.map((line) => context.parseMarkdown(line));
1425
- const [current, setCurrent] = useState3(0);
1459
+ if (lines.length === 0) {
1460
+ return document.createDocumentFragment();
1461
+ }
1426
1462
  const interval = parseInt(props.interval || "3000", 10);
1427
1463
  const speed = parseInt(props.speed || "500", 10);
1428
- const elRefs = useRef3([]);
1429
- const [maxH, setMaxH] = useState3(0);
1430
- useLayoutEffect(() => {
1431
- let h = 0;
1432
- elRefs.current.forEach((el) => {
1433
- if (el) h = Math.max(h, el.offsetHeight);
1434
- });
1435
- if (h > 0) setMaxH(h);
1436
- }, [elements]);
1437
- const cycle = useCallback(() => {
1438
- if (elements.length <= 1) return;
1439
- setCurrent((prev) => (prev + 1) % elements.length);
1440
- }, [elements.length]);
1441
- useEffect3(() => {
1442
- if (elements.length <= 1) return;
1443
- const id = setInterval(cycle, interval);
1444
- return () => clearInterval(id);
1445
- }, [cycle, interval, elements.length]);
1446
- if (elements.length === 0) return null;
1447
1464
  const rawClass = props.class || "";
1448
1465
  const inlineStyle = props.style ? parseCssString(props.style) : {};
1449
- const textSizeMap = {
1450
- "text-xs": "0.75rem",
1451
- "text-sm": "0.875rem",
1452
- "text-base": "1rem",
1453
- "text-lg": "1.125rem",
1454
- "text-xl": "1.25rem",
1455
- "text-2xl": "1.5rem",
1456
- "text-3xl": "1.875rem",
1457
- "text-4xl": "2.25rem",
1458
- "text-5xl": "3rem",
1459
- "text-6xl": "3.75rem",
1460
- "text-7xl": "4.5rem",
1461
- "text-8xl": "6rem",
1462
- "text-9xl": "8rem"
1463
- };
1464
- const textSizeMatch = rawClass.match(/\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/);
1465
- const forcedFontSize = textSizeMatch ? textSizeMap[textSizeMatch[0]] : null;
1466
1466
  const scopeClass = `sld-${++slideCounter}`;
1467
- const className = textSizeMatch ? rawClass.replace(textSizeMatch[0], "").replace(/\s+/g, " ").trim() : rawClass;
1468
- return /* @__PURE__ */ jsxs6(
1469
- "div",
1470
- {
1471
- className: "not-prose",
1472
- style: { height: maxH || "auto", position: "relative", overflow: "hidden", ...inlineStyle },
1473
- children: [
1474
- forcedFontSize && /* @__PURE__ */ jsx9("style", { children: `.${scopeClass} * { font-size: ${forcedFontSize} !important; line-height: normal !important; }` }),
1475
- /* @__PURE__ */ jsx9(
1476
- "div",
1477
- {
1478
- style: {
1479
- position: "absolute",
1480
- left: 0,
1481
- right: 0,
1482
- top: 0,
1483
- transition: `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`,
1484
- transform: `translateY(${-current * maxH}px)`
1485
- },
1486
- children: elements.map((tokens, i) => /* @__PURE__ */ jsx9(
1487
- "div",
1488
- {
1489
- ref: (el) => {
1490
- elRefs.current[i] = el;
1491
- },
1492
- style: maxH ? { height: maxH, display: "flex", alignItems: "center", overflow: "hidden" } : { display: "flex", alignItems: "center" },
1493
- children: /* @__PURE__ */ jsx9("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
1494
- },
1495
- i
1496
- ))
1497
- }
1498
- )
1499
- ]
1467
+ const container = document.createElement("div");
1468
+ container.className = "nr-slide";
1469
+ Object.assign(container.style, {
1470
+ position: "relative",
1471
+ overflow: "hidden",
1472
+ ...inlineStyle
1473
+ });
1474
+ const track = document.createElement("div");
1475
+ track.className = "nr-slide__track";
1476
+ track.style.transition = `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`;
1477
+ const slideEls = [];
1478
+ for (const line of lines) {
1479
+ const slideEl = document.createElement("div");
1480
+ slideEl.className = `nr-slide__item ${scopeClass} ${rawClass}`.trim();
1481
+ slideEl.style.display = "flex";
1482
+ slideEl.style.alignItems = "center";
1483
+ if (renderMarkdown) {
1484
+ const tokens = renderMarkdown(line);
1485
+ slideEl.appendChild(tokens);
1486
+ } else if (renderInline2) {
1487
+ slideEl.appendChild(renderInline2(line));
1488
+ }
1489
+ track.appendChild(slideEl);
1490
+ slideEls.push(slideEl);
1491
+ }
1492
+ container.appendChild(track);
1493
+ let current = 0;
1494
+ let maxH = 0;
1495
+ const measureAndSetHeight = () => {
1496
+ maxH = 0;
1497
+ for (const el of slideEls) {
1498
+ maxH = Math.max(maxH, el.offsetHeight);
1499
+ }
1500
+ if (maxH > 0) {
1501
+ container.style.height = `${maxH}px`;
1502
+ for (const el of slideEls) {
1503
+ el.style.height = `${maxH}px`;
1504
+ }
1500
1505
  }
1501
- );
1506
+ };
1507
+ requestAnimationFrame(() => {
1508
+ measureAndSetHeight();
1509
+ if (document.fonts?.ready) {
1510
+ document.fonts.ready.then(measureAndSetHeight);
1511
+ }
1512
+ });
1513
+ if (lines.length > 1) {
1514
+ setInterval(() => {
1515
+ current = (current + 1) % lines.length;
1516
+ track.style.transform = `translateY(${-current * maxH}px)`;
1517
+ }, interval);
1518
+ }
1519
+ return container;
1502
1520
  };
1503
- var SlideDirective_default = SlideDirective;
1521
+ var slide_default = slideDirective;
1504
1522
 
1505
- // react/directives/index.ts
1523
+ // vanilla/directives/index.ts
1506
1524
  var directiveRegistry = {
1507
1525
  // Admonitions
1508
- note: AdmonitionDirective_default,
1509
- info: AdmonitionDirective_default,
1510
- warning: AdmonitionDirective_default,
1511
- danger: AdmonitionDirective_default,
1512
- greentext: AdmonitionDirective_default,
1526
+ note: admonition_default,
1527
+ info: admonition_default,
1528
+ warning: admonition_default,
1529
+ danger: admonition_default,
1530
+ greentext: admonition_default,
1513
1531
  // Cards
1514
- card: CardDirective_default,
1515
- "card-m": CardDirective_default,
1516
- "card-b": CardDirective_default,
1532
+ card: card_default,
1533
+ "card-m": card_default,
1534
+ "card-b": card_default,
1517
1535
  // Interactive
1518
- details: DetailsDirective_default,
1519
- modal: ModalDirective_default,
1520
- button: ButtonDirective_default,
1536
+ details: details_default,
1537
+ modal: modal_default,
1538
+ button: button_default,
1521
1539
  // Layout / generic wrappers
1522
- div: WrapperDirective_default,
1523
- style: WrapperDirective_default,
1524
- custom: WrapperDirective_default,
1525
- raw: WrapperDirective_default,
1540
+ div: wrapper_default,
1541
+ style: wrapper_default,
1542
+ custom: wrapper_default,
1543
+ raw: wrapper_default,
1526
1544
  // Animation
1527
- slide: SlideDirective_default
1545
+ slide: slide_default
1528
1546
  };
1529
1547
  var directives_default = directiveRegistry;
1530
1548
 
1531
- // react/DirectiveRenderer.tsx
1532
- import { jsx as jsx10 } from "react/jsx-runtime";
1533
- var DirectiveRenderer = ({
1534
- element,
1535
- context,
1536
- index,
1537
- allElements
1538
- }) => {
1549
+ // vanilla/renderer.ts
1550
+ function renderTokens(tokens) {
1551
+ const article = document.createElement("article");
1552
+ article.className = "nr-prose";
1553
+ const ctx = {
1554
+ parseMarkdown,
1555
+ renderElements: (tks) => renderTokensInner(tks, ctx),
1556
+ renderInline,
1557
+ renderMarkdown: (md) => renderTokensInner(parseMarkdown(md), ctx)
1558
+ };
1559
+ article.appendChild(processElements(tokens, ctx, tokens));
1560
+ return article;
1561
+ }
1562
+ function renderMarkdownString(markdown2) {
1563
+ const tokens = parseMarkdown(markdown2);
1564
+ return renderTokens(tokens);
1565
+ }
1566
+ function renderHtmlString(html) {
1567
+ let processedContent = html;
1568
+ processedContent = processedContent.replace(
1569
+ /<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
1570
+ (_match, cssContent) => {
1571
+ const styleEl = document.createElement("style");
1572
+ styleEl.setAttribute("data-nr-global", "");
1573
+ styleEl.textContent = cssContent;
1574
+ document.head.appendChild(styleEl);
1575
+ return "";
1576
+ }
1577
+ );
1578
+ const wrapper = document.createElement("div");
1579
+ wrapper.className = "nr-raw-html";
1580
+ wrapper.innerHTML = processedContent;
1581
+ const scripts = wrapper.querySelectorAll("script");
1582
+ scripts.forEach((oldScript) => {
1583
+ const newScript = document.createElement("script");
1584
+ Array.from(oldScript.attributes).forEach(
1585
+ (attr) => newScript.setAttribute(attr.name, attr.value)
1586
+ );
1587
+ newScript.textContent = oldScript.textContent;
1588
+ oldScript.parentNode?.replaceChild(newScript, oldScript);
1589
+ });
1590
+ return wrapper;
1591
+ }
1592
+ function renderTokensInner(tokens, ctx) {
1593
+ const container = document.createElement("div");
1594
+ container.appendChild(processElements(tokens, ctx, tokens));
1595
+ return container;
1596
+ }
1597
+ function processElements(elements, ctx, allElements) {
1598
+ const fragment = document.createDocumentFragment();
1599
+ let i = 0;
1600
+ while (i < elements.length) {
1601
+ const el = elements[i];
1602
+ if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
1603
+ const cards = [];
1604
+ while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
1605
+ cards.push(elements[i]);
1606
+ i++;
1607
+ }
1608
+ if (cards.length === 1 || cards[0].props?.batch === "off") {
1609
+ for (const card of cards) {
1610
+ const rendered = renderElement(card, ctx, allElements);
1611
+ if (rendered) fragment.appendChild(rendered);
1612
+ }
1613
+ } else {
1614
+ const grid = document.createElement("div");
1615
+ grid.className = "nr-card-grid";
1616
+ for (const card of cards) {
1617
+ const rendered = renderElement(card, ctx, allElements);
1618
+ if (rendered) grid.appendChild(rendered);
1619
+ }
1620
+ fragment.appendChild(grid);
1621
+ }
1622
+ } else {
1623
+ const rendered = renderElement(el, ctx, allElements);
1624
+ if (rendered) fragment.appendChild(rendered);
1625
+ i++;
1626
+ }
1627
+ }
1628
+ return fragment;
1629
+ }
1630
+ function renderElement(element, ctx, allElements) {
1631
+ switch (element.type) {
1632
+ case "header": {
1633
+ const tag = `h${element.level}`;
1634
+ let text = element.text;
1635
+ const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
1636
+ const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
1637
+ if (alignCenter) text = alignCenter[1];
1638
+ else if (alignRight) text = alignRight[1];
1639
+ const h = document.createElement(tag);
1640
+ h.id = element.id;
1641
+ let cls = `md-h${element.level}`;
1642
+ if (alignCenter) cls += " text-center";
1643
+ if (alignRight) cls += " text-right";
1644
+ if (element.classes) cls += ` ${element.classes}`;
1645
+ h.className = cls;
1646
+ h.appendChild(renderInline(text));
1647
+ return h;
1648
+ }
1649
+ case "paragraph": {
1650
+ const p = document.createElement("p");
1651
+ let cls = "md-p";
1652
+ if (element.classes) cls += ` ${element.classes}`;
1653
+ if (element.align) cls += ` text-${element.align}`;
1654
+ p.className = cls;
1655
+ if (element.id) p.id = element.id;
1656
+ const lines = element.content.split("\n");
1657
+ for (let li = 0; li < lines.length; li++) {
1658
+ const line = lines[li];
1659
+ const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
1660
+ if (hardBreakMatch) {
1661
+ p.appendChild(renderInline(hardBreakMatch[1]));
1662
+ p.appendChild(document.createElement("br"));
1663
+ } else {
1664
+ p.appendChild(renderInline(line));
1665
+ if (li < lines.length - 1) {
1666
+ p.appendChild(document.createTextNode(" "));
1667
+ }
1668
+ }
1669
+ }
1670
+ return p;
1671
+ }
1672
+ case "codeblock":
1673
+ return createCodeBlock(element.content, element.language, element.title);
1674
+ case "directive":
1675
+ return renderDirective(element, ctx, allElements);
1676
+ case "html": {
1677
+ const el = element;
1678
+ return renderHtmlString(el.content);
1679
+ }
1680
+ case "html-block": {
1681
+ const htmlBlock = element;
1682
+ const rawProps = parseHtmlAttrs(htmlBlock.attrs);
1683
+ const el = document.createElement(htmlBlock.tag);
1684
+ for (const [key, value] of Object.entries(rawProps)) {
1685
+ if (key === "style" && typeof value === "object") {
1686
+ for (const [prop, val] of Object.entries(value)) {
1687
+ el.style.setProperty(prop, String(val));
1688
+ }
1689
+ } else if (value === true) {
1690
+ el.setAttribute(key, "");
1691
+ } else {
1692
+ el.setAttribute(key, String(value));
1693
+ }
1694
+ }
1695
+ const childFrag = processElements(htmlBlock.children, ctx, allElements);
1696
+ el.appendChild(childFrag);
1697
+ return el;
1698
+ }
1699
+ case "image": {
1700
+ const img = document.createElement("img");
1701
+ img.src = element.src;
1702
+ img.alt = element.alt;
1703
+ img.className = "nr-image";
1704
+ if (element.style) {
1705
+ for (const [key, value] of Object.entries(element.style)) {
1706
+ img.style.setProperty(key, String(value));
1707
+ }
1708
+ }
1709
+ return img;
1710
+ }
1711
+ case "table":
1712
+ return createTable(element.content, renderInline);
1713
+ case "list":
1714
+ return createList(element.content, renderInline);
1715
+ case "blockquote":
1716
+ return createBlockquote(element.content, element.classes, renderInline);
1717
+ case "hr": {
1718
+ const hr = document.createElement("hr");
1719
+ hr.className = "nr-hr";
1720
+ return hr;
1721
+ }
1722
+ case "toc": {
1723
+ const headers = allElements.filter((e) => e.type === "header");
1724
+ return createTOC(headers.map((h) => ({ level: h.level, text: h.text, id: h.id })), renderInline);
1725
+ }
1726
+ default:
1727
+ return null;
1728
+ }
1729
+ }
1730
+ function renderDirective(element, ctx, allElements) {
1539
1731
  const { directiveType, props, slots, scopeId } = element;
1540
- const Component = directives_default[directiveType];
1732
+ const renderer = directives_default[directiveType];
1541
1733
  const renderSlot = (name) => {
1734
+ const frag = document.createDocumentFragment();
1542
1735
  const slotContent = slots[name];
1543
- if (!slotContent) return null;
1544
- const parsed = context.parseMarkdown(slotContent);
1545
- return context.processAndRenderElements(parsed);
1736
+ if (!slotContent) return frag;
1737
+ const tokens = ctx.parseMarkdown(slotContent);
1738
+ frag.appendChild(ctx.renderElements(tokens));
1739
+ return frag;
1546
1740
  };
1547
1741
  const directiveProps = {
1548
1742
  directiveType,
1549
1743
  props,
1550
1744
  slots,
1551
1745
  renderSlot,
1552
- context,
1553
- index,
1554
- allElements
1746
+ context: ctx,
1747
+ index: 0,
1748
+ allElements,
1749
+ renderInline,
1750
+ renderMarkdown: ctx.renderMarkdown
1555
1751
  };
1556
- if (Component) {
1557
- return /* @__PURE__ */ jsx10(Component, { ...directiveProps }, index);
1752
+ if (renderer) {
1753
+ return renderer(directiveProps);
1558
1754
  }
1559
- return /* @__PURE__ */ jsx10("div", { className: `my-4 p-4 rounded-2xl border border-border bg-background-primary/5`, children: renderSlot("default") }, index);
1560
- };
1561
- var DirectiveRenderer_default = DirectiveRenderer;
1562
-
1563
- // react/RawHtmlRenderer.tsx
1564
- import { useRef as useRef4, useEffect as useEffect4 } from "react";
1565
- import { jsx as jsx11 } from "react/jsx-runtime";
1566
- var RawHtmlRenderer = ({
1567
- content,
1568
- globalStyles,
1569
- wrapperClassName
1570
- }) => {
1571
- const containerRef = useRef4(null);
1572
- useEffect4(() => {
1573
- if (!containerRef.current) return;
1574
- const scripts = containerRef.current.querySelectorAll("script");
1575
- scripts.forEach((oldScript) => {
1576
- const newScript = document.createElement("script");
1577
- Array.from(oldScript.attributes).forEach(
1578
- (attr) => newScript.setAttribute(attr.name, attr.value)
1579
- );
1580
- newScript.textContent = oldScript.textContent;
1581
- oldScript.parentNode?.replaceChild(newScript, oldScript);
1582
- });
1583
- scanTailwindCDN();
1584
- }, [content]);
1585
- useEffect4(() => {
1586
- if (!globalStyles) return;
1587
- const styleEl = document.createElement("style");
1588
- styleEl.setAttribute("data-global", "");
1589
- styleEl.textContent = globalStyles;
1590
- document.head.appendChild(styleEl);
1591
- return () => {
1592
- if (styleEl.parentNode) document.head.removeChild(styleEl);
1593
- };
1594
- }, [globalStyles]);
1595
- return /* @__PURE__ */ jsx11("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ jsx11("div", { dangerouslySetInnerHTML: { __html: content } }) });
1596
- };
1597
- var RawHtmlRenderer_default = RawHtmlRenderer;
1598
-
1599
- // react/context.tsx
1600
- import { createContext, useContext } from "react";
1601
- var RenderCtx = createContext(null);
1602
- var RenderContextProvider = RenderCtx.Provider;
1755
+ const fallback = document.createElement("div");
1756
+ fallback.className = "nr-unknown-directive";
1757
+ fallback.appendChild(renderSlot("default"));
1758
+ return fallback;
1759
+ }
1603
1760
 
1604
1761
  // react/CustomMarkdownRenderer.tsx
1605
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1606
- var CustomMarkdownRenderer = ({ content: initialContent }) => {
1607
- const [modals, setModals] = useState4({});
1608
- const baseId = useId3().replace(/:/g, "");
1609
- const articleClass = `scope-${baseId}`;
1610
- const contextRef = useRef5(null);
1611
- resetScopeCounter();
1612
- const allElements = useMemo(() => parseMarkdown(initialContent), [initialContent]);
1613
- useEffect5(() => {
1762
+ import { jsx } from "react/jsx-runtime";
1763
+ var CustomMarkdownRenderer = ({ content }) => {
1764
+ const containerRef = useRef2(null);
1765
+ useEffect3(() => {
1766
+ const container = containerRef.current;
1767
+ if (!container) return;
1768
+ container.replaceChildren();
1769
+ container.appendChild(renderMarkdownString(content));
1770
+ scanTailwindCDN();
1614
1771
  const handleHashChange = () => {
1615
1772
  const hash = window.location.hash;
1616
1773
  if (hash) {
1617
1774
  const parts = hash.split("#");
1618
- const id = parts[parts.length - 1];
1619
- scrollToId(id);
1775
+ scrollToId(parts[parts.length - 1]);
1620
1776
  }
1621
1777
  };
1622
1778
  handleHashChange();
1623
1779
  window.addEventListener("hashchange", handleHashChange);
1624
1780
  return () => window.removeEventListener("hashchange", handleHashChange);
1625
- }, [initialContent]);
1626
- const renderElement = useCallback2(
1627
- (element, index, _depth = 0) => {
1628
- switch (element.type) {
1629
- case "header": {
1630
- const HeaderTag = `h${element.level}`;
1631
- let text = element.text;
1632
- const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
1633
- const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
1634
- if (alignCenter) {
1635
- text = alignCenter[1];
1636
- } else if (alignRight) {
1637
- text = alignRight[1];
1638
- }
1639
- const userClasses = element.classes || "";
1640
- let headerClasses = `md-h${element.level}`;
1641
- if (alignCenter) headerClasses += " text-center";
1642
- if (alignRight) headerClasses += " text-right";
1643
- if (userClasses) headerClasses += ` ${userClasses}`;
1644
- return React8.createElement(
1645
- HeaderTag,
1646
- { key: index, id: element.id, className: headerClasses },
1647
- renderInline(text)
1648
- );
1649
- }
1650
- case "paragraph": {
1651
- const lines = element.content.split("\n");
1652
- const processedContent = lines.map((line, lineIndex) => {
1653
- const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
1654
- if (hardBreakMatch) {
1655
- return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1656
- renderInline(hardBreakMatch[1]),
1657
- /* @__PURE__ */ jsx12("br", {})
1658
- ] }, lineIndex);
1659
- }
1660
- const isLastLine = lineIndex === lines.length - 1;
1661
- return /* @__PURE__ */ jsxs7(React8.Fragment, { children: [
1662
- renderInline(line),
1663
- !isLastLine && " "
1664
- ] }, lineIndex);
1665
- });
1666
- const pUserClasses = element.classes || "";
1667
- let pClasses = "md-p";
1668
- if (pUserClasses) pClasses += ` ${pUserClasses}`;
1669
- if (element.align) pClasses += ` text-${element.align}`;
1670
- return /* @__PURE__ */ jsx12("p", { id: element.id, className: pClasses, children: processedContent }, index);
1671
- }
1672
- case "codeblock":
1673
- return /* @__PURE__ */ jsx12(
1674
- CodeBlock,
1675
- {
1676
- code: element.content,
1677
- language: element.language,
1678
- title: element.title
1679
- },
1680
- index
1681
- );
1682
- case "directive":
1683
- return /* @__PURE__ */ jsx12(
1684
- DirectiveRenderer_default,
1685
- {
1686
- element,
1687
- context: contextRef.current,
1688
- index,
1689
- allElements
1690
- },
1691
- index
1692
- );
1693
- case "html": {
1694
- let processedContent = element.content;
1695
- let globalStyles = "";
1696
- processedContent = processedContent.replace(
1697
- /<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
1698
- (_match, cssContent) => {
1699
- globalStyles += cssContent + "\n";
1700
- return "";
1701
- }
1702
- );
1703
- const wrapperClassName = "w-full my-4";
1704
- return /* @__PURE__ */ jsx12(
1705
- RawHtmlRenderer_default,
1706
- {
1707
- content: processedContent,
1708
- globalStyles: globalStyles || void 0,
1709
- wrapperClassName
1710
- },
1711
- index
1712
- );
1713
- }
1714
- case "html-block": {
1715
- const htmlBlock = element;
1716
- const rawProps = parseHtmlAttrs(htmlBlock.attrs);
1717
- const props = {};
1718
- for (const [key, value] of Object.entries(rawProps)) {
1719
- if (key === "class") props["className"] = value;
1720
- else if (key === "for") props["htmlFor"] = value;
1721
- else if (key === "tabindex") props["tabIndex"] = value;
1722
- else props[key] = value;
1723
- }
1724
- return React8.createElement(
1725
- htmlBlock.tag,
1726
- { key: index, ...props },
1727
- ...processAndRenderElements(htmlBlock.children, _depth + 1)
1728
- );
1729
- }
1730
- case "image":
1731
- return /* @__PURE__ */ jsx12(
1732
- "img",
1733
- {
1734
- alt: element.alt,
1735
- src: element.src,
1736
- style: element.style,
1737
- className: "max-w-full h-auto"
1738
- },
1739
- index
1740
- );
1741
- case "table":
1742
- return /* @__PURE__ */ jsx12("div", { children: renderTable(element.content) }, index);
1743
- case "list":
1744
- return /* @__PURE__ */ jsx12("div", { children: renderList(element.content) }, index);
1745
- case "blockquote":
1746
- return /* @__PURE__ */ jsx12("blockquote", { className: `border-l-4 border-accent-primary/30 pl-4 italic text-text-secondary my-4 text-sm sm:text-base${element.classes ? ` ${element.classes}` : ""}`, children: renderInline(element.content) }, index);
1747
- case "hr":
1748
- return /* @__PURE__ */ jsx12("hr", { className: "my-8 border-border" }, index);
1749
- case "toc":
1750
- return /* @__PURE__ */ jsx12("div", { children: generateToc(allElements) }, index);
1751
- default:
1752
- return null;
1753
- }
1754
- },
1755
- [allElements]
1756
- );
1757
- const processAndRenderElements = useCallback2(
1758
- (elements, depth = 0) => {
1759
- const result = [];
1760
- let i = 0;
1761
- while (i < elements.length) {
1762
- const el = elements[i];
1763
- if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
1764
- const cards = [];
1765
- while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
1766
- cards.push(elements[i]);
1767
- i++;
1768
- }
1769
- if (cards.length === 1 || cards[0].props?.batch === "off") {
1770
- for (let c = 0; c < cards.length; c++) {
1771
- result.push(renderElement(cards[c], result.length, depth));
1772
- }
1773
- } else {
1774
- const firstCardClass = cards[0].props?.["class"] || "";
1775
- const justifyClasses = firstCardClass.match(/\bjustify-\S+/g) || [];
1776
- const wrapperJustify = justifyClasses.length > 0 ? justifyClasses.join(" ") : "";
1777
- result.push(
1778
- /* @__PURE__ */ jsx12("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ jsx12(React8.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
1779
- );
1780
- }
1781
- } else {
1782
- result.push(renderElement(el, result.length, depth));
1783
- i++;
1784
- }
1785
- }
1786
- return result;
1787
- },
1788
- [renderElement]
1789
- );
1790
- const generateToc = (elements) => {
1791
- const headers = extractHeaders(elements);
1792
- if (headers.length === 0) return null;
1793
- return /* @__PURE__ */ jsxs7("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
1794
- /* @__PURE__ */ jsx12("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
1795
- /* @__PURE__ */ jsx12("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
1796
- if (h.type !== "header") return null;
1797
- const indentClass = h.level <= 2 ? "pl-0" : h.level === 3 ? "pl-4" : h.level === 4 ? "pl-8" : "pl-12";
1798
- return /* @__PURE__ */ jsx12("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ jsx12(
1799
- "a",
1800
- {
1801
- href: `#${h.id}`,
1802
- className: "text-accent-primary hover:text-accent-primary/80 no-underline hover:underline transition-colors",
1803
- onClick: (e) => {
1804
- e.preventDefault();
1805
- scrollToId(h.id);
1806
- },
1807
- children: renderInline(h.text.replace(/->|<-/g, "").trim())
1808
- }
1809
- ) }, i);
1810
- }) })
1811
- ] });
1812
- };
1813
- const contextForDirectives = {
1814
- modals,
1815
- setModals,
1816
- articleClass,
1817
- allElements,
1818
- parseMarkdown,
1819
- renderElement,
1820
- renderInline,
1821
- processAndRenderElements
1822
- };
1823
- contextRef.current = contextForDirectives;
1824
- return /* @__PURE__ */ jsx12(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
1781
+ }, [content]);
1782
+ return /* @__PURE__ */ jsx("div", { ref: containerRef });
1825
1783
  };
1826
1784
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
1827
1785
 
1828
1786
  // react/NReditor.tsx
1829
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1787
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
1830
1788
  var customSyntaxHighlighting = HighlightStyle.define([
1831
1789
  { tag: t2.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1832
1790
  { tag: t2.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
@@ -2279,9 +2237,9 @@ var NReditor = ({
2279
2237
  onGuide,
2280
2238
  onConfig
2281
2239
  }) => {
2282
- const editorRef = useRef6(null);
2283
- const [isAllFolded, setIsAllFolded] = useState5(false);
2284
- const [editorMode, setEditorMode] = useState5("editor");
2240
+ const editorRef = useRef3(null);
2241
+ const [isAllFolded, setIsAllFolded] = useState2(false);
2242
+ const [editorMode, setEditorMode] = useState2("split");
2285
2243
  const debouncedContent = useDebounce(value, debounceMs);
2286
2244
  useLazyTailwindCDN(tailwindCDN);
2287
2245
  const handleToggleFold = () => {
@@ -2294,7 +2252,7 @@ var NReditor = ({
2294
2252
  setIsAllFolded(true);
2295
2253
  }
2296
2254
  };
2297
- const extensions = React9.useMemo(
2255
+ const extensions = React2.useMemo(
2298
2256
  () => [
2299
2257
  customStreamParserV2,
2300
2258
  lineNumbers(),
@@ -2314,7 +2272,6 @@ var NReditor = ({
2314
2272
  customEditorTheme,
2315
2273
  syntaxHighlighting(customSyntaxHighlighting),
2316
2274
  EditorView.lineWrapping,
2317
- scrollPastEnd(),
2318
2275
  keymap.of([
2319
2276
  { key: "Ctrl-Shift-[", run: foldAll },
2320
2277
  { key: "Ctrl-Shift-]", run: unfoldAll }
@@ -2331,74 +2288,73 @@ var NReditor = ({
2331
2288
  { key: "split", icon: "vertical_split", label: "Split" },
2332
2289
  { key: "preview", icon: "visibility", label: "Preview" }
2333
2290
  ];
2334
- return /* @__PURE__ */ jsxs8("div", { className: `nr-editor ${className || ""}`, children: [
2335
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-toolbar", children: [
2336
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-toolbar-left", children: [
2337
- /* @__PURE__ */ jsx13(
2291
+ return /* @__PURE__ */ jsxs("div", { className: `nr-editor ${className || ""}`, children: [
2292
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar", children: [
2293
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar-left", children: [
2294
+ /* @__PURE__ */ jsx2(
2338
2295
  "button",
2339
2296
  {
2340
2297
  onClick: handleToggleFold,
2341
2298
  className: "nr-toolbar-btn nr-toolbar-btn-fold",
2342
2299
  title: isAllFolded ? "Expandir todo" : "Colapsar todo",
2343
2300
  "aria-label": isAllFolded ? "Expandir todo" : "Colapsar todo",
2344
- children: /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: isAllFolded ? "unfold_more" : "unfold_less" })
2301
+ children: /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: isAllFolded ? "unfold_more" : "unfold_less" })
2345
2302
  }
2346
2303
  ),
2347
- /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-divider" }),
2348
- /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-mode-group", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs8(
2304
+ /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-divider" }),
2305
+ /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-mode-group", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs(
2349
2306
  "button",
2350
2307
  {
2351
2308
  onClick: () => setEditorMode(btn.key),
2352
2309
  className: `nr-toolbar-btn nr-toolbar-btn-mode ${editorMode === btn.key ? "nr-toolbar-btn-mode--active" : ""} ${btn.key === "split" ? "nr-toolbar-btn-split" : ""}`,
2353
2310
  title: btn.label,
2354
2311
  children: [
2355
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: btn.icon }),
2356
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: btn.label })
2312
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: btn.icon }),
2313
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: btn.label })
2357
2314
  ]
2358
2315
  },
2359
2316
  btn.key
2360
2317
  )) })
2361
2318
  ] }),
2362
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-toolbar-right", children: [
2363
- onGuide && /* @__PURE__ */ jsxs8(
2319
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar-right", children: [
2320
+ onGuide && /* @__PURE__ */ jsxs(
2364
2321
  "button",
2365
2322
  {
2366
2323
  onClick: onGuide,
2367
2324
  className: "nr-toolbar-btn nr-toolbar-btn-sm nr-toolbar-btn-guide",
2368
2325
  title: "Gu\xEDa de sintaxis",
2369
2326
  children: [
2370
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: "menu_book" }),
2371
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: "Gu\xEDa" })
2327
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: "menu_book" }),
2328
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: "Gu\xEDa" })
2372
2329
  ]
2373
2330
  }
2374
2331
  ),
2375
- onGuide && onConfig && /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-divider" }),
2376
- onConfig && /* @__PURE__ */ jsxs8(
2332
+ onGuide && onConfig && /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-divider" }),
2333
+ onConfig && /* @__PURE__ */ jsxs(
2377
2334
  "button",
2378
2335
  {
2379
2336
  onClick: onConfig,
2380
2337
  className: "nr-toolbar-btn nr-toolbar-btn-sm nr-toolbar-btn-config",
2381
2338
  title: "Configurar tema y metadata",
2382
2339
  children: [
2383
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: "tune" }),
2384
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: "Configurar" })
2340
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: "tune" }),
2341
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: "Configurar" })
2385
2342
  ]
2386
2343
  }
2387
2344
  )
2388
2345
  ] })
2389
2346
  ] }),
2390
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-body", children: [
2391
- (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx13(
2347
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-body", children: [
2348
+ (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx2(
2392
2349
  "div",
2393
2350
  {
2394
2351
  className: `nr-editor-pane ${editorMode === "split" ? "nr-editor-pane--half" : ""}`,
2395
- children: /* @__PURE__ */ jsx13(
2352
+ children: /* @__PURE__ */ jsx2(
2396
2353
  CodeMirror,
2397
2354
  {
2398
2355
  value,
2399
2356
  onChange,
2400
- className: "flex-1 min-h-0 min-w-0",
2401
- height: "100%",
2357
+ height: "auto",
2402
2358
  onCreateEditor: (view) => {
2403
2359
  editorRef.current = view;
2404
2360
  },
@@ -2411,11 +2367,11 @@ var NReditor = ({
2411
2367
  )
2412
2368
  }
2413
2369
  ),
2414
- (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx13(
2370
+ (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx2(
2415
2371
  "div",
2416
2372
  {
2417
2373
  className: `nr-editor-preview ${editorMode === "split" ? "nr-editor-preview--half" : ""}`,
2418
- children: /* @__PURE__ */ jsx13("div", { className: "nr-editor-prose", children: /* @__PURE__ */ jsx13("div", { className: "nr-prose", children: /* @__PURE__ */ jsx13(CustomMarkdownRenderer_default, { content: debouncedContent }) }) })
2374
+ children: /* @__PURE__ */ jsx2("div", { className: "nr-editor-prose", children: /* @__PURE__ */ jsx2("div", { className: "nr-prose", children: /* @__PURE__ */ jsx2(CustomMarkdownRenderer_default, { content: debouncedContent }) }) })
2419
2375
  }
2420
2376
  )
2421
2377
  ] })