@sanity/runtime-cli 1.3.1 → 1.4.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/README.md +11 -14
- package/dist/actions/blueprints/logs.d.ts +1 -0
- package/dist/actions/blueprints/logs.js +3 -2
- package/dist/actions/blueprints/operations.d.ts +1 -0
- package/dist/actions/blueprints/operations.js +3 -2
- package/dist/actions/blueprints/read-blueprint.d.ts +16 -7
- package/dist/actions/blueprints/read-blueprint.js +56 -10
- package/dist/actions/blueprints/stacks.d.ts +6 -6
- package/dist/actions/blueprints/stacks.js +10 -14
- package/dist/actions/blueprints/stash-asset.d.ts +1 -0
- package/dist/actions/blueprints/stash-asset.js +2 -5
- package/dist/actions/functions/invoke.d.ts +6 -2
- package/dist/actions/functions/invoke.js +9 -11
- package/dist/actions/functions/logs.d.ts +6 -1
- package/dist/actions/functions/logs.js +10 -10
- package/dist/commands/blueprints/deploy.js +19 -18
- package/dist/commands/blueprints/info.js +18 -38
- package/dist/commands/blueprints/logs.d.ts +0 -1
- package/dist/commands/blueprints/logs.js +12 -41
- package/dist/commands/blueprints/plan.js +14 -4
- package/dist/commands/functions/invoke.js +19 -2
- package/dist/commands/functions/logs.js +26 -2
- package/dist/config.js +6 -5
- package/dist/server/static/api.d.ts +10 -0
- package/dist/server/static/api.js +38 -43
- package/dist/server/static/components/api-base.d.ts +9 -0
- package/dist/server/static/components/api-base.js +6 -7
- package/dist/server/static/components/function-list.d.ts +1 -0
- package/dist/server/static/components/function-list.js +44 -48
- package/dist/server/static/components/network-spinner.d.ts +1 -0
- package/dist/server/static/components/network-spinner.js +6 -7
- package/dist/server/static/components/payload-panel.d.ts +1 -0
- package/dist/server/static/components/payload-panel.js +32 -36
- package/dist/server/static/components/response-panel.d.ts +1 -0
- package/dist/server/static/components/response-panel.js +50 -64
- package/dist/server/static/static/api.js +53 -0
- package/dist/server/static/static/components/api-base.js +10 -0
- package/dist/server/static/static/components/function-list.js +54 -0
- package/dist/server/static/static/components/network-spinner.js +71 -0
- package/dist/server/static/static/components/payload-panel.js +45 -0
- package/dist/server/static/static/components/response-panel.js +83 -0
- package/dist/server/static/static/vendor/vendor.bundle.js +26879 -0
- package/dist/server/static/vendor/vendor.bundle.d.ts +1815 -0
- package/dist/server/static/vendor/vendor.bundle.js +913 -1029
- package/dist/utils/child-process-wrapper.d.ts +1 -0
- package/dist/utils/display/blueprints-formatting.js +2 -2
- package/dist/utils/get-headers.d.ts +8 -0
- package/dist/utils/get-headers.js +9 -0
- package/dist/utils/get-token.d.ts +3 -1
- package/dist/utils/get-token.js +2 -2
- package/dist/utils/types.d.ts +44 -30
- package/dist/utils/types.js +8 -1
- package/dist/utils/vendor/parser-validator.d.ts +8 -0
- package/dist/utils/vendor/parser-validator.js +514 -0
- package/oclif.manifest.json +1 -11
- package/package.json +10 -11
- /package/dist/server/static/{components → static/components}/app.css +0 -0
- /package/dist/server/static/{index.html → static/index.html} +0 -0
- /package/dist/server/static/{sanity-logo-sm.svg → static/sanity-logo-sm.svg} +0 -0
|
@@ -1551,7 +1551,6 @@ mkTree) {
|
|
|
1551
1551
|
divide(children, positions, from, to, 0);
|
|
1552
1552
|
return (mkTop || mkTree)(localChildren, localPositions, length);
|
|
1553
1553
|
}
|
|
1554
|
-
|
|
1555
1554
|
/**
|
|
1556
1555
|
Tree fragments are used during [incremental
|
|
1557
1556
|
parsing](#common.Parser.startParse) to track parts of old trees
|
|
@@ -1699,7 +1698,6 @@ class StringInput {
|
|
|
1699
1698
|
read(from, to) { return this.string.slice(from, to); }
|
|
1700
1699
|
}
|
|
1701
1700
|
new NodeProp({ perNode: true });
|
|
1702
|
-
|
|
1703
1701
|
/**
|
|
1704
1702
|
A parse stack. These are used internally by the parser to track
|
|
1705
1703
|
parsing progress. They also provide some properties and methods
|
|
@@ -2109,7 +2107,8 @@ class Stack {
|
|
|
2109
2107
|
return;
|
|
2110
2108
|
seen.push(state);
|
|
2111
2109
|
return parser.allActions(state, (action) => {
|
|
2112
|
-
if (action & (262144 /* Action.StayFlag */ | 131072 /* Action.GotoFlag */))
|
|
2110
|
+
if (action & (262144 /* Action.StayFlag */ | 131072 /* Action.GotoFlag */))
|
|
2111
|
+
;
|
|
2113
2112
|
else if (action & 65536 /* Action.ReduceFlag */) {
|
|
2114
2113
|
let rDepth = (action >> 19 /* Action.ReduceDepthShift */) - depth;
|
|
2115
2114
|
if (rDepth > 1) {
|
|
@@ -2299,7 +2298,6 @@ class StackBufferCursor {
|
|
|
2299
2298
|
return new StackBufferCursor(this.stack, this.pos, this.index);
|
|
2300
2299
|
}
|
|
2301
2300
|
}
|
|
2302
|
-
|
|
2303
2301
|
// See lezer-generator/src/encode.ts for comments about the encoding
|
|
2304
2302
|
// used here
|
|
2305
2303
|
function decodeArray(input, Type = Uint16Array) {
|
|
@@ -2335,7 +2333,6 @@ function decodeArray(input, Type = Uint16Array) {
|
|
|
2335
2333
|
}
|
|
2336
2334
|
return array;
|
|
2337
2335
|
}
|
|
2338
|
-
|
|
2339
2336
|
class CachedToken {
|
|
2340
2337
|
constructor() {
|
|
2341
2338
|
this.start = -1;
|
|
@@ -2681,7 +2678,6 @@ function overrides(token, prev, tableData, tableOffset) {
|
|
|
2681
2678
|
let iPrev = findOffset(tableData, tableOffset, prev);
|
|
2682
2679
|
return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev;
|
|
2683
2680
|
}
|
|
2684
|
-
|
|
2685
2681
|
// Environment variable used to control console output
|
|
2686
2682
|
const verbose = typeof process != "undefined" && process.env && /\bparse\b/.test(process.env.LOG);
|
|
2687
2683
|
let stackIDs = null;
|
|
@@ -3500,7 +3496,6 @@ function getSpecializer(spec) {
|
|
|
3500
3496
|
}
|
|
3501
3497
|
return spec.get;
|
|
3502
3498
|
}
|
|
3503
|
-
|
|
3504
3499
|
let nextTagID = 0;
|
|
3505
3500
|
/**
|
|
3506
3501
|
Highlighting tags are markers that denote a highlighting category.
|
|
@@ -4372,121 +4367,125 @@ tagHighlighter([
|
|
|
4372
4367
|
{ tag: tags.invalid, class: "tok-invalid" },
|
|
4373
4368
|
{ tag: tags.punctuation, class: "tok-punctuation" }
|
|
4374
4369
|
]);
|
|
4375
|
-
|
|
4376
4370
|
const jsonHighlighting = styleTags({
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4371
|
+
String: tags.string,
|
|
4372
|
+
Number: tags.number,
|
|
4373
|
+
"True False": tags.bool,
|
|
4374
|
+
PropertyName: tags.propertyName,
|
|
4375
|
+
Null: tags.null,
|
|
4376
|
+
", :": tags.separator,
|
|
4377
|
+
"[ ]": tags.squareBracket,
|
|
4378
|
+
"{ }": tags.brace
|
|
4385
4379
|
});
|
|
4386
|
-
|
|
4387
4380
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
4388
4381
|
const parser = LRParser.deserialize({
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4382
|
+
version: 14,
|
|
4383
|
+
states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",
|
|
4384
|
+
stateData: "#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",
|
|
4385
|
+
goto: "!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
|
|
4386
|
+
nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",
|
|
4387
|
+
maxTerm: 25,
|
|
4388
|
+
nodeProps: [
|
|
4389
|
+
["isolate", -2, 6, 11, ""],
|
|
4390
|
+
["openedBy", 7, "{", 14, "["],
|
|
4391
|
+
["closedBy", 8, "}", 15, "]"]
|
|
4392
|
+
],
|
|
4393
|
+
propSources: [jsonHighlighting],
|
|
4394
|
+
skippedNodes: [0],
|
|
4395
|
+
repeatNodeCount: 2,
|
|
4396
|
+
tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
|
|
4397
|
+
tokenizers: [0],
|
|
4398
|
+
topRules: { "JsonText": [0, 1] },
|
|
4399
|
+
tokenPrec: 0
|
|
4407
4400
|
});
|
|
4408
|
-
|
|
4409
4401
|
// These are filled with ranges (rangeFrom[i] up to but not including
|
|
4410
4402
|
// rangeTo[i]) of code points that count as extending characters.
|
|
4411
|
-
let rangeFrom = [], rangeTo = []
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
(i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i]);
|
|
4403
|
+
let rangeFrom = [], rangeTo = [];
|
|
4404
|
+
(() => {
|
|
4405
|
+
// Compressed representation of the Grapheme_Cluster_Break=Extend
|
|
4406
|
+
// information from
|
|
4407
|
+
// http://www.unicode.org/Public/16.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.
|
|
4408
|
+
// Each pair of elements represents a range, as an offet from the
|
|
4409
|
+
// previous range and a length. Numbers are in base-36, with the empty
|
|
4410
|
+
// string being a shorthand for 1.
|
|
4411
|
+
let numbers = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(s => s ? parseInt(s, 36) : 1);
|
|
4412
|
+
for (let i = 0, n = 0; i < numbers.length; i++)
|
|
4413
|
+
(i % 2 ? rangeTo : rangeFrom).push(n = n + numbers[i]);
|
|
4423
4414
|
})();
|
|
4424
|
-
|
|
4425
4415
|
function isExtendingChar(code) {
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
let
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4416
|
+
if (code < 768)
|
|
4417
|
+
return false;
|
|
4418
|
+
for (let from = 0, to = rangeFrom.length;;) {
|
|
4419
|
+
let mid = (from + to) >> 1;
|
|
4420
|
+
if (code < rangeFrom[mid])
|
|
4421
|
+
to = mid;
|
|
4422
|
+
else if (code >= rangeTo[mid])
|
|
4423
|
+
from = mid + 1;
|
|
4424
|
+
else
|
|
4425
|
+
return true;
|
|
4426
|
+
if (from == to)
|
|
4427
|
+
return false;
|
|
4428
|
+
}
|
|
4434
4429
|
}
|
|
4435
|
-
|
|
4436
4430
|
function isRegionalIndicator(code) {
|
|
4437
|
-
|
|
4431
|
+
return code >= 0x1F1E6 && code <= 0x1F1FF;
|
|
4438
4432
|
}
|
|
4439
|
-
|
|
4440
4433
|
const ZWJ = 0x200d;
|
|
4441
|
-
|
|
4442
4434
|
function findClusterBreak$1(str, pos, forward = true, includeExtending = true) {
|
|
4443
|
-
|
|
4435
|
+
return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
|
|
4444
4436
|
}
|
|
4445
|
-
|
|
4446
4437
|
function nextClusterBreak(str, pos, includeExtending) {
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4438
|
+
if (pos == str.length)
|
|
4439
|
+
return pos;
|
|
4440
|
+
// If pos is in the middle of a surrogate pair, move to its start
|
|
4441
|
+
if (pos && surrogateLow$1(str.charCodeAt(pos)) && surrogateHigh$1(str.charCodeAt(pos - 1)))
|
|
4442
|
+
pos--;
|
|
4443
|
+
let prev = codePointAt$1(str, pos);
|
|
4444
|
+
pos += codePointSize$1(prev);
|
|
4445
|
+
while (pos < str.length) {
|
|
4446
|
+
let next = codePointAt$1(str, pos);
|
|
4447
|
+
if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {
|
|
4448
|
+
pos += codePointSize$1(next);
|
|
4449
|
+
prev = next;
|
|
4450
|
+
}
|
|
4451
|
+
else if (isRegionalIndicator(next)) {
|
|
4452
|
+
let countBefore = 0, i = pos - 2;
|
|
4453
|
+
while (i >= 0 && isRegionalIndicator(codePointAt$1(str, i))) {
|
|
4454
|
+
countBefore++;
|
|
4455
|
+
i -= 2;
|
|
4456
|
+
}
|
|
4457
|
+
if (countBefore % 2 == 0)
|
|
4458
|
+
break;
|
|
4459
|
+
else
|
|
4460
|
+
pos += 2;
|
|
4461
|
+
}
|
|
4462
|
+
else {
|
|
4463
|
+
break;
|
|
4464
|
+
}
|
|
4465
|
+
}
|
|
4466
|
+
return pos;
|
|
4467
4467
|
}
|
|
4468
|
-
|
|
4469
4468
|
function prevClusterBreak(str, pos, includeExtending) {
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4469
|
+
while (pos > 0) {
|
|
4470
|
+
let found = nextClusterBreak(str, pos - 2, includeExtending);
|
|
4471
|
+
if (found < pos)
|
|
4472
|
+
return found;
|
|
4473
|
+
pos--;
|
|
4474
|
+
}
|
|
4475
|
+
return 0;
|
|
4476
4476
|
}
|
|
4477
|
-
|
|
4478
4477
|
function codePointAt$1(str, pos) {
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4478
|
+
let code0 = str.charCodeAt(pos);
|
|
4479
|
+
if (!surrogateHigh$1(code0) || pos + 1 == str.length)
|
|
4480
|
+
return code0;
|
|
4481
|
+
let code1 = str.charCodeAt(pos + 1);
|
|
4482
|
+
if (!surrogateLow$1(code1))
|
|
4483
|
+
return code0;
|
|
4484
|
+
return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000;
|
|
4484
4485
|
}
|
|
4485
|
-
|
|
4486
|
-
function
|
|
4487
|
-
function
|
|
4488
|
-
function codePointSize$1(code) { return code < 0x10000 ? 1 : 2 }
|
|
4489
|
-
|
|
4486
|
+
function surrogateLow$1(ch) { return ch >= 0xDC00 && ch < 0xE000; }
|
|
4487
|
+
function surrogateHigh$1(ch) { return ch >= 0xD800 && ch < 0xDC00; }
|
|
4488
|
+
function codePointSize$1(code) { return code < 0x10000 ? 1 : 2; }
|
|
4490
4489
|
/**
|
|
4491
4490
|
The data structure for documents. @nonabstract
|
|
4492
4491
|
*/
|
|
@@ -4837,7 +4836,7 @@ class TextNode extends Text {
|
|
|
4837
4836
|
return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);
|
|
4838
4837
|
}
|
|
4839
4838
|
}
|
|
4840
|
-
Text.empty = /*@__PURE__*/new TextLeaf([""], 0);
|
|
4839
|
+
Text.empty = /*@__PURE__*/ new TextLeaf([""], 0);
|
|
4841
4840
|
function textLength(text) {
|
|
4842
4841
|
let length = -1;
|
|
4843
4842
|
for (let line of text)
|
|
@@ -5048,7 +5047,6 @@ function clip(text, from, to) {
|
|
|
5048
5047
|
from = Math.max(0, Math.min(text.length, from));
|
|
5049
5048
|
return [from, Math.max(from, Math.min(text.length, to))];
|
|
5050
5049
|
}
|
|
5051
|
-
|
|
5052
5050
|
/**
|
|
5053
5051
|
Returns a next grapheme cluster break _after_ (not equal to)
|
|
5054
5052
|
`pos`, if `forward` is true, or before otherwise. Returns `pos`
|
|
@@ -5091,12 +5089,11 @@ function fromCodePoint(code) {
|
|
|
5091
5089
|
The amount of positions a character takes up in a JavaScript string.
|
|
5092
5090
|
*/
|
|
5093
5091
|
function codePointSize(code) { return code < 0x10000 ? 1 : 2; }
|
|
5094
|
-
|
|
5095
5092
|
const DefaultSplit = /\r\n?|\n/;
|
|
5096
5093
|
/**
|
|
5097
5094
|
Distinguishes different ways in which positions can be mapped.
|
|
5098
5095
|
*/
|
|
5099
|
-
var MapMode = /*@__PURE__*/(function (MapMode) {
|
|
5096
|
+
var MapMode = /*@__PURE__*/ (function (MapMode) {
|
|
5100
5097
|
/**
|
|
5101
5098
|
Map a position to a valid new position, even when its context
|
|
5102
5099
|
was deleted.
|
|
@@ -5114,7 +5111,8 @@ var MapMode = /*@__PURE__*/(function (MapMode) {
|
|
|
5114
5111
|
Return null if the character _after_ the position is deleted.
|
|
5115
5112
|
*/
|
|
5116
5113
|
MapMode[MapMode["TrackAfter"] = 3] = "TrackAfter";
|
|
5117
|
-
return MapMode
|
|
5114
|
+
return MapMode;
|
|
5115
|
+
})(MapMode || (MapMode = {}));
|
|
5118
5116
|
/**
|
|
5119
5117
|
A change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)
|
|
5120
5118
|
that doesn't store the inserted text. As such, it can't be
|
|
@@ -5733,7 +5731,6 @@ class SectionIter {
|
|
|
5733
5731
|
}
|
|
5734
5732
|
}
|
|
5735
5733
|
}
|
|
5736
|
-
|
|
5737
5734
|
/**
|
|
5738
5735
|
A single selection range. When
|
|
5739
5736
|
[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)
|
|
@@ -5992,7 +5989,6 @@ function checkSelection(selection, docLength) {
|
|
|
5992
5989
|
if (range.to > docLength)
|
|
5993
5990
|
throw new RangeError("Selection points outside of document");
|
|
5994
5991
|
}
|
|
5995
|
-
|
|
5996
5992
|
let nextID = 0;
|
|
5997
5993
|
/**
|
|
5998
5994
|
A facet is a labeled value that is associated with an editor
|
|
@@ -6204,7 +6200,7 @@ function dynamicFacetSlot(addresses, facet, providers) {
|
|
|
6204
6200
|
}
|
|
6205
6201
|
};
|
|
6206
6202
|
}
|
|
6207
|
-
const initField = /*@__PURE__*/Facet.define({ static: true });
|
|
6203
|
+
const initField = /*@__PURE__*/ Facet.define({ static: true });
|
|
6208
6204
|
/**
|
|
6209
6205
|
Fields can store additional information in an editor state, and
|
|
6210
6206
|
keep it in sync with the rest of the state.
|
|
@@ -6309,26 +6305,26 @@ const Prec = {
|
|
|
6309
6305
|
The highest precedence level, for extensions that should end up
|
|
6310
6306
|
near the start of the precedence ordering.
|
|
6311
6307
|
*/
|
|
6312
|
-
highest: /*@__PURE__*/prec(Prec_.highest),
|
|
6308
|
+
highest: /*@__PURE__*/ prec(Prec_.highest),
|
|
6313
6309
|
/**
|
|
6314
6310
|
A higher-than-default precedence, for extensions that should
|
|
6315
6311
|
come before those with default precedence.
|
|
6316
6312
|
*/
|
|
6317
|
-
high: /*@__PURE__*/prec(Prec_.high),
|
|
6313
|
+
high: /*@__PURE__*/ prec(Prec_.high),
|
|
6318
6314
|
/**
|
|
6319
6315
|
The default precedence, which is also used for extensions
|
|
6320
6316
|
without an explicit precedence.
|
|
6321
6317
|
*/
|
|
6322
|
-
default: /*@__PURE__*/prec(Prec_.default),
|
|
6318
|
+
default: /*@__PURE__*/ prec(Prec_.default),
|
|
6323
6319
|
/**
|
|
6324
6320
|
A lower-than-default precedence.
|
|
6325
6321
|
*/
|
|
6326
|
-
low: /*@__PURE__*/prec(Prec_.low),
|
|
6322
|
+
low: /*@__PURE__*/ prec(Prec_.low),
|
|
6327
6323
|
/**
|
|
6328
6324
|
The lowest precedence level. Meant for things that should end up
|
|
6329
6325
|
near the end of the extension order.
|
|
6330
6326
|
*/
|
|
6331
|
-
lowest: /*@__PURE__*/prec(Prec_.lowest)
|
|
6327
|
+
lowest: /*@__PURE__*/ prec(Prec_.lowest)
|
|
6332
6328
|
};
|
|
6333
6329
|
class PrecExtension {
|
|
6334
6330
|
constructor(inner, prec) {
|
|
@@ -6501,23 +6497,21 @@ function ensureAddr(state, addr) {
|
|
|
6501
6497
|
function getAddr(state, addr) {
|
|
6502
6498
|
return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1];
|
|
6503
6499
|
}
|
|
6504
|
-
|
|
6505
|
-
const
|
|
6506
|
-
const allowMultipleSelections = /*@__PURE__*/Facet.define({
|
|
6500
|
+
const languageData = /*@__PURE__*/ Facet.define();
|
|
6501
|
+
const allowMultipleSelections = /*@__PURE__*/ Facet.define({
|
|
6507
6502
|
combine: values => values.some(v => v),
|
|
6508
6503
|
static: true
|
|
6509
6504
|
});
|
|
6510
|
-
const lineSeparator = /*@__PURE__*/Facet.define({
|
|
6505
|
+
const lineSeparator = /*@__PURE__*/ Facet.define({
|
|
6511
6506
|
combine: values => values.length ? values[0] : undefined,
|
|
6512
6507
|
static: true
|
|
6513
6508
|
});
|
|
6514
|
-
const changeFilter = /*@__PURE__*/Facet.define();
|
|
6515
|
-
const transactionFilter = /*@__PURE__*/Facet.define();
|
|
6516
|
-
const transactionExtender = /*@__PURE__*/Facet.define();
|
|
6517
|
-
const readOnly = /*@__PURE__*/Facet.define({
|
|
6509
|
+
const changeFilter = /*@__PURE__*/ Facet.define();
|
|
6510
|
+
const transactionFilter = /*@__PURE__*/ Facet.define();
|
|
6511
|
+
const transactionExtender = /*@__PURE__*/ Facet.define();
|
|
6512
|
+
const readOnly = /*@__PURE__*/ Facet.define({
|
|
6518
6513
|
combine: values => values.length ? values[0] : false
|
|
6519
6514
|
});
|
|
6520
|
-
|
|
6521
6515
|
/**
|
|
6522
6516
|
Annotations are tagged values that are used to add metadata to
|
|
6523
6517
|
transactions in an extensible way. They should be used to model
|
|
@@ -6650,11 +6644,11 @@ the editor. Doing this will discard any extensions
|
|
|
6650
6644
|
the content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure)
|
|
6651
6645
|
compartments.
|
|
6652
6646
|
*/
|
|
6653
|
-
StateEffect.reconfigure = /*@__PURE__*/StateEffect.define();
|
|
6647
|
+
StateEffect.reconfigure = /*@__PURE__*/ StateEffect.define();
|
|
6654
6648
|
/**
|
|
6655
6649
|
Append extensions to the top-level configuration of the editor.
|
|
6656
6650
|
*/
|
|
6657
|
-
StateEffect.appendConfig = /*@__PURE__*/StateEffect.define();
|
|
6651
|
+
StateEffect.appendConfig = /*@__PURE__*/ StateEffect.define();
|
|
6658
6652
|
/**
|
|
6659
6653
|
Changes to the editor state are grouped into transactions.
|
|
6660
6654
|
Typically, a user action creates a single transaction, which may
|
|
@@ -6784,7 +6778,7 @@ class Transaction {
|
|
|
6784
6778
|
Annotation used to store transaction timestamps. Automatically
|
|
6785
6779
|
added to every transaction, holding `Date.now()`.
|
|
6786
6780
|
*/
|
|
6787
|
-
Transaction.time = /*@__PURE__*/Annotation.define();
|
|
6781
|
+
Transaction.time = /*@__PURE__*/ Annotation.define();
|
|
6788
6782
|
/**
|
|
6789
6783
|
Annotation used to associate a transaction with a user interface
|
|
6790
6784
|
event. Holds a string identifying the event, using a
|
|
@@ -6811,19 +6805,19 @@ information. The events used by the core libraries are:
|
|
|
6811
6805
|
Use [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check
|
|
6812
6806
|
whether the annotation matches a given event.
|
|
6813
6807
|
*/
|
|
6814
|
-
Transaction.userEvent = /*@__PURE__*/Annotation.define();
|
|
6808
|
+
Transaction.userEvent = /*@__PURE__*/ Annotation.define();
|
|
6815
6809
|
/**
|
|
6816
6810
|
Annotation indicating whether a transaction should be added to
|
|
6817
6811
|
the undo history or not.
|
|
6818
6812
|
*/
|
|
6819
|
-
Transaction.addToHistory = /*@__PURE__*/Annotation.define();
|
|
6813
|
+
Transaction.addToHistory = /*@__PURE__*/ Annotation.define();
|
|
6820
6814
|
/**
|
|
6821
6815
|
Annotation indicating (when present and true) that a transaction
|
|
6822
6816
|
represents a change made by some other actor, not the user. This
|
|
6823
6817
|
is used, for example, to tag other people's changes in
|
|
6824
6818
|
collaborative editing.
|
|
6825
6819
|
*/
|
|
6826
|
-
Transaction.remote = /*@__PURE__*/Annotation.define();
|
|
6820
|
+
Transaction.remote = /*@__PURE__*/ Annotation.define();
|
|
6827
6821
|
function joinRanges(a, b) {
|
|
6828
6822
|
let result = [];
|
|
6829
6823
|
for (let iA = 0, iB = 0;;) {
|
|
@@ -6944,13 +6938,12 @@ const none$2 = [];
|
|
|
6944
6938
|
function asArray$1(value) {
|
|
6945
6939
|
return value == null ? none$2 : Array.isArray(value) ? value : [value];
|
|
6946
6940
|
}
|
|
6947
|
-
|
|
6948
6941
|
/**
|
|
6949
6942
|
The categories produced by a [character
|
|
6950
6943
|
categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used
|
|
6951
6944
|
do things like selecting by word.
|
|
6952
6945
|
*/
|
|
6953
|
-
var CharCategory = /*@__PURE__*/(function (CharCategory) {
|
|
6946
|
+
var CharCategory = /*@__PURE__*/ (function (CharCategory) {
|
|
6954
6947
|
/**
|
|
6955
6948
|
Word characters.
|
|
6956
6949
|
*/
|
|
@@ -6963,11 +6956,12 @@ var CharCategory = /*@__PURE__*/(function (CharCategory) {
|
|
|
6963
6956
|
Anything else.
|
|
6964
6957
|
*/
|
|
6965
6958
|
CharCategory[CharCategory["Other"] = 2] = "Other";
|
|
6966
|
-
return CharCategory
|
|
6959
|
+
return CharCategory;
|
|
6960
|
+
})(CharCategory || (CharCategory = {}));
|
|
6967
6961
|
const nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
|
6968
6962
|
let wordChar;
|
|
6969
6963
|
try {
|
|
6970
|
-
wordChar = /*@__PURE__*/new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u");
|
|
6964
|
+
wordChar = /*@__PURE__*/ new RegExp("[\\p{Alphabetic}\\p{Number}_]", "u");
|
|
6971
6965
|
}
|
|
6972
6966
|
catch (_) { }
|
|
6973
6967
|
function hasWordChar(str) {
|
|
@@ -6992,7 +6986,6 @@ function makeCategorizer(wordChars) {
|
|
|
6992
6986
|
return CharCategory.Other;
|
|
6993
6987
|
};
|
|
6994
6988
|
}
|
|
6995
|
-
|
|
6996
6989
|
/**
|
|
6997
6990
|
The editor state class is a persistent (immutable) data structure.
|
|
6998
6991
|
To update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a
|
|
@@ -7351,7 +7344,7 @@ Configures the tab size to use in this state. The first
|
|
|
7351
7344
|
(highest-precedence) value of the facet is used. If no value is
|
|
7352
7345
|
given, this defaults to 4.
|
|
7353
7346
|
*/
|
|
7354
|
-
EditorState.tabSize = /*@__PURE__*/Facet.define({
|
|
7347
|
+
EditorState.tabSize = /*@__PURE__*/ Facet.define({
|
|
7355
7348
|
combine: values => values.length ? values[0] : 4
|
|
7356
7349
|
});
|
|
7357
7350
|
/**
|
|
@@ -7384,7 +7377,7 @@ Registers translation phrases. The
|
|
|
7384
7377
|
all objects registered with this facet to find translations for
|
|
7385
7378
|
its argument.
|
|
7386
7379
|
*/
|
|
7387
|
-
EditorState.phrases = /*@__PURE__*/Facet.define({
|
|
7380
|
+
EditorState.phrases = /*@__PURE__*/ Facet.define({
|
|
7388
7381
|
compare(a, b) {
|
|
7389
7382
|
let kA = Object.keys(a), kB = Object.keys(b);
|
|
7390
7383
|
return kA.length == kB.length && kA.every(k => a[k] == b[k]);
|
|
@@ -7444,8 +7437,7 @@ but do want to process every transaction.
|
|
|
7444
7437
|
Extenders run _after_ filters, when both are present.
|
|
7445
7438
|
*/
|
|
7446
7439
|
EditorState.transactionExtender = transactionExtender;
|
|
7447
|
-
Compartment.reconfigure = /*@__PURE__*/StateEffect.define();
|
|
7448
|
-
|
|
7440
|
+
Compartment.reconfigure = /*@__PURE__*/ StateEffect.define();
|
|
7449
7441
|
/**
|
|
7450
7442
|
Utility function for combining behaviors to fill in a config
|
|
7451
7443
|
object from an array of provided configs. `defaults` should hold
|
|
@@ -7463,7 +7455,8 @@ combine = {}) {
|
|
|
7463
7455
|
let value = config[key], current = result[key];
|
|
7464
7456
|
if (current === undefined)
|
|
7465
7457
|
result[key] = value;
|
|
7466
|
-
else if (current === value || value === undefined)
|
|
7458
|
+
else if (current === value || value === undefined)
|
|
7459
|
+
; // No conflict
|
|
7467
7460
|
else if (Object.hasOwnProperty.call(combine, key))
|
|
7468
7461
|
result[key] = combine[key](current, value);
|
|
7469
7462
|
else
|
|
@@ -7474,7 +7467,6 @@ combine = {}) {
|
|
|
7474
7467
|
result[key] = defaults[key];
|
|
7475
7468
|
return result;
|
|
7476
7469
|
}
|
|
7477
|
-
|
|
7478
7470
|
/**
|
|
7479
7471
|
Each range is associated with a value, which must inherit from
|
|
7480
7472
|
this class.
|
|
@@ -7875,7 +7867,7 @@ class RangeSet {
|
|
|
7875
7867
|
/**
|
|
7876
7868
|
The empty set of ranges.
|
|
7877
7869
|
*/
|
|
7878
|
-
RangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1);
|
|
7870
|
+
RangeSet.empty = /*@__PURE__*/ new RangeSet([], [], null, -1);
|
|
7879
7871
|
function lazySort(ranges) {
|
|
7880
7872
|
if (ranges.length > 1)
|
|
7881
7873
|
for (let prev = ranges[0], i = 1; i < ranges.length; i++) {
|
|
@@ -8327,7 +8319,6 @@ function findMinIndex(value, array) {
|
|
|
8327
8319
|
}
|
|
8328
8320
|
return found;
|
|
8329
8321
|
}
|
|
8330
|
-
|
|
8331
8322
|
/**
|
|
8332
8323
|
Count the column position at the given offset into the string,
|
|
8333
8324
|
taking extending characters and tab size into account.
|
|
@@ -8364,12 +8355,10 @@ function findColumn(string, col, tabSize, strict) {
|
|
|
8364
8355
|
}
|
|
8365
8356
|
return strict === true ? -1 : string.length;
|
|
8366
8357
|
}
|
|
8367
|
-
|
|
8368
8358
|
const C = "\u037c";
|
|
8369
8359
|
const COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C);
|
|
8370
8360
|
const SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet");
|
|
8371
8361
|
const top = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : {};
|
|
8372
|
-
|
|
8373
8362
|
// :: - Style modules encapsulate a set of CSS rules defined from
|
|
8374
8363
|
// JavaScript. Their definitions are only available in a given DOM
|
|
8375
8364
|
// root after it has been _mounted_ there with `StyleModule.mount`.
|
|
@@ -8380,138 +8369,139 @@ const top = typeof globalThis != "undefined" ? globalThis : typeof window != "un
|
|
|
8380
8369
|
// of style modules that were used. So to avoid leaking rules, don't
|
|
8381
8370
|
// create these dynamically, but treat them as one-time allocations.
|
|
8382
8371
|
class StyleModule {
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8372
|
+
// :: (Object<Style>, ?{finish: ?(string) → string})
|
|
8373
|
+
// Create a style module from the given spec.
|
|
8374
|
+
//
|
|
8375
|
+
// When `finish` is given, it is called on regular (non-`@`)
|
|
8376
|
+
// selectors (after `&` expansion) to compute the final selector.
|
|
8377
|
+
constructor(spec, options) {
|
|
8378
|
+
this.rules = [];
|
|
8379
|
+
let { finish } = options || {};
|
|
8380
|
+
function splitSelector(selector) {
|
|
8381
|
+
return /^@/.test(selector) ? [selector] : selector.split(/,\s*/);
|
|
8382
|
+
}
|
|
8383
|
+
function render(selectors, spec, target, isKeyframes) {
|
|
8384
|
+
let local = [], isAt = /^@(\w+)\b/.exec(selectors[0]), keyframes = isAt && isAt[1] == "keyframes";
|
|
8385
|
+
if (isAt && spec == null)
|
|
8386
|
+
return target.push(selectors[0] + ";");
|
|
8387
|
+
for (let prop in spec) {
|
|
8388
|
+
let value = spec[prop];
|
|
8389
|
+
if (/&/.test(prop)) {
|
|
8390
|
+
render(prop.split(/,\s*/).map(part => selectors.map(sel => part.replace(/&/, sel))).reduce((a, b) => a.concat(b)), value, target);
|
|
8391
|
+
}
|
|
8392
|
+
else if (value && typeof value == "object") {
|
|
8393
|
+
if (!isAt)
|
|
8394
|
+
throw new RangeError("The value of a property (" + prop + ") should be a primitive value.");
|
|
8395
|
+
render(splitSelector(prop), value, local, keyframes);
|
|
8396
|
+
}
|
|
8397
|
+
else if (value != null) {
|
|
8398
|
+
local.push(prop.replace(/_.*/, "").replace(/[A-Z]/g, l => "-" + l.toLowerCase()) + ": " + value + ";");
|
|
8399
|
+
}
|
|
8400
|
+
}
|
|
8401
|
+
if (local.length || keyframes) {
|
|
8402
|
+
target.push((finish && !isAt && !isKeyframes ? selectors.map(finish) : selectors).join(", ") +
|
|
8413
8403
|
" {" + local.join(" ") + "}");
|
|
8414
|
-
|
|
8404
|
+
}
|
|
8405
|
+
}
|
|
8406
|
+
for (let prop in spec)
|
|
8407
|
+
render(splitSelector(prop), spec[prop], this.rules);
|
|
8408
|
+
}
|
|
8409
|
+
// :: () → string
|
|
8410
|
+
// Returns a string containing the module's CSS rules.
|
|
8411
|
+
getRules() { return this.rules.join("\n"); }
|
|
8412
|
+
// :: () → string
|
|
8413
|
+
// Generate a new unique CSS class name.
|
|
8414
|
+
static newName() {
|
|
8415
|
+
let id = top[COUNT] || 1;
|
|
8416
|
+
top[COUNT] = id + 1;
|
|
8417
|
+
return C + id.toString(36);
|
|
8418
|
+
}
|
|
8419
|
+
// :: (union<Document, ShadowRoot>, union<[StyleModule], StyleModule>, ?{nonce: ?string})
|
|
8420
|
+
//
|
|
8421
|
+
// Mount the given set of modules in the given DOM root, which ensures
|
|
8422
|
+
// that the CSS rules defined by the module are available in that
|
|
8423
|
+
// context.
|
|
8424
|
+
//
|
|
8425
|
+
// Rules are only added to the document once per root.
|
|
8426
|
+
//
|
|
8427
|
+
// Rule order will follow the order of the modules, so that rules from
|
|
8428
|
+
// modules later in the array take precedence of those from earlier
|
|
8429
|
+
// modules. If you call this function multiple times for the same root
|
|
8430
|
+
// in a way that changes the order of already mounted modules, the old
|
|
8431
|
+
// order will be changed.
|
|
8432
|
+
//
|
|
8433
|
+
// If a Content Security Policy nonce is provided, it is added to
|
|
8434
|
+
// the `<style>` tag generated by the library.
|
|
8435
|
+
static mount(root, modules, options) {
|
|
8436
|
+
let set = root[SET], nonce = options && options.nonce;
|
|
8437
|
+
if (!set)
|
|
8438
|
+
set = new StyleSet(root, nonce);
|
|
8439
|
+
else if (nonce)
|
|
8440
|
+
set.setNonce(nonce);
|
|
8441
|
+
set.mount(Array.isArray(modules) ? modules : [modules], root);
|
|
8415
8442
|
}
|
|
8416
|
-
|
|
8417
|
-
for (let prop in spec) render(splitSelector(prop), spec[prop], this.rules);
|
|
8418
|
-
}
|
|
8419
|
-
|
|
8420
|
-
// :: () → string
|
|
8421
|
-
// Returns a string containing the module's CSS rules.
|
|
8422
|
-
getRules() { return this.rules.join("\n") }
|
|
8423
|
-
|
|
8424
|
-
// :: () → string
|
|
8425
|
-
// Generate a new unique CSS class name.
|
|
8426
|
-
static newName() {
|
|
8427
|
-
let id = top[COUNT] || 1;
|
|
8428
|
-
top[COUNT] = id + 1;
|
|
8429
|
-
return C + id.toString(36)
|
|
8430
|
-
}
|
|
8431
|
-
|
|
8432
|
-
// :: (union<Document, ShadowRoot>, union<[StyleModule], StyleModule>, ?{nonce: ?string})
|
|
8433
|
-
//
|
|
8434
|
-
// Mount the given set of modules in the given DOM root, which ensures
|
|
8435
|
-
// that the CSS rules defined by the module are available in that
|
|
8436
|
-
// context.
|
|
8437
|
-
//
|
|
8438
|
-
// Rules are only added to the document once per root.
|
|
8439
|
-
//
|
|
8440
|
-
// Rule order will follow the order of the modules, so that rules from
|
|
8441
|
-
// modules later in the array take precedence of those from earlier
|
|
8442
|
-
// modules. If you call this function multiple times for the same root
|
|
8443
|
-
// in a way that changes the order of already mounted modules, the old
|
|
8444
|
-
// order will be changed.
|
|
8445
|
-
//
|
|
8446
|
-
// If a Content Security Policy nonce is provided, it is added to
|
|
8447
|
-
// the `<style>` tag generated by the library.
|
|
8448
|
-
static mount(root, modules, options) {
|
|
8449
|
-
let set = root[SET], nonce = options && options.nonce;
|
|
8450
|
-
if (!set) set = new StyleSet(root, nonce);
|
|
8451
|
-
else if (nonce) set.setNonce(nonce);
|
|
8452
|
-
set.mount(Array.isArray(modules) ? modules : [modules], root);
|
|
8453
|
-
}
|
|
8454
8443
|
}
|
|
8455
|
-
|
|
8456
8444
|
let adoptedSet = new Map; //<Document, StyleSet>
|
|
8457
|
-
|
|
8458
8445
|
class StyleSet {
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8446
|
+
constructor(root, nonce) {
|
|
8447
|
+
let doc = root.ownerDocument || root, win = doc.defaultView;
|
|
8448
|
+
if (!root.head && root.adoptedStyleSheets && win.CSSStyleSheet) {
|
|
8449
|
+
let adopted = adoptedSet.get(doc);
|
|
8450
|
+
if (adopted)
|
|
8451
|
+
return root[SET] = adopted;
|
|
8452
|
+
this.sheet = new win.CSSStyleSheet;
|
|
8453
|
+
adoptedSet.set(doc, this);
|
|
8454
|
+
}
|
|
8455
|
+
else {
|
|
8456
|
+
this.styleTag = doc.createElement("style");
|
|
8457
|
+
if (nonce)
|
|
8458
|
+
this.styleTag.setAttribute("nonce", nonce);
|
|
8459
|
+
}
|
|
8460
|
+
this.modules = [];
|
|
8461
|
+
root[SET] = this;
|
|
8462
|
+
}
|
|
8463
|
+
mount(modules, root) {
|
|
8464
|
+
let sheet = this.sheet;
|
|
8465
|
+
let pos = 0 /* Current rule offset */, j = 0; /* Index into this.modules */
|
|
8466
|
+
for (let i = 0; i < modules.length; i++) {
|
|
8467
|
+
let mod = modules[i], index = this.modules.indexOf(mod);
|
|
8468
|
+
if (index < j && index > -1) { // Ordering conflict
|
|
8469
|
+
this.modules.splice(index, 1);
|
|
8470
|
+
j--;
|
|
8471
|
+
index = -1;
|
|
8472
|
+
}
|
|
8473
|
+
if (index == -1) {
|
|
8474
|
+
this.modules.splice(j++, 0, mod);
|
|
8475
|
+
if (sheet)
|
|
8476
|
+
for (let k = 0; k < mod.rules.length; k++)
|
|
8477
|
+
sheet.insertRule(mod.rules[k], pos++);
|
|
8478
|
+
}
|
|
8479
|
+
else {
|
|
8480
|
+
while (j < index)
|
|
8481
|
+
pos += this.modules[j++].rules.length;
|
|
8482
|
+
pos += mod.rules.length;
|
|
8483
|
+
j++;
|
|
8484
|
+
}
|
|
8485
|
+
}
|
|
8486
|
+
if (sheet) {
|
|
8487
|
+
if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
|
|
8488
|
+
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
8489
|
+
}
|
|
8490
|
+
else {
|
|
8491
|
+
let text = "";
|
|
8492
|
+
for (let i = 0; i < this.modules.length; i++)
|
|
8493
|
+
text += this.modules[i].getRules() + "\n";
|
|
8494
|
+
this.styleTag.textContent = text;
|
|
8495
|
+
let target = root.head || root;
|
|
8496
|
+
if (this.styleTag.parentNode != target)
|
|
8497
|
+
target.insertBefore(this.styleTag, target.firstChild);
|
|
8498
|
+
}
|
|
8499
|
+
}
|
|
8500
|
+
setNonce(nonce) {
|
|
8501
|
+
if (this.styleTag && this.styleTag.getAttribute("nonce") != nonce)
|
|
8502
|
+
this.styleTag.setAttribute("nonce", nonce);
|
|
8493
8503
|
}
|
|
8494
|
-
|
|
8495
|
-
if (sheet) {
|
|
8496
|
-
if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
|
|
8497
|
-
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
8498
|
-
} else {
|
|
8499
|
-
let text = "";
|
|
8500
|
-
for (let i = 0; i < this.modules.length; i++)
|
|
8501
|
-
text += this.modules[i].getRules() + "\n";
|
|
8502
|
-
this.styleTag.textContent = text;
|
|
8503
|
-
let target = root.head || root;
|
|
8504
|
-
if (this.styleTag.parentNode != target)
|
|
8505
|
-
target.insertBefore(this.styleTag, target.firstChild);
|
|
8506
|
-
}
|
|
8507
|
-
}
|
|
8508
|
-
|
|
8509
|
-
setNonce(nonce) {
|
|
8510
|
-
if (this.styleTag && this.styleTag.getAttribute("nonce") != nonce)
|
|
8511
|
-
this.styleTag.setAttribute("nonce", nonce);
|
|
8512
|
-
}
|
|
8513
8504
|
}
|
|
8514
|
-
|
|
8515
8505
|
// Style::Object<union<Style,string>>
|
|
8516
8506
|
//
|
|
8517
8507
|
// A style is an object that, in the simple case, maps CSS property
|
|
@@ -8537,127 +8527,128 @@ class StyleSet {
|
|
|
8537
8527
|
// styles defined inside the object that's the property's value. For
|
|
8538
8528
|
// example to create a media query you can do `{"@media screen and
|
|
8539
8529
|
// (min-width: 400px)": {...}}`.
|
|
8540
|
-
|
|
8541
8530
|
var base = {
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8531
|
+
8: "Backspace",
|
|
8532
|
+
9: "Tab",
|
|
8533
|
+
10: "Enter",
|
|
8534
|
+
12: "NumLock",
|
|
8535
|
+
13: "Enter",
|
|
8536
|
+
16: "Shift",
|
|
8537
|
+
17: "Control",
|
|
8538
|
+
18: "Alt",
|
|
8539
|
+
20: "CapsLock",
|
|
8540
|
+
27: "Escape",
|
|
8541
|
+
32: " ",
|
|
8542
|
+
33: "PageUp",
|
|
8543
|
+
34: "PageDown",
|
|
8544
|
+
35: "End",
|
|
8545
|
+
36: "Home",
|
|
8546
|
+
37: "ArrowLeft",
|
|
8547
|
+
38: "ArrowUp",
|
|
8548
|
+
39: "ArrowRight",
|
|
8549
|
+
40: "ArrowDown",
|
|
8550
|
+
44: "PrintScreen",
|
|
8551
|
+
45: "Insert",
|
|
8552
|
+
46: "Delete",
|
|
8553
|
+
59: ";",
|
|
8554
|
+
61: "=",
|
|
8555
|
+
91: "Meta",
|
|
8556
|
+
92: "Meta",
|
|
8557
|
+
106: "*",
|
|
8558
|
+
107: "+",
|
|
8559
|
+
108: ",",
|
|
8560
|
+
109: "-",
|
|
8561
|
+
110: ".",
|
|
8562
|
+
111: "/",
|
|
8563
|
+
144: "NumLock",
|
|
8564
|
+
145: "ScrollLock",
|
|
8565
|
+
160: "Shift",
|
|
8566
|
+
161: "Shift",
|
|
8567
|
+
162: "Control",
|
|
8568
|
+
163: "Control",
|
|
8569
|
+
164: "Alt",
|
|
8570
|
+
165: "Alt",
|
|
8571
|
+
173: "-",
|
|
8572
|
+
186: ";",
|
|
8573
|
+
187: "=",
|
|
8574
|
+
188: ",",
|
|
8575
|
+
189: "-",
|
|
8576
|
+
190: ".",
|
|
8577
|
+
191: "/",
|
|
8578
|
+
192: "`",
|
|
8579
|
+
219: "[",
|
|
8580
|
+
220: "\\",
|
|
8581
|
+
221: "]",
|
|
8582
|
+
222: "'"
|
|
8594
8583
|
};
|
|
8595
|
-
|
|
8596
8584
|
var shift = {
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8585
|
+
48: ")",
|
|
8586
|
+
49: "!",
|
|
8587
|
+
50: "@",
|
|
8588
|
+
51: "#",
|
|
8589
|
+
52: "$",
|
|
8590
|
+
53: "%",
|
|
8591
|
+
54: "^",
|
|
8592
|
+
55: "&",
|
|
8593
|
+
56: "*",
|
|
8594
|
+
57: "(",
|
|
8595
|
+
59: ":",
|
|
8596
|
+
61: "+",
|
|
8597
|
+
173: "_",
|
|
8598
|
+
186: ":",
|
|
8599
|
+
187: "+",
|
|
8600
|
+
188: "<",
|
|
8601
|
+
189: "_",
|
|
8602
|
+
190: ">",
|
|
8603
|
+
191: "?",
|
|
8604
|
+
192: "~",
|
|
8605
|
+
219: "{",
|
|
8606
|
+
220: "|",
|
|
8607
|
+
221: "}",
|
|
8608
|
+
222: "\""
|
|
8621
8609
|
};
|
|
8622
|
-
|
|
8623
8610
|
var mac = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
|
|
8624
8611
|
var ie$1 = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
8625
|
-
|
|
8626
8612
|
// Fill in the digit keys
|
|
8627
|
-
for (var i = 0; i < 10; i++)
|
|
8628
|
-
|
|
8613
|
+
for (var i = 0; i < 10; i++)
|
|
8614
|
+
base[48 + i] = base[96 + i] = String(i);
|
|
8629
8615
|
// The function keys
|
|
8630
|
-
for (var i = 1; i <= 24; i++)
|
|
8631
|
-
|
|
8616
|
+
for (var i = 1; i <= 24; i++)
|
|
8617
|
+
base[i + 111] = "F" + i;
|
|
8632
8618
|
// And the alphabetic keys
|
|
8633
8619
|
for (var i = 65; i <= 90; i++) {
|
|
8634
|
-
|
|
8635
|
-
|
|
8620
|
+
base[i] = String.fromCharCode(i + 32);
|
|
8621
|
+
shift[i] = String.fromCharCode(i);
|
|
8636
8622
|
}
|
|
8637
|
-
|
|
8638
8623
|
// For each code that doesn't have a shift-equivalent, copy the base name
|
|
8639
|
-
for (var code in base)
|
|
8640
|
-
|
|
8624
|
+
for (var code in base)
|
|
8625
|
+
if (!shift.hasOwnProperty(code))
|
|
8626
|
+
shift[code] = base[code];
|
|
8641
8627
|
function keyName(event) {
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8628
|
+
// On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.
|
|
8629
|
+
// On IE, shift effect is never included in `.key`.
|
|
8630
|
+
var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||
|
|
8631
|
+
ie$1 && event.shiftKey && event.key && event.key.length == 1 ||
|
|
8632
|
+
event.key == "Unidentified";
|
|
8633
|
+
var name = (!ignoreKey && event.key) ||
|
|
8634
|
+
(event.shiftKey ? shift : base)[event.keyCode] ||
|
|
8635
|
+
event.key || "Unidentified";
|
|
8636
|
+
// Edge sometimes produces wrong names (Issue #3)
|
|
8637
|
+
if (name == "Esc")
|
|
8638
|
+
name = "Escape";
|
|
8639
|
+
if (name == "Del")
|
|
8640
|
+
name = "Delete";
|
|
8641
|
+
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
|
|
8642
|
+
if (name == "Left")
|
|
8643
|
+
name = "ArrowLeft";
|
|
8644
|
+
if (name == "Up")
|
|
8645
|
+
name = "ArrowUp";
|
|
8646
|
+
if (name == "Right")
|
|
8647
|
+
name = "ArrowRight";
|
|
8648
|
+
if (name == "Down")
|
|
8649
|
+
name = "ArrowDown";
|
|
8650
|
+
return name;
|
|
8659
8651
|
}
|
|
8660
|
-
|
|
8661
8652
|
function getSelection(root) {
|
|
8662
8653
|
let target;
|
|
8663
8654
|
// Browsers differ on whether shadow roots have a getSelection
|
|
@@ -9039,7 +9030,6 @@ function textNodeAfter(startNode, startOffset) {
|
|
|
9039
9030
|
}
|
|
9040
9031
|
}
|
|
9041
9032
|
}
|
|
9042
|
-
|
|
9043
9033
|
class DOMPos {
|
|
9044
9034
|
constructor(node, offset, precise = true) {
|
|
9045
9035
|
this.node = node;
|
|
@@ -9376,36 +9366,34 @@ function mergeChildrenInto(parent, from, to, insert, openStart, openEnd) {
|
|
|
9376
9366
|
parent.length += dLen;
|
|
9377
9367
|
replaceRange(parent, fromI, fromOff, toI, toOff, insert, 0, openStart, openEnd);
|
|
9378
9368
|
}
|
|
9379
|
-
|
|
9380
9369
|
let nav = typeof navigator != "undefined" ? navigator : { userAgent: "", vendor: "", platform: "" };
|
|
9381
9370
|
let doc = typeof document != "undefined" ? document : { documentElement: { style: {} } };
|
|
9382
|
-
const ie_edge = /*@__PURE__
|
|
9383
|
-
const ie_upto10 = /*@__PURE__
|
|
9384
|
-
const ie_11up = /*@__PURE__
|
|
9371
|
+
const ie_edge = /*@__PURE__*/ /Edge\/(\d+)/.exec(nav.userAgent);
|
|
9372
|
+
const ie_upto10 = /*@__PURE__*/ /MSIE \d/.test(nav.userAgent);
|
|
9373
|
+
const ie_11up = /*@__PURE__*/ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent);
|
|
9385
9374
|
const ie = !!(ie_upto10 || ie_11up || ie_edge);
|
|
9386
|
-
const gecko = !ie && /*@__PURE__
|
|
9387
|
-
const chrome = !ie && /*@__PURE__
|
|
9375
|
+
const gecko = !ie && /*@__PURE__*/ /gecko\/(\d+)/i.test(nav.userAgent);
|
|
9376
|
+
const chrome = !ie && /*@__PURE__*/ /Chrome\/(\d+)/.exec(nav.userAgent);
|
|
9388
9377
|
const webkit = "webkitFontSmoothing" in doc.documentElement.style;
|
|
9389
|
-
const safari = !ie && /*@__PURE__
|
|
9390
|
-
const ios = safari && (/*@__PURE__*//Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);
|
|
9378
|
+
const safari = !ie && /*@__PURE__*/ /Apple Computer/.test(nav.vendor);
|
|
9379
|
+
const ios = safari && ( /*@__PURE__*//Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);
|
|
9391
9380
|
var browser = {
|
|
9392
|
-
mac: ios || /*@__PURE__
|
|
9393
|
-
windows: /*@__PURE__
|
|
9394
|
-
linux: /*@__PURE__
|
|
9381
|
+
mac: ios || /*@__PURE__*/ /Mac/.test(nav.platform),
|
|
9382
|
+
windows: /*@__PURE__*/ /Win/.test(nav.platform),
|
|
9383
|
+
linux: /*@__PURE__*/ /Linux|X11/.test(nav.platform),
|
|
9395
9384
|
ie,
|
|
9396
9385
|
ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0,
|
|
9397
9386
|
gecko,
|
|
9398
|
-
gecko_version: gecko ? +(/*@__PURE__*//Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
|
|
9387
|
+
gecko_version: gecko ? +( /*@__PURE__*//Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
|
|
9399
9388
|
chrome: !!chrome,
|
|
9400
9389
|
chrome_version: chrome ? +chrome[1] : 0,
|
|
9401
9390
|
ios,
|
|
9402
|
-
android: /*@__PURE__
|
|
9391
|
+
android: /*@__PURE__*/ /Android\b/.test(nav.userAgent),
|
|
9403
9392
|
webkit,
|
|
9404
9393
|
safari,
|
|
9405
|
-
webkit_version: webkit ? +(/*@__PURE__*//\bAppleWebKit\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
|
|
9394
|
+
webkit_version: webkit ? +( /*@__PURE__*//\bAppleWebKit\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
|
|
9406
9395
|
tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"
|
|
9407
9396
|
};
|
|
9408
|
-
|
|
9409
9397
|
const MaxJoinLen = 256;
|
|
9410
9398
|
class TextView extends ContentView {
|
|
9411
9399
|
constructor(text) {
|
|
@@ -9752,7 +9740,6 @@ function fallbackRect(view) {
|
|
|
9752
9740
|
let rects = clientRectsFor(last);
|
|
9753
9741
|
return rects[rects.length - 1] || null;
|
|
9754
9742
|
}
|
|
9755
|
-
|
|
9756
9743
|
function combineAttrs(source, target) {
|
|
9757
9744
|
for (let name in source) {
|
|
9758
9745
|
if (name == "class" && target.class)
|
|
@@ -9764,7 +9751,7 @@ function combineAttrs(source, target) {
|
|
|
9764
9751
|
}
|
|
9765
9752
|
return target;
|
|
9766
9753
|
}
|
|
9767
|
-
const noAttrs$1 = /*@__PURE__*/Object.create(null);
|
|
9754
|
+
const noAttrs$1 = /*@__PURE__*/ Object.create(null);
|
|
9768
9755
|
function attrsEq(a, b, ignore) {
|
|
9769
9756
|
if (a == b)
|
|
9770
9757
|
return true;
|
|
@@ -9812,7 +9799,6 @@ function getAttrs(dom) {
|
|
|
9812
9799
|
}
|
|
9813
9800
|
return attrs;
|
|
9814
9801
|
}
|
|
9815
|
-
|
|
9816
9802
|
/**
|
|
9817
9803
|
Widgets added to the content are described by subclasses of this
|
|
9818
9804
|
class. Using a description object like that makes it possible to
|
|
@@ -9890,7 +9876,7 @@ class WidgetType {
|
|
|
9890
9876
|
/**
|
|
9891
9877
|
The different types of blocks that can occur in an editor view.
|
|
9892
9878
|
*/
|
|
9893
|
-
var BlockType = /*@__PURE__*/(function (BlockType) {
|
|
9879
|
+
var BlockType = /*@__PURE__*/ (function (BlockType) {
|
|
9894
9880
|
/**
|
|
9895
9881
|
A line of text.
|
|
9896
9882
|
*/
|
|
@@ -9907,7 +9893,8 @@ var BlockType = /*@__PURE__*/(function (BlockType) {
|
|
|
9907
9893
|
A block widget [replacing](https://codemirror.net/6/docs/ref/#view.Decoration^replace) a range of content.
|
|
9908
9894
|
*/
|
|
9909
9895
|
BlockType[BlockType["WidgetRange"] = 3] = "WidgetRange";
|
|
9910
|
-
return BlockType
|
|
9896
|
+
return BlockType;
|
|
9897
|
+
})(BlockType || (BlockType = {}));
|
|
9911
9898
|
/**
|
|
9912
9899
|
A decoration provides information on how to draw or style a piece
|
|
9913
9900
|
of content. You'll usually use it wrapped in a
|
|
@@ -10096,7 +10083,6 @@ function addRange(from, to, ranges, margin = 0) {
|
|
|
10096
10083
|
else
|
|
10097
10084
|
ranges.push(from, to);
|
|
10098
10085
|
}
|
|
10099
|
-
|
|
10100
10086
|
class LineView extends ContentView {
|
|
10101
10087
|
constructor() {
|
|
10102
10088
|
super(...arguments);
|
|
@@ -10355,7 +10341,6 @@ class BlockGapWidget extends WidgetType {
|
|
|
10355
10341
|
get estimatedHeight() { return this.height; }
|
|
10356
10342
|
ignoreEvent() { return false; }
|
|
10357
10343
|
}
|
|
10358
|
-
|
|
10359
10344
|
class ContentBuilder {
|
|
10360
10345
|
constructor(doc, pos, end, disallowBlockEffectsFor) {
|
|
10361
10346
|
this.doc = doc;
|
|
@@ -10525,13 +10510,12 @@ class NullWidget extends WidgetType {
|
|
|
10525
10510
|
updateDOM(elt) { return elt.nodeName.toLowerCase() == this.tag; }
|
|
10526
10511
|
get isHidden() { return true; }
|
|
10527
10512
|
}
|
|
10528
|
-
NullWidget.inline = /*@__PURE__*/new NullWidget("span");
|
|
10529
|
-
NullWidget.block = /*@__PURE__*/new NullWidget("div");
|
|
10530
|
-
|
|
10513
|
+
NullWidget.inline = /*@__PURE__*/ new NullWidget("span");
|
|
10514
|
+
NullWidget.block = /*@__PURE__*/ new NullWidget("div");
|
|
10531
10515
|
/**
|
|
10532
10516
|
Used to indicate [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).
|
|
10533
10517
|
*/
|
|
10534
|
-
var Direction = /*@__PURE__*/(function (Direction) {
|
|
10518
|
+
var Direction = /*@__PURE__*/ (function (Direction) {
|
|
10535
10519
|
// (These are chosen to match the base levels, in bidi algorithm
|
|
10536
10520
|
// terms, of spans in that direction.)
|
|
10537
10521
|
/**
|
|
@@ -10542,7 +10526,8 @@ var Direction = /*@__PURE__*/(function (Direction) {
|
|
|
10542
10526
|
Right-to-left.
|
|
10543
10527
|
*/
|
|
10544
10528
|
Direction[Direction["RTL"] = 1] = "RTL";
|
|
10545
|
-
return Direction
|
|
10529
|
+
return Direction;
|
|
10530
|
+
})(Direction || (Direction = {}));
|
|
10546
10531
|
const LTR = Direction.LTR, RTL = Direction.RTL;
|
|
10547
10532
|
// Decode a string with each type encoded as log2(type)
|
|
10548
10533
|
function dec(str) {
|
|
@@ -10552,15 +10537,15 @@ function dec(str) {
|
|
|
10552
10537
|
return result;
|
|
10553
10538
|
}
|
|
10554
10539
|
// Character types for codepoints 0 to 0xf8
|
|
10555
|
-
const LowTypes = /*@__PURE__*/dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");
|
|
10540
|
+
const LowTypes = /*@__PURE__*/ dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");
|
|
10556
10541
|
// Character types for codepoints 0x600 to 0x6f9
|
|
10557
|
-
const ArabicTypes = /*@__PURE__*/dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");
|
|
10558
|
-
const Brackets = /*@__PURE__*/Object.create(null), BracketStack = [];
|
|
10542
|
+
const ArabicTypes = /*@__PURE__*/ dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");
|
|
10543
|
+
const Brackets = /*@__PURE__*/ Object.create(null), BracketStack = [];
|
|
10559
10544
|
// There's a lot more in
|
|
10560
10545
|
// https://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt,
|
|
10561
10546
|
// which are left out to keep code size down.
|
|
10562
10547
|
for (let p of ["()", "[]", "{}"]) {
|
|
10563
|
-
let l = /*@__PURE__*/p.charCodeAt(0), r = /*@__PURE__*/p.charCodeAt(1);
|
|
10548
|
+
let l = /*@__PURE__*/ p.charCodeAt(0), r = /*@__PURE__*/ p.charCodeAt(1);
|
|
10564
10549
|
Brackets[l] = r;
|
|
10565
10550
|
Brackets[r] = -l;
|
|
10566
10551
|
}
|
|
@@ -11010,23 +10995,22 @@ function autoDirection(text, from, to) {
|
|
|
11010
10995
|
}
|
|
11011
10996
|
return LTR;
|
|
11012
10997
|
}
|
|
11013
|
-
|
|
11014
|
-
const
|
|
11015
|
-
const
|
|
11016
|
-
const
|
|
11017
|
-
const
|
|
11018
|
-
const
|
|
11019
|
-
const
|
|
11020
|
-
const
|
|
11021
|
-
const
|
|
11022
|
-
const
|
|
11023
|
-
const perLineTextDirection = /*@__PURE__*/Facet.define({
|
|
10998
|
+
const clickAddsSelectionRange = /*@__PURE__*/ Facet.define();
|
|
10999
|
+
const dragMovesSelection$1 = /*@__PURE__*/ Facet.define();
|
|
11000
|
+
const mouseSelectionStyle = /*@__PURE__*/ Facet.define();
|
|
11001
|
+
const exceptionSink = /*@__PURE__*/ Facet.define();
|
|
11002
|
+
const updateListener = /*@__PURE__*/ Facet.define();
|
|
11003
|
+
const inputHandler$1 = /*@__PURE__*/ Facet.define();
|
|
11004
|
+
const focusChangeEffect = /*@__PURE__*/ Facet.define();
|
|
11005
|
+
const clipboardInputFilter = /*@__PURE__*/ Facet.define();
|
|
11006
|
+
const clipboardOutputFilter = /*@__PURE__*/ Facet.define();
|
|
11007
|
+
const perLineTextDirection = /*@__PURE__*/ Facet.define({
|
|
11024
11008
|
combine: values => values.some(x => x)
|
|
11025
11009
|
});
|
|
11026
|
-
const nativeSelectionHidden = /*@__PURE__*/Facet.define({
|
|
11010
|
+
const nativeSelectionHidden = /*@__PURE__*/ Facet.define({
|
|
11027
11011
|
combine: values => values.some(x => x)
|
|
11028
11012
|
});
|
|
11029
|
-
const scrollHandler = /*@__PURE__*/Facet.define();
|
|
11013
|
+
const scrollHandler = /*@__PURE__*/ Facet.define();
|
|
11030
11014
|
class ScrollTarget {
|
|
11031
11015
|
constructor(range, y = "nearest", x = "nearest", yMargin = 5, xMargin = 5,
|
|
11032
11016
|
// This data structure is abused to also store precise scroll
|
|
@@ -11052,8 +11036,8 @@ class ScrollTarget {
|
|
|
11052
11036
|
new ScrollTarget(EditorSelection.cursor(state.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot);
|
|
11053
11037
|
}
|
|
11054
11038
|
}
|
|
11055
|
-
const scrollIntoView$1 = /*@__PURE__*/StateEffect.define({ map: (t, ch) => t.map(ch) });
|
|
11056
|
-
const setEditContextFormatting = /*@__PURE__*/StateEffect.define();
|
|
11039
|
+
const scrollIntoView$1 = /*@__PURE__*/ StateEffect.define({ map: (t, ch) => t.map(ch) });
|
|
11040
|
+
const setEditContextFormatting = /*@__PURE__*/ StateEffect.define();
|
|
11057
11041
|
/**
|
|
11058
11042
|
Log or report an unhandled exception in client code. Should
|
|
11059
11043
|
probably only be used by extension code that allows client code to
|
|
@@ -11077,9 +11061,9 @@ function logException(state, exception, context) {
|
|
|
11077
11061
|
else
|
|
11078
11062
|
console.error(exception);
|
|
11079
11063
|
}
|
|
11080
|
-
const editable = /*@__PURE__*/Facet.define({ combine: values => values.length ? values[0] : true });
|
|
11064
|
+
const editable = /*@__PURE__*/ Facet.define({ combine: values => values.length ? values[0] : true });
|
|
11081
11065
|
let nextPluginID = 0;
|
|
11082
|
-
const viewPlugin = /*@__PURE__*/Facet.define();
|
|
11066
|
+
const viewPlugin = /*@__PURE__*/ Facet.define();
|
|
11083
11067
|
/**
|
|
11084
11068
|
View plugins associate stateful values with a view. They can
|
|
11085
11069
|
influence the way the content is drawn, and are notified of things
|
|
@@ -11194,13 +11178,13 @@ class PluginInstance {
|
|
|
11194
11178
|
this.spec = this.value = null;
|
|
11195
11179
|
}
|
|
11196
11180
|
}
|
|
11197
|
-
const editorAttributes = /*@__PURE__*/Facet.define();
|
|
11198
|
-
const contentAttributes = /*@__PURE__*/Facet.define();
|
|
11181
|
+
const editorAttributes = /*@__PURE__*/ Facet.define();
|
|
11182
|
+
const contentAttributes = /*@__PURE__*/ Facet.define();
|
|
11199
11183
|
// Provide decorations
|
|
11200
|
-
const decorations = /*@__PURE__*/Facet.define();
|
|
11201
|
-
const outerDecorations = /*@__PURE__*/Facet.define();
|
|
11202
|
-
const atomicRanges = /*@__PURE__*/Facet.define();
|
|
11203
|
-
const bidiIsolatedRanges = /*@__PURE__*/Facet.define();
|
|
11184
|
+
const decorations = /*@__PURE__*/ Facet.define();
|
|
11185
|
+
const outerDecorations = /*@__PURE__*/ Facet.define();
|
|
11186
|
+
const atomicRanges = /*@__PURE__*/ Facet.define();
|
|
11187
|
+
const bidiIsolatedRanges = /*@__PURE__*/ Facet.define();
|
|
11204
11188
|
function getIsolatedRanges(view, line) {
|
|
11205
11189
|
let isolates = view.state.facet(bidiIsolatedRanges);
|
|
11206
11190
|
if (!isolates.length)
|
|
@@ -11231,7 +11215,7 @@ function getIsolatedRanges(view, line) {
|
|
|
11231
11215
|
});
|
|
11232
11216
|
return result;
|
|
11233
11217
|
}
|
|
11234
|
-
const scrollMargins = /*@__PURE__*/Facet.define();
|
|
11218
|
+
const scrollMargins = /*@__PURE__*/ Facet.define();
|
|
11235
11219
|
function getScrollMargins(view) {
|
|
11236
11220
|
let left = 0, right = 0, top = 0, bottom = 0;
|
|
11237
11221
|
for (let source of view.state.facet(scrollMargins)) {
|
|
@@ -11249,7 +11233,7 @@ function getScrollMargins(view) {
|
|
|
11249
11233
|
}
|
|
11250
11234
|
return { left, right, top, bottom };
|
|
11251
11235
|
}
|
|
11252
|
-
const styleModule = /*@__PURE__*/Facet.define();
|
|
11236
|
+
const styleModule = /*@__PURE__*/ Facet.define();
|
|
11253
11237
|
class ChangedRange {
|
|
11254
11238
|
constructor(fromA, toA, fromB, toB) {
|
|
11255
11239
|
this.fromA = fromA;
|
|
@@ -11392,7 +11376,6 @@ class ViewUpdate {
|
|
|
11392
11376
|
*/
|
|
11393
11377
|
get empty() { return this.flags == 0 && this.transactions.length == 0; }
|
|
11394
11378
|
}
|
|
11395
|
-
|
|
11396
11379
|
class DocView extends ContentView {
|
|
11397
11380
|
get length() { return this.view.state.doc.length; }
|
|
11398
11381
|
constructor(view) {
|
|
@@ -11624,7 +11607,8 @@ class DocView extends ContentView {
|
|
|
11624
11607
|
this.dom.focus({ preventScroll: true });
|
|
11625
11608
|
}
|
|
11626
11609
|
let rawSel = getSelection(this.view.root);
|
|
11627
|
-
if (!rawSel)
|
|
11610
|
+
if (!rawSel)
|
|
11611
|
+
;
|
|
11628
11612
|
else if (main.empty) {
|
|
11629
11613
|
// Work around https://bugzilla.mozilla.org/show_bug.cgi?id=1612076
|
|
11630
11614
|
if (browser.gecko) {
|
|
@@ -12042,7 +12026,6 @@ function touchesComposition(changes, composition) {
|
|
|
12042
12026
|
});
|
|
12043
12027
|
return touched;
|
|
12044
12028
|
}
|
|
12045
|
-
|
|
12046
12029
|
function groupAt(state, pos, bias = 1) {
|
|
12047
12030
|
let categorize = state.charCategorizer(pos);
|
|
12048
12031
|
let line = state.doc.lineAt(pos), linePos = pos - line.from;
|
|
@@ -12415,7 +12398,6 @@ function skipAtoms(view, oldPos, pos) {
|
|
|
12415
12398
|
let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map(f => f(view)), pos.from, oldPos.head > pos.from ? -1 : 1);
|
|
12416
12399
|
return newPos == pos.from ? pos : EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1);
|
|
12417
12400
|
}
|
|
12418
|
-
|
|
12419
12401
|
const LineBreakPlaceholder = "\uffff";
|
|
12420
12402
|
class DOMReader {
|
|
12421
12403
|
constructor(points, state) {
|
|
@@ -12529,7 +12511,6 @@ class DOMPoint {
|
|
|
12529
12511
|
this.pos = -1;
|
|
12530
12512
|
}
|
|
12531
12513
|
}
|
|
12532
|
-
|
|
12533
12514
|
class DOMChange {
|
|
12534
12515
|
constructor(view, start, end, typeOver) {
|
|
12535
12516
|
this.typeOver = typeOver;
|
|
@@ -12797,7 +12778,6 @@ function selectionFromPoints(points, base) {
|
|
|
12797
12778
|
let anchor = points[0].pos, head = points.length == 2 ? points[1].pos : anchor;
|
|
12798
12779
|
return anchor > -1 && head > -1 ? EditorSelection.single(anchor + base, head + base) : null;
|
|
12799
12780
|
}
|
|
12800
|
-
|
|
12801
12781
|
class InputState {
|
|
12802
12782
|
setSelectionOrigin(origin) {
|
|
12803
12783
|
this.lastSelectionOrigin = origin;
|
|
@@ -13198,8 +13178,8 @@ function eventBelongsToEditor(view, event) {
|
|
|
13198
13178
|
return false;
|
|
13199
13179
|
return true;
|
|
13200
13180
|
}
|
|
13201
|
-
const handlers = /*@__PURE__*/Object.create(null);
|
|
13202
|
-
const observers = /*@__PURE__*/Object.create(null);
|
|
13181
|
+
const handlers = /*@__PURE__*/ Object.create(null);
|
|
13182
|
+
const observers = /*@__PURE__*/ Object.create(null);
|
|
13203
13183
|
// This is very crude, but unfortunately both these browsers _pretend_
|
|
13204
13184
|
// that they have a clipboard API—all the objects and methods are
|
|
13205
13185
|
// there, they just don't work, and they are hard to test.
|
|
@@ -13545,7 +13525,7 @@ handlers.copy = handlers.cut = (view, event) => {
|
|
|
13545
13525
|
return false;
|
|
13546
13526
|
}
|
|
13547
13527
|
};
|
|
13548
|
-
const isFocusChange = /*@__PURE__*/Annotation.define();
|
|
13528
|
+
const isFocusChange = /*@__PURE__*/ Annotation.define();
|
|
13549
13529
|
function focusChangeTransaction(state, focus) {
|
|
13550
13530
|
let effects = [];
|
|
13551
13531
|
for (let getEffect of state.facet(focusChangeEffect)) {
|
|
@@ -13668,7 +13648,7 @@ handlers.beforeinput = (view, event) => {
|
|
|
13668
13648
|
}
|
|
13669
13649
|
return false;
|
|
13670
13650
|
};
|
|
13671
|
-
const appliedFirefoxHack = /*@__PURE__*/new Set;
|
|
13651
|
+
const appliedFirefoxHack = /*@__PURE__*/ new Set;
|
|
13672
13652
|
// In Firefox, when cut/copy handlers are added to the document, that
|
|
13673
13653
|
// somehow avoids a bug where those events aren't fired when the
|
|
13674
13654
|
// selection is empty. See https://github.com/codemirror/dev/issues/1082
|
|
@@ -13680,7 +13660,6 @@ function firefoxCopyCutHack(doc) {
|
|
|
13680
13660
|
doc.addEventListener("cut", () => { });
|
|
13681
13661
|
}
|
|
13682
13662
|
}
|
|
13683
|
-
|
|
13684
13663
|
const wrappingWhiteSpace = ["pre-wrap", "normal", "pre-line", "break-spaces"];
|
|
13685
13664
|
// Used to track, during updateHeight, if any actual heights changed
|
|
13686
13665
|
let heightChangeFlag = false;
|
|
@@ -13835,11 +13814,12 @@ class BlockInfo {
|
|
|
13835
13814
|
return new BlockInfo(this.from, this.length + other.length, this.top, this.height + other.height, content);
|
|
13836
13815
|
}
|
|
13837
13816
|
}
|
|
13838
|
-
var QueryType$1 = /*@__PURE__*/(function (QueryType) {
|
|
13817
|
+
var QueryType$1 = /*@__PURE__*/ (function (QueryType) {
|
|
13839
13818
|
QueryType[QueryType["ByPos"] = 0] = "ByPos";
|
|
13840
13819
|
QueryType[QueryType["ByHeight"] = 1] = "ByHeight";
|
|
13841
13820
|
QueryType[QueryType["ByPosNoHeight"] = 2] = "ByPosNoHeight";
|
|
13842
|
-
return QueryType
|
|
13821
|
+
return QueryType;
|
|
13822
|
+
})(QueryType$1 || (QueryType$1 = {}));
|
|
13843
13823
|
const Epsilon = 1e-3;
|
|
13844
13824
|
class HeightMap {
|
|
13845
13825
|
constructor(length, // The number of characters covered
|
|
@@ -14402,7 +14382,6 @@ class DecorationComparator {
|
|
|
14402
14382
|
addRange(from, to, this.changes, 5);
|
|
14403
14383
|
}
|
|
14404
14384
|
}
|
|
14405
|
-
|
|
14406
14385
|
function visiblePixelRange(dom, paddingTop) {
|
|
14407
14386
|
let rect = dom.getBoundingClientRect();
|
|
14408
14387
|
let doc = dom.ownerDocument, win = doc.defaultView || window;
|
|
@@ -15056,10 +15035,9 @@ function scaleBlock(block, scaler) {
|
|
|
15056
15035
|
let bTop = scaler.toDOM(block.top), bBottom = scaler.toDOM(block.bottom);
|
|
15057
15036
|
return new BlockInfo(block.from, block.length, bTop, bBottom - bTop, Array.isArray(block._content) ? block._content.map(b => scaleBlock(b, scaler)) : block._content);
|
|
15058
15037
|
}
|
|
15059
|
-
|
|
15060
|
-
const
|
|
15061
|
-
const
|
|
15062
|
-
const baseThemeID = /*@__PURE__*/StyleModule.newName(), baseLightID = /*@__PURE__*/StyleModule.newName(), baseDarkID = /*@__PURE__*/StyleModule.newName();
|
|
15038
|
+
const theme = /*@__PURE__*/ Facet.define({ combine: strs => strs.join(" ") });
|
|
15039
|
+
const darkTheme = /*@__PURE__*/ Facet.define({ combine: values => values.indexOf(true) > -1 });
|
|
15040
|
+
const baseThemeID = /*@__PURE__*/ StyleModule.newName(), baseLightID = /*@__PURE__*/ StyleModule.newName(), baseDarkID = /*@__PURE__*/ StyleModule.newName();
|
|
15063
15041
|
const lightDarkIDs = { "&light": "." + baseLightID, "&dark": "." + baseDarkID };
|
|
15064
15042
|
function buildTheme(main, spec, scopes) {
|
|
15065
15043
|
return new StyleModule(spec, {
|
|
@@ -15074,7 +15052,7 @@ function buildTheme(main, spec, scopes) {
|
|
|
15074
15052
|
}
|
|
15075
15053
|
});
|
|
15076
15054
|
}
|
|
15077
|
-
const baseTheme$1$3 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
15055
|
+
const baseTheme$1$3 = /*@__PURE__*/ buildTheme("." + baseThemeID, {
|
|
15078
15056
|
"&": {
|
|
15079
15057
|
position: "relative !important",
|
|
15080
15058
|
boxSizing: "border-box",
|
|
@@ -15320,7 +15298,6 @@ const baseTheme$1$3 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
15320
15298
|
backgroundColor: "inherit"
|
|
15321
15299
|
}
|
|
15322
15300
|
}, lightDarkIDs);
|
|
15323
|
-
|
|
15324
15301
|
const observeOptions = {
|
|
15325
15302
|
childList: true,
|
|
15326
15303
|
characterData: true,
|
|
@@ -16031,7 +16008,6 @@ class EditContextManager {
|
|
|
16031
16008
|
this.editContext.removeEventListener(event, this.handlers[event]);
|
|
16032
16009
|
}
|
|
16033
16010
|
}
|
|
16034
|
-
|
|
16035
16011
|
// The editor's update state machine looks something like this:
|
|
16036
16012
|
//
|
|
16037
16013
|
// Idle → Updating ⇆ Idle (unchecked) → Measuring → Idle
|
|
@@ -17146,7 +17122,7 @@ Provides a Content Security Policy nonce to use when creating
|
|
|
17146
17122
|
the style sheets for the editor. Holds the empty string when no
|
|
17147
17123
|
nonce has been provided.
|
|
17148
17124
|
*/
|
|
17149
|
-
EditorView.cspNonce = /*@__PURE__*/Facet.define({ combine: values => values.length ? values[0] : "" });
|
|
17125
|
+
EditorView.cspNonce = /*@__PURE__*/ Facet.define({ combine: values => values.length ? values[0] : "" });
|
|
17150
17126
|
/**
|
|
17151
17127
|
Facet that provides additional DOM attributes for the editor's
|
|
17152
17128
|
editable DOM element.
|
|
@@ -17161,7 +17137,7 @@ EditorView.editorAttributes = editorAttributes;
|
|
|
17161
17137
|
An extension that enables line wrapping in the editor (by
|
|
17162
17138
|
setting CSS `white-space` to `pre-wrap` in the content).
|
|
17163
17139
|
*/
|
|
17164
|
-
EditorView.lineWrapping = /*@__PURE__*/EditorView.contentAttributes.of({ "class": "cm-lineWrapping" });
|
|
17140
|
+
EditorView.lineWrapping = /*@__PURE__*/ EditorView.contentAttributes.of({ "class": "cm-lineWrapping" });
|
|
17165
17141
|
/**
|
|
17166
17142
|
State effect used to include screen reader announcements in a
|
|
17167
17143
|
transaction. These will be added to the DOM in a visually hidden
|
|
@@ -17170,7 +17146,7 @@ describe effects that are visually obvious but may not be
|
|
|
17170
17146
|
noticed by screen reader users (such as moving to the next
|
|
17171
17147
|
search match).
|
|
17172
17148
|
*/
|
|
17173
|
-
EditorView.announce = /*@__PURE__*/StateEffect.define();
|
|
17149
|
+
EditorView.announce = /*@__PURE__*/ StateEffect.define();
|
|
17174
17150
|
// Maximum line length for which we compute accurate bidi info
|
|
17175
17151
|
const MaxBidiLine = 4096;
|
|
17176
17152
|
const BadMeasure = {};
|
|
@@ -17203,7 +17179,6 @@ function attrsFromFacet(view, facet, base) {
|
|
|
17203
17179
|
}
|
|
17204
17180
|
return base;
|
|
17205
17181
|
}
|
|
17206
|
-
|
|
17207
17182
|
const currentPlatform = browser.mac ? "mac" : browser.windows ? "win" : browser.linux ? "linux" : "key";
|
|
17208
17183
|
function normalizeKeyName(name, platform) {
|
|
17209
17184
|
const parts = name.split(/-(?!$)/);
|
|
@@ -17251,7 +17226,7 @@ function modifiers(name, event, shift) {
|
|
|
17251
17226
|
name = "Shift-" + name;
|
|
17252
17227
|
return name;
|
|
17253
17228
|
}
|
|
17254
|
-
const handleKeyEvents = /*@__PURE__*/Prec.default(/*@__PURE__*/EditorView.domEventHandlers({
|
|
17229
|
+
const handleKeyEvents = /*@__PURE__*/ Prec.default(/*@__PURE__*/ EditorView.domEventHandlers({
|
|
17255
17230
|
keydown(event, view) {
|
|
17256
17231
|
return runHandlers(getKeymap(view.state), event, view, "editor");
|
|
17257
17232
|
}
|
|
@@ -17264,8 +17239,8 @@ determine their precedence (the ones specified early or with high
|
|
|
17264
17239
|
priority get checked first). When a handler has returned `true`
|
|
17265
17240
|
for a given key, no further handlers are called.
|
|
17266
17241
|
*/
|
|
17267
|
-
const keymap = /*@__PURE__*/Facet.define({ enables: handleKeyEvents });
|
|
17268
|
-
const Keymaps = /*@__PURE__*/new WeakMap();
|
|
17242
|
+
const keymap = /*@__PURE__*/ Facet.define({ enables: handleKeyEvents });
|
|
17243
|
+
const Keymaps = /*@__PURE__*/ new WeakMap();
|
|
17269
17244
|
// This is hidden behind an indirection, rather than directly computed
|
|
17270
17245
|
// by the facet, to keep internal types out of the facet's type.
|
|
17271
17246
|
function getKeymap(state) {
|
|
@@ -17308,8 +17283,10 @@ function buildKeymap(bindings, platform = currentPlatform) {
|
|
|
17308
17283
|
stopPropagation: false,
|
|
17309
17284
|
run: [(view) => {
|
|
17310
17285
|
let ourObj = storedPrefix = { view, prefix, scope };
|
|
17311
|
-
setTimeout(() => {
|
|
17312
|
-
storedPrefix
|
|
17286
|
+
setTimeout(() => {
|
|
17287
|
+
if (storedPrefix == ourObj)
|
|
17288
|
+
storedPrefix = null;
|
|
17289
|
+
}, PrefixTimeout);
|
|
17313
17290
|
return true;
|
|
17314
17291
|
}]
|
|
17315
17292
|
};
|
|
@@ -17414,7 +17391,6 @@ function runHandlers(map, event, view, scope) {
|
|
|
17414
17391
|
currentKeyEvent = null;
|
|
17415
17392
|
return handled;
|
|
17416
17393
|
}
|
|
17417
|
-
|
|
17418
17394
|
/**
|
|
17419
17395
|
Implementation of [`LayerMarker`](https://codemirror.net/6/docs/ref/#view.LayerMarker) that creates
|
|
17420
17396
|
a rectangle at a given set of coordinates.
|
|
@@ -17673,7 +17649,7 @@ class LayerView {
|
|
|
17673
17649
|
this.dom.remove();
|
|
17674
17650
|
}
|
|
17675
17651
|
}
|
|
17676
|
-
const layerOrder = /*@__PURE__*/Facet.define();
|
|
17652
|
+
const layerOrder = /*@__PURE__*/ Facet.define();
|
|
17677
17653
|
/**
|
|
17678
17654
|
Define a layer.
|
|
17679
17655
|
*/
|
|
@@ -17683,9 +17659,8 @@ function layer(config) {
|
|
|
17683
17659
|
layerOrder.of(config)
|
|
17684
17660
|
];
|
|
17685
17661
|
}
|
|
17686
|
-
|
|
17687
17662
|
const CanHidePrimary = !(browser.ios && browser.webkit && browser.webkit_version < 534);
|
|
17688
|
-
const selectionConfig = /*@__PURE__*/Facet.define({
|
|
17663
|
+
const selectionConfig = /*@__PURE__*/ Facet.define({
|
|
17689
17664
|
combine(configs) {
|
|
17690
17665
|
return combineConfig(configs, {
|
|
17691
17666
|
cursorBlinkRate: 1200,
|
|
@@ -17726,7 +17701,7 @@ function drawSelection(config = {}) {
|
|
|
17726
17701
|
function configChanged(update) {
|
|
17727
17702
|
return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig);
|
|
17728
17703
|
}
|
|
17729
|
-
const cursorLayer = /*@__PURE__*/layer({
|
|
17704
|
+
const cursorLayer = /*@__PURE__*/ layer({
|
|
17730
17705
|
above: true,
|
|
17731
17706
|
markers(view) {
|
|
17732
17707
|
let { state } = view, conf = state.facet(selectionConfig);
|
|
@@ -17758,7 +17733,7 @@ const cursorLayer = /*@__PURE__*/layer({
|
|
|
17758
17733
|
function setBlinkRate(state, dom) {
|
|
17759
17734
|
dom.style.animationDuration = state.facet(selectionConfig).cursorBlinkRate + "ms";
|
|
17760
17735
|
}
|
|
17761
|
-
const selectionLayer = /*@__PURE__*/layer({
|
|
17736
|
+
const selectionLayer = /*@__PURE__*/ layer({
|
|
17762
17737
|
above: false,
|
|
17763
17738
|
markers(view) {
|
|
17764
17739
|
return view.state.selection.ranges.map(r => r.empty ? [] : RectangleMarker.forRange(view, "cm-selectionBackground", r))
|
|
@@ -17784,12 +17759,11 @@ const themeSpec = {
|
|
|
17784
17759
|
};
|
|
17785
17760
|
if (CanHidePrimary)
|
|
17786
17761
|
themeSpec[".cm-line"].caretColor = themeSpec[".cm-content"].caretColor = "transparent !important";
|
|
17787
|
-
const hideNativeSelection = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.theme(themeSpec));
|
|
17788
|
-
|
|
17789
|
-
const setDropCursorPos = /*@__PURE__*/StateEffect.define({
|
|
17762
|
+
const hideNativeSelection = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ EditorView.theme(themeSpec));
|
|
17763
|
+
const setDropCursorPos = /*@__PURE__*/ StateEffect.define({
|
|
17790
17764
|
map(pos, mapping) { return pos == null ? null : mapping.mapPos(pos); }
|
|
17791
17765
|
});
|
|
17792
|
-
const dropCursorPos = /*@__PURE__*/StateField.define({
|
|
17766
|
+
const dropCursorPos = /*@__PURE__*/ StateField.define({
|
|
17793
17767
|
create() { return null; },
|
|
17794
17768
|
update(pos, tr) {
|
|
17795
17769
|
if (pos != null)
|
|
@@ -17797,7 +17771,7 @@ const dropCursorPos = /*@__PURE__*/StateField.define({
|
|
|
17797
17771
|
return tr.effects.reduce((pos, e) => e.is(setDropCursorPos) ? e.value : pos, pos);
|
|
17798
17772
|
}
|
|
17799
17773
|
});
|
|
17800
|
-
const drawDropCursor = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
17774
|
+
const drawDropCursor = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
17801
17775
|
constructor(view) {
|
|
17802
17776
|
this.view = view;
|
|
17803
17777
|
this.cursor = null;
|
|
@@ -17879,7 +17853,6 @@ dragged over the editor.
|
|
|
17879
17853
|
function dropCursor() {
|
|
17880
17854
|
return [dropCursorPos, drawDropCursor];
|
|
17881
17855
|
}
|
|
17882
|
-
|
|
17883
17856
|
function iterMatches(doc, re, from, to, f) {
|
|
17884
17857
|
re.lastIndex = 0;
|
|
17885
17858
|
for (let cursor = doc.iterRange(from, to), pos = from, m; !cursor.next().done; pos += cursor.value.length) {
|
|
@@ -18003,9 +17976,8 @@ class MatchDecorator {
|
|
|
18003
17976
|
return deco;
|
|
18004
17977
|
}
|
|
18005
17978
|
}
|
|
18006
|
-
|
|
18007
17979
|
const UnicodeRegexpSupport = /x/.unicode != null ? "gu" : "g";
|
|
18008
|
-
const Specials = /*@__PURE__*/new RegExp("[\u0000-\u0008\u000a-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]", UnicodeRegexpSupport);
|
|
17980
|
+
const Specials = /*@__PURE__*/ new RegExp("[\u0000-\u0008\u000a-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]", UnicodeRegexpSupport);
|
|
18009
17981
|
const Names = {
|
|
18010
17982
|
0: "null",
|
|
18011
17983
|
7: "bell",
|
|
@@ -18038,7 +18010,7 @@ function supportsTabSize() {
|
|
|
18038
18010
|
}
|
|
18039
18011
|
return _supportsTabSize || false;
|
|
18040
18012
|
}
|
|
18041
|
-
const specialCharConfig = /*@__PURE__*/Facet.define({
|
|
18013
|
+
const specialCharConfig = /*@__PURE__*/ Facet.define({
|
|
18042
18014
|
combine(configs) {
|
|
18043
18015
|
let config = combineConfig(configs, {
|
|
18044
18016
|
render: null,
|
|
@@ -18153,7 +18125,6 @@ class TabWidget extends WidgetType {
|
|
|
18153
18125
|
}
|
|
18154
18126
|
ignoreEvent() { return false; }
|
|
18155
18127
|
}
|
|
18156
|
-
|
|
18157
18128
|
/**
|
|
18158
18129
|
Mark lines that have a cursor on them with the `"cm-activeLine"`
|
|
18159
18130
|
DOM class.
|
|
@@ -18161,8 +18132,8 @@ DOM class.
|
|
|
18161
18132
|
function highlightActiveLine() {
|
|
18162
18133
|
return activeLineHighlighter;
|
|
18163
18134
|
}
|
|
18164
|
-
const lineDeco = /*@__PURE__*/Decoration.line({ class: "cm-activeLine" });
|
|
18165
|
-
const activeLineHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
18135
|
+
const lineDeco = /*@__PURE__*/ Decoration.line({ class: "cm-activeLine" });
|
|
18136
|
+
const activeLineHighlighter = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
18166
18137
|
constructor(view) {
|
|
18167
18138
|
this.decorations = this.getDeco(view);
|
|
18168
18139
|
}
|
|
@@ -18184,7 +18155,6 @@ const activeLineHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
18184
18155
|
}, {
|
|
18185
18156
|
decorations: v => v.decorations
|
|
18186
18157
|
});
|
|
18187
|
-
|
|
18188
18158
|
// Don't compute precise column positions for line offsets above this
|
|
18189
18159
|
// (since it could get expensive). Assume offset==column for them.
|
|
18190
18160
|
const MaxOff = 2000;
|
|
@@ -18311,7 +18281,6 @@ function crosshairCursor(options = {}) {
|
|
|
18311
18281
|
EditorView.contentAttributes.of(view => { var _a; return ((_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.isDown) ? showCrosshair : null; })
|
|
18312
18282
|
];
|
|
18313
18283
|
}
|
|
18314
|
-
|
|
18315
18284
|
const Outside = "-10000px";
|
|
18316
18285
|
class TooltipViewManager {
|
|
18317
18286
|
constructor(view, facet, createTooltipView, removeTooltipView) {
|
|
@@ -18375,7 +18344,7 @@ function windowSpace(view) {
|
|
|
18375
18344
|
let docElt = view.dom.ownerDocument.documentElement;
|
|
18376
18345
|
return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
|
|
18377
18346
|
}
|
|
18378
|
-
const tooltipConfig = /*@__PURE__*/Facet.define({
|
|
18347
|
+
const tooltipConfig = /*@__PURE__*/ Facet.define({
|
|
18379
18348
|
combine: values => {
|
|
18380
18349
|
var _a, _b, _c;
|
|
18381
18350
|
return ({
|
|
@@ -18385,8 +18354,8 @@ const tooltipConfig = /*@__PURE__*/Facet.define({
|
|
|
18385
18354
|
});
|
|
18386
18355
|
}
|
|
18387
18356
|
});
|
|
18388
|
-
const knownHeight = /*@__PURE__*/new WeakMap();
|
|
18389
|
-
const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
18357
|
+
const knownHeight = /*@__PURE__*/ new WeakMap();
|
|
18358
|
+
const tooltipPlugin = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
18390
18359
|
constructor(view) {
|
|
18391
18360
|
this.view = view;
|
|
18392
18361
|
this.above = [];
|
|
@@ -18642,7 +18611,7 @@ function setLeftStyle(elt, value) {
|
|
|
18642
18611
|
if (isNaN(current) || Math.abs(value - current) > 1)
|
|
18643
18612
|
elt.style.left = value + "px";
|
|
18644
18613
|
}
|
|
18645
|
-
const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
|
|
18614
|
+
const baseTheme$4 = /*@__PURE__*/ EditorView.baseTheme({
|
|
18646
18615
|
".cm-tooltip": {
|
|
18647
18616
|
zIndex: 500,
|
|
18648
18617
|
boxSizing: "border-box"
|
|
@@ -18708,10 +18677,10 @@ const noOffset = { x: 0, y: 0 };
|
|
|
18708
18677
|
/**
|
|
18709
18678
|
Facet to which an extension can add a value to show a tooltip.
|
|
18710
18679
|
*/
|
|
18711
|
-
const showTooltip = /*@__PURE__*/Facet.define({
|
|
18680
|
+
const showTooltip = /*@__PURE__*/ Facet.define({
|
|
18712
18681
|
enables: [tooltipPlugin, baseTheme$4]
|
|
18713
18682
|
});
|
|
18714
|
-
const showHoverTooltip = /*@__PURE__*/Facet.define({
|
|
18683
|
+
const showHoverTooltip = /*@__PURE__*/ Facet.define({
|
|
18715
18684
|
combine: inputs => inputs.reduce((a, i) => a.concat(i), [])
|
|
18716
18685
|
});
|
|
18717
18686
|
class HoverTooltipHost {
|
|
@@ -18773,7 +18742,7 @@ class HoverTooltipHost {
|
|
|
18773
18742
|
get overlap() { return this.passProp("overlap"); }
|
|
18774
18743
|
get resize() { return this.passProp("resize"); }
|
|
18775
18744
|
}
|
|
18776
|
-
const showHoverTooltipHost = /*@__PURE__*/showTooltip.compute([showHoverTooltip], state => {
|
|
18745
|
+
const showHoverTooltipHost = /*@__PURE__*/ showTooltip.compute([showHoverTooltip], state => {
|
|
18777
18746
|
let tooltips = state.facet(showHoverTooltip);
|
|
18778
18747
|
if (tooltips.length === 0)
|
|
18779
18748
|
return null;
|
|
@@ -18997,9 +18966,8 @@ function getTooltip(view, tooltip) {
|
|
|
18997
18966
|
let found = plugin.manager.tooltips.indexOf(tooltip);
|
|
18998
18967
|
return found < 0 ? null : plugin.manager.tooltipViews[found];
|
|
18999
18968
|
}
|
|
19000
|
-
const closeHoverTooltipEffect = /*@__PURE__*/StateEffect.define();
|
|
19001
|
-
|
|
19002
|
-
const panelConfig = /*@__PURE__*/Facet.define({
|
|
18969
|
+
const closeHoverTooltipEffect = /*@__PURE__*/ StateEffect.define();
|
|
18970
|
+
const panelConfig = /*@__PURE__*/ Facet.define({
|
|
19003
18971
|
combine(configs) {
|
|
19004
18972
|
let topContainer, bottomContainer;
|
|
19005
18973
|
for (let c of configs) {
|
|
@@ -19019,7 +18987,7 @@ function getPanel(view, panel) {
|
|
|
19019
18987
|
let index = plugin ? plugin.specs.indexOf(panel) : -1;
|
|
19020
18988
|
return index > -1 ? plugin.panels[index] : null;
|
|
19021
18989
|
}
|
|
19022
|
-
const panelPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
18990
|
+
const panelPlugin = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
19023
18991
|
constructor(view) {
|
|
19024
18992
|
this.input = view.state.facet(showPanel);
|
|
19025
18993
|
this.specs = this.input.filter(s => s);
|
|
@@ -19164,10 +19132,9 @@ Opening a panel is done by providing a constructor function for
|
|
|
19164
19132
|
the panel through this facet. (The panel is closed again when its
|
|
19165
19133
|
constructor is no longer provided.) Values of `null` are ignored.
|
|
19166
19134
|
*/
|
|
19167
|
-
const showPanel = /*@__PURE__*/Facet.define({
|
|
19135
|
+
const showPanel = /*@__PURE__*/ Facet.define({
|
|
19168
19136
|
enables: panelPlugin
|
|
19169
19137
|
});
|
|
19170
|
-
|
|
19171
19138
|
/**
|
|
19172
19139
|
A gutter marker represents a bit of information attached to a line
|
|
19173
19140
|
in a specific gutter. Your own custom markers have to extend this
|
|
@@ -19202,12 +19169,12 @@ Markers given to this facet should _only_ define an
|
|
|
19202
19169
|
[`toDOM`](https://codemirror.net/6/docs/ref/#view.GutterMarker.toDOM) (or the marker will appear
|
|
19203
19170
|
in all gutters for the line).
|
|
19204
19171
|
*/
|
|
19205
|
-
const gutterLineClass = /*@__PURE__*/Facet.define();
|
|
19172
|
+
const gutterLineClass = /*@__PURE__*/ Facet.define();
|
|
19206
19173
|
/**
|
|
19207
19174
|
Facet used to add a class to all gutter elements next to a widget.
|
|
19208
19175
|
Should not provide widgets with a `toDOM` method.
|
|
19209
19176
|
*/
|
|
19210
|
-
const gutterWidgetClass = /*@__PURE__*/Facet.define();
|
|
19177
|
+
const gutterWidgetClass = /*@__PURE__*/ Facet.define();
|
|
19211
19178
|
const defaults$1 = {
|
|
19212
19179
|
class: "",
|
|
19213
19180
|
renderEmptyElements: false,
|
|
@@ -19220,7 +19187,7 @@ const defaults$1 = {
|
|
|
19220
19187
|
updateSpacer: null,
|
|
19221
19188
|
domEventHandlers: {}
|
|
19222
19189
|
};
|
|
19223
|
-
const activeGutters = /*@__PURE__*/Facet.define();
|
|
19190
|
+
const activeGutters = /*@__PURE__*/ Facet.define();
|
|
19224
19191
|
/**
|
|
19225
19192
|
Define an editor gutter. The order in which the gutters appear is
|
|
19226
19193
|
determined by their extension priority.
|
|
@@ -19228,7 +19195,7 @@ determined by their extension priority.
|
|
|
19228
19195
|
function gutter(config) {
|
|
19229
19196
|
return [gutters(), activeGutters.of(Object.assign(Object.assign({}, defaults$1), config))];
|
|
19230
19197
|
}
|
|
19231
|
-
const unfixGutters = /*@__PURE__*/Facet.define({
|
|
19198
|
+
const unfixGutters = /*@__PURE__*/ Facet.define({
|
|
19232
19199
|
combine: values => values.some(x => x)
|
|
19233
19200
|
});
|
|
19234
19201
|
/**
|
|
@@ -19247,7 +19214,7 @@ function gutters(config) {
|
|
|
19247
19214
|
];
|
|
19248
19215
|
return result;
|
|
19249
19216
|
}
|
|
19250
|
-
const gutterView = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
19217
|
+
const gutterView = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
19251
19218
|
constructor(view) {
|
|
19252
19219
|
this.view = view;
|
|
19253
19220
|
this.prevViewport = view.viewport;
|
|
@@ -19558,12 +19525,12 @@ function sameMarkers(a, b) {
|
|
|
19558
19525
|
/**
|
|
19559
19526
|
Facet used to provide markers to the line number gutter.
|
|
19560
19527
|
*/
|
|
19561
|
-
const lineNumberMarkers = /*@__PURE__*/Facet.define();
|
|
19528
|
+
const lineNumberMarkers = /*@__PURE__*/ Facet.define();
|
|
19562
19529
|
/**
|
|
19563
19530
|
Facet used to create markers in the line number gutter next to widgets.
|
|
19564
19531
|
*/
|
|
19565
|
-
const lineNumberWidgetMarker = /*@__PURE__*/Facet.define();
|
|
19566
|
-
const lineNumberConfig = /*@__PURE__*/Facet.define({
|
|
19532
|
+
const lineNumberWidgetMarker = /*@__PURE__*/ Facet.define();
|
|
19533
|
+
const lineNumberConfig = /*@__PURE__*/ Facet.define({
|
|
19567
19534
|
combine(values) {
|
|
19568
19535
|
return combineConfig(values, { formatNumber: String, domEventHandlers: {} }, {
|
|
19569
19536
|
domEventHandlers(a, b) {
|
|
@@ -19588,7 +19555,7 @@ class NumberMarker extends GutterMarker {
|
|
|
19588
19555
|
function formatNumber(view, number) {
|
|
19589
19556
|
return view.state.facet(lineNumberConfig).formatNumber(number, view.state);
|
|
19590
19557
|
}
|
|
19591
|
-
const lineNumberGutter = /*@__PURE__*/activeGutters.compute([lineNumberConfig], state => ({
|
|
19558
|
+
const lineNumberGutter = /*@__PURE__*/ activeGutters.compute([lineNumberConfig], state => ({
|
|
19592
19559
|
class: "cm-lineNumbers",
|
|
19593
19560
|
renderEmptyElements: false,
|
|
19594
19561
|
markers(view) { return view.state.facet(lineNumberMarkers); },
|
|
@@ -19631,13 +19598,13 @@ function maxLineNumber(lines) {
|
|
|
19631
19598
|
last = last * 10 + 9;
|
|
19632
19599
|
return last;
|
|
19633
19600
|
}
|
|
19634
|
-
const activeLineGutterMarker = /*@__PURE__*/new class extends GutterMarker {
|
|
19601
|
+
const activeLineGutterMarker = /*@__PURE__*/ new class extends GutterMarker {
|
|
19635
19602
|
constructor() {
|
|
19636
19603
|
super(...arguments);
|
|
19637
19604
|
this.elementClass = "cm-activeLineGutter";
|
|
19638
19605
|
}
|
|
19639
19606
|
};
|
|
19640
|
-
const activeLineGutterHighlighter = /*@__PURE__*/gutterLineClass.compute(["selection"], state => {
|
|
19607
|
+
const activeLineGutterHighlighter = /*@__PURE__*/ gutterLineClass.compute(["selection"], state => {
|
|
19641
19608
|
let marks = [], last = -1;
|
|
19642
19609
|
for (let range of state.selection.ranges) {
|
|
19643
19610
|
let linePos = state.doc.lineAt(range.head).from;
|
|
@@ -19656,13 +19623,12 @@ line](https://codemirror.net/6/docs/ref/#view.highlightActiveLine).
|
|
|
19656
19623
|
function highlightActiveLineGutter() {
|
|
19657
19624
|
return activeLineGutterHighlighter;
|
|
19658
19625
|
}
|
|
19659
|
-
|
|
19660
19626
|
var _a;
|
|
19661
19627
|
/**
|
|
19662
19628
|
Node prop stored in a parser's top syntax node to provide the
|
|
19663
19629
|
facet that stores language-specific data for that language.
|
|
19664
19630
|
*/
|
|
19665
|
-
const languageDataProp = /*@__PURE__*/new NodeProp();
|
|
19631
|
+
const languageDataProp = /*@__PURE__*/ new NodeProp();
|
|
19666
19632
|
/**
|
|
19667
19633
|
Helper function to define a facet (to be added to the top syntax
|
|
19668
19634
|
node(s) for a language via
|
|
@@ -19680,7 +19646,7 @@ function defineLanguageFacet(baseData) {
|
|
|
19680
19646
|
Syntax node prop used to register sublanguages. Should be added to
|
|
19681
19647
|
the top level node type for the language.
|
|
19682
19648
|
*/
|
|
19683
|
-
const sublanguageProp = /*@__PURE__*/new NodeProp();
|
|
19649
|
+
const sublanguageProp = /*@__PURE__*/ new NodeProp();
|
|
19684
19650
|
/**
|
|
19685
19651
|
A language object manages parsing and per-language
|
|
19686
19652
|
[metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is
|
|
@@ -19793,7 +19759,7 @@ class Language {
|
|
|
19793
19759
|
/**
|
|
19794
19760
|
@internal
|
|
19795
19761
|
*/
|
|
19796
|
-
Language.setState = /*@__PURE__*/StateEffect.define();
|
|
19762
|
+
Language.setState = /*@__PURE__*/ StateEffect.define();
|
|
19797
19763
|
function topNodeAt(state, pos, side) {
|
|
19798
19764
|
let topLang = state.facet(language), tree = syntaxTree(state).topNode;
|
|
19799
19765
|
if (!topLang || topLang.allowsNesting) {
|
|
@@ -20147,7 +20113,7 @@ class LanguageState {
|
|
|
20147
20113
|
return new LanguageState(parseState);
|
|
20148
20114
|
}
|
|
20149
20115
|
}
|
|
20150
|
-
Language.state = /*@__PURE__*/StateField.define({
|
|
20116
|
+
Language.state = /*@__PURE__*/ StateField.define({
|
|
20151
20117
|
create: LanguageState.init,
|
|
20152
20118
|
update(value, tr) {
|
|
20153
20119
|
for (let e of tr.effects)
|
|
@@ -20171,7 +20137,7 @@ if (typeof requestIdleCallback != "undefined")
|
|
|
20171
20137
|
};
|
|
20172
20138
|
const isInputPending = typeof navigator != "undefined" && ((_a = navigator.scheduling) === null || _a === void 0 ? void 0 : _a.isInputPending)
|
|
20173
20139
|
? () => navigator.scheduling.isInputPending() : null;
|
|
20174
|
-
const parseWorker = /*@__PURE__*/ViewPlugin.fromClass(class ParseWorker {
|
|
20140
|
+
const parseWorker = /*@__PURE__*/ ViewPlugin.fromClass(class ParseWorker {
|
|
20175
20141
|
constructor(view) {
|
|
20176
20142
|
this.view = view;
|
|
20177
20143
|
this.working = null;
|
|
@@ -20253,7 +20219,7 @@ by `Language` object's `extension` property (so you don't need to
|
|
|
20253
20219
|
manually wrap your languages in this). Can be used to access the
|
|
20254
20220
|
current language on a state.
|
|
20255
20221
|
*/
|
|
20256
|
-
const language = /*@__PURE__*/Facet.define({
|
|
20222
|
+
const language = /*@__PURE__*/ Facet.define({
|
|
20257
20223
|
combine(languages) { return languages.length ? languages[0] : null; },
|
|
20258
20224
|
enables: language => [
|
|
20259
20225
|
Language.state,
|
|
@@ -20292,7 +20258,6 @@ class LanguageSupport {
|
|
|
20292
20258
|
this.extension = [language, support];
|
|
20293
20259
|
}
|
|
20294
20260
|
}
|
|
20295
|
-
|
|
20296
20261
|
/**
|
|
20297
20262
|
Facet that defines a way to provide a function that computes the
|
|
20298
20263
|
appropriate indentation depth, as a column number (see
|
|
@@ -20302,13 +20267,13 @@ determined, and the line should inherit the indentation of the one
|
|
|
20302
20267
|
above it. A return value of `undefined` defers to the next indent
|
|
20303
20268
|
service.
|
|
20304
20269
|
*/
|
|
20305
|
-
const indentService = /*@__PURE__*/Facet.define();
|
|
20270
|
+
const indentService = /*@__PURE__*/ Facet.define();
|
|
20306
20271
|
/**
|
|
20307
20272
|
Facet for overriding the unit by which indentation happens. Should
|
|
20308
20273
|
be a string consisting either entirely of the same whitespace
|
|
20309
20274
|
character. When not set, this defaults to 2 spaces.
|
|
20310
20275
|
*/
|
|
20311
|
-
const indentUnit = /*@__PURE__*/Facet.define({
|
|
20276
|
+
const indentUnit = /*@__PURE__*/ Facet.define({
|
|
20312
20277
|
combine: values => {
|
|
20313
20278
|
if (!values.length)
|
|
20314
20279
|
return " ";
|
|
@@ -20468,7 +20433,7 @@ context to a column number (see also
|
|
|
20468
20433
|
[`indentString`](https://codemirror.net/6/docs/ref/#language.indentString)) or null, where null
|
|
20469
20434
|
indicates that no definitive indentation can be determined.
|
|
20470
20435
|
*/
|
|
20471
|
-
const indentNodeProp = /*@__PURE__*/new NodeProp();
|
|
20436
|
+
const indentNodeProp = /*@__PURE__*/ new NodeProp();
|
|
20472
20437
|
// Compute the indentation for a given position from the syntax tree.
|
|
20473
20438
|
function syntaxIndentation(cx, ast, pos) {
|
|
20474
20439
|
let stack = ast.resolveStack(pos);
|
|
@@ -20610,7 +20575,7 @@ function bracketedAligned(context) {
|
|
|
20610
20575
|
function delimitedStrategy(context, align, units, closing, closedAt) {
|
|
20611
20576
|
let after = context.textAfter, space = after.match(/^\s*/)[0].length;
|
|
20612
20577
|
let closed = closing && after.slice(space, space + closing.length) == closing || closedAt == context.pos + space;
|
|
20613
|
-
let aligned = bracketedAligned(context)
|
|
20578
|
+
let aligned = bracketedAligned(context);
|
|
20614
20579
|
if (aligned)
|
|
20615
20580
|
return closed ? context.column(aligned.from) : context.column(aligned.to);
|
|
20616
20581
|
return context.baseIndent + (closed ? 0 : context.unit * units);
|
|
@@ -20673,21 +20638,20 @@ function indentOnInput() {
|
|
|
20673
20638
|
return changes.length ? [tr, { changes, sequential: true }] : tr;
|
|
20674
20639
|
});
|
|
20675
20640
|
}
|
|
20676
|
-
|
|
20677
20641
|
/**
|
|
20678
20642
|
A facet that registers a code folding service. When called with
|
|
20679
20643
|
the extent of a line, such a function should return a foldable
|
|
20680
20644
|
range that starts on that line (but continues beyond it), if one
|
|
20681
20645
|
can be found.
|
|
20682
20646
|
*/
|
|
20683
|
-
const foldService = /*@__PURE__*/Facet.define();
|
|
20647
|
+
const foldService = /*@__PURE__*/ Facet.define();
|
|
20684
20648
|
/**
|
|
20685
20649
|
This node prop is used to associate folding information with
|
|
20686
20650
|
syntax node types. Given a syntax node, it should check whether
|
|
20687
20651
|
that tree is foldable and return the range that can be collapsed
|
|
20688
20652
|
when it is.
|
|
20689
20653
|
*/
|
|
20690
|
-
const foldNodeProp = /*@__PURE__*/new NodeProp();
|
|
20654
|
+
const foldNodeProp = /*@__PURE__*/ new NodeProp();
|
|
20691
20655
|
/**
|
|
20692
20656
|
[Fold](https://codemirror.net/6/docs/ref/#language.foldNodeProp) function that folds everything but
|
|
20693
20657
|
the first and the last child of a syntax node. Useful for nodes
|
|
@@ -20749,11 +20713,11 @@ circumstances—usually you'll just want to let
|
|
|
20749
20713
|
[`foldCode`](https://codemirror.net/6/docs/ref/#language.foldCode) and the [fold
|
|
20750
20714
|
gutter](https://codemirror.net/6/docs/ref/#language.foldGutter) create the transactions.)
|
|
20751
20715
|
*/
|
|
20752
|
-
const foldEffect = /*@__PURE__*/StateEffect.define({ map: mapRange });
|
|
20716
|
+
const foldEffect = /*@__PURE__*/ StateEffect.define({ map: mapRange });
|
|
20753
20717
|
/**
|
|
20754
20718
|
State effect that unfolds the given range (if it was folded).
|
|
20755
20719
|
*/
|
|
20756
|
-
const unfoldEffect = /*@__PURE__*/StateEffect.define({ map: mapRange });
|
|
20720
|
+
const unfoldEffect = /*@__PURE__*/ StateEffect.define({ map: mapRange });
|
|
20757
20721
|
function selectedLines(view) {
|
|
20758
20722
|
let lines = [];
|
|
20759
20723
|
for (let { head } of view.state.selection.ranges) {
|
|
@@ -20770,7 +20734,7 @@ set](https://codemirror.net/6/docs/ref/#view.DecorationSet)). Can be passed to
|
|
|
20770
20734
|
[`fromJSON`](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) to serialize the fold
|
|
20771
20735
|
state.
|
|
20772
20736
|
*/
|
|
20773
|
-
const foldState = /*@__PURE__*/StateField.define({
|
|
20737
|
+
const foldState = /*@__PURE__*/ StateField.define({
|
|
20774
20738
|
create() {
|
|
20775
20739
|
return Decoration.none;
|
|
20776
20740
|
},
|
|
@@ -20791,8 +20755,10 @@ const foldState = /*@__PURE__*/StateField.define({
|
|
|
20791
20755
|
// Clear folded ranges that cover the selection head
|
|
20792
20756
|
if (tr.selection) {
|
|
20793
20757
|
let onSelection = false, { head } = tr.selection.main;
|
|
20794
|
-
folded.between(head, head, (a, b) => {
|
|
20795
|
-
|
|
20758
|
+
folded.between(head, head, (a, b) => {
|
|
20759
|
+
if (a < head && b > head)
|
|
20760
|
+
onSelection = true;
|
|
20761
|
+
});
|
|
20796
20762
|
if (onSelection)
|
|
20797
20763
|
folded = folded.update({
|
|
20798
20764
|
filterFrom: head,
|
|
@@ -20832,8 +20798,10 @@ function findFold(state, from, to) {
|
|
|
20832
20798
|
}
|
|
20833
20799
|
function foldExists(folded, from, to) {
|
|
20834
20800
|
let found = false;
|
|
20835
|
-
folded.between(from, from, (a, b) => {
|
|
20836
|
-
|
|
20801
|
+
folded.between(from, from, (a, b) => {
|
|
20802
|
+
if (a == from && b == to)
|
|
20803
|
+
found = true;
|
|
20804
|
+
});
|
|
20837
20805
|
return found;
|
|
20838
20806
|
}
|
|
20839
20807
|
function maybeEnable(state, other) {
|
|
@@ -20924,7 +20892,7 @@ const defaultConfig = {
|
|
|
20924
20892
|
preparePlaceholder: null,
|
|
20925
20893
|
placeholderText: "…"
|
|
20926
20894
|
};
|
|
20927
|
-
const foldConfig = /*@__PURE__*/Facet.define({
|
|
20895
|
+
const foldConfig = /*@__PURE__*/ Facet.define({
|
|
20928
20896
|
combine(values) { return combineConfig(values, defaultConfig); }
|
|
20929
20897
|
});
|
|
20930
20898
|
/**
|
|
@@ -20953,7 +20921,7 @@ function widgetToDOM(view, prepared) {
|
|
|
20953
20921
|
element.onclick = onclick;
|
|
20954
20922
|
return element;
|
|
20955
20923
|
}
|
|
20956
|
-
const foldWidget = /*@__PURE__*/Decoration.replace({ widget: /*@__PURE__*/new class extends WidgetType {
|
|
20924
|
+
const foldWidget = /*@__PURE__*/ Decoration.replace({ widget: /*@__PURE__*/ new class extends WidgetType {
|
|
20957
20925
|
toDOM(view) { return widgetToDOM(view, null); }
|
|
20958
20926
|
} });
|
|
20959
20927
|
class PreparedFoldWidget extends WidgetType {
|
|
@@ -21047,7 +21015,7 @@ function foldGutter(config = {}) {
|
|
|
21047
21015
|
codeFolding()
|
|
21048
21016
|
];
|
|
21049
21017
|
}
|
|
21050
|
-
const baseTheme$1$2 = /*@__PURE__*/EditorView.baseTheme({
|
|
21018
|
+
const baseTheme$1$2 = /*@__PURE__*/ EditorView.baseTheme({
|
|
21051
21019
|
".cm-foldPlaceholder": {
|
|
21052
21020
|
backgroundColor: "#eee",
|
|
21053
21021
|
border: "1px solid #ddd",
|
|
@@ -21062,7 +21030,6 @@ const baseTheme$1$2 = /*@__PURE__*/EditorView.baseTheme({
|
|
|
21062
21030
|
cursor: "pointer"
|
|
21063
21031
|
}
|
|
21064
21032
|
});
|
|
21065
|
-
|
|
21066
21033
|
/**
|
|
21067
21034
|
A highlight style associates CSS styles with higlighting
|
|
21068
21035
|
[tags](https://lezer.codemirror.net/docs/ref#highlight.Tag).
|
|
@@ -21112,8 +21079,8 @@ class HighlightStyle {
|
|
|
21112
21079
|
return new HighlightStyle(specs, options || {});
|
|
21113
21080
|
}
|
|
21114
21081
|
}
|
|
21115
|
-
const highlighterFacet = /*@__PURE__*/Facet.define();
|
|
21116
|
-
const fallbackHighlighter = /*@__PURE__*/Facet.define({
|
|
21082
|
+
const highlighterFacet = /*@__PURE__*/ Facet.define();
|
|
21083
|
+
const fallbackHighlighter = /*@__PURE__*/ Facet.define({
|
|
21117
21084
|
combine(values) { return values.length ? [values[0]] : null; }
|
|
21118
21085
|
});
|
|
21119
21086
|
function getHighlighters(state) {
|
|
@@ -21177,13 +21144,13 @@ class TreeHighlighter {
|
|
|
21177
21144
|
return builder.finish();
|
|
21178
21145
|
}
|
|
21179
21146
|
}
|
|
21180
|
-
const treeHighlighter = /*@__PURE__*/Prec.high(/*@__PURE__*/ViewPlugin.fromClass(TreeHighlighter, {
|
|
21147
|
+
const treeHighlighter = /*@__PURE__*/ Prec.high(/*@__PURE__*/ ViewPlugin.fromClass(TreeHighlighter, {
|
|
21181
21148
|
decorations: v => v.decorations
|
|
21182
21149
|
}));
|
|
21183
21150
|
/**
|
|
21184
21151
|
A default highlight style (works well with light themes).
|
|
21185
21152
|
*/
|
|
21186
|
-
const defaultHighlightStyle = /*@__PURE__*/HighlightStyle.define([
|
|
21153
|
+
const defaultHighlightStyle = /*@__PURE__*/ HighlightStyle.define([
|
|
21187
21154
|
{ tag: tags.meta,
|
|
21188
21155
|
color: "#404740" },
|
|
21189
21156
|
{ tag: tags.link,
|
|
@@ -21205,32 +21172,31 @@ const defaultHighlightStyle = /*@__PURE__*/HighlightStyle.define([
|
|
|
21205
21172
|
color: "#164" },
|
|
21206
21173
|
{ tag: [tags.string, tags.deleted],
|
|
21207
21174
|
color: "#a11" },
|
|
21208
|
-
{ tag: [tags.regexp, tags.escape, /*@__PURE__*/tags.special(tags.string)],
|
|
21175
|
+
{ tag: [tags.regexp, tags.escape, /*@__PURE__*/ tags.special(tags.string)],
|
|
21209
21176
|
color: "#e40" },
|
|
21210
|
-
{ tag: /*@__PURE__*/tags.definition(tags.variableName),
|
|
21177
|
+
{ tag: /*@__PURE__*/ tags.definition(tags.variableName),
|
|
21211
21178
|
color: "#00f" },
|
|
21212
|
-
{ tag: /*@__PURE__*/tags.local(tags.variableName),
|
|
21179
|
+
{ tag: /*@__PURE__*/ tags.local(tags.variableName),
|
|
21213
21180
|
color: "#30a" },
|
|
21214
21181
|
{ tag: [tags.typeName, tags.namespace],
|
|
21215
21182
|
color: "#085" },
|
|
21216
21183
|
{ tag: tags.className,
|
|
21217
21184
|
color: "#167" },
|
|
21218
|
-
{ tag: [/*@__PURE__*/tags.special(tags.variableName), tags.macroName],
|
|
21185
|
+
{ tag: [/*@__PURE__*/ tags.special(tags.variableName), tags.macroName],
|
|
21219
21186
|
color: "#256" },
|
|
21220
|
-
{ tag: /*@__PURE__*/tags.definition(tags.propertyName),
|
|
21187
|
+
{ tag: /*@__PURE__*/ tags.definition(tags.propertyName),
|
|
21221
21188
|
color: "#00c" },
|
|
21222
21189
|
{ tag: tags.comment,
|
|
21223
21190
|
color: "#940" },
|
|
21224
21191
|
{ tag: tags.invalid,
|
|
21225
21192
|
color: "#f00" }
|
|
21226
21193
|
]);
|
|
21227
|
-
|
|
21228
|
-
const baseTheme$3 = /*@__PURE__*/EditorView.baseTheme({
|
|
21194
|
+
const baseTheme$3 = /*@__PURE__*/ EditorView.baseTheme({
|
|
21229
21195
|
"&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" },
|
|
21230
21196
|
"&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" }
|
|
21231
21197
|
});
|
|
21232
21198
|
const DefaultScanDist = 10000, DefaultBrackets = "()[]{}";
|
|
21233
|
-
const bracketMatchingConfig = /*@__PURE__*/Facet.define({
|
|
21199
|
+
const bracketMatchingConfig = /*@__PURE__*/ Facet.define({
|
|
21234
21200
|
combine(configs) {
|
|
21235
21201
|
return combineConfig(configs, {
|
|
21236
21202
|
afterCursor: true,
|
|
@@ -21240,7 +21206,7 @@ const bracketMatchingConfig = /*@__PURE__*/Facet.define({
|
|
|
21240
21206
|
});
|
|
21241
21207
|
}
|
|
21242
21208
|
});
|
|
21243
|
-
const matchingMark = /*@__PURE__*/Decoration.mark({ class: "cm-matchingBracket" }), nonmatchingMark = /*@__PURE__*/Decoration.mark({ class: "cm-nonmatchingBracket" });
|
|
21209
|
+
const matchingMark = /*@__PURE__*/ Decoration.mark({ class: "cm-matchingBracket" }), nonmatchingMark = /*@__PURE__*/ Decoration.mark({ class: "cm-nonmatchingBracket" });
|
|
21244
21210
|
function defaultRenderMatch(match) {
|
|
21245
21211
|
let decorations = [];
|
|
21246
21212
|
let mark = match.matched ? matchingMark : nonmatchingMark;
|
|
@@ -21249,7 +21215,7 @@ function defaultRenderMatch(match) {
|
|
|
21249
21215
|
decorations.push(mark.range(match.end.from, match.end.to));
|
|
21250
21216
|
return decorations;
|
|
21251
21217
|
}
|
|
21252
|
-
const bracketMatchingState = /*@__PURE__*/StateField.define({
|
|
21218
|
+
const bracketMatchingState = /*@__PURE__*/ StateField.define({
|
|
21253
21219
|
create() { return Decoration.none; },
|
|
21254
21220
|
update(deco, tr) {
|
|
21255
21221
|
if (!tr.docChanged && !tr.selection)
|
|
@@ -21292,7 +21258,7 @@ a node, a ‘handle’—the part of the node that is highlighted, and
|
|
|
21292
21258
|
that the cursor must be on to activate highlighting in the first
|
|
21293
21259
|
place.
|
|
21294
21260
|
*/
|
|
21295
|
-
const bracketMatchingHandle = /*@__PURE__*/new NodeProp();
|
|
21261
|
+
const bracketMatchingHandle = /*@__PURE__*/ new NodeProp();
|
|
21296
21262
|
function matchingNodes(node, dir, brackets) {
|
|
21297
21263
|
let byProp = node.prop(dir < 0 ? NodeProp.openedBy : NodeProp.closedBy);
|
|
21298
21264
|
if (byProp)
|
|
@@ -21386,12 +21352,12 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
21386
21352
|
}
|
|
21387
21353
|
return iter.done ? { start: startToken, matched: false } : null;
|
|
21388
21354
|
}
|
|
21389
|
-
const noTokens = /*@__PURE__*/Object.create(null);
|
|
21355
|
+
const noTokens = /*@__PURE__*/ Object.create(null);
|
|
21390
21356
|
const typeArray = [NodeType.none];
|
|
21391
21357
|
const warned = [];
|
|
21392
21358
|
// Cache of node types by name and tags
|
|
21393
|
-
const byTag = /*@__PURE__*/Object.create(null);
|
|
21394
|
-
const defaultTable = /*@__PURE__*/Object.create(null);
|
|
21359
|
+
const byTag = /*@__PURE__*/ Object.create(null);
|
|
21360
|
+
const defaultTable = /*@__PURE__*/ Object.create(null);
|
|
21395
21361
|
for (let [legacyName, name] of [
|
|
21396
21362
|
["variable", "variableName"],
|
|
21397
21363
|
["variable-2", "variableName.special"],
|
|
@@ -21406,7 +21372,7 @@ for (let [legacyName, name] of [
|
|
|
21406
21372
|
["header", "heading"],
|
|
21407
21373
|
["property", "propertyName"]
|
|
21408
21374
|
])
|
|
21409
|
-
defaultTable[legacyName] = /*@__PURE__*/createTokenType(noTokens, name);
|
|
21375
|
+
defaultTable[legacyName] = /*@__PURE__*/ createTokenType(noTokens, name);
|
|
21410
21376
|
function warnForPart(part, msg) {
|
|
21411
21377
|
if (warned.indexOf(part) > -1)
|
|
21412
21378
|
return;
|
|
@@ -21453,21 +21419,21 @@ function createTokenType(extra, tagStr) {
|
|
|
21453
21419
|
return type.id;
|
|
21454
21420
|
}
|
|
21455
21421
|
({
|
|
21456
|
-
rtl: /*@__PURE__*/Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "rtl" }, bidiIsolate: Direction.RTL }),
|
|
21457
|
-
ltr: /*@__PURE__*/Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "ltr" }, bidiIsolate: Direction.LTR })
|
|
21458
|
-
|
|
21422
|
+
rtl: /*@__PURE__*/ Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "rtl" }, bidiIsolate: Direction.RTL }),
|
|
21423
|
+
ltr: /*@__PURE__*/ Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "ltr" }, bidiIsolate: Direction.LTR })
|
|
21424
|
+
});
|
|
21459
21425
|
/**
|
|
21460
21426
|
A language provider that provides JSON parsing.
|
|
21461
21427
|
*/
|
|
21462
|
-
const jsonLanguage = /*@__PURE__*/LRLanguage.define({
|
|
21428
|
+
const jsonLanguage = /*@__PURE__*/ LRLanguage.define({
|
|
21463
21429
|
name: "json",
|
|
21464
|
-
parser: /*@__PURE__*/parser.configure({
|
|
21430
|
+
parser: /*@__PURE__*/ parser.configure({
|
|
21465
21431
|
props: [
|
|
21466
|
-
/*@__PURE__*/indentNodeProp.add({
|
|
21467
|
-
Object: /*@__PURE__*/continuedIndent({ except: /^\s*\}/ }),
|
|
21468
|
-
Array: /*@__PURE__*/continuedIndent({ except: /^\s*\]/ })
|
|
21432
|
+
/*@__PURE__*/ indentNodeProp.add({
|
|
21433
|
+
Object: /*@__PURE__*/ continuedIndent({ except: /^\s*\}/ }),
|
|
21434
|
+
Array: /*@__PURE__*/ continuedIndent({ except: /^\s*\]/ })
|
|
21469
21435
|
}),
|
|
21470
|
-
/*@__PURE__*/foldNodeProp.add({
|
|
21436
|
+
/*@__PURE__*/ foldNodeProp.add({
|
|
21471
21437
|
"Object Array": foldInside
|
|
21472
21438
|
})
|
|
21473
21439
|
]
|
|
@@ -21483,105 +21449,95 @@ JSON language support.
|
|
|
21483
21449
|
function json() {
|
|
21484
21450
|
return new LanguageSupport(jsonLanguage);
|
|
21485
21451
|
}
|
|
21486
|
-
|
|
21487
21452
|
const _state = {};
|
|
21488
21453
|
const dirtyProps = [];
|
|
21489
21454
|
const listeners = [];
|
|
21490
21455
|
const inWindow = typeof window != 'undefined';
|
|
21491
21456
|
const set = inWindow
|
|
21492
|
-
|
|
21493
|
-
|
|
21457
|
+
? window.requestAnimationFrame
|
|
21458
|
+
: setTimeout;
|
|
21494
21459
|
const cancel = inWindow
|
|
21495
|
-
|
|
21496
|
-
|
|
21460
|
+
? window.cancelAnimationFrame
|
|
21461
|
+
: clearTimeout;
|
|
21497
21462
|
let timeout;
|
|
21498
21463
|
const handler = {
|
|
21499
|
-
|
|
21500
|
-
|
|
21501
|
-
|
|
21502
|
-
|
|
21503
|
-
|
|
21504
|
-
|
|
21505
|
-
|
|
21506
|
-
|
|
21507
|
-
|
|
21508
|
-
|
|
21509
|
-
|
|
21510
|
-
|
|
21464
|
+
set: function (obj, prop, value) {
|
|
21465
|
+
if (prop === 'initialize' ||
|
|
21466
|
+
prop === 'subscribe' ||
|
|
21467
|
+
prop === 'unsubscribe') {
|
|
21468
|
+
return false;
|
|
21469
|
+
}
|
|
21470
|
+
let oldValue = obj[prop];
|
|
21471
|
+
if (oldValue !== value) {
|
|
21472
|
+
obj[prop] = value;
|
|
21473
|
+
dirtyProps.push(prop);
|
|
21474
|
+
timeout && cancel(timeout);
|
|
21475
|
+
timeout = set(notify);
|
|
21476
|
+
}
|
|
21477
|
+
return true;
|
|
21511
21478
|
}
|
|
21512
|
-
|
|
21513
|
-
return true
|
|
21514
|
-
}
|
|
21515
21479
|
};
|
|
21516
|
-
|
|
21517
21480
|
_state.initialize = initialize;
|
|
21518
21481
|
_state.subscribe = subscribe;
|
|
21519
21482
|
_state.unsubscribe = unsubscribe;
|
|
21520
21483
|
const store = new Proxy(_state, handler);
|
|
21521
|
-
|
|
21522
21484
|
function Store(initialState) {
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21526
|
-
|
|
21485
|
+
if (initialState) {
|
|
21486
|
+
initialize(initialState);
|
|
21487
|
+
}
|
|
21488
|
+
return store;
|
|
21527
21489
|
}
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
|
-
|
|
21531
|
-
|
|
21532
|
-
}
|
|
21490
|
+
function merge(o, n) {
|
|
21491
|
+
for (let prop in n) {
|
|
21492
|
+
o[prop] = n[prop];
|
|
21493
|
+
}
|
|
21533
21494
|
}
|
|
21534
|
-
|
|
21535
21495
|
/**
|
|
21536
21496
|
* Function for initializing store with existing data
|
|
21537
21497
|
* @param {object} initialState - object to be merged with internal state
|
|
21538
21498
|
*/
|
|
21539
21499
|
function initialize(initialState) {
|
|
21540
|
-
|
|
21541
|
-
|
|
21542
|
-
|
|
21500
|
+
if (initialState) {
|
|
21501
|
+
merge(_state, initialState);
|
|
21502
|
+
}
|
|
21543
21503
|
}
|
|
21544
|
-
|
|
21545
21504
|
/**
|
|
21546
21505
|
* Function for subscribing to state updates.
|
|
21547
21506
|
* @param {function} fn - function to be called when state changes
|
|
21548
21507
|
* @param {array} props - list props to listen to for changes
|
|
21549
21508
|
* @return {number} returns current number of listeners
|
|
21550
21509
|
*/
|
|
21551
|
-
function subscribe(fn, props=[]) {
|
|
21552
|
-
|
|
21510
|
+
function subscribe(fn, props = []) {
|
|
21511
|
+
return listeners.push({ fn, props });
|
|
21553
21512
|
}
|
|
21554
|
-
|
|
21555
21513
|
/**
|
|
21556
21514
|
* Function for unsubscribing from state updates.
|
|
21557
21515
|
* @param {function} fn - function to unsubscribe from state updates
|
|
21558
21516
|
*
|
|
21559
21517
|
*/
|
|
21560
21518
|
function unsubscribe(fn) {
|
|
21561
|
-
|
|
21519
|
+
return listeners.splice(listeners.findIndex(l => l.fn === fn), 1);
|
|
21562
21520
|
}
|
|
21563
|
-
|
|
21564
21521
|
function notify() {
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21522
|
+
listeners.forEach(l => {
|
|
21523
|
+
const fn = l.fn;
|
|
21524
|
+
const props = l.props;
|
|
21525
|
+
const payload = props.length
|
|
21526
|
+
? dirtyProps
|
|
21527
|
+
.filter(key => props.includes(key))
|
|
21528
|
+
.reduce((obj, key) => {
|
|
21529
|
+
return {
|
|
21530
|
+
...obj,
|
|
21531
|
+
[key]: _state[key]
|
|
21532
|
+
};
|
|
21533
|
+
}, {})
|
|
21534
|
+
: { ..._state };
|
|
21535
|
+
if (Object.keys(payload).length) {
|
|
21536
|
+
fn(payload);
|
|
21537
|
+
}
|
|
21538
|
+
});
|
|
21539
|
+
dirtyProps.length = 0;
|
|
21583
21540
|
}
|
|
21584
|
-
|
|
21585
21541
|
/**
|
|
21586
21542
|
Comment or uncomment the current selection. Will use line comments
|
|
21587
21543
|
if available, otherwise falling back to block comments.
|
|
@@ -21607,19 +21563,19 @@ The line comment syntax is taken from the
|
|
|
21607
21563
|
[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
|
|
21608
21564
|
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
|
|
21609
21565
|
*/
|
|
21610
|
-
const toggleLineComment = /*@__PURE__*/command(changeLineComment, 0 /* CommentOption.Toggle */);
|
|
21566
|
+
const toggleLineComment = /*@__PURE__*/ command(changeLineComment, 0 /* CommentOption.Toggle */);
|
|
21611
21567
|
/**
|
|
21612
21568
|
Comment or uncomment the current selection using block comments.
|
|
21613
21569
|
The block comment syntax is taken from the
|
|
21614
21570
|
[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
|
|
21615
21571
|
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
|
|
21616
21572
|
*/
|
|
21617
|
-
const toggleBlockComment = /*@__PURE__*/command(changeBlockComment, 0 /* CommentOption.Toggle */);
|
|
21573
|
+
const toggleBlockComment = /*@__PURE__*/ command(changeBlockComment, 0 /* CommentOption.Toggle */);
|
|
21618
21574
|
/**
|
|
21619
21575
|
Comment or uncomment the lines around the current selection using
|
|
21620
21576
|
block comments.
|
|
21621
21577
|
*/
|
|
21622
|
-
const toggleBlockCommentByLine = /*@__PURE__*/command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);
|
|
21578
|
+
const toggleBlockCommentByLine = /*@__PURE__*/ command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);
|
|
21623
21579
|
function getConfig(state, pos) {
|
|
21624
21580
|
let data = state.languageDataAt("commentTokens", pos);
|
|
21625
21581
|
return data.length ? data[0] : {};
|
|
@@ -21748,8 +21704,7 @@ function changeLineComment(option, state, ranges = state.selection.ranges) {
|
|
|
21748
21704
|
}
|
|
21749
21705
|
return null;
|
|
21750
21706
|
}
|
|
21751
|
-
|
|
21752
|
-
const fromHistory = /*@__PURE__*/Annotation.define();
|
|
21707
|
+
const fromHistory = /*@__PURE__*/ Annotation.define();
|
|
21753
21708
|
/**
|
|
21754
21709
|
Transaction annotation that will prevent that transaction from
|
|
21755
21710
|
being combined with other transactions in the undo history. Given
|
|
@@ -21757,7 +21712,7 @@ being combined with other transactions in the undo history. Given
|
|
|
21757
21712
|
`"after"`, subsequent transactions won't be combined with this
|
|
21758
21713
|
one. With `"full"`, the transaction is isolated on both sides.
|
|
21759
21714
|
*/
|
|
21760
|
-
const isolateHistory = /*@__PURE__*/Annotation.define();
|
|
21715
|
+
const isolateHistory = /*@__PURE__*/ Annotation.define();
|
|
21761
21716
|
/**
|
|
21762
21717
|
This facet provides a way to register functions that, given a
|
|
21763
21718
|
transaction, provide a set of effects that the history should
|
|
@@ -21765,8 +21720,8 @@ store when inverting the transaction. This can be used to
|
|
|
21765
21720
|
integrate some kinds of effects in the history, so that they can
|
|
21766
21721
|
be undone (and redone again).
|
|
21767
21722
|
*/
|
|
21768
|
-
const invertedEffects = /*@__PURE__*/Facet.define();
|
|
21769
|
-
const historyConfig = /*@__PURE__*/Facet.define({
|
|
21723
|
+
const invertedEffects = /*@__PURE__*/ Facet.define();
|
|
21724
|
+
const historyConfig = /*@__PURE__*/ Facet.define({
|
|
21770
21725
|
combine(configs) {
|
|
21771
21726
|
return combineConfig(configs, {
|
|
21772
21727
|
minDepth: 100,
|
|
@@ -21779,7 +21734,7 @@ const historyConfig = /*@__PURE__*/Facet.define({
|
|
|
21779
21734
|
});
|
|
21780
21735
|
}
|
|
21781
21736
|
});
|
|
21782
|
-
const historyField_ = /*@__PURE__*/StateField.define({
|
|
21737
|
+
const historyField_ = /*@__PURE__*/ StateField.define({
|
|
21783
21738
|
create() {
|
|
21784
21739
|
return HistoryState.empty;
|
|
21785
21740
|
},
|
|
@@ -21853,20 +21808,20 @@ function cmd(side, selection) {
|
|
|
21853
21808
|
Undo a single group of history events. Returns false if no group
|
|
21854
21809
|
was available.
|
|
21855
21810
|
*/
|
|
21856
|
-
const undo = /*@__PURE__*/cmd(0 /* BranchName.Done */, false);
|
|
21811
|
+
const undo = /*@__PURE__*/ cmd(0 /* BranchName.Done */, false);
|
|
21857
21812
|
/**
|
|
21858
21813
|
Redo a group of history events. Returns false if no group was
|
|
21859
21814
|
available.
|
|
21860
21815
|
*/
|
|
21861
|
-
const redo = /*@__PURE__*/cmd(1 /* BranchName.Undone */, false);
|
|
21816
|
+
const redo = /*@__PURE__*/ cmd(1 /* BranchName.Undone */, false);
|
|
21862
21817
|
/**
|
|
21863
21818
|
Undo a change or selection change.
|
|
21864
21819
|
*/
|
|
21865
|
-
const undoSelection = /*@__PURE__*/cmd(0 /* BranchName.Done */, true);
|
|
21820
|
+
const undoSelection = /*@__PURE__*/ cmd(0 /* BranchName.Done */, true);
|
|
21866
21821
|
/**
|
|
21867
21822
|
Redo a change or selection change.
|
|
21868
21823
|
*/
|
|
21869
|
-
const redoSelection = /*@__PURE__*/cmd(1 /* BranchName.Undone */, true);
|
|
21824
|
+
const redoSelection = /*@__PURE__*/ cmd(1 /* BranchName.Undone */, true);
|
|
21870
21825
|
// History events store groups of changes or effects that need to be
|
|
21871
21826
|
// undone/redone together.
|
|
21872
21827
|
class HistEvent {
|
|
@@ -22075,7 +22030,7 @@ class HistoryState {
|
|
|
22075
22030
|
}
|
|
22076
22031
|
}
|
|
22077
22032
|
}
|
|
22078
|
-
HistoryState.empty = /*@__PURE__*/new HistoryState(none$1, none$1);
|
|
22033
|
+
HistoryState.empty = /*@__PURE__*/ new HistoryState(none$1, none$1);
|
|
22079
22034
|
/**
|
|
22080
22035
|
Default key bindings for the undo history.
|
|
22081
22036
|
|
|
@@ -22091,7 +22046,6 @@ const historyKeymap = [
|
|
|
22091
22046
|
{ key: "Mod-u", run: undoSelection, preventDefault: true },
|
|
22092
22047
|
{ key: "Alt-u", mac: "Mod-Shift-u", run: redoSelection, preventDefault: true }
|
|
22093
22048
|
];
|
|
22094
|
-
|
|
22095
22049
|
function updateSel(sel, by) {
|
|
22096
22050
|
return EditorSelection.create(sel.ranges.map(by), sel.mainIndex);
|
|
22097
22051
|
}
|
|
@@ -22750,11 +22704,11 @@ will also delete that whitespace. When the cursor is between
|
|
|
22750
22704
|
matching brackets, an additional newline will be inserted after
|
|
22751
22705
|
the cursor.
|
|
22752
22706
|
*/
|
|
22753
|
-
const insertNewlineAndIndent = /*@__PURE__*/newlineAndIndent(false);
|
|
22707
|
+
const insertNewlineAndIndent = /*@__PURE__*/ newlineAndIndent(false);
|
|
22754
22708
|
/**
|
|
22755
22709
|
Create a blank, indented line below the current line.
|
|
22756
22710
|
*/
|
|
22757
|
-
const insertBlankLine = /*@__PURE__*/newlineAndIndent(true);
|
|
22711
|
+
const insertBlankLine = /*@__PURE__*/ newlineAndIndent(true);
|
|
22758
22712
|
function newlineAndIndent(atEof) {
|
|
22759
22713
|
return ({ state, dispatch }) => {
|
|
22760
22714
|
if (state.readOnly)
|
|
@@ -22940,7 +22894,7 @@ property changed to `mac`.)
|
|
|
22940
22894
|
- Cmd-Backspace (macOS): [`deleteLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryBackward).
|
|
22941
22895
|
- Cmd-Delete (macOS): [`deleteLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryForward).
|
|
22942
22896
|
*/
|
|
22943
|
-
const standardKeymap = /*@__PURE__*/[
|
|
22897
|
+
const standardKeymap = /*@__PURE__*/ [
|
|
22944
22898
|
{ key: "ArrowLeft", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true },
|
|
22945
22899
|
{ key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: cursorGroupLeft, shift: selectGroupLeft, preventDefault: true },
|
|
22946
22900
|
{ mac: "Cmd-ArrowLeft", run: cursorLineBoundaryLeft, shift: selectLineBoundaryLeft, preventDefault: true },
|
|
@@ -22967,7 +22921,7 @@ const standardKeymap = /*@__PURE__*/[
|
|
|
22967
22921
|
{ key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward },
|
|
22968
22922
|
{ mac: "Mod-Backspace", run: deleteLineBoundaryBackward },
|
|
22969
22923
|
{ mac: "Mod-Delete", run: deleteLineBoundaryForward }
|
|
22970
|
-
].concat(/*@__PURE__*/emacsStyleKeymap.map(b => ({ mac: b.key, run: b.run, shift: b.shift })));
|
|
22924
|
+
].concat(/*@__PURE__*/ emacsStyleKeymap.map(b => ({ mac: b.key, run: b.run, shift: b.shift })));
|
|
22971
22925
|
/**
|
|
22972
22926
|
The default keymap. Includes all bindings from
|
|
22973
22927
|
[`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:
|
|
@@ -22991,7 +22945,7 @@ The default keymap. Includes all bindings from
|
|
|
22991
22945
|
- Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
|
|
22992
22946
|
- Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
|
|
22993
22947
|
*/
|
|
22994
|
-
const defaultKeymap = /*@__PURE__*/[
|
|
22948
|
+
const defaultKeymap = /*@__PURE__*/ [
|
|
22995
22949
|
{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: cursorSyntaxLeft, shift: selectSyntaxLeft },
|
|
22996
22950
|
{ key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: cursorSyntaxRight, shift: selectSyntaxRight },
|
|
22997
22951
|
{ key: "Alt-ArrowUp", run: moveLineUp },
|
|
@@ -23011,35 +22965,43 @@ const defaultKeymap = /*@__PURE__*/[
|
|
|
23011
22965
|
{ key: "Alt-A", run: toggleBlockComment },
|
|
23012
22966
|
{ key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },
|
|
23013
22967
|
].concat(standardKeymap);
|
|
23014
|
-
|
|
23015
22968
|
function crelt() {
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
22969
|
+
var elt = arguments[0];
|
|
22970
|
+
if (typeof elt == "string")
|
|
22971
|
+
elt = document.createElement(elt);
|
|
22972
|
+
var i = 1, next = arguments[1];
|
|
22973
|
+
if (next && typeof next == "object" && next.nodeType == null && !Array.isArray(next)) {
|
|
22974
|
+
for (var name in next)
|
|
22975
|
+
if (Object.prototype.hasOwnProperty.call(next, name)) {
|
|
22976
|
+
var value = next[name];
|
|
22977
|
+
if (typeof value == "string")
|
|
22978
|
+
elt.setAttribute(name, value);
|
|
22979
|
+
else if (value != null)
|
|
22980
|
+
elt[name] = value;
|
|
22981
|
+
}
|
|
22982
|
+
i++;
|
|
22983
|
+
}
|
|
22984
|
+
for (; i < arguments.length; i++)
|
|
22985
|
+
add(elt, arguments[i]);
|
|
22986
|
+
return elt;
|
|
23029
22987
|
}
|
|
23030
|
-
|
|
23031
22988
|
function add(elt, child) {
|
|
23032
|
-
|
|
23033
|
-
|
|
23034
|
-
|
|
23035
|
-
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
|
|
23039
|
-
|
|
23040
|
-
|
|
22989
|
+
if (typeof child == "string") {
|
|
22990
|
+
elt.appendChild(document.createTextNode(child));
|
|
22991
|
+
}
|
|
22992
|
+
else if (child == null)
|
|
22993
|
+
;
|
|
22994
|
+
else if (child.nodeType != null) {
|
|
22995
|
+
elt.appendChild(child);
|
|
22996
|
+
}
|
|
22997
|
+
else if (Array.isArray(child)) {
|
|
22998
|
+
for (var i = 0; i < child.length; i++)
|
|
22999
|
+
add(elt, child[i]);
|
|
23000
|
+
}
|
|
23001
|
+
else {
|
|
23002
|
+
throw new RangeError("Unsupported child node: " + child);
|
|
23003
|
+
}
|
|
23041
23004
|
}
|
|
23042
|
-
|
|
23043
23005
|
const basicNormalize = typeof String.prototype.normalize == "function"
|
|
23044
23006
|
? x => x.normalize("NFKD") : x => x;
|
|
23045
23007
|
/**
|
|
@@ -23164,8 +23126,7 @@ class SearchCursor {
|
|
|
23164
23126
|
}
|
|
23165
23127
|
if (typeof Symbol != "undefined")
|
|
23166
23128
|
SearchCursor.prototype[Symbol.iterator] = function () { return this; };
|
|
23167
|
-
|
|
23168
|
-
const empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec("") };
|
|
23129
|
+
const empty = { from: -1, to: -1, match: /*@__PURE__*/ /.*/.exec("") };
|
|
23169
23130
|
const baseFlags = "gm" + (/x/.unicode == null ? "" : "u");
|
|
23170
23131
|
/**
|
|
23171
23132
|
This class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)
|
|
@@ -23251,7 +23212,7 @@ class RegExpCursor {
|
|
|
23251
23212
|
}
|
|
23252
23213
|
}
|
|
23253
23214
|
}
|
|
23254
|
-
const flattened = /*@__PURE__*/new WeakMap();
|
|
23215
|
+
const flattened = /*@__PURE__*/ new WeakMap();
|
|
23255
23216
|
// Reusable (partially) flattened document strings
|
|
23256
23217
|
class FlattenedDoc {
|
|
23257
23218
|
constructor(from, text) {
|
|
@@ -23343,7 +23304,6 @@ function toCharEnd(text, pos) {
|
|
|
23343
23304
|
pos++;
|
|
23344
23305
|
return pos;
|
|
23345
23306
|
}
|
|
23346
|
-
|
|
23347
23307
|
function createLineDialog(view) {
|
|
23348
23308
|
let line = String(view.state.doc.lineAt(view.state.selection.main.head).number);
|
|
23349
23309
|
let input = crelt("input", { class: "cm-textfield", name: "line", value: line });
|
|
@@ -23400,8 +23360,8 @@ function createLineDialog(view) {
|
|
|
23400
23360
|
}
|
|
23401
23361
|
return { dom };
|
|
23402
23362
|
}
|
|
23403
|
-
const dialogEffect = /*@__PURE__*/StateEffect.define();
|
|
23404
|
-
const dialogField = /*@__PURE__*/StateField.define({
|
|
23363
|
+
const dialogEffect = /*@__PURE__*/ StateEffect.define();
|
|
23364
|
+
const dialogField = /*@__PURE__*/ StateField.define({
|
|
23405
23365
|
create() { return true; },
|
|
23406
23366
|
update(value, tr) {
|
|
23407
23367
|
for (let e of tr.effects)
|
|
@@ -23433,7 +23393,7 @@ const gotoLine = view => {
|
|
|
23433
23393
|
panel.dom.querySelector("input").select();
|
|
23434
23394
|
return true;
|
|
23435
23395
|
};
|
|
23436
|
-
const baseTheme$1$1 = /*@__PURE__*/EditorView.baseTheme({
|
|
23396
|
+
const baseTheme$1$1 = /*@__PURE__*/ EditorView.baseTheme({
|
|
23437
23397
|
".cm-panel.cm-gotoLine": {
|
|
23438
23398
|
padding: "2px 6px 4px",
|
|
23439
23399
|
position: "relative",
|
|
@@ -23449,14 +23409,13 @@ const baseTheme$1$1 = /*@__PURE__*/EditorView.baseTheme({
|
|
|
23449
23409
|
}
|
|
23450
23410
|
}
|
|
23451
23411
|
});
|
|
23452
|
-
|
|
23453
23412
|
const defaultHighlightOptions = {
|
|
23454
23413
|
highlightWordAroundCursor: false,
|
|
23455
23414
|
minSelectionLength: 1,
|
|
23456
23415
|
maxMatches: 100,
|
|
23457
23416
|
wholeWords: false
|
|
23458
23417
|
};
|
|
23459
|
-
const highlightConfig = /*@__PURE__*/Facet.define({
|
|
23418
|
+
const highlightConfig = /*@__PURE__*/ Facet.define({
|
|
23460
23419
|
combine(options) {
|
|
23461
23420
|
return combineConfig(options, defaultHighlightOptions, {
|
|
23462
23421
|
highlightWordAroundCursor: (a, b) => a || b,
|
|
@@ -23475,8 +23434,8 @@ function highlightSelectionMatches(options) {
|
|
|
23475
23434
|
let ext = [defaultTheme, matchHighlighter];
|
|
23476
23435
|
return ext;
|
|
23477
23436
|
}
|
|
23478
|
-
const matchDeco = /*@__PURE__*/Decoration.mark({ class: "cm-selectionMatch" });
|
|
23479
|
-
const mainMatchDeco = /*@__PURE__*/Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
23437
|
+
const matchDeco = /*@__PURE__*/ Decoration.mark({ class: "cm-selectionMatch" });
|
|
23438
|
+
const mainMatchDeco = /*@__PURE__*/ Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
23480
23439
|
// Whether the characters directly outside the given positions are non-word characters
|
|
23481
23440
|
function insideWordBoundaries(check, state, from, to) {
|
|
23482
23441
|
return (from == 0 || check(state.sliceDoc(from - 1, from)) != CharCategory.Word) &&
|
|
@@ -23487,7 +23446,7 @@ function insideWord(check, state, from, to) {
|
|
|
23487
23446
|
return check(state.sliceDoc(from, from + 1)) == CharCategory.Word
|
|
23488
23447
|
&& check(state.sliceDoc(to - 1, to)) == CharCategory.Word;
|
|
23489
23448
|
}
|
|
23490
|
-
const matchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
23449
|
+
const matchHighlighter = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
23491
23450
|
constructor(view) {
|
|
23492
23451
|
this.decorations = this.getDeco(view);
|
|
23493
23452
|
}
|
|
@@ -23547,7 +23506,7 @@ const matchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
23547
23506
|
}, {
|
|
23548
23507
|
decorations: v => v.decorations
|
|
23549
23508
|
});
|
|
23550
|
-
const defaultTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
23509
|
+
const defaultTheme = /*@__PURE__*/ EditorView.baseTheme({
|
|
23551
23510
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
23552
23511
|
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
23553
23512
|
});
|
|
@@ -23605,8 +23564,7 @@ const selectNextOccurrence = ({ state, dispatch }) => {
|
|
|
23605
23564
|
}));
|
|
23606
23565
|
return true;
|
|
23607
23566
|
};
|
|
23608
|
-
|
|
23609
|
-
const searchConfigFacet = /*@__PURE__*/Facet.define({
|
|
23567
|
+
const searchConfigFacet = /*@__PURE__*/ Facet.define({
|
|
23610
23568
|
combine(configs) {
|
|
23611
23569
|
return combineConfig(configs, {
|
|
23612
23570
|
top: false,
|
|
@@ -23815,9 +23773,9 @@ this only has an effect if the search state has been initialized
|
|
|
23815
23773
|
by running [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) at least
|
|
23816
23774
|
once).
|
|
23817
23775
|
*/
|
|
23818
|
-
const setSearchQuery = /*@__PURE__*/StateEffect.define();
|
|
23819
|
-
const togglePanel$1 = /*@__PURE__*/StateEffect.define();
|
|
23820
|
-
const searchState = /*@__PURE__*/StateField.define({
|
|
23776
|
+
const setSearchQuery = /*@__PURE__*/ StateEffect.define();
|
|
23777
|
+
const togglePanel$1 = /*@__PURE__*/ StateEffect.define();
|
|
23778
|
+
const searchState = /*@__PURE__*/ StateField.define({
|
|
23821
23779
|
create(state) {
|
|
23822
23780
|
return new SearchState(defaultQuery(state).create(), null);
|
|
23823
23781
|
},
|
|
@@ -23838,8 +23796,8 @@ class SearchState {
|
|
|
23838
23796
|
this.panel = panel;
|
|
23839
23797
|
}
|
|
23840
23798
|
}
|
|
23841
|
-
const matchMark = /*@__PURE__*/Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /*@__PURE__*/Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" });
|
|
23842
|
-
const searchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
23799
|
+
const matchMark = /*@__PURE__*/ Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /*@__PURE__*/ Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" });
|
|
23800
|
+
const searchHighlighter = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
23843
23801
|
constructor(view) {
|
|
23844
23802
|
this.view = view;
|
|
23845
23803
|
this.decorations = this.highlight(view.state.field(searchState));
|
|
@@ -23880,7 +23838,7 @@ selection to the first match after the current main selection.
|
|
|
23880
23838
|
Will wrap around to the start of the document when it reaches the
|
|
23881
23839
|
end.
|
|
23882
23840
|
*/
|
|
23883
|
-
const findNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
23841
|
+
const findNext = /*@__PURE__*/ searchCommand((view, { query }) => {
|
|
23884
23842
|
let { to } = view.state.selection.main;
|
|
23885
23843
|
let next = query.nextMatch(view.state, to, to);
|
|
23886
23844
|
if (!next)
|
|
@@ -23900,7 +23858,7 @@ Move the selection to the previous instance of the search query,
|
|
|
23900
23858
|
before the current main selection. Will wrap past the start
|
|
23901
23859
|
of the document to start searching at the end again.
|
|
23902
23860
|
*/
|
|
23903
|
-
const findPrevious = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
23861
|
+
const findPrevious = /*@__PURE__*/ searchCommand((view, { query }) => {
|
|
23904
23862
|
let { state } = view, { from } = state.selection.main;
|
|
23905
23863
|
let prev = query.prevMatch(state, from, from);
|
|
23906
23864
|
if (!prev)
|
|
@@ -23918,7 +23876,7 @@ const findPrevious = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
|
23918
23876
|
/**
|
|
23919
23877
|
Select all instances of the search query.
|
|
23920
23878
|
*/
|
|
23921
|
-
const selectMatches = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
23879
|
+
const selectMatches = /*@__PURE__*/ searchCommand((view, { query }) => {
|
|
23922
23880
|
let ranges = query.matchAll(view.state, 1000);
|
|
23923
23881
|
if (!ranges || !ranges.length)
|
|
23924
23882
|
return false;
|
|
@@ -23953,7 +23911,7 @@ const selectSelectionMatches = ({ state, dispatch }) => {
|
|
|
23953
23911
|
/**
|
|
23954
23912
|
Replace the current match of the search query.
|
|
23955
23913
|
*/
|
|
23956
|
-
const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
23914
|
+
const replaceNext = /*@__PURE__*/ searchCommand((view, { query }) => {
|
|
23957
23915
|
let { state } = view, { from, to } = state.selection.main;
|
|
23958
23916
|
if (state.readOnly)
|
|
23959
23917
|
return false;
|
|
@@ -23985,7 +23943,7 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
|
23985
23943
|
Replace all instances of the search query with the given
|
|
23986
23944
|
replacement.
|
|
23987
23945
|
*/
|
|
23988
|
-
const replaceAll = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
23946
|
+
const replaceAll = /*@__PURE__*/ searchCommand((view, { query }) => {
|
|
23989
23947
|
if (view.state.readOnly)
|
|
23990
23948
|
return false;
|
|
23991
23949
|
let changes = query.matchAll(view.state, 1e9).map(match => {
|
|
@@ -24225,7 +24183,7 @@ function announceMatch(view, { from, to }) {
|
|
|
24225
24183
|
}
|
|
24226
24184
|
return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);
|
|
24227
24185
|
}
|
|
24228
|
-
const baseTheme$2 = /*@__PURE__*/EditorView.baseTheme({
|
|
24186
|
+
const baseTheme$2 = /*@__PURE__*/ EditorView.baseTheme({
|
|
24229
24187
|
".cm-panel.cm-search": {
|
|
24230
24188
|
padding: "2px 6px 4px",
|
|
24231
24189
|
position: "relative",
|
|
@@ -24257,10 +24215,9 @@ const baseTheme$2 = /*@__PURE__*/EditorView.baseTheme({
|
|
|
24257
24215
|
});
|
|
24258
24216
|
const searchExtensions = [
|
|
24259
24217
|
searchState,
|
|
24260
|
-
/*@__PURE__*/Prec.low(searchHighlighter),
|
|
24218
|
+
/*@__PURE__*/ Prec.low(searchHighlighter),
|
|
24261
24219
|
baseTheme$2
|
|
24262
24220
|
];
|
|
24263
|
-
|
|
24264
24221
|
/**
|
|
24265
24222
|
An instance of this is passed to completion source functions.
|
|
24266
24223
|
*/
|
|
@@ -24408,7 +24365,7 @@ function ensureAnchor(expr, start) {
|
|
|
24408
24365
|
This annotation is added to transactions that are produced by
|
|
24409
24366
|
picking a completion.
|
|
24410
24367
|
*/
|
|
24411
|
-
const pickedCompletion = /*@__PURE__*/Annotation.define();
|
|
24368
|
+
const pickedCompletion = /*@__PURE__*/ Annotation.define();
|
|
24412
24369
|
/**
|
|
24413
24370
|
Helper function that returns a transaction spec which inserts a
|
|
24414
24371
|
completion's text in the main selection range, and any other
|
|
@@ -24427,7 +24384,7 @@ function insertCompletionText(state, text, from, to) {
|
|
|
24427
24384
|
};
|
|
24428
24385
|
})), { scrollIntoView: true, userEvent: "input.complete" });
|
|
24429
24386
|
}
|
|
24430
|
-
const SourceCache = /*@__PURE__*/new WeakMap();
|
|
24387
|
+
const SourceCache = /*@__PURE__*/ new WeakMap();
|
|
24431
24388
|
function asSource(source) {
|
|
24432
24389
|
if (!Array.isArray(source))
|
|
24433
24390
|
return source;
|
|
@@ -24436,9 +24393,8 @@ function asSource(source) {
|
|
|
24436
24393
|
SourceCache.set(source, known = completeFromList(source));
|
|
24437
24394
|
return known;
|
|
24438
24395
|
}
|
|
24439
|
-
const startCompletionEffect = /*@__PURE__*/StateEffect.define();
|
|
24440
|
-
const closeCompletionEffect = /*@__PURE__*/StateEffect.define();
|
|
24441
|
-
|
|
24396
|
+
const startCompletionEffect = /*@__PURE__*/ StateEffect.define();
|
|
24397
|
+
const closeCompletionEffect = /*@__PURE__*/ StateEffect.define();
|
|
24442
24398
|
// A pattern matcher for fuzzy completion matching. Create an instance
|
|
24443
24399
|
// once for a pattern, and then use that to match any number of
|
|
24444
24400
|
// completions.
|
|
@@ -24486,7 +24442,8 @@ class FuzzyMatcher {
|
|
|
24486
24442
|
if (chars.length == 1) {
|
|
24487
24443
|
let first = codePointAt(word, 0), firstSize = codePointSize(first);
|
|
24488
24444
|
let score = firstSize == word.length ? 0 : -100 /* Penalty.NotFull */;
|
|
24489
|
-
if (first == chars[0])
|
|
24445
|
+
if (first == chars[0])
|
|
24446
|
+
;
|
|
24490
24447
|
else if (first == folded[0])
|
|
24491
24448
|
score += -200 /* Penalty.CaseFold */;
|
|
24492
24449
|
else
|
|
@@ -24595,8 +24552,7 @@ class StrictMatcher {
|
|
|
24595
24552
|
return this;
|
|
24596
24553
|
}
|
|
24597
24554
|
}
|
|
24598
|
-
|
|
24599
|
-
const completionConfig = /*@__PURE__*/Facet.define({
|
|
24555
|
+
const completionConfig = /*@__PURE__*/ Facet.define({
|
|
24600
24556
|
combine(configs) {
|
|
24601
24557
|
return combineConfig(configs, {
|
|
24602
24558
|
activateOnTyping: true,
|
|
@@ -24663,7 +24619,6 @@ function defaultPositionInfo(view, list, option, info, space, tooltip) {
|
|
|
24663
24619
|
class: "cm-completionInfo-" + (narrow ? (rtl ? "left-narrow" : "right-narrow") : left ? "left" : "right")
|
|
24664
24620
|
};
|
|
24665
24621
|
}
|
|
24666
|
-
|
|
24667
24622
|
function optionContent(config) {
|
|
24668
24623
|
let content = config.addToOptions.slice();
|
|
24669
24624
|
if (config.icons)
|
|
@@ -24968,7 +24923,6 @@ function scrollIntoView(container, element) {
|
|
|
24968
24923
|
else if (self.bottom > parent.bottom)
|
|
24969
24924
|
container.scrollTop += (self.bottom - parent.bottom) / scaleY;
|
|
24970
24925
|
}
|
|
24971
|
-
|
|
24972
24926
|
// Used to pick a preferred option when two options with the same
|
|
24973
24927
|
// label occur in the result.
|
|
24974
24928
|
function score(option) {
|
|
@@ -25237,11 +25191,11 @@ function checkValid(validFor, state, from, to) {
|
|
|
25237
25191
|
let text = state.sliceDoc(from, to);
|
|
25238
25192
|
return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);
|
|
25239
25193
|
}
|
|
25240
|
-
const setActiveEffect = /*@__PURE__*/StateEffect.define({
|
|
25194
|
+
const setActiveEffect = /*@__PURE__*/ StateEffect.define({
|
|
25241
25195
|
map(sources, mapping) { return sources.map(s => s.map(mapping)); }
|
|
25242
25196
|
});
|
|
25243
|
-
const setSelectedEffect = /*@__PURE__*/StateEffect.define();
|
|
25244
|
-
const completionState = /*@__PURE__*/StateField.define({
|
|
25197
|
+
const setSelectedEffect = /*@__PURE__*/ StateEffect.define();
|
|
25198
|
+
const completionState = /*@__PURE__*/ StateField.define({
|
|
25245
25199
|
create() { return CompletionState.start(); },
|
|
25246
25200
|
update(value, tr) { return value.update(tr); },
|
|
25247
25201
|
provide: f => [
|
|
@@ -25260,8 +25214,7 @@ function applyCompletion(view, option) {
|
|
|
25260
25214
|
apply(view, option.completion, result.from, result.to);
|
|
25261
25215
|
return true;
|
|
25262
25216
|
}
|
|
25263
|
-
const createTooltip = /*@__PURE__*/completionTooltip(completionState, applyCompletion);
|
|
25264
|
-
|
|
25217
|
+
const createTooltip = /*@__PURE__*/ completionTooltip(completionState, applyCompletion);
|
|
25265
25218
|
/**
|
|
25266
25219
|
Returns a command that moves the completion selection forward or
|
|
25267
25220
|
backward by the given amount.
|
|
@@ -25328,7 +25281,7 @@ class RunningQuery {
|
|
|
25328
25281
|
}
|
|
25329
25282
|
}
|
|
25330
25283
|
const MaxUpdateCount = 50, MinAbortTime = 1000;
|
|
25331
|
-
const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
25284
|
+
const completionPlugin = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
25332
25285
|
constructor(view) {
|
|
25333
25286
|
this.view = view;
|
|
25334
25287
|
this.debounceUpdate = -1;
|
|
@@ -25486,8 +25439,8 @@ const completionPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
25486
25439
|
}
|
|
25487
25440
|
}
|
|
25488
25441
|
});
|
|
25489
|
-
const windows = typeof navigator == "object" && /*@__PURE__
|
|
25490
|
-
const commitCharacters = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.domEventHandlers({
|
|
25442
|
+
const windows = typeof navigator == "object" && /*@__PURE__*/ /Win/.test(navigator.platform);
|
|
25443
|
+
const commitCharacters = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ EditorView.domEventHandlers({
|
|
25491
25444
|
keydown(event, view) {
|
|
25492
25445
|
let field = view.state.field(completionState, false);
|
|
25493
25446
|
if (!field || !field.open || field.open.disabled || field.open.selected < 0 ||
|
|
@@ -25501,8 +25454,7 @@ const commitCharacters = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.domEv
|
|
|
25501
25454
|
return false;
|
|
25502
25455
|
}
|
|
25503
25456
|
}));
|
|
25504
|
-
|
|
25505
|
-
const baseTheme$1 = /*@__PURE__*/EditorView.baseTheme({
|
|
25457
|
+
const baseTheme$1 = /*@__PURE__*/ EditorView.baseTheme({
|
|
25506
25458
|
".cm-tooltip.cm-tooltip-autocomplete": {
|
|
25507
25459
|
"& > ul": {
|
|
25508
25460
|
fontFamily: "monospace",
|
|
@@ -25625,23 +25577,22 @@ const baseTheme$1 = /*@__PURE__*/EditorView.baseTheme({
|
|
|
25625
25577
|
"&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" }
|
|
25626
25578
|
}
|
|
25627
25579
|
});
|
|
25628
|
-
|
|
25629
25580
|
const defaults = {
|
|
25630
25581
|
brackets: ["(", "[", "{", "'", '"'],
|
|
25631
25582
|
before: ")]}:;>",
|
|
25632
25583
|
stringPrefixes: []
|
|
25633
25584
|
};
|
|
25634
|
-
const closeBracketEffect = /*@__PURE__*/StateEffect.define({
|
|
25585
|
+
const closeBracketEffect = /*@__PURE__*/ StateEffect.define({
|
|
25635
25586
|
map(value, mapping) {
|
|
25636
25587
|
let mapped = mapping.mapPos(value, -1, MapMode.TrackAfter);
|
|
25637
25588
|
return mapped == null ? undefined : mapped;
|
|
25638
25589
|
}
|
|
25639
25590
|
});
|
|
25640
|
-
const closedBracket = /*@__PURE__*/new class extends RangeValue {
|
|
25591
|
+
const closedBracket = /*@__PURE__*/ new class extends RangeValue {
|
|
25641
25592
|
};
|
|
25642
25593
|
closedBracket.startSide = 1;
|
|
25643
25594
|
closedBracket.endSide = -1;
|
|
25644
|
-
const bracketState = /*@__PURE__*/StateField.define({
|
|
25595
|
+
const bracketState = /*@__PURE__*/ StateField.define({
|
|
25645
25596
|
create() { return RangeSet.empty; },
|
|
25646
25597
|
update(value, tr) {
|
|
25647
25598
|
value = value.map(tr.changes);
|
|
@@ -25675,8 +25626,8 @@ function closing(ch) {
|
|
|
25675
25626
|
function config(state, pos) {
|
|
25676
25627
|
return state.languageDataAt("closeBrackets", pos)[0] || defaults;
|
|
25677
25628
|
}
|
|
25678
|
-
const android = typeof navigator == "object" && /*@__PURE__
|
|
25679
|
-
const inputHandler = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, insert) => {
|
|
25629
|
+
const android = typeof navigator == "object" && /*@__PURE__*/ /Android\b/.test(navigator.userAgent);
|
|
25630
|
+
const inputHandler = /*@__PURE__*/ EditorView.inputHandler.of((view, from, to, insert) => {
|
|
25680
25631
|
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly)
|
|
25681
25632
|
return false;
|
|
25682
25633
|
let sel = view.state.selection.main;
|
|
@@ -25870,7 +25821,6 @@ function canStartStringAt(state, pos, prefixes) {
|
|
|
25870
25821
|
}
|
|
25871
25822
|
return -1;
|
|
25872
25823
|
}
|
|
25873
|
-
|
|
25874
25824
|
/**
|
|
25875
25825
|
Returns an extension that enables autocompletion.
|
|
25876
25826
|
*/
|
|
@@ -25899,14 +25849,13 @@ const completionKeymap = [
|
|
|
25899
25849
|
{ key: "Ctrl-Space", run: startCompletion },
|
|
25900
25850
|
{ mac: "Alt-`", run: startCompletion },
|
|
25901
25851
|
{ key: "Escape", run: closeCompletion },
|
|
25902
|
-
{ key: "ArrowDown", run: /*@__PURE__*/moveCompletionSelection(true) },
|
|
25903
|
-
{ key: "ArrowUp", run: /*@__PURE__*/moveCompletionSelection(false) },
|
|
25904
|
-
{ key: "PageDown", run: /*@__PURE__*/moveCompletionSelection(true, "page") },
|
|
25905
|
-
{ key: "PageUp", run: /*@__PURE__*/moveCompletionSelection(false, "page") },
|
|
25852
|
+
{ key: "ArrowDown", run: /*@__PURE__*/ moveCompletionSelection(true) },
|
|
25853
|
+
{ key: "ArrowUp", run: /*@__PURE__*/ moveCompletionSelection(false) },
|
|
25854
|
+
{ key: "PageDown", run: /*@__PURE__*/ moveCompletionSelection(true, "page") },
|
|
25855
|
+
{ key: "PageUp", run: /*@__PURE__*/ moveCompletionSelection(false, "page") },
|
|
25906
25856
|
{ key: "Enter", run: acceptCompletion }
|
|
25907
25857
|
];
|
|
25908
|
-
const completionKeymapExt = /*@__PURE__*/Prec.highest(/*@__PURE__*/keymap.computeN([completionConfig], state => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
|
|
25909
|
-
|
|
25858
|
+
const completionKeymapExt = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ keymap.computeN([completionConfig], state => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
|
|
25910
25859
|
class SelectedDiagnostic {
|
|
25911
25860
|
constructor(from, to, diagnostic) {
|
|
25912
25861
|
this.from = from;
|
|
@@ -26008,10 +25957,10 @@ function maybeEnableLint(state, effects) {
|
|
|
26008
25957
|
The state effect that updates the set of active diagnostics. Can
|
|
26009
25958
|
be useful when writing an extension that needs to track these.
|
|
26010
25959
|
*/
|
|
26011
|
-
const setDiagnosticsEffect = /*@__PURE__*/StateEffect.define();
|
|
26012
|
-
const togglePanel = /*@__PURE__*/StateEffect.define();
|
|
26013
|
-
const movePanelSelection = /*@__PURE__*/StateEffect.define();
|
|
26014
|
-
const lintState = /*@__PURE__*/StateField.define({
|
|
25960
|
+
const setDiagnosticsEffect = /*@__PURE__*/ StateEffect.define();
|
|
25961
|
+
const togglePanel = /*@__PURE__*/ StateEffect.define();
|
|
25962
|
+
const movePanelSelection = /*@__PURE__*/ StateEffect.define();
|
|
25963
|
+
const lintState = /*@__PURE__*/ StateField.define({
|
|
26015
25964
|
create() {
|
|
26016
25965
|
return new LintState(Decoration.none, null, null);
|
|
26017
25966
|
},
|
|
@@ -26043,7 +25992,7 @@ const lintState = /*@__PURE__*/StateField.define({
|
|
|
26043
25992
|
provide: f => [showPanel.from(f, val => val.panel),
|
|
26044
25993
|
EditorView.decorations.from(f, s => s.diagnostics)]
|
|
26045
25994
|
});
|
|
26046
|
-
const activeMark = /*@__PURE__*/Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
25995
|
+
const activeMark = /*@__PURE__*/ Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
26047
25996
|
function lintTooltip(view, pos, side) {
|
|
26048
25997
|
let { diagnostics } = view.state.field(lintState);
|
|
26049
25998
|
let found, start = -1, end = -1;
|
|
@@ -26121,7 +26070,7 @@ const lintKeymap = [
|
|
|
26121
26070
|
{ key: "Mod-Shift-m", run: openLintPanel, preventDefault: true },
|
|
26122
26071
|
{ key: "F8", run: nextDiagnostic }
|
|
26123
26072
|
];
|
|
26124
|
-
const lintConfig = /*@__PURE__*/Facet.define({
|
|
26073
|
+
const lintConfig = /*@__PURE__*/ Facet.define({
|
|
26125
26074
|
combine(input) {
|
|
26126
26075
|
return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, combineConfig(input.map(i => i.config), {
|
|
26127
26076
|
delay: 750,
|
|
@@ -26374,7 +26323,7 @@ function svg(content, attrs = `viewBox="0 0 40 40"`) {
|
|
|
26374
26323
|
function underline(color) {
|
|
26375
26324
|
return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${color}" fill="none" stroke-width=".7"/>`, `width="6" height="3"`);
|
|
26376
26325
|
}
|
|
26377
|
-
const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
26326
|
+
const baseTheme = /*@__PURE__*/ EditorView.baseTheme({
|
|
26378
26327
|
".cm-diagnostic": {
|
|
26379
26328
|
padding: "3px 6px 3px 8px",
|
|
26380
26329
|
marginLeft: "-1px",
|
|
@@ -26404,10 +26353,10 @@ const baseTheme = /*@__PURE__*/EditorView.baseTheme({
|
|
|
26404
26353
|
backgroundRepeat: "repeat-x",
|
|
26405
26354
|
paddingBottom: "0.7px",
|
|
26406
26355
|
},
|
|
26407
|
-
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#d11") },
|
|
26408
|
-
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
|
|
26409
|
-
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
|
|
26410
|
-
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },
|
|
26356
|
+
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ underline("#d11") },
|
|
26357
|
+
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ underline("orange") },
|
|
26358
|
+
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ underline("#999") },
|
|
26359
|
+
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ underline("#66d") },
|
|
26411
26360
|
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
26412
26361
|
".cm-tooltip-lint": {
|
|
26413
26362
|
padding: 0,
|
|
@@ -26481,16 +26430,15 @@ function maxSeverity(diagnostics) {
|
|
|
26481
26430
|
}
|
|
26482
26431
|
const lintExtensions = [
|
|
26483
26432
|
lintState,
|
|
26484
|
-
/*@__PURE__*/EditorView.decorations.compute([lintState], state => {
|
|
26433
|
+
/*@__PURE__*/ EditorView.decorations.compute([lintState], state => {
|
|
26485
26434
|
let { selected, panel } = state.field(lintState);
|
|
26486
26435
|
return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([
|
|
26487
26436
|
activeMark.range(selected.from, selected.to)
|
|
26488
26437
|
]);
|
|
26489
26438
|
}),
|
|
26490
|
-
/*@__PURE__*/hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
|
|
26439
|
+
/*@__PURE__*/ hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
|
|
26491
26440
|
baseTheme
|
|
26492
26441
|
];
|
|
26493
|
-
|
|
26494
26442
|
// (The superfluous function calls around the list of extensions work
|
|
26495
26443
|
// around current limitations in tree-shaking software.)
|
|
26496
26444
|
/**
|
|
@@ -26530,7 +26478,7 @@ you take this package's source (which is just a bunch of imports
|
|
|
26530
26478
|
and an array literal), copy it into your own code, and adjust it
|
|
26531
26479
|
as desired.
|
|
26532
26480
|
*/
|
|
26533
|
-
const basicSetup = /*@__PURE__*/(() => [
|
|
26481
|
+
const basicSetup = /*@__PURE__*/ (() => [
|
|
26534
26482
|
lineNumbers(),
|
|
26535
26483
|
highlightActiveLineGutter(),
|
|
26536
26484
|
highlightSpecialChars(),
|
|
@@ -26558,55 +26506,50 @@ const basicSetup = /*@__PURE__*/(() => [
|
|
|
26558
26506
|
...lintKeymap
|
|
26559
26507
|
])
|
|
26560
26508
|
])();
|
|
26561
|
-
|
|
26562
26509
|
const BYTE_UNITS = [
|
|
26563
|
-
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26510
|
+
'B',
|
|
26511
|
+
'kB',
|
|
26512
|
+
'MB',
|
|
26513
|
+
'GB',
|
|
26514
|
+
'TB',
|
|
26515
|
+
'PB',
|
|
26516
|
+
'EB',
|
|
26517
|
+
'ZB',
|
|
26518
|
+
'YB',
|
|
26572
26519
|
];
|
|
26573
|
-
|
|
26574
26520
|
const BIBYTE_UNITS = [
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26521
|
+
'B',
|
|
26522
|
+
'KiB',
|
|
26523
|
+
'MiB',
|
|
26524
|
+
'GiB',
|
|
26525
|
+
'TiB',
|
|
26526
|
+
'PiB',
|
|
26527
|
+
'EiB',
|
|
26528
|
+
'ZiB',
|
|
26529
|
+
'YiB',
|
|
26584
26530
|
];
|
|
26585
|
-
|
|
26586
26531
|
const BIT_UNITS = [
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26590
|
-
|
|
26591
|
-
|
|
26592
|
-
|
|
26593
|
-
|
|
26594
|
-
|
|
26595
|
-
|
|
26532
|
+
'b',
|
|
26533
|
+
'kbit',
|
|
26534
|
+
'Mbit',
|
|
26535
|
+
'Gbit',
|
|
26536
|
+
'Tbit',
|
|
26537
|
+
'Pbit',
|
|
26538
|
+
'Ebit',
|
|
26539
|
+
'Zbit',
|
|
26540
|
+
'Ybit',
|
|
26596
26541
|
];
|
|
26597
|
-
|
|
26598
26542
|
const BIBIT_UNITS = [
|
|
26599
|
-
|
|
26600
|
-
|
|
26601
|
-
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
|
-
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26543
|
+
'b',
|
|
26544
|
+
'kibit',
|
|
26545
|
+
'Mibit',
|
|
26546
|
+
'Gibit',
|
|
26547
|
+
'Tibit',
|
|
26548
|
+
'Pibit',
|
|
26549
|
+
'Eibit',
|
|
26550
|
+
'Zibit',
|
|
26551
|
+
'Yibit',
|
|
26608
26552
|
];
|
|
26609
|
-
|
|
26610
26553
|
/*
|
|
26611
26554
|
Formats the given number using `Number#toLocaleString`.
|
|
26612
26555
|
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
@@ -26614,266 +26557,207 @@ Formats the given number using `Number#toLocaleString`.
|
|
|
26614
26557
|
- If no value for locale is specified, the number is returned unmodified.
|
|
26615
26558
|
*/
|
|
26616
26559
|
const toLocaleString = (number, locale, options) => {
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26620
|
-
|
|
26621
|
-
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
|
|
26560
|
+
let result = number;
|
|
26561
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
26562
|
+
result = number.toLocaleString(locale, options);
|
|
26563
|
+
}
|
|
26564
|
+
else if (locale === true || options !== undefined) {
|
|
26565
|
+
result = number.toLocaleString(undefined, options);
|
|
26566
|
+
}
|
|
26567
|
+
return result;
|
|
26625
26568
|
};
|
|
26626
|
-
|
|
26627
26569
|
function prettyBytes(number, options) {
|
|
26628
|
-
|
|
26629
|
-
|
|
26630
|
-
|
|
26631
|
-
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
|
-
|
|
26635
|
-
|
|
26636
|
-
|
|
26637
|
-
|
|
26638
|
-
|
|
26639
|
-
|
|
26640
|
-
|
|
26641
|
-
|
|
26642
|
-
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
return prefix + numberString + separator + UNITS[0];
|
|
26669
|
-
}
|
|
26670
|
-
|
|
26671
|
-
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
26672
|
-
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
26673
|
-
|
|
26674
|
-
if (!localeOptions) {
|
|
26675
|
-
number = number.toPrecision(3);
|
|
26676
|
-
}
|
|
26677
|
-
|
|
26678
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
26679
|
-
|
|
26680
|
-
const unit = UNITS[exponent];
|
|
26681
|
-
|
|
26682
|
-
return prefix + numberString + separator + unit;
|
|
26570
|
+
if (!Number.isFinite(number)) {
|
|
26571
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
26572
|
+
}
|
|
26573
|
+
options = {
|
|
26574
|
+
bits: false,
|
|
26575
|
+
binary: false,
|
|
26576
|
+
space: true,
|
|
26577
|
+
...options,
|
|
26578
|
+
};
|
|
26579
|
+
const UNITS = options.bits
|
|
26580
|
+
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
26581
|
+
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
26582
|
+
const separator = options.space ? ' ' : '';
|
|
26583
|
+
if (options.signed && number === 0) {
|
|
26584
|
+
return ` 0${separator}${UNITS[0]}`;
|
|
26585
|
+
}
|
|
26586
|
+
const isNegative = number < 0;
|
|
26587
|
+
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
|
|
26588
|
+
if (isNegative) {
|
|
26589
|
+
number = -number;
|
|
26590
|
+
}
|
|
26591
|
+
let localeOptions;
|
|
26592
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
26593
|
+
localeOptions = { minimumFractionDigits: options.minimumFractionDigits };
|
|
26594
|
+
}
|
|
26595
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
26596
|
+
localeOptions = { maximumFractionDigits: options.maximumFractionDigits, ...localeOptions };
|
|
26597
|
+
}
|
|
26598
|
+
if (number < 1) {
|
|
26599
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
26600
|
+
return prefix + numberString + separator + UNITS[0];
|
|
26601
|
+
}
|
|
26602
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
26603
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
26604
|
+
if (!localeOptions) {
|
|
26605
|
+
number = number.toPrecision(3);
|
|
26606
|
+
}
|
|
26607
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
26608
|
+
const unit = UNITS[exponent];
|
|
26609
|
+
return prefix + numberString + separator + unit;
|
|
26683
26610
|
}
|
|
26684
|
-
|
|
26685
26611
|
const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
|
|
26686
|
-
|
|
26687
26612
|
function parseNumber(milliseconds) {
|
|
26688
|
-
|
|
26689
|
-
|
|
26690
|
-
|
|
26691
|
-
|
|
26692
|
-
|
|
26693
|
-
|
|
26694
|
-
|
|
26695
|
-
|
|
26696
|
-
|
|
26613
|
+
return {
|
|
26614
|
+
days: Math.trunc(milliseconds / 86_400_000),
|
|
26615
|
+
hours: Math.trunc(milliseconds / 3_600_000 % 24),
|
|
26616
|
+
minutes: Math.trunc(milliseconds / 60_000 % 60),
|
|
26617
|
+
seconds: Math.trunc(milliseconds / 1000 % 60),
|
|
26618
|
+
milliseconds: Math.trunc(milliseconds % 1000),
|
|
26619
|
+
microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),
|
|
26620
|
+
nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),
|
|
26621
|
+
};
|
|
26697
26622
|
}
|
|
26698
|
-
|
|
26699
26623
|
function parseBigint(milliseconds) {
|
|
26700
|
-
|
|
26701
|
-
|
|
26702
|
-
|
|
26703
|
-
|
|
26704
|
-
|
|
26705
|
-
|
|
26706
|
-
|
|
26707
|
-
|
|
26708
|
-
|
|
26624
|
+
return {
|
|
26625
|
+
days: milliseconds / 86400000n,
|
|
26626
|
+
hours: milliseconds / 3600000n % 24n,
|
|
26627
|
+
minutes: milliseconds / 60000n % 60n,
|
|
26628
|
+
seconds: milliseconds / 1000n % 60n,
|
|
26629
|
+
milliseconds: milliseconds % 1000n,
|
|
26630
|
+
microseconds: 0n,
|
|
26631
|
+
nanoseconds: 0n,
|
|
26632
|
+
};
|
|
26709
26633
|
}
|
|
26710
|
-
|
|
26711
26634
|
function parseMilliseconds(milliseconds) {
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26715
|
-
|
|
26716
|
-
|
|
26717
|
-
|
|
26718
|
-
|
|
26719
|
-
|
|
26720
|
-
|
|
26721
|
-
|
|
26722
|
-
|
|
26723
|
-
|
|
26724
|
-
|
|
26725
|
-
// No default
|
|
26726
|
-
}
|
|
26727
|
-
|
|
26728
|
-
throw new TypeError('Expected a finite number or bigint');
|
|
26635
|
+
switch (typeof milliseconds) {
|
|
26636
|
+
case 'number': {
|
|
26637
|
+
if (Number.isFinite(milliseconds)) {
|
|
26638
|
+
return parseNumber(milliseconds);
|
|
26639
|
+
}
|
|
26640
|
+
break;
|
|
26641
|
+
}
|
|
26642
|
+
case 'bigint': {
|
|
26643
|
+
return parseBigint(milliseconds);
|
|
26644
|
+
}
|
|
26645
|
+
// No default
|
|
26646
|
+
}
|
|
26647
|
+
throw new TypeError('Expected a finite number or bigint');
|
|
26729
26648
|
}
|
|
26730
|
-
|
|
26731
26649
|
const isZero = value => value === 0 || value === 0n;
|
|
26732
26650
|
const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
|
|
26733
|
-
|
|
26734
26651
|
const SECOND_ROUNDING_EPSILON = 0.000_000_1;
|
|
26735
26652
|
const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
|
|
26736
|
-
|
|
26737
26653
|
function prettyMilliseconds(milliseconds, options) {
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
|
|
26763
|
-
|
|
26764
|
-
|
|
26765
|
-
|
|
26766
|
-
|
|
26767
|
-
|
|
26768
|
-
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
|
|
26772
|
-
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
|
|
26776
|
-
|
|
26777
|
-
|
|
26778
|
-
|
|
26779
|
-
|
|
26780
|
-
|
|
26781
|
-
|
|
26782
|
-
|
|
26783
|
-
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26789
|
-
|
|
26790
|
-
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
|
|
26795
|
-
|
|
26796
|
-
|
|
26797
|
-
|
|
26798
|
-
|
|
26799
|
-
|
|
26800
|
-
|
|
26801
|
-
|
|
26802
|
-
|
|
26803
|
-
|
|
26804
|
-
|
|
26805
|
-
|
|
26806
|
-
|
|
26807
|
-
|
|
26808
|
-
|
|
26809
|
-
|
|
26810
|
-
|
|
26811
|
-
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26815
|
-
|
|
26816
|
-
|
|
26817
|
-
|
|
26818
|
-
|
|
26819
|
-
|
|
26820
|
-
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
|
|
26838
|
-
|
|
26839
|
-
|
|
26840
|
-
|
|
26841
|
-
|
|
26842
|
-
|
|
26843
|
-
|
|
26844
|
-
|
|
26845
|
-
|
|
26846
|
-
'ms',
|
|
26847
|
-
millisecondsString,
|
|
26848
|
-
);
|
|
26849
|
-
}
|
|
26850
|
-
} else {
|
|
26851
|
-
const seconds = (
|
|
26852
|
-
(isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
|
|
26853
|
-
/ 1000
|
|
26854
|
-
) % 60;
|
|
26855
|
-
const secondsDecimalDigits
|
|
26856
|
-
= typeof options.secondsDecimalDigits === 'number'
|
|
26857
|
-
? options.secondsDecimalDigits
|
|
26858
|
-
: 1;
|
|
26859
|
-
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
|
|
26860
|
-
const secondsString = options.keepDecimalsOnWholeSeconds
|
|
26861
|
-
? secondsFixed
|
|
26862
|
-
: secondsFixed.replace(/\.0+$/, '');
|
|
26863
|
-
add(Number.parseFloat(secondsString), 'second', 's', secondsString);
|
|
26864
|
-
}
|
|
26865
|
-
}
|
|
26866
|
-
|
|
26867
|
-
if (result.length === 0) {
|
|
26868
|
-
return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
|
|
26869
|
-
}
|
|
26870
|
-
|
|
26871
|
-
const separator = options.colonNotation ? ':' : ' ';
|
|
26872
|
-
if (typeof options.unitCount === 'number') {
|
|
26873
|
-
result = result.slice(0, Math.max(options.unitCount, 1));
|
|
26874
|
-
}
|
|
26875
|
-
|
|
26876
|
-
return sign + result.join(separator);
|
|
26654
|
+
const isBigInt = typeof milliseconds === 'bigint';
|
|
26655
|
+
if (!isBigInt && !Number.isFinite(milliseconds)) {
|
|
26656
|
+
throw new TypeError('Expected a finite number or bigint');
|
|
26657
|
+
}
|
|
26658
|
+
options = { ...options };
|
|
26659
|
+
const sign = milliseconds < 0 ? '-' : '';
|
|
26660
|
+
milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
|
|
26661
|
+
if (options.colonNotation) {
|
|
26662
|
+
options.compact = false;
|
|
26663
|
+
options.formatSubMilliseconds = false;
|
|
26664
|
+
options.separateMilliseconds = false;
|
|
26665
|
+
options.verbose = false;
|
|
26666
|
+
}
|
|
26667
|
+
if (options.compact) {
|
|
26668
|
+
options.unitCount = 1;
|
|
26669
|
+
options.secondsDecimalDigits = 0;
|
|
26670
|
+
options.millisecondsDecimalDigits = 0;
|
|
26671
|
+
}
|
|
26672
|
+
let result = [];
|
|
26673
|
+
const floorDecimals = (value, decimalDigits) => {
|
|
26674
|
+
const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
|
|
26675
|
+
const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
|
|
26676
|
+
return flooredValue.toFixed(decimalDigits);
|
|
26677
|
+
};
|
|
26678
|
+
const add = (value, long, short, valueString) => {
|
|
26679
|
+
if ((result.length === 0 || !options.colonNotation)
|
|
26680
|
+
&& isZero(value)
|
|
26681
|
+
&& !(options.colonNotation && short === 'm')) {
|
|
26682
|
+
return;
|
|
26683
|
+
}
|
|
26684
|
+
valueString ??= String(value);
|
|
26685
|
+
if (options.colonNotation) {
|
|
26686
|
+
const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
|
|
26687
|
+
const minLength = result.length > 0 ? 2 : 1;
|
|
26688
|
+
valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
|
|
26689
|
+
}
|
|
26690
|
+
else {
|
|
26691
|
+
valueString += options.verbose ? ' ' + pluralize(long, value) : short;
|
|
26692
|
+
}
|
|
26693
|
+
result.push(valueString);
|
|
26694
|
+
};
|
|
26695
|
+
const parsed = parseMilliseconds(milliseconds);
|
|
26696
|
+
const days = BigInt(parsed.days);
|
|
26697
|
+
if (options.hideYearAndDays) {
|
|
26698
|
+
add((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');
|
|
26699
|
+
}
|
|
26700
|
+
else {
|
|
26701
|
+
if (options.hideYear) {
|
|
26702
|
+
add(days, 'day', 'd');
|
|
26703
|
+
}
|
|
26704
|
+
else {
|
|
26705
|
+
add(days / 365n, 'year', 'y');
|
|
26706
|
+
add(days % 365n, 'day', 'd');
|
|
26707
|
+
}
|
|
26708
|
+
add(Number(parsed.hours), 'hour', 'h');
|
|
26709
|
+
}
|
|
26710
|
+
add(Number(parsed.minutes), 'minute', 'm');
|
|
26711
|
+
if (!options.hideSeconds) {
|
|
26712
|
+
if (options.separateMilliseconds
|
|
26713
|
+
|| options.formatSubMilliseconds
|
|
26714
|
+
|| (!options.colonNotation && milliseconds < 1000)) {
|
|
26715
|
+
const seconds = Number(parsed.seconds);
|
|
26716
|
+
const milliseconds = Number(parsed.milliseconds);
|
|
26717
|
+
const microseconds = Number(parsed.microseconds);
|
|
26718
|
+
const nanoseconds = Number(parsed.nanoseconds);
|
|
26719
|
+
add(seconds, 'second', 's');
|
|
26720
|
+
if (options.formatSubMilliseconds) {
|
|
26721
|
+
add(milliseconds, 'millisecond', 'ms');
|
|
26722
|
+
add(microseconds, 'microsecond', 'µs');
|
|
26723
|
+
add(nanoseconds, 'nanosecond', 'ns');
|
|
26724
|
+
}
|
|
26725
|
+
else {
|
|
26726
|
+
const millisecondsAndBelow = milliseconds
|
|
26727
|
+
+ (microseconds / 1000)
|
|
26728
|
+
+ (nanoseconds / 1e6);
|
|
26729
|
+
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === 'number'
|
|
26730
|
+
? options.millisecondsDecimalDigits
|
|
26731
|
+
: 0;
|
|
26732
|
+
const roundedMilliseconds = millisecondsAndBelow >= 1
|
|
26733
|
+
? Math.round(millisecondsAndBelow)
|
|
26734
|
+
: Math.ceil(millisecondsAndBelow);
|
|
26735
|
+
const millisecondsString = millisecondsDecimalDigits
|
|
26736
|
+
? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
|
|
26737
|
+
: roundedMilliseconds;
|
|
26738
|
+
add(Number.parseFloat(millisecondsString), 'millisecond', 'ms', millisecondsString);
|
|
26739
|
+
}
|
|
26740
|
+
}
|
|
26741
|
+
else {
|
|
26742
|
+
const seconds = ((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
|
|
26743
|
+
/ 1000) % 60;
|
|
26744
|
+
const secondsDecimalDigits = typeof options.secondsDecimalDigits === 'number'
|
|
26745
|
+
? options.secondsDecimalDigits
|
|
26746
|
+
: 1;
|
|
26747
|
+
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
|
|
26748
|
+
const secondsString = options.keepDecimalsOnWholeSeconds
|
|
26749
|
+
? secondsFixed
|
|
26750
|
+
: secondsFixed.replace(/\.0+$/, '');
|
|
26751
|
+
add(Number.parseFloat(secondsString), 'second', 's', secondsString);
|
|
26752
|
+
}
|
|
26753
|
+
}
|
|
26754
|
+
if (result.length === 0) {
|
|
26755
|
+
return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
|
|
26756
|
+
}
|
|
26757
|
+
const separator = options.colonNotation ? ':' : ' ';
|
|
26758
|
+
if (typeof options.unitCount === 'number') {
|
|
26759
|
+
result = result.slice(0, Math.max(options.unitCount, 1));
|
|
26760
|
+
}
|
|
26761
|
+
return sign + result.join(separator);
|
|
26877
26762
|
}
|
|
26878
|
-
|
|
26879
26763
|
export { EditorState, EditorView, Store, basicSetup, json, prettyBytes, prettyMilliseconds };
|