viteboard 0.1.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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +136 -0
  3. package/bin/viteboard.mjs +59 -0
  4. package/content/docs/assets/image-mqjpqlyw.png +0 -0
  5. package/content/docs/assets/image-mqjsmenr.png +0 -0
  6. package/content/docs/boards/product-roadmap.board.json +2130 -0
  7. package/content/docs/capabilities.md +89 -0
  8. package/content/docs/docs.md +84 -0
  9. package/content/docs/guide/boards-in-markdown.md +48 -0
  10. package/content/docs/guide/boards.md +92 -0
  11. package/content/docs/guide/getting-started.md +71 -0
  12. package/content/docs/guide/test.md +6 -0
  13. package/content/docs/index.md +47 -0
  14. package/content/docs/product-roadmap.board.json +2130 -0
  15. package/content/docs/test.md +219 -0
  16. package/content/docs/tetst-dir/test-board.board.json +15 -0
  17. package/content/docs/tetst-dir/test-test.md +1 -0
  18. package/content/docs/workspace.md +73 -0
  19. package/dist/assets/index-CEpxLM2o.css +1 -0
  20. package/dist/assets/index-D4xvJdEQ.js +60 -0
  21. package/dist/index.html +13 -0
  22. package/index.html +13 -0
  23. package/package.json +52 -0
  24. package/src/app/AppController.ts +955 -0
  25. package/src/app/BoardState.ts +130 -0
  26. package/src/app/ClipboardService.ts +159 -0
  27. package/src/app/CommandManager.ts +66 -0
  28. package/src/app/ElementActions.ts +152 -0
  29. package/src/app/EmbedRegionSelector.ts +103 -0
  30. package/src/app/ExportPng.ts +107 -0
  31. package/src/app/ImageInsertService.ts +141 -0
  32. package/src/app/KeyboardShortcuts.ts +124 -0
  33. package/src/app/main.ts +6 -0
  34. package/src/board/BoardPreview.ts +189 -0
  35. package/src/board/BoardService.ts +222 -0
  36. package/src/canvas/CanvasRenderer.ts +253 -0
  37. package/src/canvas/CanvasSurface.ts +70 -0
  38. package/src/canvas/HitTester.ts +110 -0
  39. package/src/canvas/ImageCache.ts +123 -0
  40. package/src/canvas/PerformanceMonitor.ts +31 -0
  41. package/src/canvas/RenderScheduler.ts +26 -0
  42. package/src/canvas/Viewport.ts +77 -0
  43. package/src/content/ContentApi.ts +258 -0
  44. package/src/content/Markdown.ts +431 -0
  45. package/src/content/MarkdownView.ts +70 -0
  46. package/src/editor/DocEditor.ts +799 -0
  47. package/src/editor/htmlToMarkdown.ts +333 -0
  48. package/src/elements/renderElement.ts +509 -0
  49. package/src/elements/types.ts +118 -0
  50. package/src/shell/Shell.ts +2950 -0
  51. package/src/shell/Sidebar.ts +1352 -0
  52. package/src/storage/AssetStore.ts +86 -0
  53. package/src/storage/BoardSerializer.ts +114 -0
  54. package/src/storage/ImportExportService.ts +153 -0
  55. package/src/storage/IndexedDbStore.ts +92 -0
  56. package/src/storage/LocalBoardStore.ts +104 -0
  57. package/src/styles.css +3257 -0
  58. package/src/templates/helpers.ts +124 -0
  59. package/src/templates/index.ts +65 -0
  60. package/src/templates/journeyMapTemplate.ts +52 -0
  61. package/src/templates/opportunityTreeTemplate.ts +45 -0
  62. package/src/templates/personaTemplate.ts +41 -0
  63. package/src/templates/prioritizationMatrixTemplate.ts +44 -0
  64. package/src/templates/requirementsFlowTemplate.ts +45 -0
  65. package/src/templates/screenshotReviewTemplate.ts +52 -0
  66. package/src/templates/systemDiagramTemplate.ts +41 -0
  67. package/src/testing/StressTestGenerator.ts +134 -0
  68. package/src/testing/StressTestPanel.ts +64 -0
  69. package/src/tools/ArrowTool.ts +87 -0
  70. package/src/tools/ImageTool.ts +39 -0
  71. package/src/tools/PanTool.ts +34 -0
  72. package/src/tools/SelectTool.ts +377 -0
  73. package/src/tools/ShapeTool.ts +106 -0
  74. package/src/tools/StickyTool.ts +69 -0
  75. package/src/tools/TaskTool.ts +52 -0
  76. package/src/tools/TextTool.ts +45 -0
  77. package/src/tools/ToolContext.ts +44 -0
  78. package/src/tools/ToolController.ts +178 -0
  79. package/src/ui/Modal.ts +58 -0
  80. package/src/ui/PerformanceOverlay.ts +75 -0
  81. package/src/ui/StorageManager.ts +94 -0
  82. package/src/ui/TemplatePicker.ts +67 -0
  83. package/src/ui/TextEditorOverlay.ts +137 -0
  84. package/src/ui/Toolbar.ts +151 -0
  85. package/src/ui/TopControls.ts +137 -0
  86. package/src/ui/icons.ts +50 -0
  87. package/tsconfig.json +19 -0
  88. package/vite.config.ts +694 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 ViteBoard Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # ViteBoard
