@antigenic-oss/paint 0.2.0 → 0.2.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.
Files changed (65) hide show
  1. package/README.md +32 -17
  2. package/bin/bridge-server.js +36 -0
  3. package/bin/paint.js +542 -102
  4. package/bin/terminal-server.js +105 -0
  5. package/package.json +7 -8
  6. package/public/dev-editor-inspector.js +92 -104
  7. package/src/app/api/claude/apply/route.ts +2 -2
  8. package/src/app/api/project/scan/route.ts +1 -1
  9. package/src/app/api/proxy/[[...path]]/route.ts +4 -4
  10. package/src/app/docs/DocsClient.tsx +1 -1
  11. package/src/app/docs/page.tsx +0 -1
  12. package/src/app/page.tsx +1 -1
  13. package/src/bridge/api-handlers.ts +1 -1
  14. package/src/bridge/proxy-handler.ts +4 -4
  15. package/src/bridge/server.ts +135 -39
  16. package/src/components/ConnectModal.tsx +1 -2
  17. package/src/components/PreviewFrame.tsx +2 -2
  18. package/src/components/ResponsiveToolbar.tsx +1 -2
  19. package/src/components/common/ColorPicker.tsx +7 -9
  20. package/src/components/common/UnitInput.tsx +1 -1
  21. package/src/components/common/VariableColorPicker.tsx +0 -1
  22. package/src/components/left-panel/ComponentsPanel.tsx +3 -3
  23. package/src/components/left-panel/LayerNode.tsx +1 -1
  24. package/src/components/left-panel/icons.tsx +1 -1
  25. package/src/components/left-panel/terminal/TerminalPanel.tsx +2 -2
  26. package/src/components/right-panel/ElementLogBox.tsx +1 -3
  27. package/src/components/right-panel/changes/ChangesPanel.tsx +12 -12
  28. package/src/components/right-panel/claude/ClaudeIntegrationPanel.tsx +2 -2
  29. package/src/components/right-panel/claude/DiffViewer.tsx +1 -1
  30. package/src/components/right-panel/claude/ProjectRootSelector.tsx +7 -7
  31. package/src/components/right-panel/claude/SetupFlow.tsx +1 -1
  32. package/src/components/right-panel/console/ConsolePanel.tsx +4 -4
  33. package/src/components/right-panel/design/BackgroundSection.tsx +2 -2
  34. package/src/components/right-panel/design/GradientEditor.tsx +6 -6
  35. package/src/components/right-panel/design/LayoutSection.tsx +4 -4
  36. package/src/components/right-panel/design/PositionSection.tsx +2 -2
  37. package/src/components/right-panel/design/SVGSection.tsx +2 -3
  38. package/src/components/right-panel/design/ShadowBlurSection.tsx +5 -5
  39. package/src/components/right-panel/design/TextSection.tsx +5 -5
  40. package/src/components/right-panel/design/icons.tsx +1 -1
  41. package/src/components/right-panel/design/inputs/BoxModelPreview.tsx +2 -2
  42. package/src/components/right-panel/design/inputs/CompactInput.tsx +2 -2
  43. package/src/components/right-panel/design/inputs/DraggableLabel.tsx +2 -1
  44. package/src/components/right-panel/design/inputs/IconToggleGroup.tsx +1 -1
  45. package/src/components/right-panel/design/inputs/LinkedInputPair.tsx +3 -3
  46. package/src/components/right-panel/design/inputs/SectionHeader.tsx +2 -1
  47. package/src/hooks/useDOMTree.ts +0 -1
  48. package/src/hooks/usePostMessage.ts +4 -3
  49. package/src/hooks/useTargetUrl.ts +1 -1
  50. package/src/inspector/DOMTraverser.ts +2 -2
  51. package/src/inspector/HoverHighlighter.ts +6 -6
  52. package/src/inspector/SelectionHighlighter.ts +4 -4
  53. package/src/lib/classifyElement.ts +1 -2
  54. package/src/lib/claude-bin.ts +1 -1
  55. package/src/lib/clientProjectScanner.ts +13 -13
  56. package/src/lib/cssVariableUtils.ts +1 -1
  57. package/src/lib/folderPicker.ts +4 -1
  58. package/src/lib/projectScanner.ts +15 -15
  59. package/src/lib/tailwindClassParser.ts +1 -1
  60. package/src/lib/textShadowUtils.ts +1 -1
  61. package/src/lib/utils.ts +4 -4
  62. package/src/proxy.ts +1 -1
  63. package/src/store/treeSlice.ts +2 -2
  64. package/src/server/terminal-server.ts +0 -104
  65. package/tsconfig.server.json +0 -12
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+
3
+ const http = require('node:http')
4
+ const { URL } = require('node:url')
5
+ const pty = require('node-pty')
6
+ const { WebSocketServer } = require('ws')
7
+
8
+ const TERMINAL_PORT = Number(process.env.TERMINAL_PORT) || 4001
9
+
10
+ const server = http.createServer((req, res) => {
11
+ const url = new URL(req.url || '/', `http://${req.headers.host || 'localhost'}`)
12
+
13
+ if (url.pathname === '/health') {
14
+ res.writeHead(200, {
15
+ 'Access-Control-Allow-Origin': '*',
16
+ 'Content-Type': 'text/plain; charset=utf-8',
17
+ })
18
+ res.end('ok')
19
+ return
20
+ }
21
+
22
+ if (req.method === 'OPTIONS') {
23
+ res.writeHead(204, {
24
+ 'Access-Control-Allow-Origin': '*',
25
+ 'Access-Control-Allow-Methods': 'GET',
26
+ 'Access-Control-Allow-Headers': '*',
27
+ })
28
+ res.end()
29
+ return
30
+ }
31
+
32
+ res.writeHead(404)
33
+ res.end('Not found')
34
+ })
35
+
36
+ const wss = new WebSocketServer({ noServer: true })
37
+
38
+ server.on('upgrade', (req, socket, head) => {
39
+ const url = new URL(req.url || '/', `http://${req.headers.host || 'localhost'}`)
40
+ if (url.pathname !== '/ws') {
41
+ socket.destroy()
42
+ return
43
+ }
44
+
45
+ wss.handleUpgrade(req, socket, head, (ws) => {
46
+ wss.emit('connection', ws, req)
47
+ })
48
+ })
49
+
50
+ wss.on('connection', (ws) => {
51
+ const shell = process.env.SHELL || '/bin/bash'
52
+ const term = pty.spawn(shell, [], {
53
+ name: 'xterm-256color',
54
+ cols: 80,
55
+ rows: 24,
56
+ cwd: process.env.HOME || process.cwd(),
57
+ env: process.env,
58
+ })
59
+
60
+ term.onData((data) => {
61
+ if (ws.readyState === ws.OPEN) {
62
+ ws.send(data)
63
+ }
64
+ })
65
+
66
+ term.onExit(() => {
67
+ try {
68
+ ws.close()
69
+ } catch {
70
+ // already closed
71
+ }
72
+ })
73
+
74
+ ws.on('message', (message) => {
75
+ const str = Buffer.isBuffer(message) ? message.toString() : String(message)
76
+
77
+ // Resize messages prefixed with \x01
78
+ if (str.startsWith('\x01')) {
79
+ try {
80
+ const { cols, rows } = JSON.parse(str.slice(1))
81
+ if (cols && rows) {
82
+ term.resize(cols, rows)
83
+ }
84
+ } catch {
85
+ // ignore invalid resize messages
86
+ }
87
+ return
88
+ }
89
+
90
+ term.write(str)
91
+ })
92
+
93
+ ws.on('close', () => {
94
+ try {
95
+ term.kill()
96
+ } catch {
97
+ // already closed
98
+ }
99
+ })
100
+ })
101
+
102
+ server.listen(TERMINAL_PORT, () => {
103
+ // eslint-disable-next-line no-console
104
+ console.log(`Terminal WebSocket server running on ws://localhost:${TERMINAL_PORT}/ws`)
105
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antigenic-oss/paint",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Visual editor for localhost web projects with a global paint CLI",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Antigenic-OSS/pAInt",
@@ -29,7 +29,6 @@
29
29
  "next.config.ts",
30
30
  "postcss.config.mjs",
31
31
  "tsconfig.json",
32
- "tsconfig.server.json",
33
32
  "README.md",
34
33
  "LICENSE",
35
34
  "NOTICE"
@@ -44,9 +43,9 @@
44
43
  "packageManager": "bun@1.3.9",
45
44
  "scripts": {
46
45
  "dev": "next dev --port 4000 --turbopack",
47
- "dev:terminal": "bun run src/server/terminal-server.ts",
48
- "dev:all": "bun run src/server/terminal-server.ts & bun run src/bridge/server.ts & next dev --port 4000 --turbopack",
49
- "bridge": "bun run src/bridge/server.ts",
46
+ "dev:terminal": "node ./bin/terminal-server.js",
47
+ "dev:all": "node ./bin/terminal-server.js & node ./bin/bridge-server.js & next dev --port 4000 --turbopack",
48
+ "bridge": "node ./bin/bridge-server.js",
50
49
  "build": "next build",
51
50
  "start": "next start --port 4000",
52
51
  "lint": "biome lint .",
@@ -69,13 +68,13 @@
69
68
  "react": "^19.2.4",
70
69
  "react-dom": "^19.2.4",
71
70
  "tailwindcss": "4.2.1",
71
+ "tsx": "^4.20.6",
72
72
  "typescript": "^5.9.3",
73
+ "ws": "^8.18.3",
73
74
  "zustand": "^5.0.11"
74
75
  },
75
76
  "devDependencies": {
76
77
  "@biomejs/biome": "2.4.5",
77
- "@changesets/cli": "^2.29.7",
78
- "@types/bun": "^1.3.9",
79
- "bun-types": "^1.3.2"
78
+ "@changesets/cli": "^2.29.7"
80
79
  }
81
80
  }