@scalar/api-client 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.js +55 -18
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 81543f42: chore: add support for Node 18
|
|
8
|
+
- Updated dependencies [81543f42]
|
|
9
|
+
- @scalar/use-keyboard-event@0.5.7
|
|
10
|
+
- @scalar/use-codemirror@0.7.19
|
|
11
|
+
- @scalar/use-modal@0.2.3
|
|
12
|
+
- @scalar/themes@0.5.4
|
|
13
|
+
|
|
14
|
+
## 0.9.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 479a7e3e: fix: bumped @codemirror/state dependency
|
|
19
|
+
- Updated dependencies [479a7e3e]
|
|
20
|
+
- @scalar/use-codemirror@0.7.18
|
|
21
|
+
|
|
3
22
|
## 0.9.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -5130,6 +5130,7 @@ class Text {
|
|
|
5130
5130
|
Replace a range of the text with the given content.
|
|
5131
5131
|
*/
|
|
5132
5132
|
replace(from, to, text) {
|
|
5133
|
+
[from, to] = clip(this, from, to);
|
|
5133
5134
|
let parts = [];
|
|
5134
5135
|
this.decompose(
|
|
5135
5136
|
0,
|
|
@@ -5165,6 +5166,7 @@ class Text {
|
|
|
5165
5166
|
Retrieve the text between the given points.
|
|
5166
5167
|
*/
|
|
5167
5168
|
slice(from, to = this.length) {
|
|
5169
|
+
[from, to] = clip(this, from, to);
|
|
5168
5170
|
let parts = [];
|
|
5169
5171
|
this.decompose(from, to, parts, 0);
|
|
5170
5172
|
return TextNode.from(parts, to - from);
|
|
@@ -5295,6 +5297,7 @@ class TextLeaf extends Text {
|
|
|
5295
5297
|
replace(from, to, text) {
|
|
5296
5298
|
if (!(text instanceof TextLeaf))
|
|
5297
5299
|
return super.replace(from, to, text);
|
|
5300
|
+
[from, to] = clip(this, from, to);
|
|
5298
5301
|
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
|
|
5299
5302
|
let newLen = this.length + text.length - (to - from);
|
|
5300
5303
|
if (lines.length <= 32)
|
|
@@ -5302,6 +5305,7 @@ class TextLeaf extends Text {
|
|
|
5302
5305
|
return TextNode.from(TextLeaf.split(lines, []), newLen);
|
|
5303
5306
|
}
|
|
5304
5307
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
5308
|
+
[from, to] = clip(this, from, to);
|
|
5305
5309
|
let result = "";
|
|
5306
5310
|
for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {
|
|
5307
5311
|
let line = this.text[i], end = pos + line.length;
|
|
@@ -5368,6 +5372,7 @@ class TextNode extends Text {
|
|
|
5368
5372
|
}
|
|
5369
5373
|
}
|
|
5370
5374
|
replace(from, to, text) {
|
|
5375
|
+
[from, to] = clip(this, from, to);
|
|
5371
5376
|
if (text.lines < this.lines)
|
|
5372
5377
|
for (let i = 0, pos = 0; i < this.children.length; i++) {
|
|
5373
5378
|
let child = this.children[i], end = pos + child.length;
|
|
@@ -5386,6 +5391,7 @@ class TextNode extends Text {
|
|
|
5386
5391
|
return super.replace(from, to, text);
|
|
5387
5392
|
}
|
|
5388
5393
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
5394
|
+
[from, to] = clip(this, from, to);
|
|
5389
5395
|
let result = "";
|
|
5390
5396
|
for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {
|
|
5391
5397
|
let child = this.children[i], end = pos + child.length;
|
|
@@ -5601,7 +5607,10 @@ class LineCursor {
|
|
|
5601
5607
|
}
|
|
5602
5608
|
next(skip = 0) {
|
|
5603
5609
|
let { done, lineBreak, value } = this.inner.next(skip);
|
|
5604
|
-
if (done) {
|
|
5610
|
+
if (done && this.afterBreak) {
|
|
5611
|
+
this.value = "";
|
|
5612
|
+
this.afterBreak = false;
|
|
5613
|
+
} else if (done) {
|
|
5605
5614
|
this.done = true;
|
|
5606
5615
|
this.value = "";
|
|
5607
5616
|
} else if (lineBreak) {
|
|
@@ -5646,6 +5655,10 @@ class Line {
|
|
|
5646
5655
|
return this.to - this.from;
|
|
5647
5656
|
}
|
|
5648
5657
|
}
|
|
5658
|
+
function clip(text, from, to) {
|
|
5659
|
+
from = Math.max(0, Math.min(text.length, from));
|
|
5660
|
+
return [from, Math.max(from, Math.min(text.length, to))];
|
|
5661
|
+
}
|
|
5649
5662
|
let extend = /* @__PURE__ */ "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);
|
|
5650
5663
|
for (let i = 1; i < extend.length; i++)
|
|
5651
5664
|
extend[i] += extend[i - 1];
|
|
@@ -6319,14 +6332,14 @@ class SelectionRange {
|
|
|
6319
6332
|
extend it.
|
|
6320
6333
|
*/
|
|
6321
6334
|
get anchor() {
|
|
6322
|
-
return this.flags &
|
|
6335
|
+
return this.flags & 32 ? this.to : this.from;
|
|
6323
6336
|
}
|
|
6324
6337
|
/**
|
|
6325
6338
|
The head of the range, which is moved when the range is
|
|
6326
6339
|
[extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).
|
|
6327
6340
|
*/
|
|
6328
6341
|
get head() {
|
|
6329
|
-
return this.flags &
|
|
6342
|
+
return this.flags & 32 ? this.from : this.to;
|
|
6330
6343
|
}
|
|
6331
6344
|
/**
|
|
6332
6345
|
True when `anchor` and `head` are at the same position.
|
|
@@ -6341,15 +6354,15 @@ class SelectionRange {
|
|
|
6341
6354
|
means no association.
|
|
6342
6355
|
*/
|
|
6343
6356
|
get assoc() {
|
|
6344
|
-
return this.flags &
|
|
6357
|
+
return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0;
|
|
6345
6358
|
}
|
|
6346
6359
|
/**
|
|
6347
6360
|
The bidirectional text level associated with this cursor, if
|
|
6348
6361
|
any.
|
|
6349
6362
|
*/
|
|
6350
6363
|
get bidiLevel() {
|
|
6351
|
-
let level = this.flags &
|
|
6352
|
-
return level ==
|
|
6364
|
+
let level = this.flags & 7;
|
|
6365
|
+
return level == 7 ? null : level;
|
|
6353
6366
|
}
|
|
6354
6367
|
/**
|
|
6355
6368
|
The goal column (stored vertical offset) associated with a
|
|
@@ -6358,8 +6371,8 @@ class SelectionRange {
|
|
|
6358
6371
|
lines of different length.
|
|
6359
6372
|
*/
|
|
6360
6373
|
get goalColumn() {
|
|
6361
|
-
let value = this.flags >>
|
|
6362
|
-
return value ==
|
|
6374
|
+
let value = this.flags >> 6;
|
|
6375
|
+
return value == 16777215 ? void 0 : value;
|
|
6363
6376
|
}
|
|
6364
6377
|
/**
|
|
6365
6378
|
Map this range through a change, producing a valid range in the
|
|
@@ -6387,8 +6400,8 @@ class SelectionRange {
|
|
|
6387
6400
|
/**
|
|
6388
6401
|
Compare this range to another range.
|
|
6389
6402
|
*/
|
|
6390
|
-
eq(other) {
|
|
6391
|
-
return this.anchor == other.anchor && this.head == other.head;
|
|
6403
|
+
eq(other, includeAssoc = false) {
|
|
6404
|
+
return this.anchor == other.anchor && this.head == other.head && (!includeAssoc || !this.empty || this.assoc == other.assoc);
|
|
6392
6405
|
}
|
|
6393
6406
|
/**
|
|
6394
6407
|
Return a JSON-serializable object representing the range.
|
|
@@ -6427,13 +6440,16 @@ class EditorSelection {
|
|
|
6427
6440
|
return EditorSelection.create(this.ranges.map((r2) => r2.map(change, assoc)), this.mainIndex);
|
|
6428
6441
|
}
|
|
6429
6442
|
/**
|
|
6430
|
-
Compare this selection to another selection.
|
|
6443
|
+
Compare this selection to another selection. By default, ranges
|
|
6444
|
+
are compared only by position. When `includeAssoc` is true,
|
|
6445
|
+
cursor ranges must also have the same
|
|
6446
|
+
[`assoc`](https://codemirror.net/6/docs/ref/#state.SelectionRange.assoc) value.
|
|
6431
6447
|
*/
|
|
6432
|
-
eq(other) {
|
|
6448
|
+
eq(other, includeAssoc = false) {
|
|
6433
6449
|
if (this.ranges.length != other.ranges.length || this.mainIndex != other.mainIndex)
|
|
6434
6450
|
return false;
|
|
6435
6451
|
for (let i = 0; i < this.ranges.length; i++)
|
|
6436
|
-
if (!this.ranges[i].eq(other.ranges[i]))
|
|
6452
|
+
if (!this.ranges[i].eq(other.ranges[i], includeAssoc))
|
|
6437
6453
|
return false;
|
|
6438
6454
|
return true;
|
|
6439
6455
|
}
|
|
@@ -6508,14 +6524,14 @@ class EditorSelection {
|
|
|
6508
6524
|
safely ignore the optional arguments in most situations.
|
|
6509
6525
|
*/
|
|
6510
6526
|
static cursor(pos, assoc = 0, bidiLevel, goalColumn) {
|
|
6511
|
-
return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ?
|
|
6527
|
+
return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 : 16) | (bidiLevel == null ? 7 : Math.min(6, bidiLevel)) | (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6);
|
|
6512
6528
|
}
|
|
6513
6529
|
/**
|
|
6514
6530
|
Create a selection range.
|
|
6515
6531
|
*/
|
|
6516
6532
|
static range(anchor, head, goalColumn, bidiLevel) {
|
|
6517
|
-
let flags = (goalColumn !== null && goalColumn !== void 0 ? goalColumn :
|
|
6518
|
-
return head < anchor ? SelectionRange.create(head, anchor,
|
|
6533
|
+
let flags = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215) << 6 | (bidiLevel == null ? 7 : Math.min(6, bidiLevel));
|
|
6534
|
+
return head < anchor ? SelectionRange.create(head, anchor, 32 | 16 | flags) : SelectionRange.create(anchor, head, (head > anchor ? 8 : 0) | flags);
|
|
6519
6535
|
}
|
|
6520
6536
|
/**
|
|
6521
6537
|
@internal
|
|
@@ -6553,6 +6569,13 @@ class Facet {
|
|
|
6553
6569
|
this.extensions = typeof enables == "function" ? enables(this) : enables;
|
|
6554
6570
|
}
|
|
6555
6571
|
/**
|
|
6572
|
+
Returns a facet reader for this facet, which can be used to
|
|
6573
|
+
[read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it.
|
|
6574
|
+
*/
|
|
6575
|
+
get reader() {
|
|
6576
|
+
return this;
|
|
6577
|
+
}
|
|
6578
|
+
/**
|
|
6556
6579
|
Define a new facet.
|
|
6557
6580
|
*/
|
|
6558
6581
|
static define(config = {}) {
|
|
@@ -7391,7 +7414,8 @@ class EditorState {
|
|
|
7391
7414
|
} else {
|
|
7392
7415
|
startValues = tr.startState.values.slice();
|
|
7393
7416
|
}
|
|
7394
|
-
|
|
7417
|
+
let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();
|
|
7418
|
+
new EditorState(conf, tr.newDoc, selection, startValues, (state2, slot) => slot.update(state2, tr), tr);
|
|
7395
7419
|
}
|
|
7396
7420
|
/**
|
|
7397
7421
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
@@ -7990,6 +8014,19 @@ class RangeSet {
|
|
|
7990
8014
|
build.add(range.from, range.to, range.value);
|
|
7991
8015
|
return build.finish();
|
|
7992
8016
|
}
|
|
8017
|
+
/**
|
|
8018
|
+
Join an array of range sets into a single set.
|
|
8019
|
+
*/
|
|
8020
|
+
static join(sets) {
|
|
8021
|
+
if (!sets.length)
|
|
8022
|
+
return RangeSet.empty;
|
|
8023
|
+
let result = sets[sets.length - 1];
|
|
8024
|
+
for (let i = sets.length - 2; i >= 0; i--) {
|
|
8025
|
+
for (let layer = sets[i]; layer != RangeSet.empty; layer = layer.nextLayer)
|
|
8026
|
+
result = new RangeSet(layer.chunkPos, layer.chunk, result, Math.max(layer.maxPoint, result.maxPoint));
|
|
8027
|
+
}
|
|
8028
|
+
return result;
|
|
8029
|
+
}
|
|
7993
8030
|
}
|
|
7994
8031
|
RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1);
|
|
7995
8032
|
function lazySort(ranges) {
|
|
@@ -8297,7 +8334,7 @@ class SpanCursor {
|
|
|
8297
8334
|
}
|
|
8298
8335
|
addActive(trackOpen) {
|
|
8299
8336
|
let i = 0, { value, to, rank } = this.cursor;
|
|
8300
|
-
while (i < this.activeRank.length && this.activeRank[i]
|
|
8337
|
+
while (i < this.activeRank.length && (rank - this.activeRank[i] || to - this.activeTo[i]) > 0)
|
|
8301
8338
|
i++;
|
|
8302
8339
|
insert(this.active, i, value);
|
|
8303
8340
|
insert(this.activeTo, i, to);
|
package/package.json
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"rest",
|
|
14
14
|
"testing"
|
|
15
15
|
],
|
|
16
|
-
"version": "0.9.
|
|
16
|
+
"version": "0.9.2",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=18"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "./dist/index.js",
|
|
@@ -43,13 +43,12 @@
|
|
|
43
43
|
"pretty-bytes": "^6.1.1",
|
|
44
44
|
"pretty-ms": "^8.0.0",
|
|
45
45
|
"vue": "^3.3.0",
|
|
46
|
-
"@scalar/themes": "0.5.
|
|
47
|
-
"@scalar/use-codemirror": "0.7.
|
|
48
|
-
"@scalar/use-modal": "0.2.
|
|
49
|
-
"@scalar/use-keyboard-event": "0.5.
|
|
46
|
+
"@scalar/themes": "0.5.4",
|
|
47
|
+
"@scalar/use-codemirror": "0.7.19",
|
|
48
|
+
"@scalar/use-modal": "0.2.3",
|
|
49
|
+
"@scalar/use-keyboard-event": "0.5.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@scalar/use-codemirror": "^0.7.17",
|
|
53
52
|
"@types/content-type": "^1.1.6",
|
|
54
53
|
"@vitejs/plugin-vue": "^4.4.0",
|
|
55
54
|
"@vitest/coverage-v8": "^0.34.4",
|
|
@@ -58,8 +57,8 @@
|
|
|
58
57
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
|
59
58
|
"vitest": "^0.34.4",
|
|
60
59
|
"vue-tsc": "^1.8.19",
|
|
61
|
-
"@scalar/api-client-proxy": "0.5.
|
|
62
|
-
"@scalar/echo-server": "0.5.
|
|
60
|
+
"@scalar/api-client-proxy": "0.5.13",
|
|
61
|
+
"@scalar/echo-server": "0.5.8"
|
|
63
62
|
},
|
|
64
63
|
"peerDependencies": {
|
|
65
64
|
"vue": "^3.3.0"
|