datafolder 1.0.30 → 1.0.31

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.
@@ -2,7 +2,7 @@ const Error_no_Such_Dir = new Error("No such dir");
2
2
 
3
3
  module.exports = ({ dirPath, dChangeId, fChangeId }) => {
4
4
  const dir = dataFolder.dirP(dirPath);
5
- if (!dir) return Error_no_Such_Dir;
5
+ if (dir === undefined) return Error_no_Such_Dir;
6
6
  const result = {};
7
7
  if (!(dChangeId || fChangeId)) {
8
8
  result.fullPathHash = dir.fullPathHash;
@@ -4896,14 +4896,19 @@
4896
4896
  for (let cur = dom, stop = false; cur && !stop;) {
4897
4897
  if (isElt(cur)) { // Element
4898
4898
  let bounding, top = cur == doc.body;
4899
- let scaleX = 1, scaleY = 1;
4899
+ let scaleX = 1, scaleY = 1, xScroll = true, yScroll = true;
4900
4900
  if (top) {
4901
4901
  bounding = windowRect(win);
4902
4902
  }
4903
4903
  else {
4904
- if (/^(fixed|sticky)$/.test(getComputedStyle(cur).position))
4904
+ let style = getComputedStyle(cur);
4905
+ if (/^(fixed|sticky)$/.test(style.position))
4905
4906
  stop = true;
4906
- if (cur.scrollHeight <= cur.clientHeight && cur.scrollWidth <= cur.clientWidth) {
4907
+ if (cur.scrollHeight <= cur.clientHeight || !/auto|scroll/.test(style.overflowY))
4908
+ yScroll = false;
4909
+ if (cur.scrollWidth <= cur.clientWidth || !/auto|scroll/.test(style.overflowX))
4910
+ xScroll = false;
4911
+ if (!xScroll && !yScroll) {
4907
4912
  cur = cur.assignedSlot || cur.parentNode;
4908
4913
  continue;
4909
4914
  }
@@ -4914,7 +4919,8 @@
4914
4919
  top: rect.top, bottom: rect.top + cur.clientHeight * scaleY };
4915
4920
  }
4916
4921
  let moveX = 0, moveY = 0;
4917
- if (y == "nearest") {
4922
+ if (!yScroll) ;
4923
+ else if (y == "nearest") {
4918
4924
  if (rect.top < bounding.top + yMargin) {
4919
4925
  moveY = rect.top - (bounding.top + yMargin);
4920
4926
  if (side > 0 && rect.bottom > bounding.bottom + moveY)
@@ -4933,7 +4939,8 @@
4933
4939
  rect.bottom - boundingHeight + yMargin;
4934
4940
  moveY = targetTop - bounding.top;
4935
4941
  }
4936
- if (x == "nearest") {
4942
+ if (!xScroll) ;
4943
+ else if (x == "nearest") {
4937
4944
  if (rect.left < bounding.left + xMargin) {
4938
4945
  moveX = rect.left - (bounding.left + xMargin);
4939
4946
  if (side > 0 && rect.right > bounding.right + moveX)
@@ -4998,9 +5005,9 @@
4998
5005
  break;
4999
5006
  }
5000
5007
  else if (isElt(cur)) {
5001
- if (!y && cur.scrollHeight > cur.clientHeight)
5008
+ if (!y && cur.scrollHeight > cur.clientHeight && /scroll|auto/.test(getComputedStyle(cur).overflowY))
5002
5009
  y = cur;
5003
- if (getX && !x && cur.scrollWidth > cur.clientWidth)
5010
+ if (getX && !x && cur.scrollWidth > cur.clientWidth && /scroll|auto/.test(getComputedStyle(cur).overflowX))
5004
5011
  x = cur;
5005
5012
  cur = cur.assignedSlot || cur.parentNode;
5006
5013
  }
@@ -5685,7 +5692,6 @@
5685
5692
  if (type == 2 /* T.R */ || type == 4 /* T.AL */)
5686
5693
  return RTL;
5687
5694
  }
5688
- return LTR;
5689
5695
  }
5690
5696
 
5691
5697
  const clickAddsSelectionRange = /*@__PURE__*/Facet.define();
@@ -5911,8 +5917,6 @@
5911
5917
  let level = result;
5912
5918
  for (let i = active.length - 1; i >= 0; i--, open--) {
5913
5919
  let direction = active[i].spec.bidiIsolate, update;
5914
- if (direction == null)
5915
- direction = autoDirection(line.text, from, to);
5916
5920
  if (open > 0 && level.length &&
5917
5921
  (update = level[level.length - 1]).to == from && update.direction == direction) {
5918
5922
  update.to = to;
@@ -5926,7 +5930,28 @@
5926
5930
  }
5927
5931
  }
5928
5932
  });
5929
- return result;
5933
+ return resolveIsolates(line.text, result);
5934
+ }
5935
+ function resolveIsolates(text, isolates) {
5936
+ for (let i of isolates) {
5937
+ if (i.direction == null) {
5938
+ for (let pos = i.from, j = 0; pos < i.to; j++) {
5939
+ let nextInner = j < i.inner.length ? i.inner[j] : null;
5940
+ let dir = autoDirection(text, pos, nextInner ? nextInner.from : i.to);
5941
+ if (dir) {
5942
+ i.direction = dir;
5943
+ break;
5944
+ }
5945
+ if (!nextInner)
5946
+ break;
5947
+ pos = nextInner.to;
5948
+ }
5949
+ if (i.direction == null)
5950
+ i.direction = Direction.LTR;
5951
+ }
5952
+ resolveIsolates(text, i.inner);
5953
+ }
5954
+ return isolates;
5930
5955
  }
5931
5956
  const scrollMargins = /*@__PURE__*/Facet.define();
5932
5957
  function getScrollMargins(view) {
@@ -8043,12 +8068,12 @@
8043
8068
  if (coords) {
8044
8069
  let editorRect = view.dom.getBoundingClientRect();
8045
8070
  let direction = view.textDirectionAt(block.from);
8046
- let pos = view.posAtCoords({ x: forward == (direction == Direction.LTR) ? editorRect.right - 1 : editorRect.left + 1,
8071
+ let pos = view.posAndSideAtCoords({ x: forward == (direction == Direction.LTR) ? editorRect.right - 1 : editorRect.left + 1,
8047
8072
  y: (coords.top + coords.bottom) / 2 });
8048
- if (pos != null)
8049
- return EditorSelection.cursor(pos, forward ? -1 : 1);
8073
+ if (pos)
8074
+ return EditorSelection.cursor(pos.pos, pos.assoc);
8050
8075
  }
8051
- return EditorSelection.cursor(forward ? block.to : block.from, forward ? -1 : 1);
8076
+ return EditorSelection.cursor(forward ? block.to : block.from, forward ? 1 : -1);
8052
8077
  }
8053
8078
  function moveByChar(view, start, forward, by) {
8054
8079
  let line = view.state.doc.lineAt(start.head), spans = view.bidiSpans(line);
@@ -10656,7 +10681,7 @@
10656
10681
  updateScaler() {
10657
10682
  let scaler = this.scaler;
10658
10683
  this.scaler = this.heightMap.height <= 7000000 /* VP.MaxDOMHeight */ ? IdScaler :
10659
- new BigScaler(this.heightOracle, this.heightMap, this.viewports);
10684
+ BigScaler.get(this.heightOracle, this.heightMap, this.viewports);
10660
10685
  return scaler.eq(this.scaler) ? 0 : 2 /* UpdateFlag.Height */;
10661
10686
  }
10662
10687
  updateViewportLines() {
@@ -11032,7 +11057,7 @@
11032
11057
  : (this.scrollParent ? this.scrollParent.getBoundingClientRect().top : 0) - this.view.contentDOM.getBoundingClientRect().top;
11033
11058
  }
11034
11059
  scrollAnchorAt(scrollOffset) {
11035
- let block = this.lineBlockAtHeight(scrollOffset + 8);
11060
+ let block = this.lineBlockAtHeight(scrollOffset + 12 - this.paddingTop);
11036
11061
  return block.from >= this.viewport.from || this.viewportLines[0].top - scrollOffset > 200 ? block : this.viewportLines[0];
11037
11062
  }
11038
11063
  elementAtHeight(height) {
@@ -11118,20 +11143,27 @@
11118
11143
  // regions outside the viewports so that the total height is
11119
11144
  // VP.MaxDOMHeight.
11120
11145
  class BigScaler {
11121
- constructor(oracle, heightMap, viewports) {
11146
+ constructor(scale, viewports) {
11147
+ this.scale = scale;
11148
+ this.viewports = viewports;
11149
+ }
11150
+ static get(oracle, heightMap, viewports) {
11122
11151
  let vpHeight = 0, base = 0, domBase = 0;
11123
- this.viewports = viewports.map(({ from, to }) => {
11152
+ let vps = viewports.map(({ from, to }) => {
11124
11153
  let top = heightMap.lineAt(from, QueryType$1.ByPos, oracle, 0, 0).top;
11125
11154
  let bottom = heightMap.lineAt(to, QueryType$1.ByPos, oracle, 0, 0).bottom;
11126
11155
  vpHeight += bottom - top;
11127
11156
  return { from, to, top, bottom, domTop: 0, domBottom: 0 };
11128
11157
  });
11129
- this.scale = (7000000 /* VP.MaxDOMHeight */ - vpHeight) / (heightMap.height - vpHeight);
11130
- for (let obj of this.viewports) {
11131
- obj.domTop = domBase + (obj.top - base) * this.scale;
11158
+ if (heightMap.height - vpHeight < 10)
11159
+ return IdScaler;
11160
+ let scale = (7000000 /* VP.MaxDOMHeight */ - vpHeight) / (heightMap.height - vpHeight);
11161
+ for (let obj of vps) {
11162
+ obj.domTop = domBase + (obj.top - base) * scale;
11132
11163
  domBase = obj.domBottom = obj.domTop + (obj.bottom - obj.top);
11133
11164
  base = obj.bottom;
11134
11165
  }
11166
+ return new BigScaler(scale, vps);
11135
11167
  }
11136
11168
  toDOM(n) {
11137
11169
  for (let i = 0, base = 0, domBase = 0;; i++) {
@@ -11586,7 +11618,7 @@
11586
11618
  }
11587
11619
  onScroll(e) {
11588
11620
  if (this.intersecting)
11589
- this.flush(false);
11621
+ this.flush(this.pendingRecords().length > 0);
11590
11622
  if (this.editContext)
11591
11623
  this.view.requestMeasure(this.editContext.measureReq);
11592
11624
  this.onScrollChanged(e);
@@ -15576,6 +15608,8 @@
15576
15608
  if (config.class)
15577
15609
  panel.className = config.class;
15578
15610
  panel.classList.add("cm-dialog");
15611
+ let focus = typeof config.focus == "string" ? content.querySelector(config.focus)
15612
+ : config.focus ? content.querySelector("input") || content.querySelector("button") : null;
15579
15613
  function done(form) {
15580
15614
  if (panel.contains(panel.ownerDocument.activeElement))
15581
15615
  view.focus();
@@ -15585,18 +15619,14 @@
15585
15619
  dom: panel,
15586
15620
  top: config.top,
15587
15621
  mount: () => {
15588
- if (config.focus) {
15589
- let focus;
15590
- if (typeof config.focus == "string")
15591
- focus = content.querySelector(config.focus);
15592
- else
15593
- focus = content.querySelector("input") || content.querySelector("button");
15594
- if (focus && "select" in focus)
15622
+ if (focus) {
15623
+ if ("select" in focus)
15595
15624
  focus.select();
15596
- else if (focus && "focus" in focus)
15625
+ else if ("focus" in focus)
15597
15626
  focus.focus();
15598
15627
  }
15599
- }
15628
+ },
15629
+ destroy: () => result(null)
15600
15630
  };
15601
15631
  }
15602
15632
 
@@ -17453,13 +17483,16 @@
17453
17483
  cursor.next();
17454
17484
  let localChildren = [], localPositions = [];
17455
17485
  let localInRepeat = id >= minRepeatType ? id : -1;
17456
- let lastGroup = 0, lastEnd = end;
17486
+ let lastGroup = 0, lastEnd = end, groupLookAhead = lookAheadAtStart;
17457
17487
  while (cursor.pos > endPos) {
17458
17488
  if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
17459
17489
  if (cursor.end <= lastEnd - maxBufferLength) {
17460
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
17490
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
17461
17491
  lastGroup = localChildren.length;
17462
17492
  lastEnd = cursor.end;
17493
+ // The buffer is read backwards, so the current look-ahead is
17494
+ // the one recorded after the next group's end.
17495
+ groupLookAhead = lookAhead;
17463
17496
  }
17464
17497
  cursor.next();
17465
17498
  }
@@ -17471,7 +17504,7 @@
17471
17504
  }
17472
17505
  }
17473
17506
  if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
17474
- makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);
17507
+ makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, groupLookAhead, contextAtStart);
17475
17508
  localChildren.reverse();
17476
17509
  localPositions.reverse();
17477
17510
  if (localInRepeat > -1 && lastGroup > 0) {
@@ -17524,7 +17557,7 @@
17524
17557
  if (!lastI && last.type == type && last.length == length)
17525
17558
  return last;
17526
17559
  if (lookAheadProp = last.prop(NodeProp.lookAhead))
17527
- lookAhead = positions[lastI] + last.length + lookAheadProp;
17560
+ lookAhead = positions[lastI] + last.length + lookAheadProp - length;
17528
17561
  }
17529
17562
  return makeTree(type, children, positions, length, lookAhead, contextHash);
17530
17563
  };
@@ -24618,7 +24651,7 @@
24618
24651
  keydown(event, view) {
24619
24652
  let field = view.state.field(completionState, false);
24620
24653
  if (!field || !field.open || field.open.disabled || field.open.selected < 0 ||
24621
- event.key.length > 1 || event.ctrlKey && !(windows && event.altKey) || event.metaKey)
24654
+ !event.key || event.key.length > 1 || event.ctrlKey && !(windows && event.altKey) || event.metaKey)
24622
24655
  return false;
24623
24656
  let option = field.open.options[field.open.selected];
24624
24657
  let result = field.active.find(a => a.source == option.source);