@noirmd/previewer 2.0.1 → 2.0.3

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/vanilla.cjs CHANGED
@@ -11609,6 +11609,553 @@ var slideDirective = ({
11609
11609
  };
11610
11610
  var slide_default = slideDirective;
11611
11611
 
11612
+ // vanilla/directives/keys.ts
11613
+ var keysDirective = ({ props, slots }) => {
11614
+ const wrap = document.createElement("div");
11615
+ wrap.className = "nr-keys";
11616
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
11617
+ if (props.style) wrap.setAttribute("style", props.style);
11618
+ const sizeClass = props.size ? ` nr-kbd--${props.size}` : "";
11619
+ const parts = (slots.default || "").split("+").map((p) => p.trim()).filter(Boolean);
11620
+ parts.forEach((part, i) => {
11621
+ if (i > 0) {
11622
+ const sep = document.createElement("span");
11623
+ sep.className = "nr-keys__sep";
11624
+ sep.textContent = "+";
11625
+ wrap.appendChild(sep);
11626
+ }
11627
+ const kbd = document.createElement("kbd");
11628
+ kbd.className = `nr-kbd${sizeClass}`;
11629
+ kbd.textContent = part;
11630
+ wrap.appendChild(kbd);
11631
+ });
11632
+ return wrap;
11633
+ };
11634
+ var keys_default = keysDirective;
11635
+
11636
+ // vanilla/directives/accordion.ts
11637
+ var accordionCounter = 0;
11638
+ var accordionItemDirective = ({ props, renderSlot }) => {
11639
+ const item = document.createElement("div");
11640
+ item.className = "nr-accordion__item";
11641
+ if (props.class) item.classList.add(...props.class.split(/\s+/).filter(Boolean));
11642
+ if (props.style) item.setAttribute("style", props.style);
11643
+ const input = document.createElement("input");
11644
+ input.type = "radio";
11645
+ input.className = "nr-accordion__input";
11646
+ if (props.checked === "true" || props.checked === "") input.checked = true;
11647
+ if (props.value) input.value = props.value;
11648
+ input.setAttribute("aria-label", props.title || "Accordion item");
11649
+ const title = document.createElement("div");
11650
+ title.className = "nr-accordion__title";
11651
+ title.textContent = props.title || "";
11652
+ const content = document.createElement("div");
11653
+ content.className = "nr-accordion__content";
11654
+ content.appendChild(renderSlot("default"));
11655
+ item.append(input, title, content);
11656
+ return item;
11657
+ };
11658
+ var accordionDirective = ({ props, renderSlot }) => {
11659
+ const wrap = document.createElement("div");
11660
+ wrap.className = "nr-accordion";
11661
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
11662
+ if (props.style) wrap.setAttribute("style", props.style);
11663
+ wrap.appendChild(renderSlot("default"));
11664
+ const mode = props.mode === "checkbox" ? "checkbox" : "radio";
11665
+ const group = `nr-acc-${++accordionCounter}`;
11666
+ wrap.querySelectorAll(".nr-accordion__input").forEach((input) => {
11667
+ input.type = mode;
11668
+ if (mode === "radio") input.name = group;
11669
+ });
11670
+ return wrap;
11671
+ };
11672
+ var accordion_default = accordionDirective;
11673
+
11674
+ // vanilla/directives/carousel.ts
11675
+ var IMG_RE = /!\[([^\]]*)\]\(([^)]+)\)/g;
11676
+ var carouselDirective = ({ props, slots }) => {
11677
+ const images = [];
11678
+ const raw = slots.default || "";
11679
+ let m;
11680
+ IMG_RE.lastIndex = 0;
11681
+ while ((m = IMG_RE.exec(raw)) !== null) {
11682
+ images.push({ src: m[2].split("#")[0].trim(), alt: m[1].trim() || "carousel image" });
11683
+ }
11684
+ if (images.length === 0) {
11685
+ return document.createDocumentFragment();
11686
+ }
11687
+ const wrap = document.createElement("div");
11688
+ wrap.className = "nr-carousel";
11689
+ wrap.tabIndex = 0;
11690
+ wrap.setAttribute("aria-label", "Image carousel");
11691
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
11692
+ if (props.style) wrap.setAttribute("style", props.style);
11693
+ if (props.width) wrap.style.width = props.width;
11694
+ if (props.float) {
11695
+ if (props.float === "left" || props.float === "right") {
11696
+ wrap.style.float = props.float;
11697
+ if (!props.width) wrap.style.maxWidth = "50%";
11698
+ wrap.style.marginInlineStart = props.float === "right" ? "1rem" : "";
11699
+ wrap.style.marginInlineEnd = props.float === "left" ? "1rem" : "";
11700
+ } else if (props.float === "center") {
11701
+ wrap.style.marginInline = "auto";
11702
+ }
11703
+ }
11704
+ const viewport = document.createElement("div");
11705
+ viewport.className = "nr-carousel__viewport";
11706
+ if (props.height) viewport.style.height = props.height;
11707
+ if (props.aspect) viewport.style.aspectRatio = props.aspect;
11708
+ const track = document.createElement("div");
11709
+ track.className = "nr-carousel__track";
11710
+ const items = [];
11711
+ for (const img of images) {
11712
+ const item = document.createElement("div");
11713
+ item.className = "nr-carousel__item";
11714
+ const el = document.createElement("img");
11715
+ el.src = img.src;
11716
+ el.alt = img.alt;
11717
+ el.loading = "lazy";
11718
+ item.appendChild(el);
11719
+ track.appendChild(item);
11720
+ items.push(item);
11721
+ }
11722
+ viewport.appendChild(track);
11723
+ wrap.appendChild(viewport);
11724
+ const total = items.length;
11725
+ let index = 0;
11726
+ const goTo = (i) => {
11727
+ index = (i % total + total) % total;
11728
+ track.style.transform = `translateX(-${index * 100}%)`;
11729
+ items.forEach((it, j) => it.classList.toggle("nr-carousel__item--active", j === index));
11730
+ dots.forEach((d, j) => d.classList.toggle("nr-carousel__dot--active", j === index));
11731
+ };
11732
+ const prev = document.createElement("button");
11733
+ prev.className = "nr-carousel__nav nr-carousel__nav--prev";
11734
+ prev.setAttribute("aria-label", "Previous slide");
11735
+ prev.textContent = "\u276E";
11736
+ prev.addEventListener("click", () => goTo(index - 1));
11737
+ const next = document.createElement("button");
11738
+ next.className = "nr-carousel__nav nr-carousel__nav--next";
11739
+ next.setAttribute("aria-label", "Next slide");
11740
+ next.textContent = "\u276F";
11741
+ next.addEventListener("click", () => goTo(index + 1));
11742
+ const dots = [];
11743
+ const dotsBox = document.createElement("div");
11744
+ dotsBox.className = "nr-carousel__dots";
11745
+ images.forEach((_, i) => {
11746
+ const dot = document.createElement("button");
11747
+ dot.className = "nr-carousel__dot";
11748
+ dot.setAttribute("aria-label", `Go to slide ${i + 1}`);
11749
+ dot.addEventListener("click", () => goTo(i));
11750
+ dotsBox.appendChild(dot);
11751
+ dots.push(dot);
11752
+ });
11753
+ wrap.append(prev, next, dotsBox);
11754
+ wrap.addEventListener("keydown", (e) => {
11755
+ if (e.key === "ArrowLeft") {
11756
+ e.preventDefault();
11757
+ goTo(index - 1);
11758
+ } else if (e.key === "ArrowRight") {
11759
+ e.preventDefault();
11760
+ goTo(index + 1);
11761
+ }
11762
+ });
11763
+ goTo(0);
11764
+ return wrap;
11765
+ };
11766
+ var carousel_default = carouselDirective;
11767
+
11768
+ // vanilla/directives/countdown.ts
11769
+ var DEFAULT_LABELS = ["days", "hours", "min", "sec"];
11770
+ var countdownDirective = ({ props }) => {
11771
+ const wrap = document.createElement("div");
11772
+ wrap.className = "nr-countdown";
11773
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
11774
+ if (props.style) wrap.setAttribute("style", props.style);
11775
+ const labelParts = (props.labels || "").split("|").map((s) => s.trim());
11776
+ const labels = DEFAULT_LABELS.map((label, i) => labelParts[i] || label);
11777
+ const digits = parseInt(props.digits || "2", 10);
11778
+ const targetTime = props.target ? new Date(props.target).getTime() : NaN;
11779
+ const hasTarget = !Number.isNaN(targetTime);
11780
+ const blocks = [];
11781
+ const compute = () => {
11782
+ if (hasTarget) {
11783
+ const diff2 = Math.max(0, targetTime - Date.now());
11784
+ return [
11785
+ Math.floor(diff2 / 864e5),
11786
+ Math.floor(diff2 / 36e5) % 24,
11787
+ Math.floor(diff2 / 6e4) % 60,
11788
+ Math.floor(diff2 / 1e3) % 60
11789
+ ];
11790
+ }
11791
+ return [
11792
+ parseInt(props.days || "0", 10),
11793
+ parseInt(props.hours || "0", 10),
11794
+ parseInt(props.min || "0", 10),
11795
+ parseInt(props.sec || "0", 10)
11796
+ ];
11797
+ };
11798
+ const render = () => {
11799
+ const values = compute();
11800
+ blocks.forEach((block, i) => {
11801
+ const v = String(values[i]);
11802
+ block.value.style.setProperty("--value", v);
11803
+ block.value.setAttribute("aria-label", v);
11804
+ block.value.textContent = v;
11805
+ });
11806
+ };
11807
+ labels.forEach((label) => {
11808
+ const block = document.createElement("div");
11809
+ block.className = "nr-countdown__block";
11810
+ const value = document.createElement("span");
11811
+ value.className = "nr-countdown__value";
11812
+ value.style.setProperty("--digits", String(digits));
11813
+ value.setAttribute("aria-live", "polite");
11814
+ value.setAttribute("aria-label", "0");
11815
+ value.textContent = "0";
11816
+ const labelEl = document.createElement("span");
11817
+ labelEl.className = "nr-countdown__label";
11818
+ labelEl.textContent = label;
11819
+ block.append(value, labelEl);
11820
+ wrap.appendChild(block);
11821
+ blocks.push({ value });
11822
+ });
11823
+ render();
11824
+ if (hasTarget) setInterval(render, 1e3);
11825
+ return wrap;
11826
+ };
11827
+ var countdown_default = countdownDirective;
11828
+
11829
+ // vanilla/directives/diff.ts
11830
+ var IMG_RE2 = /!\[([^\]]*)\]\(([^)]+)\)/g;
11831
+ var diffDirective = ({ props, slots }) => {
11832
+ let before = (props.before || "").split("#")[0].trim();
11833
+ let after = (props.after || "").split("#")[0].trim();
11834
+ if (!before || !after) {
11835
+ const urls = [];
11836
+ const raw = slots.default || "";
11837
+ let m;
11838
+ IMG_RE2.lastIndex = 0;
11839
+ while ((m = IMG_RE2.exec(raw)) !== null) {
11840
+ urls.push(m[2].split("#")[0].trim());
11841
+ }
11842
+ if (!before && urls.length > 0) before = urls[0];
11843
+ if (!after && urls.length > 1) after = urls[1];
11844
+ }
11845
+ if (!before || !after) {
11846
+ return document.createDocumentFragment();
11847
+ }
11848
+ const figure = document.createElement("figure");
11849
+ figure.className = "nr-diff";
11850
+ figure.tabIndex = 0;
11851
+ figure.setAttribute("aria-label", "Image comparison slider");
11852
+ if (props.class) figure.classList.add(...props.class.split(/\s+/).filter(Boolean));
11853
+ if (props.style) figure.setAttribute("style", props.style);
11854
+ if (props.aspect) figure.style.aspectRatio = props.aspect;
11855
+ if (props.height) figure.style.height = props.height;
11856
+ if (props.width) figure.style.width = props.width;
11857
+ if (props.float) {
11858
+ if (props.float === "left" || props.float === "right") {
11859
+ figure.style.float = props.float;
11860
+ if (!props.width) figure.style.maxWidth = "50%";
11861
+ figure.style.marginInlineStart = props.float === "right" ? "1rem" : "";
11862
+ figure.style.marginInlineEnd = props.float === "left" ? "1rem" : "";
11863
+ } else if (props.float === "center") {
11864
+ figure.style.marginInline = "auto";
11865
+ }
11866
+ }
11867
+ const beforeItem = document.createElement("div");
11868
+ beforeItem.className = "nr-diff__item nr-diff__item--before";
11869
+ beforeItem.setAttribute("role", "img");
11870
+ beforeItem.tabIndex = 0;
11871
+ const beforeImg = document.createElement("img");
11872
+ beforeImg.src = before;
11873
+ beforeImg.alt = "before";
11874
+ beforeItem.appendChild(beforeImg);
11875
+ const afterItem = document.createElement("div");
11876
+ afterItem.className = "nr-diff__item nr-diff__item--after";
11877
+ afterItem.setAttribute("role", "img");
11878
+ const afterImg = document.createElement("img");
11879
+ afterImg.src = after;
11880
+ afterImg.alt = "after";
11881
+ afterItem.appendChild(afterImg);
11882
+ const resizer = document.createElement("div");
11883
+ resizer.className = "nr-diff__resizer";
11884
+ resizer.setAttribute("aria-label", "Drag to compare");
11885
+ resizer.title = "Drag to compare";
11886
+ figure.append(beforeItem, afterItem, resizer);
11887
+ let pos = 50;
11888
+ const applyPos = () => {
11889
+ figure.style.setProperty("--nr-diff-pos", `${pos}%`);
11890
+ };
11891
+ const setPosFromClientX = (clientX) => {
11892
+ const rect = figure.getBoundingClientRect();
11893
+ if (rect.width === 0) return;
11894
+ pos = Math.min(100, Math.max(0, (clientX - rect.left) / rect.width * 100));
11895
+ applyPos();
11896
+ };
11897
+ resizer.addEventListener("pointerdown", (e) => {
11898
+ e.preventDefault();
11899
+ resizer.setPointerCapture(e.pointerId);
11900
+ setPosFromClientX(e.clientX);
11901
+ });
11902
+ resizer.addEventListener("pointermove", (e) => {
11903
+ if (e.buttons & 1) setPosFromClientX(e.clientX);
11904
+ });
11905
+ resizer.addEventListener("pointerup", (e) => {
11906
+ if (resizer.hasPointerCapture(e.pointerId)) {
11907
+ resizer.releasePointerCapture(e.pointerId);
11908
+ }
11909
+ });
11910
+ figure.addEventListener("click", (e) => {
11911
+ if (e.target === resizer) return;
11912
+ setPosFromClientX(e.clientX);
11913
+ });
11914
+ figure.addEventListener("keydown", (e) => {
11915
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
11916
+ e.preventDefault();
11917
+ pos = Math.min(100, Math.max(0, pos + (e.key === "ArrowRight" ? 5 : -5)));
11918
+ applyPos();
11919
+ });
11920
+ applyPos();
11921
+ return figure;
11922
+ };
11923
+ var diff_default = diffDirective;
11924
+
11925
+ // vanilla/directives/hover3d.ts
11926
+ var hover3dDirective = ({ props, renderSlot }) => {
11927
+ const container = document.createElement("div");
11928
+ container.className = "nr-hover-3d";
11929
+ if (props.class) container.classList.add(...props.class.split(/\s+/).filter(Boolean));
11930
+ if (props.style) container.setAttribute("style", props.style);
11931
+ const stage = document.createElement("div");
11932
+ stage.className = "nr-hover-3d__stage";
11933
+ stage.appendChild(renderSlot("default"));
11934
+ container.appendChild(stage);
11935
+ for (let i = 0; i < 8; i++) {
11936
+ container.appendChild(document.createElement("div"));
11937
+ }
11938
+ return container;
11939
+ };
11940
+ var hover3d_default = hover3dDirective;
11941
+
11942
+ // vanilla/directives/hovergallery.ts
11943
+ var IMG_RE3 = /!\[([^\]]*)\]\(([^)]+)\)/g;
11944
+ var hovergalleryDirective = ({ props, slots }) => {
11945
+ const images = [];
11946
+ const raw = slots.default || "";
11947
+ let m;
11948
+ IMG_RE3.lastIndex = 0;
11949
+ while ((m = IMG_RE3.exec(raw)) !== null) {
11950
+ images.push({ src: m[2].split("#")[0].trim(), alt: m[1].trim() || "gallery image" });
11951
+ }
11952
+ if (images.length === 0) {
11953
+ return document.createDocumentFragment();
11954
+ }
11955
+ const figure = document.createElement("figure");
11956
+ figure.className = "nr-hover-gallery";
11957
+ if (props.aspect) figure.style.aspectRatio = props.aspect;
11958
+ if (props.class) figure.classList.add(...props.class.split(/\s+/).filter(Boolean));
11959
+ if (props.style) figure.setAttribute("style", props.style);
11960
+ for (const img of images) {
11961
+ const el = document.createElement("img");
11962
+ el.src = img.src;
11963
+ el.alt = img.alt;
11964
+ el.loading = "lazy";
11965
+ figure.appendChild(el);
11966
+ }
11967
+ return figure;
11968
+ };
11969
+ var hovergallery_default = hovergalleryDirective;
11970
+
11971
+ // vanilla/directives/chat.ts
11972
+ var chatItemDirective = ({ props, renderSlot }) => {
11973
+ const side = props.side === "end" ? "end" : "start";
11974
+ const wrap = document.createElement("div");
11975
+ wrap.className = `nr-chat nr-chat--${side}`;
11976
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
11977
+ if (props.style) wrap.setAttribute("style", props.style);
11978
+ const header = document.createElement("div");
11979
+ header.className = "nr-chat__header";
11980
+ if (props.name) {
11981
+ const name = document.createElement("span");
11982
+ name.className = "nr-chat__name";
11983
+ name.textContent = props.name;
11984
+ header.appendChild(name);
11985
+ }
11986
+ if (props.time) {
11987
+ const time = document.createElement("time");
11988
+ time.className = "nr-chat__time";
11989
+ time.textContent = props.time;
11990
+ header.appendChild(time);
11991
+ }
11992
+ if (header.childNodes.length > 0) wrap.appendChild(header);
11993
+ if (props.avatar) {
11994
+ const avatar = document.createElement("div");
11995
+ avatar.className = "nr-chat__avatar";
11996
+ const img = document.createElement("img");
11997
+ img.src = props.avatar;
11998
+ img.alt = props.name || "avatar";
11999
+ avatar.appendChild(img);
12000
+ wrap.appendChild(avatar);
12001
+ }
12002
+ const bubble = document.createElement("div");
12003
+ bubble.className = `nr-chat__bubble${props.color ? ` nr-chat__bubble--${props.color}` : ""}`;
12004
+ bubble.appendChild(renderSlot("default"));
12005
+ wrap.appendChild(bubble);
12006
+ if (props.footer) {
12007
+ const footer = document.createElement("div");
12008
+ footer.className = "nr-chat__footer";
12009
+ footer.textContent = props.footer;
12010
+ wrap.appendChild(footer);
12011
+ }
12012
+ return wrap;
12013
+ };
12014
+ var chatDirective = ({ props, renderSlot }) => {
12015
+ const wrap = document.createElement("div");
12016
+ wrap.className = "nr-chat";
12017
+ if (props.class) wrap.classList.add(...props.class.split(/\s+/).filter(Boolean));
12018
+ if (props.style) wrap.setAttribute("style", props.style);
12019
+ wrap.appendChild(renderSlot("default"));
12020
+ return wrap;
12021
+ };
12022
+ var chat_default = chatDirective;
12023
+
12024
+ // vanilla/directives/events.ts
12025
+ function parseEventProp(eventProp) {
12026
+ if (!eventProp) return [];
12027
+ const bindings = [];
12028
+ for (const part of eventProp.split(";")) {
12029
+ const trimmed = part.trim();
12030
+ if (!trimmed) continue;
12031
+ const idx = trimmed.indexOf(":");
12032
+ if (idx === -1) continue;
12033
+ const eventName = trimmed.slice(0, idx).trim().replace(/^on/i, "");
12034
+ const fnName = trimmed.slice(idx + 1).trim();
12035
+ if (eventName && fnName) bindings.push({ eventName, fnName });
12036
+ }
12037
+ return bindings;
12038
+ }
12039
+ function bindEventProp(el, eventProp) {
12040
+ for (const { eventName, fnName } of parseEventProp(eventProp)) {
12041
+ el.addEventListener(eventName, (e) => {
12042
+ const fn = window[fnName];
12043
+ if (typeof fn === "function") {
12044
+ fn.call(el, e);
12045
+ }
12046
+ });
12047
+ }
12048
+ }
12049
+
12050
+ // vanilla/directives/richlist.ts
12051
+ var richlistItemDirective = ({ props, renderSlot }) => {
12052
+ const li = document.createElement("li");
12053
+ li.className = "nr-richlist__item";
12054
+ if (props.class) li.classList.add(...props.class.split(/\s+/).filter(Boolean));
12055
+ if (props.style) li.setAttribute("style", props.style);
12056
+ if (props.image) {
12057
+ const thumb = document.createElement("div");
12058
+ thumb.className = "nr-richlist__thumb";
12059
+ const img = document.createElement("img");
12060
+ img.src = props.image;
12061
+ img.alt = props.title || "list item";
12062
+ img.loading = "lazy";
12063
+ thumb.appendChild(img);
12064
+ li.appendChild(thumb);
12065
+ }
12066
+ if (props.title || props.subtitle) {
12067
+ const main = document.createElement("div");
12068
+ main.className = "nr-richlist__main";
12069
+ if (props.title) {
12070
+ const title = document.createElement("div");
12071
+ title.className = "nr-richlist__title";
12072
+ title.textContent = props.title;
12073
+ main.appendChild(title);
12074
+ }
12075
+ if (props.subtitle) {
12076
+ const subtitle = document.createElement("div");
12077
+ subtitle.className = "nr-richlist__subtitle";
12078
+ subtitle.textContent = props.subtitle;
12079
+ main.appendChild(subtitle);
12080
+ }
12081
+ li.appendChild(main);
12082
+ }
12083
+ const descFrag = renderSlot("default");
12084
+ if (descFrag.childNodes.length > 0) {
12085
+ const desc = document.createElement("p");
12086
+ desc.className = "nr-richlist__desc";
12087
+ desc.appendChild(descFrag);
12088
+ li.appendChild(desc);
12089
+ }
12090
+ const actions = [
12091
+ { icon: props.icon, url: props.url, event: props.event },
12092
+ { icon: props.icon2, url: props.url2, event: props.event2 }
12093
+ ].filter((a) => !!a.icon);
12094
+ if (actions.length > 0) {
12095
+ const actionsDiv = document.createElement("div");
12096
+ actionsDiv.className = "nr-richlist__actions";
12097
+ for (const { icon, url, event } of actions) {
12098
+ const btn = document.createElement("button");
12099
+ btn.className = "nr-richlist__action";
12100
+ btn.type = "button";
12101
+ btn.setAttribute("aria-label", icon);
12102
+ btn.appendChild(createIcon(icon));
12103
+ if (event) {
12104
+ bindEventProp(btn, event);
12105
+ } else if (url) {
12106
+ btn.addEventListener("click", () => window.open(url, "_blank"));
12107
+ }
12108
+ actionsDiv.appendChild(btn);
12109
+ }
12110
+ li.appendChild(actionsDiv);
12111
+ }
12112
+ return li;
12113
+ };
12114
+ var richlistDirective = ({ props, renderSlot }) => {
12115
+ const ul = document.createElement("ul");
12116
+ ul.className = "nr-richlist";
12117
+ if (props.class) ul.classList.add(...props.class.split(/\s+/).filter(Boolean));
12118
+ if (props.style) ul.setAttribute("style", props.style);
12119
+ ul.appendChild(renderSlot("default"));
12120
+ return ul;
12121
+ };
12122
+ var richlist_default = richlistDirective;
12123
+
12124
+ // vanilla/directives/stat.ts
12125
+ var statDirective = ({ props }) => {
12126
+ const colorClass = props.color ? ` nr-stat--${props.color}` : "";
12127
+ const stat = document.createElement("div");
12128
+ stat.className = `nr-stat${colorClass}`;
12129
+ if (props.class) stat.classList.add(...props.class.split(/\s+/).filter(Boolean));
12130
+ if (props.style) stat.setAttribute("style", props.style);
12131
+ if (props.icon) {
12132
+ const figure = document.createElement("div");
12133
+ figure.className = "nr-stat__figure";
12134
+ figure.appendChild(createIcon(props.icon));
12135
+ stat.appendChild(figure);
12136
+ }
12137
+ if (props.title) {
12138
+ const title = document.createElement("div");
12139
+ title.className = "nr-stat__title";
12140
+ title.textContent = props.title;
12141
+ stat.appendChild(title);
12142
+ }
12143
+ if (props.value) {
12144
+ const value = document.createElement("div");
12145
+ value.className = "nr-stat__value";
12146
+ value.textContent = props.value;
12147
+ stat.appendChild(value);
12148
+ }
12149
+ if (props.desc) {
12150
+ const desc = document.createElement("div");
12151
+ desc.className = "nr-stat__desc";
12152
+ desc.textContent = props.desc;
12153
+ stat.appendChild(desc);
12154
+ }
12155
+ return stat;
12156
+ };
12157
+ var stat_default = statDirective;
12158
+
11612
12159
  // vanilla/directives/index.ts
