@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/README.md CHANGED
@@ -46,7 +46,7 @@ import { Button } from '@crewlethq/ui/Button'; // 8 KB of CSS, not 182 KB
46
46
  | Data display | `DataGrid` (with `useDataGridDriving`, `useAnyDataGridDriving` and `countDataGridRows`), `DataTable`, `CopyableCell`, `Table`, the read-only table cells (`TableKeyCell`, `TableNumberCell`, `TableDateCell`, `TableEntityCell`, `TableStatusCell`, `TableTagsCell`, `TableTextCell`, `TableTwoLineCell`), `StatCard`, `Meter`, `SegmentedMeter`, `Stepper`, `PricingCard`, `Avatar`, `AvatarStack`, `EntityChip`, `CodeBlock`, `QrCode`, `ObjectHeader`, `FactLine`, `SetByLine` (set, seen, observed or confirmed by, with `SET_BY_VERBS`), `GraphCanvas` (a layered map of clusters, groups and three families of line, with its legend, the card beside an entry, the selection dock and fullscreen, its pure layout `layoutGraph`, the trunks `graphTrunks`, the reach `graphReach` and the keyboard walk `graphStep`), `Skeleton`, `Eyebrow`, `StatGroup`, `PinTile`, `IconTile`, `SettingsTable` (with `SettingsTable.Row`), `CatalogTile` |
47
47
  | List screens | `DataView`, and its parts on their own: `DataViewToolbar`, `FilterAxisBar`, `FilterAxisChip`, `FilterPill`, plus the filter model (`filterDefsFromColumns`, `applyColumnFilters`, `filterPredicate`, `blankFilterValue`) |
48
48
  | Feedback and overlays | `Callout`, `NoticeList` and `groupNotices` (several notices from one source, each said once), `AttentionList` (what needs a person, as rows in one card), `ConflictNote`, `EditingStatus`, `Toaster`, `Modal` (with `variant="sheet"`), `ConfirmModal`, `CommandPalette`, `Tooltip`, `Popover`, `Announcer` |
49
- | Documents and review | `DiffView` and `DiffSummary` with the line diff they draw (`diffLines`, `diffStat`, `collapseDiff`, `firstChangedLines`, `splitLines`, `MAX_DIFF_LINES`, with no React in it), `DiffList`, `VersionCompare`, `CommentThread` |
49
+ | Documents and review | `DiffView` and `DiffSummary` with the line diff they draw (`compareLines`, `compareSequences`, `changedRuns`, `diffStat`, `collapseDiff`, `firstChangedLines`, `splitLines`, with no React in it), `DiffList`, `VersionCompare`, `CommentThread` |
50
50
  | Conversations and the assistant | `ChatThread` (with `ChatThreadHandle`), `ChatMessage` and `ChatMessageFailure`, `MessageActions` (with `MessageAction`, `QuickReaction` and `ActionDivider`), `ReactionBar` and `AddReaction` (with `reactionWho`), `EmojiPicker` (with `EMOJI_GROUPS`, `emojiName` and `searchEmoji`), `ThreadSummary`, `ActivityLine`, `WorkingLine` (every agent at work on one line, with `workingSentence`, `workingAnnouncement` and `BouncingDots`), `MentionChip`, `MessageBubble`, `RunChip`, `StepList` and `StepStateMark`, `ProposalCard`, `ChangeList` (with `shortenUnchanged`), `StatusCard`, `ReceiptStrip`, `RefusalStrip`, `ResultTableCard`, `OpenInAppCard`, `BriefCard` (with `points`, what was said, each citing its message), `EntityList`, `RecordChip` and `RecordChipList` (a record named in a sentence, opening a peek, and the Also read line), `RefusalCard`, `SuggestionRow` and `SuggestionList`, `SendButton`, a transcript's timeline (`ChatDay` with `ChatDayPill`, `ChatDivider`), `LinkCard` (a link unfurled under its message), `MentionMenu` (with `mentionQuery`), `ActionCard` and `ActionCardRow` |
51
51
  | Charts | `Legend`, `BarList`, `StackedBar`, `StackedColumns`, `StackedRing`, `ActivityStrip`, `TimeSeries`, `Sparkline` (with its `fine` weight), the reading layer they share (`ChartTooltip`, `useChartHover`), and the ramp (`DATA_COLORS`, `DATA_COLOR_OTHER`, `dataColor`) |
52
52
  | Marks | `Count` (with `tone="attention"`), `StatusDot`, `Spinner`, `EmptyValue`, `VisuallyHidden` |
@@ -208,6 +208,14 @@ places:
208
208
  - A surface that pans or zooms dispatches `LAYER_REPOSITION_EVENT` on its host
209
209
  when the content beneath it moves, and every panel anchored inside follows.
210
210
 
