mrmd-editor 0.7.1 → 0.8.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/package.json +3 -1
- package/src/commands.js +112 -4
- package/src/comment-syntax.js +364 -39
- package/src/config/handlers.js +1 -2
- package/src/config/schema.js +46 -4
- package/src/document-template.js +2236 -0
- package/src/frontmatter-updater.js +204 -74
- package/src/grammar.js +758 -0
- package/src/index.js +1074 -55
- package/src/keymap.js +11 -2
- package/src/markdown/block-decorations.js +108 -5
- package/src/markdown/facets.js +37 -0
- package/src/markdown/html-inline.js +9 -5
- package/src/markdown/index.js +13 -3
- package/src/markdown/inline-commands.js +256 -0
- package/src/markdown/inline-model.js +578 -0
- package/src/markdown/inline-state.js +103 -0
- package/src/markdown/renderer.js +219 -12
- package/src/markdown/styles.js +290 -3
- package/src/markdown/widgets/alert-title.js +10 -8
- package/src/markdown/widgets/frontmatter.js +0 -6
- package/src/markdown/widgets/index.js +1 -0
- package/src/markdown/widgets/list-marker.js +29 -0
- package/src/markdown/wysiwyg.js +1158 -0
- package/src/mrp-types.js +2 -0
- package/src/output-widget.js +532 -18
- package/src/page-view-pagination.js +127 -0
- package/src/runtime-lsp.js +1757 -150
- package/src/section-controls/commands.js +617 -0
- package/src/section-controls/index.js +63 -0
- package/src/section-controls/plugin.js +165 -0
- package/src/section-controls/widgets.js +936 -0
- package/src/shell/ai-menu.js +11 -0
- package/src/shell/components/context-panel.js +572 -0
- package/src/shell/components/status-bar.js +10 -2
- package/src/shell/layouts/studio.js +206 -14
- package/src/shell/orchestrator-client.js +69 -0
- package/src/spellcheck.js +166 -0
- package/src/tables/README.md +97 -0
- package/src/tables/commands/insert-linked-table.js +122 -0
- package/src/tables/commands/open-table-workspace.js +43 -0
- package/src/tables/index.js +24 -0
- package/src/tables/jobs/client.js +158 -0
- package/src/tables/parsing/anchors.js +82 -0
- package/src/tables/parsing/linked-table-blocks.js +61 -0
- package/src/tables/state/linked-table-state.js +68 -0
- package/src/tables/widgets/linked-table-source-banner.js +77 -0
- package/src/tables/widgets/linked-table-widget.js +256 -0
- package/src/tables/workspace/controller.js +616 -0
- package/src/term-pty-client.js +51 -2
- package/src/term-widget.js +43 -3
- package/src/widgets/theme-utils.js +24 -16
- package/src/widgets/theme.js +1015 -1
- package/src/runtime-codelens/detector.js +0 -279
- package/src/runtime-codelens/index.js +0 -76
- package/src/runtime-codelens/plugin.js +0 -142
- package/src/runtime-codelens/styles.js +0 -184
- package/src/runtime-codelens/widgets.js +0 -216
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime CodeLens Widget
|
|
3
|
-
*
|
|
4
|
-
* Renders the CodeLens UI with:
|
|
5
|
-
* - Language label (🐍 Python, ⬢ Node, etc.)
|
|
6
|
-
* - Action buttons (Start, Restart, Stop)
|
|
7
|
-
* - Status indicator (● connected, ○ stopped)
|
|
8
|
-
* - "Restart All" button for multi-runtime configs
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { WidgetType } from '@codemirror/view';
|
|
12
|
-
|
|
13
|
-
/** Language display labels */
|
|
14
|
-
const LANGUAGE_LABELS = {
|
|
15
|
-
python: '🐍 Python',
|
|
16
|
-
bash: '$ Bash',
|
|
17
|
-
node: '⬢ Node',
|
|
18
|
-
julia: '◐ Julia',
|
|
19
|
-
r: '📊 R',
|
|
20
|
-
shell: '⌘ Shell',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {Object} RuntimeStatus
|
|
25
|
-
* @property {boolean} alive - Whether runtime is running
|
|
26
|
-
* @property {number} [pid] - Process ID
|
|
27
|
-
* @property {number} [port] - Port number
|
|
28
|
-
* @property {string} [error] - Error message if failed
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @typedef {Object} RuntimeInfo
|
|
33
|
-
* @property {string} language - Runtime language
|
|
34
|
-
* @property {string} name - Session name
|
|
35
|
-
* @property {string} [venv] - Virtual environment path
|
|
36
|
-
* @property {string} [cwd] - Working directory
|
|
37
|
-
* @property {RuntimeStatus} [status] - Current status
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @typedef {Object} RuntimeCodeLensCallbacks
|
|
42
|
-
* @property {(runtime: RuntimeInfo) => void} [onStart] - Start runtime
|
|
43
|
-
* @property {(name: string) => void} [onStop] - Stop runtime by name
|
|
44
|
-
* @property {(name: string) => void} [onRestart] - Restart runtime by name
|
|
45
|
-
* @property {() => void} [onRestartAll] - Restart all runtimes
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
export class RuntimeCodeLensWidget extends WidgetType {
|
|
49
|
-
/**
|
|
50
|
-
* @param {Object} options
|
|
51
|
-
* @param {RuntimeInfo[]} options.runtimes - Runtime configurations with status
|
|
52
|
-
* @param {RuntimeCodeLensCallbacks} options.callbacks - Action callbacks
|
|
53
|
-
* @param {'config' | 'frontmatter'} options.blockType - Block type
|
|
54
|
-
*/
|
|
55
|
-
constructor(options) {
|
|
56
|
-
super();
|
|
57
|
-
this.runtimes = options.runtimes || [];
|
|
58
|
-
this.callbacks = options.callbacks || {};
|
|
59
|
-
this.blockType = options.blockType || 'config';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
eq(other) {
|
|
63
|
-
if (!(other instanceof RuntimeCodeLensWidget)) return false;
|
|
64
|
-
if (this.runtimes.length !== other.runtimes.length) return false;
|
|
65
|
-
if (this.blockType !== other.blockType) return false;
|
|
66
|
-
|
|
67
|
-
// Compare each runtime's status
|
|
68
|
-
for (let i = 0; i < this.runtimes.length; i++) {
|
|
69
|
-
const a = this.runtimes[i];
|
|
70
|
-
const b = other.runtimes[i];
|
|
71
|
-
if (a.name !== b.name) return false;
|
|
72
|
-
if (a.language !== b.language) return false;
|
|
73
|
-
if (a.status?.alive !== b.status?.alive) return false;
|
|
74
|
-
if (a.status?.pid !== b.status?.pid) return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
toDOM() {
|
|
81
|
-
const container = document.createElement('div');
|
|
82
|
-
container.className = 'cm-runtime-codelens';
|
|
83
|
-
|
|
84
|
-
// Render each runtime's controls
|
|
85
|
-
for (const runtime of this.runtimes) {
|
|
86
|
-
container.appendChild(this._createRuntimeRow(runtime));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// "Restart All" button (only for config blocks with multiple runtimes)
|
|
90
|
-
if (this.blockType === 'config' && this.runtimes.length > 1) {
|
|
91
|
-
const restartAllRow = document.createElement('div');
|
|
92
|
-
restartAllRow.className = 'cm-runtime-codelens-row cm-runtime-codelens-row--all';
|
|
93
|
-
|
|
94
|
-
const restartAllBtn = this._createButton('↻ Restart All', 'Restart all runtimes', () => {
|
|
95
|
-
this.callbacks.onRestartAll?.();
|
|
96
|
-
});
|
|
97
|
-
restartAllBtn.className += ' cm-runtime-codelens-btn--restart-all';
|
|
98
|
-
restartAllRow.appendChild(restartAllBtn);
|
|
99
|
-
container.appendChild(restartAllRow);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return container;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Create a row for a single runtime
|
|
107
|
-
* @param {RuntimeInfo} runtime
|
|
108
|
-
* @returns {HTMLElement}
|
|
109
|
-
*/
|
|
110
|
-
_createRuntimeRow(runtime) {
|
|
111
|
-
const row = document.createElement('div');
|
|
112
|
-
row.className = 'cm-runtime-codelens-row';
|
|
113
|
-
|
|
114
|
-
// Language label
|
|
115
|
-
const label = document.createElement('span');
|
|
116
|
-
label.className = 'cm-runtime-codelens-label';
|
|
117
|
-
label.textContent = LANGUAGE_LABELS[runtime.language] || runtime.language;
|
|
118
|
-
row.appendChild(label);
|
|
119
|
-
|
|
120
|
-
// Session name (if not "default")
|
|
121
|
-
if (runtime.name && runtime.name !== 'default') {
|
|
122
|
-
const nameBadge = document.createElement('span');
|
|
123
|
-
nameBadge.className = 'cm-runtime-codelens-name';
|
|
124
|
-
nameBadge.textContent = runtime.name;
|
|
125
|
-
row.appendChild(nameBadge);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Actions container
|
|
129
|
-
const actions = document.createElement('div');
|
|
130
|
-
actions.className = 'cm-runtime-codelens-actions';
|
|
131
|
-
|
|
132
|
-
const isAlive = runtime.status?.alive;
|
|
133
|
-
|
|
134
|
-
if (!isAlive) {
|
|
135
|
-
// Not running: show Start button
|
|
136
|
-
actions.appendChild(
|
|
137
|
-
this._createButton('▶', 'Start', () => {
|
|
138
|
-
this.callbacks.onStart?.(runtime);
|
|
139
|
-
})
|
|
140
|
-
);
|
|
141
|
-
} else {
|
|
142
|
-
// Running: show Restart and Stop buttons
|
|
143
|
-
actions.appendChild(
|
|
144
|
-
this._createButton('↻', 'Restart', () => {
|
|
145
|
-
this.callbacks.onRestart?.(runtime.name);
|
|
146
|
-
})
|
|
147
|
-
);
|
|
148
|
-
actions.appendChild(
|
|
149
|
-
this._createButton('■', 'Stop', () => {
|
|
150
|
-
this.callbacks.onStop?.(runtime.name);
|
|
151
|
-
})
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
row.appendChild(actions);
|
|
156
|
-
|
|
157
|
-
// Status indicator
|
|
158
|
-
const status = document.createElement('span');
|
|
159
|
-
status.className = 'cm-runtime-codelens-status';
|
|
160
|
-
status.innerHTML = this._renderStatus(runtime.status);
|
|
161
|
-
row.appendChild(status);
|
|
162
|
-
|
|
163
|
-
return row;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Create a button element
|
|
168
|
-
* @param {string} text - Button text
|
|
169
|
-
* @param {string} title - Tooltip
|
|
170
|
-
* @param {() => void} onClick - Click handler
|
|
171
|
-
* @returns {HTMLButtonElement}
|
|
172
|
-
*/
|
|
173
|
-
_createButton(text, title, onClick) {
|
|
174
|
-
const btn = document.createElement('button');
|
|
175
|
-
btn.className = 'cm-runtime-codelens-btn';
|
|
176
|
-
btn.textContent = text;
|
|
177
|
-
btn.title = title;
|
|
178
|
-
btn.onclick = (e) => {
|
|
179
|
-
e.preventDefault();
|
|
180
|
-
e.stopPropagation();
|
|
181
|
-
onClick();
|
|
182
|
-
};
|
|
183
|
-
return btn;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Render status indicator HTML
|
|
188
|
-
* @param {RuntimeStatus} [status]
|
|
189
|
-
* @returns {string}
|
|
190
|
-
*/
|
|
191
|
-
_renderStatus(status) {
|
|
192
|
-
if (!status) {
|
|
193
|
-
return '<span class="cm-runtime-codelens-dot cm-runtime-codelens-dot--gray"></span><span class="cm-runtime-codelens-status-text">Not started</span>';
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (status.error) {
|
|
197
|
-
return `<span class="cm-runtime-codelens-dot cm-runtime-codelens-dot--red"></span><span class="cm-runtime-codelens-status-text">Error</span>`;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (status.alive) {
|
|
201
|
-
const pidText = status.pid ? ` (PID ${status.pid})` : '';
|
|
202
|
-
return `<span class="cm-runtime-codelens-dot cm-runtime-codelens-dot--green"></span><span class="cm-runtime-codelens-status-text">Connected${pidText}</span>`;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return '<span class="cm-runtime-codelens-dot cm-runtime-codelens-dot--gray"></span><span class="cm-runtime-codelens-status-text">Stopped</span>';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
ignoreEvent() {
|
|
209
|
-
// Let our buttons handle their own events
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
destroy() {
|
|
214
|
-
// Cleanup if needed
|
|
215
|
-
}
|
|
216
|
-
}
|