@asd14/vblocks 1.0.0 → 2.0.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.
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>VBlocks app</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@asd14/ts-config/targets/react.json",
4
+ "compilerOptions": {
5
+ "noEmit": true,
6
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildinfo",
7
+ "types": ["@asd14/vblocks/client"],
8
+ "paths": {
9
+ "@self/*": ["./src/*"]
10
+ }
11
+ },
12
+ "include": ["src"]
13
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "vblocks-app",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "start": "vblocks serve",
8
+ "build": "vblocks build",
9
+ "build:single": "vblocks build --env single",
10
+ "typecheck": "tsc --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "react": "^19",
14
+ "react-dom": "^19"
15
+ },
16
+ "devDependencies": {
17
+ "@asd14/ts-config": "^1.6.0",
18
+ "@asd14/vblocks": "*",
19
+ "@types/react": "^19",
20
+ "@types/react-dom": "^19",
21
+ "typescript": "^6"
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ import { createRoot } from "react-dom/client"
2
+
3
+ import "./index.css"
4
+
5
+ const root = document.querySelector("#root")
6
+
7
+ if (!root) {
8
+ throw new Error("index.html has no #root element")
9
+ }
10
+
11
+ createRoot(root).render(<h1>Hello World!</h1>)
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package.json",
3
+ "name": "vblocks-app",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "start": "vblocks serve",
8
+ "build": "vblocks build",
9
+ "build:single": "vblocks build --env single",
10
+ "typecheck": "tsc --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "@xyflow/react": "^12",
14
+ "react": "^19",
15
+ "react-dom": "^19"
16
+ },
17
+ "devDependencies": {
18
+ "@asd14/ts-config": "^1.6.0",
19
+ "@asd14/vblocks": "*",
20
+ "@tailwindcss/postcss": "^4",
21
+ "@types/react": "^19",
22
+ "@types/react-dom": "^19",
23
+ "tailwindcss": "^4",
24
+ "typescript": "^6"
25
+ }
26
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @param {{ mode: "production" | "development" | "none" }} api
3
+ */
4
+ export default ({ mode }) => ({
5
+ plugins: {
6
+ "@tailwindcss/postcss": {
7
+ optimize: mode === "production",
8
+ },
9
+ "cssnano": mode === "production" && {
10
+ preset: "default",
11
+ },
12
+ },
13
+ })
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,128 @@
1
+ import { useCallback } from "react"
2
+ import { createRoot } from "react-dom/client"
3
+ import {
4
+ addEdge,
5
+ Background,
6
+ Controls,
7
+ Handle,
8
+ Position,
9
+ ReactFlow,
10
+ useEdgesState,
11
+ useNodesState,
12
+ type Edge,
13
+ type Node,
14
+ type NodeProps,
15
+ type NodeTypes,
16
+ type OnConnect,
17
+ } from "@xyflow/react"
18
+
19
+ import "@xyflow/react/dist/style.css"
20
+ import "./index.css"
21
+
22
+ type StepNode = Node<{ label: string; detail: string }, "step">
23
+
24
+ /**
25
+ * The graph. Edit these two lists, this specimen draws the VBlocks build.
26
+ */
27
+ const initialNodes: StepNode[] = [
28
+ {
29
+ id: "index.tsx",
30
+ type: "step",
31
+ position: { x: 0, y: 0 },
32
+ data: { label: "src/index.tsx", detail: "The application entry point" },
33
+ },
34
+ {
35
+ id: "index.css",
36
+ type: "step",
37
+ position: { x: 280, y: 0 },
38
+ data: { label: "src/index.css", detail: "The global CSS" },
39
+ },
40
+ {
41
+ id: "swc",
42
+ type: "step",
43
+ position: { x: 0, y: 140 },
44
+ data: { label: "SWC", detail: "Compiles TypeScript and JSX" },
45
+ },
46
+ {
47
+ id: "postcss",
48
+ type: "step",
49
+ position: { x: 280, y: 140 },
50
+ data: { label: "PostCSS", detail: "Runs Tailwind and cssnano" },
51
+ },
52
+ {
53
+ id: "index.html",
54
+ type: "step",
55
+ position: { x: 560, y: 140 },
56
+ data: { label: "src/index.html", detail: "The HTML template" },
57
+ },
58
+ {
59
+ id: "webpack",
60
+ type: "step",
61
+ position: { x: 280, y: 280 },
62
+ data: { label: "Webpack", detail: "Bundles the modules and the assets" },
63
+ },
64
+ {
65
+ id: "dist",
66
+ type: "step",
67
+ position: { x: 280, y: 420 },
68
+ data: { label: "dist/index.html", detail: "The build output" },
69
+ },
70
+ ]
71
+
72
+ const initialEdges: Edge[] = [
73
+ { id: "index.tsx-swc", source: "index.tsx", target: "swc" },
74
+ { id: "index.css-postcss", source: "index.css", target: "postcss" },
75
+ { id: "swc-webpack", source: "swc", target: "webpack" },
76
+ { id: "postcss-webpack", source: "postcss", target: "webpack" },
77
+ { id: "index.html-webpack", source: "index.html", target: "webpack" },
78
+ { id: "webpack-dist", source: "webpack", target: "dist", animated: true },
79
+ ]
80
+
81
+ const Step = ({ data }: NodeProps<StepNode>) => (
82
+ <div className="w-56 rounded-md border border-stone-300 bg-white px-4 py-2 shadow-sm">
83
+ <Handle type="target" position={Position.Top} />
84
+ <div className="font-mono text-sm font-semibold text-stone-900">
85
+ {data.label}
86
+ </div>
87
+ <div className="text-xs text-stone-500">{data.detail}</div>
88
+ <Handle type="source" position={Position.Bottom} />
89
+ </div>
90
+ )
91
+
92
+ const nodeTypes: NodeTypes = { step: Step }
93
+
94
+ const Playground = () => {
95
+ const [nodes, , onNodesChange] = useNodesState(initialNodes)
96
+ const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges)
97
+
98
+ const onConnect: OnConnect = useCallback(
99
+ connection => {
100
+ setEdges(currentEdges => addEdge(connection, currentEdges))
101
+ },
102
+ [setEdges]
103
+ )
104
+
105
+ return (
106
+ <div className="h-screen w-screen">
107
+ <ReactFlow
108
+ nodes={nodes}
109
+ edges={edges}
110
+ nodeTypes={nodeTypes}
111
+ onNodesChange={onNodesChange}
112
+ onEdgesChange={onEdgesChange}
113
+ onConnect={onConnect}
114
+ fitView>
115
+ <Background />
116
+ <Controls />
117
+ </ReactFlow>
118
+ </div>
119
+ )
120
+ }
121
+
122
+ const root = document.querySelector("#root")
123
+
124
+ if (!root) {
125
+ throw new Error("index.html has no #root element")
126
+ }
127
+
128
+ createRoot(root).render(<Playground />)
@@ -1,4 +0,0 @@
1
- /** @type {import("tailwindcss").Config} */
2
- export default {
3
- content: ["./src/**/*.{ts,tsx}"],
4
- }