@vscode/web-editors 0.0.2-114 → 0.0.2-116

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/dist/index.d.ts CHANGED
@@ -3005,13 +3005,11 @@ declare class TextOperationBuilder {
3005
3005
  //#endregion
3006
3006
  //#region src/sync/textDiff.d.ts
3007
3007
  /**
3008
- * A minimal operation that turns `oldText` into `newText`, so that unchanged
3009
- * text in between separate changes is kept (and concurrent edits there keep
3010
- * their place). Uses Myers' O(ND) algorithm on the part between the common
3011
- * prefix and suffix; when the texts differ in more than `maxDistance`
3012
- * characters, everything in between is replaced instead.
3008
+ * An operation that turns `oldText` into `newText` by replacing everything
3009
+ * between their common prefix and suffix. Linear time, so it stays fast for
3010
+ * large texts; separate changes become one replacement of the text between them.
3013
3011
  */
3014
- declare function diffText(oldText: string, newText: string, maxDistance?: number): TextOperation;
3012
+ declare function diffText(oldText: string, newText: string): TextOperation;
3015
3013
  //#endregion
3016
3014
  //#region src/sync/contentOperation.d.ts
3017
3015
  /** {@link OtType} for lists of {@link ContentEdit}s, as exchanged by web editors. */
package/dist/index.js CHANGED
@@ -4888,13 +4888,11 @@ const identityOperation = new TextOperationBuilder().build();
4888
4888
  //#endregion
4889
4889
  //#region src/sync/textDiff.ts
4890
4890
  /**
4891
- * A minimal operation that turns `oldText` into `newText`, so that unchanged
4892
- * text in between separate changes is kept (and concurrent edits there keep
4893
- * their place). Uses Myers' O(ND) algorithm on the part between the common
4894
- * prefix and suffix; when the texts differ in more than `maxDistance`
4895
- * characters, everything in between is replaced instead.
4891
+ * An operation that turns `oldText` into `newText` by replacing everything
4892
+ * between their common prefix and suffix. Linear time, so it stays fast for
4893
+ * large texts; separate changes become one replacement of the text between them.
4896
4894
  */
4897
- function diffText(oldText, newText, maxDistance = 256) {
4895
+ function diffText(oldText, newText) {
4898
4896
  const shorter = Math.min(oldText.length, newText.length);
4899
4897
  let start = 0;
4900
4898
  while (start < shorter && oldText.charCodeAt(start) === newText.charCodeAt(start)) start++;
@@ -4904,75 +4902,7 @@ function diffText(oldText, newText, maxDistance = 256) {
4904
4902
  oldEnd--;
4905
4903
  newEnd--;
4906
4904
  }
4907
- const builder = new TextOperationBuilder().retain(start);
4908
- const a = oldText.slice(start, oldEnd);
4909
- const b = newText.slice(start, newEnd);
4910
- const script = shortestEditScript(a, b, maxDistance);
4911
- if (script) for (const step of script) if (step.kind === "keep") builder.retain(step.length);
4912
- else if (step.kind === "insert") builder.insert(b.slice(step.newStart, step.newStart + step.length));
4913
- else builder.delete(step.length);
4914
- else builder.insert(b).delete(a.length);
4915
- return builder.build();
4916
- }
4917
- /** Myers' shortest edit script from `a` to `b`, or `undefined` if it needs more than `maxDistance` steps. */
4918
- function shortestEditScript(a, b, maxDistance) {
4919
- const n = a.length;
4920
- const m = b.length;
4921
- const max = Math.min(n + m, maxDistance);
4922
- const offset = max + 1;
4923
- const v = new Int32Array(2 * max + 3);
4924
- const trace = [];
4925
- for (let d = 0; d <= max; d++) {
4926
- trace.push(v.slice());
4927
- for (let k = -d; k <= d; k += 2) {
4928
- let x = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1] ? v[offset + k + 1] : v[offset + k - 1] + 1;
4929
- let y = x - k;
4930
- while (x < n && y < m && a.charCodeAt(x) === b.charCodeAt(y)) {
4931
- x++;
4932
- y++;
4933
- }
4934
- v[offset + k] = x;
4935
- if (x >= n && y >= m) return backtrack(trace, d, n, m, offset);
4936
- }
4937
- }
4938
- }
4939
- function backtrack(trace, distance, n, m, offset) {
4940
- const reversed = [];
4941
- let x = n;
4942
- let y = m;
4943
- for (let d = distance; d > 0; d--) {
4944
- const v = trace[d];
4945
- const k = x - y;
4946
- const previousK = k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1] ? k + 1 : k - 1;
4947
- const previousX = v[offset + previousK];
4948
- const previousY = previousX - previousK;
4949
- const snake = Math.min(x - previousX, y - previousY);
4950
- if (snake > 0) reversed.push({
4951
- kind: "keep",
4952
- length: snake
4953
- });
4954
- x -= snake;
4955
- y -= snake;
4956
- if (x === previousX) {
4957
- reversed.push({
4958
- kind: "insert",
4959
- newStart: previousY,
4960
- length: 1
4961
- });
4962
- y--;
4963
- } else {
4964
- reversed.push({
4965
- kind: "delete",
4966
- length: 1
4967
- });
4968
- x--;
4969
- }
4970
- }
4971
- if (x > 0) reversed.push({
4972
- kind: "keep",
4973
- length: x
4974
- });
4975
- return reversed.reverse();
4905
+ return new TextOperationBuilder().retain(start).insert(newText.slice(start, newEnd)).delete(oldEnd - start).build();
4976
4906
  }
4977
4907
  //#endregion
4978
4908
  //#region src/sync/contentOperation.ts
@@ -5556,7 +5486,7 @@ var HostConnection = class HostConnection {
5556
5486
  const result = await signed.connection.get(hubAccessInterface).requestAccess({
5557
5487
  consumer: {
5558
5488
  ...req.consumer,
5559
- principal: signed.principal.identity.principal
5489
+ principal: signed.principal.identity.publicSigningIdentity.principal
5560
5490
  },
5561
5491
  permissions,
5562
5492
  duration: req.duration