@shumoku/core 0.2.0 → 0.2.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 (56) hide show
  1. package/dist/icons/build-icons.js +3 -3
  2. package/dist/icons/build-icons.js.map +1 -1
  3. package/dist/icons/generated-icons.js +10 -10
  4. package/dist/icons/generated-icons.js.map +1 -1
  5. package/dist/index.d.ts +3 -4
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +6 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/layout/hierarchical.d.ts +1 -1
  10. package/dist/layout/hierarchical.d.ts.map +1 -1
  11. package/dist/layout/hierarchical.js +82 -66
  12. package/dist/layout/hierarchical.js.map +1 -1
  13. package/dist/layout/index.d.ts +1 -1
  14. package/dist/layout/index.d.ts.map +1 -1
  15. package/dist/layout/index.js.map +1 -1
  16. package/dist/models/types.d.ts.map +1 -1
  17. package/dist/models/types.js +13 -13
  18. package/dist/models/types.js.map +1 -1
  19. package/dist/themes/dark.d.ts.map +1 -1
  20. package/dist/themes/dark.js +1 -1
  21. package/dist/themes/dark.js.map +1 -1
  22. package/dist/themes/index.d.ts +3 -3
  23. package/dist/themes/index.d.ts.map +1 -1
  24. package/dist/themes/index.js +4 -4
  25. package/dist/themes/index.js.map +1 -1
  26. package/dist/themes/modern.d.ts.map +1 -1
  27. package/dist/themes/modern.js.map +1 -1
  28. package/dist/themes/types.d.ts.map +1 -1
  29. package/dist/themes/utils.d.ts +1 -1
  30. package/dist/themes/utils.d.ts.map +1 -1
  31. package/dist/themes/utils.js +5 -4
  32. package/dist/themes/utils.js.map +1 -1
  33. package/package.json +88 -92
  34. package/src/constants.ts +35 -35
  35. package/src/icons/build-icons.ts +12 -6
  36. package/src/icons/generated-icons.ts +12 -12
  37. package/src/index.test.ts +66 -0
  38. package/src/index.ts +6 -13
  39. package/src/layout/hierarchical.ts +1251 -1221
  40. package/src/layout/index.ts +1 -1
  41. package/src/models/types.ts +47 -37
  42. package/src/themes/dark.ts +15 -15
  43. package/src/themes/index.ts +7 -7
  44. package/src/themes/modern.ts +22 -22
  45. package/src/themes/types.ts +26 -26
  46. package/src/themes/utils.ts +25 -24
  47. package/dist/renderer/index.d.ts +0 -6
  48. package/dist/renderer/index.d.ts.map +0 -1
  49. package/dist/renderer/index.js +0 -5
  50. package/dist/renderer/index.js.map +0 -1
  51. package/dist/renderer/svg.d.ts +0 -131
  52. package/dist/renderer/svg.d.ts.map +0 -1
  53. package/dist/renderer/svg.js +0 -1031
  54. package/dist/renderer/svg.js.map +0 -1
  55. package/src/renderer/index.ts +0 -6
  56. package/src/renderer/svg.ts +0 -1277
@@ -2,5 +2,5 @@
2
2
  * Shumoku Layout Engines
3
3
  */
4
4
 
5
- export { HierarchicalLayout, hierarchicalLayout } from './hierarchical.js'
6
5
  export type { HierarchicalLayoutOptions } from './hierarchical.js'
6
+ export { HierarchicalLayout, hierarchicalLayout } from './hierarchical.js'
@@ -8,13 +8,13 @@
8
8
  // ============================================
9
9
 
10
10
  export type NodeShape =
