skillui 1.1.2 → 1.1.4
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/README.md +20 -15
- package/dist/cli.js +105073 -194
- package/package.json +15 -6
- package/dist/cli.d.ts +0 -3
- package/dist/extractors/components.d.ts +0 -11
- package/dist/extractors/components.js +0 -455
- package/dist/extractors/framework.d.ts +0 -4
- package/dist/extractors/framework.js +0 -126
- package/dist/extractors/tokens/computed.d.ts +0 -7
- package/dist/extractors/tokens/computed.js +0 -249
- package/dist/extractors/tokens/css.d.ts +0 -3
- package/dist/extractors/tokens/css.js +0 -510
- package/dist/extractors/tokens/http-css.d.ts +0 -14
- package/dist/extractors/tokens/http-css.js +0 -1689
- package/dist/extractors/tokens/tailwind.d.ts +0 -3
- package/dist/extractors/tokens/tailwind.js +0 -353
- package/dist/extractors/tokens/tokens-file.d.ts +0 -3
- package/dist/extractors/tokens/tokens-file.js +0 -229
- package/dist/extractors/ultra/animations.d.ts +0 -21
- package/dist/extractors/ultra/animations.js +0 -527
- package/dist/extractors/ultra/components-dom.d.ts +0 -13
- package/dist/extractors/ultra/components-dom.js +0 -149
- package/dist/extractors/ultra/interactions.d.ts +0 -14
- package/dist/extractors/ultra/interactions.js +0 -222
- package/dist/extractors/ultra/layout.d.ts +0 -14
- package/dist/extractors/ultra/layout.js +0 -123
- package/dist/extractors/ultra/pages.d.ts +0 -16
- package/dist/extractors/ultra/pages.js +0 -228
- package/dist/font-resolver.d.ts +0 -10
- package/dist/font-resolver.js +0 -280
- package/dist/modes/dir.d.ts +0 -6
- package/dist/modes/dir.js +0 -213
- package/dist/modes/repo.d.ts +0 -6
- package/dist/modes/repo.js +0 -76
- package/dist/modes/ultra.d.ts +0 -22
- package/dist/modes/ultra.js +0 -281
- package/dist/modes/url.d.ts +0 -14
- package/dist/modes/url.js +0 -161
- package/dist/normalizer.d.ts +0 -11
- package/dist/normalizer.js +0 -867
- package/dist/playwright-loader.d.ts +0 -10
- package/dist/playwright-loader.js +0 -71
- package/dist/screenshot.d.ts +0 -9
- package/dist/screenshot.js +0 -94
- package/dist/types-ultra.d.ts +0 -157
- package/dist/types-ultra.js +0 -4
- package/dist/types.d.ts +0 -182
- package/dist/types.js +0 -4
- package/dist/writers/animations-md.d.ts +0 -17
- package/dist/writers/animations-md.js +0 -313
- package/dist/writers/components-md.d.ts +0 -8
- package/dist/writers/components-md.js +0 -151
- package/dist/writers/design-md.d.ts +0 -7
- package/dist/writers/design-md.js +0 -704
- package/dist/writers/interactions-md.d.ts +0 -8
- package/dist/writers/interactions-md.js +0 -146
- package/dist/writers/layout-md.d.ts +0 -8
- package/dist/writers/layout-md.js +0 -120
- package/dist/writers/skill.d.ts +0 -12
- package/dist/writers/skill.js +0 -1006
- package/dist/writers/tokens-json.d.ts +0 -11
- package/dist/writers/tokens-json.js +0 -164
package/dist/modes/url.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runUrlMode = runUrlMode;
|
|
4
|
-
const computed_1 = require("../extractors/tokens/computed");
|
|
5
|
-
const http_css_1 = require("../extractors/tokens/http-css");
|
|
6
|
-
const normalizer_1 = require("../normalizer");
|
|
7
|
-
const screenshot_1 = require("../screenshot");
|
|
8
|
-
/**
|
|
9
|
-
* URL mode: crawl a live website and extract design tokens.
|
|
10
|
-
*
|
|
11
|
-
* Strategy:
|
|
12
|
-
* 1. ALWAYS fetch HTML + linked CSS via HTTP (no Playwright needed)
|
|
13
|
-
* 2. If Playwright is available, ALSO extract computed styles from live DOM
|
|
14
|
-
* 3. Merge both token sets for maximum coverage
|
|
15
|
-
*/
|
|
16
|
-
async function runUrlMode(url, nameOverride, skillDir) {
|
|
17
|
-
const projectName = nameOverride || deriveUrlName(url);
|
|
18
|
-
// Step 1: HTTP-based extraction (always works, no Playwright)
|
|
19
|
-
process.stdout.write(' Fetching CSS...');
|
|
20
|
-
const httpResult = await (0, http_css_1.extractHttpCSSTokens)(url, 5);
|
|
21
|
-
const httpTokens = httpResult.tokens;
|
|
22
|
-
const httpComponents = httpResult.components;
|
|
23
|
-
const httpColorCount = httpTokens.colors.length;
|
|
24
|
-
const httpFontCount = httpTokens.fonts.length;
|
|
25
|
-
console.log(` \u2713 (${httpColorCount} colors, ${httpFontCount} fonts from CSS)`);
|
|
26
|
-
// Step 2: Try Playwright for computed styles (optional enhancement)
|
|
27
|
-
let computedTokens = null;
|
|
28
|
-
let hasPlaywright = false;
|
|
29
|
-
try {
|
|
30
|
-
require.resolve('playwright');
|
|
31
|
-
hasPlaywright = true;
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Playwright not installed
|
|
35
|
-
}
|
|
36
|
-
if (hasPlaywright) {
|
|
37
|
-
process.stdout.write(' Crawling DOM...');
|
|
38
|
-
try {
|
|
39
|
-
computedTokens = await (0, computed_1.extractComputedTokens)(url, 3);
|
|
40
|
-
const compColorCount = computedTokens.colors.length;
|
|
41
|
-
console.log(` \u2713 (${compColorCount} computed colors)`);
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
console.log(' \u2717 (Playwright extraction failed, using CSS-only)');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
console.log(' (Playwright not installed — using CSS-only extraction)');
|
|
49
|
-
console.log(' Tip: npm install playwright && npx playwright install chromium');
|
|
50
|
-
}
|
|
51
|
-
// Step 3: Merge HTTP + computed tokens
|
|
52
|
-
const merged = mergeUrlTokens(httpTokens, computedTokens);
|
|
53
|
-
// Step 4: Normalize into a design profile
|
|
54
|
-
const profile = (0, normalizer_1.normalize)(projectName, [], merged, httpComponents, {
|
|
55
|
-
iconLibrary: null,
|
|
56
|
-
stateLibrary: null,
|
|
57
|
-
animationLibrary: null,
|
|
58
|
-
});
|
|
59
|
-
// Attach URL metadata to profile
|
|
60
|
-
profile.siteUrl = url;
|
|
61
|
-
profile.favicon = merged.favicon || null;
|
|
62
|
-
// Step 5: Capture screenshot (best-effort, non-blocking)
|
|
63
|
-
let screenshotPath = null;
|
|
64
|
-
if (skillDir) {
|
|
65
|
-
process.stdout.write(' Capturing screenshot...');
|
|
66
|
-
screenshotPath = await (0, screenshot_1.captureScreenshot)(url, skillDir);
|
|
67
|
-
console.log(screenshotPath ? ' ✓' : ' (skipped)');
|
|
68
|
-
}
|
|
69
|
-
return { profile, screenshotPath };
|
|
70
|
-
}
|
|
71
|
-
function mergeUrlTokens(http, computed) {
|
|
72
|
-
if (!computed)
|
|
73
|
-
return http;
|
|
74
|
-
const merged = {
|
|
75
|
-
colors: [...http.colors],
|
|
76
|
-
fonts: [...http.fonts],
|
|
77
|
-
spacingValues: [...http.spacingValues, ...computed.spacingValues],
|
|
78
|
-
shadows: [...http.shadows],
|
|
79
|
-
cssVariables: [...http.cssVariables],
|
|
80
|
-
breakpoints: [...http.breakpoints],
|
|
81
|
-
borderRadii: [...http.borderRadii],
|
|
82
|
-
gradients: [...http.gradients],
|
|
83
|
-
fontVarMap: { ...http.fontVarMap },
|
|
84
|
-
animations: [...http.animations],
|
|
85
|
-
darkModeVars: [...http.darkModeVars],
|
|
86
|
-
zIndexValues: [...(http.zIndexValues || [])],
|
|
87
|
-
containerMaxWidth: http.containerMaxWidth || computed.containerMaxWidth || null,
|
|
88
|
-
fontSources: [...(http.fontSources || [])],
|
|
89
|
-
pageSections: [...(http.pageSections || [])],
|
|
90
|
-
transitionDurations: [...(http.transitionDurations || [])],
|
|
91
|
-
transitionEasings: [...(http.transitionEasings || [])],
|
|
92
|
-
favicon: http.favicon || computed.favicon || null,
|
|
93
|
-
siteTitle: http.siteTitle || computed.siteTitle || null,
|
|
94
|
-
};
|
|
95
|
-
// Merge computed colors
|
|
96
|
-
for (const color of computed.colors) {
|
|
97
|
-
const existing = merged.colors.find(c => c.value === color.value);
|
|
98
|
-
if (existing) {
|
|
99
|
-
existing.frequency += color.frequency;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
merged.colors.push({ ...color });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// Merge computed fonts (computed styles are more authoritative for actual rendering)
|
|
106
|
-
for (const font of computed.fonts) {
|
|
107
|
-
if (font.family && !merged.fonts.find(f => f.family === font.family)) {
|
|
108
|
-
merged.fonts.push({ ...font });
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// Merge shadows
|
|
112
|
-
for (const shadow of computed.shadows) {
|
|
113
|
-
if (!merged.shadows.find(s => s.value === shadow.value)) {
|
|
114
|
-
merged.shadows.push({ ...shadow });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Merge CSS variables
|
|
118
|
-
for (const v of computed.cssVariables) {
|
|
119
|
-
if (!merged.cssVariables.find(cv => cv.name === v.name)) {
|
|
120
|
-
merged.cssVariables.push({ ...v });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Merge border radii
|
|
124
|
-
for (const r of (computed.borderRadii || [])) {
|
|
125
|
-
if (!merged.borderRadii.includes(r)) {
|
|
126
|
-
merged.borderRadii.push(r);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Merge breakpoints
|
|
130
|
-
for (const bp of computed.breakpoints) {
|
|
131
|
-
if (!merged.breakpoints.find(b => b.value === bp.value)) {
|
|
132
|
-
merged.breakpoints.push({ ...bp });
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Merge font sources
|
|
136
|
-
for (const fs of (computed.fontSources || [])) {
|
|
137
|
-
if (!merged.fontSources.find(f => f.family === fs.family && f.src === fs.src)) {
|
|
138
|
-
merged.fontSources.push(fs);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Merge transition data
|
|
142
|
-
for (const d of (computed.transitionDurations || [])) {
|
|
143
|
-
if (!merged.transitionDurations.includes(d))
|
|
144
|
-
merged.transitionDurations.push(d);
|
|
145
|
-
}
|
|
146
|
-
for (const e of (computed.transitionEasings || [])) {
|
|
147
|
-
if (!merged.transitionEasings.includes(e))
|
|
148
|
-
merged.transitionEasings.push(e);
|
|
149
|
-
}
|
|
150
|
-
return merged;
|
|
151
|
-
}
|
|
152
|
-
function deriveUrlName(url) {
|
|
153
|
-
try {
|
|
154
|
-
const hostname = new URL(url).hostname;
|
|
155
|
-
return hostname.replace(/^www\./, '').split('.')[0];
|
|
156
|
-
}
|
|
157
|
-
catch {
|
|
158
|
-
return 'website';
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=url.js.map
|
package/dist/normalizer.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DesignProfile, RawTokens, Framework, ComponentInfo } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Normalize raw extracted tokens into a clean DesignProfile.
|
|
4
|
-
* Pure deterministic logic — no AI, no inference beyond rule-based heuristics.
|
|
5
|
-
*/
|
|
6
|
-
export declare function normalize(projectName: string, frameworks: Framework[], rawTokens: RawTokens, components: ComponentInfo[], libraries?: {
|
|
7
|
-
iconLibrary: string | null;
|
|
8
|
-
stateLibrary: string | null;
|
|
9
|
-
animationLibrary: string | null;
|
|
10
|
-
}): DesignProfile;
|
|
11
|
-
//# sourceMappingURL=normalizer.d.ts.map
|