211
+ ## Changes in 0.153.0
212
+
213
+ ### Every line diff is tinted, compared honestly and written on
214
+
215
+ - **`DiffView` tints every diff** (`--color-diff-*`: green and red rows, the numbers on a band in the sign ink, an edited run on its word tint), keeps the glyph and the word, and clears 4.5:1 on every tint; `DiffSummary` and `DiffList` take the same tokens.
216
+ - **`DiffView` compares two texts itself** (`before`, `after`, `context`; `compareLines`, Myers, bounded by `MAX_COMPARE_LINES` and `MAX_EDITS`, a sentence in place of the rows past them) and takes keyed lines (`path`), `layout="split"`, `against`, `empty`, `notes`, `onPick`, `picked`, `reveal` and `tokens`, windowed past `WINDOW_FROM_ROWS` rows.
217
+ - **Breaking:** `diffLines` and `MAX_DIFF_LINES` are gone (they drew a whole replacement past 2,000 lines); use `compareLines` or hand `DiffView` the texts. `DiffSection.lines` is read-only and `DiffLine` takes an optional `path`.
218
+
211
219
  ## Changes in 0.151.0
212
220
 
213
221
  ### A standing advisory rests as one line
@@ -1,5 +1,5 @@
1
- export { CHANGE_LIST_COLLAPSE_OVER, CHANGE_LIST_LABELS, ChangeList, ChangeListItems, shortenUnchanged } from '../chunk-NB53SAL4.js';
2
- import '../chunk-RGJB34YN.js';
1
+ export { CHANGE_LIST_COLLAPSE_OVER, CHANGE_LIST_LABELS, ChangeList, ChangeListItems, shortenUnchanged } from '../chunk-NOZD547E.js';
2
+ import '../chunk-7XUP32RY.js';
3
3
  import '../chunk-SJ3EUCFD.js';
4
4
  import '../chunk-QRE6JCHS.js';
5
5
  import '../chunk-D5O64CVE.js';
@@ -1,3 +1,3 @@
1
- export { DIFF_LIST_LABELS, DiffList } from '../chunk-RGJB34YN.js';
1
+ export { DIFF_LIST_LABELS, DiffList } from '../chunk-7XUP32RY.js';
2
2
  import '../chunk-RRRK2KB6.js';
3
3
  import '../chunk-ODEQTPFM.js';
@@ -1,8 +1,7 @@
1
1
  /* DiffList: one path per row, with its mark, its word and its tint.
2
2
 
3
- The tint is the soft step of the state the row is in and the text is the
4
- matching ink step, which is the pairing the palette suite measures: a fill
5
- is never text and an ink step is never a background. */
3
+ An added or removed row takes the diff family's row and sign, as a line of
4
+ DiffView does; a changed one the warning soft step and its ink. */
6
5
  /*
7
6
  * HALF A STEP, between the rows and inside them. A diff row is a LINE OF A
8
7
  * DOCUMENT rather than an item in a list: at the full 4px step a fifty-line
@@ -35,13 +34,13 @@
35
34
  this replaces read add, remove and replace, which no answer has ever
36
35
  carried, so every diff row rendered untinted. */
37
36
  .crewlet-diff-list__row--added {
38
- background: var(--color-feedback-success-soft);
39
- color: var(--color-feedback-success-ink);
37
+ background: var(--color-diff-added-row);
38
+ color: var(--color-diff-added-sign);
40
39
  }
41
40
 
42
41
  .crewlet-diff-list__row--removed {
43
- background: var(--color-feedback-danger-soft);
44
- color: var(--color-feedback-danger-ink);
42
+ background: var(--color-diff-removed-row);
43
+ color: var(--color-diff-removed-sign);
45
44
  }
46
45
 
