@noirmd/previewer 1.2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/NReditor.cjs +928 -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 +929 -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 +929 -882
  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 +928 -876
  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 +929 -885
  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 +928 -879
  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 +123 -31
  38. package/dist/vanilla.cjs.map +1 -1
  39. package/dist/vanilla.css +32 -677
  40. package/dist/vanilla.d.cts +24 -2
  41. package/dist/vanilla.d.ts +24 -2
  42. package/dist/vanilla.js +119 -31
  43. package/dist/vanilla.js.map +1 -1
  44. package/dist/variables.css +90 -0
  45. package/dist/vue.cjs +1007 -1120
  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 +1006 -1119
  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";
@@ -315,6 +315,75 @@ function useDebounce(value, delay) {
315
315
 
316
316
  // react/useTailwindCDN.ts
317
317
  import { useEffect as useEffect2, useRef } from "react";
318
+
319
+ // vanilla/tailwindTheme.ts
320
+ var THEME_STYLE_ID = "nr-tailwind-theme";
321
+ var NR_THEME_CSS = `
322
+ @theme {
323
+ --color-primary: var(--color-accent-primary, oklch(var(--p, 55% 0.3 240) / 1));
324
+ --color-primary-content: #ffffff;
325
+ --color-secondary: oklch(var(--s, 55% 0.25 200) / 1);
326
+ --color-secondary-content: #ffffff;
327
+ --color-accent: var(--color-accent-primary, oklch(var(--a, 65% 0.25 160) / 1));
328
+ --color-accent-content: #ffffff;
329
+ --color-neutral: oklch(var(--n, 50% 0.05 240) / 1);
330
+ --color-neutral-content: var(--color-text-primary, oklch(var(--nc, 92% 0.02 240) / 1));
331
+ --color-base-100: var(--color-background-primary, oklch(var(--b1, 15% 0.01 260) / 1));
332
+ --color-base-200: var(--color-background-secondary-solid, oklch(var(--b2, 20% 0.02 260) / 1));
333
+ --color-base-300: var(--color-border, oklch(var(--b3, 25% 0.03 260) / 1));
334
+ --color-base-content: var(--color-text-primary, oklch(var(--bc, 92% 0.02 260) / 1));
335
+ --color-info: oklch(var(--in, 70% 0.2 220) / 1);
336
+ --color-info-content: #ffffff;
337
+ --color-success: oklch(var(--su, 65% 0.25 140) / 1);
338
+ --color-success-content: #ffffff;
339
+ --color-warning: oklch(var(--wa, 80% 0.25 80) / 1);
340
+ --color-warning-content: #1f2937;
341
+ --color-error: oklch(var(--er, 65% 0.3 30) / 1);
342
+ --color-error-content: #ffffff;
343
+ }
344
+ `;
345
+ function getVar(root, name) {
346
+ return getComputedStyle(root).getPropertyValue(name).trim();
347
+ }
348
+ function stylesheetHasTheme() {
349
+ for (const sheet of Array.from(document.styleSheets)) {
350
+ let rules = null;
351
+ try {
352
+ rules = sheet.cssRules;
353
+ } catch {
354
+ continue;
355
+ }
356
+ if (!rules) continue;
357
+ for (const rule of Array.from(rules)) {
358
+ const css2 = rule.cssText || "";
359
+ if (css2.includes("@theme") || css2.includes('@plugin "daisyui"')) return true;
360
+ }
361
+ }
362
+ return false;
363
+ }
364
+ function hasHostTheme() {
365
+ if (typeof window === "undefined" || typeof document === "undefined") return true;
366
+ if (getVar(document.documentElement, "--color-primary")) return true;
367
+ if (getVar(document.documentElement, "--color-base-100")) return true;
368
+ if (document.body && (getVar(document.body, "--color-primary") || getVar(document.body, "--color-base-100"))) return true;
369
+ return stylesheetHasTheme();
370
+ }
371
+ function injectNRTailwindTheme() {
372
+ if (typeof document === "undefined") return;
373
+ if (document.getElementById(THEME_STYLE_ID)) return;
374
+ if (hasHostTheme()) return;
375
+ const style = document.createElement("style");
376
+ style.id = THEME_STYLE_ID;
377
+ style.setAttribute("type", "text/tailwindcss");
378
+ style.textContent = NR_THEME_CSS;
379
+ document.head.appendChild(style);
380
+ }
381
+ function removeNRTailwindTheme() {
382
+ if (typeof document === "undefined") return;
383
+ document.getElementById(THEME_STYLE_ID)?.remove();
384
+ }
385
+
386
+ // react/useTailwindCDN.ts
318
387
  var CDN_URL = "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4";
319
388
  var SCRIPT_ID = "tailwind-cdn-v4-runtime";
320
389
  var CONFIG_ID = "tailwind-cdn-v4-config";
@@ -334,6 +403,7 @@ function useLazyTailwindCDN(enabled) {
334
403
  if ((window.__twCDNRefs ?? 0) <= 0) {
335
404
  document.getElementById(SCRIPT_ID)?.remove();
336
405
  document.getElementById(CONFIG_ID)?.remove();
406
+ removeNRTailwindTheme();
337
407
  window.__twCDNRefs = 0;
338
408
  loadedRef.current = false;
339
409
  }
@@ -346,6 +416,7 @@ function useLazyTailwindCDN(enabled) {
346
416
  configScript.textContent = TAILWIND_CDN_CONFIG;
347
417
  document.head.appendChild(configScript);
348
418
  }
419
+ injectNRTailwindTheme();
349
420
  if (!document.getElementById(SCRIPT_ID)) {
350
421
  const script = document.createElement("script");
351
422
  script.id = SCRIPT_ID;
@@ -358,6 +429,7 @@ function useLazyTailwindCDN(enabled) {
358
429
  if ((window.__twCDNRefs ?? 0) <= 0) {
359
430
  document.getElementById(SCRIPT_ID)?.remove();
360
431
  document.getElementById(CONFIG_ID)?.remove();
432
+ removeNRTailwindTheme();
361
433
  window.__twCDNRefs = 0;
362
434
  loadedRef.current = false;
363
435
  }
@@ -370,7 +442,7 @@ function scanTailwindCDN() {
370
442
  }
371
443
 
372
444
  // react/CustomMarkdownRenderer.tsx
373
- import React8, { useState as useState4, useEffect as useEffect5, useCallback as useCallback2, useMemo, useId as useId3, useRef as useRef5 } from "react";
445
+ import { useEffect as useEffect3, useRef as useRef2 } from "react";
374
446
 
375
447
  // core/utils.ts
376
448
  function parseCssString(cssText) {
@@ -416,9 +488,6 @@ function extractAttributes(text) {
416
488
  return { text: cleanedText, classes: classList.join(" "), id };
417
489
  }
418
490
  var _scopeCounter = 0;
419
- function resetScopeCounter() {
420
- _scopeCounter = 0;
421
- }
422
491
  function generateScopeId() {
423
492
  return `scope-${++_scopeCounter}`;
424
493
  }
@@ -466,6 +535,7 @@ function parseMarkdown(markdown2) {
466
535
  if (!markdown2) return [];
467
536
  const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
468
537
  const result = [];
538
+ const usedIds = /* @__PURE__ */ new Set();
469
539
  let i = 0;
470
540
  while (i < lines.length) {
471
541
  const line = lines[i];
@@ -475,7 +545,14 @@ function parseMarkdown(markdown2) {
475
545
  const level = match[1].length;
476
546
  const rawText = match[2];
477
547
  const { text: text2, classes: classes2, id: customId } = extractAttributes(rawText);
478
- const id2 = customId || generateId(text2.replace(/->|<-/g, ""));
548
+ const baseId = customId || generateId(text2.replace(/->|<-/g, ""));
549
+ let id2 = baseId;
550
+ let n = 1;
551
+ while (usedIds.has(id2)) {
552
+ n++;
553
+ id2 = `${baseId}-${n}`;
554
+ }
555
+ usedIds.add(id2);
479
556
  result.push({ type: "header", level, text: text2, id: id2, classes: classes2 || void 0 });
480
557
  i++;
481
558
  continue;
@@ -790,10 +867,7 @@ function splitSlots(rawContent) {
790
867
  return slots;
791
868
  }
792
869
 
793
- // react/ui-components.tsx
794
- import { useState as useState2, useRef as useRef2 } from "react";
795
-
796
- // react/highlightSetup.ts
870
+ // vanilla/highlightSetup.ts
797
871
  import hljs from "highlight.js/lib/core";
798
872
  import javascript from "highlight.js/lib/languages/javascript";
799
873
  import typescript from "highlight.js/lib/languages/typescript";
@@ -842,991 +916,952 @@ hljs.registerLanguage("java", java);
842
916
  hljs.registerLanguage("csharp", csharp);
843
917
  hljs.registerLanguage("cs", csharp);
844
918
  hljs.registerLanguage("cpp", cpp);
845
- hljs.registerLanguage("c", cpp);
846
919
  hljs.registerLanguage("go", go);
847
920
  hljs.registerLanguage("rust", rust);
848
- hljs.registerLanguage("rs", rust);
849
921
  hljs.registerLanguage("php", php);
850
922
  hljs.registerLanguage("ruby", ruby);
851
- hljs.registerLanguage("rb", ruby);
852
923
  hljs.registerLanguage("swift", swift);
853
924
  hljs.registerLanguage("kotlin", kotlin);
854
- hljs.registerLanguage("kt", kotlin);
855
925
  hljs.registerLanguage("dart", dart);
856
926
  hljs.registerLanguage("yaml", yaml);
857
- hljs.registerLanguage("yml", yaml);
858
927
  hljs.registerLanguage("toml", toml);
859
- hljs.registerLanguage("ini", toml);
860
928
  hljs.registerLanguage("dockerfile", dockerfile);
861
- hljs.registerLanguage("docker", dockerfile);
862
929
  hljs.registerLanguage("diff", diff);
863
930
  hljs.registerLanguage("shell", shell);
864
931
  var highlightSetup_default = hljs;
865
932
 
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}`;
933
+ // vanilla/components.ts
934
+ function createIcon(iconName, extraClasses) {
935
+ const span = document.createElement("span");
936
+ const cls = `nr-icon material-icons-round${extraClasses ? ` ${extraClasses}` : ""}`;
937
+ span.className = cls;
938
+ span.setAttribute("aria-hidden", "true");
872
939
  const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
873
940
  if (isCodepoint) {
874
- return /* @__PURE__ */ jsx(
875
- "span",
876
- {
877
- className: baseClass,
878
- dangerouslySetInnerHTML: { __html: `&#x${iconName};` },
879
- "aria-hidden": "true"
880
- }
881
- );
941
+ span.innerHTML = `&#x${iconName};`;
942
+ } else {
943
+ span.textContent = iconName;
882
944
  }
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);
945
+ return span;
946
+ }
947
+ function createCodeBlock(code, language, title) {
948
+ const wrapper = document.createElement("div");
949
+ wrapper.className = "nr-codeblock";
888
950
  const lang = language?.split(/[\s{]/)[0]?.trim() || "";
889
- let html;
951
+ if (title) {
952
+ const header = document.createElement("div");
953
+ header.className = "nr-codeblock__header";
954
+ header.appendChild(createIcon("description"));
955
+ const titleSpan = document.createElement("span");
956
+ titleSpan.textContent = title;
957
+ header.appendChild(titleSpan);
958
+ wrapper.appendChild(header);
959
+ }
960
+ const pre = document.createElement("pre");
961
+ pre.className = "nr-codeblock__pre";
962
+ const codeEl = document.createElement("code");
963
+ codeEl.className = `language-${lang || "plaintext"}`;
890
964
  try {
891
965
  if (lang && highlightSetup_default.getLanguage(lang)) {
892
- html = highlightSetup_default.highlight(code, { language: lang }).value;
966
+ codeEl.innerHTML = highlightSetup_default.highlight(code, { language: lang }).value;
893
967
  } else {
894
- html = highlightSetup_default.highlightAuto(code).value;
968
+ codeEl.innerHTML = highlightSetup_default.highlightAuto(code).value;
895
969
  }
896
970
  } catch {
897
- html = "";
971
+ codeEl.textContent = code;
898
972
  }
899
- const handleCopy = () => {
973
+ pre.appendChild(codeEl);
974
+ wrapper.appendChild(pre);
975
+ const copyBtn = document.createElement("button");
976
+ copyBtn.className = "nr-codeblock__copy";
977
+ copyBtn.title = "Copy code";
978
+ const copyIcon = createIcon("content_copy");
979
+ copyIcon.style.fontSize = "1rem";
980
+ copyBtn.appendChild(copyIcon);
981
+ let timer = null;
982
+ copyBtn.addEventListener("click", () => {
900
983
  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 = {
984
+ copyIcon.textContent = "check";
985
+ if (timer) clearTimeout(timer);
986
+ timer = setTimeout(() => {
987
+ copyIcon.textContent = "content_copy";
988
+ }, 1800);
989
+ });
990
+ wrapper.appendChild(copyBtn);
991
+ return wrapper;
992
+ }
993
+ var DEFAULT_ADMONITION_ICONS = {
915
994
  note: "info",
916
995
  info: "lightbulb",
917
996
  warning: "warning",
918
997
  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"
998
+ greentext: "subdirectory_arrow_right"
927
999
  };
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
- );
944
- };
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));
1000
+ function createAdmonition(type, title, icon) {
1001
+ const el = document.createElement("div");
1002
+ el.className = `nr-admonition nr-admonition--${type || "note"}`;
1003
+ if (title) {
1004
+ const header = document.createElement("h5");
1005
+ header.className = "nr-admonition__title";
1006
+ const iconToRender = icon || DEFAULT_ADMONITION_ICONS[type] || "info";
1007
+ header.appendChild(createIcon(iconToRender, "nr-admonition__icon"));
1008
+ const titleSpan = document.createElement("span");
1009
+ titleSpan.textContent = title;
1010
+ header.appendChild(titleSpan);
1011
+ el.appendChild(header);
1096
1012
  }
1097
- return elements;
1013
+ const body = document.createElement("div");
1014
+ body.className = "nr-admonition__body";
1015
+ el.appendChild(body);
1016
+ return el;
1017
+ }
1018
+ function createDetails(title, icon, defaultOpen) {
1019
+ const details = document.createElement("details");
1020
+ details.className = "nr-details";
1021
+ if (defaultOpen) details.open = true;
1022
+ const summary = document.createElement("summary");
1023
+ summary.className = "nr-details__summary";
1024
+ const iconToRender = icon || "play_arrow";
1025
+ const iconEl = createIcon(iconToRender, "nr-details__icon");
1026
+ summary.appendChild(iconEl);
1027
+ const titleSpan = document.createElement("span");
1028
+ titleSpan.textContent = title || "Details";
1029
+ summary.appendChild(titleSpan);
1030
+ details.addEventListener("toggle", () => {
1031
+ iconEl.classList.toggle("nr-details__icon--open", details.open);
1032
+ });
1033
+ details.appendChild(summary);
1034
+ const body = document.createElement("div");
1035
+ body.className = "nr-details__body";
1036
+ details.appendChild(body);
1037
+ return details;
1098
1038
  }
1099
- function renderTable(content) {
1039
+ function createModal(title) {
1040
+ const dialog = document.createElement("dialog");
1041
+ dialog.className = "nr-modal";
1042
+ dialog.addEventListener("click", (e) => {
1043
+ if (e.target === dialog) {
1044
+ dialog.close();
1045
+ }
1046
+ });
1047
+ const popup = document.createElement("div");
1048
+ popup.className = "nr-modal__popup";
1049
+ const header = document.createElement("div");
1050
+ header.className = "nr-modal__header";
1051
+ const titleEl = document.createElement("h2");
1052
+ titleEl.className = "nr-modal__title";
1053
+ titleEl.textContent = title;
1054
+ header.appendChild(titleEl);
1055
+ const closeBtn = document.createElement("button");
1056
+ closeBtn.className = "nr-modal__close";
1057
+ closeBtn.appendChild(createIcon("close"));
1058
+ closeBtn.addEventListener("click", () => dialog.close());
1059
+ header.appendChild(closeBtn);
1060
+ popup.appendChild(header);
1061
+ const body = document.createElement("div");
1062
+ body.className = "nr-modal__body";
1063
+ popup.appendChild(body);
1064
+ dialog.appendChild(popup);
1065
+ return dialog;
1066
+ }
1067
+ function createTable(content, renderInline2) {
1100
1068
  const rows = content.split("\n").filter((r) => r.trim());
1101
- if (rows.length < 2) return /* @__PURE__ */ jsx2("p", { children: content });
1069
+ if (rows.length < 2) {
1070
+ const p = document.createElement("p");
1071
+ p.textContent = content;
1072
+ return p;
1073
+ }
1102
1074
  const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
1103
1075
  const headerCells = parseRow(rows[0]);
1104
1076
  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
- ] }) });
1077
+ const wrapper = document.createElement("div");
1078
+ wrapper.className = "nr-table-wrap";
1079
+ const table = document.createElement("table");
1080
+ table.className = "nr-table";
1081
+ const thead = document.createElement("thead");
1082
+ const tr = document.createElement("tr");
1083
+ for (const cell of headerCells) {
1084
+ const th = document.createElement("th");
1085
+ th.className = "nr-table__th";
1086
+ th.appendChild(renderInline2(cell));
1087
+ tr.appendChild(th);
1088
+ }
1089
+ thead.appendChild(tr);
1090
+ table.appendChild(thead);
1091
+ const tbody = document.createElement("tbody");
1092
+ for (const cells of bodyRows) {
1093
+ const tr2 = document.createElement("tr");
1094
+ for (const cell of cells) {
1095
+ const td = document.createElement("td");
1096
+ td.className = "nr-table__td";
1097
+ td.appendChild(renderInline2(cell));
1098
+ tr2.appendChild(td);
1099
+ }
1100
+ tbody.appendChild(tr2);
1101
+ }
1102
+ table.appendChild(tbody);
1103
+ wrapper.appendChild(table);
1104
+ return wrapper;
1109
1105
  }
