@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/vanilla.js
CHANGED
|
@@ -11048,6 +11048,7 @@ function createModal(title) {
|
|
|
11048
11048
|
header.appendChild(titleEl);
|
|
11049
11049
|
const closeBtn = document.createElement("button");
|
|
11050
11050
|
closeBtn.className = "nr-modal__close";
|
|
11051
|
+
closeBtn.setAttribute("aria-label", "Close");
|
|
11051
11052
|
closeBtn.appendChild(createIcon("close"));
|
|
11052
11053
|
closeBtn.addEventListener("click", () => dialog.close());
|
|
11053
11054
|
header.appendChild(closeBtn);
|
|
@@ -11329,6 +11330,18 @@ function openModal(dialog) {
|
|
|
11329
11330
|
}
|
|
11330
11331
|
}
|
|
11331
11332
|
var IMG_RE = /!\[([^\]]*)\]\(([^)]+)\)/g;
|
|
11333
|
+
function applyAlignClass(el, baseClass, align) {
|
|
11334
|
+
if (align === "center") {
|
|
11335
|
+
el.classList.add(`${baseClass}--center`);
|
|
11336
|
+
} else if (align === "right") {
|
|
11337
|
+
el.classList.add(`${baseClass}--right`);
|
|
11338
|
+
}
|
|
11339
|
+
}
|
|
11340
|
+
function resolveIcon(value, fallback) {
|
|
11341
|
+
if (!value) return fallback;
|
|
11342
|
+
if (value === "none" || value === "off") return null;
|
|
11343
|
+
return value;
|
|
11344
|
+
}
|
|
11332
11345
|
function parseIntProp(value, defaultValue) {
|
|
11333
11346
|
if (!value) return defaultValue;
|
|
11334
11347
|
const n = parseInt(value, 10);
|
|
@@ -11368,13 +11381,16 @@ var modalDirective = ({ props, renderSlot }) => {
|
|
|
11368
11381
|
const label = props.label || props.title || "Open";
|
|
11369
11382
|
const modalTitle = props.title || "Modal";
|
|
11370
11383
|
const align = props.align || "left";
|
|
11384
|
+
const iconName = resolveIcon(props.icon, "open_in_full");
|
|
11371
11385
|
const wrapper = document.createElement("div");
|
|
11372
|
-
wrapper.className =
|
|
11386
|
+
wrapper.className = "nr-modal-trigger";
|
|
11387
|
+
applyAlignClass(wrapper, "nr-modal-trigger", align);
|
|
11373
11388
|
const btn = document.createElement("button");
|
|
11374
|
-
btn.className =
|
|
11389
|
+
btn.className = "nr-button nr-button--default";
|
|
11390
|
+
btn.setAttribute("aria-haspopup", "dialog");
|
|
11391
|
+
applyColor(btn, props.color, "nr-button");
|
|
11375
11392
|
applyBaseProps(btn, props);
|
|
11376
|
-
|
|
11377
|
-
if (icon) btn.appendChild(createIcon(icon));
|
|
11393
|
+
if (iconName) btn.appendChild(createIcon(iconName));
|
|
11378
11394
|
btn.appendChild(document.createTextNode(label));
|
|
11379
11395
|
const dialog = createModal(modalTitle);
|
|
11380
11396
|
const body = dialog.querySelector(".nr-modal__body");
|
|
@@ -11395,20 +11411,21 @@ var modal_default = modalDirective;
|
|
|
11395
11411
|
var buttonDirective = ({ props, renderSlot }) => {
|
|
11396
11412
|
const url = props.url || props.href || "#";
|
|
11397
11413
|
const label = props.label || props.title;
|
|
11398
|
-
const
|
|
11414
|
+
const iconName = resolveIcon(props.icon, "touch_app");
|
|
11399
11415
|
const target = props.target || "_blank";
|
|
11400
|
-
const customClass = props.class || "";
|
|
11401
11416
|
const align = props.align || "left";
|
|
11402
11417
|
const wrapper = document.createElement("div");
|
|
11403
|
-
wrapper.className =
|
|
11418
|
+
wrapper.className = "nr-button-wrap";
|
|
11419
|
+
applyAlignClass(wrapper, "nr-button-wrap", align);
|
|
11404
11420
|
if (label) {
|
|
11405
11421
|
const a = document.createElement("a");
|
|
11406
11422
|
a.href = url;
|
|
11407
11423
|
a.target = target;
|
|
11408
|
-
a.rel = "noopener noreferrer";
|
|
11424
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11409
11425
|
a.className = "nr-button nr-button--default";
|
|
11426
|
+
applyColor(a, props.color, "nr-button");
|
|
11410
11427
|
applyBaseProps(a, props);
|
|
11411
|
-
a.appendChild(createIcon(
|
|
11428
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11412
11429
|
a.appendChild(document.createTextNode(label));
|
|
11413
11430
|
wrapper.appendChild(a);
|
|
11414
11431
|
return wrapper;
|
|
@@ -11418,6 +11435,8 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11418
11435
|
if (links.length > 0) {
|
|
11419
11436
|
links.forEach((link) => {
|
|
11420
11437
|
link.classList.add("nr-button", "nr-button--default");
|
|
11438
|
+
applyColor(link, props.color, "nr-button");
|
|
11439
|
+
if (iconName) link.prepend(createIcon(iconName));
|
|
11421
11440
|
applyBaseProps(link, props);
|
|
11422
11441
|
});
|
|
11423
11442
|
wrapper.appendChild(slotContent);
|
|
@@ -11425,10 +11444,11 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11425
11444
|
const a = document.createElement("a");
|
|
11426
11445
|
a.href = url;
|
|
11427
11446
|
a.target = target;
|
|
11428
|
-
a.rel = "noopener noreferrer";
|
|
11447
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11429
11448
|
a.className = "nr-button nr-button--default";
|
|
11449
|
+
applyColor(a, props.color, "nr-button");
|
|
11430
11450
|
applyBaseProps(a, props);
|
|
11431
|
-
a.appendChild(createIcon(
|
|
11451
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11432
11452
|
a.appendChild(slotContent);
|
|
11433
11453
|
wrapper.appendChild(a);
|
|
11434
11454
|
}
|