47
46
  .crewlet-diff-list__row--changed {
@@ -1,6 +1,15 @@
1
- import type { HTMLAttributes } from 'react';
2
- import type { DiffSection } from './diff.js';
3
- export interface DiffViewLabels {
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ import type { DiffLine, DiffSection } from './diff.js';
3
+ import { type Uncompared } from './lineDiff.js';
4
+ import { type DiffSpan } from './wordDiff.js';
5
+ export interface DiffSummaryLabels {
6
+ /** Read in place of the drawn counts: "3 lines added, 1 removed". */
7
+ spoken: (added: number, removed: number) => string;
8
+ /** What the counts are measured against: "against version 4". */
9
+ against: (what: string) => string;
10
+ }
11
+ export declare const DIFF_SUMMARY_LABELS: DiffSummaryLabels;
12
+ export interface DiffViewLabels extends DiffSummaryLabels {
4
13
  /** The row a dropped run of unchanged lines is drawn as: "12 unchanged lines". */
5
14
  skipped: (count: number) => string;
6
15
  /** Read in place of the `+` mark on an added line. */
@@ -9,39 +18,57 @@ export interface DiffViewLabels {
9
18
  removed: string;
10
19
  /** The region's accessible name when the caller gives none. */
11
20
  region: string;
21
+ /** Said in place of the diff when nothing changed and the host gives no `empty`. */
22
+ empty: string;
23
+ /** Said in place of every row when two texts were not compared. */
24
+ notCompared: (why: Uncompared) => string;
25
+ /** A pickable line number's name: "Line 12: pick it". */
26
+ pick: (line: DiffLine) => string;
12
27
  }
13
28
  export declare const DIFF_VIEW_LABELS: DiffViewLabels;
14
- export interface DiffViewProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
15
- /**
16
- * The lines to draw, grouped into sections with the count of unchanged
17
- * lines dropped before each: `collapseDiff(diffLines(before, after))`, or
18
- * sections a host computed some other way.
19
- */
29
+ /** How the two sides are laid out. */
30
+ export type DiffLayout = 'unified' | 'split';
31
+ /** Sections a host computed, or two texts the diff compares by line. */
32
+ type DiffSource = {
20
33
  sections: readonly DiffSection[];
34
+ before?: undefined;
35
+ after?: undefined;
36
+ context?: undefined;
37
+ } | {
38
+ before: string;
39
+ after: string;
40
+ /** Unchanged lines kept either side of a change: three when unset. */
41
+ context?: number | undefined;
42
+ sections?: undefined;
43
+ };
44
+ export type DiffViewProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & DiffSource & {
45
+ /** Unified by default; split only where the diff is at least the phone breakpoint wide. */
46
+ layout?: DiffLayout | undefined;
47
+ /** What the counts above the diff are measured against ("rev 12"); left out, no counts are drawn. */
48
+ against?: string | undefined;
49
+ /** Drawn in place of the diff when nothing changed. */
50
+ empty?: ReactNode;
51
+ /** What a host draws under a line (a finding, a thread); asked only for the rows drawn. */
52
+ notes?: ((line: DiffLine) => ReactNode) | undefined;
53
+ /** With it, each line's own number is a button that picks the line; Shift extends the pick. */
54
+ onPick?: ((line: DiffLine, extend: boolean) => void) | undefined;
55
+ /** Whether the host has picked a line, which is drawn marked. */
56
+ picked?: ((line: DiffLine) => boolean) | undefined;
57
+ /** The line to bring into view once, wherever the window is; a new predicate is a new reveal. */
58
+ reveal?: ((line: DiffLine) => boolean) | undefined;
59
+ /** A line's coloured spans (its syntax), by the side it is read from and its number there. */
60
+ tokens?: ((side: 'before' | 'after', n: number) => readonly DiffSpan[] | null) | undefined;
21
61
  labels?: Partial<DiffViewLabels> | undefined;
22
- }
62
+ };
63
+ /** Rows a diff draws before only the blocks near the view hold theirs. */
64
+ export declare const WINDOW_FROM_ROWS = 1000;
65
+ /** Rows a window block holds. */
66
+ export declare const WINDOW_BLOCK_ROWS = 100;
23
67
  /**
24
- * A line diff, rendered as the document it is.
25
- *
26
- * MONOSPACE AND LINE-NUMBERED on both sides, because the two numbers are what
27
- * a reader uses to find the paragraph in the version beside it. A skipped run
28
- * is a row of its own saying how many lines it stands for: a gap silently
29
- * closed makes a document edited at both ends look like one rewritten in the
30
- * middle.
31
- *
32
- * COLOUR IS NEVER THE ONLY SIGNAL. An added or removed line carries a tint, a
33
- * drawn mark and a word: the mark is hidden from assistive technology and the
34
- * word ("Added", "Removed") is read in its place, because a minus sign is
35
- * announced as anything from "minus" to nothing at all.
68
+ * A line diff on the diff family's tints, each line also marked by a glyph and
69
+ * a word; handed two texts it compares them, and says when it did not.
36
70
  */
37
- export declare function DiffView({ sections, labels: overrides, className, 'aria-label': ariaLabel, ...rest }: DiffViewProps): import("react").JSX.Element;
38
- export interface DiffSummaryLabels {
39
- /** Read in place of the drawn counts: "3 lines added, 1 removed". */
40
- spoken: (added: number, removed: number) => string;
41
- /** What the counts are measured against: "against version 4". */
42
- against: (what: string) => string;
43
- }
44
- export declare const DIFF_SUMMARY_LABELS: DiffSummaryLabels;
71
+ export declare function DiffView(props: DiffViewProps): import("react").JSX.Element;
45
72
  export interface DiffSummaryProps extends Omit<HTMLAttributes<HTMLParagraphElement>, 'children'> {
46
73
  added: number;
47
74
  removed: number;
@@ -50,10 +77,8 @@ export interface DiffSummaryProps extends Omit<HTMLAttributes<HTMLParagraphEleme
50
77
  labels?: Partial<DiffSummaryLabels> | undefined;
51
78
  }
52
79
  /**
53
- * The one line above a diff that says how big it is: `+3 −1 against version 4`.
54
- *
55
- * The drawn counts are tinted with the same inks as the lines they count, and
56
- * a sentence is read in their place, so the size of the change never rests on
57
- * a plus sign and a colour.
80
+ * The one line above a diff that says how big it is: `+3 −1 against version 4`,
81
+ * the counts in the diff family's sign inks and a sentence read in their place.
58
82
  */
59
83
  export declare function DiffSummary({ added, removed, against, labels: overrides, className, ...rest }: DiffSummaryProps): import("react").JSX.Element;
84
+ export {};
@@ -1,23 +1,9 @@
1
1
  /**
2
- * What changed between two versions of a document, by line.
3
- *
4
- * OVER LINES, by the classic longest-common-subsequence table. The shape is
5
- * the one a prose document wants: a paragraph somebody rewrote is a line
6
- * replaced, not thirty character edits scattered through it. Word-level
7
- * refinement inside a changed line is deliberately absent: it makes a small
8
- * edit prettier and a large one unreadable, and documents are rewritten in
9
- * paragraphs.
10
- *
11
- * THE TABLE RATHER THAN MYERS, and [MAX_DIFF_LINES] is what pays for that
12
- * choice. The table is quadratic on every input, but it is a dozen lines
13
- * anybody can check by reading; the cap keeps the quadratic term small, and a
14
- * document past it is reported as a whole replacement rather than freezing the
15
- * tab.
16
- *
17
- * FRAMEWORK FREE. Nothing here imports React, so a host can compute a diff in
18
- * a worker or a test and hand the sections to [DiffView].
2
+ * The shapes a line diff is drawn from, and what a host does with them: count
3
+ * a diff, collapse a whole one to its changes, or cut a preview. Two texts are
4
+ * compared by [compareLines] (`lineDiff.ts`). Framework free.
19
5
  */
20
- /** One line of the result. `same` lines carry both numbers. */
6
+ /** One line of a diff. `same` lines carry both numbers. */
21
7
  export interface DiffLine {
22
8
  kind: 'same' | 'add' | 'remove';
23
9
  text: string;
@@ -25,6 +11,8 @@ export interface DiffLine {
25
11
  before: number | null;
26
12
  /** 1-based line number in the NEW document, or null on a removal. */
27
13
  after: number | null;
14
+ /** Where a setting is (a configuration path, a file): a keyed diff draws it in place of the numbers. */
15
+ path?: string | undefined;
28
16
  }
29
17
  /** What a diff amounts to, for a one-line summary above it. */
30
18
  export interface DiffStat {
@@ -40,35 +28,15 @@ export interface DiffStat {
40
28
  */
41
29
  export interface DiffSection {
42
30
  /** The lines of this section, in order. */
43
- lines: DiffLine[];
31
+ lines: readonly DiffLine[];
44
32
  /** How many unchanged lines were dropped BEFORE this section. */
45
33
  skipped: number;
46
34
  }
47
35
  /**
48
- * The size past which the table is not worth building.
49
- *
50
- * SIZED FROM THE TABLE'S MEMORY, because that is the quantity that binds and
51
- * it is paid on every input: `(N+1)` rows of `(M+1)` `Uint32` entries, every
52
- * cell filled. At two thousand lines that is about 16 MB and 60 ms, which a
53
- * tab holds without noticing; at ten thousand it is hundreds of megabytes and
54
- * seconds on the main thread. Raising it means replacing the table with Myers
55
- * or Hirschberg first.
56
- */
57
- export declare const MAX_DIFF_LINES = 2000;
58
- /**
59
- * Split a document into the lines a diff compares.
60
- *
61
- * A trailing newline is not a line. Every file that ends properly has one, so
62
- * counting it would report an added last line on every document that gained
63
- * one. Both line endings read as one.
36
+ * Split a text into the lines a diff compares: every line ending ends one, and
37
+ * a final newline ends the last line rather than starting another.
64
38
  */
65
39
  export declare function splitLines(text: string): string[];
66
- /**
67
- * The line diff of two documents: every line of the result in order, context
68
- * included, because a document diff is read as a document rather than as a
69
- * patch.
70
- */
71
- export declare function diffLines(before: string, after: string): DiffLine[];
72
40
  /**
73
41
  * Count the additions and removals, and say when there are none: identical is
74
42
  * its own answer, not "0 added, 0 removed".
@@ -1,5 +1,9 @@
1
1
  import './DiffView.css';
2
- export { DiffView, DiffSummary, DIFF_VIEW_LABELS, DIFF_SUMMARY_LABELS } from './DiffView.js';
3
- export type { DiffViewLabels, DiffViewProps, DiffSummaryLabels, DiffSummaryProps } from './DiffView.js';
4
- export { MAX_DIFF_LINES, collapseDiff, diffLines, diffStat, firstChangedLines, splitLines } from './diff.js';
2
+ export { DiffView, DiffSummary, DIFF_VIEW_LABELS, DIFF_SUMMARY_LABELS, WINDOW_BLOCK_ROWS, WINDOW_FROM_ROWS, } from './DiffView.js';
3
+ export type { DiffLayout, DiffViewLabels, DiffViewProps, DiffSummaryLabels, DiffSummaryProps } from './DiffView.js';
4
+ export { collapseDiff, diffStat, firstChangedLines, splitLines } from './diff.js';
5
5
  export type { DiffLine, DiffSection, DiffStat } from './diff.js';
6
+ export { CONTEXT_LINES, MAX_COMPARE_LINES, MAX_EDITS, compareLines, compareSequences, distanceFloor, notComparedReason, } from './lineDiff.js';
7
+ export type { EditRun, LineComparison, Uncompared } from './lineDiff.js';
8
+ export { changedRuns, lineTokens, segments } from './wordDiff.js';
9
+ export type { ChangedRuns, DiffSpan, LineToken, Run, Segment } from './wordDiff.js';
@@ -1,3 +1,3 @@
1
- export { DIFF_SUMMARY_LABELS, DIFF_VIEW_LABELS, DiffSummary, DiffView, MAX_DIFF_LINES, collapseDiff, diffLines, diffStat, firstChangedLines, splitLines } from '../chunk-F4CM5KD3.js';
1
+ export { CONTEXT_LINES, DIFF_SUMMARY_LABELS, DIFF_VIEW_LABELS, DiffSummary, DiffView, MAX_COMPARE_LINES, MAX_EDITS, WINDOW_BLOCK_ROWS, WINDOW_FROM_ROWS, changedRuns, collapseDiff, compareLines, compareSequences, diffStat, distanceFloor, firstChangedLines, lineTokens, notComparedReason, segments, splitLines } from '../chunk-4YLN5QVL.js';
2
2
  import '../chunk-RRRK2KB6.js';
3
3
  import '../chunk-ODEQTPFM.js';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Two texts compared line by line: the shortest edit (Myers 1986) in linear
3
+ * space, bounded, and saying why when it did not compare ([Uncompared]).
4
+ */
5
+ import { type DiffSection } from './diff.js';
6
+ /**
7
+ * The most lines a comparison reads on a side of what changed. With [MAX_EDITS]
8
+ * it bounds the work: 20,000 lines a side with 4,000 edited took about 100 ms in
9
+ * Node 24 on a laptop core.
10
+ */
11
+ export declare const MAX_COMPARE_LINES = 20000;
12
+ /** The most lines removed and added before two texts are too different to compare. */
13
+ export declare const MAX_EDITS = 4000;
14
+ /** Unchanged lines kept either side of a change by default: git's own three. */
15
+ export declare const CONTEXT_LINES = 3;
16
+ /** Why two texts were not compared line by line. */
17
+ export type Uncompared =
18
+ /** What changed spans more lines a side than a comparison reads: `lines` is the longer side's. */
19
+ {
20
+ kind: 'too-large';
21
+ lines: number;
22
+ }
23
+ /** More than [MAX_EDITS] lines were removed and added between them. */
24
+ | {
25
+ kind: 'too-different';
26
+ };
27
+ /** Two texts compared: the changed runs with their context, none when the texts match, or why not. */
28
+ export type LineComparison = {
29
+ kind: 'compared';
30
+ sections: DiffSection[];
31
+ } | Uncompared;
32
+ /** One run of a comparison: lines both texts hold, or lines removed and added. */
33
+ export type EditRun = {
34
+ kind: 'same';
35
+ count: number;
36
+ } | {
37
+ kind: 'change';
38
+ removed: number;
39
+ added: number;
40
+ };
41
+ /** Compares `before` with `after` line by line, keeping `context` unchanged lines either side of each change. */
42
+ export declare function compareLines(before: string, after: string, context?: number): LineComparison;
43
+ /**
44
+ * The shortest edit turning `a` into `b` as runs front to back, or why it was
45
+ * not made: [compareLines]'s comparison over any sequence of strings, such as
46
+ * a page's blocks or a block's words.
47
+ */
48
+ export declare function compareSequences(a: readonly string[], b: readonly string[]): {
49
+ kind: 'compared';
50
+ runs: EditRun[];
51
+ } | Uncompared;
52
+ /** Why two texts were not compared, as the clause after "not compared line by line:". */
53
+ export declare function notComparedReason(why: Uncompared): string;
54
+ /**
55
+ * A floor under the lines removed and added that turn `a` into `b`: an
56
+ * alignment keeps a line no more often than the text holding it fewer times.
57
+ */
58
+ export declare function distanceFloor(a: ArrayLike<number>, b: ArrayLike<number>): number;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Where an edited line changed: the ONE run between what a removed line and
3
+ * its added line share at their start and at their end, in whole tokens. A
4
+ * word-by-word diff would mark every word the edit moved past.
5
+ */
6
+ /** A stretch of a line's text, as offsets into it: `start` inclusive, `end` exclusive. */
7
+ export interface Run {
8
+ start: number;
9
+ end: number;
10
+ }
11
+ /** What to underline on each line of a pair, or nothing on a side that only lost or gained. */
12
+ export interface ChangedRuns {
13
+ before: Run | null;
14
+ after: Run | null;
15
+ }
16
+ /** A token of a line; `word` when it holds a letter or a digit. */
17
+ export interface LineToken {
18
+ text: string;
19
+ start: number;
20
+ end: number;
21
+ word: boolean;
22
+ }
23
+ /** A line's tokens, in order, covering every character of it. */
24
+ export declare function lineTokens(text: string): LineToken[];
25
+ /**
26
+ * The run of `before` and of `after` that differ, when the two are one line
27
+ * edited. Two lines that share no word at their ends are two lines, and
28
+ * nothing is underlined.
29
+ */
30
+ export declare function changedRuns(before: string, after: string): ChangedRuns;
31
+ /** A host's run of a line's text, up to `end` (exclusive), drawn with `className`, or plain. */
32
+ export interface DiffSpan {
33
+ end: number;
34
+ className: string | null;
35
+ }
36
+ /** One piece of a drawn line: the changed run, or a stretch with its class or none. */
37
+ export interface Segment {
38
+ start: number;
39
+ end: number;
40
+ className: string | null;
41
+ run: boolean;
42
+ }
43
+ /**
44
+ * A line cut at its spans' ends and its run's edges, covering it in order. The
45
+ * run is one segment with no class: its text keeps the line's own ink on its tint.
46
+ */
47
+ export declare function segments(text: string, spans: readonly DiffSpan[] | null, run: Run | null): Segment[];
@@ -0,0 +1,224 @@
1
+ /* DiffView: a line diff in the diff family's colours, on every surface. A
2
+ changed line is said three ways, each enough alone: its tint, its glyph with
3
+ the word read in its place, and the underline on the run an edit changed. */
4
+ .crewlet-diff-view {
5
+ container: crewlet-diff-view / inline-size;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: var(--spacing-2);
9
+ min-width: 0;
10
+ }
11
+
12
+ /* The diff's own ground: the card rung, which the palette measures its tints over. */
13
+ .crewlet-diff-view__body {
14
+ overflow: hidden;
15
+ border: 1px solid var(--color-border-default);
16
+ border-radius: var(--radius-sm);
17
+ background: var(--color-surface-subtle);
18
+ color: var(--color-text-primary);
19
+ font-family: var(--font-family-mono);
20
+ font-size: var(--font-size-compact);
21
+ line-height: var(--font-line-height-body);
22
+ }
23
+
24
+ /* A line's tracks: numbers (or a path), the mark, the text. Widths come from
25
+ the counts the component publishes, so every window block lands on them. */
26
+ .crewlet-diff-view__line {
27
+ display: grid;
28
+ grid-template-columns: 2ch minmax(0, 1fr);
29
+ column-gap: var(--spacing-2);
30
+ padding: calc(var(--spacing-1) / 4) var(--spacing-3) calc(var(--spacing-1) / 4) var(--spacing-2);
31
+ }
32
+
33
+ .crewlet-diff-view--numbered .crewlet-diff-view__line {
34
+ --crewlet-diff-gutter: calc(var(--spacing-2) * 2.5 + var(--crewlet-diff-digits) * 2ch);
35
+
36
+ grid-template-columns: calc(var(--crewlet-diff-digits) * 1ch) calc(var(--crewlet-diff-digits) * 1ch) 2ch minmax(0, 1fr);
37
+ }
38
+
39
+ .crewlet-diff-view--numbered.crewlet-diff-view--split .crewlet-diff-view__line {
40
+ --crewlet-diff-gutter: calc(var(--spacing-2) * 1.5 + var(--crewlet-diff-digits) * 1ch);
41
+
42
+ grid-template-columns: calc(var(--crewlet-diff-digits) * 1ch) 2ch minmax(0, 1fr);
43
+ }
44
+
45
+ /* A path takes up to 40% of the line; the value keeps its own track, so a
46
+ line that continues the setting above (and draws no path) lines up under it. */
47
+ .crewlet-diff-view--keyed .crewlet-diff-view__line {
48
+ grid-template-columns: 2ch min(calc(var(--crewlet-diff-path) * 1ch), 40%) minmax(0, 1fr);
49
+ }
50
+
51
+ .crewlet-diff-view--keyed .crewlet-diff-view__text {
52
+ grid-column: 3;
53
+ }
54
+
55
+ /* The tints, with the numbers on a band in the sign's ink. The band is an
56
+ inset shadow, so forced colours drop it with the tint and keep the glyph. */
57
+ .crewlet-diff-view__line--add {
58
+ background: var(--color-diff-added-row);
59
+ box-shadow: inset var(--crewlet-diff-gutter, 0) 0 0 var(--color-diff-added-gutter);
60
+ }
61
+
62
+ .crewlet-diff-view__line--remove {
63
+ background: var(--color-diff-removed-row);
64
+ box-shadow: inset var(--crewlet-diff-gutter, 0) 0 0 var(--color-diff-removed-gutter);
65
+ }
66
+
67
+ .crewlet-diff-view__number {
68
+ color: var(--color-text-tertiary);
69
+ text-align: right;
70
+ font-variant-numeric: tabular-nums;
71
+ user-select: none;
72
+ }
73
+
74
+ .crewlet-diff-view__line--add .crewlet-diff-view__mark,
75
+ .crewlet-diff-view__line--add .crewlet-diff-view__number {
76
+ color: var(--color-diff-added-sign);
77
+ }
78
+
79
+ .crewlet-diff-view__line--remove .crewlet-diff-view__mark,
80
+ .crewlet-diff-view__line--remove .crewlet-diff-view__number {
81
+ color: var(--color-diff-removed-sign);
82
+ }
83
+
84
+ /* A number that picks its line: the number, pressable, its underline answering the pointer. */
85
+ .crewlet-diff-view__pick {
86
+ padding: 0;
87
+ border: 0;
88
+ background: none;
89
+ font: inherit;
90
+ cursor: pointer;
91
+ }
92
+
93
+ .crewlet-diff-view__pick:hover {
94
+ text-decoration-line: underline;
95
+ }
96
+
97
+ /* A picked line: the selected tint in place of its tints and band, an accent
98
+ bar at its start; its glyph and its run's underline stay. */
99
+ .crewlet-diff-view__line--picked {
100
+ background: var(--color-surface-selected);
101
+ box-shadow: inset 2px 0 0 var(--color-brand-accent);
102
+ outline: 2px solid transparent;
103
+ outline-offset: -2px;
104
+ }
105
+
106
+ .crewlet-diff-view__line--picked .crewlet-diff-view__number {
107
+ color: var(--color-text-tertiary);
108
+ }
109
+
110
+ .crewlet-diff-view__mark {
111
+ color: var(--color-text-secondary);
112
+ text-align: center;
113
+ user-select: none;
114
+ }
115
+
116
+ .crewlet-diff-view__path {
117
+ min-width: 0;
118
+ overflow-wrap: anywhere;
119
+ }
120
+
121
+ /* Nothing is cut: a line wraps and keeps its own spacing. */
122
+ .crewlet-diff-view__text {
123
+ min-width: 0;
124
+ white-space: pre-wrap;
125
+ overflow-wrap: anywhere;
126
+ }
127
+
128
+ /* Where an edited line changed: its word tint under the line's own ink, underlined. */
129
+ .crewlet-diff-view__run {
130
+ text-decoration-line: underline;
131
+ text-decoration-thickness: from-font;
132
+ text-underline-position: under;
133
+ }
134
+
135
+ .crewlet-diff-view__line--add .crewlet-diff-view__run {
136
+ background: var(--color-diff-added-word);
137
+ color: var(--color-text-primary);
138
+ }
139
+
140
+ .crewlet-diff-view__line--remove .crewlet-diff-view__run {
141
+ background: var(--color-diff-removed-word);
142
+ color: var(--color-text-primary);
143
+ }
144
+
145
+ .crewlet-diff-view__line--picked .crewlet-diff-view__run {
146
+ background: none;
147
+ }
148
+
149
+ /* What a host draws under a line, on the diff's ground in the body's face. */
150
+ .crewlet-diff-view__notes {
151
+ display: flex;
152
+ flex-direction: column;
153
+ gap: var(--spacing-2);
154
+ padding: var(--spacing-2) var(--spacing-3);
155
+ border-block: 1px solid var(--color-border-default);
156
+ font-family: var(--font-family-sans);
157
+ }
158
+
159
+ /* A gap says what it stands for, on the hunk row. */
160
+ .crewlet-diff-view__skip {
161
+ padding: var(--spacing-1) var(--spacing-3);
162
+ border-block: 1px solid var(--color-border-default);
163
+ background: var(--color-diff-hunk-row);
164
+ color: var(--color-text-tertiary);
165
+ font-family: var(--font-family-sans);
166
+ font-size: var(--font-size-xs);
167
+ }
168
+
169
+ .crewlet-diff-view__block:first-child > .crewlet-diff-view__skip:first-child {
170
+ border-block-start: none;
171
+ }
172
+
173
+ /* Split: the older text on the left, the newer on the right. */
174
+ .crewlet-diff-view__pair {
175
+ display: grid;
176
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
177
+ }
178
+
179
+ .crewlet-diff-view__pair > :last-child {
180
+ border-inline-start: 1px solid var(--color-border-default);
181
+ }
182
+
183
+ /* A comparison not made is said in place of every row; "Nothing changed" is quieter. */
184
+ .crewlet-diff-view__said {
185
+ margin: 0;
186
+ color: var(--color-text-secondary);
187
+ font-size: var(--font-size-compact);
188
+ }
189
+
190
+ .crewlet-diff-view__said--quiet {
191
+ color: var(--color-text-tertiary);
192
+ }
193
+
194
+ /* On a narrow diff a setting's value takes the row under its path. */
195
+ @container crewlet-diff-view (width < 640px) {
196
+ .crewlet-diff-view--keyed .crewlet-diff-view__line {
197
+ grid-template-columns: 2ch minmax(0, 1fr);
198
+ }
199
+
200
+ .crewlet-diff-view--keyed .crewlet-diff-view__text {
201
+ grid-column: 2;
202
+ }
203
+ }
204
+
205
+ /* DiffSummary: the size of the change, in the same inks as its lines. */
206
+ .crewlet-diff-summary {
207
+ margin: 0;
208
+ color: var(--color-text-secondary);
209
+ font-size: var(--font-size-compact);
210
+ }
211
+
212
+ .crewlet-diff-summary__added,
213
+ .crewlet-diff-summary__removed {
214
+ font-family: var(--font-family-mono);
215
+ font-variant-numeric: tabular-nums;
216
+ }
217
+
218
+ .crewlet-diff-summary__added {
219
+ color: var(--color-diff-added-sign);
220
+ }
221
+
222
+ .crewlet-diff-summary__removed {
223
+ color: var(--color-diff-removed-sign);
224
+ }
@@ -3,12 +3,12 @@ import '../chunk-KOJPDCGQ.js';
3
3
  import '../chunk-VRVNLJUA.js';
4
4
  import '../chunk-OAD4AXYJ.js';
5
5
  import '../chunk-NWKH5FF7.js';
6
- import '../chunk-KBZO4B33.js';
7
6
  import '../chunk-SJ3EUCFD.js';
8
7
  import '../chunk-E7KRB77B.js';
9
8
  import '../chunk-AV2DXAEL.js';
10
9
  import '../chunk-475DOAWF.js';
11
10
  import '../chunk-WSIJDWUG.js';
11
+ import '../chunk-KBZO4B33.js';
12
12
  import '../chunk-QRE6JCHS.js';
13
13
  import '../chunk-IMF3CPTY.js';
14
14
  import '../chunk-XSPCITPN.js';
@@ -1,7 +1,7 @@
1
- export { PROPOSAL_CARD_LABELS, PROPOSAL_FAILURE_OUTCOMES, PROPOSAL_STATES, PROPOSAL_TONES, ProposalCard } from '../chunk-5DLBGF6I.js';
1
+ export { PROPOSAL_CARD_LABELS, PROPOSAL_FAILURE_OUTCOMES, PROPOSAL_STATES, PROPOSAL_TONES, ProposalCard } from '../chunk-2YAK37D6.js';
2
2
  import '../chunk-OAD4AXYJ.js';
3
- import '../chunk-NB53SAL4.js';
4
- import '../chunk-RGJB34YN.js';
3
+ import '../chunk-NOZD547E.js';
4
+ import '../chunk-7XUP32RY.js';
5
5
  import '../chunk-NWKH5FF7.js';
6
6
  import '../chunk-CWACQEPP.js';
7
7
  import '../chunk-SJ3EUCFD.js';
@@ -2,8 +2,8 @@ export { RAIL_LIST_LABELS, RailList } from '../chunk-ECYA6XZL.js';
2
2
  import '../chunk-TTUFOH2Y.js';
3
3
  import '../chunk-657WR3MX.js';
4
4
  import '../chunk-6KWNXIDE.js';
5
- import '../chunk-KW7T23RT.js';
6
5
  import '../chunk-TODOBUXO.js';
6
+ import '../chunk-KW7T23RT.js';
7
7
  import '../chunk-HBDA76EZ.js';
8
8
  import '../chunk-E7KRB77B.js';
9
9
  import '../chunk-AV2DXAEL.js';