datafolder 1.0.24 → 1.0.26

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # datafolder
2
2
 
3
- datafolder is a lightning fluid JSON database for high speed SSDs, featuring an AI-friendly API for simple and human maintainable code generation, millisecond data response, with full index and trigger features supported, and the unique ability to browse and manage data as a folder tree directly in your browser. It works perfectly for a wide range of scenarios, from game/application backends to embedded systems to IoT to edge computing.
3
+ datafolder is a lightning fluid JSON database for high speed SSDs, featuring an AI-friendly API for simple and human maintainable code generation, millisecond data response, with full index and trigger features supported, and the unique ability to browse and manage data as a folder tree directly in your browser. It works perfectly for a wide range of scenarios, from RAG‑based QA systems, knowledge‑oriented AI agents, game/application backends to embedded systems to IoT to edge computing.
4
4
 
5
5
  ### Changelog
6
6
 
@@ -51,7 +51,7 @@ dataFolder.insert(file, { feedbackScore: feedbackScore + 1, address: { city: "c"
51
51
 
52
52
  🧩 Plain JavaScript: Built with plain JavaScript, offers full TypeScript support and safe atomic writes.
53
53
 
54
- 🔧 Designed for application/game backends, IoT, and edge computing scenarios, easily deployable on servers, in browsers, and even on embedded hardware.
54
+ 🔧 Designed for RAG‑based QA systems, knowledge‑oriented AI agents, application/game backends, IoT, and edge computing scenarios, easily deployable on servers, in browsers, and even on embedded hardware.
55
55
 
56
56
  ### 1. Simple CRUD APIs
57
57
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "datafolder",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "author": {
5
5
  "name": "lysh",
6
6
  "email": "datafolderdev@outlook.com"
7
7
  },
8
- "description": "datafolder is a lightning fluid JSON database for high speed SSDs, featuring an AI-friendly API for simple and human maintainable code generation, millisecond data response, with full index and trigger features supported, and the unique ability to browse and manage data as a folder tree directly in your browser. It works perfectly for a wide range of scenarios, from game/application backends to embedded systems to IoT to edge computing.",
8
+ "description": "datafolder is a lightning fluid JSON database for high speed SSDs, featuring an AI-friendly API for simple and human maintainable code generation, millisecond data response, with full index and trigger features supported, and the unique ability to browse and manage data as a folder tree directly in your browser. It works perfectly for a wide range of scenarios, from RAG‑based QA systems, knowledge‑oriented AI agents, game/application backends to embedded systems to IoT to edge computing.",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -4991,6 +4991,22 @@
4991
4991
  this.focusOffset = focusOffset;
4992
4992
  }
4993
4993
  }
4994
+ function getScrollStack(target) {
4995
+ let stack = [];
4996
+ for (let cur = target; cur; cur = cur.nodeType == 11 ? cur.host : cur.parentNode) {
4997
+ if (cur.nodeType == 1)
4998
+ stack.push({ node: cur, left: cur.scrollLeft, top: cur.scrollTop });
4999
+ }
5000
+ return stack;
5001
+ }
5002
+ function restoreScrollStack(stack, vert = true) {
5003
+ for (let { node, left, top } of stack) {
5004
+ if (vert && node.scrollTop != top)
5005
+ node.scrollTop = top;
5006
+ if (node.scrollLeft != left)
5007
+ node.scrollLeft = left;
5008
+ }
5009
+ }
4994
5010
  let preventScrollSupported = null;
4995
5011
  // Safari 26 breaks preventScroll support
4996
5012
  if (browser.safari && browser.safari_version >= 26)
@@ -5002,12 +5018,7 @@
5002
5018
  return dom.setActive(); // in IE
5003
5019
  if (preventScrollSupported)
5004
5020
  return dom.focus(preventScrollSupported);
5005
- let stack = [];
5006
- for (let cur = dom; cur; cur = cur.parentNode) {
5007
- stack.push(cur, cur.scrollTop, cur.scrollLeft);
5008
- if (cur == cur.ownerDocument)
5009
- break;
5010
- }
5021
+ let stack = getScrollStack(dom);
5011
5022
  dom.focus(preventScrollSupported == null ? {
5012
5023
  get preventScroll() {
5013
5024
  preventScrollSupported = { preventScroll: true };
@@ -5016,13 +5027,7 @@
5016
5027
  } : undefined);
5017
5028
  if (!preventScrollSupported) {
5018
5029
  preventScrollSupported = false;
5019
- for (let i = 0; i < stack.length;) {
5020
- let elt = stack[i++], top = stack[i++], left = stack[i++];
5021
- if (elt.scrollTop != top)
5022
- elt.scrollTop = top;
5023
- if (elt.scrollLeft != left)
5024
- elt.scrollLeft = left;
5025
- }
5030
+ restoreScrollStack(stack);
5026
5031
  }
5027
5032
  }
5028
5033
  let scratchRange;
@@ -7767,11 +7772,14 @@
7767
7772
  // can affect it. So this tries to kludge around the problem by
7768
7773
  // calling scrollIntoView on the scroll target's line.
7769
7774
  if (window.visualViewport && window.innerHeight - window.visualViewport.height > 1 &&
7770
- (rect.top > window.pageYOffset + window.visualViewport.offsetTop + window.visualViewport.height ||
7771
- rect.bottom < window.pageYOffset + window.visualViewport.offsetTop)) {
7775
+ (rect.top > window.visualViewport.offsetTop + window.visualViewport.height ||
7776
+ rect.bottom < window.visualViewport.offsetTop)) {
7772
7777
  let line = this.view.docView.lineAt(range.head, 1);
7773
- if (line)
7778
+ if (line) {
7779
+ let stack = getScrollStack(line.dom);
7774
7780
  line.dom.scrollIntoView({ block: "nearest" });
7781
+ restoreScrollStack(stack, false);
7782
+ }
7775
7783
  }
7776
7784
  }
