@arach/arc 0.4.3 → 0.4.5

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
@@ -22,23 +22,30 @@ export declare interface ArcConnectorStyle {
22
22
  dashed?: boolean;
23
23
  }
24
24
 
25
- export declare function ArcDiagram({ data, className, interactive, mode, theme, label, labelPosition, defaultZoom, zoomLevels, showArcToggle, showAutoLayout, showControls, showMinimap, frame, hoverEffects, onNodeHover, titleBlock, maxFitZoom, }: ArcDiagramProps): JSX.Element;
25
+ export declare function ArcDiagram({ data, className, interactive, mode, theme, label, labelPosition, defaultZoom, zoomLevels, showArcToggle, showAutoLayout, showControls, showMinimap, showFocusStory, frame, hoverEffects, onNodeHover, titleBlock, maxFitZoom, }: ArcDiagramProps): JSX.Element;
26
26
 
27
27
  export declare interface ArcDiagramData {
28
28
  id?: string;
29
29
  layout: DiagramLayout;
30
+ layoutHints?: LayoutHints;
30
31
  nodes: Record<string, ArcNodePosition>;
31
32
  nodeData: Record<string, ArcNodeData>;
32
33
  connectors: ArcConnector[];
33
34
  connectorStyles: Record<string, ArcConnectorStyle>;
35
+ focusTargets?: Record<string, FocusTarget>;
36
+ groups?: GroupShape[];
34
37
  }
35
38
 
36
39
  declare interface ArcDiagramData_2 {
40
+ id?: string;
37
41
  layout: DiagramLayout_2;
42
+ layoutHints?: LayoutHints_2;
38
43
  nodes: Record<string, NodePosition_2>;
39
44
  nodeData: Record<string, NodeData>;
40
45
  connectors: Connector[];
41
46
  connectorStyles: Record<string, ConnectorStyle_2>;
47
+ focusTargets?: Record<string, FocusTarget_2>;
48
+ groups?: GroupShape_2[];
42
49
  }
43
50
 
44
51
  export declare function ArcDiagramIsometric({ config, options, className, style, onNodeClick, onLayerClick }: ArcDiagramProps_2): JSX.Element;
