console-rects 0.1.0 → 0.1.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 (2) hide show
  1. package/README.md +70 -0
  2. package/package.json +13 -3
package/README.md CHANGED
@@ -0,0 +1,70 @@
1
+ # console-rects
2
+
3
+ A utility to visualize rectangles in the console using box-drawing characters. Created at Screen Studio to help debug geometry code when things get complex.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install console-rects
9
+ yarn install console-rects
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```typescript
15
+ import { logRects } from "console-rects";
16
+
17
+ const rectangles = [
18
+ { x: 0, y: 0, width: 100, height: 100 },
19
+ { x: 40, y: 40, width: 100, height: 100 },
20
+ { x: 80, y: 80, width: 100, height: 100 },
21
+ ];
22
+
23
+ logRects(rectangles);
24
+ ```
25
+
26
+ This will output a visual representation of the rectangles in your console:
27
+
28
+ ```
29
+ [0, 0]
30
+ ┌────────┐
31
+ │ │
32
+ │ │
33
+ │ │
34
+ │ ┏━━━━━━━━┓
35
+ │ ┃ │ ┃
36
+ │ ┃ │ ┃
37
+ │ ┃ │ ┃
38
+ │ ┃ ╔════════╗
39
+ └───┃───║┘ ┃ ║
40
+ ┃ ║ ┃ ║
41
+ ┃ ║ ┃ ║
42
+ ┃ ║ ┃ ║
43
+ ┗━━━║━━━━┛ ║
44
+ ║ ║
45
+ ║ ║
46
+ ║ ║
47
+ ╚════════╝
48
+ [180, 180]
49
+ ```
50
+
51
+ Each rectangle gets a different line style (light, heavy, double, dashed, dashed-heavy) based on its position in the array.
52
+
53
+ ## Options
54
+
55
+ - `sizePerPoint` (default: `10`) - Controls the resolution/scale. Smaller values = higher detail.
56
+ - `showLegend` (default: `true`) - Show coordinate labels at corners.
57
+ - `startWithNewLine` (default: `true`) - Add a newline before the output.
58
+ - `dontLog` (default: `false`) - Return the string without logging to console.
59
+
60
+ ```typescript
61
+ logRects(rectangles, {
62
+ sizePerPoint: 20,
63
+ showLegend: false,
64
+ dontLog: true,
65
+ });
66
+ ```
67
+
68
+ ## License
69
+
70
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "console-rects",
3
- "version": "0.1.0",
4
- "description": "",
3
+ "version": "0.1.1",
4
+ "description": "Visualize rectangles in the console using box-drawing characters. Perfect for debugging geometry code.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
@@ -17,7 +17,17 @@
17
17
  "dist",
18
18
  "README.md"
19
19
  ],
20
- "keywords": [],
20
+ "keywords": [
21
+ "console",
22
+ "debug",
23
+ "visualization",
24
+ "rectangles",
25
+ "geometry",
26
+ "ascii",
27
+ "box-drawing",
28
+ "debugging",
29
+ "cli"
30
+ ],
21
31
  "author": {
22
32
  "name": "Adam Pietrasiak",
23
33
  "email": "adam@pietrasiak.com"