7777
7785
  lineHasWidget(pos) {
@@ -8193,23 +8201,22 @@
8193
8201
  search: while (lo < hi) {
8194
8202
  let dist = hi - lo, mid = (lo + hi) >> 1;
8195
8203
  adjust: if (seen.has(mid)) {
8196
- let scan = lo + Math.floor(Math.random() * dist);
8197
- for (let i = 0; i < dist; i++) {
8204
+ for (let i = 1; i < dist; i++) {
8205
+ let scan = mid + i;
8206
+ if (scan >= hi)
8207
+ scan -= dist;
8198
8208
  if (!seen.has(scan)) {
8199
8209
  mid = scan;
8200
8210
  break adjust;
8201
8211
  }
8202
- scan++;
8203
- if (scan == hi)
8204
- scan = lo; // Wrap around
8205
8212
  }
8206
8213
  break search; // No index found, we're done
8207
8214
  }
8208
8215
  seen.add(mid);
8209
- let rects = getRects(mid);
8216
+ let rects = getRects(mid), side = 0;
8210
8217
  if (rects)
8211
8218
  for (let i = 0; i < rects.length; i++) {
8212
- let rect = rects[i], side = 0;
8219
+ let rect = rects[i];
8213
8220
  // Ignore empty rectangles when there are other rectangles
8214
8221
  if (rect.width == 0 && rects.length > 1)
8215
8222
  continue;
@@ -8234,12 +8241,12 @@
8234
8241
  if (off)
8235
8242
  side = (off < 0) == (this.baseDir == Direction.LTR) ? -1 : 1;
8236
8243
  }
8237
- // Narrow binary search when it is safe to do so
8238
- if (side == -1 && (!bidi || this.baseDirAt(positions[mid], 1)))
8239
- hi = mid;
8240
- else if (side == 1 && (!bidi || this.baseDirAt(positions[mid + 1], -1)))
8241
- lo = mid + 1;
8242
8244
  }
8245
+ // Narrow binary search when it is safe to do so
8246
+ if (side == -1 && (!bidi || this.baseDirAt(positions[mid], 1)))
8247
+ hi = mid;
8248
+ else if (side == 1 && (!bidi || this.baseDirAt(positions[mid + 1], -1)))
8249
+ lo = mid + 1;
8243
8250
  }
8244
8251
  // If no element with y overlap is found, find the nearest element
8245
8252
  // on the y axis, move this.y into it, and retry the scan.
@@ -12533,10 +12540,12 @@
12533
12540
  (scroll == this.scrollDOM || this.hasFocus ||
12534
12541
  Math.max(this.inputState.lastWheelEvent, this.inputState.lastTouchTime) > Date.now() - 100)) {
12535
12542
  scrollOffset = scrollOffset + diff;
12536
- if (scroll)
12537
- scroll.scrollTop += diff;
12538
- else
12543
+ if (!scroll)
12539
12544
  this.win.scrollBy(0, diff);
12545
+ else if (scrollAnchorPos < 0)
12546
+ scroll.scrollTop = scroll.scrollHeight;
12547
+ else
12548
+ scroll.scrollTop += diff;
12540
12549
  scrollAnchorHeight = -1;
12541
12550
  continue;
12542
12551
  }
