tigma 1.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.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # Tigma
2
+
3
+ A terminal-based design tool for creating ASCII diagrams and designs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun install
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Start with a blank canvas
15
+ bun run index.ts
16
+
17
+ # Open an existing file
18
+ bun run index.ts mydesign.tigma
19
+ ```
20
+
21
+ ## Tools
22
+
23
+ Switch between tools using keyboard shortcuts:
24
+
25
+ | Key | Tool | Description |
26
+ |-----|------|-------------|
27
+ | `M` | Move | Select, move, and resize objects |
28
+ | `T` | Text | Create and edit text boxes |
29
+ | `R` | Rectangle | Draw rectangular shapes with box-drawing characters |
30
+ | `L` | Line | Draw lines (horizontal, vertical, or diagonal) |
31
+
32
+ ## Controls
33
+
34
+ ### General
35
+
36
+ | Key | Action |
37
+ |-----|--------|
38
+ | `Ctrl+S` | Save file (prompts for filename if new) |
39
+ | `Ctrl+Z` | Undo |
40
+ | `Ctrl+U` | Redo |
41
+ | `Delete` / `Backspace` | Delete selected or hovered object(s) |
42
+ | `Escape` | Cancel current drawing / exit text editing |
43
+
44
+ ### Move Tool
45
+
46
+ - **Click** on an object to select it
47
+ - **Shift+Click** to add/remove objects from selection (multi-select)
48
+ - **Click+Drag** to move selected objects
49
+ - **Click on empty space** to deselect all
50
+
51
+ #### Rectangle Resizing
52
+
53
+ When a single rectangle is selected and hovered, resize handles appear at:
54
+ - Corners (NW, NE, SW, SE)
55
+ - Edge midpoints (N, S, E, W)
56
+
57
+ Drag the handles to resize the rectangle.
58
+
59
+ #### Layer Ordering
60
+
61
+ | Key | Action |
62
+ |-----|--------|
63
+ | `Ctrl+[` | Move selected object down one layer |
64
+ | `Ctrl+]` | Move selected object up one layer |
65
+
66
+ ### Text Tool
67
+
68
+ - **Click** on empty space to create a new text box
69
+ - **Click** on existing text to edit it
70
+ - **Type** to insert characters at cursor
71
+ - **Arrow keys** to move cursor
72
+ - `Home` / `End` to jump to start/end
73
+ - `Backspace` / `Delete` to remove characters
74
+ - `Ctrl+B` to toggle **bold** mode for new characters
75
+ - `Escape` to finish editing
76
+
77
+ ### Rectangle Tool
78
+
79
+ - **Click+Drag** to draw a rectangle
80
+ - Release to commit the shape
81
+ - Rectangle uses current stroke and fill colors
82
+ - Bold mode affects border thickness
83
+
84
+ ### Line Tool
85
+
86
+ - **Click+Drag** to draw a line
87
+ - Supports horizontal, vertical, and diagonal lines
88
+ - Uses Bresenham's algorithm for diagonal rendering
89
+ - Line uses current stroke color
90
+
91
+ ## Colors
92
+
93
+ A color picker is displayed at the bottom-right of the canvas.
94
+
95
+ ### Stroke Colors
96
+ Controls the color of:
97
+ - Text characters
98
+ - Rectangle borders
99
+ - Lines
100
+
101
+ Available stroke colors: Transparent, Black, White, Red, Green, Blue, Yellow
102
+
103
+ ### Fill Colors
104
+ Controls the background fill of:
105
+ - Rectangles (interior area)
106
+ - Text boxes (background)
107
+
108
+ Available fill colors: Transparent, Black, Gray, Muted Red, Muted Green, Muted Blue, Muted Yellow
109
+
110
+ **Transparent** (shown as `null`) means no color is applied, allowing content beneath to show through.
111
+
112
+ Click on a color swatch to select it. The selected color applies to:
113
+ 1. New objects you create
114
+ 2. Currently selected objects (immediately updates them)
115
+
116
+ ## File Format
117
+
118
+ Designs are saved as `.tigma` files in JSON format. The file stores:
119
+
120
+ - Text boxes with per-character styling (bold, color)
121
+ - Rectangles with position, stroke color, fill color, and bold state
122
+ - Lines with position, stroke color, and bold state
123
+ - Z-index ordering for proper layering
124
+
125
+ ## Features
126
+
127
+ - **Layered rendering**: Objects stack based on z-index; newer objects appear on top by default
128
+ - **Multi-selection**: Select multiple objects with Shift+Click
129
+ - **Undo/Redo**: Up to 100 history snapshots
130
+ - **Terminal responsive**: Adapts to terminal resize events
131
+ - **Mouse support**: Full mouse interaction including hover highlighting
132
+ - **Live preview**: See rectangles and lines as you draw them
133
+
134
+ ## Example Workflow
135
+
136
+ 1. Press `R` to select the Rectangle tool
137
+ 2. Click and drag to draw a box
138
+ 3. Press `T` to select the Text tool
139
+ 4. Click inside the box and type a label
140
+ 5. Press `Escape` to finish editing
141
+ 6. Press `M` to switch to Move tool
142
+ 7. Select objects and adjust positions
143
+ 8. Use the color picker to change colors
144
+ 9. Press `Ctrl+S` to save your work