@noirmd/previewer 2.1.5 → 2.1.6
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 +42 -14
- package/dist/NReditor.cjs.map +1 -1
- package/dist/NReditor.js +42 -14
- package/dist/NReditor.js.map +1 -1
- package/dist/button.css +25 -1
- package/dist/index.cjs +31 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +42 -14
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +42 -14
- package/dist/react.js.map +1 -1
- package/dist/vanilla.cjs +31 -11
- package/dist/vanilla.cjs.map +1 -1
- package/dist/vanilla.js +31 -11
- package/dist/vanilla.js.map +1 -1
- package/dist/vue.cjs +31 -11
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js +31 -11
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/vue.js
CHANGED
|
@@ -11061,6 +11061,7 @@ function createModal(title) {
|
|
|
11061
11061
|
header.appendChild(titleEl);
|
|
11062
11062
|
const closeBtn = document.createElement("button");
|
|
11063
11063
|
closeBtn.className = "nr-modal__close";
|
|
11064
|
+
closeBtn.setAttribute("aria-label", "Close");
|
|
11064
11065
|
closeBtn.appendChild(createIcon("close"));
|
|
11065
11066
|
closeBtn.addEventListener("click", () => dialog.close());
|
|
11066
11067
|
header.appendChild(closeBtn);
|
|
@@ -11342,6 +11343,18 @@ function openModal(dialog) {
|
|
|
11342
11343
|
}
|
|
11343
11344
|
}
|
|
11344
11345
|
var IMG_RE = /!\[([^\]]*)\]\(([^)]+)\)/g;
|
|
11346
|
+
function applyAlignClass(el, baseClass, align) {
|
|
11347
|
+
if (align === "center") {
|
|
11348
|
+
el.classList.add(`${baseClass}--center`);
|
|
11349
|
+
} else if (align === "right") {
|
|
11350
|
+
el.classList.add(`${baseClass}--right`);
|
|
11351
|
+
}
|
|
11352
|
+
}
|
|
11353
|
+
function resolveIcon(value, fallback) {
|
|
11354
|
+
if (!value) return fallback;
|
|
11355
|
+
if (value === "none" || value === "off") return null;
|
|
11356
|
+
return value;
|
|
11357
|
+
}
|
|
11345
11358
|
function parseIntProp(value, defaultValue) {
|
|
11346
11359
|
if (!value) return defaultValue;
|
|
11347
11360
|
const n = parseInt(value, 10);
|
|
@@ -11381,13 +11394,16 @@ var modalDirective = ({ props, renderSlot }) => {
|
|
|
11381
11394
|
const label = props.label || props.title || "Open";
|
|
11382
11395
|
const modalTitle = props.title || "Modal";
|
|
11383
11396
|
const align = props.align || "left";
|
|
11397
|
+
const iconName = resolveIcon(props.icon, "open_in_full");
|
|
11384
11398
|
const wrapper = document.createElement("div");
|
|
11385
|
-
wrapper.className =
|
|
11399
|
+
wrapper.className = "nr-modal-trigger";
|
|
11400
|
+
applyAlignClass(wrapper, "nr-modal-trigger", align);
|
|
11386
11401
|
const btn = document.createElement("button");
|
|
11387
|
-
btn.className =
|
|
11402
|
+
btn.className = "nr-button nr-button--default";
|
|
11403
|
+
btn.setAttribute("aria-haspopup", "dialog");
|
|
11404
|
+
applyColor(btn, props.color, "nr-button");
|
|
11388
11405
|
applyBaseProps(btn, props);
|
|
11389
|
-
|
|
11390
|
-
if (icon) btn.appendChild(createIcon(icon));
|
|
11406
|
+
if (iconName) btn.appendChild(createIcon(iconName));
|
|
11391
11407
|
btn.appendChild(document.createTextNode(label));
|
|
11392
11408
|
const dialog = createModal(modalTitle);
|
|
11393
11409
|
const body = dialog.querySelector(".nr-modal__body");
|
|
@@ -11408,20 +11424,21 @@ var modal_default = modalDirective;
|
|
|
11408
11424
|
var buttonDirective = ({ props, renderSlot }) => {
|
|
11409
11425
|
const url = props.url || props.href || "#";
|
|
11410
11426
|
const label = props.label || props.title;
|
|
11411
|
-
const
|
|
11427
|
+
const iconName = resolveIcon(props.icon, "touch_app");
|
|
11412
11428
|
const target = props.target || "_blank";
|
|
11413
|
-
const customClass = props.class || "";
|
|
11414
11429
|
const align = props.align || "left";
|
|
11415
11430
|
const wrapper = document.createElement("div");
|
|
11416
|
-
wrapper.className =
|
|
11431
|
+
wrapper.className = "nr-button-wrap";
|
|
11432
|
+
applyAlignClass(wrapper, "nr-button-wrap", align);
|
|
11417
11433
|
if (label) {
|
|
11418
11434
|
const a = document.createElement("a");
|
|
11419
11435
|
a.href = url;
|
|
11420
11436
|
a.target = target;
|
|
11421
|
-
a.rel = "noopener noreferrer";
|
|
11437
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11422
11438
|
a.className = "nr-button nr-button--default";
|
|
11439
|
+
applyColor(a, props.color, "nr-button");
|
|
11423
11440
|
applyBaseProps(a, props);
|
|
11424
|
-
a.appendChild(createIcon(
|
|
11441
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11425
11442
|
a.appendChild(document.createTextNode(label));
|
|
11426
11443
|
wrapper.appendChild(a);
|
|
11427
11444
|
return wrapper;
|
|
@@ -11431,6 +11448,8 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11431
11448
|
if (links.length > 0) {
|
|
11432
11449
|
links.forEach((link) => {
|
|
11433
11450
|
link.classList.add("nr-button", "nr-button--default");
|
|
11451
|
+
applyColor(link, props.color, "nr-button");
|
|
11452
|
+
if (iconName) link.prepend(createIcon(iconName));
|
|
11434
11453
|
applyBaseProps(link, props);
|
|
11435
11454
|
});
|
|
11436
11455
|
wrapper.appendChild(slotContent);
|
|
@@ -11438,10 +11457,11 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11438
11457
|
const a = document.createElement("a");
|
|
11439
11458
|
a.href = url;
|
|
11440
11459
|
a.target = target;
|
|
11441
|
-
a.rel = "noopener noreferrer";
|
|
11460
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11442
11461
|
a.className = "nr-button nr-button--default";
|
|
11462
|
+
applyColor(a, props.color, "nr-button");
|
|
11443
11463
|
applyBaseProps(a, props);
|
|
11444
|
-
a.appendChild(createIcon(
|
|
11464
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11445
11465
|
a.appendChild(slotContent);
|
|
11446
11466
|
wrapper.appendChild(a);
|
|
11447
11467
|
}
|