1110
- function renderList(content) {
1106
+ function createList(content, renderInline2) {
1111
1107
  const lines = content.split("\n");
1112
1108
  const items = [];
1113
1109
  for (const line of lines) {
1114
1110
  if (!line.trim()) continue;
1115
1111
  const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.+)$/);
1116
1112
  if (match) {
1117
- items.push({
1118
- indent: match[1].length,
1119
- marker: match[2],
1120
- text: match[3]
1121
- });
1113
+ items.push({ indent: match[1].length, marker: match[2], text: match[3] });
1122
1114
  }
1123
1115
  }
1124
- if (items.length === 0) return /* @__PURE__ */ jsx2("p", { children: content });
1116
+ if (items.length === 0) {
1117
+ const p = document.createElement("p");
1118
+ p.textContent = content;
1119
+ return p;
1120
+ }
1125
1121
  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)) });
1122
+ const list = document.createElement(isOrdered ? "ol" : "ul");
1123
+ list.className = "nr-list";
1124
+ for (const item of items) {
1125
+ const li = document.createElement("li");
1126
+ li.className = "nr-list__item";
1127
+ li.appendChild(renderInline2(item.text));
1128
+ list.appendChild(li);
1129
+ }
1130
+ return list;
1128
1131
  }
1129
- function extractHeaders(elements) {
1130
- return elements.filter((el) => el.type === "header");
1132
+ function createTOC(headers, renderInline2) {
1133
+ const nav = document.createElement("nav");
1134
+ nav.className = "nr-toc";
1135
+ const title = document.createElement("div");
1136
+ title.className = "nr-toc__title";
1137
+ title.textContent = "Table of Contents";
1138
+ nav.appendChild(title);
1139
+ const ul = document.createElement("ul");
1140
+ ul.className = "nr-toc__list";
1141
+ for (const h of headers) {
1142
+ const li = document.createElement("li");
1143
+ li.className = `nr-toc__item nr-toc__item--h${h.level}`;
1144
+ const a = document.createElement("a");
1145
+ a.className = "nr-toc__link";
1146
+ a.href = `#${h.id}`;
1147
+ a.appendChild(renderInline2(h.text.replace(/->|<-/g, "").trim()));
1148
+ a.addEventListener("click", (e) => {
1149
+ e.preventDefault();
1150
+ const target = document.getElementById(h.id);
1151
+ if (target) target.scrollIntoView({ behavior: "smooth", block: "start" });
1152
+ });
1153
+ li.appendChild(a);
1154
+ ul.appendChild(li);
1155
+ }
1156
+ nav.appendChild(ul);
1157
+ return nav;
1158
+ }
1159
+ function createBlockquote(content, classes, renderInline2) {
1160
+ const el = document.createElement("blockquote");
1161
+ el.className = `nr-blockquote${classes ? ` ${classes}` : ""}`;
1162
+ el.appendChild(renderInline2(content));
1163
+ return el;
1131
1164
  }
1132
1165
 
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")
1166
+ // vanilla/inline.ts
1167
+ function renderInline(text) {
1168
+ const fragment = document.createDocumentFragment();
1169
+ if (!text) return fragment;
1170
+ const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
1171
+ let lastIndex = 0;
1172
+ let match;
1173
+ while ((match = regex.exec(text)) !== null) {
1174
+ if (match.index > lastIndex) {
1175
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex, match.index)));
1149
1176
  }
