@notectl/core 1.0.6 → 1.0.9
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/README.md +78 -56
- package/custom-elements.json +344 -0
- package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs → AttrRegistry-D-przlzb.mjs} +4 -4
- package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs.map → AttrRegistry-D-przlzb.mjs.map} +1 -1
- package/dist/chunks/ColorNames-iaWsSZx1.mjs +35 -0
- package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +1 -0
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +140 -0
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +1 -0
- package/dist/chunks/{Commands-DLP85Mp5.mjs → Commands-CSpSwGXv.mjs} +13 -13
- package/dist/chunks/{Commands-DLP85Mp5.mjs.map → Commands-CSpSwGXv.mjs.map} +1 -1
- package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs +46 -0
- package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs.map +1 -0
- package/dist/chunks/ToolbarPlugin-DFkl1uYO.mjs +818 -0
- package/dist/chunks/ToolbarPlugin-DFkl1uYO.mjs.map +1 -0
- package/dist/chunks/index-BCvuDpVr.mjs +191 -0
- package/dist/chunks/index-BCvuDpVr.mjs.map +1 -0
- package/dist/chunks/index-BFsYGsBR.mjs +92 -0
- package/dist/chunks/index-BFsYGsBR.mjs.map +1 -0
- package/dist/chunks/index-BIL37LSL.mjs +73 -0
- package/dist/chunks/index-BIL37LSL.mjs.map +1 -0
- package/dist/chunks/index-BL56fbXt.mjs +402 -0
- package/dist/chunks/index-BL56fbXt.mjs.map +1 -0
- package/dist/chunks/index-BQ8iIYLn.mjs +209 -0
- package/dist/chunks/index-BQ8iIYLn.mjs.map +1 -0
- package/dist/chunks/index-BRYzYOYC.mjs +63 -0
- package/dist/chunks/index-BRYzYOYC.mjs.map +1 -0
- package/dist/chunks/index-BSFLNveF.mjs +953 -0
- package/dist/chunks/index-BSFLNveF.mjs.map +1 -0
- package/dist/chunks/index-BTJfyJlJ.mjs +187 -0
- package/dist/chunks/index-BTJfyJlJ.mjs.map +1 -0
- package/dist/chunks/index-Bsp4LC5t.mjs +130 -0
- package/dist/chunks/index-Bsp4LC5t.mjs.map +1 -0
- package/dist/chunks/index-DA8TG2S8.mjs +220 -0
- package/dist/chunks/index-DA8TG2S8.mjs.map +1 -0
- package/dist/chunks/index-DAFCISBN.mjs +100 -0
- package/dist/chunks/index-DAFCISBN.mjs.map +1 -0
- package/dist/chunks/index-DC1EK22F.mjs +41 -0
- package/dist/chunks/index-DC1EK22F.mjs.map +1 -0
- package/dist/chunks/index-DGrRWMlW.mjs +541 -0
- package/dist/chunks/index-DGrRWMlW.mjs.map +1 -0
- package/dist/chunks/index-DfO_fKw6.mjs +39 -0
- package/dist/chunks/index-DfO_fKw6.mjs.map +1 -0
- package/dist/chunks/index-o6hDR07y.mjs +41 -0
- package/dist/chunks/index-o6hDR07y.mjs.map +1 -0
- package/dist/chunks/index-uTnc9y7M.mjs +62 -0
- package/dist/chunks/index-uTnc9y7M.mjs.map +1 -0
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs +34 -0
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +37 -5
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts +27 -0
- package/dist/editor/PaperLayoutController.d.ts.map +1 -0
- package/dist/editor/PaperSize.d.ts +35 -0
- package/dist/editor/PaperSize.d.ts.map +1 -0
- package/dist/editor/styles/color-picker.d.ts +1 -1
- package/dist/editor/styles/color-picker.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +2 -0
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/paper.d.ts +3 -0
- package/dist/editor/styles/paper.d.ts.map +1 -0
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.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/editor/styles.d.ts.map +1 -1
- package/dist/i18n/Locale.d.ts +17 -0
- package/dist/i18n/Locale.d.ts.map +1 -0
- package/dist/i18n/LocaleService.d.ts +8 -0
- package/dist/i18n/LocaleService.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/resolvePluginLocale.d.ts +3 -0
- package/dist/i18n/resolvePluginLocale.d.ts.map +1 -0
- package/dist/index.d.ts +48 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +2 -0
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts +2 -0
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts +2 -0
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/LegacyHTMLNormalizer.d.ts +18 -0
- package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +4 -0
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/model/HTMLParser.d.ts +13 -0
- package/dist/model/HTMLParser.d.ts.map +1 -1
- package/dist/model/SchemaRegistry.d.ts +2 -2
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/notectl-core.mjs +2297 -1971
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +2894 -1825
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +17 -2
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +22 -1
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentLocale.d.ts +19 -0
- package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +4 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +3 -89
- package/dist/plugins/alignment.mjs.map +1 -1
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts +17 -0
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +3 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +2 -55
- package/dist/plugins/blockquote.mjs.map +1 -1
- package/dist/plugins/code-block/CodeBlockLocale.d.ts +17 -0
- package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +2 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +3 -3
- package/dist/plugins/font/FontLocale.d.ts +15 -0
- package/dist/plugins/font/FontLocale.d.ts.map +1 -0
- package/dist/plugins/font/FontPlugin.d.ts +3 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeLocale.d.ts +17 -0
- package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts +3 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +2 -0
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +2 -201
- package/dist/plugins/font-size.mjs.map +1 -1
- package/dist/plugins/font.mjs +2 -183
- package/dist/plugins/font.mjs.map +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +14 -0
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingCommands.d.ts +5 -0
- package/dist/plugins/heading/HeadingCommands.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingInputRules.d.ts +5 -0
- package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts +5 -0
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingLocale.d.ts +26 -0
- package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts +4 -40
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -184
- package/dist/plugins/heading.mjs.map +1 -1
- package/dist/plugins/highlight/HighlightLocale.d.ts +17 -0
- package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts +3 -5
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +2 -123
- package/dist/plugins/highlight.mjs.map +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts +15 -0
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +4 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +2 -56
- package/dist/plugins/horizontal-rule.mjs.map +1 -1
- package/dist/plugins/image/ImageLocale.d.ts +25 -0
- package/dist/plugins/image/ImageLocale.d.ts.map +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image/ImageUpload.d.ts +3 -0
- package/dist/plugins/image/ImageUpload.d.ts.map +1 -1
- package/dist/plugins/image.mjs +4 -378
- package/dist/plugins/image.mjs.map +1 -1
- package/dist/plugins/link/LinkLocale.d.ts +23 -0
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +3 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +2 -124
- package/dist/plugins/link.mjs.map +1 -1
- package/dist/plugins/list/ListLocale.d.ts +18 -0
- package/dist/plugins/list/ListLocale.d.ts.map +1 -0
- package/dist/plugins/list/ListPlugin.d.ts +13 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +2 -190
- package/dist/plugins/list.mjs.map +1 -1
- package/dist/plugins/print/PrintLocale.d.ts +16 -0
- package/dist/plugins/print/PrintLocale.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts +7 -0
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/PrintTypes.d.ts +5 -0
- package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
- package/dist/plugins/shared/ColorMarkOperations.d.ts +28 -0
- package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -0
- package/dist/plugins/shared/ColorNames.d.ts +22 -0
- package/dist/plugins/shared/ColorNames.d.ts.map +1 -0
- package/dist/plugins/shared/ColorPickerPopup.d.ts +31 -0
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -0
- package/dist/plugins/shared/ColorValidation.d.ts +14 -0
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts +17 -0
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +3 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +2 -32
- package/dist/plugins/strikethrough.mjs.map +1 -1
- package/dist/plugins/super-sub/SuperSubLocale.d.ts +19 -0
- package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts +3 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
- package/dist/plugins/super-sub.mjs +2 -78
- package/dist/plugins/super-sub.mjs.map +1 -1
- package/dist/plugins/table/TableBorderColor.d.ts +24 -0
- package/dist/plugins/table/TableBorderColor.d.ts.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts +9 -8
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +14 -0
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -0
- package/dist/plugins/table/TableControls.d.ts +3 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +13 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +48 -0
- package/dist/plugins/table/TableLocale.d.ts.map +1 -0
- package/dist/plugins/table/TableNavigation.d.ts +2 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts +3 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +7 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/index.d.ts +3 -0
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table.mjs +18 -660
- package/dist/plugins/table.mjs.map +1 -1
- package/dist/plugins/text-color/TextColorLocale.d.ts +17 -0
- package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts +3 -5
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +2 -123
- package/dist/plugins/text-color.mjs.map +1 -1
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts +18 -0
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +4 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +2 -49
- package/dist/plugins/text-formatting.mjs.map +1 -1
- package/dist/plugins/toolbar/ToolbarLocale.d.ts +15 -0
- package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts +23 -0
- package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +56 -0
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +18 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/state/EditorState.d.ts +4 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/ReadonlyGuard.d.ts +6 -0
- package/dist/state/ReadonlyGuard.d.ts.map +1 -0
- package/dist/state/Transaction.d.ts +4 -0
- package/dist/state/Transaction.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts +2 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs +0 -15
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-sJTiZr-S.mjs +0 -398
- package/dist/chunks/ToolbarPlugin-sJTiZr-S.mjs.map +0 -1
- package/dist/chunks/color-picker-Csf0wx5a.mjs +0 -5
- package/dist/chunks/color-picker-Csf0wx5a.mjs.map +0 -1
- package/dist/chunks/index-QvKiO9_4.mjs +0 -538
- package/dist/chunks/index-QvKiO9_4.mjs.map +0 -1
- package/dist/input/SourceNormalizer.d.ts +0 -7
- package/dist/input/SourceNormalizer.d.ts.map +0 -1
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
+
import { f as o, n, a as r, b as i, c as s, d as l } from "./ToolbarKeyboardNav-B32OMv8r.mjs";
|
|
3
|
+
const a = { formattingOptionsAria: "Formatting options", moreToolsAria: "More tools" }, c = { en: a, 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: "और उपकरण" } }, d = { BurgerMenu: "burger-menu", Flow: "flow", None: "none" }, p = "notectl-toolbar-btn--overflow-hidden", h = "notectl-toolbar-separator--overflow-hidden";
|
|
4
|
+
class u {
|
|
5
|
+
toolbar;
|
|
6
|
+
context;
|
|
7
|
+
onOverflowChange;
|
|
8
|
+
onItemActivated;
|
|
9
|
+
getActiveElement;
|
|
10
|
+
ariaLabel;
|
|
11
|
+
entries = [];
|
|
12
|
+
overflowButton = null;
|
|
13
|
+
overflowDropdown = null;
|
|
14
|
+
overflowEntries = [];
|
|
15
|
+
resizeObserver = null;
|
|
16
|
+
closeHandler = null;
|
|
17
|
+
constructor(t2) {
|
|
18
|
+
this.toolbar = t2.toolbar, this.ariaLabel = t2.ariaLabel, this.context = t2.context, this.onOverflowChange = t2.onOverflowChange, this.onItemActivated = t2.onItemActivated, this.getActiveElement = t2.getActiveElement, this.resizeObserver = new ResizeObserver(() => this.recalculate()), this.resizeObserver.observe(this.toolbar);
|
|
19
|
+
}
|
|
20
|
+
update(t2) {
|
|
21
|
+
this.entries = t2.map((t3) => ({ element: t3.element, item: t3.item })), this.recalculate();
|
|
22
|
+
}
|
|
23
|
+
recalculate() {
|
|
24
|
+
if (0 === this.entries.length) return;
|
|
25
|
+
this.closeDropdown(), this.resetVisibility(), this.ensureOverflowButton(), this.setOverflowButtonVisible(false);
|
|
26
|
+
const t2 = this.measureAvailableWidth() - 34 - 2;
|
|
27
|
+
let e2 = 0, o2 = false;
|
|
28
|
+
const n2 = [], r2 = Array.from(this.toolbar.children);
|
|
29
|
+
for (const i2 of r2) {
|
|
30
|
+
if (i2 === this.overflowButton) continue;
|
|
31
|
+
if (i2.classList.contains("notectl-toolbar-separator")) {
|
|
32
|
+
if (o2) {
|
|
33
|
+
i2.classList.add(h);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const n3 = i2.offsetWidth + 2;
|
|
37
|
+
e2 + n3 > t2 ? (o2 = true, i2.classList.add(h)) : e2 += n3;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const r3 = this.entries.find((t3) => t3.element === i2);
|
|
41
|
+
if (!r3) continue;
|
|
42
|
+
if (o2) {
|
|
43
|
+
r3.element.classList.add(p), n2.push(r3);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const s2 = r3.element.offsetWidth + 2;
|
|
47
|
+
e2 + s2 > t2 ? (o2 = true, r3.element.classList.add(p), n2.push(r3)) : e2 += s2;
|
|
48
|
+
}
|
|
49
|
+
this.overflowEntries = n2, this.hideTrailingSeparators(), this.setOverflowButtonVisible(n2.length > 0), this.notifyChange();
|
|
50
|
+
}
|
|
51
|
+
updateItemStates(t2) {
|
|
52
|
+
if (!this.overflowDropdown) return;
|
|
53
|
+
const e2 = Array.from(this.overflowDropdown.querySelectorAll(".notectl-dropdown__item"));
|
|
54
|
+
for (const o2 of e2) {
|
|
55
|
+
const e3 = o2.getAttribute("data-toolbar-item"), n2 = this.overflowEntries.find((t3) => t3.item.id === e3);
|
|
56
|
+
if (!n2) continue;
|
|
57
|
+
const r2 = n2.item.isActive?.(t2) ?? false, i2 = n2.item.isEnabled?.(t2) ?? true;
|
|
58
|
+
o2.classList.toggle("notectl-dropdown__item--active", r2), o2.disabled = !i2;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
destroy() {
|
|
62
|
+
this.resizeObserver?.disconnect(), this.resizeObserver = null, this.closeDropdown(), this.overflowButton?.remove(), this.overflowButton = null, this.entries = [], this.overflowEntries = [];
|
|
63
|
+
}
|
|
64
|
+
measureAvailableWidth() {
|
|
65
|
+
const t2 = getComputedStyle(this.toolbar), e2 = Number.parseFloat(t2.paddingLeft) || 0, o2 = Number.parseFloat(t2.paddingRight) || 0;
|
|
66
|
+
return this.toolbar.clientWidth - e2 - o2;
|
|
67
|
+
}
|
|
68
|
+
resetVisibility() {
|
|
69
|
+
for (const t3 of this.entries) t3.element.classList.remove(p);
|
|
70
|
+
const t2 = Array.from(this.toolbar.querySelectorAll(".notectl-toolbar-separator"));
|
|
71
|
+
for (const e2 of t2) e2.classList.remove(h);
|
|
72
|
+
}
|
|
73
|
+
setOverflowButtonVisible(t2) {
|
|
74
|
+
this.overflowButton && (this.overflowButton.classList.toggle("notectl-toolbar-overflow-btn--hidden", !t2), t2 || this.overflowButton.removeAttribute("tabindex"));
|
|
75
|
+
}
|
|
76
|
+
ensureOverflowButton() {
|
|
77
|
+
if (this.overflowButton) return;
|
|
78
|
+
const t2 = document.createElement("button");
|
|
79
|
+
t2.type = "button", t2.className = "notectl-toolbar-overflow-btn", t2.setAttribute("aria-label", this.ariaLabel), t2.setAttribute("aria-haspopup", "true"), t2.setAttribute("aria-expanded", "false"), t2.innerHTML = '<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="3" cy="8" r="1.5" fill="currentColor"/><circle cx="8" cy="8" r="1.5" fill="currentColor"/><circle cx="13" cy="8" r="1.5" fill="currentColor"/></svg>', t2.addEventListener("mousedown", (t3) => {
|
|
80
|
+
t3.preventDefault(), this.toggleDropdown();
|
|
81
|
+
}), this.toolbar.appendChild(t2), this.overflowButton = t2;
|
|
82
|
+
}
|
|
83
|
+
toggleDropdown() {
|
|
84
|
+
this.overflowDropdown ? this.closeDropdown() : this.openDropdown();
|
|
85
|
+
}
|
|
86
|
+
openDropdown() {
|
|
87
|
+
if (!this.overflowButton || 0 === this.overflowEntries.length) return;
|
|
88
|
+
const t2 = document.createElement("div");
|
|
89
|
+
t2.className = "notectl-toolbar-popup notectl-dropdown", t2.setAttribute("role", "menu"), this.renderDropdownItems(t2), this.positionDropdown(t2), this.appendToRoot(t2), this.overflowDropdown = t2, this.overflowButton.setAttribute("aria-expanded", "true"), requestAnimationFrame(() => {
|
|
90
|
+
const e2 = t2.querySelector('[role="menuitem"]');
|
|
91
|
+
e2?.focus();
|
|
92
|
+
}), t2.addEventListener("keydown", (t3) => this.handleDropdownKeydown(t3)), this.registerCloseHandler();
|
|
93
|
+
}
|
|
94
|
+
renderDropdownItems(t2) {
|
|
95
|
+
let e2 = null;
|
|
96
|
+
for (const o2 of this.overflowEntries) {
|
|
97
|
+
if (null !== e2 && o2.item.group !== e2) {
|
|
98
|
+
const e3 = document.createElement("div");
|
|
99
|
+
e3.className = "notectl-dropdown__separator", e3.setAttribute("role", "separator"), t2.appendChild(e3);
|
|
100
|
+
}
|
|
101
|
+
e2 = o2.item.group;
|
|
102
|
+
const n2 = document.createElement("button");
|
|
103
|
+
n2.type = "button", n2.className = "notectl-dropdown__item", n2.setAttribute("role", "menuitem"), n2.setAttribute("tabindex", "-1"), n2.setAttribute("data-toolbar-item", o2.item.id);
|
|
104
|
+
const r2 = document.createElement("span");
|
|
105
|
+
r2.className = "notectl-dropdown__item-icon", r2.innerHTML = o2.item.icon, n2.appendChild(r2);
|
|
106
|
+
const i2 = document.createElement("span");
|
|
107
|
+
i2.className = "notectl-dropdown__item-label", i2.textContent = o2.item.tooltip ?? o2.item.label, n2.appendChild(i2), n2.addEventListener("mousedown", (t3) => {
|
|
108
|
+
t3.preventDefault(), t3.stopPropagation(), this.activateOverflowItem(o2);
|
|
109
|
+
}), t2.appendChild(n2);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
positionDropdown(t2) {
|
|
113
|
+
if (!this.overflowButton) return;
|
|
114
|
+
const e2 = this.overflowButton.getBoundingClientRect(), o2 = window.innerWidth - e2.right;
|
|
115
|
+
t2.style.position = "fixed", t2.style.top = `${e2.bottom + 2}px`, t2.style.right = `${o2}px`, t2.style.left = "auto", t2.style.zIndex = "10000";
|
|
116
|
+
}
|
|
117
|
+
appendToRoot(t2) {
|
|
118
|
+
if (!this.overflowButton) return;
|
|
119
|
+
const e2 = this.overflowButton.getRootNode();
|
|
120
|
+
e2 instanceof ShadowRoot ? e2.appendChild(t2) : document.body.appendChild(t2);
|
|
121
|
+
}
|
|
122
|
+
registerCloseHandler() {
|
|
123
|
+
this.closeHandler = (t2) => {
|
|
124
|
+
const e2 = t2.composedPath();
|
|
125
|
+
this.overflowDropdown && !e2.includes(this.overflowDropdown) && this.overflowButton && !e2.includes(this.overflowButton) && this.closeDropdown();
|
|
126
|
+
}, setTimeout(() => {
|
|
127
|
+
this.closeHandler && document.addEventListener("mousedown", this.closeHandler);
|
|
128
|
+
}, 0);
|
|
129
|
+
}
|
|
130
|
+
closeDropdown() {
|
|
131
|
+
this.overflowDropdown && (this.overflowDropdown.remove(), this.overflowDropdown = null), this.overflowButton && this.overflowButton.setAttribute("aria-expanded", "false"), this.closeHandler && (document.removeEventListener("mousedown", this.closeHandler), this.closeHandler = null);
|
|
132
|
+
}
|
|
133
|
+
activateOverflowItem(t2) {
|
|
134
|
+
this.closeDropdown(), t2.item.popupType && this.overflowButton ? this.onItemActivated(this.overflowButton, t2.item) : this.context.executeCommand(t2.item.command);
|
|
135
|
+
}
|
|
136
|
+
handleDropdownKeydown(t2) {
|
|
137
|
+
if (!this.overflowDropdown) return;
|
|
138
|
+
if ("Escape" === t2.key || "Tab" === t2.key) return t2.preventDefault(), t2.stopPropagation(), this.closeDropdown(), void this.overflowButton?.focus();
|
|
139
|
+
const e2 = Array.from(this.overflowDropdown.querySelectorAll('[role="menuitem"]')), n2 = e2.indexOf(this.getActiveElement());
|
|
140
|
+
switch (t2.key) {
|
|
141
|
+
case "ArrowDown": {
|
|
142
|
+
t2.preventDefault();
|
|
143
|
+
const r2 = o(e2, n2, 1);
|
|
144
|
+
e2[r2]?.focus();
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
case "ArrowUp": {
|
|
148
|
+
t2.preventDefault();
|
|
149
|
+
const r2 = o(e2, n2, -1);
|
|
150
|
+
e2[r2]?.focus();
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "Enter":
|
|
154
|
+
case " ": {
|
|
155
|
+
t2.preventDefault();
|
|
156
|
+
const o2 = e2[n2];
|
|
157
|
+
if (!o2) break;
|
|
158
|
+
const r2 = o2.getAttribute("data-toolbar-item"), i2 = this.overflowEntries.find((t3) => t3.item.id === r2);
|
|
159
|
+
i2 && this.activateOverflowItem(i2);
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
hideTrailingSeparators() {
|
|
165
|
+
const t2 = Array.from(this.toolbar.children);
|
|
166
|
+
for (let e2 = t2.length - 1; e2 >= 0; e2--) {
|
|
167
|
+
const o2 = t2[e2];
|
|
168
|
+
if (o2 && o2 !== this.overflowButton) {
|
|
169
|
+
if (o2.classList.contains("notectl-toolbar-separator")) o2.classList.contains(h) || o2.classList.add(h);
|
|
170
|
+
else if (!o2.classList.contains(p)) break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
notifyChange() {
|
|
175
|
+
const t2 = this.entries.filter((t3) => !t3.element.classList.contains(p)).map((t3) => t3.element);
|
|
176
|
+
this.onOverflowChange(t2, this.overflowEntries.length > 0 ? this.overflowButton : null);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function m(t2, e2, o2) {
|
|
180
|
+
const n2 = t2.querySelectorAll(".notectl-grid-picker__cell");
|
|
181
|
+
for (const t3 of n2) {
|
|
182
|
+
const n3 = Number(t3.getAttribute("data-row")), r2 = Number(t3.getAttribute("data-col"));
|
|
183
|
+
t3.classList.toggle("notectl-grid-picker__cell--highlighted", n3 <= e2 && r2 <= o2);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function b() {
|
|
187
|
+
const t2 = document.createElement("span");
|
|
188
|
+
return t2.className = "notectl-toolbar-separator", t2.setAttribute("role", "separator"), t2;
|
|
189
|
+
}
|
|
190
|
+
class f {
|
|
191
|
+
activePopup = null;
|
|
192
|
+
activePopupButton = null;
|
|
193
|
+
closePopupHandler = null;
|
|
194
|
+
getActiveElement;
|
|
195
|
+
constructor(t2) {
|
|
196
|
+
this.getActiveElement = t2;
|
|
197
|
+
}
|
|
198
|
+
isOpen() {
|
|
199
|
+
return null !== this.activePopup;
|
|
200
|
+
}
|
|
201
|
+
toggle(t2, e2, o2) {
|
|
202
|
+
if (this.activePopup) return void this.close();
|
|
203
|
+
const n2 = document.createElement("div");
|
|
204
|
+
switch (n2.className = "notectl-toolbar-popup", e2.popupType) {
|
|
205
|
+
case "gridPicker":
|
|
206
|
+
!(function(t3, e3, o3) {
|
|
207
|
+
t3.className += " notectl-grid-picker";
|
|
208
|
+
const n3 = document.createElement("div");
|
|
209
|
+
n3.className = "notectl-grid-picker__grid", n3.setAttribute("role", "grid"), n3.style.display = "grid", n3.style.gridTemplateColumns = `repeat(${e3.maxCols}, 1fr)`, n3.style.gap = "2px", n3.style.padding = "8px";
|
|
210
|
+
const r2 = document.createElement("div");
|
|
211
|
+
r2.className = "notectl-grid-picker__label", r2.textContent = "1 x 1", r2.style.textAlign = "center", r2.style.padding = "4px", r2.style.fontSize = "12px", r2.setAttribute("aria-live", "polite");
|
|
212
|
+
for (let t4 = 1; t4 <= e3.maxRows; t4++) for (let i2 = 1; i2 <= e3.maxCols; i2++) {
|
|
213
|
+
const s2 = document.createElement("div");
|
|
214
|
+
s2.className = "notectl-grid-picker__cell", s2.setAttribute("role", "gridcell"), s2.setAttribute("tabindex", "-1"), s2.setAttribute("aria-label", `${t4} x ${i2}`), s2.style.width = "20px", s2.style.height = "20px", s2.style.border = "1px solid #ccc", s2.style.cursor = "pointer", s2.setAttribute("data-row", String(t4)), s2.setAttribute("data-col", String(i2)), s2.addEventListener("mouseenter", () => {
|
|
215
|
+
m(n3, t4, i2), r2.textContent = `${t4} x ${i2}`;
|
|
216
|
+
}), s2.addEventListener("mousedown", (n4) => {
|
|
217
|
+
n4.preventDefault(), n4.stopPropagation(), e3.onSelect(t4, i2), o3();
|
|
218
|
+
}), s2.addEventListener("click", () => {
|
|
219
|
+
e3.onSelect(t4, i2), o3();
|
|
220
|
+
}), n3.appendChild(s2);
|
|
221
|
+
}
|
|
222
|
+
t3.appendChild(n3), t3.appendChild(r2);
|
|
223
|
+
})(n2, e2.popupConfig, () => this.close());
|
|
224
|
+
break;
|
|
225
|
+
case "dropdown":
|
|
226
|
+
!(function(t3, e3, o3, n3) {
|
|
227
|
+
t3.classList.add("notectl-dropdown"), t3.setAttribute("role", "menu");
|
|
228
|
+
for (const r2 of e3.items) {
|
|
229
|
+
const e4 = document.createElement("button");
|
|
230
|
+
if (e4.type = "button", e4.className = "notectl-dropdown__item", e4.setAttribute("role", "menuitem"), e4.setAttribute("tabindex", "-1"), r2.icon) {
|
|
231
|
+
const t4 = document.createElement("span");
|
|
232
|
+
t4.className = "notectl-dropdown__item-icon", t4.innerHTML = r2.icon, e4.appendChild(t4);
|
|
233
|
+
}
|
|
234
|
+
const i2 = document.createElement("span");
|
|
235
|
+
i2.className = "notectl-dropdown__item-label", i2.textContent = r2.label, e4.appendChild(i2), e4.addEventListener("mousedown", (t4) => {
|
|
236
|
+
t4.preventDefault(), t4.stopPropagation(), o3(r2.command), n3();
|
|
237
|
+
}), e4.addEventListener("click", () => {
|
|
238
|
+
o3(r2.command), n3();
|
|
239
|
+
}), t3.appendChild(e4);
|
|
240
|
+
}
|
|
241
|
+
})(n2, e2.popupConfig, (t3) => o2.executeCommand(t3), () => this.close());
|
|
242
|
+
break;
|
|
243
|
+
case "custom":
|
|
244
|
+
e2.renderPopup(n2, o2, () => this.close());
|
|
245
|
+
}
|
|
246
|
+
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)), this.closePopupHandler = (e3) => {
|
|
247
|
+
const o3 = e3.composedPath();
|
|
248
|
+
o3.includes(n2) || o3.includes(t2) || this.close();
|
|
249
|
+
}, setTimeout(() => {
|
|
250
|
+
this.closePopupHandler && document.addEventListener("mousedown", this.closePopupHandler);
|
|
251
|
+
}, 0);
|
|
252
|
+
}
|
|
253
|
+
close() {
|
|
254
|
+
this.activePopupButton && (this.activePopupButton.classList.remove("notectl-toolbar-btn--popup-open"), this.activePopupButton.setAttribute("aria-expanded", "false"), this.activePopupButton = null), this.activePopup && (this.activePopup.remove(), this.activePopup = null), this.closePopupHandler && (document.removeEventListener("mousedown", this.closePopupHandler), this.closePopupHandler = null);
|
|
255
|
+
}
|
|
256
|
+
closeAndRestoreFocus() {
|
|
257
|
+
const t2 = this.activePopupButton;
|
|
258
|
+
this.close(), t2?.focus();
|
|
259
|
+
}
|
|
260
|
+
destroy() {
|
|
261
|
+
this.close();
|
|
262
|
+
}
|
|
263
|
+
positionAndAppend(t2, e2) {
|
|
264
|
+
const o2 = e2.getBoundingClientRect();
|
|
265
|
+
t2.style.position = "fixed", t2.style.top = `${o2.bottom + 2}px`, t2.style.left = `${o2.left}px`, t2.style.zIndex = "10000";
|
|
266
|
+
const n2 = e2.getRootNode();
|
|
267
|
+
n2 instanceof ShadowRoot ? n2.appendChild(t2) : document.body.appendChild(t2);
|
|
268
|
+
}
|
|
269
|
+
focusFirstItem(t2) {
|
|
270
|
+
requestAnimationFrame(() => {
|
|
271
|
+
const e2 = t2.querySelector('[role="menuitem"]') ?? t2.querySelector(".notectl-grid-picker__cell") ?? t2.querySelector("button");
|
|
272
|
+
e2?.focus();
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
handlePopupKeydown(t2) {
|
|
276
|
+
if (!this.activePopup) return;
|
|
277
|
+
if ("Escape" === t2.key) return t2.preventDefault(), t2.stopPropagation(), void this.closeAndRestoreFocus();
|
|
278
|
+
if ("Tab" === t2.key) return t2.preventDefault(), void this.closeAndRestoreFocus();
|
|
279
|
+
const e2 = this.activePopup.querySelectorAll('[role="menuitem"]');
|
|
280
|
+
e2.length > 0 ? this.handleDropdownKeydown(t2, e2) : null !== this.activePopup.querySelector(".notectl-grid-picker__cell") ? this.handleGridKeydown(t2) : this.handleCustomPopupKeydown(t2);
|
|
281
|
+
}
|
|
282
|
+
handleDropdownKeydown(t2, e2) {
|
|
283
|
+
const n2 = Array.from(e2), r2 = n2.indexOf(this.getActiveElement());
|
|
284
|
+
switch (t2.key) {
|
|
285
|
+
case "ArrowDown": {
|
|
286
|
+
t2.preventDefault();
|
|
287
|
+
const e3 = o(n2, r2, 1);
|
|
288
|
+
n2[e3]?.focus();
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case "ArrowUp": {
|
|
292
|
+
t2.preventDefault();
|
|
293
|
+
const e3 = o(n2, r2, -1);
|
|
294
|
+
n2[e3]?.focus();
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case "Enter":
|
|
298
|
+
case " ": {
|
|
299
|
+
t2.preventDefault();
|
|
300
|
+
const e3 = n2[r2];
|
|
301
|
+
e3 && e3.click();
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
handleGridKeydown(t2) {
|
|
307
|
+
const e2 = this.getActiveElement(), o2 = Number(e2?.getAttribute("data-row") ?? 1), r2 = Number(e2?.getAttribute("data-col") ?? 1), i2 = this.activePopup?.querySelector(".notectl-grid-picker__grid") ?? null;
|
|
308
|
+
if (!i2) return;
|
|
309
|
+
const s2 = i2.querySelector(".notectl-grid-picker__cell:last-child"), l2 = Number(s2?.getAttribute("data-col") ?? 1), a2 = Number(s2?.getAttribute("data-row") ?? 1);
|
|
310
|
+
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t2.key)) {
|
|
311
|
+
t2.preventDefault();
|
|
312
|
+
const [e3, s3] = n(o2, r2, a2, l2, t2.key), c2 = i2.querySelector(`.notectl-grid-picker__cell[data-row="${e3}"][data-col="${s3}"]`);
|
|
313
|
+
c2?.focus(), m(i2, e3, s3);
|
|
314
|
+
const d2 = this.activePopup?.querySelector(".notectl-grid-picker__label") ?? null;
|
|
315
|
+
d2 && (d2.textContent = `${e3} x ${s3}`);
|
|
316
|
+
}
|
|
317
|
+
"Enter" !== t2.key && " " !== t2.key || (t2.preventDefault(), e2?.click());
|
|
318
|
+
}
|
|
319
|
+
handleCustomPopupKeydown(t2) {
|
|
320
|
+
if (!this.activePopup) return;
|
|
321
|
+
const e2 = Array.from(this.activePopup.querySelectorAll("button"));
|
|
322
|
+
if (0 === e2.length) return;
|
|
323
|
+
const n2 = this.getActiveElement(), r2 = e2.indexOf(n2);
|
|
324
|
+
switch (t2.key) {
|
|
325
|
+
case "ArrowDown": {
|
|
326
|
+
t2.preventDefault();
|
|
327
|
+
const n3 = o(e2, r2, 1);
|
|
328
|
+
e2[n3]?.focus();
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
case "ArrowUp": {
|
|
332
|
+
t2.preventDefault();
|
|
333
|
+
const n3 = o(e2, r2, -1);
|
|
334
|
+
e2[n3]?.focus();
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
case "Enter":
|
|
338
|
+
case " ":
|
|
339
|
+
t2.preventDefault(), n2 && n2.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, cancelable: true }));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
class v {
|
|
344
|
+
element;
|
|
345
|
+
timer = null;
|
|
346
|
+
target = null;
|
|
347
|
+
isPopupActive;
|
|
348
|
+
static TOOLTIP_ID = "notectl-toolbar-tooltip";
|
|
349
|
+
constructor(t2) {
|
|
350
|
+
this.isPopupActive = t2, this.element = document.createElement("div"), this.element.className = "notectl-toolbar-tooltip", this.element.id = v.TOOLTIP_ID, this.element.setAttribute("role", "tooltip"), this.element.style.display = "none";
|
|
351
|
+
}
|
|
352
|
+
show(t2) {
|
|
353
|
+
if (this.hide(), this.isPopupActive() || t2.disabled) return;
|
|
354
|
+
const e2 = t2.getAttribute("data-tooltip");
|
|
355
|
+
e2 && (this.target = t2, this.timer = setTimeout(() => {
|
|
356
|
+
if (this.isPopupActive()) return;
|
|
357
|
+
this.element.textContent = e2, this.element.style.display = "";
|
|
358
|
+
const o2 = t2.getRootNode();
|
|
359
|
+
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", v.TOOLTIP_ID);
|
|
360
|
+
const n2 = t2.getBoundingClientRect();
|
|
361
|
+
this.element.style.position = "fixed", this.element.style.top = `${n2.bottom + 6}px`, this.element.style.left = `${n2.left + n2.width / 2}px`, this.element.style.transform = "translateX(-50%)";
|
|
362
|
+
}, 500));
|
|
363
|
+
}
|
|
364
|
+
hide() {
|
|
365
|
+
this.timer && (clearTimeout(this.timer), this.timer = null), this.target && (this.target.removeAttribute("aria-describedby"), this.target = null), this.element.style.display = "none";
|
|
366
|
+
}
|
|
367
|
+
destroy() {
|
|
368
|
+
this.hide(), this.element.remove();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const w = new t("toolbar");
|
|
372
|
+
class g {
|
|
373
|
+
id = "toolbar";
|
|
374
|
+
name = "Toolbar";
|
|
375
|
+
priority = 10;
|
|
376
|
+
context = null;
|
|
377
|
+
toolbarElement = null;
|
|
378
|
+
buttons = [];
|
|
379
|
+
hiddenItems = /* @__PURE__ */ new Set();
|
|
380
|
+
layoutConfig;
|
|
381
|
+
overflowBehavior;
|
|
382
|
+
focusedIndex = 0;
|
|
383
|
+
tooltip = null;
|
|
384
|
+
popupController = null;
|
|
385
|
+
overflowController = null;
|
|
386
|
+
visibleElements = [];
|
|
387
|
+
locale;
|
|
388
|
+
constructor(t2) {
|
|
389
|
+
this.layoutConfig = t2 ?? null, this.overflowBehavior = t2?.overflow ?? d.BurgerMenu;
|
|
390
|
+
}
|
|
391
|
+
init(t2) {
|
|
392
|
+
this.locale = e(c, t2), t2.registerStyleSheet(`
|
|
393
|
+
/* Toolbar */
|
|
394
|
+
.notectl-plugin-container--top {
|
|
395
|
+
display: flex;
|
|
396
|
+
align-items: center;
|
|
397
|
+
flex-wrap: nowrap;
|
|
398
|
+
border-bottom: 1px solid var(--notectl-border);
|
|
399
|
+
background: var(--notectl-toolbar-bg, var(--notectl-surface-raised));
|
|
400
|
+
min-height: 40px;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.notectl-toolbar {
|
|
404
|
+
display: flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
flex-wrap: nowrap;
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
flex: 1;
|
|
409
|
+
min-width: 0;
|
|
410
|
+
gap: 2px;
|
|
411
|
+
padding: 4px 8px;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.notectl-toolbar[hidden] {
|
|
415
|
+
display: none;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.notectl-toolbar-btn {
|
|
419
|
+
display: inline-flex;
|
|
420
|
+
align-items: center;
|
|
421
|
+
justify-content: center;
|
|
422
|
+
width: 32px;
|
|
423
|
+
height: 32px;
|
|
424
|
+
border: 1px solid transparent;
|
|
425
|
+
border-radius: 4px;
|
|
426
|
+
background: transparent;
|
|
427
|
+
cursor: pointer;
|
|
428
|
+
color: var(--notectl-fg);
|
|
429
|
+
font-size: 14px;
|
|
430
|
+
line-height: 1;
|
|
431
|
+
padding: 0;
|
|
432
|
+
flex-shrink: 0;
|
|
433
|
+
transition: background 0.1s, border-color 0.1s;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.notectl-toolbar-btn:hover {
|
|
437
|
+
background: var(--notectl-hover-bg);
|
|
438
|
+
border-color: var(--notectl-border);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.notectl-toolbar-btn--active {
|
|
442
|
+
background: var(--notectl-active-bg);
|
|
443
|
+
border-color: var(--notectl-primary-muted);
|
|
444
|
+
color: var(--notectl-primary-fg);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.notectl-toolbar-btn:focus-visible {
|
|
448
|
+
box-shadow: 0 0 0 2px var(--notectl-focus-ring);
|
|
449
|
+
outline: none;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.notectl-toolbar-btn:disabled {
|
|
453
|
+
opacity: 0.4;
|
|
454
|
+
cursor: not-allowed;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.notectl-toolbar-btn:disabled:hover {
|
|
458
|
+
background: transparent;
|
|
459
|
+
border-color: transparent;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.notectl-toolbar-btn__icon {
|
|
463
|
+
display: inline-flex;
|
|
464
|
+
align-items: center;
|
|
465
|
+
justify-content: center;
|
|
466
|
+
pointer-events: none;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.notectl-toolbar-btn__icon svg {
|
|
470
|
+
display: block;
|
|
471
|
+
width: 18px;
|
|
472
|
+
height: 18px;
|
|
473
|
+
fill: currentColor;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/* Tooltip (rendered as fixed-position element in shadow root) */
|
|
477
|
+
.notectl-toolbar-tooltip {
|
|
478
|
+
position: fixed;
|
|
479
|
+
padding: 4px 8px;
|
|
480
|
+
border-radius: 4px;
|
|
481
|
+
background: var(--notectl-tooltip-bg);
|
|
482
|
+
color: var(--notectl-tooltip-fg);
|
|
483
|
+
font-size: 11px;
|
|
484
|
+
font-weight: 500;
|
|
485
|
+
white-space: nowrap;
|
|
486
|
+
pointer-events: none;
|
|
487
|
+
z-index: 10001;
|
|
488
|
+
line-height: 1.4;
|
|
489
|
+
letter-spacing: 0.01em;
|
|
490
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.notectl-toolbar-separator {
|
|
494
|
+
display: inline-block;
|
|
495
|
+
width: 1px;
|
|
496
|
+
height: 20px;
|
|
497
|
+
background: var(--notectl-border);
|
|
498
|
+
margin: 0 4px;
|
|
499
|
+
vertical-align: middle;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/* Toolbar Popups */
|
|
503
|
+
.notectl-toolbar-popup {
|
|
504
|
+
background: var(--notectl-surface-overlay);
|
|
505
|
+
border: 1px solid var(--notectl-border);
|
|
506
|
+
border-radius: 6px;
|
|
507
|
+
box-shadow: 0 4px 12px var(--notectl-shadow);
|
|
508
|
+
overflow: hidden;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/* Grid Picker */
|
|
512
|
+
.notectl-grid-picker__cell:focus-visible {
|
|
513
|
+
outline: 2px solid var(--notectl-focus-ring);
|
|
514
|
+
outline-offset: -1px;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.notectl-grid-picker__cell--highlighted {
|
|
518
|
+
background: var(--notectl-primary-muted);
|
|
519
|
+
border-color: var(--notectl-primary);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/* Dropdown */
|
|
523
|
+
.notectl-dropdown {
|
|
524
|
+
min-width: 160px;
|
|
525
|
+
padding: 4px 0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.notectl-dropdown__item {
|
|
529
|
+
display: flex;
|
|
530
|
+
align-items: center;
|
|
531
|
+
width: 100%;
|
|
532
|
+
padding: 8px 12px;
|
|
533
|
+
text-align: left;
|
|
534
|
+
border: none;
|
|
535
|
+
background: none;
|
|
536
|
+
cursor: pointer;
|
|
537
|
+
font-size: 14px;
|
|
538
|
+
color: var(--notectl-fg);
|
|
539
|
+
line-height: 1.4;
|
|
540
|
+
font-family: inherit;
|
|
541
|
+
white-space: nowrap;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.notectl-dropdown__item:hover,
|
|
545
|
+
.notectl-dropdown__item:focus-visible {
|
|
546
|
+
background: var(--notectl-hover-bg);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.notectl-dropdown__item:focus-visible {
|
|
550
|
+
outline: none;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.notectl-dropdown__item-icon {
|
|
554
|
+
display: inline-flex;
|
|
555
|
+
align-items: center;
|
|
556
|
+
justify-content: center;
|
|
557
|
+
width: 28px;
|
|
558
|
+
font-weight: 600;
|
|
559
|
+
color: var(--notectl-fg-muted);
|
|
560
|
+
flex-shrink: 0;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.notectl-dropdown__item-label {
|
|
564
|
+
flex: 1;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/* Overflow behavior: flow mode — toolbar wraps to additional rows */
|
|
568
|
+
.notectl-toolbar[data-overflow="flow"] {
|
|
569
|
+
flex-wrap: wrap;
|
|
570
|
+
overflow: visible;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/* Overflow behavior: none — toolbar clips without any responsive behavior */
|
|
574
|
+
.notectl-toolbar[data-overflow="none"] {
|
|
575
|
+
flex-wrap: nowrap;
|
|
576
|
+
overflow: hidden;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/* Overflow: hidden items (burger-menu mode) */
|
|
580
|
+
.notectl-toolbar-btn--overflow-hidden,
|
|
581
|
+
.notectl-toolbar-separator--overflow-hidden {
|
|
582
|
+
display: none;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/* Overflow "more" button */
|
|
586
|
+
.notectl-toolbar-overflow-btn {
|
|
587
|
+
display: inline-flex;
|
|
588
|
+
align-items: center;
|
|
589
|
+
justify-content: center;
|
|
590
|
+
width: 32px;
|
|
591
|
+
height: 32px;
|
|
592
|
+
border: 1px solid transparent;
|
|
593
|
+
border-radius: 4px;
|
|
594
|
+
background: transparent;
|
|
595
|
+
cursor: pointer;
|
|
596
|
+
color: var(--notectl-fg);
|
|
597
|
+
font-size: 16px;
|
|
598
|
+
line-height: 1;
|
|
599
|
+
padding: 0;
|
|
600
|
+
flex-shrink: 0;
|
|
601
|
+
margin-left: auto;
|
|
602
|
+
transition: background 0.1s, border-color 0.1s;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.notectl-toolbar-overflow-btn:hover {
|
|
606
|
+
background: var(--notectl-hover-bg);
|
|
607
|
+
border-color: var(--notectl-border);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.notectl-toolbar-overflow-btn--hidden {
|
|
611
|
+
display: none;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.notectl-toolbar-overflow-btn:focus-visible {
|
|
615
|
+
box-shadow: 0 0 0 2px var(--notectl-focus-ring);
|
|
616
|
+
outline: none;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/* Dropdown item states shared by all dropdown menus (including overflow) */
|
|
620
|
+
.notectl-dropdown__item:disabled {
|
|
621
|
+
opacity: 0.4;
|
|
622
|
+
cursor: not-allowed;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.notectl-dropdown__item:disabled:hover {
|
|
626
|
+
background: none;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.notectl-dropdown__item--active {
|
|
630
|
+
color: var(--notectl-primary-fg);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.notectl-dropdown__item-icon svg {
|
|
634
|
+
display: block;
|
|
635
|
+
width: 16px;
|
|
636
|
+
height: 16px;
|
|
637
|
+
fill: currentColor;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.notectl-dropdown__separator {
|
|
641
|
+
height: 1px;
|
|
642
|
+
background: var(--notectl-border);
|
|
643
|
+
margin: 4px 0;
|
|
644
|
+
}
|
|
645
|
+
`), this.context = t2, this.popupController = new f(() => this.getActiveElement()), this.tooltip = new v(() => this.popupController?.isOpen() ?? false), t2.registerService(w, { refresh: () => this.updateButtonStates(t2.getState()), closePopup: () => this.popupController?.close() }), this.createToolbarElement();
|
|
646
|
+
}
|
|
647
|
+
getOverflowBehavior() {
|
|
648
|
+
return this.overflowBehavior;
|
|
649
|
+
}
|
|
650
|
+
setOverflowBehavior(t2) {
|
|
651
|
+
t2 !== this.overflowBehavior && (this.overflowBehavior = t2, this.applyOverflowBehavior(), this.renderItems());
|
|
652
|
+
}
|
|
653
|
+
onReady() {
|
|
654
|
+
this.renderItems();
|
|
655
|
+
}
|
|
656
|
+
destroy() {
|
|
657
|
+
this.overflowController?.destroy(), this.overflowController = null, this.popupController?.destroy(), this.popupController = null, this.tooltip?.destroy(), this.tooltip = null, this.toolbarElement && (this.toolbarElement.remove(), this.toolbarElement = null), this.buttons = [], this.visibleElements = [], this.context = null;
|
|
658
|
+
}
|
|
659
|
+
onStateChange(t2, e2, o2) {
|
|
660
|
+
this.updateButtonStates(e2);
|
|
661
|
+
}
|
|
662
|
+
onReadOnlyChange(t2) {
|
|
663
|
+
this.toolbarElement && (this.toolbarElement.hidden = t2);
|
|
664
|
+
}
|
|
665
|
+
onConfigure(t2) {
|
|
666
|
+
for (const [e2, o2] of Object.entries(t2)) false === o2 ? this.hiddenItems.add(e2) : this.hiddenItems.delete(e2);
|
|
667
|
+
this.renderItems();
|
|
668
|
+
}
|
|
669
|
+
createToolbarElement() {
|
|
670
|
+
if (!this.context) return;
|
|
671
|
+
this.toolbarElement && this.toolbarElement.remove(), this.buttons = [];
|
|
672
|
+
const t2 = this.context.getPluginContainer("top");
|
|
673
|
+
this.toolbarElement = document.createElement("div"), this.toolbarElement.setAttribute("role", "toolbar"), this.toolbarElement.setAttribute("aria-label", this.locale.formattingOptionsAria), this.toolbarElement.setAttribute("data-notectl-no-print", ""), this.toolbarElement.className = "notectl-toolbar", this.toolbarElement.addEventListener("keydown", (t3) => this.handleToolbarKeydown(t3)), this.applyOverflowBehavior(), t2.appendChild(this.toolbarElement);
|
|
674
|
+
}
|
|
675
|
+
applyOverflowBehavior() {
|
|
676
|
+
this.toolbarElement && this.context && (this.overflowController?.destroy(), this.overflowController = null, this.toolbarElement.setAttribute("data-overflow", this.overflowBehavior), this.overflowBehavior === d.BurgerMenu ? this.overflowController = new u({ toolbar: this.toolbarElement, ariaLabel: this.locale.moreToolsAria, context: this.context, onOverflowChange: (t2, e2) => {
|
|
677
|
+
this.visibleElements = e2 ? [...t2, e2] : [...t2], this.initRovingTabindex();
|
|
678
|
+
}, onItemActivated: (t2, e2) => {
|
|
679
|
+
this.activateButton(t2, e2);
|
|
680
|
+
}, getActiveElement: () => this.getActiveElement() }) : this.visibleElements = []);
|
|
681
|
+
}
|
|
682
|
+
renderItems() {
|
|
683
|
+
if (this.context && this.toolbarElement) {
|
|
684
|
+
for (const t2 of this.buttons) t2.element.remove();
|
|
685
|
+
this.buttons = [];
|
|
686
|
+
for (const t2 of this.toolbarElement.querySelectorAll(".notectl-toolbar-separator")) t2.remove();
|
|
687
|
+
this.layoutConfig ? this.renderItemsByLayout() : this.renderItemsByPriority(), this.buttons.length > 0 && !this.toolbarElement.parentElement && this.context.getPluginContainer("top").appendChild(this.toolbarElement), this.overflowController?.update(this.buttons), this.initRovingTabindex(), this.updateButtonStates(this.context.getState());
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
getTabElements() {
|
|
691
|
+
return this.visibleElements.length > 0 ? this.visibleElements : this.buttons.map((t2) => t2.element);
|
|
692
|
+
}
|
|
693
|
+
initRovingTabindex() {
|
|
694
|
+
const t2 = this.getTabElements(), e2 = r(t2);
|
|
695
|
+
this.focusedIndex = e2 >= 0 ? e2 : 0, i(t2, this.focusedIndex);
|
|
696
|
+
}
|
|
697
|
+
setRovingFocus(t2) {
|
|
698
|
+
const e2 = this.getTabElements();
|
|
699
|
+
t2 < 0 || t2 >= e2.length || (this.focusedIndex = t2, i(e2, t2), e2[t2]?.focus());
|
|
700
|
+
}
|
|
701
|
+
getActiveElement() {
|
|
702
|
+
const t2 = this.toolbarElement?.getRootNode();
|
|
703
|
+
return t2 instanceof ShadowRoot ? t2.activeElement : document.activeElement;
|
|
704
|
+
}
|
|
705
|
+
syncFocusedIndex() {
|
|
706
|
+
const t2 = this.getActiveElement(), e2 = this.getTabElements().findIndex((e3) => e3 === t2);
|
|
707
|
+
e2 >= 0 && (this.focusedIndex = e2);
|
|
708
|
+
}
|
|
709
|
+
handleToolbarKeydown(t2) {
|
|
710
|
+
const e2 = this.getTabElements();
|
|
711
|
+
if (0 !== e2.length) switch (this.syncFocusedIndex(), t2.key) {
|
|
712
|
+
case "ArrowRight": {
|
|
713
|
+
t2.preventDefault();
|
|
714
|
+
const o2 = l(e2, this.focusedIndex, 1);
|
|
715
|
+
this.setRovingFocus(o2);
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
case "ArrowLeft": {
|
|
719
|
+
t2.preventDefault();
|
|
720
|
+
const o2 = l(e2, this.focusedIndex, -1);
|
|
721
|
+
this.setRovingFocus(o2);
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
case "Home": {
|
|
725
|
+
t2.preventDefault();
|
|
726
|
+
const o2 = r(e2);
|
|
727
|
+
o2 >= 0 && this.setRovingFocus(o2);
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
case "End": {
|
|
731
|
+
t2.preventDefault();
|
|
732
|
+
const o2 = s(e2);
|
|
733
|
+
o2 >= 0 && this.setRovingFocus(o2);
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
case "Enter":
|
|
737
|
+
case " ": {
|
|
738
|
+
t2.preventDefault();
|
|
739
|
+
const o2 = e2[this.focusedIndex], n2 = this.buttons.find((t3) => t3.element === o2);
|
|
740
|
+
n2 && this.activateButton(n2.element, n2.item);
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
activateButton(t2, e2) {
|
|
746
|
+
this.tooltip?.hide(), e2.popupType && this.context ? this.popupController?.toggle(t2, e2, this.context) : this.context?.executeCommand(e2.command);
|
|
747
|
+
}
|
|
748
|
+
renderItemsByLayout() {
|
|
749
|
+
if (!this.context || !this.toolbarElement || !this.layoutConfig) return;
|
|
750
|
+
const t2 = this.context.getSchemaRegistry();
|
|
751
|
+
let e2 = true;
|
|
752
|
+
for (const o2 of this.layoutConfig.groups) {
|
|
753
|
+
const n2 = [];
|
|
754
|
+
for (const e3 of o2) {
|
|
755
|
+
const o3 = t2.getToolbarItemsByPlugin(e3).filter((t3) => !this.hiddenItems.has(t3.id));
|
|
756
|
+
o3.sort((t3, e4) => (t3.priority ?? 100) - (e4.priority ?? 100)), n2.push(...o3);
|
|
757
|
+
}
|
|
758
|
+
if (0 !== n2.length) {
|
|
759
|
+
e2 || this.toolbarElement.appendChild(b()), e2 = false;
|
|
760
|
+
for (const t3 of n2) {
|
|
761
|
+
const e3 = this.createButton(t3);
|
|
762
|
+
this.toolbarElement.appendChild(e3.element), this.buttons.push(e3);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
0 === this.buttons.length && this.toolbarElement.remove();
|
|
767
|
+
}
|
|
768
|
+
renderItemsByPriority() {
|
|
769
|
+
if (!this.context || !this.toolbarElement) return;
|
|
770
|
+
const t2 = this.context.getSchemaRegistry().getToolbarItems().filter((t3) => !this.hiddenItems.has(t3.id));
|
|
771
|
+
if (0 === t2.length) return void this.toolbarElement.remove();
|
|
772
|
+
const e2 = [...t2].sort((t3, e3) => (t3.priority ?? 100) - (e3.priority ?? 100));
|
|
773
|
+
if (e2.some((t3) => t3.separatorAfter)) for (let t3 = 0; t3 < e2.length; t3++) {
|
|
774
|
+
const o2 = e2[t3];
|
|
775
|
+
if (!o2) continue;
|
|
776
|
+
const n2 = this.createButton(o2);
|
|
777
|
+
this.toolbarElement.appendChild(n2.element), this.buttons.push(n2), o2.separatorAfter && t3 < e2.length - 1 && this.toolbarElement.appendChild(b());
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
const t3 = /* @__PURE__ */ new Map();
|
|
781
|
+
for (const o3 of e2) {
|
|
782
|
+
const e3 = t3.get(o3.group) ?? [];
|
|
783
|
+
e3.push(o3), t3.set(o3.group, e3);
|
|
784
|
+
}
|
|
785
|
+
let o2 = true;
|
|
786
|
+
for (const [, e3] of t3) {
|
|
787
|
+
o2 || this.toolbarElement.appendChild(b()), o2 = false;
|
|
788
|
+
for (const t4 of e3) {
|
|
789
|
+
const e4 = this.createButton(t4);
|
|
790
|
+
this.toolbarElement.appendChild(e4.element), this.buttons.push(e4);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
createButton(t2) {
|
|
796
|
+
const e2 = document.createElement("button");
|
|
797
|
+
e2.type = "button", e2.className = `notectl-toolbar-btn notectl-toolbar-btn--${t2.id}`, e2.setAttribute("aria-pressed", "false"), e2.setAttribute("aria-label", t2.label), e2.setAttribute("data-toolbar-item", t2.id), e2.setAttribute("data-tooltip", t2.tooltip ?? t2.label), t2.popupType && (e2.setAttribute("aria-haspopup", "true"), e2.setAttribute("aria-expanded", "false"));
|
|
798
|
+
const o2 = document.createElement("span");
|
|
799
|
+
return o2.className = "notectl-toolbar-btn__icon", o2.innerHTML = t2.icon, e2.appendChild(o2), e2.addEventListener("mousedown", (o3) => {
|
|
800
|
+
o3.preventDefault(), this.activateButton(e2, t2);
|
|
801
|
+
}), e2.addEventListener("mouseenter", () => this.tooltip?.show(e2)), e2.addEventListener("mouseleave", () => this.tooltip?.hide()), e2.addEventListener("focus", () => this.tooltip?.show(e2)), e2.addEventListener("blur", () => this.tooltip?.hide()), { element: e2, item: t2 };
|
|
802
|
+
}
|
|
803
|
+
updateButtonStates(t2) {
|
|
804
|
+
for (const e2 of this.buttons) {
|
|
805
|
+
const o2 = e2.item.isActive?.(t2) ?? false, n2 = e2.item.isEnabled?.(t2) ?? true;
|
|
806
|
+
e2.element.setAttribute("aria-pressed", String(o2)), e2.element.classList.toggle("notectl-toolbar-btn--active", o2), e2.element.disabled = !n2, n2 ? e2.element.removeAttribute("aria-disabled") : e2.element.setAttribute("aria-disabled", "true");
|
|
807
|
+
}
|
|
808
|
+
this.overflowController?.updateItemStates(t2);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
export {
|
|
812
|
+
g as T,
|
|
813
|
+
w as a,
|
|
814
|
+
c as b,
|
|
815
|
+
a as c,
|
|
816
|
+
d
|
|
817
|
+
};
|
|
818
|
+
//# sourceMappingURL=ToolbarPlugin-DFkl1uYO.mjs.map
|