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