Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6bf145b
chore: empty commit for beta branch
amadeus May 29, 2026
a398bb4
Editor (#601)
ije May 29, 2026
78711c6
chore: update @pierre/diffs to `1.3.0-beta.1`
amadeus May 29, 2026
5d35148
chore: update @pierre/diffs to `1.3.0-beta.2`
amadeus Jun 1, 2026
4d9640f
feat(editor): Add rounded selection (#757)
ije Jun 2, 2026
e3696fa
refactor(editor): refactor search panel (#759)
ije Jun 2, 2026
ce71db5
feat(editor): add pause and resume functionality for background token…
ije Jun 2, 2026
880b2b2
pref(editor): Introduce `postponeBackgroundTokenizeToNextFrame` metho…
ije Jun 2, 2026
e564310
fix
ije Jun 2, 2026
613e51d
Add debug option for the tokenzier
ije Jun 2, 2026
01845f6
Update types
ije Jun 2, 2026
d87b8c2
refactor(editor): Reshape search panel UI (#764)
ije Jun 3, 2026
3322712
Merge branch 'beta-1.3' into editor/perf/tokenzier
ije Jun 3, 2026
0214041
Refactor
ije Jun 3, 2026
fdb46f5
Set diff style to 'split' when editing
ije Jun 3, 2026
ad22569
Update file re-render porfermance
ije Jun 3, 2026
08e885e
Fix svg spirte
ije Jun 3, 2026
d0f31a7
Fix `applyDocumentChangeToLineAnnotations` function
ije Jun 3, 2026
2f5397b
Update demo app
ije Jun 3, 2026
f2b1b1d
Update editor.css
ije Jun 3, 2026
bf3c7ef
hide svg sprite
ije Jun 3, 2026
59cb1f8
wip
ije Jun 3, 2026
d51a5fe
typo
ije Jun 4, 2026
fc76687
Reduce requestAnimationFrame calls
ije Jun 4, 2026
0938323
Merge branch 'editor/perf/tokenzier' into editor/diff
ije Jun 4, 2026
563ac16
Update editor.css
ije Jun 4, 2026
b9865ec
Introduce `renderLineAnnotations` function
ije Jun 4, 2026
6207ff6
refactor
ije Jun 4, 2026
f2e51a7
refactor
ije Jun 4, 2026
73b6dbe
wip
ije Jun 4, 2026
6d19ba3
Update editor api
ije Jun 5, 2026
230ff7f
Fix rerender
ije Jun 5, 2026
6310d65
Add didEdit prop to FileDiff and optimize rendering logic
ije Jun 5, 2026
f010408
Fix select line highlight
ije Jun 5, 2026
420244b
typo
ije Jun 5, 2026
99aca8d
Update getLineText method to include optional line break parameter
ije Jun 5, 2026
97d4258
Fix diff render
ije Jun 5, 2026
aac1a53
pref(editor): Introduce `postponeBackgroundTokenizeToNextFrame` metho…
ije Jun 5, 2026
e8fc900
Merge branch 'beta-1.3' into editor/diff
ije Jun 5, 2026
a15f6ad
typo
ije Jun 5, 2026
7408b6e
fix(renderers): Update data-line-index format in createPlainAdditionL…
ije Jun 5, 2026
ae0f433
Optimize handling of unchanged lines and trailing context mismatches
ije Jun 5, 2026
4e37740
Revert "Optimize handling of unchanged lines and trailing context mis…
ije Jun 5, 2026
34a789e
fix
ije Jun 5, 2026
d8c17ba
fix
ije Jun 7, 2026
b54c4a0
typo
ije Jun 8, 2026
5d3708d
fix
ije Jun 8, 2026
54597ed
Implement marker rendering
ije Jun 8, 2026
9702b2d
Update search panel css
ije Jun 8, 2026
21fda6b
Add MarkerManager class
ije Jun 8, 2026
1231669
Clean up
ije Jun 8, 2026
e10d1b5
refactor
ije Jun 8, 2026
9380583
clean up
ije Jun 8, 2026
fcedd15
design tweaks to widgets
mdo Jun 8, 2026
7cd8022
chore: empty commit for beta branch
amadeus May 29, 2026
d5d780b
Editor (#601)
ije May 29, 2026
1a76053
chore: update @pierre/diffs to `1.3.0-beta.1`
amadeus May 29, 2026
7d966c7
chore: update @pierre/diffs to `1.3.0-beta.2`
amadeus Jun 1, 2026
a5890d8
feat(editor): Add rounded selection (#757)
ije Jun 2, 2026
d70fd32
refactor(editor): refactor search panel (#759)
ije Jun 2, 2026
8c27aa8
refactor(editor): Reshape search panel UI (#764)
ije Jun 3, 2026
341198e
pref(editor): Introduce `postponeBackgroundTokenizeToNextFrame` metho…
ije Jun 5, 2026
84ac331
Homepage Editor demo (#761)
mdo Jun 8, 2026
8df745f
chore: update @pierre/diffs to `1.3.0-beta.3`
amadeus Jun 9, 2026
699484b
Merge branch 'beta-1.3' into editor/diff
ije Jun 9, 2026
6b1c243
fix
ije Jun 9, 2026
baf194a
check if render cache is dirty
ije Jun 9, 2026
b4b8c17
Merge branch 'editor/diff' into editor/diagnostic
ije Jun 9, 2026
1d7c383
fix(diffs/editor): Add input support of `deleteSoftLineBackward` and…
ije Jun 9, 2026
7af963d
refactor(editor): realtime update on diff editing (#774)
ije Jun 9, 2026
7f16935
Merge branch 'beta-1.3' into editor/diagnostic
ije Jun 9, 2026
5652895
refactor(diffs/editor): Rename "Quick Edit" to "Selection Action" (#790)
ije Jun 9, 2026
763e306
Merge branch 'beta-1.3' into editor/diagnostic
ije Jun 9, 2026
b005108
fix css
ije Jun 9, 2026
894a594
refactor
ije Jun 9, 2026
588b60a
Merge branch 'beta-1.3' into editor/diagnostic
ije Jun 10, 2026
5549de9
Removed the `renderMarkerMessage` option from `EditorOptions`.
ije Jun 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"@pierre/diffs": "workspace:*",
"@pierre/icons": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"shiki": "catalog:"
Expand Down
95 changes: 95 additions & 0 deletions apps/demo/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ import {
} from '@pierre/diffs';
import { Editor } from '@pierre/diffs/editor';
import type { WorkerPoolManager } from '@pierre/diffs/worker';
import {
IconCiFailedOctagonFill,
IconCiWarningFill,
IconInfoFill,
} from '@pierre/icons';
import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';

import {
cleanupCodeView,
Expand Down Expand Up @@ -59,6 +66,33 @@ const CRAZY_FILE = false;
const LARGE_CONFLICT_FILE = false;
const CODE_VIEW_OLD_NEW_FILE = true;

// Pre-render the @pierre/icons SVG markup once so it can be embedded into the
// `message.html` strings the editor injects for markers. The icons default to
// `fill: currentcolor`, so each one inherits the surrounding text color.
const MARKER_INFO_ICON = renderToStaticMarkup(
createElement(IconInfoFill, { size: 16 })
);
const MARKER_WARNING_ICON = renderToStaticMarkup(
createElement(IconCiWarningFill, { size: 16 })
);
const MARKER_ERROR_ICON = renderToStaticMarkup(
createElement(IconCiFailedOctagonFill, { size: 16 })
);

// Builds the HTML for a single marker overlay: a severity-colored leading icon
// next to a message, with an additional description indented below the message
// (aligned with the message text, not the icon).
function markerMessage(opts: {
color: string;
icon: string;
message: string;
description: string;
}): string {
const iconCol = `<span style="color:${opts.color};display:inline-flex;flex:none;margin-top:2px">${opts.icon}</span>`;
const textCol = `<div style="display:flex;flex-direction:column;gap:2px">${opts.message}<div style="color:gray">${opts.description}</div></div>`;
return `<div style="display:flex;align-items:flex-start;gap:8px">${iconCol}${textCol}</div>`;
}

const FileStreamCodeConfigs: FileStreamCodeConfigsItem[] = [
{
content: tsContent,
Expand Down Expand Up @@ -868,6 +902,67 @@ if (renderFileButton != null) {
direction: 'none',
},
]);
requestAnimationFrame(() => {
editor.setMarkers([
{
start: {
line: 1,
character: 2,
},
end: {
line: 1,
character: 1000, // will be normalized to the end of the line(< 1000 chars)
},
severity: 'info',
message: {
html: markerMessage({
color: 'var(--diffs-editor-info-fg, #3794ff)',
icon: MARKER_INFO_ICON,
message: '<code>CodeOptionsMultipleThemes</code>',
description: 'Code options of multiple themes.',
}),
},
},
{
start: {
line: 2,
character: 2,
},
end: {
line: 2,
character: 1000, // will be normalized to the end of the line(< 1000 chars)
},
severity: 'warning',
message: {
html: markerMessage({
color: 'var(--diffs-editor-warning-fg, #cca700)',
icon: MARKER_WARNING_ICON,
message: '<code>CodeToHastOptions</code>',
description: 'Code to Hast Options is deprecated.',
}),
},
},
{
start: {
line: 3,
character: 2,
},
end: {
line: 3,
character: 1000, // will be normalized to the end of the line(< 1000 chars)
},
severity: 'error',
message: {
html: markerMessage({
color: 'var(--diffs-editor-error-fg, red)',
icon: MARKER_ERROR_ICON,
message: '<code>DecorationItem</code>',
description: 'Type not defined.',
}),
},
},
]);
});
} else {
editor.cleanUp();
}
Expand Down
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 61 additions & 21 deletions packages/diffs/src/editor/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
}
[data-caret],
[data-selection-range],
[data-match-range] {
[data-match-range],
[data-marker-range] {
position: absolute;
top: 0;
left: 0;
Expand Down Expand Up @@ -90,18 +91,42 @@
background-color: var(--diffs-bg);
}
[data-match-range] {
z-index: -10;
background-color: var(
--diffs-editor-match-bg,
var(--diffs-editor-selection-bg)
);
z-index: -10;
}
[data-match-range]:not([data-focus]) {
background-color: var(
--diffs-editor-match-highlight-bg,
light-dark(#ff963288, #ff963266)
);
}
[data-marker-range] {
z-index: 1;
/* White stroke: luminance masks treat black as transparent. */
-webkit-mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+');
mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+');
-webkit-mask-position: left bottom;
mask-position: left bottom;
-webkit-mask-repeat: repeat-x;
mask-repeat: repeat-x;
-webkit-mask-size: 6px 3px;
mask-size: 6px 3px;
}
[data-marker-error] {
background-color: var(--diffs-editor-error-fg, red);
}
[data-marker-warning] {
background-color: var(--diffs-editor-warning-fg, #cca700);
}
[data-marker-info] {
background-color: var(--diffs-editor-info-fg, #3794ff);
}
[data-marker-hint] {
background-color: var(--diffs-editor-hint-fg, #6a6a6a);
}
Comment on lines +118 to +129

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdo we should probably figure out how to use theme based colors for these. Also we should confirm if these are the colors we want as defaults.

Shouldn't block this PR, just something to follow up fix with.

[data-rtl] {
border-top-left-radius: 3px;
}
Expand All @@ -126,6 +151,36 @@
visibility: visible;
}
}
[data-editor-widget] {
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
--diffs-widget-shadow:
inset 0 0 0 1px var(--diffs-bg), 0 4px 8px rgb(0 0 0 / 0.075),
0 6px 18px rgb(0 0 0 / 0.075);
position: absolute;
top: 0;
left: 0;
z-index: 100;
width: fit-content;
max-width: calc(100% - 24px);
border: 1px solid var(--diffs-widget-border);
border-radius: 9px;
background-color: var(--diffs-widget-bg);
background-clip: padding-box;
box-shadow: var(--diffs-widget-shadow);
}
[data-marker-popup] {
padding: 8px 12px;
min-width: 180px;
pointer-events: auto;
font-family: var(--diffs-header-font-fallback);
font-size: 14px;
line-height: 1.4;
}
[data-marker-popup] code {
display: inline;
background-color: transparent;
}

/* Selection Action Widget */
[data-selection-action-icon] {
Expand Down Expand Up @@ -159,35 +214,22 @@

/* Search Panel Widget */
[data-search-panel] {
display: flex;
gap: 6px;
position: sticky;
top: 12px;
z-index: 100;
width: fit-content;
min-width: 300px;
max-width: calc(100% - 24px);
margin-inline: auto 12px;
margin-bottom: 4px;
display: flex;
gap: 4px;
background-clip: padding-box;
background-color: color-mix(
in lab,
color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg)),
transparent 40%
);
border: 1px solid color-mix(in lab, var(--diffs-fg) 15%, var(--diffs-bg));
padding: 6px 6px 6px 10px;
border-radius: 8px;
box-shadow: 0 0 12px 0 color-mix(in lab, var(--diffs-fg) 10%, var(--diffs-bg));
backdrop-filter: blur(8px);
padding: 4px;
}
[data-search-panel-row] {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 1px;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
font-family: var(--diffs-header-font-fallback);
font-size: 14px;
}
[data-search-panel-row] input {
Expand Down Expand Up @@ -234,8 +276,6 @@
color 0.1s ease-in-out;
}
[data-search-panel-row] [data-icon='search'] {
width: 16px;
margin-right: 2px;
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
cursor: default;
}
Expand Down
Loading
Loading