@vscode/markdown-editor 0.0.2-28 → 0.0.2-29
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/index.d.ts +27 -0
- package/dist/index.js +268 -215
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/view/editor.css +14 -0
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { O as v, S as N, a as Se } from "./stringEdit-DzLs4E1d.js";
|
|
2
2
|
import kn from "katex";
|
|
3
|
-
import { o as
|
|
3
|
+
import { o as R, d as $, t as bn, n as U, V as rs, q as H, A as cs } from "./runOnChange-e7FtCqOQ.js";
|
|
4
4
|
import { D as as, f as ls, a as ds, b as hs, c as us, d as fs } from "./config-Dvgk17FF.js";
|
|
5
|
-
import { e as
|
|
5
|
+
import { e as Sc } from "./config-Dvgk17FF.js";
|
|
6
6
|
import { parse as ms, preprocess as gs, postprocess as ps } from "micromark";
|
|
7
7
|
import { math as _s } from "micromark-extension-math";
|
|
8
8
|
import { gfmTable as vs } from "micromark-extension-gfm-table";
|
|
@@ -651,7 +651,7 @@ function xn(n, e) {
|
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
const Es = /\[[ xX]\]/;
|
|
654
|
-
function
|
|
654
|
+
function fc(n) {
|
|
655
655
|
if (n.checked === void 0)
|
|
656
656
|
return;
|
|
657
657
|
const e = Es.exec(yn(n));
|
|
@@ -1460,7 +1460,7 @@ function Fs(n) {
|
|
|
1460
1460
|
let e = Bt.get(n);
|
|
1461
1461
|
return e === void 0 && (e = Hs++, Bt.set(n, e)), e;
|
|
1462
1462
|
}
|
|
1463
|
-
function
|
|
1463
|
+
function mc(n, e) {
|
|
1464
1464
|
let t = 0;
|
|
1465
1465
|
function s(i) {
|
|
1466
1466
|
const o = t, r = i.children;
|
|
@@ -1481,7 +1481,7 @@ function Ks(n) {
|
|
|
1481
1481
|
}
|
|
1482
1482
|
return t;
|
|
1483
1483
|
}
|
|
1484
|
-
const Ws = {}, On =
|
|
1484
|
+
const Ws = {}, On = R(Ws, !1), zs = On;
|
|
1485
1485
|
let ht, it;
|
|
1486
1486
|
function Gs() {
|
|
1487
1487
|
return it || (it = bs({ useWasm: !1 }).then((n) => {
|
|
@@ -1565,7 +1565,7 @@ function je(n, e, t, s, i) {
|
|
|
1565
1565
|
return o;
|
|
1566
1566
|
}
|
|
1567
1567
|
const Zs = Symbol("NO_ACTIVE_BLOCKS");
|
|
1568
|
-
class
|
|
1568
|
+
class gc {
|
|
1569
1569
|
_parser = new Ps();
|
|
1570
1570
|
/**
|
|
1571
1571
|
* The most recent edit applied to {@link sourceText}, used by
|
|
@@ -1574,8 +1574,8 @@ class mc {
|
|
|
1574
1574
|
* source text (see {@link document}).
|
|
1575
1575
|
*/
|
|
1576
1576
|
_pendingEdit;
|
|
1577
|
-
sourceText =
|
|
1578
|
-
wordNavigationConfig =
|
|
1577
|
+
sourceText = R(this, new Pe(""));
|
|
1578
|
+
wordNavigationConfig = R(this, as);
|
|
1579
1579
|
/**
|
|
1580
1580
|
* Read-only mode. When `true`, the editor never reveals a block's source
|
|
1581
1581
|
* markers (markdown special characters like `**`, `#`, list bullets, code
|
|
@@ -1585,19 +1585,19 @@ class mc {
|
|
|
1585
1585
|
* default (`false`) is the normal editing mode where the active block
|
|
1586
1586
|
* reveals its markers.
|
|
1587
1587
|
*/
|
|
1588
|
-
readonlyMode =
|
|
1588
|
+
readonlyMode = R(this, !1);
|
|
1589
1589
|
/**
|
|
1590
1590
|
* The current selection, or `undefined` when the editor has no caret
|
|
1591
1591
|
* (e.g. an inactive/unfocused rendering).
|
|
1592
1592
|
*/
|
|
1593
|
-
selection =
|
|
1593
|
+
selection = R(this, void 0);
|
|
1594
1594
|
/**
|
|
1595
1595
|
* Whether a Ctrl/Cmd modifier is currently held. Set by the controller from
|
|
1596
1596
|
* live keyboard state; the view reads it to show the link-open affordance
|
|
1597
1597
|
* (underline + pointer cursor) only while a Ctrl/Cmd+click would open a link
|
|
1598
1598
|
* whose block is active.
|
|
1599
1599
|
*/
|
|
1600
|
-
ctrlOrMetaDown =
|
|
1600
|
+
ctrlOrMetaDown = R(this, !1);
|
|
1601
1601
|
/**
|
|
1602
1602
|
* Whether a pointer-driven selection drag is currently in progress. Set by
|
|
1603
1603
|
* the controller between the pointer-down that starts the drag and the
|
|
@@ -1605,14 +1605,14 @@ class mc {
|
|
|
1605
1605
|
* would otherwise flicker mid-drag (e.g. the comment input box appears only
|
|
1606
1606
|
* once the drag ends).
|
|
1607
1607
|
*/
|
|
1608
|
-
isSelecting =
|
|
1608
|
+
isSelecting = R(this, !1);
|
|
1609
1609
|
/**
|
|
1610
1610
|
* Gutter markers (source-control style change indicators) painted in the
|
|
1611
1611
|
* left gutter. Each entry maps a source {@link OffsetRange} to a change kind
|
|
1612
1612
|
* — see {@link GutterMarker}. Purely decorative: markers never affect the
|
|
1613
1613
|
* parsed {@link document}, selection, or layout. Empty by default.
|
|
1614
1614
|
*/
|
|
1615
|
-
gutterMarkers =
|
|
1615
|
+
gutterMarkers = R(this, []);
|
|
1616
1616
|
/**
|
|
1617
1617
|
* Forces the rendered active-block set. `undefined` (the default)
|
|
1618
1618
|
* derives the set from the current selection range (see
|
|
@@ -1620,14 +1620,14 @@ class mc {
|
|
|
1620
1620
|
* "no active block" — useful in fixtures that always want the
|
|
1621
1621
|
* collapsed/inactive rendering.
|
|
1622
1622
|
*/
|
|
1623
|
-
activeBlocksOverride =
|
|
1623
|
+
activeBlocksOverride = R(this, void 0);
|
|
1624
1624
|
/**
|
|
1625
1625
|
* The transient empty-paragraph editing state, or `undefined` when none is
|
|
1626
1626
|
* armed. See {@link PendingParagraph}. This is *not* document data — it is
|
|
1627
1627
|
* cleared by any source edit and lives only between the Enter that armed it
|
|
1628
1628
|
* and the next keystroke.
|
|
1629
1629
|
*/
|
|
1630
|
-
pendingParagraph =
|
|
1630
|
+
pendingParagraph = R(this, void 0);
|
|
1631
1631
|
cursorOffset = $(
|
|
1632
1632
|
this,
|
|
1633
1633
|
(e) => e.readObservable(this.selection)?.active
|
|
@@ -1682,7 +1682,7 @@ class mc {
|
|
|
1682
1682
|
* the baseline's removed/changed blocks are shown as read-only decorations.
|
|
1683
1683
|
* `undefined` (the default) renders normally.
|
|
1684
1684
|
*/
|
|
1685
|
-
baseline =
|
|
1685
|
+
baseline = R(this, void 0);
|
|
1686
1686
|
_baselineDocument = $(this, (e) => {
|
|
1687
1687
|
const t = e.readObservable(this.baseline);
|
|
1688
1688
|
return t ? this._parser.parse(t) : void 0;
|
|
@@ -2126,7 +2126,7 @@ function ri(n, e, t, s) {
|
|
|
2126
2126
|
));
|
|
2127
2127
|
}
|
|
2128
2128
|
class ci {
|
|
2129
|
-
measurements =
|
|
2129
|
+
measurements = R(this, []);
|
|
2130
2130
|
/**
|
|
2131
2131
|
* Concatenated visual line map across all mounted blocks. Every per-block
|
|
2132
2132
|
* map uses the same editor-local coordinate space, so concatenation is
|
|
@@ -2833,7 +2833,7 @@ class re extends U {
|
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
2835
|
const Gi = [];
|
|
2836
|
-
class
|
|
2836
|
+
class B extends re {
|
|
2837
2837
|
constructor(e, t, s) {
|
|
2838
2838
|
super(e.ast, t, s), this.data = e;
|
|
2839
2839
|
}
|
|
@@ -2876,7 +2876,7 @@ class R extends re {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
}
|
|
2878
2878
|
function X(n, e, t) {
|
|
2879
|
-
if (t instanceof
|
|
2879
|
+
if (t instanceof B) {
|
|
2880
2880
|
if (t.canReuse(n))
|
|
2881
2881
|
return t;
|
|
2882
2882
|
} else if (t?.ast === n.ast)
|
|
@@ -2941,7 +2941,7 @@ function fe(n) {
|
|
|
2941
2941
|
return n instanceof le ? n : void 0;
|
|
2942
2942
|
}
|
|
2943
2943
|
function Z(n, e, t, s) {
|
|
2944
|
-
const { paired: i, unused: o } = Tt(e, t ??
|
|
2944
|
+
const { paired: i, unused: o } = Tt(e, t ?? F), r = e.map((c) => s(c, i.get(c)));
|
|
2945
2945
|
for (const c of o)
|
|
2946
2946
|
c.dispose();
|
|
2947
2947
|
return qi(n, r), r;
|
|
@@ -2970,8 +2970,8 @@ function ue(n) {
|
|
|
2970
2970
|
function Pn(n) {
|
|
2971
2971
|
return (e, t) => e.kind === "marker" && e.ast.markerKind === "content" ? new St(e, document.createTextNode(e.ast.content)) : X(e, n, t);
|
|
2972
2972
|
}
|
|
2973
|
-
const
|
|
2974
|
-
class ft extends
|
|
2973
|
+
const F = [];
|
|
2974
|
+
class ft extends B {
|
|
2975
2975
|
_originalNode;
|
|
2976
2976
|
_modifiedNode;
|
|
2977
2977
|
constructor(e, t, s) {
|
|
@@ -2990,7 +2990,7 @@ function Kt(n, e, t, s) {
|
|
|
2990
2990
|
const i = X(n.view, t, s), o = i.element;
|
|
2991
2991
|
return o.classList.add(e), o.classList.toggle("md-block-active", n.active), o.classList.toggle("md-markers-hidden", !n.active), i;
|
|
2992
2992
|
}
|
|
2993
|
-
class mt extends
|
|
2993
|
+
class mt extends B {
|
|
2994
2994
|
sideNode;
|
|
2995
2995
|
constructor(e, t, s) {
|
|
2996
2996
|
const i = s?.dom ?? document.createElement("div");
|
|
@@ -3028,7 +3028,7 @@ function ji(n, e) {
|
|
|
3028
3028
|
const r = document.createElement("span");
|
|
3029
3029
|
r.className = "md-text";
|
|
3030
3030
|
const c = tt(r, t, s, n.ast);
|
|
3031
|
-
return new
|
|
3031
|
+
return new B(n, r, c);
|
|
3032
3032
|
}
|
|
3033
3033
|
const i = e?.dom, o = i instanceof globalThis.Text && i.data === t ? i : document.createTextNode(t);
|
|
3034
3034
|
return new St(n, o);
|
|
@@ -3098,37 +3098,37 @@ function tt(n, e, t, s) {
|
|
|
3098
3098
|
c.className = o.cls, c.appendChild(r), n.appendChild(c);
|
|
3099
3099
|
} else
|
|
3100
3100
|
n.appendChild(r);
|
|
3101
|
-
i.push(new Q(s, r,
|
|
3101
|
+
i.push(new Q(s, r, F, o.text.length));
|
|
3102
3102
|
}
|
|
3103
3103
|
return i;
|
|
3104
3104
|
}
|
|
3105
|
-
class St extends
|
|
3105
|
+
class St extends B {
|
|
3106
3106
|
constructor(e, t) {
|
|
3107
|
-
super(e, t,
|
|
3107
|
+
super(e, t, F);
|
|
3108
3108
|
}
|
|
3109
3109
|
}
|
|
3110
3110
|
class Q extends re {
|
|
3111
3111
|
_sourceLength;
|
|
3112
|
-
constructor(e, t, s =
|
|
3112
|
+
constructor(e, t, s = F, i = e.length) {
|
|
3113
3113
|
super(e, t, s), this._sourceLength = i;
|
|
3114
3114
|
}
|
|
3115
3115
|
get sourceLength() {
|
|
3116
3116
|
return this._sourceLength;
|
|
3117
3117
|
}
|
|
3118
3118
|
}
|
|
3119
|
-
class zt extends
|
|
3119
|
+
class zt extends B {
|
|
3120
3120
|
_span;
|
|
3121
3121
|
constructor(e, t) {
|
|
3122
3122
|
const s = e.ast, i = `md-marker md-marker-${s.markerKind}`, o = t && t.dom instanceof globalThis.Text && t.dom.data === s.content, r = o ? t._span : document.createElement("span");
|
|
3123
3123
|
r.className = e.visible ? i : `${i} md-marker-hidden`;
|
|
3124
3124
|
const c = o ? t.dom : document.createTextNode(s.content);
|
|
3125
|
-
o || r.appendChild(c), super(e, c,
|
|
3125
|
+
o || r.appendChild(c), super(e, c, F), this._span = r;
|
|
3126
3126
|
}
|
|
3127
3127
|
get mountNode() {
|
|
3128
3128
|
return this._span;
|
|
3129
3129
|
}
|
|
3130
3130
|
}
|
|
3131
|
-
class Xe extends
|
|
3131
|
+
class Xe extends B {
|
|
3132
3132
|
_span;
|
|
3133
3133
|
constructor(e, t) {
|
|
3134
3134
|
const s = Xe._build(e, t);
|
|
@@ -3154,10 +3154,10 @@ class Xe extends R {
|
|
|
3154
3154
|
const a = t && t.dom instanceof globalThis.Text && t.dom.data === s.content && t.children.length === 0, l = a ? t._span : document.createElement("span");
|
|
3155
3155
|
l.className = e.visible ? i : `${i} md-glue-hidden`;
|
|
3156
3156
|
const d = a ? t.dom : document.createTextNode(s.content);
|
|
3157
|
-
return a || l.appendChild(d), { span: l, dom: d, children:
|
|
3157
|
+
return a || l.appendChild(d), { span: l, dom: d, children: F };
|
|
3158
3158
|
}
|
|
3159
3159
|
}
|
|
3160
|
-
class Gt extends
|
|
3160
|
+
class Gt extends B {
|
|
3161
3161
|
_span;
|
|
3162
3162
|
constructor(e, t) {
|
|
3163
3163
|
const s = e.ast.content, i = document.createElement("span");
|
|
@@ -3175,7 +3175,7 @@ function Ji(n, e, t) {
|
|
|
3175
3175
|
const s = document.createTextNode(e);
|
|
3176
3176
|
return n.appendChild(s), [new Q(t, s)];
|
|
3177
3177
|
}
|
|
3178
|
-
class le extends
|
|
3178
|
+
class le extends B {
|
|
3179
3179
|
constructor(e, t, s, i, o) {
|
|
3180
3180
|
const r = o?.element ?? document.createElement(t);
|
|
3181
3181
|
!o && s && (r.className = s);
|
|
@@ -3183,7 +3183,7 @@ class le extends R {
|
|
|
3183
3183
|
super(e, r, c);
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
3186
|
-
class qt extends
|
|
3186
|
+
class qt extends B {
|
|
3187
3187
|
constructor(e, t, s) {
|
|
3188
3188
|
const i = s && s.element.tagName === `H${e.ast.level}`, o = i ? s.element : document.createElement(`h${e.ast.level}`);
|
|
3189
3189
|
i || (o.className = "md-block md-heading");
|
|
@@ -3191,7 +3191,7 @@ class qt extends R {
|
|
|
3191
3191
|
super(e, o, r);
|
|
3192
3192
|
}
|
|
3193
3193
|
}
|
|
3194
|
-
class Ut extends
|
|
3194
|
+
class Ut extends B {
|
|
3195
3195
|
_contentEl;
|
|
3196
3196
|
constructor(e, t, s) {
|
|
3197
3197
|
if (e.showMarkup) {
|
|
@@ -3204,13 +3204,13 @@ class Ut extends R {
|
|
|
3204
3204
|
const i = document.createElement("div");
|
|
3205
3205
|
i.className = "md-block md-thematic-break-wrapper";
|
|
3206
3206
|
const o = document.createElement("hr");
|
|
3207
|
-
o.className = "md-block md-thematic-break", i.appendChild(o), super(e, i,
|
|
3207
|
+
o.className = "md-block md-thematic-break", i.appendChild(o), super(e, i, F), this._contentEl = o;
|
|
3208
3208
|
}
|
|
3209
3209
|
get element() {
|
|
3210
3210
|
return this._contentEl;
|
|
3211
3211
|
}
|
|
3212
3212
|
}
|
|
3213
|
-
class jt extends
|
|
3213
|
+
class jt extends B {
|
|
3214
3214
|
_scroller;
|
|
3215
3215
|
constructor(e, t, s) {
|
|
3216
3216
|
const i = s && s.dom instanceof HTMLDivElement ? s : void 0, o = i?.dom ?? document.createElement("div");
|
|
@@ -3233,7 +3233,7 @@ class jt extends R {
|
|
|
3233
3233
|
return this._scroller;
|
|
3234
3234
|
}
|
|
3235
3235
|
}
|
|
3236
|
-
class Ot extends
|
|
3236
|
+
class Ot extends B {
|
|
3237
3237
|
_session;
|
|
3238
3238
|
/**
|
|
3239
3239
|
* Subscription that re-tokenises the rendered `<code>` in place whenever the
|
|
@@ -3280,9 +3280,9 @@ class Ot extends R {
|
|
|
3280
3280
|
L.replacements.map((w) => Se.replace(w.replaceRange.delta(c), w.newText))
|
|
3281
3281
|
);
|
|
3282
3282
|
t?.onEmbeddedCodeEditorEdit?.(i, x);
|
|
3283
|
-
}, d.setContent(l), g = d.element, _ =
|
|
3283
|
+
}, d.setContent(l), g = d.element, _ = F;
|
|
3284
3284
|
} else if (u)
|
|
3285
|
-
u.classList.add("md-block", "md-code-block"), g = u, _ =
|
|
3285
|
+
u.classList.add("md-block", "md-code-block"), g = u, _ = F;
|
|
3286
3286
|
else if (i.openFence) {
|
|
3287
3287
|
const b = document.createElement("pre");
|
|
3288
3288
|
b.className = "md-block md-code-block";
|
|
@@ -3367,7 +3367,7 @@ function Xt(n, e, t, s) {
|
|
|
3367
3367
|
l.appendChild(a), e.appendChild(l);
|
|
3368
3368
|
} else
|
|
3369
3369
|
e.appendChild(a);
|
|
3370
|
-
i.push(new Q(n, a,
|
|
3370
|
+
i.push(new Q(n, a, F, c.length));
|
|
3371
3371
|
}
|
|
3372
3372
|
return i;
|
|
3373
3373
|
}
|
|
@@ -3384,13 +3384,13 @@ function Wn(n, e, t) {
|
|
|
3384
3384
|
const s = e.filter((c) => c.length > 0 && c.start >= 0 && c.start + c.length <= t).slice().sort((c, a) => c.start - a.start), i = [];
|
|
3385
3385
|
let o = 0;
|
|
3386
3386
|
const r = (c) => {
|
|
3387
|
-
c > 0 && i.push(new Q(n, document.createTextNode(""),
|
|
3387
|
+
c > 0 && i.push(new Q(n, document.createTextNode(""), F, c));
|
|
3388
3388
|
};
|
|
3389
3389
|
for (const c of s)
|
|
3390
|
-
c.start < o || (r(c.start - o), i.push(new Q(n, c.dom,
|
|
3390
|
+
c.start < o || (r(c.start - o), i.push(new Q(n, c.dom, F, c.length)), o = c.start + c.length);
|
|
3391
3391
|
return r(t - o), i;
|
|
3392
3392
|
}
|
|
3393
|
-
class Yt extends
|
|
3393
|
+
class Yt extends B {
|
|
3394
3394
|
/**
|
|
3395
3395
|
* The rendered (inactive, KaTeX) height in px, measured after mount and
|
|
3396
3396
|
* carried forward across rebuilds via `previous`. When the block becomes
|
|
@@ -3434,13 +3434,13 @@ class Yt extends R {
|
|
|
3434
3434
|
} catch {
|
|
3435
3435
|
a.textContent = r;
|
|
3436
3436
|
}
|
|
3437
|
-
super(e, a,
|
|
3437
|
+
super(e, a, F), this._renderedHeight = o;
|
|
3438
3438
|
}
|
|
3439
3439
|
recordMeasuredHeight(e) {
|
|
3440
3440
|
this.data.showMarkup || (this._renderedHeight = e);
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
|
-
class Qt extends
|
|
3443
|
+
class Qt extends B {
|
|
3444
3444
|
constructor(e, t, s) {
|
|
3445
3445
|
const i = e.ast.ordered ? "ol" : "ul", o = s && s.element.tagName === i.toUpperCase(), r = o ? s.element : document.createElement(i);
|
|
3446
3446
|
o || (r.className = "md-block md-list");
|
|
@@ -3448,7 +3448,7 @@ class Qt extends R {
|
|
|
3448
3448
|
super(e, r, c);
|
|
3449
3449
|
}
|
|
3450
3450
|
}
|
|
3451
|
-
class Zt extends
|
|
3451
|
+
class Zt extends B {
|
|
3452
3452
|
constructor(e, t, s) {
|
|
3453
3453
|
const i = e.ast, o = document.createElement("li");
|
|
3454
3454
|
e.isActive && o.classList.add("md-list-item-active"), i.checked !== void 0 && o.classList.add("md-task-list-item"), e.isActive || o.classList.add("md-markers-hidden"), o.style.setProperty("--md-list-level", String(e.level));
|
|
@@ -3470,7 +3470,7 @@ class Zt extends R {
|
|
|
3470
3470
|
}
|
|
3471
3471
|
}
|
|
3472
3472
|
function to(n, e, t, s) {
|
|
3473
|
-
const { paired: i, unused: o } = Tt(e, t?.children ??
|
|
3473
|
+
const { paired: i, unused: o } = Tt(e, t?.children ?? F), r = e.map((d) => X(d, s, i.get(d)));
|
|
3474
3474
|
for (const d of o)
|
|
3475
3475
|
d.dispose();
|
|
3476
3476
|
if (!(e.length >= 2 && e[0].kind === "glue" && e[0].ast.glueKind === "indent" && e[1].kind === "marker" && e[1].ast.markerKind === "listItemMarker"))
|
|
@@ -3478,7 +3478,7 @@ function to(n, e, t, s) {
|
|
|
3478
3478
|
const a = n.firstElementChild, l = a && a.classList.contains("md-list-gutter") ? a : document.createElement("span");
|
|
3479
3479
|
return l.className = "md-list-gutter", me(l, [r[0].mountNode, r[1].mountNode]), me(n, [l, ...r.slice(2).map((d) => d.mountNode)]), r;
|
|
3480
3480
|
}
|
|
3481
|
-
class Jt extends
|
|
3481
|
+
class Jt extends B {
|
|
3482
3482
|
_table;
|
|
3483
3483
|
constructor(e, t, s) {
|
|
3484
3484
|
const i = s?.dom ?? document.createElement("div"), o = s?._table ?? document.createElement("table");
|
|
@@ -3493,7 +3493,7 @@ class Jt extends R {
|
|
|
3493
3493
|
return this.dom;
|
|
3494
3494
|
}
|
|
3495
3495
|
}
|
|
3496
|
-
class en extends
|
|
3496
|
+
class en extends B {
|
|
3497
3497
|
constructor(e, t, s) {
|
|
3498
3498
|
const i = s?.element ?? document.createElement("tr");
|
|
3499
3499
|
e.isDelimiter && i.classList.add("md-table-delimiter-row");
|
|
@@ -3503,13 +3503,13 @@ class en extends R {
|
|
|
3503
3503
|
}), super(e, i, o);
|
|
3504
3504
|
}
|
|
3505
3505
|
}
|
|
3506
|
-
class tn extends
|
|
3506
|
+
class tn extends B {
|
|
3507
3507
|
constructor(e, t, s) {
|
|
3508
3508
|
const i = s?.element ?? document.createElement("code"), o = Z(i, e.content, s?.children, Pn(t));
|
|
3509
3509
|
super(e, i, o);
|
|
3510
3510
|
}
|
|
3511
3511
|
}
|
|
3512
|
-
class nn extends
|
|
3512
|
+
class nn extends B {
|
|
3513
3513
|
constructor(e, t, s) {
|
|
3514
3514
|
if (e.showMarkup) {
|
|
3515
3515
|
const a = document.createElement("span");
|
|
@@ -3538,10 +3538,10 @@ class nn extends R {
|
|
|
3538
3538
|
} catch {
|
|
3539
3539
|
c.textContent = o;
|
|
3540
3540
|
}
|
|
3541
|
-
super(e, c,
|
|
3541
|
+
super(e, c, F);
|
|
3542
3542
|
}
|
|
3543
3543
|
}
|
|
3544
|
-
class sn extends
|
|
3544
|
+
class sn extends B {
|
|
3545
3545
|
constructor(e, t, s) {
|
|
3546
3546
|
const i = s?.element ?? document.createElement("a");
|
|
3547
3547
|
if (zn(e.ast.url) ? (i.href = e.ast.url, i.dataset.mdUrl = e.ast.url) : (i.removeAttribute("href"), delete i.dataset.mdUrl), !s) {
|
|
@@ -3572,7 +3572,7 @@ class sn extends R {
|
|
|
3572
3572
|
super(e, i, o);
|
|
3573
3573
|
}
|
|
3574
3574
|
}
|
|
3575
|
-
class on extends
|
|
3575
|
+
class on extends B {
|
|
3576
3576
|
constructor(e, t, s) {
|
|
3577
3577
|
const i = e.ast;
|
|
3578
3578
|
if (e.showMarkup) {
|
|
@@ -3583,7 +3583,7 @@ class on extends R {
|
|
|
3583
3583
|
return;
|
|
3584
3584
|
}
|
|
3585
3585
|
const o = document.createElement("img");
|
|
3586
|
-
zn(i.url) && (o.src = i.url), o.alt = i.alt, super(e, o,
|
|
3586
|
+
zn(i.url) && (o.src = i.url), o.alt = i.alt, super(e, o, F);
|
|
3587
3587
|
}
|
|
3588
3588
|
}
|
|
3589
3589
|
function Tt(n, e) {
|
|
@@ -3992,23 +3992,23 @@ function Le(n, e, t, s) {
|
|
|
3992
3992
|
// The trailing gap is revealed as `↵` glyphs by virtue of its `blockGap`
|
|
3993
3993
|
// kind (see `GlueViewNode`), so the break needs no inline-flow opt-in.
|
|
3994
3994
|
case "thematicBreak":
|
|
3995
|
-
return T(t, new Co(i, e.showMarkup,
|
|
3995
|
+
return T(t, new Co(i, e.showMarkup, K(i.children, e, t)));
|
|
3996
3996
|
case "unhandledBlock":
|
|
3997
|
-
return T(t, new Lo(i,
|
|
3997
|
+
return T(t, new Lo(i, K(i.children, e, t)));
|
|
3998
3998
|
case "marker":
|
|
3999
3999
|
return T(t, new So(i, Io(i.markerKind, e)));
|
|
4000
4000
|
case "glue":
|
|
4001
4001
|
return T(t, new qn(i, Ao(i.glueKind, e), e.inlineFlow ?? !1));
|
|
4002
4002
|
case "heading":
|
|
4003
|
-
return T(t, new oo(i,
|
|
4003
|
+
return T(t, new oo(i, K(i.children, ee(e), t)));
|
|
4004
4004
|
case "paragraph":
|
|
4005
|
-
return T(t, new ro(i,
|
|
4005
|
+
return T(t, new ro(i, K(i.children, ee(e), t)));
|
|
4006
4006
|
case "codeBlock":
|
|
4007
|
-
return T(t, new ao(i, e.showMarkup,
|
|
4007
|
+
return T(t, new ao(i, e.showMarkup, K(i.children, e, t)));
|
|
4008
4008
|
case "mathBlock":
|
|
4009
|
-
return T(t, new lo(i, e.showMarkup,
|
|
4009
|
+
return T(t, new lo(i, e.showMarkup, K(i.children, e, t)));
|
|
4010
4010
|
case "blockQuote":
|
|
4011
|
-
return T(t, new ho(i,
|
|
4011
|
+
return T(t, new ho(i, K(i.children, e, t)));
|
|
4012
4012
|
case "list":
|
|
4013
4013
|
return T(t, Do(i, e, t));
|
|
4014
4014
|
case "listItem":
|
|
@@ -4020,19 +4020,19 @@ function Le(n, e, t, s) {
|
|
|
4020
4020
|
case "tableCell":
|
|
4021
4021
|
return T(t, Jn(i, e.showMarkup, e.showTableGlue, e.selectionInNode, t));
|
|
4022
4022
|
case "strong":
|
|
4023
|
-
return T(t, new mo(i,
|
|
4023
|
+
return T(t, new mo(i, K(i.children, ee(e), t)));
|
|
4024
4024
|
case "emphasis":
|
|
4025
|
-
return T(t, new go(i,
|
|
4025
|
+
return T(t, new go(i, K(i.children, ee(e), t)));
|
|
4026
4026
|
case "strikethrough":
|
|
4027
|
-
return T(t, new po(i,
|
|
4027
|
+
return T(t, new po(i, K(i.children, ee(e), t)));
|
|
4028
4028
|
case "inlineCode":
|
|
4029
|
-
return T(t, new _o(i,
|
|
4029
|
+
return T(t, new _o(i, K(i.children, ee(e), t)));
|
|
4030
4030
|
case "inlineMath":
|
|
4031
|
-
return T(t, new vo(i, e.showMarkup,
|
|
4031
|
+
return T(t, new vo(i, e.showMarkup, K(i.children, ee(e), t)));
|
|
4032
4032
|
case "link":
|
|
4033
|
-
return T(t, new wo(i,
|
|
4033
|
+
return T(t, new wo(i, K(i.children, ee(e), t)));
|
|
4034
4034
|
case "image":
|
|
4035
|
-
return T(t, new ko(i, e.showMarkup,
|
|
4035
|
+
return T(t, new ko(i, e.showMarkup, K(i.children, ee(e), t)));
|
|
4036
4036
|
case "document":
|
|
4037
4037
|
return jn(i, /* @__PURE__ */ new Set(), v.ofLength(0), void 0);
|
|
4038
4038
|
}
|
|
@@ -4087,7 +4087,7 @@ function Bo(n, e) {
|
|
|
4087
4087
|
return !0;
|
|
4088
4088
|
}
|
|
4089
4089
|
}
|
|
4090
|
-
function
|
|
4090
|
+
function K(n, e, t) {
|
|
4091
4091
|
const s = Ae(t);
|
|
4092
4092
|
return n.map((i, o) => {
|
|
4093
4093
|
const r = i.kind === "text" ? {
|
|
@@ -4183,7 +4183,7 @@ function Zn(n, e, t, s) {
|
|
|
4183
4183
|
}
|
|
4184
4184
|
function Jn(n, e, t, s, i) {
|
|
4185
4185
|
const o = { showMarkup: e, showTableGlue: t, selectionInNode: s };
|
|
4186
|
-
return new yo(n, e, t,
|
|
4186
|
+
return new yo(n, e, t, K(n.children, ee(o), i));
|
|
4187
4187
|
}
|
|
4188
4188
|
const Ye = /* @__PURE__ */ new Set();
|
|
4189
4189
|
function Vo(n, e) {
|
|
@@ -4329,7 +4329,7 @@ class zo extends U {
|
|
|
4329
4329
|
super(), this.element = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.element.setAttribute("class", "md-selection-layer"), this._path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this._path.setAttribute("class", "md-selection-path"), this.element.appendChild(this._path), this.rendering = $(this, (t) => {
|
|
4330
4330
|
const s = t.readObservable(e.selection), i = t.readObservable(e.visualLineMap), o = t.readObservable(e.blocks);
|
|
4331
4331
|
return Go(this._path, s, i, o);
|
|
4332
|
-
}), this._register(
|
|
4332
|
+
}), this._register(H((t) => {
|
|
4333
4333
|
t.readObservable(this.rendering);
|
|
4334
4334
|
}));
|
|
4335
4335
|
}
|
|
@@ -4515,9 +4515,9 @@ class Qo extends U {
|
|
|
4515
4515
|
return this.element.style.display = "none", new Ke(i ?? 0, !1, P.EMPTY);
|
|
4516
4516
|
const r = o.lineIndexOfOffset(i), c = o.lineRect(r).withZeroWidthAt(o.xAtOffset(i)), a = e.blocks ? t.readObservable(e.blocks) : void 0, l = a ? ts(Uo(a, i)) : void 0;
|
|
4517
4517
|
return l && (c.x < l.left - 0.5 || c.x > l.right + 0.5) ? (this.element.style.display = "none", new Ke(i, !1, P.EMPTY)) : (this.element.style.left = `${c.x}px`, this.element.style.top = `${c.y}px`, this.element.style.height = `${c.height}px`, this.element.style.display = "", new Ke(i, !0, c));
|
|
4518
|
-
}), this._register(
|
|
4518
|
+
}), this._register(H((t) => {
|
|
4519
4519
|
t.readObservable(this.rendering);
|
|
4520
|
-
})), this._register(
|
|
4520
|
+
})), this._register(H((t) => {
|
|
4521
4521
|
t.readObservable(e.offset), this.element.style.animation = "none", this.element.offsetWidth, this.element.style.animation = "";
|
|
4522
4522
|
}));
|
|
4523
4523
|
}
|
|
@@ -4534,7 +4534,7 @@ class Zo extends U {
|
|
|
4534
4534
|
super(), this.element = document.createElement("div"), this.element.className = "md-gutter-layer", this.rendering = $(this, (t) => {
|
|
4535
4535
|
const s = t.readObservable(e.markers), i = t.readObservable(e.visualLineMap);
|
|
4536
4536
|
return this._render(s, i);
|
|
4537
|
-
}), this._register(
|
|
4537
|
+
}), this._register(H((t) => {
|
|
4538
4538
|
t.readObservable(this.rendering);
|
|
4539
4539
|
}));
|
|
4540
4540
|
}
|
|
@@ -4578,12 +4578,15 @@ function tr(n) {
|
|
|
4578
4578
|
s.sourceStart < e && (e = s.sourceStart), s.sourceEndExclusive > t && (t = s.sourceEndExclusive);
|
|
4579
4579
|
return v.fromTo(e, t);
|
|
4580
4580
|
}
|
|
4581
|
-
|
|
4582
|
-
|
|
4581
|
+
function nr(n) {
|
|
4582
|
+
return n.windowHasFocus && n.focusIsUnclaimed;
|
|
4583
|
+
}
|
|
4584
|
+
const sr = 900;
|
|
4585
|
+
class pc extends U {
|
|
4583
4586
|
constructor(e, t) {
|
|
4584
4587
|
super(), this._model = e, this._options = t, this.element = document.createElement("div"), this.element.className = "md-editor", this._options?.classNames && this.element.classList.add(...this._options.classNames), this.element.tabIndex = 0, this._contentContainer = document.createElement("div"), this._contentContainer.className = "md-editor-content", this.element.appendChild(this._contentContainer);
|
|
4585
|
-
const s = this._options?.limitedWidth ?? cs(
|
|
4586
|
-
this._register(
|
|
4588
|
+
const s = this._options?.limitedWidth ?? cs(sr);
|
|
4589
|
+
this._register(H((a) => {
|
|
4587
4590
|
const l = s.read(a);
|
|
4588
4591
|
this._contentContainer.style.maxWidth = l === void 0 ? "" : `${l}px`;
|
|
4589
4592
|
})), this.measuredLayout = new ci();
|
|
@@ -4621,14 +4624,14 @@ class gc extends U {
|
|
|
4621
4624
|
})), this._contentContainer.appendChild(this._cursorView.element), this._gutterMarkersView = this._register(new Zo({
|
|
4622
4625
|
markers: this._model.gutterMarkers,
|
|
4623
4626
|
visualLineMap: this.measuredLayout.visualLineMap
|
|
4624
|
-
})), this._contentContainer.appendChild(this._gutterMarkersView.element), this._diffHighlightsView = this._register(new Wo(this._contentContainer, this.coordinateSpace)), this._contentContainer.appendChild(this._diffHighlightsView.element), this._register(
|
|
4627
|
+
})), this._contentContainer.appendChild(this._gutterMarkersView.element), this._diffHighlightsView = this._register(new Wo(this._contentContainer, this.coordinateSpace)), this._contentContainer.appendChild(this._diffHighlightsView.element), this._register(H((a) => {
|
|
4625
4628
|
const l = this._model.readonlyMode.read(a);
|
|
4626
4629
|
this.element.classList.toggle("md-readonly", l), l || this.element.classList.remove("md-readonly-editing-attempt");
|
|
4627
4630
|
})), this._options?.showReadonlyToggle !== !1 && this._setupReadonlyToggle(), this.editContext = new EditContext({
|
|
4628
4631
|
text: this._model.sourceText.get().value,
|
|
4629
4632
|
selectionStart: 0,
|
|
4630
4633
|
selectionEnd: 0
|
|
4631
|
-
}), this.element.editContext = this.editContext, this._register(
|
|
4634
|
+
}), this.element.editContext = this.editContext, this._register(H(this._renderAutorun)), this._setupModifierTracking(), this._setupFocusTracking(), this._register(H((a) => {
|
|
4632
4635
|
const l = a.readObservable(this._model.selection)?.range;
|
|
4633
4636
|
this.editContext.updateSelection(l?.start ?? 0, l?.endExclusive ?? 0);
|
|
4634
4637
|
})), this._register({ dispose: () => {
|
|
@@ -4657,7 +4660,7 @@ class gc extends U {
|
|
|
4657
4660
|
* immutable node for the next. Never used for source-of-truth lookups
|
|
4658
4661
|
* (those go through the measured-layout model).
|
|
4659
4662
|
*/
|
|
4660
|
-
_document =
|
|
4663
|
+
_document = R(this, void 0);
|
|
4661
4664
|
/** The current view-node tree (AST overlaid with rendered DOM), for debugging. */
|
|
4662
4665
|
get documentViewNode() {
|
|
4663
4666
|
return this._document;
|
|
@@ -4670,17 +4673,29 @@ class gc extends U {
|
|
|
4670
4673
|
*/
|
|
4671
4674
|
_previousViewData;
|
|
4672
4675
|
/** The current view-data tree (AST overlaid with selection flags), for debugging. */
|
|
4673
|
-
_viewData =
|
|
4676
|
+
_viewData = R(this, void 0);
|
|
4674
4677
|
get viewData() {
|
|
4675
4678
|
return this._viewData;
|
|
4676
4679
|
}
|
|
4680
|
+
/**
|
|
4681
|
+
* Whether the editor is genuinely focused: focus rests somewhere inside the
|
|
4682
|
+
* editor subtree *and* its window is focused. Mirrored onto the root as
|
|
4683
|
+
* `.md-focused`, which gates the painted caret — the blinking cursor is only
|
|
4684
|
+
* shown while this is `true`, so it never blinks in an unfocused editor or
|
|
4685
|
+
* after the window loses focus. Only the caret's visibility is affected; the
|
|
4686
|
+
* logical selection and caret geometry ({@link caretRect}) are unchanged.
|
|
4687
|
+
*/
|
|
4688
|
+
_focused = R(this, !1);
|
|
4689
|
+
get focused() {
|
|
4690
|
+
return this._focused;
|
|
4691
|
+
}
|
|
4677
4692
|
/**
|
|
4678
4693
|
* Caret rect (editor-local coordinates) for the transient empty paragraph, or
|
|
4679
4694
|
* `undefined` when none is armed. Set each frame from the synthetic
|
|
4680
4695
|
* paragraph element's geometry and fed to the {@link CursorView}, which has
|
|
4681
4696
|
* no visual-line-map entry to place the caret from otherwise.
|
|
4682
4697
|
*/
|
|
4683
|
-
_pendingCaretRect =
|
|
4698
|
+
_pendingCaretRect = R(this, void 0);
|
|
4684
4699
|
/**
|
|
4685
4700
|
* The block cache projected for views (selection painting) that need to
|
|
4686
4701
|
* react to mount/unmount. Derived from {@link _document}, so it stays in
|
|
@@ -4734,10 +4749,34 @@ class gc extends U {
|
|
|
4734
4749
|
* a plain click, but an active link only opens with the modifier held.
|
|
4735
4750
|
*/
|
|
4736
4751
|
_setupModifierTracking() {
|
|
4737
|
-
this._register(
|
|
4752
|
+
this._register(H((e) => {
|
|
4738
4753
|
this.element.classList.toggle("md-mod-down", this._model.ctrlOrMetaDown.read(e));
|
|
4739
4754
|
}));
|
|
4740
4755
|
}
|
|
4756
|
+
/**
|
|
4757
|
+
* Tracks whether the editor is genuinely focused and mirrors it onto the
|
|
4758
|
+
* root as `.md-focused` so CSS can gate the painted caret. "Focused" means
|
|
4759
|
+
* focus rests somewhere inside the editor subtree *and* the window itself is
|
|
4760
|
+
* focused; either condition failing (focus moving elsewhere, or the window
|
|
4761
|
+
* losing focus) hides the blinking caret while leaving the logical selection
|
|
4762
|
+
* and caret geometry intact.
|
|
4763
|
+
*/
|
|
4764
|
+
_setupFocusTracking() {
|
|
4765
|
+
const e = this.element, t = e.ownerDocument.defaultView ?? window, s = () => {
|
|
4766
|
+
const l = e.ownerDocument.activeElement;
|
|
4767
|
+
return l !== null && e.contains(l);
|
|
4768
|
+
}, i = (l) => this._focused.set(l, void 0), o = () => i(!0), r = (l) => {
|
|
4769
|
+
const d = l.relatedTarget;
|
|
4770
|
+
i(d instanceof Node && e.contains(d));
|
|
4771
|
+
}, c = () => i(!1), a = () => i(s());
|
|
4772
|
+
e.addEventListener("focusin", o), e.addEventListener("focusout", r), t.addEventListener("blur", c), t.addEventListener("focus", a), this._register({
|
|
4773
|
+
dispose: () => {
|
|
4774
|
+
e.removeEventListener("focusin", o), e.removeEventListener("focusout", r), t.removeEventListener("blur", c), t.removeEventListener("focus", a);
|
|
4775
|
+
}
|
|
4776
|
+
}), this._register(H((l) => {
|
|
4777
|
+
this.element.classList.toggle("md-focused", this._focused.read(l));
|
|
4778
|
+
}));
|
|
4779
|
+
}
|
|
4741
4780
|
/**
|
|
4742
4781
|
* Renders the edit/read-only mode toggle. It flips the model's
|
|
4743
4782
|
* {@link EditorModel.readonlyMode}: when locked (read-only) every block stays
|
|
@@ -4782,7 +4821,7 @@ class gc extends U {
|
|
|
4782
4821
|
dispose: () => {
|
|
4783
4822
|
t.removeEventListener("pointerdown", d), t.removeEventListener("keydown", u), t.removeEventListener("focus", h), t.removeEventListener("blur", f), t.removeEventListener("animationend", m), t.removeEventListener("click", l), this._readonlyToggleButton === t && (this._readonlyToggleButton = void 0), this.element.editContext === null && (this.element.editContext = this.editContext);
|
|
4784
4823
|
}
|
|
4785
|
-
}), this._register(
|
|
4824
|
+
}), this._register(H((g) => {
|
|
4786
4825
|
const _ = this._model.readonlyMode.read(g);
|
|
4787
4826
|
t.classList.toggle("md-readonly-toggle-locked", _), t.setAttribute("aria-pressed", String(_)), t.setAttribute("aria-label", _ ? "Locked; switch to editing" : "Editing; switch to locked mode"), t.title = _ ? "Read-only: markers hidden, editing disabled. Click to edit." : "Editing: click to lock (hide markers, disable editing).", _ || t.classList.remove("md-readonly-toggle-shine");
|
|
4788
4827
|
})), this._contentContainer.insertBefore(e, this._contentContainer.firstChild);
|
|
@@ -4801,6 +4840,20 @@ class gc extends U {
|
|
|
4801
4840
|
focus() {
|
|
4802
4841
|
this.element.focus({ preventScroll: !0 });
|
|
4803
4842
|
}
|
|
4843
|
+
/**
|
|
4844
|
+
* Focuses the editor when it opens, but only if doing so will not steal
|
|
4845
|
+
* focus from an explicit user target: the window must already be focused and
|
|
4846
|
+
* no other element may have claimed focus yet. Returns whether focus was
|
|
4847
|
+
* taken. Intended for the single editable editor on open; a no-op for a
|
|
4848
|
+
* background window or when the user has already focused something else.
|
|
4849
|
+
*/
|
|
4850
|
+
tryAutoFocus() {
|
|
4851
|
+
const e = this.element.ownerDocument, t = e.activeElement, s = {
|
|
4852
|
+
windowHasFocus: e.hasFocus(),
|
|
4853
|
+
focusIsUnclaimed: t === null || t === e.body
|
|
4854
|
+
};
|
|
4855
|
+
return nr(s) ? (this.focus(), !0) : !1;
|
|
4856
|
+
}
|
|
4804
4857
|
/**
|
|
4805
4858
|
* Own point→offset resolution. When `true` (the default),
|
|
4806
4859
|
* {@link resolveOffsetFromPoint} ignores the platform DOM hit-test
|
|
@@ -4813,7 +4866,7 @@ class gc extends U {
|
|
|
4813
4866
|
* (e.g. the pointer leaving the window), which the platform hit-test cannot
|
|
4814
4867
|
* resolve. Set to `false` to fall back to the platform DOM hit-test.
|
|
4815
4868
|
*/
|
|
4816
|
-
geometricHitTest =
|
|
4869
|
+
geometricHitTest = R(this, !0);
|
|
4817
4870
|
/**
|
|
4818
4871
|
* Client coordinates → absolute source offset (any block). Used during
|
|
4819
4872
|
* drag to keep extending the selection even when the pointer leaves the
|
|
@@ -4971,7 +5024,7 @@ class gc extends U {
|
|
|
4971
5024
|
this._diffHighlightsView.clear();
|
|
4972
5025
|
}
|
|
4973
5026
|
}
|
|
4974
|
-
class
|
|
5027
|
+
class ir {
|
|
4975
5028
|
connect(e) {
|
|
4976
5029
|
const t = (r) => {
|
|
4977
5030
|
const c = e.getSelectedText();
|
|
@@ -4991,7 +5044,7 @@ class sr {
|
|
|
4991
5044
|
};
|
|
4992
5045
|
}
|
|
4993
5046
|
}
|
|
4994
|
-
class
|
|
5047
|
+
class _c {
|
|
4995
5048
|
constructor(e = navigator.clipboard) {
|
|
4996
5049
|
this._clipboard = e;
|
|
4997
5050
|
}
|
|
@@ -5094,7 +5147,7 @@ const S = ["macos"], j = ["windows", "linux"], y = (n, e = !1) => ({
|
|
|
5094
5147
|
p("Enter", We("insertHardLineBreak"), { shift: !0 }),
|
|
5095
5148
|
p("Enter", We("insertParagraph"), { ctrl: !0 })
|
|
5096
5149
|
]
|
|
5097
|
-
},
|
|
5150
|
+
}, or = /* @__PURE__ */ new Set([
|
|
5098
5151
|
"ArrowLeft",
|
|
5099
5152
|
"ArrowRight",
|
|
5100
5153
|
"ArrowUp",
|
|
@@ -5102,13 +5155,13 @@ const S = ["macos"], j = ["windows", "linux"], y = (n, e = !1) => ({
|
|
|
5102
5155
|
"Home",
|
|
5103
5156
|
"End"
|
|
5104
5157
|
]);
|
|
5105
|
-
function or(n) {
|
|
5106
|
-
return ir.has(n);
|
|
5107
|
-
}
|
|
5108
5158
|
function rr(n) {
|
|
5109
|
-
return
|
|
5159
|
+
return or.has(n);
|
|
5110
5160
|
}
|
|
5111
5161
|
function cr(n) {
|
|
5162
|
+
return n.includes("Macintosh") || n.includes("Mac OS X") ? "macos" : n.includes("Windows") ? "windows" : "linux";
|
|
5163
|
+
}
|
|
5164
|
+
function ar(n) {
|
|
5112
5165
|
return {
|
|
5113
5166
|
key: n.key,
|
|
5114
5167
|
code: n.code,
|
|
@@ -5119,26 +5172,26 @@ function cr(n) {
|
|
|
5119
5172
|
altGraphKey: n.getModifierState("AltGraph")
|
|
5120
5173
|
};
|
|
5121
5174
|
}
|
|
5122
|
-
function
|
|
5175
|
+
function lr(n, e, t = ss) {
|
|
5123
5176
|
if (n.altGraphKey)
|
|
5124
5177
|
return;
|
|
5125
|
-
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 :
|
|
5178
|
+
const s = n.key.length === 1 ? n.key.toLowerCase() : n.key, i = /^[a-z]$/.test(s) ? void 0 : dr(n.code);
|
|
5126
5179
|
for (const o of t.bindings)
|
|
5127
|
-
if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) &&
|
|
5180
|
+
if ((o.key === s || o.key === i) && (!o.platforms || o.platforms.includes(e)) && hr(n, o.modifiers))
|
|
5128
5181
|
return o.action;
|
|
5129
5182
|
}
|
|
5130
|
-
function
|
|
5183
|
+
function dr(n) {
|
|
5131
5184
|
return /^Key([A-Z])$/.exec(n)?.[1].toLowerCase();
|
|
5132
5185
|
}
|
|
5133
|
-
function
|
|
5186
|
+
function hr(n, e = {}) {
|
|
5134
5187
|
return n.shiftKey === !!e.shift && n.altKey === !!e.alt && n.ctrlKey === !!e.ctrl && n.metaKey === !!e.meta;
|
|
5135
5188
|
}
|
|
5136
|
-
const
|
|
5137
|
-
class
|
|
5189
|
+
const ur = 500, dn = 5;
|
|
5190
|
+
class vc extends U {
|
|
5138
5191
|
constructor(e, t, s) {
|
|
5139
5192
|
super(), this._model = e, this._view = t;
|
|
5140
5193
|
const i = this._view.element, o = i.ownerDocument.defaultView ?? window;
|
|
5141
|
-
this._keyboardPlatform = s?.keyboardPlatform ??
|
|
5194
|
+
this._keyboardPlatform = s?.keyboardPlatform ?? cr(o.navigator.userAgent), this._keyboardProfile = s?.keyboardProfile ?? ss, i.addEventListener("pointerdown", this._handlePointerDown), i.addEventListener("keydown", this._handleKeyDown), this._register({
|
|
5142
5195
|
dispose: () => {
|
|
5143
5196
|
i.removeEventListener("pointerdown", this._handlePointerDown), i.removeEventListener("keydown", this._handleKeyDown);
|
|
5144
5197
|
}
|
|
@@ -5147,7 +5200,7 @@ class _c extends U {
|
|
|
5147
5200
|
o.removeEventListener("keydown", this._updateModifierState), o.removeEventListener("keyup", this._updateModifierState), o.removeEventListener("blur", this._clearModifierState), i.ownerDocument.removeEventListener("selectionchange", this._discardNativeSelection);
|
|
5148
5201
|
}
|
|
5149
5202
|
});
|
|
5150
|
-
const r = s?.clipboardStrategy ?? new
|
|
5203
|
+
const r = s?.clipboardStrategy ?? new ir();
|
|
5151
5204
|
this._register(r.connect({
|
|
5152
5205
|
element: i,
|
|
5153
5206
|
getSelectedText: () => this._selectedText(),
|
|
@@ -5187,7 +5240,7 @@ class _c extends U {
|
|
|
5187
5240
|
if (e.button !== 0)
|
|
5188
5241
|
return;
|
|
5189
5242
|
e.preventDefault(), this._model.cancelPendingParagraph(), this._view.focus(), this._desiredColumn = void 0;
|
|
5190
|
-
const t = new de(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time <
|
|
5243
|
+
const t = new de(e.clientX, e.clientY), s = this._lastPointerDown, i = s !== void 0 && e.timeStamp - s.time < ur && Math.abs(t.x - s.point.x) < dn && Math.abs(t.y - s.point.y) < dn;
|
|
5191
5244
|
if (this._clickCount = i ? this._clickCount + 1 : 1, this._lastPointerDown = { time: e.timeStamp, point: t }, !this._view.isPointInContent(t)) {
|
|
5192
5245
|
this._model.selection.set(void 0, void 0);
|
|
5193
5246
|
return;
|
|
@@ -5199,7 +5252,7 @@ class _c extends U {
|
|
|
5199
5252
|
return;
|
|
5200
5253
|
}
|
|
5201
5254
|
if (this._clickCount === 3) {
|
|
5202
|
-
const u =
|
|
5255
|
+
const u = mr(this._model.document.get(), o);
|
|
5203
5256
|
u && this._model.selection.set(zi(this._makeCursorContext(), u), void 0);
|
|
5204
5257
|
return;
|
|
5205
5258
|
}
|
|
@@ -5304,19 +5357,19 @@ class _c extends U {
|
|
|
5304
5357
|
!t || t.rangeCount === 0 || t.isCollapsed || !this._view.containsRenderedContent(t.anchorNode) && !this._view.containsRenderedContent(t.focusNode) || t.removeAllRanges();
|
|
5305
5358
|
};
|
|
5306
5359
|
_handleKeyDown = (e) => {
|
|
5307
|
-
if (e.isComposing ||
|
|
5360
|
+
if (e.isComposing || fr(e, this._view.element))
|
|
5308
5361
|
return;
|
|
5309
5362
|
if (this._updateModifierState(e), this._model.pendingParagraph.get() !== void 0 && (e.key === "Backspace" || e.key === "Escape")) {
|
|
5310
5363
|
hn(e), this._model.cancelPendingParagraph();
|
|
5311
5364
|
return;
|
|
5312
5365
|
}
|
|
5313
|
-
const t =
|
|
5314
|
-
|
|
5366
|
+
const t = lr(
|
|
5367
|
+
ar(e),
|
|
5315
5368
|
this._keyboardPlatform,
|
|
5316
5369
|
this._keyboardProfile
|
|
5317
5370
|
);
|
|
5318
5371
|
if (!t) {
|
|
5319
|
-
|
|
5372
|
+
rr(e.key) && e.preventDefault();
|
|
5320
5373
|
return;
|
|
5321
5374
|
}
|
|
5322
5375
|
hn(e), this._model.pendingParagraph.get() !== void 0 && t.kind !== "enter" && this._model.cancelPendingParagraph(), this._executeKeyboardAction(t);
|
|
@@ -5439,10 +5492,10 @@ function ze(n) {
|
|
|
5439
5492
|
function hn(n) {
|
|
5440
5493
|
n.preventDefault(), n.stopPropagation();
|
|
5441
5494
|
}
|
|
5442
|
-
function
|
|
5495
|
+
function fr(n, e) {
|
|
5443
5496
|
return n.target !== e;
|
|
5444
5497
|
}
|
|
5445
|
-
function
|
|
5498
|
+
function mr(n, e) {
|
|
5446
5499
|
const t = new Set(n.blocks);
|
|
5447
5500
|
let s = 0;
|
|
5448
5501
|
for (const i of n.children) {
|
|
@@ -5455,7 +5508,7 @@ function fr(n, e) {
|
|
|
5455
5508
|
}
|
|
5456
5509
|
}
|
|
5457
5510
|
const un = "md-debug-show-line-rects";
|
|
5458
|
-
function
|
|
5511
|
+
function gr(n, e) {
|
|
5459
5512
|
try {
|
|
5460
5513
|
const t = localStorage.getItem(n);
|
|
5461
5514
|
return t === null ? e : t === "true";
|
|
@@ -5463,20 +5516,20 @@ function mr(n, e) {
|
|
|
5463
5516
|
return e;
|
|
5464
5517
|
}
|
|
5465
5518
|
}
|
|
5466
|
-
function
|
|
5519
|
+
function pr(n, e) {
|
|
5467
5520
|
try {
|
|
5468
5521
|
localStorage.setItem(n, String(e));
|
|
5469
5522
|
} catch {
|
|
5470
5523
|
}
|
|
5471
5524
|
}
|
|
5472
|
-
class
|
|
5525
|
+
class wc extends U {
|
|
5473
5526
|
overlayElement;
|
|
5474
5527
|
infoElement;
|
|
5475
5528
|
rendering;
|
|
5476
5529
|
/** Absolute source offsets that map to a rendered DOM character. */
|
|
5477
5530
|
mappedOffsets;
|
|
5478
5531
|
/** Whether the dashed line-bands and run boxes are drawn (persisted). */
|
|
5479
|
-
_showLineRects =
|
|
5532
|
+
_showLineRects = R(this, gr(un, !0));
|
|
5480
5533
|
constructor(e, t) {
|
|
5481
5534
|
super(), this.overlayElement = document.createElement("div"), this.overlayElement.className = "md-debug-layout-overlay", Object.assign(this.overlayElement.style, {
|
|
5482
5535
|
position: "absolute",
|
|
@@ -5505,12 +5558,12 @@ class vc extends U {
|
|
|
5505
5558
|
});
|
|
5506
5559
|
const i = document.createElement("input");
|
|
5507
5560
|
i.type = "checkbox", i.checked = this._showLineRects.get(), i.addEventListener("change", () => {
|
|
5508
|
-
this._showLineRects.set(i.checked, void 0),
|
|
5561
|
+
this._showLineRects.set(i.checked, void 0), pr(un, i.checked);
|
|
5509
5562
|
}), s.appendChild(i), s.appendChild(document.createTextNode("show line rects")), this.infoElement.appendChild(s);
|
|
5510
5563
|
const o = document.createElement("pre");
|
|
5511
5564
|
o.style.margin = "0", o.style.whiteSpace = "pre", this.infoElement.appendChild(o), this.rendering = $(this, (r) => {
|
|
5512
5565
|
const c = r.readObservable(t.model.measurements), a = r.readObservable(this._showLineRects);
|
|
5513
|
-
return
|
|
5566
|
+
return vr(
|
|
5514
5567
|
this.overlayElement,
|
|
5515
5568
|
o,
|
|
5516
5569
|
c,
|
|
@@ -5519,19 +5572,19 @@ class vc extends U {
|
|
|
5519
5572
|
t.colorForOffset,
|
|
5520
5573
|
t.hoveredOffset
|
|
5521
5574
|
);
|
|
5522
|
-
}), this.mappedOffsets = $(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register(
|
|
5575
|
+
}), this.mappedOffsets = $(this, (r) => r.readObservable(this.rendering).mappedOffsets), this._register(H((r) => {
|
|
5523
5576
|
r.readObservable(this.rendering);
|
|
5524
5577
|
const c = t.hoveredOffset ? r.readObservable(t.hoveredOffset) : void 0;
|
|
5525
|
-
t.hoveredOffset &&
|
|
5578
|
+
t.hoveredOffset && kr(this.overlayElement, c);
|
|
5526
5579
|
}));
|
|
5527
5580
|
}
|
|
5528
5581
|
}
|
|
5529
|
-
class
|
|
5582
|
+
class _r {
|
|
5530
5583
|
constructor(e, t, s, i) {
|
|
5531
5584
|
this.blockCount = e, this.mountedCount = t, this.lineCount = s, this.mappedOffsets = i;
|
|
5532
5585
|
}
|
|
5533
5586
|
}
|
|
5534
|
-
function
|
|
5587
|
+
function vr(n, e, t, s, i, o, r) {
|
|
5535
5588
|
n.textContent = "";
|
|
5536
5589
|
const c = s.capture();
|
|
5537
5590
|
let a = 0, l = 0, d = 0;
|
|
@@ -5563,16 +5616,16 @@ function _r(n, e, t, s, i, o, r) {
|
|
|
5563
5616
|
}), n.appendChild(M);
|
|
5564
5617
|
}
|
|
5565
5618
|
}
|
|
5566
|
-
g.viewNode && (d +=
|
|
5619
|
+
g.viewNode && (d += wr(n, c, g.viewNode, g.absoluteStart, u, o, r));
|
|
5567
5620
|
}
|
|
5568
5621
|
const h = `blocks: ${t.length} mounted: ${a} lines: ${l} chars: ${d}`, f = t.map((m, g) => {
|
|
5569
5622
|
const _ = m.isMeasured ? "M" : "e", k = m.visualLineMap?.lines.length ?? 0;
|
|
5570
5623
|
return `${String(g).padStart(2)} ${_} start=${String(m.absoluteStart).padStart(4)} h=${m.height.toFixed(1).padStart(6)} lines=${k} kind=${m.block.kind}`;
|
|
5571
5624
|
});
|
|
5572
5625
|
return e.textContent = [h, ...f].join(`
|
|
5573
|
-
`), new
|
|
5626
|
+
`), new _r(t.length, a, l, u);
|
|
5574
5627
|
}
|
|
5575
|
-
function
|
|
5628
|
+
function wr(n, e, t, s, i, o, r) {
|
|
5576
5629
|
let c = 0;
|
|
5577
5630
|
const a = document.createRange(), l = s + t.sourceLength, d = [];
|
|
5578
5631
|
t.forEachTextLeaf(s, (h, f) => {
|
|
@@ -5605,7 +5658,7 @@ function vr(n, e, t, s, i, o, r) {
|
|
|
5605
5658
|
}
|
|
5606
5659
|
return c;
|
|
5607
5660
|
}
|
|
5608
|
-
function
|
|
5661
|
+
function kr(n, e) {
|
|
5609
5662
|
for (const t of Array.from(n.children)) {
|
|
5610
5663
|
if (!t.style)
|
|
5611
5664
|
continue;
|
|
@@ -5622,7 +5675,7 @@ class Ne {
|
|
|
5622
5675
|
this.length = e, this.className = t;
|
|
5623
5676
|
}
|
|
5624
5677
|
}
|
|
5625
|
-
class
|
|
5678
|
+
class br {
|
|
5626
5679
|
/**
|
|
5627
5680
|
* @param _monaco The Monarch runtime ({@link IMonarchApi}), injected so this
|
|
5628
5681
|
* package depends on `monaco-editor` for types only.
|
|
@@ -5633,7 +5686,7 @@ class kr {
|
|
|
5633
5686
|
}
|
|
5634
5687
|
_tokenizers = /* @__PURE__ */ new Map();
|
|
5635
5688
|
create(e, t) {
|
|
5636
|
-
return new
|
|
5689
|
+
return new xr(this._tokenizerFor(e), t);
|
|
5637
5690
|
}
|
|
5638
5691
|
dispose() {
|
|
5639
5692
|
for (const e of this._tokenizers.values())
|
|
@@ -5645,13 +5698,13 @@ class kr {
|
|
|
5645
5698
|
if (t === void 0)
|
|
5646
5699
|
return;
|
|
5647
5700
|
let s = this._tokenizers.get(e);
|
|
5648
|
-
return s || (s = new this._monaco.MonarchTokenizer(
|
|
5701
|
+
return s || (s = new this._monaco.MonarchTokenizer(Lr, Sr, e, this._monaco.compile(e, t), Or), this._tokenizers.set(e, s)), s;
|
|
5649
5702
|
}
|
|
5650
5703
|
}
|
|
5651
|
-
class
|
|
5704
|
+
class xr {
|
|
5652
5705
|
constructor(e, t) {
|
|
5653
5706
|
this._tokenizer = e, this._initialState = e?.getInitialState(), this._text = t, this._lines = this._tokenizeFrom(0, [], this._initialState, t.split(`
|
|
5654
|
-
`)), this._lineStarts = this._computeLineStarts(), this._snapshotObs =
|
|
5707
|
+
`)), this._lineStarts = this._computeLineStarts(), this._snapshotObs = R("syntaxSnapshot", new mn(this, this._version));
|
|
5655
5708
|
}
|
|
5656
5709
|
_text;
|
|
5657
5710
|
_lines;
|
|
@@ -5672,7 +5725,7 @@ class br {
|
|
|
5672
5725
|
const s = gn(this._lines), i = e.apply(this._text), o = e.replacements[0].replaceRange.start, r = this._lineIndexAt(o), c = this._lines.slice(0, r), a = r === 0 ? this._initialState : this._lines[r - 1].endState;
|
|
5673
5726
|
this._text = i, this._lines = this._tokenizeFrom(r, c, a, i.split(`
|
|
5674
5727
|
`)), this._lineStarts = this._computeLineStarts(), this._version++;
|
|
5675
|
-
const l =
|
|
5728
|
+
const l = Cr(s, gn(this._lines));
|
|
5676
5729
|
this._snapshotObs.set(new mn(this, this._version), t, l);
|
|
5677
5730
|
}
|
|
5678
5731
|
dispose() {
|
|
@@ -5690,7 +5743,7 @@ class br {
|
|
|
5690
5743
|
const a = i[c], l = c < i.length - 1;
|
|
5691
5744
|
if (this._tokenizer && r) {
|
|
5692
5745
|
const d = this._tokenizer.tokenize(a, l, r);
|
|
5693
|
-
o.push({ text: a, tokens:
|
|
5746
|
+
o.push({ text: a, tokens: Er(d.tokens, a.length), endState: d.endState }), r = d.endState;
|
|
5694
5747
|
} else
|
|
5695
5748
|
o.push({ text: a, tokens: a.length === 0 ? [] : [new Ne(a.length, void 0)], endState: r });
|
|
5696
5749
|
}
|
|
@@ -5735,16 +5788,16 @@ class mn {
|
|
|
5735
5788
|
return this._doc._getTokens(this._version, e);
|
|
5736
5789
|
}
|
|
5737
5790
|
}
|
|
5738
|
-
function
|
|
5791
|
+
function yr(n) {
|
|
5739
5792
|
return n === "" ? void 0 : n;
|
|
5740
5793
|
}
|
|
5741
|
-
function
|
|
5794
|
+
function Er(n, e) {
|
|
5742
5795
|
if (n.length === 0)
|
|
5743
5796
|
return e === 0 ? [] : [new Ne(e, void 0)];
|
|
5744
5797
|
const t = [];
|
|
5745
5798
|
for (let s = 0; s < n.length; s++) {
|
|
5746
5799
|
const i = n[s].offset, o = s + 1 < n.length ? n[s + 1].offset : e;
|
|
5747
|
-
o > i && t.push(new Ne(o - i,
|
|
5800
|
+
o > i && t.push(new Ne(o - i, yr(n[s].type)));
|
|
5748
5801
|
}
|
|
5749
5802
|
return t;
|
|
5750
5803
|
}
|
|
@@ -5766,7 +5819,7 @@ function _n(n) {
|
|
|
5766
5819
|
e += t.length;
|
|
5767
5820
|
return e;
|
|
5768
5821
|
}
|
|
5769
|
-
function
|
|
5822
|
+
function Cr(n, e) {
|
|
5770
5823
|
const t = n.length, s = e.length;
|
|
5771
5824
|
let i = 0, o = 0;
|
|
5772
5825
|
for (; i < t && i < s && pn(n[i], e[i]); )
|
|
@@ -5777,21 +5830,21 @@ function Er(n, e) {
|
|
|
5777
5830
|
const a = _n(n), l = _n(e), d = new v(o, a - c), u = l - c - o;
|
|
5778
5831
|
return d.isEmpty && u === 0 ? ke.empty : ke.replace(d, u);
|
|
5779
5832
|
}
|
|
5780
|
-
const
|
|
5833
|
+
const Lr = {
|
|
5781
5834
|
languageIdCodec: { encodeLanguageId: () => 0, decodeLanguageId: () => "" },
|
|
5782
5835
|
isRegisteredLanguageId: () => !1,
|
|
5783
5836
|
getLanguageIdByLanguageName: () => null,
|
|
5784
5837
|
getLanguageIdByMimeType: () => null,
|
|
5785
5838
|
requestBasicLanguageFeatures: () => {
|
|
5786
5839
|
}
|
|
5787
|
-
}, Lr = {
|
|
5788
|
-
getColorTheme: () => ({ tokenTheme: {} })
|
|
5789
5840
|
}, Sr = {
|
|
5841
|
+
getColorTheme: () => ({ tokenTheme: {} })
|
|
5842
|
+
}, Or = {
|
|
5790
5843
|
getValue: () => 2e4,
|
|
5791
5844
|
onDidChangeConfiguration: () => ({ dispose() {
|
|
5792
5845
|
} })
|
|
5793
5846
|
};
|
|
5794
|
-
function
|
|
5847
|
+
function kc(n, e) {
|
|
5795
5848
|
const t = /* @__PURE__ */ new Map([
|
|
5796
5849
|
["typescript", e.typescript],
|
|
5797
5850
|
["ts", e.typescript],
|
|
@@ -5807,14 +5860,14 @@ function wc(n, e) {
|
|
|
5807
5860
|
["sh", e.shell],
|
|
5808
5861
|
["bash", e.shell]
|
|
5809
5862
|
]);
|
|
5810
|
-
return new
|
|
5863
|
+
return new br(n, t);
|
|
5811
5864
|
}
|
|
5812
|
-
const
|
|
5813
|
-
class
|
|
5865
|
+
const Tr = '<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M14 7v1H8v6H7V8H1V7h6V1h1v6h6z"></path></svg>';
|
|
5866
|
+
class Mr extends U {
|
|
5814
5867
|
constructor(e) {
|
|
5815
5868
|
super(), this._options = e, this.element = document.createElement("div"), this.element.className = "md-comment-input", this._textarea = document.createElement("textarea"), this._textarea.className = "md-comment-input-textarea", this._textarea.rows = 1, this._textarea.placeholder = e?.placeholder ?? "Add Comment", this.element.appendChild(this._textarea), this._measure = document.createElement("span"), this._measure.className = "md-comment-input-measure", this._measure.setAttribute("aria-hidden", "true"), this.element.appendChild(this._measure);
|
|
5816
5869
|
const t = document.createElement("div");
|
|
5817
|
-
t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML =
|
|
5870
|
+
t.className = "md-comment-input-actions", this.element.appendChild(t), this._submitButton = document.createElement("button"), this._submitButton.type = "button", this._submitButton.className = "md-comment-input-submit", this._submitButton.innerHTML = Tr, this._submitButton.title = "Comment", t.appendChild(this._submitButton);
|
|
5818
5871
|
const s = (c) => {
|
|
5819
5872
|
c.stopPropagation(), !(c.target === this._textarea || this._submitButton.contains(c.target)) && (c.preventDefault(), this._textarea.focus());
|
|
5820
5873
|
};
|
|
@@ -5832,7 +5885,7 @@ class Tr extends U {
|
|
|
5832
5885
|
};
|
|
5833
5886
|
this._textarea.addEventListener("keydown", o), this._register({ dispose: () => this._textarea.removeEventListener("keydown", o) });
|
|
5834
5887
|
const r = () => this._submit();
|
|
5835
|
-
this._submitButton.addEventListener("click", r), this._register({ dispose: () => this._submitButton.removeEventListener("click", r) }), this._register(
|
|
5888
|
+
this._submitButton.addEventListener("click", r), this._register({ dispose: () => this._submitButton.removeEventListener("click", r) }), this._register(H((c) => {
|
|
5836
5889
|
const a = this._value.read(c).trim().length > 0;
|
|
5837
5890
|
this._submitButton.disabled = !a, this.element.classList.toggle("md-comment-input-empty", !a);
|
|
5838
5891
|
})), this._autoSize();
|
|
@@ -5841,7 +5894,7 @@ class Tr extends U {
|
|
|
5841
5894
|
_textarea;
|
|
5842
5895
|
_measure;
|
|
5843
5896
|
_submitButton;
|
|
5844
|
-
_value =
|
|
5897
|
+
_value = R(this, "");
|
|
5845
5898
|
/** Live, untrimmed textarea content. */
|
|
5846
5899
|
get value() {
|
|
5847
5900
|
return this._value;
|
|
@@ -5877,9 +5930,9 @@ class Tr extends U {
|
|
|
5877
5930
|
r > 0 && (this._textarea.style.height = `${r}px`), this._options?.onDidChangeSize?.();
|
|
5878
5931
|
}
|
|
5879
5932
|
}
|
|
5880
|
-
class
|
|
5933
|
+
class bc extends U {
|
|
5881
5934
|
constructor(e, t, s) {
|
|
5882
|
-
super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new
|
|
5935
|
+
super(), this._model = e, this._view = t, this._options = s, this._gap = s?.gap ?? 8, this._widget = this._register(new Mr({
|
|
5883
5936
|
onDidChangeSize: () => {
|
|
5884
5937
|
this._visible && this._layoutHorizontally();
|
|
5885
5938
|
},
|
|
@@ -5891,7 +5944,7 @@ class kc extends U {
|
|
|
5891
5944
|
const o = new ResizeObserver(() => {
|
|
5892
5945
|
this._visible && this._layoutHorizontally();
|
|
5893
5946
|
});
|
|
5894
|
-
o.observe(i), o.observe(this._view.overlayContainer), this._register({ dispose: () => o.disconnect() }), this._register(
|
|
5947
|
+
o.observe(i), o.observe(this._view.overlayContainer), this._register({ dispose: () => o.disconnect() }), this._register(H((d) => this._update(d)));
|
|
5895
5948
|
const r = this._view.element.ownerDocument, c = () => {
|
|
5896
5949
|
this._view.element.classList.add("md-comment-active");
|
|
5897
5950
|
};
|
|
@@ -5997,8 +6050,8 @@ class kc extends U {
|
|
|
5997
6050
|
this._submittedRange = t, this._hideAndRefocus(), t && this._options?.onSubmit?.({ text: e, range: t });
|
|
5998
6051
|
}
|
|
5999
6052
|
}
|
|
6000
|
-
class
|
|
6001
|
-
_comments =
|
|
6053
|
+
class xc {
|
|
6054
|
+
_comments = R(this, []);
|
|
6002
6055
|
/** Monotonic counter for ids of comments created via {@link create}. */
|
|
6003
6056
|
_sequence = 0;
|
|
6004
6057
|
/** The current comments, in insertion order. */
|
|
@@ -6009,7 +6062,7 @@ class bc {
|
|
|
6009
6062
|
* The comment currently hovered (by its card or its highlight), or
|
|
6010
6063
|
* `undefined`. Shared so the card and the highlight can react together.
|
|
6011
6064
|
*/
|
|
6012
|
-
hoveredId =
|
|
6065
|
+
hoveredId = R(this, void 0);
|
|
6013
6066
|
/** Replace the whole comment set. */
|
|
6014
6067
|
set(e) {
|
|
6015
6068
|
this._comments.set(e, void 0);
|
|
@@ -6038,8 +6091,8 @@ class bc {
|
|
|
6038
6091
|
this._comments.set(this._comments.get().filter((t) => t.id !== e), void 0);
|
|
6039
6092
|
}
|
|
6040
6093
|
}
|
|
6041
|
-
const Ge = "http://www.w3.org/2000/svg",
|
|
6042
|
-
class
|
|
6094
|
+
const Ge = "http://www.w3.org/2000/svg", Nr = 260, Rr = 320, Br = 0.32, Ir = 28, vn = 16, Ar = 12, Dr = 18, Pr = 4, Vr = 2, $r = 10;
|
|
6095
|
+
class Hr extends U {
|
|
6043
6096
|
constructor(e, t) {
|
|
6044
6097
|
super(), this._model = e, this._view = t, this._layer = this._createLayer("md-comment-shapes"), this._view.overlayContainer.appendChild(this._layer), this._register({
|
|
6045
6098
|
dispose: () => {
|
|
@@ -6048,7 +6101,7 @@ class $r extends U {
|
|
|
6048
6101
|
this._disposeEntry(s);
|
|
6049
6102
|
this._entries.clear(), this._view.element.style.paddingRight = "";
|
|
6050
6103
|
}
|
|
6051
|
-
}), this._register(
|
|
6104
|
+
}), this._register(H((s) => this._update(s)));
|
|
6052
6105
|
}
|
|
6053
6106
|
_layer;
|
|
6054
6107
|
_entries = /* @__PURE__ */ new Map();
|
|
@@ -6124,7 +6177,7 @@ class $r extends U {
|
|
|
6124
6177
|
}
|
|
6125
6178
|
_fillCard(e) {
|
|
6126
6179
|
const { comment: t } = e, s = t.author ?? "You";
|
|
6127
|
-
e.authorEl.textContent = s, e.avatarEl.textContent =
|
|
6180
|
+
e.authorEl.textContent = s, e.avatarEl.textContent = Wr(s), e.timeEl.textContent = t.createdAt !== void 0 ? zr(t.createdAt) : "", e.bodyEl.textContent = t.body;
|
|
6128
6181
|
}
|
|
6129
6182
|
_disposeEntry(e) {
|
|
6130
6183
|
for (const t of e.disposables)
|
|
@@ -6139,20 +6192,20 @@ class $r extends U {
|
|
|
6139
6192
|
return;
|
|
6140
6193
|
}
|
|
6141
6194
|
this._layer.style.display = "";
|
|
6142
|
-
const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(
|
|
6195
|
+
const i = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).width, o = getComputedStyle(s), r = parseFloat(o.maxWidth), c = (parseFloat(o.paddingLeft) || 0) + (parseFloat(o.paddingRight) || 0), a = (parseFloat(o.borderLeftWidth) || 0) + (parseFloat(o.borderRightWidth) || 0), l = Number.isNaN(r) ? i : o.boxSizing === "border-box" ? r : r + c + a, d = Math.max(0, (i - Math.min(l, i)) / 2), u = Math.round(Math.max(Nr, Math.min(Rr, i * Br))), h = u + Ir + vn, f = d >= h ? 0 : Math.min(2 * (h - d), h), m = f > 0 ? `${Math.ceil(f)}px` : "";
|
|
6143
6196
|
t.style.paddingRight !== m && (t.style.paddingRight = m);
|
|
6144
6197
|
const _ = this._view.coordinateSpace.capture().toLocalRect(t.getBoundingClientRect()).right - vn - u, k = s.clientWidth, b = e.map(({ entry: x, rects: w }) => {
|
|
6145
6198
|
x.card.style.left = `${_}px`, x.card.style.width = `${u}px`;
|
|
6146
|
-
const M =
|
|
6199
|
+
const M = Fr(w), V = w.length > 0 ? Math.min(...w.map((q) => q.y)) : 0;
|
|
6147
6200
|
return { entry: x, rects: w, anchor: M, desiredTop: V };
|
|
6148
6201
|
});
|
|
6149
6202
|
b.sort((x, w) => x.desiredTop - w.desiredTop);
|
|
6150
6203
|
let L = -1 / 0;
|
|
6151
6204
|
for (const x of b) {
|
|
6152
|
-
const w = Math.max(x.desiredTop, L +
|
|
6205
|
+
const w = Math.max(x.desiredTop, L + Ar);
|
|
6153
6206
|
x.entry.card.style.top = `${w}px`;
|
|
6154
6207
|
const M = x.entry.card.offsetHeight;
|
|
6155
|
-
L = w + M, x.entry.shapePath.setAttribute("d", ns(x.rects,
|
|
6208
|
+
L = w + M, x.entry.shapePath.setAttribute("d", ns(x.rects, Pr)), x.entry.leaderPath.setAttribute("d", x.anchor ? Kr(x.anchor, k, { x: _, y: w + Dr }) : "");
|
|
6156
6209
|
}
|
|
6157
6210
|
}
|
|
6158
6211
|
_applyHover(e) {
|
|
@@ -6162,27 +6215,27 @@ class $r extends U {
|
|
|
6162
6215
|
}
|
|
6163
6216
|
}
|
|
6164
6217
|
}
|
|
6165
|
-
function
|
|
6218
|
+
function Fr(n) {
|
|
6166
6219
|
if (n.length === 0)
|
|
6167
6220
|
return;
|
|
6168
6221
|
let e = n[0];
|
|
6169
6222
|
for (const i of n)
|
|
6170
6223
|
i.y + i.height > e.y + e.height && (e = i);
|
|
6171
6224
|
const t = e.x + e.width;
|
|
6172
|
-
return { x: Math.max(e.x, t -
|
|
6225
|
+
return { x: Math.max(e.x, t - $r), y: e.y + e.height - Vr / 2 };
|
|
6173
6226
|
}
|
|
6174
|
-
function
|
|
6227
|
+
function Kr(n, e, t) {
|
|
6175
6228
|
const s = Math.max(e, n.x + 12), i = t.x - s, o = s + i * 0.55, r = t.x - i * 0.45;
|
|
6176
6229
|
return `M ${n.x} ${n.y} L ${s} ${n.y} C ${o} ${n.y}, ${r} ${t.y}, ${t.x} ${t.y}`;
|
|
6177
6230
|
}
|
|
6178
|
-
function
|
|
6231
|
+
function Wr(n) {
|
|
6179
6232
|
const e = n.trim().split(/\s+/).filter(Boolean);
|
|
6180
6233
|
if (e.length === 0)
|
|
6181
6234
|
return "?";
|
|
6182
6235
|
const t = e[0][0] ?? "", s = e.length > 1 ? e[e.length - 1][0] ?? "" : "";
|
|
6183
6236
|
return (t + s).toUpperCase();
|
|
6184
6237
|
}
|
|
6185
|
-
function
|
|
6238
|
+
function zr(n) {
|
|
6186
6239
|
const e = Math.max(0, Math.round((Date.now() - n) / 1e3));
|
|
6187
6240
|
if (e < 60)
|
|
6188
6241
|
return "just now";
|
|
@@ -6192,9 +6245,9 @@ function Wr(n) {
|
|
|
6192
6245
|
const s = Math.round(t / 60);
|
|
6193
6246
|
return s < 24 ? `${s}h ago` : `${Math.round(s / 24)}d ago`;
|
|
6194
6247
|
}
|
|
6195
|
-
const
|
|
6196
|
-
function
|
|
6197
|
-
const t = n.element, s = n.overlayContainer, i = t.clientWidth -
|
|
6248
|
+
const Gr = 12, qr = 8;
|
|
6249
|
+
function Ur(n, e) {
|
|
6250
|
+
const t = n.element, s = n.overlayContainer, i = t.clientWidth - qr - s.offsetLeft, o = [];
|
|
6198
6251
|
for (const c of e) {
|
|
6199
6252
|
if (c.rects.length === 0) {
|
|
6200
6253
|
c.element.style.visibility = "hidden";
|
|
@@ -6205,7 +6258,7 @@ function qr(n, e) {
|
|
|
6205
6258
|
o.sort((c, a) => c.y - a.y);
|
|
6206
6259
|
let r = -1 / 0;
|
|
6207
6260
|
for (const c of o) {
|
|
6208
|
-
const a = Math.max(c.y, r +
|
|
6261
|
+
const a = Math.max(c.y, r + Gr), l = i - c.element.offsetWidth;
|
|
6209
6262
|
c.element.style.left = `${l}px`, c.element.style.top = `${a}px`, r = a + c.element.offsetHeight;
|
|
6210
6263
|
}
|
|
6211
6264
|
}
|
|
@@ -6219,7 +6272,7 @@ class is extends U {
|
|
|
6219
6272
|
o.widget.dispose();
|
|
6220
6273
|
this._entries.clear(), this._layer.remove();
|
|
6221
6274
|
}
|
|
6222
|
-
}), this._register(
|
|
6275
|
+
}), this._register(H((o) => {
|
|
6223
6276
|
const r = this.model.comments.read(o);
|
|
6224
6277
|
this._reconcile(r);
|
|
6225
6278
|
for (const c of r)
|
|
@@ -6250,7 +6303,7 @@ class is extends U {
|
|
|
6250
6303
|
}
|
|
6251
6304
|
_relayout() {
|
|
6252
6305
|
const e = this._order.map((t) => this._entries.get(t)).filter((t) => t !== void 0).map((t) => ({ element: t.widget.element, rects: t.rects.get() }));
|
|
6253
|
-
|
|
6306
|
+
Ur(this.view, e), this._revealPendingComment();
|
|
6254
6307
|
}
|
|
6255
6308
|
_revealPendingComment() {
|
|
6256
6309
|
const e = this._pendingRevealCommentId;
|
|
@@ -6260,9 +6313,9 @@ class is extends U {
|
|
|
6260
6313
|
!t || t.style.visibility === "hidden" || (this._pendingRevealCommentId = void 0, t.scrollIntoView({ block: "center", inline: "nearest" }));
|
|
6261
6314
|
}
|
|
6262
6315
|
}
|
|
6263
|
-
const
|
|
6316
|
+
const jr = /^([a-z0-9]+)/i;
|
|
6264
6317
|
function O(n) {
|
|
6265
|
-
const e =
|
|
6318
|
+
const e = jr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
|
|
6266
6319
|
return s.length && (t.className = s.join(" ")), t;
|
|
6267
6320
|
}
|
|
6268
6321
|
function ve(n) {
|
|
@@ -6289,7 +6342,7 @@ function qe(n) {
|
|
|
6289
6342
|
} else s && t.appendChild(document.createTextNode(s));
|
|
6290
6343
|
return e.appendChild(t), e;
|
|
6291
6344
|
}
|
|
6292
|
-
class
|
|
6345
|
+
class Xr {
|
|
6293
6346
|
constructor(e, t) {
|
|
6294
6347
|
this._comments = e, this._domNode = O("div.agent-feedback-widget"), this._domNode.classList.add("collapsed"), this._domNode.tabIndex = -1, this._domNode.setAttribute("widgetid", "agent-feedback-widget-0"), this._headerNode = O("div.agent-feedback-widget-header"), this._headerNode.appendChild(dt("comment")), this._titleNode = O("span.agent-feedback-widget-title"), this._updateTitle(), this._headerNode.appendChild(this._titleNode), this._headerNode.appendChild(O("span.agent-feedback-widget-spacer")), this._toggleButton = O("div.agent-feedback-widget-toggle"), this._updateToggleButton(), this._headerNode.appendChild(this._toggleButton), this._domNode.appendChild(this._headerNode), this._bodyNode = O("div.agent-feedback-widget-body"), this._bodyNode.classList.add("collapsed"), this._buildFeedbackItems(), this._domNode.appendChild(this._bodyNode), this._domNode.appendChild(O("div.agent-feedback-widget-arrow")), this._setupEventHandlers(), this._domNode.classList.add("visible"), t?.expanded && this.expand(), t?.focusedCommentId && this.focusFeedback(t.focusedCommentId);
|
|
6295
6348
|
}
|
|
@@ -6489,7 +6542,7 @@ class jr {
|
|
|
6489
6542
|
this._disposables.length = 0, this._domNode.remove();
|
|
6490
6543
|
}
|
|
6491
6544
|
}
|
|
6492
|
-
class
|
|
6545
|
+
class Yr extends is {
|
|
6493
6546
|
createWidget(e) {
|
|
6494
6547
|
const t = this.context?.resolveLine?.(e.range.start) ?? 1, s = {
|
|
6495
6548
|
id: e.id,
|
|
@@ -6498,26 +6551,26 @@ class Xr extends is {
|
|
|
6498
6551
|
startLine: t,
|
|
6499
6552
|
text: e.body
|
|
6500
6553
|
};
|
|
6501
|
-
return new
|
|
6554
|
+
return new Xr([s], { expanded: !0 });
|
|
6502
6555
|
}
|
|
6503
6556
|
}
|
|
6504
|
-
const
|
|
6557
|
+
const Qr = /^([a-z0-9]+)/i;
|
|
6505
6558
|
function we(n) {
|
|
6506
|
-
const e =
|
|
6559
|
+
const e = Qr.exec(n)?.[1] ?? "div", t = document.createElement(e), s = n.slice(e.length).split(".").filter(Boolean);
|
|
6507
6560
|
return s.length && (t.className = s.join(" ")), t;
|
|
6508
6561
|
}
|
|
6509
6562
|
function wn(n) {
|
|
6510
6563
|
return `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`;
|
|
6511
6564
|
}
|
|
6512
|
-
const
|
|
6565
|
+
const Zr = {
|
|
6513
6566
|
edit: wn('<path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path>'),
|
|
6514
6567
|
trash: wn('<polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line>')
|
|
6515
6568
|
};
|
|
6516
|
-
function
|
|
6569
|
+
function Jr(n, e) {
|
|
6517
6570
|
const t = document.createElement("button");
|
|
6518
|
-
return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML =
|
|
6571
|
+
return t.type = "button", t.className = "vscode-comment-widget-v2-action", t.setAttribute("aria-label", e), t.title = e, t.innerHTML = Zr[n] ?? "", t;
|
|
6519
6572
|
}
|
|
6520
|
-
class
|
|
6573
|
+
class ec {
|
|
6521
6574
|
_domNode;
|
|
6522
6575
|
_textNode;
|
|
6523
6576
|
_toggleNode;
|
|
@@ -6555,7 +6608,7 @@ class Jr {
|
|
|
6555
6608
|
}
|
|
6556
6609
|
/** A header action button that runs `onClick` (and cleans up on dispose). */
|
|
6557
6610
|
_actionButton(e, t, s) {
|
|
6558
|
-
const i =
|
|
6611
|
+
const i = Jr(e, t), o = (r) => {
|
|
6559
6612
|
r.preventDefault(), r.stopPropagation(), s();
|
|
6560
6613
|
};
|
|
6561
6614
|
return i.addEventListener("click", o), this._disposables.push(() => i.removeEventListener("click", o)), i;
|
|
@@ -6567,52 +6620,52 @@ class Jr {
|
|
|
6567
6620
|
this._domNode.remove();
|
|
6568
6621
|
}
|
|
6569
6622
|
}
|
|
6570
|
-
const
|
|
6571
|
-
class
|
|
6623
|
+
const tc = 80;
|
|
6624
|
+
class nc extends is {
|
|
6572
6625
|
createWidget(e) {
|
|
6573
|
-
return new
|
|
6626
|
+
return new ec({
|
|
6574
6627
|
username: e.author ?? "You",
|
|
6575
6628
|
body: e.body,
|
|
6576
|
-
state: e.body.length >
|
|
6629
|
+
state: e.body.length > tc ? "collapsed" : "short",
|
|
6577
6630
|
// Edit is intentionally omitted (hidden) for now. Delete removes the
|
|
6578
6631
|
// comment from the shared model; the autorun then disposes the card.
|
|
6579
6632
|
onDelete: () => this.model.remove(e.id)
|
|
6580
6633
|
});
|
|
6581
6634
|
}
|
|
6582
6635
|
}
|
|
6583
|
-
const
|
|
6636
|
+
const yc = {
|
|
6584
6637
|
connected: "Connected lines (original)",
|
|
6585
6638
|
vscode: "VS Code cards",
|
|
6586
6639
|
"vscode-v2": "Markdown cards (V3)"
|
|
6587
|
-
},
|
|
6588
|
-
connected: (n, e) => new
|
|
6589
|
-
vscode: (n, e, t) => new
|
|
6590
|
-
"vscode-v2": (n, e, t) => new
|
|
6640
|
+
}, Ec = {
|
|
6641
|
+
connected: (n, e) => new Hr(n, e),
|
|
6642
|
+
vscode: (n, e, t) => new Yr(n, e, t),
|
|
6643
|
+
"vscode-v2": (n, e, t) => new nc(n, e, t)
|
|
6591
6644
|
};
|
|
6592
6645
|
export {
|
|
6593
6646
|
G as AstNode,
|
|
6594
|
-
|
|
6647
|
+
_c as AsyncClipboardStrategy,
|
|
6595
6648
|
ye as BlockQuoteAstNode,
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6649
|
+
B as BlockViewNode,
|
|
6650
|
+
Ec as COMMENTS_DESIGNS,
|
|
6651
|
+
yc as COMMENTS_DESIGN_LABELS,
|
|
6599
6652
|
Y as CodeBlockAstNode,
|
|
6600
6653
|
Ot as CodeBlockViewNode,
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6654
|
+
Mr as CommentInputWidget,
|
|
6655
|
+
bc as CommentModeController,
|
|
6656
|
+
xc as CommentsModel,
|
|
6657
|
+
Hr as CommentsView,
|
|
6605
6658
|
Qo as CursorView,
|
|
6606
6659
|
Ke as CursorViewRendering,
|
|
6607
6660
|
as as DEFAULT_WORD_NAVIGATION_CONFIG,
|
|
6608
|
-
|
|
6661
|
+
Sc as DEFAULT_WORD_SEPARATORS,
|
|
6609
6662
|
yt as DocumentAstNode,
|
|
6610
6663
|
Mt as DocumentViewNode,
|
|
6611
|
-
|
|
6664
|
+
vc as EditorController,
|
|
6612
6665
|
nt as EditorCoordinateSpace,
|
|
6613
6666
|
io as EditorCoordinateTransform,
|
|
6614
|
-
|
|
6615
|
-
|
|
6667
|
+
gc as EditorModel,
|
|
6668
|
+
pc as EditorView,
|
|
6616
6669
|
wt as EmphasisAstNode,
|
|
6617
6670
|
z as GlueAstNode,
|
|
6618
6671
|
he as HeadingAstNode,
|
|
@@ -6627,11 +6680,11 @@ export {
|
|
|
6627
6680
|
Ps as MarkdownParser,
|
|
6628
6681
|
C as MarkerAstNode,
|
|
6629
6682
|
_e as MathBlockAstNode,
|
|
6630
|
-
|
|
6631
|
-
|
|
6683
|
+
_r as MeasuredLayoutDebugRendering,
|
|
6684
|
+
wc as MeasuredLayoutDebugView,
|
|
6632
6685
|
ci as MeasuredLayoutModel,
|
|
6633
|
-
|
|
6634
|
-
|
|
6686
|
+
br as MonacoSyntaxHighlighter,
|
|
6687
|
+
ir as NativeClipboardStrategy,
|
|
6635
6688
|
v as OffsetRange,
|
|
6636
6689
|
ne as ParagraphAstNode,
|
|
6637
6690
|
de as Point2D,
|
|
@@ -6655,9 +6708,9 @@ export {
|
|
|
6655
6708
|
ei as VisualLine,
|
|
6656
6709
|
Ie as VisualLineMap,
|
|
6657
6710
|
ut as VisualRun,
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6711
|
+
nc as VsCodeV2CommentsView,
|
|
6712
|
+
Yr as VscodeStackedCommentsView,
|
|
6713
|
+
kc as createDefaultMonacoSyntaxHighlighter,
|
|
6661
6714
|
xi as cursorDocumentEnd,
|
|
6662
6715
|
bi as cursorDocumentStart,
|
|
6663
6716
|
Vt as cursorDown,
|
|
@@ -6696,8 +6749,8 @@ export {
|
|
|
6696
6749
|
Ki as selectAll,
|
|
6697
6750
|
zi as selectBlock,
|
|
6698
6751
|
Wi as selectWord,
|
|
6699
|
-
|
|
6700
|
-
|
|
6752
|
+
fc as taskCheckboxRange,
|
|
6753
|
+
mc as visualizeAst,
|
|
6701
6754
|
ss as vscodeKeyboardProfile
|
|
6702
6755
|
};
|
|
6703
6756
|
//# sourceMappingURL=index.js.map
|