11diff --git a/node_modules/lib0/dist/delta/delta.d.ts b/node_modules/lib0/dist/delta/delta.d.ts
2- index 4b3d23b..779e9cb 100644
2+ index 1f97a3d..b6f9db5 100644
33--- a/node_modules/lib0/dist/delta/delta.d.ts
44+++ b/node_modules/lib0/dist/delta/delta.d.ts
5- @@ -887 ,7 +887 ,7 @@ export function from<NodeName extends string | null, Attrs extends {
5+ @@ -905 ,7 +905 ,7 @@ export function from<NodeName extends string | null, Attrs extends {
66 children: Extract<Children, Array<any>> extends Array<infer Ac> ? (unknown extends Ac ? never : Ac) : never;
77 text: Extract<Children, string> extends never ? false : true;
88 }>;
@@ -12,42 +12,26 @@ index 4b3d23b..779e9cb 100644
1212 index: number;
1313 remove: Array<any>;
1414diff --git a/node_modules/lib0/src/delta/delta.js b/node_modules/lib0/src/delta/delta.js
15- index e063729..a5f50be 100644
15+ index d4be86c..89ddc86 100644
1616--- a/node_modules/lib0/src/delta/delta.js
1717+++ b/node_modules/lib0/src/delta/delta.js
18- @@ -2324,13 +2324,30 @@ class _DiffStringWrapper {
19- * 7. merge content diff and formatting updates
20- */
21-
22- + /**
23- + * Default node-pairing predicate used by {@link diff}: two child nodes are
24- + * considered "the same node" (diffed in place / modified) iff they share a
25- + * name. Callers can pass a custom predicate to force a *replace* (delete +
26- + * insert) for nodes that should be treated as atomic - e.g. raising a diff
27- + * boundary when a node's identifying child changes type.
28- + *
29- + * @param {DeltaAny} a
30- + * @param {DeltaAny} b
31- + * @return {boolean}
32- + */
33- + const defaultMatchNodes = (a, b) => a.name === b.name
34- +
35- /**
18+ @@ -2443,9 +2443,14 @@ class _DiffStringWrapper {
3619 * @template {DeltaConf} Conf
3720 * @param {Delta<Conf>} d1
3821 * @param {NoInfer<Delta<Conf>>} d2
3922+ * @param {(a: DeltaAny, b: DeltaAny) => boolean} [matchNodes] decides whether a
4023+ * removed node and an inserted node are the *same* node (→ diffed/modified in
41- + * place) or different (→ replaced). Defaults to name-equality
42- + * ({@link defaultMatchNodes}).
24+ + * place) or different (→ replaced). Defaults to name-equality. Override to force
25+ + * a *replace* for nodes that should be treated as atomic - e.g. raising a diff
26+ + * boundary when a node's identifying child changes type.
4327 * @return {Delta<Conf>}
4428 */
4529- export const diff = (d1, d2) => {
46- + export const diff = (d1, d2, matchNodes = defaultMatchNodes ) => {
30+ + export const diff = (d1, d2, matchNodes = (a, b) => a.name === b.name ) => {
4731 const d = create(d1.name === d2.name ? d1.name : null, $deltaAny)
4832 if (d1.fingerprint !== d2.fingerprint) {
4933 /**
50- @@ -2413 ,7 +2430 ,7 @@ export const diff = (d1, d2) => {
34+ @@ -2533 ,7 +2538 ,7 @@ export const diff = (d1, d2) => {
5135 const changeset3 = diffChangesetWithSeparator(changeset2, patience.smartSplitRegex)
5236 // split all
5337 const changeset4 = diffChangesetWithSeparator(changeset3, /./g)
@@ -56,7 +40,7 @@ index e063729..a5f50be 100644
5640 if (formattingNeedsDiff) {
5741 const formattingDiff = create()
5842 // update opsIs with content diff. then we can figure out the formatting diff.
59- @@ -2477 ,7 +2494 ,7 @@ export const diff = (d1, d2) => {
43+ @@ -2602 ,7 +2607 ,7 @@ export const diff = (d1, d2) => {
6044 const prevVal = attr1?.value
6145 const nextVal = attr2.value
6246 if ($deltaAny.check(prevVal) && $deltaAny.check(nextVal) && prevVal.name === nextVal.name) {
@@ -65,18 +49,18 @@ index e063729..a5f50be 100644
6549 } else {
6650 d.setAttr(key, nextVal)
6751 }
68- @@ -2522 ,8 +2539 ,9 @@ const applyInserts = (d, cins, len) => { len > 0 && cins.splice(0, len).forEach(
52+ @@ -2648 ,8 +2653 ,9 @@ const applyInserts = (d, cins, len) => { len > 0 && cins.splice(0, len).forEach(
6953 /**
7054 * @param {DeltaBuilderAny} d
7155 * @param {Array<{ index: number, remove: Array<any>, insert: Array<any> }>} changeset
7256+ * @param {(a: DeltaAny, b: DeltaAny) => boolean} [matchNodes] see {@link diff}
7357 */
7458- const applyChangesetToDelta = (d, changeset) => {
75- + const applyChangesetToDelta = (d, changeset, matchNodes = defaultMatchNodes ) => {
59+ + const applyChangesetToDelta = (d, changeset, matchNodes = (a, b) => a.name === b.name ) => {
7660 for (let ci = 0, lastIndex = 0; ci < changeset.length; ci++) {
7761 const c = changeset[ci]
7862 d.retain(c.index - lastIndex)
79- @@ -2534 ,14 +2552 ,14 @@ const applyChangesetToDelta = (d, changeset) => {
63+ @@ -2660 ,14 +2666 ,14 @@ const applyChangesetToDelta = (d, changeset) => {
8064 const cremoveDeltaIndex = c.remove.findIndex(cc => $deltaAny.check(cc))
8165 if (cremoveDeltaIndex < 0) break
8266 const cremoveDelta = c.remove[cremoveDeltaIndex]
0 commit comments