11613
12160
  var directiveRegistry = {
11614
12161
  // Admonitions
@@ -11631,7 +12178,21 @@ var directiveRegistry = {
11631
12178
  custom: wrapper_default,
11632
12179
  raw: wrapper_default,
11633
12180
  // Animation
11634
- slide: slide_default
12181
+ slide: slide_default,
12182
+ // New components
12183
+ keys: keys_default,
12184
+ accordion: accordion_default,
12185
+ "accordion-item": accordionItemDirective,
12186
+ carousel: carousel_default,
12187
+ countdown: countdown_default,
12188
+ diff: diff_default,
12189
+ "hover-3d": hover3d_default,
12190
+ "hover-gallery": hovergallery_default,
12191
+ chat: chat_default,
12192
+ "chat-item": chatItemDirective,
12193
+ richlist: richlist_default,
12194
+ "richlist-item": richlistItemDirective,
12195
+ stat: stat_default
11635
12196
  };
11636
12197
  var directives_default = directiveRegistry;
11637
12198
 
@@ -11686,11 +12247,18 @@ function renderTokensInner(tokens, ctx) {
11686
12247
  function processElements(elements, ctx, allElements) {
11687
12248
  const fragment = document.createDocumentFragment();
11688
12249
  let i = 0;
12250
+ const BATCHED_DIRECTIVES = {
12251
+ card: "nr-card-grid",
12252
+ "card-m": "nr-card-grid",
12253
+ "card-b": "nr-card-grid",
12254
+ stat: "nr-stat-grid"
12255
+ };
12256
+ const isBatched = (directive) => !!directive && directive.type === "directive" && Object.prototype.hasOwnProperty.call(BATCHED_DIRECTIVES, directive.directiveType);
11689
12257
  while (i < elements.length) {
11690
12258
  const el = elements[i];
11691
- if (el.type === "directive" && ["card", "card-m", "card-b"].includes(el.directiveType)) {
12259
+ if (isBatched(el)) {
11692
12260
  const cards = [];
11693
- while (i < elements.length && elements[i].type === "directive" && ["card", "card-m", "card-b"].includes(elements[i].directiveType)) {
12261
+ while (i < elements.length && isBatched(elements[i])) {
11694
12262
  cards.push(elements[i]);
11695
12263
  i++;
11696
12264
  }
@@ -11701,7 +12269,7 @@ function processElements(elements, ctx, allElements) {
11701
12269
  }
11702
12270
  } else {
11703
12271
  const grid = document.createElement("div");
11704
- grid.className = "nr-card-grid";
12272
+ grid.className = BATCHED_DIRECTIVES[cards[0].directiveType];
11705
12273
  for (const card of cards) {
11706
12274
  const rendered = renderElement(card, ctx, allElements);
11707
12275
  if (rendered) grid.appendChild(rendered);