datafolder 1.0.8 → 1.0.9
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 +1 -1
- package/package.json +1 -1
- package/scripts/fastify.js +2 -2
- package/static/codemirror.bundle/editor.bundle.js +29 -18
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ datafolder is a lightning fluid JSON database for SSD, featuring an AI-friendly
|
|
|
4
4
|
|
|
5
5
|
### Changelog
|
|
6
6
|
|
|
7
|
-
1.0.
|
|
7
|
+
1.0.9 Added Typescript type declarations.
|
|
8
8
|
|
|
9
9
|
1.0.7 Added trigger editor and [internal.md](https://github.com/datafolderdev/datafolder/wiki/Internals-of-datafolder)
|
|
10
10
|
|
package/package.json
CHANGED
package/scripts/fastify.js
CHANGED
|
@@ -13,8 +13,8 @@ const config = {
|
|
|
13
13
|
};
|
|
14
14
|
const { port, staticRoot } = config;
|
|
15
15
|
const fastify = Fastify({ logger: false, forceCloseConnections: true });
|
|
16
|
-
const qyDB = new QyDB(join(__dirname, "../tmp/simulate2"));
|
|
17
|
-
|
|
16
|
+
// const qyDB = new QyDB(join(__dirname, "../tmp/simulate2"));
|
|
17
|
+
const qyDB = new QyDB();
|
|
18
18
|
let sigintReceived = false;
|
|
19
19
|
process.on("SIGINT", async () => {
|
|
20
20
|
logger.log("SIGINT signal received: closing HTTP server");
|
|
@@ -1406,11 +1406,11 @@
|
|
|
1406
1406
|
/**
|
|
1407
1407
|
Extend this range to cover at least `from` to `to`.
|
|
1408
1408
|
*/
|
|
1409
|
-
extend(from, to = from) {
|
|
1409
|
+
extend(from, to = from, assoc = 0) {
|
|
1410
1410
|
if (from <= this.anchor && to >= this.anchor)
|
|
1411
|
-
return EditorSelection.range(from, to);
|
|
1411
|
+
return EditorSelection.range(from, to, undefined, undefined, assoc);
|
|
1412
1412
|
let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;
|
|
1413
|
-
return EditorSelection.range(this.anchor, head);
|
|
1413
|
+
return EditorSelection.range(this.anchor, head, undefined, undefined, assoc);
|
|
1414
1414
|
}
|
|
1415
1415
|
/**
|
|
1416
1416
|
Compare this range to another range.
|
|
@@ -1557,11 +1557,13 @@
|
|
|
1557
1557
|
/**
|
|
1558
1558
|
Create a selection range.
|
|
1559
1559
|
*/
|
|
1560
|
-
static range(anchor, head, goalColumn, bidiLevel) {
|
|
1560
|
+
static range(anchor, head, goalColumn, bidiLevel, assoc) {
|
|
1561
1561
|
let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */) |
|
|
1562
1562
|
(bidiLevel == null ? 7 : Math.min(6, bidiLevel));
|
|
1563
|
+
if (!assoc && anchor != head)
|
|
1564
|
+
assoc = head < anchor ? 1 : -1;
|
|
1563
1565
|
return head < anchor ? SelectionRange.create(head, anchor, 32 /* RangeFlag.Inverted */ | 16 /* RangeFlag.AssocAfter */ | flags)
|
|
1564
|
-
: SelectionRange.create(anchor, head, (
|
|
1566
|
+
: SelectionRange.create(anchor, head, (!assoc ? 0 : assoc < 0 ? 8 /* RangeFlag.AssocBefore */ : 16 /* RangeFlag.AssocAfter */) | flags);
|
|
1565
1567
|
}
|
|
1566
1568
|
/**
|
|
1567
1569
|
@internal
|
|
@@ -4418,7 +4420,7 @@
|
|
|
4418
4420
|
couldn't (in which case the widget will be redrawn). The default
|
|
4419
4421
|
implementation just returns false.
|
|
4420
4422
|
*/
|
|
4421
|
-
updateDOM(dom, view) { return false; }
|
|
4423
|
+
updateDOM(dom, view, from) { return false; }
|
|
4422
4424
|
/**
|
|
4423
4425
|
@internal
|
|
4424
4426
|
*/
|
|
@@ -6821,7 +6823,7 @@
|
|
|
6821
6823
|
let tile = widgets[i];
|
|
6822
6824
|
if (!this.reused.has(tile) &&
|
|
6823
6825
|
(pass == 0 ? tile.widget.compare(widget)
|
|
6824
|
-
: tile.widget.constructor == widget.constructor && widget.updateDOM(tile.dom, this.view))) {
|
|
6826
|
+
: tile.widget.constructor == widget.constructor && widget.updateDOM(tile.dom, this.view, tile.widget))) {
|
|
6825
6827
|
widgets.splice(i, 1);
|
|
6826
6828
|
if (i < this.index[0])
|
|
6827
6829
|
this.index[0]--;
|
|
@@ -7677,6 +7679,7 @@
|
|
|
7677
7679
|
this.blockWrappers = this.view.state.facet(blockWrappers).map(v => typeof v == "function" ? v(this.view) : v);
|
|
7678
7680
|
}
|
|
7679
7681
|
scrollIntoView(target) {
|
|
7682
|
+
var _a;
|
|
7680
7683
|
if (target.isSnapshot) {
|
|
7681
7684
|
let ref = this.view.viewState.lineBlockAt(target.range.head);
|
|
7682
7685
|
this.view.scrollDOM.scrollTop = ref.top - target.yMargin;
|
|
@@ -7693,7 +7696,7 @@
|
|
|
7693
7696
|
}
|
|
7694
7697
|
}
|
|
7695
7698
|
let { range } = target;
|
|
7696
|
-
let rect = this.coordsAt(range.head, range.
|
|
7699
|
+
let rect = this.coordsAt(range.head, (_a = range.assoc) !== null && _a !== void 0 ? _a : (range.empty ? 0 : range.head > range.anchor ? -1 : 1)), other;
|
|
7697
7700
|
if (!rect)
|
|
7698
7701
|
return;
|
|
7699
7702
|
if (!range.empty && (other = this.coordsAt(range.anchor, range.anchor > range.head ? -1 : 1)))
|
|
@@ -7960,7 +7963,8 @@
|
|
|
7960
7963
|
return EditorSelection.cursor(startPos, start.assoc);
|
|
7961
7964
|
let goal = start.goalColumn, startY;
|
|
7962
7965
|
let rect = view.contentDOM.getBoundingClientRect();
|
|
7963
|
-
let startCoords = view.coordsAtPos(startPos, (start.empty ? start.
|
|
7966
|
+
let startCoords = view.coordsAtPos(startPos, start.assoc || ((start.empty ? forward : start.head == start.from) ? 1 : -1));
|
|
7967
|
+
let docTop = view.documentTop;
|
|
7964
7968
|
if (startCoords) {
|
|
7965
7969
|
if (goal == null)
|
|
7966
7970
|
goal = startCoords.left - rect.left;
|
|
@@ -7973,9 +7977,16 @@
|
|
|
7973
7977
|
startY = (dir < 0 ? line.top : line.bottom) + docTop;
|
|
7974
7978
|
}
|
|
7975
7979
|
let resolvedGoal = rect.left + goal;
|
|
7976
|
-
let dist = distance !== null && distance !== void 0 ? distance :
|
|
7977
|
-
let
|
|
7978
|
-
|
|
7980
|
+
let halfText = view.viewState.heightOracle.textHeight >> 1, dist = distance !== null && distance !== void 0 ? distance : halfText;
|
|
7981
|
+
for (let scan = 0;; scan += halfText) {
|
|
7982
|
+
let y = startY + (dist + scan) * dir;
|
|
7983
|
+
let pos = posAtCoords(view, { x: resolvedGoal, y }, false, dir);
|
|
7984
|
+
if (forward ? y > rect.bottom : y < rect.top)
|
|
7985
|
+
return EditorSelection.cursor(pos.pos, pos.assoc);
|
|
7986
|
+
let posCoords = view.coordsAtPos(pos.pos, pos.assoc), mid = posCoords ? (posCoords.top + posCoords.bottom) / 2 : 0;
|
|
7987
|
+
if (!posCoords || (forward ? mid > startY : mid < startY))
|
|
7988
|
+
return EditorSelection.cursor(pos.pos, pos.assoc, undefined, goal);
|
|
7989
|
+
}
|
|
7979
7990
|
}
|
|
7980
7991
|
function skipAtomicRanges(atoms, pos, bias) {
|
|
7981
7992
|
for (;;) {
|
|
@@ -8834,9 +8845,9 @@
|
|
|
8834
8845
|
// applyDOMChange, notify key handlers of it and reset to
|
|
8835
8846
|
// the state they produce.
|
|
8836
8847
|
let pending;
|
|
8837
|
-
if (browser.ios && !event.synthetic && !event.altKey && !event.metaKey &&
|
|
8848
|
+
if (browser.ios && !event.synthetic && !event.altKey && !event.metaKey && !event.shiftKey &&
|
|
8838
8849
|
((pending = PendingKeys.find(key => key.keyCode == event.keyCode)) && !event.ctrlKey ||
|
|
8839
|
-
EmacsyPendingKeys.indexOf(event.key) > -1 && event.ctrlKey
|
|
8850
|
+
EmacsyPendingKeys.indexOf(event.key) > -1 && event.ctrlKey)) {
|
|
8840
8851
|
this.pendingIOSKey = pending || event;
|
|
8841
8852
|
setTimeout(() => this.flushIOSKey(), 250);
|
|
8842
8853
|
return true;
|
|
@@ -9240,10 +9251,10 @@
|
|
|
9240
9251
|
if (start.pos != cur.pos && !extend) {
|
|
9241
9252
|
let startRange = rangeForClick(view, start.pos, start.assoc, type);
|
|
9242
9253
|
let from = Math.min(startRange.from, range.from), to = Math.max(startRange.to, range.to);
|
|
9243
|
-
range = from < range.from ? EditorSelection.range(from, to) : EditorSelection.range(to, from);
|
|
9254
|
+
range = from < range.from ? EditorSelection.range(from, to, range.assoc) : EditorSelection.range(to, from, range.assoc);
|
|
9244
9255
|
}
|
|
9245
9256
|
if (extend)
|
|
9246
|
-
return startSel.replaceRange(startSel.main.extend(range.from, range.to));
|
|
9257
|
+
return startSel.replaceRange(startSel.main.extend(range.from, range.to, range.assoc));
|
|
9247
9258
|
else if (multiple && type == 1 && startSel.ranges.length > 1 && (removed = removeRangeAround(startSel, cur.pos)))
|
|
9248
9259
|
return removed;
|
|
9249
9260
|
else if (multiple)
|
|
@@ -13727,7 +13738,7 @@
|
|
|
13727
13738
|
let prim = r == state.selection.main;
|
|
13728
13739
|
if (r.empty || conf.drawRangeCursor && !(prim && browser.ios && conf.iosSelectionHandles)) {
|
|
13729
13740
|
let className = prim ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary";
|
|
13730
|
-
let cursor = r.empty ? r : EditorSelection.cursor(r.head, r.
|
|
13741
|
+
let cursor = r.empty ? r : EditorSelection.cursor(r.head, r.assoc);
|
|
13731
13742
|
for (let piece of RectangleMarker.forRange(view, className, cursor))
|
|
13732
13743
|
cursors.push(piece);
|
|
13733
13744
|
}
|
|
@@ -21035,7 +21046,7 @@
|
|
|
21035
21046
|
function extendSel(target, how) {
|
|
21036
21047
|
let selection = updateSel(target.state.selection, range => {
|
|
21037
21048
|
let head = how(range);
|
|
21038
|
-
return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
|
|
21049
|
+
return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined, head.assoc);
|
|
21039
21050
|
});
|
|
21040
21051
|
if (selection.eq(target.state.selection))
|
|
21041
21052
|
return false;
|