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
@@ -0,0 +1,89 @@
1
+ ---
2
+ title: Capabilities
3
+ ---
4
+
5
+ # Capabilities
6
+
7
+ Capabilities are structured markdown specs stored at `<docs-root>/capabilities/*.md`. They're designed to be selected, combined, and copied as a single prompt into an AI coding assistant.
8
+
9
+ This is your blank slate — create your first capability by right-clicking a directory in the sidebar and choosing **New Capability**.
10
+
11
+ ## What a capability looks like
12
+
13
+ ```markdown
14
+ ---
15
+ title: Auth flow
16
+ summary: Describes the JWT-based authentication flow for this service.
17
+ tags: auth, security, backend
18
+ ---
19
+
20
+ # Auth flow
21
+
22
+ ## Overview
23
+
24
+ All API requests are authenticated with a short-lived JWT issued by...
25
+
26
+ ## Token structure
27
+
28
+ ...
29
+ ```
30
+
31
+ The frontmatter (`title`, `summary`, `tags`) powers the capability library cards and search. The body is the full spec content that gets copied into the prompt.
32
+
33
+ ## Creating a capability
34
+
35
+ Right-click any directory in the sidebar → **New Capability**. Type a name. The file is created in `<docs-root>/capabilities/<name>.md` with a frontmatter stub.
36
+
37
+ Click **Edit** in the top bar to write the spec body.
38
+
39
+ ## The capability library
40
+
41
+ Click **All Capabilities** in the sidebar to open the capability library for a project. Each capability appears as a card showing its title, summary, and tags.
42
+
43
+ From the library you can:
44
+
45
+ - Click a card title to open the full spec
46
+ - Click **Add to cart** to queue a spec for prompt building
47
+ - Click **Copy as LLM prompt** on a detail page to copy a single spec immediately
48
+
49
+ ## The component cart
50
+
51
+ The cart accumulates selected specs. It lives in the **Cart** button in the top bar — the number badge shows how many specs are queued.
52
+
53
+ Click the Cart button to open the popover:
54
+
55
+ | Button | Action |
56
+ | --- | --- |
57
+ | **Copy prompt** | Copies all specs as a single formatted prompt |
58
+ | **Remove** | Removes one spec from the cart |
59
+ | **Clear** | Empties the cart |
60
+
61
+ The cart is session memory — it resets when you close the tab.
62
+
63
+ ## The combined prompt format
64
+
65
+ When you click **Copy prompt**, the output looks like:
66
+
67
+ ```
68
+ Use these capability/component specs as implementation guidance for the next coding task.
69
+
70
+ ## 1. Auth flow
71
+
72
+ [full spec content]
73
+
74
+ ---
75
+
76
+ ## 2. Rate limiting
77
+
78
+ [full spec content]
79
+ ```
80
+
81
+ Paste this directly into ChatGPT, Claude, or any AI assistant as context before giving your coding instruction.
82
+
83
+ ## Searching capabilities
84
+
85
+ Capabilities are included in full-text search (Cmd K / Ctrl K). Results from the capability library are labelled **Capability** in the search results to distinguish them from regular docs.
86
+
87
+ ---
88
+
89
+ **Next:** [Workspace](workspace.md) — managing projects, the wiki, and shortcuts.
@@ -0,0 +1,84 @@
1
+ ---
2
+ title: Docs
3
+ ---
4
+
5
+ # Docs
6
+
7
+ Docs are plain markdown files. They live anywhere under a `docs/` root and are discovered automatically — no config file, no manifest.
8
+
9
+ ## Writing a doc
10
+
11
+ Click **Edit** in the top bar while viewing any doc. The editor opens inline. Click **Save** or press **Escape** to close.
12
+
13
+ To create a new doc, right-click any directory in the sidebar and choose **New Doc**. Type a name; the file is created immediately and you're navigated to it.
14
+
15
+ ## You can add Images!
16
+
17
+ ![image](../assets/image-mqjsmenr.png)
18
+
19
+ ## Markdown support
20
+
21
+ The renderer covers all standard constructs:
22
+
23
+ | Element | Syntax |
24
+ | --- | --- |
25
+ | Headings | `# H1` through `###### H6` |
26
+ | Bold | `**text**` or `__text__` |
27
+ | Italic | `*text*` or `_text_` |
28
+ | Inline code | \`` `code` `\` |
29
+ | Fenced code block | ` `\``lang ` |
30
+ | Link | `[label](url)` or `[label](relative-path.md)` |
31
+ | Image | `![alt](path-or-url)` |
32
+ | Unordered list | `- item` |
33
+ | Ordered list | `1. item` |
34
+ | Task list | `- [ ] item` / `- [x] item` |
35
+ | Table | GFM table syntax |
36
+ | Blockquote | `> text` |
37
+ | Horizontal rule | `---` |
38
+ | Board embed | ` `\``board ` block (see [Boards](boards.md)) |
39
+
40
+ Relative links between docs work — `[Getting started](getting-started.md)` navigates within the same docs root.
41
+
42
+ ## The sidebar tree
43
+
44
+ The sidebar mirrors the filesystem. Rules:
45
+
46
+ - `index.md` in any directory shows as **Overview** and sorts to the top
47
+ - Directories become collapsible groups (sorted before files)
48
+ - Files are sorted alphabetically after directories
49
+ - `boards/`, `capabilities/`, `assets/` are excluded from the tree
50
+
51
+ The tool reflects changes immediately — create a file on disk and refresh to see it.
52
+
53
+ ## Right-click actions on docs
54
+
55
+ Right-click any doc link in the sidebar:
56
+
57
+ | Action | What it does |
58
+ | --- | --- |
59
+ | **Open** | Navigate to the doc |
60
+ | **Edit** | Open the inline editor |
61
+ | **Rename** | Rename the file; updates the URL |
62
+ | **Delete** | Delete the file after confirmation |
63
+
64
+ Right-click any **directory**:
65
+
66
+ | Action | What it does |
67
+ | --- | --- |
68
+ | **New Doc** | Create a `.md` file in that directory |
69
+ | **New Board** | Create a board in that directory's `boards/` |
70
+ | **New Capability** | Create a capability spec in `capabilities/` |
71
+
72
+ ## Full-text search
73
+
74
+ Press **Cmd K** (Mac) or **Ctrl K** (Windows/Linux) to open the command palette.
75
+
76
+ - Type any word or phrase to search across all docs and capabilities in all registered projects
77
+ - Results show the document title, section heading, and a text snippet with the matched term highlighted
78
+ - Arrow keys to move through results · Enter to navigate · Escape to close
79
+
80
+ Search is indexed at startup and refreshed after every content change.
81
+
82
+ ---
83
+
84
+ **Next:** [Boards](boards.md) — infinite-canvas editing and board embeds.
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Boards in markdown
3
+ order: 2
4
+ ---
5
+
6
+ # Boards in markdown
7
+
8
+ You can embed any board into a doc and **frame exactly the region you want to show**.
9
+
10
+ ## The directive
11
+
12
+ ```board
13
+ src: ../product-roadmap
14
+ region: -393, -16, 1259, 663
15
+ height: 360
16
+ title: Product Roadmap
17
+ ```
18
+
19
+ `src` is required — it's the board file name without `.board.json`.
20
+
21
+ - `region` is four numbers in **world coordinates**: `x, y, width, height`. Omit it to fit the whole board.
22
+ - The preview is **read-only** and rendered with the same drawing engine as the editor, so it looks identical — just cropped and static.
23
+
24
+ ## How to get a region without doing math
25
+
26
+ 1. Open the board from the Boards section for the active docs root and click **Edit**.
27
+ 2. Pan/zoom until the area you want fills the screen.
28
+ 3. Click **Copy embed** in the top bar.
29
+ 4. Paste the snippet into any markdown file. The current visible rectangle becomes the `region`
30
+
31
+ \`\`\`board
32
+
33
+ src: product-roadmap
34
+
35
+ region: 4958, 3057, 1273, 789
36
+
37
+ height: 360
38
+
39
+ title: Product Roadmap
40
+
41
+ \`\`\`
42
+
43
+ ```board
44
+ src: ../product-roadmap
45
+ region: 4958, 3057, 1273, 789
46
+ height: 360
47
+ title: Product Roadmap
48
+ ```
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: Boards
3
+ ---
4
+
5
+ # Boards
6
+
7
+ Boards are infinite-canvas files stored as JSON alongside your docs. They open in a full-screen editor, close back to the doc view, and commit to git like any other file.
8
+
9
+ ## Creating a board
10
+
11
+ Three ways:
12
+
13
+ 1. Right-click a directory in the sidebar → **New Board**
14
+ 2. Click **All Boards** for a project → **+ New board** button on the page
15
+ 3. Click the board page button in the top-right of the boards list page
16
+
17
+ Give the board a title. The file is created at `<docs-root>/boards/<slug>.board.json`.
18
+
19
+ ## Editing a board
20
+
21
+ Click any board in the sidebar or on the All Boards page. The board opens full-screen. The shell layout is hidden while the editor is active — close with the **×** button in the top-right to return.
22
+
23
+ ### Canvas controls
24
+
25
+ | Input | Action |
26
+ | --- | --- |
27
+ | Scroll | Pan vertically |
28
+ | Shift + scroll | Pan horizontally |
29
+ | Cmd/Ctrl + scroll | Zoom in / out |
30
+ | Click element | Select |
31
+ | Click + drag empty area | Pan |
32
+ | Double-click element | Edit text |
33
+ | Delete / Backspace | Remove selected |
34
+
35
+ ### Toolbar elements
36
+
37
+ The bottom toolbar contains every element type:
38
+
39
+ - **Select** — move, resize, multi-select
40
+ - **Pan** — drag canvas
41
+ - **Sticky** — colour-coded sticky notes
42
+ - **Task** — checkbox task items
43
+ - **Text** — free text at any size
44
+ - **Shapes** — rectangles, ellipses, and more with fill/stroke
45
+ - **Arrow / Connector** — lines between elements
46
+ - **Image** — paste or drag an image file; stored in `assets/`
47
+ - **Frame** — group elements into a named region
48
+ - **Templates** — pre-built layout starters
49
+
50
+ ### Renaming and deleting
51
+
52
+ Right-click any board link in the sidebar:
53
+
54
+ - **Rename** — updates the board's title (the `.board.json` filename stays the same)
55
+ - **Delete** — removes the file after confirmation
56
+
57
+ ## Embedding a board in a doc
58
+
59
+ A board region can be embedded inline in any markdown doc using a fenced `board` block:
60
+
61
+ ````
62
+ ```board
63
+ src: my-board
64
+ region: 100, 200, 800, 400
65
+ height: 320
66
+ title: Sprint overview
67
+ ```
68
+ ````
69
+
70
+ - `src` — the board filename without `.board.json` (**required**)
71
+ - `region` — four world-space coordinates: `x, y, width, height` (optional — omit to fit the whole board)
72
+ - `height` — height of the embed in pixels (optional, defaults to 360)
73
+ - `title` — caption shown below the embed (optional)
74
+
75
+ The embed is **read-only** and rendered with the same drawing engine as the editor.
76
+
77
+ ## Getting a region without doing the maths
78
+
79
+ 1. Open the board and click **Edit** to enter the canvas editor.
80
+ 2. Pan and zoom until the area you want to show fills the screen.
81
+ 3. Click **Copy embed** in the top-right toolbar.
82
+ 4. Paste the snippet anywhere in a markdown doc.
83
+
84
+ The `region` coordinates are calculated from whatever is currently visible on screen.
85
+
86
+ ## Board files are git-native
87
+
88
+ Each board is a single JSON file. `git diff` shows exactly which elements changed. Board files are small — a board with 50 elements is typically under 20 KB.
89
+
90
+ ---
91
+
92
+ **Next:** [Capabilities](capabilities.md) — writing reusable specs and building LLM prompts.
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Getting started
3
+ ---
4
+
5
+ # Getting started
6
+
7
+ ## Install and run
8
+
9
+ ```bash
10
+ pnpm install
11
+ pnpm dev
12
+ ```
13
+
14
+ Open the URL printed in the terminal. You'll see the home page with an empty workspace.
15
+
16
+ ## Add a project
17
+
18
+ Click **+ Add Repo** on the home page or at the bottom of the sidebar. A native folder picker opens — select the root of any project you want to document.
19
+
20
+ The tool scans the selected directory recursively for folders named `docs/`. Every `docs/` folder that contains at least one `.md` or `.board.json` file becomes a **docs root** and appears in the sidebar.
21
+
22
+ > The tool only records the path. It never copies, uploads, or modifies your project files.
23
+
24
+ ## What the sidebar shows
25
+
26
+ After adding a project you'll see it as a collapsible section in the sidebar. Click to expand. Inside you'll find the path tree leading to each discovered `docs/` root.
27
+
28
+ - Each docs root shows its relative path (e.g. `backend/api/docs`)
29
+ - Right-click any directory to create a new doc, board, or capability inside it
30
+ - **All Boards** and **All Capabilities** appear at the bottom of each project
31
+
32
+ ## The folder model
33
+
34
+ The tool expects this layout inside each `docs/` root:
35
+
36
+ ```
37
+ docs/
38
+ index.md → shows as "Overview" in the sidebar
39
+ any-subdir/ → becomes a collapsible group
40
+ my-doc.md
41
+ boards/ → board files; excluded from the doc tree
42
+ my-board.board.json
43
+ capabilities/ → capability specs; shown via All Capabilities
44
+ auth-flow.md
45
+ assets/ → images; excluded from the doc tree
46
+ screenshot.png
47
+ ```
48
+
49
+ `boards/`, `capabilities/`, and `assets/` are special directories — the tool recognises them and surfaces their contents through dedicated views rather than as doc tree nodes.
50
+
51
+ ## Your first doc
52
+
53
+ 1. Right-click a directory in the sidebar.
54
+ 2. Choose **New Doc**.
55
+ 3. Type a name — it becomes the filename (`my-doc.md`) and the page title.
56
+ 4. The doc opens immediately. Click **Edit** in the top bar to write in it.
57
+
58
+ ## Your first board
59
+
60
+ 1. Right-click a directory or click **All Boards** → **+ New board**.
61
+ 2. Give it a title.
62
+ 3. The board opens in full-screen canvas mode.
63
+ 4. Draw, add stickies, shapes, tasks. Close with the × button when done.
64
+
65
+ ## Removing a project
66
+
67
+ Right-click the project name in the sidebar → **Remove from workspace**. The project is unregistered. Nothing on disk is deleted.
68
+
69
+ ---
70
+
71
+ **Next:** [Docs](docs.md) — writing and managing markdown content.
@@ -0,0 +1,6 @@
1
+ ```board
2
+ src: ../product-roadmap
3
+ region: 4590, 604, 3172, 1650
4
+ height: 360
5
+ title: Product Roadmap
6
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: Overview
3
+ ---
4
+
5
+ # ViteBoard
6
+
7
+ A local-first documentation workspace for development teams. Markdown docs, infinite-canvas boards, and structured capability specs — all plain files on disk, committed to git alongside your source code.
8
+
9
+ There is no cloud service, no database, no account. The Vite dev-server plugin reads and writes files directly. Every change you make is immediately a git diff.
10
+
11
+ ---
12
+
13
+ ## What's in here
14
+
15
+ **[Getting started](guide/getting-started.md)** — add your first project, understand the folder model, make your first doc and board.
16
+
17
+ **[Docs](guide/docs.md)** — writing and managing markdown documents, the sidebar tree, right-click actions, full-text search.
18
+
19
+ **[Boards](guide/boards.md)** — creating and editing infinite-canvas boards, embedding board regions into docs, the Copy embed workflow.
20
+
21
+ **[Capabilities](guide/capabilities.md)** — writing capability specs, the component cart, building and copying LLM prompts.
22
+
23
+ **[Workspace](guide/workspace.md)** — managing multiple projects, the project wiki, keyboard shortcuts, removing projects.
24
+
25
+ ---
26
+
27
+ ## The short version
28
+
29
+ 1. Run `pnpm dev` in this directory.
30
+ 2. Click **Add Repo** in the sidebar and pick any project root.
31
+ 3. The sidebar discovers every `docs/` folder under that root.
32
+ 4. Right-click any directory in the sidebar to create a doc, board, or capability.
33
+ 5. Everything saves to disk. Commit with git as normal.
34
+
35
+ **Note:** These built-in docs ship with ViteBoard. To remove them, delete the `content/docs/` folder from the ViteBoard directory and restart the dev server.
36
+
37
+ ## How it stores things
38
+
39
+ | Action | What happens on disk |
40
+ | --- | --- |
41
+ | Create / edit a doc | Writes `<docs-root>/<path>.md` |
42
+ | Create / save a board | Writes `<docs-root>/boards/<id>.board.json` |
43
+ | Paste image on board | Writes `<docs-root>/assets/<filename>` |
44
+ | Create a capability | Writes `<docs-root>/capabilities/<name>.md` |
45
+ | Add a project | Records path in `.workspace/workspace.json` |
46
+
47
+ Nothing leaves your machine.