@visualli/core 0.1.6 → 0.2.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.
Files changed (127) hide show
  1. package/README.md +37 -105
  2. package/dist/chunk-25AJTPMS.js +68 -0
  3. package/dist/chunk-25AJTPMS.js.map +1 -0
  4. package/dist/{chunk-6NXADJK2.js → chunk-7NJWM7ZE.js} +84 -117
  5. package/dist/chunk-7NJWM7ZE.js.map +1 -0
  6. package/dist/chunk-KVSM3APM.js +96 -0
  7. package/dist/chunk-KVSM3APM.js.map +1 -0
  8. package/dist/{chunk-PDP5CVUL.js → chunk-LOQLNYB3.js} +2 -2
  9. package/dist/chunk-LV3EXUQY.js +753 -0
  10. package/dist/chunk-LV3EXUQY.js.map +1 -0
  11. package/dist/chunk-N7HCYULH.js +12 -0
  12. package/dist/chunk-N7HCYULH.js.map +1 -0
  13. package/dist/{chunk-I75TMOE4.js → chunk-P6PKWVYF.js} +2 -2
  14. package/dist/chunk-TPLJJKAU.js +151 -0
  15. package/dist/chunk-TPLJJKAU.js.map +1 -0
  16. package/dist/chunk-UAMEJG2C.js +267 -0
  17. package/dist/chunk-UAMEJG2C.js.map +1 -0
  18. package/dist/{chunk-LJYSKSCE.js → chunk-W2CAOOJJ.js} +6 -6
  19. package/dist/chunk-W2CAOOJJ.js.map +1 -0
  20. package/dist/config/index.cjs +250 -349
  21. package/dist/config/index.cjs.map +1 -1
  22. package/dist/config/index.d.cts +107 -66
  23. package/dist/config/index.d.ts +107 -66
  24. package/dist/config/index.js +52 -34
  25. package/dist/constants/index.cjs +14 -333
  26. package/dist/constants/index.cjs.map +1 -1
  27. package/dist/constants/index.d.cts +5 -243
  28. package/dist/constants/index.d.ts +5 -243
  29. package/dist/constants/index.js +5 -75
  30. package/dist/designSystem-BOrZHfEq.d.cts +150 -0
  31. package/dist/designSystem-BOrZHfEq.d.ts +150 -0
  32. package/dist/document-BFBwn93X.d.ts +26 -0
  33. package/dist/document-MEJEfxl3.d.cts +26 -0
  34. package/dist/ideaSize-CLDKeyqD.d.cts +11 -0
  35. package/dist/ideaSize-DxxGy2E8.d.ts +11 -0
  36. package/dist/index-BmILeKj6.d.cts +99 -0
  37. package/dist/index-CcPRwVUL.d.ts +99 -0
  38. package/dist/index.cjs +1636 -961
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +350 -27
  41. package/dist/index.d.ts +350 -27
  42. package/dist/index.js +445 -190
  43. package/dist/index.js.map +1 -1
  44. package/dist/{document-B3hnNr-F.d.cts → layer-B2A3Ki48.d.cts} +2 -16
  45. package/dist/{document-B3hnNr-F.d.ts → layer-B2A3Ki48.d.ts} +2 -16
  46. package/dist/layout/index.d.cts +2 -1
  47. package/dist/layout/index.d.ts +2 -1
  48. package/dist/mindmap-C3Qr0qKW.d.cts +182 -0
  49. package/dist/mindmap-DHeVa86G.d.ts +182 -0
  50. package/dist/parser/index.cjs +745 -179
  51. package/dist/parser/index.cjs.map +1 -1
  52. package/dist/parser/index.d.cts +23 -8
  53. package/dist/parser/index.d.ts +23 -8
  54. package/dist/parser/index.js +7 -2
  55. package/dist/performance/index.cjs +13 -0
  56. package/dist/performance/index.cjs.map +1 -1
  57. package/dist/performance/index.js +2 -2
  58. package/dist/theme/index.cjs +884 -0
  59. package/dist/theme/index.cjs.map +1 -0
  60. package/dist/theme/index.d.cts +2 -0
  61. package/dist/theme/index.d.ts +2 -0
  62. package/dist/theme/index.js +53 -0
  63. package/dist/types/index.d.cts +4 -2
  64. package/dist/types/index.d.ts +4 -2
  65. package/dist/viewport/index.cjs +17 -6
  66. package/dist/viewport/index.cjs.map +1 -1
  67. package/dist/viewport/index.d.cts +6 -4
  68. package/dist/viewport/index.d.ts +6 -4
  69. package/dist/viewport/index.js +2 -2
  70. package/licenses/visualli-design-system/LICENSE +9 -0
  71. package/licenses/visualli-design-system/NOTICE.md +6 -0
  72. package/package.json +13 -5
  73. package/src/config/README.md +2 -4
  74. package/src/config/USAGE_EXAMPLES.md +0 -4
  75. package/src/config/index.ts +3 -4
  76. package/src/constants/index.ts +1 -1
  77. package/src/constants/layout.ts +11 -0
  78. package/src/constants/performanceConstants.ts +8 -27
  79. package/src/generated/README.md +12 -0
  80. package/src/generated/designSystem.ts +758 -0
  81. package/src/generated/geometry/blob.ts +99 -0
  82. package/src/generated/geometry/blobShapes.ts +4 -0
  83. package/src/generated/geometry/color.ts +37 -0
  84. package/src/generated/geometry/container.ts +84 -0
  85. package/src/generated/geometry/detail.ts +22 -0
  86. package/src/generated/geometry/idea.ts +56 -0
  87. package/src/generated/geometry/interaction.ts +122 -0
  88. package/src/generated/geometry/motion.ts +140 -0
  89. package/src/index.ts +18 -1
  90. package/src/parser/configUtils.ts +12 -19
  91. package/src/parser/visualliConverter.ts +71 -112
  92. package/src/parser/visualliParser.ts +16 -1
  93. package/src/rendering/culling.ts +16 -12
  94. package/src/rendering/ideaSize.ts +21 -0
  95. package/src/rendering/nodeGeometry.ts +97 -0
  96. package/src/theme/index.ts +136 -0
  97. package/src/types/document.ts +9 -0
  98. package/src/types/layer.ts +1 -1
  99. package/src/types/mindmap.ts +13 -0
  100. package/src/utils/navigation.ts +33 -63
  101. package/src/viewport/viewportUtils.ts +6 -4
  102. package/dist/animations/index.cjs +0 -146
  103. package/dist/animations/index.cjs.map +0 -1
  104. package/dist/animations/index.d.cts +0 -81
  105. package/dist/animations/index.d.ts +0 -81
  106. package/dist/animations/index.js +0 -35
  107. package/dist/chunk-6NXADJK2.js.map +0 -1
  108. package/dist/chunk-F36SMC3K.js +0 -106
  109. package/dist/chunk-F36SMC3K.js.map +0 -1
  110. package/dist/chunk-G5H3P4YZ.js +0 -273
  111. package/dist/chunk-G5H3P4YZ.js.map +0 -1
  112. package/dist/chunk-LDJRGT2Q.js +0 -163
  113. package/dist/chunk-LDJRGT2Q.js.map +0 -1
  114. package/dist/chunk-LJYSKSCE.js.map +0 -1
  115. package/dist/chunk-LNTJTDB2.js +0 -349
  116. package/dist/chunk-LNTJTDB2.js.map +0 -1
  117. package/dist/mindmap-DWS0WZT_.d.cts +0 -118
  118. package/dist/mindmap-DWS0WZT_.d.ts +0 -118
  119. package/src/animations/constants.ts +0 -72
  120. package/src/animations/easing.ts +0 -70
  121. package/src/animations/index.ts +0 -2
  122. package/src/config/blobShapes.ts +0 -146
  123. package/src/config/textScaling.ts +0 -54
  124. package/src/constants/design.ts +0 -281
  125. /package/dist/{chunk-PDP5CVUL.js.map → chunk-LOQLNYB3.js.map} +0 -0
  126. /package/dist/{chunk-I75TMOE4.js.map → chunk-P6PKWVYF.js.map} +0 -0
  127. /package/dist/{animations → theme}/index.js.map +0 -0