1150
- );
1151
- };
1152
- var AdmonitionDirective_default = AdmonitionDirective;
1177
+ fragment.appendChild(parseInlinePart(match[0]));
1178
+ lastIndex = regex.lastIndex;
1179
+ }
1180
+ if (lastIndex < text.length) {
1181
+ fragment.appendChild(document.createTextNode(text.slice(lastIndex)));
1182
+ }
1183
+ return fragment;
1184
+ }
1185
+ function parseInlinePart(part) {
1186
+ let match;
1187
+ if (match = part.match(/^\|\[([^\]]+)\]\|$/)) {
1188
+ return createIcon(match[1]);
1189
+ }
1190
+ if (match = part.match(/^!~(.+?)~!$/)) {
1191
+ const content = match[1];
1192
+ const parts = content.split(";");
1193
+ let color = "currentColor";
1194
+ let decorationStyle = "solid";
1195
+ let type = "underline";
1196
+ let textIndex = 0;
1197
+ if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
1198
+ color = parts[textIndex++];
1199
+ }
1200
+ if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
1201
+ decorationStyle = parts[textIndex++];
1202
+ }
1203
+ if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
1204
+ type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
1205
+ }
1206
+ const innerText = parts.slice(textIndex).join(";");
1207
+ const span = document.createElement("span");
1208
+ span.className = "nr-underline";
1209
+ span.style.textDecoration = `${type} ${decorationStyle} ${color}`;
1210
+ span.style.textDecorationThickness = "auto";
1211
+ span.appendChild(renderInline(innerText));
1212
+ return span;
1213
+ }
1214
+ if (match = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
1215
+ const span = document.createElement("span");
1216
+ span.style.color = match[1];
1217
+ span.appendChild(renderInline(match[2]));
1218
+ return span;
1219
+ }
1220
+ if (match = part.match(/^!>([^<]+?)<!$/)) {
1221
+ const span = document.createElement("span");
1222
+ span.className = "nr-spoiler";
1223
+ span.appendChild(renderInline(match[1]));
1224
+ return span;
1225
+ }
1226
+ if (match = part.match(/^==(.+?)==$/)) {
1227
+ const mark = document.createElement("mark");
1228
+ mark.className = "nr-highlight";
1229
+ mark.appendChild(renderInline(match[1]));
1230
+ return mark;
1231
+ }
1232
+ if (match = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
1233
+ const strong = document.createElement("strong");
1234
+ const em = document.createElement("em");
1235
+ em.appendChild(renderInline(match[1]));
1236
+ strong.appendChild(em);
1237
+ return strong;
1238
+ }
1239
+ if (match = part.match(/^\*\*(.+?)\*\*$/)) {
1240
+ const strong = document.createElement("strong");
1241
+ strong.appendChild(renderInline(match[1]));
1242
+ return strong;
1243
+ }
1244
+ if (match = part.match(/^_(.+?)_$/)) {
1245
+ const em = document.createElement("em");
1246
+ em.appendChild(renderInline(match[1]));
1247
+ return em;
1248
+ }
1249
+ if (match = part.match(/^~~(.+?)~~$/)) {
1250
+ const del = document.createElement("del");
1251
+ del.appendChild(renderInline(match[1]));
1252
+ return del;
1253
+ }
1254
+ if (match = part.match(/^`([^`]+)`$/)) {
1255
+ const code = document.createElement("code");
1256
+ code.className = "nr-inline-code";
1257
+ code.textContent = match[1];
1258
+ return code;
1259
+ }
1260
+ if (match = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
1261
+ const a = document.createElement("a");
1262
+ a.className = "nr-link";
1263
+ a.href = match[2];
1264
+ a.target = "_blank";
1265
+ a.rel = "noopener noreferrer";
1266
+ a.appendChild(renderInline(match[1]));
1267
+ return a;
1268
+ }
1269
+ if (part.startsWith("<") && part.endsWith(">")) {
1270
+ const span = document.createElement("span");
1271
+ span.innerHTML = part;
1272
+ return span;
1273
+ }
1274
+ return document.createTextNode(part);
1275
+ }
1153
1276
 
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
- ] });
1277
+ // vanilla/directives/admonition.ts
1278
+ var admonitionDirective = ({ directiveType, props, renderSlot }) => {
1279
+ const el = createAdmonition(directiveType, props.title, props.icon);
1280
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1281
+ if (props.style) el.setAttribute("style", props.style);
1282
+ const body = el.querySelector(".nr-admonition__body");
1283
+ if (body) {
1284
+ body.appendChild(renderSlot("default"));
1285
+ }
1286
+ return el;
1237
1287
  };
1238
- var CardDirective_default = CardDirective;
1288
+ var admonition_default = admonitionDirective;
1239
1289
 
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
- }
1290
+ // vanilla/directives/details.ts
1291
+ var detailsDirective = ({ props, renderSlot }) => {
1292
+ const el = createDetails(
1293
+ props.title || "Details",
1294
+ props.icon,
1295
+ props.defaultOpen === "true"
1256
1296
  );
1297
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1298
+ if (props.style) el.setAttribute("style", props.style);
1299
+ const body = el.querySelector(".nr-details__body");
1300
+ if (body) {
1301
+ body.appendChild(renderSlot("default"));
1302
+ }
1303
+ return el;
1257
1304
  };
1258
- var DetailsDirective_default = DetailsDirective;
1305
+ var details_default = detailsDirective;
1259
1306
 
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}`;
1307
+ // vanilla/directives/modal.ts
1308
+ var modalDirective = ({ props, renderSlot }) => {
1270
1309
  const label = props.label || props.title || "Open";
1271
1310
  const modalTitle = props.title || "Modal";
1272
1311
  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
- ] });
1312
+ const wrapper = document.createElement("div");
1313
+ wrapper.className = "nr-modal-trigger";
1314
+ const btn = document.createElement("button");
1315
+ btn.className = `nr-button nr-button--default`;
1316
+ if (customClass) btn.classList.add(...customClass.split(/\s+/).filter(Boolean));
1317
+ const icon = props.icon || "open_in_new";
1318
+ if (icon) btn.appendChild(createIcon(icon));
1319
+ btn.appendChild(document.createTextNode(label));
1320
+ const dialog = createModal(modalTitle);
1321
+ const body = dialog.querySelector(".nr-modal__body");
1322
+ if (body) {
1323
+ const prose = document.createElement("div");
1324
+ prose.className = "nr-prose";
1325
+ prose.appendChild(renderSlot("default"));
1326
+ body.appendChild(prose);
1327
+ }
1328
+ btn.addEventListener("click", () => {
1329
+ if (!dialog.open) {
1330
+ document.body.appendChild(dialog);
1331
+ dialog.showModal();
1332
+ dialog.addEventListener("close", () => {
1333
+ dialog.remove();
1334
+ }, { once: true });
1335
+ }
1336
+ });
1337
+ wrapper.appendChild(btn);
1338
+ wrapper.appendChild(dialog);
1339
+ return wrapper;
1308
1340
  };
