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