2
+
3
+ A local-first documentation workspace and infinite-canvas whiteboard. Markdown docs, boards, and structured capability specs — all plain files on disk, tracked by git.
4
+
5
+ **Zero runtime dependencies.** Built entirely in vanilla TypeScript with Vite.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g viteboard
11
+ ```
12
+
13
+ Then run from any directory:
14
+
15
+ ```bash
16
+ viteboard
17
+ ```
18
+
19
+ Or run without installing:
20
+
21
+ ```bash
22
+ npx viteboard
23
+ ```
24
+
25
+ Or with pnpm:
26
+
27
+ ```bash
28
+ pnpm dlx viteboard
29
+ ```
30
+
31
+ ViteBoard opens in your browser. Click **Add Repo** in the sidebar, pick any local project directory, and ViteBoard discovers all `docs/` folders and mounts them in the sidebar.
32
+
33
+ ## Development
34
+
35
+ To work on ViteBoard itself:
36
+
37
+ ```bash
38
+ git clone https://gitlab.com/ajsib/viteboard.git
39
+ cd viteboard
40
+ npm install
41
+ npm run dev
42
+ ```
43
+
44
+ ## What It Does
45
+
46
+ ViteBoard is a local documentation tool that runs alongside your codebase. Point it at a project directory and it finds every `docs/` folder, giving you a workspace to write, organize, and browse documentation — all stored as plain files that git tracks naturally.
47
+
48
+ ### Docs
49
+
50
+ Write markdown files inside any `docs/` directory. ViteBoard renders them with full markdown support: headings, lists, tables, code blocks, images, and links. Edit inline or in an integrated editor.
51
+
52
+ ### Boards
53
+
54
+ Infinite-canvas whiteboards saved as `.board.json` files next to your docs. Create sticky notes, shapes, arrows, text, images, tasks, and frames. Boards are small, diffable, and git-native.
55
+
56
+ Board regions can be embedded directly into markdown documents using fenced code blocks.
57
+
58
+ ### Capabilities
59
+
60
+ Structured markdown specs with YAML frontmatter (title, summary, tags). Build a cart of specs and copy them as a combined prompt for AI workflows.
61
+
62
+ ### Search
63
+
64
+ Full-text search across every doc and capability in every registered project. `Cmd/Ctrl K` to open from anywhere.
65
+
66
+ ## Project Structure
67
+
68
+ ```
69
+ your-project/
70
+ frontend/
71
+ src/
72
+ docs/ <- ViteBoard discovers this
73
+ index.md
74
+ guides/
75
+ getting-started.md
76
+ boards/
77
+ architecture.board.json
78
+ capabilities/
79
+ auth-flow.md
80
+ assets/
81
+ screenshot.png
82
+ api/
83
+ docs/ <- And this
84
+ endpoints.md
85
+ backend/ <- No docs/ yet (create one via View: Raw)
86
+ ```
87
+
88
+ Each `docs/` folder becomes a content root. ViteBoard reads and writes files directly to disk. Git in your project is the source of truth.
89
+
90
+ ## Navigation
91
+
92
+ ### View: Docs (default)
93
+
94
+ The sidebar shows only your `docs/` folders and their contents. Clean, focused, no noise from the rest of the project filesystem.
95
+
96
+ ### View: Raw
97
+
98
+ Toggle via the three-dot menu on any project header. Shows the full directory tree with non-docs directories subtly muted. Right-click any directory to create a `docs/` folder inside it. Once created, toggle back to Docs view and the new root appears immediately.
99
+
100
+ ### Breadcrumbs
101
+
102
+ Every page shows its full path as clickable breadcrumbs. Each directory segment links to a wiki page showing the contents of that level — docs, boards, capabilities, and subdirectories.
103
+
104
+ ### Shared Links
105
+
106
+ Copy any URL from the address bar. Links are stable and resolve correctly when the same project is registered in the workspace.
107
+
108
+ ## Sidebar Actions
109
+
110
+ - **Right-click a directory** inside `docs/` to create docs, boards, capabilities, or subdirectories
111
+ - **Right-click a file** to open, edit, rename, or delete
112
+ - **Drag and drop** files and directories to reorganize
113
+ - **Three-dot menu** on project headers for View: Raw/Docs toggle, wiki, and project actions
114
+
115
+ ## Workspace
116
+
117
+ Developer-specific workspace settings (which projects are registered) live in `.workspace/` and should be gitignored. The workspace file stores only absolute paths to project roots.
118
+
119
+ ## Building
120
+
121
+ ```bash
122
+ npm run build # Type-check + bundle to dist/
123
+ npm run preview # Preview the production build
124
+ ```
125
+
126
+ ## Tech
127
+
128
+ - **Vite** — dev server and build tool
129
+ - **TypeScript** — all source code, zero JavaScript
130
+ - **Canvas API** — infinite-canvas board rendering (no libraries)
131
+ - **Custom Vite plugin** — serves as the backend, handling file I/O and workspace management
132
+ - **Hash-based routing** — works as static files, no page reloads
133
+
134
+ ## License
135
+
136
+ MIT
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createServer } from "vite";
4
+ import { fileURLToPath } from "node:url";
5
+ import path from "node:path";
6
+ import fs from "node:fs";
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const packageRoot = path.resolve(__dirname, "..");
10
+
11
+ // The user's working directory — where .workspace/ and projects live
12
+ const userCwd = process.cwd();
13
+
14
+ const port = parseInt(process.env.PORT || "5173", 10);
15
+ const host = process.env.HOST || "localhost";
16
+
17
+ async function main() {
18
+ // Check if we're running from the source repo (dev mode) or as an installed package
19
+ const hasSourceIndex = fs.existsSync(path.join(packageRoot, "index.html"));
20
+ const hasDist = fs.existsSync(path.join(packageRoot, "dist", "index.html"));
21
+
22
+ if (hasSourceIndex) {
23
+ // Dev mode or running from source — use Vite dev server
24
+ const server = await createServer({
25
+ root: packageRoot,
26
+ configFile: path.join(packageRoot, "vite.config.ts"),
27
+ server: { port, host, open: true },
28
+ });
29
+ await server.listen();
30
+ server.printUrls();
31
+ } else if (hasDist) {
32
+ // Installed as a package — serve the pre-built dist with the API plugin
33
+ // We need to dynamically import the config since it may be .ts
34
+ const { default: configFn } = await import(path.join(packageRoot, "vite.config.ts"));
35
+ const config = typeof configFn === "function" ? configFn({}) : configFn;
36
+ const plugins = Array.isArray(config.plugins) ? config.plugins : [];
37
+
38
+ const server = await createServer({
39
+ root: path.join(packageRoot, "dist"),
40
+ plugins,
41
+ server: { port, host, open: true },
42
+ });
43
+ await server.listen();
44
+ server.printUrls();
45
+ } else {
46
+ console.error("ViteBoard: Could not find index.html or dist/. Is the package installed correctly?");
47
+ process.exit(1);
48
+ }
49
+ }
50
+
51
+ console.log(`
52
+ ViteBoard — Local documentation workspace
53
+ Working directory: ${userCwd}
54
+ `);
55
+
56
+ main().catch((err) => {
57
+ console.error("Failed to start ViteBoard:", err);
58
+ process.exit(1);
59
+ });