1309
- var ModalDirective_default = ModalDirective;
1341
+ var modal_default = modalDirective;
1310
1342
 
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
- }) => {
1343
+ // vanilla/directives/button.ts
1344
+ var buttonDirective = ({ props, renderSlot }) => {
1318
1345
  const url = props.url || props.href || "#";
1319
1346
  const label = props.label;
1320
1347
  const icon = props.icon || "near_me";
1321
1348
  const target = props.target || "_blank";
1322
1349
  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(" ");
1350
+ const wrapper = document.createElement("div");
1351
+ wrapper.className = "nr-button-wrap";
1337
1352
  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
- ) });
1353
+ const a = document.createElement("a");
1354
+ a.href = url;
1355
+ a.target = target;
1356
+ a.rel = "noopener noreferrer";
1357
+ a.className = "nr-button nr-button--default";
1358
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
1359
+ a.appendChild(createIcon(icon));
1360
+ a.appendChild(document.createTextNode(label));
1361
+ wrapper.appendChild(a);
1362
+ return wrapper;
1351
1363
  }
1352
1364
  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);
1365
+ const links = slotContent.querySelectorAll("a");
1367
1366
  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
- ) });
1367
+ links.forEach((link) => {
1368
+ link.classList.add("nr-button", "nr-button--default");
1369
+ if (customClass) link.classList.add(...customClass.split(/\s+/).filter(Boolean));
1370
+ });
1371
+ wrapper.appendChild(slotContent);
1372
+ } else {
1373
+ const a = document.createElement("a");
1374
+ a.href = url;
1375
+ a.target = target;
1376
+ a.rel = "noopener noreferrer";
1377
+ a.className = "nr-button nr-button--default";
1378
+ if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
1379
+ a.appendChild(createIcon(icon));
1380
+ a.appendChild(slotContent);
1381
+ wrapper.appendChild(a);
1383
1382
  }
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
- ] }) });
1383
+ return wrapper;
1388
1384
  };
