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