@mcp-b/interactive-components 0.2.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/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/code-editor-B94tewLC.js +425 -0
- package/dist/code-preview-gKk0nBKP.js +269 -0
- package/dist/components/code-editor/code-editor.d.ts +65 -0
- package/dist/components/code-editor/code-editor.js +2 -0
- package/dist/components/code-preview/code-preview.d.ts +58 -0
- package/dist/components/code-preview/code-preview.js +3 -0
- package/dist/components/interactive-editor/interactive-editor.d.ts +77 -0
- package/dist/components/interactive-editor/interactive-editor.js +3 -0
- package/dist/components/r-editor/r-editor.d.ts +68 -0
- package/dist/components/r-editor/r-editor.js +2 -0
- package/dist/components/sql-editor/sql-editor.d.ts +78 -0
- package/dist/components/sql-editor/sql-editor.js +2 -0
- package/dist/decorate-DcF3lt7P.js +9 -0
- package/dist/docs/custom-elements.json +2807 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/interactive-editor-WfTWxJGF.js +1454 -0
- package/dist/lib/runner-channel.d.ts +25 -0
- package/dist/lib/runner-channel.js +55 -0
- package/dist/lib/runner-url.d.ts +15 -0
- package/dist/lib/runner-url.js +19 -0
- package/dist/lib/transform.d.ts +2 -0
- package/dist/lib/transform.js +210 -0
- package/dist/r-editor-DwSyDo2i.js +743 -0
- package/dist/runners/ephemeral-indexeddb.js +114 -0
- package/dist/runners/pglite-runner.js +175 -0
- package/dist/runners/pyscript-runner.html +189 -0
- package/dist/runners/webr-runner.html +282 -0
- package/dist/sql-editor-CsNrjJ2_.js +968 -0
- package/dist/themes/interactive.css +79 -0
- package/dist/transform-DWhHlnkw.d.ts +53 -0
- package/dist/vite.d.ts +14 -0
- package/dist/vite.js +62 -0
- package/package.json +96 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { t as __decorate } from "./decorate-DcF3lt7P.js";
|
|
2
|
+
import { buildHtmlPreview, buildModulePreview, buildPythonPayload, detectLanguage } from "./lib/transform.js";
|
|
3
|
+
import { RUNNER_CONNECT_TYPE, bindRunnerUrl, connectRunner, createRunnerChannelId, isRecord, parseRunnerConsoleMessage } from "./lib/runner-channel.js";
|
|
4
|
+
import { getRunnerUrl } from "./lib/runner-url.js";
|
|
5
|
+
import { css, html } from "lit";
|
|
6
|
+
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
8
|
+
import hostStyles from "@mcp-b/wc-support/styles/host.styles";
|
|
9
|
+
import "@mcp-b/web-components/components/callout/callout.js";
|
|
10
|
+
import "@mcp-b/web-components/components/spinner/spinner.js";
|
|
11
|
+
//#region src/components/code-preview/code-preview.styles.ts
|
|
12
|
+
var code_preview_styles_default = css`
|
|
13
|
+
:host {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
position: relative;
|
|
17
|
+
background: var(--sigvelo-interactive-preview-bg, #fff);
|
|
18
|
+
height: 100%;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.preview-iframe {
|
|
23
|
+
flex: 1;
|
|
24
|
+
width: 100%;
|
|
25
|
+
border: none;
|
|
26
|
+
background: var(--sigvelo-interactive-preview-bg, #fff);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.loading {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
background: var(--sigvelo-interactive-preview-bg, #fff);
|
|
36
|
+
z-index: 5;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.error {
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset: 0;
|
|
42
|
+
overflow: auto;
|
|
43
|
+
padding: 16px;
|
|
44
|
+
z-index: 10;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/code-preview/code-preview.ts
|
|
49
|
+
/**
|
|
50
|
+
* `<sigvelo-code-preview>`
|
|
51
|
+
*
|
|
52
|
+
* @summary A sandboxed preview pane that transpiles and runs code from a set of
|
|
53
|
+
* files. Supports HTML entry points (with inlined CSS/JS) and module entry
|
|
54
|
+
* points (TS/TSX via esm.sh). Displays errors using `<sigvelo-callout>`.
|
|
55
|
+
*
|
|
56
|
+
* @tag sigvelo-code-preview
|
|
57
|
+
* @status experimental
|
|
58
|
+
* @since 0.1
|
|
59
|
+
*
|
|
60
|
+
* @event sigvelo-run - Fires when execution completes successfully.
|
|
61
|
+
* @event sigvelo-error - Fires when a build or runtime error occurs. `event.detail.message` has the error text.
|
|
62
|
+
* @event sigvelo-console - Fires for validated console output from the isolated preview.
|
|
63
|
+
*/
|
|
64
|
+
var SigveloCodePreview = class SigveloCodePreview extends SigveloElement {
|
|
65
|
+
constructor(..._args) {
|
|
66
|
+
super(..._args);
|
|
67
|
+
this.files = [];
|
|
68
|
+
this.entryFile = "";
|
|
69
|
+
this.captureConsole = false;
|
|
70
|
+
this._srcdoc = "";
|
|
71
|
+
this._pyRunnerSrc = "";
|
|
72
|
+
this._error = null;
|
|
73
|
+
this._loading = false;
|
|
74
|
+
this._blobUrls = [];
|
|
75
|
+
this._pendingPyPayload = null;
|
|
76
|
+
this._runnerPort = null;
|
|
77
|
+
this._runnerChannelId = createRunnerChannelId();
|
|
78
|
+
}
|
|
79
|
+
static {
|
|
80
|
+
this.styles = [hostStyles, code_preview_styles_default];
|
|
81
|
+
}
|
|
82
|
+
static {
|
|
83
|
+
this.CONSOLE_CAPTURE_SCRIPT = `<script>
|
|
84
|
+
(function() {
|
|
85
|
+
var _port = null;
|
|
86
|
+
var _queuedMessages = [];
|
|
87
|
+
var _connect = function(event) {
|
|
88
|
+
if (event.source !== parent ||
|
|
89
|
+
event.origin !== '__SIGVELO_PARENT_ORIGIN__' ||
|
|
90
|
+
!event.data ||
|
|
91
|
+
event.data.type !== ${JSON.stringify(RUNNER_CONNECT_TYPE)} ||
|
|
92
|
+
event.data.channelId !== '__SIGVELO_CHANNEL_ID__' ||
|
|
93
|
+
event.data.parentOrigin !== '__SIGVELO_PARENT_ORIGIN__' ||
|
|
94
|
+
event.ports.length !== 1) return;
|
|
95
|
+
_port = event.ports[0];
|
|
96
|
+
_port.start();
|
|
97
|
+
_queuedMessages.forEach(function(message) { _port.postMessage(message); });
|
|
98
|
+
_queuedMessages = [];
|
|
99
|
+
window.removeEventListener('message', _connect);
|
|
100
|
+
};
|
|
101
|
+
window.addEventListener('message', _connect);
|
|
102
|
+
var _post = function(level, args) {
|
|
103
|
+
try {
|
|
104
|
+
var message = { __sigvelo_console: true, level: level, args: args.map(function(a) {
|
|
105
|
+
try { return typeof a === 'object' ? JSON.stringify(a, null, 2) : String(a); }
|
|
106
|
+
catch(e) { return String(a); }
|
|
107
|
+
}), ts: Date.now() };
|
|
108
|
+
if (_port) _port.postMessage(message);
|
|
109
|
+
else if (_queuedMessages.length < 100) _queuedMessages.push(message);
|
|
110
|
+
} catch(e) {}
|
|
111
|
+
};
|
|
112
|
+
['log','warn','error','info'].forEach(function(m) {
|
|
113
|
+
var orig = console[m];
|
|
114
|
+
console[m] = function() {
|
|
115
|
+
var args = Array.prototype.slice.call(arguments);
|
|
116
|
+
_post(m, args);
|
|
117
|
+
orig.apply(console, args);
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
window.addEventListener('error', function(e) {
|
|
121
|
+
_post('error', [e.message + ' at ' + e.filename + ':' + e.lineno]);
|
|
122
|
+
});
|
|
123
|
+
})();
|
|
124
|
+
<\/script>`;
|
|
125
|
+
}
|
|
126
|
+
disconnectedCallback() {
|
|
127
|
+
super.disconnectedCallback();
|
|
128
|
+
this._runnerPort?.close();
|
|
129
|
+
this._runnerPort = null;
|
|
130
|
+
this._revokeBlobUrls();
|
|
131
|
+
}
|
|
132
|
+
_onRunnerMessage(data) {
|
|
133
|
+
if (isRecord(data) && data.__sigvelo_pyscript_ready === true && this._pendingPyPayload) {
|
|
134
|
+
this._postPyPayload();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const consoleMessage = parseRunnerConsoleMessage(data);
|
|
138
|
+
if (consoleMessage) this.dispatchEvent(new CustomEvent("sigvelo-console", {
|
|
139
|
+
bubbles: true,
|
|
140
|
+
composed: true,
|
|
141
|
+
detail: consoleMessage
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
_postPyPayload() {
|
|
145
|
+
if (!this._pendingPyPayload) return;
|
|
146
|
+
this._runnerPort?.postMessage(this._pendingPyPayload);
|
|
147
|
+
}
|
|
148
|
+
_connectRunner(event) {
|
|
149
|
+
if (!(event.currentTarget instanceof HTMLIFrameElement)) return;
|
|
150
|
+
this._runnerPort?.close();
|
|
151
|
+
this._runnerPort = connectRunner(event.currentTarget, this._runnerChannelId, (data) => this._onRunnerMessage(data));
|
|
152
|
+
}
|
|
153
|
+
/** Build and display the current file set. */
|
|
154
|
+
async run() {
|
|
155
|
+
this._revokeBlobUrls();
|
|
156
|
+
this._loading = true;
|
|
157
|
+
this._error = null;
|
|
158
|
+
try {
|
|
159
|
+
const fileMap = /* @__PURE__ */ new Map();
|
|
160
|
+
for (const f of this.files) fileMap.set(f.name, {
|
|
161
|
+
name: f.name,
|
|
162
|
+
content: f.content,
|
|
163
|
+
language: f.language ?? detectLanguage(f.name)
|
|
164
|
+
});
|
|
165
|
+
const entry = this._resolveEntry(fileMap);
|
|
166
|
+
const entryLang = detectLanguage(entry);
|
|
167
|
+
if (entryLang === "python") {
|
|
168
|
+
this._pendingPyPayload = buildPythonPayload(fileMap, entry);
|
|
169
|
+
this._srcdoc = "";
|
|
170
|
+
const runnerUrl = bindRunnerUrl(getRunnerUrl("pyscript"), this._runnerChannelId).href;
|
|
171
|
+
if (this._pyRunnerSrc === runnerUrl) this._postPyPayload();
|
|
172
|
+
else this._pyRunnerSrc = runnerUrl;
|
|
173
|
+
} else if (entryLang === "html") {
|
|
174
|
+
this._pyRunnerSrc = "";
|
|
175
|
+
this._srcdoc = this._injectConsoleCapture(await buildHtmlPreview(fileMap));
|
|
176
|
+
this._blobUrls = [];
|
|
177
|
+
} else {
|
|
178
|
+
this._pyRunnerSrc = "";
|
|
179
|
+
const result = await buildModulePreview(fileMap, entry);
|
|
180
|
+
this._srcdoc = this._injectConsoleCapture(result.html);
|
|
181
|
+
this._blobUrls = result.blobUrls;
|
|
182
|
+
}
|
|
183
|
+
this.dispatchEvent(new CustomEvent("sigvelo-run", {
|
|
184
|
+
bubbles: true,
|
|
185
|
+
composed: true
|
|
186
|
+
}));
|
|
187
|
+
} catch (err) {
|
|
188
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
189
|
+
this._error = message;
|
|
190
|
+
this.dispatchEvent(new CustomEvent("sigvelo-error", {
|
|
191
|
+
bubbles: true,
|
|
192
|
+
composed: true,
|
|
193
|
+
detail: { message }
|
|
194
|
+
}));
|
|
195
|
+
} finally {
|
|
196
|
+
this._loading = false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
_resolveEntry(fileMap) {
|
|
200
|
+
if (this.entryFile && fileMap.has(this.entryFile)) return this.entryFile;
|
|
201
|
+
for (const name of [
|
|
202
|
+
"index.html",
|
|
203
|
+
"index.tsx",
|
|
204
|
+
"index.ts",
|
|
205
|
+
"index.jsx",
|
|
206
|
+
"index.js",
|
|
207
|
+
"main.tsx",
|
|
208
|
+
"main.ts",
|
|
209
|
+
"main.py",
|
|
210
|
+
"index.py",
|
|
211
|
+
"main.r",
|
|
212
|
+
"script.r"
|
|
213
|
+
]) if (fileMap.has(name)) return name;
|
|
214
|
+
return fileMap.keys().next().value ?? "";
|
|
215
|
+
}
|
|
216
|
+
_revokeBlobUrls() {
|
|
217
|
+
for (const url of this._blobUrls) URL.revokeObjectURL(url);
|
|
218
|
+
this._blobUrls = [];
|
|
219
|
+
}
|
|
220
|
+
/** Injects the console capture script before </body> if captureConsole is enabled. */
|
|
221
|
+
_injectConsoleCapture(markup) {
|
|
222
|
+
if (!this.captureConsole) return markup;
|
|
223
|
+
const captureScript = SigveloCodePreview.CONSOLE_CAPTURE_SCRIPT.replaceAll("__SIGVELO_CHANNEL_ID__", this._runnerChannelId).replaceAll("__SIGVELO_PARENT_ORIGIN__", window.location.origin);
|
|
224
|
+
const idx = markup.lastIndexOf("</body>");
|
|
225
|
+
if (idx === -1) return markup + captureScript;
|
|
226
|
+
return markup.slice(0, idx) + captureScript + markup.slice(idx);
|
|
227
|
+
}
|
|
228
|
+
render() {
|
|
229
|
+
return html`
|
|
230
|
+
${this._loading ? html` <div class="loading"><sigvelo-spinner label="Building…"></sigvelo-spinner></div> ` : ""}
|
|
231
|
+
${this._error ? html`
|
|
232
|
+
<div class="error">
|
|
233
|
+
<sigvelo-callout color="destructive">
|
|
234
|
+
<sigvelo-icon slot="icon" name="alert-triangle"></sigvelo-icon>
|
|
235
|
+
<pre style="margin:0; white-space:pre-wrap; word-break:break-word; font-size:12px;">
|
|
236
|
+
${this._error}</pre
|
|
237
|
+
>
|
|
238
|
+
</sigvelo-callout>
|
|
239
|
+
</div>
|
|
240
|
+
` : ""}
|
|
241
|
+
${this._pyRunnerSrc ? html`<iframe
|
|
242
|
+
class="preview-iframe"
|
|
243
|
+
sandbox="allow-scripts allow-modals allow-forms"
|
|
244
|
+
title="Code preview"
|
|
245
|
+
.src=${this._pyRunnerSrc}
|
|
246
|
+
@load=${this._connectRunner}
|
|
247
|
+
></iframe>` : html`<iframe
|
|
248
|
+
class="preview-iframe"
|
|
249
|
+
sandbox="allow-scripts allow-modals allow-forms"
|
|
250
|
+
title="Code preview"
|
|
251
|
+
.srcdoc=${this._srcdoc}
|
|
252
|
+
@load=${this._connectRunner}
|
|
253
|
+
></iframe>`}
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
__decorate([property({ type: Array })], SigveloCodePreview.prototype, "files", void 0);
|
|
258
|
+
__decorate([property({ attribute: "entry-file" })], SigveloCodePreview.prototype, "entryFile", void 0);
|
|
259
|
+
__decorate([property({
|
|
260
|
+
attribute: "capture-console",
|
|
261
|
+
type: Boolean
|
|
262
|
+
})], SigveloCodePreview.prototype, "captureConsole", void 0);
|
|
263
|
+
__decorate([state()], SigveloCodePreview.prototype, "_srcdoc", void 0);
|
|
264
|
+
__decorate([state()], SigveloCodePreview.prototype, "_pyRunnerSrc", void 0);
|
|
265
|
+
__decorate([state()], SigveloCodePreview.prototype, "_error", void 0);
|
|
266
|
+
__decorate([state()], SigveloCodePreview.prototype, "_loading", void 0);
|
|
267
|
+
customElements.define("sigvelo-code-preview", SigveloCodePreview);
|
|
268
|
+
//#endregion
|
|
269
|
+
export { SigveloCodePreview as t };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { n as FileLanguage } from "../../transform-DWhHlnkw.js";
|
|
2
|
+
import { CSSResultGroup, PropertyValues } from "lit";
|
|
3
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
5
|
+
|
|
6
|
+
//#region src/components/code-editor/code-editor.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* `<sigvelo-code-editor>`
|
|
9
|
+
*
|
|
10
|
+
* @summary A CodeMirror 6 wrapper that provides syntax-highlighted editing for
|
|
11
|
+
* a single document. Supports JavaScript, TypeScript, JSX, TSX, HTML, and CSS.
|
|
12
|
+
* Automatically detects dark mode from the `data-theme` attribute on the
|
|
13
|
+
* document root and applies the One Dark CodeMirror theme accordingly.
|
|
14
|
+
*
|
|
15
|
+
* @tag sigvelo-code-editor
|
|
16
|
+
* @status experimental
|
|
17
|
+
* @since 0.1
|
|
18
|
+
*
|
|
19
|
+
* @event sigvelo-change - Fires when the document content changes. `event.detail.value` contains the new content.
|
|
20
|
+
*/
|
|
21
|
+
declare class SigveloCodeEditor extends SigveloElement {
|
|
22
|
+
static styles: CSSResultGroup;
|
|
23
|
+
/** The document content. */
|
|
24
|
+
value: string;
|
|
25
|
+
/** Syntax highlighting language. */
|
|
26
|
+
language: FileLanguage;
|
|
27
|
+
/** Makes the editor read-only. */
|
|
28
|
+
readonly: boolean;
|
|
29
|
+
/** Accessible label for the editor. */
|
|
30
|
+
editorLabel: string;
|
|
31
|
+
/**
|
|
32
|
+
* The name exposed to assistive technology. CodeMirror renders a
|
|
33
|
+
* `role="textbox"` element, which must always be named, so an unset
|
|
34
|
+
* `editor-label` falls back to the language rather than leaving it anonymous.
|
|
35
|
+
*/
|
|
36
|
+
private get accessibleLabel();
|
|
37
|
+
private _host;
|
|
38
|
+
private _dark;
|
|
39
|
+
private _view;
|
|
40
|
+
private _langCompartment;
|
|
41
|
+
private _themeCompartment;
|
|
42
|
+
private _readonlyCompartment;
|
|
43
|
+
private _labelCompartment;
|
|
44
|
+
private _suppressExternalUpdate;
|
|
45
|
+
private _themeObserver;
|
|
46
|
+
private _systemTheme;
|
|
47
|
+
private _onSystemThemeChange;
|
|
48
|
+
connectedCallback(): void;
|
|
49
|
+
protected firstUpdated(): void;
|
|
50
|
+
protected updated(changed: PropertyValues): void;
|
|
51
|
+
disconnectedCallback(): void;
|
|
52
|
+
private _isDark;
|
|
53
|
+
private _observeTheme;
|
|
54
|
+
private _createView;
|
|
55
|
+
/** Returns the underlying CodeMirror `EditorView`, or `null` if not yet created. */
|
|
56
|
+
getEditorView(): EditorView | null;
|
|
57
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
58
|
+
}
|
|
59
|
+
declare global {
|
|
60
|
+
interface HTMLElementTagNameMap {
|
|
61
|
+
"sigvelo-code-editor": SigveloCodeEditor;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { SigveloCodeEditor };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { t as EditorFile } from "../../transform-DWhHlnkw.js";
|
|
2
|
+
import { CSSResultGroup } from "lit";
|
|
3
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
4
|
+
//#region src/components/code-preview/code-preview.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* `<sigvelo-code-preview>`
|
|
7
|
+
*
|
|
8
|
+
* @summary A sandboxed preview pane that transpiles and runs code from a set of
|
|
9
|
+
* files. Supports HTML entry points (with inlined CSS/JS) and module entry
|
|
10
|
+
* points (TS/TSX via esm.sh). Displays errors using `<sigvelo-callout>`.
|
|
11
|
+
*
|
|
12
|
+
* @tag sigvelo-code-preview
|
|
13
|
+
* @status experimental
|
|
14
|
+
* @since 0.1
|
|
15
|
+
*
|
|
16
|
+
* @event sigvelo-run - Fires when execution completes successfully.
|
|
17
|
+
* @event sigvelo-error - Fires when a build or runtime error occurs. `event.detail.message` has the error text.
|
|
18
|
+
* @event sigvelo-console - Fires for validated console output from the isolated preview.
|
|
19
|
+
*/
|
|
20
|
+
declare class SigveloCodePreview extends SigveloElement {
|
|
21
|
+
static styles: CSSResultGroup;
|
|
22
|
+
/** The file set to render. */
|
|
23
|
+
files: EditorFile[];
|
|
24
|
+
/**
|
|
25
|
+
* The name of the entry file. Defaults to `index.html` if present,
|
|
26
|
+
* otherwise the first `.tsx`, `.ts`, `.jsx`, or `.js` file.
|
|
27
|
+
*/
|
|
28
|
+
entryFile: string;
|
|
29
|
+
/** When true, injects a console capture script into the iframe srcdoc. */
|
|
30
|
+
captureConsole: boolean;
|
|
31
|
+
private _srcdoc;
|
|
32
|
+
private _pyRunnerSrc;
|
|
33
|
+
private _error;
|
|
34
|
+
private _loading;
|
|
35
|
+
private _blobUrls;
|
|
36
|
+
private _pendingPyPayload;
|
|
37
|
+
private _runnerPort;
|
|
38
|
+
private readonly _runnerChannelId;
|
|
39
|
+
private static readonly CONSOLE_CAPTURE_SCRIPT;
|
|
40
|
+
disconnectedCallback(): void;
|
|
41
|
+
private _onRunnerMessage;
|
|
42
|
+
private _postPyPayload;
|
|
43
|
+
private _connectRunner;
|
|
44
|
+
/** Build and display the current file set. */
|
|
45
|
+
run(): Promise<void>;
|
|
46
|
+
private _resolveEntry;
|
|
47
|
+
private _revokeBlobUrls;
|
|
48
|
+
/** Injects the console capture script before </body> if captureConsole is enabled. */
|
|
49
|
+
private _injectConsoleCapture;
|
|
50
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
"sigvelo-code-preview": SigveloCodePreview;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { SigveloCodePreview };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as EditorFile } from "../../transform-DWhHlnkw.js";
|
|
2
|
+
import { CSSResultGroup, PropertyValues } from "lit";
|
|
3
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
4
|
+
//#region src/components/interactive-editor/interactive-editor.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* `<sigvelo-interactive-editor>`
|
|
7
|
+
*
|
|
8
|
+
* @summary A multi-file code playground with a collapsible file explorer
|
|
9
|
+
* sidebar, code editor, and live preview/console pane. The sidebar sits
|
|
10
|
+
* beside the editor only and does not extend into the preview pane.
|
|
11
|
+
*
|
|
12
|
+
* @tag sigvelo-interactive-editor
|
|
13
|
+
* @status experimental
|
|
14
|
+
* @since 0.1
|
|
15
|
+
* @cssproperty [--sigvelo-interactive-editor-height=30rem] - The editor's block size.
|
|
16
|
+
*/
|
|
17
|
+
declare class SigveloInteractiveEditor extends SigveloElement {
|
|
18
|
+
static styles: CSSResultGroup;
|
|
19
|
+
files: EditorFile[];
|
|
20
|
+
entryFile: string;
|
|
21
|
+
layout: "horizontal" | "vertical";
|
|
22
|
+
hideEditor: boolean;
|
|
23
|
+
hidePreview: boolean;
|
|
24
|
+
autoRun: boolean;
|
|
25
|
+
private _activeFileName;
|
|
26
|
+
private _fileContents;
|
|
27
|
+
private _showAddFile;
|
|
28
|
+
private _newFileName;
|
|
29
|
+
private _fileError;
|
|
30
|
+
private _compact;
|
|
31
|
+
private _compactView;
|
|
32
|
+
private _rightPane;
|
|
33
|
+
private _consoleLogs;
|
|
34
|
+
private _unreadConsoleCount;
|
|
35
|
+
private _sidebarOpen;
|
|
36
|
+
private _expandedFolders;
|
|
37
|
+
private _preview;
|
|
38
|
+
private _runDebounce;
|
|
39
|
+
private _resizeObserver;
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
43
|
+
protected updated(changed: PropertyValues): void;
|
|
44
|
+
private _onConsoleMessage;
|
|
45
|
+
private _clearConsole;
|
|
46
|
+
private _initFiles;
|
|
47
|
+
private _activeContent;
|
|
48
|
+
private _activeLanguage;
|
|
49
|
+
private _onEditorChange;
|
|
50
|
+
private _scheduleRun;
|
|
51
|
+
private _runCode;
|
|
52
|
+
/** Returns the runtime language of the project ('python', 'r', or 'js'). */
|
|
53
|
+
private _projectRuntime;
|
|
54
|
+
private _confirmAddFile;
|
|
55
|
+
private _dismissAddFile;
|
|
56
|
+
private _removeFile;
|
|
57
|
+
private _switchView;
|
|
58
|
+
private _selectFileAndShowCode;
|
|
59
|
+
private _switchRightPane;
|
|
60
|
+
private _toggleFolder;
|
|
61
|
+
private _renderTreeNodes;
|
|
62
|
+
private _renderSidebar;
|
|
63
|
+
private _renderEditorPane;
|
|
64
|
+
private _renderRightPane;
|
|
65
|
+
private _renderConsoleView;
|
|
66
|
+
private _renderMobileNav;
|
|
67
|
+
private _renderMobileFileList;
|
|
68
|
+
private _renderContent;
|
|
69
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
70
|
+
}
|
|
71
|
+
declare global {
|
|
72
|
+
interface HTMLElementTagNameMap {
|
|
73
|
+
"sigvelo-interactive-editor": SigveloInteractiveEditor;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { SigveloInteractiveEditor };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CSSResultGroup } from "lit";
|
|
2
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
3
|
+
//#region src/components/r-editor/r-editor.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<sigvelo-r-editor>`
|
|
6
|
+
*
|
|
7
|
+
* @summary A WebR-powered R code editor with integrated console output and plot
|
|
8
|
+
* viewer. Runs R code in the browser via WebAssembly. The editor pane uses
|
|
9
|
+
* CodeMirror with R syntax highlighting, while the right pane shows captured
|
|
10
|
+
* plots and console output in separate tabs.
|
|
11
|
+
*
|
|
12
|
+
* @tag sigvelo-r-editor
|
|
13
|
+
* @status experimental
|
|
14
|
+
* @since 0.1
|
|
15
|
+
*/
|
|
16
|
+
declare class SigveloREditor extends SigveloElement {
|
|
17
|
+
static styles: CSSResultGroup;
|
|
18
|
+
/** Initial R code to display in the editor. */
|
|
19
|
+
code: string;
|
|
20
|
+
/** R packages to pre-install before running code (e.g. `['ggplot2']`). */
|
|
21
|
+
packages: string[];
|
|
22
|
+
/** Accessible label for the editor. */
|
|
23
|
+
editorLabel: string;
|
|
24
|
+
private _editedCode;
|
|
25
|
+
private _consoleLogs;
|
|
26
|
+
private _plots;
|
|
27
|
+
private _currentPlotIndex;
|
|
28
|
+
private _webRReady;
|
|
29
|
+
private _webRLoading;
|
|
30
|
+
private _loadingMessage;
|
|
31
|
+
private _running;
|
|
32
|
+
private _compact;
|
|
33
|
+
private _compactView;
|
|
34
|
+
private _rightPane;
|
|
35
|
+
private _unreadConsoleCount;
|
|
36
|
+
private _resizeObserver;
|
|
37
|
+
private _runnerIframe;
|
|
38
|
+
private _runnerPort;
|
|
39
|
+
private readonly _runnerChannelId;
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
protected firstUpdated(): void;
|
|
42
|
+
disconnectedCallback(): void;
|
|
43
|
+
private _initRunner;
|
|
44
|
+
private _onMessage;
|
|
45
|
+
private _runCode;
|
|
46
|
+
private _onEditorChange;
|
|
47
|
+
private _prevPlot;
|
|
48
|
+
private _nextPlot;
|
|
49
|
+
private _savePlot;
|
|
50
|
+
private _clearPlots;
|
|
51
|
+
private _clearConsole;
|
|
52
|
+
private _switchRightPane;
|
|
53
|
+
private _switchView;
|
|
54
|
+
private _renderEditorPane;
|
|
55
|
+
private _renderPlotViewer;
|
|
56
|
+
private _renderConsoleView;
|
|
57
|
+
private _renderRightPane;
|
|
58
|
+
private _renderLoadingOverlay;
|
|
59
|
+
private _renderMobileNav;
|
|
60
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
61
|
+
}
|
|
62
|
+
declare global {
|
|
63
|
+
interface HTMLElementTagNameMap {
|
|
64
|
+
"sigvelo-r-editor": SigveloREditor;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { SigveloREditor };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CSSResultGroup } from "lit";
|
|
2
|
+
import { SigveloElement } from "@mcp-b/wc-support/base/sigvelo-element";
|
|
3
|
+
//#region src/components/sql-editor/sql-editor.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `<sigvelo-sql-editor>`
|
|
6
|
+
*
|
|
7
|
+
* @summary An in-browser PostgreSQL editor powered by PGlite (WASM). Runs
|
|
8
|
+
* SQL queries locally with no server. Includes a results table, schema
|
|
9
|
+
* browser with autocompletion, and optional dataset preloading via the
|
|
10
|
+
* `setup-sql` attribute.
|
|
11
|
+
*
|
|
12
|
+
* @tag sigvelo-sql-editor
|
|
13
|
+
* @status experimental
|
|
14
|
+
* @since 0.1
|
|
15
|
+
*/
|
|
16
|
+
declare class SigveloSqlEditor extends SigveloElement {
|
|
17
|
+
static styles: CSSResultGroup;
|
|
18
|
+
/** SQL to execute on database initialization (CREATE TABLE, INSERT, etc.). */
|
|
19
|
+
setupSql: string;
|
|
20
|
+
/** Initial query in the editor. */
|
|
21
|
+
code: string;
|
|
22
|
+
/** IndexedDB name for persistence. Empty = in-memory (no persistence). */
|
|
23
|
+
dbName: string;
|
|
24
|
+
/** Enable PostGIS extension on the in-browser database. */
|
|
25
|
+
postgis: boolean;
|
|
26
|
+
/** Accessible label for the editor. */
|
|
27
|
+
editorLabel: string;
|
|
28
|
+
private _editedCode;
|
|
29
|
+
private _pgliteReady;
|
|
30
|
+
private _pgliteLoading;
|
|
31
|
+
private _loadingMessage;
|
|
32
|
+
private _running;
|
|
33
|
+
private _resultFields;
|
|
34
|
+
private _resultRows;
|
|
35
|
+
private _rowCount;
|
|
36
|
+
private _executionTimeMs;
|
|
37
|
+
private _error;
|
|
38
|
+
private _schema;
|
|
39
|
+
private _expandedTables;
|
|
40
|
+
private _sortColumn;
|
|
41
|
+
private _sortDirection;
|
|
42
|
+
private _compact;
|
|
43
|
+
private _compactView;
|
|
44
|
+
private _rightPane;
|
|
45
|
+
private _runner;
|
|
46
|
+
private _resizeObserver;
|
|
47
|
+
private _execId;
|
|
48
|
+
connectedCallback(): void;
|
|
49
|
+
protected firstUpdated(): void;
|
|
50
|
+
disconnectedCallback(): void;
|
|
51
|
+
private _initRunner;
|
|
52
|
+
private _postToRunner;
|
|
53
|
+
private _onMessage;
|
|
54
|
+
private _requestSchema;
|
|
55
|
+
private _runCode;
|
|
56
|
+
private _onEditorChange;
|
|
57
|
+
private _resetDatabase;
|
|
58
|
+
private _boundOnKeydown;
|
|
59
|
+
private _onKeydown;
|
|
60
|
+
private _toggleTable;
|
|
61
|
+
private _insertSelectQuery;
|
|
62
|
+
private _toggleSort;
|
|
63
|
+
private _getSortedRows;
|
|
64
|
+
private _renderEditorPane;
|
|
65
|
+
private _renderResultsView;
|
|
66
|
+
private _renderSchemaView;
|
|
67
|
+
private _renderRightPane;
|
|
68
|
+
private _renderLoadingOverlay;
|
|
69
|
+
private _renderMobileNav;
|
|
70
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface HTMLElementTagNameMap {
|
|
74
|
+
"sigvelo-sql-editor": SigveloSqlEditor;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { SigveloSqlEditor };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.138.0/helpers/esm/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { __decorate as t };
|