@notectl/core 1.7.1 → 1.7.2
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/{AttrRegistry-Ci0qAvtS.mjs → AttrRegistry-D9Jx_RVb.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-Ci0qAvtS.mjs.map → AttrRegistry-D9Jx_RVb.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +80 -0
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs.map +1 -0
- package/dist/chunks/{CaretNavigation-qLfeL0So.mjs → CaretNavigation-7JYpIKbs.mjs} +3 -3
- package/dist/chunks/{CaretNavigation-qLfeL0So.mjs.map → CaretNavigation-7JYpIKbs.mjs.map} +1 -1
- package/dist/chunks/{ColorGrid-BBkN0AOb.mjs → ColorGrid-Dneqb8if.mjs} +56 -55
- package/dist/chunks/ColorGrid-Dneqb8if.mjs.map +1 -0
- package/dist/chunks/{ColorPickerPopup-D3ysvOH-.mjs → ColorPickerPopup-CiCLBbe9.mjs} +11 -11
- package/dist/chunks/{ColorPickerPopup-D3ysvOH-.mjs.map → ColorPickerPopup-CiCLBbe9.mjs.map} +1 -1
- package/dist/chunks/{Document-DfZ1NOjs.mjs → Document-Brtw2jL1.mjs} +6 -6
- package/dist/chunks/{Document-DfZ1NOjs.mjs.map → Document-Brtw2jL1.mjs.map} +1 -1
- package/dist/chunks/{MarkCommands-uybmkw9l.mjs → MarkCommands-6RUJ4L3r.mjs} +3 -3
- package/dist/chunks/{MarkCommands-uybmkw9l.mjs.map → MarkCommands-6RUJ4L3r.mjs.map} +1 -1
- package/dist/chunks/{NodeResolver-CzLmmrph.mjs → NodeResolver-C2XYkeOi.mjs} +2 -2
- package/dist/chunks/{NodeResolver-CzLmmrph.mjs.map → NodeResolver-C2XYkeOi.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs +32 -0
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs.map +1 -0
- package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +16 -0
- package/dist/chunks/{RangeIterator-Bye0UtbY.mjs.map → RangeIterator-Bh4Vl_6D.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-ChRjVQwL.mjs +239 -0
- package/dist/chunks/StyleRuntime-ChRjVQwL.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-B7oJRzpl.mjs → ToolbarPlugin-DpLVJ71w.mjs} +48 -47
- package/dist/chunks/ToolbarPlugin-DpLVJ71w.mjs.map +1 -0
- package/dist/chunks/{index-DoCvDkfj.mjs → index--n1RGpq-.mjs} +39 -38
- package/dist/chunks/index--n1RGpq-.mjs.map +1 -0
- package/dist/chunks/{index-DayTn6Re.mjs → index-4or5UzNO.mjs} +43 -41
- package/dist/chunks/index-4or5UzNO.mjs.map +1 -0
- package/dist/chunks/{index-CFJFD4lF.mjs → index-ABlTDvEX.mjs} +19 -18
- package/dist/chunks/index-ABlTDvEX.mjs.map +1 -0
- package/dist/chunks/{index-DmuuFS5D.mjs → index-BAke7kNL.mjs} +43 -43
- package/dist/chunks/{index-DmuuFS5D.mjs.map → index-BAke7kNL.mjs.map} +1 -1
- package/dist/chunks/{index-DGKQhSAl.mjs → index-BXtw5PNN.mjs} +2 -2
- package/dist/chunks/{index-DGKQhSAl.mjs.map → index-BXtw5PNN.mjs.map} +1 -1
- package/dist/chunks/{index-CH1r7DL-.mjs → index-BhDXjueu.mjs} +204 -203
- package/dist/chunks/index-BhDXjueu.mjs.map +1 -0
- package/dist/chunks/{index-CfyS_pgH.mjs → index-BqNUfq-y.mjs} +32 -31
- package/dist/chunks/index-BqNUfq-y.mjs.map +1 -0
- package/dist/chunks/{index-Ckzqtn5D.mjs → index-BvqkuEY1.mjs} +15 -14
- package/dist/chunks/index-BvqkuEY1.mjs.map +1 -0
- package/dist/chunks/{index-CrKz_IEn.mjs → index-C1opJocO.mjs} +2 -2
- package/dist/chunks/{index-CrKz_IEn.mjs.map → index-C1opJocO.mjs.map} +1 -1
- package/dist/chunks/{index-Deag_lVi.mjs → index-CWltg1wK.mjs} +24 -21
- package/dist/chunks/index-CWltg1wK.mjs.map +1 -0
- package/dist/chunks/{index-E7OgN7hM.mjs → index-Cd3uJLP3.mjs} +2 -2
- package/dist/chunks/{index-E7OgN7hM.mjs.map → index-Cd3uJLP3.mjs.map} +1 -1
- package/dist/chunks/{index-CFPP456m.mjs → index-CluzpB2b.mjs} +2 -2
- package/dist/chunks/{index-CFPP456m.mjs.map → index-CluzpB2b.mjs.map} +1 -1
- package/dist/chunks/{index-DIvHQtE2.mjs → index-D3NlpmT1.mjs} +15 -14
- package/dist/chunks/index-D3NlpmT1.mjs.map +1 -0
- package/dist/chunks/{index-Bt_d4IqB.mjs → index-D515iymW.mjs} +71 -70
- package/dist/chunks/{index-Bt_d4IqB.mjs.map → index-D515iymW.mjs.map} +1 -1
- package/dist/chunks/{index-Dum8yE_t.mjs → index-Dk49P9N4.mjs} +11 -11
- package/dist/chunks/{index-Dum8yE_t.mjs.map → index-Dk49P9N4.mjs.map} +1 -1
- package/dist/chunks/{index-yhz2qeeh.mjs → index-DyzigvbZ.mjs} +128 -124
- package/dist/chunks/index-DyzigvbZ.mjs.map +1 -0
- package/dist/chunks/{index-DuRNETFv.mjs → index-ErZ5_a1o.mjs} +3 -3
- package/dist/chunks/{index-DuRNETFv.mjs.map → index-ErZ5_a1o.mjs.map} +1 -1
- package/dist/chunks/{index-Dy6SllXW.mjs → index-fsVJLutn.mjs} +3 -3
- package/dist/chunks/{index-Dy6SllXW.mjs.map → index-fsVJLutn.mjs.map} +1 -1
- package/dist/commands/AttributedMarkCommands.d.ts.map +1 -1
- package/dist/editor/EditorThemeController.d.ts +3 -0
- package/dist/editor/EditorThemeController.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +13 -0
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -1
- package/dist/notectl-core.mjs +452 -440
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +1325 -1068
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.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/CodeBlockNodeView.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/gap-cursor.mjs +6 -6
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/shared/ColorGrid.d.ts.map +1 -1
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table.mjs +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/style/StyleRuntime.d.ts +38 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs +0 -58
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs.map +0 -1
- package/dist/chunks/ColorGrid-BBkN0AOb.mjs.map +0 -1
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs +0 -30
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs.map +0 -1
- package/dist/chunks/RangeIterator-Bye0UtbY.mjs +0 -16
- package/dist/chunks/ToolbarPlugin-B7oJRzpl.mjs.map +0 -1
- package/dist/chunks/index-CFJFD4lF.mjs.map +0 -1
- package/dist/chunks/index-CH1r7DL-.mjs.map +0 -1
- package/dist/chunks/index-CfyS_pgH.mjs.map +0 -1
- package/dist/chunks/index-Ckzqtn5D.mjs.map +0 -1
- package/dist/chunks/index-DIvHQtE2.mjs.map +0 -1
- package/dist/chunks/index-DayTn6Re.mjs.map +0 -1
- package/dist/chunks/index-Deag_lVi.mjs.map +0 -1
- package/dist/chunks/index-DoCvDkfj.mjs.map +0 -1
- package/dist/chunks/index-yhz2qeeh.mjs.map +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
const e = "data-notectl-style-token", t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
function s() {
|
|
3
|
+
if ("undefined" == typeof CSSStyleSheet) return null;
|
|
4
|
+
try {
|
|
5
|
+
return new CSSStyleSheet();
|
|
6
|
+
} catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function o(e2, s2) {
|
|
11
|
+
const o2 = n.get(e2);
|
|
12
|
+
o2 && (o2.destroy(), n.delete(e2)), t.set(e2, { mode: s2.mode, nonce: s2.nonce, sheet: s2.sheet ?? null });
|
|
13
|
+
}
|
|
14
|
+
function i(e2) {
|
|
15
|
+
const s2 = n.get(e2);
|
|
16
|
+
s2 && (s2.destroy(), n.delete(e2)), t.delete(e2);
|
|
17
|
+
}
|
|
18
|
+
function l(e2, t2, n2) {
|
|
19
|
+
const s2 = y(e2);
|
|
20
|
+
s2 && "inline" !== s2.mode ? S(s2.root, s2.settings).setProperty(e2, t2, n2) : f(e2, t2, n2);
|
|
21
|
+
}
|
|
22
|
+
function r(e2, t2) {
|
|
23
|
+
l(e2, t2, "");
|
|
24
|
+
}
|
|
25
|
+
function c(e2, t2) {
|
|
26
|
+
const n2 = y(e2);
|
|
27
|
+
if (n2 && "inline" !== n2.mode) S(n2.root, n2.settings).setProperties(e2, t2);
|
|
28
|
+
else for (const [n3, s2] of Object.entries(t2)) f(e2, n3, s2 ?? "");
|
|
29
|
+
}
|
|
30
|
+
function a(e2, t2) {
|
|
31
|
+
const n2 = y(e2);
|
|
32
|
+
n2 && "inline" !== n2.mode ? S(n2.root, n2.settings).setStyleText(e2, t2) : e2.style.cssText = t2;
|
|
33
|
+
}
|
|
34
|
+
function h(e2, t2) {
|
|
35
|
+
const n2 = y(e2);
|
|
36
|
+
if (!n2 || "inline" === n2.mode) {
|
|
37
|
+
const n3 = e2.style.cssText;
|
|
38
|
+
return void (e2.style.cssText = n3 ? `${n3}; ${t2}` : t2);
|
|
39
|
+
}
|
|
40
|
+
S(n2.root, n2.settings).appendStyleText(e2, t2);
|
|
41
|
+
}
|
|
42
|
+
function u(e2, t2) {
|
|
43
|
+
a(e2, t2);
|
|
44
|
+
}
|
|
45
|
+
function d(e2) {
|
|
46
|
+
const n2 = p(e2);
|
|
47
|
+
if (n2) return t.get(n2)?.nonce;
|
|
48
|
+
}
|
|
49
|
+
function f(e2, t2, n2) {
|
|
50
|
+
t2.startsWith("--") || t2.includes("-") ? n2 ? e2.style.setProperty(t2, n2) : e2.style.removeProperty(t2) : e2.style[t2] = n2;
|
|
51
|
+
}
|
|
52
|
+
function y(e2) {
|
|
53
|
+
const n2 = (function(e3) {
|
|
54
|
+
return p(e3);
|
|
55
|
+
})(e2);
|
|
56
|
+
if (!n2) return null;
|
|
57
|
+
const s2 = t.get(n2);
|
|
58
|
+
return s2 ? { root: n2, mode: s2.mode, settings: s2 } : null;
|
|
59
|
+
}
|
|
60
|
+
function S(e2, t2) {
|
|
61
|
+
const s2 = n.get(e2);
|
|
62
|
+
if (s2) return s2;
|
|
63
|
+
const o2 = new g(e2, t2);
|
|
64
|
+
return n.set(e2, o2), o2;
|
|
65
|
+
}
|
|
66
|
+
function m(e2) {
|
|
67
|
+
return "undefined" != typeof ShadowRoot && e2 instanceof ShadowRoot;
|
|
68
|
+
}
|
|
69
|
+
function k(e2) {
|
|
70
|
+
return "undefined" != typeof Document && e2 instanceof Document;
|
|
71
|
+
}
|
|
72
|
+
function p(e2) {
|
|
73
|
+
const t2 = m(e2) || k(e2) ? e2 : e2.getRootNode();
|
|
74
|
+
return m(t2) || k(t2) ? t2 : "undefined" != typeof document ? document : null;
|
|
75
|
+
}
|
|
76
|
+
class g {
|
|
77
|
+
declarationByElement = /* @__PURE__ */ new WeakMap();
|
|
78
|
+
tokenByDeclaration = /* @__PURE__ */ new Map();
|
|
79
|
+
declarationByToken = /* @__PURE__ */ new Map();
|
|
80
|
+
tokenRefCount = /* @__PURE__ */ new Map();
|
|
81
|
+
tokenByElement = /* @__PURE__ */ new WeakMap();
|
|
82
|
+
tokenCounter = 0;
|
|
83
|
+
root;
|
|
84
|
+
nonce;
|
|
85
|
+
sheet;
|
|
86
|
+
fallbackStyleElement = null;
|
|
87
|
+
ownsAdoptedSheet = false;
|
|
88
|
+
constructor(e2, t2) {
|
|
89
|
+
this.root = e2, this.nonce = t2.nonce, this.sheet = t2.sheet ?? null;
|
|
90
|
+
}
|
|
91
|
+
destroy() {
|
|
92
|
+
this.clearRuntimeRules(), this.ownsAdoptedSheet && this.sheet && "adoptedStyleSheets" in this.root && (this.root.adoptedStyleSheets = this.root.adoptedStyleSheets.filter((e2) => e2 !== this.sheet)), this.fallbackStyleElement?.remove(), this.fallbackStyleElement = null, this.sheet = null, this.ownsAdoptedSheet = false, this.tokenByDeclaration.clear(), this.declarationByToken.clear(), this.tokenRefCount.clear(), this.tokenCounter = 0;
|
|
93
|
+
}
|
|
94
|
+
setProperty(e2, t2, n2) {
|
|
95
|
+
const s2 = this.getOrCreateDeclarations(e2), o2 = C(t2);
|
|
96
|
+
n2 ? s2.set(o2, n2) : s2.delete(o2), this.syncElementToken(e2, s2);
|
|
97
|
+
}
|
|
98
|
+
setProperties(e2, t2) {
|
|
99
|
+
const n2 = this.getOrCreateDeclarations(e2);
|
|
100
|
+
for (const [e3, s2] of Object.entries(t2)) {
|
|
101
|
+
const t3 = C(e3);
|
|
102
|
+
s2 ? n2.set(t3, s2) : n2.delete(t3);
|
|
103
|
+
}
|
|
104
|
+
this.syncElementToken(e2, n2);
|
|
105
|
+
}
|
|
106
|
+
setStyleText(e2, t2) {
|
|
107
|
+
const n2 = E(t2);
|
|
108
|
+
0 !== n2.size ? (this.declarationByElement.set(e2, n2), this.syncElementToken(e2, n2)) : this.clearElementStyles(e2);
|
|
109
|
+
}
|
|
110
|
+
appendStyleText(e2, t2) {
|
|
111
|
+
const n2 = E(t2);
|
|
112
|
+
if (0 === n2.size) return;
|
|
113
|
+
const s2 = this.getOrCreateDeclarations(e2);
|
|
114
|
+
for (const [e3, t3] of n2) s2.set(e3, t3);
|
|
115
|
+
this.syncElementToken(e2, s2);
|
|
116
|
+
}
|
|
117
|
+
getStyleText(e2) {
|
|
118
|
+
const t2 = this.declarationByElement.get(e2);
|
|
119
|
+
return t2 && 0 !== t2.size ? R(t2) : "";
|
|
120
|
+
}
|
|
121
|
+
getOrCreateDeclarations(e2) {
|
|
122
|
+
const t2 = this.declarationByElement.get(e2);
|
|
123
|
+
if (t2) return t2;
|
|
124
|
+
const n2 = /* @__PURE__ */ new Map();
|
|
125
|
+
return this.declarationByElement.set(e2, n2), n2;
|
|
126
|
+
}
|
|
127
|
+
syncElementToken(t2, n2) {
|
|
128
|
+
const s2 = this.tokenByElement.get(t2);
|
|
129
|
+
if (0 === n2.size) return void this.clearElementStyles(t2);
|
|
130
|
+
const o2 = R(n2);
|
|
131
|
+
let i2 = this.tokenByDeclaration.get(o2);
|
|
132
|
+
i2 || (i2 = `s${this.tokenCounter.toString(36)}`, this.tokenCounter += 1, this.tokenByDeclaration.set(o2, i2), this.declarationByToken.set(i2, o2), this.insertRule(i2, o2)), s2 !== i2 && (this.retainToken(i2), s2 && this.releaseToken(s2), this.tokenByElement.set(t2, i2)), t2.setAttribute(e, i2);
|
|
133
|
+
}
|
|
134
|
+
insertRule(e2, t2) {
|
|
135
|
+
const n2 = `${T(e2)} { ${t2}; }`, s2 = this.ensureSheet();
|
|
136
|
+
if (s2) try {
|
|
137
|
+
s2.insertRule(n2, s2.cssRules.length);
|
|
138
|
+
} catch {
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
ensureSheet() {
|
|
142
|
+
if (this.sheet) return this.sheet;
|
|
143
|
+
if ("undefined" != typeof CSSStyleSheet) try {
|
|
144
|
+
const e3 = new CSSStyleSheet();
|
|
145
|
+
if ("adoptedStyleSheets" in this.root) {
|
|
146
|
+
const t2 = this.root.adoptedStyleSheets;
|
|
147
|
+
return this.root.adoptedStyleSheets = [...t2, e3], this.sheet = e3, this.ownsAdoptedSheet = true, e3;
|
|
148
|
+
}
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
const e2 = this.ensureFallbackStyleElement();
|
|
152
|
+
return this.sheet = e2.sheet ?? null, this.sheet;
|
|
153
|
+
}
|
|
154
|
+
clearElementStyles(t2) {
|
|
155
|
+
this.declarationByElement.delete(t2);
|
|
156
|
+
const n2 = this.tokenByElement.get(t2);
|
|
157
|
+
n2 && (this.tokenByElement.delete(t2), this.releaseToken(n2)), t2.removeAttribute(e);
|
|
158
|
+
}
|
|
159
|
+
retainToken(e2) {
|
|
160
|
+
const t2 = this.tokenRefCount.get(e2) ?? 0;
|
|
161
|
+
this.tokenRefCount.set(e2, t2 + 1);
|
|
162
|
+
}
|
|
163
|
+
releaseToken(e2) {
|
|
164
|
+
const t2 = this.tokenRefCount.get(e2);
|
|
165
|
+
if (!t2) return;
|
|
166
|
+
if (t2 > 1) return void this.tokenRefCount.set(e2, t2 - 1);
|
|
167
|
+
this.tokenRefCount.delete(e2);
|
|
168
|
+
const n2 = this.declarationByToken.get(e2);
|
|
169
|
+
n2 && (this.declarationByToken.delete(e2), this.tokenByDeclaration.delete(n2)), this.deleteRule(e2);
|
|
170
|
+
}
|
|
171
|
+
deleteRule(e2) {
|
|
172
|
+
const t2 = this.sheet;
|
|
173
|
+
if (!t2) return;
|
|
174
|
+
const n2 = T(e2);
|
|
175
|
+
for (let e3 = t2.cssRules.length - 1; e3 >= 0; e3 -= 1) {
|
|
176
|
+
const s2 = t2.cssRules[e3];
|
|
177
|
+
if (s2 && w(s2, n2)) {
|
|
178
|
+
try {
|
|
179
|
+
t2.deleteRule(e3);
|
|
180
|
+
} catch {
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
clearRuntimeRules() {
|
|
187
|
+
const t2 = this.sheet;
|
|
188
|
+
if (t2) for (let n2 = t2.cssRules.length - 1; n2 >= 0; n2 -= 1) {
|
|
189
|
+
const s2 = t2.cssRules[n2];
|
|
190
|
+
if (s2 && s2.cssText.includes(`[${e}="`)) try {
|
|
191
|
+
t2.deleteRule(n2);
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
ensureFallbackStyleElement() {
|
|
197
|
+
if (this.fallbackStyleElement) return this.fallbackStyleElement;
|
|
198
|
+
const e2 = document.createElement("style");
|
|
199
|
+
return e2.setAttribute("data-notectl-runtime-styles", ""), this.nonce && e2.setAttribute("nonce", this.nonce), m(this.root) ? this.root.appendChild(e2) : (this.root.head ?? this.root.documentElement).appendChild(e2), this.fallbackStyleElement = e2, e2;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function E(e2) {
|
|
203
|
+
const t2 = /* @__PURE__ */ new Map();
|
|
204
|
+
for (const n2 of e2.split(";")) {
|
|
205
|
+
const e3 = n2.trim();
|
|
206
|
+
if (!e3) continue;
|
|
207
|
+
const s2 = e3.indexOf(":");
|
|
208
|
+
if (s2 <= 0) continue;
|
|
209
|
+
const o2 = C(e3.slice(0, s2)), i2 = e3.slice(s2 + 1).trim();
|
|
210
|
+
i2 ? t2.set(o2, i2) : t2.delete(o2);
|
|
211
|
+
}
|
|
212
|
+
return t2;
|
|
213
|
+
}
|
|
214
|
+
function R(e2) {
|
|
215
|
+
return Array.from(e2.entries()).sort(([e3], [t2]) => e3.localeCompare(t2)).map(([e3, t2]) => `${e3}: ${t2}`).join("; ");
|
|
216
|
+
}
|
|
217
|
+
function C(e2) {
|
|
218
|
+
const t2 = e2.trim();
|
|
219
|
+
return t2 ? t2.startsWith("--") ? t2 : t2.includes("-") ? t2.toLowerCase() : t2.replace(/[A-Z]/g, (e3) => `-${e3.toLowerCase()}`).toLowerCase() : "";
|
|
220
|
+
}
|
|
221
|
+
function T(t2) {
|
|
222
|
+
return `[${e}="${t2}"]`;
|
|
223
|
+
}
|
|
224
|
+
function w(e2, t2) {
|
|
225
|
+
return "undefined" != typeof CSSStyleRule && e2 instanceof CSSStyleRule ? e2.selectorText === t2 : e2.cssText.includes(t2);
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
l as a,
|
|
229
|
+
u as b,
|
|
230
|
+
h as c,
|
|
231
|
+
a as d,
|
|
232
|
+
s as e,
|
|
233
|
+
r as f,
|
|
234
|
+
d as g,
|
|
235
|
+
o as r,
|
|
236
|
+
c as s,
|
|
237
|
+
i as u
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=StyleRuntime-ChRjVQwL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyleRuntime-ChRjVQwL.mjs","sources":["../../src/style/StyleRuntime.ts"],"sourcesContent":["/**\n * Runtime style abstraction.\n *\n * - `inline` mode writes directly to `HTMLElement.style` (legacy behavior)\n * - `strict` mode writes no inline styles and instead assigns token attributes\n * backed by dynamic CSS rules in a stylesheet.\n */\n\nexport type RuntimeStyleMode = 'inline' | 'strict';\n\nexport interface StyleRootOptions {\n\treadonly mode: RuntimeStyleMode;\n\treadonly nonce?: string;\n\treadonly sheet?: CSSStyleSheet | null;\n}\n\ntype StyleRoot = ShadowRoot | Document;\n\ninterface RootConfig {\n\treadonly mode: RuntimeStyleMode;\n\treadonly nonce?: string;\n\treadonly sheet: CSSStyleSheet | null;\n}\n\nconst STYLE_TOKEN_ATTR = 'data-notectl-style-token';\nconst STYLE_ELEMENT_ATTR = 'data-notectl-runtime-styles';\n\nconst rootConfigs: WeakMap<StyleRoot, RootConfig> = new WeakMap();\nconst strictEngines: WeakMap<StyleRoot, StrictStyleEngine> = new WeakMap();\n\n/** Creates a constructable stylesheet when the environment supports it. */\nexport function createRuntimeStyleSheet(): CSSStyleSheet | null {\n\tif (typeof CSSStyleSheet === 'undefined') return null;\n\ttry {\n\t\treturn new CSSStyleSheet();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/** Registers styling mode for a root (shadow root or document). */\nexport function registerStyleRoot(root: StyleRoot, options: StyleRootOptions): void {\n\tconst previous = strictEngines.get(root);\n\tif (previous) {\n\t\tprevious.destroy();\n\t\tstrictEngines.delete(root);\n\t}\n\trootConfigs.set(root, {\n\t\tmode: options.mode,\n\t\tnonce: options.nonce,\n\t\tsheet: options.sheet ?? null,\n\t});\n}\n\n/** Unregisters root styling and tears down strict runtime state if present. */\nexport function unregisterStyleRoot(root: StyleRoot): void {\n\tconst engine = strictEngines.get(root);\n\tif (engine) {\n\t\tengine.destroy();\n\t\tstrictEngines.delete(root);\n\t}\n\trootConfigs.delete(root);\n}\n\n/** Sets a single style property. Empty value removes the property. */\nexport function setStyleProperty(el: HTMLElement, property: string, value: string): void {\n\tconst config = resolveConfig(el);\n\tif (!config || config.mode === 'inline') {\n\t\tsetInlineProperty(el, property, value);\n\t\treturn;\n\t}\n\tgetStrictEngine(config.root, config.settings).setProperty(el, property, value);\n}\n\n/** Removes a single style property. */\nexport function removeStyleProperty(el: HTMLElement, property: string): void {\n\tsetStyleProperty(el, property, '');\n}\n\n/** Sets multiple style properties in one call. */\nexport function setStyleProperties(\n\tel: HTMLElement,\n\tproperties: Readonly<Record<string, string | undefined | null>>,\n): void {\n\tconst config = resolveConfig(el);\n\tif (!config || config.mode === 'inline') {\n\t\tfor (const [property, value] of Object.entries(properties)) {\n\t\t\tsetInlineProperty(el, property, value ?? '');\n\t\t}\n\t\treturn;\n\t}\n\tgetStrictEngine(config.root, config.settings).setProperties(el, properties);\n}\n\n/** Replaces the element style text. */\nexport function setStyleText(el: HTMLElement, cssText: string): void {\n\tconst config = resolveConfig(el);\n\tif (!config || config.mode === 'inline') {\n\t\tel.style.cssText = cssText;\n\t\treturn;\n\t}\n\tgetStrictEngine(config.root, config.settings).setStyleText(el, cssText);\n}\n\n/** Merges a cssText fragment into current element styles. */\nexport function appendStyleText(el: HTMLElement, cssText: string): void {\n\tconst config = resolveConfig(el);\n\tif (!config || config.mode === 'inline') {\n\t\tconst current = el.style.cssText;\n\t\tel.style.cssText = current ? `${current}; ${cssText}` : cssText;\n\t\treturn;\n\t}\n\tgetStrictEngine(config.root, config.settings).appendStyleText(el, cssText);\n}\n\n/** Alias for legacy `setAttribute('style', ...)` sites. */\nexport function setStyleAttribute(el: HTMLElement, cssText: string): void {\n\tsetStyleText(el, cssText);\n}\n\n/** Returns serialized styles for an element. */\nexport function getStyleText(el: HTMLElement): string {\n\tconst config = resolveConfig(el);\n\tif (!config || config.mode === 'inline') return el.style.cssText;\n\treturn getStrictEngine(config.root, config.settings).getStyleText(el);\n}\n\n/** Returns the configured CSP nonce for the node's style root (if any). */\nexport function getStyleNonceForNode(node: Node): string | undefined {\n\tconst root = resolveStyleRootFromNode(node);\n\tif (!root) return undefined;\n\treturn rootConfigs.get(root)?.nonce;\n}\n\nfunction setInlineProperty(el: HTMLElement, property: string, value: string): void {\n\tif (property.startsWith('--')) {\n\t\tif (value) {\n\t\t\tel.style.setProperty(property, value);\n\t\t} else {\n\t\t\tel.style.removeProperty(property);\n\t\t}\n\t\treturn;\n\t}\n\tif (property.includes('-')) {\n\t\tif (value) {\n\t\t\tel.style.setProperty(property, value);\n\t\t} else {\n\t\t\tel.style.removeProperty(property);\n\t\t}\n\t\treturn;\n\t}\n\t(el.style as CSSStyleDeclaration & Record<string, string>)[property] = value;\n}\n\nfunction resolveConfig(\n\tel: HTMLElement,\n): { root: StyleRoot; mode: RuntimeStyleMode; settings: RootConfig } | null {\n\tconst root = resolveStyleRoot(el);\n\tif (!root) return null;\n\tconst settings = rootConfigs.get(root);\n\tif (!settings) return null;\n\treturn { root, mode: settings.mode, settings };\n}\n\nfunction resolveStyleRoot(el: HTMLElement): StyleRoot | null {\n\treturn resolveStyleRootFromNode(el);\n}\n\nfunction getStrictEngine(root: StyleRoot, config: RootConfig): StrictStyleEngine {\n\tconst cached = strictEngines.get(root);\n\tif (cached) return cached;\n\tconst engine = new StrictStyleEngine(root, config);\n\tstrictEngines.set(root, engine);\n\treturn engine;\n}\n\nfunction isShadowRoot(value: unknown): value is ShadowRoot {\n\treturn typeof ShadowRoot !== 'undefined' && value instanceof ShadowRoot;\n}\n\nfunction isDocument(value: unknown): value is Document {\n\treturn typeof Document !== 'undefined' && value instanceof Document;\n}\n\nfunction resolveStyleRootFromNode(node: Node): StyleRoot | null {\n\tconst rootNode: Node = isShadowRoot(node) || isDocument(node) ? node : node.getRootNode();\n\tif (isShadowRoot(rootNode)) return rootNode;\n\tif (isDocument(rootNode)) return rootNode;\n\tif (typeof document !== 'undefined') return document;\n\treturn null;\n}\n\nclass StrictStyleEngine {\n\tprivate readonly declarationByElement: WeakMap<HTMLElement, Map<string, string>> = new WeakMap();\n\tprivate readonly tokenByDeclaration: Map<string, string> = new Map();\n\tprivate readonly declarationByToken: Map<string, string> = new Map();\n\tprivate readonly tokenRefCount: Map<string, number> = new Map();\n\tprivate readonly tokenByElement: WeakMap<HTMLElement, string> = new WeakMap();\n\tprivate tokenCounter = 0;\n\tprivate readonly root: StyleRoot;\n\tprivate readonly nonce?: string;\n\tprivate sheet: CSSStyleSheet | null;\n\tprivate fallbackStyleElement: HTMLStyleElement | null = null;\n\tprivate ownsAdoptedSheet = false;\n\n\tconstructor(root: StyleRoot, config: RootConfig) {\n\t\tthis.root = root;\n\t\tthis.nonce = config.nonce;\n\t\tthis.sheet = config.sheet ?? null;\n\t}\n\n\tdestroy(): void {\n\t\tthis.clearRuntimeRules();\n\t\tif (this.ownsAdoptedSheet && this.sheet && 'adoptedStyleSheets' in this.root) {\n\t\t\tthis.root.adoptedStyleSheets = this.root.adoptedStyleSheets.filter(\n\t\t\t\t(adoptedSheet: CSSStyleSheet): boolean => adoptedSheet !== this.sheet,\n\t\t\t);\n\t\t}\n\t\tthis.fallbackStyleElement?.remove();\n\t\tthis.fallbackStyleElement = null;\n\t\tthis.sheet = null;\n\t\tthis.ownsAdoptedSheet = false;\n\t\tthis.tokenByDeclaration.clear();\n\t\tthis.declarationByToken.clear();\n\t\tthis.tokenRefCount.clear();\n\t\tthis.tokenCounter = 0;\n\t}\n\n\tsetProperty(el: HTMLElement, property: string, value: string): void {\n\t\tconst declarations = this.getOrCreateDeclarations(el);\n\t\tconst name = normalizePropertyName(property);\n\t\tif (!value) {\n\t\t\tdeclarations.delete(name);\n\t\t} else {\n\t\t\tdeclarations.set(name, value);\n\t\t}\n\t\tthis.syncElementToken(el, declarations);\n\t}\n\n\tsetProperties(\n\t\tel: HTMLElement,\n\t\tproperties: Readonly<Record<string, string | undefined | null>>,\n\t): void {\n\t\tconst declarations = this.getOrCreateDeclarations(el);\n\t\tfor (const [property, value] of Object.entries(properties)) {\n\t\t\tconst name = normalizePropertyName(property);\n\t\t\tif (!value) {\n\t\t\t\tdeclarations.delete(name);\n\t\t\t} else {\n\t\t\t\tdeclarations.set(name, value);\n\t\t\t}\n\t\t}\n\t\tthis.syncElementToken(el, declarations);\n\t}\n\n\tsetStyleText(el: HTMLElement, cssText: string): void {\n\t\tconst declarations = parseStyleText(cssText);\n\t\tif (declarations.size === 0) {\n\t\t\tthis.clearElementStyles(el);\n\t\t\treturn;\n\t\t}\n\t\tthis.declarationByElement.set(el, declarations);\n\t\tthis.syncElementToken(el, declarations);\n\t}\n\n\tappendStyleText(el: HTMLElement, cssText: string): void {\n\t\tconst parsed = parseStyleText(cssText);\n\t\tif (parsed.size === 0) return;\n\t\tconst declarations = this.getOrCreateDeclarations(el);\n\t\tfor (const [property, value] of parsed) {\n\t\t\tdeclarations.set(property, value);\n\t\t}\n\t\tthis.syncElementToken(el, declarations);\n\t}\n\n\tgetStyleText(el: HTMLElement): string {\n\t\tconst declarations = this.declarationByElement.get(el);\n\t\tif (!declarations || declarations.size === 0) return '';\n\t\treturn serializeDeclarations(declarations);\n\t}\n\n\tprivate getOrCreateDeclarations(el: HTMLElement): Map<string, string> {\n\t\tconst existing = this.declarationByElement.get(el);\n\t\tif (existing) return existing;\n\t\tconst created = new Map<string, string>();\n\t\tthis.declarationByElement.set(el, created);\n\t\treturn created;\n\t}\n\n\tprivate syncElementToken(el: HTMLElement, declarations: Map<string, string>): void {\n\t\tconst previousToken = this.tokenByElement.get(el);\n\t\tif (declarations.size === 0) {\n\t\t\tthis.clearElementStyles(el);\n\t\t\treturn;\n\t\t}\n\n\t\tconst declarationText = serializeDeclarations(declarations);\n\t\tlet token = this.tokenByDeclaration.get(declarationText);\n\t\tif (!token) {\n\t\t\ttoken = `s${this.tokenCounter.toString(36)}`;\n\t\t\tthis.tokenCounter += 1;\n\t\t\tthis.tokenByDeclaration.set(declarationText, token);\n\t\t\tthis.declarationByToken.set(token, declarationText);\n\t\t\tthis.insertRule(token, declarationText);\n\t\t}\n\t\tif (previousToken !== token) {\n\t\t\tthis.retainToken(token);\n\t\t\tif (previousToken) {\n\t\t\t\tthis.releaseToken(previousToken);\n\t\t\t}\n\t\t\tthis.tokenByElement.set(el, token);\n\t\t}\n\t\tel.setAttribute(STYLE_TOKEN_ATTR, token);\n\t}\n\n\tprivate insertRule(token: string, declarationText: string): void {\n\t\tconst rule = `${buildTokenSelector(token)} { ${declarationText}; }`;\n\t\tconst sheet = this.ensureSheet();\n\t\tif (!sheet) return;\n\t\ttry {\n\t\t\tsheet.insertRule(rule, sheet.cssRules.length);\n\t\t} catch {\n\t\t\t// Ignore malformed declarations from third-party plugin attrs.\n\t\t}\n\t}\n\n\tprivate ensureSheet(): CSSStyleSheet | null {\n\t\tif (this.sheet) return this.sheet;\n\n\t\tif (typeof CSSStyleSheet !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tconst sheet = new CSSStyleSheet();\n\t\t\t\tif ('adoptedStyleSheets' in this.root) {\n\t\t\t\t\tconst adopted = this.root.adoptedStyleSheets;\n\t\t\t\t\tthis.root.adoptedStyleSheets = [...adopted, sheet];\n\t\t\t\t\tthis.sheet = sheet;\n\t\t\t\t\tthis.ownsAdoptedSheet = true;\n\t\t\t\t\treturn sheet;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Fall through to style element fallback.\n\t\t\t}\n\t\t}\n\n\t\tconst style = this.ensureFallbackStyleElement();\n\t\tthis.sheet = (style.sheet as CSSStyleSheet | null) ?? null;\n\t\treturn this.sheet;\n\t}\n\n\tprivate clearElementStyles(el: HTMLElement): void {\n\t\tthis.declarationByElement.delete(el);\n\t\tconst token = this.tokenByElement.get(el);\n\t\tif (token) {\n\t\t\tthis.tokenByElement.delete(el);\n\t\t\tthis.releaseToken(token);\n\t\t}\n\t\tel.removeAttribute(STYLE_TOKEN_ATTR);\n\t}\n\n\tprivate retainToken(token: string): void {\n\t\tconst current = this.tokenRefCount.get(token) ?? 0;\n\t\tthis.tokenRefCount.set(token, current + 1);\n\t}\n\n\tprivate releaseToken(token: string): void {\n\t\tconst current = this.tokenRefCount.get(token);\n\t\tif (!current) return;\n\t\tif (current > 1) {\n\t\t\tthis.tokenRefCount.set(token, current - 1);\n\t\t\treturn;\n\t\t}\n\t\tthis.tokenRefCount.delete(token);\n\t\tconst declaration = this.declarationByToken.get(token);\n\t\tif (declaration) {\n\t\t\tthis.declarationByToken.delete(token);\n\t\t\tthis.tokenByDeclaration.delete(declaration);\n\t\t}\n\t\tthis.deleteRule(token);\n\t}\n\n\tprivate deleteRule(token: string): void {\n\t\tconst sheet = this.sheet;\n\t\tif (!sheet) return;\n\t\tconst selector = buildTokenSelector(token);\n\t\tfor (let index = sheet.cssRules.length - 1; index >= 0; index -= 1) {\n\t\t\tconst rule = sheet.cssRules[index];\n\t\t\tif (!rule || !isTokenSelectorMatch(rule, selector)) continue;\n\t\t\ttry {\n\t\t\t\tsheet.deleteRule(index);\n\t\t\t} catch {\n\t\t\t\t// Ignore parser/runtime discrepancies in unsupported environments.\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\tprivate clearRuntimeRules(): void {\n\t\tconst sheet = this.sheet;\n\t\tif (!sheet) return;\n\t\tfor (let index = sheet.cssRules.length - 1; index >= 0; index -= 1) {\n\t\t\tconst rule = sheet.cssRules[index];\n\t\t\tif (!rule || !rule.cssText.includes(`[${STYLE_TOKEN_ATTR}=\"`)) continue;\n\t\t\ttry {\n\t\t\t\tsheet.deleteRule(index);\n\t\t\t} catch {\n\t\t\t\t// Ignore parser/runtime discrepancies in unsupported environments.\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate ensureFallbackStyleElement(): HTMLStyleElement {\n\t\tif (this.fallbackStyleElement) return this.fallbackStyleElement;\n\t\tconst style: HTMLStyleElement = document.createElement('style');\n\t\tstyle.setAttribute(STYLE_ELEMENT_ATTR, '');\n\t\tif (this.nonce) {\n\t\t\tstyle.setAttribute('nonce', this.nonce);\n\t\t}\n\t\tif (isShadowRoot(this.root)) {\n\t\t\tthis.root.appendChild(style);\n\t\t} else {\n\t\t\tconst host = this.root.head ?? this.root.documentElement;\n\t\t\thost.appendChild(style);\n\t\t}\n\t\tthis.fallbackStyleElement = style;\n\t\treturn style;\n\t}\n}\n\nfunction parseStyleText(styleText: string): Map<string, string> {\n\tconst declarations = new Map<string, string>();\n\tfor (const rawPart of styleText.split(';')) {\n\t\tconst part = rawPart.trim();\n\t\tif (!part) continue;\n\t\tconst separator = part.indexOf(':');\n\t\tif (separator <= 0) continue;\n\t\tconst property = normalizePropertyName(part.slice(0, separator));\n\t\tconst value = part.slice(separator + 1).trim();\n\t\tif (!value) {\n\t\t\tdeclarations.delete(property);\n\t\t} else {\n\t\t\tdeclarations.set(property, value);\n\t\t}\n\t}\n\treturn declarations;\n}\n\nfunction serializeDeclarations(declarations: Map<string, string>): string {\n\tconst ordered: [string, string][] = Array.from(declarations.entries()).sort(([a], [b]) =>\n\t\ta.localeCompare(b),\n\t);\n\treturn ordered.map(([property, value]) => `${property}: ${value}`).join('; ');\n}\n\nfunction normalizePropertyName(property: string): string {\n\tconst trimmed = property.trim();\n\tif (!trimmed) return '';\n\tif (trimmed.startsWith('--')) return trimmed;\n\tif (trimmed.includes('-')) return trimmed.toLowerCase();\n\treturn trimmed.replace(/[A-Z]/g, (char: string) => `-${char.toLowerCase()}`).toLowerCase();\n}\n\nfunction buildTokenSelector(token: string): string {\n\treturn `[${STYLE_TOKEN_ATTR}=\"${token}\"]`;\n}\n\nfunction isTokenSelectorMatch(rule: CSSRule, selector: string): boolean {\n\tif (typeof CSSStyleRule !== 'undefined' && rule instanceof CSSStyleRule) {\n\t\treturn rule.selectorText === selector;\n\t}\n\treturn rule.cssText.includes(selector);\n}\n"],"names":["STYLE_TOKEN_ATTR","rootConfigs","WeakMap","strictEngines","createRuntimeStyleSheet","CSSStyleSheet","registerStyleRoot","root","options","previous","get","destroy","delete","set","mode","nonce","sheet","unregisterStyleRoot","engine","setStyleProperty","el","property","value","config","resolveConfig","getStrictEngine","settings","setProperty","setInlineProperty","removeStyleProperty","setStyleProperties","properties","setProperties","Object","entries","setStyleText","cssText","style","appendStyleText","current","setStyleAttribute","getStyleNonceForNode","node","resolveStyleRootFromNode","startsWith","includes","removeProperty","cached","StrictStyleEngine","isShadowRoot","ShadowRoot","isDocument","Document","rootNode","getRootNode","document","declarationByElement","tokenByDeclaration","Map","declarationByToken","tokenRefCount","tokenByElement","tokenCounter","fallbackStyleElement","ownsAdoptedSheet","this","clearRuntimeRules","adoptedStyleSheets","filter","adoptedSheet","remove","clear","declarations","getOrCreateDeclarations","name","normalizePropertyName","syncElementToken","parseStyleText","size","clearElementStyles","parsed","serializeDeclarations","existing","created","previousToken","declarationText","token","toString","insertRule","retainToken","releaseToken","setAttribute","rule","buildTokenSelector","ensureSheet","cssRules","length","adopted","ensureFallbackStyleElement","removeAttribute","declaration","deleteRule","selector","index","isTokenSelectorMatch","createElement","appendChild","head","documentElement","styleText","rawPart","split","part","trim","separator","indexOf","slice","Array","from","sort","a","b","localeCompare","map","join","trimmed","toLowerCase","replace","char","CSSStyleRule","selectorText"],"mappings":"AAwBA,MAAMA,IAAmB,4BAGnBC,wBAAkDC,WAClDC,wBAA2DD;AAG1D,SAASE,IAAAA;AACf,MAA6B,eAAA,OAAlBC,cAA+B,QAAO;AACjD,MAAA;AACC,WAAO,IAAIA;AAAAA,EACZ,QAAA;AACC,WAAO;AAAA,EACR;AACD;AAG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AAC9B;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
-
import { a as o, p as n } from "./PopupPositioning-
|
|
2
|
+
import { a as o, p as n } from "./PopupPositioning-BTT-_pQ3.mjs";
|
|
3
3
|
import { f as r, n as i, b as s, a as l, c as a, d as c } from "./ToolbarKeyboardNav-DhpL8zNV.mjs";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { s as d, a as p } from "./StyleRuntime-ChRjVQwL.mjs";
|
|
5
|
+
const u = new t("popup");
|
|
6
|
+
class h {
|
|
6
7
|
stack = [];
|
|
7
8
|
referenceNode;
|
|
8
9
|
constructor(t2) {
|
|
@@ -69,8 +70,8 @@ class p {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
const
|
|
73
|
-
class
|
|
73
|
+
const m = { formattingOptionsAria: "Formatting options", moreToolsAria: "More tools" }, b = { en: m, 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
|
+
class w {
|
|
74
75
|
toolbar;
|
|
75
76
|
context;
|
|
76
77
|
onOverflowChange;
|
|
@@ -101,21 +102,21 @@ class v {
|
|
|
101
102
|
if (t3 === this.overflowButton) continue;
|
|
102
103
|
if (t3.classList.contains("notectl-toolbar-separator")) {
|
|
103
104
|
if (i2) {
|
|
104
|
-
t3.classList.add(
|
|
105
|
+
t3.classList.add(g);
|
|
105
106
|
continue;
|
|
106
107
|
}
|
|
107
108
|
const e4 = (o2.get(t3) ?? 0) + 2;
|
|
108
|
-
r2 + e4 > n2 ? (i2 = true, t3.classList.add(
|
|
109
|
+
r2 + e4 > n2 ? (i2 = true, t3.classList.add(g)) : r2 += e4;
|
|
109
110
|
continue;
|
|
110
111
|
}
|
|
111
112
|
const e3 = this.entries.find((e4) => e4.element === t3);
|
|
112
113
|
if (!e3) continue;
|
|
113
114
|
if (i2) {
|
|
114
|
-
e3.element.classList.add(
|
|
115
|
+
e3.element.classList.add(v), s2.push(e3);
|
|
115
116
|
continue;
|
|
116
117
|
}
|
|
117
118
|
const l2 = (o2.get(t3) ?? 0) + 2;
|
|
118
|
-
r2 + l2 > n2 ? (i2 = true, e3.element.classList.add(
|
|
119
|
+
r2 + l2 > n2 ? (i2 = true, e3.element.classList.add(v), s2.push(e3)) : r2 += l2;
|
|
119
120
|
}
|
|
120
121
|
this.overflowEntries = s2, this.hideTrailingSeparators(), this.setOverflowButtonVisible(s2.length > 0), this.notifyChange();
|
|
121
122
|
}
|
|
@@ -145,9 +146,9 @@ class v {
|
|
|
145
146
|
return this.toolbar.clientWidth - e2 - o2;
|
|
146
147
|
}
|
|
147
148
|
resetVisibility() {
|
|
148
|
-
for (const t3 of this.entries) t3.element.classList.remove(
|
|
149
|
+
for (const t3 of this.entries) t3.element.classList.remove(v);
|
|
149
150
|
const t2 = Array.from(this.toolbar.querySelectorAll(".notectl-toolbar-separator"));
|
|
150
|
-
for (const e2 of t2) e2.classList.remove(
|
|
151
|
+
for (const e2 of t2) e2.classList.remove(g);
|
|
151
152
|
}
|
|
152
153
|
setOverflowButtonVisible(t2) {
|
|
153
154
|
this.overflowButton && (this.overflowButton.classList.toggle("notectl-toolbar-overflow-btn--hidden", !t2), t2 || this.overflowButton.removeAttribute("tabindex"));
|
|
@@ -195,7 +196,7 @@ class v {
|
|
|
195
196
|
positionDropdown(t2) {
|
|
196
197
|
if (!this.overflowButton) return;
|
|
197
198
|
const e2 = this.overflowButton.getBoundingClientRect(), o2 = window.innerWidth - e2.right;
|
|
198
|
-
t2
|
|
199
|
+
d(t2, { position: "fixed", top: `${e2.bottom + 2}px`, right: `${o2}px`, left: "auto", zIndex: "10000" });
|
|
199
200
|
}
|
|
200
201
|
registerCloseHandler() {
|
|
201
202
|
this.closeHandler = (t2) => {
|
|
@@ -248,28 +249,28 @@ class v {
|
|
|
248
249
|
for (let e2 = t2.length - 1; e2 >= 0; e2--) {
|
|
249
250
|
const o2 = t2[e2];
|
|
250
251
|
if (o2 && o2 !== this.overflowButton) {
|
|
251
|
-
if (o2.classList.contains("notectl-toolbar-separator")) o2.classList.contains(
|
|
252
|
-
else if (!o2.classList.contains(
|
|
252
|
+
if (o2.classList.contains("notectl-toolbar-separator")) o2.classList.contains(g) || o2.classList.add(g);
|
|
253
|
+
else if (!o2.classList.contains(v)) break;
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
notifyChange() {
|
|
257
|
-
const t2 = this.entries.filter((t3) => !t3.element.classList.contains(
|
|
258
|
+
const t2 = this.entries.filter((t3) => !t3.element.classList.contains(v)).map((t3) => t3.element);
|
|
258
259
|
this.onOverflowChange(t2, this.overflowEntries.length > 0 ? this.overflowButton : null);
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
|
-
function
|
|
262
|
+
function x(t2, e2, o2) {
|
|
262
263
|
const n2 = t2.querySelectorAll(".notectl-grid-picker__cell");
|
|
263
264
|
for (const t3 of n2) {
|
|
264
265
|
const n3 = Number(t3.getAttribute("data-row")), r2 = Number(t3.getAttribute("data-col"));
|
|
265
266
|
t3.classList.toggle("notectl-grid-picker__cell--highlighted", n3 <= e2 && r2 <= o2);
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
+
function y() {
|
|
269
270
|
const t2 = document.createElement("span");
|
|
270
271
|
return t2.className = "notectl-toolbar-separator", t2.setAttribute("role", "separator"), t2;
|
|
271
272
|
}
|
|
272
|
-
class
|
|
273
|
+
class A {
|
|
273
274
|
activePopup = null;
|
|
274
275
|
activePopupButton = null;
|
|
275
276
|
activeHandle = null;
|
|
@@ -329,13 +330,13 @@ class x {
|
|
|
329
330
|
!(function(t3, e3, o3) {
|
|
330
331
|
t3.className += " notectl-grid-picker";
|
|
331
332
|
const n3 = document.createElement("div");
|
|
332
|
-
n3.className = "notectl-grid-picker__grid", n3.setAttribute("role", "grid"), n3
|
|
333
|
+
n3.className = "notectl-grid-picker__grid", n3.setAttribute("role", "grid"), d(n3, { display: "grid", gridTemplateColumns: `repeat(${e3.maxCols}, 1fr)`, gap: "2px", padding: "8px" });
|
|
333
334
|
const r2 = document.createElement("div");
|
|
334
|
-
r2.className = "notectl-grid-picker__label", r2.textContent = "1 x 1", r2
|
|
335
|
+
r2.className = "notectl-grid-picker__label", r2.textContent = "1 x 1", d(r2, { textAlign: "center", padding: "4px", fontSize: "12px" }), r2.setAttribute("aria-live", "polite");
|
|
335
336
|
for (let t4 = 1; t4 <= e3.maxRows; t4++) for (let i2 = 1; i2 <= e3.maxCols; i2++) {
|
|
336
337
|
const s2 = document.createElement("div");
|
|
337
|
-
s2.className = "notectl-grid-picker__cell", s2.setAttribute("role", "gridcell"), s2.setAttribute("tabindex", "-1"), s2.setAttribute("aria-label", `${t4} x ${i2}`), s2
|
|
338
|
-
|
|
338
|
+
s2.className = "notectl-grid-picker__cell", s2.setAttribute("role", "gridcell"), s2.setAttribute("tabindex", "-1"), s2.setAttribute("aria-label", `${t4} x ${i2}`), d(s2, { width: "20px", height: "20px", border: "1px solid #ccc", cursor: "pointer" }), s2.setAttribute("data-row", String(t4)), s2.setAttribute("data-col", String(i2)), s2.addEventListener("mouseenter", () => {
|
|
339
|
+
x(n3, t4, i2), r2.textContent = `${t4} x ${i2}`;
|
|
339
340
|
}), s2.addEventListener("mousedown", (n4) => {
|
|
340
341
|
n4.preventDefault(), n4.stopPropagation(), e3.onSelect(t4, i2), o3();
|
|
341
342
|
}), s2.addEventListener("click", () => {
|
|
@@ -373,7 +374,7 @@ class x {
|
|
|
373
374
|
}
|
|
374
375
|
positionAndAppend(t2, e2) {
|
|
375
376
|
const o2 = e2.getBoundingClientRect();
|
|
376
|
-
t2
|
|
377
|
+
d(t2, { position: "fixed", top: `${o2.bottom + 2}px`, left: `${o2.left}px`, zIndex: "10000" });
|
|
377
378
|
const n2 = e2.getRootNode();
|
|
378
379
|
n2 instanceof ShadowRoot ? n2.appendChild(t2) : document.body.appendChild(t2);
|
|
379
380
|
}
|
|
@@ -421,7 +422,7 @@ class x {
|
|
|
421
422
|
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t2.key)) {
|
|
422
423
|
t2.preventDefault();
|
|
423
424
|
const [e3, s3] = i(o2, n2, a2, l2, t2.key), c2 = r2.querySelector(`.notectl-grid-picker__cell[data-row="${e3}"][data-col="${s3}"]`);
|
|
424
|
-
c2?.focus(),
|
|
425
|
+
c2?.focus(), x(r2, e3, s3);
|
|
425
426
|
const d2 = this.activePopup?.querySelector(".notectl-grid-picker__label") ?? null;
|
|
426
427
|
d2 && (d2.textContent = `${e3} x ${s3}`);
|
|
427
428
|
}
|
|
@@ -451,36 +452,36 @@ class x {
|
|
|
451
452
|
}
|
|
452
453
|
}
|
|
453
454
|
}
|
|
454
|
-
class
|
|
455
|
+
class E {
|
|
455
456
|
element;
|
|
456
457
|
timer = null;
|
|
457
458
|
target = null;
|
|
458
459
|
isPopupActive;
|
|
459
460
|
static TOOLTIP_ID = "notectl-toolbar-tooltip";
|
|
460
461
|
constructor(t2) {
|
|
461
|
-
this.isPopupActive = t2, this.element = document.createElement("div"), this.element.className = "notectl-toolbar-tooltip", this.element.id =
|
|
462
|
+
this.isPopupActive = t2, this.element = document.createElement("div"), this.element.className = "notectl-toolbar-tooltip", this.element.id = E.TOOLTIP_ID, this.element.setAttribute("role", "tooltip"), p(this.element, "display", "none");
|
|
462
463
|
}
|
|
463
464
|
show(t2) {
|
|
464
465
|
if (this.hide(), this.isPopupActive() || t2.disabled) return;
|
|
465
466
|
const e2 = t2.getAttribute("data-tooltip");
|
|
466
467
|
e2 && (this.target = t2, this.timer = setTimeout(() => {
|
|
467
468
|
if (this.isPopupActive()) return;
|
|
468
|
-
this.element.textContent = e2, this.element
|
|
469
|
+
this.element.textContent = e2, p(this.element, "display", "");
|
|
469
470
|
const o2 = t2.getRootNode();
|
|
470
|
-
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",
|
|
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", E.TOOLTIP_ID);
|
|
471
472
|
const n2 = t2.getBoundingClientRect();
|
|
472
|
-
this.element
|
|
473
|
+
d(this.element, { position: "fixed", top: `${n2.bottom + 6}px`, left: `${n2.left + n2.width / 2}px`, transform: "translateX(-50%)" });
|
|
473
474
|
}, 500));
|
|
474
475
|
}
|
|
475
476
|
hide() {
|
|
476
|
-
this.timer && (clearTimeout(this.timer), this.timer = null), this.target && (this.target.removeAttribute("aria-describedby"), this.target = null), this.element
|
|
477
|
+
this.timer && (clearTimeout(this.timer), this.timer = null), this.target && (this.target.removeAttribute("aria-describedby"), this.target = null), p(this.element, "display", "none");
|
|
477
478
|
}
|
|
478
479
|
destroy() {
|
|
479
480
|
this.hide(), this.element.remove();
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
|
-
const
|
|
483
|
-
class
|
|
483
|
+
const k = new t("toolbar");
|
|
484
|
+
class C {
|
|
484
485
|
id = "toolbar";
|
|
485
486
|
name = "Toolbar";
|
|
486
487
|
priority = 10;
|
|
@@ -498,10 +499,10 @@ class E {
|
|
|
498
499
|
visibleElements = [];
|
|
499
500
|
locale;
|
|
500
501
|
constructor(t2) {
|
|
501
|
-
this.layoutConfig = t2 ?? null, this.overflowBehavior = t2?.overflow ??
|
|
502
|
+
this.layoutConfig = t2 ?? null, this.overflowBehavior = t2?.overflow ?? f.BurgerMenu;
|
|
502
503
|
}
|
|
503
504
|
init(t2) {
|
|
504
|
-
this.locale = e(
|
|
505
|
+
this.locale = e(b, t2), t2.registerStyleSheet(`
|
|
505
506
|
/* Toolbar */
|
|
506
507
|
.notectl-plugin-container--top {
|
|
507
508
|
display: flex;
|
|
@@ -839,7 +840,7 @@ class E {
|
|
|
839
840
|
outline: 2px solid var(--notectl-focus-ring);
|
|
840
841
|
outline-offset: -1px;
|
|
841
842
|
}
|
|
842
|
-
`), this.context = t2, this.popupManager = new
|
|
843
|
+
`), this.context = t2, this.popupManager = new h(t2.getContainer()), t2.registerService(u, this.popupManager), this.popupController = new A(() => this.getActiveElement()), this.popupController.setPopupManager(this.popupManager), this.tooltip = new E(() => this.popupController?.isOpen() ?? false), t2.registerService(k, { refresh: () => this.updateButtonStates(t2.getState()), closePopup: () => this.popupController?.close() }), this.createToolbarElement();
|
|
843
844
|
}
|
|
844
845
|
getOverflowBehavior() {
|
|
845
846
|
return this.overflowBehavior;
|
|
@@ -870,7 +871,7 @@ class E {
|
|
|
870
871
|
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);
|
|
871
872
|
}
|
|
872
873
|
applyOverflowBehavior() {
|
|
873
|
-
this.toolbarElement && this.context && (this.overflowController?.destroy(), this.overflowController = null, this.toolbarElement.setAttribute("data-overflow", this.overflowBehavior), this.overflowBehavior ===
|
|
874
|
+
this.toolbarElement && this.context && (this.overflowController?.destroy(), this.overflowController = null, this.toolbarElement.setAttribute("data-overflow", this.overflowBehavior), this.overflowBehavior === f.BurgerMenu ? this.overflowController = new w({ toolbar: this.toolbarElement, ariaLabel: this.locale.moreToolsAria, context: this.context, popupManager: this.popupManager ?? void 0, onOverflowChange: (t2, e2) => {
|
|
874
875
|
this.visibleElements = e2 ? [...t2, e2] : [...t2], this.initRovingTabindex();
|
|
875
876
|
}, onItemActivated: (t2, e2) => {
|
|
876
877
|
this.activateButton(t2, e2);
|
|
@@ -953,7 +954,7 @@ class E {
|
|
|
953
954
|
o3.sort((t3, e4) => (t3.priority ?? 100) - (e4.priority ?? 100)), n2.push(...o3);
|
|
954
955
|
}
|
|
955
956
|
if (0 !== n2.length) {
|
|
956
|
-
e2 || this.toolbarElement.appendChild(
|
|
957
|
+
e2 || this.toolbarElement.appendChild(y()), e2 = false;
|
|
957
958
|
for (const t3 of n2) {
|
|
958
959
|
const e3 = this.createButton(t3);
|
|
959
960
|
this.toolbarElement.appendChild(e3.element), this.buttons.push(e3);
|
|
@@ -971,7 +972,7 @@ class E {
|
|
|
971
972
|
const o2 = e2[t3];
|
|
972
973
|
if (!o2) continue;
|
|
973
974
|
const n2 = this.createButton(o2);
|
|
974
|
-
this.toolbarElement.appendChild(n2.element), this.buttons.push(n2), o2.separatorAfter && t3 < e2.length - 1 && this.toolbarElement.appendChild(
|
|
975
|
+
this.toolbarElement.appendChild(n2.element), this.buttons.push(n2), o2.separatorAfter && t3 < e2.length - 1 && this.toolbarElement.appendChild(y());
|
|
975
976
|
}
|
|
976
977
|
else {
|
|
977
978
|
const t3 = /* @__PURE__ */ new Map();
|
|
@@ -981,7 +982,7 @@ class E {
|
|
|
981
982
|
}
|
|
982
983
|
let o2 = true;
|
|
983
984
|
for (const [, e3] of t3) {
|
|
984
|
-
o2 || this.toolbarElement.appendChild(
|
|
985
|
+
o2 || this.toolbarElement.appendChild(y()), o2 = false;
|
|
985
986
|
for (const t4 of e3) {
|
|
986
987
|
const e4 = this.createButton(t4);
|
|
987
988
|
this.toolbarElement.appendChild(e4.element), this.buttons.push(e4);
|
|
@@ -1019,12 +1020,12 @@ class E {
|
|
|
1019
1020
|
}
|
|
1020
1021
|
}
|
|
1021
1022
|
export {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1023
|
+
h as P,
|
|
1024
|
+
C as T,
|
|
1025
|
+
k as a,
|
|
1026
|
+
u as b,
|
|
1027
|
+
b as c,
|
|
1028
|
+
m as d,
|
|
1029
|
+
f as e
|
|
1029
1030
|
};
|
|
1030
|
-
//# sourceMappingURL=ToolbarPlugin-
|
|
1031
|
+
//# sourceMappingURL=ToolbarPlugin-DpLVJ71w.mjs.map
|