@tscircuit/runframe 0.0.1
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/.github/workflows/bun-formatcheck.yml +26 -0
- package/.github/workflows/bun-pver-release.yml +25 -0
- package/.github/workflows/bun-typecheck.yml +26 -0
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/biome.json +57 -0
- package/bun.lockb +0 -0
- package/cosmos.config.json +3 -0
- package/cosmos.decorator.tsx +3 -0
- package/dist/assets/index-CNL2S1zq.js +36 -0
- package/dist/assets/index-DDl5GwFA.js +21609 -0
- package/dist/assets/vision_bundle-CPRQl8Yc.js +15 -0
- package/dist/index.html +13 -0
- package/dist/standalone.js +46887 -0
- package/examples/resistor.fixture.tsx +12 -0
- package/examples/runframe-with-api-1.fixture.tsx +41 -0
- package/examples/runframe1-basic.fixture.tsx +19 -0
- package/index.html +13 -0
- package/lib/components/BomTable.tsx +69 -0
- package/lib/components/CircuitJsonPreview.tsx +348 -0
- package/lib/components/CircuitJsonTableViewer/CircuitJsonTableViewer.tsx +315 -0
- package/lib/components/CircuitJsonTableViewer/ClickableText.tsx +20 -0
- package/lib/components/CircuitJsonTableViewer/HeaderCell.tsx +26 -0
- package/lib/components/CircuitJsonTableViewer/Modal.tsx +38 -0
- package/lib/components/ErrorFallback.tsx +25 -0
- package/lib/components/ErrorTabContent.tsx +86 -0
- package/lib/components/PcbViewerWithContainerHeight.tsx +47 -0
- package/lib/components/PreviewEmptyState.tsx +14 -0
- package/lib/components/RunFrame.tsx +68 -0
- package/lib/components/RunFrameWithApi/index.tsx +41 -0
- package/lib/components/RunFrameWithApi/standalone.tsx +6 -0
- package/lib/components/RunFrameWithApi/store.ts +122 -0
- package/lib/components/RunFrameWithApi/types.ts +43 -0
- package/lib/components/ui/button.tsx +57 -0
- package/lib/components/ui/dropdown-menu.tsx +203 -0
- package/lib/components/ui/tabs.tsx +53 -0
- package/lib/dev/render-to-circuit-json.ts +7 -0
- package/lib/hooks/use-styles.ts +17 -0
- package/lib/preview.ts +1 -0
- package/lib/runner.ts +2 -0
- package/lib/utils/index.ts +6 -0
- package/lib/utils/pcbManualEditEventHandler.ts +156 -0
- package/package.json +52 -0
- package/postcss.config.js +8 -0
- package/renovate.json +15 -0
- package/scripts/build-css.ts +26 -0
- package/src/main.tsx +13 -0
- package/tailwind.config.js +3 -0
- package/tsconfig.json +43 -0
- package/vite.config.ts +43 -0
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tscircuit/runframe",
|
|
3
|
+
"main": "dist/index.js",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "cosmos",
|
|
8
|
+
"build": "bun run build:lib",
|
|
9
|
+
"build:lib": "bun run build:css && bun run build:cli && bun run build:standalone",
|
|
10
|
+
"build:css": "bun run scripts/build-css.ts",
|
|
11
|
+
"build:site": "cosmos-export",
|
|
12
|
+
"build:cli": "vite build",
|
|
13
|
+
"build:standalone": "tsup ./lib/components/RunFrameWithApi/standalone.tsx --sourcemap inline --format esm",
|
|
14
|
+
"format:check": "biome format .",
|
|
15
|
+
"format": "biome format --write .",
|
|
16
|
+
"vercel-build": "bun run build:css && cosmos-export"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@biomejs/biome": "^1.9.4",
|
|
20
|
+
"@types/bun": "latest",
|
|
21
|
+
"@types/react": "18",
|
|
22
|
+
"@types/react-dom": "18",
|
|
23
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
24
|
+
"autoprefixer": "^10.4.20",
|
|
25
|
+
"class-variance-authority": "^0.7.1",
|
|
26
|
+
"react": "18",
|
|
27
|
+
"react-cosmos": "^6.2.1",
|
|
28
|
+
"react-dom": "18",
|
|
29
|
+
"tailwindcss": "^3.4.16",
|
|
30
|
+
"tsup": "^8.3.5",
|
|
31
|
+
"vite": "^6.0.3"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"typescript": "^5.0.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
38
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
39
|
+
"@radix-ui/react-tabs": "^1.1.1",
|
|
40
|
+
"@tscircuit/3d-viewer": "^0.0.54",
|
|
41
|
+
"@tscircuit/eval-webworker": "^0.0.22",
|
|
42
|
+
"@tscircuit/file-server": "^0.0.5",
|
|
43
|
+
"@tscircuit/pcb-viewer": "^1.10.22",
|
|
44
|
+
"@tscircuit/schematic-viewer": "2.0.3",
|
|
45
|
+
"circuit-to-svg": "^0.0.91",
|
|
46
|
+
"comlink": "^4.4.2",
|
|
47
|
+
"cssnano": "^7.0.6",
|
|
48
|
+
"lucide-react": "^0.468.0",
|
|
49
|
+
"react-cosmos-plugin-vite": "^6.2.0",
|
|
50
|
+
"tailwind-merge": "^2.5.5"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/renovate.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": ["config:base"],
|
|
4
|
+
"packageRules": [
|
|
5
|
+
{
|
|
6
|
+
"packagePatterns": ["*"],
|
|
7
|
+
"excludePackagePatterns": ["@tscircuit/*", "circuit-to-svg"],
|
|
8
|
+
"enabled": false
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"matchUpdateTypes": ["major", "minor", "patch"],
|
|
12
|
+
"automerge": true
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from "node:fs"
|
|
2
|
+
import postcss from "postcss"
|
|
3
|
+
import tailwindcss from "tailwindcss"
|
|
4
|
+
import autoprefixer from "autoprefixer"
|
|
5
|
+
import cssnano from "cssnano"
|
|
6
|
+
import tailwindConfig from "../tailwind.config"
|
|
7
|
+
|
|
8
|
+
async function buildCss() {
|
|
9
|
+
// Read your base CSS file with @tailwind directives
|
|
10
|
+
const css = "@tailwind components; @tailwind utilities;"
|
|
11
|
+
|
|
12
|
+
const result = await postcss([
|
|
13
|
+
tailwindcss(tailwindConfig),
|
|
14
|
+
autoprefixer,
|
|
15
|
+
cssnano,
|
|
16
|
+
]).process(css, {
|
|
17
|
+
from: undefined,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(
|
|
21
|
+
"./lib/hooks/styles.generated.ts",
|
|
22
|
+
`export default \`${result.css.replace(/\\/g, "\\\\")}\``,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
buildCss()
|
package/src/main.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CircuitJsonPreview } from "lib/components/CircuitJsonPreview"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { createRoot } from "react-dom/client"
|
|
4
|
+
|
|
5
|
+
const root = createRoot(document.getElementById("root")!)
|
|
6
|
+
|
|
7
|
+
root.render(
|
|
8
|
+
<React.StrictMode>
|
|
9
|
+
<div style={{ width: "100vw", height: "100vh" }}>
|
|
10
|
+
<CircuitJsonPreview circuitJson={[]} />
|
|
11
|
+
</div>
|
|
12
|
+
</React.StrictMode>,
|
|
13
|
+
)
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Enable latest features
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
"baseUrl": ".",
|
|
12
|
+
"paths": {
|
|
13
|
+
"lib/*": ["lib/*"]
|
|
14
|
+
},
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
|
|
17
|
+
// Bundler mode
|
|
18
|
+
"moduleResolution": "bundler",
|
|
19
|
+
"allowImportingTsExtensions": true,
|
|
20
|
+
"verbatimModuleSyntax": true,
|
|
21
|
+
"noEmit": true,
|
|
22
|
+
|
|
23
|
+
// Best practices
|
|
24
|
+
"strict": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true,
|
|
27
|
+
|
|
28
|
+
// Some stricter flags (disabled by default)
|
|
29
|
+
"noUnusedLocals": false,
|
|
30
|
+
"noUnusedParameters": false,
|
|
31
|
+
"noPropertyAccessFromIndexSignature": false
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"lib/**/*.ts",
|
|
35
|
+
"lib/**/*.tsx",
|
|
36
|
+
"examples/**/*.ts",
|
|
37
|
+
"examples/**/*.tsx",
|
|
38
|
+
"cli/**/*.ts",
|
|
39
|
+
"cli/**/*.tsx",
|
|
40
|
+
"scripts/**/*.ts",
|
|
41
|
+
"scripts/**/*.tsx"
|
|
42
|
+
]
|
|
43
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineConfig, type Plugin } from "vite"
|
|
2
|
+
import react from "@vitejs/plugin-react"
|
|
3
|
+
import { resolve } from "node:path"
|
|
4
|
+
import winterspecBundle from "@tscircuit/file-server/dist/bundle"
|
|
5
|
+
import { getNodeHandler } from "winterspec/adapters/node"
|
|
6
|
+
|
|
7
|
+
const fakeHandler = getNodeHandler(winterspecBundle as any, {})
|
|
8
|
+
|
|
9
|
+
function apiServerPlugin(): Plugin {
|
|
10
|
+
return {
|
|
11
|
+
name: "api-server",
|
|
12
|
+
configureServer(server) {
|
|
13
|
+
server.middlewares.use(async (req, res, next) => {
|
|
14
|
+
if (req.url?.startsWith("/api/")) {
|
|
15
|
+
req.url = req.url.replace("/api/", "/")
|
|
16
|
+
fakeHandler(req, res)
|
|
17
|
+
} else {
|
|
18
|
+
next()
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const plugins: any[] = [react()]
|
|
26
|
+
|
|
27
|
+
if (!process.env.VERCEL) {
|
|
28
|
+
plugins.push(apiServerPlugin())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
plugins,
|
|
33
|
+
resolve: {
|
|
34
|
+
alias: {
|
|
35
|
+
lib: resolve(__dirname, "./lib"),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
define: {
|
|
39
|
+
global: {},
|
|
40
|
+
},
|
|
41
|
+
root: ".",
|
|
42
|
+
publicDir: "public",
|
|
43
|
+
})
|