@dxos/ui-editor 0.8.4-main.52d7546f51 → 0.8.4-main.6fa680abb7
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/lib/browser/index.mjs +487 -413
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +487 -413
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/defaults.d.ts +1 -1
- package/dist/types/src/defaults.d.ts.map +1 -1
- package/dist/types/src/extensions/auto-scroll.d.ts +6 -0
- package/dist/types/src/extensions/auto-scroll.d.ts.map +1 -0
- package/dist/types/src/extensions/automerge/automerge.d.ts.map +1 -1
- package/dist/types/src/extensions/factories.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +2 -2
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/extensions/scroller.d.ts +66 -0
- package/dist/types/src/extensions/scroller.d.ts.map +1 -0
- package/dist/types/src/styles/index.d.ts +0 -2
- package/dist/types/src/styles/index.d.ts.map +1 -1
- package/dist/types/src/styles/theme.d.ts +15 -0
- package/dist/types/src/styles/theme.d.ts.map +1 -1
- package/dist/types/src/util/cursor.d.ts +1 -1
- package/dist/types/src/util/cursor.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -28
- package/src/defaults.ts +4 -4
- package/src/extensions/annotations.ts +1 -1
- package/src/extensions/auto-scroll.ts +126 -0
- package/src/extensions/automerge/automerge.test.tsx +2 -2
- package/src/extensions/automerge/automerge.ts +6 -5
- package/src/extensions/blocks.ts +5 -5
- package/src/extensions/comments.ts +5 -5
- package/src/extensions/dnd.ts +2 -2
- package/src/extensions/factories.ts +6 -7
- package/src/extensions/folding.ts +2 -2
- package/src/extensions/index.ts +2 -2
- package/src/extensions/markdown/decorate.ts +4 -3
- package/src/extensions/markdown/highlight.ts +25 -11
- package/src/extensions/markdown/link.ts +27 -33
- package/src/extensions/markdown/styles.ts +6 -6
- package/src/extensions/outliner/outliner.ts +3 -3
- package/src/extensions/preview/preview.ts +1 -1
- package/src/extensions/scroller.ts +232 -0
- package/src/extensions/selection.ts +1 -1
- package/src/extensions/tags/streamer.ts +1 -1
- package/src/extensions/tags/xml-tags.ts +7 -4
- package/src/styles/index.ts +0 -2
- package/src/styles/theme.ts +106 -30
- package/src/util/cursor.ts +1 -1
- package/dist/types/src/extensions/autoscroll.d.ts +0 -20
- package/dist/types/src/extensions/autoscroll.d.ts.map +0 -1
- package/dist/types/src/extensions/scrolling.d.ts +0 -78
- package/dist/types/src/extensions/scrolling.d.ts.map +0 -1
- package/dist/types/src/styles/markdown.d.ts +0 -8
- package/dist/types/src/styles/markdown.d.ts.map +0 -1
- package/dist/types/src/styles/tokens.d.ts +0 -3
- package/dist/types/src/styles/tokens.d.ts.map +0 -1
- package/src/extensions/autoscroll.ts +0 -165
- package/src/extensions/scrolling.ts +0 -189
- package/src/styles/markdown.ts +0 -26
- package/src/styles/tokens.ts +0 -17
|
@@ -13,17 +13,17 @@ import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
|
|
|
13
13
|
|
|
14
14
|
// src/defaults.ts
|
|
15
15
|
import { mx } from "@dxos/ui-theme";
|
|
16
|
-
var editorWidth = "!
|
|
16
|
+
var editorWidth = "!mx-auto w-full max-w-[min(50rem,100%-4rem)]";
|
|
17
17
|
var editorSlots = {
|
|
18
18
|
scroll: {
|
|
19
|
-
className: "
|
|
19
|
+
className: "pt-2"
|
|
20
20
|
},
|
|
21
21
|
content: {
|
|
22
22
|
className: editorWidth
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
var editorWithToolbarLayout = "grid grid-cols-1 grid-rows-[min-content_1fr] data-[toolbar=disabled]:grid-rows-[1fr] justify-center content-start overflow-hidden";
|
|
26
|
-
var stackItemContentEditorClassNames = (role) => mx("p-0.5 dx-focus-ring-inset
|
|
26
|
+
var stackItemContentEditorClassNames = (role) => mx("dx-attention-surface p-0.5 dx-focus-ring-inset data-[toolbar=disabled]:pt-2", role === "section" ? "[&_.cm-scroller]:overflow-hidden [&_.cm-scroller]:min-h-24" : "dx-container overflow-hidden");
|
|
27
27
|
|
|
28
28
|
// src/extensions/annotations.ts
|
|
29
29
|
import { RangeSetBuilder } from "@codemirror/state";
|
|
@@ -58,7 +58,7 @@ var annotations = ({ match } = {}) => {
|
|
|
58
58
|
".cm-annotation": {
|
|
59
59
|
textDecoration: "underline",
|
|
60
60
|
textDecorationStyle: "wavy",
|
|
61
|
-
textDecorationColor: "var(--
|
|
61
|
+
textDecorationColor: "var(--color-error-text)"
|
|
62
62
|
}
|
|
63
63
|
})
|
|
64
64
|
];
|
|
@@ -501,192 +501,210 @@ var typeahead = ({ onComplete } = {}) => {
|
|
|
501
501
|
];
|
|
502
502
|
};
|
|
503
503
|
|
|
504
|
-
// src/extensions/
|
|
505
|
-
import { StateEffect as StateEffect2 } from "@codemirror/state";
|
|
504
|
+
// src/extensions/auto-scroll.ts
|
|
506
505
|
import { EditorView as EditorView5, ViewPlugin as ViewPlugin6 } from "@codemirror/view";
|
|
507
|
-
import {
|
|
506
|
+
import { addEventListener, combine, throttle } from "@dxos/async";
|
|
508
507
|
import { Domino } from "@dxos/ui";
|
|
509
508
|
|
|
510
|
-
// src/extensions/
|
|
509
|
+
// src/extensions/scroller.ts
|
|
511
510
|
import { StateEffect } from "@codemirror/state";
|
|
512
511
|
import { EditorView as EditorView4, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
|
|
512
|
+
import { log as log2 } from "@dxos/log";
|
|
513
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/scroller.ts";
|
|
514
|
+
var scrollerLineEffect = StateEffect.define();
|
|
515
|
+
var scrollerCrawlEffect = StateEffect.define();
|
|
516
|
+
var scrollToLine = (view, options) => {
|
|
517
|
+
view.dispatch({
|
|
518
|
+
effects: scrollerLineEffect.of(options)
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
var scroller = ({ overScroll = 0 } = {}) => {
|
|
522
|
+
const scrollPlugin = ViewPlugin5.fromClass(class ScrollerPlugin {
|
|
516
523
|
view;
|
|
524
|
+
crawler;
|
|
517
525
|
constructor(view) {
|
|
518
526
|
this.view = view;
|
|
527
|
+
this.crawler = createCrawler(this.view);
|
|
519
528
|
}
|
|
520
529
|
// No-op.
|
|
521
530
|
destroy() {
|
|
531
|
+
this.crawler.cancel();
|
|
522
532
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
const scroller = this.view.scrollDOM;
|
|
530
|
-
const targetLine = Math.max(0, lineNumber - 1);
|
|
531
|
-
if (behavior === "instant") {
|
|
532
|
-
requestAnimationFrame(() => {
|
|
533
|
-
this.view.dispatch({
|
|
534
|
-
selection: {
|
|
535
|
-
anchor: doc.line(targetLine + 1).from
|
|
536
|
-
},
|
|
537
|
-
scrollIntoView: true
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
if (targetLine >= doc.lines) {
|
|
543
|
-
const targetScrollTop2 = scroller.scrollHeight - scroller.clientHeight + (animOffset || 0);
|
|
544
|
-
this.animateScroll(scroller, targetScrollTop2);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
const lineStart = doc.line(targetLine + 1).from;
|
|
548
|
-
const coords = this.view.coordsAtPos(lineStart);
|
|
549
|
-
if (!coords) {
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
const currentScrollTop = scroller.scrollTop;
|
|
553
|
-
const scrollerRect = scroller.getBoundingClientRect();
|
|
554
|
-
const maxScrollTop = scroller.scrollHeight - scroller.clientHeight;
|
|
555
|
-
let targetScrollTop;
|
|
556
|
-
if (animPosition === "end") {
|
|
557
|
-
targetScrollTop = currentScrollTop + coords.bottom - scrollerRect.bottom + animOffset;
|
|
533
|
+
cancel() {
|
|
534
|
+
this.crawler.cancel();
|
|
535
|
+
}
|
|
536
|
+
crawl(start = false) {
|
|
537
|
+
if (start) {
|
|
538
|
+
this.crawler.scroll();
|
|
558
539
|
} else {
|
|
559
|
-
|
|
540
|
+
this.crawler.cancel();
|
|
560
541
|
}
|
|
561
|
-
const clampedScrollTop = Math.max(0, Math.min(targetScrollTop, maxScrollTop));
|
|
562
|
-
this.animateScroll(scroller, clampedScrollTop);
|
|
563
542
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
543
|
+
scroll({ line, offset = 0, position, behavior = "instant" }) {
|
|
544
|
+
const { scrollTop, scrollHeight, clientHeight } = this.view.scrollDOM;
|
|
545
|
+
const scrollerRect = this.view.scrollDOM.getBoundingClientRect();
|
|
546
|
+
const doc = this.view.state.doc;
|
|
547
|
+
let targetScrollTop = scrollHeight - clientHeight + offset;
|
|
548
|
+
if (line >= 0 && line <= doc.lines - 1) {
|
|
549
|
+
const lineStart = doc.line(line + 1).from;
|
|
550
|
+
const coords = this.view.coordsAtPos(lineStart);
|
|
551
|
+
if (coords) {
|
|
552
|
+
const currentScrollTop = scrollTop;
|
|
553
|
+
const maxScrollTop = scrollHeight - clientHeight;
|
|
554
|
+
if (position === "end") {
|
|
555
|
+
targetScrollTop = currentScrollTop + coords.bottom - scrollerRect.bottom + offset;
|
|
556
|
+
} else {
|
|
557
|
+
targetScrollTop = currentScrollTop + coords.top - scrollerRect.top + offset;
|
|
558
|
+
}
|
|
559
|
+
targetScrollTop = Math.max(0, Math.min(targetScrollTop, maxScrollTop));
|
|
560
|
+
}
|
|
570
561
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
562
|
+
requestAnimationFrame(() => {
|
|
563
|
+
this.view.scrollDOM.scrollTo({
|
|
564
|
+
top: targetScrollTop,
|
|
565
|
+
behavior
|
|
566
|
+
});
|
|
574
567
|
});
|
|
575
568
|
}
|
|
576
569
|
});
|
|
577
570
|
return [
|
|
578
571
|
scrollPlugin,
|
|
579
|
-
//
|
|
572
|
+
// Listen for effect.s
|
|
580
573
|
EditorView4.updateListener.of((update2) => {
|
|
581
574
|
update2.transactions.forEach((transaction) => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
});
|
|
575
|
+
try {
|
|
576
|
+
const plugin = update2.view.plugin(scrollPlugin);
|
|
577
|
+
if (plugin) {
|
|
578
|
+
for (const effect of transaction.effects) {
|
|
579
|
+
if (effect.is(scrollerCrawlEffect)) {
|
|
580
|
+
plugin.crawl(effect.value);
|
|
581
|
+
} else if (effect.is(scrollerLineEffect)) {
|
|
582
|
+
plugin.scroll(effect.value);
|
|
583
|
+
}
|
|
592
584
|
}
|
|
593
585
|
}
|
|
586
|
+
} catch (err) {
|
|
587
|
+
log2.catch(err, void 0, {
|
|
588
|
+
F: __dxlog_file2,
|
|
589
|
+
L: 145,
|
|
590
|
+
S: void 0,
|
|
591
|
+
C: (f, a) => f(...a)
|
|
592
|
+
});
|
|
594
593
|
}
|
|
595
594
|
});
|
|
595
|
+
}),
|
|
596
|
+
// Styles.
|
|
597
|
+
EditorView4.theme({
|
|
598
|
+
".cm-content": {
|
|
599
|
+
paddingBottom: `${overScroll}px`
|
|
600
|
+
},
|
|
601
|
+
".cm-scroller": {
|
|
602
|
+
overflowAnchor: "none",
|
|
603
|
+
paddingBottom: "0"
|
|
604
|
+
},
|
|
605
|
+
".cm-scroller.cm-hide-scrollbar::-webkit-scrollbar": {
|
|
606
|
+
display: "none"
|
|
607
|
+
},
|
|
608
|
+
".cm-scroller::-webkit-scrollbar-thumb": {
|
|
609
|
+
background: "transparent",
|
|
610
|
+
transition: "background 0.15s"
|
|
611
|
+
},
|
|
612
|
+
"&:hover .cm-scroller::-webkit-scrollbar-thumb": {
|
|
613
|
+
background: "var(--color-scrollbar-thumb)"
|
|
614
|
+
},
|
|
615
|
+
".cm-scroll-button": {
|
|
616
|
+
position: "absolute",
|
|
617
|
+
bottom: "0.5rem",
|
|
618
|
+
right: "1rem"
|
|
619
|
+
}
|
|
596
620
|
})
|
|
597
621
|
];
|
|
598
622
|
};
|
|
599
|
-
|
|
600
|
-
view.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
623
|
+
function createCrawler(view, k = 0.3, maxStep = 2, targetDelta = 0.5) {
|
|
624
|
+
const el = view.scrollDOM;
|
|
625
|
+
let currentTop = 0;
|
|
626
|
+
let rafId = null;
|
|
627
|
+
function frame() {
|
|
628
|
+
const targetTop = el.scrollHeight - el.clientHeight;
|
|
629
|
+
const delta = targetTop - currentTop;
|
|
630
|
+
const absDelta = Math.abs(delta);
|
|
631
|
+
if (absDelta < targetDelta) {
|
|
632
|
+
el.scrollTop = targetTop;
|
|
633
|
+
currentTop = targetTop;
|
|
634
|
+
rafId = null;
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const step = Math.sign(delta) * Math.min(absDelta, Math.max(1, Math.min(absDelta * k, maxStep)));
|
|
638
|
+
currentTop += step;
|
|
639
|
+
el.scrollTop = currentTop;
|
|
640
|
+
rafId = requestAnimationFrame(frame);
|
|
641
|
+
}
|
|
642
|
+
return {
|
|
643
|
+
scroll: () => {
|
|
644
|
+
if (rafId === null) {
|
|
645
|
+
currentTop = el.scrollTop;
|
|
646
|
+
rafId = requestAnimationFrame(frame);
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
cancel: () => {
|
|
650
|
+
if (rafId !== null) {
|
|
651
|
+
cancelAnimationFrame(rafId);
|
|
652
|
+
rafId = null;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}
|
|
607
657
|
|
|
608
|
-
// src/extensions/
|
|
609
|
-
var
|
|
610
|
-
var autoScroll = ({ autoScroll: autoScroll2 = true, threshold = 100, throttleDelay = 1e3, onAutoScroll } = {}) => {
|
|
658
|
+
// src/extensions/auto-scroll.ts
|
|
659
|
+
var autoScroll = (_ = {}) => {
|
|
611
660
|
let buttonContainer;
|
|
612
|
-
let hideTimeout;
|
|
613
|
-
let lastScrollTop = 0;
|
|
614
661
|
let isPinned = true;
|
|
615
|
-
const setPinned = (
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
};
|
|
619
|
-
const hideScrollbar = (view) => {
|
|
620
|
-
view.scrollDOM.classList.add("cm-hide-scrollbar");
|
|
621
|
-
clearTimeout(hideTimeout);
|
|
622
|
-
hideTimeout = setTimeout(() => {
|
|
623
|
-
view.scrollDOM.classList.remove("cm-hide-scrollbar");
|
|
624
|
-
}, 1e3);
|
|
625
|
-
};
|
|
626
|
-
const scrollToBottom = (view, behavior) => {
|
|
627
|
-
setPinned(true);
|
|
628
|
-
hideScrollbar(view);
|
|
629
|
-
const line = view.state.doc.lineAt(view.state.doc.length);
|
|
630
|
-
view.dispatch({
|
|
631
|
-
selection: {
|
|
632
|
-
anchor: line.to,
|
|
633
|
-
head: line.to
|
|
634
|
-
},
|
|
635
|
-
effects: scrollToLineEffect.of({
|
|
636
|
-
line: line.number,
|
|
637
|
-
options: {
|
|
638
|
-
position: "end",
|
|
639
|
-
offset: threshold,
|
|
640
|
-
behavior
|
|
641
|
-
}
|
|
642
|
-
})
|
|
643
|
-
});
|
|
662
|
+
const setPinned = (pinned) => {
|
|
663
|
+
buttonContainer?.classList.toggle("opacity-0", pinned);
|
|
664
|
+
isPinned = pinned;
|
|
644
665
|
};
|
|
645
|
-
const checkDistance = debounce((view) => {
|
|
646
|
-
const scrollerRect = view.scrollDOM.getBoundingClientRect();
|
|
647
|
-
const coords = view.coordsAtPos(view.state.doc.length);
|
|
648
|
-
const distanceFromBottom = coords ? coords.bottom - scrollerRect.bottom : 0;
|
|
649
|
-
setPinned(distanceFromBottom < 0);
|
|
650
|
-
}, 1e3);
|
|
651
|
-
const triggerUpdate = debounce((view) => scrollToBottom(view), throttleDelay);
|
|
652
666
|
return [
|
|
653
667
|
// Update listener for logging when scrolling is needed.
|
|
654
|
-
EditorView5.updateListener.of(({ view,
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
668
|
+
EditorView5.updateListener.of(({ view, heightChanged, state }) => {
|
|
669
|
+
if (heightChanged) {
|
|
670
|
+
if (isPinned) {
|
|
671
|
+
const { scrollTop, scrollHeight, clientHeight } = view.scrollDOM;
|
|
672
|
+
const delta = scrollHeight - scrollTop - clientHeight;
|
|
673
|
+
if (delta > 0 && scrollTop > 0) {
|
|
674
|
+
setPinned(true);
|
|
675
|
+
view.dispatch({
|
|
676
|
+
effects: scrollerCrawlEffect.of(true)
|
|
677
|
+
});
|
|
678
|
+
} else if (delta < 0) {
|
|
679
|
+
setPinned(false);
|
|
659
680
|
}
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
const coords = view.coordsAtPos(view.state.doc.length);
|
|
664
|
-
const scrollerRect = view.scrollDOM.getBoundingClientRect();
|
|
665
|
-
const distanceFromBottom = coords ? scrollerRect.bottom - coords.bottom : 0;
|
|
666
|
-
if (autoScroll2 && distanceFromBottom < threshold) {
|
|
667
|
-
const shouldScroll = onAutoScroll?.({
|
|
668
|
-
view,
|
|
669
|
-
distanceFromBottom
|
|
670
|
-
}) ?? true;
|
|
671
|
-
if (shouldScroll) {
|
|
672
|
-
triggerUpdate(view);
|
|
681
|
+
} else {
|
|
682
|
+
if (state.doc.length === 0) {
|
|
683
|
+
setPinned(true);
|
|
673
684
|
}
|
|
674
|
-
} else if (distanceFromBottom < 0) {
|
|
675
|
-
setPinned(false);
|
|
676
685
|
}
|
|
677
686
|
}
|
|
678
687
|
}),
|
|
679
|
-
// Detect user scroll.
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
688
|
+
// Detect user scroll and unpin (or re-pin if scrolled to the bottom).
|
|
689
|
+
ViewPlugin6.fromClass(class {
|
|
690
|
+
cleanup;
|
|
691
|
+
constructor(view) {
|
|
692
|
+
this.cleanup = createUserScrollDetector(view.scrollDOM, throttle(() => {
|
|
693
|
+
requestAnimationFrame(() => {
|
|
694
|
+
const { scrollTop, scrollHeight, clientHeight } = view.scrollDOM;
|
|
695
|
+
const delta = scrollHeight - scrollTop - clientHeight;
|
|
696
|
+
const pinned = delta === 0;
|
|
697
|
+
setPinned(pinned);
|
|
698
|
+
if (!pinned) {
|
|
699
|
+
view.dispatch({
|
|
700
|
+
effects: scrollerCrawlEffect.of(false)
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
}, 500));
|
|
705
|
+
}
|
|
706
|
+
destroy() {
|
|
707
|
+
this.cleanup();
|
|
690
708
|
}
|
|
691
709
|
}),
|
|
692
710
|
// Scroll button.
|
|
@@ -695,34 +713,33 @@ var autoScroll = ({ autoScroll: autoScroll2 = true, threshold = 100, throttleDel
|
|
|
695
713
|
const icon = Domino.of("dx-icon").attributes({
|
|
696
714
|
icon: "ph--arrow-down--regular"
|
|
697
715
|
});
|
|
698
|
-
const button = Domino.of("button").classNames("dx-button bg-
|
|
716
|
+
const button = Domino.of("button").classNames("dx-button bg-accent-surface").attributes({
|
|
699
717
|
"data-density": "fine"
|
|
700
718
|
}).children(icon).on("click", () => {
|
|
701
|
-
|
|
719
|
+
setPinned(true);
|
|
720
|
+
view.dispatch({
|
|
721
|
+
effects: scrollerLineEffect.of({
|
|
722
|
+
line: -1,
|
|
723
|
+
position: "end",
|
|
724
|
+
behavior: "smooth"
|
|
725
|
+
})
|
|
726
|
+
});
|
|
702
727
|
});
|
|
703
728
|
buttonContainer = Domino.of("div").classNames("cm-scroll-button transition-opacity duration-300 opacity-0").children(button).root;
|
|
704
729
|
view.scrollDOM.parentElement.appendChild(buttonContainer);
|
|
705
730
|
}
|
|
706
|
-
}),
|
|
707
|
-
// Styles.
|
|
708
|
-
EditorView5.theme({
|
|
709
|
-
".cm-scroller": {
|
|
710
|
-
scrollbarWidth: "thin"
|
|
711
|
-
},
|
|
712
|
-
".cm-scroller.cm-hide-scrollbar": {
|
|
713
|
-
scrollbarWidth: "none"
|
|
714
|
-
},
|
|
715
|
-
".cm-scroller.cm-hide-scrollbar::-webkit-scrollbar": {
|
|
716
|
-
display: "none"
|
|
717
|
-
},
|
|
718
|
-
".cm-scroll-button": {
|
|
719
|
-
position: "absolute",
|
|
720
|
-
bottom: "0.5rem",
|
|
721
|
-
right: "1rem"
|
|
722
|
-
}
|
|
723
731
|
})
|
|
724
732
|
];
|
|
725
733
|
};
|
|
734
|
+
function createUserScrollDetector(element, onUserScroll) {
|
|
735
|
+
return combine(addEventListener(element, "wheel", () => onUserScroll(), {
|
|
736
|
+
passive: true
|
|
737
|
+
}), addEventListener(element, "pointerdown", (event) => {
|
|
738
|
+
if (event.clientX > element.getBoundingClientRect().right - (element.offsetWidth - element.clientWidth)) {
|
|
739
|
+
onUserScroll();
|
|
740
|
+
}
|
|
741
|
+
}));
|
|
742
|
+
}
|
|
726
743
|
|
|
727
744
|
// src/extensions/automerge/automerge.ts
|
|
728
745
|
import { next as A3 } from "@automerge/automerge";
|
|
@@ -736,15 +753,15 @@ var initialSync = Transaction.userEvent.of("initial.sync");
|
|
|
736
753
|
|
|
737
754
|
// src/extensions/automerge/cursor.ts
|
|
738
755
|
import { fromCursor, toCursor } from "@dxos/echo-db";
|
|
739
|
-
import { log as
|
|
740
|
-
var
|
|
756
|
+
import { log as log3 } from "@dxos/log";
|
|
757
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/automerge/cursor.ts";
|
|
741
758
|
var cursorConverter = (accessor) => ({
|
|
742
759
|
toCursor: (pos, assoc) => {
|
|
743
760
|
try {
|
|
744
761
|
return toCursor(accessor, pos, assoc);
|
|
745
762
|
} catch (err) {
|
|
746
|
-
|
|
747
|
-
F:
|
|
763
|
+
log3.catch(err, void 0, {
|
|
764
|
+
F: __dxlog_file3,
|
|
748
765
|
L: 15,
|
|
749
766
|
S: void 0,
|
|
750
767
|
C: (f, a) => f(...a)
|
|
@@ -756,8 +773,8 @@ var cursorConverter = (accessor) => ({
|
|
|
756
773
|
try {
|
|
757
774
|
return fromCursor(accessor, cursor2);
|
|
758
775
|
} catch (err) {
|
|
759
|
-
|
|
760
|
-
F:
|
|
776
|
+
log3.catch(err, void 0, {
|
|
777
|
+
F: __dxlog_file3,
|
|
761
778
|
L: 24,
|
|
762
779
|
S: void 0,
|
|
763
780
|
C: (f, a) => f(...a)
|
|
@@ -768,10 +785,10 @@ var cursorConverter = (accessor) => ({
|
|
|
768
785
|
});
|
|
769
786
|
|
|
770
787
|
// src/extensions/automerge/defs.ts
|
|
771
|
-
import { Annotation, StateEffect as
|
|
788
|
+
import { Annotation, StateEffect as StateEffect2 } from "@codemirror/state";
|
|
772
789
|
var getPath = (state, field) => state.field(field).path;
|
|
773
790
|
var getLastHeads = (state, field) => state.field(field).lastHeads;
|
|
774
|
-
var updateHeadsEffect =
|
|
791
|
+
var updateHeadsEffect = StateEffect2.define({});
|
|
775
792
|
var updateHeads = (newHeads) => updateHeadsEffect.of({
|
|
776
793
|
newHeads
|
|
777
794
|
});
|
|
@@ -782,7 +799,7 @@ var isReconcile = (tr) => {
|
|
|
782
799
|
|
|
783
800
|
// src/extensions/automerge/sync.ts
|
|
784
801
|
import { next as A2 } from "@automerge/automerge";
|
|
785
|
-
import { log as
|
|
802
|
+
import { log as log4 } from "@dxos/log";
|
|
786
803
|
|
|
787
804
|
// src/extensions/automerge/update-automerge.ts
|
|
788
805
|
import { next as A } from "@automerge/automerge";
|
|
@@ -923,7 +940,7 @@ var charPath = (textPath, candidatePath) => {
|
|
|
923
940
|
};
|
|
924
941
|
|
|
925
942
|
// src/extensions/automerge/sync.ts
|
|
926
|
-
var
|
|
943
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/automerge/sync.ts";
|
|
927
944
|
var Syncer = class {
|
|
928
945
|
_handle;
|
|
929
946
|
_state;
|
|
@@ -946,8 +963,8 @@ var Syncer = class {
|
|
|
946
963
|
this._pending = false;
|
|
947
964
|
}
|
|
948
965
|
onEditorChange(view) {
|
|
949
|
-
|
|
950
|
-
F:
|
|
966
|
+
log4("onEditorChange", void 0, {
|
|
967
|
+
F: __dxlog_file4,
|
|
951
968
|
L: 45,
|
|
952
969
|
S: this,
|
|
953
970
|
C: (f, a) => f(...a)
|
|
@@ -962,8 +979,8 @@ var Syncer = class {
|
|
|
962
979
|
}
|
|
963
980
|
}
|
|
964
981
|
onAutomergeChange(view) {
|
|
965
|
-
|
|
966
|
-
F:
|
|
982
|
+
log4("onAutomergeChange", void 0, {
|
|
983
|
+
F: __dxlog_file4,
|
|
967
984
|
L: 60,
|
|
968
985
|
S: this,
|
|
969
986
|
C: (f, a) => f(...a)
|
|
@@ -1029,6 +1046,15 @@ var automerge = (accessor) => {
|
|
|
1029
1046
|
const value = DocAccessor.getValue(accessor);
|
|
1030
1047
|
const current = this._view.state.doc.toString();
|
|
1031
1048
|
if (value !== current) {
|
|
1049
|
+
console.warn("ENABLING INITIAL SYNC -- THIS MAY BE A REGRESSION");
|
|
1050
|
+
this._view.dispatch({
|
|
1051
|
+
changes: {
|
|
1052
|
+
from: 0,
|
|
1053
|
+
to: this._view.state.doc.length,
|
|
1054
|
+
insert: value
|
|
1055
|
+
},
|
|
1056
|
+
annotations: initialSync
|
|
1057
|
+
});
|
|
1032
1058
|
}
|
|
1033
1059
|
});
|
|
1034
1060
|
}
|
|
@@ -1056,7 +1082,7 @@ import { Annotation as Annotation2, RangeSet } from "@codemirror/state";
|
|
|
1056
1082
|
import { Decoration as Decoration5, EditorView as EditorView7, ViewPlugin as ViewPlugin8, WidgetType as WidgetType3 } from "@codemirror/view";
|
|
1057
1083
|
import { Event } from "@dxos/async";
|
|
1058
1084
|
import { Context } from "@dxos/context";
|
|
1059
|
-
var
|
|
1085
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/awareness/awareness.ts";
|
|
1060
1086
|
var dummyProvider = {
|
|
1061
1087
|
remoteStateChange: new Event(),
|
|
1062
1088
|
open: () => {
|
|
@@ -1080,7 +1106,7 @@ var awareness = (provider = dummyProvider) => {
|
|
|
1080
1106
|
};
|
|
1081
1107
|
var RemoteSelectionsDecorator = class {
|
|
1082
1108
|
_ctx = new Context(void 0, {
|
|
1083
|
-
F:
|
|
1109
|
+
F: __dxlog_file5,
|
|
1084
1110
|
L: 80
|
|
1085
1111
|
});
|
|
1086
1112
|
_cursorConverter;
|
|
@@ -1293,8 +1319,8 @@ var styles = EditorView7.theme({
|
|
|
1293
1319
|
import { DeferredTask, Event as Event2, sleep } from "@dxos/async";
|
|
1294
1320
|
import { Context as Context2 } from "@dxos/context";
|
|
1295
1321
|
import { invariant } from "@dxos/invariant";
|
|
1296
|
-
import { log as
|
|
1297
|
-
var
|
|
1322
|
+
import { log as log5 } from "@dxos/log";
|
|
1323
|
+
var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/awareness/awareness-provider.ts";
|
|
1298
1324
|
var DEBOUNCE_INTERVAL = 100;
|
|
1299
1325
|
var SpaceAwarenessProvider = class {
|
|
1300
1326
|
_remoteStates = /* @__PURE__ */ new Map();
|
|
@@ -1314,7 +1340,7 @@ var SpaceAwarenessProvider = class {
|
|
|
1314
1340
|
}
|
|
1315
1341
|
open() {
|
|
1316
1342
|
this._ctx = new Context2(void 0, {
|
|
1317
|
-
F:
|
|
1343
|
+
F: __dxlog_file6,
|
|
1318
1344
|
L: 57
|
|
1319
1345
|
});
|
|
1320
1346
|
this._postTask = new DeferredTask(this._ctx, async () => {
|
|
@@ -1341,10 +1367,10 @@ var SpaceAwarenessProvider = class {
|
|
|
1341
1367
|
void this._messenger.postMessage(this._channel, {
|
|
1342
1368
|
kind: "query"
|
|
1343
1369
|
}).catch((err) => {
|
|
1344
|
-
|
|
1370
|
+
log5.debug("failed to query awareness", {
|
|
1345
1371
|
err
|
|
1346
1372
|
}, {
|
|
1347
|
-
F:
|
|
1373
|
+
F: __dxlog_file6,
|
|
1348
1374
|
L: 91,
|
|
1349
1375
|
S: this,
|
|
1350
1376
|
C: (f, a) => f(...a)
|
|
@@ -1361,7 +1387,7 @@ var SpaceAwarenessProvider = class {
|
|
|
1361
1387
|
}
|
|
1362
1388
|
update(position) {
|
|
1363
1389
|
invariant(this._postTask, void 0, {
|
|
1364
|
-
F:
|
|
1390
|
+
F: __dxlog_file6,
|
|
1365
1391
|
L: 106,
|
|
1366
1392
|
S: this,
|
|
1367
1393
|
A: [
|
|
@@ -1378,7 +1404,7 @@ var SpaceAwarenessProvider = class {
|
|
|
1378
1404
|
}
|
|
1379
1405
|
_handleQueryMessage() {
|
|
1380
1406
|
invariant(this._postTask, void 0, {
|
|
1381
|
-
F:
|
|
1407
|
+
F: __dxlog_file6,
|
|
1382
1408
|
L: 117,
|
|
1383
1409
|
S: this,
|
|
1384
1410
|
A: [
|
|
@@ -1390,7 +1416,7 @@ var SpaceAwarenessProvider = class {
|
|
|
1390
1416
|
}
|
|
1391
1417
|
_handlePostMessage(message) {
|
|
1392
1418
|
invariant(message.kind === "post", void 0, {
|
|
1393
|
-
F:
|
|
1419
|
+
F: __dxlog_file6,
|
|
1394
1420
|
L: 122,
|
|
1395
1421
|
S: this,
|
|
1396
1422
|
A: [
|
|
@@ -1406,9 +1432,9 @@ var SpaceAwarenessProvider = class {
|
|
|
1406
1432
|
// src/extensions/blast.ts
|
|
1407
1433
|
import { EditorView as EditorView8, keymap as keymap3 } from "@codemirror/view";
|
|
1408
1434
|
import defaultsDeep from "lodash.defaultsdeep";
|
|
1409
|
-
import { throttle } from "@dxos/async";
|
|
1435
|
+
import { throttle as throttle2 } from "@dxos/async";
|
|
1410
1436
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1411
|
-
var
|
|
1437
|
+
var __dxlog_file7 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/blast.ts";
|
|
1412
1438
|
var defaultOptions = {
|
|
1413
1439
|
effect: 2,
|
|
1414
1440
|
maxParticles: 200,
|
|
@@ -1527,7 +1553,7 @@ var Blaster = class {
|
|
|
1527
1553
|
}
|
|
1528
1554
|
initialize() {
|
|
1529
1555
|
invariant2(!this._canvas && !this._ctx, void 0, {
|
|
1530
|
-
F:
|
|
1556
|
+
F: __dxlog_file7,
|
|
1531
1557
|
L: 142,
|
|
1532
1558
|
S: this,
|
|
1533
1559
|
A: [
|
|
@@ -1564,7 +1590,7 @@ var Blaster = class {
|
|
|
1564
1590
|
}
|
|
1565
1591
|
start() {
|
|
1566
1592
|
invariant2(this._canvas && this._ctx, void 0, {
|
|
1567
|
-
F:
|
|
1593
|
+
F: __dxlog_file7,
|
|
1568
1594
|
L: 181,
|
|
1569
1595
|
S: this,
|
|
1570
1596
|
A: [
|
|
@@ -1598,11 +1624,11 @@ var Blaster = class {
|
|
|
1598
1624
|
this.drawParticles();
|
|
1599
1625
|
requestAnimationFrame(this.loop.bind(this));
|
|
1600
1626
|
}
|
|
1601
|
-
shake =
|
|
1627
|
+
shake = throttle2(({ time }) => {
|
|
1602
1628
|
this._shakeTime = this._shakeTimeMax || time;
|
|
1603
1629
|
this._shakeTimeMax = time;
|
|
1604
1630
|
}, 100);
|
|
1605
|
-
spawn =
|
|
1631
|
+
spawn = throttle2(({ element, point }) => {
|
|
1606
1632
|
const color = getRGBComponents(element, this._options.color);
|
|
1607
1633
|
const numParticles = random(this._options.particleNumRange.min, this._options.particleNumRange.max);
|
|
1608
1634
|
const dir = this._lastPoint.x === point.x ? 0 : this._lastPoint.x < point.x ? 1 : -1;
|
|
@@ -1776,11 +1802,11 @@ var blocks = () => [
|
|
|
1776
1802
|
".cm-line.block-line": {
|
|
1777
1803
|
paddingLeft: "0.75rem",
|
|
1778
1804
|
paddingRight: "0.75rem",
|
|
1779
|
-
borderLeft: "1px solid var(--
|
|
1780
|
-
borderRight: "1px solid var(--
|
|
1805
|
+
borderLeft: "1px solid var(--color-subdued-separator)",
|
|
1806
|
+
borderRight: "1px solid var(--color-subdued-separator)"
|
|
1781
1807
|
},
|
|
1782
1808
|
".cm-line.block-single": {
|
|
1783
|
-
border: "1px solid var(--
|
|
1809
|
+
border: "1px solid var(--color-subdued-separator)",
|
|
1784
1810
|
borderRadius: "6px",
|
|
1785
1811
|
paddingTop: "0.5rem",
|
|
1786
1812
|
paddingBottom: "0.5rem",
|
|
@@ -1788,7 +1814,7 @@ var blocks = () => [
|
|
|
1788
1814
|
marginBottom: "0.5rem"
|
|
1789
1815
|
},
|
|
1790
1816
|
".cm-line.block-first": {
|
|
1791
|
-
borderTop: "1px solid var(--
|
|
1817
|
+
borderTop: "1px solid var(--color-subdued-separator)",
|
|
1792
1818
|
borderTopLeftRadius: "6px",
|
|
1793
1819
|
borderTopRightRadius: "6px",
|
|
1794
1820
|
paddingTop: "0.5rem",
|
|
@@ -1796,7 +1822,7 @@ var blocks = () => [
|
|
|
1796
1822
|
},
|
|
1797
1823
|
".cm-line.block-middle": {},
|
|
1798
1824
|
".cm-line.block-last": {
|
|
1799
|
-
borderBottom: "1px solid var(--
|
|
1825
|
+
borderBottom: "1px solid var(--color-subdued-separator)",
|
|
1800
1826
|
borderBottomLeftRadius: "6px",
|
|
1801
1827
|
borderBottomRightRadius: "6px",
|
|
1802
1828
|
paddingBottom: "0.5rem",
|
|
@@ -1806,13 +1832,13 @@ var blocks = () => [
|
|
|
1806
1832
|
];
|
|
1807
1833
|
|
|
1808
1834
|
// src/extensions/bookmarks.ts
|
|
1809
|
-
import { Prec as Prec3, StateEffect as
|
|
1835
|
+
import { Prec as Prec3, StateEffect as StateEffect3, StateField as StateField2 } from "@codemirror/state";
|
|
1810
1836
|
import { keymap as keymap4 } from "@codemirror/view";
|
|
1811
|
-
import { log as
|
|
1812
|
-
var
|
|
1813
|
-
var addBookmark =
|
|
1814
|
-
var removeBookmark =
|
|
1815
|
-
var clearBookmarks =
|
|
1837
|
+
import { log as log6 } from "@dxos/log";
|
|
1838
|
+
var __dxlog_file8 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/bookmarks.ts";
|
|
1839
|
+
var addBookmark = StateEffect3.define();
|
|
1840
|
+
var removeBookmark = StateEffect3.define();
|
|
1841
|
+
var clearBookmarks = StateEffect3.define();
|
|
1816
1842
|
var bookmarks = () => {
|
|
1817
1843
|
return [
|
|
1818
1844
|
bookmarksField,
|
|
@@ -1821,8 +1847,8 @@ var bookmarks = () => {
|
|
|
1821
1847
|
key: "Mod-ArrowUp",
|
|
1822
1848
|
run: (view) => {
|
|
1823
1849
|
const bookmarks2 = view.state.field(bookmarksField);
|
|
1824
|
-
|
|
1825
|
-
F:
|
|
1850
|
+
log6("up", bookmarks2, {
|
|
1851
|
+
F: __dxlog_file8,
|
|
1826
1852
|
L: 29,
|
|
1827
1853
|
S: void 0,
|
|
1828
1854
|
C: (f, a) => f(...a)
|
|
@@ -1834,8 +1860,8 @@ var bookmarks = () => {
|
|
|
1834
1860
|
key: "Mod-ArrowDown",
|
|
1835
1861
|
run: (view) => {
|
|
1836
1862
|
const bookmarks2 = view.state.field(bookmarksField);
|
|
1837
|
-
|
|
1838
|
-
F:
|
|
1863
|
+
log6("down", bookmarks2, {
|
|
1864
|
+
F: __dxlog_file8,
|
|
1839
1865
|
L: 37,
|
|
1840
1866
|
S: void 0,
|
|
1841
1867
|
C: (f, a) => f(...a)
|
|
@@ -1876,22 +1902,22 @@ var bookmarksField = StateField2.define({
|
|
|
1876
1902
|
|
|
1877
1903
|
// src/extensions/comments.ts
|
|
1878
1904
|
import { invertedEffects } from "@codemirror/commands";
|
|
1879
|
-
import { StateEffect as
|
|
1905
|
+
import { StateEffect as StateEffect4, StateField as StateField3 } from "@codemirror/state";
|
|
1880
1906
|
import { Decoration as Decoration7, EditorView as EditorView11, ViewPlugin as ViewPlugin10, hoverTooltip, keymap as keymap6 } from "@codemirror/view";
|
|
1881
1907
|
import sortBy from "lodash.sortby";
|
|
1882
|
-
import { debounce as
|
|
1883
|
-
import { log as
|
|
1908
|
+
import { debounce as debounce2 } from "@dxos/async";
|
|
1909
|
+
import { log as log7 } from "@dxos/log";
|
|
1884
1910
|
import { isNonNullable } from "@dxos/util";
|
|
1885
1911
|
|
|
1886
1912
|
// src/extensions/selection.ts
|
|
1887
1913
|
import { Transaction as Transaction3 } from "@codemirror/state";
|
|
1888
1914
|
import { EditorView as EditorView10, keymap as keymap5 } from "@codemirror/view";
|
|
1889
|
-
import { debounce
|
|
1915
|
+
import { debounce } from "@dxos/async";
|
|
1890
1916
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1891
1917
|
import { isTruthy } from "@dxos/util";
|
|
1892
|
-
var
|
|
1918
|
+
var __dxlog_file9 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/selection.ts";
|
|
1893
1919
|
var documentId = singleValueFacet();
|
|
1894
|
-
var stateRestoreAnnotation = "dxos.
|
|
1920
|
+
var stateRestoreAnnotation = "org.dxos.cm.state-restore";
|
|
1895
1921
|
var createEditorStateTransaction = ({ scrollTo, selection }) => {
|
|
1896
1922
|
return {
|
|
1897
1923
|
selection,
|
|
@@ -1905,7 +1931,7 @@ var createEditorStateTransaction = ({ scrollTo, selection }) => {
|
|
|
1905
1931
|
var createEditorStateStore = (keyPrefix) => ({
|
|
1906
1932
|
getState: (id) => {
|
|
1907
1933
|
invariant3(id, void 0, {
|
|
1908
|
-
F:
|
|
1934
|
+
F: __dxlog_file9,
|
|
1909
1935
|
L: 47,
|
|
1910
1936
|
S: void 0,
|
|
1911
1937
|
A: [
|
|
@@ -1918,7 +1944,7 @@ var createEditorStateStore = (keyPrefix) => ({
|
|
|
1918
1944
|
},
|
|
1919
1945
|
setState: (id, state) => {
|
|
1920
1946
|
invariant3(id, void 0, {
|
|
1921
|
-
F:
|
|
1947
|
+
F: __dxlog_file9,
|
|
1922
1948
|
L: 53,
|
|
1923
1949
|
S: void 0,
|
|
1924
1950
|
A: [
|
|
@@ -1930,7 +1956,7 @@ var createEditorStateStore = (keyPrefix) => ({
|
|
|
1930
1956
|
}
|
|
1931
1957
|
});
|
|
1932
1958
|
var selectionState = ({ getState, setState } = {}) => {
|
|
1933
|
-
const setStateDebounced =
|
|
1959
|
+
const setStateDebounced = debounce(setState, 1e3);
|
|
1934
1960
|
return [
|
|
1935
1961
|
// TODO(burdon): Track scrolling (currently only updates when cursor moves).
|
|
1936
1962
|
// EditorView.domEventHandlers({
|
|
@@ -1977,10 +2003,10 @@ var selectionState = ({ getState, setState } = {}) => {
|
|
|
1977
2003
|
};
|
|
1978
2004
|
|
|
1979
2005
|
// src/extensions/comments.ts
|
|
1980
|
-
var
|
|
1981
|
-
var setComments =
|
|
1982
|
-
var setSelection =
|
|
1983
|
-
var setCommentState =
|
|
2006
|
+
var __dxlog_file10 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/comments.ts";
|
|
2007
|
+
var setComments = StateEffect4.define();
|
|
2008
|
+
var setSelection = StateEffect4.define();
|
|
2009
|
+
var setCommentState = StateEffect4.define();
|
|
1984
2010
|
var commentsState = StateField3.define({
|
|
1985
2011
|
create: (state) => ({
|
|
1986
2012
|
id: state.facet(documentId),
|
|
@@ -2022,14 +2048,14 @@ var commentsState = StateField3.define({
|
|
|
2022
2048
|
var styles2 = EditorView11.theme({
|
|
2023
2049
|
".cm-comment, .cm-comment-current": {
|
|
2024
2050
|
padding: "3px 0",
|
|
2025
|
-
color: "var(--
|
|
2026
|
-
backgroundColor: "var(--
|
|
2051
|
+
color: "var(--color-cm-comment-text)",
|
|
2052
|
+
backgroundColor: "var(--color-cm-comment-surface)"
|
|
2027
2053
|
},
|
|
2028
2054
|
".cm-comment > span, .cm-comment-current > span": {
|
|
2029
2055
|
boxDecorationBreak: "clone",
|
|
2030
|
-
boxShadow: "0 0 1px 3px var(--
|
|
2031
|
-
backgroundColor: "var(--
|
|
2032
|
-
color: "var(--
|
|
2056
|
+
boxShadow: "0 0 1px 3px var(--color-cm-comment-surface)",
|
|
2057
|
+
backgroundColor: "var(--color-cm-comment-surface)",
|
|
2058
|
+
color: "var(--color-cm-comment-text)",
|
|
2033
2059
|
cursor: "pointer"
|
|
2034
2060
|
}
|
|
2035
2061
|
});
|
|
@@ -2047,8 +2073,8 @@ var commentsDecorations = EditorView11.decorations.compute([
|
|
|
2047
2073
|
const decorations2 = sortBy(comments2 ?? [], (range) => range.range.from)?.flatMap((comment) => {
|
|
2048
2074
|
const range = comment.range;
|
|
2049
2075
|
if (!range) {
|
|
2050
|
-
|
|
2051
|
-
F:
|
|
2076
|
+
log7.warn("Invalid range:", range, {
|
|
2077
|
+
F: __dxlog_file10,
|
|
2052
2078
|
L: 140,
|
|
2053
2079
|
S: void 0,
|
|
2054
2080
|
C: (f, a) => f(...a)
|
|
@@ -2062,7 +2088,7 @@ var commentsDecorations = EditorView11.decorations.compute([
|
|
|
2062
2088
|
}).filter(isNonNullable);
|
|
2063
2089
|
return Decoration7.set(decorations2);
|
|
2064
2090
|
});
|
|
2065
|
-
var commentClickedEffect =
|
|
2091
|
+
var commentClickedEffect = StateEffect4.define();
|
|
2066
2092
|
var handleCommentClick = EditorView11.domEventHandlers({
|
|
2067
2093
|
click: (event, view) => {
|
|
2068
2094
|
let target = event.target;
|
|
@@ -2180,7 +2206,7 @@ var mapTrackedComment = (comment, changes) => ({
|
|
|
2180
2206
|
from: changes.mapPos(comment.from, 1),
|
|
2181
2207
|
to: changes.mapPos(comment.to, 1)
|
|
2182
2208
|
});
|
|
2183
|
-
var restoreCommentEffect =
|
|
2209
|
+
var restoreCommentEffect = StateEffect4.define({
|
|
2184
2210
|
map: mapTrackedComment
|
|
2185
2211
|
});
|
|
2186
2212
|
var createComment = (view) => {
|
|
@@ -2214,7 +2240,7 @@ var createComment = (view) => {
|
|
|
2214
2240
|
var optionsFacet = singleValueFacet();
|
|
2215
2241
|
var comments = (options = {}) => {
|
|
2216
2242
|
const { key: shortcut = "meta-'" } = options;
|
|
2217
|
-
const handleSelect =
|
|
2243
|
+
const handleSelect = debounce2((state) => options.onSelect?.(state), 200);
|
|
2218
2244
|
return [
|
|
2219
2245
|
optionsFacet.of(options),
|
|
2220
2246
|
options.id ? documentId.of(options.id) : void 0,
|
|
@@ -2392,9 +2418,9 @@ var createExternalCommentSync = (id, subscribe, getComments) => ViewPlugin10.fro
|
|
|
2392
2418
|
// src/extensions/debug.ts
|
|
2393
2419
|
import { syntaxTree } from "@codemirror/language";
|
|
2394
2420
|
import { StateField as StateField4 } from "@codemirror/state";
|
|
2395
|
-
var debugNodeLogger = (
|
|
2421
|
+
var debugNodeLogger = (log12 = console.log) => {
|
|
2396
2422
|
const logTokens = (state) => syntaxTree(state).iterate({
|
|
2397
|
-
enter: (node) =>
|
|
2423
|
+
enter: (node) => log12(node.type)
|
|
2398
2424
|
});
|
|
2399
2425
|
return StateField4.define({
|
|
2400
2426
|
create: (state) => logTokens(state),
|
|
@@ -2429,8 +2455,8 @@ var dropFile = (options = {}) => {
|
|
|
2429
2455
|
};
|
|
2430
2456
|
var styles3 = EditorView12.theme({
|
|
2431
2457
|
".cm-dropCursor": {
|
|
2432
|
-
borderLeft: "2px solid var(--
|
|
2433
|
-
color: "var(--
|
|
2458
|
+
borderLeft: "2px solid var(--color-accent-text)",
|
|
2459
|
+
color: "var(--color-accent-text)",
|
|
2434
2460
|
padding: "0 4px"
|
|
2435
2461
|
},
|
|
2436
2462
|
".cm-dropCursor:after": {
|
|
@@ -2448,43 +2474,62 @@ import { EditorView as EditorView15, ViewPlugin as ViewPlugin11, drawSelection,
|
|
|
2448
2474
|
import { vscodeDarkStyle, vscodeLightStyle } from "@uiw/codemirror-theme-vscode";
|
|
2449
2475
|
import defaultsDeep2 from "lodash.defaultsdeep";
|
|
2450
2476
|
import { generateName } from "@dxos/display-name";
|
|
2451
|
-
import { log as
|
|
2477
|
+
import { log as log8 } from "@dxos/log";
|
|
2452
2478
|
import { hexToHue, isTruthy as isTruthy2 } from "@dxos/util";
|
|
2453
2479
|
|
|
2454
|
-
// src/styles/
|
|
2480
|
+
// src/styles/theme.ts
|
|
2481
|
+
import { EditorView as EditorView13 } from "@codemirror/view";
|
|
2455
2482
|
import { mx as mx3 } from "@dxos/ui-theme";
|
|
2456
2483
|
var headings = {
|
|
2457
|
-
1:
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2484
|
+
1: {
|
|
2485
|
+
className: "text-4xl",
|
|
2486
|
+
fontSize: "var(--text-4xl)",
|
|
2487
|
+
lineHeight: "var(--text-4xl--line-height)"
|
|
2488
|
+
},
|
|
2489
|
+
2: {
|
|
2490
|
+
className: "text-3xl",
|
|
2491
|
+
fontSize: "var(--text-3xl)",
|
|
2492
|
+
lineHeight: "var(--text-3xl--line-height)"
|
|
2493
|
+
},
|
|
2494
|
+
3: {
|
|
2495
|
+
className: "text-2xl",
|
|
2496
|
+
fontSize: "var(--text-2xl)",
|
|
2497
|
+
lineHeight: "var(--text-2xl--line-height)"
|
|
2498
|
+
},
|
|
2499
|
+
4: {
|
|
2500
|
+
className: "text-xl",
|
|
2501
|
+
fontSize: "var(--text-xl)",
|
|
2502
|
+
lineHeight: "var(--text-xl--line-height)"
|
|
2503
|
+
},
|
|
2504
|
+
5: {
|
|
2505
|
+
className: "text-lg",
|
|
2506
|
+
fontSize: "var(--text-lg)",
|
|
2507
|
+
lineHeight: "var(--text-lg--line-height)"
|
|
2508
|
+
},
|
|
2509
|
+
6: {
|
|
2510
|
+
className: "text-base",
|
|
2511
|
+
fontSize: "var(--text-base)",
|
|
2512
|
+
lineHeight: "var(--text-base--line-height)"
|
|
2513
|
+
}
|
|
2463
2514
|
};
|
|
2464
2515
|
var markdownTheme = {
|
|
2465
|
-
code: "font-mono
|
|
2466
|
-
codeMark: "font-mono text-
|
|
2516
|
+
code: "font-mono no-underline! text-cm-code",
|
|
2517
|
+
codeMark: "font-mono text-cm-code-mark",
|
|
2467
2518
|
mark: "opacity-50",
|
|
2468
|
-
heading: (level) => {
|
|
2469
|
-
|
|
2470
|
-
|
|
2519
|
+
heading: (level) => ({
|
|
2520
|
+
className: mx3(headings[level].className, "font-light text-cm-heading"),
|
|
2521
|
+
color: "var(--color-cm-heading) !important",
|
|
2522
|
+
lineHeight: headings[level].lineHeight,
|
|
2523
|
+
fontSize: headings[level].fontSize,
|
|
2524
|
+
fontWeight: "100 !important"
|
|
2525
|
+
})
|
|
2471
2526
|
};
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
import { EditorView as EditorView13 } from "@codemirror/view";
|
|
2475
|
-
|
|
2476
|
-
// src/styles/tokens.ts
|
|
2477
|
-
import { tokens } from "@dxos/ui-theme";
|
|
2478
|
-
import { get } from "@dxos/util";
|
|
2479
|
-
var getToken = (path, defaultValue) => {
|
|
2480
|
-
const value = get(tokens, path, defaultValue);
|
|
2481
|
-
return value?.toString() ?? "";
|
|
2482
|
-
};
|
|
2483
|
-
var fontBody = getToken("fontFamily.body");
|
|
2484
|
-
var fontMono = getToken("fontFamily.mono");
|
|
2485
|
-
|
|
2486
|
-
// src/styles/theme.ts
|
|
2527
|
+
var fontBody = "Inter Variable, ui-sans-serif, system-ui, sans-serif";
|
|
2528
|
+
var fontMono = "JetBrains Mono Variable, ui-monospace, Cascadia Code, Source Code Pro, monospace";
|
|
2487
2529
|
var baseTheme = EditorView13.baseTheme({
|
|
2530
|
+
/**
|
|
2531
|
+
* Outer frame.
|
|
2532
|
+
*/
|
|
2488
2533
|
"&": {},
|
|
2489
2534
|
"&.cm-focused": {
|
|
2490
2535
|
outline: "none"
|
|
@@ -2493,7 +2538,18 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2493
2538
|
* Scroller
|
|
2494
2539
|
*/
|
|
2495
2540
|
".cm-scroller": {
|
|
2496
|
-
|
|
2541
|
+
overflowAnchor: "none"
|
|
2542
|
+
},
|
|
2543
|
+
".cm-scroller::-webkit-scrollbar": {
|
|
2544
|
+
width: "8px"
|
|
2545
|
+
},
|
|
2546
|
+
".cm-scroller::-webkit-scrollbar-track": {},
|
|
2547
|
+
".cm-scroller::-webkit-scrollbar-thumb": {
|
|
2548
|
+
background: "transparent",
|
|
2549
|
+
transition: "background 0.15s"
|
|
2550
|
+
},
|
|
2551
|
+
"&:hover .cm-scroller::-webkit-scrollbar-thumb": {
|
|
2552
|
+
background: "var(--color-scrollbar-thumb)"
|
|
2497
2553
|
},
|
|
2498
2554
|
/**
|
|
2499
2555
|
* Content
|
|
@@ -2515,8 +2571,8 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2515
2571
|
".cm-gutter": {},
|
|
2516
2572
|
".cm-gutter.cm-lineNumbers": {
|
|
2517
2573
|
paddingRight: "4px",
|
|
2518
|
-
borderRight: "1px solid var(--
|
|
2519
|
-
color: "var(--
|
|
2574
|
+
borderRight: "1px solid var(--color-subdued-separator)",
|
|
2575
|
+
color: "var(--color-subdued)"
|
|
2520
2576
|
},
|
|
2521
2577
|
".cm-gutter.cm-lineNumbers .cm-gutterElement": {
|
|
2522
2578
|
minWidth: "40px"
|
|
@@ -2536,25 +2592,25 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2536
2592
|
paddingInline: 0
|
|
2537
2593
|
},
|
|
2538
2594
|
".cm-activeLine": {
|
|
2539
|
-
background: "var(--
|
|
2595
|
+
background: "var(--color-cm-active-line)"
|
|
2540
2596
|
},
|
|
2541
2597
|
/**
|
|
2542
2598
|
* Cursor (layer).
|
|
2543
2599
|
*/
|
|
2544
2600
|
".cm-cursor, .cm-dropCursor": {
|
|
2545
|
-
borderLeft: "2px solid var(--
|
|
2601
|
+
borderLeft: "2px solid var(--color-cm-cursor)"
|
|
2546
2602
|
},
|
|
2547
2603
|
".cm-placeholder": {
|
|
2548
|
-
color: "var(--
|
|
2604
|
+
color: "var(--color-placeholder)"
|
|
2549
2605
|
},
|
|
2550
2606
|
/**
|
|
2551
2607
|
* Selection (layer).
|
|
2552
2608
|
*/
|
|
2553
2609
|
".cm-selectionBackground": {
|
|
2554
|
-
background: "var(--
|
|
2610
|
+
background: "var(--color-cm-selection)"
|
|
2555
2611
|
},
|
|
2556
2612
|
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
|
|
2557
|
-
background: "var(--
|
|
2613
|
+
background: "var(--color-cm-focused-selection)"
|
|
2558
2614
|
},
|
|
2559
2615
|
/**
|
|
2560
2616
|
* Search.
|
|
@@ -2564,8 +2620,8 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2564
2620
|
margin: "0 -3px",
|
|
2565
2621
|
padding: "3px",
|
|
2566
2622
|
borderRadius: "3px",
|
|
2567
|
-
background: "var(--
|
|
2568
|
-
color: "var(--
|
|
2623
|
+
background: "var(--color-cm-highlight-surface)",
|
|
2624
|
+
color: "var(--color-cm-highlight)"
|
|
2569
2625
|
},
|
|
2570
2626
|
".cm-searchMatch-selected": {
|
|
2571
2627
|
textDecoration: "underline"
|
|
@@ -2576,20 +2632,29 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2576
2632
|
".cm-link": {
|
|
2577
2633
|
textDecorationLine: "underline",
|
|
2578
2634
|
textDecorationThickness: "1px",
|
|
2579
|
-
textDecorationColor: "var(--
|
|
2635
|
+
textDecorationColor: "var(--color-separator)",
|
|
2580
2636
|
textUnderlineOffset: "2px",
|
|
2581
2637
|
borderRadius: ".125rem"
|
|
2582
2638
|
},
|
|
2583
2639
|
".cm-link > span": {
|
|
2584
|
-
color: "var(--
|
|
2640
|
+
color: "var(--color-accent-text)"
|
|
2641
|
+
},
|
|
2642
|
+
".cm-link > span:hover": {
|
|
2643
|
+
color: "var(--color-accent-text-hover)"
|
|
2585
2644
|
},
|
|
2586
2645
|
/**
|
|
2587
2646
|
* Tooltip.
|
|
2588
2647
|
*/
|
|
2589
2648
|
".cm-tooltip": {
|
|
2590
|
-
background: "var(--
|
|
2649
|
+
background: "var(--color-modal-surface)"
|
|
2591
2650
|
},
|
|
2592
2651
|
".cm-tooltip-below": {},
|
|
2652
|
+
".cm-tooltip-hover": {
|
|
2653
|
+
background: "var(--color-modal-surface)",
|
|
2654
|
+
border: "1px solid var(--color-separator)",
|
|
2655
|
+
borderRadius: "4px",
|
|
2656
|
+
overflow: "hidden"
|
|
2657
|
+
},
|
|
2593
2658
|
/**
|
|
2594
2659
|
* Autocomplete.
|
|
2595
2660
|
* https://github.com/codemirror/autocomplete/blob/main/src/completion.ts
|
|
@@ -2597,7 +2662,7 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2597
2662
|
".cm-tooltip.cm-tooltip-autocomplete": {
|
|
2598
2663
|
marginTop: "6px",
|
|
2599
2664
|
marginLeft: "-10px",
|
|
2600
|
-
border: "2px solid var(--
|
|
2665
|
+
border: "2px solid var(--color-separator)",
|
|
2601
2666
|
borderRadius: "4px"
|
|
2602
2667
|
},
|
|
2603
2668
|
".cm-tooltip.cm-tooltip-autocomplete > ul": {
|
|
@@ -2607,12 +2672,12 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2607
2672
|
padding: "4px"
|
|
2608
2673
|
},
|
|
2609
2674
|
".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]": {
|
|
2610
|
-
background: "var(--
|
|
2611
|
-
color: "var(--
|
|
2675
|
+
background: "var(--color-active-surface)",
|
|
2676
|
+
color: "var(--color-base-surface-text)"
|
|
2612
2677
|
},
|
|
2613
2678
|
".cm-tooltip.cm-tooltip-autocomplete > ul > completion-section": {
|
|
2614
2679
|
paddingLeft: "4px !important",
|
|
2615
|
-
color: "var(--
|
|
2680
|
+
color: "var(--color-base-surface-text)"
|
|
2616
2681
|
},
|
|
2617
2682
|
/**
|
|
2618
2683
|
* Completion info.
|
|
@@ -2621,17 +2686,17 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2621
2686
|
width: "360px !important",
|
|
2622
2687
|
margin: "-10px 1px 0 1px",
|
|
2623
2688
|
padding: "8px !important",
|
|
2624
|
-
borderColor: "var(--
|
|
2689
|
+
borderColor: "var(--color-separator)"
|
|
2625
2690
|
},
|
|
2626
2691
|
".cm-completionIcon": {
|
|
2627
2692
|
display: "none"
|
|
2628
2693
|
},
|
|
2629
2694
|
".cm-completionLabel": {
|
|
2630
|
-
color: "var(--
|
|
2695
|
+
color: "var(--color-description)",
|
|
2631
2696
|
padding: "0 4px"
|
|
2632
2697
|
},
|
|
2633
2698
|
".cm-completionMatchedText": {
|
|
2634
|
-
color: "var(--
|
|
2699
|
+
color: "var(--color-base-surface-text)",
|
|
2635
2700
|
textDecoration: "none !important"
|
|
2636
2701
|
},
|
|
2637
2702
|
/**
|
|
@@ -2655,7 +2720,7 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2655
2720
|
backgroundColor: "var(--surface-bg)"
|
|
2656
2721
|
},
|
|
2657
2722
|
".cm-panel input, .cm-panel button, .cm-panel label": {
|
|
2658
|
-
color: "var(--
|
|
2723
|
+
color: "var(--color-subdued)",
|
|
2659
2724
|
fontSize: "14px",
|
|
2660
2725
|
all: "unset",
|
|
2661
2726
|
margin: "3px !important",
|
|
@@ -2663,10 +2728,10 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2663
2728
|
outline: "1px solid transparent"
|
|
2664
2729
|
},
|
|
2665
2730
|
".cm-panel input, .cm-panel button": {
|
|
2666
|
-
backgroundColor: "var(--
|
|
2731
|
+
backgroundColor: "var(--color-input-surface)"
|
|
2667
2732
|
},
|
|
2668
2733
|
".cm-panel input:focus, .cm-panel button:focus": {
|
|
2669
|
-
outline: "1px solid var(--
|
|
2734
|
+
outline: "1px solid var(--color-neutral-focus-indicator)"
|
|
2670
2735
|
},
|
|
2671
2736
|
".cm-panel label": {
|
|
2672
2737
|
display: "inline-flex",
|
|
@@ -2679,26 +2744,26 @@ var baseTheme = EditorView13.baseTheme({
|
|
|
2679
2744
|
height: "8px",
|
|
2680
2745
|
marginRight: "6px !important",
|
|
2681
2746
|
padding: "2px !important",
|
|
2682
|
-
color: "var(--
|
|
2747
|
+
color: "var(--color-neutral-focus-indicator)"
|
|
2683
2748
|
},
|
|
2684
2749
|
".cm-panel button": {
|
|
2685
2750
|
"&:hover": {
|
|
2686
|
-
// TODO(burdon): Replace with layer and @apply bg-
|
|
2687
|
-
backgroundColor: "var(--
|
|
2751
|
+
// TODO(burdon): Replace with layer and @apply bg-accent-surface-hover
|
|
2752
|
+
backgroundColor: "var(--color-accent-surface-hover) !important"
|
|
2688
2753
|
},
|
|
2689
2754
|
"&:active": {
|
|
2690
|
-
backgroundColor: "var(--
|
|
2755
|
+
backgroundColor: "var(--color-accent-surface-hover)"
|
|
2691
2756
|
}
|
|
2692
2757
|
},
|
|
2693
2758
|
".cm-panel.cm-search": {
|
|
2694
2759
|
padding: "4px",
|
|
2695
|
-
borderTop: "1px solid var(--
|
|
2760
|
+
borderTop: "1px solid var(--color-separator)"
|
|
2696
2761
|
}
|
|
2697
2762
|
});
|
|
2698
2763
|
var editorGutter = EditorView13.theme({
|
|
2699
2764
|
".cm-gutters": {
|
|
2700
2765
|
// NOTE: Non-transparent background required to cover content if scrolling horizontally.
|
|
2701
|
-
background: "var(--
|
|
2766
|
+
background: "var(--color-base-surface) !important",
|
|
2702
2767
|
paddingRight: "1rem"
|
|
2703
2768
|
}
|
|
2704
2769
|
});
|
|
@@ -2716,9 +2781,9 @@ var createFontTheme = ({ monospace } = {}) => EditorView13.theme({
|
|
|
2716
2781
|
});
|
|
2717
2782
|
|
|
2718
2783
|
// src/extensions/focus.ts
|
|
2719
|
-
import { StateEffect as
|
|
2784
|
+
import { StateEffect as StateEffect5, StateField as StateField5 } from "@codemirror/state";
|
|
2720
2785
|
import { EditorView as EditorView14 } from "@codemirror/view";
|
|
2721
|
-
var focusEffect =
|
|
2786
|
+
var focusEffect = StateEffect5.define();
|
|
2722
2787
|
var focusField = StateField5.define({
|
|
2723
2788
|
create: () => false,
|
|
2724
2789
|
update: (value, tr) => {
|
|
@@ -2747,7 +2812,7 @@ var focus = [
|
|
|
2747
2812
|
];
|
|
2748
2813
|
|
|
2749
2814
|
// src/extensions/factories.ts
|
|
2750
|
-
var
|
|
2815
|
+
var __dxlog_file11 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/factories.ts";
|
|
2751
2816
|
var tabbable = EditorView15.contentAttributes.of({
|
|
2752
2817
|
tabindex: "0"
|
|
2753
2818
|
});
|
|
@@ -2802,9 +2867,9 @@ var createBasicExtensions = (propsProp) => {
|
|
|
2802
2867
|
return [
|
|
2803
2868
|
// NOTE: Doesn't catch errors in keymap functions.
|
|
2804
2869
|
EditorView15.exceptionSink.of((err) => {
|
|
2805
|
-
|
|
2806
|
-
F:
|
|
2807
|
-
L:
|
|
2870
|
+
log8.catch(err, void 0, {
|
|
2871
|
+
F: __dxlog_file11,
|
|
2872
|
+
L: 131,
|
|
2808
2873
|
S: void 0,
|
|
2809
2874
|
C: (f, a) => f(...a)
|
|
2810
2875
|
});
|
|
@@ -2856,12 +2921,12 @@ var createBasicExtensions = (propsProp) => {
|
|
|
2856
2921
|
};
|
|
2857
2922
|
var grow = {
|
|
2858
2923
|
editor: {
|
|
2859
|
-
className: "
|
|
2924
|
+
className: "h-full w-full"
|
|
2860
2925
|
}
|
|
2861
2926
|
};
|
|
2862
2927
|
var fullWidth = {
|
|
2863
2928
|
editor: {
|
|
2864
|
-
className: "
|
|
2929
|
+
className: "w-full"
|
|
2865
2930
|
}
|
|
2866
2931
|
};
|
|
2867
2932
|
var defaultThemeSlots = grow;
|
|
@@ -2904,8 +2969,8 @@ var createDataExtensions = ({ id, text, messenger, identity }) => {
|
|
|
2904
2969
|
channel: `awareness.${id}`,
|
|
2905
2970
|
peerId: identity.identityKey.toHex(),
|
|
2906
2971
|
info: {
|
|
2907
|
-
darkColor: `var(--
|
|
2908
|
-
lightColor: `var(--
|
|
2972
|
+
darkColor: `var(--color-${hue}-border)`,
|
|
2973
|
+
lightColor: `var(--color-${hue}-border)`,
|
|
2909
2974
|
displayName: identity.profile?.displayName ?? generateName(identity.identityKey.toHex())
|
|
2910
2975
|
}
|
|
2911
2976
|
})));
|
|
@@ -2924,7 +2989,7 @@ var folding = () => {
|
|
|
2924
2989
|
}),
|
|
2925
2990
|
foldGutter({
|
|
2926
2991
|
markerDOM: (open) => {
|
|
2927
|
-
return Domino2.of("div").classNames("flex
|
|
2992
|
+
return Domino2.of("div").classNames("flex h-full justify-center items-center").children(Domino2.of("svg", Domino2.SVG).classNames(mx4("w-4 h-4 cursor-pointer", open && "rotate-90")).children(Domino2.of("use", Domino2.SVG).attributes({
|
|
2928
2993
|
href: Domino2.icon("ph--caret-right--regular")
|
|
2929
2994
|
}))).root;
|
|
2930
2995
|
}
|
|
@@ -4220,6 +4285,11 @@ import { markdownLanguage } from "@codemirror/lang-markdown";
|
|
|
4220
4285
|
import { HighlightStyle as HighlightStyle2 } from "@codemirror/language";
|
|
4221
4286
|
import { Tag, styleTags, tags } from "@lezer/highlight";
|
|
4222
4287
|
import { Table } from "@lezer/markdown";
|
|
4288
|
+
var styles4 = {
|
|
4289
|
+
code: "font-mono no-underline! text-cm-code",
|
|
4290
|
+
codeMark: "font-mono text-cm-code-mark",
|
|
4291
|
+
mark: "opacity-50"
|
|
4292
|
+
};
|
|
4223
4293
|
var markdownTags = {
|
|
4224
4294
|
Blockquote: Tag.define(),
|
|
4225
4295
|
CodeMark: Tag.define(),
|
|
@@ -4301,7 +4371,7 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
|
4301
4371
|
markdownTags.LinkReference,
|
|
4302
4372
|
markdownTags.ListMark
|
|
4303
4373
|
],
|
|
4304
|
-
class:
|
|
4374
|
+
class: styles4.mark
|
|
4305
4375
|
},
|
|
4306
4376
|
// Markdown marks.
|
|
4307
4377
|
{
|
|
@@ -4312,7 +4382,7 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
|
4312
4382
|
markdownTags.QuoteMark,
|
|
4313
4383
|
markdownTags.EmphasisMark
|
|
4314
4384
|
],
|
|
4315
|
-
class:
|
|
4385
|
+
class: styles4.mark
|
|
4316
4386
|
},
|
|
4317
4387
|
// E.g., code block language (after ```).
|
|
4318
4388
|
{
|
|
@@ -4321,7 +4391,7 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
|
4321
4391
|
tags.function(tags.variableName),
|
|
4322
4392
|
tags.labelName
|
|
4323
4393
|
],
|
|
4324
|
-
class:
|
|
4394
|
+
class: styles4.codeMark
|
|
4325
4395
|
},
|
|
4326
4396
|
// Fonts.
|
|
4327
4397
|
{
|
|
@@ -4331,30 +4401,38 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
|
4331
4401
|
],
|
|
4332
4402
|
class: "font-mono"
|
|
4333
4403
|
},
|
|
4334
|
-
// Headings
|
|
4404
|
+
// Headings — use CSS properties only (no class:) so CodeMirror generates scoped CSS via
|
|
4405
|
+
// StyleModule that overrides vscodeDarkStyle's t.heading rule. When class: is present,
|
|
4406
|
+
// HighlightStyle silently ignores all other CSS properties (they're mutually exclusive).
|
|
4407
|
+
// Font sizes use Tailwind v4 CSS variables so nothing is hardcoded.
|
|
4408
|
+
{
|
|
4409
|
+
tag: tags.heading,
|
|
4410
|
+
color: "var(--color-cm-heading) !important",
|
|
4411
|
+
fontWeight: "300"
|
|
4412
|
+
},
|
|
4335
4413
|
{
|
|
4336
4414
|
tag: tags.heading1,
|
|
4337
|
-
|
|
4415
|
+
...markdownTheme.heading(1)
|
|
4338
4416
|
},
|
|
4339
4417
|
{
|
|
4340
4418
|
tag: tags.heading2,
|
|
4341
|
-
|
|
4419
|
+
...markdownTheme.heading(2)
|
|
4342
4420
|
},
|
|
4343
4421
|
{
|
|
4344
4422
|
tag: tags.heading3,
|
|
4345
|
-
|
|
4423
|
+
...markdownTheme.heading(3)
|
|
4346
4424
|
},
|
|
4347
4425
|
{
|
|
4348
4426
|
tag: tags.heading4,
|
|
4349
|
-
|
|
4427
|
+
...markdownTheme.heading(4)
|
|
4350
4428
|
},
|
|
4351
4429
|
{
|
|
4352
4430
|
tag: tags.heading5,
|
|
4353
|
-
|
|
4431
|
+
...markdownTheme.heading(5)
|
|
4354
4432
|
},
|
|
4355
4433
|
{
|
|
4356
4434
|
tag: tags.heading6,
|
|
4357
|
-
|
|
4435
|
+
...markdownTheme.heading(6)
|
|
4358
4436
|
},
|
|
4359
4437
|
// Emphasis.
|
|
4360
4438
|
{
|
|
@@ -4379,7 +4457,7 @@ var markdownHighlightStyle = (_options = {}) => {
|
|
|
4379
4457
|
markdownTags.CodeText,
|
|
4380
4458
|
markdownTags.InlineCode
|
|
4381
4459
|
],
|
|
4382
|
-
class:
|
|
4460
|
+
class: styles4.code
|
|
4383
4461
|
},
|
|
4384
4462
|
{
|
|
4385
4463
|
tag: [
|
|
@@ -4484,7 +4562,7 @@ var convertTreeToJson = (state) => {
|
|
|
4484
4562
|
|
|
4485
4563
|
// src/extensions/markdown/decorate.ts
|
|
4486
4564
|
import { syntaxTree as syntaxTree7 } from "@codemirror/language";
|
|
4487
|
-
import { Prec as Prec4, RangeSetBuilder as RangeSetBuilder5, StateEffect as
|
|
4565
|
+
import { Prec as Prec4, RangeSetBuilder as RangeSetBuilder5, StateEffect as StateEffect6 } from "@codemirror/state";
|
|
4488
4566
|
import { Decoration as Decoration11, EditorView as EditorView23, ViewPlugin as ViewPlugin14, WidgetType as WidgetType7 } from "@codemirror/view";
|
|
4489
4567
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
4490
4568
|
import { mx as mx6 } from "@dxos/ui-theme";
|
|
@@ -4736,7 +4814,7 @@ var formattingStyles = EditorView21.theme({
|
|
|
4736
4814
|
width: "100%",
|
|
4737
4815
|
height: "0",
|
|
4738
4816
|
verticalAlign: "middle",
|
|
4739
|
-
borderTop: "1px solid var(--
|
|
4817
|
+
borderTop: "1px solid var(--color-cm-separator)",
|
|
4740
4818
|
opacity: 0.5
|
|
4741
4819
|
},
|
|
4742
4820
|
/**
|
|
@@ -4759,8 +4837,8 @@ var formattingStyles = EditorView21.theme({
|
|
|
4759
4837
|
* Blockquote.
|
|
4760
4838
|
*/
|
|
4761
4839
|
"& .cm-blockquote": {
|
|
4762
|
-
background: "var(--
|
|
4763
|
-
borderLeft: "2px solid var(--
|
|
4840
|
+
background: "var(--color-cm-codeblock)",
|
|
4841
|
+
borderLeft: "2px solid var(--color-cm-separator)",
|
|
4764
4842
|
paddingLeft: "1rem",
|
|
4765
4843
|
margin: "0"
|
|
4766
4844
|
},
|
|
@@ -4771,7 +4849,7 @@ var formattingStyles = EditorView21.theme({
|
|
|
4771
4849
|
fontFamily: fontMono
|
|
4772
4850
|
},
|
|
4773
4851
|
"& .cm-codeblock-line": {
|
|
4774
|
-
background: "var(--
|
|
4852
|
+
background: "var(--color-cm-codeblock)",
|
|
4775
4853
|
paddingInline: "1rem !important"
|
|
4776
4854
|
},
|
|
4777
4855
|
"& .cm-codeblock-start": {
|
|
@@ -4805,8 +4883,8 @@ var formattingStyles = EditorView21.theme({
|
|
|
4805
4883
|
".cm-table-head": {
|
|
4806
4884
|
padding: "2px 16px 2px 0px",
|
|
4807
4885
|
textAlign: "left",
|
|
4808
|
-
borderBottom: "1px solid var(--
|
|
4809
|
-
color: "var(--
|
|
4886
|
+
borderBottom: "1px solid var(--color-cm-separator)",
|
|
4887
|
+
color: "var(--color-subdued)"
|
|
4810
4888
|
},
|
|
4811
4889
|
".cm-table-cell": {
|
|
4812
4890
|
padding: "2px 16px 2px 0px"
|
|
@@ -4946,7 +5024,7 @@ var TableWidget = class extends WidgetType6 {
|
|
|
4946
5024
|
};
|
|
4947
5025
|
|
|
4948
5026
|
// src/extensions/markdown/decorate.ts
|
|
4949
|
-
var
|
|
5027
|
+
var __dxlog_file12 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/markdown/decorate.ts";
|
|
4950
5028
|
var Unicode = {
|
|
4951
5029
|
emDash: "\u2014",
|
|
4952
5030
|
bullet: "\u2022",
|
|
@@ -4969,7 +5047,6 @@ var LinkButton = class extends WidgetType7 {
|
|
|
4969
5047
|
eq(other) {
|
|
4970
5048
|
return this.url === other.url;
|
|
4971
5049
|
}
|
|
4972
|
-
// TODO(burdon): Create icon and link directly without react?
|
|
4973
5050
|
toDOM(view) {
|
|
4974
5051
|
const el = document.createElement("span");
|
|
4975
5052
|
this.render(el, {
|
|
@@ -5082,8 +5159,8 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
|
5082
5159
|
const headerLevels = [];
|
|
5083
5160
|
const getHeaderLevels = (node, level) => {
|
|
5084
5161
|
invariant4(level > 0, void 0, {
|
|
5085
|
-
F:
|
|
5086
|
-
L:
|
|
5162
|
+
F: __dxlog_file12,
|
|
5163
|
+
L: 179,
|
|
5087
5164
|
S: void 0,
|
|
5088
5165
|
A: [
|
|
5089
5166
|
"level > 0",
|
|
@@ -5121,8 +5198,8 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
|
5121
5198
|
};
|
|
5122
5199
|
const getCurrentListLevel = () => {
|
|
5123
5200
|
invariant4(listLevels.length, void 0, {
|
|
5124
|
-
F:
|
|
5125
|
-
L:
|
|
5201
|
+
F: __dxlog_file12,
|
|
5202
|
+
L: 201,
|
|
5126
5203
|
S: void 0,
|
|
5127
5204
|
A: [
|
|
5128
5205
|
"listLevels.length",
|
|
@@ -5172,7 +5249,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
|
5172
5249
|
from: mark.from,
|
|
5173
5250
|
to: mark.from + len,
|
|
5174
5251
|
deco: Decoration11.replace({
|
|
5175
|
-
widget: new TextWidget(num, markdownTheme.heading(level))
|
|
5252
|
+
widget: new TextWidget(num, markdownTheme.heading(level).className)
|
|
5176
5253
|
})
|
|
5177
5254
|
});
|
|
5178
5255
|
}
|
|
@@ -5439,7 +5516,7 @@ var buildDecorations2 = (view, options, focus2) => {
|
|
|
5439
5516
|
atomicDeco: atomicDeco.finish()
|
|
5440
5517
|
};
|
|
5441
5518
|
};
|
|
5442
|
-
var forceUpdate =
|
|
5519
|
+
var forceUpdate = StateEffect6.define();
|
|
5443
5520
|
var decorateMarkdown = (options = {}) => {
|
|
5444
5521
|
return [
|
|
5445
5522
|
ViewPlugin14.fromClass(class {
|
|
@@ -5511,8 +5588,7 @@ var linkTooltip = (renderTooltip) => {
|
|
|
5511
5588
|
return {
|
|
5512
5589
|
pos: link.from,
|
|
5513
5590
|
end: link.to,
|
|
5514
|
-
|
|
5515
|
-
// above: true,
|
|
5591
|
+
above: true,
|
|
5516
5592
|
create: () => {
|
|
5517
5593
|
const el = document.createElement("div");
|
|
5518
5594
|
el.className = tooltipContent({});
|
|
@@ -5528,16 +5604,13 @@ var linkTooltip = (renderTooltip) => {
|
|
|
5528
5604
|
};
|
|
5529
5605
|
}
|
|
5530
5606
|
};
|
|
5531
|
-
}, {
|
|
5532
|
-
// NOTE: 0 = default of 300ms.
|
|
5533
|
-
hoverTime: 1
|
|
5534
5607
|
});
|
|
5535
5608
|
};
|
|
5536
5609
|
|
|
5537
5610
|
// src/extensions/mention.ts
|
|
5538
5611
|
import { autocompletion } from "@codemirror/autocomplete";
|
|
5539
|
-
import { log as
|
|
5540
|
-
var
|
|
5612
|
+
import { log as log9 } from "@dxos/log";
|
|
5613
|
+
var __dxlog_file13 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/mention.ts";
|
|
5541
5614
|
var mention = ({ debug, onSearch }) => {
|
|
5542
5615
|
return autocompletion({
|
|
5543
5616
|
// TODO(burdon): Not working.
|
|
@@ -5549,10 +5622,10 @@ var mention = ({ debug, onSearch }) => {
|
|
|
5549
5622
|
icons: false,
|
|
5550
5623
|
override: [
|
|
5551
5624
|
(context) => {
|
|
5552
|
-
|
|
5625
|
+
log9.info("completion context", {
|
|
5553
5626
|
context
|
|
5554
5627
|
}, {
|
|
5555
|
-
F:
|
|
5628
|
+
F: __dxlog_file13,
|
|
5556
5629
|
L: 27,
|
|
5557
5630
|
S: void 0,
|
|
5558
5631
|
C: (f, a) => f(...a)
|
|
@@ -5573,8 +5646,8 @@ var mention = ({ debug, onSearch }) => {
|
|
|
5573
5646
|
};
|
|
5574
5647
|
|
|
5575
5648
|
// src/extensions/modal.ts
|
|
5576
|
-
import { StateEffect as
|
|
5577
|
-
var modalStateEffect =
|
|
5649
|
+
import { StateEffect as StateEffect7, StateField as StateField9 } from "@codemirror/state";
|
|
5650
|
+
var modalStateEffect = StateEffect7.define();
|
|
5578
5651
|
var modalStateField = StateField9.define({
|
|
5579
5652
|
create: () => false,
|
|
5580
5653
|
update: (value, tr) => {
|
|
@@ -5635,7 +5708,7 @@ import { syntaxTree as syntaxTree9 } from "@codemirror/language";
|
|
|
5635
5708
|
import { StateField as StateField10 } from "@codemirror/state";
|
|
5636
5709
|
import { Facet as Facet2 } from "@codemirror/state";
|
|
5637
5710
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
5638
|
-
var
|
|
5711
|
+
var __dxlog_file14 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/outliner/tree.ts";
|
|
5639
5712
|
var itemToJSON = ({ type, index, level, lineRange, contentRange, children }) => {
|
|
5640
5713
|
return {
|
|
5641
5714
|
type,
|
|
@@ -5790,7 +5863,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5790
5863
|
}
|
|
5791
5864
|
case "BulletList": {
|
|
5792
5865
|
invariant5(current, void 0, {
|
|
5793
|
-
F:
|
|
5866
|
+
F: __dxlog_file14,
|
|
5794
5867
|
L: 219,
|
|
5795
5868
|
S: void 0,
|
|
5796
5869
|
A: [
|
|
@@ -5807,7 +5880,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5807
5880
|
}
|
|
5808
5881
|
case "ListItem": {
|
|
5809
5882
|
invariant5(parent, void 0, {
|
|
5810
|
-
F:
|
|
5883
|
+
F: __dxlog_file14,
|
|
5811
5884
|
L: 228,
|
|
5812
5885
|
S: void 0,
|
|
5813
5886
|
A: [
|
|
@@ -5849,7 +5922,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5849
5922
|
}
|
|
5850
5923
|
case "ListMark": {
|
|
5851
5924
|
invariant5(current, void 0, {
|
|
5852
|
-
F:
|
|
5925
|
+
F: __dxlog_file14,
|
|
5853
5926
|
L: 272,
|
|
5854
5927
|
S: void 0,
|
|
5855
5928
|
A: [
|
|
@@ -5863,7 +5936,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5863
5936
|
}
|
|
5864
5937
|
case "Task": {
|
|
5865
5938
|
invariant5(current, void 0, {
|
|
5866
|
-
F:
|
|
5939
|
+
F: __dxlog_file14,
|
|
5867
5940
|
L: 278,
|
|
5868
5941
|
S: void 0,
|
|
5869
5942
|
A: [
|
|
@@ -5876,7 +5949,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5876
5949
|
}
|
|
5877
5950
|
case "TaskMarker": {
|
|
5878
5951
|
invariant5(current, void 0, {
|
|
5879
|
-
F:
|
|
5952
|
+
F: __dxlog_file14,
|
|
5880
5953
|
L: 283,
|
|
5881
5954
|
S: void 0,
|
|
5882
5955
|
A: [
|
|
@@ -5892,7 +5965,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5892
5965
|
leave: (node) => {
|
|
5893
5966
|
if (node.name === "BulletList") {
|
|
5894
5967
|
invariant5(parent, void 0, {
|
|
5895
|
-
F:
|
|
5968
|
+
F: __dxlog_file14,
|
|
5896
5969
|
L: 291,
|
|
5897
5970
|
S: void 0,
|
|
5898
5971
|
A: [
|
|
@@ -5906,7 +5979,7 @@ var outlinerTree = (_options = {}) => {
|
|
|
5906
5979
|
}
|
|
5907
5980
|
});
|
|
5908
5981
|
invariant5(tree, void 0, {
|
|
5909
|
-
F:
|
|
5982
|
+
F: __dxlog_file14,
|
|
5910
5983
|
L: 298,
|
|
5911
5984
|
S: void 0,
|
|
5912
5985
|
A: [
|
|
@@ -6204,8 +6277,8 @@ import { mx as mx7 } from "@dxos/ui-theme";
|
|
|
6204
6277
|
// src/extensions/outliner/editor.ts
|
|
6205
6278
|
import { EditorSelection as EditorSelection4, EditorState as EditorState2 } from "@codemirror/state";
|
|
6206
6279
|
import { ViewPlugin as ViewPlugin15 } from "@codemirror/view";
|
|
6207
|
-
import { log as
|
|
6208
|
-
var
|
|
6280
|
+
import { log as log10 } from "@dxos/log";
|
|
6281
|
+
var __dxlog_file15 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/outliner/editor.ts";
|
|
6209
6282
|
var LIST_ITEM_REGEX = /^\s*- (\[ \]|\[x\])? /;
|
|
6210
6283
|
var initialize = () => {
|
|
6211
6284
|
return ViewPlugin15.fromClass(class {
|
|
@@ -6337,7 +6410,7 @@ var editor = () => [
|
|
|
6337
6410
|
cancel = true;
|
|
6338
6411
|
return;
|
|
6339
6412
|
}
|
|
6340
|
-
|
|
6413
|
+
log10("change", {
|
|
6341
6414
|
item,
|
|
6342
6415
|
line: {
|
|
6343
6416
|
from: line.from,
|
|
@@ -6356,7 +6429,7 @@ var editor = () => [
|
|
|
6356
6429
|
length: insert.length
|
|
6357
6430
|
}
|
|
6358
6431
|
}, {
|
|
6359
|
-
F:
|
|
6432
|
+
F: __dxlog_file15,
|
|
6360
6433
|
L: 164,
|
|
6361
6434
|
S: void 0,
|
|
6362
6435
|
C: (f, a) => f(...a)
|
|
@@ -6364,10 +6437,10 @@ var editor = () => [
|
|
|
6364
6437
|
}
|
|
6365
6438
|
});
|
|
6366
6439
|
if (changes.length > 0) {
|
|
6367
|
-
|
|
6440
|
+
log10("modified,", {
|
|
6368
6441
|
changes
|
|
6369
6442
|
}, {
|
|
6370
|
-
F:
|
|
6443
|
+
F: __dxlog_file15,
|
|
6371
6444
|
L: 175,
|
|
6372
6445
|
S: void 0,
|
|
6373
6446
|
C: (f, a) => f(...a)
|
|
@@ -6378,8 +6451,8 @@ var editor = () => [
|
|
|
6378
6451
|
}
|
|
6379
6452
|
];
|
|
6380
6453
|
} else if (cancel) {
|
|
6381
|
-
|
|
6382
|
-
F:
|
|
6454
|
+
log10("cancel", void 0, {
|
|
6455
|
+
F: __dxlog_file15,
|
|
6383
6456
|
L: 178,
|
|
6384
6457
|
S: void 0,
|
|
6385
6458
|
C: (f, a) => f(...a)
|
|
@@ -6392,7 +6465,7 @@ var editor = () => [
|
|
|
6392
6465
|
|
|
6393
6466
|
// src/extensions/outliner/menu.ts
|
|
6394
6467
|
import { EditorView as EditorView24, ViewPlugin as ViewPlugin16 } from "@codemirror/view";
|
|
6395
|
-
import { addEventListener } from "@dxos/async";
|
|
6468
|
+
import { addEventListener as addEventListener2 } from "@dxos/async";
|
|
6396
6469
|
var menu = (options = {}) => [
|
|
6397
6470
|
ViewPlugin16.fromClass(class {
|
|
6398
6471
|
view;
|
|
@@ -6414,7 +6487,7 @@ var menu = (options = {}) => [
|
|
|
6414
6487
|
}
|
|
6415
6488
|
container.appendChild(this.tag);
|
|
6416
6489
|
const handler = () => this.scheduleUpdate();
|
|
6417
|
-
this.cleanup =
|
|
6490
|
+
this.cleanup = addEventListener2(container, "scroll", handler);
|
|
6418
6491
|
this.scheduleUpdate();
|
|
6419
6492
|
}
|
|
6420
6493
|
destroy() {
|
|
@@ -6493,7 +6566,7 @@ var outliner = (_options = {}) => [
|
|
|
6493
6566
|
}),
|
|
6494
6567
|
// Researve space for menu.
|
|
6495
6568
|
EditorView25.contentAttributes.of({
|
|
6496
|
-
class: "
|
|
6569
|
+
class: "w-full !mr-[3rem]"
|
|
6497
6570
|
})
|
|
6498
6571
|
];
|
|
6499
6572
|
var decorations = () => [
|
|
@@ -6557,10 +6630,10 @@ var decorations = () => [
|
|
|
6557
6630
|
marginBottom: "2px"
|
|
6558
6631
|
},
|
|
6559
6632
|
".cm-list-item-focused": {
|
|
6560
|
-
borderColor: "var(--
|
|
6633
|
+
borderColor: "var(--color-neutral-focus-indicator)"
|
|
6561
6634
|
},
|
|
6562
6635
|
"&:focus-within .cm-list-item-selected": {
|
|
6563
|
-
borderColor: "var(--
|
|
6636
|
+
borderColor: "var(--color-separator)"
|
|
6564
6637
|
}
|
|
6565
6638
|
}))
|
|
6566
6639
|
];
|
|
@@ -6677,7 +6750,7 @@ var PreviewBlockWidget = class extends WidgetType8 {
|
|
|
6677
6750
|
}
|
|
6678
6751
|
toDOM(_view) {
|
|
6679
6752
|
const root = document.createElement("div");
|
|
6680
|
-
root.classList.add("cm-preview-block", "density-fine");
|
|
6753
|
+
root.classList.add("cm-preview-block", "dx-density-fine");
|
|
6681
6754
|
this._options.addBlockContainer?.({
|
|
6682
6755
|
link: this._link,
|
|
6683
6756
|
el: root
|
|
@@ -6892,7 +6965,7 @@ var mixedParser = (registry) => {
|
|
|
6892
6965
|
};
|
|
6893
6966
|
|
|
6894
6967
|
// src/extensions/tags/streamer.ts
|
|
6895
|
-
import { StateEffect as
|
|
6968
|
+
import { StateEffect as StateEffect8, StateField as StateField12 } from "@codemirror/state";
|
|
6896
6969
|
import { Decoration as Decoration14, EditorView as EditorView28, ViewPlugin as ViewPlugin18, WidgetType as WidgetType9 } from "@codemirror/view";
|
|
6897
6970
|
import { Domino as Domino3 } from "@dxos/ui";
|
|
6898
6971
|
import { isTruthy as isTruthy4 } from "@dxos/util";
|
|
@@ -6904,7 +6977,7 @@ var streamer = (options = {}) => {
|
|
|
6904
6977
|
].filter(isTruthy4);
|
|
6905
6978
|
};
|
|
6906
6979
|
var cursor = () => {
|
|
6907
|
-
const hideCursor =
|
|
6980
|
+
const hideCursor = StateEffect8.define();
|
|
6908
6981
|
const showCursor = StateField12.define({
|
|
6909
6982
|
create: () => true,
|
|
6910
6983
|
update: (value, tr) => {
|
|
@@ -6974,9 +7047,9 @@ var CursorWidget = class extends WidgetType9 {
|
|
|
6974
7047
|
};
|
|
6975
7048
|
var fadeIn = (options = {}) => {
|
|
6976
7049
|
const FADE_IN_DURATION = 1e3;
|
|
6977
|
-
const DEFAULT_REMOVAL_DELAY =
|
|
7050
|
+
const DEFAULT_REMOVAL_DELAY = 3e3;
|
|
6978
7051
|
const removalDelay = options.removalDelay ?? DEFAULT_REMOVAL_DELAY;
|
|
6979
|
-
const removeDecoration =
|
|
7052
|
+
const removeDecoration = StateEffect8.define();
|
|
6980
7053
|
const fadeField = StateField12.define({
|
|
6981
7054
|
create: () => Decoration14.none,
|
|
6982
7055
|
update: (decorations2, tr) => {
|
|
@@ -7086,17 +7159,17 @@ var fadeIn = (options = {}) => {
|
|
|
7086
7159
|
|
|
7087
7160
|
// src/extensions/tags/xml-tags.ts
|
|
7088
7161
|
import { syntaxTree as syntaxTree11 } from "@codemirror/language";
|
|
7089
|
-
import { Prec as Prec7, RangeSetBuilder as RangeSetBuilder7, StateEffect as
|
|
7162
|
+
import { Prec as Prec7, RangeSetBuilder as RangeSetBuilder7, StateEffect as StateEffect9, StateField as StateField13 } from "@codemirror/state";
|
|
7090
7163
|
import { Decoration as Decoration15, EditorView as EditorView29, ViewPlugin as ViewPlugin19, WidgetType as WidgetType10, keymap as keymap13 } from "@codemirror/view";
|
|
7091
7164
|
import { invariant as invariant7 } from "@dxos/invariant";
|
|
7092
|
-
import { log as
|
|
7165
|
+
import { log as log11 } from "@dxos/log";
|
|
7093
7166
|
|
|
7094
7167
|
// src/extensions/tags/xml-util.ts
|
|
7095
7168
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
7096
|
-
var
|
|
7169
|
+
var __dxlog_file16 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/tags/xml-util.ts";
|
|
7097
7170
|
var nodeToJson = (state, node) => {
|
|
7098
7171
|
invariant6(node.type.name === "Element", "Node is not an Element", {
|
|
7099
|
-
F:
|
|
7172
|
+
F: __dxlog_file16,
|
|
7100
7173
|
L: 18,
|
|
7101
7174
|
S: void 0,
|
|
7102
7175
|
A: [
|
|
@@ -7160,16 +7233,16 @@ var nodeToJson = (state, node) => {
|
|
|
7160
7233
|
};
|
|
7161
7234
|
|
|
7162
7235
|
// src/extensions/tags/xml-tags.ts
|
|
7163
|
-
var
|
|
7164
|
-
var navigatePreviousEffect =
|
|
7165
|
-
var navigateNextEffect =
|
|
7236
|
+
var __dxlog_file17 = "/__w/dxos/dxos/packages/ui/ui-editor/src/extensions/tags/xml-tags.ts";
|
|
7237
|
+
var navigatePreviousEffect = StateEffect9.define();
|
|
7238
|
+
var navigateNextEffect = StateEffect9.define();
|
|
7166
7239
|
var getXmlTextChild = (children) => {
|
|
7167
7240
|
const child = children?.[0];
|
|
7168
7241
|
return typeof child === "string" ? child : null;
|
|
7169
7242
|
};
|
|
7170
|
-
var xmlTagContextEffect =
|
|
7171
|
-
var xmlTagResetEffect =
|
|
7172
|
-
var xmlTagUpdateEffect =
|
|
7243
|
+
var xmlTagContextEffect = StateEffect9.define();
|
|
7244
|
+
var xmlTagResetEffect = StateEffect9.define();
|
|
7245
|
+
var xmlTagUpdateEffect = StateEffect9.define();
|
|
7173
7246
|
var widgetContextStateField = StateField13.define({
|
|
7174
7247
|
create: () => void 0,
|
|
7175
7248
|
update: (value, tr) => {
|
|
@@ -7190,11 +7263,11 @@ var widgetStateMapStateField = StateField13.define({
|
|
|
7190
7263
|
}
|
|
7191
7264
|
if (effect.is(xmlTagUpdateEffect)) {
|
|
7192
7265
|
const { id, value } = effect.value;
|
|
7193
|
-
|
|
7266
|
+
log11("widget updated", {
|
|
7194
7267
|
id,
|
|
7195
7268
|
value
|
|
7196
7269
|
}, {
|
|
7197
|
-
F:
|
|
7270
|
+
F: __dxlog_file17,
|
|
7198
7271
|
L: 153,
|
|
7199
7272
|
S: void 0,
|
|
7200
7273
|
C: (f, a) => f(...a)
|
|
@@ -7225,11 +7298,11 @@ var createWidgetMap = (setWidgets) => {
|
|
|
7225
7298
|
const widgets = /* @__PURE__ */ new Map();
|
|
7226
7299
|
const notifier = {
|
|
7227
7300
|
mounted: (state) => {
|
|
7228
|
-
|
|
7301
|
+
log11("widget mounted", {
|
|
7229
7302
|
id: state.id,
|
|
7230
7303
|
tag: state.props._tag
|
|
7231
7304
|
}, {
|
|
7232
|
-
F:
|
|
7305
|
+
F: __dxlog_file17,
|
|
7233
7306
|
L: 206,
|
|
7234
7307
|
S: void 0,
|
|
7235
7308
|
C: (f, a) => f(...a)
|
|
@@ -7241,11 +7314,11 @@ var createWidgetMap = (setWidgets) => {
|
|
|
7241
7314
|
},
|
|
7242
7315
|
unmounted: (id) => {
|
|
7243
7316
|
const state = widgets.get(id);
|
|
7244
|
-
|
|
7317
|
+
log11("widget unmounted", {
|
|
7245
7318
|
id,
|
|
7246
7319
|
tag: state?.props._tag
|
|
7247
7320
|
}, {
|
|
7248
|
-
F:
|
|
7321
|
+
F: __dxlog_file17,
|
|
7249
7322
|
L: 212,
|
|
7250
7323
|
S: void 0,
|
|
7251
7324
|
C: (f, a) => f(...a)
|
|
@@ -7307,11 +7380,9 @@ var createNavigationEffectPlugin = (widgetDecorationsField, bookmarks2) => {
|
|
|
7307
7380
|
anchor: line.from,
|
|
7308
7381
|
head: line.from
|
|
7309
7382
|
},
|
|
7310
|
-
effects:
|
|
7311
|
-
line: line.number,
|
|
7312
|
-
|
|
7313
|
-
offset: -16
|
|
7314
|
-
}
|
|
7383
|
+
effects: scrollerLineEffect.of({
|
|
7384
|
+
line: line.number - 1,
|
|
7385
|
+
offset: -16
|
|
7315
7386
|
})
|
|
7316
7387
|
});
|
|
7317
7388
|
continue;
|
|
@@ -7342,11 +7413,9 @@ var createNavigationEffectPlugin = (widgetDecorationsField, bookmarks2) => {
|
|
|
7342
7413
|
anchor: line.to,
|
|
7343
7414
|
head: line.to
|
|
7344
7415
|
},
|
|
7345
|
-
effects:
|
|
7346
|
-
line: line.number,
|
|
7347
|
-
|
|
7348
|
-
offset: -16
|
|
7349
|
-
}
|
|
7416
|
+
effects: scrollerLineEffect.of({
|
|
7417
|
+
line: line.number - 1,
|
|
7418
|
+
offset: -16
|
|
7350
7419
|
})
|
|
7351
7420
|
});
|
|
7352
7421
|
} else {
|
|
@@ -7356,11 +7425,9 @@ var createNavigationEffectPlugin = (widgetDecorationsField, bookmarks2) => {
|
|
|
7356
7425
|
anchor: line.to,
|
|
7357
7426
|
head: line.to
|
|
7358
7427
|
},
|
|
7359
|
-
effects:
|
|
7360
|
-
line: line.number,
|
|
7361
|
-
|
|
7362
|
-
position: "end"
|
|
7363
|
-
}
|
|
7428
|
+
effects: scrollerLineEffect.of({
|
|
7429
|
+
line: line.number - 1,
|
|
7430
|
+
position: "end"
|
|
7364
7431
|
})
|
|
7365
7432
|
});
|
|
7366
7433
|
}
|
|
@@ -7407,6 +7474,12 @@ var createWidgetDecorationsField = (registry = {}, notifier) => StateField13.def
|
|
|
7407
7474
|
update: ({ from, decorations: decorations2 }, tr) => {
|
|
7408
7475
|
for (const effect of tr.effects) {
|
|
7409
7476
|
if (effect.is(xmlTagResetEffect)) {
|
|
7477
|
+
if (tr.docChanged) {
|
|
7478
|
+
return buildDecorations4(tr.state, {
|
|
7479
|
+
from: 0,
|
|
7480
|
+
to: tr.state.doc.length
|
|
7481
|
+
}, registry, notifier);
|
|
7482
|
+
}
|
|
7410
7483
|
return {
|
|
7411
7484
|
from: 0,
|
|
7412
7485
|
decorations: Decoration15.none
|
|
@@ -7417,12 +7490,12 @@ var createWidgetDecorationsField = (registry = {}, notifier) => StateField13.def
|
|
|
7417
7490
|
const { state } = tr;
|
|
7418
7491
|
const reset = tr.changes.touchesRange(0, from);
|
|
7419
7492
|
if (reset) {
|
|
7420
|
-
|
|
7493
|
+
log11("document reset", {
|
|
7421
7494
|
from,
|
|
7422
7495
|
to: state.doc.length
|
|
7423
7496
|
}, {
|
|
7424
|
-
F:
|
|
7425
|
-
L:
|
|
7497
|
+
F: __dxlog_file17,
|
|
7498
|
+
L: 374,
|
|
7426
7499
|
S: void 0,
|
|
7427
7500
|
C: (f, a) => f(...a)
|
|
7428
7501
|
});
|
|
@@ -7503,9 +7576,9 @@ var buildDecorations4 = (state, range, registry, notifier) => {
|
|
|
7503
7576
|
}
|
|
7504
7577
|
}
|
|
7505
7578
|
} catch (err) {
|
|
7506
|
-
|
|
7507
|
-
F:
|
|
7508
|
-
L:
|
|
7579
|
+
log11.catch(err, void 0, {
|
|
7580
|
+
F: __dxlog_file17,
|
|
7581
|
+
L: 459,
|
|
7509
7582
|
S: void 0,
|
|
7510
7583
|
C: (f, a) => f(...a)
|
|
7511
7584
|
});
|
|
@@ -7529,8 +7602,8 @@ var PlaceholderWidget2 = class extends WidgetType10 {
|
|
|
7529
7602
|
constructor(id, Component, props, notifier) {
|
|
7530
7603
|
super(), this.id = id, this.Component = Component, this.props = props, this.notifier = notifier;
|
|
7531
7604
|
invariant7(id, void 0, {
|
|
7532
|
-
F:
|
|
7533
|
-
L:
|
|
7605
|
+
F: __dxlog_file17,
|
|
7606
|
+
L: 485,
|
|
7534
7607
|
S: this,
|
|
7535
7608
|
A: [
|
|
7536
7609
|
"id",
|
|
@@ -7659,6 +7732,7 @@ export {
|
|
|
7659
7732
|
convertTreeToJson,
|
|
7660
7733
|
createBasicExtensions,
|
|
7661
7734
|
createComment,
|
|
7735
|
+
createCrawler,
|
|
7662
7736
|
createDataExtensions,
|
|
7663
7737
|
createEditorStateStore,
|
|
7664
7738
|
createEditorStateTransaction,
|
|
@@ -7739,9 +7813,10 @@ export {
|
|
|
7739
7813
|
removeStyle,
|
|
7740
7814
|
replacer,
|
|
7741
7815
|
scrollThreadIntoView,
|
|
7742
|
-
scrollToBottomEffect,
|
|
7743
7816
|
scrollToLine,
|
|
7744
|
-
|
|
7817
|
+
scroller,
|
|
7818
|
+
scrollerCrawlEffect,
|
|
7819
|
+
scrollerLineEffect,
|
|
7745
7820
|
selectionState,
|
|
7746
7821
|
setBlockquote,
|
|
7747
7822
|
setComments,
|
|
@@ -7749,7 +7824,6 @@ export {
|
|
|
7749
7824
|
setSelection,
|
|
7750
7825
|
setStyle,
|
|
7751
7826
|
singleValueFacet,
|
|
7752
|
-
smoothScroll,
|
|
7753
7827
|
stackItemContentEditorClassNames,
|
|
7754
7828
|
staticCompletion,
|
|
7755
7829
|
streamer,
|