canvas_erd 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +6 -2
- data/lib/canvas_erd/diagram_store.rb +16 -2
- data/lib/canvas_erd/server.rb +10 -1
- data/lib/canvas_erd/version.rb +1 -2
- data/lib/canvas_erd/web/app.js +845 -70
- data/lib/canvas_erd/web/document.js +401 -2
- data/lib/canvas_erd/web/index.html +153 -1
- data/lib/canvas_erd/web/styles.css +208 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39ebe5db48904942a80ea166d24eb8763a71f45a3fc9d97a9b988d108f863888
|
|
4
|
+
data.tar.gz: d245c04d437052b6115bbc98543cf11d73173089746a9154d16308ea34bfb6f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 686c13d68d58c6b9fcdff3fb82fc6002af67d4d099a707d7a8a3fc7ba7a8b76df7970969003000f19dcfd1989ba57f9e2467fc82ff2c674f321930f35662a786
|
|
7
|
+
data.tar.gz: 64ab7fd0574de7b1c3977eca2172bcbc954b2dcf07d52ccd07da28a1c5d49a73a37e7277e7c03d7d0ee179b749b50cc69e74b8f63c44bfc73ef97583a3bc33f5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 - 2026-09-19
|
|
4
|
+
|
|
5
|
+
- Format whole notes with paragraph styles, bold, italic, underline, alignment, text and background colors, and keyboard shortcuts for styles and emphasis.
|
|
6
|
+
- Choose colors from common options or custom values currently used in the diagram, including transparent note backgrounds and background-aware borders.
|
|
7
|
+
- Color the headers of one or more selected tables to visually group related tables, with preset and custom colors.
|
|
8
|
+
- Enter arrow endpoint editing immediately when an arrow is selected, without requiring a double-click.
|
|
9
|
+
- Style arrows with independent endpoint heads, solid, dashed, or dotted lines, adjustable widths, and foreground-palette or custom colors.
|
|
10
|
+
- Draw backmost grouping frames with editable labels, foreground-palette or custom colors, and solid, dashed, or dotted borders.
|
|
11
|
+
- Render association cardinalities with table-edge-aligned crow's-foot notation, retaining text for nonstandard numeric ranges.
|
|
12
|
+
- Open the most recently modified saved diagram when the editor starts.
|
|
13
|
+
|
|
3
14
|
## 0.1.0 - 2026-08-30
|
|
4
15
|
|
|
5
16
|
- Generate a JSON-safe diagram schema from Rails ERD domain models.
|
data/README.md
CHANGED
|
@@ -35,16 +35,20 @@ Diagrams are saved by the editor as `*.erd.png` files under `docs/erd/` in the R
|
|
|
35
35
|
bundle exec canvas_erd --diagrams-dir db/diagrams
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
The editor
|
|
38
|
+
The editor opens the most recently modified saved diagram when it starts. Its saved-diagram menu loads other files directly. You can also open a specific diagram with `bundle exec canvas_erd path/to/domain.erd.png`.
|
|
39
39
|
|
|
40
40
|
## Editor controls
|
|
41
41
|
|
|
42
42
|
- Drag tables to reposition them.
|
|
43
43
|
- Use the table sidebar to add or remove tables without losing their positions.
|
|
44
|
+
- Select one or more tables to color their headers and visually group related tables.
|
|
44
45
|
- Use **Layout tables** to rearrange the tables currently on the canvas with ELK without moving notes or hidden tables.
|
|
45
46
|
- Pinch over the canvas or use the toolbar buttons to zoom.
|
|
46
47
|
- Use a two-finger trackpad gesture to pan. Space-drag remains available as a keyboard fallback, and **Fit diagram** resets the view.
|
|
47
|
-
- Add editable notes with **Add note**.
|
|
48
|
+
- Add editable notes with **Add note**. Notes support paragraph styles, emphasis, alignment, and text and background colors; new notes inherit the last touched note's style.
|
|
49
|
+
- Draw and style arrows with independent endpoint heads. Selecting an arrow immediately exposes its movable endpoints.
|
|
50
|
+
- Draw grouping frames behind the diagram, then edit their labels, colors, and border styles.
|
|
51
|
+
- Relationship cardinalities use crow's-foot notation at table edges, with exact text retained for uncommon numeric ranges.
|
|
48
52
|
- Use **Refresh schema** after a database migration to update columns and relationships. Existing table positions, selections, notes, and the current view are preserved; new tables start unselected.
|
|
49
53
|
- Edit the diagram name, then use **Save** (or <kbd>⌘S</kbd>/<kbd>Ctrl-S</kbd>) to write the complete diagram into the Rails application as a normal `*.erd.png` image with its editable schema, layout, notes, selection, and viewport embedded inside it. Select a saved diagram from the menu to reopen it, or use **New** to start an “Untitled ERD.”
|
|
50
54
|
|
|
@@ -31,10 +31,23 @@ module CanvasERD
|
|
|
31
31
|
Dir.children(directory).select { |name| valid_filename?(name) && File.file?(path_for(name)) }.sort
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
def most_recent_name
|
|
35
|
+
names.max_by { |name| [File.mtime(path_for(name)).to_f, name] }
|
|
36
|
+
rescue SystemCallError => error
|
|
37
|
+
raise Error, "Could not inspect saved diagrams: #{error.message}"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def document(name)
|
|
41
|
+
read_diagram(name).last
|
|
42
|
+
end
|
|
43
|
+
|
|
34
44
|
def read(name)
|
|
45
|
+
read_diagram(name).first
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def read_diagram(name)
|
|
35
49
|
bytes = File.binread(path_for(name))
|
|
36
|
-
PngDocument.read(StringIO.new(bytes))
|
|
37
|
-
bytes
|
|
50
|
+
[bytes, PngDocument.read(StringIO.new(bytes))]
|
|
38
51
|
rescue Errno::ENOENT
|
|
39
52
|
raise NotFound, "Diagram not found: #{name}"
|
|
40
53
|
rescue SystemCallError => error
|
|
@@ -42,6 +55,7 @@ module CanvasERD
|
|
|
42
55
|
rescue PngDocument::Error => error
|
|
43
56
|
raise Error, error.message
|
|
44
57
|
end
|
|
58
|
+
private :read_diagram
|
|
45
59
|
|
|
46
60
|
def write(name, bytes)
|
|
47
61
|
path = path_for(name)
|
data/lib/canvas_erd/server.rb
CHANGED
|
@@ -92,7 +92,16 @@ module CanvasERD
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def document_response
|
|
95
|
-
document = @document["state"]
|
|
95
|
+
document = if @document["state"]
|
|
96
|
+
@document
|
|
97
|
+
elsif @diagram_store && (name = @diagram_store.most_recent_name)
|
|
98
|
+
@diagram_store.document(name).merge(
|
|
99
|
+
"filename" => name,
|
|
100
|
+
"application_schema" => schema
|
|
101
|
+
)
|
|
102
|
+
else
|
|
103
|
+
@document.merge("schema" => schema)
|
|
104
|
+
end
|
|
96
105
|
response(
|
|
97
106
|
200,
|
|
98
107
|
"application/json; charset=utf-8",
|