@arach/arc 0.3.1 → 0.4.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.
package/lib/index.d.ts CHANGED
@@ -2,39 +2,51 @@ import { Connector as ArcConnector } from './components/ArcDiagram';
2
2
  import { ConnectorStyle as ArcConnectorStyle } from './components/ArcDiagram';
3
3
  import { default as ArcDiagram } from './components/ArcDiagram';
4
4
  import { ArcDiagramData } from './components/ArcDiagram';
5
+ import { ArcDiagramData as ArcDiagramData_2 } from '../components/ArcDiagram';
5
6
  import { default as ArcDiagramIsometric } from './player/ArcDiagram';
6
7
  import { NodeData as ArcNodeData } from './components/ArcDiagram';
7
8
  import { NodePosition as ArcNodePosition } from './components/ArcDiagram';
9
+ import { AutoDiagramInput } from './utils/autoLayout';
10
+ import { autoLayout } from './utils/autoLayout';
8
11
  import { ColorPalette } from './utils/themes';
9
12
  import { configToYaml } from './utils/yamlConfig';
13
+ import { createAutoLayout } from './utils/autoLayout';
14
+ import { deleteDiagramSession } from './utils/sessionStorage';
15
+ import { deriveSessionId } from './utils/sessionStorage';
10
16
  import { default as DiagramCanvas } from './components/editor/DiagramCanvas';
11
17
  import { DiagramColor } from './components/ArcDiagram';
12
18
  import { default as DiagramEditor } from './components/editor/DiagramEditor';
13
- import { DiagramGroup } from './components/ArcDiagram';
14
19
  import { DiagramLayout } from './components/ArcDiagram';
15
20
  import { DiagramMode } from './components/ArcDiagram';
21
+ import { DiagramSession } from './utils/sessionStorage';
16
22
  import { EditorProvider } from './components/editor/EditorProvider';
23
+ import { generateSessionId } from './utils/sessionStorage';
17
24
  import { getColorShading } from './utils/isometric';
18
25
  import { getTheme } from './utils/themes';
19
26
  import { getThemeList } from './utils/themes';
20
- import { GroupLabelAnchor } from './components/ArcDiagram';
21
- import { GroupLabelPlacement } from './components/ArcDiagram';
22
27
  import { ISO_COLORS } from './utils/isometric';
23
28
  import { isoBoundingBox } from './utils/isometric';
24
29
  import { isoBox } from './utils/isometric';
25
30
  import { isoShading } from './utils/isometric';
26
31
  import { isoToScreen } from './utils/isometric';
32
+ import { listDiagramSessions } from './utils/sessionStorage';
33
+ import { loadDiagramSession } from './utils/sessionStorage';
27
34
  import { NodeSize } from './components/ArcDiagram';
28
35
  import { parseYamlConfig } from './utils/yamlConfig';
29
36
  import { renderToElement } from './player/vanilla';
30
37
  import { renderToString } from './player/vanilla';
38
+ import { saveDiagramSession } from './utils/sessionStorage';
31
39
  import { screenToIsoFloor } from './utils/isometric';
32
40
  import { Theme } from './utils/themes';
33
41
  import { ThemeId } from './components/ArcDiagram';
34
42
  import { THEMES } from './utils/themes';
43
+ import { useColorMode } from './components/editor/EditorProvider';
35
44
  import { useDiagram } from './components/editor/EditorProvider';
45
+ import { useDiagramMeta } from './components/editor/EditorProvider';
36
46
  import { useEditor } from './components/editor/EditorProvider';
37
47
  import { useEditorState } from './components/editor/EditorProvider';
48
+ import { useResolvedTheme } from './components/editor/EditorProvider';
49
+ import { useThemeId } from './components/editor/EditorProvider';
38
50
  import { useViewMode } from './components/editor/EditorProvider';
39
51
 
40
52
  export { ArcConnector }
@@ -51,6 +63,25 @@ export { ArcNodeData }
51
63
 
52
64
  export { ArcNodePosition }
53
65
 
66
+ export declare interface AsciiOptions {
67
+ /** Pixels per character horizontally (default: 8) */
68
+ scaleX?: number;
69
+ /** Pixels per character vertically (default: 16) */
70
+ scaleY?: number;
71
+ /** 'unicode' for box-drawing chars, 'ascii' for +- style (default: 'unicode') */
72
+ charset?: 'unicode' | 'ascii';
73
+ /** Character padding around diagram (default: 1) */
74
+ padding?: number;
75
+ /** Max output width in chars — auto-adjusts scaleX if exceeded */
76
+ maxWidth?: number;
77
+ /** Show connector labels (default: true) */
78
+ showLabels?: boolean;
79
+ }
80
+
81
+ export { AutoDiagramInput }
82
+
83
+ export { autoLayout }
84
+
54
85
  export { ColorPalette }
55
86
 
56
87
  export { configToYaml }
@@ -66,6 +97,12 @@ export declare interface ConnectorStyle {
66
97
  showEndpoints?: boolean;
67
98
  }
68
99
 
100
+ export { createAutoLayout }
101
+
102
+ export { deleteDiagramSession }
103
+
104
+ export { deriveSessionId }
105
+
69
106
  export { DiagramCanvas }
70
107
 
