@buoy-design/core 0.1.1 → 0.1.3
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/dist/analysis/audit.d.ts +47 -0
- package/dist/analysis/audit.d.ts.map +1 -0
- package/dist/analysis/audit.js +168 -0
- package/dist/analysis/audit.js.map +1 -0
- package/dist/analysis/index.d.ts +1 -0
- package/dist/analysis/index.d.ts.map +1 -1
- package/dist/analysis/index.js +2 -0
- package/dist/analysis/index.js.map +1 -1
- package/dist/analysis/semantic-diff.d.ts +15 -0
- package/dist/analysis/semantic-diff.d.ts.map +1 -1
- package/dist/analysis/semantic-diff.js +204 -1
- package/dist/analysis/semantic-diff.js.map +1 -1
- package/dist/analysis/token-suggestions.d.ts +8 -1
- package/dist/analysis/token-suggestions.d.ts.map +1 -1
- package/dist/analysis/token-suggestions.js +116 -10
- package/dist/analysis/token-suggestions.js.map +1 -1
- package/dist/extraction/css-parser.d.ts +51 -0
- package/dist/extraction/css-parser.d.ts.map +1 -0
- package/dist/extraction/css-parser.js +303 -0
- package/dist/extraction/css-parser.js.map +1 -0
- package/dist/extraction/index.d.ts +2 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +2 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/graph/builder.d.ts +118 -0
- package/dist/graph/builder.d.ts.map +1 -0
- package/dist/graph/builder.js +328 -0
- package/dist/graph/builder.js.map +1 -0
- package/dist/graph/collectors/git.d.ts +90 -0
- package/dist/graph/collectors/git.d.ts.map +1 -0
- package/dist/graph/collectors/git.js +253 -0
- package/dist/graph/collectors/git.js.map +1 -0
- package/dist/graph/collectors/imports.d.ts +55 -0
- package/dist/graph/collectors/imports.d.ts.map +1 -0
- package/dist/graph/collectors/imports.js +230 -0
- package/dist/graph/collectors/imports.js.map +1 -0
- package/dist/graph/collectors/index.d.ts +9 -0
- package/dist/graph/collectors/index.d.ts.map +1 -0
- package/dist/graph/collectors/index.js +12 -0
- package/dist/graph/collectors/index.js.map +1 -0
- package/dist/graph/collectors/usages.d.ts +68 -0
- package/dist/graph/collectors/usages.d.ts.map +1 -0
- package/dist/graph/collectors/usages.js +244 -0
- package/dist/graph/collectors/usages.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +29 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/queries.d.ts +81 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +379 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/types.d.ts +184 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +8 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/models/drift.d.ts +20 -4
- package/dist/models/drift.d.ts.map +1 -1
- package/dist/models/drift.js +55 -1
- package/dist/models/drift.js.map +1 -1
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/token.d.ts +57 -0
- package/dist/models/token.d.ts.map +1 -1
- package/dist/models/token.js +9 -0
- package/dist/models/token.js.map +1 -1
- package/dist/tokenization/generator.d.ts +49 -0
- package/dist/tokenization/generator.d.ts.map +1 -0
- package/dist/tokenization/generator.js +886 -0
- package/dist/tokenization/generator.js.map +1 -0
- package/dist/tokenization/index.d.ts +2 -0
- package/dist/tokenization/index.d.ts.map +1 -0
- package/dist/tokenization/index.js +2 -0
- package/dist/tokenization/index.js.map +1 -0
- package/dist/tokens/comparison.d.ts +30 -0
- package/dist/tokens/comparison.d.ts.map +1 -0
- package/dist/tokens/comparison.js +142 -0
- package/dist/tokens/comparison.js.map +1 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +5 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/parser.d.ts +11 -0
- package/dist/tokens/parser.d.ts.map +1 -0
- package/dist/tokens/parser.js +268 -0
- package/dist/tokens/parser.js.map +1 -0
- package/package.json +14 -10
- package/LICENSE +0 -21
- package/dist/analysis/semantic-diff.test.d.ts +0 -2
- package/dist/analysis/semantic-diff.test.d.ts.map +0 -1
- package/dist/analysis/semantic-diff.test.js +0 -188
- package/dist/analysis/semantic-diff.test.js.map +0 -1
- package/dist/models/component.test.d.ts +0 -2
- package/dist/models/component.test.d.ts.map +0 -1
- package/dist/models/component.test.js +0 -55
- package/dist/models/component.test.js.map +0 -1
- package/dist/models/drift.test.d.ts +0 -2
- package/dist/models/drift.test.d.ts.map +0 -1
- package/dist/models/drift.test.js +0 -38
- package/dist/models/drift.test.js.map +0 -1
- package/dist/models/token.test.d.ts +0 -2
- package/dist/models/token.test.d.ts.map +0 -1
- package/dist/models/token.test.js +0 -168
- package/dist/models/token.test.js.map +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Value Parser
|
|
3
|
+
* Extracts design values (colors, spacing, fonts, radii) from CSS text.
|
|
4
|
+
* Framework-agnostic - works on any CSS string.
|
|
5
|
+
*/
|
|
6
|
+
// CSS color keywords (subset of most common)
|
|
7
|
+
const CSS_COLORS = new Set([
|
|
8
|
+
'transparent', 'currentcolor', 'inherit',
|
|
9
|
+
'black', 'white', 'red', 'green', 'blue', 'yellow', 'orange', 'purple',
|
|
10
|
+
'pink', 'brown', 'gray', 'grey', 'cyan', 'magenta', 'lime', 'maroon',
|
|
11
|
+
'navy', 'olive', 'teal', 'aqua', 'fuchsia', 'silver',
|
|
12
|
+
]);
|
|
13
|
+
// Properties that accept color values
|
|
14
|
+
const COLOR_PROPERTIES = new Set([
|
|
15
|
+
'color', 'background', 'background-color', 'border-color',
|
|
16
|
+
'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',
|
|
17
|
+
'outline-color', 'text-decoration-color', 'fill', 'stroke',
|
|
18
|
+
'box-shadow', 'text-shadow', 'caret-color', 'accent-color',
|
|
19
|
+
]);
|
|
20
|
+
// Properties for actual spacing (padding, margin, gap)
|
|
21
|
+
const SPACING_PROPERTIES = new Set([
|
|
22
|
+
'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left',
|
|
23
|
+
'margin-block', 'margin-inline', 'margin-block-start', 'margin-block-end',
|
|
24
|
+
'margin-inline-start', 'margin-inline-end',
|
|
25
|
+
'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
|
|
26
|
+
'padding-block', 'padding-inline', 'padding-block-start', 'padding-block-end',
|
|
27
|
+
'padding-inline-start', 'padding-inline-end',
|
|
28
|
+
'gap', 'row-gap', 'column-gap', 'grid-gap',
|
|
29
|
+
]);
|
|
30
|
+
// Properties for sizing (width, height)
|
|
31
|
+
const SIZING_PROPERTIES = new Set([
|
|
32
|
+
'width', 'height', 'min-width', 'max-width', 'min-height', 'max-height',
|
|
33
|
+
'flex-basis', 'block-size', 'inline-size',
|
|
34
|
+
]);
|
|
35
|
+
// Properties for positioning
|
|
36
|
+
const POSITION_PROPERTIES = new Set([
|
|
37
|
+
'top', 'right', 'bottom', 'left',
|
|
38
|
+
'inset', 'inset-block', 'inset-inline',
|
|
39
|
+
'inset-block-start', 'inset-block-end', 'inset-inline-start', 'inset-inline-end',
|
|
40
|
+
]);
|
|
41
|
+
// Properties for font sizes
|
|
42
|
+
const FONT_SIZE_PROPERTIES = new Set(['font-size', 'line-height']);
|
|
43
|
+
// Properties for border radius
|
|
44
|
+
const RADIUS_PROPERTIES = new Set([
|
|
45
|
+
'border-radius',
|
|
46
|
+
'border-top-left-radius', 'border-top-right-radius',
|
|
47
|
+
'border-bottom-left-radius', 'border-bottom-right-radius',
|
|
48
|
+
]);
|
|
49
|
+
/**
|
|
50
|
+
* Parse CSS text and extract design values
|
|
51
|
+
*/
|
|
52
|
+
export function parseCssValues(cssText) {
|
|
53
|
+
const values = [];
|
|
54
|
+
const errors = [];
|
|
55
|
+
// Extract breakpoints from media queries
|
|
56
|
+
const breakpoints = extractMediaQueryBreakpoints(cssText);
|
|
57
|
+
values.push(...breakpoints);
|
|
58
|
+
// Match property: value pairs
|
|
59
|
+
const propertyRegex = /([a-z-]+)\s*:\s*([^;{}]+)/gi;
|
|
60
|
+
let match;
|
|
61
|
+
while ((match = propertyRegex.exec(cssText)) !== null) {
|
|
62
|
+
const property = match[1]?.toLowerCase().trim();
|
|
63
|
+
const rawValue = match[2]?.trim();
|
|
64
|
+
if (!property || !rawValue)
|
|
65
|
+
continue;
|
|
66
|
+
// Skip CSS variables and calc expressions for now
|
|
67
|
+
if (rawValue.startsWith('var(') || rawValue.startsWith('calc(')) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const { category, context } = categorizeProperty(property);
|
|
71
|
+
if (category === 'other')
|
|
72
|
+
continue;
|
|
73
|
+
// For color properties, extract color values
|
|
74
|
+
if (category === 'color') {
|
|
75
|
+
const colors = extractColorValues(rawValue);
|
|
76
|
+
for (const color of colors) {
|
|
77
|
+
values.push({
|
|
78
|
+
property,
|
|
79
|
+
value: color,
|
|
80
|
+
rawValue,
|
|
81
|
+
category: 'color',
|
|
82
|
+
context: 'color',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// For spacing/sizing/font-size/radius, extract numeric values
|
|
87
|
+
else {
|
|
88
|
+
const numerics = extractNumericValues(rawValue);
|
|
89
|
+
for (const numeric of numerics) {
|
|
90
|
+
values.push({
|
|
91
|
+
property,
|
|
92
|
+
value: numeric,
|
|
93
|
+
rawValue,
|
|
94
|
+
category,
|
|
95
|
+
context,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { values, errors };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Extract breakpoint values from @media queries
|
|
104
|
+
*/
|
|
105
|
+
function extractMediaQueryBreakpoints(cssText) {
|
|
106
|
+
const breakpoints = [];
|
|
107
|
+
// Match @media queries with width conditions
|
|
108
|
+
// Matches: @media (min-width: 768px), @media screen and (max-width: 1024px), etc.
|
|
109
|
+
const mediaQueryRegex = /@media[^{]*\{/gi;
|
|
110
|
+
let match;
|
|
111
|
+
while ((match = mediaQueryRegex.exec(cssText)) !== null) {
|
|
112
|
+
const mediaQuery = match[0];
|
|
113
|
+
// Extract min-width values
|
|
114
|
+
const minWidthRegex = /min-width\s*:\s*(\d+(?:\.\d+)?)(px|rem|em)/gi;
|
|
115
|
+
let widthMatch;
|
|
116
|
+
while ((widthMatch = minWidthRegex.exec(mediaQuery)) !== null) {
|
|
117
|
+
const num = widthMatch[1];
|
|
118
|
+
const unit = widthMatch[2];
|
|
119
|
+
if (!num || !unit)
|
|
120
|
+
continue;
|
|
121
|
+
const value = num + unit.toLowerCase();
|
|
122
|
+
breakpoints.push({
|
|
123
|
+
property: 'min-width',
|
|
124
|
+
value,
|
|
125
|
+
rawValue: mediaQuery.trim(),
|
|
126
|
+
category: 'breakpoint',
|
|
127
|
+
context: 'breakpoint',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Extract max-width values
|
|
131
|
+
const maxWidthRegex = /max-width\s*:\s*(\d+(?:\.\d+)?)(px|rem|em)/gi;
|
|
132
|
+
while ((widthMatch = maxWidthRegex.exec(mediaQuery)) !== null) {
|
|
133
|
+
const num = widthMatch[1];
|
|
134
|
+
const unit = widthMatch[2];
|
|
135
|
+
if (!num || !unit)
|
|
136
|
+
continue;
|
|
137
|
+
const value = num + unit.toLowerCase();
|
|
138
|
+
breakpoints.push({
|
|
139
|
+
property: 'max-width',
|
|
140
|
+
value,
|
|
141
|
+
rawValue: mediaQuery.trim(),
|
|
142
|
+
category: 'breakpoint',
|
|
143
|
+
context: 'breakpoint',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return breakpoints;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Categorize a CSS property by type and context
|
|
151
|
+
*/
|
|
152
|
+
function categorizeProperty(property) {
|
|
153
|
+
if (COLOR_PROPERTIES.has(property)) {
|
|
154
|
+
return { category: 'color', context: 'color' };
|
|
155
|
+
}
|
|
156
|
+
if (SPACING_PROPERTIES.has(property)) {
|
|
157
|
+
return { category: 'spacing', context: 'spacing' };
|
|
158
|
+
}
|
|
159
|
+
if (SIZING_PROPERTIES.has(property)) {
|
|
160
|
+
return { category: 'sizing', context: 'sizing' };
|
|
161
|
+
}
|
|
162
|
+
if (POSITION_PROPERTIES.has(property)) {
|
|
163
|
+
return { category: 'spacing', context: 'position' };
|
|
164
|
+
}
|
|
165
|
+
if (FONT_SIZE_PROPERTIES.has(property)) {
|
|
166
|
+
return { category: 'font-size', context: 'typography' };
|
|
167
|
+
}
|
|
168
|
+
if (RADIUS_PROPERTIES.has(property)) {
|
|
169
|
+
return { category: 'radius', context: 'radius' };
|
|
170
|
+
}
|
|
171
|
+
if (property === 'font-family') {
|
|
172
|
+
return { category: 'font-family', context: 'typography' };
|
|
173
|
+
}
|
|
174
|
+
return { category: 'other', context: 'other' };
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Extract color values from a CSS value string
|
|
178
|
+
*/
|
|
179
|
+
function extractColorValues(value) {
|
|
180
|
+
const colors = [];
|
|
181
|
+
// Hex colors: #rgb, #rrggbb, #rrggbbaa
|
|
182
|
+
const hexRegex = /#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})\b/gi;
|
|
183
|
+
let match;
|
|
184
|
+
while ((match = hexRegex.exec(value)) !== null) {
|
|
185
|
+
colors.push(match[0].toLowerCase());
|
|
186
|
+
}
|
|
187
|
+
// RGB/RGBA
|
|
188
|
+
const rgbRegex = /rgba?\s*\([^)]+\)/gi;
|
|
189
|
+
while ((match = rgbRegex.exec(value)) !== null) {
|
|
190
|
+
colors.push(normalizeRgb(match[0]));
|
|
191
|
+
}
|
|
192
|
+
// HSL/HSLA
|
|
193
|
+
const hslRegex = /hsla?\s*\([^)]+\)/gi;
|
|
194
|
+
while ((match = hslRegex.exec(value)) !== null) {
|
|
195
|
+
colors.push(match[0].toLowerCase());
|
|
196
|
+
}
|
|
197
|
+
// OKLCH
|
|
198
|
+
const oklchRegex = /oklch\s*\([^)]+\)/gi;
|
|
199
|
+
while ((match = oklchRegex.exec(value)) !== null) {
|
|
200
|
+
colors.push(match[0].toLowerCase());
|
|
201
|
+
}
|
|
202
|
+
// Named colors (only if no other colors found)
|
|
203
|
+
if (colors.length === 0) {
|
|
204
|
+
const words = value.toLowerCase().split(/\s+/);
|
|
205
|
+
for (const word of words) {
|
|
206
|
+
if (CSS_COLORS.has(word)) {
|
|
207
|
+
colors.push(word);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return colors;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Extract numeric values with units from a CSS value string
|
|
215
|
+
*/
|
|
216
|
+
function extractNumericValues(value) {
|
|
217
|
+
const numerics = [];
|
|
218
|
+
// Match numbers with units: 16px, 1.5rem, 0.5em, etc.
|
|
219
|
+
const numericRegex = /(-?\d*\.?\d+)(px|rem|em|%|vh|vw|ch|ex|vmin|vmax)\b/gi;
|
|
220
|
+
let match;
|
|
221
|
+
while ((match = numericRegex.exec(value)) !== null) {
|
|
222
|
+
numerics.push(match[0].toLowerCase());
|
|
223
|
+
}
|
|
224
|
+
// Also match unitless 0
|
|
225
|
+
if (/\b0\b/.test(value) && numerics.length === 0) {
|
|
226
|
+
numerics.push('0');
|
|
227
|
+
}
|
|
228
|
+
return numerics;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Normalize RGB color format
|
|
232
|
+
*/
|
|
233
|
+
function normalizeRgb(rgb) {
|
|
234
|
+
return rgb.toLowerCase().replace(/\s+/g, '');
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Normalize a hex color to 6-digit format
|
|
238
|
+
*/
|
|
239
|
+
export function normalizeHexColor(hex) {
|
|
240
|
+
hex = hex.toLowerCase();
|
|
241
|
+
if (hex.length === 4) {
|
|
242
|
+
// #rgb → #rrggbb
|
|
243
|
+
return `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`;
|
|
244
|
+
}
|
|
245
|
+
return hex;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Convert hex to RGB values
|
|
249
|
+
*/
|
|
250
|
+
export function hexToRgb(hex) {
|
|
251
|
+
hex = normalizeHexColor(hex).replace('#', '');
|
|
252
|
+
if (hex.length !== 6)
|
|
253
|
+
return null;
|
|
254
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
255
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
256
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
257
|
+
return { r, g, b };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Parse a spacing value to pixels (approximate for rem/em)
|
|
261
|
+
*/
|
|
262
|
+
export function spacingToPx(value, baseFontSize = 16) {
|
|
263
|
+
const match = value.match(/^(-?\d*\.?\d+)(px|rem|em)?$/i);
|
|
264
|
+
if (!match || !match[1])
|
|
265
|
+
return null;
|
|
266
|
+
const num = parseFloat(match[1]);
|
|
267
|
+
const unit = (match[2] ?? 'px').toLowerCase();
|
|
268
|
+
switch (unit) {
|
|
269
|
+
case 'px':
|
|
270
|
+
return num;
|
|
271
|
+
case 'rem':
|
|
272
|
+
case 'em':
|
|
273
|
+
return num * baseFontSize;
|
|
274
|
+
default:
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Group extracted values by category
|
|
280
|
+
*/
|
|
281
|
+
export function groupByCategory(values) {
|
|
282
|
+
const grouped = {};
|
|
283
|
+
for (const value of values) {
|
|
284
|
+
const category = value.category;
|
|
285
|
+
if (!grouped[category]) {
|
|
286
|
+
grouped[category] = [];
|
|
287
|
+
}
|
|
288
|
+
grouped[category].push(value);
|
|
289
|
+
}
|
|
290
|
+
return grouped;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Count occurrences of each unique value
|
|
294
|
+
*/
|
|
295
|
+
export function countOccurrences(values) {
|
|
296
|
+
const counts = new Map();
|
|
297
|
+
for (const v of values) {
|
|
298
|
+
const key = `${v.category}:${v.value}`;
|
|
299
|
+
counts.set(key, (counts.get(key) || 0) + 1);
|
|
300
|
+
}
|
|
301
|
+
return counts;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=css-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-parser.js","sourceRoot":"","sources":["../../src/extraction/css-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+BH,6CAA6C;AAC7C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,aAAa,EAAE,cAAc,EAAE,SAAS;IACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACtE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ;IACpE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ;CACrD,CAAC,CAAC;AAEH,sCAAsC;AACtC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc;IACzD,kBAAkB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB;IACpF,eAAe,EAAE,uBAAuB,EAAE,MAAM,EAAE,QAAQ;IAC1D,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc;CAC3D,CAAC,CAAC;AAEH,uDAAuD;AACvD,MAAM,kBAAkB,GAAG,IAAI,GAAG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AAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph Builder
|
|
3
|
+
*
|
|
4
|
+
* Constructs the design system knowledge graph from SQLite data.
|
|
5
|
+
* Uses graphology for in-memory graph operations.
|
|
6
|
+
*/
|
|
7
|
+
import type { AbstractGraph } from 'graphology-types';
|
|
8
|
+
import type { NodeType, EdgeType, NodeAttributes, EdgeAttributes, GraphBuildOptions, GraphStats } from './types.js';
|
|
9
|
+
export type DesignSystemGraph = AbstractGraph<NodeAttributes, EdgeAttributes>;
|
|
10
|
+
/**
|
|
11
|
+
* Create an empty directed multigraph for the design system
|
|
12
|
+
*/
|
|
13
|
+
export declare function createGraph(): DesignSystemGraph;
|
|
14
|
+
/**
|
|
15
|
+
* Generate a unique node ID
|
|
16
|
+
*/
|
|
17
|
+
export declare function nodeId(type: NodeType, id: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate a unique edge ID
|
|
20
|
+
*/
|
|
21
|
+
export declare function edgeId(type: EdgeType, sourceId: string, targetId: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Add a node to the graph if it doesn't exist
|
|
24
|
+
*/
|
|
25
|
+
export declare function addNode(graph: DesignSystemGraph, type: NodeType, id: string, attributes: Omit<NodeAttributes, 'type'>): string;
|
|
26
|
+
/**
|
|
27
|
+
* Update node attributes
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateNode(graph: DesignSystemGraph, nid: string, attributes: Partial<NodeAttributes>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get all nodes of a specific type
|
|
32
|
+
*/
|
|
33
|
+
export declare function getNodesByType(graph: DesignSystemGraph, type: NodeType): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Add an edge to the graph
|
|
36
|
+
*/
|
|
37
|
+
export declare function addEdge(graph: DesignSystemGraph, type: EdgeType, sourceId: string, targetId: string, attributes?: Omit<EdgeAttributes, 'type'>): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get all edges of a specific type
|
|
40
|
+
*/
|
|
41
|
+
export declare function getEdgesByType(graph: DesignSystemGraph, type: EdgeType): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all outgoing edges of a specific type from a node
|
|
44
|
+
*/
|
|
45
|
+
export declare function getOutEdgesByType(graph: DesignSystemGraph, nid: string, type: EdgeType): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Get all incoming edges of a specific type to a node
|
|
48
|
+
*/
|
|
49
|
+
export declare function getInEdgesByType(graph: DesignSystemGraph, nid: string, type: EdgeType): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Get statistics about the graph
|
|
52
|
+
*/
|
|
53
|
+
export declare function getGraphStats(graph: DesignSystemGraph): GraphStats;
|
|
54
|
+
/**
|
|
55
|
+
* Export graph to JSON format
|
|
56
|
+
*/
|
|
57
|
+
export declare function exportToJSON(graph: DesignSystemGraph): object;
|
|
58
|
+
/**
|
|
59
|
+
* Import graph from JSON format
|
|
60
|
+
*/
|
|
61
|
+
export declare function importFromJSON(data: ReturnType<DesignSystemGraph['export']>): DesignSystemGraph;
|
|
62
|
+
/**
|
|
63
|
+
* Export graph to DOT format for visualization
|
|
64
|
+
*/
|
|
65
|
+
export declare function exportToDOT(graph: DesignSystemGraph): string;
|
|
66
|
+
/**
|
|
67
|
+
* Export graph to Cytoscape format for web visualization
|
|
68
|
+
*/
|
|
69
|
+
export declare function exportToCytoscape(graph: DesignSystemGraph): object;
|
|
70
|
+
/**
|
|
71
|
+
* Builder class for constructing the graph incrementally
|
|
72
|
+
*/
|
|
73
|
+
export declare class GraphBuilder {
|
|
74
|
+
private graph;
|
|
75
|
+
readonly projectId: string;
|
|
76
|
+
constructor(options: GraphBuildOptions);
|
|
77
|
+
/**
|
|
78
|
+
* Add a token node
|
|
79
|
+
*/
|
|
80
|
+
addToken(id: string, name: string, category: string, value: string, source: string, isW3C?: boolean): string;
|
|
81
|
+
/**
|
|
82
|
+
* Add a component node
|
|
83
|
+
*/
|
|
84
|
+
addComponent(id: string, name: string, filePath: string, framework: string, props?: string[], variants?: string[]): string;
|
|
85
|
+
/**
|
|
86
|
+
* Add a file node
|
|
87
|
+
*/
|
|
88
|
+
addFile(id: string, path: string, lineCount?: number): string;
|
|
89
|
+
/**
|
|
90
|
+
* Add a commit node
|
|
91
|
+
*/
|
|
92
|
+
addCommit(sha: string, message: string, author: string, authorEmail: string | undefined, timestamp: Date): string;
|
|
93
|
+
/**
|
|
94
|
+
* Add a developer node
|
|
95
|
+
*/
|
|
96
|
+
addDeveloper(id: string, name: string, email: string, githubLogin?: string, commitCount?: number): string;
|
|
97
|
+
/**
|
|
98
|
+
* Add a PR node
|
|
99
|
+
*/
|
|
100
|
+
addPR(id: string, number: number, title: string, state: 'open' | 'closed' | 'merged', authorLogin?: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* Add a drift signal node
|
|
103
|
+
*/
|
|
104
|
+
addDriftSignal(id: string, driftType: string, severity: string, message: string, resolved?: boolean): string;
|
|
105
|
+
/**
|
|
106
|
+
* Add an edge between nodes
|
|
107
|
+
*/
|
|
108
|
+
addEdge(type: EdgeType, sourceId: string, targetId: string, attributes?: Omit<EdgeAttributes, 'type'>): string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Get the built graph
|
|
111
|
+
*/
|
|
112
|
+
build(): DesignSystemGraph;
|
|
113
|
+
/**
|
|
114
|
+
* Get graph statistics
|
|
115
|
+
*/
|
|
116
|
+
getStats(): GraphStats;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/graph/builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AAW9E;;GAEG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAM/C;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjF;AAMD;;GAEG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GACvC,MAAM,CAWR;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,OAAO,CAAC,cAAc,CAAC,GAClC,IAAI,CAIN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,QAAQ,GACb,MAAM,EAAE,CAIV;AAMD;;GAEG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,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