1389
- var ButtonDirective_default = ButtonDirective;
1385
+ var button_default = buttonDirective;
1390
1386
 
1391
- // react/directives/WrapperDirective.tsx
1392
- import { jsx as jsx8 } from "react/jsx-runtime";
1393
- var WrapperDirective = ({
1387
+ // vanilla/directives/card.ts
1388
+ var cardDirective = ({
1389
+ directiveType,
1394
1390
  props,
1395
- renderSlot
1391
+ slots,
1392
+ renderSlot,
1393
+ options
1396
1394
  }) => {
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;
1395
+ const { title, image, icon, url, target } = props;
1396
+ const customClass = props.class || "";
1397
+ const hasDescription = !!slots.description;
1398
+ const { isSingleCard } = options || {};
1399
+ const isModal = directiveType === "card-m";
1400
+ const isLink = directiveType === "card-b";
1401
+ const inlineStyles = props.style ? parseCssString(props.style) : {};
1402
+ const card = document.createElement("div");
1403
+ card.className = `nr-card${isModal || isLink ? " nr-card--interactive" : ""} ${customClass}`.trim();
1404
+ for (const [key, value] of Object.entries(inlineStyles)) {
1405
+ card.style.setProperty(key, String(value));
1406
+ }
1407
+ if (image) {
1408
+ const imgWrap = document.createElement("div");
1409
+ imgWrap.className = `nr-card__image${isSingleCard ? " nr-card__image--tall" : ""}`;
1410
+ const img = document.createElement("img");
1411
+ img.src = image;
1412
+ img.alt = title || "";
1413
+ img.className = "nr-card__img";
1414
+ imgWrap.appendChild(img);
1415
+ const gradient = document.createElement("div");
1416
+ gradient.className = "nr-card__gradient";
1417
+ imgWrap.appendChild(gradient);
1418
+ card.appendChild(imgWrap);
1419
+ }
1420
+ const body = document.createElement("div");
1421
+ body.className = `nr-card__body${image ? " nr-card__body--overlap" : ""}`;
1422
+ if (icon || title) {
1423
+ const header = document.createElement("div");
1424
+ header.className = "nr-card__header";
1425
+ if (icon) {
1426
+ const iconWrap = document.createElement("div");
1427
+ iconWrap.className = "nr-card__icon-wrap";
1428
+ iconWrap.appendChild(createIcon(icon));
1429
+ header.appendChild(iconWrap);
1430
+ }
1431
+ if (title) {
1432
+ const h3 = document.createElement("h3");
1433
+ h3.className = "nr-card__title";
1434
+ h3.textContent = title;
1435
+ header.appendChild(h3);
1436
+ }
1437
+ body.appendChild(header);
1438
+ }
1439
+ if (hasDescription) {
1440
+ const desc = document.createElement("div");
1441
+ desc.className = "nr-card__description";
1442
+ desc.appendChild(renderSlot("description"));
1443
+ body.appendChild(desc);
1444
+ }
1445
+ if (directiveType === "card") {
1446
+ const contentSlot = renderSlot("content") || renderSlot("default");
1447
+ if (contentSlot.childNodes.length > 0) {
1448
+ const contentDiv = document.createElement("div");
1449
+ contentDiv.className = "nr-card__content";
1450
+ contentDiv.appendChild(contentSlot);
1451
+ body.appendChild(contentDiv);
1452
+ }
1453
+ }
1454
+ if (isModal || isLink) {
1455
+ const action = document.createElement("div");
1456
+ action.className = "nr-card__action";
1457
+ if (isLink && url) {
1458
+ const a = document.createElement("a");
1459
+ a.href = url;
1460
+ a.target = target || "_blank";
1461
+ a.rel = "noopener noreferrer";
1462
+ a.className = "nr-card__action-link";
1463
+ a.appendChild(createIcon("open_in_new"));
1464
+ a.appendChild(document.createTextNode(" Link"));
1465
+ action.appendChild(a);
1466
+ } else if (isModal) {
1467
+ const modalBtn = document.createElement("div");
1468
+ modalBtn.className = "nr-card__action-link";
1469
+ modalBtn.appendChild(createIcon("arrow_forward"));
1470
+ modalBtn.appendChild(document.createTextNode(" Abrir"));
1471
+ action.appendChild(modalBtn);
1472
+ }
1473
+ body.appendChild(action);
1474
+ }
1475
+ card.appendChild(body);
1476
+ if (isModal) {
1477
+ const dialog = createModal(title || "Detalles");
1478
+ const modalBody = dialog.querySelector(".nr-modal__body");
1479
+ if (modalBody) {
1480
+ const prose = document.createElement("div");
1481
+ prose.className = "nr-prose";
1482
+ prose.appendChild(renderSlot("content") || renderSlot("default"));
1483
+ modalBody.appendChild(prose);
1484
+ }
1485
+ card.addEventListener("click", () => {
1486
+ if (!dialog.open) {
1487
+ document.body.appendChild(dialog);
1488
+ dialog.showModal();
1489
+ dialog.addEventListener("close", () => dialog.remove(), { once: true });
1490
+ }
1491
+ });
1492
+ const frag = document.createDocumentFragment();
1493
+ frag.appendChild(card);
1494
+ frag.appendChild(dialog);
1495
+ return frag;
1496
+ }
1497
+ if (isLink && url) {
1498
+ card.addEventListener("click", () => window.open(url, target || "_blank"));
1499
+ }
1500
+ return card;
1501
+ };
1502
+ var card_default = cardDirective;
1503
+
1504
+ // vanilla/directives/wrapper.ts
1505
+ var wrapperDirective = ({ props, renderSlot }) => {
1506
+ const el = document.createElement("div");
1507
+ el.className = "nr-wrapper";
1508
+ if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
1509
+ if (props.id) el.id = props.id;
1510
+ if (props.style) {
1511
+ const styles = parseCssString(props.style);
1512
+ for (const [key, value] of Object.entries(styles)) {
1513
+ el.style.setProperty(key, String(value));
1514
+ }
1515
+ }
1404
1516
  for (const [key, value] of Object.entries(props)) {
1405
1517
  if (key.startsWith("data-")) {
1406
- wrapperProps[key] = value;
1518
+ el.setAttribute(key, value);
1407
1519
  }
1408
1520
  }
1409
- return /* @__PURE__ */ jsx8("div", { ...wrapperProps, children: renderSlot("default") });
1521
+ el.appendChild(renderSlot("default"));
1522
+ return el;
1410
1523
  };
1411
- var WrapperDirective_default = WrapperDirective;
1524
+ var wrapper_default = wrapperDirective;
1412
1525
 
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";
1526
+ // vanilla/directives/slide.ts
1416
1527
  var slideCounter = 0;
1417
- var SlideDirective = ({
1528
+ var slideDirective = ({
1418
1529
  props,
1419
- context,
1420
- slots
1530
+ slots,
1531
+ renderInline: renderInline2,
1532
+ renderMarkdown
1421
1533
  }) => {
1422
1534
  const rawContent = slots.default || "";
1423
1535
  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);
1536
+ if (lines.length === 0) {
1537
+ return document.createDocumentFragment();
1538
+ }
1426
1539
  const interval = parseInt(props.interval || "3000", 10);
1427
1540
  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
1541
  const rawClass = props.class || "";
1448
1542
  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
1543
  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
- ]
1544
+ const container = document.createElement("div");
1545
+ container.className = "nr-slide";
1546
+ Object.assign(container.style, {
1547
+ position: "relative",
1548
+ overflow: "hidden",
1549
+ ...inlineStyle
1550
+ });
1551
+ const track = document.createElement("div");
1552
+ track.className = "nr-slide__track";
1553
+ track.style.transition = `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`;
1554
+ const slideEls = [];
1555
+ for (const line of lines) {
1556
+ const slideEl = document.createElement("div");
1557
+ slideEl.className = `nr-slide__item ${scopeClass} ${rawClass}`.trim();
1558
+ slideEl.style.display = "flex";
1559
+ slideEl.style.alignItems = "center";
1560
+ if (renderMarkdown) {
1561
+ const tokens = renderMarkdown(line);
1562
+ slideEl.appendChild(tokens);
1563
+ } else if (renderInline2) {
1564
+ slideEl.appendChild(renderInline2(line));
1565
+ }
1566
+ track.appendChild(slideEl);
1567
+ slideEls.push(slideEl);
1568
+ }
1569
+ container.appendChild(track);
1570
+ let current = 0;
1571
+ let maxH = 0;
1572
+ const measureAndSetHeight = () => {
1573
+ maxH = 0;
1574
+ for (const el of slideEls) {
1575
+ maxH = Math.max(maxH, el.offsetHeight);
1576
+ }
1577
+ if (maxH > 0) {
1578
+ container.style.height = `${maxH}px`;
1579
+ for (const el of slideEls) {
1580
+ el.style.height = `${maxH}px`;
1581
+ }
1500
1582
  }
1501
- );
1583
+ };
1584
+ requestAnimationFrame(() => {
1585
+ measureAndSetHeight();
1586
+ if (document.fonts?.ready) {
1587
+ document.fonts.ready.then(measureAndSetHeight);
1588
+ }
1589
+ });
1590
+ if (lines.length > 1) {
1591
+ setInterval(() => {
1592
+ current = (current + 1) % lines.length;
1593
+ track.style.transform = `translateY(${-current * maxH}px)`;
1594
+ }, interval);
1595
+ }
1596
+ return container;
1502
1597
  };
1503
- var SlideDirective_default = SlideDirective;
1598
+ var slide_default = slideDirective;
1504
1599
 
1505
- // react/directives/index.ts
1600
+ // vanilla/directives/index.ts
1506
1601
  var directiveRegistry = {
1507
1602
  // Admonitions
1508
- note: AdmonitionDirective_default,
1509
- info: AdmonitionDirective_default,
1510
- warning: AdmonitionDirective_default,
1511
- danger: AdmonitionDirective_default,
1512
- greentext: AdmonitionDirective_default,
1603
+ note: admonition_default,
1604
+ info: admonition_default,
1605
+ warning: admonition_default,
1606
+ danger: admonition_default,
1607
+ greentext: admonition_default,
1513
1608
  // Cards
1514
- card: CardDirective_default,
1515
- "card-m": CardDirective_default,
1516
- "card-b": CardDirective_default,
1609
+ card: card_default,
1610
+ "card-m": card_default,
1611
+ "card-b": card_default,
1517
1612
  // Interactive
1518
- details: DetailsDirective_default,
1519
- modal: ModalDirective_default,
1520
- button: ButtonDirective_default,
1613
+ details: details_default,
1614
+ modal: modal_default,
1615
+ button: button_default,
1521
1616
  // Layout / generic wrappers
1522
- div: WrapperDirective_default,
1523
- style: WrapperDirective_default,
1524
- custom: WrapperDirective_default,
1525
- raw: WrapperDirective_default,
1617
+ div: wrapper_default,
1618
+ style: wrapper_default,
1619
+ custom: wrapper_default,
1620
+ raw: wrapper_default,
1526
1621
  // Animation
1527
- slide: SlideDirective_default
1622
+ slide: slide_default
1528
1623
  };
1529
1624
  var directives_default = directiveRegistry;
1530
1625
 
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
- }) => {
1626
+ // vanilla/renderer.ts
1627
+ function renderTokens(tokens) {
1628
+ const article = document.createElement("article");
1629
+ article.className = "nr-prose";
1630
+ const ctx = {
1631
+ parseMarkdown,
1632
+ renderElements: (tks) => renderTokensInner(tks, ctx),
1633
+ renderInline,
1634
+ renderMarkdown: (md) => renderTokensInner(parseMarkdown(md), ctx)
1635
+ };
1636
+ article.appendChild(processElements(tokens, ctx, tokens));
1637
+ return article;
1638
+ }
1639
+ function renderMarkdownString(markdown2) {
1640
+ const tokens = parseMarkdown(markdown2);
1641
+ return renderTokens(tokens);
1642
+ }
1643
+ function renderHtmlString(html) {
1644
+ let processedContent = html;
1645
+ processedContent = processedContent.replace(
1646
+ /<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
1647
+ (_match, cssContent) => {
1648
+ const styleEl = document.createElement("style");
1649
+ styleEl.setAttribute("data-nr-global", "");
1650
+ styleEl.textContent = cssContent;
1651
+ document.head.appendChild(styleEl);
1652
+ return "";
1653
+ }
1654
+ );
1655
+ const wrapper = document.createElement("div");
1656
+ wrapper.className = "nr-raw-html";
1657
+ wrapper.innerHTML = processedContent;
1658
+ const scripts = wrapper.querySelectorAll("script");
1659
+ scripts.forEach((oldScript) => {
1660
+ const newScript = document.createElement("script");
1661
+ Array.from(oldScript.attributes).forEach(
1662
+ (attr) => newScript.setAttribute(attr.name, attr.value)
1663
+ );
1664
+ newScript.textContent = oldScript.textContent;
1665
+ oldScript.parentNode?.replaceChild(newScript, oldScript);
1666
+ });
1667
+ return wrapper;
1668
+ }
1669
+ function renderTokensInner(tokens, ctx) {
1670
+ const container = document.createElement("div");
1671
+ container.appendChild(processElements(tokens, ctx, tokens));
1672
+ return container;
1673
+ }
1674
+ function processElements(elements, ctx, allElements) {
1675
+ const fragment = document.createDocumentFragment();
1676
+ let i = 0;
1677
+ while (i < elements.length) {
1678
+ const el = elements[i];
1679
+ if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
1680
+ const cards = [];
1681
+ while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
1682
+ cards.push(elements[i]);
1683
+ i++;
1684
+ }
1685
+ if (cards.length === 1 || cards[0].props?.batch === "off") {
1686
+ for (const card of cards) {
1687
+ const rendered = renderElement(card, ctx, allElements);
1688
+ if (rendered) fragment.appendChild(rendered);
1689
+ }
1690
+ } else {
1691
+ const grid = document.createElement("div");
1692
+ grid.className = "nr-card-grid";
1693
+ for (const card of cards) {
1694
+ const rendered = renderElement(card, ctx, allElements);
1695
+ if (rendered) grid.appendChild(rendered);
1696
+ }
1697
+ fragment.appendChild(grid);
1698
+ }
1699
+ } else {
1700
+ const rendered = renderElement(el, ctx, allElements);
1701
+ if (rendered) fragment.appendChild(rendered);
1702
+ i++;
1703
+ }
1704
+ }
1705
+ return fragment;
1706
+ }
1707
+ function renderElement(element, ctx, allElements) {
1708
+ switch (element.type) {
1709
+ case "header": {
1710
+ const tag = `h${element.level}`;
1711
+ let text = element.text;
1712
+ const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
1713
+ const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
1714
+ if (alignCenter) text = alignCenter[1];
1715
+ else if (alignRight) text = alignRight[1];
1716
+ const h = document.createElement(tag);
1717
+ h.id = element.id;
1718
+ let cls = `md-h${element.level}`;
1719
+ if (alignCenter) cls += " text-center";
1720
+ if (alignRight) cls += " text-right";
1721
+ if (element.classes) cls += ` ${element.classes}`;
1722
+ h.className = cls;
1723
+ h.appendChild(renderInline(text));
1724
+ return h;
1725
+ }
1726
+ case "paragraph": {
1727
+ const p = document.createElement("p");
1728
+ let cls = "md-p";
1729
+ if (element.classes) cls += ` ${element.classes}`;
1730
+ if (element.align) cls += ` text-${element.align}`;
1731
+ p.className = cls;
1732
+ if (element.id) p.id = element.id;
1733
+ const lines = element.content.split("\n");
1734
+ for (let li = 0; li < lines.length; li++) {
1735
+ const line = lines[li];
1736
+ const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
1737
+ if (hardBreakMatch) {
1738
+ p.appendChild(renderInline(hardBreakMatch[1]));
1739
+ p.appendChild(document.createElement("br"));
1740
+ } else {
1741
+ p.appendChild(renderInline(line));
1742
+ if (li < lines.length - 1) {
1743
+ p.appendChild(document.createTextNode(" "));
1744
+ }
1745
+ }
1746
+ }
1747
+ return p;
1748
+ }
1749
+ case "codeblock":
1750
+ return createCodeBlock(element.content, element.language, element.title);
1751
+ case "directive":
1752
+ return renderDirective(element, ctx, allElements);
1753
+ case "html": {
1754
+ const el = element;
1755
+ return renderHtmlString(el.content);
1756
+ }
1757
+ case "html-block": {
1758
+ const htmlBlock = element;
1759
+ const rawProps = parseHtmlAttrs(htmlBlock.attrs);
1760
+ const el = document.createElement(htmlBlock.tag);
1761
+ for (const [key, value] of Object.entries(rawProps)) {
1762
+ if (key === "style" && typeof value === "object") {
1763
+ for (const [prop, val] of Object.entries(value)) {
1764
+ el.style.setProperty(prop, String(val));
1765
+ }
1766
+ } else if (value === true) {
1767
+ el.setAttribute(key, "");
1768
+ } else {
1769
+ el.setAttribute(key, String(value));
1770
+ }
1771
+ }
1772
+ const childFrag = processElements(htmlBlock.children, ctx, allElements);
1773
+ el.appendChild(childFrag);
1774
+ return el;
1775
+ }
1776
+ case "image": {
1777
+ const img = document.createElement("img");
1778
+ img.src = element.src;
1779
+ img.alt = element.alt;
1780
+ img.className = "nr-image";
1781
+ if (element.style) {
1782
+ for (const [key, value] of Object.entries(element.style)) {
1783
+ img.style.setProperty(key, String(value));
1784
+ }
1785
+ }
1786
+ return img;
1787
+ }
1788
+ case "table":
1789
+ return createTable(element.content, renderInline);
1790
+ case "list":
1791
+ return createList(element.content, renderInline);
1792
+ case "blockquote":
1793
+ return createBlockquote(element.content, element.classes, renderInline);
1794
+ case "hr": {
1795
+ const hr = document.createElement("hr");
1796
+ hr.className = "nr-hr";
1797
+ return hr;
1798
+ }
1799
+ case "toc": {
1800
+ const headers = allElements.filter((e) => e.type === "header");
1801
+ return createTOC(headers.map((h) => ({ level: h.level, text: h.text, id: h.id })), renderInline);
1802
+ }
1803
+ default:
1804
+ return null;
1805
+ }
1806
+ }
1807
+ function renderDirective(element, ctx, allElements) {
1539
1808
  const { directiveType, props, slots, scopeId } = element;
1540
- const Component = directives_default[directiveType];
1809
+ const renderer = directives_default[directiveType];
1541
1810
  const renderSlot = (name) => {
1811
+ const frag = document.createDocumentFragment();
1542
1812
  const slotContent = slots[name];
1543
- if (!slotContent) return null;
1544
- const parsed = context.parseMarkdown(slotContent);
1545
- return context.processAndRenderElements(parsed);
1813
+ if (!slotContent) return frag;
1814
+ const tokens = ctx.parseMarkdown(slotContent);
1815
+ frag.appendChild(ctx.renderElements(tokens));
1816
+ return frag;
1546
1817
  };
1547
1818
  const directiveProps = {
1548
1819
  directiveType,
1549
1820
  props,
1550
1821
  slots,
1551
1822
  renderSlot,
1552
- context,
1553
- index,
1554
- allElements
1823
+ context: ctx,
1824
+ index: 0,
1825
+ allElements,
1826
+ renderInline,
1827
+ renderMarkdown: ctx.renderMarkdown
1555
1828
  };
1556
- if (Component) {
1557
- return /* @__PURE__ */ jsx10(Component, { ...directiveProps }, index);
1829
+ if (renderer) {
1830
+ return renderer(directiveProps);
1558
1831
  }
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;
1832
+ const fallback = document.createElement("div");
1833
+ fallback.className = "nr-unknown-directive";
1834
+ fallback.appendChild(renderSlot("default"));
1835
+ return fallback;
1836
+ }
1603
1837
 
1604
1838
  // 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(() => {
1839
+ import { jsx } from "react/jsx-runtime";
1840
+ var CustomMarkdownRenderer = ({ content }) => {
1841
+ const containerRef = useRef2(null);
1842
+ useEffect3(() => {
1843
+ const container = containerRef.current;
1844
+ if (!container) return;
1845
+ container.replaceChildren();
1846
+ container.appendChild(renderMarkdownString(content));
1847
+ scanTailwindCDN();
1614
1848
  const handleHashChange = () => {
1615
1849
  const hash = window.location.hash;
1616
1850
  if (hash) {
1617
1851
  const parts = hash.split("#");
1618
- const id = parts[parts.length - 1];
1619
- scrollToId(id);
1852
+ scrollToId(parts[parts.length - 1]);
1620
1853
  }
1621
1854
  };
1622
1855
  handleHashChange();
1623
1856
  window.addEventListener("hashchange", handleHashChange);
1624
1857
  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) });
1858
+ }, [content]);
1859
+ return /* @__PURE__ */ jsx("div", { ref: containerRef });
1825
1860
  };