@@ -13893,7 +13902,8 @@
13893
13902
  },
13894
13903
  class: "cm-selectionLayer"
13895
13904
  });
13896
- const selectionBg = browser.gecko && browser.gecko_version >= 153 ? "#ffffff01" : "transparent";
13905
+ // https://discuss.codemirror.net/t/firefox-153-ignores-transparent-selection-styling/9838
13906
+ const selectionBg = browser.gecko && browser.gecko_version == 153 ? "#ffffff01" : "transparent";
13897
13907
  const hideNativeSelection = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.theme({
13898
13908
  ".cm-line": {
13899
13909
  "& ::selection, &::selection": { backgroundColor: `${selectionBg} !important` },
@@ -21351,7 +21361,7 @@
21351
21361
  Expand the selection to cover entire lines.
21352
21362
  */
21353
21363
  const selectLine = ({ state, dispatch }) => {
21354
- let ranges = selectedLineBlocks(state).map(({ from, to }) => EditorSelection.range(from, Math.min(to + 1, state.doc.length)));
21364
+ let ranges = selectedLineBlocks(state).map(({ from, to }) => EditorSelection.undirectionalRange(from, Math.min(to + 1, state.doc.length)));
21355
21365
  dispatch(state.update({ selection: EditorSelection.create(ranges), userEvent: "select" }));
21356
21366
  return true;
21357
21367
  };
@@ -21374,7 +21384,7 @@
21374
21384
  if (((node.from < range.from && node.to >= range.to) ||
21375
21385
  (node.to > range.to && node.from <= range.from)) &&
21376
21386
  cur.next)
21377
- return EditorSelection.range(node.to, node.from);
21387
+ return EditorSelection.undirectionalRange(node.from, node.to);
21378
21388
  }
21379
21389
  return range;
21380
21390
  });
@@ -21962,7 +21972,7 @@
21962
21972
  - Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)
21963
21973
  - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
21964
21974
  - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
21965
- - Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
21975
+ - Shift-Alt-a (Shift-Ctrl-a on macOS): [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
21966
21976
  - Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
21967
21977
  */
21968
21978
  const defaultKeymap = /*@__PURE__*/[
@@ -21984,7 +21994,7 @@
21984
21994
  { key: "Shift-Mod-k", run: deleteLine },
21985
21995
  { key: "Shift-Mod-\\", run: cursorMatchingBracket },
21986
21996
  { key: "Mod-/", run: toggleComment },
21987
- { key: "Alt-A", run: toggleBlockComment },
21997
+ { key: "Alt-A", mac: "Ctrl-A", run: toggleBlockComment },
21988
21998
  { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },
21989
21999
  ].concat(standardKeymap);
21990
22000