@@ -67,6 +74,8 @@ declare interface ArcDiagramProps {
67
74
  showControls?: boolean;
68
75
  /** Show a minimap overview (bottom-left). Default: false */
69
76
  showMinimap?: boolean;
77
+ /** Show the active focus target's caption and steps. Default: false */
78
+ showFocusStory?: boolean;
70
79
  /** Override the edge/frame treatment (else the theme's brand.frame). */
71
80
  frame?: BrandSpec['frame'];
72
81
  /** Control hover behavior. true = all effects (default), false = none, object = granular control */
@@ -124,6 +133,8 @@ export declare interface AsciiOptions {
124
133
  * Generate a diagram from minimal input — no positions or anchors needed.
125
134
  */
126
135
  export declare interface AutoDiagramInput {
136
+ layoutHints?: ArcDiagramData_2['layoutHints'];
137
+ groups?: ArcDiagramData_2['groups'];
127
138
  nodeData: ArcDiagramData_2['nodeData'];
128
139
  connectors: Array<Omit<Connector, 'fromAnchor' | 'toAnchor'> & {
129
140
  fromAnchor?: AnchorPosition_2;
@@ -163,6 +174,16 @@ declare interface BrandSpec {
163
174
  frame?: 'hairline' | 'inset' | 'brackets' | 'ticks' | 'cropmarks' | 'corners' | 'sheet' | 'reticle' | 'none';
164
175
  /** Render an engineering-drawing title block in the bottom-right corner. */
165
176
  titleBlock?: boolean;
177
+ /** Node silhouette when nodeRadius is not set explicitly. */
178
+ nodeShape?: 'rounded' | 'square' | 'chamfer' | 'pill';
179
+ /** Overall node opacity (0–1). */
180
+ nodeOpacity?: number;
181
+ /** Frosted glass backdrop on nodes. */
182
+ nodeGlass?: boolean;
183
+ /** Colored accent stripe on the node shell. */
184
+ accentBar?: 'left' | 'top' | 'none';
185
+ /** Soft bloom on connector strokes. */
186
+ connectorGlow?: boolean;
166
187
  }
167
188
 
168
189
  export declare interface ColorPalette {
@@ -331,9 +352,7 @@ declare interface DiagramConfig_2 {
331
352
  }[];
332
353
  }
333
354
 
334
- export declare function DiagramEditor({ isDark, onToggleTheme, initialData, themeId, colorMode, sessionId, initialDiagramMeta }: {
335
- isDark: boolean;
336
- onToggleTheme: () => void;
355
+ export declare function DiagramEditor({ initialData, themeId, colorMode, sessionId, initialDiagramMeta, }: {
337
356
  initialData?: any;
338
357
  themeId?: string | null;
339
358
  colorMode?: 'light' | 'dark';
@@ -429,6 +448,44 @@ export declare interface EmbedConfig {
429
448
  showGrid?: boolean;
430
449
  }
431
450
 
451
+ export declare interface FocusConnectorRef {
452
+ from: string;
453
+ to: string;
454
+ }
455
+
456
+ declare interface FocusConnectorRef_2 {
457
+ from: string;
458
+ to: string;
459
+ }
460
+
461
+ export declare interface FocusStep {
462
+ icon: string;
463
+ label: string;
464
+ }
465
+
466
+ declare interface FocusStep_2 {
467
+ icon: string;
468
+ label: string;
469
+ }
470
+
471
+ export declare interface FocusTarget {
472
+ mode?: 'append' | 'replace';
473
+ nodes?: string[];
474
+ connectors?: FocusConnectorRef[];
475
+ caption?: string;
476
+ steps?: FocusStep[];
477
+ }
478
+
479
+ /** A declarative highlight story activated by hovering or selecting a node. */
480
+ declare interface FocusTarget_2 {
481
+ /** `append` includes direct neighbors; `replace` uses only the explicit story. */
482
+ mode?: 'append' | 'replace';
483
+ nodes?: string[];
484
+ connectors?: FocusConnectorRef_2[];
485
+ caption?: string;
486
+ steps?: FocusStep_2[];
487
+ }
488
+
432
489
  /** Generate a short session ID (first 8 hex chars of a UUID for brevity in URLs) */
433
490
  export declare function generateSessionId(): string;
434
491
 
@@ -443,6 +500,54 @@ export declare function getThemeList(): {
443
500
  description: string;
444
501
  }[];
445
502
 
503
+ export declare type GroupLayoutDirection = 'horizontal' | 'vertical';
504
+
505
+ declare type GroupLayoutDirection_2 = 'horizontal' | 'vertical';
506
+
507
+ export declare interface GroupLayoutHint {
508
+ direction?: GroupLayoutDirection;
509
+ padding?: number;
510
+ layerGap?: number;
511
+ itemGap?: number;
512
+ align?: LayoutAlignment;
513
+ justify?: LayoutAlignment | 'space-between';
514
+ }
515
+
516
+ /** Layout policy for the nodes inside one group frame. */
517
+ declare interface GroupLayoutHint_2 {
518
+ /** `horizontal` lays layers left-to-right; `vertical` lays them top-to-bottom. */
519
+ direction?: GroupLayoutDirection_2;
520
+ padding?: number;
521
+ layerGap?: number;
522
+ itemGap?: number;
523
+ align?: LayoutAlignment_2;
524
+ justify?: LayoutAlignment_2 | 'space-between';
525
+ }
526
+
527
+ export declare interface GroupShape {
528
+ id: string;
529
+ x: number;
530
+ y: number;
531
+ width: number;
532
+ height: number;
533
+ type: 'rect' | 'circle';
534
+ color: DiagramColor;
535
+ label?: string;
536
+ dashed?: boolean;
537
+ }
538
+
539
+ declare interface GroupShape_2 {
540
+ id: string;
541
+ x: number;
542
+ y: number;
543
+ width: number;
544
+ height: number;
545
+ type: 'rect' | 'circle';
546
+ color: DiagramColor_2;
547
+ label?: string;
548
+ dashed?: boolean;
549
+ }
550
+
446
551
  declare interface HoverEffectsConfig {
447
552
  /** Dim unrelated nodes/connectors. Default: true */
448
553
  dim?: boolean;
@@ -496,7 +601,7 @@ declare const initialState: {
496
601
  template: string;
497
602
  zoom: number;
498
603
  viewMode: string;
499
- themeId: any;
604
+ themeId: string;
500
605
  colorMode: string;
501
606
  };
502
607
  meta: {
@@ -588,6 +693,20 @@ declare type LabelAlign = 'left' | 'right' | 'center';
588
693
 
589
694
  declare type LabelCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
590
695
 
696
+ export declare type LayoutAlignment = 'start' | 'center' | 'end';
697
+
698
+ declare type LayoutAlignment_2 = 'start' | 'center' | 'end';
699
+
700
+ export declare interface LayoutHints {
701
+ nodes?: Record<string, NodeLayoutHint>;
702
+ groups?: Record<string, GroupLayoutHint>;
703
+ }
704
+
705
+ declare interface LayoutHints_2 {
706
+ nodes?: Record<string, NodeLayoutHint_2>;
707
+ groups?: Record<string, GroupLayoutHint_2>;
708
+ }
709
+
591
710
  declare interface LayoutOptions {
592
711
  /** Horizontal gap between columns */
593
712
  columnGap?: number;
@@ -617,6 +736,22 @@ declare interface NodeData {
617
736
  color: DiagramColor_2;
618
737
  }
619
738
 
739
+ export declare interface NodeLayoutHint {
740
+ group?: string;
741
+ layer?: number;
742
+ order?: number;
743
+ }
744
+
745
+ /** Optional placement hints used by autoLayout when nodes belong to groups. */
746
+ declare interface NodeLayoutHint_2 {
747
+ /** ID of the group frame that owns this node. */
748
+ group?: string;
749
+ /** Explicit layer within the group. Connected nodes are layered automatically otherwise. */
750
+ layer?: number;
751
+ /** Stable ordering within a layer. Lower values render first. */
752
+ order?: number;
753
+ }
754
+
620
755
  export declare interface NodePosition {
621
756
  x: number;
622
757
  y: number;
@@ -636,7 +771,7 @@ declare interface NodePosition_2 {
636
771
 
637
772
  export declare type NodeSize = 'xs' | 's' | 'm' | 'l';
638
773
 
639
- declare type NodeSize_2 = 's' | 'm' | 'l';
774
+ declare type NodeSize_2 = 'xs' | 's' | 'm' | 'l';
640
775
 
641
776
  declare type NodeSize_3 = 'large' | 'normal' | 'small';
642
777
 
@@ -696,6 +831,11 @@ export declare function renderToElement(container: HTMLElement, config: DiagramC
696
831
  */
697
832
  export declare function renderToString(config: DiagramConfig): string;
698
833
 
834
+ export declare function resolveFocusState(activeNodeId: string | null, connectors: ArcConnector[], focusTargets?: Record<string, FocusTarget>): {
835
+ nodeIds: Set<string>;
836
+ connectorIndexes: Set<number>;
837
+ };
838
+
699
839
  /** Save a diagram session to localStorage */
700
840
  export declare function saveDiagramSession(id: string, data: Omit<DiagramSession, 'updatedAt'>): void;
701
841
 
@@ -737,7 +877,7 @@ declare interface ThemeBackground {
737
877
  };
738
878
  }
739
879
 
740
- export declare type ThemeId = 'default' | 'warm' | 'cool' | 'mono' | 'engineering' | 'workbench' | 'tactical';
880
+ export declare type ThemeId = 'default' | 'warm' | 'cool' | 'mono' | 'engineering' | 'workbench' | 'tactical' | 'command';
741
881
 
742
882
  export declare const THEMES: Record<ThemeId, Theme>;
743
883
 
@@ -831,10 +971,13 @@ export declare function useEditorState(): {
831
971
  template: string;
832
972
  zoom: number;
833
973
  viewMode: string;
834
- themeId: any;
974
+ themeId: string;
835
975
  colorMode: string;
836
976
  };
837
977
 
978
+ /** Returns the active theme's brand spec (typography, node shape, connector treatment). */
979
+ export declare function useResolvedBrand(): BrandSpec;
980
+
838
981
  /** Returns the resolved theme palette (light or dark) for the current theme and color mode. */
839
982
  export declare function useResolvedTheme(): {
840
983
  palette: ColorPalette;
@@ -846,7 +989,7 @@ export declare function useResolvedTheme(): {
846
989
  };
847
990
  };
848
991
 
849
- export declare function useThemeId(): any;
992
+ export declare function useThemeId(): string;
850
993
 
851
994
  export declare function useViewMode(): string;
852
995
 
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/lang-css" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/lang-html" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/lang-javascript" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/lang-json" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/lang-markdown" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/language" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/state" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const o = {};
2
+ throw new Error('Could not resolve "@codemirror/view" imported by "hudsonkit".');
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,5 @@
1
+ const t = {};
2
+ throw new Error('Could not resolve "@xterm/xterm" imported by "hudsonkit".');
3
+ export {
4
+ t as default
5
+ };
package/package.json CHANGED
@@ -1,22 +1,27 @@
1
1
  {
2
2
  "name": "@arach/arc",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "workspaces": [
7
7
  "packages/*"
8
8
  ],
9
- "description": "Visual diagram editor for creating architecture diagrams",
9
+ "description": "Diagrams as code for React — design, render, and export typed architecture diagrams",
10
10
  "author": "Arach Tchoupani",
11
11
  "license": "MIT",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "https://github.com/arach/arc.git"
15
15
  },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "provenance": true
19
+ },
16
20
  "keywords": [
17
21
  "diagram",
18
22
  "editor",
19
23
  "architecture",
24
+ "diagrams-as-code",
20
25
  "visualization",
21
26
  "react",
22
27
  "isometric"
@@ -25,9 +30,9 @@
25
30
  "arc-ascii": "./bin/arc-ascii.mjs"
26
31
  },
27
32
  "files": [
28
- "lib/arc.es.js",
29
- "lib/arc.umd.js",
30
- "lib/index.d.ts",
33
+ "lib/*.js",
34
+ "lib/*.d.ts",
35
+ "lib/*.css",
31
36
  "bin/arc-ascii.mjs"
32
37
  ],
33
38
  "main": "./lib/arc.umd.js",
@@ -50,24 +55,17 @@
50
55
  "typecheck": "tsc --noEmit",
51
56
  "preview": "vite preview",
52
57
  "generate-og": "node scripts/generate-og.js",
53
- "check:dist": "attw --pack . --ignore-rules cjs-resolves-to-esm unexpected-module-syntax && publint",
58
+ "check:dist": "attw --pack . --ignore-rules cjs-resolves-to-esm unexpected-module-syntax && publint && node scripts/check-packlist.mjs",
54
59
  "prepublishOnly": "bun run build:lib && bun run check:dist"
55
60
  },
56
61
  "peerDependencies": {
57
62
  "react": "^18.0.0 || ^19.0.0",
58
- "react-dom": "^18.0.0 || ^19.0.0",
59
- "lucide-react": ">=0.400.0"
60
- },
61
- "dependencies": {
62
- "@arach/dewey": "^0.2.0",
63
- "@base-ui/react": "^1.0.0",
64
- "js-yaml": "^4.1.1",
65
- "react": "^19.2.0",
66
- "react-dom": "^19.2.0",
67
- "react-router-dom": "^7.12.0"
63
+ "react-dom": "^18.0.0 || ^19.0.0"
68
64
  },
69
65
  "devDependencies": {
66
+ "@arach/dewey": "^0.2.0",
70
67
  "@arethetypeswrong/cli": "^0.18.4",
68
+ "@base-ui/react": "^1.0.0",
71
69
  "@eslint/js": "^9.39.1",
72
70
  "@tailwindcss/vite": "^4.1.18",
73
71
  "@types/js-yaml": "^4.0.9",
@@ -79,9 +77,14 @@
79
77
  "eslint-plugin-react-hooks": "^7.0.1",
80
78
  "eslint-plugin-react-refresh": "^0.4.24",
81
79
  "globals": "^16.5.0",
80
+ "hudsonkit": "^0.3.3",
81
+ "js-yaml": "^4.1.1",
82
82
  "lucide-react": "^0.562.0",
83
83
  "publint": "^0.3.21",
84
84
  "puppeteer": "^24.34.0",
85
+ "react": "^19.2.0",
86
+ "react-dom": "^19.2.0",
87
+ "react-router-dom": "^7.12.0",
85
88
  "rollup-plugin-visualizer": "^6.0.5",
86
89
  "satori": "^0.18.3",
87
90
  "sharp": "^0.34.5",