1826
1861
  var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
1827
1862
 
1828
1863
  // react/NReditor.tsx
1829
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1864
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
1830
1865
  var customSyntaxHighlighting = HighlightStyle.define([
1831
1866
  { tag: t2.heading, fontWeight: "bold", color: "var(--tc-heading, #e2e8f0)" },
1832
1867
  { tag: t2.quote, color: "var(--tc-quote, #94a3b8)", fontStyle: "italic" },
@@ -2279,9 +2314,9 @@ var NReditor = ({
2279
2314
  onGuide,
2280
2315
  onConfig
2281
2316
  }) => {
2282
- const editorRef = useRef6(null);
2283
- const [isAllFolded, setIsAllFolded] = useState5(false);
2284
- const [editorMode, setEditorMode] = useState5("editor");
2317
+ const editorRef = useRef3(null);
2318
+ const [isAllFolded, setIsAllFolded] = useState2(false);
2319
+ const [editorMode, setEditorMode] = useState2("split");
2285
2320
  const debouncedContent = useDebounce(value, debounceMs);
2286
2321
  useLazyTailwindCDN(tailwindCDN);
2287
2322
  const handleToggleFold = () => {
@@ -2294,7 +2329,7 @@ var NReditor = ({
2294
2329
  setIsAllFolded(true);
2295
2330
  }
2296
2331
  };
2297
- const extensions = React9.useMemo(
2332
+ const extensions = React2.useMemo(
2298
2333
  () => [
2299
2334
  customStreamParserV2,
2300
2335
  lineNumbers(),
@@ -2314,7 +2349,6 @@ var NReditor = ({
2314
2349
  customEditorTheme,
2315
2350
  syntaxHighlighting(customSyntaxHighlighting),
2316
2351
  EditorView.lineWrapping,
2317
- scrollPastEnd(),
2318
2352
  keymap.of([
2319
2353
  { key: "Ctrl-Shift-[", run: foldAll },
2320
2354
  { key: "Ctrl-Shift-]", run: unfoldAll }
@@ -2331,74 +2365,73 @@ var NReditor = ({
2331
2365
  { key: "split", icon: "vertical_split", label: "Split" },
2332
2366
  { key: "preview", icon: "visibility", label: "Preview" }
2333
2367
  ];
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(
2368
+ return /* @__PURE__ */ jsxs("div", { className: `nr-editor ${className || ""}`, children: [
2369
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar", children: [
2370
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar-left", children: [
2371
+ /* @__PURE__ */ jsx2(
2338
2372
  "button",
2339
2373
  {
2340
2374
  onClick: handleToggleFold,
2341
2375
  className: "nr-toolbar-btn nr-toolbar-btn-fold",
2342
2376
  title: isAllFolded ? "Expandir todo" : "Colapsar todo",
2343
2377
  "aria-label": isAllFolded ? "Expandir todo" : "Colapsar todo",
2344
- children: /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: isAllFolded ? "unfold_more" : "unfold_less" })
2378
+ children: /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: isAllFolded ? "unfold_more" : "unfold_less" })
2345
2379
  }
2346
2380
  ),
2347
- /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-divider" }),
2348
- /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-mode-group", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs8(
2381
+ /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-divider" }),
2382
+ /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-mode-group", children: modeButtons.map((btn) => /* @__PURE__ */ jsxs(
2349
2383
  "button",
2350
2384
  {
2351
2385
  onClick: () => setEditorMode(btn.key),
2352
2386
  className: `nr-toolbar-btn nr-toolbar-btn-mode ${editorMode === btn.key ? "nr-toolbar-btn-mode--active" : ""} ${btn.key === "split" ? "nr-toolbar-btn-split" : ""}`,
2353
2387
  title: btn.label,
2354
2388
  children: [
2355
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: btn.icon }),
2356
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: btn.label })
2389
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: btn.icon }),
2390
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: btn.label })
2357
2391
  ]
2358
2392
  },
2359
2393
  btn.key
2360
2394
  )) })
