@haklex/rich-diff 0.0.92 → 0.0.94
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/RichDiff.d.ts.map +1 -1
- package/dist/compute-diff.d.ts +2 -7
- package/dist/compute-diff.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -385
- package/dist/rich-diff.css +1 -1
- package/package.json +5 -4
package/dist/RichDiff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichDiff.d.ts","sourceRoot":"","sources":["../src/RichDiff.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RichDiff.d.ts","sourceRoot":"","sources":["../src/RichDiff.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,KAAK,EAAE,qBAAqB,EAAyB,MAAM,SAAS,CAAC;AAK5E,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACrD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACxC;AA2ED,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,QAAQ,EACR,OAAmB,EACnB,KAAe,EACf,cAAc,EACd,UAAU,EACV,SAAS,GACV,EAAE,aAAa,2CAiDf"}
|
package/dist/compute-diff.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export interface DiffHunk {
|
|
4
|
-
nodes: SerializedLexicalNode[];
|
|
5
|
-
type: DiffOpType;
|
|
6
|
-
}
|
|
7
|
-
export declare function computeDiff(oldState: SerializedEditorState, newState: SerializedEditorState): DiffHunk[];
|
|
1
|
+
export type { DiffHunk, DiffOpType, MarkKind } from '@haklex/rich-diff-core';
|
|
2
|
+
export { computeDiff, decorateSubtree, diffModifiedNode } from '@haklex/rich-diff-core';
|
|
8
3
|
//# sourceMappingURL=compute-diff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-diff.d.ts","sourceRoot":"","sources":["../src/compute-diff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compute-diff.d.ts","sourceRoot":"","sources":["../src/compute-diff.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { DiffHunk, DiffOpType } from './compute-diff';
|
|
2
|
-
export { computeDiff } from './compute-diff';
|
|
3
1
|
export type { RichDiffProps } from './RichDiff';
|
|
4
2
|
export { RichDiff } from './RichDiff';
|
|
3
|
+
export type { DiffHunk, DiffOpType } from '@haklex/rich-diff-core';
|
|
4
|
+
export { computeDiff } from '@haklex/rich-diff-core';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { computeDiff } from "@haklex/rich-diff-core";
|
|
3
|
+
import { computeDiff as computeDiff2 } from "@haklex/rich-diff-core";
|
|
2
4
|
import { getVariantClass, ColorSchemeProvider } from "@haklex/rich-editor";
|
|
3
5
|
import { RichRenderer } from "@haklex/rich-static-renderer";
|
|
4
6
|
import { PortalThemeProvider } from "@haklex/rich-style-token";
|
|
@@ -14,390 +16,6 @@ var cellOld = "xcvddd7";
|
|
|
14
16
|
var delete_ = "xcvddd8";
|
|
15
17
|
var insert = "xcvddd9";
|
|
16
18
|
var empty = "xcvddda";
|
|
17
|
-
const CHAR_DIFF_MAX_MATRIX_CELLS = 5e4;
|
|
18
|
-
const DELETE_MARK_STYLE = "background-color: color-mix(in srgb, var(--rc-alert-caution) 22%, transparent); text-decoration: line-through;";
|
|
19
|
-
const INSERT_MARK_STYLE = "background-color: color-mix(in srgb, var(--rc-alert-tip) 22%, transparent);";
|
|
20
|
-
function getNodeTypeKey(node) {
|
|
21
|
-
const n = node;
|
|
22
|
-
if (n.type === "heading") return `heading:${n.tag}`;
|
|
23
|
-
if (n.type === "list") return `list:${n.listType}`;
|
|
24
|
-
return n.type || "unknown";
|
|
25
|
-
}
|
|
26
|
-
function nodesEqual(a, b) {
|
|
27
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
28
|
-
}
|
|
29
|
-
function isTextNode(node) {
|
|
30
|
-
const n = node;
|
|
31
|
-
return n.type === "text" && typeof n.text === "string";
|
|
32
|
-
}
|
|
33
|
-
function getChildren(node) {
|
|
34
|
-
const n = node;
|
|
35
|
-
return Array.isArray(n.children) ? n.children : null;
|
|
36
|
-
}
|
|
37
|
-
function appendStyle(baseStyle, extraStyle) {
|
|
38
|
-
const normalizedBase = typeof baseStyle === "string" ? baseStyle.trim() : "";
|
|
39
|
-
if (!normalizedBase) return extraStyle;
|
|
40
|
-
return `${normalizedBase}${normalizedBase.endsWith(";") ? "" : ";"} ${extraStyle}`;
|
|
41
|
-
}
|
|
42
|
-
function cloneTextNode(node, text, markKind) {
|
|
43
|
-
let { style } = node;
|
|
44
|
-
if (markKind === "delete") {
|
|
45
|
-
style = appendStyle(style, DELETE_MARK_STYLE);
|
|
46
|
-
} else if (markKind === "insert") {
|
|
47
|
-
style = appendStyle(style, INSERT_MARK_STYLE);
|
|
48
|
-
}
|
|
49
|
-
const cloned = {
|
|
50
|
-
...node,
|
|
51
|
-
text,
|
|
52
|
-
style
|
|
53
|
-
};
|
|
54
|
-
return cloned;
|
|
55
|
-
}
|
|
56
|
-
function cloneNodeWithChildren(node, children) {
|
|
57
|
-
return {
|
|
58
|
-
...node,
|
|
59
|
-
children
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function decorateSubtree(node, kind) {
|
|
63
|
-
if (isTextNode(node)) {
|
|
64
|
-
return cloneTextNode(node, node.text, kind);
|
|
65
|
-
}
|
|
66
|
-
const children = getChildren(node);
|
|
67
|
-
if (!children) return node;
|
|
68
|
-
return cloneNodeWithChildren(
|
|
69
|
-
node,
|
|
70
|
-
children.map((child) => decorateSubtree(child, kind))
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
function reverseText(value) {
|
|
74
|
-
return Array.from(value).reverse().join("");
|
|
75
|
-
}
|
|
76
|
-
function mergeTextOps(ops) {
|
|
77
|
-
const merged = [];
|
|
78
|
-
for (const op of ops) {
|
|
79
|
-
if (!op.text) continue;
|
|
80
|
-
const last = merged.at(-1);
|
|
81
|
-
if (last && last.kind === op.kind) {
|
|
82
|
-
last.text += op.text;
|
|
83
|
-
} else {
|
|
84
|
-
merged.push({ ...op });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return merged;
|
|
88
|
-
}
|
|
89
|
-
function diffMiddleChars(oldChars, newChars) {
|
|
90
|
-
const m = oldChars.length;
|
|
91
|
-
const n = newChars.length;
|
|
92
|
-
if (m === 0 && n === 0) return [];
|
|
93
|
-
if (m === 0) return [{ kind: "insert", text: newChars.join("") }];
|
|
94
|
-
if (n === 0) return [{ kind: "delete", text: oldChars.join("") }];
|
|
95
|
-
if (m * n > CHAR_DIFF_MAX_MATRIX_CELLS) {
|
|
96
|
-
return [
|
|
97
|
-
{ kind: "delete", text: oldChars.join("") },
|
|
98
|
-
{ kind: "insert", text: newChars.join("") }
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
const dp = Array.from(
|
|
102
|
-
{ length: m + 1 },
|
|
103
|
-
() => Array.from({ length: n + 1 }).fill(0)
|
|
104
|
-
);
|
|
105
|
-
for (let i2 = 1; i2 <= m; i2++) {
|
|
106
|
-
for (let j2 = 1; j2 <= n; j2++) {
|
|
107
|
-
if (oldChars[i2 - 1] === newChars[j2 - 1]) {
|
|
108
|
-
dp[i2][j2] = dp[i2 - 1][j2 - 1] + 1;
|
|
109
|
-
} else {
|
|
110
|
-
dp[i2][j2] = Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const reversedOps = [];
|
|
115
|
-
let i = m;
|
|
116
|
-
let j = n;
|
|
117
|
-
while (i > 0 && j > 0) {
|
|
118
|
-
if (oldChars[i - 1] === newChars[j - 1]) {
|
|
119
|
-
const last = reversedOps.at(-1);
|
|
120
|
-
if (last && last.kind === "equal") {
|
|
121
|
-
last.text += oldChars[i - 1];
|
|
122
|
-
} else {
|
|
123
|
-
reversedOps.push({ kind: "equal", text: oldChars[i - 1] });
|
|
124
|
-
}
|
|
125
|
-
i--;
|
|
126
|
-
j--;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (dp[i - 1][j] >= dp[i][j - 1]) {
|
|
130
|
-
const last = reversedOps.at(-1);
|
|
131
|
-
if (last && last.kind === "delete") {
|
|
132
|
-
last.text += oldChars[i - 1];
|
|
133
|
-
} else {
|
|
134
|
-
reversedOps.push({ kind: "delete", text: oldChars[i - 1] });
|
|
135
|
-
}
|
|
136
|
-
i--;
|
|
137
|
-
} else {
|
|
138
|
-
const last = reversedOps.at(-1);
|
|
139
|
-
if (last && last.kind === "insert") {
|
|
140
|
-
last.text += newChars[j - 1];
|
|
141
|
-
} else {
|
|
142
|
-
reversedOps.push({ kind: "insert", text: newChars[j - 1] });
|
|
143
|
-
}
|
|
144
|
-
j--;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
while (i > 0) {
|
|
148
|
-
const last = reversedOps.at(-1);
|
|
149
|
-
if (last && last.kind === "delete") {
|
|
150
|
-
last.text += oldChars[i - 1];
|
|
151
|
-
} else {
|
|
152
|
-
reversedOps.push({ kind: "delete", text: oldChars[i - 1] });
|
|
153
|
-
}
|
|
154
|
-
i--;
|
|
155
|
-
}
|
|
156
|
-
while (j > 0) {
|
|
157
|
-
const last = reversedOps.at(-1);
|
|
158
|
-
if (last && last.kind === "insert") {
|
|
159
|
-
last.text += newChars[j - 1];
|
|
160
|
-
} else {
|
|
161
|
-
reversedOps.push({ kind: "insert", text: newChars[j - 1] });
|
|
162
|
-
}
|
|
163
|
-
j--;
|
|
164
|
-
}
|
|
165
|
-
const forwardOps = reversedOps.reverse().map((op) => ({ kind: op.kind, text: reverseText(op.text) }));
|
|
166
|
-
return mergeTextOps(forwardOps);
|
|
167
|
-
}
|
|
168
|
-
function diffTextByChar(oldText, newText) {
|
|
169
|
-
const oldChars = Array.from(oldText);
|
|
170
|
-
const newChars = Array.from(newText);
|
|
171
|
-
let prefix = 0;
|
|
172
|
-
while (prefix < oldChars.length && prefix < newChars.length && oldChars[prefix] === newChars[prefix]) {
|
|
173
|
-
prefix++;
|
|
174
|
-
}
|
|
175
|
-
let oldSuffix = oldChars.length - 1;
|
|
176
|
-
let newSuffix = newChars.length - 1;
|
|
177
|
-
while (oldSuffix >= prefix && newSuffix >= prefix && oldChars[oldSuffix] === newChars[newSuffix]) {
|
|
178
|
-
oldSuffix--;
|
|
179
|
-
newSuffix--;
|
|
180
|
-
}
|
|
181
|
-
const ops = [];
|
|
182
|
-
if (prefix > 0) {
|
|
183
|
-
ops.push({
|
|
184
|
-
kind: "equal",
|
|
185
|
-
text: oldChars.slice(0, prefix).join("")
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
ops.push(
|
|
189
|
-
...diffMiddleChars(
|
|
190
|
-
oldChars.slice(prefix, oldSuffix + 1),
|
|
191
|
-
newChars.slice(prefix, newSuffix + 1)
|
|
192
|
-
)
|
|
193
|
-
);
|
|
194
|
-
if (oldSuffix < oldChars.length - 1) {
|
|
195
|
-
ops.push({
|
|
196
|
-
kind: "equal",
|
|
197
|
-
text: oldChars.slice(oldSuffix + 1).join("")
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return mergeTextOps(ops);
|
|
201
|
-
}
|
|
202
|
-
function splitTextNodeByCharDiff(oldNode, newNode) {
|
|
203
|
-
const ops = diffTextByChar(oldNode.text, newNode.text);
|
|
204
|
-
const oldNodes = [];
|
|
205
|
-
const newNodes = [];
|
|
206
|
-
let changed = false;
|
|
207
|
-
for (const op of ops) {
|
|
208
|
-
if (!op.text) continue;
|
|
209
|
-
if (op.kind === "equal") {
|
|
210
|
-
oldNodes.push(cloneTextNode(oldNode, op.text));
|
|
211
|
-
newNodes.push(cloneTextNode(newNode, op.text));
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
changed = true;
|
|
215
|
-
if (op.kind === "delete") {
|
|
216
|
-
oldNodes.push(cloneTextNode(oldNode, op.text, "delete"));
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
newNodes.push(cloneTextNode(newNode, op.text, "insert"));
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
oldNodes: oldNodes.length > 0 ? oldNodes : [oldNode],
|
|
223
|
-
newNodes: newNodes.length > 0 ? newNodes : [newNode],
|
|
224
|
-
changed
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function alignNodes(oldNodes, newNodes) {
|
|
228
|
-
const m = oldNodes.length;
|
|
229
|
-
const n = newNodes.length;
|
|
230
|
-
const dp = Array.from(
|
|
231
|
-
{ length: m + 1 },
|
|
232
|
-
() => Array.from({ length: n + 1 }).fill(0)
|
|
233
|
-
);
|
|
234
|
-
for (let i2 = 1; i2 <= m; i2++) {
|
|
235
|
-
for (let j2 = 1; j2 <= n; j2++) {
|
|
236
|
-
const skip = Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
|
|
237
|
-
if (getNodeTypeKey(oldNodes[i2 - 1]) === getNodeTypeKey(newNodes[j2 - 1])) {
|
|
238
|
-
const score = nodesEqual(oldNodes[i2 - 1], newNodes[j2 - 1]) ? 2 : 1;
|
|
239
|
-
dp[i2][j2] = Math.max(skip, dp[i2 - 1][j2 - 1] + score);
|
|
240
|
-
} else {
|
|
241
|
-
dp[i2][j2] = skip;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const ops = [];
|
|
246
|
-
let i = m;
|
|
247
|
-
let j = n;
|
|
248
|
-
while (i > 0 && j > 0) {
|
|
249
|
-
const typeMatch = getNodeTypeKey(oldNodes[i - 1]) === getNodeTypeKey(newNodes[j - 1]);
|
|
250
|
-
if (typeMatch) {
|
|
251
|
-
const exact = nodesEqual(oldNodes[i - 1], newNodes[j - 1]);
|
|
252
|
-
const score = exact ? 2 : 1;
|
|
253
|
-
if (dp[i][j] === dp[i - 1][j - 1] + score) {
|
|
254
|
-
ops.push(
|
|
255
|
-
exact ? { kind: "equal", node: oldNodes[i - 1] } : {
|
|
256
|
-
kind: "modify",
|
|
257
|
-
oldNode: oldNodes[i - 1],
|
|
258
|
-
newNode: newNodes[j - 1]
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
i--;
|
|
262
|
-
j--;
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
if (dp[i - 1][j] >= dp[i][j - 1]) {
|
|
267
|
-
ops.push({ kind: "delete", node: oldNodes[i - 1] });
|
|
268
|
-
i--;
|
|
269
|
-
} else {
|
|
270
|
-
ops.push({ kind: "insert", node: newNodes[j - 1] });
|
|
271
|
-
j--;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
while (i > 0) {
|
|
275
|
-
ops.push({ kind: "delete", node: oldNodes[--i] });
|
|
276
|
-
}
|
|
277
|
-
while (j > 0) {
|
|
278
|
-
ops.push({ kind: "insert", node: newNodes[--j] });
|
|
279
|
-
}
|
|
280
|
-
ops.reverse();
|
|
281
|
-
return ops;
|
|
282
|
-
}
|
|
283
|
-
function diffChildrenInline(oldChildren, newChildren) {
|
|
284
|
-
const ops = alignNodes(oldChildren, newChildren);
|
|
285
|
-
const nextOldChildren = [];
|
|
286
|
-
const nextNewChildren = [];
|
|
287
|
-
let changed = false;
|
|
288
|
-
for (const op of ops) {
|
|
289
|
-
switch (op.kind) {
|
|
290
|
-
case "equal": {
|
|
291
|
-
nextOldChildren.push(op.node);
|
|
292
|
-
nextNewChildren.push(op.node);
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
295
|
-
case "delete": {
|
|
296
|
-
changed = true;
|
|
297
|
-
nextOldChildren.push(decorateSubtree(op.node, "delete"));
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
case "insert": {
|
|
301
|
-
changed = true;
|
|
302
|
-
nextNewChildren.push(decorateSubtree(op.node, "insert"));
|
|
303
|
-
break;
|
|
304
|
-
}
|
|
305
|
-
case "modify": {
|
|
306
|
-
changed = true;
|
|
307
|
-
if (isTextNode(op.oldNode) && isTextNode(op.newNode)) {
|
|
308
|
-
const textDiff = splitTextNodeByCharDiff(op.oldNode, op.newNode);
|
|
309
|
-
nextOldChildren.push(...textDiff.oldNodes);
|
|
310
|
-
nextNewChildren.push(...textDiff.newNodes);
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
const nested = diffNodeInline(op.oldNode, op.newNode);
|
|
314
|
-
if (nested) {
|
|
315
|
-
nextOldChildren.push(nested.oldNode);
|
|
316
|
-
nextNewChildren.push(nested.newNode);
|
|
317
|
-
} else {
|
|
318
|
-
nextOldChildren.push(decorateSubtree(op.oldNode, "delete"));
|
|
319
|
-
nextNewChildren.push(decorateSubtree(op.newNode, "insert"));
|
|
320
|
-
}
|
|
321
|
-
break;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return {
|
|
326
|
-
oldChildren: nextOldChildren,
|
|
327
|
-
newChildren: nextNewChildren,
|
|
328
|
-
changed
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function diffNodeInline(oldNode, newNode) {
|
|
332
|
-
if (getNodeTypeKey(oldNode) !== getNodeTypeKey(newNode)) return null;
|
|
333
|
-
if (nodesEqual(oldNode, newNode)) {
|
|
334
|
-
return { oldNode, newNode, changed: false };
|
|
335
|
-
}
|
|
336
|
-
const oldChildren = getChildren(oldNode);
|
|
337
|
-
const newChildren = getChildren(newNode);
|
|
338
|
-
if (!oldChildren || !newChildren) return null;
|
|
339
|
-
const childDiff = diffChildrenInline(oldChildren, newChildren);
|
|
340
|
-
if (!childDiff.changed) {
|
|
341
|
-
return { oldNode, newNode, changed: false };
|
|
342
|
-
}
|
|
343
|
-
return {
|
|
344
|
-
oldNode: cloneNodeWithChildren(oldNode, childDiff.oldChildren),
|
|
345
|
-
newNode: cloneNodeWithChildren(newNode, childDiff.newChildren),
|
|
346
|
-
changed: true
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
function diffModifiedNode(oldNode, newNode) {
|
|
350
|
-
const nested = diffNodeInline(oldNode, newNode);
|
|
351
|
-
if (nested) {
|
|
352
|
-
return { oldNode: nested.oldNode, newNode: nested.newNode };
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
oldNode: decorateSubtree(oldNode, "delete"),
|
|
356
|
-
newNode: decorateSubtree(newNode, "insert")
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
function computeDiff(oldState, newState) {
|
|
360
|
-
const ops = alignNodes(oldState.root.children, newState.root.children);
|
|
361
|
-
const hunks = [];
|
|
362
|
-
for (const op of ops) {
|
|
363
|
-
switch (op.kind) {
|
|
364
|
-
case "equal": {
|
|
365
|
-
const last = hunks.at(-1);
|
|
366
|
-
if (last && last.type === "equal") {
|
|
367
|
-
last.nodes.push(op.node);
|
|
368
|
-
} else {
|
|
369
|
-
hunks.push({ type: "equal", nodes: [op.node] });
|
|
370
|
-
}
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
case "modify": {
|
|
374
|
-
{
|
|
375
|
-
const inline = diffModifiedNode(op.oldNode, op.newNode);
|
|
376
|
-
hunks.push(
|
|
377
|
-
{ type: "delete", nodes: [inline.oldNode] },
|
|
378
|
-
{ type: "insert", nodes: [inline.newNode] }
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
case "delete": {
|
|
384
|
-
hunks.push({
|
|
385
|
-
type: "delete",
|
|
386
|
-
nodes: [decorateSubtree(op.node, "delete")]
|
|
387
|
-
});
|
|
388
|
-
break;
|
|
389
|
-
}
|
|
390
|
-
case "insert": {
|
|
391
|
-
hunks.push({
|
|
392
|
-
type: "insert",
|
|
393
|
-
nodes: [decorateSubtree(op.node, "insert")]
|
|
394
|
-
});
|
|
395
|
-
break;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return hunks;
|
|
400
|
-
}
|
|
401
19
|
function buildRows(hunks) {
|
|
402
20
|
const rows = [];
|
|
403
21
|
let i = 0;
|
|
@@ -494,5 +112,5 @@ function RichDiff({
|
|
|
494
112
|
}
|
|
495
113
|
export {
|
|
496
114
|
RichDiff,
|
|
497
|
-
computeDiff
|
|
115
|
+
computeDiff2 as computeDiff
|
|
498
116
|
};
|
package/dist/rich-diff.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj00{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj01{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj02{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #a1a1aa;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 12px}.dark .pvevj00,[data-theme=dark] .pvevj00,.dark.pvevj00,[data-theme=dark].pvevj00,.dark .pvevj01,[data-theme=dark] .pvevj01,.dark.pvevj01,[data-theme=dark].pvevj01,.dark .pvevj02,[data-theme=dark] .pvevj02,.dark.pvevj02,[data-theme=dark].pvevj02{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}.xcvddd0{border:1px solid var(--rc-border);border-radius:6px;overflow:hidden;font-size:14px}.xcvddd1{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--rc-border);background:var(--rc-bg-secondary)}.xcvddd2{padding:8px 16px;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--rc-text-secondary)}.xcvddd3{border-right:1px solid var(--rc-border)}.xcvddd4{display:flex;flex-direction:column}.xcvddd5{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--rc-border)}.xcvddd5:last-child{border-bottom:none}.xcvddd6{padding:4px 12px;min-height:32px;overflow:hidden}.xcvddd7{border-right:1px solid var(--rc-border)}.xcvddd8{background-color:color-mix(in srgb,var(--rc-alert-caution) 15%,transparent)}.xcvddd9{background-color:color-mix(in srgb,var(--rc-alert-tip) 15%,transparent)}.xcvddda{background-color:var(--rc-bg-secondary)}.xcvddd8 .rich-content__body{opacity:.85}
|
|
1
|
+
:root{--rc-text: #000;--rc-text-secondary: #262626;--rc-text-tertiary: #737373;--rc-text-quaternary: #a3a3a3;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f5f5f5;--rc-fill: #e8e8e8;--rc-fill-secondary: #eeeeee;--rc-fill-tertiary: #f5f5f5;--rc-fill-quaternary: #fafafa;--rc-border: #f5f5f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #404040;--rc-code-bg: #f5f5f5;--rc-hr-border: #e5e5e5;--rc-quote-border: #2563eb;--rc-quote-bg: #f5f5f5;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a3a3a3;--rc-text-tertiary: #737373;--rc-text-quaternary: #525252;--rc-bg: #0a0a0a;--rc-bg-secondary: #171717;--rc-bg-tertiary: #262626;--rc-fill: #2a2a2a;--rc-fill-secondary: #222222;--rc-fill-tertiary: #1a1a1a;--rc-fill-quaternary: #141414;--rc-border: #262626;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #d4d4d4;--rc-code-bg: #262626;--rc-hr-border: #262626;--rc-quote-border: #60a5fa;--rc-quote-bg: #262626;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}[data-theme=dark]{--rc-text: #fafafa;--rc-text-secondary: #a3a3a3;--rc-text-tertiary: #737373;--rc-text-quaternary: #525252;--rc-bg: #0a0a0a;--rc-bg-secondary: #171717;--rc-bg-tertiary: #262626;--rc-fill: #2a2a2a;--rc-fill-secondary: #222222;--rc-fill-tertiary: #1a1a1a;--rc-fill-quaternary: #141414;--rc-border: #262626;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #d4d4d4;--rc-code-bg: #262626;--rc-hr-border: #262626;--rc-quote-border: #60a5fa;--rc-quote-bg: #262626;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj00{--rc-text: #000;--rc-text-secondary: #262626;--rc-text-tertiary: #737373;--rc-text-quaternary: #a3a3a3;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f5f5f5;--rc-fill: #e8e8e8;--rc-fill-secondary: #eeeeee;--rc-fill-tertiary: #f5f5f5;--rc-fill-quaternary: #fafafa;--rc-border: #f5f5f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #404040;--rc-code-bg: #f5f5f5;--rc-hr-border: #e5e5e5;--rc-quote-border: #2563eb;--rc-quote-bg: #f5f5f5;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj01{--rc-text: #000;--rc-text-secondary: #262626;--rc-text-tertiary: #737373;--rc-text-quaternary: #a3a3a3;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f5f5f5;--rc-fill: #e8e8e8;--rc-fill-secondary: #eeeeee;--rc-fill-tertiary: #f5f5f5;--rc-fill-quaternary: #fafafa;--rc-border: #f5f5f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #404040;--rc-code-bg: #f5f5f5;--rc-hr-border: #e5e5e5;--rc-quote-border: #2563eb;--rc-quote-bg: #f5f5f5;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}.pvevj02{--rc-text: #000;--rc-text-secondary: #262626;--rc-text-tertiary: #737373;--rc-text-quaternary: #a3a3a3;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f5f5f5;--rc-fill: #e8e8e8;--rc-fill-secondary: #eeeeee;--rc-fill-tertiary: #f5f5f5;--rc-fill-quaternary: #fafafa;--rc-border: #f5f5f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #404040;--rc-code-bg: #f5f5f5;--rc-hr-border: #e5e5e5;--rc-quote-border: #a3a3a3;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 12px}.dark .pvevj00,[data-theme=dark] .pvevj00,.dark.pvevj00,[data-theme=dark].pvevj00,.dark .pvevj01,[data-theme=dark] .pvevj01,.dark.pvevj01,[data-theme=dark].pvevj01,.dark .pvevj02,[data-theme=dark] .pvevj02,.dark.pvevj02,[data-theme=dark].pvevj02{--rc-text: #fafafa;--rc-text-secondary: #a3a3a3;--rc-text-tertiary: #737373;--rc-text-quaternary: #525252;--rc-bg: #0a0a0a;--rc-bg-secondary: #171717;--rc-bg-tertiary: #262626;--rc-fill: #2a2a2a;--rc-fill-secondary: #222222;--rc-fill-tertiary: #1a1a1a;--rc-fill-quaternary: #141414;--rc-border: #262626;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #d4d4d4;--rc-code-bg: #262626;--rc-hr-border: #262626;--rc-quote-border: #60a5fa;--rc-quote-bg: #262626;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}.xcvddd0{border:1px solid var(--rc-border);border-radius:6px;overflow:hidden;font-size:14px}.xcvddd1{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--rc-border);background:var(--rc-bg-secondary)}.xcvddd2{padding:8px 16px;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--rc-text-secondary)}.xcvddd3{border-right:1px solid var(--rc-border)}.xcvddd4{display:flex;flex-direction:column}.xcvddd5{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--rc-border)}.xcvddd5:last-child{border-bottom:none}.xcvddd6{padding:4px 12px;min-height:32px;overflow:hidden}.xcvddd7{border-right:1px solid var(--rc-border)}.xcvddd8{background-color:color-mix(in srgb,var(--rc-alert-caution) 15%,transparent)}.xcvddd9{background-color:color-mix(in srgb,var(--rc-alert-tip) 15%,transparent)}.xcvddda{background-color:var(--rc-bg-secondary)}.xcvddd8 .rich-content__body{opacity:.85}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-diff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.94",
|
|
4
4
|
"description": "Rich diff editor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@haklex/rich-
|
|
25
|
-
"@haklex/rich-
|
|
26
|
-
"@haklex/rich-
|
|
24
|
+
"@haklex/rich-diff-core": "0.0.94",
|
|
25
|
+
"@haklex/rich-editor": "0.0.94",
|
|
26
|
+
"@haklex/rich-static-renderer": "0.0.94",
|
|
27
|
+
"@haklex/rich-style-token": "0.0.94"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/react": "^19.2.14",
|