@rcarls/rc-textarea 0.4.2 → 0.5.0
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/CHANGELOG.md +13 -0
- package/README.md +2 -3
- package/dist/custom-elements.json +1 -58
- package/dist/{line-actions-controller-TP6g5HYk.js → line-actions-controller-CB8U0WvH.js} +112 -148
- package/dist/line-actions-controller-CB8U0WvH.js.map +1 -0
- package/dist/rc-textarea-define.js +2 -2
- package/dist/rc-textarea.js +1 -1
- package/dist/types/packages/rc-textarea/src/rc-textarea.d.ts +1 -22
- package/dist/types/packages/rc-textarea/src/types.d.ts +0 -4
- package/package.json +2 -2
- package/dist/line-actions-controller-TP6g5HYk.js.map +0 -1
- /package/dist/types/packages/rc-textarea/src/{decoration.test.d.ts → decoration.unit.test.d.ts} +0 -0
- /package/dist/types/packages/rc-textarea/src/{pattern-matcher.test.d.ts → pattern-matcher.unit.test.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { css as Lt, LitElement as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as Lt, LitElement as st, html as Tt } from "lit";
|
|
2
|
+
import { property as b, query as tt } from "lit/decorators.js";
|
|
3
3
|
import { NativeChildController as kt } from "@rcarls/rc-common";
|
|
4
4
|
var d = /* @__PURE__ */ ((n) => (n[n.TYPE = 3] = "TYPE", n[n.LEVEL = 12] = "LEVEL", n[n.ATTRIBUTE = 13] = "ATTRIBUTE", n[n.BLOT = 14] = "BLOT", n[n.INLINE = 7] = "INLINE", n[n.BLOCK = 11] = "BLOCK", n[n.BLOCK_BLOT = 10] = "BLOCK_BLOT", n[n.INLINE_BLOT = 6] = "INLINE_BLOT", n[n.BLOCK_ATTRIBUTE = 9] = "BLOCK_ATTRIBUTE", n[n.INLINE_ATTRIBUTE = 5] = "INLINE_ATTRIBUTE", n[n.ANY = 15] = "ANY", n))(d || {});
|
|
5
5
|
class T {
|
|
@@ -33,7 +33,7 @@ class O extends Error {
|
|
|
33
33
|
t = "[Parchment] " + t, super(t), this.message = t, this.name = this.constructor.name;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const ut = class
|
|
36
|
+
const ut = class X {
|
|
37
37
|
constructor() {
|
|
38
38
|
this.attributes = {}, this.classes = {}, this.tags = {}, this.types = {};
|
|
39
39
|
}
|
|
@@ -61,10 +61,10 @@ const ut = class Y {
|
|
|
61
61
|
// @ts-expect-error Fix me later
|
|
62
62
|
e instanceof Node || e.nodeType === Node.TEXT_NODE ? e : r.create(s)
|
|
63
63
|
), a = new r(t, o, s);
|
|
64
|
-
return
|
|
64
|
+
return X.blots.set(a.domNode, a), a;
|
|
65
65
|
}
|
|
66
66
|
find(t, e = !1) {
|
|
67
|
-
return
|
|
67
|
+
return X.find(t, e);
|
|
68
68
|
}
|
|
69
69
|
query(t, e = d.ANY) {
|
|
70
70
|
let s;
|
|
@@ -86,7 +86,7 @@ const ut = class Y {
|
|
|
86
86
|
};
|
|
87
87
|
ut.blots = /* @__PURE__ */ new WeakMap();
|
|
88
88
|
let z = ut;
|
|
89
|
-
function
|
|
89
|
+
function it(n, t) {
|
|
90
90
|
return (n.getAttribute("class") || "").split(/\s+/).filter((e) => e.indexOf(`${t}-`) === 0);
|
|
91
91
|
}
|
|
92
92
|
class Bt extends T {
|
|
@@ -97,17 +97,17 @@ class Bt extends T {
|
|
|
97
97
|
return this.canAdd(t, e) ? (this.remove(t), t.classList.add(`${this.keyName}-${e}`), !0) : !1;
|
|
98
98
|
}
|
|
99
99
|
remove(t) {
|
|
100
|
-
|
|
100
|
+
it(t, this.keyName).forEach((e) => {
|
|
101
101
|
t.classList.remove(e);
|
|
102
102
|
}), t.classList.length === 0 && t.removeAttribute("class");
|
|
103
103
|
}
|
|
104
104
|
value(t) {
|
|
105
|
-
const e = (
|
|
105
|
+
const e = (it(t, this.keyName)[0] || "").slice(this.keyName.length + 1);
|
|
106
106
|
return this.canAdd(t, e) ? e : "";
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
const Dt = Bt;
|
|
110
|
-
function
|
|
110
|
+
function F(n) {
|
|
111
111
|
const t = n.split("-"), e = t.slice(1).map((s) => s[0].toUpperCase() + s.slice(1)).join("");
|
|
112
112
|
return t[0] + e;
|
|
113
113
|
}
|
|
@@ -116,13 +116,13 @@ class It extends T {
|
|
|
116
116
|
return (t.getAttribute("style") || "").split(";").map((e) => e.split(":")[0].trim());
|
|
117
117
|
}
|
|
118
118
|
add(t, e) {
|
|
119
|
-
return this.canAdd(t, e) ? (t.style[
|
|
119
|
+
return this.canAdd(t, e) ? (t.style[F(this.keyName)] = e, !0) : !1;
|
|
120
120
|
}
|
|
121
121
|
remove(t) {
|
|
122
|
-
t.style[
|
|
122
|
+
t.style[F(this.keyName)] = "", t.getAttribute("style") || t.removeAttribute("style");
|
|
123
123
|
}
|
|
124
124
|
value(t) {
|
|
125
|
-
const e = t.style[
|
|
125
|
+
const e = t.style[F(this.keyName)];
|
|
126
126
|
return this.canAdd(t, e) ? e : "";
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -378,7 +378,7 @@ class Mt {
|
|
|
378
378
|
return e;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function rt(n, t) {
|
|
382
382
|
const e = t.find(n);
|
|
383
383
|
if (e)
|
|
384
384
|
return e;
|
|
@@ -412,7 +412,7 @@ const gt = class N extends pt {
|
|
|
412
412
|
build() {
|
|
413
413
|
this.children = new Mt(), Array.from(this.domNode.childNodes).filter((t) => t !== this.uiNode).reverse().forEach((t) => {
|
|
414
414
|
try {
|
|
415
|
-
const e =
|
|
415
|
+
const e = rt(t, this.scroll);
|
|
416
416
|
this.insertBefore(e, this.children.head || void 0);
|
|
417
417
|
} catch (e) {
|
|
418
418
|
if (e instanceof O)
|
|
@@ -538,7 +538,7 @@ const gt = class N extends pt {
|
|
|
538
538
|
}), s.filter((r) => r.parentNode === this.domNode && r !== this.uiNode).sort((r, o) => r === o ? 0 : r.compareDocumentPosition(o) & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : -1).forEach((r) => {
|
|
539
539
|
let o = null;
|
|
540
540
|
r.nextSibling != null && (o = this.scroll.find(r.nextSibling));
|
|
541
|
-
const a =
|
|
541
|
+
const a = rt(r, this.scroll);
|
|
542
542
|
(a.next !== o || a.next == null) && (a.parent != null && a.parent.removeChild(this), this.insertBefore(a, o || void 0));
|
|
543
543
|
}), this.enforceAllowedChildren();
|
|
544
544
|
}
|
|
@@ -613,12 +613,12 @@ const E = class C extends L {
|
|
|
613
613
|
};
|
|
614
614
|
E.allowedChildren = [E, q], E.blotName = "inline", E.scope = d.INLINE_BLOT, E.tagName = "SPAN";
|
|
615
615
|
let Ht = E;
|
|
616
|
-
const _t = Ht, A = class
|
|
616
|
+
const _t = Ht, A = class Y extends L {
|
|
617
617
|
static create(t) {
|
|
618
618
|
return super.create(t);
|
|
619
619
|
}
|
|
620
620
|
static formats(t, e) {
|
|
621
|
-
const s = e.query(
|
|
621
|
+
const s = e.query(Y.blotName);
|
|
622
622
|
if (!(s != null && t.tagName === s.tagName)) {
|
|
623
623
|
if (typeof this.tagName == "string")
|
|
624
624
|
return !0;
|
|
@@ -631,7 +631,7 @@ const _t = Ht, A = class Z extends L {
|
|
|
631
631
|
}
|
|
632
632
|
format(t, e) {
|
|
633
633
|
const s = this.scroll.query(t, d.BLOCK);
|
|
634
|
-
s != null && (s instanceof T ? this.attributes.attribute(s, e) : t === this.statics.blotName && !e ? this.replaceWith(
|
|
634
|
+
s != null && (s instanceof T ? this.attributes.attribute(s, e) : t === this.statics.blotName && !e ? this.replaceWith(Y.blotName) : e && (t !== this.statics.blotName || this.formats()[t] !== e) && this.replaceWith(t, e));
|
|
635
635
|
}
|
|
636
636
|
formats() {
|
|
637
637
|
const t = this.attributes.values(), e = this.statics.formats(this.domNode, this.scroll);
|
|
@@ -668,7 +668,7 @@ A.blotName = "block", A.scope = d.BLOCK_BLOT, A.tagName = "P", A.allowedChildren
|
|
|
668
668
|
q
|
|
669
669
|
];
|
|
670
670
|
let Kt = A;
|
|
671
|
-
const
|
|
671
|
+
const Z = Kt, J = class extends L {
|
|
672
672
|
checkMerge() {
|
|
673
673
|
return this.next !== null && this.next.statics.blotName === this.statics.blotName;
|
|
674
674
|
}
|
|
@@ -685,10 +685,10 @@ const J = Kt, Q = class extends L {
|
|
|
685
685
|
super.optimize(t), this.children.length > 0 && this.next != null && this.checkMerge() && (this.next.moveChildren(this), this.next.remove());
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
|
-
|
|
689
|
-
let Vt =
|
|
688
|
+
J.blotName = "container", J.scope = d.BLOCK_BLOT;
|
|
689
|
+
let Vt = J;
|
|
690
690
|
const qt = Vt;
|
|
691
|
-
class
|
|
691
|
+
class Wt extends q {
|
|
692
692
|
static formats(t, e) {
|
|
693
693
|
}
|
|
694
694
|
format(t, e) {
|
|
@@ -701,7 +701,7 @@ class Ft extends q {
|
|
|
701
701
|
return this.statics.formats(this.domNode, this.scroll);
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
const
|
|
704
|
+
const Ft = Wt, Gt = {
|
|
705
705
|
attributes: !0,
|
|
706
706
|
characterData: !0,
|
|
707
707
|
characterDataOldValue: !0,
|
|
@@ -781,9 +781,9 @@ const Wt = Ft, Gt = {
|
|
|
781
781
|
}), e.mutationsMap = s, s.has(this.domNode) && super.update(s.get(this.domNode), e), this.optimize(t, e);
|
|
782
782
|
}
|
|
783
783
|
};
|
|
784
|
-
S.blotName = "scroll", S.defaultChild =
|
|
784
|
+
S.blotName = "scroll", S.defaultChild = Z, S.allowedChildren = [Z, qt], S.scope = d.BLOCK_BLOT, S.tagName = "DIV";
|
|
785
785
|
let Xt = S;
|
|
786
|
-
const Yt = Xt,
|
|
786
|
+
const Yt = Xt, nt = class vt extends q {
|
|
787
787
|
static create(t) {
|
|
788
788
|
return document.createTextNode(t);
|
|
789
789
|
}
|
|
@@ -828,8 +828,8 @@ const Yt = Xt, ot = class vt extends q {
|
|
|
828
828
|
return this.text;
|
|
829
829
|
}
|
|
830
830
|
};
|
|
831
|
-
|
|
832
|
-
const
|
|
831
|
+
nt.blotName = "text", nt.scope = d.INLINE_BLOT;
|
|
832
|
+
const et = class et extends Yt {
|
|
833
833
|
constructor(t, e) {
|
|
834
834
|
super(t, e), this.observer.disconnect();
|
|
835
835
|
}
|
|
@@ -839,9 +839,9 @@ const st = class st extends Yt {
|
|
|
839
839
|
optimize(t, e) {
|
|
840
840
|
}
|
|
841
841
|
};
|
|
842
|
-
|
|
843
|
-
let
|
|
844
|
-
const B = class B extends
|
|
842
|
+
et.blotName = "rc-scroll";
|
|
843
|
+
let Q = et;
|
|
844
|
+
const B = class B extends Z {
|
|
845
845
|
};
|
|
846
846
|
B.blotName = "rc-block", B.tagName = "DIV", B.className = "line";
|
|
847
847
|
let U = B;
|
|
@@ -859,7 +859,7 @@ function Zt(n, t) {
|
|
|
859
859
|
n.classList.add(e);
|
|
860
860
|
t.bold && (n.style.fontWeight = "bold"), t.italic && (n.style.fontStyle = "italic"), t.color && (n.style.color = t.color), t.background && (n.style.backgroundColor = t.background), t.underline && (n.style.textDecoration = `${t.underline} underline`, t.underlineColor && (n.style.textDecorationColor = t.underlineColor));
|
|
861
861
|
}
|
|
862
|
-
const I = class I extends
|
|
862
|
+
const I = class I extends Ft {
|
|
863
863
|
static create() {
|
|
864
864
|
const t = super.create();
|
|
865
865
|
return t.contentEditable = "false", t.setAttribute("aria-hidden", "true"), t;
|
|
@@ -920,7 +920,7 @@ function G(n) {
|
|
|
920
920
|
class te {
|
|
921
921
|
constructor(t) {
|
|
922
922
|
const e = Jt();
|
|
923
|
-
this.scroll = new
|
|
923
|
+
this.scroll = new Q(e, t);
|
|
924
924
|
}
|
|
925
925
|
/**
|
|
926
926
|
* Rebuild the document tree.
|
|
@@ -949,26 +949,26 @@ class te {
|
|
|
949
949
|
} else
|
|
950
950
|
p = U.create(), s.appendChild(p);
|
|
951
951
|
const k = o.get(g) ?? [];
|
|
952
|
-
for (const
|
|
953
|
-
if (
|
|
954
|
-
for (const x of
|
|
952
|
+
for (const _ of k) {
|
|
953
|
+
if (_.className)
|
|
954
|
+
for (const x of _.className.split(/\s+/).filter(Boolean))
|
|
955
955
|
p.classList.add(x);
|
|
956
|
-
if (
|
|
957
|
-
for (const [x, w] of Object.entries(
|
|
956
|
+
if (_.attributes)
|
|
957
|
+
for (const [x, w] of Object.entries(_.attributes))
|
|
958
958
|
p.setAttribute(x, w);
|
|
959
959
|
}
|
|
960
|
-
const St = a.filter((
|
|
960
|
+
const St = a.filter((_) => _.from < m && _.to > u), Ot = l.filter((_) => _.offset >= u && _.offset <= m);
|
|
961
961
|
Qt(p, f, u, St, Ot);
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
const
|
|
962
|
+
const W = k.filter((_) => _.message);
|
|
963
|
+
if (W.length > 0) {
|
|
964
|
+
const _ = W.map((w) => w.message).join(" · "), x = [
|
|
965
965
|
...new Set(
|
|
966
|
-
|
|
966
|
+
W.flatMap(
|
|
967
967
|
(w) => w.messageClassName ? w.messageClassName.split(/\s+/).filter(Boolean) : []
|
|
968
968
|
)
|
|
969
969
|
)
|
|
970
970
|
];
|
|
971
|
-
p.dataset.message =
|
|
971
|
+
p.dataset.message = _, p.title = _, x.length > 0 && (p.dataset.messageClass = x.join(" "));
|
|
972
972
|
}
|
|
973
973
|
h += f.length + 1;
|
|
974
974
|
}
|
|
@@ -984,25 +984,25 @@ class te {
|
|
|
984
984
|
function ee(n) {
|
|
985
985
|
const t = Array.from(n.querySelectorAll(".line"));
|
|
986
986
|
return t.length > 0 ? t.map((e) => se(e)).join(`
|
|
987
|
-
`) :
|
|
987
|
+
`) : bt(n);
|
|
988
988
|
}
|
|
989
989
|
function se(n) {
|
|
990
990
|
let t = "";
|
|
991
991
|
for (const e of n.childNodes)
|
|
992
|
-
t +=
|
|
992
|
+
t += yt(e);
|
|
993
993
|
return t;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function yt(n) {
|
|
996
996
|
if (n.nodeType === Node.TEXT_NODE)
|
|
997
997
|
return n.data;
|
|
998
998
|
if (!(n instanceof Element) || n.classList.contains("widget") || n.classList.contains("line-message") || n.tagName === "BR")
|
|
999
999
|
return "";
|
|
1000
1000
|
let t = "";
|
|
1001
1001
|
for (const e of n.childNodes)
|
|
1002
|
-
t +=
|
|
1002
|
+
t += yt(e);
|
|
1003
1003
|
return t;
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function bt(n) {
|
|
1006
1006
|
let t = "", e = !0;
|
|
1007
1007
|
for (const s of n.childNodes)
|
|
1008
1008
|
if (s.nodeType === Node.TEXT_NODE)
|
|
@@ -1016,7 +1016,7 @@ function yt(n) {
|
|
|
1016
1016
|
if (s.classList.contains("widget"))
|
|
1017
1017
|
continue;
|
|
1018
1018
|
(s.tagName === "DIV" || s.tagName === "P") && !e && (t += `
|
|
1019
|
-
`), e = !1, t +=
|
|
1019
|
+
`), e = !1, t += bt(s);
|
|
1020
1020
|
}
|
|
1021
1021
|
return t;
|
|
1022
1022
|
}
|
|
@@ -1070,7 +1070,7 @@ function Nt(n, t, e, s) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
return { found: !1, offset: s };
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function ot(n, t) {
|
|
1074
1074
|
const e = Array.from(n.querySelectorAll(".line"));
|
|
1075
1075
|
let s = t;
|
|
1076
1076
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -1130,7 +1130,7 @@ function P(n) {
|
|
|
1130
1130
|
return null;
|
|
1131
1131
|
}
|
|
1132
1132
|
function ie(n, t) {
|
|
1133
|
-
const e =
|
|
1133
|
+
const e = ot(n, t.anchorOffset), s = ot(n, t.focusOffset);
|
|
1134
1134
|
if (!(!e || !s))
|
|
1135
1135
|
try {
|
|
1136
1136
|
const i = window.getSelection();
|
|
@@ -1153,7 +1153,7 @@ function wt(n, t) {
|
|
|
1153
1153
|
s--, i--;
|
|
1154
1154
|
return { start: e, removed: s - e, inserted: i - e };
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function at(n, t, e) {
|
|
1157
1157
|
const s = e.start + e.removed, i = e.inserted - e.removed;
|
|
1158
1158
|
if (t <= e.start)
|
|
1159
1159
|
return { from: n, to: t };
|
|
@@ -1176,12 +1176,12 @@ function ne(n, t, e) {
|
|
|
1176
1176
|
const s = wt(t, e), i = s.start + s.removed, r = t.slice(s.start, i), o = e.slice(s.start, s.start + s.inserted), a = (r.match(/\n/g) ?? []).length, h = (o.match(/\n/g) ?? []).length - a, c = re(t, s.start) + 1, f = c + a, g = [];
|
|
1177
1177
|
for (const u of n)
|
|
1178
1178
|
if (u.type === "mark") {
|
|
1179
|
-
const m =
|
|
1179
|
+
const m = at(u.from, u.to, s);
|
|
1180
1180
|
m && g.push({ ...u, from: m.from, to: m.to });
|
|
1181
1181
|
} else if (u.type === "line")
|
|
1182
1182
|
u.line < c ? g.push(u) : u.line <= f || g.push({ ...u, line: u.line + h });
|
|
1183
1183
|
else {
|
|
1184
|
-
const m =
|
|
1184
|
+
const m = at(u.offset, u.offset + 1, s);
|
|
1185
1185
|
m && g.push({ ...u, offset: m.from });
|
|
1186
1186
|
}
|
|
1187
1187
|
return g;
|
|
@@ -1196,7 +1196,7 @@ function j(n, t, e) {
|
|
|
1196
1196
|
const s = wt(t, e);
|
|
1197
1197
|
return oe(t, s) ? [] : ne(n, t, e);
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function lt(n, t) {
|
|
1200
1200
|
const e = crypto.randomUUID();
|
|
1201
1201
|
return n.set(e, { ...t, id: e }), e;
|
|
1202
1202
|
}
|
|
@@ -1291,7 +1291,6 @@ const ce = Lt`
|
|
|
1291
1291
|
}
|
|
1292
1292
|
|
|
1293
1293
|
:host([line-numbers]) #gutter,
|
|
1294
|
-
:host([list-numbers]) #gutter,
|
|
1295
1294
|
:host([gutter]) #gutter {
|
|
1296
1295
|
display: block;
|
|
1297
1296
|
}
|
|
@@ -1427,13 +1426,13 @@ const ce = Lt`
|
|
|
1427
1426
|
vertical-align: middle;
|
|
1428
1427
|
}
|
|
1429
1428
|
`;
|
|
1430
|
-
var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor,
|
|
1429
|
+
var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, y = (n, t, e, s) => {
|
|
1431
1430
|
for (var i = s > 1 ? void 0 : s ? ue(t, e) : t, r = n.length - 1, o; r >= 0; r--)
|
|
1432
1431
|
(o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
|
|
1433
1432
|
return s && i && he(t, e, i), i;
|
|
1434
1433
|
};
|
|
1435
1434
|
const de = 100;
|
|
1436
|
-
function
|
|
1435
|
+
function ct(n) {
|
|
1437
1436
|
const t = document.createElement("div");
|
|
1438
1437
|
t.innerHTML = n;
|
|
1439
1438
|
const e = [];
|
|
@@ -1459,9 +1458,9 @@ function X(n) {
|
|
|
1459
1458
|
i(r);
|
|
1460
1459
|
return e;
|
|
1461
1460
|
}
|
|
1462
|
-
const V = class V extends
|
|
1461
|
+
const V = class V extends st {
|
|
1463
1462
|
constructor() {
|
|
1464
|
-
super(...arguments), this.lineNumbers = !1, this.
|
|
1463
|
+
super(...arguments), this.lineNumbers = !1, this.gutter = !1, this.wordWrap = !1, this.autoGrow = !1, this.readOnly = !1, this._value = "", this._initialValueResolved = !1, this._valueSetByHost = !1, this._document = null, this._$textareaRef = null, this._textareaController = new kt(this, {
|
|
1465
1464
|
selector: ":scope > textarea",
|
|
1466
1465
|
observe: !0,
|
|
1467
1466
|
onChange: (t, e) => this._setupTextarea(t, e),
|
|
@@ -1522,26 +1521,6 @@ const V = class V extends it {
|
|
|
1522
1521
|
this._insertText(s);
|
|
1523
1522
|
};
|
|
1524
1523
|
}
|
|
1525
|
-
get listNumbers() {
|
|
1526
|
-
return this._listNumbers;
|
|
1527
|
-
}
|
|
1528
|
-
set listNumbers(t) {
|
|
1529
|
-
t && console.warn(
|
|
1530
|
-
"[rc-textarea] `listNumbers` / `list-numbers` is deprecated and will be removed before v1.0. Use a plugin with `LineDecoration.gutterContent` to implement sparse line numbering."
|
|
1531
|
-
);
|
|
1532
|
-
const e = this._listNumbers;
|
|
1533
|
-
this._listNumbers = t, this.requestUpdate("listNumbers", e);
|
|
1534
|
-
}
|
|
1535
|
-
get label() {
|
|
1536
|
-
return this._label;
|
|
1537
|
-
}
|
|
1538
|
-
set label(t) {
|
|
1539
|
-
t && console.warn(
|
|
1540
|
-
"[rc-textarea] `label` is deprecated and will be removed before v1.0. Set `aria-label` on the slotted `<textarea>`, or associate a `<label>` element via its `for`/`id` pair instead."
|
|
1541
|
-
);
|
|
1542
|
-
const e = this._label;
|
|
1543
|
-
this._label = t, this.requestUpdate("label", e);
|
|
1544
|
-
}
|
|
1545
1524
|
get plugin() {
|
|
1546
1525
|
return this._pluginProperty;
|
|
1547
1526
|
}
|
|
@@ -1577,12 +1556,12 @@ const V = class V extends it {
|
|
|
1577
1556
|
super.disconnectedCallback(), document.removeEventListener("selectionchange", this._docSelectionChangeHandler), this._plugin?.destroy?.(), this._plugin = null, this._pluginApi = null, this._clearPluginSheets(), this._cursorCallbacks.clear(), this._resizeObserver?.disconnect(), this._$textareaRef?.deref()?.removeEventListener("invalid", this._onTextareaInvalid), this._rafHandle !== null && (cancelAnimationFrame(this._rafHandle), this._rafHandle = null);
|
|
1578
1557
|
}
|
|
1579
1558
|
firstUpdated() {
|
|
1580
|
-
this._$editor && (this._document = new te(this._$editor), this._bindEditorEvents(this._$editor)), this._resizeObserver = new ResizeObserver(() => {
|
|
1559
|
+
this._$editor && (this._document = new te(this._$editor), this._bindEditorEvents(this._$editor), this._syncLabel()), this._resizeObserver = new ResizeObserver(() => {
|
|
1581
1560
|
this._syncGutter(), this._syncGutterHeights();
|
|
1582
1561
|
}), this._resizeObserver.observe(this), this._scheduleRender();
|
|
1583
1562
|
}
|
|
1584
1563
|
updated(t) {
|
|
1585
|
-
t.has("readOnly") && (this._$editor && (this._$editor.contentEditable = this.readOnly ? "false" : "true"), this._syncGutterHeights(), this._textareaController.sync())
|
|
1564
|
+
t.has("readOnly") && (this._$editor && (this._$editor.contentEditable = this.readOnly ? "false" : "true"), this._syncGutterHeights(), this._textareaController.sync());
|
|
1586
1565
|
}
|
|
1587
1566
|
render() {
|
|
1588
1567
|
return Tt`
|
|
@@ -1858,7 +1837,7 @@ const V = class V extends it {
|
|
|
1858
1837
|
};
|
|
1859
1838
|
},
|
|
1860
1839
|
addDecoration(e) {
|
|
1861
|
-
return
|
|
1840
|
+
return lt(t._pluginDecorations, e);
|
|
1862
1841
|
},
|
|
1863
1842
|
removeDecoration(e) {
|
|
1864
1843
|
t._pluginDecorations.delete(e);
|
|
@@ -1888,11 +1867,7 @@ const V = class V extends it {
|
|
|
1888
1867
|
)), t._pluginSheets.delete(e);
|
|
1889
1868
|
},
|
|
1890
1869
|
parseDecorationsFromHtml(e) {
|
|
1891
|
-
return
|
|
1892
|
-
},
|
|
1893
|
-
/** @deprecated Use `parseDecorationsFromHtml` instead. */
|
|
1894
|
-
decorationsFromHtml(e) {
|
|
1895
|
-
return X(e);
|
|
1870
|
+
return ct(e);
|
|
1896
1871
|
},
|
|
1897
1872
|
decorationsFromTokens(e, s) {
|
|
1898
1873
|
const i = [];
|
|
@@ -1979,9 +1954,9 @@ const V = class V extends it {
|
|
|
1979
1954
|
if (t !== this._pluginSeq)
|
|
1980
1955
|
return;
|
|
1981
1956
|
if (typeof a == "string") {
|
|
1982
|
-
const l =
|
|
1957
|
+
const l = ct(a);
|
|
1983
1958
|
for (const h of l)
|
|
1984
|
-
|
|
1959
|
+
lt(this._pluginDecorations, h);
|
|
1985
1960
|
}
|
|
1986
1961
|
}
|
|
1987
1962
|
}
|
|
@@ -1999,7 +1974,7 @@ const V = class V extends it {
|
|
|
1999
1974
|
}
|
|
2000
1975
|
/**
|
|
2001
1976
|
* Compute the label string for each gutter cell based on the current gutter
|
|
2002
|
-
* mode (`lineNumbers`, `
|
|
1977
|
+
* mode (`lineNumbers`, `gutter`) and any
|
|
2003
1978
|
* `LineDecoration.gutterContent` overrides in `allDecorations`.
|
|
2004
1979
|
*
|
|
2005
1980
|
* Returns one entry per line (same length as `value.split('\n')`):
|
|
@@ -2009,12 +1984,11 @@ const V = class V extends it {
|
|
|
2009
1984
|
_computeGutterLabels(t, e = this._value) {
|
|
2010
1985
|
const s = e.split(`
|
|
2011
1986
|
`), i = /* @__PURE__ */ new Map();
|
|
2012
|
-
for (const
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
return i.has(l) ? i.get(l) : this.lineNumbers ? String(l) : this.listNumbers ? o.trim() === "" ? null : (r++, `${r}.`) : null;
|
|
1987
|
+
for (const r of t)
|
|
1988
|
+
r.type === "line" && r.gutterContent !== void 0 && i.set(r.line, r.gutterContent);
|
|
1989
|
+
return s.map((r, o) => {
|
|
1990
|
+
const a = o + 1;
|
|
1991
|
+
return i.has(a) ? i.get(a) : this.lineNumbers ? String(a) : null;
|
|
2018
1992
|
});
|
|
2019
1993
|
}
|
|
2020
1994
|
/**
|
|
@@ -2055,7 +2029,7 @@ const V = class V extends it {
|
|
|
2055
2029
|
* (called by the `ResizeObserver` without a new render pass).
|
|
2056
2030
|
*/
|
|
2057
2031
|
_syncGutter(t) {
|
|
2058
|
-
if (!this.lineNumbers && !this.
|
|
2032
|
+
if (!this.lineNumbers && !this.gutter || !this._$gutterCells)
|
|
2059
2033
|
return;
|
|
2060
2034
|
t !== void 0 && (this._gutterLabels = t);
|
|
2061
2035
|
const e = this._gutterLabels;
|
|
@@ -2085,10 +2059,6 @@ const V = class V extends it {
|
|
|
2085
2059
|
return;
|
|
2086
2060
|
}
|
|
2087
2061
|
}
|
|
2088
|
-
if (this._label) {
|
|
2089
|
-
this._$editor.setAttribute("aria-label", this._label);
|
|
2090
|
-
return;
|
|
2091
|
-
}
|
|
2092
2062
|
this._$editor.removeAttribute("aria-label");
|
|
2093
2063
|
}
|
|
2094
2064
|
_syncTypography(t) {
|
|
@@ -2127,52 +2097,46 @@ const V = class V extends it {
|
|
|
2127
2097
|
}
|
|
2128
2098
|
};
|
|
2129
2099
|
V.styles = ce, V.shadowRootOptions = {
|
|
2130
|
-
...
|
|
2100
|
+
...st.shadowRootOptions,
|
|
2131
2101
|
delegatesFocus: !0
|
|
2132
2102
|
};
|
|
2133
|
-
let
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
],
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
],
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
],
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
],
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
],
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
],
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
],
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
],
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
],
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
],
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
],
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
],
|
|
2170
|
-
b([
|
|
2171
|
-
y({ type: String })
|
|
2172
|
-
], _.prototype, "value", 1);
|
|
2173
|
-
b([
|
|
2174
|
-
y({ type: String, attribute: "default-value" })
|
|
2175
|
-
], _.prototype, "defaultValue", 1);
|
|
2103
|
+
let v = V;
|
|
2104
|
+
y([
|
|
2105
|
+
b({ type: Boolean, attribute: "line-numbers", reflect: !0 })
|
|
2106
|
+
], v.prototype, "lineNumbers", 2);
|
|
2107
|
+
y([
|
|
2108
|
+
b({ type: Boolean, attribute: "gutter", reflect: !0 })
|
|
2109
|
+
], v.prototype, "gutter", 2);
|
|
2110
|
+
y([
|
|
2111
|
+
b({ type: Boolean, attribute: "word-wrap", reflect: !0 })
|
|
2112
|
+
], v.prototype, "wordWrap", 2);
|
|
2113
|
+
y([
|
|
2114
|
+
b({ type: Boolean, attribute: "auto-grow", reflect: !0 })
|
|
2115
|
+
], v.prototype, "autoGrow", 2);
|
|
2116
|
+
y([
|
|
2117
|
+
b({ type: Boolean, attribute: "read-only", reflect: !0 })
|
|
2118
|
+
], v.prototype, "readOnly", 2);
|
|
2119
|
+
y([
|
|
2120
|
+
b({ attribute: !1 })
|
|
2121
|
+
], v.prototype, "plugin", 1);
|
|
2122
|
+
y([
|
|
2123
|
+
b({ attribute: !1 })
|
|
2124
|
+
], v.prototype, "decorations", 1);
|
|
2125
|
+
y([
|
|
2126
|
+
tt("#editor")
|
|
2127
|
+
], v.prototype, "_$editor", 2);
|
|
2128
|
+
y([
|
|
2129
|
+
tt("#gutter-cells")
|
|
2130
|
+
], v.prototype, "_$gutterCells", 2);
|
|
2131
|
+
y([
|
|
2132
|
+
tt("slot")
|
|
2133
|
+
], v.prototype, "_$slot", 2);
|
|
2134
|
+
y([
|
|
2135
|
+
b({ type: String })
|
|
2136
|
+
], v.prototype, "value", 1);
|
|
2137
|
+
y([
|
|
2138
|
+
b({ type: String, attribute: "default-value" })
|
|
2139
|
+
], v.prototype, "defaultValue", 1);
|
|
2176
2140
|
function we(n, t = {}) {
|
|
2177
2141
|
const e = [];
|
|
2178
2142
|
return {
|
|
@@ -2391,8 +2355,8 @@ function me(n, t, e) {
|
|
|
2391
2355
|
}
|
|
2392
2356
|
export {
|
|
2393
2357
|
Ct as L,
|
|
2394
|
-
|
|
2358
|
+
v as R,
|
|
2395
2359
|
we as c,
|
|
2396
2360
|
le as m
|
|
2397
2361
|
};
|
|
2398
|
-
//# sourceMappingURL=line-actions-controller-
|
|
2362
|
+
//# sourceMappingURL=line-actions-controller-CB8U0WvH.js.map
|