@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/button.css
CHANGED
|
@@ -35,4 +35,28 @@
|
|
|
35
35
|
}
|
|
36
36
|
.nr-button:active {
|
|
37
37
|
transform: scale(0.95);
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ── Theme color variants ───────────────────────────────── */
|
|
41
|
+
|
|
42
|
+
.nr-button--primary,
|
|
43
|
+
.nr-button--accent { background: var(--nr-accent); color: #fff; border-color: var(--nr-accent); }
|
|
44
|
+
.nr-button--primary:hover,
|
|
45
|
+
.nr-button--accent:hover { background: color-mix(in srgb, var(--nr-accent) 85%, #000); color: #fff; }
|
|
46
|
+
|
|
47
|
+
.nr-button--secondary { background: var(--nr-secondary); color: #fff; border-color: var(--nr-secondary); }
|
|
48
|
+
.nr-button--secondary:hover { background: color-mix(in srgb, var(--nr-secondary) 85%, #000); color: #fff; }
|
|
49
|
+
|
|
50
|
+
.nr-button--info { background: var(--nr-info); color: #fff; border-color: var(--nr-info); }
|
|
51
|
+
.nr-button--info:hover { background: color-mix(in srgb, var(--nr-info) 85%, #000); color: #fff; }
|
|
52
|
+
|
|
53
|
+
.nr-button--success { background: var(--nr-success); color: #fff; border-color: var(--nr-success); }
|
|
54
|
+
.nr-button--success:hover { background: color-mix(in srgb, var(--nr-success) 85%, #000); color: #fff; }
|
|
55
|
+
|
|
56
|
+
.nr-button--warning { background: var(--nr-warning); color: #1f2937; border-color: var(--nr-warning); }
|
|
57
|
+
.nr-button--warning:hover { background: color-mix(in srgb, var(--nr-warning) 85%, #000); color: #1f2937; }
|
|
58
|
+
|
|
59
|
+
.nr-button--danger,
|
|
60
|
+
.nr-button--error { background: var(--nr-danger); color: #fff; border-color: var(--nr-danger); }
|
|
61
|
+
.nr-button--danger:hover,
|
|
62
|
+
.nr-button--error:hover { background: color-mix(in srgb, var(--nr-danger) 85%, #000); color: #fff; }
|
package/dist/index.cjs
CHANGED
|
@@ -11089,6 +11089,7 @@ function createModal(title) {
|
|
|
11089
11089
|
header.appendChild(titleEl);
|
|
11090
11090
|
const closeBtn = document.createElement("button");
|
|
11091
11091
|
closeBtn.className = "nr-modal__close";
|
|
11092
|
+
closeBtn.setAttribute("aria-label", "Close");
|
|
11092
11093
|
closeBtn.appendChild(createIcon("close"));
|
|
11093
11094
|
closeBtn.addEventListener("click", () => dialog.close());
|
|
11094
11095
|
header.appendChild(closeBtn);
|
|
@@ -11370,6 +11371,18 @@ function openModal(dialog) {
|
|
|
11370
11371
|
}
|
|
11371
11372
|
}
|
|
11372
11373
|
var IMG_RE = /!\[([^\]]*)\]\(([^)]+)\)/g;
|
|
11374
|
+
function applyAlignClass(el, baseClass, align) {
|
|
11375
|
+
if (align === "center") {
|
|
11376
|
+
el.classList.add(`${baseClass}--center`);
|
|
11377
|
+
} else if (align === "right") {
|
|
11378
|
+
el.classList.add(`${baseClass}--right`);
|
|
11379
|
+
}
|
|
11380
|
+
}
|
|
11381
|
+
function resolveIcon(value, fallback) {
|
|
11382
|
+
if (!value) return fallback;
|
|
11383
|
+
if (value === "none" || value === "off") return null;
|
|
11384
|
+
return value;
|
|
11385
|
+
}
|
|
11373
11386
|
function parseIntProp(value, defaultValue) {
|
|
11374
11387
|
if (!value) return defaultValue;
|
|
11375
11388
|
const n = parseInt(value, 10);
|
|
@@ -11409,13 +11422,16 @@ var modalDirective = ({ props, renderSlot }) => {
|
|
|
11409
11422
|
const label = props.label || props.title || "Open";
|
|
11410
11423
|
const modalTitle = props.title || "Modal";
|
|
11411
11424
|
const align = props.align || "left";
|
|
11425
|
+
const iconName = resolveIcon(props.icon, "open_in_full");
|
|
11412
11426
|
const wrapper = document.createElement("div");
|
|
11413
|
-
wrapper.className =
|
|
11427
|
+
wrapper.className = "nr-modal-trigger";
|
|
11428
|
+
applyAlignClass(wrapper, "nr-modal-trigger", align);
|
|
11414
11429
|
const btn = document.createElement("button");
|
|
11415
|
-
btn.className =
|
|
11430
|
+
btn.className = "nr-button nr-button--default";
|
|
11431
|
+
btn.setAttribute("aria-haspopup", "dialog");
|
|
11432
|
+
applyColor(btn, props.color, "nr-button");
|
|
11416
11433
|
applyBaseProps(btn, props);
|
|
11417
|
-
|
|
11418
|
-
if (icon) btn.appendChild(createIcon(icon));
|
|
11434
|
+
if (iconName) btn.appendChild(createIcon(iconName));
|
|
11419
11435
|
btn.appendChild(document.createTextNode(label));
|
|
11420
11436
|
const dialog = createModal(modalTitle);
|
|
11421
11437
|
const body = dialog.querySelector(".nr-modal__body");
|
|
@@ -11436,20 +11452,21 @@ var modal_default = modalDirective;
|
|
|
11436
11452
|
var buttonDirective = ({ props, renderSlot }) => {
|
|
11437
11453
|
const url = props.url || props.href || "#";
|
|
11438
11454
|
const label = props.label || props.title;
|
|
11439
|
-
const
|
|
11455
|
+
const iconName = resolveIcon(props.icon, "touch_app");
|
|
11440
11456
|
const target = props.target || "_blank";
|
|
11441
|
-
const customClass = props.class || "";
|
|
11442
11457
|
const align = props.align || "left";
|
|
11443
11458
|
const wrapper = document.createElement("div");
|
|
11444
|
-
wrapper.className =
|
|
11459
|
+
wrapper.className = "nr-button-wrap";
|
|
11460
|
+
applyAlignClass(wrapper, "nr-button-wrap", align);
|
|
11445
11461
|
if (label) {
|
|
11446
11462
|
const a = document.createElement("a");
|
|
11447
11463
|
a.href = url;
|
|
11448
11464
|
a.target = target;
|
|
11449
|
-
a.rel = "noopener noreferrer";
|
|
11465
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11450
11466
|
a.className = "nr-button nr-button--default";
|
|
11467
|
+
applyColor(a, props.color, "nr-button");
|
|
11451
11468
|
applyBaseProps(a, props);
|
|
11452
|
-
a.appendChild(createIcon(
|
|
11469
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11453
11470
|
a.appendChild(document.createTextNode(label));
|
|
11454
11471
|
wrapper.appendChild(a);
|
|
11455
11472
|
return wrapper;
|
|
@@ -11459,6 +11476,8 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11459
11476
|
if (links.length > 0) {
|
|
11460
11477
|
links.forEach((link) => {
|
|
11461
11478
|
link.classList.add("nr-button", "nr-button--default");
|
|
11479
|
+
applyColor(link, props.color, "nr-button");
|
|
11480
|
+
if (iconName) link.prepend(createIcon(iconName));
|
|
11462
11481
|
applyBaseProps(link, props);
|
|
11463
11482
|
});
|
|
11464
11483
|
wrapper.appendChild(slotContent);
|
|
@@ -11466,10 +11485,11 @@ var buttonDirective = ({ props, renderSlot }) => {
|
|
|
11466
11485
|
const a = document.createElement("a");
|
|
11467
11486
|
a.href = url;
|
|
11468
11487
|
a.target = target;
|
|
11469
|
-
a.rel = "noopener noreferrer";
|
|
11488
|
+
if (target === "_blank") a.rel = "noopener noreferrer";
|
|
11470
11489
|
a.className = "nr-button nr-button--default";
|
|
11490
|
+
applyColor(a, props.color, "nr-button");
|
|
11471
11491
|
applyBaseProps(a, props);
|
|
11472
|
-
a.appendChild(createIcon(
|
|
11492
|
+
if (iconName) a.appendChild(createIcon(iconName));
|
|
11473
11493
|
a.appendChild(slotContent);
|
|
11474
11494
|
wrapper.appendChild(a);
|
|
11475
11495
|
}
|