@crewlethq/ui 0.152.0 → 0.153.0

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/styles.css CHANGED
@@ -20183,12 +20183,11 @@ svg.crewlet-datetime__chevron {
20183
20183
  }
20184
20184
 
20185
20185
 
20186
- /* DiffList-3JNPLQ2E.css */
20186
+ /* DiffList-57M6YCNS.css */
20187
20187
  /* DiffList: one path per row, with its mark, its word and its tint.
20188
20188
 
20189
- The tint is the soft step of the state the row is in and the text is the
20190
- matching ink step, which is the pairing the palette suite measures: a fill
20191
- is never text and an ink step is never a background. */
20189
+ An added or removed row takes the diff family's row and sign, as a line of
20190
+ DiffView does; a changed one the warning soft step and its ink. */
20192
20191
  /*
20193
20192
  * HALF A STEP, between the rows and inside them. A diff row is a LINE OF A
20194
20193
  * DOCUMENT rather than an item in a list: at the full 4px step a fifty-line
@@ -20221,13 +20220,13 @@ svg.crewlet-datetime__chevron {
20221
20220
  this replaces read add, remove and replace, which no answer has ever
20222
20221
  carried, so every diff row rendered untinted. */
20223
20222
  .crewlet-diff-list__row--added {
20224
- background: var(--color-feedback-success-soft);
20225
- color: var(--color-feedback-success-ink);
20223
+ background: var(--color-diff-added-row);
20224
+ color: var(--color-diff-added-sign);
20226
20225
  }
20227
20226
 
20228
20227
  .crewlet-diff-list__row--removed {
20229
- background: var(--color-feedback-danger-soft);
20230
- color: var(--color-feedback-danger-ink);
20228
+ background: var(--color-diff-removed-row);
20229
+ color: var(--color-diff-removed-sign);
20231
20230
  }
20232
20231
 
