@dxos/ui-editor 0.8.4-main.dfabb4ec29 → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/index.mjs +482 -458
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +482 -458
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/extensions/index.d.ts +1 -3
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/scrolling/auto-scroll.d.ts.map +1 -0
- package/dist/types/src/extensions/{scroller.d.ts → scrolling/crawler.d.ts} +13 -6
- package/dist/types/src/extensions/scrolling/crawler.d.ts.map +1 -0
- package/dist/types/src/extensions/scrolling/index.d.ts +5 -0
- package/dist/types/src/extensions/scrolling/index.d.ts.map +1 -0
- package/dist/types/src/extensions/scrolling/scroll-past-end.d.ts.map +1 -0
- package/dist/types/src/extensions/scrolling/scroller.d.ts +16 -0
- package/dist/types/src/extensions/scrolling/scroller.d.ts.map +1 -0
- package/dist/types/src/styles/theme.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -29
- package/src/extensions/factories.ts +1 -1
- package/src/extensions/index.ts +1 -3
- package/src/extensions/outliner/outliner.ts +1 -1
- package/src/extensions/{auto-scroll.ts → scrolling/auto-scroll.ts} +30 -20
- package/src/extensions/{scroller.ts → scrolling/crawler.ts} +19 -12
- package/src/extensions/scrolling/index.ts +8 -0
- package/src/extensions/{scroll-past-end.ts → scrolling/scroll-past-end.ts} +6 -6
- package/src/extensions/scrolling/scroller.ts +27 -0
- package/src/extensions/tags/xml-formatting.ts +1 -1
- package/src/extensions/tags/xml-tags.ts +4 -4
- package/src/styles/theme.ts +8 -7
- package/dist/types/src/extensions/auto-scroll.d.ts.map +0 -1
- package/dist/types/src/extensions/scroll-past-end.d.ts.map +0 -1
- package/dist/types/src/extensions/scroller.d.ts.map +0 -1
- /package/dist/types/src/extensions/{auto-scroll.d.ts → scrolling/auto-scroll.d.ts} +0 -0
- /package/dist/types/src/extensions/{scroll-past-end.d.ts → scrolling/scroll-past-end.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/ui-editor",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.f466a3d56e",
|
|
4
4
|
"description": "Text editor components.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
@@ -62,27 +62,27 @@
|
|
|
62
62
|
"lodash.merge": "^4.6.2",
|
|
63
63
|
"lodash.sortby": "^4.7.0",
|
|
64
64
|
"style-mod": "^4.1.0",
|
|
65
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/display-name": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/protocols": "0.8.4-main.
|
|
77
|
-
"@dxos/ui": "0.8.4-main.
|
|
78
|
-
"@dxos/ui-types": "0.8.4-main.
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
65
|
+
"@dxos/app-graph": "0.8.4-main.f466a3d56e",
|
|
66
|
+
"@dxos/debug": "0.8.4-main.f466a3d56e",
|
|
67
|
+
"@dxos/async": "0.8.4-main.f466a3d56e",
|
|
68
|
+
"@dxos/client": "0.8.4-main.f466a3d56e",
|
|
69
|
+
"@dxos/display-name": "0.8.4-main.f466a3d56e",
|
|
70
|
+
"@dxos/context": "0.8.4-main.f466a3d56e",
|
|
71
|
+
"@dxos/echo-db": "0.8.4-main.f466a3d56e",
|
|
72
|
+
"@dxos/invariant": "0.8.4-main.f466a3d56e",
|
|
73
|
+
"@dxos/log": "0.8.4-main.f466a3d56e",
|
|
74
|
+
"@dxos/echo": "0.8.4-main.f466a3d56e",
|
|
75
|
+
"@dxos/lit-ui": "0.8.4-main.f466a3d56e",
|
|
76
|
+
"@dxos/protocols": "0.8.4-main.f466a3d56e",
|
|
77
|
+
"@dxos/ui-theme": "0.8.4-main.f466a3d56e",
|
|
78
|
+
"@dxos/ui-types": "0.8.4-main.f466a3d56e",
|
|
79
|
+
"@dxos/ui": "0.8.4-main.f466a3d56e",
|
|
80
|
+
"@dxos/util": "0.8.4-main.f466a3d56e"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@automerge/automerge": "3.2.6",
|
|
84
|
-
"@automerge/automerge-repo": "2.6.0-subduction.
|
|
85
|
-
"@automerge/automerge-repo-network-broadcastchannel": "2.6.0-subduction.
|
|
84
|
+
"@automerge/automerge-repo": "2.6.0-subduction.20",
|
|
85
|
+
"@automerge/automerge-repo-network-broadcastchannel": "2.6.0-subduction.20",
|
|
86
86
|
"@effect/platform": "0.94.4",
|
|
87
87
|
"@types/chai": "^4.2.15",
|
|
88
88
|
"@types/chai-dom": "^1.11.0",
|
|
@@ -95,21 +95,21 @@
|
|
|
95
95
|
"happy-dom": "^20.0.0",
|
|
96
96
|
"jsdom": "^27.0.0",
|
|
97
97
|
"mocha": "^10.6.0",
|
|
98
|
-
"vite": "^8.0.
|
|
98
|
+
"vite": "^8.0.13",
|
|
99
99
|
"vite-plugin-top-level-await": "^1.6.0",
|
|
100
100
|
"vite-plugin-wasm": "^3.6.0",
|
|
101
|
-
"@dxos/config": "0.8.4-main.
|
|
102
|
-
"@dxos/echo": "0.8.4-main.
|
|
103
|
-
"@dxos/
|
|
104
|
-
"@dxos/
|
|
105
|
-
"@dxos/
|
|
106
|
-
"@dxos/
|
|
107
|
-
"@dxos/
|
|
101
|
+
"@dxos/config": "0.8.4-main.f466a3d56e",
|
|
102
|
+
"@dxos/echo": "0.8.4-main.f466a3d56e",
|
|
103
|
+
"@dxos/keyboard": "0.8.4-main.f466a3d56e",
|
|
104
|
+
"@dxos/random": "0.8.4-main.f466a3d56e",
|
|
105
|
+
"@dxos/schema": "0.8.4-main.f466a3d56e",
|
|
106
|
+
"@dxos/storybook-utils": "0.8.4-main.f466a3d56e",
|
|
107
|
+
"@dxos/ui-theme": "0.8.4-main.f466a3d56e"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
110
|
"@effect/platform": "0.94.4",
|
|
111
111
|
"effect": "3.20.0",
|
|
112
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
112
|
+
"@dxos/ui-theme": "0.8.4-main.f466a3d56e"
|
|
113
113
|
},
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
@@ -33,7 +33,7 @@ import { baseTheme, createFontTheme, editorGutter } from '../styles';
|
|
|
33
33
|
import { automerge } from './automerge';
|
|
34
34
|
import { SpaceAwarenessProvider, awareness } from './awareness';
|
|
35
35
|
import { focus } from './focus';
|
|
36
|
-
import { scrollPastEnd } from './
|
|
36
|
+
import { scrollPastEnd } from './scrolling';
|
|
37
37
|
|
|
38
38
|
//
|
|
39
39
|
// Basic
|
package/src/extensions/index.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
export * from './annotations';
|
|
6
6
|
export * from './autocomplete';
|
|
7
|
-
export * from './auto-scroll';
|
|
8
7
|
export * from './automerge';
|
|
9
8
|
export * from './awareness';
|
|
10
9
|
export * from './blast';
|
|
@@ -26,8 +25,7 @@ export * from './modes';
|
|
|
26
25
|
export * from './outliner';
|
|
27
26
|
export * from './preview';
|
|
28
27
|
export * from './replacer';
|
|
29
|
-
export * from './
|
|
30
|
-
export * from './scroller';
|
|
28
|
+
export * from './scrolling';
|
|
31
29
|
export * from './selection';
|
|
32
30
|
export * from './snippets';
|
|
33
31
|
export * from './state';
|
|
@@ -156,7 +156,7 @@ const decorations = () => [
|
|
|
156
156
|
},
|
|
157
157
|
|
|
158
158
|
'.cm-list-item-focused': {
|
|
159
|
-
borderColor: 'var(--color-
|
|
159
|
+
borderColor: 'var(--color-focus-ring-subtle)',
|
|
160
160
|
},
|
|
161
161
|
'&:focus-within .cm-list-item-selected': {
|
|
162
162
|
borderColor: 'var(--color-separator)',
|
|
@@ -9,7 +9,7 @@ import { addEventListener, combine, throttle } from '@dxos/async';
|
|
|
9
9
|
import { Domino } from '@dxos/ui';
|
|
10
10
|
import { getSize } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { crawlerActiveEffect, crawlerLineEffect } from './crawler';
|
|
13
13
|
|
|
14
14
|
/** Enable or disable autoscroll. */
|
|
15
15
|
export const autoScrollEffect = StateEffect.define<boolean>();
|
|
@@ -54,11 +54,11 @@ export const autoScroll = ({ scrollOnResize = true }: AutoScrollProps = {}) => {
|
|
|
54
54
|
if (enabled) {
|
|
55
55
|
setPinned(true);
|
|
56
56
|
view.dispatch({
|
|
57
|
-
effects:
|
|
57
|
+
effects: crawlerActiveEffect.of(true),
|
|
58
58
|
});
|
|
59
59
|
} else {
|
|
60
60
|
view.dispatch({
|
|
61
|
-
effects:
|
|
61
|
+
effects: crawlerActiveEffect.of(false),
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -96,7 +96,7 @@ export const autoScroll = ({ scrollOnResize = true }: AutoScrollProps = {}) => {
|
|
|
96
96
|
const delta = scrollHeight - scrollTop - clientHeight;
|
|
97
97
|
if (delta > 0) {
|
|
98
98
|
setPinned(true);
|
|
99
|
-
view.dispatch({ effects:
|
|
99
|
+
view.dispatch({ effects: crawlerActiveEffect.of(true) });
|
|
100
100
|
} else if (delta < -1) {
|
|
101
101
|
setPinned(false);
|
|
102
102
|
}
|
|
@@ -133,7 +133,7 @@ export const autoScroll = ({ scrollOnResize = true }: AutoScrollProps = {}) => {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
view.scrollDOM.scrollTo({ top: view.scrollDOM.scrollHeight, behavior: 'instant' });
|
|
136
|
-
view.dispatch({ effects:
|
|
136
|
+
view.dispatch({ effects: crawlerActiveEffect.of(false) });
|
|
137
137
|
});
|
|
138
138
|
}, 50);
|
|
139
139
|
|
|
@@ -161,20 +161,30 @@ export const autoScroll = ({ scrollOnResize = true }: AutoScrollProps = {}) => {
|
|
|
161
161
|
class {
|
|
162
162
|
private readonly cleanup: () => void;
|
|
163
163
|
constructor(view: EditorView) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
164
|
+
// Re-pin check is throttled so the listener doesn't thrash while scrolling, but
|
|
165
|
+
// unpinning must be immediate — otherwise content arriving during the throttle
|
|
166
|
+
// window re-applies the crawl effect and yanks the viewport back to the bottom.
|
|
167
|
+
const onUserScroll = throttle(() => {
|
|
168
|
+
requestAnimationFrame(() => {
|
|
169
|
+
const { scrollTop, scrollHeight, clientHeight } = view.scrollDOM;
|
|
170
|
+
const delta = scrollHeight - scrollTop - clientHeight;
|
|
171
|
+
// Sub-pixel tolerance: fractional scroll positions can leave delta at e.g. 0.5
|
|
172
|
+
// even when the user is visually at the bottom.
|
|
173
|
+
const pinned = Math.abs(delta) <= 1;
|
|
174
|
+
setPinned(pinned);
|
|
175
|
+
if (!pinned) {
|
|
176
|
+
view.dispatch({ effects: crawlerActiveEffect.of(false) });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}, 500);
|
|
180
|
+
|
|
181
|
+
this.cleanup = createUserScrollDetector(view.scrollDOM, () => {
|
|
182
|
+
if (isPinned) {
|
|
183
|
+
setPinned(false);
|
|
184
|
+
view.dispatch({ effects: crawlerActiveEffect.of(false) });
|
|
185
|
+
}
|
|
186
|
+
onUserScroll();
|
|
187
|
+
});
|
|
178
188
|
}
|
|
179
189
|
destroy() {
|
|
180
190
|
this.cleanup();
|
|
@@ -196,7 +206,7 @@ export const autoScroll = ({ scrollOnResize = true }: AutoScrollProps = {}) => {
|
|
|
196
206
|
.on('click', () => {
|
|
197
207
|
setPinned(true);
|
|
198
208
|
view.dispatch({
|
|
199
|
-
effects:
|
|
209
|
+
effects: crawlerLineEffect.of({ line: -1, position: 'end', behavior: 'smooth' }),
|
|
200
210
|
});
|
|
201
211
|
});
|
|
202
212
|
|
|
@@ -40,10 +40,10 @@ export type ScrollToProps = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/** Scroll to a specific line. */
|
|
43
|
-
export const
|
|
43
|
+
export const crawlerLineEffect = StateEffect.define<ScrollToProps>();
|
|
44
44
|
|
|
45
45
|
/** Start/stop crawling the end of the document. */
|
|
46
|
-
export const
|
|
46
|
+
export const crawlerActiveEffect = StateEffect.define<boolean>();
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Helper function to scroll to a specific line.
|
|
@@ -51,22 +51,29 @@ export const scrollerCrawlEffect = StateEffect.define<boolean>();
|
|
|
51
51
|
*/
|
|
52
52
|
export const scrollToLine = (view: EditorView, options: ScrollToProps) => {
|
|
53
53
|
view.dispatch({
|
|
54
|
-
effects:
|
|
54
|
+
effects: crawlerLineEffect.of(options),
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
export type
|
|
58
|
+
export type CrawlerOptions = {
|
|
59
59
|
/** Threshold in px to trigger scroll from bottom. */
|
|
60
60
|
overScroll?: number;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Imperative scroll-control primitive for streaming editor views.
|
|
65
|
+
*
|
|
66
|
+
* Owns the scroll-related effects (`crawlerLineEffect`, `crawlerActiveEffect`), the spring
|
|
67
|
+
* crawler that follows the bottom of the document, and the `.cm-scroller` theme (overflow,
|
|
68
|
+
* scrollbar styling, and the `::after` overscroll spacer).
|
|
69
|
+
*
|
|
70
|
+
* Use directly for jump-to-line navigation, or pair with `autoScroll` for a pin-to-bottom
|
|
71
|
+
* streaming policy. The composite `streamScroll` bundles both for the common case.
|
|
65
72
|
*/
|
|
66
|
-
export const
|
|
73
|
+
export const crawler = ({ overScroll = 0 }: CrawlerOptions = {}) => {
|
|
67
74
|
// ViewPlugin to manage scroll animations.
|
|
68
|
-
const
|
|
69
|
-
class
|
|
75
|
+
const crawlerPlugin = ViewPlugin.fromClass(
|
|
76
|
+
class CrawlerPlugin {
|
|
70
77
|
private readonly crawler: ReturnType<typeof createCrawler>;
|
|
71
78
|
constructor(private readonly view: EditorView) {
|
|
72
79
|
this.crawler = createCrawler(this.view);
|
|
@@ -126,18 +133,18 @@ export const scroller = ({ overScroll = 0 }: ScrollerOptions = {}) => {
|
|
|
126
133
|
);
|
|
127
134
|
|
|
128
135
|
return [
|
|
129
|
-
|
|
136
|
+
crawlerPlugin,
|
|
130
137
|
|
|
131
138
|
// Listen for effect.
|
|
132
139
|
EditorView.updateListener.of((update) => {
|
|
133
140
|
update.transactions.forEach((transaction) => {
|
|
134
141
|
try {
|
|
135
|
-
const plugin = update.view.plugin(
|
|
142
|
+
const plugin = update.view.plugin(crawlerPlugin);
|
|
136
143
|
if (plugin) {
|
|
137
144
|
for (const effect of transaction.effects) {
|
|
138
|
-
if (effect.is(
|
|
145
|
+
if (effect.is(crawlerActiveEffect)) {
|
|
139
146
|
plugin.crawl(effect.value);
|
|
140
|
-
} else if (effect.is(
|
|
147
|
+
} else if (effect.is(crawlerLineEffect)) {
|
|
141
148
|
plugin.scroll(effect.value);
|
|
142
149
|
}
|
|
143
150
|
}
|
|
@@ -12,15 +12,15 @@ import { EditorView, ViewPlugin } from '@codemirror/view';
|
|
|
12
12
|
*/
|
|
13
13
|
const scrollPastEndPlugin = ViewPlugin.fromClass(
|
|
14
14
|
class {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
_height = 1_000;
|
|
16
|
+
_attrs: { style: string } | null = { style: `padding-bottom: ${this._height}px` };
|
|
17
17
|
|
|
18
18
|
update({ view }: { view: EditorView }) {
|
|
19
19
|
const lastLineBlock = view.lineBlockAt(view.state.doc.length);
|
|
20
20
|
const height = view.dom.clientHeight - lastLineBlock.height - view.documentPadding.top - 0.5;
|
|
21
|
-
if (height >= 0 && height !== this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
21
|
+
if (height >= 0 && height !== this._height) {
|
|
22
|
+
this._height = height;
|
|
23
|
+
this._attrs = { style: `padding-bottom: ${height}px` };
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
},
|
|
@@ -28,5 +28,5 @@ const scrollPastEndPlugin = ViewPlugin.fromClass(
|
|
|
28
28
|
|
|
29
29
|
export const scrollPastEnd = (): Extension => [
|
|
30
30
|
scrollPastEndPlugin,
|
|
31
|
-
EditorView.contentAttributes.of((view) => view.plugin(scrollPastEndPlugin)?.
|
|
31
|
+
EditorView.contentAttributes.of((view) => view.plugin(scrollPastEndPlugin)?._attrs ?? null),
|
|
32
32
|
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Extension } from '@codemirror/state';
|
|
6
|
+
|
|
7
|
+
import { isTruthy } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { type AutoScrollProps, autoScroll as autoScrollExtension } from './auto-scroll';
|
|
10
|
+
import { type CrawlerOptions, crawler } from './crawler';
|
|
11
|
+
|
|
12
|
+
export type ScrollerOptions = CrawlerOptions &
|
|
13
|
+
AutoScrollProps & {
|
|
14
|
+
/**
|
|
15
|
+
* Include the auto-scroll policy (pin-to-bottom, user-scroll unpin, scroll-to-bottom button).
|
|
16
|
+
* Set to `false` to get only the crawler primitive (line jumps, theme, overscroll spacer).
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
autoScroll?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Composite scroll extension for streaming editor views (chat threads, transcripts, logs).
|
|
24
|
+
*/
|
|
25
|
+
export const scroller = ({ overScroll, scrollOnResize, autoScroll = true }: ScrollerOptions = {}): Extension[] => {
|
|
26
|
+
return [crawler({ overScroll }), autoScroll && autoScrollExtension({ scrollOnResize })].filter(isTruthy);
|
|
27
|
+
};
|
|
@@ -111,7 +111,7 @@ export const xmlFormatting = ({ skip }: XmlFormattingOptions = {}): Extension =>
|
|
|
111
111
|
|
|
112
112
|
EditorView.baseTheme({
|
|
113
113
|
'.cm-xml-element': {
|
|
114
|
-
backgroundColor: 'var(--color-
|
|
114
|
+
backgroundColor: 'var(--color-current-surface)',
|
|
115
115
|
borderRadius: '0.25rem',
|
|
116
116
|
padding: '0.25rem',
|
|
117
117
|
},
|
|
@@ -21,7 +21,7 @@ import { Domino } from '@dxos/ui';
|
|
|
21
21
|
|
|
22
22
|
import { type Range } from '../../types';
|
|
23
23
|
import { decorationSetToArray } from '../../util';
|
|
24
|
-
import {
|
|
24
|
+
import { crawlerLineEffect } from '../scrolling';
|
|
25
25
|
import { nodeToJson } from './xml-util';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -299,7 +299,7 @@ const createNavigationEffectPlugin = (
|
|
|
299
299
|
const line = view.state.doc.lineAt(widget?.from ?? 0);
|
|
300
300
|
view.dispatch({
|
|
301
301
|
selection: { anchor: line.from, head: line.from },
|
|
302
|
-
effects:
|
|
302
|
+
effects: crawlerLineEffect.of({ line: line.number - 1, offset: -16 }),
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
continue;
|
|
@@ -325,13 +325,13 @@ const createNavigationEffectPlugin = (
|
|
|
325
325
|
const line = view.state.doc.lineAt(widget?.from);
|
|
326
326
|
view.dispatch({
|
|
327
327
|
selection: { anchor: line.to, head: line.to },
|
|
328
|
-
effects:
|
|
328
|
+
effects: crawlerLineEffect.of({ line: line.number - 1, offset: -16 }),
|
|
329
329
|
});
|
|
330
330
|
} else {
|
|
331
331
|
const line = view.state.doc.lineAt(view.state.doc.length);
|
|
332
332
|
view.dispatch({
|
|
333
333
|
selection: { anchor: line.to, head: line.to },
|
|
334
|
-
effects:
|
|
334
|
+
effects: crawlerLineEffect.of({ line: line.number - 1, position: 'end' }),
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
|
package/src/styles/theme.ts
CHANGED
|
@@ -108,7 +108,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
108
108
|
* Scroller
|
|
109
109
|
*/
|
|
110
110
|
'.cm-scroller': {
|
|
111
|
-
// Browser scroll-anchoring: see comment in `
|
|
111
|
+
// Browser scroll-anchoring: see comment in `scrolling/crawler.ts`. `auto` lets the browser pin a
|
|
112
112
|
// stable element near the viewport top so widget resizes (e.g. tool-block TogglePanel
|
|
113
113
|
// open/close) don't jump the user's view.
|
|
114
114
|
overflowAnchor: 'auto',
|
|
@@ -227,6 +227,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
227
227
|
textDecorationColor: 'var(--color-separator)',
|
|
228
228
|
textUnderlineOffset: '2px',
|
|
229
229
|
borderRadius: '.125rem',
|
|
230
|
+
cursor: 'pointer',
|
|
230
231
|
},
|
|
231
232
|
'.cm-link > span': {
|
|
232
233
|
color: 'var(--color-accent-text)',
|
|
@@ -266,12 +267,12 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
266
267
|
padding: '4px',
|
|
267
268
|
},
|
|
268
269
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]': {
|
|
269
|
-
background: 'var(--color-
|
|
270
|
-
color: 'var(--color-base-
|
|
270
|
+
background: 'var(--color-current-surface)',
|
|
271
|
+
color: 'var(--color-base-foreground)',
|
|
271
272
|
},
|
|
272
273
|
'.cm-tooltip.cm-tooltip-autocomplete > ul > completion-section': {
|
|
273
274
|
paddingLeft: '4px !important',
|
|
274
|
-
color: 'var(--color-base-
|
|
275
|
+
color: 'var(--color-base-foreground)',
|
|
275
276
|
},
|
|
276
277
|
|
|
277
278
|
/**
|
|
@@ -291,7 +292,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
291
292
|
padding: '0 4px',
|
|
292
293
|
},
|
|
293
294
|
'.cm-completionMatchedText': {
|
|
294
|
-
color: 'var(--color-base-
|
|
295
|
+
color: 'var(--color-base-foreground)',
|
|
295
296
|
textDecoration: 'none !important',
|
|
296
297
|
},
|
|
297
298
|
|
|
@@ -327,7 +328,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
327
328
|
backgroundColor: 'var(--color-input-surface)',
|
|
328
329
|
},
|
|
329
330
|
'.cm-panel input:focus, .cm-panel button:focus': {
|
|
330
|
-
outline: '1px solid var(--color-
|
|
331
|
+
outline: '1px solid var(--color-focus-ring-subtle)',
|
|
331
332
|
},
|
|
332
333
|
'.cm-panel label': {
|
|
333
334
|
display: 'inline-flex',
|
|
@@ -340,7 +341,7 @@ export const baseTheme = EditorView.baseTheme({
|
|
|
340
341
|
height: '8px',
|
|
341
342
|
marginRight: '6px !important',
|
|
342
343
|
padding: '2px !important',
|
|
343
|
-
color: 'var(--color-
|
|
344
|
+
color: 'var(--color-focus-ring-subtle)',
|
|
344
345
|
},
|
|
345
346
|
'.cm-panel button': {
|
|
346
347
|
'&:hover': {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto-scroll.d.ts","sourceRoot":"","sources":["../../../../src/extensions/auto-scroll.ts"],"names":[],"mappings":"AAaA,oCAAoC;AACpC,eAAO,MAAM,gBAAgB,sDAAgC,CAAC;AAE9D,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,wBAA+B,eAAe,4CAoLpE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-past-end.d.ts","sourceRoot":"","sources":["../../../../src/extensions/scroll-past-end.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAwBnD,eAAO,MAAM,aAAa,QAAO,SAGhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroller.d.ts","sourceRoot":"","sources":["../../../../src/extensions/scroller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAC;AAI1D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,iCAAiC;AACjC,eAAO,MAAM,kBAAkB,4DAAsC,CAAC;AAEtE,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,sDAAgC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,YAAY,SAAU,UAAU,WAAW,aAAa,SAIpE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,oBAAwB,eAAe,4CA0H3D,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,SAAI,EAAE,aAAa,SAAI,EAAE,YAAY,SAAK;IAiC3F,MAAM;IAON,MAAM;EAST"}
|
|
File without changes
|
|
File without changes
|