ghost 5.65.0 → 5.66.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/components/{tryghost-adapter-cache-memory-ttl-5.65.0.tgz → tryghost-adapter-cache-memory-ttl-5.66.0.tgz} +0 -0
- package/components/{tryghost-adapter-cache-redis-5.65.0.tgz → tryghost-adapter-cache-redis-5.66.0.tgz} +0 -0
- package/components/{tryghost-adapter-manager-5.65.0.tgz → tryghost-adapter-manager-5.66.0.tgz} +0 -0
- package/components/{tryghost-announcement-bar-settings-5.65.0.tgz → tryghost-announcement-bar-settings-5.66.0.tgz} +0 -0
- package/components/tryghost-api-framework-5.66.0.tgz +0 -0
- package/components/{tryghost-api-version-compatibility-service-5.65.0.tgz → tryghost-api-version-compatibility-service-5.66.0.tgz} +0 -0
- package/components/{tryghost-audience-feedback-5.65.0.tgz → tryghost-audience-feedback-5.66.0.tgz} +0 -0
- package/components/{tryghost-bookshelf-repository-5.65.0.tgz → tryghost-bookshelf-repository-5.66.0.tgz} +0 -0
- package/components/tryghost-bootstrap-socket-5.66.0.tgz +0 -0
- package/components/tryghost-collections-5.66.0.tgz +0 -0
- package/components/{tryghost-constants-5.65.0.tgz → tryghost-constants-5.66.0.tgz} +0 -0
- package/components/{tryghost-custom-theme-settings-service-5.65.0.tgz → tryghost-custom-theme-settings-service-5.66.0.tgz} +0 -0
- package/components/{tryghost-data-generator-5.65.0.tgz → tryghost-data-generator-5.66.0.tgz} +0 -0
- package/components/{tryghost-domain-events-5.65.0.tgz → tryghost-domain-events-5.66.0.tgz} +0 -0
- package/components/tryghost-donations-5.66.0.tgz +0 -0
- package/components/{tryghost-dynamic-routing-events-5.65.0.tgz → tryghost-dynamic-routing-events-5.66.0.tgz} +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.66.0.tgz +0 -0
- package/components/{tryghost-email-analytics-service-5.65.0.tgz → tryghost-email-analytics-service-5.66.0.tgz} +0 -0
- package/components/{tryghost-email-content-generator-5.65.0.tgz → tryghost-email-content-generator-5.66.0.tgz} +0 -0
- package/components/tryghost-email-events-5.66.0.tgz +0 -0
- package/components/{tryghost-email-service-5.65.0.tgz → tryghost-email-service-5.66.0.tgz} +0 -0
- package/components/tryghost-email-suppression-list-5.66.0.tgz +0 -0
- package/components/tryghost-event-aware-cache-wrapper-5.66.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.66.0.tgz +0 -0
- package/components/tryghost-external-media-inliner-5.66.0.tgz +0 -0
- package/components/{tryghost-extract-api-key-5.65.0.tgz → tryghost-extract-api-key-5.66.0.tgz} +0 -0
- package/components/{tryghost-html-to-plaintext-5.65.0.tgz → tryghost-html-to-plaintext-5.66.0.tgz} +0 -0
- package/components/tryghost-i18n-5.66.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.66.0.tgz +0 -0
- package/components/{tryghost-importer-revue-5.65.0.tgz → tryghost-importer-revue-5.66.0.tgz} +0 -0
- package/components/tryghost-in-memory-repository-5.66.0.tgz +0 -0
- package/components/{tryghost-job-manager-5.65.0.tgz → tryghost-job-manager-5.66.0.tgz} +0 -0
- package/components/tryghost-link-redirects-5.66.0.tgz +0 -0
- package/components/tryghost-link-replacer-5.66.0.tgz +0 -0
- package/components/{tryghost-link-tracking-5.65.0.tgz → tryghost-link-tracking-5.66.0.tgz} +0 -0
- package/components/tryghost-magic-link-5.66.0.tgz +0 -0
- package/components/tryghost-mail-events-5.66.0.tgz +0 -0
- package/components/{tryghost-mailgun-client-5.65.0.tgz → tryghost-mailgun-client-5.66.0.tgz} +0 -0
- package/components/{tryghost-member-attribution-5.65.0.tgz → tryghost-member-attribution-5.66.0.tgz} +0 -0
- package/components/{tryghost-member-events-5.65.0.tgz → tryghost-member-events-5.66.0.tgz} +0 -0
- package/components/tryghost-members-api-5.66.0.tgz +0 -0
- package/components/{tryghost-members-csv-5.65.0.tgz → tryghost-members-csv-5.66.0.tgz} +0 -0
- package/components/{tryghost-members-events-service-5.65.0.tgz → tryghost-members-events-service-5.66.0.tgz} +0 -0
- package/components/{tryghost-members-importer-5.65.0.tgz → tryghost-members-importer-5.66.0.tgz} +0 -0
- package/components/{tryghost-members-offers-5.65.0.tgz → tryghost-members-offers-5.66.0.tgz} +0 -0
- package/components/{tryghost-members-payments-5.65.0.tgz → tryghost-members-payments-5.66.0.tgz} +0 -0
- package/components/tryghost-members-ssr-5.66.0.tgz +0 -0
- package/components/{tryghost-members-stripe-service-5.65.0.tgz → tryghost-members-stripe-service-5.66.0.tgz} +0 -0
- package/components/tryghost-mentions-email-report-5.66.0.tgz +0 -0
- package/components/{tryghost-milestones-5.65.0.tgz → tryghost-milestones-5.66.0.tgz} +0 -0
- package/components/{tryghost-minifier-5.65.0.tgz → tryghost-minifier-5.66.0.tgz} +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.66.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.66.0.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.66.0.tgz +0 -0
- package/components/{tryghost-mw-error-handler-5.65.0.tgz → tryghost-mw-error-handler-5.66.0.tgz} +0 -0
- package/components/tryghost-mw-session-from-token-5.66.0.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.66.0.tgz +0 -0
- package/components/{tryghost-mw-version-match-5.65.0.tgz → tryghost-mw-version-match-5.66.0.tgz} +0 -0
- package/components/tryghost-mw-vhost-5.66.0.tgz +0 -0
- package/components/tryghost-nql-filter-expansions-5.66.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.66.0.tgz +0 -0
- package/components/tryghost-package-json-5.66.0.tgz +0 -0
- package/components/{tryghost-post-events-5.65.0.tgz → tryghost-post-events-5.66.0.tgz} +0 -0
- package/components/{tryghost-post-revisions-5.65.0.tgz → tryghost-post-revisions-5.66.0.tgz} +0 -0
- package/components/{tryghost-posts-service-5.65.0.tgz → tryghost-posts-service-5.66.0.tgz} +0 -0
- package/components/tryghost-recommendations-5.66.0.tgz +0 -0
- package/components/tryghost-referrers-5.66.0.tgz +0 -0
- package/components/tryghost-security-5.66.0.tgz +0 -0
- package/components/tryghost-session-service-5.66.0.tgz +0 -0
- package/components/{tryghost-settings-path-manager-5.65.0.tgz → tryghost-settings-path-manager-5.66.0.tgz} +0 -0
- package/components/tryghost-slack-notifications-5.66.0.tgz +0 -0
- package/components/tryghost-staff-service-5.66.0.tgz +0 -0
- package/components/{tryghost-stats-service-5.65.0.tgz → tryghost-stats-service-5.66.0.tgz} +0 -0
- package/components/tryghost-tiers-5.66.0.tgz +0 -0
- package/components/tryghost-update-check-service-5.66.0.tgz +0 -0
- package/components/{tryghost-verification-trigger-5.65.0.tgz → tryghost-verification-trigger-5.66.0.tgz} +0 -0
- package/components/{tryghost-version-notifications-data-service-5.65.0.tgz → tryghost-version-notifications-data-service-5.66.0.tgz} +0 -0
- package/components/tryghost-webmentions-5.66.0.tgz +0 -0
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-2b332315.mjs → CodeEditorView-b1c6a306.mjs} +424 -418
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/index-02567620.mjs +17406 -0
- package/core/built/admin/assets/admin-x-settings/{limit-service-7694c0d4.mjs → limit-service-bf02ec54.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-2073207d.mjs → modals-d2fd552b.mjs} +4281 -4177
- package/core/built/admin/assets/{chunk.143.c91dc1d2a8a5a1f318ec.js → chunk.143.f2758c8aac6998f30b19.js} +5 -5
- package/core/built/admin/assets/{chunk.178.d921de78463d288f3bcd.js → chunk.178.1dd5d9b6741e78efa75a.js} +4 -4
- package/core/built/admin/assets/{chunk.518.396deed1a0c759d1f403.js → chunk.555.ba02d5a0095b4c4a7700.js} +57 -54
- package/core/built/admin/assets/{ghost-38746349a72536a92f4d8235a582d716.js → ghost-56045473f2cfd232419a9d27bf8225a5.js} +174 -182
- package/core/built/admin/assets/ghost-dark-54c925ac8f527d36132c18af7bef116e.css +1 -0
- package/core/built/admin/assets/ghost-f1a535bfec933b08a7a45f607cc245b1.css +1 -0
- package/core/built/admin/assets/{vendor-240cd1dbd84a2e07709b867442c41840.js → vendor-5aa07b661eeb443bf7dd2c1de3b3f387.js} +22 -20
- package/core/built/admin/index.html +6 -6
- package/core/frontend/helpers/recommendations.js +116 -0
- package/core/frontend/helpers/tpl/recommendations.hbs +15 -0
- package/core/server/adapters/scheduling/scheduling-default.js +8 -8
- package/core/server/api/endpoints/recommendations-public.js +2 -1
- package/core/server/api/endpoints/utils/serializers/output/utils/clean.js +1 -0
- package/core/server/data/migrations/versions/5.66/2023-09-22-14-15-add-recommendation-notifications-column.js +7 -0
- package/core/server/data/schema/schema.js +1 -0
- package/core/server/lib/image/Gravatar.js +1 -1
- package/core/server/lib/image/ImageSize.js +7 -3
- package/core/server/lib/request-external.js +9 -0
- package/core/server/models/post.js +46 -0
- package/core/server/models/user.js +3 -0
- package/core/server/services/collections/PostsRepository.js +7 -2
- package/core/server/services/comments/CommentsServiceEmails.js +1 -1
- package/core/server/services/mentions/BookshelfMentionRepository.js +2 -1
- package/core/server/services/mentions/service.js +4 -0
- package/core/server/services/recommendations/RecommendationEnablerService.js +1 -1
- package/core/server/services/recommendations/RecommendationServiceWrapper.js +68 -8
- package/core/server/services/themes/installer.js +1 -1
- package/core/server/services/webhooks/WebhookTrigger.js +6 -2
- package/core/server/services/xmlrpc.js +3 -1
- package/core/shared/labs.js +5 -0
- package/package.json +149 -149
- package/yarn.lock +283 -158
- package/components/tryghost-api-framework-5.65.0.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.65.0.tgz +0 -0
- package/components/tryghost-collections-5.65.0.tgz +0 -0
- package/components/tryghost-donations-5.65.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.65.0.tgz +0 -0
- package/components/tryghost-email-events-5.65.0.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.65.0.tgz +0 -0
- package/components/tryghost-event-aware-cache-wrapper-5.65.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.65.0.tgz +0 -0
- package/components/tryghost-external-media-inliner-5.65.0.tgz +0 -0
- package/components/tryghost-i18n-5.65.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.65.0.tgz +0 -0
- package/components/tryghost-in-memory-repository-5.65.0.tgz +0 -0
- package/components/tryghost-link-redirects-5.65.0.tgz +0 -0
- package/components/tryghost-link-replacer-5.65.0.tgz +0 -0
- package/components/tryghost-magic-link-5.65.0.tgz +0 -0
- package/components/tryghost-mail-events-5.65.0.tgz +0 -0
- package/components/tryghost-members-api-5.65.0.tgz +0 -0
- package/components/tryghost-members-ssr-5.65.0.tgz +0 -0
- package/components/tryghost-mentions-email-report-5.65.0.tgz +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.65.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.65.0.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.65.0.tgz +0 -0
- package/components/tryghost-mw-session-from-token-5.65.0.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.65.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.65.0.tgz +0 -0
- package/components/tryghost-nql-filter-expansions-5.65.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.65.0.tgz +0 -0
- package/components/tryghost-package-json-5.65.0.tgz +0 -0
- package/components/tryghost-recommendations-5.65.0.tgz +0 -0
- package/components/tryghost-referrers-5.65.0.tgz +0 -0
- package/components/tryghost-security-5.65.0.tgz +0 -0
- package/components/tryghost-session-service-5.65.0.tgz +0 -0
- package/components/tryghost-slack-notifications-5.65.0.tgz +0 -0
- package/components/tryghost-staff-service-5.65.0.tgz +0 -0
- package/components/tryghost-tiers-5.65.0.tgz +0 -0
- package/components/tryghost-update-check-service-5.65.0.tgz +0 -0
- package/components/tryghost-webmentions-5.65.0.tgz +0 -0
- package/core/built/admin/assets/admin-x-settings/index-4a560e9e.mjs +0 -19693
- package/core/built/admin/assets/ghost-761b67711827277b7095ebc7acc5c49f.css +0 -1
- package/core/built/admin/assets/ghost-dark-d3f636c30e80bdd7f21d3fb4770073c9.css +0 -1
- /package/core/built/admin/assets/{chunk.518.396deed1a0c759d1f403.js.LICENSE.txt → chunk.555.ba02d5a0095b4c4a7700.js.LICENSE.txt} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { E as p, F as
|
|
3
|
-
const
|
|
1
|
+
import { b as ke, d as W, aP as wt, bp as qn, C as Rt, bq as Hn, j as P, br as Vn, E as zn, y as Un, P as $n, J as Gn, H as Kn, G as Jn } from "./index-02567620.mjs";
|
|
2
|
+
import { E as p, F as ue, v as Ee, S as we, o as d, w as qe, C as _n, x as jn, y as Tt, z as Ot, A as Se, B as It, G as Pt, H as Wt, J as $e, K as Xe, M as w, O as Z, g as et, b as Ge, Q as Qn, R as ee, V as Ft, U as y, W as Yn, X as Zn, Y as ae, Z as M, _ as Xn, $ as er, a0 as tt, a1 as ce, a2 as tr, a3 as nr, a4 as rr, a5 as or, a6 as ir, a7 as sr, a8 as lr, a9 as ar, aa as cr, ab as hr, ac as ur, ad as fr, ae as dr, af as mr, ag as Nt, ah as gr, ai as pr, aj as yr, ak as xr, al as kr, am as br, an as qt, ao as Sr, ap as Cr, t as f, aq as vr } from "./index-9cc1df42.mjs";
|
|
3
|
+
const Ar = (t) => {
|
|
4
4
|
let { state: e } = t, r = e.doc.lineAt(e.selection.main.from), n = rt(t.state, r.from);
|
|
5
|
-
return n.line ?
|
|
5
|
+
return n.line ? Mr(t) : n.block ? Br(t) : !1;
|
|
6
6
|
};
|
|
7
7
|
function nt(t, e) {
|
|
8
8
|
return ({ state: r, dispatch: n }) => {
|
|
@@ -12,16 +12,16 @@ function nt(t, e) {
|
|
|
12
12
|
return o ? (n(r.update(o)), !0) : !1;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const Mr = /* @__PURE__ */ nt(
|
|
16
|
+
wr,
|
|
17
17
|
0
|
|
18
18
|
/* CommentOption.Toggle */
|
|
19
|
-
),
|
|
19
|
+
), Lr = /* @__PURE__ */ nt(
|
|
20
20
|
Ht,
|
|
21
21
|
0
|
|
22
22
|
/* CommentOption.Toggle */
|
|
23
|
-
),
|
|
24
|
-
(t, e) => Ht(t, e,
|
|
23
|
+
), Br = /* @__PURE__ */ nt(
|
|
24
|
+
(t, e) => Ht(t, e, Er(e)),
|
|
25
25
|
0
|
|
26
26
|
/* CommentOption.Toggle */
|
|
27
27
|
);
|
|
@@ -29,16 +29,16 @@ function rt(t, e) {
|
|
|
29
29
|
let r = t.languageDataAt("commentTokens", e);
|
|
30
30
|
return r.length ? r[0] : {};
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const le = 50;
|
|
33
33
|
function Dr(t, { open: e, close: r }, n, o) {
|
|
34
|
-
let i = t.sliceDoc(n -
|
|
34
|
+
let i = t.sliceDoc(n - le, n), s = t.sliceDoc(o, o + le), l = /\s*$/.exec(i)[0].length, a = /^\s*/.exec(s)[0].length, c = i.length - l;
|
|
35
35
|
if (i.slice(c - e.length, c) == e && s.slice(a, a + r.length) == r)
|
|
36
36
|
return {
|
|
37
37
|
open: { pos: n - l, margin: l && 1 },
|
|
38
38
|
close: { pos: o + a, margin: a && 1 }
|
|
39
39
|
};
|
|
40
40
|
let h, u;
|
|
41
|
-
o - n <= 2 *
|
|
41
|
+
o - n <= 2 * le ? h = u = t.sliceDoc(n, o) : (h = t.sliceDoc(n, n + le), u = t.sliceDoc(o - le, o));
|
|
42
42
|
let m = /^\s*/.exec(h)[0].length, x = /\s*$/.exec(u)[0].length, S = u.length - x - r.length;
|
|
43
43
|
return h.slice(m, m + e.length) == e && u.slice(S, S + r.length) == r ? {
|
|
44
44
|
open: {
|
|
@@ -51,7 +51,7 @@ function Dr(t, { open: e, close: r }, n, o) {
|
|
|
51
51
|
}
|
|
52
52
|
} : null;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Er(t) {
|
|
55
55
|
let e = [];
|
|
56
56
|
for (let r of t.selection.ranges) {
|
|
57
57
|
let n = t.doc.lineAt(r.from), o = r.to <= n.to ? n : t.doc.lineAt(r.to), i = e.length - 1;
|
|
@@ -77,7 +77,7 @@ function Ht(t, e, r = e.selection.ranges) {
|
|
|
77
77
|
}
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function wr(t, e, r = e.selection.ranges) {
|
|
81
81
|
let n = [], o = -1;
|
|
82
82
|
for (let { from: i, to: s } of r) {
|
|
83
83
|
let l = n.length, a = 1e9, c = rt(e, i).line;
|
|
@@ -114,9 +114,9 @@ function Er(t, e, r = e.selection.ranges) {
|
|
|
114
114
|
}
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
const Ke = /* @__PURE__ */ Xe.define(),
|
|
117
|
+
const Ke = /* @__PURE__ */ Xe.define(), Rr = /* @__PURE__ */ Xe.define(), Tr = /* @__PURE__ */ ue.define(), Vt = /* @__PURE__ */ ue.define({
|
|
118
118
|
combine(t) {
|
|
119
|
-
return
|
|
119
|
+
return Ee(t, {
|
|
120
120
|
minDepth: 100,
|
|
121
121
|
newGroupDelay: 500,
|
|
122
122
|
joinToEvent: (e, r) => r
|
|
@@ -127,21 +127,21 @@ const Ke = /* @__PURE__ */ Xe.define(), wr = /* @__PURE__ */ Xe.define(), Rr = /
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
function
|
|
130
|
+
function Or(t) {
|
|
131
131
|
let e = 0;
|
|
132
132
|
return t.iterChangedRanges((r, n) => e = n), e;
|
|
133
133
|
}
|
|
134
|
-
const zt = /* @__PURE__ */
|
|
134
|
+
const zt = /* @__PURE__ */ we.define({
|
|
135
135
|
create() {
|
|
136
136
|
return T.empty;
|
|
137
137
|
},
|
|
138
138
|
update(t, e) {
|
|
139
139
|
let r = e.state.facet(Vt), n = e.annotation(Ke);
|
|
140
140
|
if (n) {
|
|
141
|
-
let a = e.docChanged ? d.single(
|
|
142
|
-
return c ? u =
|
|
141
|
+
let a = e.docChanged ? d.single(Or(e.changes)) : void 0, c = C.fromTransaction(e, a), h = n.side, u = h == 0 ? t.undone : t.done;
|
|
142
|
+
return c ? u = Ce(u, u.length, r.minDepth, c) : u = Gt(u, e.startState.selection), new T(h == 0 ? n.rest : u, h == 0 ? u : n.rest);
|
|
143
143
|
}
|
|
144
|
-
let o = e.annotation(
|
|
144
|
+
let o = e.annotation(Rr);
|
|
145
145
|
if ((o == "full" || o == "before") && (t = t.isolate()), e.annotation(qe.addToHistory) === !1)
|
|
146
146
|
return e.changes.empty ? t : t.addMapping(e.changes.desc);
|
|
147
147
|
let i = C.fromTransaction(e), s = e.annotation(qe.time), l = e.annotation(qe.userEvent);
|
|
@@ -154,7 +154,7 @@ const zt = /* @__PURE__ */ Ee.define({
|
|
|
154
154
|
return new T(t.done.map(C.fromJSON), t.undone.map(C.fromJSON));
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
function
|
|
157
|
+
function Ir(t = {}) {
|
|
158
158
|
return [
|
|
159
159
|
zt,
|
|
160
160
|
Vt.of(t),
|
|
@@ -166,7 +166,7 @@ function Or(t = {}) {
|
|
|
166
166
|
})
|
|
167
167
|
];
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function Re(t, e) {
|
|
170
170
|
return function({ state: r, dispatch: n }) {
|
|
171
171
|
if (!e && r.readOnly)
|
|
172
172
|
return !1;
|
|
@@ -177,7 +177,7 @@ function we(t, e) {
|
|
|
177
177
|
return i ? (n(i), !0) : !1;
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
const Ut = /* @__PURE__ */
|
|
180
|
+
const Ut = /* @__PURE__ */ Re(0, !1), Je = /* @__PURE__ */ Re(1, !1), Pr = /* @__PURE__ */ Re(0, !0), Wr = /* @__PURE__ */ Re(1, !0);
|
|
181
181
|
class C {
|
|
182
182
|
constructor(e, r, n, o, i) {
|
|
183
183
|
this.changes = e, this.effects = r, this.mapped = n, this.startSelection = o, this.selectionsAfter = i;
|
|
@@ -195,14 +195,14 @@ class C {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
static fromJSON(e) {
|
|
198
|
-
return new C(e.changes &&
|
|
198
|
+
return new C(e.changes && _n.fromJSON(e.changes), [], e.mapped && jn.fromJSON(e.mapped), e.startSelection && d.fromJSON(e.startSelection), e.selectionsAfter.map(d.fromJSON));
|
|
199
199
|
}
|
|
200
200
|
// This does not check `addToHistory` and such, it assumes the
|
|
201
201
|
// transaction needs to be converted to an item. Returns null when
|
|
202
202
|
// there are no changes or effects in the transaction.
|
|
203
203
|
static fromTransaction(e, r) {
|
|
204
204
|
let n = L;
|
|
205
|
-
for (let o of e.startState.facet(
|
|
205
|
+
for (let o of e.startState.facet(Tr)) {
|
|
206
206
|
let i = o(e);
|
|
207
207
|
i.length && (n = n.concat(i));
|
|
208
208
|
}
|
|
@@ -212,11 +212,11 @@ class C {
|
|
|
212
212
|
return new C(void 0, L, void 0, void 0, e);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ce(t, e, r, n) {
|
|
216
216
|
let o = e + 1 > r + 20 ? e - r - 1 : 0, i = t.slice(o, e);
|
|
217
217
|
return i.push(n), i;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function Fr(t, e) {
|
|
220
220
|
let r = [], n = !1;
|
|
221
221
|
return t.iterChangedRanges((o, i) => r.push(o, i)), e.iterChangedRanges((o, i, s, l) => {
|
|
222
222
|
for (let a = 0; a < r.length; ) {
|
|
@@ -225,21 +225,21 @@ function Wr(t, e) {
|
|
|
225
225
|
}
|
|
226
226
|
}), n;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Nr(t, e) {
|
|
229
229
|
return t.ranges.length == e.ranges.length && t.ranges.filter((r, n) => r.empty != e.ranges[n].empty).length === 0;
|
|
230
230
|
}
|
|
231
231
|
function $t(t, e) {
|
|
232
232
|
return t.length ? e.length ? t.concat(e) : t : e;
|
|
233
233
|
}
|
|
234
|
-
const L = [],
|
|
234
|
+
const L = [], qr = 200;
|
|
235
235
|
function Gt(t, e) {
|
|
236
236
|
if (t.length) {
|
|
237
|
-
let r = t[t.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length -
|
|
238
|
-
return n.length && n[n.length - 1].eq(e) ? t : (n.push(e),
|
|
237
|
+
let r = t[t.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length - qr));
|
|
238
|
+
return n.length && n[n.length - 1].eq(e) ? t : (n.push(e), Ce(t, t.length - 1, 1e9, r.setSelAfter(n)));
|
|
239
239
|
} else
|
|
240
240
|
return [C.selection([e])];
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function Hr(t) {
|
|
243
243
|
let e = t[t.length - 1], r = t.slice();
|
|
244
244
|
return r[t.length - 1] = e.setSelAfter(e.selectionsAfter.slice(0, e.selectionsAfter.length - 1)), r;
|
|
245
245
|
}
|
|
@@ -248,7 +248,7 @@ function He(t, e) {
|
|
|
248
248
|
return t;
|
|
249
249
|
let r = t.length, n = L;
|
|
250
250
|
for (; r; ) {
|
|
251
|
-
let o =
|
|
251
|
+
let o = Vr(t[r - 1], e, n);
|
|
252
252
|
if (o.changes && !o.changes.empty || o.effects.length) {
|
|
253
253
|
let i = t.slice(0, r);
|
|
254
254
|
return i[r - 1] = o, i;
|
|
@@ -257,14 +257,14 @@ function He(t, e) {
|
|
|
257
257
|
}
|
|
258
258
|
return n.length ? [C.selection(n)] : L;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Vr(t, e, r) {
|
|
261
261
|
let n = $t(t.selectionsAfter.length ? t.selectionsAfter.map((l) => l.map(e)) : L, r);
|
|
262
262
|
if (!t.changes)
|
|
263
263
|
return C.selection(n);
|
|
264
264
|
let o = t.changes.map(e), i = e.mapDesc(t.changes, !0), s = t.mapped ? t.mapped.composeDesc(i) : i;
|
|
265
265
|
return new C(o, w.mapEffects(t.effects, e), s, t.startSelection.map(i), n);
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const zr = /^(input\.type|delete)($|\.)/;
|
|
268
268
|
class T {
|
|
269
269
|
constructor(e, r, n = 0, o = void 0) {
|
|
270
270
|
this.done = e, this.undone = r, this.prevTime = n, this.prevUserEvent = o;
|
|
@@ -274,12 +274,12 @@ class T {
|
|
|
274
274
|
}
|
|
275
275
|
addChanges(e, r, n, o, i) {
|
|
276
276
|
let s = this.done, l = s[s.length - 1];
|
|
277
|
-
return l && l.changes && !l.changes.empty && e.changes && (!n ||
|
|
278
|
-
n == "input.type.compose") ? s =
|
|
277
|
+
return l && l.changes && !l.changes.empty && e.changes && (!n || zr.test(n)) && (!l.selectionsAfter.length && r - this.prevTime < o.newGroupDelay && o.joinToEvent(i, Fr(l.changes, e.changes)) || // For compose (but not compose.start) events, always join with previous event
|
|
278
|
+
n == "input.type.compose") ? s = Ce(s, s.length - 1, o.minDepth, new C(e.changes.compose(l.changes), $t(e.effects, l.effects), l.mapped, l.startSelection, L)) : s = Ce(s, s.length, o.minDepth, e), new T(s, L, r, n);
|
|
279
279
|
}
|
|
280
280
|
addSelection(e, r, n, o) {
|
|
281
281
|
let i = this.done.length ? this.done[this.done.length - 1].selectionsAfter : L;
|
|
282
|
-
return i.length > 0 && r - this.prevTime < o && n == this.prevUserEvent && n && /^select($|\.)/.test(n) &&
|
|
282
|
+
return i.length > 0 && r - this.prevTime < o && n == this.prevUserEvent && n && /^select($|\.)/.test(n) && Nr(i[i.length - 1], e) ? this : new T(Gt(this.done, e), this.undone, r, n);
|
|
283
283
|
}
|
|
284
284
|
addMapping(e) {
|
|
285
285
|
return new T(He(this.done, e), He(this.undone, e), this.prevTime, this.prevUserEvent);
|
|
@@ -292,7 +292,7 @@ class T {
|
|
|
292
292
|
if (n && i.selectionsAfter.length)
|
|
293
293
|
return r.update({
|
|
294
294
|
selection: i.selectionsAfter[i.selectionsAfter.length - 1],
|
|
295
|
-
annotations: Ke.of({ side: e, rest:
|
|
295
|
+
annotations: Ke.of({ side: e, rest: Hr(o) }),
|
|
296
296
|
userEvent: e == 0 ? "select.undo" : "select.redo",
|
|
297
297
|
scrollIntoView: !0
|
|
298
298
|
});
|
|
@@ -312,59 +312,59 @@ class T {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
T.empty = /* @__PURE__ */ new T(L, L);
|
|
315
|
-
const
|
|
315
|
+
const Ur = [
|
|
316
316
|
{ key: "Mod-z", run: Ut, preventDefault: !0 },
|
|
317
317
|
{ key: "Mod-y", mac: "Mod-Shift-z", run: Je, preventDefault: !0 },
|
|
318
318
|
{ linux: "Ctrl-Shift-z", run: Je, preventDefault: !0 },
|
|
319
|
-
{ key: "Mod-u", run:
|
|
320
|
-
{ key: "Alt-u", mac: "Mod-Shift-u", run:
|
|
319
|
+
{ key: "Mod-u", run: Pr, preventDefault: !0 },
|
|
320
|
+
{ key: "Alt-u", mac: "Mod-Shift-u", run: Wr, preventDefault: !0 }
|
|
321
321
|
];
|
|
322
|
-
function
|
|
322
|
+
function re(t, e) {
|
|
323
323
|
return d.create(t.ranges.map(e), t.mainIndex);
|
|
324
324
|
}
|
|
325
325
|
function O(t, e) {
|
|
326
326
|
return t.update({ selection: e, scrollIntoView: !0, userEvent: "select" });
|
|
327
327
|
}
|
|
328
328
|
function R({ state: t, dispatch: e }, r) {
|
|
329
|
-
let n =
|
|
329
|
+
let n = re(t.selection, r);
|
|
330
330
|
return n.eq(t.selection) ? !1 : (e(O(t, n)), !0);
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Te(t, e) {
|
|
333
333
|
return d.cursor(e ? t.to : t.from);
|
|
334
334
|
}
|
|
335
335
|
function Kt(t, e) {
|
|
336
|
-
return R(t, (r) => r.empty ? t.moveByChar(r, e) :
|
|
336
|
+
return R(t, (r) => r.empty ? t.moveByChar(r, e) : Te(r, e));
|
|
337
337
|
}
|
|
338
338
|
function b(t) {
|
|
339
|
-
return t.textDirectionAt(t.state.selection.main.head) ==
|
|
339
|
+
return t.textDirectionAt(t.state.selection.main.head) == Qn.LTR;
|
|
340
340
|
}
|
|
341
341
|
const Jt = (t) => Kt(t, !b(t)), _t = (t) => Kt(t, b(t));
|
|
342
342
|
function jt(t, e) {
|
|
343
|
-
return R(t, (r) => r.empty ? t.moveByGroup(r, e) :
|
|
343
|
+
return R(t, (r) => r.empty ? t.moveByGroup(r, e) : Te(r, e));
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
function
|
|
345
|
+
const $r = (t) => jt(t, !b(t)), Gr = (t) => jt(t, b(t));
|
|
346
|
+
function Kr(t, e, r) {
|
|
347
347
|
if (e.type.prop(r))
|
|
348
348
|
return !0;
|
|
349
349
|
let n = e.to - e.from;
|
|
350
350
|
return n && (n > 2 || /[^\s,.;:]/.test(t.sliceDoc(e.from, e.to))) || e.firstChild;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Oe(t, e, r) {
|
|
353
353
|
let n = et(t).resolveInner(e.head), o = r ? Ge.closedBy : Ge.openedBy;
|
|
354
354
|
for (let a = e.head; ; ) {
|
|
355
355
|
let c = r ? n.childAfter(a) : n.childBefore(a);
|
|
356
356
|
if (!c)
|
|
357
357
|
break;
|
|
358
|
-
|
|
358
|
+
Kr(t, c, o) ? n = c : a = r ? c.to : c.from;
|
|
359
359
|
}
|
|
360
360
|
let i = n.type.prop(o), s, l;
|
|
361
|
-
return i && (s = r ?
|
|
361
|
+
return i && (s = r ? Z(t, n.from, 1) : Z(t, n.to, -1)) && s.matched ? l = r ? s.end.to : s.end.from : l = r ? n.to : n.from, d.cursor(l, r ? -1 : 1);
|
|
362
362
|
}
|
|
363
|
-
const
|
|
363
|
+
const Jr = (t) => R(t, (e) => Oe(t.state, e, !b(t))), _r = (t) => R(t, (e) => Oe(t.state, e, b(t)));
|
|
364
364
|
function Qt(t, e) {
|
|
365
365
|
return R(t, (r) => {
|
|
366
366
|
if (!r.empty)
|
|
367
|
-
return
|
|
367
|
+
return Te(r, e);
|
|
368
368
|
let n = t.moveVertically(r, e);
|
|
369
369
|
return n.head != r.head ? n : t.moveToLineBoundary(r, e);
|
|
370
370
|
});
|
|
@@ -388,7 +388,7 @@ function Xt(t) {
|
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
function en(t, e) {
|
|
391
|
-
let r = Xt(t), { state: n } = t, o =
|
|
391
|
+
let r = Xt(t), { state: n } = t, o = re(n.selection, (s) => s.empty ? t.moveVertically(s, e, r.height) : Te(s, e));
|
|
392
392
|
if (o.eq(n.selection))
|
|
393
393
|
return !1;
|
|
394
394
|
let i;
|
|
@@ -407,10 +407,10 @@ function N(t, e, r) {
|
|
|
407
407
|
}
|
|
408
408
|
return o;
|
|
409
409
|
}
|
|
410
|
-
const
|
|
411
|
-
function
|
|
412
|
-
let n = !1, o =
|
|
413
|
-
let s =
|
|
410
|
+
const jr = (t) => R(t, (e) => N(t, e, !0)), Qr = (t) => R(t, (e) => N(t, e, !1)), Yr = (t) => R(t, (e) => N(t, e, !b(t))), Zr = (t) => R(t, (e) => N(t, e, b(t))), Xr = (t) => R(t, (e) => d.cursor(t.lineBlockAt(e.head).from, 1)), eo = (t) => R(t, (e) => d.cursor(t.lineBlockAt(e.head).to, -1));
|
|
411
|
+
function to(t, e, r) {
|
|
412
|
+
let n = !1, o = re(t.selection, (i) => {
|
|
413
|
+
let s = Z(t, i.head, -1) || Z(t, i.head, 1) || i.head > 0 && Z(t, i.head - 1, 1) || i.head < t.doc.length && Z(t, i.head + 1, -1);
|
|
414
414
|
if (!s || !s.end)
|
|
415
415
|
return i;
|
|
416
416
|
n = !0;
|
|
@@ -419,34 +419,34 @@ function eo(t, e, r) {
|
|
|
419
419
|
});
|
|
420
420
|
return n ? (e(O(t, o)), !0) : !1;
|
|
421
421
|
}
|
|
422
|
-
const
|
|
423
|
-
function
|
|
424
|
-
let r =
|
|
422
|
+
const no = ({ state: t, dispatch: e }) => to(t, e, !1);
|
|
423
|
+
function B(t, e) {
|
|
424
|
+
let r = re(t.state.selection, (n) => {
|
|
425
425
|
let o = e(n);
|
|
426
426
|
return d.range(n.anchor, o.head, o.goalColumn, o.bidiLevel || void 0);
|
|
427
427
|
});
|
|
428
428
|
return r.eq(t.state.selection) ? !1 : (t.dispatch(O(t.state, r)), !0);
|
|
429
429
|
}
|
|
430
430
|
function tn(t, e) {
|
|
431
|
-
return
|
|
431
|
+
return B(t, (r) => t.moveByChar(r, e));
|
|
432
432
|
}
|
|
433
433
|
const nn = (t) => tn(t, !b(t)), rn = (t) => tn(t, b(t));
|
|
434
434
|
function on(t, e) {
|
|
435
|
-
return
|
|
435
|
+
return B(t, (r) => t.moveByGroup(r, e));
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const ro = (t) => on(t, !b(t)), oo = (t) => on(t, b(t)), io = (t) => B(t, (e) => Oe(t.state, e, !b(t))), so = (t) => B(t, (e) => Oe(t.state, e, b(t)));
|
|
438
438
|
function sn(t, e) {
|
|
439
|
-
return
|
|
439
|
+
return B(t, (r) => t.moveVertically(r, e));
|
|
440
440
|
}
|
|
441
441
|
const ln = (t) => sn(t, !1), an = (t) => sn(t, !0);
|
|
442
442
|
function cn(t, e) {
|
|
443
|
-
return
|
|
443
|
+
return B(t, (r) => t.moveVertically(r, e, Xt(t).height));
|
|
444
444
|
}
|
|
445
|
-
const ut = (t) => cn(t, !1), ft = (t) => cn(t, !0),
|
|
446
|
-
let r =
|
|
445
|
+
const ut = (t) => cn(t, !1), ft = (t) => cn(t, !0), lo = (t) => B(t, (e) => N(t, e, !0)), ao = (t) => B(t, (e) => N(t, e, !1)), co = (t) => B(t, (e) => N(t, e, !b(t))), ho = (t) => B(t, (e) => N(t, e, b(t))), uo = (t) => B(t, (e) => d.cursor(t.lineBlockAt(e.head).from)), fo = (t) => B(t, (e) => d.cursor(t.lineBlockAt(e.head).to)), dt = ({ state: t, dispatch: e }) => (e(O(t, { anchor: 0 })), !0), mt = ({ state: t, dispatch: e }) => (e(O(t, { anchor: t.doc.length })), !0), gt = ({ state: t, dispatch: e }) => (e(O(t, { anchor: t.selection.main.anchor, head: 0 })), !0), pt = ({ state: t, dispatch: e }) => (e(O(t, { anchor: t.selection.main.anchor, head: t.doc.length })), !0), mo = ({ state: t, dispatch: e }) => (e(t.update({ selection: { anchor: 0, head: t.doc.length }, userEvent: "select" })), !0), go = ({ state: t, dispatch: e }) => {
|
|
446
|
+
let r = Pe(t).map(({ from: n, to: o }) => d.range(n, Math.min(o + 1, t.doc.length)));
|
|
447
447
|
return e(t.update({ selection: d.create(r), userEvent: "select" })), !0;
|
|
448
|
-
},
|
|
449
|
-
let r =
|
|
448
|
+
}, po = ({ state: t, dispatch: e }) => {
|
|
449
|
+
let r = re(t.selection, (n) => {
|
|
450
450
|
var o;
|
|
451
451
|
let i = et(t).resolveInner(n.head, 1);
|
|
452
452
|
for (; !(i.from < n.from && i.to >= n.to || i.to > n.to && i.from <= n.from || !(!((o = i.parent) === null || o === void 0) && o.parent)); )
|
|
@@ -454,20 +454,20 @@ const ut = (t) => cn(t, !1), ft = (t) => cn(t, !0), so = (t) => D(t, (e) => N(t,
|
|
|
454
454
|
return d.range(i.to, i.from);
|
|
455
455
|
});
|
|
456
456
|
return e(O(t, r)), !0;
|
|
457
|
-
},
|
|
457
|
+
}, yo = ({ state: t, dispatch: e }) => {
|
|
458
458
|
let r = t.selection, n = null;
|
|
459
459
|
return r.ranges.length > 1 ? n = d.create([r.main]) : r.main.empty || (n = d.create([d.cursor(r.main.head)])), n ? (e(O(t, n)), !0) : !1;
|
|
460
460
|
};
|
|
461
|
-
function
|
|
461
|
+
function Ie(t, e) {
|
|
462
462
|
if (t.state.readOnly)
|
|
463
463
|
return !1;
|
|
464
464
|
let r = "delete.selection", { state: n } = t, o = n.changeByRange((i) => {
|
|
465
465
|
let { from: s, to: l } = i;
|
|
466
466
|
if (s == l) {
|
|
467
467
|
let a = e(s);
|
|
468
|
-
a < s ? (r = "delete.backward", a =
|
|
468
|
+
a < s ? (r = "delete.backward", a = ge(t, a, !1)) : a > s && (r = "delete.forward", a = ge(t, a, !0)), s = Math.min(s, a), l = Math.max(l, a);
|
|
469
469
|
} else
|
|
470
|
-
s =
|
|
470
|
+
s = ge(t, s, !1), l = ge(t, l, !0);
|
|
471
471
|
return s == l ? { range: i } : { changes: { from: s, to: l }, range: d.cursor(s) };
|
|
472
472
|
});
|
|
473
473
|
return o.changes.empty ? !1 : (t.dispatch(n.update(o, {
|
|
@@ -476,7 +476,7 @@ function Oe(t, e) {
|
|
|
476
476
|
effects: r == "delete.selection" ? p.announce.of(n.phrase("Selection deleted")) : void 0
|
|
477
477
|
})), !0);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function ge(t, e, r) {
|
|
480
480
|
if (t instanceof p)
|
|
481
481
|
for (let n of t.state.facet(p.atomicRanges).map((o) => o(t)))
|
|
482
482
|
n.between(e, e, (o, i) => {
|
|
@@ -484,7 +484,7 @@ function me(t, e, r) {
|
|
|
484
484
|
});
|
|
485
485
|
return e;
|
|
486
486
|
}
|
|
487
|
-
const hn = (t, e) =>
|
|
487
|
+
const hn = (t, e) => Ie(t, (r) => {
|
|
488
488
|
let { state: n } = t, o = n.doc.lineAt(r), i, s;
|
|
489
489
|
if (!e && r > o.from && r < o.from + 200 && !/[^ \t]/.test(i = o.text.slice(0, r - o.from))) {
|
|
490
490
|
if (i[i.length - 1] == " ")
|
|
@@ -494,28 +494,28 @@ const hn = (t, e) => Oe(t, (r) => {
|
|
|
494
494
|
r--;
|
|
495
495
|
s = r;
|
|
496
496
|
} else
|
|
497
|
-
s =
|
|
497
|
+
s = ee(o.text, r - o.from, e, e) + o.from, s == r && o.number != (e ? n.doc.lines : 1) && (s += e ? 1 : -1);
|
|
498
498
|
return s;
|
|
499
|
-
}), je = (t) => hn(t, !1), un = (t) => hn(t, !0), fn = (t, e) =>
|
|
499
|
+
}), je = (t) => hn(t, !1), un = (t) => hn(t, !0), fn = (t, e) => Ie(t, (r) => {
|
|
500
500
|
let n = r, { state: o } = t, i = o.doc.lineAt(n), s = o.charCategorizer(n);
|
|
501
501
|
for (let l = null; ; ) {
|
|
502
502
|
if (n == (e ? i.to : i.from)) {
|
|
503
503
|
n == r && i.number != (e ? o.doc.lines : 1) && (n += e ? 1 : -1);
|
|
504
504
|
break;
|
|
505
505
|
}
|
|
506
|
-
let a =
|
|
506
|
+
let a = ee(i.text, n - i.from, e) + i.from, c = i.text.slice(Math.min(n, a) - i.from, Math.max(n, a) - i.from), h = s(c);
|
|
507
507
|
if (l != null && h != l)
|
|
508
508
|
break;
|
|
509
509
|
(c != " " || n != r) && (l = h), n = a;
|
|
510
510
|
}
|
|
511
511
|
return n;
|
|
512
|
-
}), dn = (t) => fn(t, !1),
|
|
512
|
+
}), dn = (t) => fn(t, !1), xo = (t) => fn(t, !0), mn = (t) => Ie(t, (e) => {
|
|
513
513
|
let r = t.lineBlockAt(e).to;
|
|
514
514
|
return e < r ? r : Math.min(t.state.doc.length, e + 1);
|
|
515
|
-
}),
|
|
515
|
+
}), ko = (t) => Ie(t, (e) => {
|
|
516
516
|
let r = t.lineBlockAt(e).from;
|
|
517
517
|
return e > r ? r : Math.max(0, e - 1);
|
|
518
|
-
}),
|
|
518
|
+
}), bo = ({ state: t, dispatch: e }) => {
|
|
519
519
|
if (t.readOnly)
|
|
520
520
|
return !1;
|
|
521
521
|
let r = t.changeByRange((n) => ({
|
|
@@ -523,13 +523,13 @@ const hn = (t, e) => Oe(t, (r) => {
|
|
|
523
523
|
range: d.cursor(n.from)
|
|
524
524
|
}));
|
|
525
525
|
return e(t.update(r, { scrollIntoView: !0, userEvent: "input" })), !0;
|
|
526
|
-
},
|
|
526
|
+
}, So = ({ state: t, dispatch: e }) => {
|
|
527
527
|
if (t.readOnly)
|
|
528
528
|
return !1;
|
|
529
529
|
let r = t.changeByRange((n) => {
|
|
530
530
|
if (!n.empty || n.from == 0 || n.from == t.doc.length)
|
|
531
531
|
return { range: n };
|
|
532
|
-
let o = n.from, i = t.doc.lineAt(o), s = o == i.from ? o - 1 :
|
|
532
|
+
let o = n.from, i = t.doc.lineAt(o), s = o == i.from ? o - 1 : ee(i.text, o - i.from, !1) + i.from, l = o == i.to ? o + 1 : ee(i.text, o - i.from, !0) + i.from;
|
|
533
533
|
return {
|
|
534
534
|
changes: { from: s, to: l, insert: t.doc.slice(o, l).append(t.doc.slice(s, o)) },
|
|
535
535
|
range: d.cursor(l)
|
|
@@ -537,7 +537,7 @@ const hn = (t, e) => Oe(t, (r) => {
|
|
|
537
537
|
});
|
|
538
538
|
return r.changes.empty ? !1 : (e(t.update(r, { scrollIntoView: !0, userEvent: "move.character" })), !0);
|
|
539
539
|
};
|
|
540
|
-
function
|
|
540
|
+
function Pe(t) {
|
|
541
541
|
let e = [], r = -1;
|
|
542
542
|
for (let n of t.selection.ranges) {
|
|
543
543
|
let o = t.doc.lineAt(n.from), i = t.doc.lineAt(n.to);
|
|
@@ -554,7 +554,7 @@ function gn(t, e, r) {
|
|
|
554
554
|
if (t.readOnly)
|
|
555
555
|
return !1;
|
|
556
556
|
let n = [], o = [];
|
|
557
|
-
for (let i of
|
|
557
|
+
for (let i of Pe(t)) {
|
|
558
558
|
if (r ? i.to == t.doc.length : i.from == 0)
|
|
559
559
|
continue;
|
|
560
560
|
let s = t.doc.lineAt(r ? i.to + 1 : i.from - 1), l = s.length + 1;
|
|
@@ -575,41 +575,41 @@ function gn(t, e, r) {
|
|
|
575
575
|
userEvent: "move.line"
|
|
576
576
|
})), !0) : !1;
|
|
577
577
|
}
|
|
578
|
-
const
|
|
578
|
+
const Co = ({ state: t, dispatch: e }) => gn(t, e, !1), vo = ({ state: t, dispatch: e }) => gn(t, e, !0);
|
|
579
579
|
function pn(t, e, r) {
|
|
580
580
|
if (t.readOnly)
|
|
581
581
|
return !1;
|
|
582
582
|
let n = [];
|
|
583
|
-
for (let o of
|
|
583
|
+
for (let o of Pe(t))
|
|
584
584
|
r ? n.push({ from: o.from, insert: t.doc.slice(o.from, o.to) + t.lineBreak }) : n.push({ from: o.to, insert: t.lineBreak + t.doc.slice(o.from, o.to) });
|
|
585
585
|
return e(t.update({ changes: n, scrollIntoView: !0, userEvent: "input.copyline" })), !0;
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const Ao = ({ state: t, dispatch: e }) => pn(t, e, !1), Mo = ({ state: t, dispatch: e }) => pn(t, e, !0), Lo = (t) => {
|
|
588
588
|
if (t.state.readOnly)
|
|
589
589
|
return !1;
|
|
590
|
-
let { state: e } = t, r = e.changes(
|
|
590
|
+
let { state: e } = t, r = e.changes(Pe(e).map(({ from: o, to: i }) => (o > 0 ? o-- : i < e.doc.length && i++, { from: o, to: i }))), n = re(e.selection, (o) => t.moveVertically(o, !0)).map(r);
|
|
591
591
|
return t.dispatch({ changes: r, selection: n, scrollIntoView: !0, userEvent: "delete.line" }), !0;
|
|
592
592
|
};
|
|
593
|
-
function
|
|
593
|
+
function Bo(t, e) {
|
|
594
594
|
if (/\(\)|\[\]|\{\}/.test(t.sliceDoc(e - 1, e + 1)))
|
|
595
595
|
return { from: e, to: e };
|
|
596
596
|
let r = et(t).resolveInner(e), n = r.childBefore(e), o = r.childAfter(e), i;
|
|
597
597
|
return n && o && n.to <= e && o.from >= e && (i = n.type.prop(Ge.closedBy)) && i.indexOf(o.name) > -1 && t.doc.lineAt(n.to).from == t.doc.lineAt(o.from).from ? { from: n.to, to: o.from } : null;
|
|
598
598
|
}
|
|
599
|
-
const Do = /* @__PURE__ */ yn(!1),
|
|
599
|
+
const Do = /* @__PURE__ */ yn(!1), Eo = /* @__PURE__ */ yn(!0);
|
|
600
600
|
function yn(t) {
|
|
601
601
|
return ({ state: e, dispatch: r }) => {
|
|
602
602
|
if (e.readOnly)
|
|
603
603
|
return !1;
|
|
604
604
|
let n = e.changeByRange((o) => {
|
|
605
|
-
let { from: i, to: s } = o, l = e.doc.lineAt(i), a = !t && i == s &&
|
|
605
|
+
let { from: i, to: s } = o, l = e.doc.lineAt(i), a = !t && i == s && Bo(e, i);
|
|
606
606
|
t && (i = s = (s <= l.to ? l : e.doc.lineAt(s)).to);
|
|
607
607
|
let c = new Tt(e, { simulateBreak: i, simulateDoubleBreak: !!a }), h = Ot(c, i);
|
|
608
608
|
for (h == null && (h = /^\s*/.exec(e.doc.lineAt(i).text)[0].length); s < l.to && /\s/.test(l.text[s - l.from]); )
|
|
609
609
|
s++;
|
|
610
610
|
a ? { from: i, to: s } = a : i > l.from && i < l.from + 100 && !/\S/.test(l.text.slice(0, i)) && (i = l.from);
|
|
611
|
-
let u = ["",
|
|
612
|
-
return a && u.push(
|
|
611
|
+
let u = ["", Se(e, h)];
|
|
612
|
+
return a && u.push(Se(e, c.lineIndent(l.from, -1))), {
|
|
613
613
|
changes: { from: i, to: s, insert: It.of(u) },
|
|
614
614
|
range: d.cursor(i + 1 + u[1].length)
|
|
615
615
|
};
|
|
@@ -632,7 +632,7 @@ function ot(t, e) {
|
|
|
632
632
|
};
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const
|
|
635
|
+
const wo = ({ state: t, dispatch: e }) => {
|
|
636
636
|
if (t.readOnly)
|
|
637
637
|
return !1;
|
|
638
638
|
let r = /* @__PURE__ */ Object.create(null), n = new Tt(t, { overrideIndentation: (i) => {
|
|
@@ -643,7 +643,7 @@ const Eo = ({ state: t, dispatch: e }) => {
|
|
|
643
643
|
if (a == null)
|
|
644
644
|
return;
|
|
645
645
|
/\S/.test(i.text) || (a = 0);
|
|
646
|
-
let c = /^\s*/.exec(i.text)[0], h =
|
|
646
|
+
let c = /^\s*/.exec(i.text)[0], h = Se(t, a);
|
|
647
647
|
(c != h || l.from < i.from + c.length) && (r[i.from] = a, s.push({ from: i.from, to: i.from + c.length, insert: h }));
|
|
648
648
|
});
|
|
649
649
|
return o.changes.empty || e(t.update(o, { userEvent: "indent" })), !0;
|
|
@@ -653,31 +653,31 @@ const Eo = ({ state: t, dispatch: e }) => {
|
|
|
653
653
|
let o = /^\s*/.exec(r.text)[0];
|
|
654
654
|
if (!o)
|
|
655
655
|
return;
|
|
656
|
-
let i = Wt(o, t.tabSize), s = 0, l =
|
|
656
|
+
let i = Wt(o, t.tabSize), s = 0, l = Se(t, Math.max(0, i - $e(t)));
|
|
657
657
|
for (; s < o.length && s < l.length && o.charCodeAt(s) == l.charCodeAt(s); )
|
|
658
658
|
s++;
|
|
659
659
|
n.push({ from: r.from + s, to: r.from + o.length, insert: l.slice(s) });
|
|
660
|
-
}), { userEvent: "delete.dedent" })), !0),
|
|
660
|
+
}), { userEvent: "delete.dedent" })), !0), Ro = [
|
|
661
661
|
{ key: "Ctrl-b", run: Jt, shift: nn, preventDefault: !0 },
|
|
662
662
|
{ key: "Ctrl-f", run: _t, shift: rn },
|
|
663
663
|
{ key: "Ctrl-p", run: Yt, shift: ln },
|
|
664
664
|
{ key: "Ctrl-n", run: Zt, shift: an },
|
|
665
|
-
{ key: "Ctrl-a", run:
|
|
666
|
-
{ key: "Ctrl-e", run:
|
|
665
|
+
{ key: "Ctrl-a", run: Xr, shift: uo },
|
|
666
|
+
{ key: "Ctrl-e", run: eo, shift: fo },
|
|
667
667
|
{ key: "Ctrl-d", run: un },
|
|
668
668
|
{ key: "Ctrl-h", run: je },
|
|
669
669
|
{ key: "Ctrl-k", run: mn },
|
|
670
670
|
{ key: "Ctrl-Alt-h", run: dn },
|
|
671
|
-
{ key: "Ctrl-o", run:
|
|
672
|
-
{ key: "Ctrl-t", run:
|
|
671
|
+
{ key: "Ctrl-o", run: bo },
|
|
672
|
+
{ key: "Ctrl-t", run: So },
|
|
673
673
|
{ key: "Ctrl-v", run: _e }
|
|
674
|
-
],
|
|
674
|
+
], To = /* @__PURE__ */ [
|
|
675
675
|
{ key: "ArrowLeft", run: Jt, shift: nn, preventDefault: !0 },
|
|
676
|
-
{ key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run:
|
|
677
|
-
{ mac: "Cmd-ArrowLeft", run:
|
|
676
|
+
{ key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: $r, shift: ro, preventDefault: !0 },
|
|
677
|
+
{ mac: "Cmd-ArrowLeft", run: Yr, shift: co, preventDefault: !0 },
|
|
678
678
|
{ key: "ArrowRight", run: _t, shift: rn, preventDefault: !0 },
|
|
679
|
-
{ key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run:
|
|
680
|
-
{ mac: "Cmd-ArrowRight", run:
|
|
679
|
+
{ key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: Gr, shift: oo, preventDefault: !0 },
|
|
680
|
+
{ mac: "Cmd-ArrowRight", run: Zr, shift: ho, preventDefault: !0 },
|
|
681
681
|
{ key: "ArrowUp", run: Yt, shift: ln, preventDefault: !0 },
|
|
682
682
|
{ mac: "Cmd-ArrowUp", run: dt, shift: gt },
|
|
683
683
|
{ mac: "Ctrl-ArrowUp", run: ht, shift: ut },
|
|
@@ -686,37 +686,37 @@ const Eo = ({ state: t, dispatch: e }) => {
|
|
|
686
686
|
{ mac: "Ctrl-ArrowDown", run: _e, shift: ft },
|
|
687
687
|
{ key: "PageUp", run: ht, shift: ut },
|
|
688
688
|
{ key: "PageDown", run: _e, shift: ft },
|
|
689
|
-
{ key: "Home", run:
|
|
689
|
+
{ key: "Home", run: Qr, shift: ao, preventDefault: !0 },
|
|
690
690
|
{ key: "Mod-Home", run: dt, shift: gt },
|
|
691
|
-
{ key: "End", run:
|
|
691
|
+
{ key: "End", run: jr, shift: lo, preventDefault: !0 },
|
|
692
692
|
{ key: "Mod-End", run: mt, shift: pt },
|
|
693
693
|
{ key: "Enter", run: Do },
|
|
694
|
-
{ key: "Mod-a", run:
|
|
694
|
+
{ key: "Mod-a", run: mo },
|
|
695
695
|
{ key: "Backspace", run: je, shift: je },
|
|
696
696
|
{ key: "Delete", run: un },
|
|
697
697
|
{ key: "Mod-Backspace", mac: "Alt-Backspace", run: dn },
|
|
698
|
-
{ key: "Mod-Delete", mac: "Alt-Delete", run:
|
|
699
|
-
{ mac: "Mod-Backspace", run:
|
|
698
|
+
{ key: "Mod-Delete", mac: "Alt-Delete", run: xo },
|
|
699
|
+
{ mac: "Mod-Backspace", run: ko },
|
|
700
700
|
{ mac: "Mod-Delete", run: mn }
|
|
701
|
-
].concat(/* @__PURE__ */
|
|
702
|
-
{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run:
|
|
703
|
-
{ key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run:
|
|
704
|
-
{ key: "Alt-ArrowUp", run:
|
|
705
|
-
{ key: "Shift-Alt-ArrowUp", run:
|
|
706
|
-
{ key: "Alt-ArrowDown", run:
|
|
707
|
-
{ key: "Shift-Alt-ArrowDown", run:
|
|
708
|
-
{ key: "Escape", run:
|
|
709
|
-
{ key: "Mod-Enter", run:
|
|
710
|
-
{ key: "Alt-l", mac: "Ctrl-l", run:
|
|
711
|
-
{ key: "Mod-i", run:
|
|
701
|
+
].concat(/* @__PURE__ */ Ro.map((t) => ({ mac: t.key, run: t.run, shift: t.shift }))), Oo = /* @__PURE__ */ [
|
|
702
|
+
{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: Jr, shift: io },
|
|
703
|
+
{ key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: _r, shift: so },
|
|
704
|
+
{ key: "Alt-ArrowUp", run: Co },
|
|
705
|
+
{ key: "Shift-Alt-ArrowUp", run: Ao },
|
|
706
|
+
{ key: "Alt-ArrowDown", run: vo },
|
|
707
|
+
{ key: "Shift-Alt-ArrowDown", run: Mo },
|
|
708
|
+
{ key: "Escape", run: yo },
|
|
709
|
+
{ key: "Mod-Enter", run: Eo },
|
|
710
|
+
{ key: "Alt-l", mac: "Ctrl-l", run: go },
|
|
711
|
+
{ key: "Mod-i", run: po, preventDefault: !0 },
|
|
712
712
|
{ key: "Mod-[", run: kn },
|
|
713
713
|
{ key: "Mod-]", run: xn },
|
|
714
|
-
{ key: "Mod-Alt-\\", run:
|
|
715
|
-
{ key: "Shift-Mod-k", run:
|
|
716
|
-
{ key: "Shift-Mod-\\", run:
|
|
717
|
-
{ key: "Mod-/", run:
|
|
718
|
-
{ key: "Alt-A", run:
|
|
719
|
-
].concat(
|
|
714
|
+
{ key: "Mod-Alt-\\", run: wo },
|
|
715
|
+
{ key: "Shift-Mod-k", run: Lo },
|
|
716
|
+
{ key: "Shift-Mod-\\", run: no },
|
|
717
|
+
{ key: "Mod-/", run: Ar },
|
|
718
|
+
{ key: "Alt-A", run: Lr }
|
|
719
|
+
].concat(To), Io = { key: "Tab", run: xn, shift: kn };
|
|
720
720
|
function g() {
|
|
721
721
|
var t = arguments[0];
|
|
722
722
|
typeof t == "string" && (t = document.createElement(t));
|
|
@@ -746,7 +746,7 @@ function bn(t, e) {
|
|
|
746
746
|
throw new RangeError("Unsupported child node: " + e);
|
|
747
747
|
}
|
|
748
748
|
const yt = typeof String.prototype.normalize == "function" ? (t) => t.normalize("NFKD") : (t) => t;
|
|
749
|
-
class
|
|
749
|
+
class te {
|
|
750
750
|
/**
|
|
751
751
|
Create a text cursor. The query is the search string, `from` to
|
|
752
752
|
`to` provides the region to search.
|
|
@@ -769,7 +769,7 @@ class Z {
|
|
|
769
769
|
return -1;
|
|
770
770
|
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
771
771
|
}
|
|
772
|
-
return
|
|
772
|
+
return Yn(this.buffer, this.bufferPos);
|
|
773
773
|
}
|
|
774
774
|
/**
|
|
775
775
|
Look for the next match. Updates the iterator's
|
|
@@ -792,8 +792,8 @@ class Z {
|
|
|
792
792
|
let e = this.peek();
|
|
793
793
|
if (e < 0)
|
|
794
794
|
return this.done = !0, this;
|
|
795
|
-
let r =
|
|
796
|
-
this.bufferPos +=
|
|
795
|
+
let r = er(e), n = this.bufferStart + this.bufferPos;
|
|
796
|
+
this.bufferPos += Zn(e);
|
|
797
797
|
let o = this.normalize(r);
|
|
798
798
|
for (let i = 0, s = n; ; i++) {
|
|
799
799
|
let l = o.charCodeAt(i), a = this.match(l, s);
|
|
@@ -815,7 +815,7 @@ class Z {
|
|
|
815
815
|
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? n = { from: r, to: r + 1 } : this.matches.push(1, r)), n && this.test && !this.test(n.from, n.to, this.buffer, this.bufferPos) && (n = null), n;
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
typeof Symbol < "u" && (
|
|
818
|
+
typeof Symbol < "u" && (te.prototype[Symbol.iterator] = function() {
|
|
819
819
|
return this;
|
|
820
820
|
});
|
|
821
821
|
const Sn = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, it = "gm" + (/x/.unicode == null ? "" : "u");
|
|
@@ -830,7 +830,7 @@ class Cn {
|
|
|
830
830
|
return new vn(e, r, n, o, i);
|
|
831
831
|
this.re = new RegExp(r, it + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.iter = e.iter();
|
|
832
832
|
let s = e.lineAt(o);
|
|
833
|
-
this.curLineStart = s.from, this.matchPos =
|
|
833
|
+
this.curLineStart = s.from, this.matchPos = ve(e, o), this.getLine(this.curLineStart);
|
|
834
834
|
}
|
|
835
835
|
getLine(e) {
|
|
836
836
|
this.iter.next(e), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
@@ -847,7 +847,7 @@ class Cn {
|
|
|
847
847
|
let r = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
848
848
|
if (r) {
|
|
849
849
|
let n = this.curLineStart + r.index, o = n + r[0].length;
|
|
850
|
-
if (this.matchPos =
|
|
850
|
+
if (this.matchPos = ve(this.text, o + (n == o ? 1 : 0)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < o || n > this.value.to) && (!this.test || this.test(n, o, r)))
|
|
851
851
|
return this.value = { from: n, to: o, match: r }, this;
|
|
852
852
|
e = this.matchPos - this.curLineStart;
|
|
853
853
|
} else if (this.curLineStart + this.curLine.length < this.to)
|
|
@@ -858,7 +858,7 @@ class Cn {
|
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
const Ve = /* @__PURE__ */ new WeakMap();
|
|
861
|
-
class
|
|
861
|
+
class X {
|
|
862
862
|
constructor(e, r) {
|
|
863
863
|
this.from = e, this.text = r;
|
|
864
864
|
}
|
|
@@ -868,18 +868,18 @@ class Q {
|
|
|
868
868
|
static get(e, r, n) {
|
|
869
869
|
let o = Ve.get(e);
|
|
870
870
|
if (!o || o.from >= n || o.to <= r) {
|
|
871
|
-
let l = new
|
|
871
|
+
let l = new X(r, e.sliceString(r, n));
|
|
872
872
|
return Ve.set(e, l), l;
|
|
873
873
|
}
|
|
874
874
|
if (o.from == r && o.to == n)
|
|
875
875
|
return o;
|
|
876
876
|
let { text: i, from: s } = o;
|
|
877
|
-
return s > r && (i = e.sliceString(r, s) + i, s = r), o.to < n && (i += e.sliceString(o.to, n)), Ve.set(e, new
|
|
877
|
+
return s > r && (i = e.sliceString(r, s) + i, s = r), o.to < n && (i += e.sliceString(o.to, n)), Ve.set(e, new X(s, i)), new X(r, i.slice(r - s, n - s));
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
class vn {
|
|
881
881
|
constructor(e, r, n, o, i) {
|
|
882
|
-
this.text = e, this.to = i, this.done = !1, this.value = Sn, this.matchPos =
|
|
882
|
+
this.text = e, this.to = i, this.done = !1, this.value = Sn, this.matchPos = ve(e, o), this.re = new RegExp(r, it + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.flat = X.get(e, o, this.chunkEnd(
|
|
883
883
|
o + 5e3
|
|
884
884
|
/* Base */
|
|
885
885
|
));
|
|
@@ -893,25 +893,25 @@ class vn {
|
|
|
893
893
|
if (r && !r[0] && r.index == e && (this.re.lastIndex = e + 1, r = this.re.exec(this.flat.text)), r) {
|
|
894
894
|
let n = this.flat.from + r.index, o = n + r[0].length;
|
|
895
895
|
if ((this.flat.to >= this.to || r.index + r[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n, o, r)))
|
|
896
|
-
return this.value = { from: n, to: o, match: r }, this.matchPos =
|
|
896
|
+
return this.value = { from: n, to: o, match: r }, this.matchPos = ve(this.text, o + (n == o ? 1 : 0)), this;
|
|
897
897
|
}
|
|
898
898
|
if (this.flat.to == this.to)
|
|
899
899
|
return this.done = !0, this;
|
|
900
|
-
this.flat =
|
|
900
|
+
this.flat = X.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
typeof Symbol < "u" && (Cn.prototype[Symbol.iterator] = vn.prototype[Symbol.iterator] = function() {
|
|
905
905
|
return this;
|
|
906
906
|
});
|
|
907
|
-
function
|
|
907
|
+
function Po(t) {
|
|
908
908
|
try {
|
|
909
909
|
return new RegExp(t, it), !0;
|
|
910
910
|
} catch {
|
|
911
911
|
return !1;
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function ve(t, e) {
|
|
915
915
|
if (e >= t.length)
|
|
916
916
|
return e;
|
|
917
917
|
let r = t.lineAt(e), n;
|
|
@@ -923,7 +923,7 @@ function Qe(t) {
|
|
|
923
923
|
let e = g("input", { class: "cm-textfield", name: "line" }), r = g("form", {
|
|
924
924
|
class: "cm-gotoLine",
|
|
925
925
|
onkeydown: (o) => {
|
|
926
|
-
o.keyCode == 27 ? (o.preventDefault(), t.dispatch({ effects:
|
|
926
|
+
o.keyCode == 27 ? (o.preventDefault(), t.dispatch({ effects: Ae.of(!1) }), t.focus()) : o.keyCode == 13 && (o.preventDefault(), n());
|
|
927
927
|
},
|
|
928
928
|
onsubmit: (o) => {
|
|
929
929
|
o.preventDefault(), n();
|
|
@@ -935,66 +935,66 @@ function Qe(t) {
|
|
|
935
935
|
return;
|
|
936
936
|
let { state: i } = t, s = i.doc.lineAt(i.selection.main.head), [, l, a, c, h] = o, u = c ? +c.slice(1) : 0, m = a ? +a : s.number;
|
|
937
937
|
if (a && h) {
|
|
938
|
-
let
|
|
939
|
-
l && (
|
|
938
|
+
let D = m / 100;
|
|
939
|
+
l && (D = D * (l == "-" ? -1 : 1) + s.number / i.doc.lines), m = Math.round(i.doc.lines * D);
|
|
940
940
|
} else
|
|
941
941
|
a && l && (m = m * (l == "-" ? -1 : 1) + s.number);
|
|
942
942
|
let x = i.doc.line(Math.max(1, Math.min(i.doc.lines, m))), S = d.cursor(x.from + Math.max(0, Math.min(u, x.length)));
|
|
943
943
|
t.dispatch({
|
|
944
|
-
effects: [
|
|
944
|
+
effects: [Ae.of(!1), p.scrollIntoView(S.from, { y: "center" })],
|
|
945
945
|
selection: S
|
|
946
946
|
}), t.focus();
|
|
947
947
|
}
|
|
948
948
|
return { dom: r };
|
|
949
949
|
}
|
|
950
|
-
const
|
|
950
|
+
const Ae = /* @__PURE__ */ w.define(), xt = /* @__PURE__ */ we.define({
|
|
951
951
|
create() {
|
|
952
952
|
return !0;
|
|
953
953
|
},
|
|
954
954
|
update(t, e) {
|
|
955
955
|
for (let r of e.effects)
|
|
956
|
-
r.is(
|
|
956
|
+
r.is(Ae) && (t = r.value);
|
|
957
957
|
return t;
|
|
958
958
|
},
|
|
959
959
|
provide: (t) => tt.from(t, (e) => e ? Qe : null)
|
|
960
|
-
}),
|
|
961
|
-
let e =
|
|
960
|
+
}), Wo = (t) => {
|
|
961
|
+
let e = ae(t, Qe);
|
|
962
962
|
if (!e) {
|
|
963
|
-
let r = [
|
|
964
|
-
t.state.field(xt, !1) == null && r.push(w.appendConfig.of([xt,
|
|
963
|
+
let r = [Ae.of(!0)];
|
|
964
|
+
t.state.field(xt, !1) == null && r.push(w.appendConfig.of([xt, Fo])), t.dispatch({ effects: r }), e = ae(t, Qe);
|
|
965
965
|
}
|
|
966
966
|
return e && e.dom.querySelector("input").focus(), !0;
|
|
967
|
-
},
|
|
967
|
+
}, Fo = /* @__PURE__ */ p.baseTheme({
|
|
968
968
|
".cm-panel.cm-gotoLine": {
|
|
969
969
|
padding: "2px 6px 4px",
|
|
970
970
|
"& label": { fontSize: "80%" }
|
|
971
971
|
}
|
|
972
|
-
}),
|
|
972
|
+
}), No = {
|
|
973
973
|
highlightWordAroundCursor: !1,
|
|
974
974
|
minSelectionLength: 1,
|
|
975
975
|
maxMatches: 100,
|
|
976
976
|
wholeWords: !1
|
|
977
|
-
}, An = /* @__PURE__ */
|
|
977
|
+
}, An = /* @__PURE__ */ ue.define({
|
|
978
978
|
combine(t) {
|
|
979
|
-
return
|
|
979
|
+
return Ee(t, No, {
|
|
980
980
|
highlightWordAroundCursor: (e, r) => e || r,
|
|
981
981
|
minSelectionLength: Math.min,
|
|
982
982
|
maxMatches: Math.min
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
985
|
});
|
|
986
|
-
function
|
|
987
|
-
let e = [
|
|
986
|
+
function qo(t) {
|
|
987
|
+
let e = [$o, Uo];
|
|
988
988
|
return t && e.push(An.of(t)), e;
|
|
989
989
|
}
|
|
990
|
-
const
|
|
990
|
+
const Ho = /* @__PURE__ */ y.mark({ class: "cm-selectionMatch" }), Vo = /* @__PURE__ */ y.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
991
991
|
function kt(t, e, r, n) {
|
|
992
992
|
return (r == 0 || t(e.sliceDoc(r - 1, r)) != M.Word) && (n == e.doc.length || t(e.sliceDoc(n, n + 1)) != M.Word);
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function zo(t, e, r, n) {
|
|
995
995
|
return t(e.sliceDoc(r, r + 1)) == M.Word && t(e.sliceDoc(n - 1, n)) == M.Word;
|
|
996
996
|
}
|
|
997
|
-
const
|
|
997
|
+
const Uo = /* @__PURE__ */ Ft.fromClass(class {
|
|
998
998
|
constructor(t) {
|
|
999
999
|
this.decorations = this.getDeco(t);
|
|
1000
1000
|
}
|
|
@@ -1018,17 +1018,17 @@ const zo = /* @__PURE__ */ Ft.fromClass(class {
|
|
|
1018
1018
|
if (a < e.minSelectionLength || a > 200)
|
|
1019
1019
|
return y.none;
|
|
1020
1020
|
if (e.wholeWords) {
|
|
1021
|
-
if (i = r.sliceDoc(o.from, o.to), s = r.charCategorizer(o.head), !(kt(s, r, o.from, o.to) &&
|
|
1021
|
+
if (i = r.sliceDoc(o.from, o.to), s = r.charCategorizer(o.head), !(kt(s, r, o.from, o.to) && zo(s, r, o.from, o.to)))
|
|
1022
1022
|
return y.none;
|
|
1023
1023
|
} else if (i = r.sliceDoc(o.from, o.to).trim(), !i)
|
|
1024
1024
|
return y.none;
|
|
1025
1025
|
}
|
|
1026
1026
|
let l = [];
|
|
1027
1027
|
for (let a of t.visibleRanges) {
|
|
1028
|
-
let c = new
|
|
1028
|
+
let c = new te(r.doc, i, a.from, a.to);
|
|
1029
1029
|
for (; !c.next().done; ) {
|
|
1030
1030
|
let { from: h, to: u } = c.value;
|
|
1031
|
-
if ((!s || kt(s, r, h, u)) && (o.empty && h <= o.from && u >= o.to ? l.push(
|
|
1031
|
+
if ((!s || kt(s, r, h, u)) && (o.empty && h <= o.from && u >= o.to ? l.push(Vo.range(h, u)) : (h >= o.to || u <= o.from) && l.push(Ho.range(h, u)), l.length > e.maxMatches))
|
|
1032
1032
|
return y.none;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
@@ -1036,20 +1036,20 @@ const zo = /* @__PURE__ */ Ft.fromClass(class {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
}, {
|
|
1038
1038
|
decorations: (t) => t.decorations
|
|
1039
|
-
}),
|
|
1039
|
+
}), $o = /* @__PURE__ */ p.baseTheme({
|
|
1040
1040
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
1041
1041
|
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
1042
|
-
}),
|
|
1042
|
+
}), Go = ({ state: t, dispatch: e }) => {
|
|
1043
1043
|
let { selection: r } = t, n = d.create(r.ranges.map((o) => t.wordAt(o.head) || d.cursor(o.head)), r.mainIndex);
|
|
1044
1044
|
return n.eq(r) ? !1 : (e(t.update({ selection: n })), !0);
|
|
1045
1045
|
};
|
|
1046
|
-
function
|
|
1046
|
+
function Ko(t, e) {
|
|
1047
1047
|
let { main: r, ranges: n } = t.selection, o = t.wordAt(r.head), i = o && o.from == r.from && o.to == r.to;
|
|
1048
|
-
for (let s = !1, l = new
|
|
1048
|
+
for (let s = !1, l = new te(t.doc, e, n[n.length - 1].to); ; )
|
|
1049
1049
|
if (l.next(), l.done) {
|
|
1050
1050
|
if (s)
|
|
1051
1051
|
return null;
|
|
1052
|
-
l = new
|
|
1052
|
+
l = new te(t.doc, e, 0, Math.max(0, n[n.length - 1].from - 1)), s = !0;
|
|
1053
1053
|
} else {
|
|
1054
1054
|
if (s && n.some((a) => a.from == l.value.from))
|
|
1055
1055
|
continue;
|
|
@@ -1061,27 +1061,27 @@ function Go(t, e) {
|
|
|
1061
1061
|
return l.value;
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
const
|
|
1064
|
+
const Jo = ({ state: t, dispatch: e }) => {
|
|
1065
1065
|
let { ranges: r } = t.selection;
|
|
1066
1066
|
if (r.some((i) => i.from === i.to))
|
|
1067
|
-
return
|
|
1067
|
+
return Go({ state: t, dispatch: e });
|
|
1068
1068
|
let n = t.sliceDoc(r[0].from, r[0].to);
|
|
1069
1069
|
if (t.selection.ranges.some((i) => t.sliceDoc(i.from, i.to) != n))
|
|
1070
1070
|
return !1;
|
|
1071
|
-
let o =
|
|
1071
|
+
let o = Ko(t, n);
|
|
1072
1072
|
return o ? (e(t.update({
|
|
1073
1073
|
selection: t.selection.addRange(d.range(o.from, o.to), !1),
|
|
1074
1074
|
effects: p.scrollIntoView(o.to)
|
|
1075
1075
|
})), !0) : !1;
|
|
1076
|
-
},
|
|
1076
|
+
}, oe = /* @__PURE__ */ ue.define({
|
|
1077
1077
|
combine(t) {
|
|
1078
|
-
return
|
|
1078
|
+
return Ee(t, {
|
|
1079
1079
|
top: !1,
|
|
1080
1080
|
caseSensitive: !1,
|
|
1081
1081
|
literal: !1,
|
|
1082
1082
|
regexp: !1,
|
|
1083
1083
|
wholeWord: !1,
|
|
1084
|
-
createPanel: (e) => new
|
|
1084
|
+
createPanel: (e) => new ii(e),
|
|
1085
1085
|
scrollToMatch: (e) => p.scrollIntoView(e)
|
|
1086
1086
|
});
|
|
1087
1087
|
}
|
|
@@ -1091,7 +1091,7 @@ class Mn {
|
|
|
1091
1091
|
Create a query object.
|
|
1092
1092
|
*/
|
|
1093
1093
|
constructor(e) {
|
|
1094
|
-
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp ||
|
|
1094
|
+
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || Po(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord;
|
|
1095
1095
|
}
|
|
1096
1096
|
/**
|
|
1097
1097
|
@internal
|
|
@@ -1110,15 +1110,15 @@ class Mn {
|
|
|
1110
1110
|
@internal
|
|
1111
1111
|
*/
|
|
1112
1112
|
create() {
|
|
1113
|
-
return this.regexp ? new
|
|
1113
|
+
return this.regexp ? new Yo(this) : new jo(this);
|
|
1114
1114
|
}
|
|
1115
1115
|
/**
|
|
1116
1116
|
Get a search cursor for this query, searching through the given
|
|
1117
1117
|
range in the given state.
|
|
1118
1118
|
*/
|
|
1119
1119
|
getCursor(e, r = 0, n) {
|
|
1120
|
-
let o = e.doc ? e :
|
|
1121
|
-
return n == null && (n = o.doc.length), this.regexp ?
|
|
1120
|
+
let o = e.doc ? e : ce.create({ doc: e });
|
|
1121
|
+
return n == null && (n = o.doc.length), this.regexp ? Y(this, o, r, n) : Q(this, o, r, n);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
1124
|
class Ln {
|
|
@@ -1126,25 +1126,25 @@ class Ln {
|
|
|
1126
1126
|
this.spec = e;
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return new
|
|
1129
|
+
function Q(t, e, r, n) {
|
|
1130
|
+
return new te(e.doc, t.unquoted, r, n, t.caseSensitive ? void 0 : (o) => o.toLowerCase(), t.wholeWord ? _o(e.doc, e.charCategorizer(e.selection.main.head)) : void 0);
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return (r, n, o, i) => ((i > r || i + o.length < n) && (i = Math.max(0, r - 2), o = t.sliceString(i, Math.min(t.length, n + 2))), (e(
|
|
1132
|
+
function _o(t, e) {
|
|
1133
|
+
return (r, n, o, i) => ((i > r || i + o.length < n) && (i = Math.max(0, r - 2), o = t.sliceString(i, Math.min(t.length, n + 2))), (e(Me(o, r - i)) != M.Word || e(Le(o, r - i)) != M.Word) && (e(Le(o, n - i)) != M.Word || e(Me(o, n - i)) != M.Word));
|
|
1134
1134
|
}
|
|
1135
|
-
class
|
|
1135
|
+
class jo extends Ln {
|
|
1136
1136
|
constructor(e) {
|
|
1137
1137
|
super(e);
|
|
1138
1138
|
}
|
|
1139
1139
|
nextMatch(e, r, n) {
|
|
1140
|
-
let o =
|
|
1141
|
-
return o.done && (o =
|
|
1140
|
+
let o = Q(this.spec, e, n, e.doc.length).nextOverlapping();
|
|
1141
|
+
return o.done && (o = Q(this.spec, e, 0, r).nextOverlapping()), o.done ? null : o.value;
|
|
1142
1142
|
}
|
|
1143
1143
|
// Searching in reverse is, rather than implementing an inverted search
|
|
1144
1144
|
// cursor, done by scanning chunk after chunk forward.
|
|
1145
1145
|
prevMatchInRange(e, r, n) {
|
|
1146
1146
|
for (let o = n; ; ) {
|
|
1147
|
-
let i = Math.max(r, o - 1e4 - this.spec.unquoted.length), s =
|
|
1147
|
+
let i = Math.max(r, o - 1e4 - this.spec.unquoted.length), s = Q(this.spec, e, i, o), l = null;
|
|
1148
1148
|
for (; !s.nextOverlapping().done; )
|
|
1149
1149
|
l = s.value;
|
|
1150
1150
|
if (l)
|
|
@@ -1161,7 +1161,7 @@ class _o extends Ln {
|
|
|
1161
1161
|
return this.spec.unquote(this.spec.replace);
|
|
1162
1162
|
}
|
|
1163
1163
|
matchAll(e, r) {
|
|
1164
|
-
let n =
|
|
1164
|
+
let n = Q(this.spec, e, 0, e.doc.length), o = [];
|
|
1165
1165
|
for (; !n.next().done; ) {
|
|
1166
1166
|
if (o.length >= r)
|
|
1167
1167
|
return null;
|
|
@@ -1170,30 +1170,30 @@ class _o extends Ln {
|
|
|
1170
1170
|
return o;
|
|
1171
1171
|
}
|
|
1172
1172
|
highlight(e, r, n, o) {
|
|
1173
|
-
let i =
|
|
1173
|
+
let i = Q(this.spec, e, Math.max(0, r - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
|
|
1174
1174
|
for (; !i.next().done; )
|
|
1175
1175
|
o(i.value.from, i.value.to);
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function Y(t, e, r, n) {
|
|
1179
1179
|
return new Cn(e.doc, t.search, {
|
|
1180
1180
|
ignoreCase: !t.caseSensitive,
|
|
1181
|
-
test: t.wholeWord ?
|
|
1181
|
+
test: t.wholeWord ? Qo(e.charCategorizer(e.selection.main.head)) : void 0
|
|
1182
1182
|
}, r, n);
|
|
1183
1183
|
}
|
|
1184
|
-
function Ae(t, e) {
|
|
1185
|
-
return t.slice(Y(t, e, !1), e);
|
|
1186
|
-
}
|
|
1187
1184
|
function Me(t, e) {
|
|
1188
|
-
return t.slice(e,
|
|
1185
|
+
return t.slice(ee(t, e, !1), e);
|
|
1186
|
+
}
|
|
1187
|
+
function Le(t, e) {
|
|
1188
|
+
return t.slice(e, ee(t, e));
|
|
1189
1189
|
}
|
|
1190
|
-
function
|
|
1191
|
-
return (e, r, n) => !n[0].length || (t(
|
|
1190
|
+
function Qo(t) {
|
|
1191
|
+
return (e, r, n) => !n[0].length || (t(Me(n.input, n.index)) != M.Word || t(Le(n.input, n.index)) != M.Word) && (t(Le(n.input, n.index + n[0].length)) != M.Word || t(Me(n.input, n.index + n[0].length)) != M.Word);
|
|
1192
1192
|
}
|
|
1193
|
-
class
|
|
1193
|
+
class Yo extends Ln {
|
|
1194
1194
|
nextMatch(e, r, n) {
|
|
1195
|
-
let o =
|
|
1196
|
-
return o.done && (o =
|
|
1195
|
+
let o = Y(this.spec, e, n, e.doc.length).next();
|
|
1196
|
+
return o.done && (o = Y(this.spec, e, 0, r).next()), o.done ? null : o.value;
|
|
1197
1197
|
}
|
|
1198
1198
|
prevMatchInRange(e, r, n) {
|
|
1199
1199
|
for (let o = 1; ; o++) {
|
|
@@ -1201,7 +1201,7 @@ class Qo extends Ln {
|
|
|
1201
1201
|
r,
|
|
1202
1202
|
n - o * 1e4
|
|
1203
1203
|
/* ChunkSize */
|
|
1204
|
-
), s =
|
|
1204
|
+
), s = Y(this.spec, e, i, n), l = null;
|
|
1205
1205
|
for (; !s.next().done; )
|
|
1206
1206
|
l = s.value;
|
|
1207
1207
|
if (l && (i == r || l.from > i + 10))
|
|
@@ -1217,7 +1217,7 @@ class Qo extends Ln {
|
|
|
1217
1217
|
return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g, (r, n) => n == "$" ? "$" : n == "&" ? e.match[0] : n != "0" && +n < e.match.length ? e.match[n] : r));
|
|
1218
1218
|
}
|
|
1219
1219
|
matchAll(e, r) {
|
|
1220
|
-
let n =
|
|
1220
|
+
let n = Y(this.spec, e, 0, e.doc.length), o = [];
|
|
1221
1221
|
for (; !n.next().done; ) {
|
|
1222
1222
|
if (o.length >= r)
|
|
1223
1223
|
return null;
|
|
@@ -1226,7 +1226,7 @@ class Qo extends Ln {
|
|
|
1226
1226
|
return o;
|
|
1227
1227
|
}
|
|
1228
1228
|
highlight(e, r, n, o) {
|
|
1229
|
-
let i =
|
|
1229
|
+
let i = Y(this.spec, e, Math.max(
|
|
1230
1230
|
0,
|
|
1231
1231
|
r - 250
|
|
1232
1232
|
/* HighlightMargin */
|
|
@@ -1235,13 +1235,13 @@ class Qo extends Ln {
|
|
|
1235
1235
|
o(i.value.from, i.value.to);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
const
|
|
1238
|
+
const he = /* @__PURE__ */ w.define(), st = /* @__PURE__ */ w.define(), F = /* @__PURE__ */ we.define({
|
|
1239
1239
|
create(t) {
|
|
1240
1240
|
return new ze(Ye(t).create(), null);
|
|
1241
1241
|
},
|
|
1242
1242
|
update(t, e) {
|
|
1243
1243
|
for (let r of e.effects)
|
|
1244
|
-
r.is(
|
|
1244
|
+
r.is(he) ? t = new ze(r.value.create(), t.panel) : r.is(st) && (t = new ze(t.query, r.value ? lt : null));
|
|
1245
1245
|
return t;
|
|
1246
1246
|
},
|
|
1247
1247
|
provide: (t) => tt.from(t, (e) => e.panel)
|
|
@@ -1251,7 +1251,7 @@ class ze {
|
|
|
1251
1251
|
this.query = e, this.panel = r;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const Zo = /* @__PURE__ */ y.mark({ class: "cm-searchMatch" }), Xo = /* @__PURE__ */ y.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), ei = /* @__PURE__ */ Ft.fromClass(class {
|
|
1255
1255
|
constructor(t) {
|
|
1256
1256
|
this.view = t, this.decorations = this.highlight(t.state.field(F));
|
|
1257
1257
|
}
|
|
@@ -1262,14 +1262,14 @@ const Yo = /* @__PURE__ */ y.mark({ class: "cm-searchMatch" }), Zo = /* @__PURE_
|
|
|
1262
1262
|
highlight({ query: t, panel: e }) {
|
|
1263
1263
|
if (!e || !t.spec.valid)
|
|
1264
1264
|
return y.none;
|
|
1265
|
-
let { view: r } = this, n = new
|
|
1265
|
+
let { view: r } = this, n = new tr();
|
|
1266
1266
|
for (let o = 0, i = r.visibleRanges, s = i.length; o < s; o++) {
|
|
1267
1267
|
let { from: l, to: a } = i[o];
|
|
1268
1268
|
for (; o < s - 1 && a > i[o + 1].from - 2 * 250; )
|
|
1269
1269
|
a = i[++o].to;
|
|
1270
1270
|
t.highlight(r.state, l, a, (c, h) => {
|
|
1271
1271
|
let u = r.state.selection.ranges.some((m) => m.from == c && m.to == h);
|
|
1272
|
-
n.add(c, h, u ?
|
|
1272
|
+
n.add(c, h, u ? Xo : Zo);
|
|
1273
1273
|
});
|
|
1274
1274
|
}
|
|
1275
1275
|
return n.finish();
|
|
@@ -1277,44 +1277,44 @@ const Yo = /* @__PURE__ */ y.mark({ class: "cm-searchMatch" }), Zo = /* @__PURE_
|
|
|
1277
1277
|
}, {
|
|
1278
1278
|
decorations: (t) => t.decorations
|
|
1279
1279
|
});
|
|
1280
|
-
function
|
|
1280
|
+
function fe(t) {
|
|
1281
1281
|
return (e) => {
|
|
1282
1282
|
let r = e.state.field(F, !1);
|
|
1283
1283
|
return r && r.query.spec.valid ? t(e, r) : En(e);
|
|
1284
1284
|
};
|
|
1285
1285
|
}
|
|
1286
|
-
const
|
|
1286
|
+
const Be = /* @__PURE__ */ fe((t, { query: e }) => {
|
|
1287
1287
|
let { to: r } = t.state.selection.main, n = e.nextMatch(t.state, r, r);
|
|
1288
1288
|
if (!n)
|
|
1289
1289
|
return !1;
|
|
1290
|
-
let o = d.single(n.from, n.to), i = t.state.facet(
|
|
1290
|
+
let o = d.single(n.from, n.to), i = t.state.facet(oe);
|
|
1291
1291
|
return t.dispatch({
|
|
1292
1292
|
selection: o,
|
|
1293
1293
|
effects: [at(t, n), i.scrollToMatch(o.main, t)],
|
|
1294
1294
|
userEvent: "select.search"
|
|
1295
|
-
}),
|
|
1296
|
-
}), De = /* @__PURE__ */
|
|
1295
|
+
}), Dn(t), !0;
|
|
1296
|
+
}), De = /* @__PURE__ */ fe((t, { query: e }) => {
|
|
1297
1297
|
let { state: r } = t, { from: n } = r.selection.main, o = e.prevMatch(r, n, n);
|
|
1298
1298
|
if (!o)
|
|
1299
1299
|
return !1;
|
|
1300
|
-
let i = d.single(o.from, o.to), s = t.state.facet(
|
|
1300
|
+
let i = d.single(o.from, o.to), s = t.state.facet(oe);
|
|
1301
1301
|
return t.dispatch({
|
|
1302
1302
|
selection: i,
|
|
1303
1303
|
effects: [at(t, o), s.scrollToMatch(i.main, t)],
|
|
1304
1304
|
userEvent: "select.search"
|
|
1305
|
-
}),
|
|
1306
|
-
}),
|
|
1305
|
+
}), Dn(t), !0;
|
|
1306
|
+
}), ti = /* @__PURE__ */ fe((t, { query: e }) => {
|
|
1307
1307
|
let r = e.matchAll(t.state, 1e3);
|
|
1308
1308
|
return !r || !r.length ? !1 : (t.dispatch({
|
|
1309
1309
|
selection: d.create(r.map((n) => d.range(n.from, n.to))),
|
|
1310
1310
|
userEvent: "select.search.matches"
|
|
1311
1311
|
}), !0);
|
|
1312
|
-
}),
|
|
1312
|
+
}), ni = ({ state: t, dispatch: e }) => {
|
|
1313
1313
|
let r = t.selection;
|
|
1314
1314
|
if (r.ranges.length > 1 || r.main.empty)
|
|
1315
1315
|
return !1;
|
|
1316
1316
|
let { from: n, to: o } = r.main, i = [], s = 0;
|
|
1317
|
-
for (let l = new
|
|
1317
|
+
for (let l = new te(t.doc, t.sliceDoc(n, o)); !l.next().done; ) {
|
|
1318
1318
|
if (i.length > 1e3)
|
|
1319
1319
|
return !1;
|
|
1320
1320
|
l.value.from == n && (s = i.length), i.push(d.range(l.value.from, l.value.to));
|
|
@@ -1323,7 +1323,7 @@ const Le = /* @__PURE__ */ he((t, { query: e }) => {
|
|
|
1323
1323
|
selection: d.create(i, s),
|
|
1324
1324
|
userEvent: "select.search.matches"
|
|
1325
1325
|
})), !0;
|
|
1326
|
-
}, bt = /* @__PURE__ */
|
|
1326
|
+
}, bt = /* @__PURE__ */ fe((t, { query: e }) => {
|
|
1327
1327
|
let { state: r } = t, { from: n, to: o } = r.selection.main;
|
|
1328
1328
|
if (r.readOnly)
|
|
1329
1329
|
return !1;
|
|
@@ -1333,7 +1333,7 @@ const Le = /* @__PURE__ */ he((t, { query: e }) => {
|
|
|
1333
1333
|
let s = [], l, a, c = [];
|
|
1334
1334
|
if (i.from == n && i.to == o && (a = r.toText(e.getReplacement(i)), s.push({ from: i.from, to: i.to, insert: a }), i = e.nextMatch(r, i.from, i.to), c.push(p.announce.of(r.phrase("replaced match on line $", r.doc.lineAt(n).number) + "."))), i) {
|
|
1335
1335
|
let h = s.length == 0 || s[0].from >= i.to ? 0 : i.to - i.from - a.length;
|
|
1336
|
-
l = d.single(i.from - h, i.to - h), c.push(at(t, i)), c.push(r.facet(
|
|
1336
|
+
l = d.single(i.from - h, i.to - h), c.push(at(t, i)), c.push(r.facet(oe).scrollToMatch(l.main, t));
|
|
1337
1337
|
}
|
|
1338
1338
|
return t.dispatch({
|
|
1339
1339
|
changes: s,
|
|
@@ -1341,7 +1341,7 @@ const Le = /* @__PURE__ */ he((t, { query: e }) => {
|
|
|
1341
1341
|
effects: c,
|
|
1342
1342
|
userEvent: "input.replace"
|
|
1343
1343
|
}), !0;
|
|
1344
|
-
}),
|
|
1344
|
+
}), ri = /* @__PURE__ */ fe((t, { query: e }) => {
|
|
1345
1345
|
if (t.state.readOnly)
|
|
1346
1346
|
return !1;
|
|
1347
1347
|
let r = e.matchAll(t.state, 1e9).map((o) => {
|
|
@@ -1358,14 +1358,14 @@ const Le = /* @__PURE__ */ he((t, { query: e }) => {
|
|
|
1358
1358
|
}), !0;
|
|
1359
1359
|
});
|
|
1360
1360
|
function lt(t) {
|
|
1361
|
-
return t.state.facet(
|
|
1361
|
+
return t.state.facet(oe).createPanel(t);
|
|
1362
1362
|
}
|
|
1363
1363
|
function Ye(t, e) {
|
|
1364
1364
|
var r, n, o, i, s;
|
|
1365
1365
|
let l = t.selection.main, a = l.empty || l.to > l.from + 100 ? "" : t.sliceDoc(l.from, l.to);
|
|
1366
1366
|
if (e && !a)
|
|
1367
1367
|
return e;
|
|
1368
|
-
let c = t.facet(
|
|
1368
|
+
let c = t.facet(oe);
|
|
1369
1369
|
return new Mn({
|
|
1370
1370
|
search: ((r = e == null ? void 0 : e.literal) !== null && r !== void 0 ? r : c.literal) ? a : a.replace(/\n/g, "\\n"),
|
|
1371
1371
|
caseSensitive: (n = e == null ? void 0 : e.caseSensitive) !== null && n !== void 0 ? n : c.caseSensitive,
|
|
@@ -1374,44 +1374,44 @@ function Ye(t, e) {
|
|
|
1374
1374
|
wholeWord: (s = e == null ? void 0 : e.wholeWord) !== null && s !== void 0 ? s : c.wholeWord
|
|
1375
1375
|
});
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
let e =
|
|
1377
|
+
function Bn(t) {
|
|
1378
|
+
let e = ae(t, lt);
|
|
1379
1379
|
return e && e.dom.querySelector("[main-field]");
|
|
1380
1380
|
}
|
|
1381
|
-
function
|
|
1382
|
-
let e =
|
|
1381
|
+
function Dn(t) {
|
|
1382
|
+
let e = Bn(t);
|
|
1383
1383
|
e && e == t.root.activeElement && e.select();
|
|
1384
1384
|
}
|
|
1385
1385
|
const En = (t) => {
|
|
1386
1386
|
let e = t.state.field(F, !1);
|
|
1387
1387
|
if (e && e.panel) {
|
|
1388
|
-
let r =
|
|
1388
|
+
let r = Bn(t);
|
|
1389
1389
|
if (r && r != t.root.activeElement) {
|
|
1390
1390
|
let n = Ye(t.state, e.query.spec);
|
|
1391
|
-
n.valid && t.dispatch({ effects:
|
|
1391
|
+
n.valid && t.dispatch({ effects: he.of(n) }), r.focus(), r.select();
|
|
1392
1392
|
}
|
|
1393
1393
|
} else
|
|
1394
1394
|
t.dispatch({ effects: [
|
|
1395
1395
|
st.of(!0),
|
|
1396
|
-
e ?
|
|
1396
|
+
e ? he.of(Ye(t.state, e.query.spec)) : w.appendConfig.of(li)
|
|
1397
1397
|
] });
|
|
1398
1398
|
return !0;
|
|
1399
1399
|
}, wn = (t) => {
|
|
1400
1400
|
let e = t.state.field(F, !1);
|
|
1401
1401
|
if (!e || !e.panel)
|
|
1402
1402
|
return !1;
|
|
1403
|
-
let r =
|
|
1403
|
+
let r = ae(t, lt);
|
|
1404
1404
|
return r && r.dom.contains(t.root.activeElement) && t.focus(), t.dispatch({ effects: st.of(!1) }), !0;
|
|
1405
|
-
},
|
|
1405
|
+
}, oi = [
|
|
1406
1406
|
{ key: "Mod-f", run: En, scope: "editor search-panel" },
|
|
1407
|
-
{ key: "F3", run:
|
|
1408
|
-
{ key: "Mod-g", run:
|
|
1407
|
+
{ key: "F3", run: Be, shift: De, scope: "editor search-panel", preventDefault: !0 },
|
|
1408
|
+
{ key: "Mod-g", run: Be, shift: De, scope: "editor search-panel", preventDefault: !0 },
|
|
1409
1409
|
{ key: "Escape", run: wn, scope: "editor search-panel" },
|
|
1410
|
-
{ key: "Mod-Shift-l", run:
|
|
1411
|
-
{ key: "Alt-g", run:
|
|
1412
|
-
{ key: "Mod-d", run:
|
|
1410
|
+
{ key: "Mod-Shift-l", run: ni },
|
|
1411
|
+
{ key: "Alt-g", run: Wo },
|
|
1412
|
+
{ key: "Mod-d", run: Jo, preventDefault: !0 }
|
|
1413
1413
|
];
|
|
1414
|
-
class
|
|
1414
|
+
class ii {
|
|
1415
1415
|
constructor(e) {
|
|
1416
1416
|
this.view = e;
|
|
1417
1417
|
let r = this.query = e.state.field(F).query.spec;
|
|
@@ -1458,9 +1458,9 @@ class oi {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
this.dom = g("div", { onkeydown: (o) => this.keydown(o), class: "cm-search" }, [
|
|
1460
1460
|
this.searchField,
|
|
1461
|
-
n("next", () =>
|
|
1461
|
+
n("next", () => Be(e), [v(e, "next")]),
|
|
1462
1462
|
n("prev", () => De(e), [v(e, "previous")]),
|
|
1463
|
-
n("select", () =>
|
|
1463
|
+
n("select", () => ti(e), [v(e, "all")]),
|
|
1464
1464
|
g("label", null, [this.caseField, v(e, "match case")]),
|
|
1465
1465
|
g("label", null, [this.reField, v(e, "regexp")]),
|
|
1466
1466
|
g("label", null, [this.wordField, v(e, "by word")]),
|
|
@@ -1468,7 +1468,7 @@ class oi {
|
|
|
1468
1468
|
g("br"),
|
|
1469
1469
|
this.replaceField,
|
|
1470
1470
|
n("replace", () => bt(e), [v(e, "replace")]),
|
|
1471
|
-
n("replaceAll", () =>
|
|
1471
|
+
n("replaceAll", () => ri(e), [v(e, "replace all")])
|
|
1472
1472
|
],
|
|
1473
1473
|
g("button", {
|
|
1474
1474
|
name: "close",
|
|
@@ -1486,15 +1486,15 @@ class oi {
|
|
|
1486
1486
|
wholeWord: this.wordField.checked,
|
|
1487
1487
|
replace: this.replaceField.value
|
|
1488
1488
|
});
|
|
1489
|
-
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects:
|
|
1489
|
+
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: he.of(e) }));
|
|
1490
1490
|
}
|
|
1491
1491
|
keydown(e) {
|
|
1492
|
-
|
|
1492
|
+
nr(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? De : Be)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), bt(this.view));
|
|
1493
1493
|
}
|
|
1494
1494
|
update(e) {
|
|
1495
1495
|
for (let r of e.transactions)
|
|
1496
1496
|
for (let n of r.effects)
|
|
1497
|
-
n.is(
|
|
1497
|
+
n.is(he) && !n.value.eq(this.query) && this.setQuery(n.value);
|
|
1498
1498
|
}
|
|
1499
1499
|
setQuery(e) {
|
|
1500
1500
|
this.query = e, this.searchField.value = e.search, this.replaceField.value = e.replace, this.caseField.checked = e.caseSensitive, this.reField.checked = e.regexp, this.wordField.checked = e.wholeWord;
|
|
@@ -1506,32 +1506,32 @@ class oi {
|
|
|
1506
1506
|
return 80;
|
|
1507
1507
|
}
|
|
1508
1508
|
get top() {
|
|
1509
|
-
return this.view.state.facet(
|
|
1509
|
+
return this.view.state.facet(oe).top;
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
function v(t, e) {
|
|
1513
1513
|
return t.state.phrase(e);
|
|
1514
1514
|
}
|
|
1515
|
-
const
|
|
1515
|
+
const pe = 30, ye = /[\s\.,:;?!]/;
|
|
1516
1516
|
function at(t, { from: e, to: r }) {
|
|
1517
|
-
let n = t.state.doc.lineAt(e), o = t.state.doc.lineAt(r).to, i = Math.max(n.from, e -
|
|
1517
|
+
let n = t.state.doc.lineAt(e), o = t.state.doc.lineAt(r).to, i = Math.max(n.from, e - pe), s = Math.min(o, r + pe), l = t.state.sliceDoc(i, s);
|
|
1518
1518
|
if (i != n.from) {
|
|
1519
|
-
for (let a = 0; a <
|
|
1520
|
-
if (!
|
|
1519
|
+
for (let a = 0; a < pe; a++)
|
|
1520
|
+
if (!ye.test(l[a + 1]) && ye.test(l[a])) {
|
|
1521
1521
|
l = l.slice(a);
|
|
1522
1522
|
break;
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
1525
|
if (s != o) {
|
|
1526
|
-
for (let a = l.length - 1; a > l.length -
|
|
1527
|
-
if (!
|
|
1526
|
+
for (let a = l.length - 1; a > l.length - pe; a--)
|
|
1527
|
+
if (!ye.test(l[a - 1]) && ye.test(l[a])) {
|
|
1528
1528
|
l = l.slice(0, a);
|
|
1529
1529
|
break;
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
return p.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`);
|
|
1533
1533
|
}
|
|
1534
|
-
const
|
|
1534
|
+
const si = /* @__PURE__ */ p.baseTheme({
|
|
1535
1535
|
".cm-panel.cm-search": {
|
|
1536
1536
|
padding: "2px 6px 4px",
|
|
1537
1537
|
position: "relative",
|
|
@@ -1560,17 +1560,17 @@ const ii = /* @__PURE__ */ p.baseTheme({
|
|
|
1560
1560
|
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
1561
1561
|
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
1562
1562
|
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
1563
|
-
}),
|
|
1563
|
+
}), li = [
|
|
1564
1564
|
F,
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
|
|
1565
|
+
/* @__PURE__ */ Xn.lowest(ei),
|
|
1566
|
+
si
|
|
1567
1567
|
];
|
|
1568
|
-
class
|
|
1568
|
+
class ai {
|
|
1569
1569
|
constructor(e, r, n) {
|
|
1570
1570
|
this.from = e, this.to = r, this.diagnostic = n;
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
class
|
|
1573
|
+
class V {
|
|
1574
1574
|
constructor(e, r, n) {
|
|
1575
1575
|
this.diagnostics = e, this.panel = r, this.selected = n;
|
|
1576
1576
|
}
|
|
@@ -1578,52 +1578,52 @@ class H {
|
|
|
1578
1578
|
let o = e, i = n.facet(On).markerFilter;
|
|
1579
1579
|
i && (o = i(o));
|
|
1580
1580
|
let s = y.set(o.map((l) => l.from == l.to || l.from == l.to - 1 && n.doc.lineAt(l.from).to == l.from ? y.widget({
|
|
1581
|
-
widget: new
|
|
1581
|
+
widget: new yi(l),
|
|
1582
1582
|
diagnostic: l
|
|
1583
1583
|
}).range(l.from) : y.mark({
|
|
1584
1584
|
attributes: { class: "cm-lintRange cm-lintRange-" + l.severity + (l.markClass ? " " + l.markClass : "") },
|
|
1585
1585
|
diagnostic: l
|
|
1586
1586
|
}).range(l.from, l.to)), !0);
|
|
1587
|
-
return new
|
|
1587
|
+
return new V(s, r, ne(s));
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
|
-
function
|
|
1590
|
+
function ne(t, e = null, r = 0) {
|
|
1591
1591
|
let n = null;
|
|
1592
1592
|
return t.between(r, 1e9, (o, i, { spec: s }) => {
|
|
1593
1593
|
if (!(e && s.diagnostic != e))
|
|
1594
|
-
return n = new
|
|
1594
|
+
return n = new ai(o, i, s.diagnostic), !1;
|
|
1595
1595
|
}), n;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function ci(t, e) {
|
|
1598
1598
|
let r = t.startState.doc.lineAt(e.pos);
|
|
1599
1599
|
return !!(t.effects.some((n) => n.is(Rn)) || t.changes.touchesRange(r.from, r.to));
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return t.field(A, !1) ? e : e.concat(w.appendConfig.of(
|
|
1601
|
+
function hi(t, e) {
|
|
1602
|
+
return t.field(A, !1) ? e : e.concat(w.appendConfig.of(bi));
|
|
1603
1603
|
}
|
|
1604
|
-
const Rn = /* @__PURE__ */ w.define(), ct = /* @__PURE__ */ w.define(), Tn = /* @__PURE__ */ w.define(), A = /* @__PURE__ */
|
|
1604
|
+
const Rn = /* @__PURE__ */ w.define(), ct = /* @__PURE__ */ w.define(), Tn = /* @__PURE__ */ w.define(), A = /* @__PURE__ */ we.define({
|
|
1605
1605
|
create() {
|
|
1606
|
-
return new
|
|
1606
|
+
return new V(y.none, null, null);
|
|
1607
1607
|
},
|
|
1608
1608
|
update(t, e) {
|
|
1609
1609
|
if (e.docChanged) {
|
|
1610
1610
|
let r = t.diagnostics.map(e.changes), n = null;
|
|
1611
1611
|
if (t.selected) {
|
|
1612
1612
|
let o = e.changes.mapPos(t.selected.from, 1);
|
|
1613
|
-
n =
|
|
1613
|
+
n = ne(r, t.selected.diagnostic, o) || ne(r, null, o);
|
|
1614
1614
|
}
|
|
1615
|
-
t = new
|
|
1615
|
+
t = new V(r, t.panel, n);
|
|
1616
1616
|
}
|
|
1617
1617
|
for (let r of e.effects)
|
|
1618
|
-
r.is(Rn) ? t =
|
|
1618
|
+
r.is(Rn) ? t = V.init(r.value, t.panel, e.state) : r.is(ct) ? t = new V(t.diagnostics, r.value ? We.open : null, t.selected) : r.is(Tn) && (t = new V(t.diagnostics, t.panel, r.value));
|
|
1619
1619
|
return t;
|
|
1620
1620
|
},
|
|
1621
1621
|
provide: (t) => [
|
|
1622
1622
|
tt.from(t, (e) => e.panel),
|
|
1623
1623
|
p.decorations.from(t, (e) => e.diagnostics)
|
|
1624
1624
|
]
|
|
1625
|
-
}),
|
|
1626
|
-
function
|
|
1625
|
+
}), ui = /* @__PURE__ */ y.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
1626
|
+
function fi(t, e, r) {
|
|
1627
1627
|
let { diagnostics: n } = t.state.field(A), o = [], i = 2e8, s = 0;
|
|
1628
1628
|
n.between(e - (r < 0 ? 1 : 0), e + (r > 0 ? 1 : 0), (a, c, { spec: h }) => {
|
|
1629
1629
|
e >= a && e <= c && (a == c || (e > a || r > 0) && (e < c || r < 0)) && (o.push(h.diagnostic), i = Math.min(a, i), s = Math.max(c, s));
|
|
@@ -1634,33 +1634,33 @@ function ui(t, e, r) {
|
|
|
1634
1634
|
end: s,
|
|
1635
1635
|
above: t.state.doc.lineAt(i).to < s,
|
|
1636
1636
|
create() {
|
|
1637
|
-
return { dom:
|
|
1637
|
+
return { dom: di(t, o) };
|
|
1638
1638
|
}
|
|
1639
1639
|
} : null;
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1641
|
+
function di(t, e) {
|
|
1642
1642
|
return g("ul", { class: "cm-tooltip-lint" }, e.map((r) => Pn(t, r, !1)));
|
|
1643
1643
|
}
|
|
1644
|
-
const
|
|
1644
|
+
const mi = (t) => {
|
|
1645
1645
|
let e = t.state.field(A, !1);
|
|
1646
|
-
(!e || !e.panel) && t.dispatch({ effects:
|
|
1647
|
-
let r =
|
|
1646
|
+
(!e || !e.panel) && t.dispatch({ effects: hi(t.state, [ct.of(!0)]) });
|
|
1647
|
+
let r = ae(t, We.open);
|
|
1648
1648
|
return r && r.dom.querySelector(".cm-panel-lint ul").focus(), !0;
|
|
1649
1649
|
}, St = (t) => {
|
|
1650
1650
|
let e = t.state.field(A, !1);
|
|
1651
1651
|
return !e || !e.panel ? !1 : (t.dispatch({ effects: ct.of(!1) }), !0);
|
|
1652
|
-
},
|
|
1652
|
+
}, gi = (t) => {
|
|
1653
1653
|
let e = t.state.field(A, !1);
|
|
1654
1654
|
if (!e)
|
|
1655
1655
|
return !1;
|
|
1656
1656
|
let r = t.state.selection.main, n = e.diagnostics.iter(r.to + 1);
|
|
1657
1657
|
return !n.value && (n = e.diagnostics.iter(0), !n.value || n.from == r.from && n.to == r.to) ? !1 : (t.dispatch({ selection: { anchor: n.from, head: n.to }, scrollIntoView: !0 }), !0);
|
|
1658
|
-
},
|
|
1659
|
-
{ key: "Mod-Shift-m", run:
|
|
1660
|
-
{ key: "F8", run:
|
|
1661
|
-
], On = /* @__PURE__ */
|
|
1658
|
+
}, pi = [
|
|
1659
|
+
{ key: "Mod-Shift-m", run: mi, preventDefault: !0 },
|
|
1660
|
+
{ key: "F8", run: gi }
|
|
1661
|
+
], On = /* @__PURE__ */ ue.define({
|
|
1662
1662
|
combine(t) {
|
|
1663
|
-
return Object.assign({ sources: t.map((e) => e.source) },
|
|
1663
|
+
return Object.assign({ sources: t.map((e) => e.source) }, Ee(t.map((e) => e.config), {
|
|
1664
1664
|
delay: 750,
|
|
1665
1665
|
markerFilter: null,
|
|
1666
1666
|
tooltipFilter: null,
|
|
@@ -1694,7 +1694,7 @@ function Pn(t, e, r) {
|
|
|
1694
1694
|
if (m.preventDefault(), l)
|
|
1695
1695
|
return;
|
|
1696
1696
|
l = !0;
|
|
1697
|
-
let x =
|
|
1697
|
+
let x = ne(t.state.field(A).diagnostics, e);
|
|
1698
1698
|
x && i.apply(t, x.from, x.to);
|
|
1699
1699
|
}, { name: c } = i, h = o[s] ? c.indexOf(o[s]) : -1, u = h < 0 ? c : [
|
|
1700
1700
|
c.slice(0, h),
|
|
@@ -1710,7 +1710,7 @@ function Pn(t, e, r) {
|
|
|
1710
1710
|
}, u);
|
|
1711
1711
|
}), e.source && g("div", { class: "cm-diagnosticSource" }, e.source));
|
|
1712
1712
|
}
|
|
1713
|
-
class
|
|
1713
|
+
class yi extends or {
|
|
1714
1714
|
constructor(e) {
|
|
1715
1715
|
super(), this.diagnostic = e;
|
|
1716
1716
|
}
|
|
@@ -1726,7 +1726,7 @@ class Ct {
|
|
|
1726
1726
|
this.diagnostic = r, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = Pn(e, r, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
1727
1727
|
}
|
|
1728
1728
|
}
|
|
1729
|
-
class
|
|
1729
|
+
class We {
|
|
1730
1730
|
constructor(e) {
|
|
1731
1731
|
this.view = e, this.items = [];
|
|
1732
1732
|
let r = (o) => {
|
|
@@ -1746,7 +1746,7 @@ class Pe {
|
|
|
1746
1746
|
let { diagnostic: i } = this.items[this.selectedIndex], s = In(i.actions);
|
|
1747
1747
|
for (let l = 0; l < s.length; l++)
|
|
1748
1748
|
if (s[l].toUpperCase().charCodeAt(0) == o.keyCode) {
|
|
1749
|
-
let a =
|
|
1749
|
+
let a = ne(this.view.state.field(A).diagnostics, i);
|
|
1750
1750
|
a && i.actions[l].apply(e, a.from, a.to);
|
|
1751
1751
|
}
|
|
1752
1752
|
} else
|
|
@@ -1822,7 +1822,7 @@ class Pe {
|
|
|
1822
1822
|
moveSelection(e) {
|
|
1823
1823
|
if (this.selectedIndex < 0)
|
|
1824
1824
|
return;
|
|
1825
|
-
let r = this.view.state.field(A), n =
|
|
1825
|
+
let r = this.view.state.field(A), n = ne(r.diagnostics, this.items[e].diagnostic);
|
|
1826
1826
|
n && this.view.dispatch({
|
|
1827
1827
|
selection: { anchor: n.from, head: n.to },
|
|
1828
1828
|
scrollIntoView: !0,
|
|
@@ -1830,16 +1830,16 @@ class Pe {
|
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
1832
|
static open(e) {
|
|
1833
|
-
return new
|
|
1833
|
+
return new We(e);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
function
|
|
1836
|
+
function xi(t, e = 'viewBox="0 0 40 40"') {
|
|
1837
1837
|
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`;
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1840
|
-
return
|
|
1839
|
+
function xe(t) {
|
|
1840
|
+
return xi(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
|
|
1841
1841
|
}
|
|
1842
|
-
const
|
|
1842
|
+
const ki = /* @__PURE__ */ p.baseTheme({
|
|
1843
1843
|
".cm-diagnostic": {
|
|
1844
1844
|
padding: "3px 6px 3px 8px",
|
|
1845
1845
|
marginLeft: "-1px",
|
|
@@ -1869,10 +1869,10 @@ const xi = /* @__PURE__ */ p.baseTheme({
|
|
|
1869
1869
|
backgroundRepeat: "repeat-x",
|
|
1870
1870
|
paddingBottom: "0.7px"
|
|
1871
1871
|
},
|
|
1872
|
-
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */
|
|
1873
|
-
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */
|
|
1874
|
-
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */
|
|
1875
|
-
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */
|
|
1872
|
+
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ xe("#d11") },
|
|
1873
|
+
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ xe("orange") },
|
|
1874
|
+
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ xe("#999") },
|
|
1875
|
+
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ xe("#66d") },
|
|
1876
1876
|
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
1877
1877
|
".cm-tooltip-lint": {
|
|
1878
1878
|
padding: 0,
|
|
@@ -1929,39 +1929,39 @@ const xi = /* @__PURE__ */ p.baseTheme({
|
|
|
1929
1929
|
margin: 0
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
|
-
}),
|
|
1932
|
+
}), bi = [
|
|
1933
1933
|
A,
|
|
1934
1934
|
/* @__PURE__ */ p.decorations.compute([A], (t) => {
|
|
1935
1935
|
let { selected: e, panel: r } = t.field(A);
|
|
1936
1936
|
return !e || !r || e.from == e.to ? y.none : y.set([
|
|
1937
|
-
|
|
1937
|
+
ui.range(e.from, e.to)
|
|
1938
1938
|
]);
|
|
1939
1939
|
}),
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
|
|
1940
|
+
/* @__PURE__ */ rr(fi, { hideOn: ci }),
|
|
1941
|
+
ki
|
|
1942
1942
|
];
|
|
1943
1943
|
var vt = function(e) {
|
|
1944
1944
|
e === void 0 && (e = {});
|
|
1945
1945
|
var {
|
|
1946
1946
|
crosshairCursor: r = !1
|
|
1947
1947
|
} = e, n = [];
|
|
1948
|
-
e.closeBracketsKeymap !== !1 && (n = n.concat(
|
|
1948
|
+
e.closeBracketsKeymap !== !1 && (n = n.concat(ir)), e.defaultKeymap !== !1 && (n = n.concat(Oo)), e.searchKeymap !== !1 && (n = n.concat(oi)), e.historyKeymap !== !1 && (n = n.concat(Ur)), e.foldKeymap !== !1 && (n = n.concat(sr)), e.completionKeymap !== !1 && (n = n.concat(lr)), e.lintKeymap !== !1 && (n = n.concat(pi));
|
|
1949
1949
|
var o = [];
|
|
1950
|
-
return e.lineNumbers !== !1 && o.push(
|
|
1950
|
+
return e.lineNumbers !== !1 && o.push(ar()), e.highlightActiveLineGutter !== !1 && o.push(cr()), e.highlightSpecialChars !== !1 && o.push(hr()), e.history !== !1 && o.push(Ir()), e.foldGutter !== !1 && o.push(ur()), e.drawSelection !== !1 && o.push(fr()), e.dropCursor !== !1 && o.push(dr()), e.allowMultipleSelections !== !1 && o.push(ce.allowMultipleSelections.of(!0)), e.indentOnInput !== !1 && o.push(mr()), e.syntaxHighlighting !== !1 && o.push(Nt(Sr, {
|
|
1951
1951
|
fallback: !0
|
|
1952
|
-
})), e.bracketMatching !== !1 && o.push(
|
|
1952
|
+
})), e.bracketMatching !== !1 && o.push(gr()), e.closeBrackets !== !1 && o.push(pr()), e.autocompletion !== !1 && o.push(yr()), e.rectangularSelection !== !1 && o.push(xr()), r !== !1 && o.push(kr()), e.highlightActiveLine !== !1 && o.push(br()), e.highlightSelectionMatches !== !1 && o.push(qo()), e.tabSize && typeof e.tabSize == "number" && o.push(Pt.of(" ".repeat(e.tabSize))), o.concat([qt.of(n.flat())]).filter(Boolean);
|
|
1953
1953
|
};
|
|
1954
|
-
const
|
|
1954
|
+
const Si = "#e5c07b", At = "#e06c75", Ci = "#56b6c2", vi = "#ffffff", be = "#abb2bf", Ze = "#7d8799", Ai = "#61afef", Mi = "#98c379", Mt = "#d19a66", Li = "#c678dd", Bi = "#21252b", Lt = "#2c313a", Bt = "#282c34", Ue = "#353a42", Di = "#3E4451", Dt = "#528bff", Ei = /* @__PURE__ */ p.theme({
|
|
1955
1955
|
"&": {
|
|
1956
|
-
color:
|
|
1957
|
-
backgroundColor:
|
|
1956
|
+
color: be,
|
|
1957
|
+
backgroundColor: Bt
|
|
1958
1958
|
},
|
|
1959
1959
|
".cm-content": {
|
|
1960
|
-
caretColor:
|
|
1960
|
+
caretColor: Dt
|
|
1961
1961
|
},
|
|
1962
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
1962
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: Dt },
|
|
1963
1963
|
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Di },
|
|
1964
|
-
".cm-panels": { backgroundColor:
|
|
1964
|
+
".cm-panels": { backgroundColor: Bi, color: be },
|
|
1965
1965
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1966
1966
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1967
1967
|
".cm-searchMatch": {
|
|
@@ -1977,7 +1977,7 @@ const bi = "#e5c07b", At = "#e06c75", Si = "#56b6c2", Ci = "#ffffff", ke = "#abb
|
|
|
1977
1977
|
backgroundColor: "#bad0f847"
|
|
1978
1978
|
},
|
|
1979
1979
|
".cm-gutters": {
|
|
1980
|
-
backgroundColor:
|
|
1980
|
+
backgroundColor: Bt,
|
|
1981
1981
|
color: Ze,
|
|
1982
1982
|
border: "none"
|
|
1983
1983
|
},
|
|
@@ -2004,13 +2004,13 @@ const bi = "#e5c07b", At = "#e06c75", Si = "#56b6c2", Ci = "#ffffff", ke = "#abb
|
|
|
2004
2004
|
".cm-tooltip-autocomplete": {
|
|
2005
2005
|
"& > ul > li[aria-selected]": {
|
|
2006
2006
|
backgroundColor: Lt,
|
|
2007
|
-
color:
|
|
2007
|
+
color: be
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
}, { dark: !0 }),
|
|
2010
|
+
}, { dark: !0 }), wi = /* @__PURE__ */ Cr.define([
|
|
2011
2011
|
{
|
|
2012
2012
|
tag: f.keyword,
|
|
2013
|
-
color:
|
|
2013
|
+
color: Li
|
|
2014
2014
|
},
|
|
2015
2015
|
{
|
|
2016
2016
|
tag: [f.name, f.deleted, f.character, f.propertyName, f.macroName],
|
|
@@ -2018,7 +2018,7 @@ const bi = "#e5c07b", At = "#e06c75", Si = "#56b6c2", Ci = "#ffffff", ke = "#abb
|
|
|
2018
2018
|
},
|
|
2019
2019
|
{
|
|
2020
2020
|
tag: [/* @__PURE__ */ f.function(f.variableName), f.labelName],
|
|
2021
|
-
color:
|
|
2021
|
+
color: Ai
|
|
2022
2022
|
},
|
|
2023
2023
|
{
|
|
2024
2024
|
tag: [f.color, /* @__PURE__ */ f.constant(f.name), /* @__PURE__ */ f.standard(f.name)],
|
|
@@ -2026,15 +2026,15 @@ const bi = "#e5c07b", At = "#e06c75", Si = "#56b6c2", Ci = "#ffffff", ke = "#abb
|
|
|
2026
2026
|
},
|
|
2027
2027
|
{
|
|
2028
2028
|
tag: [/* @__PURE__ */ f.definition(f.name), f.separator],
|
|
2029
|
-
color:
|
|
2029
|
+
color: be
|
|
2030
2030
|
},
|
|
2031
2031
|
{
|
|
2032
2032
|
tag: [f.typeName, f.className, f.number, f.changed, f.annotation, f.modifier, f.self, f.namespace],
|
|
2033
|
-
color:
|
|
2033
|
+
color: Si
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
2036
|
tag: [f.operator, f.operatorKeyword, f.url, f.escape, f.regexp, f.link, /* @__PURE__ */ f.special(f.string)],
|
|
2037
|
-
color:
|
|
2037
|
+
color: Ci
|
|
2038
2038
|
},
|
|
2039
2039
|
{
|
|
2040
2040
|
tag: [f.meta, f.comment],
|
|
@@ -2068,20 +2068,20 @@ const bi = "#e5c07b", At = "#e06c75", Si = "#56b6c2", Ci = "#ffffff", ke = "#abb
|
|
|
2068
2068
|
},
|
|
2069
2069
|
{
|
|
2070
2070
|
tag: [f.processingInstruction, f.string, f.inserted],
|
|
2071
|
-
color:
|
|
2071
|
+
color: Mi
|
|
2072
2072
|
},
|
|
2073
2073
|
{
|
|
2074
2074
|
tag: f.invalid,
|
|
2075
|
-
color:
|
|
2075
|
+
color: vi
|
|
2076
2076
|
}
|
|
2077
|
-
]),
|
|
2078
|
-
var
|
|
2077
|
+
]), Ri = [Ei, /* @__PURE__ */ Nt(wi)];
|
|
2078
|
+
var Ti = p.theme({
|
|
2079
2079
|
"&": {
|
|
2080
2080
|
backgroundColor: "#fff"
|
|
2081
2081
|
}
|
|
2082
2082
|
}, {
|
|
2083
2083
|
dark: !1
|
|
2084
|
-
}),
|
|
2084
|
+
}), Oi = function(e) {
|
|
2085
2085
|
e === void 0 && (e = {});
|
|
2086
2086
|
var {
|
|
2087
2087
|
indentWithTab: r = !0,
|
|
@@ -2091,12 +2091,12 @@ var Ri = p.theme({
|
|
|
2091
2091
|
placeholder: s = "",
|
|
2092
2092
|
basicSetup: l = !0
|
|
2093
2093
|
} = e, a = [];
|
|
2094
|
-
switch (r && a.unshift(qt.of([
|
|
2094
|
+
switch (r && a.unshift(qt.of([Io])), l && (typeof l == "boolean" ? a.unshift(vt()) : a.unshift(vt(l))), s && a.unshift(vr(s)), i) {
|
|
2095
2095
|
case "light":
|
|
2096
|
-
a.push(
|
|
2096
|
+
a.push(Ti);
|
|
2097
2097
|
break;
|
|
2098
2098
|
case "dark":
|
|
2099
|
-
a.push(
|
|
2099
|
+
a.push(Ri);
|
|
2100
2100
|
break;
|
|
2101
2101
|
case "none":
|
|
2102
2102
|
break;
|
|
@@ -2104,8 +2104,8 @@ var Ri = p.theme({
|
|
|
2104
2104
|
a.push(i);
|
|
2105
2105
|
break;
|
|
2106
2106
|
}
|
|
2107
|
-
return n === !1 && a.push(p.editable.of(!1)), o && a.push(
|
|
2108
|
-
},
|
|
2107
|
+
return n === !1 && a.push(p.editable.of(!1)), o && a.push(ce.readOnly.of(!0)), [...a];
|
|
2108
|
+
}, Ii = (t) => ({
|
|
2109
2109
|
line: t.state.doc.lineAt(t.state.selection.main.from),
|
|
2110
2110
|
lineCount: t.state.doc.lines,
|
|
2111
2111
|
lineBreak: t.state.lineBreak,
|
|
@@ -2118,8 +2118,8 @@ var Ri = p.theme({
|
|
|
2118
2118
|
selectionCode: t.state.sliceDoc(t.state.selection.main.from, t.state.selection.main.to),
|
|
2119
2119
|
selections: t.state.selection.ranges.map((e) => t.state.sliceDoc(e.from, e.to)),
|
|
2120
2120
|
selectedText: t.state.selection.ranges.some((e) => !e.empty)
|
|
2121
|
-
}), Et = Xe.define(),
|
|
2122
|
-
function
|
|
2121
|
+
}), Et = Xe.define(), Pi = [];
|
|
2122
|
+
function Wi(t) {
|
|
2123
2123
|
var {
|
|
2124
2124
|
value: e,
|
|
2125
2125
|
selection: r,
|
|
@@ -2127,7 +2127,7 @@ function Pi(t) {
|
|
|
2127
2127
|
onStatistics: o,
|
|
2128
2128
|
onCreateEditor: i,
|
|
2129
2129
|
onUpdate: s,
|
|
2130
|
-
extensions: l =
|
|
2130
|
+
extensions: l = Pi,
|
|
2131
2131
|
autoFocus: a,
|
|
2132
2132
|
theme: c = "light",
|
|
2133
2133
|
height: h = null,
|
|
@@ -2135,22 +2135,22 @@ function Pi(t) {
|
|
|
2135
2135
|
maxHeight: m = null,
|
|
2136
2136
|
width: x = null,
|
|
2137
2137
|
minWidth: S = null,
|
|
2138
|
-
maxWidth:
|
|
2139
|
-
placeholder:
|
|
2140
|
-
editable:
|
|
2141
|
-
readOnly:
|
|
2142
|
-
indentWithTab:
|
|
2143
|
-
basicSetup:
|
|
2144
|
-
root:
|
|
2145
|
-
initialState:
|
|
2146
|
-
} = t, [
|
|
2138
|
+
maxWidth: D = null,
|
|
2139
|
+
placeholder: z = "",
|
|
2140
|
+
editable: q = !0,
|
|
2141
|
+
readOnly: U = !1,
|
|
2142
|
+
indentWithTab: $ = !0,
|
|
2143
|
+
basicSetup: G = !0,
|
|
2144
|
+
root: K,
|
|
2145
|
+
initialState: H
|
|
2146
|
+
} = t, [J, de] = ke(), [k, I] = ke(), [_, j] = ke(), Fe = p.theme({
|
|
2147
2147
|
"&": {
|
|
2148
2148
|
height: h,
|
|
2149
2149
|
minHeight: u,
|
|
2150
2150
|
maxHeight: m,
|
|
2151
2151
|
width: x,
|
|
2152
2152
|
minWidth: S,
|
|
2153
|
-
maxWidth:
|
|
2153
|
+
maxWidth: D
|
|
2154
2154
|
},
|
|
2155
2155
|
"& .cm-scroller": {
|
|
2156
2156
|
height: "100% !important"
|
|
@@ -2159,46 +2159,46 @@ function Pi(t) {
|
|
|
2159
2159
|
if (E.docChanged && typeof n == "function" && // Fix echoing of the remote changes:
|
|
2160
2160
|
// If transaction is market as remote we don't have to call `onChange` handler again
|
|
2161
2161
|
!E.transactions.some((Nn) => Nn.annotation(Et))) {
|
|
2162
|
-
var
|
|
2163
|
-
n(
|
|
2162
|
+
var se = E.state.doc, me = se.toString();
|
|
2163
|
+
n(me, E);
|
|
2164
2164
|
}
|
|
2165
|
-
o && o(
|
|
2166
|
-
}), Fn =
|
|
2165
|
+
o && o(Ii(E));
|
|
2166
|
+
}), Fn = Oi({
|
|
2167
2167
|
theme: c,
|
|
2168
|
-
editable:
|
|
2169
|
-
readOnly:
|
|
2170
|
-
placeholder:
|
|
2171
|
-
indentWithTab:
|
|
2172
|
-
basicSetup:
|
|
2173
|
-
}),
|
|
2174
|
-
return s && typeof s == "function" &&
|
|
2175
|
-
if (
|
|
2168
|
+
editable: q,
|
|
2169
|
+
readOnly: U,
|
|
2170
|
+
placeholder: z,
|
|
2171
|
+
indentWithTab: $,
|
|
2172
|
+
basicSetup: G
|
|
2173
|
+
}), ie = [Ne, Fe, ...Fn];
|
|
2174
|
+
return s && typeof s == "function" && ie.push(p.updateListener.of(s)), ie = ie.concat(l), W(() => {
|
|
2175
|
+
if (J && !_) {
|
|
2176
2176
|
var E = {
|
|
2177
2177
|
doc: e,
|
|
2178
2178
|
selection: r,
|
|
2179
|
-
extensions:
|
|
2180
|
-
},
|
|
2181
|
-
if (
|
|
2182
|
-
var
|
|
2183
|
-
state:
|
|
2184
|
-
parent:
|
|
2185
|
-
root:
|
|
2179
|
+
extensions: ie
|
|
2180
|
+
}, se = H ? ce.fromJSON(H.json, E, H.fields) : ce.create(E);
|
|
2181
|
+
if (j(se), !k) {
|
|
2182
|
+
var me = new p({
|
|
2183
|
+
state: se,
|
|
2184
|
+
parent: J,
|
|
2185
|
+
root: K
|
|
2186
2186
|
});
|
|
2187
|
-
I(
|
|
2187
|
+
I(me), i && i(me, se);
|
|
2188
2188
|
}
|
|
2189
2189
|
}
|
|
2190
2190
|
return () => {
|
|
2191
|
-
k && (
|
|
2191
|
+
k && (j(void 0), I(void 0));
|
|
2192
2192
|
};
|
|
2193
|
-
}, [
|
|
2193
|
+
}, [J, _]), W(() => de(t.container), [t.container]), W(() => () => {
|
|
2194
2194
|
k && (k.destroy(), I(void 0));
|
|
2195
2195
|
}, [k]), W(() => {
|
|
2196
2196
|
a && k && k.focus();
|
|
2197
2197
|
}, [a, k]), W(() => {
|
|
2198
2198
|
k && k.dispatch({
|
|
2199
|
-
effects: w.reconfigure.of(
|
|
2199
|
+
effects: w.reconfigure.of(ie)
|
|
2200
2200
|
});
|
|
2201
|
-
}, [c, l, h, u, m, x, S,
|
|
2201
|
+
}, [c, l, h, u, m, x, S, D, z, q, U, $, G, n, s]), W(() => {
|
|
2202
2202
|
if (e !== void 0) {
|
|
2203
2203
|
var E = k ? k.state.doc.toString() : "";
|
|
2204
2204
|
k && e !== E && k.dispatch({
|
|
@@ -2211,15 +2211,15 @@ function Pi(t) {
|
|
|
2211
2211
|
});
|
|
2212
2212
|
}
|
|
2213
2213
|
}, [e, k]), {
|
|
2214
|
-
state:
|
|
2215
|
-
setState:
|
|
2214
|
+
state: _,
|
|
2215
|
+
setState: j,
|
|
2216
2216
|
view: k,
|
|
2217
2217
|
setView: I,
|
|
2218
|
-
container:
|
|
2219
|
-
setContainer:
|
|
2218
|
+
container: J,
|
|
2219
|
+
setContainer: de
|
|
2220
2220
|
};
|
|
2221
2221
|
}
|
|
2222
|
-
var
|
|
2222
|
+
var Fi = ["className", "value", "selection", "extensions", "onChange", "onStatistics", "onCreateEditor", "onUpdate", "autoFocus", "theme", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "basicSetup", "placeholder", "indentWithTab", "editable", "readOnly", "root", "initialState"], Wn = /* @__PURE__ */ wt((t, e) => {
|
|
2223
2223
|
var {
|
|
2224
2224
|
className: r,
|
|
2225
2225
|
value: n = "",
|
|
@@ -2234,50 +2234,50 @@ var Wi = ["className", "value", "selection", "extensions", "onChange", "onStatis
|
|
|
2234
2234
|
height: m,
|
|
2235
2235
|
minHeight: x,
|
|
2236
2236
|
maxHeight: S,
|
|
2237
|
-
width:
|
|
2238
|
-
minWidth:
|
|
2239
|
-
maxWidth:
|
|
2240
|
-
basicSetup:
|
|
2241
|
-
placeholder:
|
|
2242
|
-
indentWithTab:
|
|
2243
|
-
editable:
|
|
2244
|
-
readOnly:
|
|
2245
|
-
root:
|
|
2246
|
-
initialState:
|
|
2247
|
-
} = t, k = qn(t,
|
|
2248
|
-
state:
|
|
2249
|
-
view:
|
|
2237
|
+
width: D,
|
|
2238
|
+
minWidth: z,
|
|
2239
|
+
maxWidth: q,
|
|
2240
|
+
basicSetup: U,
|
|
2241
|
+
placeholder: $,
|
|
2242
|
+
indentWithTab: G,
|
|
2243
|
+
editable: K,
|
|
2244
|
+
readOnly: H,
|
|
2245
|
+
root: J,
|
|
2246
|
+
initialState: de
|
|
2247
|
+
} = t, k = qn(t, Fi), I = Rt(null), {
|
|
2248
|
+
state: _,
|
|
2249
|
+
view: j,
|
|
2250
2250
|
container: Fe
|
|
2251
|
-
} =
|
|
2251
|
+
} = Wi({
|
|
2252
2252
|
container: I.current,
|
|
2253
|
-
root:
|
|
2253
|
+
root: J,
|
|
2254
2254
|
value: n,
|
|
2255
2255
|
autoFocus: h,
|
|
2256
2256
|
theme: u,
|
|
2257
2257
|
height: m,
|
|
2258
2258
|
minHeight: x,
|
|
2259
2259
|
maxHeight: S,
|
|
2260
|
-
width:
|
|
2261
|
-
minWidth:
|
|
2262
|
-
maxWidth:
|
|
2263
|
-
basicSetup:
|
|
2264
|
-
placeholder:
|
|
2265
|
-
indentWithTab:
|
|
2266
|
-
editable:
|
|
2267
|
-
readOnly:
|
|
2260
|
+
width: D,
|
|
2261
|
+
minWidth: z,
|
|
2262
|
+
maxWidth: q,
|
|
2263
|
+
basicSetup: U,
|
|
2264
|
+
placeholder: $,
|
|
2265
|
+
indentWithTab: G,
|
|
2266
|
+
editable: K,
|
|
2267
|
+
readOnly: H,
|
|
2268
2268
|
selection: o,
|
|
2269
2269
|
onChange: s,
|
|
2270
2270
|
onStatistics: l,
|
|
2271
2271
|
onCreateEditor: a,
|
|
2272
2272
|
onUpdate: c,
|
|
2273
2273
|
extensions: i,
|
|
2274
|
-
initialState:
|
|
2274
|
+
initialState: de
|
|
2275
2275
|
});
|
|
2276
2276
|
if (Hn(e, () => ({
|
|
2277
2277
|
editor: I.current,
|
|
2278
|
-
state:
|
|
2279
|
-
view:
|
|
2280
|
-
}), [I, Fe,
|
|
2278
|
+
state: _,
|
|
2279
|
+
view: j
|
|
2280
|
+
}), [I, Fe, _, j]), typeof n != "string")
|
|
2281
2281
|
throw new Error("value must be typeof string but got " + typeof n);
|
|
2282
2282
|
var Ne = typeof u == "string" ? "cm-theme-" + u : "cm-theme";
|
|
2283
2283
|
return /* @__PURE__ */ P.jsx("div", Vn({
|
|
@@ -2286,14 +2286,14 @@ var Wi = ["className", "value", "selection", "extensions", "onChange", "onStatis
|
|
|
2286
2286
|
}, k));
|
|
2287
2287
|
});
|
|
2288
2288
|
Wn.displayName = "CodeMirror";
|
|
2289
|
-
const
|
|
2289
|
+
const Ni = p.theme({
|
|
2290
2290
|
"& .cm-scroller": {
|
|
2291
2291
|
fontFamily: "Consolas, Liberation Mono, Menlo, Courier, monospace"
|
|
2292
2292
|
},
|
|
2293
2293
|
"& .cm-activeLine, & .cm-activeLineGutter": {
|
|
2294
2294
|
backgroundColor: "transparent"
|
|
2295
2295
|
}
|
|
2296
|
-
}),
|
|
2296
|
+
}), Vi = wt(function({
|
|
2297
2297
|
title: e,
|
|
2298
2298
|
value: r,
|
|
2299
2299
|
height: n = "200px",
|
|
@@ -2304,16 +2304,20 @@ const Fi = p.theme({
|
|
|
2304
2304
|
onChange: a,
|
|
2305
2305
|
...c
|
|
2306
2306
|
}, h) {
|
|
2307
|
-
const u = zn(), m = Rt(null), [x, S] =
|
|
2307
|
+
const u = zn(), m = Rt(null), [x, S] = ke(100), [D, z] = Un.useState(null), { setFocusState: q } = $n(), U = () => {
|
|
2308
|
+
q(!0);
|
|
2309
|
+
}, $ = () => {
|
|
2310
|
+
q(!1);
|
|
2311
|
+
};
|
|
2308
2312
|
W(() => {
|
|
2309
|
-
Promise.all(l).then(
|
|
2313
|
+
Promise.all(l).then(z);
|
|
2310
2314
|
}, [l]), W(() => {
|
|
2311
|
-
const
|
|
2312
|
-
S(
|
|
2315
|
+
const K = new ResizeObserver(([H]) => {
|
|
2316
|
+
S(H.contentRect.width);
|
|
2313
2317
|
});
|
|
2314
|
-
return
|
|
2318
|
+
return K.observe(m.current), () => K.disconnect();
|
|
2315
2319
|
}, []);
|
|
2316
|
-
let
|
|
2320
|
+
let G = Gn(
|
|
2317
2321
|
"peer order-2 w-full max-w-full overflow-hidden rounded-sm border",
|
|
2318
2322
|
s ? "bg-transparent" : "bg-grey-75",
|
|
2319
2323
|
o ? "border-red" : "border-grey-500 hover:border-grey-700 focus:border-grey-800",
|
|
@@ -2322,26 +2326,28 @@ const Fi = p.theme({
|
|
|
2322
2326
|
);
|
|
2323
2327
|
return /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
|
|
2324
2328
|
/* @__PURE__ */ P.jsx("div", { ref: m }),
|
|
2325
|
-
|
|
2329
|
+
D && /* @__PURE__ */ P.jsxs("div", { className: n === "full" ? "h-full" : "", style: { width: x }, children: [
|
|
2326
2330
|
/* @__PURE__ */ P.jsx(
|
|
2327
2331
|
Wn,
|
|
2328
2332
|
{
|
|
2329
2333
|
ref: h,
|
|
2330
|
-
className:
|
|
2331
|
-
extensions:
|
|
2334
|
+
className: G,
|
|
2335
|
+
extensions: D,
|
|
2332
2336
|
height: n === "full" ? "100%" : n,
|
|
2333
|
-
theme:
|
|
2337
|
+
theme: Ni,
|
|
2334
2338
|
value: r,
|
|
2339
|
+
onBlur: $,
|
|
2335
2340
|
onChange: a,
|
|
2341
|
+
onFocus: U,
|
|
2336
2342
|
...c
|
|
2337
2343
|
}
|
|
2338
2344
|
),
|
|
2339
|
-
e && /* @__PURE__ */ P.jsx(
|
|
2340
|
-
i && /* @__PURE__ */ P.jsx(
|
|
2345
|
+
e && /* @__PURE__ */ P.jsx(Kn, { className: "order-1 !text-grey-700 peer-focus:!text-black", htmlFor: u, useLabelTag: !0, children: e }),
|
|
2346
|
+
i && /* @__PURE__ */ P.jsx(Jn, { className: "order-3", color: o ? "red" : "", children: i })
|
|
2341
2347
|
] })
|
|
2342
2348
|
] });
|
|
2343
2349
|
});
|
|
2344
2350
|
export {
|
|
2345
|
-
|
|
2351
|
+
Vi as default
|
|
2346
2352
|
};
|
|
2347
|
-
//# sourceMappingURL=CodeEditorView-
|
|
2353
|
+
//# sourceMappingURL=CodeEditorView-b1c6a306.mjs.map
|