71
108
  export { DiagramColor }
@@ -100,10 +137,18 @@ export declare interface DiagramConfig {
100
137
 
101
138
  export { DiagramEditor }
102
139
 
103
- export { DiagramGroup }
104
-
105
140
  export { DiagramLayout }
106
141
 
142
+ export declare interface DiagramMeta {
143
+ themeId?: string | null;
144
+ colorMode?: 'light' | 'dark';
145
+ viewport?: {
146
+ width: number;
147
+ height: number;
148
+ };
149
+ sourceUrl?: string;
150
+ }
151
+
107
152
  export { DiagramMode }
108
153
 
109
154
  export declare interface DiagramNode {
@@ -120,6 +165,8 @@ export declare interface DiagramNode {
120
165
  translucent?: boolean;
121
166
  }
122
167
 
168
+ export { DiagramSession }
169
+
123
170
  export { EditorProvider }
124
171
 
125
172
  export declare interface EmbedConfig {
@@ -134,16 +181,14 @@ export declare interface EmbedConfig {
134
181
  showGrid?: boolean;
135
182
  }
136
183
 
184
+ export { generateSessionId }
185
+
137
186
  export { getColorShading }
138
187
 
139
188
  export { getTheme }
140
189
 
141
190
  export { getThemeList }
142
191
 
143
- export { GroupLabelAnchor }
144
-
145
- export { GroupLabelPlacement }
146
-
147
192
  export { ISO_COLORS }
148
193
 
149
194
  export { isoBoundingBox }
@@ -154,6 +199,10 @@ export { isoShading }
154
199
 
155
200
  export { isoToScreen }
156
201
 
202
+ export { listDiagramSessions }
203
+
204
+ export { loadDiagramSession }
205
+
157
206
  export declare interface NodePosition {
158
207
  x: number;
159
208
  y: number;
@@ -171,10 +220,14 @@ declare type NodeSize_2 = 'large' | 'normal' | 'small';
171
220
 
172
221
  export { parseYamlConfig }
173
222
 
223
+ export declare function renderAscii(data: ArcDiagramData_2, options?: AsciiOptions): string;
224
+
174
225
  export { renderToElement }
175
226
 
176
227
  export { renderToString }
177
228
 
229
+ export { saveDiagramSession }
230
+
178
231
  export { screenToIsoFloor }
179
232
 
180
233
  export { Theme }
@@ -196,12 +249,20 @@ export declare interface TierConfig {
196
249
  blur?: number;
197
250
  }
198
251
 
252
+ export { useColorMode }
253
+
199
254
  export { useDiagram }
200
255
 
256
+ export { useDiagramMeta }
257
+
201
258
  export { useEditor }
202
259
 
203
260
  export { useEditorState }
204
261
 
262
+ export { useResolvedTheme }
263
+
264
+ export { useThemeId }
265
+
205
266
  export { useViewMode }
206
267
 
207
268
  export declare type ViewMode = '2d' | 'isometric';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arach/arc",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Visual diagram editor for creating architecture diagrams",
6
6
  "author": "Arach Tchoupani",
@@ -17,10 +17,14 @@
17
17
  "react",
18
18
  "isometric"
19
19
  ],
20
+ "bin": {
21
+ "arc-ascii": "./bin/arc-ascii.mjs"
22
+ },
20
23
  "files": [
21
24
  "lib/arc.es.js",
22
25
  "lib/arc.umd.js",
23
- "lib/index.d.ts"
26
+ "lib/index.d.ts",
27
+ "bin/arc-ascii.mjs"
24
28
  ],
25
29
  "main": "./lib/arc.umd.js",
26
30
  "module": "./lib/arc.es.js",
@@ -33,17 +37,6 @@
33
37
  }
34
38
  },
35
39
  "sideEffects": false,
36
- "scripts": {
37
- "dev": "vite",
38
- "build": "tsc && vite build && node scripts/generate-docs-html.js",
39
- "build:lib": "vite build --config vite.config.lib.js",
40
- "build:player": "vite build --config vite.config.player.js && vite build --config vite.config.player-slim.js",
41
- "lint": "eslint .",
42
- "typecheck": "tsc --noEmit",
43
- "preview": "vite preview",
44
- "generate-og": "node scripts/generate-og.js",
45
- "prepublishOnly": "pnpm build:lib"
46
- },
47
40
  "peerDependencies": {
48
41
  "react": "^18.0.0 || ^19.0.0",
49
42
  "react-dom": "^18.0.0 || ^19.0.0",
@@ -79,5 +72,15 @@
79
72
  "typescript": "^5.9.3",
80
73
  "vite": "^7.2.4",
81
74
  "vite-plugin-dts": "^4.5.4"
75
+ },
76
+ "scripts": {
77
+ "dev": "vite",
78
+ "build": "tsc && vite build && node scripts/generate-docs-html.js",
79
+ "build:lib": "vite build --config vite.config.lib.js",
80
+ "build:player": "vite build --config vite.config.player.js && vite build --config vite.config.player-slim.js",
81
+ "lint": "eslint .",
82
+ "typecheck": "tsc --noEmit",
83
+ "preview": "vite preview",
84
+ "generate-og": "node scripts/generate-og.js"
82
85
  }
83
- }
86
+ }