@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.
- package/dist/NReditor.cjs +928 -895
- package/dist/NReditor.cjs.map +1 -1
- package/dist/NReditor.d.cts +1 -1
- package/dist/NReditor.d.ts +1 -1
- package/dist/NReditor.js +929 -896
- package/dist/NReditor.js.map +1 -1
- package/dist/admonition.css +55 -0
- package/dist/{markdown.css → base.css} +96 -126
- package/dist/blockquote.css +16 -0
- package/dist/button.css +32 -0
- package/dist/card.css +143 -0
- package/dist/codeblock.css +59 -0
- package/dist/core.cjs +9 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +9 -1
- package/dist/core.js.map +1 -1
- package/dist/details.css +45 -0
- package/dist/editor.css +56 -9
- package/dist/fonts/material-icons-round.woff2 +0 -0
- package/dist/index.cjs +929 -882
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -70
- package/dist/index.d.ts +41 -70
- package/dist/index.js +928 -876
- package/dist/index.js.map +1 -1
- package/dist/list.css +18 -0
- package/dist/modal.css +82 -0
- package/dist/react.cjs +929 -885
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +44 -73
- package/dist/react.d.ts +44 -73
- package/dist/react.js +928 -879
- package/dist/react.js.map +1 -1
- package/dist/slide.css +21 -0
- package/dist/table.css +36 -0
- package/dist/toc.css +45 -0
- package/dist/vanilla.cjs +123 -31
- package/dist/vanilla.cjs.map +1 -1
- package/dist/vanilla.css +32 -677
- package/dist/vanilla.d.cts +24 -2
- package/dist/vanilla.d.ts +24 -2
- package/dist/vanilla.js +119 -31
- package/dist/vanilla.js.map +1 -1
- package/dist/variables.css +90 -0
- package/dist/vue.cjs +1007 -1120
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +63 -214
- package/dist/vue.d.ts +63 -214
- package/dist/vue.js +1006 -1119
- package/dist/vue.js.map +1 -1
- package/editor.css +56 -9
- package/package.json +5 -10
- package/markdown.css +0 -344
package/dist/index.cjs
CHANGED
|
@@ -1572,15 +1572,10 @@ var require_core = __commonJS({
|
|
|
1572
1572
|
// index.ts
|
|
1573
1573
|
var index_exports = {};
|
|
1574
1574
|
__export(index_exports, {
|
|
1575
|
-
Admonition: () => Admonition,
|
|
1576
|
-
CodeBlock: () => CodeBlock,
|
|
1577
1575
|
CustomMarkdownRenderer: () => CustomMarkdownRenderer_default,
|
|
1578
|
-
Details: () => Details,
|
|
1579
|
-
IconRenderer: () => IconRenderer,
|
|
1580
|
-
Modal: () => Modal,
|
|
1581
1576
|
NRpreviewer: () => NRpreviewer_default,
|
|
1577
|
+
RawHtmlRenderer: () => RawHtmlRenderer_default,
|
|
1582
1578
|
extractAttributes: () => extractAttributes,
|
|
1583
|
-
extractHeaders: () => extractHeaders,
|
|
1584
1579
|
generateId: () => generateId,
|
|
1585
1580
|
generateScopeId: () => generateScopeId,
|
|
1586
1581
|
parseCssString: () => parseCssString,
|
|
@@ -1690,6 +1685,7 @@ function parseMarkdown(markdown2) {
|
|
|
1690
1685
|
if (!markdown2) return [];
|
|
1691
1686
|
const lines = markdown2.replace(/\r\n/g, "\n").replace(/\r/g, "").split("\n");
|
|
1692
1687
|
const result = [];
|
|
1688
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
1693
1689
|
let i = 0;
|
|
1694
1690
|
while (i < lines.length) {
|
|
1695
1691
|
const line = lines[i];
|
|
@@ -1699,7 +1695,14 @@ function parseMarkdown(markdown2) {
|
|
|
1699
1695
|
const level = match[1].length;
|
|
1700
1696
|
const rawText = match[2];
|
|
1701
1697
|
const { text: text2, classes: classes2, id: customId } = extractAttributes(rawText);
|
|
1702
|
-
const
|
|
1698
|
+
const baseId = customId || generateId(text2.replace(/->|<-/g, ""));
|
|
1699
|
+
let id2 = baseId;
|
|
1700
|
+
let n = 1;
|
|
1701
|
+
while (usedIds.has(id2)) {
|
|
1702
|
+
n++;
|
|
1703
|
+
id2 = `${baseId}-${n}`;
|
|
1704
|
+
}
|
|
1705
|
+
usedIds.add(id2);
|
|
1703
1706
|
result.push({ type: "header", level, text: text2, id: id2, classes: classes2 || void 0 });
|
|
1704
1707
|
i++;
|
|
1705
1708
|
continue;
|
|
@@ -2015,10 +2018,7 @@ function splitSlots(rawContent) {
|
|
|
2015
2018
|
}
|
|
2016
2019
|
|
|
2017
2020
|
// react/CustomMarkdownRenderer.tsx
|
|
2018
|
-
var
|
|
2019
|
-
|
|
2020
|
-
// react/ui-components.tsx
|
|
2021
|
-
var import_react = require("react");
|
|
2021
|
+
var import_react2 = require("react");
|
|
2022
2022
|
|
|
2023
2023
|
// node_modules/highlight.js/es/core.js
|
|
2024
2024
|
var import_core = __toESM(require_core(), 1);
|
|
@@ -10916,7 +10916,7 @@ function shell(hljs) {
|
|
|
10916
10916
|
};
|
|
10917
10917
|
}
|
|
10918
10918
|
|
|
10919
|
-
//
|
|
10919
|
+
// vanilla/highlightSetup.ts
|
|
10920
10920
|
core_default.registerLanguage("javascript", javascript);
|
|
10921
10921
|
core_default.registerLanguage("js", javascript);
|
|
10922
10922
|
core_default.registerLanguage("jsx", javascript);
|
|
@@ -10940,729 +10940,996 @@ core_default.registerLanguage("java", java);
|
|
|
10940
10940
|
core_default.registerLanguage("csharp", csharp);
|
|
10941
10941
|
core_default.registerLanguage("cs", csharp);
|
|
10942
10942
|
core_default.registerLanguage("cpp", cpp);
|
|
10943
|
-
core_default.registerLanguage("c", cpp);
|
|
10944
10943
|
core_default.registerLanguage("go", go);
|
|
10945
10944
|
core_default.registerLanguage("rust", rust);
|
|
10946
|
-
core_default.registerLanguage("rs", rust);
|
|
10947
10945
|
core_default.registerLanguage("php", php);
|
|
10948
10946
|
core_default.registerLanguage("ruby", ruby);
|
|
10949
|
-
core_default.registerLanguage("rb", ruby);
|
|
10950
10947
|
core_default.registerLanguage("swift", swift);
|
|
10951
10948
|
core_default.registerLanguage("kotlin", kotlin);
|
|
10952
|
-
core_default.registerLanguage("kt", kotlin);
|
|
10953
10949
|
core_default.registerLanguage("dart", dart);
|
|
10954
10950
|
core_default.registerLanguage("yaml", yaml);
|
|
10955
|
-
core_default.registerLanguage("yml", yaml);
|
|
10956
10951
|
core_default.registerLanguage("toml", ini);
|
|
10957
|
-
core_default.registerLanguage("ini", ini);
|
|
10958
10952
|
core_default.registerLanguage("dockerfile", dockerfile);
|
|
10959
|
-
core_default.registerLanguage("docker", dockerfile);
|
|
10960
10953
|
core_default.registerLanguage("diff", diff);
|
|
10961
10954
|
core_default.registerLanguage("shell", shell);
|
|
10962
10955
|
var highlightSetup_default = core_default;
|
|
10963
10956
|
|
|
10964
|
-
//
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10957
|
+
// vanilla/components.ts
|
|
10958
|
+
function createIcon(iconName, extraClasses) {
|
|
10959
|
+
const span = document.createElement("span");
|
|
10960
|
+
const cls = `nr-icon material-icons-round${extraClasses ? ` ${extraClasses}` : ""}`;
|
|
10961
|
+
span.className = cls;
|
|
10962
|
+
span.setAttribute("aria-hidden", "true");
|
|
10970
10963
|
const isCodepoint = /^[eE][0-9a-fA-F]{3,4}$/.test(iconName);
|
|
10971
10964
|
if (isCodepoint) {
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
className: baseClass,
|
|
10976
|
-
dangerouslySetInnerHTML: { __html: `&#x${iconName};` },
|
|
10977
|
-
"aria-hidden": "true"
|
|
10978
|
-
}
|
|
10979
|
-
);
|
|
10965
|
+
span.innerHTML = `&#x${iconName};`;
|
|
10966
|
+
} else {
|
|
10967
|
+
span.textContent = iconName;
|
|
10980
10968
|
}
|
|
10981
|
-
return
|
|
10982
|
-
}
|
|
10983
|
-
|
|
10984
|
-
const
|
|
10985
|
-
|
|
10969
|
+
return span;
|
|
10970
|
+
}
|
|
10971
|
+
function createCodeBlock(code, language, title) {
|
|
10972
|
+
const wrapper = document.createElement("div");
|
|
10973
|
+
wrapper.className = "nr-codeblock";
|
|
10986
10974
|
const lang = language?.split(/[\s{]/)[0]?.trim() || "";
|
|
10987
|
-
|
|
10975
|
+
if (title) {
|
|
10976
|
+
const header = document.createElement("div");
|
|
10977
|
+
header.className = "nr-codeblock__header";
|
|
10978
|
+
header.appendChild(createIcon("description"));
|
|
10979
|
+
const titleSpan = document.createElement("span");
|
|
10980
|
+
titleSpan.textContent = title;
|
|
10981
|
+
header.appendChild(titleSpan);
|
|
10982
|
+
wrapper.appendChild(header);
|
|
10983
|
+
}
|
|
10984
|
+
const pre = document.createElement("pre");
|
|
10985
|
+
pre.className = "nr-codeblock__pre";
|
|
10986
|
+
const codeEl = document.createElement("code");
|
|
10987
|
+
codeEl.className = `language-${lang || "plaintext"}`;
|
|
10988
10988
|
try {
|
|
10989
10989
|
if (lang && highlightSetup_default.getLanguage(lang)) {
|
|
10990
|
-
|
|
10990
|
+
codeEl.innerHTML = highlightSetup_default.highlight(code, { language: lang }).value;
|
|
10991
10991
|
} else {
|
|
10992
|
-
|
|
10992
|
+
codeEl.innerHTML = highlightSetup_default.highlightAuto(code).value;
|
|
10993
10993
|
}
|
|
10994
10994
|
} catch {
|
|
10995
|
-
|
|
10995
|
+
codeEl.textContent = code;
|
|
10996
10996
|
}
|
|
10997
|
-
|
|
10997
|
+
pre.appendChild(codeEl);
|
|
10998
|
+
wrapper.appendChild(pre);
|
|
10999
|
+
const copyBtn = document.createElement("button");
|
|
11000
|
+
copyBtn.className = "nr-codeblock__copy";
|
|
11001
|
+
copyBtn.title = "Copy code";
|
|
11002
|
+
const copyIcon = createIcon("content_copy");
|
|
11003
|
+
copyIcon.style.fontSize = "1rem";
|
|
11004
|
+
copyBtn.appendChild(copyIcon);
|
|
11005
|
+
let timer = null;
|
|
11006
|
+
copyBtn.addEventListener("click", () => {
|
|
10998
11007
|
navigator.clipboard.writeText(code);
|
|
10999
|
-
|
|
11000
|
-
if (
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded", style: { fontSize: "1rem" }, children: copied ? "check" : "content_copy" }) })
|
|
11010
|
-
] });
|
|
11011
|
-
};
|
|
11012
|
-
var defaultIcons = {
|
|
11008
|
+
copyIcon.textContent = "check";
|
|
11009
|
+
if (timer) clearTimeout(timer);
|
|
11010
|
+
timer = setTimeout(() => {
|
|
11011
|
+
copyIcon.textContent = "content_copy";
|
|
11012
|
+
}, 1800);
|
|
11013
|
+
});
|
|
11014
|
+
wrapper.appendChild(copyBtn);
|
|
11015
|
+
return wrapper;
|
|
11016
|
+
}
|
|
11017
|
+
var DEFAULT_ADMONITION_ICONS = {
|
|
11013
11018
|
note: "info",
|
|
11014
11019
|
info: "lightbulb",
|
|
11015
11020
|
warning: "warning",
|
|
11016
11021
|
danger: "report",
|
|
11017
|
-
greentext: "
|
|
11018
|
-
};
|
|
11019
|
-
var typeClasses = {
|
|
11020
|
-
note: "border-info/20 bg-info/5 text-info",
|
|
11021
|
-
info: "border-info/30 bg-info/10 text-info",
|
|
11022
|
-
warning: "border-amber-500/30 bg-amber-500/10 text-amber-500",
|
|
11023
|
-
danger: "border-danger/30 bg-danger/10 text-danger",
|
|
11024
|
-
greentext: "border-success/30 bg-success/10 text-success"
|
|
11022
|
+
greentext: "subdirectory_arrow_right"
|
|
11025
11023
|
};
|
|
11026
|
-
|
|
11027
|
-
const
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
);
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
}) => {
|
|
11051
|
-
const [isOpen, setIsOpen] = (0, import_react.useState)(defaultOpen);
|
|
11024
|
+
function createAdmonition(type, title, icon) {
|
|
11025
|
+
const el = document.createElement("div");
|
|
11026
|
+
el.className = `nr-admonition nr-admonition--${type || "note"}`;
|
|
11027
|
+
if (title) {
|
|
11028
|
+
const header = document.createElement("h5");
|
|
11029
|
+
header.className = "nr-admonition__title";
|
|
11030
|
+
const iconToRender = icon || DEFAULT_ADMONITION_ICONS[type] || "info";
|
|
11031
|
+
header.appendChild(createIcon(iconToRender, "nr-admonition__icon"));
|
|
11032
|
+
const titleSpan = document.createElement("span");
|
|
11033
|
+
titleSpan.textContent = title;
|
|
11034
|
+
header.appendChild(titleSpan);
|
|
11035
|
+
el.appendChild(header);
|
|
11036
|
+
}
|
|
11037
|
+
const body = document.createElement("div");
|
|
11038
|
+
body.className = "nr-admonition__body";
|
|
11039
|
+
el.appendChild(body);
|
|
11040
|
+
return el;
|
|
11041
|
+
}
|
|
11042
|
+
function createDetails(title, icon, defaultOpen) {
|
|
11043
|
+
const details = document.createElement("details");
|
|
11044
|
+
details.className = "nr-details";
|
|
11045
|
+
if (defaultOpen) details.open = true;
|
|
11046
|
+
const summary = document.createElement("summary");
|
|
11047
|
+
summary.className = "nr-details__summary";
|
|
11052
11048
|
const iconToRender = icon || "play_arrow";
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
extraClasses: `transition-transform ${isOpen ? "rotate-90" : ""}`
|
|
11074
|
-
}
|
|
11075
|
-
),
|
|
11076
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
|
|
11077
|
-
]
|
|
11078
|
-
}
|
|
11079
|
-
),
|
|
11080
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.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 })
|
|
11081
|
-
]
|
|
11082
|
-
}
|
|
11083
|
-
);
|
|
11084
|
-
};
|
|
11085
|
-
var Modal = ({ title, isOpen, onClose, children }) => {
|
|
11086
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: (open) => {
|
|
11087
|
-
if (!open) onClose();
|
|
11088
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Portal, { children: [
|
|
11089
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Backdrop, { className: "fixed inset-0 z-[9999] bg-black/60" }),
|
|
11090
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Viewport, { className: "fixed inset-0 z-[9999] flex items-center justify-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.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: [
|
|
11091
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between items-center p-4 border-b border-border bg-background-secondary-solid/20", children: [
|
|
11092
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Title, { className: "text-lg font-bold !m-0", children: title }),
|
|
11093
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.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__ */ (0, import_jsx_runtime.jsx)("span", { className: "material-symbols-rounded text-base", children: "close" }) })
|
|
11094
|
-
] }),
|
|
11095
|
-
/* @__PURE__ */ (0, import_jsx_runtime.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 })
|
|
11096
|
-
] }) })
|
|
11097
|
-
] }) });
|
|
11098
|
-
};
|
|
11099
|
-
|
|
11100
|
-
// react/renderers.tsx
|
|
11101
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
11102
|
-
function renderInline(text) {
|
|
11103
|
-
if (!text) return text;
|
|
11104
|
-
const parsePart = (part, key) => {
|
|
11105
|
-
let match2;
|
|
11106
|
-
if (match2 = part.match(/^\|\[([^\]]+)\]\|$/)) {
|
|
11107
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IconRenderer, { iconName: match2[1] }, key);
|
|
11108
|
-
}
|
|
11109
|
-
if (match2 = part.match(/^!~(.+?)~!$/)) {
|
|
11110
|
-
const content = match2[1];
|
|
11111
|
-
const parts = content.split(";");
|
|
11112
|
-
let color = "currentColor";
|
|
11113
|
-
let decorationStyle = "solid";
|
|
11114
|
-
let type = "underline";
|
|
11115
|
-
let textIndex = 0;
|
|
11116
|
-
if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
|
|
11117
|
-
color = parts[textIndex++];
|
|
11118
|
-
}
|
|
11119
|
-
if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
|
|
11120
|
-
decorationStyle = parts[textIndex++];
|
|
11121
|
-
}
|
|
11122
|
-
if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
|
|
11123
|
-
type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
|
|
11124
|
-
}
|
|
11125
|
-
const innerText = parts.slice(textIndex).join(";");
|
|
11126
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
11127
|
-
"span",
|
|
11128
|
-
{
|
|
11129
|
-
style: {
|
|
11130
|
-
textDecoration: `${type} ${decorationStyle} ${color}`,
|
|
11131
|
-
textDecorationThickness: "auto"
|
|
11132
|
-
},
|
|
11133
|
-
children: renderInline(innerText)
|
|
11134
|
-
},
|
|
11135
|
-
key
|
|
11136
|
-
);
|
|
11137
|
-
}
|
|
11138
|
-
if (match2 = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
|
|
11139
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: match2[1] }, children: renderInline(match2[2]) }, key);
|
|
11140
|
-
}
|
|
11141
|
-
if (match2 = part.match(/^!>([^<]+?)<!$/)) {
|
|
11142
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "bg-text-primary text-bg-primary px-1 rounded hover:bg-transparent transition-colors cursor-pointer", children: renderInline(match2[1]) }, key);
|
|
11143
|
-
}
|
|
11144
|
-
if (match2 = part.match(/^==(.+?)==$/)) {
|
|
11145
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("mark", { className: "bg-yellow-500/20 text-inherit px-0.5 rounded", children: renderInline(match2[1]) }, key);
|
|
11146
|
-
}
|
|
11147
|
-
if (match2 = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
|
|
11148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }) }, key);
|
|
11149
|
-
}
|
|
11150
|
-
if (match2 = part.match(/^\*\*(.+?)\*\*$/)) {
|
|
11151
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: renderInline(match2[1]) }, key);
|
|
11152
|
-
}
|
|
11153
|
-
if (match2 = part.match(/^_(.+?)_$/)) {
|
|
11154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("em", { children: renderInline(match2[1]) }, key);
|
|
11155
|
-
}
|
|
11156
|
-
if (match2 = part.match(/^~~(.+?)~~$/)) {
|
|
11157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("del", { children: renderInline(match2[1]) }, key);
|
|
11158
|
-
}
|
|
11159
|
-
if (match2 = part.match(/^`([^`]+)`$/)) {
|
|
11160
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("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);
|
|
11161
|
-
}
|
|
11162
|
-
if (match2 = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
|
|
11163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
11164
|
-
"a",
|
|
11165
|
-
{
|
|
11166
|
-
href: match2[2],
|
|
11167
|
-
className: "text-accent-primary underline decoration-accent-primary/40 hover:decoration-accent-primary transition-colors",
|
|
11168
|
-
target: "_blank",
|
|
11169
|
-
rel: "noopener noreferrer",
|
|
11170
|
-
children: renderInline(match2[1])
|
|
11171
|
-
},
|
|
11172
|
-
key
|
|
11173
|
-
);
|
|
11174
|
-
}
|
|
11175
|
-
if (part.startsWith("<") && part.endsWith(">")) {
|
|
11176
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { dangerouslySetInnerHTML: { __html: part } }, key);
|
|
11177
|
-
}
|
|
11178
|
-
return part;
|
|
11179
|
-
};
|
|
11180
|
-
const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
|
|
11181
|
-
const elements = [];
|
|
11182
|
-
let lastIndex = 0;
|
|
11183
|
-
let match;
|
|
11184
|
-
let keyCounter = 0;
|
|
11185
|
-
while ((match = regex.exec(text)) !== null) {
|
|
11186
|
-
if (match.index > lastIndex) {
|
|
11187
|
-
elements.push(text.slice(lastIndex, match.index));
|
|
11049
|
+
const iconEl = createIcon(iconToRender, "nr-details__icon");
|
|
11050
|
+
summary.appendChild(iconEl);
|
|
11051
|
+
const titleSpan = document.createElement("span");
|
|
11052
|
+
titleSpan.textContent = title || "Details";
|
|
11053
|
+
summary.appendChild(titleSpan);
|
|
11054
|
+
details.addEventListener("toggle", () => {
|
|
11055
|
+
iconEl.classList.toggle("nr-details__icon--open", details.open);
|
|
11056
|
+
});
|
|
11057
|
+
details.appendChild(summary);
|
|
11058
|
+
const body = document.createElement("div");
|
|
11059
|
+
body.className = "nr-details__body";
|
|
11060
|
+
details.appendChild(body);
|
|
11061
|
+
return details;
|
|
11062
|
+
}
|
|
11063
|
+
function createModal(title) {
|
|
11064
|
+
const dialog = document.createElement("dialog");
|
|
11065
|
+
dialog.className = "nr-modal";
|
|
11066
|
+
dialog.addEventListener("click", (e) => {
|
|
11067
|
+
if (e.target === dialog) {
|
|
11068
|
+
dialog.close();
|
|
11188
11069
|
}
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11070
|
+
});
|
|
11071
|
+
const popup = document.createElement("div");
|
|
11072
|
+
popup.className = "nr-modal__popup";
|
|
11073
|
+
const header = document.createElement("div");
|
|
11074
|
+
header.className = "nr-modal__header";
|
|
11075
|
+
const titleEl = document.createElement("h2");
|
|
11076
|
+
titleEl.className = "nr-modal__title";
|
|
11077
|
+
titleEl.textContent = title;
|
|
11078
|
+
header.appendChild(titleEl);
|
|
11079
|
+
const closeBtn = document.createElement("button");
|
|
11080
|
+
closeBtn.className = "nr-modal__close";
|
|
11081
|
+
closeBtn.appendChild(createIcon("close"));
|
|
11082
|
+
closeBtn.addEventListener("click", () => dialog.close());
|
|
11083
|
+
header.appendChild(closeBtn);
|
|
11084
|
+
popup.appendChild(header);
|
|
11085
|
+
const body = document.createElement("div");
|
|
11086
|
+
body.className = "nr-modal__body";
|
|
11087
|
+
popup.appendChild(body);
|
|
11088
|
+
dialog.appendChild(popup);
|
|
11089
|
+
return dialog;
|
|
11196
11090
|
}
|
|
11197
|
-
function
|
|
11091
|
+
function createTable(content, renderInline2) {
|
|
11198
11092
|
const rows = content.split("\n").filter((r) => r.trim());
|
|
11199
|
-
if (rows.length < 2)
|
|
11093
|
+
if (rows.length < 2) {
|
|
11094
|
+
const p = document.createElement("p");
|
|
11095
|
+
p.textContent = content;
|
|
11096
|
+
return p;
|
|
11097
|
+
}
|
|
11200
11098
|
const parseRow = (row) => row.split("|").map((c) => c.trim()).filter(Boolean);
|
|
11201
11099
|
const headerCells = parseRow(rows[0]);
|
|
11202
11100
|
const bodyRows = rows.slice(2).map(parseRow);
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11101
|
+
const wrapper = document.createElement("div");
|
|
11102
|
+
wrapper.className = "nr-table-wrap";
|
|
11103
|
+
const table = document.createElement("table");
|
|
11104
|
+
table.className = "nr-table";
|
|
11105
|
+
const thead = document.createElement("thead");
|
|
11106
|
+
const tr = document.createElement("tr");
|
|
11107
|
+
for (const cell of headerCells) {
|
|
11108
|
+
const th = document.createElement("th");
|
|
11109
|
+
th.className = "nr-table__th";
|
|
11110
|
+
th.appendChild(renderInline2(cell));
|
|
11111
|
+
tr.appendChild(th);
|
|
11112
|
+
}
|
|
11113
|
+
thead.appendChild(tr);
|
|
11114
|
+
table.appendChild(thead);
|
|
11115
|
+
const tbody = document.createElement("tbody");
|
|
11116
|
+
for (const cells of bodyRows) {
|
|
11117
|
+
const tr2 = document.createElement("tr");
|
|
11118
|
+
for (const cell of cells) {
|
|
11119
|
+
const td = document.createElement("td");
|
|
11120
|
+
td.className = "nr-table__td";
|
|
11121
|
+
td.appendChild(renderInline2(cell));
|
|
11122
|
+
tr2.appendChild(td);
|
|
11123
|
+
}
|
|
11124
|
+
tbody.appendChild(tr2);
|
|
11125
|
+
}
|
|
11126
|
+
table.appendChild(tbody);
|
|
11127
|
+
wrapper.appendChild(table);
|
|
11128
|
+
return wrapper;
|
|
11207
11129
|
}
|
|
11208
|
-
function
|
|
11130
|
+
function createList(content, renderInline2) {
|
|
11209
11131
|
const lines = content.split("\n");
|
|
11210
11132
|
const items = [];
|
|
11211
11133
|
for (const line of lines) {
|
|
11212
11134
|
if (!line.trim()) continue;
|
|
11213
11135
|
const match = line.match(/^(\s*)([-*+]|\d+\.)\s+(.+)$/);
|
|
11214
11136
|
if (match) {
|
|
11215
|
-
items.push({
|
|
11216
|
-
indent: match[1].length,
|
|
11217
|
-
marker: match[2],
|
|
11218
|
-
text: match[3]
|
|
11219
|
-
});
|
|
11137
|
+
items.push({ indent: match[1].length, marker: match[2], text: match[3] });
|
|
11220
11138
|
}
|
|
11221
11139
|
}
|
|
11222
|
-
if (items.length === 0)
|
|
11140
|
+
if (items.length === 0) {
|
|
11141
|
+
const p = document.createElement("p");
|
|
11142
|
+
p.textContent = content;
|
|
11143
|
+
return p;
|
|
11144
|
+
}
|
|
11223
11145
|
const isOrdered = /^\d+\.$/.test(items[0].marker);
|
|
11224
|
-
const
|
|
11225
|
-
|
|
11146
|
+
const list = document.createElement(isOrdered ? "ol" : "ul");
|
|
11147
|
+
list.className = "nr-list";
|
|
11148
|
+
for (const item of items) {
|
|
11149
|
+
const li = document.createElement("li");
|
|
11150
|
+
li.className = "nr-list__item";
|
|
11151
|
+
li.appendChild(renderInline2(item.text));
|
|
11152
|
+
list.appendChild(li);
|
|
11153
|
+
}
|
|
11154
|
+
return list;
|
|
11155
|
+
}
|
|
11156
|
+
function createTOC(headers, renderInline2) {
|
|
11157
|
+
const nav = document.createElement("nav");
|
|
11158
|
+
nav.className = "nr-toc";
|
|
11159
|
+
const title = document.createElement("div");
|
|
11160
|
+
title.className = "nr-toc__title";
|
|
11161
|
+
title.textContent = "Table of Contents";
|
|
11162
|
+
nav.appendChild(title);
|
|
11163
|
+
const ul = document.createElement("ul");
|
|
11164
|
+
ul.className = "nr-toc__list";
|
|
11165
|
+
for (const h of headers) {
|
|
11166
|
+
const li = document.createElement("li");
|
|
11167
|
+
li.className = `nr-toc__item nr-toc__item--h${h.level}`;
|
|
11168
|
+
const a = document.createElement("a");
|
|
11169
|
+
a.className = "nr-toc__link";
|
|
11170
|
+
a.href = `#${h.id}`;
|
|
11171
|
+
a.appendChild(renderInline2(h.text.replace(/->|<-/g, "").trim()));
|
|
11172
|
+
a.addEventListener("click", (e) => {
|
|
11173
|
+
e.preventDefault();
|
|
11174
|
+
const target = document.getElementById(h.id);
|
|
11175
|
+
if (target) target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
11176
|
+
});
|
|
11177
|
+
li.appendChild(a);
|
|
11178
|
+
ul.appendChild(li);
|
|
11179
|
+
}
|
|
11180
|
+
nav.appendChild(ul);
|
|
11181
|
+
return nav;
|
|
11226
11182
|
}
|
|
11227
|
-
function
|
|
11228
|
-
|
|
11183
|
+
function createBlockquote(content, classes, renderInline2) {
|
|
11184
|
+
const el = document.createElement("blockquote");
|
|
11185
|
+
el.className = `nr-blockquote${classes ? ` ${classes}` : ""}`;
|
|
11186
|
+
el.appendChild(renderInline2(content));
|
|
11187
|
+
return el;
|
|
11229
11188
|
}
|
|
11230
11189
|
|
|
11231
|
-
//
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
type: directiveType,
|
|
11242
|
-
title: props.title,
|
|
11243
|
-
icon: props.icon,
|
|
11244
|
-
className: props.class,
|
|
11245
|
-
style: props.style ? parseCssString(props.style) : void 0,
|
|
11246
|
-
children: renderSlot("default")
|
|
11190
|
+
// vanilla/inline.ts
|
|
11191
|
+
function renderInline(text) {
|
|
11192
|
+
const fragment = document.createDocumentFragment();
|
|
11193
|
+
if (!text) return fragment;
|
|
11194
|
+
const regex = /(\|\[[^\]]+\]\||\*\*\*.+?\*\*\*|\*\*.+?\*\*|_.+?_|~~.+?~~|`[^`]+?`|!~.+?~!|%[^%\s]+?%[\s\S]+?%%|!>.+?<!|==.+?==|\[[^\]]+?\]\([^)]+?\)|<[^>]+>)/g;
|
|
11195
|
+
let lastIndex = 0;
|
|
11196
|
+
let match;
|
|
11197
|
+
while ((match = regex.exec(text)) !== null) {
|
|
11198
|
+
if (match.index > lastIndex) {
|
|
11199
|
+
fragment.appendChild(document.createTextNode(text.slice(lastIndex, match.index)));
|
|
11247
11200
|
}
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11201
|
+
fragment.appendChild(parseInlinePart(match[0]));
|
|
11202
|
+
lastIndex = regex.lastIndex;
|
|
11203
|
+
}
|
|
11204
|
+
if (lastIndex < text.length) {
|
|
11205
|
+
fragment.appendChild(document.createTextNode(text.slice(lastIndex)));
|
|
11206
|
+
}
|
|
11207
|
+
return fragment;
|
|
11208
|
+
}
|
|
11209
|
+
function parseInlinePart(part) {
|
|
11210
|
+
let match;
|
|
11211
|
+
if (match = part.match(/^\|\[([^\]]+)\]\|$/)) {
|
|
11212
|
+
return createIcon(match[1]);
|
|
11213
|
+
}
|
|
11214
|
+
if (match = part.match(/^!~(.+?)~!$/)) {
|
|
11215
|
+
const content = match[1];
|
|
11216
|
+
const parts = content.split(";");
|
|
11217
|
+
let color = "currentColor";
|
|
11218
|
+
let decorationStyle = "solid";
|
|
11219
|
+
let type = "underline";
|
|
11220
|
+
let textIndex = 0;
|
|
11221
|
+
if (parts[textIndex]?.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/) || ["red", "blue", "green", "purple", "orange", "yellow", "pink"].includes(parts[textIndex])) {
|
|
11222
|
+
color = parts[textIndex++];
|
|
11223
|
+
}
|
|
11224
|
+
if (["solid", "double", "dotted", "dashed", "wavy"].includes(parts[textIndex])) {
|
|
11225
|
+
decorationStyle = parts[textIndex++];
|
|
11226
|
+
}
|
|
11227
|
+
if (["underline", "line-through", "overline", "both"].includes(parts[textIndex])) {
|
|
11228
|
+
type = parts[textIndex] === "both" ? "underline line-through" : parts[textIndex++];
|
|
11229
|
+
}
|
|
11230
|
+
const innerText = parts.slice(textIndex).join(";");
|
|
11231
|
+
const span = document.createElement("span");
|
|
11232
|
+
span.className = "nr-underline";
|
|
11233
|
+
span.style.textDecoration = `${type} ${decorationStyle} ${color}`;
|
|
11234
|
+
span.style.textDecorationThickness = "auto";
|
|
11235
|
+
span.appendChild(renderInline(innerText));
|
|
11236
|
+
return span;
|
|
11237
|
+
}
|
|
11238
|
+
if (match = part.match(/%([^%\s]+?)%([\s\S]+?)%%/)) {
|
|
11239
|
+
const span = document.createElement("span");
|
|
11240
|
+
span.style.color = match[1];
|
|
11241
|
+
span.appendChild(renderInline(match[2]));
|
|
11242
|
+
return span;
|
|
11243
|
+
}
|
|
11244
|
+
if (match = part.match(/^!>([^<]+?)<!$/)) {
|
|
11245
|
+
const span = document.createElement("span");
|
|
11246
|
+
span.className = "nr-spoiler";
|
|
11247
|
+
span.appendChild(renderInline(match[1]));
|
|
11248
|
+
return span;
|
|
11249
|
+
}
|
|
11250
|
+
if (match = part.match(/^==(.+?)==$/)) {
|
|
11251
|
+
const mark = document.createElement("mark");
|
|
11252
|
+
mark.className = "nr-highlight";
|
|
11253
|
+
mark.appendChild(renderInline(match[1]));
|
|
11254
|
+
return mark;
|
|
11255
|
+
}
|
|
11256
|
+
if (match = part.match(/^\*\*\*(.+?)\*\*\*$/)) {
|
|
11257
|
+
const strong = document.createElement("strong");
|
|
11258
|
+
const em = document.createElement("em");
|
|
11259
|
+
em.appendChild(renderInline(match[1]));
|
|
11260
|
+
strong.appendChild(em);
|
|
11261
|
+
return strong;
|
|
11262
|
+
}
|
|
11263
|
+
if (match = part.match(/^\*\*(.+?)\*\*$/)) {
|
|
11264
|
+
const strong = document.createElement("strong");
|
|
11265
|
+
strong.appendChild(renderInline(match[1]));
|
|
11266
|
+
return strong;
|
|
11267
|
+
}
|
|
11268
|
+
if (match = part.match(/^_(.+?)_$/)) {
|
|
11269
|
+
const em = document.createElement("em");
|
|
11270
|
+
em.appendChild(renderInline(match[1]));
|
|
11271
|
+
return em;
|
|
11272
|
+
}
|
|
11273
|
+
if (match = part.match(/^~~(.+?)~~$/)) {
|
|
11274
|
+
const del = document.createElement("del");
|
|
11275
|
+
del.appendChild(renderInline(match[1]));
|
|
11276
|
+
return del;
|
|
11277
|
+
}
|
|
11278
|
+
if (match = part.match(/^`([^`]+)`$/)) {
|
|
11279
|
+
const code = document.createElement("code");
|
|
11280
|
+
code.className = "nr-inline-code";
|
|
11281
|
+
code.textContent = match[1];
|
|
11282
|
+
return code;
|
|
11283
|
+
}
|
|
11284
|
+
if (match = part.match(/^\[([^\]]+?)\]\(([^)]+?)\)$/)) {
|
|
11285
|
+
const a = document.createElement("a");
|
|
11286
|
+
a.className = "nr-link";
|
|
11287
|
+
a.href = match[2];
|
|
11288
|
+
a.target = "_blank";
|
|
11289
|
+
a.rel = "noopener noreferrer";
|
|
11290
|
+
a.appendChild(renderInline(match[1]));
|
|
11291
|
+
return a;
|
|
11292
|
+
}
|
|
11293
|
+
if (part.startsWith("<") && part.endsWith(">")) {
|
|
11294
|
+
const span = document.createElement("span");
|
|
11295
|
+
span.innerHTML = part;
|
|
11296
|
+
return span;
|
|
11297
|
+
}
|
|
11298
|
+
return document.createTextNode(part);
|
|
11299
|
+
}
|
|
11251
11300
|
|
|
11252
|
-
//
|
|
11253
|
-
var
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
}) => {
|
|
11263
|
-
const stableId = (0, import_react2.useId)();
|
|
11264
|
-
const { title, image, icon, class: customClass, url, target } = props;
|
|
11265
|
-
const hasDescription = !!slots.description;
|
|
11266
|
-
const { isSingleCard } = options;
|
|
11267
|
-
const isModal = directiveType === "card-m";
|
|
11268
|
-
const isLink = directiveType === "card-b";
|
|
11269
|
-
const modalId = `modal-card-${props.id || stableId}`;
|
|
11270
|
-
const wrapperClass = customClass || "";
|
|
11271
|
-
const inlineStyles = props.style ? parseCssString(props.style) : {};
|
|
11272
|
-
const description = hasDescription ? renderSlot("description") : null;
|
|
11273
|
-
const content = renderSlot("content") || renderSlot("default");
|
|
11274
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react2.default.Fragment, { children: [
|
|
11275
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
11276
|
-
"div",
|
|
11277
|
-
{
|
|
11278
|
-
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}`,
|
|
11279
|
-
style: inlineStyles,
|
|
11280
|
-
onClick: isModal ? (e) => {
|
|
11281
|
-
e.preventDefault();
|
|
11282
|
-
e.stopPropagation();
|
|
11283
|
-
context.setModals((prev) => ({ ...prev, [modalId]: true }));
|
|
11284
|
-
} : isLink && url ? () => window.open(url, "_blank") : void 0,
|
|
11285
|
-
role: isModal ? "button" : void 0,
|
|
11286
|
-
tabIndex: isModal ? 0 : void 0,
|
|
11287
|
-
onKeyDown: isModal ? (e) => {
|
|
11288
|
-
if (e.key === "Enter" || e.key === " ") context.setModals((prev) => ({ ...prev, [modalId]: true }));
|
|
11289
|
-
} : void 0,
|
|
11290
|
-
children: [
|
|
11291
|
-
image && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `w-full ${isSingleCard ? "h-[240px]" : "h-[160px]"} overflow-hidden relative transition-all duration-500`, children: [
|
|
11292
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: image, alt: title || "", className: "w-full h-full object-cover !m-0" }),
|
|
11293
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-0 bg-gradient-to-t from-background-primary/40 to-transparent" })
|
|
11294
|
-
] }),
|
|
11295
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
|
|
11296
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-3 mb-3", children: [
|
|
11297
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: icon }) }),
|
|
11298
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-base font-black tracking-tight leading-tight !m-0", children: title })
|
|
11299
|
-
] }),
|
|
11300
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
11301
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-sm opacity-80 leading-relaxed font-medium", children: description }),
|
|
11302
|
-
directiveType === "card" && content && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-2", children: content })
|
|
11303
|
-
] }),
|
|
11304
|
-
(isModal || isLink) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-6 flex justify-end", children: isLink && url ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
11305
|
-
"a",
|
|
11306
|
-
{
|
|
11307
|
-
href: url,
|
|
11308
|
-
target: "_blank",
|
|
11309
|
-
rel: "noopener noreferrer",
|
|
11310
|
-
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",
|
|
11311
|
-
onClick: (e) => e.stopPropagation(),
|
|
11312
|
-
children: [
|
|
11313
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "open_in_new" }),
|
|
11314
|
-
" Link"
|
|
11315
|
-
]
|
|
11316
|
-
}
|
|
11317
|
-
) : isModal ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
|
|
11318
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconRenderer, { iconName: "arrow_forward" }),
|
|
11319
|
-
" Abrir"
|
|
11320
|
-
] }) : null })
|
|
11321
|
-
] })
|
|
11322
|
-
]
|
|
11323
|
-
}
|
|
11324
|
-
),
|
|
11325
|
-
isModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
11326
|
-
Modal,
|
|
11327
|
-
{
|
|
11328
|
-
title: title || "Detalles",
|
|
11329
|
-
isOpen: !!context.modals[modalId],
|
|
11330
|
-
onClose: () => context.setModals((prev) => ({ ...prev, [modalId]: false })),
|
|
11331
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "prose prose-sm max-w-none", children: content })
|
|
11332
|
-
}
|
|
11333
|
-
)
|
|
11334
|
-
] });
|
|
11301
|
+
// vanilla/directives/admonition.ts
|
|
11302
|
+
var admonitionDirective = ({ directiveType, props, renderSlot }) => {
|
|
11303
|
+
const el = createAdmonition(directiveType, props.title, props.icon);
|
|
11304
|
+
if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
|
|
11305
|
+
if (props.style) el.setAttribute("style", props.style);
|
|
11306
|
+
const body = el.querySelector(".nr-admonition__body");
|
|
11307
|
+
if (body) {
|
|
11308
|
+
body.appendChild(renderSlot("default"));
|
|
11309
|
+
}
|
|
11310
|
+
return el;
|
|
11335
11311
|
};
|
|
11336
|
-
var
|
|
11312
|
+
var admonition_default = admonitionDirective;
|
|
11337
11313
|
|
|
11338
|
-
//
|
|
11339
|
-
var
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
11345
|
-
Details,
|
|
11346
|
-
{
|
|
11347
|
-
title: props.title || "Details",
|
|
11348
|
-
icon: props.icon,
|
|
11349
|
-
defaultOpen: props.defaultOpen === "true",
|
|
11350
|
-
className: props.class,
|
|
11351
|
-
style: props.style ? parseCssString(props.style) : void 0,
|
|
11352
|
-
children: renderSlot("default")
|
|
11353
|
-
}
|
|
11314
|
+
// vanilla/directives/details.ts
|
|
11315
|
+
var detailsDirective = ({ props, renderSlot }) => {
|
|
11316
|
+
const el = createDetails(
|
|
11317
|
+
props.title || "Details",
|
|
11318
|
+
props.icon,
|
|
11319
|
+
props.defaultOpen === "true"
|
|
11354
11320
|
);
|
|
11321
|
+
if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
|
|
11322
|
+
if (props.style) el.setAttribute("style", props.style);
|
|
11323
|
+
const body = el.querySelector(".nr-details__body");
|
|
11324
|
+
if (body) {
|
|
11325
|
+
body.appendChild(renderSlot("default"));
|
|
11326
|
+
}
|
|
11327
|
+
return el;
|
|
11355
11328
|
};
|
|
11356
|
-
var
|
|
11329
|
+
var details_default = detailsDirective;
|
|
11357
11330
|
|
|
11358
|
-
//
|
|
11359
|
-
var
|
|
11360
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11361
|
-
var ModalDirective = ({
|
|
11362
|
-
props,
|
|
11363
|
-
renderSlot,
|
|
11364
|
-
context
|
|
11365
|
-
}) => {
|
|
11366
|
-
const stableId = (0, import_react3.useId)();
|
|
11367
|
-
const modalId = `modal-${props.id || stableId}`;
|
|
11331
|
+
// vanilla/directives/modal.ts
|
|
11332
|
+
var modalDirective = ({ props, renderSlot }) => {
|
|
11368
11333
|
const label = props.label || props.title || "Open";
|
|
11369
11334
|
const modalTitle = props.title || "Modal";
|
|
11370
11335
|
const customClass = props.class || "";
|
|
11371
|
-
const
|
|
11372
|
-
|
|
11373
|
-
const
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
const
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
const
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
title: modalTitle,
|
|
11400
|
-
isOpen: !!context.modals[modalId],
|
|
11401
|
-
onClose: handleClose,
|
|
11402
|
-
children: renderSlot("default")
|
|
11403
|
-
}
|
|
11404
|
-
)
|
|
11405
|
-
] });
|
|
11336
|
+
const wrapper = document.createElement("div");
|
|
11337
|
+
wrapper.className = "nr-modal-trigger";
|
|
11338
|
+
const btn = document.createElement("button");
|
|
11339
|
+
btn.className = `nr-button nr-button--default`;
|
|
11340
|
+
if (customClass) btn.classList.add(...customClass.split(/\s+/).filter(Boolean));
|
|
11341
|
+
const icon = props.icon || "open_in_new";
|
|
11342
|
+
if (icon) btn.appendChild(createIcon(icon));
|
|
11343
|
+
btn.appendChild(document.createTextNode(label));
|
|
11344
|
+
const dialog = createModal(modalTitle);
|
|
11345
|
+
const body = dialog.querySelector(".nr-modal__body");
|
|
11346
|
+
if (body) {
|
|
11347
|
+
const prose = document.createElement("div");
|
|
11348
|
+
prose.className = "nr-prose";
|
|
11349
|
+
prose.appendChild(renderSlot("default"));
|
|
11350
|
+
body.appendChild(prose);
|
|
11351
|
+
}
|
|
11352
|
+
btn.addEventListener("click", () => {
|
|
11353
|
+
if (!dialog.open) {
|
|
11354
|
+
document.body.appendChild(dialog);
|
|
11355
|
+
dialog.showModal();
|
|
11356
|
+
dialog.addEventListener("close", () => {
|
|
11357
|
+
dialog.remove();
|
|
11358
|
+
}, { once: true });
|
|
11359
|
+
}
|
|
11360
|
+
});
|
|
11361
|
+
wrapper.appendChild(btn);
|
|
11362
|
+
wrapper.appendChild(dialog);
|
|
11363
|
+
return wrapper;
|
|
11406
11364
|
};
|
|
11407
|
-
var
|
|
11365
|
+
var modal_default = modalDirective;
|
|
11408
11366
|
|
|
11409
|
-
//
|
|
11410
|
-
var
|
|
11411
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
11412
|
-
var ButtonDirective = ({
|
|
11413
|
-
props,
|
|
11414
|
-
renderSlot
|
|
11415
|
-
}) => {
|
|
11367
|
+
// vanilla/directives/button.ts
|
|
11368
|
+
var buttonDirective = ({ props, renderSlot }) => {
|
|
11416
11369
|
const url = props.url || props.href || "#";
|
|
11417
11370
|
const label = props.label;
|
|
11418
11371
|
const icon = props.icon || "near_me";
|
|
11419
11372
|
const target = props.target || "_blank";
|
|
11420
11373
|
const customClass = props.class || "";
|
|
11421
|
-
const
|
|
11422
|
-
|
|
11423
|
-
const hasDisplayClass = /\b(flex|inline-flex|block|inline-block|grid|inline-grid|hidden)\b/.test(customClass);
|
|
11424
|
-
const displayClass = hasDisplayClass ? "" : "inline-flex";
|
|
11425
|
-
const isInline = !customClass || !/\b(flex|block|grid)\b/.test(customClass) || /\binline-flex\b/.test(customClass);
|
|
11426
|
-
const marginClass = isInline ? "my-1 mx-1" : "my-4";
|
|
11427
|
-
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, " ");
|
|
11428
|
-
const btnClass = `${btnBase} ${customClass}`.trim();
|
|
11429
|
-
const positionMap = {
|
|
11430
|
-
"#left": "flex justify-start",
|
|
11431
|
-
"#center": "flex justify-center",
|
|
11432
|
-
"#right": "flex justify-end"
|
|
11433
|
-
};
|
|
11434
|
-
const wrapperClass = customClass.split(/\s+/).map((c) => positionMap[c] || c).join(" ");
|
|
11374
|
+
const wrapper = document.createElement("div");
|
|
11375
|
+
wrapper.className = "nr-button-wrap";
|
|
11435
11376
|
if (label) {
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
]
|
|
11447
|
-
}
|
|
11448
|
-
) });
|
|
11377
|
+
const a = document.createElement("a");
|
|
11378
|
+
a.href = url;
|
|
11379
|
+
a.target = target;
|
|
11380
|
+
a.rel = "noopener noreferrer";
|
|
11381
|
+
a.className = "nr-button nr-button--default";
|
|
11382
|
+
if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
|
|
11383
|
+
a.appendChild(createIcon(icon));
|
|
11384
|
+
a.appendChild(document.createTextNode(label));
|
|
11385
|
+
wrapper.appendChild(a);
|
|
11386
|
+
return wrapper;
|
|
11449
11387
|
}
|
|
11450
11388
|
const slotContent = renderSlot("default");
|
|
11451
|
-
const
|
|
11452
|
-
if (!element) return [];
|
|
11453
|
-
if (import_react4.default.isValidElement(element) && element.type === "a") {
|
|
11454
|
-
return [element];
|
|
11455
|
-
}
|
|
11456
|
-
if (Array.isArray(element)) {
|
|
11457
|
-
return element.flatMap(findLinks);
|
|
11458
|
-
}
|
|
11459
|
-
if (import_react4.default.isValidElement(element) && element.props.children) {
|
|
11460
|
-
return findLinks(element.props.children);
|
|
11461
|
-
}
|
|
11462
|
-
return [];
|
|
11463
|
-
};
|
|
11464
|
-
const links = findLinks(slotContent);
|
|
11389
|
+
const links = slotContent.querySelectorAll("a");
|
|
11465
11390
|
if (links.length > 0) {
|
|
11466
|
-
|
|
11467
|
-
(
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
)
|
|
11391
|
+
links.forEach((link) => {
|
|
11392
|
+
link.classList.add("nr-button", "nr-button--default");
|
|
11393
|
+
if (customClass) link.classList.add(...customClass.split(/\s+/).filter(Boolean));
|
|
11394
|
+
});
|
|
11395
|
+
wrapper.appendChild(slotContent);
|
|
11396
|
+
} else {
|
|
11397
|
+
const a = document.createElement("a");
|
|
11398
|
+
a.href = url;
|
|
11399
|
+
a.target = target;
|
|
11400
|
+
a.rel = "noopener noreferrer";
|
|
11401
|
+
a.className = "nr-button nr-button--default";
|
|
11402
|
+
if (customClass) a.classList.add(...customClass.split(/\s+/).filter(Boolean));
|
|
11403
|
+
a.appendChild(createIcon(icon));
|
|
11404
|
+
a.appendChild(slotContent);
|
|
11405
|
+
wrapper.appendChild(a);
|
|
11481
11406
|
}
|
|
11482
|
-
return
|
|
11483
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconRenderer, { iconName: icon }),
|
|
11484
|
-
slotContent
|
|
11485
|
-
] }) });
|
|
11407
|
+
return wrapper;
|
|
11486
11408
|
};
|
|
11487
|
-
var
|
|
11409
|
+
var button_default = buttonDirective;
|
|
11488
11410
|
|
|
11489
|
-
//
|
|
11490
|
-
var
|
|
11491
|
-
|
|
11411
|
+
// vanilla/directives/card.ts
|
|
11412
|
+
var cardDirective = ({
|
|
11413
|
+
directiveType,
|
|
11492
11414
|
props,
|
|
11493
|
-
|
|
11415
|
+
slots,
|
|
11416
|
+
renderSlot,
|
|
11417
|
+
options
|
|
11494
11418
|
}) => {
|
|
11495
|
-
const
|
|
11496
|
-
const
|
|
11497
|
-
const
|
|
11498
|
-
const
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11419
|
+
const { title, image, icon, url, target } = props;
|
|
11420
|
+
const customClass = props.class || "";
|
|
11421
|
+
const hasDescription = !!slots.description;
|
|
11422
|
+
const { isSingleCard } = options || {};
|
|
11423
|
+
const isModal = directiveType === "card-m";
|
|
11424
|
+
const isLink = directiveType === "card-b";
|
|
11425
|
+
const inlineStyles = props.style ? parseCssString(props.style) : {};
|
|
11426
|
+
const card = document.createElement("div");
|
|
11427
|
+
card.className = `nr-card${isModal || isLink ? " nr-card--interactive" : ""} ${customClass}`.trim();
|
|
11428
|
+
for (const [key, value] of Object.entries(inlineStyles)) {
|
|
11429
|
+
card.style.setProperty(key, String(value));
|
|
11430
|
+
}
|
|
11431
|
+
if (image) {
|
|
11432
|
+
const imgWrap = document.createElement("div");
|
|
11433
|
+
imgWrap.className = `nr-card__image${isSingleCard ? " nr-card__image--tall" : ""}`;
|
|
11434
|
+
const img = document.createElement("img");
|
|
11435
|
+
img.src = image;
|
|
11436
|
+
img.alt = title || "";
|
|
11437
|
+
img.className = "nr-card__img";
|
|
11438
|
+
imgWrap.appendChild(img);
|
|
11439
|
+
const gradient = document.createElement("div");
|
|
11440
|
+
gradient.className = "nr-card__gradient";
|
|
11441
|
+
imgWrap.appendChild(gradient);
|
|
11442
|
+
card.appendChild(imgWrap);
|
|
11443
|
+
}
|
|
11444
|
+
const body = document.createElement("div");
|
|
11445
|
+
body.className = `nr-card__body${image ? " nr-card__body--overlap" : ""}`;
|
|
11446
|
+
if (icon || title) {
|
|
11447
|
+
const header = document.createElement("div");
|
|
11448
|
+
header.className = "nr-card__header";
|
|
11449
|
+
if (icon) {
|
|
11450
|
+
const iconWrap = document.createElement("div");
|
|
11451
|
+
iconWrap.className = "nr-card__icon-wrap";
|
|
11452
|
+
iconWrap.appendChild(createIcon(icon));
|
|
11453
|
+
header.appendChild(iconWrap);
|
|
11454
|
+
}
|
|
11455
|
+
if (title) {
|
|
11456
|
+
const h3 = document.createElement("h3");
|
|
11457
|
+
h3.className = "nr-card__title";
|
|
11458
|
+
h3.textContent = title;
|
|
11459
|
+
header.appendChild(h3);
|
|
11460
|
+
}
|
|
11461
|
+
body.appendChild(header);
|
|
11462
|
+
}
|
|
11463
|
+
if (hasDescription) {
|
|
11464
|
+
const desc = document.createElement("div");
|
|
11465
|
+
desc.className = "nr-card__description";
|
|
11466
|
+
desc.appendChild(renderSlot("description"));
|
|
11467
|
+
body.appendChild(desc);
|
|
11468
|
+
}
|
|
11469
|
+
if (directiveType === "card") {
|
|
11470
|
+
const contentSlot = renderSlot("content") || renderSlot("default");
|
|
11471
|
+
if (contentSlot.childNodes.length > 0) {
|
|
11472
|
+
const contentDiv = document.createElement("div");
|
|
11473
|
+
contentDiv.className = "nr-card__content";
|
|
11474
|
+
contentDiv.appendChild(contentSlot);
|
|
11475
|
+
body.appendChild(contentDiv);
|
|
11476
|
+
}
|
|
11477
|
+
}
|
|
11478
|
+
if (isModal || isLink) {
|
|
11479
|
+
const action = document.createElement("div");
|
|
11480
|
+
action.className = "nr-card__action";
|
|
11481
|
+
if (isLink && url) {
|
|
11482
|
+
const a = document.createElement("a");
|
|
11483
|
+
a.href = url;
|
|
11484
|
+
a.target = target || "_blank";
|
|
11485
|
+
a.rel = "noopener noreferrer";
|
|
11486
|
+
a.className = "nr-card__action-link";
|
|
11487
|
+
a.appendChild(createIcon("open_in_new"));
|
|
11488
|
+
a.appendChild(document.createTextNode(" Link"));
|
|
11489
|
+
action.appendChild(a);
|
|
11490
|
+
} else if (isModal) {
|
|
11491
|
+
const modalBtn = document.createElement("div");
|
|
11492
|
+
modalBtn.className = "nr-card__action-link";
|
|
11493
|
+
modalBtn.appendChild(createIcon("arrow_forward"));
|
|
11494
|
+
modalBtn.appendChild(document.createTextNode(" Abrir"));
|
|
11495
|
+
action.appendChild(modalBtn);
|
|
11496
|
+
}
|
|
11497
|
+
body.appendChild(action);
|
|
11498
|
+
}
|
|
11499
|
+
card.appendChild(body);
|
|
11500
|
+
if (isModal) {
|
|
11501
|
+
const dialog = createModal(title || "Detalles");
|
|
11502
|
+
const modalBody = dialog.querySelector(".nr-modal__body");
|
|
11503
|
+
if (modalBody) {
|
|
11504
|
+
const prose = document.createElement("div");
|
|
11505
|
+
prose.className = "nr-prose";
|
|
11506
|
+
prose.appendChild(renderSlot("content") || renderSlot("default"));
|
|
11507
|
+
modalBody.appendChild(prose);
|
|
11508
|
+
}
|
|
11509
|
+
card.addEventListener("click", () => {
|
|
11510
|
+
if (!dialog.open) {
|
|
11511
|
+
document.body.appendChild(dialog);
|
|
11512
|
+
dialog.showModal();
|
|
11513
|
+
dialog.addEventListener("close", () => dialog.remove(), { once: true });
|
|
11514
|
+
}
|
|
11515
|
+
});
|
|
11516
|
+
const frag = document.createDocumentFragment();
|
|
11517
|
+
frag.appendChild(card);
|
|
11518
|
+
frag.appendChild(dialog);
|
|
11519
|
+
return frag;
|
|
11520
|
+
}
|
|
11521
|
+
if (isLink && url) {
|
|
11522
|
+
card.addEventListener("click", () => window.open(url, target || "_blank"));
|
|
11523
|
+
}
|
|
11524
|
+
return card;
|
|
11525
|
+
};
|
|
11526
|
+
var card_default = cardDirective;
|
|
11527
|
+
|
|
11528
|
+
// vanilla/directives/wrapper.ts
|
|
11529
|
+
var wrapperDirective = ({ props, renderSlot }) => {
|
|
11530
|
+
const el = document.createElement("div");
|
|
11531
|
+
el.className = "nr-wrapper";
|
|
11532
|
+
if (props.class) el.classList.add(...props.class.split(/\s+/).filter(Boolean));
|
|
11533
|
+
if (props.id) el.id = props.id;
|
|
11534
|
+
if (props.style) {
|
|
11535
|
+
const styles = parseCssString(props.style);
|
|
11536
|
+
for (const [key, value] of Object.entries(styles)) {
|
|
11537
|
+
el.style.setProperty(key, String(value));
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11502
11540
|
for (const [key, value] of Object.entries(props)) {
|
|
11503
11541
|
if (key.startsWith("data-")) {
|
|
11504
|
-
|
|
11542
|
+
el.setAttribute(key, value);
|
|
11505
11543
|
}
|
|
11506
11544
|
}
|
|
11507
|
-
|
|
11545
|
+
el.appendChild(renderSlot("default"));
|
|
11546
|
+
return el;
|
|
11508
11547
|
};
|
|
11509
|
-
var
|
|
11548
|
+
var wrapper_default = wrapperDirective;
|
|
11510
11549
|
|
|
11511
|
-
//
|
|
11512
|
-
var import_react5 = require("react");
|
|
11513
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
11550
|
+
// vanilla/directives/slide.ts
|
|
11514
11551
|
var slideCounter = 0;
|
|
11515
|
-
var
|
|
11552
|
+
var slideDirective = ({
|
|
11516
11553
|
props,
|
|
11517
|
-
|
|
11518
|
-
|
|
11554
|
+
slots,
|
|
11555
|
+
renderInline: renderInline2,
|
|
11556
|
+
renderMarkdown
|
|
11519
11557
|
}) => {
|
|
11520
11558
|
const rawContent = slots.default || "";
|
|
11521
11559
|
const lines = rawContent.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
11522
|
-
|
|
11523
|
-
|
|
11560
|
+
if (lines.length === 0) {
|
|
11561
|
+
return document.createDocumentFragment();
|
|
11562
|
+
}
|
|
11524
11563
|
const interval = parseInt(props.interval || "3000", 10);
|
|
11525
11564
|
const speed = parseInt(props.speed || "500", 10);
|
|
11526
|
-
const elRefs = (0, import_react5.useRef)([]);
|
|
11527
|
-
const [maxH, setMaxH] = (0, import_react5.useState)(0);
|
|
11528
|
-
(0, import_react5.useLayoutEffect)(() => {
|
|
11529
|
-
let h = 0;
|
|
11530
|
-
elRefs.current.forEach((el) => {
|
|
11531
|
-
if (el) h = Math.max(h, el.offsetHeight);
|
|
11532
|
-
});
|
|
11533
|
-
if (h > 0) setMaxH(h);
|
|
11534
|
-
}, [elements]);
|
|
11535
|
-
const cycle = (0, import_react5.useCallback)(() => {
|
|
11536
|
-
if (elements.length <= 1) return;
|
|
11537
|
-
setCurrent((prev) => (prev + 1) % elements.length);
|
|
11538
|
-
}, [elements.length]);
|
|
11539
|
-
(0, import_react5.useEffect)(() => {
|
|
11540
|
-
if (elements.length <= 1) return;
|
|
11541
|
-
const id = setInterval(cycle, interval);
|
|
11542
|
-
return () => clearInterval(id);
|
|
11543
|
-
}, [cycle, interval, elements.length]);
|
|
11544
|
-
if (elements.length === 0) return null;
|
|
11545
11565
|
const rawClass = props.class || "";
|
|
11546
11566
|
const inlineStyle = props.style ? parseCssString(props.style) : {};
|
|
11547
|
-
const textSizeMap = {
|
|
11548
|
-
"text-xs": "0.75rem",
|
|
11549
|
-
"text-sm": "0.875rem",
|
|
11550
|
-
"text-base": "1rem",
|
|
11551
|
-
"text-lg": "1.125rem",
|
|
11552
|
-
"text-xl": "1.25rem",
|
|
11553
|
-
"text-2xl": "1.5rem",
|
|
11554
|
-
"text-3xl": "1.875rem",
|
|
11555
|
-
"text-4xl": "2.25rem",
|
|
11556
|
-
"text-5xl": "3rem",
|
|
11557
|
-
"text-6xl": "3.75rem",
|
|
11558
|
-
"text-7xl": "4.5rem",
|
|
11559
|
-
"text-8xl": "6rem",
|
|
11560
|
-
"text-9xl": "8rem"
|
|
11561
|
-
};
|
|
11562
|
-
const textSizeMatch = rawClass.match(/\btext-(xs|sm|base|lg|xl|[2-9]xl)\b/);
|
|
11563
|
-
const forcedFontSize = textSizeMatch ? textSizeMap[textSizeMatch[0]] : null;
|
|
11564
11567
|
const scopeClass = `sld-${++slideCounter}`;
|
|
11565
|
-
const
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
{
|
|
11587
|
-
ref: (el) => {
|
|
11588
|
-
elRefs.current[i] = el;
|
|
11589
|
-
},
|
|
11590
|
-
style: maxH ? { height: maxH, display: "flex", alignItems: "center", overflow: "hidden" } : { display: "flex", alignItems: "center" },
|
|
11591
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${scopeClass} ${className}`, style: { width: "100%" }, children: context.processAndRenderElements(tokens) })
|
|
11592
|
-
},
|
|
11593
|
-
i
|
|
11594
|
-
))
|
|
11595
|
-
}
|
|
11596
|
-
)
|
|
11597
|
-
]
|
|
11568
|
+
const container = document.createElement("div");
|
|
11569
|
+
container.className = "nr-slide";
|
|
11570
|
+
Object.assign(container.style, {
|
|
11571
|
+
position: "relative",
|
|
11572
|
+
overflow: "hidden",
|
|
11573
|
+
...inlineStyle
|
|
11574
|
+
});
|
|
11575
|
+
const track = document.createElement("div");
|
|
11576
|
+
track.className = "nr-slide__track";
|
|
11577
|
+
track.style.transition = `transform ${speed}ms cubic-bezier(0.16, 1, 0.3, 1)`;
|
|
11578
|
+
const slideEls = [];
|
|
11579
|
+
for (const line of lines) {
|
|
11580
|
+
const slideEl = document.createElement("div");
|
|
11581
|
+
slideEl.className = `nr-slide__item ${scopeClass} ${rawClass}`.trim();
|
|
11582
|
+
slideEl.style.display = "flex";
|
|
11583
|
+
slideEl.style.alignItems = "center";
|
|
11584
|
+
if (renderMarkdown) {
|
|
11585
|
+
const tokens = renderMarkdown(line);
|
|
11586
|
+
slideEl.appendChild(tokens);
|
|
11587
|
+
} else if (renderInline2) {
|
|
11588
|
+
slideEl.appendChild(renderInline2(line));
|
|
11598
11589
|
}
|
|
11599
|
-
|
|
11590
|
+
track.appendChild(slideEl);
|
|
11591
|
+
slideEls.push(slideEl);
|
|
11592
|
+
}
|
|
11593
|
+
container.appendChild(track);
|
|
11594
|
+
let current = 0;
|
|
11595
|
+
let maxH = 0;
|
|
11596
|
+
const measureAndSetHeight = () => {
|
|
11597
|
+
maxH = 0;
|
|
11598
|
+
for (const el of slideEls) {
|
|
11599
|
+
maxH = Math.max(maxH, el.offsetHeight);
|
|
11600
|
+
}
|
|
11601
|
+
if (maxH > 0) {
|
|
11602
|
+
container.style.height = `${maxH}px`;
|
|
11603
|
+
for (const el of slideEls) {
|
|
11604
|
+
el.style.height = `${maxH}px`;
|
|
11605
|
+
}
|
|
11606
|
+
}
|
|
11607
|
+
};
|
|
11608
|
+
requestAnimationFrame(() => {
|
|
11609
|
+
measureAndSetHeight();
|
|
11610
|
+
if (document.fonts?.ready) {
|
|
11611
|
+
document.fonts.ready.then(measureAndSetHeight);
|
|
11612
|
+
}
|
|
11613
|
+
});
|
|
11614
|
+
if (lines.length > 1) {
|
|
11615
|
+
setInterval(() => {
|
|
11616
|
+
current = (current + 1) % lines.length;
|
|
11617
|
+
track.style.transform = `translateY(${-current * maxH}px)`;
|
|
11618
|
+
}, interval);
|
|
11619
|
+
}
|
|
11620
|
+
return container;
|
|
11600
11621
|
};
|
|
11601
|
-
var
|
|
11622
|
+
var slide_default = slideDirective;
|
|
11602
11623
|
|
|
11603
|
-
//
|
|
11624
|
+
// vanilla/directives/index.ts
|
|
11604
11625
|
var directiveRegistry = {
|
|
11605
11626
|
// Admonitions
|
|
11606
|
-
note:
|
|
11607
|
-
info:
|
|
11608
|
-
warning:
|
|
11609
|
-
danger:
|
|
11610
|
-
greentext:
|
|
11627
|
+
note: admonition_default,
|
|
11628
|
+
info: admonition_default,
|
|
11629
|
+
warning: admonition_default,
|
|
11630
|
+
danger: admonition_default,
|
|
11631
|
+
greentext: admonition_default,
|
|
11611
11632
|
// Cards
|
|
11612
|
-
card:
|
|
11613
|
-
"card-m":
|
|
11614
|
-
"card-b":
|
|
11633
|
+
card: card_default,
|
|
11634
|
+
"card-m": card_default,
|
|
11635
|
+
"card-b": card_default,
|
|
11615
11636
|
// Interactive
|
|
11616
|
-
details:
|
|
11617
|
-
modal:
|
|
11618
|
-
button:
|
|
11637
|
+
details: details_default,
|
|
11638
|
+
modal: modal_default,
|
|
11639
|
+
button: button_default,
|
|
11619
11640
|
// Layout / generic wrappers
|
|
11620
|
-
div:
|
|
11621
|
-
style:
|
|
11622
|
-
custom:
|
|
11623
|
-
raw:
|
|
11641
|
+
div: wrapper_default,
|
|
11642
|
+
style: wrapper_default,
|
|
11643
|
+
custom: wrapper_default,
|
|
11644
|
+
raw: wrapper_default,
|
|
11624
11645
|
// Animation
|
|
11625
|
-
slide:
|
|
11646
|
+
slide: slide_default
|
|
11626
11647
|
};
|
|
11627
11648
|
var directives_default = directiveRegistry;
|
|
11628
11649
|
|
|
11629
|
-
//
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11650
|
+
// vanilla/renderer.ts
|
|
11651
|
+
function renderTokens(tokens) {
|
|
11652
|
+
const article = document.createElement("article");
|
|
11653
|
+
article.className = "nr-prose";
|
|
11654
|
+
const ctx = {
|
|
11655
|
+
parseMarkdown,
|
|
11656
|
+
renderElements: (tks) => renderTokensInner(tks, ctx),
|
|
11657
|
+
renderInline,
|
|
11658
|
+
renderMarkdown: (md) => renderTokensInner(parseMarkdown(md), ctx)
|
|
11659
|
+
};
|
|
11660
|
+
article.appendChild(processElements(tokens, ctx, tokens));
|
|
11661
|
+
return article;
|
|
11662
|
+
}
|
|
11663
|
+
function renderMarkdownString(markdown2) {
|
|
11664
|
+
const tokens = parseMarkdown(markdown2);
|
|
11665
|
+
return renderTokens(tokens);
|
|
11666
|
+
}
|
|
11667
|
+
function renderHtmlString(html) {
|
|
11668
|
+
let processedContent = html;
|
|
11669
|
+
processedContent = processedContent.replace(
|
|
11670
|
+
/<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
|
|
11671
|
+
(_match, cssContent) => {
|
|
11672
|
+
const styleEl = document.createElement("style");
|
|
11673
|
+
styleEl.setAttribute("data-nr-global", "");
|
|
11674
|
+
styleEl.textContent = cssContent;
|
|
11675
|
+
document.head.appendChild(styleEl);
|
|
11676
|
+
return "";
|
|
11677
|
+
}
|
|
11678
|
+
);
|
|
11679
|
+
const wrapper = document.createElement("div");
|
|
11680
|
+
wrapper.className = "nr-raw-html";
|
|
11681
|
+
wrapper.innerHTML = processedContent;
|
|
11682
|
+
const scripts = wrapper.querySelectorAll("script");
|
|
11683
|
+
scripts.forEach((oldScript) => {
|
|
11684
|
+
const newScript = document.createElement("script");
|
|
11685
|
+
Array.from(oldScript.attributes).forEach(
|
|
11686
|
+
(attr) => newScript.setAttribute(attr.name, attr.value)
|
|
11687
|
+
);
|
|
11688
|
+
newScript.textContent = oldScript.textContent;
|
|
11689
|
+
oldScript.parentNode?.replaceChild(newScript, oldScript);
|
|
11690
|
+
});
|
|
11691
|
+
return wrapper;
|
|
11692
|
+
}
|
|
11693
|
+
function renderTokensInner(tokens, ctx) {
|
|
11694
|
+
const container = document.createElement("div");
|
|
11695
|
+
container.appendChild(processElements(tokens, ctx, tokens));
|
|
11696
|
+
return container;
|
|
11697
|
+
}
|
|
11698
|
+
function processElements(elements, ctx, allElements) {
|
|
11699
|
+
const fragment = document.createDocumentFragment();
|
|
11700
|
+
let i = 0;
|
|
11701
|
+
while (i < elements.length) {
|
|
11702
|
+
const el = elements[i];
|
|
11703
|
+
if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
|
|
11704
|
+
const cards = [];
|
|
11705
|
+
while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
|
|
11706
|
+
cards.push(elements[i]);
|
|
11707
|
+
i++;
|
|
11708
|
+
}
|
|
11709
|
+
if (cards.length === 1 || cards[0].props?.batch === "off") {
|
|
11710
|
+
for (const card of cards) {
|
|
11711
|
+
const rendered = renderElement(card, ctx, allElements);
|
|
11712
|
+
if (rendered) fragment.appendChild(rendered);
|
|
11713
|
+
}
|
|
11714
|
+
} else {
|
|
11715
|
+
const grid = document.createElement("div");
|
|
11716
|
+
grid.className = "nr-card-grid";
|
|
11717
|
+
for (const card of cards) {
|
|
11718
|
+
const rendered = renderElement(card, ctx, allElements);
|
|
11719
|
+
if (rendered) grid.appendChild(rendered);
|
|
11720
|
+
}
|
|
11721
|
+
fragment.appendChild(grid);
|
|
11722
|
+
}
|
|
11723
|
+
} else {
|
|
11724
|
+
const rendered = renderElement(el, ctx, allElements);
|
|
11725
|
+
if (rendered) fragment.appendChild(rendered);
|
|
11726
|
+
i++;
|
|
11727
|
+
}
|
|
11728
|
+
}
|
|
11729
|
+
return fragment;
|
|
11730
|
+
}
|
|
11731
|
+
function renderElement(element, ctx, allElements) {
|
|
11732
|
+
switch (element.type) {
|
|
11733
|
+
case "header": {
|
|
11734
|
+
const tag = `h${element.level}`;
|
|
11735
|
+
let text = element.text;
|
|
11736
|
+
const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
|
|
11737
|
+
const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
|
|
11738
|
+
if (alignCenter) text = alignCenter[1];
|
|
11739
|
+
else if (alignRight) text = alignRight[1];
|
|
11740
|
+
const h = document.createElement(tag);
|
|
11741
|
+
h.id = element.id;
|
|
11742
|
+
let cls = `md-h${element.level}`;
|
|
11743
|
+
if (alignCenter) cls += " text-center";
|
|
11744
|
+
if (alignRight) cls += " text-right";
|
|
11745
|
+
if (element.classes) cls += ` ${element.classes}`;
|
|
11746
|
+
h.className = cls;
|
|
11747
|
+
h.appendChild(renderInline(text));
|
|
11748
|
+
return h;
|
|
11749
|
+
}
|
|
11750
|
+
case "paragraph": {
|
|
11751
|
+
const p = document.createElement("p");
|
|
11752
|
+
let cls = "md-p";
|
|
11753
|
+
if (element.classes) cls += ` ${element.classes}`;
|
|
11754
|
+
if (element.align) cls += ` text-${element.align}`;
|
|
11755
|
+
p.className = cls;
|
|
11756
|
+
if (element.id) p.id = element.id;
|
|
11757
|
+
const lines = element.content.split("\n");
|
|
11758
|
+
for (let li = 0; li < lines.length; li++) {
|
|
11759
|
+
const line = lines[li];
|
|
11760
|
+
const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
|
|
11761
|
+
if (hardBreakMatch) {
|
|
11762
|
+
p.appendChild(renderInline(hardBreakMatch[1]));
|
|
11763
|
+
p.appendChild(document.createElement("br"));
|
|
11764
|
+
} else {
|
|
11765
|
+
p.appendChild(renderInline(line));
|
|
11766
|
+
if (li < lines.length - 1) {
|
|
11767
|
+
p.appendChild(document.createTextNode(" "));
|
|
11768
|
+
}
|
|
11769
|
+
}
|
|
11770
|
+
}
|
|
11771
|
+
return p;
|
|
11772
|
+
}
|
|
11773
|
+
case "codeblock":
|
|
11774
|
+
return createCodeBlock(element.content, element.language, element.title);
|
|
11775
|
+
case "directive":
|
|
11776
|
+
return renderDirective(element, ctx, allElements);
|
|
11777
|
+
case "html": {
|
|
11778
|
+
const el = element;
|
|
11779
|
+
return renderHtmlString(el.content);
|
|
11780
|
+
}
|
|
11781
|
+
case "html-block": {
|
|
11782
|
+
const htmlBlock = element;
|
|
11783
|
+
const rawProps = parseHtmlAttrs(htmlBlock.attrs);
|
|
11784
|
+
const el = document.createElement(htmlBlock.tag);
|
|
11785
|
+
for (const [key, value] of Object.entries(rawProps)) {
|
|
11786
|
+
if (key === "style" && typeof value === "object") {
|
|
11787
|
+
for (const [prop, val] of Object.entries(value)) {
|
|
11788
|
+
el.style.setProperty(prop, String(val));
|
|
11789
|
+
}
|
|
11790
|
+
} else if (value === true) {
|
|
11791
|
+
el.setAttribute(key, "");
|
|
11792
|
+
} else {
|
|
11793
|
+
el.setAttribute(key, String(value));
|
|
11794
|
+
}
|
|
11795
|
+
}
|
|
11796
|
+
const childFrag = processElements(htmlBlock.children, ctx, allElements);
|
|
11797
|
+
el.appendChild(childFrag);
|
|
11798
|
+
return el;
|
|
11799
|
+
}
|
|
11800
|
+
case "image": {
|
|
11801
|
+
const img = document.createElement("img");
|
|
11802
|
+
img.src = element.src;
|
|
11803
|
+
img.alt = element.alt;
|
|
11804
|
+
img.className = "nr-image";
|
|
11805
|
+
if (element.style) {
|
|
11806
|
+
for (const [key, value] of Object.entries(element.style)) {
|
|
11807
|
+
img.style.setProperty(key, String(value));
|
|
11808
|
+
}
|
|
11809
|
+
}
|
|
11810
|
+
return img;
|
|
11811
|
+
}
|
|
11812
|
+
case "table":
|
|
11813
|
+
return createTable(element.content, renderInline);
|
|
11814
|
+
case "list":
|
|
11815
|
+
return createList(element.content, renderInline);
|
|
11816
|
+
case "blockquote":
|
|
11817
|
+
return createBlockquote(element.content, element.classes, renderInline);
|
|
11818
|
+
case "hr": {
|
|
11819
|
+
const hr = document.createElement("hr");
|
|
11820
|
+
hr.className = "nr-hr";
|
|
11821
|
+
return hr;
|
|
11822
|
+
}
|
|
11823
|
+
case "toc": {
|
|
11824
|
+
const headers = allElements.filter((e) => e.type === "header");
|
|
11825
|
+
return createTOC(headers.map((h) => ({ level: h.level, text: h.text, id: h.id })), renderInline);
|
|
11826
|
+
}
|
|
11827
|
+
default:
|
|
11828
|
+
return null;
|
|
11829
|
+
}
|
|
11830
|
+
}
|
|
11831
|
+
function renderDirective(element, ctx, allElements) {
|
|
11637
11832
|
const { directiveType, props, slots, scopeId } = element;
|
|
11638
|
-
const
|
|
11833
|
+
const renderer = directives_default[directiveType];
|
|
11639
11834
|
const renderSlot = (name) => {
|
|
11835
|
+
const frag = document.createDocumentFragment();
|
|
11640
11836
|
const slotContent = slots[name];
|
|
11641
|
-
if (!slotContent) return
|
|
11642
|
-
const
|
|
11643
|
-
|
|
11837
|
+
if (!slotContent) return frag;
|
|
11838
|
+
const tokens = ctx.parseMarkdown(slotContent);
|
|
11839
|
+
frag.appendChild(ctx.renderElements(tokens));
|
|
11840
|
+
return frag;
|
|
11644
11841
|
};
|
|
11645
11842
|
const directiveProps = {
|
|
11646
11843
|
directiveType,
|
|
11647
11844
|
props,
|
|
11648
11845
|
slots,
|
|
11649
11846
|
renderSlot,
|
|
11650
|
-
context,
|
|
11651
|
-
index,
|
|
11652
|
-
allElements
|
|
11847
|
+
context: ctx,
|
|
11848
|
+
index: 0,
|
|
11849
|
+
allElements,
|
|
11850
|
+
renderInline,
|
|
11851
|
+
renderMarkdown: ctx.renderMarkdown
|
|
11653
11852
|
};
|
|
11654
|
-
if (
|
|
11655
|
-
return
|
|
11853
|
+
if (renderer) {
|
|
11854
|
+
return renderer(directiveProps);
|
|
11656
11855
|
}
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11856
|
+
const fallback = document.createElement("div");
|
|
11857
|
+
fallback.className = "nr-unknown-directive";
|
|
11858
|
+
fallback.appendChild(renderSlot("default"));
|
|
11859
|
+
return fallback;
|
|
11860
|
+
}
|
|
11660
11861
|
|
|
11661
|
-
// react/
|
|
11662
|
-
var
|
|
11862
|
+
// react/useTailwindCDN.ts
|
|
11863
|
+
var import_react = require("react");
|
|
11864
|
+
|
|
11865
|
+
// vanilla/tailwindTheme.ts
|
|
11866
|
+
var THEME_STYLE_ID = "nr-tailwind-theme";
|
|
11867
|
+
var NR_THEME_CSS = `
|
|
11868
|
+
@theme {
|
|
11869
|
+
--color-primary: var(--color-accent-primary, oklch(var(--p, 55% 0.3 240) / 1));
|
|
11870
|
+
--color-primary-content: #ffffff;
|
|
11871
|
+
--color-secondary: oklch(var(--s, 55% 0.25 200) / 1);
|
|
11872
|
+
--color-secondary-content: #ffffff;
|
|
11873
|
+
--color-accent: var(--color-accent-primary, oklch(var(--a, 65% 0.25 160) / 1));
|
|
11874
|
+
--color-accent-content: #ffffff;
|
|
11875
|
+
--color-neutral: oklch(var(--n, 50% 0.05 240) / 1);
|
|
11876
|
+
--color-neutral-content: var(--color-text-primary, oklch(var(--nc, 92% 0.02 240) / 1));
|
|
11877
|
+
--color-base-100: var(--color-background-primary, oklch(var(--b1, 15% 0.01 260) / 1));
|
|
11878
|
+
--color-base-200: var(--color-background-secondary-solid, oklch(var(--b2, 20% 0.02 260) / 1));
|
|
11879
|
+
--color-base-300: var(--color-border, oklch(var(--b3, 25% 0.03 260) / 1));
|
|
11880
|
+
--color-base-content: var(--color-text-primary, oklch(var(--bc, 92% 0.02 260) / 1));
|
|
11881
|
+
--color-info: oklch(var(--in, 70% 0.2 220) / 1);
|
|
11882
|
+
--color-info-content: #ffffff;
|
|
11883
|
+
--color-success: oklch(var(--su, 65% 0.25 140) / 1);
|
|
11884
|
+
--color-success-content: #ffffff;
|
|
11885
|
+
--color-warning: oklch(var(--wa, 80% 0.25 80) / 1);
|
|
11886
|
+
--color-warning-content: #1f2937;
|
|
11887
|
+
--color-error: oklch(var(--er, 65% 0.3 30) / 1);
|
|
11888
|
+
--color-error-content: #ffffff;
|
|
11889
|
+
}
|
|
11890
|
+
`;
|
|
11891
|
+
function getVar(root, name) {
|
|
11892
|
+
return getComputedStyle(root).getPropertyValue(name).trim();
|
|
11893
|
+
}
|
|
11894
|
+
function stylesheetHasTheme() {
|
|
11895
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
11896
|
+
let rules = null;
|
|
11897
|
+
try {
|
|
11898
|
+
rules = sheet.cssRules;
|
|
11899
|
+
} catch {
|
|
11900
|
+
continue;
|
|
11901
|
+
}
|
|
11902
|
+
if (!rules) continue;
|
|
11903
|
+
for (const rule of Array.from(rules)) {
|
|
11904
|
+
const css2 = rule.cssText || "";
|
|
11905
|
+
if (css2.includes("@theme") || css2.includes('@plugin "daisyui"')) return true;
|
|
11906
|
+
}
|
|
11907
|
+
}
|
|
11908
|
+
return false;
|
|
11909
|
+
}
|
|
11910
|
+
function hasHostTheme() {
|
|
11911
|
+
if (typeof window === "undefined" || typeof document === "undefined") return true;
|
|
11912
|
+
if (getVar(document.documentElement, "--color-primary")) return true;
|
|
11913
|
+
if (getVar(document.documentElement, "--color-base-100")) return true;
|
|
11914
|
+
if (document.body && (getVar(document.body, "--color-primary") || getVar(document.body, "--color-base-100"))) return true;
|
|
11915
|
+
return stylesheetHasTheme();
|
|
11916
|
+
}
|
|
11917
|
+
function injectNRTailwindTheme() {
|
|
11918
|
+
if (typeof document === "undefined") return;
|
|
11919
|
+
if (document.getElementById(THEME_STYLE_ID)) return;
|
|
11920
|
+
if (hasHostTheme()) return;
|
|
11921
|
+
const style = document.createElement("style");
|
|
11922
|
+
style.id = THEME_STYLE_ID;
|
|
11923
|
+
style.setAttribute("type", "text/tailwindcss");
|
|
11924
|
+
style.textContent = NR_THEME_CSS;
|
|
11925
|
+
document.head.appendChild(style);
|
|
11926
|
+
}
|
|
11927
|
+
function removeNRTailwindTheme() {
|
|
11928
|
+
if (typeof document === "undefined") return;
|
|
11929
|
+
document.getElementById(THEME_STYLE_ID)?.remove();
|
|
11930
|
+
}
|
|
11663
11931
|
|
|
11664
11932
|
// react/useTailwindCDN.ts
|
|
11665
|
-
var import_react6 = require("react");
|
|
11666
11933
|
var CDN_URL = "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4";
|
|
11667
11934
|
var SCRIPT_ID = "tailwind-cdn-v4-runtime";
|
|
11668
11935
|
var CONFIG_ID = "tailwind-cdn-v4-config";
|
|
@@ -11675,13 +11942,14 @@ window.tailwind.config = {
|
|
|
11675
11942
|
};
|
|
11676
11943
|
`;
|
|
11677
11944
|
function useLazyTailwindCDN(enabled) {
|
|
11678
|
-
const loadedRef = (0,
|
|
11679
|
-
(0,
|
|
11945
|
+
const loadedRef = (0, import_react.useRef)(false);
|
|
11946
|
+
(0, import_react.useEffect)(() => {
|
|
11680
11947
|
if (!enabled) {
|
|
11681
11948
|
window.__twCDNRefs = (window.__twCDNRefs ?? 1) - 1;
|
|
11682
11949
|
if ((window.__twCDNRefs ?? 0) <= 0) {
|
|
11683
11950
|
document.getElementById(SCRIPT_ID)?.remove();
|
|
11684
11951
|
document.getElementById(CONFIG_ID)?.remove();
|
|
11952
|
+
removeNRTailwindTheme();
|
|
11685
11953
|
window.__twCDNRefs = 0;
|
|
11686
11954
|
loadedRef.current = false;
|
|
11687
11955
|
}
|
|
@@ -11694,6 +11962,7 @@ function useLazyTailwindCDN(enabled) {
|
|
|
11694
11962
|
configScript.textContent = TAILWIND_CDN_CONFIG;
|
|
11695
11963
|
document.head.appendChild(configScript);
|
|
11696
11964
|
}
|
|
11965
|
+
injectNRTailwindTheme();
|
|
11697
11966
|
if (!document.getElementById(SCRIPT_ID)) {
|
|
11698
11967
|
const script = document.createElement("script");
|
|
11699
11968
|
script.id = SCRIPT_ID;
|
|
@@ -11706,6 +11975,7 @@ function useLazyTailwindCDN(enabled) {
|
|
|
11706
11975
|
if ((window.__twCDNRefs ?? 0) <= 0) {
|
|
11707
11976
|
document.getElementById(SCRIPT_ID)?.remove();
|
|
11708
11977
|
document.getElementById(CONFIG_ID)?.remove();
|
|
11978
|
+
removeNRTailwindTheme();
|
|
11709
11979
|
window.__twCDNRefs = 0;
|
|
11710
11980
|
loadedRef.current = false;
|
|
11711
11981
|
}
|
|
@@ -11726,6 +11996,7 @@ function preloadTailwindCDN() {
|
|
|
11726
11996
|
configScript.textContent = TAILWIND_CDN_CONFIG;
|
|
11727
11997
|
document.head.appendChild(configScript);
|
|
11728
11998
|
}
|
|
11999
|
+
injectNRTailwindTheme();
|
|
11729
12000
|
const script = document.createElement("script");
|
|
11730
12001
|
script.id = SCRIPT_ID;
|
|
11731
12002
|
script.src = CDN_URL;
|
|
@@ -11739,272 +12010,52 @@ function preloadTailwindCDN() {
|
|
|
11739
12010
|
}
|
|
11740
12011
|
}
|
|
11741
12012
|
|
|
11742
|
-
// react/RawHtmlRenderer.tsx
|
|
11743
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
11744
|
-
var RawHtmlRenderer = ({
|
|
11745
|
-
content,
|
|
11746
|
-
globalStyles,
|
|
11747
|
-
wrapperClassName
|
|
11748
|
-
}) => {
|
|
11749
|
-
const containerRef = (0, import_react7.useRef)(null);
|
|
11750
|
-
(0, import_react7.useEffect)(() => {
|
|
11751
|
-
if (!containerRef.current) return;
|
|
11752
|
-
const scripts = containerRef.current.querySelectorAll("script");
|
|
11753
|
-
scripts.forEach((oldScript) => {
|
|
11754
|
-
const newScript = document.createElement("script");
|
|
11755
|
-
Array.from(oldScript.attributes).forEach(
|
|
11756
|
-
(attr) => newScript.setAttribute(attr.name, attr.value)
|
|
11757
|
-
);
|
|
11758
|
-
newScript.textContent = oldScript.textContent;
|
|
11759
|
-
oldScript.parentNode?.replaceChild(newScript, oldScript);
|
|
11760
|
-
});
|
|
11761
|
-
scanTailwindCDN();
|
|
11762
|
-
}, [content]);
|
|
11763
|
-
(0, import_react7.useEffect)(() => {
|
|
11764
|
-
if (!globalStyles) return;
|
|
11765
|
-
const styleEl = document.createElement("style");
|
|
11766
|
-
styleEl.setAttribute("data-global", "");
|
|
11767
|
-
styleEl.textContent = globalStyles;
|
|
11768
|
-
document.head.appendChild(styleEl);
|
|
11769
|
-
return () => {
|
|
11770
|
-
if (styleEl.parentNode) document.head.removeChild(styleEl);
|
|
11771
|
-
};
|
|
11772
|
-
}, [globalStyles]);
|
|
11773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: wrapperClassName, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { dangerouslySetInnerHTML: { __html: content } }) });
|
|
11774
|
-
};
|
|
11775
|
-
var RawHtmlRenderer_default = RawHtmlRenderer;
|
|
11776
|
-
|
|
11777
|
-
// react/context.tsx
|
|
11778
|
-
var import_react8 = require("react");
|
|
11779
|
-
var RenderCtx = (0, import_react8.createContext)(null);
|
|
11780
|
-
var RenderContextProvider = RenderCtx.Provider;
|
|
11781
|
-
|
|
11782
12013
|
// react/CustomMarkdownRenderer.tsx
|
|
11783
|
-
var
|
|
11784
|
-
var CustomMarkdownRenderer = ({ content
|
|
11785
|
-
const
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
12014
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
12015
|
+
var CustomMarkdownRenderer = ({ content }) => {
|
|
12016
|
+
const containerRef = (0, import_react2.useRef)(null);
|
|
12017
|
+
(0, import_react2.useEffect)(() => {
|
|
12018
|
+
const container = containerRef.current;
|
|
12019
|
+
if (!container) return;
|
|
12020
|
+
container.replaceChildren();
|
|
12021
|
+
container.appendChild(renderMarkdownString(content));
|
|
12022
|
+
scanTailwindCDN();
|
|
11792
12023
|
const handleHashChange = () => {
|
|
11793
12024
|
const hash = window.location.hash;
|
|
11794
12025
|
if (hash) {
|
|
11795
12026
|
const parts = hash.split("#");
|
|
11796
|
-
|
|
11797
|
-
scrollToId(id);
|
|
12027
|
+
scrollToId(parts[parts.length - 1]);
|
|
11798
12028
|
}
|
|
11799
12029
|
};
|
|
11800
12030
|
handleHashChange();
|
|
11801
12031
|
window.addEventListener("hashchange", handleHashChange);
|
|
11802
12032
|
return () => window.removeEventListener("hashchange", handleHashChange);
|
|
11803
|
-
}, [
|
|
11804
|
-
|
|
11805
|
-
(element, index, _depth = 0) => {
|
|
11806
|
-
switch (element.type) {
|
|
11807
|
-
case "header": {
|
|
11808
|
-
const HeaderTag = `h${element.level}`;
|
|
11809
|
-
let text = element.text;
|
|
11810
|
-
const alignCenter = text.match(/^->\s*(.+?)\s*<-\s*$/);
|
|
11811
|
-
const alignRight = text.match(/^->\s*(.+?)\s*->\s*$/);
|
|
11812
|
-
if (alignCenter) {
|
|
11813
|
-
text = alignCenter[1];
|
|
11814
|
-
} else if (alignRight) {
|
|
11815
|
-
text = alignRight[1];
|
|
11816
|
-
}
|
|
11817
|
-
const userClasses = element.classes || "";
|
|
11818
|
-
let headerClasses = `md-h${element.level}`;
|
|
11819
|
-
if (alignCenter) headerClasses += " text-center";
|
|
11820
|
-
if (alignRight) headerClasses += " text-right";
|
|
11821
|
-
if (userClasses) headerClasses += ` ${userClasses}`;
|
|
11822
|
-
return import_react9.default.createElement(
|
|
11823
|
-
HeaderTag,
|
|
11824
|
-
{ key: index, id: element.id, className: headerClasses },
|
|
11825
|
-
renderInline(text)
|
|
11826
|
-
);
|
|
11827
|
-
}
|
|
11828
|
-
case "paragraph": {
|
|
11829
|
-
const lines = element.content.split("\n");
|
|
11830
|
-
const processedContent = lines.map((line, lineIndex) => {
|
|
11831
|
-
const hardBreakMatch = line.match(/^(.*?)(\s{2,})$/);
|
|
11832
|
-
if (hardBreakMatch) {
|
|
11833
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react9.default.Fragment, { children: [
|
|
11834
|
-
renderInline(hardBreakMatch[1]),
|
|
11835
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {})
|
|
11836
|
-
] }, lineIndex);
|
|
11837
|
-
}
|
|
11838
|
-
const isLastLine = lineIndex === lines.length - 1;
|
|
11839
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react9.default.Fragment, { children: [
|
|
11840
|
-
renderInline(line),
|
|
11841
|
-
!isLastLine && " "
|
|
11842
|
-
] }, lineIndex);
|
|
11843
|
-
});
|
|
11844
|
-
const pUserClasses = element.classes || "";
|
|
11845
|
-
let pClasses = "md-p";
|
|
11846
|
-
if (pUserClasses) pClasses += ` ${pUserClasses}`;
|
|
11847
|
-
if (element.align) pClasses += ` text-${element.align}`;
|
|
11848
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { id: element.id, className: pClasses, children: processedContent }, index);
|
|
11849
|
-
}
|
|
11850
|
-
case "codeblock":
|
|
11851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
11852
|
-
CodeBlock,
|
|
11853
|
-
{
|
|
11854
|
-
code: element.content,
|
|
11855
|
-
language: element.language,
|
|
11856
|
-
title: element.title
|
|
11857
|
-
},
|
|
11858
|
-
index
|
|
11859
|
-
);
|
|
11860
|
-
case "directive":
|
|
11861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
11862
|
-
DirectiveRenderer_default,
|
|
11863
|
-
{
|
|
11864
|
-
element,
|
|
11865
|
-
context: contextRef.current,
|
|
11866
|
-
index,
|
|
11867
|
-
allElements
|
|
11868
|
-
},
|
|
11869
|
-
index
|
|
11870
|
-
);
|
|
11871
|
-
case "html": {
|
|
11872
|
-
let processedContent = element.content;
|
|
11873
|
-
let globalStyles = "";
|
|
11874
|
-
processedContent = processedContent.replace(
|
|
11875
|
-
/<style(?:\s+[^>]*)?>([\s\S]*?)<\/style>/gi,
|
|
11876
|
-
(_match, cssContent) => {
|
|
11877
|
-
globalStyles += cssContent + "\n";
|
|
11878
|
-
return "";
|
|
11879
|
-
}
|
|
11880
|
-
);
|
|
11881
|
-
const wrapperClassName = "w-full my-4";
|
|
11882
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
11883
|
-
RawHtmlRenderer_default,
|
|
11884
|
-
{
|
|
11885
|
-
content: processedContent,
|
|
11886
|
-
globalStyles: globalStyles || void 0,
|
|
11887
|
-
wrapperClassName
|
|
11888
|
-
},
|
|
11889
|
-
index
|
|
11890
|
-
);
|
|
11891
|
-
}
|
|
11892
|
-
case "html-block": {
|
|
11893
|
-
const htmlBlock = element;
|
|
11894
|
-
const rawProps = parseHtmlAttrs(htmlBlock.attrs);
|
|
11895
|
-
const props = {};
|
|
11896
|
-
for (const [key, value] of Object.entries(rawProps)) {
|
|
11897
|
-
if (key === "class") props["className"] = value;
|
|
11898
|
-
else if (key === "for") props["htmlFor"] = value;
|
|
11899
|
-
else if (key === "tabindex") props["tabIndex"] = value;
|
|
11900
|
-
else props[key] = value;
|
|
11901
|
-
}
|
|
11902
|
-
return import_react9.default.createElement(
|
|
11903
|
-
htmlBlock.tag,
|
|
11904
|
-
{ key: index, ...props },
|
|
11905
|
-
...processAndRenderElements(htmlBlock.children, _depth + 1)
|
|
11906
|
-
);
|
|
11907
|
-
}
|
|
11908
|
-
case "image":
|
|
11909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
11910
|
-
"img",
|
|
11911
|
-
{
|
|
11912
|
-
alt: element.alt,
|
|
11913
|
-
src: element.src,
|
|
11914
|
-
style: element.style,
|
|
11915
|
-
className: "max-w-full h-auto"
|
|
11916
|
-
},
|
|
11917
|
-
index
|
|
11918
|
-
);
|
|
11919
|
-
case "table":
|
|
11920
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderTable(element.content) }, index);
|
|
11921
|
-
case "list":
|
|
11922
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: renderList(element.content) }, index);
|
|
11923
|
-
case "blockquote":
|
|
11924
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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);
|
|
11925
|
-
case "hr":
|
|
11926
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "my-8 border-border" }, index);
|
|
11927
|
-
case "toc":
|
|
11928
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: generateToc(allElements) }, index);
|
|
11929
|
-
default:
|
|
11930
|
-
return null;
|
|
11931
|
-
}
|
|
11932
|
-
},
|
|
11933
|
-
[allElements]
|
|
11934
|
-
);
|
|
11935
|
-
const processAndRenderElements = (0, import_react9.useCallback)(
|
|
11936
|
-
(elements, depth = 0) => {
|
|
11937
|
-
const result = [];
|
|
11938
|
-
let i = 0;
|
|
11939
|
-
while (i < elements.length) {
|
|
11940
|
-
const el = elements[i];
|
|
11941
|
-
if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
|
|
11942
|
-
const cards = [];
|
|
11943
|
-
while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
|
|
11944
|
-
cards.push(elements[i]);
|
|
11945
|
-
i++;
|
|
11946
|
-
}
|
|
11947
|
-
if (cards.length === 1 || cards[0].props?.batch === "off") {
|
|
11948
|
-
for (let c = 0; c < cards.length; c++) {
|
|
11949
|
-
result.push(renderElement(cards[c], result.length, depth));
|
|
11950
|
-
}
|
|
11951
|
-
} else {
|
|
11952
|
-
const firstCardClass = cards[0].props?.["class"] || "";
|
|
11953
|
-
const justifyClasses = firstCardClass.match(/\bjustify-\S+/g) || [];
|
|
11954
|
-
const wrapperJustify = justifyClasses.length > 0 ? justifyClasses.join(" ") : "";
|
|
11955
|
-
result.push(
|
|
11956
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `not-prose flex flex-wrap gap-6 my-6 ${wrapperJustify}`, children: cards.map((card, ci) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react9.default.Fragment, { children: renderElement(card, ci, depth) }, ci)) }, `card-grid-${result.length}`)
|
|
11957
|
-
);
|
|
11958
|
-
}
|
|
11959
|
-
} else {
|
|
11960
|
-
result.push(renderElement(el, result.length, depth));
|
|
11961
|
-
i++;
|
|
11962
|
-
}
|
|
11963
|
-
}
|
|
11964
|
-
return result;
|
|
11965
|
-
},
|
|
11966
|
-
[renderElement]
|
|
11967
|
-
);
|
|
11968
|
-
const generateToc = (elements) => {
|
|
11969
|
-
const headers = extractHeaders(elements);
|
|
11970
|
-
if (headers.length === 0) return null;
|
|
11971
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("nav", { className: "not-prose my-6 p-4 rounded-2xl border border-border bg-background-primary/5", children: [
|
|
11972
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-base font-bold mb-3", children: "Table of Contents" }),
|
|
11973
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "space-y-1 list-none p-0 m-0", children: headers.map((h, i) => {
|
|
11974
|
-
if (h.type !== "header") return null;
|
|
11975
|
-
const indentClass = h.level <= 2 ? "pl-0" : h.level === 3 ? "pl-4" : h.level === 4 ? "pl-8" : "pl-12";
|
|
11976
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { className: `${indentClass} text-sm sm:text-base`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
11977
|
-
"a",
|
|
11978
|
-
{
|
|
11979
|
-
href: `#${h.id}`,
|
|
11980
|
-
className: "text-accent-primary hover:text-accent-primary/80 no-underline hover:underline transition-colors",
|
|
11981
|
-
onClick: (e) => {
|
|
11982
|
-
e.preventDefault();
|
|
11983
|
-
scrollToId(h.id);
|
|
11984
|
-
},
|
|
11985
|
-
children: renderInline(h.text.replace(/->|<-/g, "").trim())
|
|
11986
|
-
}
|
|
11987
|
-
) }, i);
|
|
11988
|
-
}) })
|
|
11989
|
-
] });
|
|
11990
|
-
};
|
|
11991
|
-
const contextForDirectives = {
|
|
11992
|
-
modals,
|
|
11993
|
-
setModals,
|
|
11994
|
-
articleClass,
|
|
11995
|
-
allElements,
|
|
11996
|
-
parseMarkdown,
|
|
11997
|
-
renderElement,
|
|
11998
|
-
renderInline,
|
|
11999
|
-
processAndRenderElements
|
|
12000
|
-
};
|
|
12001
|
-
contextRef.current = contextForDirectives;
|
|
12002
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RenderContextProvider, { value: contextForDirectives, children: processAndRenderElements(allElements) });
|
|
12033
|
+
}, [content]);
|
|
12034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: containerRef });
|
|
12003
12035
|
};
|
|
12004
12036
|
var CustomMarkdownRenderer_default = CustomMarkdownRenderer;
|
|
12005
12037
|
|
|
12038
|
+
// react/RawHtmlRenderer.tsx
|
|
12039
|
+
var import_react3 = require("react");
|
|
12040
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
12041
|
+
var RawHtmlRenderer = ({
|
|
12042
|
+
content,
|
|
12043
|
+
wrapperClassName = "nr-raw-html"
|
|
12044
|
+
}) => {
|
|
12045
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
12046
|
+
(0, import_react3.useEffect)(() => {
|
|
12047
|
+
const container = containerRef.current;
|
|
12048
|
+
if (!container) return;
|
|
12049
|
+
container.replaceChildren();
|
|
12050
|
+
container.appendChild(renderHtmlString(content));
|
|
12051
|
+
scanTailwindCDN();
|
|
12052
|
+
}, [content]);
|
|
12053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: containerRef, className: wrapperClassName });
|
|
12054
|
+
};
|
|
12055
|
+
var RawHtmlRenderer_default = RawHtmlRenderer;
|
|
12056
|
+
|
|
12006
12057
|
// react/NRpreviewer.tsx
|
|
12007
|
-
var
|
|
12058
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
12008
12059
|
var NRpreviewer = ({
|
|
12009
12060
|
content,
|
|
12010
12061
|
html,
|
|
@@ -12013,21 +12064,22 @@ var NRpreviewer = ({
|
|
|
12013
12064
|
style
|
|
12014
12065
|
}) => {
|
|
12015
12066
|
useLazyTailwindCDN(tailwindCDN);
|
|
12067
|
+
const wrapperClass = `nr-prose${className ? ` ${className}` : ""}`;
|
|
12016
12068
|
if (content) {
|
|
12017
|
-
return /* @__PURE__ */ (0,
|
|
12069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: wrapperClass, style, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CustomMarkdownRenderer_default, { content }) });
|
|
12018
12070
|
}
|
|
12019
12071
|
if (html) {
|
|
12020
|
-
return /* @__PURE__ */ (0,
|
|
12072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: wrapperClass, style, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RawHtmlRenderer_default, { content: html }) });
|
|
12021
12073
|
}
|
|
12022
12074
|
return null;
|
|
12023
12075
|
};
|
|
12024
12076
|
var NRpreviewer_default = NRpreviewer;
|
|
12025
12077
|
|
|
12026
12078
|
// react/useDebounce.ts
|
|
12027
|
-
var
|
|
12079
|
+
var import_react4 = require("react");
|
|
12028
12080
|
function useDebounce(value, delay) {
|
|
12029
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
12030
|
-
(0,
|
|
12081
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react4.useState)(value);
|
|
12082
|
+
(0, import_react4.useEffect)(() => {
|
|
12031
12083
|
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
12032
12084
|
return () => clearTimeout(timer);
|
|
12033
12085
|
}, [value, delay]);
|
|
@@ -12035,15 +12087,10 @@ function useDebounce(value, delay) {
|
|
|
12035
12087
|
}
|
|
12036
12088
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12037
12089
|
0 && (module.exports = {
|
|
12038
|
-
Admonition,
|
|
12039
|
-
CodeBlock,
|
|
12040
12090
|
CustomMarkdownRenderer,
|
|
12041
|
-
Details,
|
|
12042
|
-
IconRenderer,
|
|
12043
|
-
Modal,
|
|
12044
12091
|
NRpreviewer,
|
|
12092
|
+
RawHtmlRenderer,
|
|
12045
12093
|
extractAttributes,
|
|
12046
|
-
extractHeaders,
|
|
12047
12094
|
generateId,
|
|
12048
12095
|
generateScopeId,
|
|
12049
12096
|
parseCssString,
|