@lit-pigeon/editor 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ let t = null;
2
+ function r() {
3
+ return t || (t = import("./rich-text.js").then((s) => s.default)), t;
4
+ }
5
+ class l {
6
+ constructor() {
7
+ this._active = null, this._listeners = /* @__PURE__ */ new Set(), this._held = !1;
8
+ }
9
+ setActive(e) {
10
+ if (this._active !== e) {
11
+ this._active = e;
12
+ for (const i of this._listeners) i(e);
13
+ }
14
+ }
15
+ /** Clear only if `editor` is the currently-active one (avoids races on rapid focus changes). */
16
+ clearIfActive(e) {
17
+ this._active === e && this.setActive(null);
18
+ }
19
+ /**
20
+ * "Focus hold" — set while the user operates a formatting control that lives
21
+ * outside the editable (the bubble's link field, the sidebar format panel's
22
+ * `<select>`/color inputs). Native form controls steal DOM focus, which would
23
+ * otherwise blur the editor and tear it down before the command runs. While
24
+ * held, the editor's blur handler keeps the editor alive and the active
25
+ * binding intact so the command can apply to the preserved selection.
26
+ */
27
+ holdFocus() {
28
+ this._held = !0;
29
+ }
30
+ releaseFocus() {
31
+ this._held = !1;
32
+ }
33
+ isHeld() {
34
+ return this._held;
35
+ }
36
+ getActive() {
37
+ return this._active;
38
+ }
39
+ subscribe(e) {
40
+ return this._listeners.add(e), () => this._listeners.delete(e);
41
+ }
42
+ }
43
+ const h = new l();
44
+ export {
45
+ r as l,
46
+ h as r
47
+ };