@@ -1,281 +0,0 @@
1
- // ─── Design System Constants ──────────────────────────────────────────────────
2
- //
3
- // Single source of truth for all color tokens, typography, spacing, and
4
- // visual design constants used across the SDK and consuming apps.
5
- //
6
- // ## Color Priority
7
- // 1. Data file values (node.color, layer.backgroundColor)
8
- // 2. Fall back to these constants
9
-
10
- // ── Visualli Design System v2 ─────────────────────────────────────────────────
11
-
12
- export const DS_COLORS = {
13
- light: {
14
- bgApp: '#F0EDE6',
15
- bgSurface: '#FAF8F4',
16
- bgInput: '#FFFFFF',
17
- border: '#DDD9D0',
18
- borderDivider: '#E8E4DC',
19
- primary: '#1B2D4F',
20
- primaryHover: '#243B68',
21
- textPrimary: '#1A1A18',
22
- textSecondary: '#6B6860',
23
- textMuted: '#747270',
24
- textOnPrimary: '#FAF8F4',
25
- hoverItem: 'rgba(27,45,79,0.07)',
26
- focusRing: 'rgba(27,45,79,0.40)',
27
- btnMuted: '#8E8C88',
28
- },
29
- dark: {
30
- bgApp: '#141412',
31
- bgSurface: '#1C1C1A',
32
- bgInput: '#262622',
33
- border: '#333330',
34
- borderDivider: '#2A2A28',
35
- primary: '#BB532D',
36
- primaryHover: '#CC6440',
37
- textPrimary: '#F0EDE6',
38
- textSecondary: '#B0ABA3',
39
- textMuted: '#8E8C88',
40
- textOnPrimary: '#FAF8F4',
41
- hoverItem: 'rgba(198,94,56,0.12)',
42
- focusRing: 'rgba(198,94,56,0.50)',
43
- btnMuted: '#4A4845',
44
- },
45
- } as const;
46
-
47
- export const DS_TYPOGRAPHY = {
48
- fontDisplay: "'Nunito', sans-serif",
49
- fontBody: "'Nunito Sans', sans-serif",
50
- logo: { size: '20px', weight: 800, letterSpacing: '0.04em' },
51
- heading: { size: '16px', weight: 700, letterSpacing: '-0.2px' },
52
- cta: { size: '11px', weight: 800, letterSpacing: '0.12em', transform: 'uppercase' as const },
53
- body: { size: '13px', weight: 400 },
54
- input: { size: '13px', weight: 300, style: 'italic' as const },
55
- search: { size: '12px', weight: 400 },
56
- username: { size: '13px', weight: 600 },
57
- avatar: { size: '11px', weight: 700 },
58
- footer: { size: '12px', weight: 400 },
59
- empty: { size: '11px', weight: 300, style: 'italic' as const },
60
- } as const;
61
-
62
- export const DS_RADII = {
63
- sidebar: 16,
64
- input: 8,
65
- cta: 7,
66
- item: 6,
67
- swatch: 10,
68
- } as const;
69
-
70
- // ── Brand Colors ──────────────────────────────────────────────────────────────
71
-
72
- export const BRAND_COLORS = {
73
- primary: {
74
- 50: '#EFF6FF',
75
- 100: '#DBEAFE',
76
- 200: '#BFDBFE',
77
- 300: '#93C5FD',
78
- 400: '#60A5FA',
79
- 500: '#3B82F6',
80
- 600: '#2563EB',
81
- 700: '#1D4ED8',
82
- 800: '#1E40AF',
83
- 900: '#1E3A8A',
84
- },
85
- secondary: {
86
- 50: '#F0FDF4',
87
- 100: '#DCFCE7',
88
- 200: '#BBF7D0',
89
- 300: '#86EFAC',
90
- 400: '#4ADE80',
91
- 500: '#10B981',
92
- 600: '#059669',
93
- 700: '#047857',
94
- 800: '#065F46',
95
- 900: '#064E3B',
96
- },
97
- accent: {
98
- purple: '#8B5CF6',
99
- cyan: '#06B6D4',
100
- sky: '#0EA5E9',
101
- lime: '#84CC16',
102
- amber: '#F59E0B',
103
- red: '#EF4444',
104
- },
105
- } as const;
106
-
107
- // ── Level Colors ──────────────────────────────────────────────────────────────
108
-
109
- export const LEVEL_COLORS = {
110
- level0: BRAND_COLORS.primary[500],
111
- level1: BRAND_COLORS.primary[400],
112
- level2: BRAND_COLORS.primary[300],
113
- level3: BRAND_COLORS.primary[200],
114
- level4: BRAND_COLORS.primary[300],
115
- level5: BRAND_COLORS.primary[400],
116
- level6: BRAND_COLORS.primary[500],
117
- level7: BRAND_COLORS.primary[600],
118
- level8: BRAND_COLORS.primary[700],
119
- } as const;
120
-
121
- export const LEVEL_COLOR_ARRAY = [
122
- LEVEL_COLORS.level0,
123
- LEVEL_COLORS.level1,
124
- LEVEL_COLORS.level2,
125
- LEVEL_COLORS.level3,
126
- LEVEL_COLORS.level4,
127
- LEVEL_COLORS.level5,
128
- LEVEL_COLORS.level6,
129
- LEVEL_COLORS.level7,
130
- LEVEL_COLORS.level8,
131
- ] as const;
132
-
133
- export const PARENT_FALLBACK_COLORS = [
134
- '#12C7D3', '#325E8C', '#8A70A6', '#F54A57', '#FF6C4D',
135
- '#F28C16', '#FFD347', '#7F7F7F', '#8D8D8D',
136
- ] as const;
137
-
138
- export const SEMANTIC_COLORS = {
139
- success: BRAND_COLORS.secondary[500],
140
- error: BRAND_COLORS.accent.red,
141
- warning: BRAND_COLORS.accent.amber,
142
- info: BRAND_COLORS.primary[500],
143
- } as const;
144
-
145
- // ── Theme Colors ──────────────────────────────────────────────────────────────
146
-
147
- export const THEME_COLORS = {
148
- light: {
149
- background: { primary: '#FAF8F4', secondary: '#F0EDE6', tertiary: '#FFFFFF' },
150
- text: { primary: '#1A1A18', secondary: '#6B6860', tertiary: '#747270' },
151
- border: { primary: '#DDD9D0', secondary: '#E8E4DC' },
152
- },
153
- dark: {
154
- background: { primary: '#1C1C1A', secondary: '#141412', tertiary: '#262622' },
155
- text: { primary: '#F0EDE6', secondary: '#B0ABA3', tertiary: '#8E8C88' },
156
- border: { primary: '#333330', secondary: '#2A2A28' },
157
- },
158
- } as const;
159
-
160
- // ── Canvas Node Colors ────────────────────────────────────────────────────────
161
-
162
- export const CANVAS_COLORS = {
163
- node: {
164
- border: '#FFFFFF',
165
- titleColor: '#1e1b4b',
166
- badgeBackground: '#FFC107',
167
- badgeStroke: '#fcd34d',
168
- },
169
- } as const;
170
-
171
- // ── Spacing ───────────────────────────────────────────────────────────────────
172
-
173
- export const SPACING = {
174
- xs: 4,
175
- sm: 8,
176
- md: 16,
177
- lg: 24,
178
- xl: 32,
179
- '2xl': 48,
180
- '3xl': 64,
181
- '4xl': 96,
182
- } as const;
183
-
184
- export const LAYOUT_SPACING = {
185
- nodeSpacing: 200,
186
- levelSpacing: 150,
187
- containerPadding: 20,
188
- gridSize: 50,
189
- } as const;
190
-
191
- // ── Typography ────────────────────────────────────────────────────────────────
192
-
193
- export const FONTS = {
194
- primary: "'Inter', sans-serif",
195
- secondary: "'Poppins', sans-serif",
196
- mono: "'Roboto Mono', monospace",
197
- } as const;
198
-
199
- export const FONT_SIZES = {
200
- xs: '0.75rem',
201
- sm: '0.875rem',
202
- base: '1rem',
203
- lg: '1.125rem',
204
- xl: '1.25rem',
205
- '2xl': '1.5rem',
206
- '3xl': '1.875rem',
207
- '4xl': '2.25rem',
208
- } as const;
209
-
210
- // ── Helpers ───────────────────────────────────────────────────────────────────
211
-
212
- /** Get a level color, cycling back to level 0 for levels > 8. */
213
- export function getColorForLevel(level: number): string {
214
- return LEVEL_COLOR_ARRAY[level % LEVEL_COLOR_ARRAY.length];
215
- }
216
-
217
- /**
218
- * Darken a hex color by reducing HSL lightness.
219
- * Returns a monochromatic darker version — used for border/stroke colors.
220
- * Falls back to the original string if parsing fails.
221
- */
222
- export function darkenHexColor(hex: string, amount: number = 0.22): string {
223
- if (!hex || !hex.startsWith('#')) return hex;
224
- let r: number, g: number, b: number;
225
- if (hex.length === 4) {
226
- r = parseInt(hex[1] + hex[1], 16);
227
- g = parseInt(hex[2] + hex[2], 16);
228
- b = parseInt(hex[3] + hex[3], 16);
229
- } else if (hex.length === 7) {
230
- r = parseInt(hex.slice(1, 3), 16);
231
- g = parseInt(hex.slice(3, 5), 16);
232
- b = parseInt(hex.slice(5, 7), 16);
233
- } else {
234
- return hex;
235
- }
236
- if (isNaN(r) || isNaN(g) || isNaN(b)) return hex;
237
- const rn = r / 255, gn = g / 255, bn = b / 255;
238
- const cmax = Math.max(rn, gn, bn), cmin = Math.min(rn, gn, bn);
239
- const d = cmax - cmin;
240
- const l = (cmax + cmin) / 2;
241
- const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
242
- let h = 0;
243
- if (d !== 0) {
244
- const seg = cmax === rn ? (gn - bn) / d : cmax === gn ? (bn - rn) / d + 2 : (rn - gn) / d + 4;
245
- h = ((seg * 60) + 360) % 360;
246
- }
247
- const newL = Math.max(0, l - amount);
248
- const c2 = (1 - Math.abs(2 * newL - 1)) * s;
249
- const x2 = c2 * (1 - Math.abs(((h / 60) % 2) - 1));
250
- const m2 = newL - c2 / 2;
251
- let r1 = 0, g1 = 0, b1 = 0;
252
- if (h < 60) { r1 = c2; g1 = x2; b1 = 0; }
253
- else if (h < 120) { r1 = x2; g1 = c2; b1 = 0; }
254
- else if (h < 180) { r1 = 0; g1 = c2; b1 = x2; }
255
- else if (h < 240) { r1 = 0; g1 = x2; b1 = c2; }
256
- else if (h < 300) { r1 = x2; g1 = 0; b1 = c2; }
257
- else { r1 = c2; g1 = 0; b1 = x2; }
258
- const toHex = (v: number) => Math.round((v + m2) * 255).toString(16).padStart(2, '0');
259
- return `#${toHex(r1)}${toHex(g1)}${toHex(b1)}`;
260
- }
261
-
262
- export function getThemeBackground(
263
- isDark: boolean,
264
- variant: 'primary' | 'secondary' | 'tertiary' = 'primary',
265
- ): string {
266
- return isDark ? THEME_COLORS.dark.background[variant] : THEME_COLORS.light.background[variant];
267
- }
268
-
269
- export function getThemeText(
270
- isDark: boolean,
271
- variant: 'primary' | 'secondary' | 'tertiary' = 'primary',
272
- ): string {
273
- return isDark ? THEME_COLORS.dark.text[variant] : THEME_COLORS.light.text[variant];
274
- }
275
-
276
- export function getThemeBorder(
277
- isDark: boolean,
278
- variant: 'primary' | 'secondary' = 'primary',
279
- ): string {
280
- return isDark ? THEME_COLORS.dark.border[variant] : THEME_COLORS.light.border[variant];
281
- }
File without changes