11
- | 'rect' // Rectangle [text]
12
- | 'rounded' // Rounded rectangle (text)
13
- | 'circle' // Circle ((text))
14
- | 'diamond' // Diamond {text}
15
- | 'hexagon' // Hexagon {{text}}
16
- | 'cylinder' // Database cylinder [(text)]
17
- | 'stadium' // Stadium/pill shape ([text])
11
+ | 'rect' // Rectangle [text]
12
+ | 'rounded' // Rounded rectangle (text)
13
+ | 'circle' // Circle ((text))
14
+ | 'diamond' // Diamond {text}
15
+ | 'hexagon' // Hexagon {{text}}
16
+ | 'cylinder' // Database cylinder [(text)]
17
+ | 'stadium' // Stadium/pill shape ([text])
18
18
  | 'trapezoid' // Trapezoid [/text/]
19
19
 
20
20
  export interface NodeStyle {
@@ -96,17 +96,17 @@ export interface Node {
96
96
  // ============================================
97
97
 
98
98
  export type LinkType =
99
- | 'solid' // Normal line -->
100
- | 'dashed' // Dashed line -.->
101
- | 'thick' // Thick line ==>
102
- | 'double' // Double line o==o
99
+ | 'solid' // Normal line -->
100
+ | 'dashed' // Dashed line -.->
101
+ | 'thick' // Thick line ==>
102
+ | 'double' // Double line o==o
103
103
  | 'invisible' // No line (for layout only)
104
104
 
105
105
  export type ArrowType =
106
- | 'none' // No arrow ---
107
- | 'forward' // Arrow at target -->
108
- | 'back' // Arrow at source <--
109
- | 'both' // Arrows at both <-->
106
+ | 'none' // No arrow ---
107
+ | 'forward' // Arrow at target -->
108
+ | 'back' // Arrow at source <--
109
+ | 'both' // Arrows at both <-->
110
110
 
111
111
  export interface LinkStyle {
112
112
  stroke?: string
@@ -123,7 +123,7 @@ export interface LinkStyle {
123
123
  export interface LinkEndpoint {
124
124
  node: string
125
125
  port?: string
126
- ip?: string // e.g., "10.57.0.1/30"
126
+ ip?: string // e.g., "10.57.0.1/30"
127
127
  }
128
128
 
129
129
  /**
@@ -276,9 +276,19 @@ export interface Subgraph {
276
276
  * Standard paper size presets
277
277
  */
278
278
  export type PaperSize =
279
- | 'A0' | 'A1' | 'A2' | 'A3' | 'A4'
280
- | 'B0' | 'B1' | 'B2' | 'B3' | 'B4'
281
- | 'letter' | 'legal' | 'tabloid'
279
+ | 'A0'
280
+ | 'A1'
281
+ | 'A2'
282
+ | 'A3'
283
+ | 'A4'
284
+ | 'B0'
285
+ | 'B1'
286
+ | 'B2'
287
+ | 'B3'
288
+ | 'B4'
289
+ | 'letter'
290
+ | 'legal'
291
+ | 'tabloid'
282
292
 
283
293
  /**
284
294
  * Paper orientation
@@ -289,19 +299,19 @@ export type PaperOrientation = 'portrait' | 'landscape'
289
299
  * Paper size dimensions in mm
290
300
  */
291
301
  export const PAPER_SIZES: Record<PaperSize, { width: number; height: number }> = {
292
- 'A0': { width: 841, height: 1189 },
293
- 'A1': { width: 594, height: 841 },
294
- 'A2': { width: 420, height: 594 },
295
- 'A3': { width: 297, height: 420 },
296
- 'A4': { width: 210, height: 297 },
297
- 'B0': { width: 1000, height: 1414 },
298
- 'B1': { width: 707, height: 1000 },
299
- 'B2': { width: 500, height: 707 },
300
- 'B3': { width: 353, height: 500 },
301
- 'B4': { width: 250, height: 353 },
302
- 'letter': { width: 216, height: 279 },
303
- 'legal': { width: 216, height: 356 },
304
- 'tabloid': { width: 279, height: 432 },
302
+ A0: { width: 841, height: 1189 },
303
+ A1: { width: 594, height: 841 },
304
+ A2: { width: 420, height: 594 },
305
+ A3: { width: 297, height: 420 },
306
+ A4: { width: 210, height: 297 },
307
+ B0: { width: 1000, height: 1414 },
308
+ B1: { width: 707, height: 1000 },
309
+ B2: { width: 500, height: 707 },
310
+ B3: { width: 353, height: 500 },
311
+ B4: { width: 250, height: 353 },
312
+ letter: { width: 216, height: 279 },
313
+ legal: { width: 216, height: 356 },
314
+ tabloid: { width: 279, height: 432 },
305
315
  }
306
316
 
307
317
  /**
@@ -354,7 +364,7 @@ export interface CanvasSettings {
354
364
  export function paperSizeToPixels(
355
365
  size: PaperSize,
356
366
  orientation: PaperOrientation = 'portrait',
357
- dpi: number = 96
367
+ dpi = 96,
358
368
  ): { width: number; height: number } {
359
369
  const dimensions = PAPER_SIZES[size]
360
370
  const mmToInch = 1 / 25.4
@@ -539,10 +549,10 @@ export interface LayoutNode {
539
549
 
540
550
  export interface LayoutLink {
541
551
  id: string
542
- from: string // Node ID
543
- to: string // Node ID
544
- fromEndpoint: LinkEndpoint // Full endpoint info
545
- toEndpoint: LinkEndpoint // Full endpoint info
552
+ from: string // Node ID
553
+ to: string // Node ID
554
+ fromEndpoint: LinkEndpoint // Full endpoint info
555
+ toEndpoint: LinkEndpoint // Full endpoint info
546
556
  points: Position[]
547
557
  link: Link
548
558
  }
@@ -2,49 +2,49 @@
2
2
  * Dark theme
3
3
  */
4
4
 
5
- import type { Theme } from './types.js'
6
- import { modernTheme } from './modern.js'
7
5
  import { DeviceType } from '../models/index.js'
6
+ import { modernTheme } from './modern.js'
7
+ import type { Theme } from './types.js'
8
8
 
9
9
  export const darkTheme: Theme = {
10
10
  ...modernTheme,
11
11
  name: 'dark',
12
12
  variant: 'dark',
13
-
13
+
14
14
  colors: {
15
15
  ...modernTheme.colors,
16
-
16
+
17
17
  // Backgrounds (inverted)
18
18
  background: '#0f172a',
19
19
  surface: '#1e293b',
20
20
  surfaceHover: '#334155',
21
-
21
+
22
22
  // Text (inverted)
23
23
  text: '#f1f5f9',
24
24
  textSecondary: '#94a3b8',
25
25
  textDisabled: '#475569',
26
-
26
+
27
27
  // Primary (adjusted for dark)
28
28
  primary: '#60a5fa',
29
29
  primaryHover: '#3b82f6',
30
30
  primaryActive: '#2563eb',
31
-
31
+
32
32
  // Secondary (adjusted for dark)
33
33
  secondary: '#a78bfa',
34
34
  secondaryHover: '#8b5cf6',
35
35
  secondaryActive: '#7c3aed',
36
-
36
+
37
37
  // Status (adjusted for dark)
38
38
  success: '#34d399',
39
39
  warning: '#fbbf24',
40
40
  error: '#f87171',
41
41
  info: '#60a5fa',
42
-
42
+
43
43
  // Links
44
44
  link: '#60a5fa',
45
45
  linkHover: '#3b82f6',
46
46
  linkDown: '#f87171',
47
-
47
+
48
48
  // Device colors (adjusted for dark)
49
49
  devices: {
50
50
  [DeviceType.Router]: '#60a5fa',
@@ -58,7 +58,7 @@ export const darkTheme: Theme = {
58
58
  [DeviceType.Internet]: '#818cf8',
59
59
  [DeviceType.Generic]: '#64748b',
60
60
  },
61
-
61
+
62
62
  // Module colors (adjusted for dark)
63
63
  modules: {
64
64
  core: '#1e3a8a',
@@ -68,15 +68,15 @@ export const darkTheme: Theme = {
68
68
  cloud: '#312e81',
69
69
  default: '#374151',
70
70
  },
71
-
71
+
72
72
  // Grid
73
73
  grid: '#334155',
74
74
  guideline: '#60a5fa',
75
75
  },
76
-
76
+
77
77
  shadows: {
78
78
  ...modernTheme.shadows,
79
-
79
+
80
80
  // Darker shadows for dark theme
81
81
  small: {
82
82
  color: '#000000',
@@ -107,4 +107,4 @@ export const darkTheme: Theme = {
107
107
  alpha: 0.7,
108
108
  },
109
109
  },
110
- }
110
+ }
@@ -2,23 +2,23 @@
2
2
  * Theme system exports
3
3
  */
4
4
 
5
- export * from './types.js'
6
- export { modernTheme } from './modern.js'
7
5
  export { darkTheme } from './dark.js'
6
+ export { modernTheme } from './modern.js'
7
+ export * from './types.js'
8
8
  export {
9
- mergeTheme,
10
- createTheme,
11
9
  applyThemeToCSS,
12
- getThemeFromCSS
10
+ createTheme,
11
+ getThemeFromCSS,
12
+ mergeTheme,
13
13
  } from './utils.js'
14
14
 
15
+ import { darkTheme } from './dark.js'
15
16
  // Default themes map
16
17
  import { modernTheme } from './modern.js'
17
- import { darkTheme } from './dark.js'
18
18
 
19
19
  export const themes = {
20
20
  modern: modernTheme,
21
21
  dark: darkTheme,
22
22
  } as const
23
23
 
24
- export type ThemeName = keyof typeof themes
24
+ export type ThemeName = keyof typeof themes
@@ -2,45 +2,45 @@
2
2
  * Modern theme - Default light theme
3
3
  */
4
4
 
5
- import type { Theme } from './types.js'
6
5
  import { DeviceType } from '../models/index.js'
6
+ import type { Theme } from './types.js'
7
7
 
8
8
  export const modernTheme: Theme = {
9
9
  name: 'modern',
10
10
  variant: 'light',
11
-
11
+
12
12
  colors: {
13
13
  // Backgrounds
14
14
  background: '#ffffff',
15
15
  surface: '#f8fafc',
16
16
  surfaceHover: '#f1f5f9',
17
-
17
+
18
18
  // Text
19
19
  text: '#0f172a',
20
20
  textSecondary: '#64748b',
21
21
  textDisabled: '#cbd5e1',
22
-
22
+
23
23
  // Primary (Blue)
24
24
  primary: '#3b82f6',
25
25
  primaryHover: '#2563eb',
26
26
  primaryActive: '#1d4ed8',
27
-
27
+
28
28
  // Secondary (Purple)
29
29
  secondary: '#8b5cf6',
30
30
  secondaryHover: '#7c3aed',
31
31
  secondaryActive: '#6d28d9',
32
-
32
+
33
33
  // Status
34
34
  success: '#10b981',
35
35
  warning: '#f59e0b',
36
36
  error: '#ef4444',
37
37
  info: '#3b82f6',
38
-
38
+
39
39
  // Links
40
40
  link: '#3b82f6',
41
41
  linkHover: '#2563eb',
42
42
  linkDown: '#ef4444',
43
-
43
+
44
44
  // Device colors
45
45
  devices: {
46
46
  [DeviceType.Router]: '#3b82f6',
@@ -54,7 +54,7 @@ export const modernTheme: Theme = {
54
54
  [DeviceType.Internet]: '#6366f1',
55
55
  [DeviceType.Generic]: '#94a3b8',
56
56
  },
57
-
57
+
58
58
  // Module colors
59
59
  modules: {
60
60
  core: '#dbeafe',
@@ -64,19 +64,19 @@ export const modernTheme: Theme = {
64
64
  cloud: '#e0e7ff',
65
65
  default: '#f3f4f6',
66
66
  },
67
-
67
+
68
68
  // Grid
69
69
  grid: '#e5e7eb',
70
70
  guideline: '#3b82f6',
71
71
  },
72
-
72
+
73
73
  dimensions: {
74
74
  device: {
75
75
  small: { width: 60, height: 40 },
76
76
  medium: { width: 80, height: 60 },
77
77
  large: { width: 120, height: 80 },
78
78
  },
79
-
79
+
80
80
  fontSize: {
81
81
  tiny: 10,
82
82
  small: 12,
@@ -84,14 +84,14 @@ export const modernTheme: Theme = {
84
84
  large: 16,
85
85
  huge: 20,
86
86
  },
87
-
87
+
88
88
  lineWidth: {
89
89
  thin: 1,
90
90
  normal: 2,
91
91
  thick: 3,
92
92
  emphasis: 4,
93
93
  },
94
-
94
+
95
95
  spacing: {
96
96
  xs: 4,
97
97
  sm: 8,
@@ -99,7 +99,7 @@ export const modernTheme: Theme = {
99
99
  lg: 24,
100
100
  xl: 32,
101
101
  },
102
-
102
+
103
103
  radius: {
104
104
  small: 4,
105
105
  medium: 8,
@@ -107,7 +107,7 @@ export const modernTheme: Theme = {
107
107
  round: 9999,
108
108
  },
109
109
  },
110
-
110
+
111
111
  shadows: {
112
112
  none: {
113
113
  color: 'transparent',
@@ -144,7 +144,7 @@ export const modernTheme: Theme = {
144
144
  alpha: 0.5,
145
145
  },
146
146
  },
147
-
147
+
148
148
  animations: {
149
149
  duration: {
150
150
  instant: 0,
@@ -152,7 +152,7 @@ export const modernTheme: Theme = {
152
152
  normal: 300,
153
153
  slow: 500,
154
154
  },
155
-
155
+
156
156
  easing: {
157
157
  linear: 'linear',
158
158
  easeIn: 'ease-in',
@@ -161,14 +161,14 @@ export const modernTheme: Theme = {
161
161
  bounce: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
162
162
  },
163
163
  },
164
-
164
+
165
165
  typography: {
166
166
  fontFamily: {
167
167
  sans: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
168
168
  mono: 'ui-monospace, "Cascadia Mono", "Consolas", monospace',
169
169
  display: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
170
170
  },
171
-
171
+
172
172
  fontWeight: {
173
173
  light: 300,
174
174
  regular: 400,
@@ -176,11 +176,11 @@ export const modernTheme: Theme = {
176
176
  semibold: 600,
177
177
  bold: 700,
178
178
  },
179
-
179
+
180
180
  letterSpacing: {
181
181
  tight: -0.025,
182
182
  normal: 0,
183
183
  wide: 0.025,
184
184
  },
185
185
  },
186
- }
186
+ }
@@ -11,28 +11,28 @@ export interface ThemeColors {
11
11
  background: string
12
12
  surface: string
13
13
  surfaceHover: string
14
-
14
+
15
15
  /**
16
16
  * Text colors
17
17
  */
18
18
  text: string
19
19
  textSecondary: string
20
20
  textDisabled: string
21
-
21
+
22
22
  /**
23
23
  * Primary palette
24
24
  */
25
25
  primary: string
26
26
  primaryHover: string
27
27
  primaryActive: string
28
-
28
+
29
29
  /**
30
30
  * Secondary palette
31
31
  */
32
32
  secondary: string
33
33
  secondaryHover: string
34
34
  secondaryActive: string
35
-
35
+
36
36
  /**
37
37
  * Status colors
38
38
  */
@@ -40,19 +40,19 @@ export interface ThemeColors {
40
40
  warning: string
41
41
  error: string
42
42
  info: string
43
-
43
+
44
44
  /**
45
45
  * Link colors
46
46
  */
47
47
  link: string
48
48
  linkHover: string
49
49
  linkDown: string
50
-
50
+
51
51
  /**
52
52
  * Device type colors
53
53
  */
54
54
  devices: Partial<Record<DeviceType | string, string>>
55
-
55
+
56
56
  /**
57
57
  * Module colors (for Bento Grid)
58
58
  */
@@ -64,7 +64,7 @@ export interface ThemeColors {
64
64
  cloud: string
65
65
  default: string
66
66
  }
67
-
67
+
68
68
  /**
69
69
  * Grid and guides
70
70
  */
@@ -81,7 +81,7 @@ export interface ThemeDimensions {
81
81
  medium: { width: number; height: number }
82
82
  large: { width: number; height: number }
83
83
  }
84
-
84
+
85
85
  /**
86
86
  * Font sizes
87
87
  */
@@ -92,7 +92,7 @@ export interface ThemeDimensions {
92
92
  large: number
93
93
  huge: number
94
94
  }
95
-
95
+
96
96
  /**
97
97
  * Line widths
98
98
  */
@@ -102,7 +102,7 @@ export interface ThemeDimensions {
102
102
  thick: number
103
103
  emphasis: number
104
104
  }
105
-
105
+
106
106
  /**
107
107
  * Spacing
108
108
  */
@@ -113,7 +113,7 @@ export interface ThemeDimensions {
113
113
  lg: number
114
114
  xl: number
115
115
  }
116
-
116
+
117
117
  /**
118
118
  * Border radius
119
119
  */
@@ -154,7 +154,7 @@ export interface ThemeAnimations {
154
154
  normal: number
155
155
  slow: number
156
156
  }
157
-
157
+
158
158
  /**
159
159
  * Easing functions
160
160
  */
@@ -176,7 +176,7 @@ export interface ThemeTypography {
176
176
  mono: string
177
177
  display: string
178
178
  }
179
-
179
+
180
180
  /**
181
181
  * Font weights
182
182
  */
@@ -187,7 +187,7 @@ export interface ThemeTypography {
187
187
  semibold: number
188
188
  bold: number
189
189
  }
190
-
190
+
191
191
  /**
192
192
  * Letter spacing
193
193
  */
@@ -203,37 +203,37 @@ export interface Theme {
203
203
  * Theme name
204
204
  */
205
205
  name: string
206
-
206
+
207
207
  /**
208
208
  * Theme variant
209
209
  */
210
210
  variant: 'light' | 'dark'
211
-
211
+
212
212
  /**
213
213
  * Color definitions
214
214
  */
215
215
  colors: ThemeColors
216
-
216
+
217
217
  /**
218
218
  * Size definitions
219
219
  */
220
220
  dimensions: ThemeDimensions
221
-
221
+
222
222
  /**
223
223
  * Shadow definitions
224
224
  */
225
225
  shadows: ThemeShadows
226
-
226
+
227
227
  /**
228
228
  * Animation settings
229
229
  */
230
230
  animations: ThemeAnimations
231
-
231
+
232
232
  /**
233
233
  * Typography settings
234
234
  */
235
235
  typography: ThemeTypography
236
-
236
+
237
237
  /**
238
238
  * Custom properties
239
239
  */
@@ -245,7 +245,7 @@ export interface ThemeOptions {
245
245
  * Base theme to extend
246
246
  */
247
247
  extends?: Theme
248
-
248
+
249
249
  /**
250
250
  * Partial overrides
251
251
  */
@@ -257,6 +257,6 @@ export type DeepPartial<T> = {
257
257
  [P in keyof T]?: T[P] extends (infer U)[]
258
258
  ? DeepPartial<U>[]
259
259
  : T[P] extends readonly (infer U)[]
260
- ? readonly DeepPartial<U>[]
261
- : DeepPartial<T[P]>
262
- }
260
+ ? readonly DeepPartial<U>[]
261
+ : DeepPartial<T[P]>
262
+ }