@mcp-b/interactive-components 0.2.21 → 0.3.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/{code-editor-B94tewLC.js → code-editor-hnbxw8Xk.js} +97 -183
- package/dist/{code-preview-gKk0nBKP.js → code-preview-Pq2CFfK9.js} +20 -3
- package/dist/components/code-editor/code-editor.d.ts +4 -11
- package/dist/components/code-editor/code-editor.js +1 -1
- package/dist/components/code-preview/code-preview.d.ts +4 -1
- package/dist/components/code-preview/code-preview.js +1 -1
- package/dist/components/interactive-editor/interactive-editor.d.ts +4 -3
- package/dist/components/interactive-editor/interactive-editor.js +1 -1
- package/dist/components/r-editor/r-editor.js +1 -1
- package/dist/components/sql-editor/sql-editor.js +1 -1
- package/dist/docs/custom-elements.json +60 -70
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/{interactive-editor-WfTWxJGF.js → interactive-editor-DQfrcGUo.js} +20 -19
- package/dist/lib/transform.d.ts +52 -1
- package/dist/lib/transform.js +23 -15
- package/dist/{r-editor-DwSyDo2i.js → r-editor-BuoVoBdn.js} +11 -4
- package/dist/{sql-editor-CsNrjJ2_.js → sql-editor-26vbWzLE.js} +25 -7
- package/dist/themes/interactive.css +12 -11
- package/package.json +3 -4
- package/dist/transform-DWhHlnkw.d.ts +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/interactive-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Sigvelo interactive code editor components built with Lit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-editor",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@codemirror/legacy-modes": "^6.5.3",
|
|
52
52
|
"@codemirror/search": "^6.7.1",
|
|
53
53
|
"@codemirror/state": "^6.7.1",
|
|
54
|
-
"@codemirror/theme-one-dark": "^6.1.3",
|
|
55
54
|
"@codemirror/view": "^6.43.8",
|
|
56
55
|
"@electric-sql/pglite": "0.4.2",
|
|
57
56
|
"@electric-sql/pglite-postgis": "0.0.4",
|
|
@@ -59,8 +58,8 @@
|
|
|
59
58
|
"@pyscript/core": "0.7.19",
|
|
60
59
|
"vite-plugin-static-copy": "^3.4.0",
|
|
61
60
|
"webr": "0.5.8",
|
|
62
|
-
"@mcp-b/wc-support": "0.
|
|
63
|
-
"@mcp-b/web-components": "0.
|
|
61
|
+
"@mcp-b/wc-support": "0.3.0",
|
|
62
|
+
"@mcp-b/web-components": "0.3.0"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//#region src/lib/transform.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* In-browser code transformation and preview building.
|
|
4
|
-
*
|
|
5
|
-
* - esm.sh transform API for TS/TSX/JSX → ES module transpilation
|
|
6
|
-
* - Blob URLs for inter-file module resolution
|
|
7
|
-
* - Import rewriting for npm packages via esm.sh CDN
|
|
8
|
-
*/
|
|
9
|
-
type FileLanguage = "javascript" | "typescript" | "jsx" | "tsx" | "html" | "css" | "python" | "r" | "sql";
|
|
10
|
-
interface EditorFile {
|
|
11
|
-
name: string;
|
|
12
|
-
content: string;
|
|
13
|
-
language?: FileLanguage;
|
|
14
|
-
}
|
|
15
|
-
declare function detectLanguage(filename: string): FileLanguage;
|
|
16
|
-
declare function needsTransform(lang: FileLanguage): boolean;
|
|
17
|
-
declare function transformCode(code: string, filename: string): Promise<string>;
|
|
18
|
-
/** Rewrites bare npm specifiers (`from 'react'`) to esm.sh CDN URLs. */
|
|
19
|
-
declare function rewriteNpmImports(code: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Builds a preview for HTML-entry projects. Inlines referenced CSS and JS
|
|
22
|
-
* files, transforming TS/JSX as needed.
|
|
23
|
-
*/
|
|
24
|
-
declare function buildHtmlPreview(files: Map<string, EditorFile>): Promise<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Builds a preview for module-entry projects (TS/TSX/JS). Transforms each
|
|
27
|
-
* file, creates Blob URLs for inter-file imports, and wraps in HTML.
|
|
28
|
-
*
|
|
29
|
-
* Returns `{ html, blobUrls }` — caller should revoke blob URLs on cleanup.
|
|
30
|
-
*/
|
|
31
|
-
declare function buildModulePreview(files: Map<string, EditorFile>, entryName: string): Promise<{
|
|
32
|
-
html: string;
|
|
33
|
-
blobUrls: string[];
|
|
34
|
-
}>;
|
|
35
|
-
/** Payload sent to the pyscript-runner.html page via postMessage. */
|
|
36
|
-
interface PyScriptRunPayload {
|
|
37
|
-
type: "pyscript-run";
|
|
38
|
-
code: string;
|
|
39
|
-
bodyHtml: string;
|
|
40
|
-
css: string;
|
|
41
|
-
config: Record<string, unknown> | null;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Builds a postMessage payload for the PyScript runner page.
|
|
45
|
-
*
|
|
46
|
-
* PyScript cannot run inside srcdoc or blob-URL iframes because it uses
|
|
47
|
-
* `new URL(m, location.href)` internally, and those iframe types have
|
|
48
|
-
* invalid base URLs. Instead, we load a static `pyscript-runner.html`
|
|
49
|
-
* page (served at a real HTTP URL) and send code to it via postMessage.
|
|
50
|
-
*/
|
|
51
|
-
declare function buildPythonPayload(files: Map<string, EditorFile>, entryName: string): PyScriptRunPayload;
|
|
52
|
-
//#endregion
|
|
53
|
-
export { buildModulePreview as a, needsTransform as c, buildHtmlPreview as i, rewriteNpmImports as l, FileLanguage as n, buildPythonPayload as o, PyScriptRunPayload as r, detectLanguage as s, EditorFile as t, transformCode as u };
|