@notectl/core 1.7.2 → 1.7.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/chunks/{ColorGrid-Dneqb8if.mjs → ColorGrid--lBQ7jCK.mjs} +2 -2
- package/dist/chunks/{ColorGrid-Dneqb8if.mjs.map → ColorGrid--lBQ7jCK.mjs.map} +1 -1
- package/dist/chunks/{ColorPickerPopup-CiCLBbe9.mjs → ColorPickerPopup-TpIRlXc8.mjs} +8 -8
- package/dist/chunks/ColorPickerPopup-TpIRlXc8.mjs.map +1 -0
- package/dist/chunks/Document-Brtw2jL1.mjs.map +1 -1
- package/dist/chunks/MarkCommands-6RUJ4L3r.mjs.map +1 -1
- package/dist/chunks/NodeSpec-NZVvcCuH.mjs.map +1 -1
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs +34 -0
- package/dist/chunks/PopupPositioning-CgjgAKjp.mjs.map +1 -0
- package/dist/chunks/{StyleRuntime-ChRjVQwL.mjs → StyleRuntime-CP4NCwKT.mjs} +49 -53
- package/dist/chunks/StyleRuntime-CP4NCwKT.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
- package/dist/chunks/{index-D515iymW.mjs → index--7pBhSF4.mjs} +5 -5
- package/dist/chunks/index--7pBhSF4.mjs.map +1 -0
- package/dist/chunks/index-BXCkjDax.mjs +161 -0
- package/dist/chunks/index-BXCkjDax.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-DpLVJ71w.mjs → index-BcDRT4K2.mjs} +81 -93
- package/dist/chunks/index-BcDRT4K2.mjs.map +1 -0
- package/dist/chunks/{index--n1RGpq-.mjs → index-BjFBWBOC.mjs} +46 -49
- package/dist/chunks/index-BjFBWBOC.mjs.map +1 -0
- package/dist/chunks/{index-BqNUfq-y.mjs → index-CCyqQ0Dz.mjs} +2 -2
- package/dist/chunks/{index-BqNUfq-y.mjs.map → index-CCyqQ0Dz.mjs.map} +1 -1
- package/dist/chunks/{index-DyzigvbZ.mjs → index-DSAuGP4n.mjs} +50 -50
- package/dist/chunks/index-DSAuGP4n.mjs.map +1 -0
- package/dist/chunks/{index-BhDXjueu.mjs → index-DtRfqsq5.mjs} +14 -14
- package/dist/chunks/{index-BhDXjueu.mjs.map → index-DtRfqsq5.mjs.map} +1 -1
- package/dist/chunks/{index-Dk49P9N4.mjs → index-Dum8yE_t.mjs} +11 -11
- package/dist/chunks/{index-Dk49P9N4.mjs.map → index-Dum8yE_t.mjs.map} +1 -1
- package/dist/chunks/{index-CluzpB2b.mjs → index-DxbQirny.mjs} +7 -7
- package/dist/chunks/{index-CluzpB2b.mjs.map → index-DxbQirny.mjs.map} +1 -1
- package/dist/chunks/{index-CWltg1wK.mjs → index-WpbK_s_H.mjs} +20 -25
- package/dist/chunks/index-WpbK_s_H.mjs.map +1 -0
- package/dist/chunks/{index-D3NlpmT1.mjs → index-WrqH1wG8.mjs} +3 -3
- package/dist/chunks/{index-D3NlpmT1.mjs.map → index-WrqH1wG8.mjs.map} +1 -1
- package/dist/chunks/{index-BvqkuEY1.mjs → index-fx3KIap3.mjs} +3 -3
- package/dist/chunks/{index-BvqkuEY1.mjs.map → index-fx3KIap3.mjs.map} +1 -1
- package/dist/chunks/{index-BAke7kNL.mjs → index-oOJo-ywB.mjs} +41 -41
- package/dist/chunks/{index-BAke7kNL.mjs.map → index-oOJo-ywB.mjs.map} +1 -1
- package/dist/chunks/{index-ABlTDvEX.mjs → index-toj88jtL.mjs} +2 -2
- package/dist/chunks/{index-ABlTDvEX.mjs.map → index-toj88jtL.mjs.map} +1 -1
- package/dist/commands/MarkCommands.d.ts +3 -3
- package/dist/commands/MarkCommands.d.ts.map +1 -1
- package/dist/editor/CSSClassCollector.d.ts +36 -0
- package/dist/editor/CSSClassCollector.d.ts.map +1 -0
- package/dist/editor/ContentHTMLTypes.d.ts +29 -0
- package/dist/editor/ContentHTMLTypes.d.ts.map +1 -0
- package/dist/editor/ContentStyleInjector.d.ts +69 -0
- package/dist/editor/ContentStyleInjector.d.ts.map +1 -0
- package/dist/editor/DocumentParser.d.ts +9 -1
- package/dist/editor/DocumentParser.d.ts.map +1 -1
- package/dist/editor/DocumentSerializer.d.ts +6 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -1
- package/dist/editor/MarkSerializer.d.ts +7 -0
- package/dist/editor/MarkSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +8 -11
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/styles/font-select.d.ts +1 -1
- package/dist/editor/styles/font-select.d.ts.map +1 -1
- package/dist/editor/styles/font-size-select.d.ts +1 -1
- package/dist/editor/styles/font-size-select.d.ts.map +1 -1
- package/dist/editor/styles/heading-select.d.ts +1 -1
- package/dist/editor/styles/heading-select.d.ts.map +1 -1
- package/dist/editor/styles/toolbar.d.ts +1 -1
- package/dist/editor/styles/toolbar.d.ts.map +1 -1
- package/dist/index.d.ts +10 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/model/Document.d.ts +0 -4
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/NodeSpec.d.ts +19 -2
- package/dist/model/NodeSpec.d.ts.map +1 -1
- package/dist/notectl-core.mjs +460 -336
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +676 -587
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +0 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/index.d.ts +2 -1
- package/dist/plugins/code-block/index.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +0 -1
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts +0 -2
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +3 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts +2 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
- package/dist/plugins/shared/PopupManager.d.ts +12 -2
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts +3 -2
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +0 -3
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +2 -2
- package/dist/presets/PresetTypes.d.ts +1 -1
- package/dist/presets/PresetTypes.d.ts.map +1 -1
- package/dist/style/StyleRuntime.d.ts +3 -7
- package/dist/style/StyleRuntime.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/ColorPickerPopup-CiCLBbe9.mjs.map +0 -1
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs +0 -32
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs.map +0 -1
- package/dist/chunks/StyleRuntime-ChRjVQwL.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-DpLVJ71w.mjs.map +0 -1
- package/dist/chunks/index--n1RGpq-.mjs.map +0 -1
- package/dist/chunks/index-4or5UzNO.mjs +0 -168
- package/dist/chunks/index-4or5UzNO.mjs.map +0 -1
- package/dist/chunks/index-CWltg1wK.mjs.map +0 -1
- package/dist/chunks/index-D515iymW.mjs.map +0 -1
- package/dist/chunks/index-DyzigvbZ.mjs.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
+
import { e } from "./HTMLUtils-DTqQzcKR.mjs";
|
|
3
|
+
import { a as n } from "./StyleRuntime-CP4NCwKT.mjs";
|
|
4
|
+
import { c as o } from "./ColorValidation-CV4f1wu6.mjs";
|
|
5
|
+
import { r as i, i as r, a as s, g as a } from "./AttributedMarkCommands-BtLea72z.mjs";
|
|
6
|
+
import { m as l } from "./TypeBrands-C09nE2qO.mjs";
|
|
7
|
+
const c = { label: "Font Size", tooltip: "Font Size", customFontSizeAria: "Custom font size", fontSizesAria: "Font sizes" }, p = { en: c, de: { label: "Schriftgröße", tooltip: "Schriftgröße", customFontSizeAria: "Benutzerdefinierte Schriftgröße", fontSizesAria: "Schriftgrößen" }, es: { label: "Tamaño de fuente", tooltip: "Tamaño de fuente", customFontSizeAria: "Tamaño de fuente personalizado", fontSizesAria: "Tamaños de fuente" }, fr: { label: "Taille de police", tooltip: "Taille de police", customFontSizeAria: "Taille de police personnalisée", fontSizesAria: "Tailles de police" }, zh: { label: "字号", tooltip: "字号", customFontSizeAria: "自定义字号", fontSizesAria: "字号列表" }, ru: { label: "Размер шрифта", tooltip: "Размер шрифта", customFontSizeAria: "Произвольный размер шрифта", fontSizesAria: "Размеры шрифта" }, ar: { label: "حجم الخط", tooltip: "حجم الخط", customFontSizeAria: "حجم خط مخصص", fontSizesAria: "أحجام الخط" }, hi: { label: "फ़ॉन्ट आकार", tooltip: "फ़ॉन्ट आकार", customFontSizeAria: "कस्टम फ़ॉन्ट आकार", fontSizesAria: "फ़ॉन्ट आकार सूची" } };
|
|
8
|
+
function f(t2, e2) {
|
|
9
|
+
const n2 = (function(t3) {
|
|
10
|
+
return a(t3, "fontSize", (t4) => t4.attrs.size ?? null);
|
|
11
|
+
})(t2);
|
|
12
|
+
if (!n2) return e2;
|
|
13
|
+
const o2 = Number.parseInt(n2, 10);
|
|
14
|
+
return Number.isNaN(o2) ? e2 : o2;
|
|
15
|
+
}
|
|
16
|
+
function u(t2, e2, n2) {
|
|
17
|
+
const o2 = { type: l("fontSize"), attrs: { size: n2 } }, i2 = s(e2, o2);
|
|
18
|
+
return !!i2 && (t2.dispatch(i2), true);
|
|
19
|
+
}
|
|
20
|
+
function d(t2, e2) {
|
|
21
|
+
const n2 = i(e2, l("fontSize"));
|
|
22
|
+
return !!n2 && (t2.dispatch(n2), true);
|
|
23
|
+
}
|
|
24
|
+
function m(t2, e2, n2, o2, i2) {
|
|
25
|
+
const r2 = (function(t3, e3, n3) {
|
|
26
|
+
if ("up" === e3) {
|
|
27
|
+
for (const e4 of n3) if (e4 > t3) return e4;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
for (let e4 = n3.length - 1; e4 >= 0; e4--) {
|
|
31
|
+
const o3 = n3[e4];
|
|
32
|
+
if (void 0 !== o3 && o3 < t3) return o3;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
})(f(e2, i2), n2, o2);
|
|
36
|
+
return null !== r2 && (r2 === i2 ? d(t2, e2) : u(t2, e2, `${r2}px`));
|
|
37
|
+
}
|
|
38
|
+
function z(t2, e2, n2) {
|
|
39
|
+
e2 === n2 ? t2.executeCommand("removeFontSize") : u(t2, t2.getState(), `${e2}px`);
|
|
40
|
+
}
|
|
41
|
+
function S(t2, e2) {
|
|
42
|
+
const n2 = document.createElement("button");
|
|
43
|
+
n2.type = "button", n2.id = `notectl-font-size-option-${t2}`, n2.className = "notectl-font-size-picker__item", n2.setAttribute("role", "option"), n2.setAttribute("aria-selected", String(e2)), e2 && n2.classList.add("notectl-font-size-picker__item--active");
|
|
44
|
+
const o2 = document.createElement("span");
|
|
45
|
+
o2.className = "notectl-font-size-picker__check", o2.textContent = e2 ? "✓" : "", n2.appendChild(o2);
|
|
46
|
+
const i2 = document.createElement("span");
|
|
47
|
+
return i2.className = "notectl-font-size-picker__label", i2.textContent = String(t2), n2.appendChild(i2), n2;
|
|
48
|
+
}
|
|
49
|
+
const g = [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96];
|
|
50
|
+
class h {
|
|
51
|
+
id = "fontSize";
|
|
52
|
+
name = "Font Size";
|
|
53
|
+
priority = 21;
|
|
54
|
+
config;
|
|
55
|
+
sizes;
|
|
56
|
+
defaultSize;
|
|
57
|
+
locale;
|
|
58
|
+
constructor(t2) {
|
|
59
|
+
var e2;
|
|
60
|
+
this.config = { ...t2 }, this.sizes = (function(t3) {
|
|
61
|
+
if (!t3 || 0 === t3.length) return g;
|
|
62
|
+
const e3 = [...new Set(t3)].filter((t4) => Number.isInteger(t4) && t4 > 0);
|
|
63
|
+
return e3.sort((t4, e4) => t4 - e4), e3.length > 0 ? e3 : g;
|
|
64
|
+
})(t2?.sizes), this.defaultSize = (e2 = t2?.defaultSize, void 0 === e2 ? 16 : Number.isInteger(e2) && e2 > 0 ? e2 : 16);
|
|
65
|
+
}
|
|
66
|
+
init(e2) {
|
|
67
|
+
this.locale = t(p, e2, this.config.locale), e2.registerStyleSheet("\n/* Font Size Select — Width overrides for combobox button */\n.notectl-toolbar-btn--fontSize {\n min-width: 60px;\n max-width: 80px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n min-width: 140px;\n display: flex;\n flex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n padding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n font-size: 13px;\n font-family: inherit;\n color: var(--notectl-fg);\n background: var(--notectl-bg);\n outline: none;\n box-sizing: border-box;\n -moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n border-color: var(--notectl-border-focus);\n box-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n max-height: 280px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 7px 12px;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--notectl-fg);\n line-height: 1.4;\n text-align: left;\n white-space: nowrap;\n font-family: inherit;\n transition: background 0.1s;\n outline: none;\n}\n\n@media (hover: hover) {\n .notectl-font-size-picker__item:hover {\n background: var(--notectl-hover-bg);\n }\n}\n\n.notectl-font-size-picker__item--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n .notectl-font-size-picker__item--active:hover {\n background: var(--notectl-active-bg);\n }\n}\n\n.notectl-font-size-picker__item--focused {\n outline: 2px solid var(--notectl-primary);\n outline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n flex-shrink: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__label {\n flex: 1;\n}\n"), this.registerMarkSpec(e2), this.registerCommands(e2), this.registerKeymaps(e2), this.registerToolbarItem(e2), this.applyDefaultSizeToContainer(e2);
|
|
68
|
+
}
|
|
69
|
+
destroy() {
|
|
70
|
+
}
|
|
71
|
+
registerMarkSpec(t2) {
|
|
72
|
+
t2.registerMarkSpec({ type: "fontSize", rank: 4, attrs: { size: { default: "" } }, toDOM(t3) {
|
|
73
|
+
const e2 = document.createElement("span"), o2 = t3.attrs?.size ?? "";
|
|
74
|
+
return o2 && n(e2, "fontSize", o2), e2;
|
|
75
|
+
}, toHTMLString: (t3, n2) => {
|
|
76
|
+
const i2 = String(t3.attrs?.size ?? "");
|
|
77
|
+
return i2 && o(i2) ? `<span style="font-size: ${e(i2)}">${n2}</span>` : n2;
|
|
78
|
+
}, toHTMLStyle: (t3) => {
|
|
79
|
+
const n2 = String(t3.attrs?.size ?? "");
|
|
80
|
+
return n2 && o(n2) ? `font-size: ${e(n2)}` : null;
|
|
81
|
+
}, parseHTML: [{ tag: "span", getAttrs: (t3) => {
|
|
82
|
+
const e2 = t3.style.fontSize;
|
|
83
|
+
return !!e2 && { size: e2 };
|
|
84
|
+
} }], sanitize: { tags: ["span"] } });
|
|
85
|
+
}
|
|
86
|
+
registerCommands(t2) {
|
|
87
|
+
t2.registerCommand("removeFontSize", () => d(t2, t2.getState())), t2.registerCommand("setFontSize", () => false), t2.registerCommand("increaseFontSize", () => m(t2, t2.getState(), "up", this.sizes, this.defaultSize)), t2.registerCommand("decreaseFontSize", () => m(t2, t2.getState(), "down", this.sizes, this.defaultSize));
|
|
88
|
+
}
|
|
89
|
+
registerKeymaps(t2) {
|
|
90
|
+
t2.registerKeymap({ "Mod-Shift-+": () => m(t2, t2.getState(), "up", this.sizes, this.defaultSize), "Mod-Shift-_": () => m(t2, t2.getState(), "down", this.sizes, this.defaultSize) });
|
|
91
|
+
}
|
|
92
|
+
registerToolbarItem(t2) {
|
|
93
|
+
t2.registerToolbarItem({ id: "fontSize", group: "format", label: this.locale.label, tooltip: this.locale.tooltip, command: "removeFontSize", priority: 6, popupType: "combobox", separatorAfter: this.config.separatorAfter, getLabel: (t3) => String(f(t3, this.defaultSize)), renderPopup: (t3, e2, n2) => {
|
|
94
|
+
!(function(t4, e3, n3) {
|
|
95
|
+
t4.classList.add("notectl-font-size-picker");
|
|
96
|
+
const o2 = f(e3.getState(), n3.defaultSize), i2 = (function(t5, e4) {
|
|
97
|
+
const n4 = document.createElement("input");
|
|
98
|
+
return n4.type = "number", n4.className = "notectl-font-size-picker__input", n4.min = String(1), n4.max = String(400), n4.value = String(t5), n4.setAttribute("aria-label", e4.locale?.customFontSizeAria ?? "Custom font size"), n4;
|
|
99
|
+
})(o2, n3);
|
|
100
|
+
!(function(t5, e4) {
|
|
101
|
+
const n4 = document.createElement("div");
|
|
102
|
+
n4.className = "notectl-font-size-picker__input-wrapper", n4.appendChild(e4), t5.appendChild(n4);
|
|
103
|
+
})(t4, i2);
|
|
104
|
+
const { list: r2, items: s2 } = (function(t5, e4, n4, o3) {
|
|
105
|
+
const i3 = document.createElement("div");
|
|
106
|
+
i3.className = "notectl-font-size-picker__list", i3.setAttribute("role", "listbox"), i3.setAttribute("aria-label", o3.locale?.fontSizesAria ?? "Font sizes");
|
|
107
|
+
const r3 = [];
|
|
108
|
+
for (const s3 of t5) {
|
|
109
|
+
const t6 = S(s3, s3 === e4);
|
|
110
|
+
t6.addEventListener("mousedown", (t7) => {
|
|
111
|
+
t7.preventDefault(), t7.stopPropagation(), z(n4, s3, o3.defaultSize), o3.onClose({ restoreFocusTo: o3.contentElement });
|
|
112
|
+
}), r3.push(t6), i3.appendChild(t6);
|
|
113
|
+
}
|
|
114
|
+
return { list: i3, items: r3 };
|
|
115
|
+
})(n3.sizes, o2, e3, n3);
|
|
116
|
+
t4.appendChild(r2), (function(t5, e4, n4, o3) {
|
|
117
|
+
const i3 = e4.indexOf(n4);
|
|
118
|
+
if (i3 < 0) return;
|
|
119
|
+
const r3 = t5[i3];
|
|
120
|
+
r3 && (requestAnimationFrame(() => {
|
|
121
|
+
r3.scrollIntoView({ block: "nearest" });
|
|
122
|
+
}), o3.setAttribute("aria-activedescendant", r3.id));
|
|
123
|
+
})(s2, n3.sizes, o2, r2), (function(t5, e4, n4, o3, i3) {
|
|
124
|
+
let r3 = -1;
|
|
125
|
+
const s3 = (t6) => {
|
|
126
|
+
r3 >= 0 && r3 < n4.length && n4[r3]?.classList.remove("notectl-font-size-picker__item--focused"), r3 = t6;
|
|
127
|
+
const o4 = n4[r3];
|
|
128
|
+
r3 >= 0 && r3 < n4.length && o4 && (o4.classList.add("notectl-font-size-picker__item--focused"), o4.scrollIntoView({ block: "nearest" }), e4.setAttribute("aria-activedescendant", o4.id));
|
|
129
|
+
};
|
|
130
|
+
t5.addEventListener("keydown", (e5) => {
|
|
131
|
+
if ("Enter" === e5.key) {
|
|
132
|
+
e5.preventDefault();
|
|
133
|
+
const n5 = Number.parseInt(t5.value, 10);
|
|
134
|
+
!Number.isNaN(n5) && n5 >= 1 && n5 <= 400 && (z(o3, n5, i3.defaultSize), i3.onClose({ restoreFocusTo: i3.contentElement }));
|
|
135
|
+
} else "ArrowDown" === e5.key ? (e5.preventDefault(), s3(0), n4[0]?.focus()) : "Escape" === e5.key && (e5.preventDefault(), i3.onClose({ restoreFocusTo: i3.contentElement }));
|
|
136
|
+
}), e4.addEventListener("keydown", (e5) => {
|
|
137
|
+
if ("ArrowDown" === e5.key) e5.preventDefault(), r3 < n4.length - 1 && (s3(r3 + 1), n4[r3]?.focus());
|
|
138
|
+
else if ("ArrowUp" === e5.key) e5.preventDefault(), r3 > 0 ? (s3(r3 - 1), n4[r3]?.focus()) : (s3(-1), t5.focus());
|
|
139
|
+
else if ("Enter" === e5.key) {
|
|
140
|
+
e5.preventDefault();
|
|
141
|
+
const t6 = i3.sizes[r3];
|
|
142
|
+
r3 >= 0 && r3 < i3.sizes.length && void 0 !== t6 && (z(o3, t6, i3.defaultSize), i3.onClose({ restoreFocusTo: i3.contentElement }));
|
|
143
|
+
} else "Escape" === e5.key && (e5.preventDefault(), i3.onClose({ restoreFocusTo: i3.contentElement }));
|
|
144
|
+
});
|
|
145
|
+
})(i2, r2, s2, e3, n3);
|
|
146
|
+
})(t3, e2, { sizes: this.sizes, defaultSize: this.defaultSize, onClose: n2, contentElement: e2.getContainer(), locale: this.locale });
|
|
147
|
+
}, isActive: (t3) => (function(t4) {
|
|
148
|
+
return r(t4, "fontSize");
|
|
149
|
+
})(t3) });
|
|
150
|
+
}
|
|
151
|
+
applyDefaultSizeToContainer(t2) {
|
|
152
|
+
const e2 = t2.getContainer();
|
|
153
|
+
n(e2, "fontSize", `${this.defaultSize}px`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
h as F,
|
|
158
|
+
p as a,
|
|
159
|
+
c as b
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=index-BXCkjDax.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BXCkjDax.mjs","sources":["../../src/editor/styles/font-size-select.ts","../../src/plugins/font-size/FontSizeLocale.ts","../../src/plugins/font-size/FontSizeOperations.ts","../../src/plugins/font-size/FontSizePopup.ts","../../src/plugins/font-size/FontSizePlugin.ts"],"sourcesContent":["/** Font size picker toolbar combobox + popup styles. */\nexport const FONT_SIZE_SELECT_CSS = `\n/* Font Size Select — Width overrides for combobox button */\n.notectl-toolbar-btn--fontSize {\n\tmin-width: 60px;\n\tmax-width: 80px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-bg);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\tline-height: 1.4;\n\ttext-align: left;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n\toutline: none;\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n@media (hover: hover) {\n\t.notectl-font-size-picker__item--active:hover {\n\t\tbackground: var(--notectl-active-bg);\n\t}\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__label {\n\tflex: 1;\n}\n`;\n","/** Locale interface and default English locale for the FontSizePlugin. */\n\n// --- Locale Interface ---\n\nexport interface FontSizeLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n\treadonly customFontSizeAria: string;\n\treadonly fontSizesAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const FONT_SIZE_LOCALE_EN: FontSizeLocale = {\n\tlabel: 'Font Size',\n\ttooltip: 'Font Size',\n\tcustomFontSizeAria: 'Custom font size',\n\tfontSizesAria: 'Font sizes',\n};\n\n// --- German Locale ---\n\nexport const FONT_SIZE_LOCALE_DE: FontSizeLocale = {\n\tlabel: 'Schriftgröße',\n\ttooltip: 'Schriftgröße',\n\tcustomFontSizeAria: 'Benutzerdefinierte Schriftgröße',\n\tfontSizesAria: 'Schriftgrößen',\n};\n\n// --- Spanish Locale ---\n\nexport const FONT_SIZE_LOCALE_ES: FontSizeLocale = {\n\tlabel: 'Tamaño de fuente',\n\ttooltip: 'Tamaño de fuente',\n\tcustomFontSizeAria: 'Tamaño de fuente personalizado',\n\tfontSizesAria: 'Tamaños de fuente',\n};\n\n// --- French Locale ---\n\nexport const FONT_SIZE_LOCALE_FR: FontSizeLocale = {\n\tlabel: 'Taille de police',\n\ttooltip: 'Taille de police',\n\tcustomFontSizeAria: 'Taille de police personnalisée',\n\tfontSizesAria: 'Tailles de police',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const FONT_SIZE_LOCALE_ZH: FontSizeLocale = {\n\tlabel: '字号',\n\ttooltip: '字号',\n\tcustomFontSizeAria: '自定义字号',\n\tfontSizesAria: '字号列表',\n};\n\n// --- Russian Locale ---\n\nexport const FONT_SIZE_LOCALE_RU: FontSizeLocale = {\n\tlabel: 'Размер шрифта',\n\ttooltip: 'Размер шрифта',\n\tcustomFontSizeAria: 'Произвольный размер шрифта',\n\tfontSizesAria: 'Размеры шрифта',\n};\n\n// --- Arabic Locale ---\n\nexport const FONT_SIZE_LOCALE_AR: FontSizeLocale = {\n\tlabel: 'حجم الخط',\n\ttooltip: 'حجم الخط',\n\tcustomFontSizeAria: 'حجم خط مخصص',\n\tfontSizesAria: 'أحجام الخط',\n};\n\n// --- Hindi Locale ---\n\nexport const FONT_SIZE_LOCALE_HI: FontSizeLocale = {\n\tlabel: 'फ़ॉन्ट आकार',\n\ttooltip: 'फ़ॉन्ट आकार',\n\tcustomFontSizeAria: 'कस्टम फ़ॉन्ट आकार',\n\tfontSizesAria: 'फ़ॉन्ट आकार सूची',\n};\n\n// --- Locale Map ---\n\nexport const FONT_SIZE_LOCALES: Record<string, FontSizeLocale> = {\n\ten: FONT_SIZE_LOCALE_EN,\n\tde: FONT_SIZE_LOCALE_DE,\n\tes: FONT_SIZE_LOCALE_ES,\n\tfr: FONT_SIZE_LOCALE_FR,\n\tzh: FONT_SIZE_LOCALE_ZH,\n\tru: FONT_SIZE_LOCALE_RU,\n\tar: FONT_SIZE_LOCALE_AR,\n\thi: FONT_SIZE_LOCALE_HI,\n};\n","/**\n * Pure business logic for font-size state queries and transaction builders.\n * All functions are DOM-free and operate on EditorState / PluginContext.\n *\n * Delegates to the generic AttributedMarkCommands helpers for the\n * collapsed-vs-range branching logic.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\n\n// --- State Queries ---\n\n/** Returns the raw fontSize CSS value at the current selection, or null. */\nexport function getActiveSize(state: EditorState): string | null {\n\treturn getMarkAttrAtSelection(state, 'fontSize', (m) => m.attrs.size ?? null);\n}\n\n/** Returns the active font size as a number, falling back to defaultSize. */\nexport function getActiveSizeNumeric(state: EditorState, defaultSize: number): number {\n\tconst raw: string | null = getActiveSize(state);\n\tif (!raw) return defaultSize;\n\tconst parsed: number = Number.parseInt(raw, 10);\n\treturn Number.isNaN(parsed) ? defaultSize : parsed;\n}\n\n/** Returns true when the selection carries a fontSize mark. */\nexport function isFontSizeActive(state: EditorState): boolean {\n\treturn isAttributedMarkActive(state, 'fontSize');\n}\n\n// --- Commands ---\n\n/** Applies a fontSize mark with the given CSS size string to the selection. */\nexport function applyFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst mark = { type: markType('fontSize'), attrs: { size } };\n\tconst tr = applyAttributedMark(state, mark);\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Removes the fontSize mark from the current selection. */\nexport function removeFontSize(context: PluginContext, state: EditorState): boolean {\n\tconst tr = removeAttributedMark(state, markType('fontSize'));\n\tif (!tr) return false;\n\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Steps the font size up or down through the preset list. */\nexport function stepFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n\tdefaultSize: number,\n): boolean {\n\tconst current: number = getActiveSizeNumeric(state, defaultSize);\n\tconst next: number | null = getNextPresetSize(current, direction, sizes);\n\tif (next === null) return false;\n\n\tif (next === defaultSize) {\n\t\treturn removeFontSize(context, state);\n\t}\n\treturn applyFontSize(context, state, `${next}px`);\n}\n\n/**\n * Selects a specific font size: removes the mark when size equals the\n * default, otherwise applies the new size.\n */\nexport function selectSize(context: PluginContext, size: number, defaultSize: number): void {\n\tif (size === defaultSize) {\n\t\tcontext.executeCommand('removeFontSize');\n\t} else {\n\t\tapplyFontSize(context, context.getState(), `${size}px`);\n\t}\n}\n\n// --- Helpers ---\n\n/** Finds the next preset size in the given direction, or null at boundaries. */\nexport function getNextPresetSize(\n\tcurrent: number,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n): number | null {\n\tif (direction === 'up') {\n\t\tfor (const size of sizes) {\n\t\t\tif (size > current) return size;\n\t\t}\n\t\treturn null;\n\t}\n\tfor (let i: number = sizes.length - 1; i >= 0; i--) {\n\t\tconst size: number | undefined = sizes[i];\n\t\tif (size !== undefined && size < current) return size;\n\t}\n\treturn null;\n}\n","/**\n * Renders the font-size picker popup with a custom numeric input\n * and an accessible preset list with keyboard navigation.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport type { PopupCloseOptions } from '../shared/PopupManager.js';\nimport type { FontSizeLocale } from './FontSizeLocale.js';\nimport { getActiveSizeNumeric, selectSize } from './FontSizeOperations.js';\n\n// --- Constants ---\n\nconst MIN_CUSTOM_SIZE = 1;\nconst MAX_CUSTOM_SIZE = 400;\n\n// --- Config ---\n\nexport interface FontSizePopupConfig {\n\treadonly sizes: readonly number[];\n\treadonly defaultSize: number;\n\treadonly onClose: (options?: PopupCloseOptions) => void;\n\treadonly contentElement: HTMLElement;\n\treadonly locale?: FontSizeLocale;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the font-size picker DOM inside the given container. */\nexport function renderFontSizePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-font-size-picker');\n\n\tconst currentSize: number = getActiveSizeNumeric(context.getState(), config.defaultSize);\n\n\tconst input: HTMLInputElement = buildCustomInput(currentSize, config);\n\tappendInputWrapper(container, input);\n\n\tconst { list, items } = buildSizeList(config.sizes, currentSize, context, config);\n\tcontainer.appendChild(list);\n\n\tscrollActiveIntoView(items, config.sizes, currentSize, list);\n\tattachKeyboardNavigation(input, list, items, context, config);\n}\n\n// --- Custom Input ---\n\nfunction buildCustomInput(currentSize: number, config: FontSizePopupConfig): HTMLInputElement {\n\tconst input: HTMLInputElement = document.createElement('input');\n\tinput.type = 'number';\n\tinput.className = 'notectl-font-size-picker__input';\n\tinput.min = String(MIN_CUSTOM_SIZE);\n\tinput.max = String(MAX_CUSTOM_SIZE);\n\tinput.value = String(currentSize);\n\tinput.setAttribute('aria-label', config.locale?.customFontSizeAria ?? 'Custom font size');\n\treturn input;\n}\n\nfunction appendInputWrapper(container: HTMLElement, input: HTMLInputElement): void {\n\tconst wrapper: HTMLDivElement = document.createElement('div');\n\twrapper.className = 'notectl-font-size-picker__input-wrapper';\n\twrapper.appendChild(input);\n\tcontainer.appendChild(wrapper);\n}\n\n// --- Size List ---\n\ninterface SizeListResult {\n\treadonly list: HTMLDivElement;\n\treadonly items: HTMLButtonElement[];\n}\n\nfunction buildSizeList(\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): SizeListResult {\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-font-size-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', config.locale?.fontSizesAria ?? 'Font sizes');\n\n\tconst items: HTMLButtonElement[] = [];\n\n\tfor (const size of sizes) {\n\t\tconst isActive: boolean = size === currentSize;\n\t\tconst item: HTMLButtonElement = buildSizeItem(size, isActive);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tselectSize(context, size, config.defaultSize);\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t});\n\n\t\titems.push(item);\n\t\tlist.appendChild(item);\n\t}\n\n\treturn { list, items };\n}\n\nfunction buildSizeItem(size: number, isActive: boolean): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.id = `notectl-font-size-option-${size}`;\n\titem.className = 'notectl-font-size-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-font-size-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-font-size-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst label: HTMLSpanElement = document.createElement('span');\n\tlabel.className = 'notectl-font-size-picker__label';\n\tlabel.textContent = String(size);\n\titem.appendChild(label);\n\n\treturn item;\n}\n\n// --- Scroll ---\n\nfunction scrollActiveIntoView(\n\titems: HTMLButtonElement[],\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tlist: HTMLDivElement,\n): void {\n\tconst activeIdx: number = sizes.indexOf(currentSize);\n\tif (activeIdx < 0) return;\n\n\tconst activeItem: HTMLButtonElement | undefined = items[activeIdx];\n\tif (!activeItem) return;\n\n\trequestAnimationFrame(() => {\n\t\tactiveItem.scrollIntoView({ block: 'nearest' });\n\t});\n\tlist.setAttribute('aria-activedescendant', activeItem.id);\n}\n\n// --- Keyboard Navigation ---\n\nfunction attachKeyboardNavigation(\n\tinput: HTMLInputElement,\n\tlist: HTMLDivElement,\n\titems: HTMLButtonElement[],\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tlet focusedIndex = -1;\n\n\tconst setFocused = (idx: number): void => {\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length) {\n\t\t\titems[focusedIndex]?.classList.remove('notectl-font-size-picker__item--focused');\n\t\t}\n\t\tfocusedIndex = idx;\n\t\tconst el: HTMLButtonElement | undefined = items[focusedIndex];\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length && el) {\n\t\t\tel.classList.add('notectl-font-size-picker__item--focused');\n\t\t\tel.scrollIntoView({ block: 'nearest' });\n\t\t\tlist.setAttribute('aria-activedescendant', el.id);\n\t\t}\n\t};\n\n\tinput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tconst val: number = Number.parseInt(input.value, 10);\n\t\t\tif (!Number.isNaN(val) && val >= MIN_CUSTOM_SIZE && val <= MAX_CUSTOM_SIZE) {\n\t\t\t\tselectSize(context, val, config.defaultSize);\n\t\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t\t}\n\t\t} else if (e.key === 'ArrowDown') {\n\t\t\te.preventDefault();\n\t\t\tsetFocused(0);\n\t\t\titems[0]?.focus();\n\t\t} else if (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n\n\tlist.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'ArrowDown') {\n\t\t\te.preventDefault();\n\t\t\tif (focusedIndex < items.length - 1) {\n\t\t\t\tsetFocused(focusedIndex + 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t}\n\t\t} else if (e.key === 'ArrowUp') {\n\t\t\te.preventDefault();\n\t\t\tif (focusedIndex > 0) {\n\t\t\t\tsetFocused(focusedIndex - 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t} else {\n\t\t\t\tsetFocused(-1);\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t} else if (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tconst selectedSize: number | undefined = config.sizes[focusedIndex];\n\t\t\tif (focusedIndex >= 0 && focusedIndex < config.sizes.length && selectedSize !== undefined) {\n\t\t\t\tselectSize(context, selectedSize, config.defaultSize);\n\t\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t\t}\n\t\t} else if (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.onClose({ restoreFocusTo: config.contentElement });\n\t\t}\n\t});\n}\n","/**\n * FontSizePlugin: registers a fontSize mark with attrs, a combobox-style\n * toolbar selector with WCAG-accessible popup, and commands for\n * increasing / decreasing font size.\n */\n\nimport { FONT_SIZE_SELECT_CSS } from '../../editor/styles/font-size-select.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isValidCSSFontSize } from '../shared/ColorValidation.js';\nimport { FONT_SIZE_LOCALES, type FontSizeLocale } from './FontSizeLocale.js';\nimport {\n\tgetActiveSizeNumeric,\n\tisFontSizeActive,\n\tremoveFontSize,\n\tstepFontSize,\n} from './FontSizeOperations.js';\nimport { renderFontSizePopup } from './FontSizePopup.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfontSize: { size: string };\n\t}\n}\n\n// --- Constants ---\n\n/** Default preset sizes shown in the font size dropdown. */\nexport const DEFAULT_FONT_SIZES: readonly number[] = [\n\t8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96,\n];\n\nconst DEFAULT_FONT_SIZE = 16;\n\n// --- Configuration ---\n\nexport interface FontSizeConfig {\n\t/**\n\t * Preset sizes shown in the font size dropdown.\n\t * Must contain positive integers. Values are sorted and deduplicated automatically.\n\t * Defaults to {@link DEFAULT_FONT_SIZES} when omitted or empty.\n\t */\n\treadonly sizes?: readonly number[];\n\t/**\n\t * The base font size that text has when no fontSize mark is applied.\n\t * Shown as the initial value in the toolbar combo and used as the\n\t * \"neutral\" size — selecting it removes the mark instead of applying one.\n\t * Defaults to 16.\n\t */\n\treadonly defaultSize?: number;\n\t/** When true, a separator is rendered after the fontSize toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: FontSizeLocale;\n}\n\n// --- Plugin ---\n\nexport class FontSizePlugin implements Plugin {\n\treadonly id = 'fontSize';\n\treadonly name = 'Font Size';\n\treadonly priority = 21;\n\n\tprivate readonly config: FontSizeConfig;\n\tprivate readonly sizes: readonly number[];\n\tprivate readonly defaultSize: number;\n\tprivate locale!: FontSizeLocale;\n\n\tconstructor(config?: Partial<FontSizeConfig>) {\n\t\tthis.config = { ...config };\n\t\tthis.sizes = resolveSizes(config?.sizes);\n\t\tthis.defaultSize = resolveDefaultSize(config?.defaultSize);\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(FONT_SIZE_LOCALES, context, this.config.locale);\n\n\t\tcontext.registerStyleSheet(FONT_SIZE_SELECT_CSS);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.applyDefaultSizeToContainer(context);\n\t}\n\n\tdestroy(): void {\n\t\t// no-op: nothing to clean up\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'fontSize',\n\t\t\trank: 4,\n\t\t\tattrs: {\n\t\t\t\tsize: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\t\tconst size: string = mark.attrs?.size ?? '';\n\t\t\t\tif (size) {\n\t\t\t\t\tsetStyleProperty(span, 'fontSize', size);\n\t\t\t\t}\n\t\t\t\treturn span;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst size: string = String(mark.attrs?.size ?? '');\n\t\t\t\tif (!size || !isValidCSSFontSize(size)) return content;\n\t\t\t\treturn `<span style=\"font-size: ${escapeHTML(size)}\">${content}</span>`;\n\t\t\t},\n\t\t\ttoHTMLStyle: (mark) => {\n\t\t\t\tconst size: string = String(mark.attrs?.size ?? '');\n\t\t\t\tif (!size || !isValidCSSFontSize(size)) return null;\n\t\t\t\treturn `font-size: ${escapeHTML(size)}`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\tconst size: string = el.style.fontSize;\n\t\t\t\t\t\tif (!size) return false;\n\t\t\t\t\t\treturn { size };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['span'] },\n\t\t});\n\t}\n\n\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFontSize', () => {\n\t\t\treturn removeFontSize(context, context.getState());\n\t\t});\n\n\t\tcontext.registerCommand('setFontSize', () => {\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('increaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t});\n\n\t\tcontext.registerCommand('decreaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t});\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-+': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t\t'Mod-Shift-_': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'fontSize',\n\t\t\tgroup: 'format',\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeFontSize',\n\t\t\tpriority: 6,\n\t\t\tpopupType: 'combobox',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\tgetLabel: (state: EditorState): string =>\n\t\t\t\tString(getActiveSizeNumeric(state, this.defaultSize)),\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderFontSizePopup(container, ctx, {\n\t\t\t\t\tsizes: this.sizes,\n\t\t\t\t\tdefaultSize: this.defaultSize,\n\t\t\t\t\tonClose,\n\t\t\t\t\tcontentElement: ctx.getContainer(),\n\t\t\t\t\tlocale: this.locale,\n\t\t\t\t});\n\t\t\t},\n\t\t\tisActive: (state) => isFontSizeActive(state),\n\t\t});\n\t}\n\n\t/**\n\t * Sets the configured default font size on the editor content container\n\t * so that unformatted text renders at the correct size instead of the\n\t * browser default (16px).\n\t */\n\tprivate applyDefaultSizeToContainer(context: PluginContext): void {\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tsetStyleProperty(container, 'fontSize', `${this.defaultSize}px`);\n\t}\n}\n\n// --- Helpers ---\n\nfunction resolveSizes(sizes: readonly number[] | undefined): readonly number[] {\n\tif (!sizes || sizes.length === 0) return DEFAULT_FONT_SIZES;\n\tconst unique: number[] = [...new Set(sizes)].filter((n) => Number.isInteger(n) && n > 0);\n\tunique.sort((a, b) => a - b);\n\treturn unique.length > 0 ? unique : DEFAULT_FONT_SIZES;\n}\n\nfunction resolveDefaultSize(size: number | undefined): number {\n\tif (size === undefined) return DEFAULT_FONT_SIZE;\n\treturn Number.isInteger(size) && size > 0 ? size : DEFAULT_FONT_SIZE;\n}\n"],"names":["FONT_SIZE_LOCALE_EN","label","tooltip","customFontSizeAria","fontSizesAria","FONT_SIZE_LOCALES","en","de","es","fr","zh","ru","ar","hi","getActiveSizeNumeric","state","defaultSize","raw","getMarkAttrAtSelection","m","attrs","size","parsed","Number","parseInt","isNaN","applyFontSize","context","mark","type","markType","tr","applyAttributedMark","dispatch","removeFontSize","removeAttributedMark","stepFontSize","direction","sizes","next","current","i","length","selectSize","executeCommand","getState","buildSizeItem","isActive","item","document","createElement","id","className","setAttribute","String","classList","add","check","textContent","appendChild","DEFAULT_FONT_SIZES","FontSizePlugin","name","priority","config","locale","this","unique","Set","filter","n","isInteger","sort","a","b","resolvePluginLocale","registerStyleSheet","registerMarkSpec","registerCommands","registerKeymaps","registerToolbarItem","applyDefaultSizeToContainer","destroy","rank","default","span","setStyleProperty","toHTMLString","content","isValidCSSFontSize","escapeHTML","toHTMLStyle","parseHTML","tag","getAttrs","el","style","fontSize","sanitize","tags","registerCommand","registerKeymap","group","command","popupType","separatorAfter","getLabel","renderPopup","container","ctx","onClose","currentSize","input","min","max","value","wrapper","list","items","addEventListener","e","preventDefault","stopPropagation","restoreFocusTo","contentElement","push","activeIdx","indexOf","activeItem","requestAnimationFrame","scrollIntoView","block","focusedIndex","setFocused","idx","remove","key","val","focus","selectedSize","getContainer","isAttributedMarkActive"],"mappings":";;;;;;AACO,MCYMA,IAAsC,EAClDC,OAAO,aACPC,SAAS,aACTC,oBAAoB,oBACpBC,eAAe,aAAA,GAoEHC,IAAoD,EAChEC,IAAIN,GACJO,IAjEkD,EAClDN,OAAO,gBACPC,SAAS,gBACTC,oBAAoB,mCACpBC,eAAe,gBAAA,GA8DfI,IAzDkD,EAClDP,OAAO,oBACPC,SAAS,oBACTC,oBAAoB,kCACpBC,eAAe,oBAAA,GAsDfK,IAjDkD,EAClDR,OAAO,oBACPC,SAAS,oBACTC,oBAAoB,kCACpBC,eAAe,oBAAA,GA8CfM,IAzCkD,EAClDT,OAAO,MACPC,SAAS,MACTC,oBAAoB,SACpBC,eAAe,OAAA,GAsCfO,IA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";
|
|
2
|
-
import { a as o, p as n } from "./PopupPositioning-
|
|
3
|
-
import { f as r, n as i, b as
|
|
4
|
-
import { s as d, a as p } from "./StyleRuntime-
|
|
2
|
+
import { a as o, p as n } from "./PopupPositioning-CgjgAKjp.mjs";
|
|
3
|
+
import { f as r, n as i, b as l, a as s, c as a, d as c } from "./ToolbarKeyboardNav-DhpL8zNV.mjs";
|
|
4
|
+
import { s as d, a as p } from "./StyleRuntime-CP4NCwKT.mjs";
|
|
5
|
+
import "./ToolbarItem-BpZggUGo.mjs";
|
|
5
6
|
const u = new t("popup");
|
|
6
7
|
class h {
|
|
7
8
|
stack = [];
|
|
@@ -12,19 +13,19 @@ class h {
|
|
|
12
13
|
open(t2) {
|
|
13
14
|
const e2 = document.createElement("div");
|
|
14
15
|
e2.className = t2.className ? `notectl-popup ${t2.className}` : "notectl-popup", t2.ariaRole && e2.setAttribute("role", t2.ariaRole), t2.ariaLabel && e2.setAttribute("aria-label", t2.ariaLabel);
|
|
15
|
-
const r2 = { close: () => this.closeEntry(c2), getElement: () => e2 };
|
|
16
|
-
t2.content(e2, () => this.closeEntry(c2));
|
|
16
|
+
const r2 = { close: (t3) => this.closeEntry(c2, t3), getElement: () => e2 };
|
|
17
|
+
t2.content(e2, (t3) => this.closeEntry(c2, t3));
|
|
17
18
|
const i2 = t2.referenceNode ?? this.referenceNode;
|
|
18
19
|
o(e2, i2);
|
|
19
|
-
const
|
|
20
|
-
n(e2,
|
|
21
|
-
const
|
|
20
|
+
const l2 = t2.anchor instanceof HTMLElement ? t2.anchor.getBoundingClientRect() : t2.anchor;
|
|
21
|
+
n(e2, l2, { position: t2.position ?? "below-start" });
|
|
22
|
+
const s2 = t2.parent ? this.findEntryByHandle(t2.parent) : null, a2 = (o2) => {
|
|
22
23
|
const n2 = o2.composedPath();
|
|
23
24
|
if (!n2.includes(e2)) {
|
|
24
25
|
for (const t3 of this.stack) if (n2.includes(t3.element)) return;
|
|
25
26
|
t2.anchor instanceof HTMLElement && n2.includes(t2.anchor) || this.closeEntry(c2);
|
|
26
27
|
}
|
|
27
|
-
}, c2 = { element: e2, config: t2, clickOutsideHandler: a2, parent:
|
|
28
|
+
}, c2 = { element: e2, config: t2, clickOutsideHandler: a2, parent: s2 };
|
|
28
29
|
return this.stack.push(c2), setTimeout(() => {
|
|
29
30
|
document.addEventListener("mousedown", a2);
|
|
30
31
|
}, 0), this.focusFirstItem(e2), r2;
|
|
@@ -45,14 +46,14 @@ class h {
|
|
|
45
46
|
destroy() {
|
|
46
47
|
this.closeAll();
|
|
47
48
|
}
|
|
48
|
-
closeEntry(t2) {
|
|
49
|
-
const
|
|
50
|
-
if (-1 !==
|
|
51
|
-
for (; this.stack.length >
|
|
49
|
+
closeEntry(t2, e2) {
|
|
50
|
+
const o2 = this.stack.indexOf(t2);
|
|
51
|
+
if (-1 !== o2) {
|
|
52
|
+
for (; this.stack.length > o2 + 1; ) {
|
|
52
53
|
const t3 = this.stack[this.stack.length - 1];
|
|
53
54
|
t3 && this.removeEntry(t3);
|
|
54
55
|
}
|
|
55
|
-
this.removeEntry(t2), t2.config.restoreFocusTo && t2.config.restoreFocusTo.focus(), t2.config.onClose?.();
|
|
56
|
+
this.removeEntry(t2), void 0 !== e2 && "restoreFocusTo" in e2 ? e2.restoreFocusTo?.focus() : t2.config.restoreFocusTo && t2.config.restoreFocusTo.focus(), t2.config.onClose?.();
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
removeEntry(t2) {
|
|
@@ -70,7 +71,7 @@ class h {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
+
const b = { formattingOptionsAria: "Formatting options", moreToolsAria: "More tools" }, m = { en: b, de: { formattingOptionsAria: "Formatierungsoptionen", moreToolsAria: "Weitere Werkzeuge" }, es: { formattingOptionsAria: "Opciones de formato", moreToolsAria: "Más herramientas" }, fr: { formattingOptionsAria: "Options de mise en forme", moreToolsAria: "Plus d'outils" }, zh: { formattingOptionsAria: "格式选项", moreToolsAria: "更多工具" }, ru: { formattingOptionsAria: "Параметры форматирования", moreToolsAria: "Другие инструменты" }, ar: { formattingOptionsAria: "خيارات التنسيق", moreToolsAria: "أدوات إضافية" }, hi: { formattingOptionsAria: "फ़ॉर्मेटिंग विकल्प", moreToolsAria: "और उपकरण" } }, f = { BurgerMenu: "burger-menu", Flow: "flow", None: "none" }, v = "notectl-toolbar-btn--overflow-hidden", g = "notectl-toolbar-separator--overflow-hidden";
|
|
74
75
|
class w {
|
|
75
76
|
toolbar;
|
|
76
77
|
context;
|
|
@@ -97,7 +98,7 @@ class w {
|
|
|
97
98
|
this.closeDropdown(), this.resetVisibility(), this.ensureOverflowButton(), this.setOverflowButtonVisible(false);
|
|
98
99
|
const t2 = this.measureAvailableWidth(), e2 = Array.from(this.toolbar.children), o2 = this.measureChildWidths(e2), n2 = t2 - 34 - 2;
|
|
99
100
|
let r2 = 0, i2 = false;
|
|
100
|
-
const
|
|
101
|
+
const l2 = [];
|
|
101
102
|
for (const t3 of e2) {
|
|
102
103
|
if (t3 === this.overflowButton) continue;
|
|
103
104
|
if (t3.classList.contains("notectl-toolbar-separator")) {
|
|
@@ -112,13 +113,13 @@ class w {
|
|
|
112
113
|
const e3 = this.entries.find((e4) => e4.element === t3);
|
|
113
114
|
if (!e3) continue;
|
|
114
115
|
if (i2) {
|
|
115
|
-
e3.element.classList.add(v),
|
|
116
|
+
e3.element.classList.add(v), l2.push(e3);
|
|
116
117
|
continue;
|
|
117
118
|
}
|
|
118
|
-
const
|
|
119
|
-
r2 +
|
|
119
|
+
const s2 = (o2.get(t3) ?? 0) + 2;
|
|
120
|
+
r2 + s2 > n2 ? (i2 = true, e3.element.classList.add(v), l2.push(e3)) : r2 += s2;
|
|
120
121
|
}
|
|
121
|
-
this.overflowEntries =
|
|
122
|
+
this.overflowEntries = l2, this.hideTrailingSeparators(), this.setOverflowButtonVisible(l2.length > 0), this.notifyChange();
|
|
122
123
|
}
|
|
123
124
|
updateItemStates(t2) {
|
|
124
125
|
if (!this.overflowDropdown) return;
|
|
@@ -187,8 +188,8 @@ class w {
|
|
|
187
188
|
r2.type = "button", r2.className = "notectl-dropdown__item", r2.setAttribute("role", "menuitem"), r2.setAttribute("tabindex", "-1"), r2.setAttribute("data-toolbar-item", n2.item.id);
|
|
188
189
|
const i2 = document.createElement("span");
|
|
189
190
|
i2.className = "notectl-dropdown__item-icon", "combobox" !== n2.item.popupType && (i2.innerHTML = n2.item.icon), r2.appendChild(i2);
|
|
190
|
-
const
|
|
191
|
-
|
|
191
|
+
const l2 = document.createElement("span");
|
|
192
|
+
l2.className = "notectl-dropdown__item-label", l2.textContent = "combobox" === n2.item.popupType ? n2.item.getLabel(e2) : n2.item.tooltip ?? n2.item.label, r2.appendChild(l2), r2.addEventListener("mousedown", (t3) => {
|
|
192
193
|
t3.preventDefault(), t3.stopPropagation(), this.activateOverflowItem(n2);
|
|
193
194
|
}), t2.appendChild(r2);
|
|
194
195
|
}
|
|
@@ -270,7 +271,7 @@ function y() {
|
|
|
270
271
|
const t2 = document.createElement("span");
|
|
271
272
|
return t2.className = "notectl-toolbar-separator", t2.setAttribute("role", "separator"), t2;
|
|
272
273
|
}
|
|
273
|
-
class
|
|
274
|
+
class E {
|
|
274
275
|
activePopup = null;
|
|
275
276
|
activePopupButton = null;
|
|
276
277
|
activeHandle = null;
|
|
@@ -286,7 +287,7 @@ class A {
|
|
|
286
287
|
return null !== this.activePopup;
|
|
287
288
|
}
|
|
288
289
|
toggle(t2, e2, o2) {
|
|
289
|
-
this.activePopup ? this.close() : this.
|
|
290
|
+
this.activePopup ? this.close() : this.openViaManager(t2, e2, o2);
|
|
290
291
|
}
|
|
291
292
|
close() {
|
|
292
293
|
if (this.activeHandle) {
|
|
@@ -309,21 +310,6 @@ class A {
|
|
|
309
310
|
this.activePopup = t3, this.renderPopupContent(t3, e2, o2, n2), t3.addEventListener("keydown", (t4) => this.handlePopupKeydown(t4));
|
|
310
311
|
} }));
|
|
311
312
|
}
|
|
312
|
-
openLegacy(t2, e2, o2) {
|
|
313
|
-
const n2 = document.createElement("div");
|
|
314
|
-
n2.className = "notectl-toolbar-popup", this.renderPopupContent(n2, e2, o2, () => this.close()), this.positionAndAppend(n2, t2), this.activePopup = n2, this.activePopupButton = t2, t2.classList.add("notectl-toolbar-btn--popup-open"), t2.setAttribute("aria-expanded", "true"), this.focusFirstItem(n2), n2.addEventListener("keydown", (t3) => this.handlePopupKeydown(t3));
|
|
315
|
-
const r2 = (e3) => {
|
|
316
|
-
const o3 = e3.composedPath();
|
|
317
|
-
o3.includes(n2) || o3.includes(t2) || this.close();
|
|
318
|
-
};
|
|
319
|
-
setTimeout(() => {
|
|
320
|
-
document.addEventListener("mousedown", r2);
|
|
321
|
-
}, 0), n2.dataset.legacyClose = "true";
|
|
322
|
-
const i2 = this.close.bind(this);
|
|
323
|
-
this.close = () => {
|
|
324
|
-
document.removeEventListener("mousedown", r2), this.close = i2, i2();
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
313
|
renderPopupContent(t2, e2, o2, n2) {
|
|
328
314
|
switch (e2.popupType) {
|
|
329
315
|
case "gridPicker":
|
|
@@ -334,14 +320,14 @@ class A {
|
|
|
334
320
|
const r2 = document.createElement("div");
|
|
335
321
|
r2.className = "notectl-grid-picker__label", r2.textContent = "1 x 1", d(r2, { textAlign: "center", padding: "4px", fontSize: "12px" }), r2.setAttribute("aria-live", "polite");
|
|
336
322
|
for (let t4 = 1; t4 <= e3.maxRows; t4++) for (let i2 = 1; i2 <= e3.maxCols; i2++) {
|
|
337
|
-
const
|
|
338
|
-
|
|
323
|
+
const l2 = document.createElement("div");
|
|
324
|
+
l2.className = "notectl-grid-picker__cell", l2.setAttribute("role", "gridcell"), l2.setAttribute("tabindex", "-1"), l2.setAttribute("aria-label", `${t4} x ${i2}`), d(l2, { width: "20px", height: "20px", border: "1px solid #ccc", cursor: "pointer" }), l2.setAttribute("data-row", String(t4)), l2.setAttribute("data-col", String(i2)), l2.addEventListener("mouseenter", () => {
|
|
339
325
|
x(n3, t4, i2), r2.textContent = `${t4} x ${i2}`;
|
|
340
|
-
}),
|
|
326
|
+
}), l2.addEventListener("mousedown", (n4) => {
|
|
341
327
|
n4.preventDefault(), n4.stopPropagation(), e3.onSelect(t4, i2), o3();
|
|
342
|
-
}),
|
|
328
|
+
}), l2.addEventListener("click", () => {
|
|
343
329
|
e3.onSelect(t4, i2), o3();
|
|
344
|
-
}), n3.appendChild(
|
|
330
|
+
}), n3.appendChild(l2);
|
|
345
331
|
}
|
|
346
332
|
t3.appendChild(n3), t3.appendChild(r2);
|
|
347
333
|
})(t2, e2.popupConfig, n2);
|
|
@@ -372,18 +358,6 @@ class A {
|
|
|
372
358
|
clearButtonState() {
|
|
373
359
|
this.activePopupButton && (this.activePopupButton.classList.remove("notectl-toolbar-btn--popup-open"), this.activePopupButton.setAttribute("aria-expanded", "false"), this.activePopupButton = null);
|
|
374
360
|
}
|
|
375
|
-
positionAndAppend(t2, e2) {
|
|
376
|
-
const o2 = e2.getBoundingClientRect();
|
|
377
|
-
d(t2, { position: "fixed", top: `${o2.bottom + 2}px`, left: `${o2.left}px`, zIndex: "10000" });
|
|
378
|
-
const n2 = e2.getRootNode();
|
|
379
|
-
n2 instanceof ShadowRoot ? n2.appendChild(t2) : document.body.appendChild(t2);
|
|
380
|
-
}
|
|
381
|
-
focusFirstItem(t2) {
|
|
382
|
-
requestAnimationFrame(() => {
|
|
383
|
-
const e2 = t2.querySelector('[role="menuitem"]') ?? t2.querySelector(".notectl-grid-picker__cell") ?? t2.querySelector("button");
|
|
384
|
-
e2?.focus();
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
361
|
handlePopupKeydown(t2) {
|
|
388
362
|
if (!this.activePopup) return;
|
|
389
363
|
if ("Escape" === t2.key) return t2.preventDefault(), t2.stopPropagation(), void this.closeAndRestoreFocus();
|
|
@@ -418,13 +392,13 @@ class A {
|
|
|
418
392
|
handleGridKeydown(t2) {
|
|
419
393
|
const e2 = this.getActiveElement(), o2 = Number(e2?.getAttribute("data-row") ?? 1), n2 = Number(e2?.getAttribute("data-col") ?? 1), r2 = this.activePopup?.querySelector(".notectl-grid-picker__grid") ?? null;
|
|
420
394
|
if (!r2) return;
|
|
421
|
-
const
|
|
395
|
+
const l2 = r2.querySelector(".notectl-grid-picker__cell:last-child"), s2 = Number(l2?.getAttribute("data-col") ?? 1), a2 = Number(l2?.getAttribute("data-row") ?? 1);
|
|
422
396
|
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t2.key)) {
|
|
423
397
|
t2.preventDefault();
|
|
424
|
-
const [e3,
|
|
425
|
-
c2?.focus(), x(r2, e3,
|
|
398
|
+
const [e3, l3] = i(o2, n2, a2, s2, t2.key), c2 = r2.querySelector(`.notectl-grid-picker__cell[data-row="${e3}"][data-col="${l3}"]`);
|
|
399
|
+
c2?.focus(), x(r2, e3, l3);
|
|
426
400
|
const d2 = this.activePopup?.querySelector(".notectl-grid-picker__label") ?? null;
|
|
427
|
-
d2 && (d2.textContent = `${e3} x ${
|
|
401
|
+
d2 && (d2.textContent = `${e3} x ${l3}`);
|
|
428
402
|
}
|
|
429
403
|
"Enter" !== t2.key && " " !== t2.key || (t2.preventDefault(), e2?.click());
|
|
430
404
|
}
|
|
@@ -452,14 +426,14 @@ class A {
|
|
|
452
426
|
}
|
|
453
427
|
}
|
|
454
428
|
}
|
|
455
|
-
class
|
|
429
|
+
class A {
|
|
456
430
|
element;
|
|
457
431
|
timer = null;
|
|
458
432
|
target = null;
|
|
459
433
|
isPopupActive;
|
|
460
434
|
static TOOLTIP_ID = "notectl-toolbar-tooltip";
|
|
461
435
|
constructor(t2) {
|
|
462
|
-
this.isPopupActive = t2, this.element = document.createElement("div"), this.element.className = "notectl-toolbar-tooltip", this.element.id =
|
|
436
|
+
this.isPopupActive = t2, this.element = document.createElement("div"), this.element.className = "notectl-toolbar-tooltip", this.element.id = A.TOOLTIP_ID, this.element.setAttribute("role", "tooltip"), p(this.element, "display", "none");
|
|
463
437
|
}
|
|
464
438
|
show(t2) {
|
|
465
439
|
if (this.hide(), this.isPopupActive() || t2.disabled) return;
|
|
@@ -468,7 +442,7 @@ class E {
|
|
|
468
442
|
if (this.isPopupActive()) return;
|
|
469
443
|
this.element.textContent = e2, p(this.element, "display", "");
|
|
470
444
|
const o2 = t2.getRootNode();
|
|
471
|
-
o2 instanceof ShadowRoot && !this.element.parentNode ? o2.appendChild(this.element) : o2 instanceof ShadowRoot || this.element.parentNode || document.body.appendChild(this.element), t2.setAttribute("aria-describedby",
|
|
445
|
+
o2 instanceof ShadowRoot && !this.element.parentNode ? o2.appendChild(this.element) : o2 instanceof ShadowRoot || this.element.parentNode || document.body.appendChild(this.element), t2.setAttribute("aria-describedby", A.TOOLTIP_ID);
|
|
472
446
|
const n2 = t2.getBoundingClientRect();
|
|
473
447
|
d(this.element, { position: "fixed", top: `${n2.bottom + 6}px`, left: `${n2.left + n2.width / 2}px`, transform: "translateX(-50%)" });
|
|
474
448
|
}, 500));
|
|
@@ -502,7 +476,7 @@ class C {
|
|
|
502
476
|
this.layoutConfig = t2 ?? null, this.overflowBehavior = t2?.overflow ?? f.BurgerMenu;
|
|
503
477
|
}
|
|
504
478
|
init(t2) {
|
|
505
|
-
this.locale = e(
|
|
479
|
+
this.locale = e(m, t2), t2.registerStyleSheet(`
|
|
506
480
|
/* Toolbar */
|
|
507
481
|
.notectl-plugin-container--top {
|
|
508
482
|
display: flex;
|
|
@@ -546,9 +520,11 @@ class C {
|
|
|
546
520
|
transition: background 0.1s, border-color 0.1s;
|
|
547
521
|
}
|
|
548
522
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
523
|
+
@media (hover: hover) {
|
|
524
|
+
.notectl-toolbar-btn:hover {
|
|
525
|
+
background: var(--notectl-hover-bg);
|
|
526
|
+
border-color: var(--notectl-border);
|
|
527
|
+
}
|
|
552
528
|
}
|
|
553
529
|
|
|
554
530
|
.notectl-toolbar-btn--active {
|
|
@@ -567,9 +543,11 @@ class C {
|
|
|
567
543
|
cursor: not-allowed;
|
|
568
544
|
}
|
|
569
545
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
546
|
+
@media (hover: hover) {
|
|
547
|
+
.notectl-toolbar-btn:disabled:hover {
|
|
548
|
+
background: transparent;
|
|
549
|
+
border-color: transparent;
|
|
550
|
+
}
|
|
573
551
|
}
|
|
574
552
|
|
|
575
553
|
.notectl-toolbar-btn__icon {
|
|
@@ -654,12 +632,14 @@ class C {
|
|
|
654
632
|
white-space: nowrap;
|
|
655
633
|
}
|
|
656
634
|
|
|
657
|
-
|
|
658
|
-
.notectl-dropdown__item:
|
|
659
|
-
|
|
635
|
+
@media (hover: hover) {
|
|
636
|
+
.notectl-dropdown__item:hover {
|
|
637
|
+
background: var(--notectl-hover-bg);
|
|
638
|
+
}
|
|
660
639
|
}
|
|
661
640
|
|
|
662
641
|
.notectl-dropdown__item:focus-visible {
|
|
642
|
+
background: var(--notectl-hover-bg);
|
|
663
643
|
outline: none;
|
|
664
644
|
}
|
|
665
645
|
|
|
@@ -715,9 +695,11 @@ class C {
|
|
|
715
695
|
transition: background 0.1s, border-color 0.1s;
|
|
716
696
|
}
|
|
717
697
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
698
|
+
@media (hover: hover) {
|
|
699
|
+
.notectl-toolbar-overflow-btn:hover {
|
|
700
|
+
background: var(--notectl-hover-bg);
|
|
701
|
+
border-color: var(--notectl-border);
|
|
702
|
+
}
|
|
721
703
|
}
|
|
722
704
|
|
|
723
705
|
.notectl-toolbar-overflow-btn--hidden {
|
|
@@ -735,8 +717,10 @@ class C {
|
|
|
735
717
|
cursor: not-allowed;
|
|
736
718
|
}
|
|
737
719
|
|
|
738
|
-
|
|
739
|
-
|
|
720
|
+
@media (hover: hover) {
|
|
721
|
+
.notectl-dropdown__item:disabled:hover {
|
|
722
|
+
background: none;
|
|
723
|
+
}
|
|
740
724
|
}
|
|
741
725
|
|
|
742
726
|
.notectl-dropdown__item--active {
|
|
@@ -766,9 +750,11 @@ class C {
|
|
|
766
750
|
background: var(--notectl-bg);
|
|
767
751
|
}
|
|
768
752
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
753
|
+
@media (hover: hover) {
|
|
754
|
+
.notectl-toolbar-btn[role="combobox"]:hover {
|
|
755
|
+
background: var(--notectl-hover-bg);
|
|
756
|
+
border-color: var(--notectl-fg-muted);
|
|
757
|
+
}
|
|
772
758
|
}
|
|
773
759
|
|
|
774
760
|
.notectl-toolbar-btn[role="combobox"].notectl-toolbar-btn--active {
|
|
@@ -832,15 +818,17 @@ class C {
|
|
|
832
818
|
margin-top: 4px;
|
|
833
819
|
}
|
|
834
820
|
|
|
835
|
-
|
|
836
|
-
|
|
821
|
+
@media (hover: hover) {
|
|
822
|
+
.notectl-link-popup__button:hover {
|
|
823
|
+
background: var(--notectl-hover-bg);
|
|
824
|
+
}
|
|
837
825
|
}
|
|
838
826
|
|
|
839
827
|
.notectl-link-popup__button:focus-visible {
|
|
840
828
|
outline: 2px solid var(--notectl-focus-ring);
|
|
841
829
|
outline-offset: -1px;
|
|
842
830
|
}
|
|
843
|
-
`), this.context = t2, this.popupManager = new h(t2.getContainer()), t2.registerService(u, this.popupManager), this.popupController = new
|
|
831
|
+
`), this.context = t2, this.popupManager = new h(t2.getContainer()), t2.registerService(u, this.popupManager), this.popupController = new E(() => this.getActiveElement()), this.popupController.setPopupManager(this.popupManager), this.tooltip = new A(() => this.popupController?.isOpen() ?? false), t2.registerService(k, { refresh: () => this.updateButtonStates(t2.getState()), closePopup: () => this.popupController?.close() }), this.createToolbarElement();
|
|
844
832
|
}
|
|
845
833
|
getOverflowBehavior() {
|
|
846
834
|
return this.overflowBehavior;
|
|
@@ -889,12 +877,12 @@ class C {
|
|
|
889
877
|
return this.visibleElements.length > 0 ? this.visibleElements : this.buttons.map((t2) => t2.element);
|
|
890
878
|
}
|
|
891
879
|
initRovingTabindex() {
|
|
892
|
-
const t2 = this.getTabElements(), e2 =
|
|
893
|
-
this.focusedIndex = e2 >= 0 ? e2 : 0,
|
|
880
|
+
const t2 = this.getTabElements(), e2 = l(t2);
|
|
881
|
+
this.focusedIndex = e2 >= 0 ? e2 : 0, s(t2, this.focusedIndex);
|
|
894
882
|
}
|
|
895
883
|
setRovingFocus(t2) {
|
|
896
884
|
const e2 = this.getTabElements();
|
|
897
|
-
t2 < 0 || t2 >= e2.length || (this.focusedIndex = t2,
|
|
885
|
+
t2 < 0 || t2 >= e2.length || (this.focusedIndex = t2, s(e2, t2), e2[t2]?.focus());
|
|
898
886
|
}
|
|
899
887
|
getActiveElement() {
|
|
900
888
|
const t2 = this.toolbarElement?.getRootNode();
|
|
@@ -921,7 +909,7 @@ class C {
|
|
|
921
909
|
}
|
|
922
910
|
case "Home": {
|
|
923
911
|
t2.preventDefault();
|
|
924
|
-
const o2 =
|
|
912
|
+
const o2 = l(e2);
|
|
925
913
|
o2 >= 0 && this.setRovingFocus(o2);
|
|
926
914
|
break;
|
|
927
915
|
}
|
|
@@ -1022,10 +1010,10 @@ class C {
|
|
|
1022
1010
|
export {
|
|
1023
1011
|
h as P,
|
|
1024
1012
|
C as T,
|
|
1025
|
-
|
|
1026
|
-
|
|
1013
|
+
u as a,
|
|
1014
|
+
m as b,
|
|
1027
1015
|
b as c,
|
|
1028
|
-
|
|
1029
|
-
|
|
1016
|
+
f as d,
|
|
1017
|
+
k as e
|
|
1030
1018
|
};
|
|
1031
|
-
//# sourceMappingURL=
|
|
1019
|
+
//# sourceMappingURL=index-BcDRT4K2.mjs.map
|