2361
2395
  ] }),
2362
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-toolbar-right", children: [
2363
- onGuide && /* @__PURE__ */ jsxs8(
2396
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-toolbar-right", children: [
2397
+ onGuide && /* @__PURE__ */ jsxs(
2364
2398
  "button",
2365
2399
  {
2366
2400
  onClick: onGuide,
2367
2401
  className: "nr-toolbar-btn nr-toolbar-btn-sm nr-toolbar-btn-guide",
2368
2402
  title: "Gu\xEDa de sintaxis",
2369
2403
  children: [
2370
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: "menu_book" }),
2371
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: "Gu\xEDa" })
2404
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: "menu_book" }),
2405
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: "Gu\xEDa" })
2372
2406
  ]
2373
2407
  }
2374
2408
  ),
2375
- onGuide && onConfig && /* @__PURE__ */ jsx13("div", { className: "nr-toolbar-divider" }),
2376
- onConfig && /* @__PURE__ */ jsxs8(
2409
+ onGuide && onConfig && /* @__PURE__ */ jsx2("div", { className: "nr-toolbar-divider" }),
2410
+ onConfig && /* @__PURE__ */ jsxs(
2377
2411
  "button",
2378
2412
  {
2379
2413
  onClick: onConfig,
2380
2414
  className: "nr-toolbar-btn nr-toolbar-btn-sm nr-toolbar-btn-config",
2381
2415
  title: "Configurar tema y metadata",
2382
2416
  children: [
2383
- /* @__PURE__ */ jsx13("span", { className: "material-symbols-rounded", children: "tune" }),
2384
- /* @__PURE__ */ jsx13("span", { className: "nr-toolbar-label", children: "Configurar" })
2417
+ /* @__PURE__ */ jsx2("span", { className: "material-icons-round", children: "tune" }),
2418
+ /* @__PURE__ */ jsx2("span", { className: "nr-toolbar-label", children: "Configurar" })
2385
2419
  ]
2386
2420
  }
2387
2421
  )
2388
2422
  ] })