20233
20232
  .crewlet-diff-list__row--changed {
@@ -20343,75 +20342,209 @@ svg.crewlet-datetime__chevron {
20343
20342
  }
20344
20343
 
20345
20344
 
20346
- /* DiffView-ZI5C25Q3.css */
20347
- /* DiffView: a line diff, monospace and line-numbered on both sides.
20348
-
20349
- A changed line is marked three ways, a tint, a drawn mark and a word read
20350
- in its place, because colour alone is not a signal and a printed or
20351
- forced-colours render loses the tint entirely. The tint and the mark are
20352
- the diff family's row and sign, which the palette suite measures together. */
20345
+ /* DiffView-J55CPJDX.css */
20346
+ /* DiffView: a line diff in the diff family's colours, on every surface. A
20347
+ changed line is said three ways, each enough alone: its tint, its glyph with
20348
+ the word read in its place, and the underline on the run an edit changed. */
20353
20349
  .crewlet-diff-view {
20350
+ container: crewlet-diff-view / inline-size;
20351
+ display: flex;
20352
+ flex-direction: column;
20353
+ gap: var(--spacing-2);
20354
+ min-width: 0;
20355
+ }
20356
+
20357
+ /* The diff's own ground: the card rung, which the palette measures its tints over. */
20358
+ .crewlet-diff-view__body {
20354
20359
  overflow: hidden;
20355
20360
  border: 1px solid var(--color-border-default);
20356
20361
  border-radius: var(--radius-sm);
20362
+ background: var(--color-surface-subtle);
20363
+ color: var(--color-text-primary);
20357
20364
  font-family: var(--font-family-mono);
20358
- font-size: var(--font-size-xs);
20359
- line-height: var(--font-line-height-normal);
20365
+ font-size: var(--font-size-compact);
20366
+ line-height: var(--font-line-height-body);
20360
20367
  }
20361
20368
 
20362
- .crewlet-diff-view__section + .crewlet-diff-view__section,
20363
- .crewlet-diff-view__skip + .crewlet-diff-view__line {
20364
- border-top: 1px solid var(--color-border-default);
20369
+ /* A line's tracks: numbers (or a path), the mark, the text. Widths come from
20370
+ the counts the component publishes, so every window block lands on them. */
20371
+ .crewlet-diff-view__line {
20372
+ display: grid;
20373
+ grid-template-columns: 2ch minmax(0, 1fr);
20374
+ column-gap: var(--spacing-2);
20375
+ padding: calc(var(--spacing-1) / 4) var(--spacing-3) calc(var(--spacing-1) / 4) var(--spacing-2);
20365
20376
  }
20366
20377
 
20367
- /* A GAP SAYS WHAT IT STANDS FOR. Silently closed, a document edited at both
20368
- ends looks like one rewritten in the middle. */
20369
- .crewlet-diff-view__skip {
20370
- padding: var(--spacing-1) var(--spacing-3);
20371
- background: var(--color-surface-elevated);
20372
- color: var(--color-text-tertiary);
20373
- font-family: var(--font-family-sans);
20374
- font-size: var(--font-size-xs);
20378
+ .crewlet-diff-view--numbered .crewlet-diff-view__line {
20379
+ --crewlet-diff-gutter: calc(var(--spacing-2) * 2.5 + var(--crewlet-diff-digits) * 2ch);
20380
+
20381
+ grid-template-columns: calc(var(--crewlet-diff-digits) * 1ch) calc(var(--crewlet-diff-digits) * 1ch) 2ch minmax(0, 1fr);
20375
20382
  }
20376
20383
 
20377
- .crewlet-diff-view__line {
20378
- display: grid;
20379
- grid-template-columns: 3.5ch 3.5ch 2ch minmax(0, 1fr);
20380
- gap: var(--spacing-2);
20381
- padding: calc(var(--spacing-1) / 4) var(--spacing-3) calc(var(--spacing-1) / 4) var(--spacing-2);
20384
+ .crewlet-diff-view--numbered.crewlet-diff-view--split .crewlet-diff-view__line {
20385
+ --crewlet-diff-gutter: calc(var(--spacing-2) * 1.5 + var(--crewlet-diff-digits) * 1ch);
20386
+
20387
+ grid-template-columns: calc(var(--crewlet-diff-digits) * 1ch) 2ch minmax(0, 1fr);
20388
+ }
20389
+
20390
+ /* A path takes up to 40% of the line; the value keeps its own track, so a
20391
+ line that continues the setting above (and draws no path) lines up under it. */
20392
+ .crewlet-diff-view--keyed .crewlet-diff-view__line {
20393
+ grid-template-columns: 2ch min(calc(var(--crewlet-diff-path) * 1ch), 40%) minmax(0, 1fr);
20394
+ }
20395
+
20396
+ .crewlet-diff-view--keyed .crewlet-diff-view__text {
20397
+ grid-column: 3;
20398
+ }
20399
+
20400
+ /* The tints, with the numbers on a band in the sign's ink. The band is an
20401
+ inset shadow, so forced colours drop it with the tint and keep the glyph. */
20402
+ .crewlet-diff-view__line--add {
20403
+ background: var(--color-diff-added-row);
20404
+ box-shadow: inset var(--crewlet-diff-gutter, 0) 0 0 var(--color-diff-added-gutter);
20405
+ }
20406
+
20407
+ .crewlet-diff-view__line--remove {
20408
+ background: var(--color-diff-removed-row);
20409
+ box-shadow: inset var(--crewlet-diff-gutter, 0) 0 0 var(--color-diff-removed-gutter);
20382
20410
  }
20383
20411
 
20384
20412
  .crewlet-diff-view__number {
20385
20413
  color: var(--color-text-tertiary);
20386
20414
  text-align: right;
20387
- user-select: none;
20388
20415
  font-variant-numeric: tabular-nums;
20416
+ user-select: none;
20417
+ }
20418
+
20419
+ .crewlet-diff-view__line--add .crewlet-diff-view__mark,
20420
+ .crewlet-diff-view__line--add .crewlet-diff-view__number {
20421
+ color: var(--color-diff-added-sign);
20422
+ }
20423
+
20424
+ .crewlet-diff-view__line--remove .crewlet-diff-view__mark,
20425
+ .crewlet-diff-view__line--remove .crewlet-diff-view__number {
20426
+ color: var(--color-diff-removed-sign);
20427
+ }
20428
+
20429
+ /* A number that picks its line: the number, pressable, its underline answering the pointer. */
20430
+ .crewlet-diff-view__pick {
20431
+ padding: 0;
20432
+ border: 0;
20433
+ background: none;
20434
+ font: inherit;
20435
+ cursor: pointer;
20436
+ }
20437
+
20438
+ .crewlet-diff-view__pick:hover {
20439
+ text-decoration-line: underline;
20440
+ }
20441
+
20442
+ /* A picked line: the selected tint in place of its tints and band, an accent
20443
+ bar at its start; its glyph and its run's underline stay. */
20444
+ .crewlet-diff-view__line--picked {
20445
+ background: var(--color-surface-selected);
20446
+ box-shadow: inset 2px 0 0 var(--color-brand-accent);
20447
+ outline: 2px solid transparent;
20448
+ outline-offset: -2px;
20449
+ }
20450
+
20451
+ .crewlet-diff-view__line--picked .crewlet-diff-view__number {
20452
+ color: var(--color-text-tertiary);
20389
20453
  }
20390
20454
 
20391
20455
  .crewlet-diff-view__mark {
20456
+ color: var(--color-text-secondary);
20392
20457
  text-align: center;
20393
20458
  user-select: none;
20394
20459
  }
20395
20460
 
20461
+ .crewlet-diff-view__path {
20462
+ min-width: 0;
20463
+ overflow-wrap: anywhere;
20464
+ }
20465
+
20466
+ /* Nothing is cut: a line wraps and keeps its own spacing. */
20396
20467
  .crewlet-diff-view__text {
20468
+ min-width: 0;
20397
20469
  white-space: pre-wrap;
20398
20470
  overflow-wrap: anywhere;
20399
20471
  }
20400
20472
 
20401
- .crewlet-diff-view__line--add {
20402
- background: var(--color-diff-added-row);
20473
+ /* Where an edited line changed: its word tint under the line's own ink, underlined. */
20474
+ .crewlet-diff-view__run {
20475
+ text-decoration-line: underline;
20476
+ text-decoration-thickness: from-font;
20477
+ text-underline-position: under;
20403
20478
  }
20404
20479
 
20405
- .crewlet-diff-view__line--add .crewlet-diff-view__mark {
20406
- color: var(--color-diff-added-sign);
20480
+ .crewlet-diff-view__line--add .crewlet-diff-view__run {
20481
+ background: var(--color-diff-added-word);
20482
+ color: var(--color-text-primary);
20407
20483
  }
20408
20484
 
20409
- .crewlet-diff-view__line--remove {
20410
- background: var(--color-diff-removed-row);
20485
+ .crewlet-diff-view__line--remove .crewlet-diff-view__run {
20486
+ background: var(--color-diff-removed-word);
20487
+ color: var(--color-text-primary);
20411
20488
  }
20412
20489
 
20413
- .crewlet-diff-view__line--remove .crewlet-diff-view__mark {
20414
- color: var(--color-diff-removed-sign);
20490
+ .crewlet-diff-view__line--picked .crewlet-diff-view__run {
20491
+ background: none;
20492
+ }
20493
+
20494
+ /* What a host draws under a line, on the diff's ground in the body's face. */
20495
+ .crewlet-diff-view__notes {
20496
+ display: flex;
20497
+ flex-direction: column;
20498
+ gap: var(--spacing-2);
20499
+ padding: var(--spacing-2) var(--spacing-3);
20500
+ border-block: 1px solid var(--color-border-default);
20501
+ font-family: var(--font-family-sans);
20502
+ }
20503
+
20504
+ /* A gap says what it stands for, on the hunk row. */
20505
+ .crewlet-diff-view__skip {
20506
+ padding: var(--spacing-1) var(--spacing-3);
20507
+ border-block: 1px solid var(--color-border-default);
20508
+ background: var(--color-diff-hunk-row);
20509
+ color: var(--color-text-tertiary);
20510
+ font-family: var(--font-family-sans);
20511
+ font-size: var(--font-size-xs);
20512
+ }
20513
+
20514
+ .crewlet-diff-view__block:first-child > .crewlet-diff-view__skip:first-child {
20515
+ border-block-start: none;
20516
+ }
20517
+
20518
+ /* Split: the older text on the left, the newer on the right. */
20519
+ .crewlet-diff-view__pair {
20520
+ display: grid;
20521
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
20522
+ }
20523
+
20524
+ .crewlet-diff-view__pair > :last-child {
20525
+ border-inline-start: 1px solid var(--color-border-default);
20526
+ }
20527
+
20528
+ /* A comparison not made is said in place of every row; "Nothing changed" is quieter. */
20529
+ .crewlet-diff-view__said {
20530
+ margin: 0;
20531
+ color: var(--color-text-secondary);
20532
+ font-size: var(--font-size-compact);
20533
+ }
20534
+
20535
+ .crewlet-diff-view__said--quiet {
20536
+ color: var(--color-text-tertiary);
20537
+ }
20538
+
20539
+ /* On a narrow diff a setting's value takes the row under its path. */
20540
+ @container crewlet-diff-view (width < 640px) {
20541
+ .crewlet-diff-view--keyed .crewlet-diff-view__line {
20542
+ grid-template-columns: 2ch minmax(0, 1fr);
20543
+ }
20544
+
20545
+ .crewlet-diff-view--keyed .crewlet-diff-view__text {
20546
+ grid-column: 2;
20547
+ }
20415
20548
  }
20416
20549
 
20417
20550
  /* DiffSummary: the size of the change, in the same inks as its lines. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewlethq/ui",
3
- "version": "0.152.0",
3
+ "version": "0.153.0",
4
4
  "description": "Crewlet shared React components built on @crewlethq/tokens and @crewlethq/icons.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "clean": "rm -rf dist src/generated"
43
43
  },
44
44
  "dependencies": {
45
- "@crewlethq/icons": "0.152.0",
46
- "@crewlethq/tokens": "0.152.0",
45
+ "@crewlethq/icons": "0.153.0",
46
+ "@crewlethq/tokens": "0.153.0",
47
47
  "prosemirror-commands": "1.7.2",
48
48
  "prosemirror-gapcursor": "1.4.1",
49
49
  "prosemirror-history": "1.5.1",
@@ -1,90 +0,0 @@
1
- /* DiffView: a line diff, monospace and line-numbered on both sides.
2
-
3
- A changed line is marked three ways, a tint, a drawn mark and a word read
4
- in its place, because colour alone is not a signal and a printed or
5
- forced-colours render loses the tint entirely. The tint and the mark are
6
- the diff family's row and sign, which the palette suite measures together. */
7
- .crewlet-diff-view {
8
- overflow: hidden;
9
- border: 1px solid var(--color-border-default);
10
- border-radius: var(--radius-sm);
11
- font-family: var(--font-family-mono);
12
- font-size: var(--font-size-xs);
13
- line-height: var(--font-line-height-normal);
14
- }
15
-
16
- .crewlet-diff-view__section + .crewlet-diff-view__section,
17
- .crewlet-diff-view__skip + .crewlet-diff-view__line {
18
- border-top: 1px solid var(--color-border-default);
19
- }
20
-
21
- /* A GAP SAYS WHAT IT STANDS FOR. Silently closed, a document edited at both
22
- ends looks like one rewritten in the middle. */
23
- .crewlet-diff-view__skip {
24
- padding: var(--spacing-1) var(--spacing-3);
25
- background: var(--color-surface-elevated);
26
- color: var(--color-text-tertiary);
27
- font-family: var(--font-family-sans);
28
- font-size: var(--font-size-xs);
29
- }
30
-
31
- .crewlet-diff-view__line {
32
- display: grid;
33
- grid-template-columns: 3.5ch 3.5ch 2ch minmax(0, 1fr);
34
- gap: var(--spacing-2);
35
- padding: calc(var(--spacing-1) / 4) var(--spacing-3) calc(var(--spacing-1) / 4) var(--spacing-2);
36
- }
37
-
38
- .crewlet-diff-view__number {
39
- color: var(--color-text-tertiary);
40
- text-align: right;
41
- user-select: none;
42
- font-variant-numeric: tabular-nums;
43
- }
44
-
45
- .crewlet-diff-view__mark {
46
- text-align: center;
47
- user-select: none;
48
- }
49
-
50
- .crewlet-diff-view__text {
51
- white-space: pre-wrap;
52
- overflow-wrap: anywhere;
53
- }
54
-
55
- .crewlet-diff-view__line--add {
56
- background: var(--color-diff-added-row);
57
- }
58
-
59
- .crewlet-diff-view__line--add .crewlet-diff-view__mark {
60
- color: var(--color-diff-added-sign);
61
- }
62
-
63
- .crewlet-diff-view__line--remove {
64
- background: var(--color-diff-removed-row);
65
- }
66
-
67
- .crewlet-diff-view__line--remove .crewlet-diff-view__mark {
68
- color: var(--color-diff-removed-sign);
69
- }
70
-
71
- /* DiffSummary: the size of the change, in the same inks as its lines. */
72
- .crewlet-diff-summary {
73
- margin: 0;
74
- color: var(--color-text-secondary);
75
- font-size: var(--font-size-compact);
76
- }
77
-
78
- .crewlet-diff-summary__added,
79
- .crewlet-diff-summary__removed {
80
- font-family: var(--font-family-mono);
81
- font-variant-numeric: tabular-nums;
82
- }
83
-
84
- .crewlet-diff-summary__added {
85
- color: var(--color-diff-added-sign);
86
- }
87
-
88
- .crewlet-diff-summary__removed {
89
- color: var(--color-diff-removed-sign);
90
- }
@@ -1,187 +0,0 @@
1
- import { VisuallyHidden } from './chunk-RRRK2KB6.js';
2
- import { cx } from './chunk-ODEQTPFM.js';
3
- import './DiffView-ZI5C25Q3.css';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
-
6
- var DIFF_VIEW_LABELS = {
7
- skipped: (count) => count === 1 ? "1 unchanged line" : `${count.toLocaleString()} unchanged lines`,
8
- added: "Added",
9
- removed: "Removed",
10
- region: "Line changes"
11
- };
12
- function DiffView({ sections, labels: overrides, className, "aria-label": ariaLabel, ...rest }) {
13
- const labels = overrides ? { ...DIFF_VIEW_LABELS, ...overrides } : DIFF_VIEW_LABELS;
14
- return /* @__PURE__ */ jsx("div", { ...rest, role: "group", "aria-label": ariaLabel ?? labels.region, className: cx("crewlet-diff-view", className), children: sections.map((section, s) => (
15
- // A section has no identity of its own: a diff is computed whole, so
16
- // its position is what tells two sections apart.
17
- /* @__PURE__ */ jsxs("div", { className: "crewlet-diff-view__section", children: [
18
- section.skipped > 0 && /* @__PURE__ */ jsx("div", { className: "crewlet-diff-view__skip", children: labels.skipped(section.skipped) }),
19
- section.lines.map((line, i) => (
20
- // THE CLASS NAMES ARE LITERALS, never assembled from the value: a
21
- // stylesheet gate that cannot see a class cannot tell a rule this
22
- // file relies on from one nothing uses.
23
- /* @__PURE__ */ jsxs(
24
- "div",
25
- {
26
- className: cx(
27
- "crewlet-diff-view__line",
28
- line.kind === "add" && "crewlet-diff-view__line--add",
29
- line.kind === "remove" && "crewlet-diff-view__line--remove"
30
- ),
31
- children: [
32
- /* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__number", "aria-hidden": "true", children: line.before ?? "" }),
33
- /* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__number", "aria-hidden": "true", children: line.after ?? "" }),
34
- /* @__PURE__ */ jsxs("span", { className: "crewlet-diff-view__mark", children: [
35
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: line.kind === "add" ? "+" : line.kind === "remove" ? "\u2212" : " " }),
36
- line.kind === "add" && /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.added }),
37
- line.kind === "remove" && /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.removed })
38
- ] }),
39
- /* @__PURE__ */ jsx("span", { className: "crewlet-diff-view__text", children: line.text || " " })
40
- ]
41
- },
42
- i
43
- )
44
- ))
45
- ] }, s)
46
- )) });
47
- }
48
- var DIFF_SUMMARY_LABELS = {
49
- spoken: (added, removed) => `${added === 1 ? "1 line" : `${added.toLocaleString()} lines`} added, ${removed.toLocaleString()} removed`,
50
- against: (what) => `against ${what}`
51
- };
52
- function DiffSummary({ added, removed, against, labels: overrides, className, ...rest }) {
53
- const labels = overrides ? { ...DIFF_SUMMARY_LABELS, ...overrides } : DIFF_SUMMARY_LABELS;
54
- return /* @__PURE__ */ jsxs("p", { ...rest, className: cx("crewlet-diff-summary", className), children: [
55
- /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
56
- /* @__PURE__ */ jsxs("span", { className: "crewlet-diff-summary__added", children: [
57
- "+",
58
- added.toLocaleString()
59
- ] }),
60
- " ",
61
- /* @__PURE__ */ jsx("span", { className: "crewlet-diff-summary__removed", children: `\u2212${removed.toLocaleString()}` })
62
- ] }),
63
- /* @__PURE__ */ jsx(VisuallyHidden, { children: labels.spoken(added, removed) }),
64
- against !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
65
- " ",
66
- labels.against(against)
67
- ] })
68
- ] });
69
- }
70
-
71
- // src/DiffView/diff.ts
72
- var MAX_DIFF_LINES = 2e3;
73
- function splitLines(text) {
74
- const normalised = (text ?? "").replace(/\r\n?/g, "\n");
75
- if (normalised === "") return [];
76
- return normalised.replace(/\n$/, "").split("\n");
77
- }
78
- function diffLines(before, after) {
79
- const a = splitLines(before);
80
- const b = splitLines(after);
81
- if (a.length > MAX_DIFF_LINES || b.length > MAX_DIFF_LINES) {
82
- return [
83
- ...a.map((text, i) => ({ kind: "remove", text, before: i + 1, after: null })),
84
- ...b.map((text, i) => ({ kind: "add", text, before: null, after: i + 1 }))
85
- ];
86
- }
87
- return walk(a, b, common(a, b));
88
- }
89
- function diffStat(diff) {
90
- let added = 0;
91
- let removed = 0;
92
- for (const line of diff) {
93
- if (line.kind === "add") added++;
94
- if (line.kind === "remove") removed++;
95
- }
96
- return { added, removed, identical: added === 0 && removed === 0 };
97
- }
98
- function collapseDiff(diff, context = 3) {
99
- const keep = new Array(diff.length).fill(false);
100
- diff.forEach((line, i) => {
101
- if (line.kind === "same") return;
102
- for (let k = Math.max(0, i - context); k <= Math.min(diff.length - 1, i + context); k++) {
103
- keep[k] = true;
104
- }
105
- });
106
- const out = [];
107
- let skipped = 0;
108
- let current = null;
109
- diff.forEach((line, i) => {
110
- if (keep[i]) {
111
- if (!current) {
112
- current = [];
113
- out.push({ lines: current, skipped });
114
- skipped = 0;
115
- }
116
- current.push(line);
117
- return;
118
- }
119
- skipped++;
120
- current = null;
121
- });
122
- return out;
123
- }
124
- function firstChangedLines(sections, max) {
125
- const out = [];
126
- let shown = 0;
127
- let more = 0;
128
- for (const section of sections) {
129
- const kept = [];
130
- for (const line of section.lines) {
131
- const changed = line.kind !== "same";
132
- if (shown >= max) {
133
- if (changed) more++;
134
- continue;
135
- }
136
- if (changed) shown++;
137
- kept.push(line);
138
- }
139
- if (kept.length > 0) out.push({ lines: kept, skipped: section.skipped });
140
- }
141
- return { sections: out, more };
142
- }
143
- function common(a, b) {
144
- const table = [];
145
- for (let i = 0; i <= a.length; i++) table.push(new Uint32Array(b.length + 1));
146
- for (let i = a.length - 1; i >= 0; i--) {
147
- const row = table[i];
148
- const next = table[i + 1];
149
- for (let j = b.length - 1; j >= 0; j--) {
150
- row[j] = a[i] === b[j] ? next[j + 1] + 1 : Math.max(next[j], row[j + 1]);
151
- }
152
- }
153
- return table;
154
- }
155
- function walk(a, b, table) {
156
- const out = [];
157
- let i = 0;
158
- let j = 0;
159
- while (i < a.length && j < b.length) {
160
- if (a[i] === b[j]) {
161
- out.push({ kind: "same", text: a[i], before: i + 1, after: j + 1 });
162
- i++;
163
- j++;
164
- continue;
165
- }
166
- const down = table[i + 1][j];
167
- const right = table[i][j + 1];
168
- if (down >= right) {
169
- out.push({ kind: "remove", text: a[i], before: i + 1, after: null });
170
- i++;
171
- } else {
172
- out.push({ kind: "add", text: b[j], before: null, after: j + 1 });
173
- j++;
174
- }
175
- }
176
- while (i < a.length) {
177
- out.push({ kind: "remove", text: a[i], before: i + 1, after: null });
178
- i++;
179
- }
180
- while (j < b.length) {
181
- out.push({ kind: "add", text: b[j], before: null, after: j + 1 });
182
- j++;
183
- }
184
- return out;
185
- }
186
-
187
- export { DIFF_SUMMARY_LABELS, DIFF_VIEW_LABELS, DiffSummary, DiffView, MAX_DIFF_LINES, collapseDiff, diffLines, diffStat, firstChangedLines, splitLines };
@@ -1,5 +1,5 @@
1
- import { richEditorLabels } from './chunk-2DMTW2Y3.js';
2
1
  import { schema, readMarkdown, writeMarkdown } from './chunk-7CSTEH5I.js';
2
+ import { richEditorLabels } from './chunk-2DMTW2Y3.js';
3
3
  import './chunk-KOJPDCGQ.js';
4
4
  import { Toolbar } from './chunk-NPEI2QAN.js';
5
5
  import { safeHref, MARKDOWN_CALLOUT_TONES } from './chunk-KBZO4B33.js';