@arach/arc 0.4.5 → 0.6.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/bin/arc-mcp.mjs +31826 -0
- package/docs/llm.txt +208 -0
- package/lib/MarkupPanel-CroO7O49.js +182 -0
- package/lib/arc.css +1 -1
- package/lib/arc.es.js +31 -27
- package/lib/arc.umd.js +156 -143
- package/lib/index-B4esAiHG.js +1006 -0
- package/lib/index-BtUi_w1W.js +964 -0
- package/lib/index-CI-w1U9t.js +2725 -0
- package/lib/index-CQhCoaVM.js +77 -0
- package/lib/index-CVhUGF67.js +1309 -0
- package/lib/{index-Ctu8395c.js → index-CbEv7M-m.js} +27251 -25424
- package/lib/index-Cg52_-j6.js +959 -0
- package/lib/index-Cmm99d2_.js +1925 -0
- package/lib/index-CnGsbmkP.js +7884 -0
- package/lib/index-CvsZLy9v.js +2344 -0
- package/lib/index-DBTOQDAV.js +1886 -0
- package/lib/index-Ds2bIH9V.js +967 -0
- package/lib/{index-z7-999ZD.js → index-gm9Hs3ZB.js} +1 -1
- package/lib/index.d.ts +79 -8
- package/package.json +33 -6
- package/skills/arc-diagrams/SKILL.md +218 -0
- package/src/types/diagram.ts +197 -0
- package/lib/commands_hudsonkit_false-tNYQZ4nZ.js +0 -5
- package/lib/highlight_hudsonkit_false-CGjCyNxW.js +0 -5
- package/lib/lang-css_hudsonkit_false-oeV3Hq1J.js +0 -5
- package/lib/lang-html_hudsonkit_false-CCxA3CYh.js +0 -5
- package/lib/lang-javascript_hudsonkit_false-SQgz3iJM.js +0 -5
- package/lib/lang-json_hudsonkit_false-BksH8zxC.js +0 -5
- package/lib/lang-markdown_hudsonkit_false-B5TeQsd5.js +0 -5
- package/lib/language_hudsonkit_false-D4r7WoC5.js +0 -5
- package/lib/state_hudsonkit_false-Rl5x6lAJ.js +0 -5
- package/lib/view_hudsonkit_false-Cv9f7Eek.js +0 -5
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Arc Diagram Types
|
|
2
|
+
// Shared format for Arc editor and consumers (Talkie docs, etc.)
|
|
3
|
+
|
|
4
|
+
import type { NodeShape } from '../utils/nodeShape'
|
|
5
|
+
|
|
6
|
+
export type { NodeShape }
|
|
7
|
+
|
|
8
|
+
export type NodeSize = 'xs' | 's' | 'm' | 'l'
|
|
9
|
+
|
|
10
|
+
export type AnchorPosition =
|
|
11
|
+
| 'left' | 'right' | 'top' | 'bottom'
|
|
12
|
+
| 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight'
|
|
13
|
+
|
|
14
|
+
export type DiagramColor =
|
|
15
|
+
| 'violet' | 'emerald' | 'blue' | 'amber'
|
|
16
|
+
| 'sky' | 'zinc' | 'rose' | 'orange'
|
|
17
|
+
|
|
18
|
+
export interface NodePosition {
|
|
19
|
+
x: number
|
|
20
|
+
y: number
|
|
21
|
+
size: NodeSize
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NodeData {
|
|
25
|
+
icon: string
|
|
26
|
+
name: string
|
|
27
|
+
subtitle?: string
|
|
28
|
+
description?: string
|
|
29
|
+
color: DiagramColor
|
|
30
|
+
/** Per-node silhouette. Omit to follow the theme's own node shape. */
|
|
31
|
+
shape?: NodeShape
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Connector {
|
|
35
|
+
from: string
|
|
36
|
+
to: string
|
|
37
|
+
fromAnchor: AnchorPosition
|
|
38
|
+
toAnchor: AnchorPosition
|
|
39
|
+
style: string
|
|
40
|
+
curve?: 'natural' | 'step'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ConnectorStyle {
|
|
44
|
+
color: DiagramColor
|
|
45
|
+
strokeWidth: number
|
|
46
|
+
label?: string
|
|
47
|
+
dashed?: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface DiagramLayout {
|
|
51
|
+
width: number
|
|
52
|
+
height: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface GridConfig {
|
|
56
|
+
enabled: boolean
|
|
57
|
+
size: number
|
|
58
|
+
color: string
|
|
59
|
+
opacity: number
|
|
60
|
+
type: 'dots' | 'lines'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface GroupShape {
|
|
64
|
+
id: string
|
|
65
|
+
x: number
|
|
66
|
+
y: number
|
|
67
|
+
width: number
|
|
68
|
+
height: number
|
|
69
|
+
type: 'rect' | 'circle'
|
|
70
|
+
color: DiagramColor
|
|
71
|
+
label?: string
|
|
72
|
+
dashed?: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FocusConnectorRef {
|
|
76
|
+
from: string
|
|
77
|
+
to: string
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface FocusStep {
|
|
81
|
+
icon: string
|
|
82
|
+
label: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A declarative highlight story activated by hovering or selecting a node. */
|
|
86
|
+
export interface FocusTarget {
|
|
87
|
+
/** `append` includes direct neighbors; `replace` uses only the explicit story. */
|
|
88
|
+
mode?: 'append' | 'replace'
|
|
89
|
+
nodes?: string[]
|
|
90
|
+
connectors?: FocusConnectorRef[]
|
|
91
|
+
caption?: string
|
|
92
|
+
steps?: FocusStep[]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type LayoutAlignment = 'start' | 'center' | 'end'
|
|
96
|
+
export type GroupLayoutDirection = 'horizontal' | 'vertical'
|
|
97
|
+
|
|
98
|
+
/** Optional placement hints used by autoLayout when nodes belong to groups. */
|
|
99
|
+
export interface NodeLayoutHint {
|
|
100
|
+
/** ID of the group frame that owns this node. */
|
|
101
|
+
group?: string
|
|
102
|
+
/** Explicit layer within the group. Connected nodes are layered automatically otherwise. */
|
|
103
|
+
layer?: number
|
|
104
|
+
/** Stable ordering within a layer. Lower values render first. */
|
|
105
|
+
order?: number
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Layout policy for the nodes inside one group frame. */
|
|
109
|
+
export interface GroupLayoutHint {
|
|
110
|
+
/** `horizontal` lays layers left-to-right; `vertical` lays them top-to-bottom. */
|
|
111
|
+
direction?: GroupLayoutDirection
|
|
112
|
+
padding?: number
|
|
113
|
+
layerGap?: number
|
|
114
|
+
itemGap?: number
|
|
115
|
+
align?: LayoutAlignment
|
|
116
|
+
justify?: LayoutAlignment | 'space-between'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface LayoutHints {
|
|
120
|
+
nodes?: Record<string, NodeLayoutHint>
|
|
121
|
+
groups?: Record<string, GroupLayoutHint>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface DiagramImage {
|
|
125
|
+
id: string
|
|
126
|
+
src: string
|
|
127
|
+
name: string
|
|
128
|
+
x: number
|
|
129
|
+
y: number
|
|
130
|
+
width: number
|
|
131
|
+
height: number
|
|
132
|
+
opacity: number
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ExportZone {
|
|
136
|
+
x: number
|
|
137
|
+
y: number
|
|
138
|
+
width: number
|
|
139
|
+
height: number
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Full diagram format (internal Arc state)
|
|
143
|
+
export interface ArcDiagram {
|
|
144
|
+
layout: DiagramLayout
|
|
145
|
+
grid: GridConfig
|
|
146
|
+
layoutHints?: LayoutHints
|
|
147
|
+
nodes: Record<string, NodePosition>
|
|
148
|
+
nodeData: Record<string, NodeData>
|
|
149
|
+
connectors: Connector[]
|
|
150
|
+
connectorStyles: Record<string, ConnectorStyle>
|
|
151
|
+
groups?: GroupShape[]
|
|
152
|
+
focusTargets?: Record<string, FocusTarget>
|
|
153
|
+
images?: DiagramImage[]
|
|
154
|
+
exportZone?: ExportZone | null
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Clean export format (for consumers)
|
|
158
|
+
export interface ArcDiagramData {
|
|
159
|
+
id?: string
|
|
160
|
+
layout: DiagramLayout
|
|
161
|
+
layoutHints?: LayoutHints
|
|
162
|
+
nodes: Record<string, NodePosition>
|
|
163
|
+
nodeData: Record<string, NodeData>
|
|
164
|
+
connectors: Connector[]
|
|
165
|
+
connectorStyles: Record<string, ConnectorStyle>
|
|
166
|
+
focusTargets?: Record<string, FocusTarget>
|
|
167
|
+
groups?: GroupShape[]
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Convert full diagram to clean export format
|
|
171
|
+
export function toExportFormat(diagram: ArcDiagram): ArcDiagramData {
|
|
172
|
+
return {
|
|
173
|
+
layout: diagram.layout,
|
|
174
|
+
layoutHints: diagram.layoutHints,
|
|
175
|
+
nodes: diagram.nodes,
|
|
176
|
+
nodeData: diagram.nodeData,
|
|
177
|
+
connectors: diagram.connectors,
|
|
178
|
+
connectorStyles: diagram.connectorStyles,
|
|
179
|
+
focusTargets: diagram.focusTargets,
|
|
180
|
+
groups: diagram.groups,
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Generate TypeScript source file content
|
|
185
|
+
export function toTypeScriptSource(diagram: ArcDiagram, name: string = 'diagram'): string {
|
|
186
|
+
const data = toExportFormat(diagram)
|
|
187
|
+
const json = JSON.stringify(data, null, 2)
|
|
188
|
+
.replace(/"([^"]+)":/g, '$1:') // Remove quotes from keys
|
|
189
|
+
.replace(/"/g, "'") // Use single quotes
|
|
190
|
+
|
|
191
|
+
return `import type { ArcDiagramData } from '@arach/arc'
|
|
192
|
+
|
|
193
|
+
const ${name}: ArcDiagramData = ${json}
|
|
194
|
+
|
|
195
|
+
export default ${name}
|
|
196
|
+
`
|
|
197
|
+
}
|