2389
2423
  ] }),
2390
- /* @__PURE__ */ jsxs8("div", { className: "nr-editor-body", children: [
2391
- (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx13(
2424
+ /* @__PURE__ */ jsxs("div", { className: "nr-editor-body", children: [
2425
+ (editorMode === "editor" || editorMode === "split") && /* @__PURE__ */ jsx2(
2392
2426
  "div",
2393
2427
  {
2394
2428
  className: `nr-editor-pane ${editorMode === "split" ? "nr-editor-pane--half" : ""}`,
2395
- children: /* @__PURE__ */ jsx13(
2429
+ children: /* @__PURE__ */ jsx2(
2396
2430
  CodeMirror,
2397
2431
  {
2398
2432
  value,
2399
2433
  onChange,
2400
- className: "flex-1 min-h-0 min-w-0",
2401
- height: "100%",
2434
+ height: "auto",
2402
2435
  onCreateEditor: (view) => {
2403
2436
  editorRef.current = view;
2404
2437
  },
@@ -2411,11 +2444,11 @@ var NReditor = ({
2411
2444
  )
2412
2445
  }
2413
2446
  ),
2414
- (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx13(
2447
+ (editorMode === "preview" || editorMode === "split") && /* @__PURE__ */ jsx2(
2415
2448
  "div",
2416
2449
  {
2417
2450
  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 }) }) })
2451
+ children: /* @__PURE__ */ jsx2("div", { className: "nr-editor-prose", children: /* @__PURE__ */ jsx2("div", { className: "nr-prose", children: /* @__PURE__ */ jsx2(CustomMarkdownRenderer_default, { content: debouncedContent }) }) })
2419
2452
  }
2420
2453
  )
2421
2454
  ] })