@onereach/ui-components 4.1.1 → 4.2.0-beta.2544.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/v2/components/OrCode/OrCode.js +6 -3727
- package/dist/bundled/v2/components/OrCode/index.js +6 -2
- package/dist/bundled/v2/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v2/components/OrCode/theme.js +2 -1
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +1 -0
- package/dist/bundled/v2/components/OrConfirm/index.js +1 -0
- package/dist/bundled/v2/components/OrModal/OrModal.js +3 -1266
- package/dist/bundled/v2/components/OrModal/index.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1988 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +68 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +15 -2
- package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-c5a9adb7.js → v2/index-16aee5bc.js} +14 -234
- package/dist/bundled/v2/index-62c3221b.js +6956 -0
- package/dist/bundled/{v3/lang-02d2bb2d.js → v2/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v2/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +18 -5
- package/dist/bundled/v2/markdown-516daba9.js +18737 -0
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-d5fb0b11.js → v2/useFocusTrap-9567b3c8.js} +3 -105
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +236 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-806d209b.js → OrConfirm.vue_vue_type_script_lang-36318ca2.js} +1 -1
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +107 -0
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-2bb9d87f.js +1765 -0
- package/dist/bundled/v3/components/OrCode/OrCode.js +10 -6
- package/dist/bundled/v3/components/OrCode/index.js +8 -4
- package/dist/bundled/v3/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v3/components/OrCode/theme.js +2 -1
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +4 -3
- package/dist/bundled/v3/components/OrConfirm/index.js +3 -2
- package/dist/bundled/v3/components/OrModal/OrModal.js +3 -2
- package/dist/bundled/v3/components/OrModal/index.js +2 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +227 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +84 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +19 -5
- package/dist/bundled/v3/index-16aee5bc.js +3740 -0
- package/dist/bundled/v3/index-62c3221b.js +6956 -0
- package/dist/bundled/{v2/lang-02d2bb2d.js → v3/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v3/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +23 -9
- package/dist/bundled/v3/markdown-516daba9.js +18737 -0
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/v3/useFocusTrap-9567b3c8.js +1268 -0
- package/dist/esm/v2/OrRichTextEditor-dfddef2b.js +722 -0
- package/dist/esm/v2/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +59 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v2/index.js +24 -0
- package/dist/esm/v3/OrRichTextEditor-f4ce18ef.js +686 -0
- package/dist/esm/v3/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +57 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v3/index.js +24 -0
- package/package.json +25 -5
- package/src/components/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +7 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +103 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +624 -0
- package/src/components/or-rich-text-editor-v3/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +64 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +254 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +213 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +117 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
4
|
+
import { Transaction as CMTransaction } from '@codemirror/state';
|
|
5
|
+
import { Command, EditorView as CMView } from '@codemirror/view';
|
|
6
|
+
import { CodeMirrorViewOptions } from './types';
|
|
7
|
+
declare class CodeMirrorView implements NodeView {
|
|
8
|
+
name: string;
|
|
9
|
+
node: ProsemirrorNode;
|
|
10
|
+
view: EditorView;
|
|
11
|
+
dom: HTMLElement;
|
|
12
|
+
cm: CMView;
|
|
13
|
+
getPos: () => number;
|
|
14
|
+
updating: boolean;
|
|
15
|
+
constructor(options: CodeMirrorViewOptions);
|
|
16
|
+
forwardSelection(): void;
|
|
17
|
+
asProseMirrorSelection(doc: ProsemirrorNode): TextSelection;
|
|
18
|
+
dispatch(cmTr: CMTransaction): void;
|
|
19
|
+
mayBeEscape(unit: 'char' | 'line', dir: -1 | 1): Command;
|
|
20
|
+
update(node: ProsemirrorNode): boolean;
|
|
21
|
+
setSelection(anchor: number, head: number): void;
|
|
22
|
+
focus(): void;
|
|
23
|
+
selectNode(): void;
|
|
24
|
+
stopEvent(): boolean;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
export default CodeMirrorView;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { n as exitCode, T as TextSelection, S as Selection } from '../../../../index-62c3221b.js';
|
|
2
|
+
import { a as EditorState, E as EditorView, Y as highlightActiveLine, B as highlightActiveLineGutter, z as lineNumbers, k as keymap } from '../../../../index-f5487f12.js';
|
|
3
|
+
import theme from './theme.js';
|
|
4
|
+
import '../../../../index.es-3f39f316.js';
|
|
5
|
+
|
|
6
|
+
const computeChange = (oldVal, newVal) => {
|
|
7
|
+
if (oldVal === newVal) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
let start = 0;
|
|
11
|
+
let oldEnd = oldVal.length;
|
|
12
|
+
let newEnd = newVal.length;
|
|
13
|
+
while (start < oldEnd && oldVal.charCodeAt(start) === newVal.charCodeAt(start)) {
|
|
14
|
+
start += 1;
|
|
15
|
+
}
|
|
16
|
+
while (oldEnd > start && newEnd > start && oldVal.charCodeAt(oldEnd - 1) === newVal.charCodeAt(newEnd - 1)) {
|
|
17
|
+
oldEnd -= 1;
|
|
18
|
+
newEnd -= 1;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
from: start,
|
|
22
|
+
to: oldEnd,
|
|
23
|
+
text: newVal.slice(start, newEnd)
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
class CodeMirrorView {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
var _a;
|
|
29
|
+
this.updating = false;
|
|
30
|
+
// Store for later
|
|
31
|
+
this.node = options.node;
|
|
32
|
+
this.view = options.view;
|
|
33
|
+
const cmExtensions = ((_a = options.cmOptions) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
34
|
+
this.name = 'codeBlock', this.getPos = options.getPos;
|
|
35
|
+
const changeFilter = EditorState.changeFilter.of(tr => {
|
|
36
|
+
if (!tr.docChanged && !this.updating) {
|
|
37
|
+
this.forwardSelection();
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
// Create a CodeMirror instancew
|
|
42
|
+
this.cm = new EditorView({
|
|
43
|
+
dispatch: this.dispatch.bind(this)
|
|
44
|
+
});
|
|
45
|
+
// The editor's outer node is our DOM representation
|
|
46
|
+
this.dom = this.cm.dom;
|
|
47
|
+
const cmState = EditorState.create({
|
|
48
|
+
doc: this.node.textContent,
|
|
49
|
+
extensions: [theme, changeFilter, highlightActiveLine(), highlightActiveLineGutter(), lineNumbers(), keymap.of([{
|
|
50
|
+
key: 'ArrowUp',
|
|
51
|
+
run: this.mayBeEscape('line', -1)
|
|
52
|
+
}, {
|
|
53
|
+
key: 'ArrowLeft',
|
|
54
|
+
run: this.mayBeEscape('char', -1)
|
|
55
|
+
}, {
|
|
56
|
+
key: 'ArrowDown',
|
|
57
|
+
run: this.mayBeEscape('line', 1)
|
|
58
|
+
}, {
|
|
59
|
+
key: 'ArrowRight',
|
|
60
|
+
run: this.mayBeEscape('char', 1)
|
|
61
|
+
}, {
|
|
62
|
+
key: 'Ctrl-Enter',
|
|
63
|
+
run: () => {
|
|
64
|
+
if (exitCode(this.view.state, this.view.dispatch)) {
|
|
65
|
+
this.view.focus();
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}]), cmExtensions]
|
|
71
|
+
});
|
|
72
|
+
this.cm.setState(cmState);
|
|
73
|
+
}
|
|
74
|
+
forwardSelection() {
|
|
75
|
+
if (!this.cm.hasFocus) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const {
|
|
79
|
+
state
|
|
80
|
+
} = this.view;
|
|
81
|
+
const selection = this.asProseMirrorSelection(state.doc);
|
|
82
|
+
if (!selection.eq(state.selection)) {
|
|
83
|
+
this.view.dispatch(state.tr.setSelection(selection));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
asProseMirrorSelection(doc) {
|
|
87
|
+
const offset = this.getPos() + 1;
|
|
88
|
+
const {
|
|
89
|
+
anchor,
|
|
90
|
+
head
|
|
91
|
+
} = this.cm.state.selection.main;
|
|
92
|
+
return TextSelection.create(doc, anchor + offset, head + offset);
|
|
93
|
+
}
|
|
94
|
+
dispatch(cmTr) {
|
|
95
|
+
this.cm.setState(cmTr.state);
|
|
96
|
+
if (cmTr.docChanged && !this.updating) {
|
|
97
|
+
const start = this.getPos() + 1;
|
|
98
|
+
const cmValue = cmTr.state.doc.toString();
|
|
99
|
+
const change = computeChange(this.node.textContent, cmValue);
|
|
100
|
+
if (!change) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const content = change.text ? this.view.state.schema.text(change.text) : null;
|
|
104
|
+
const tr = this.view.state.tr.replaceWith(change.from + start, change.to + start, content);
|
|
105
|
+
this.view.dispatch(tr);
|
|
106
|
+
this.forwardSelection();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
mayBeEscape(unit, dir) {
|
|
110
|
+
return view => {
|
|
111
|
+
const {
|
|
112
|
+
state
|
|
113
|
+
} = view;
|
|
114
|
+
const {
|
|
115
|
+
selection
|
|
116
|
+
} = state;
|
|
117
|
+
const offsetToPos = () => {
|
|
118
|
+
const offset = selection.main.from;
|
|
119
|
+
const line = state.doc.lineAt(offset);
|
|
120
|
+
return {
|
|
121
|
+
line: line.number,
|
|
122
|
+
ch: offset - line.from
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const pos = offsetToPos();
|
|
126
|
+
const hasSelection = state.selection.ranges.some(r => !r.empty);
|
|
127
|
+
const firstLine = 1;
|
|
128
|
+
const lastLine = state.doc.lineAt(state.doc.length).number;
|
|
129
|
+
if (hasSelection || pos.line !== (dir < 0 ? firstLine : lastLine) || unit === 'char' && pos.ch !== (dir < 0 ? 0 : state.doc.line(pos.line).length)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize);
|
|
133
|
+
const pmSelection = Selection.near(this.view.state.doc.resolve(targetPos), dir);
|
|
134
|
+
this.view.dispatch(this.view.state.tr.setSelection(pmSelection).scrollIntoView());
|
|
135
|
+
this.view.focus();
|
|
136
|
+
return true;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
update(node) {
|
|
140
|
+
if (node.type !== this.node.type) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
this.node = node;
|
|
144
|
+
const change = computeChange(this.cm.state.doc.toString(), node.textContent);
|
|
145
|
+
if (change) {
|
|
146
|
+
this.updating = true;
|
|
147
|
+
this.cm.dispatch({
|
|
148
|
+
changes: {
|
|
149
|
+
from: change.from,
|
|
150
|
+
to: change.to,
|
|
151
|
+
insert: change.text
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
this.updating = false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
setSelection(anchor, head) {
|
|
159
|
+
this.focus();
|
|
160
|
+
this.updating = true;
|
|
161
|
+
this.cm.dispatch({
|
|
162
|
+
selection: {
|
|
163
|
+
anchor,
|
|
164
|
+
head
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
this.updating = false;
|
|
168
|
+
}
|
|
169
|
+
focus() {
|
|
170
|
+
this.cm.focus();
|
|
171
|
+
this.forwardSelection();
|
|
172
|
+
}
|
|
173
|
+
selectNode() {
|
|
174
|
+
this.focus();
|
|
175
|
+
}
|
|
176
|
+
stopEvent() {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
destroy() {
|
|
180
|
+
this.cm.destroy();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { CodeMirrorView as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CodeMirrorView } from './codemirrorView';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Extension } from '@codemirror/state';
|
|
2
|
+
import { HighlightStyle } from '@codemirror/language';
|
|
3
|
+
export declare const color: {
|
|
4
|
+
chalky: string;
|
|
5
|
+
coral: string;
|
|
6
|
+
cyan: string;
|
|
7
|
+
invalid: string;
|
|
8
|
+
ivory: string;
|
|
9
|
+
stone: string;
|
|
10
|
+
malibu: string;
|
|
11
|
+
sage: string;
|
|
12
|
+
whiskey: string;
|
|
13
|
+
violet: string;
|
|
14
|
+
darkBackground: string;
|
|
15
|
+
highlightBackground: string;
|
|
16
|
+
background: string;
|
|
17
|
+
tooltipBackground: string;
|
|
18
|
+
selection: string;
|
|
19
|
+
cursor: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const orCodeTheme: Extension;
|
|
22
|
+
export declare const orCodeHighlightStyle: HighlightStyle;
|
|
23
|
+
declare const theme: Extension;
|
|
24
|
+
export default theme;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { E as EditorView, ah as HighlightStyle, $ as tags, M as syntaxHighlighting } from '../../../../index-f5487f12.js';
|
|
2
|
+
import '../../../../index.es-3f39f316.js';
|
|
3
|
+
|
|
4
|
+
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
|
|
5
|
+
const chalky = 'var(--c-warning-darken-20)',
|
|
6
|
+
coral = 'var(--c-error)',
|
|
7
|
+
cyan = '#56b6c2',
|
|
8
|
+
invalid = 'var(--c-white)',
|
|
9
|
+
ivory = 'var(--c-neutral-6)',
|
|
10
|
+
stone = 'var(--c-neutral-5)',
|
|
11
|
+
// Brightened compared to original to increase contrast
|
|
12
|
+
malibu = '#61afef',
|
|
13
|
+
sage = 'var(--c-success)',
|
|
14
|
+
whiskey = 'var(--c-warning-darken-5)',
|
|
15
|
+
violet = '#c678dd',
|
|
16
|
+
darkBackground = 'var(--c-neutral-1)',
|
|
17
|
+
highlightBackground = 'var(--c-neutral-2)',
|
|
18
|
+
background = 'var(--c-neutral-1)',
|
|
19
|
+
tooltipBackground = 'var(--c-neutral-2)',
|
|
20
|
+
selection = 'var(--c-neutral-3)',
|
|
21
|
+
cursor = 'var(--c-primary)';
|
|
22
|
+
/// The colors used in the theme, as CSS color strings.
|
|
23
|
+
const color = {
|
|
24
|
+
chalky,
|
|
25
|
+
coral,
|
|
26
|
+
cyan,
|
|
27
|
+
invalid,
|
|
28
|
+
ivory,
|
|
29
|
+
stone,
|
|
30
|
+
malibu,
|
|
31
|
+
sage,
|
|
32
|
+
whiskey,
|
|
33
|
+
violet,
|
|
34
|
+
darkBackground,
|
|
35
|
+
highlightBackground,
|
|
36
|
+
background,
|
|
37
|
+
tooltipBackground,
|
|
38
|
+
selection,
|
|
39
|
+
cursor
|
|
40
|
+
};
|
|
41
|
+
/// The editor theme styles for One Dark.
|
|
42
|
+
const orCodeTheme = EditorView.theme({
|
|
43
|
+
'&': {
|
|
44
|
+
color: ivory,
|
|
45
|
+
backgroundColor: background
|
|
46
|
+
},
|
|
47
|
+
'.cm-content': {
|
|
48
|
+
caretColor: cursor
|
|
49
|
+
},
|
|
50
|
+
'.cm-button': {
|
|
51
|
+
background: highlightBackground,
|
|
52
|
+
color: 'var(--c-neutral-6)',
|
|
53
|
+
border: 0,
|
|
54
|
+
borderRadius: 'var(--s-2)'
|
|
55
|
+
},
|
|
56
|
+
'.cm-panel.cm-search input[type=checkbox]': {
|
|
57
|
+
display: 'inline-block',
|
|
58
|
+
verticalAlign: 'middle'
|
|
59
|
+
},
|
|
60
|
+
'.cm-cursor, .cm-dropCursor': {
|
|
61
|
+
borderLeftColor: cursor
|
|
62
|
+
},
|
|
63
|
+
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
|
|
64
|
+
backgroundColor: selection
|
|
65
|
+
},
|
|
66
|
+
'.cm-panels': {
|
|
67
|
+
backgroundColor: darkBackground,
|
|
68
|
+
color: ivory
|
|
69
|
+
},
|
|
70
|
+
'.cm-panels.cm-panels-top': {
|
|
71
|
+
borderBottom: '2px solid var(--c-neutral-2)'
|
|
72
|
+
},
|
|
73
|
+
'.cm-panels.cm-panels-bottom': {
|
|
74
|
+
borderTop: '2px solid var(--c-neutral-2)'
|
|
75
|
+
},
|
|
76
|
+
'.cm-searchMatch': {
|
|
77
|
+
backgroundColor: 'var(--c-neutral-1)',
|
|
78
|
+
outline: '1px solid var(--c-neutral-2)'
|
|
79
|
+
},
|
|
80
|
+
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
81
|
+
backgroundColor: '#6199ff2f'
|
|
82
|
+
},
|
|
83
|
+
'.cm-activeLine': {
|
|
84
|
+
backgroundColor: '#6699ff0b'
|
|
85
|
+
},
|
|
86
|
+
'.cm-selectionMatch': {
|
|
87
|
+
backgroundColor: '#aafe661a'
|
|
88
|
+
},
|
|
89
|
+
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
|
|
90
|
+
backgroundColor: '#bad0f847'
|
|
91
|
+
},
|
|
92
|
+
'.cm-gutters': {
|
|
93
|
+
backgroundColor: background,
|
|
94
|
+
color: stone,
|
|
95
|
+
border: 'none'
|
|
96
|
+
},
|
|
97
|
+
'.cm-activeLineGutter': {
|
|
98
|
+
backgroundColor: highlightBackground
|
|
99
|
+
},
|
|
100
|
+
'.cm-foldPlaceholder': {
|
|
101
|
+
backgroundColor: 'transparent',
|
|
102
|
+
border: 'none',
|
|
103
|
+
color: '#ddd'
|
|
104
|
+
},
|
|
105
|
+
'.cm-tooltip': {
|
|
106
|
+
border: 'none',
|
|
107
|
+
backgroundColor: tooltipBackground
|
|
108
|
+
},
|
|
109
|
+
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
110
|
+
borderTopColor: 'transparent',
|
|
111
|
+
borderBottomColor: 'transparent'
|
|
112
|
+
},
|
|
113
|
+
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
114
|
+
borderTopColor: tooltipBackground,
|
|
115
|
+
borderBottomColor: tooltipBackground
|
|
116
|
+
},
|
|
117
|
+
'.cm-tooltip-autocomplete': {
|
|
118
|
+
'& > ul > li[aria-selected]': {
|
|
119
|
+
backgroundColor: highlightBackground,
|
|
120
|
+
color: ivory
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
'.cm-textfield': {
|
|
124
|
+
outline: 'none',
|
|
125
|
+
background: background,
|
|
126
|
+
color: 'var(--c-neutral-6)',
|
|
127
|
+
backgroundColor: 'var(--c-neutral-1)',
|
|
128
|
+
border: '1px solid var(--c-neutral-2)',
|
|
129
|
+
borderRadius: 'var(--s-2)'
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
dark: true
|
|
133
|
+
});
|
|
134
|
+
/// The highlighting style for code in the One Dark theme.
|
|
135
|
+
const orCodeHighlightStyle = HighlightStyle.define([{
|
|
136
|
+
tag: tags.keyword,
|
|
137
|
+
color: violet
|
|
138
|
+
}, {
|
|
139
|
+
tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName],
|
|
140
|
+
color: coral
|
|
141
|
+
}, {
|
|
142
|
+
tag: [tags.function(tags.variableName), tags.labelName],
|
|
143
|
+
color: malibu
|
|
144
|
+
}, {
|
|
145
|
+
tag: [tags.color, tags.constant(tags.name), tags.standard(tags.name)],
|
|
146
|
+
color: whiskey
|
|
147
|
+
}, {
|
|
148
|
+
tag: [tags.definition(tags.name), tags.separator],
|
|
149
|
+
color: ivory
|
|
150
|
+
}, {
|
|
151
|
+
tag: [tags.typeName, tags.className, tags.number, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace],
|
|
152
|
+
color: chalky
|
|
153
|
+
}, {
|
|
154
|
+
tag: [tags.operator, tags.operatorKeyword, tags.url, tags.escape, tags.regexp, tags.link, tags.special(tags.string)],
|
|
155
|
+
color: cyan
|
|
156
|
+
}, {
|
|
157
|
+
tag: [tags.meta, tags.comment],
|
|
158
|
+
color: stone
|
|
159
|
+
}, {
|
|
160
|
+
tag: tags.strong,
|
|
161
|
+
fontWeight: 'bold'
|
|
162
|
+
}, {
|
|
163
|
+
tag: tags.emphasis,
|
|
164
|
+
fontStyle: 'italic'
|
|
165
|
+
}, {
|
|
166
|
+
tag: tags.strikethrough,
|
|
167
|
+
textDecoration: 'line-through'
|
|
168
|
+
}, {
|
|
169
|
+
tag: tags.link,
|
|
170
|
+
color: stone,
|
|
171
|
+
textDecoration: 'underline'
|
|
172
|
+
}, {
|
|
173
|
+
tag: tags.heading,
|
|
174
|
+
fontWeight: 'bold',
|
|
175
|
+
color: coral
|
|
176
|
+
}, {
|
|
177
|
+
tag: [tags.atom, tags.bool, tags.special(tags.variableName)],
|
|
178
|
+
color: whiskey
|
|
179
|
+
}, {
|
|
180
|
+
tag: [tags.processingInstruction, tags.string, tags.inserted],
|
|
181
|
+
color: sage
|
|
182
|
+
}, {
|
|
183
|
+
tag: tags.invalid,
|
|
184
|
+
color: invalid
|
|
185
|
+
}]);
|
|
186
|
+
/// Extension to enable the One Dark theme (both the editor theme and
|
|
187
|
+
/// the highlight style).
|
|
188
|
+
const theme = [orCodeTheme, syntaxHighlighting(orCodeHighlightStyle)];
|
|
189
|
+
|
|
190
|
+
export { color, theme as default, orCodeHighlightStyle, orCodeTheme };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
2
|
+
import type { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
3
|
+
import type { Extension } from '@codemirror/state';
|
|
4
|
+
export interface ComputeChange {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
interface CMOptions {
|
|
10
|
+
extensions: Extension;
|
|
11
|
+
}
|
|
12
|
+
export type GetPos = () => number | undefined;
|
|
13
|
+
export interface CodeMirrorViewOptions {
|
|
14
|
+
node: ProsemirrorNode;
|
|
15
|
+
view: EditorView;
|
|
16
|
+
getPos: GetPos;
|
|
17
|
+
cmOptions?: CMOptions;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -22,12 +22,12 @@ export { s as OrCheckbox } from '../OrCheckbox.vue_vue_type_script_lang-6ff51af9
|
|
|
22
22
|
export { s as OrCheckboxV3 } from '../OrCheckbox.vue_vue_type_script_lang-60cefcbd.js';
|
|
23
23
|
export { s as OrChip } from '../OrChip.vue_vue_type_script_lang-ceebbd82.js';
|
|
24
24
|
export { s as OrChips } from '../OrChips.vue_vue_type_script_lang-94b456c7.js';
|
|
25
|
-
export { s as OrCode } from '../OrCode.vue_vue_type_script_lang-
|
|
25
|
+
export { s as OrCode } from '../OrCode.vue_vue_type_script_lang-f6f74339.js';
|
|
26
26
|
export { OrCodeLanguages } from './OrCode/constants.js';
|
|
27
27
|
export { s as OrCollapse } from '../OrCollapse.vue_vue_type_script_lang-5137ca99.js';
|
|
28
28
|
export { s as OrColorPicker } from '../OrColorPicker.vue_vue_type_script_lang-3a799e23.js';
|
|
29
29
|
export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './OrColorPicker/constants.js';
|
|
30
|
-
export { s as OrConfirm } from '../OrConfirm.vue_vue_type_script_lang-
|
|
30
|
+
export { s as OrConfirm } from '../OrConfirm.vue_vue_type_script_lang-36318ca2.js';
|
|
31
31
|
export { s as OrConfirmV3 } from '../OrConfirm.vue_vue_type_script_lang-d069c95f.js';
|
|
32
32
|
export { ConfirmType } from './OrConfirmV3/props.js';
|
|
33
33
|
export { s as OrDateTimePicker } from '../OrDateTimePicker.vue_vue_type_script_lang-5c1a5d4a.js';
|
|
@@ -77,7 +77,7 @@ export { LoaderColor, LoaderSize, LoaderVariant } from './OrLoaderV3/props.js';
|
|
|
77
77
|
export { s as OrMenuItemV3 } from '../OrMenuItem.vue_vue_type_script_lang-b338d68a.js';
|
|
78
78
|
export { s as OrMenuV3 } from '../OrMenu.vue_vue_type_script_lang-4772731e.js';
|
|
79
79
|
export { PopoverPlacement as MenuPlacement, PopoverPlacement, PopoverVariant, PopoverPlacement as TooltipPlacement } from './OrPopoverV3/props.js';
|
|
80
|
-
export { s as OrModal } from '../OrModal.vue_vue_type_script_lang-
|
|
80
|
+
export { s as OrModal } from '../OrModal.vue_vue_type_script_lang-af0c4288.js';
|
|
81
81
|
export { OrModalSizes } from './OrModal/constants.js';
|
|
82
82
|
export { s as OrModalV3 } from '../OrModal.vue_vue_type_script_lang-265f39e0.js';
|
|
83
83
|
export { ModalSize } from './OrModalV3/props.js';
|
|
@@ -151,6 +151,7 @@ export { default as useQueueV3 } from './OrToastV3/composable/useQueue.js';
|
|
|
151
151
|
export { s as OrTooltip } from '../OrTooltip.vue_vue_type_script_lang-b8594f7e.js';
|
|
152
152
|
export { s as OrTooltipContent } from '../OrTooltipContent.vue_vue_type_script_lang-969c20ed.js';
|
|
153
153
|
export { s as OrTooltipV3 } from '../OrTooltip.vue_vue_type_script_lang-b35199da.js';
|
|
154
|
+
export { s as OrRichTextEditorV3 } from '../OrRichTextEditor.vue_vue_type_script_lang-2bb9d87f.js';
|
|
154
155
|
import 'vue-demi';
|
|
155
156
|
import 'lodash';
|
|
156
157
|
import './OrIcon/OrIcon.js';
|
|
@@ -222,10 +223,14 @@ import './OrCarousel/constants.js';
|
|
|
222
223
|
import './OrCheckboxV3/styles.js';
|
|
223
224
|
import './OrChip/OrChip.js';
|
|
224
225
|
import './OrChips/constants.js';
|
|
225
|
-
import '../index-
|
|
226
|
-
import '../
|
|
226
|
+
import '../index-f5487f12.js';
|
|
227
|
+
import '../index.es-3f39f316.js';
|
|
228
|
+
import '../index-16aee5bc.js';
|
|
229
|
+
import '../index-70ca38c5.js';
|
|
230
|
+
import './OrCode/lang.js';
|
|
227
231
|
import './OrCode/theme.js';
|
|
228
232
|
import './OrModal/OrModal.js';
|
|
233
|
+
import '../useFocusTrap-9567b3c8.js';
|
|
229
234
|
import './OrOverlay/OrOverlay.js';
|
|
230
235
|
import './OrColorPicker/utils/defultPalette.js';
|
|
231
236
|
import '../index-63e094a0.js';
|
|
@@ -275,3 +280,12 @@ import './OrToast/Timer.js';
|
|
|
275
280
|
import './OrToastV3/styles.js';
|
|
276
281
|
import './OrToastV3/composable/useToastEventBus.js';
|
|
277
282
|
import './OrToastV3/Timer.js';
|
|
283
|
+
import '../markdown-516daba9.js';
|
|
284
|
+
import '../index-62c3221b.js';
|
|
285
|
+
import 'node:punycode';
|
|
286
|
+
import '../tiptap-core.esm-f85402b1.js';
|
|
287
|
+
import './OrRichTextEditorV3/styles.js';
|
|
288
|
+
import './OrRichTextEditorV3/utils/codemirror/codemirrorNode.js';
|
|
289
|
+
import './OrRichTextEditorV3/utils/codemirror/codemirrorView.js';
|
|
290
|
+
import './OrRichTextEditorV3/utils/codemirror/theme.js';
|
|
291
|
+
import './OrModalV3/OrModal.js';
|