@webability/core 1.0.1 → 1.1.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.
- package/dist/index.cjs +566 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +561 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -161,4 +161,78 @@ declare function dismissModals(page: PageLike): Promise<void>;
|
|
|
161
161
|
|
|
162
162
|
declare function toHtmlReport(result: ScanResult): string;
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
type Framework = 'tailwind' | 'bootstrap' | 'mui' | 'plain-css';
|
|
165
|
+
interface FrameworkInfo {
|
|
166
|
+
framework: Framework;
|
|
167
|
+
version?: string;
|
|
168
|
+
confidence: number;
|
|
169
|
+
}
|
|
170
|
+
declare function detectFramework(page: PageLike): Promise<FrameworkInfo>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Contrast Solver — finds the nearest color that passes WCAG contrast requirements.
|
|
174
|
+
* Instead of picking a generic gray, it stays within the same hue family.
|
|
175
|
+
*/
|
|
176
|
+
interface ContrastSuggestion {
|
|
177
|
+
currentColor: string;
|
|
178
|
+
suggestedColor: string;
|
|
179
|
+
currentRatio: number;
|
|
180
|
+
suggestedRatio: number;
|
|
181
|
+
requiredRatio: number;
|
|
182
|
+
bgColor: string;
|
|
183
|
+
}
|
|
184
|
+
declare function getContrastRatio(fg: string, bg: string): number;
|
|
185
|
+
/**
|
|
186
|
+
* Find the nearest color in the same hue that passes the required contrast ratio.
|
|
187
|
+
* Darkens or lightens the color along its own hue axis.
|
|
188
|
+
*/
|
|
189
|
+
declare function solveContrast(fgHex: string, bgHex: string, requiredRatio?: number): ContrastSuggestion | null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Tailwind Mapper — maps hex colors to Tailwind class names
|
|
193
|
+
* and suggests the nearest passing Tailwind class for contrast issues.
|
|
194
|
+
*/
|
|
195
|
+
interface TailwindSuggestion {
|
|
196
|
+
currentClass: string | null;
|
|
197
|
+
suggestedClass: string;
|
|
198
|
+
currentHex: string;
|
|
199
|
+
suggestedHex: string;
|
|
200
|
+
currentRatio: number;
|
|
201
|
+
suggestedRatio: number;
|
|
202
|
+
requiredRatio: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Find the nearest Tailwind class that passes contrast requirements.
|
|
206
|
+
*/
|
|
207
|
+
declare function suggestTailwindFix(fgHex: string, bgHex: string, requiredRatio?: number, prefix?: string): TailwindSuggestion | null;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Developer Suggestions — transforms raw detector output into
|
|
211
|
+
* framework-aware, actionable guidance for developers.
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
interface DevSuggestion {
|
|
215
|
+
/** The original issue */
|
|
216
|
+
issue: ScanIssue;
|
|
217
|
+
/** Human-readable explanation of what's wrong */
|
|
218
|
+
problem: string;
|
|
219
|
+
/** Framework-aware fix suggestion */
|
|
220
|
+
fix: string;
|
|
221
|
+
/** What to change (before → after) */
|
|
222
|
+
before?: string;
|
|
223
|
+
after?: string;
|
|
224
|
+
/** Contrast data if applicable */
|
|
225
|
+
contrast?: {
|
|
226
|
+
current: number;
|
|
227
|
+
required: number;
|
|
228
|
+
suggested: number;
|
|
229
|
+
fgColor: string;
|
|
230
|
+
bgColor: string;
|
|
231
|
+
suggestedColor: string;
|
|
232
|
+
};
|
|
233
|
+
/** WCAG reference */
|
|
234
|
+
wcagLink: string;
|
|
235
|
+
}
|
|
236
|
+
declare function generateDevSuggestion(issue: ScanIssue, framework: Framework, elementClasses?: string, fgColor?: string, bgColor?: string): DevSuggestion;
|
|
237
|
+
|
|
238
|
+
export { type BrowserDetector, type ContrastSuggestion, type DetectedIssue, type DevSuggestion, type FixDetector, type FixIssueType, type Framework, type FrameworkInfo, type IssueImpact, type IssueSource, type PageLike, type ScanIssue, type ScanOptions, type ScanResult, type SiteTheme, type TailwindSuggestion, VIEWPORT_SIZES, type ViewportPreset, WCAG_BY_ISSUE, type WcagLevel, detectFramework, dismissModals, extractSiteTheme, generateDevSuggestion, getContrastRatio, runAxe, runDetectors, scan, solveContrast, suggestTailwindFix, toHtmlReport };
|
package/dist/index.d.ts
CHANGED
|
@@ -161,4 +161,78 @@ declare function dismissModals(page: PageLike): Promise<void>;
|
|
|
161
161
|
|
|
162
162
|
declare function toHtmlReport(result: ScanResult): string;
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
type Framework = 'tailwind' | 'bootstrap' | 'mui' | 'plain-css';
|
|
165
|
+
interface FrameworkInfo {
|
|
166
|
+
framework: Framework;
|
|
167
|
+
version?: string;
|
|
168
|
+
confidence: number;
|
|
169
|
+
}
|
|
170
|
+
declare function detectFramework(page: PageLike): Promise<FrameworkInfo>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Contrast Solver — finds the nearest color that passes WCAG contrast requirements.
|
|
174
|
+
* Instead of picking a generic gray, it stays within the same hue family.
|
|
175
|
+
*/
|
|
176
|
+
interface ContrastSuggestion {
|
|
177
|
+
currentColor: string;
|
|
178
|
+
suggestedColor: string;
|
|
179
|
+
currentRatio: number;
|
|
180
|
+
suggestedRatio: number;
|
|
181
|
+
requiredRatio: number;
|
|
182
|
+
bgColor: string;
|
|
183
|
+
}
|
|
184
|
+
declare function getContrastRatio(fg: string, bg: string): number;
|
|
185
|
+
/**
|
|
186
|
+
* Find the nearest color in the same hue that passes the required contrast ratio.
|
|
187
|
+
* Darkens or lightens the color along its own hue axis.
|
|
188
|
+
*/
|
|
189
|
+
declare function solveContrast(fgHex: string, bgHex: string, requiredRatio?: number): ContrastSuggestion | null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Tailwind Mapper — maps hex colors to Tailwind class names
|
|
193
|
+
* and suggests the nearest passing Tailwind class for contrast issues.
|
|
194
|
+
*/
|
|
195
|
+
interface TailwindSuggestion {
|
|
196
|
+
currentClass: string | null;
|
|
197
|
+
suggestedClass: string;
|
|
198
|
+
currentHex: string;
|
|
199
|
+
suggestedHex: string;
|
|
200
|
+
currentRatio: number;
|
|
201
|
+
suggestedRatio: number;
|
|
202
|
+
requiredRatio: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Find the nearest Tailwind class that passes contrast requirements.
|
|
206
|
+
*/
|
|
207
|
+
declare function suggestTailwindFix(fgHex: string, bgHex: string, requiredRatio?: number, prefix?: string): TailwindSuggestion | null;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Developer Suggestions — transforms raw detector output into
|
|
211
|
+
* framework-aware, actionable guidance for developers.
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
interface DevSuggestion {
|
|
215
|
+
/** The original issue */
|
|
216
|
+
issue: ScanIssue;
|
|
217
|
+
/** Human-readable explanation of what's wrong */
|
|
218
|
+
problem: string;
|
|
219
|
+
/** Framework-aware fix suggestion */
|
|
220
|
+
fix: string;
|
|
221
|
+
/** What to change (before → after) */
|
|
222
|
+
before?: string;
|
|
223
|
+
after?: string;
|
|
224
|
+
/** Contrast data if applicable */
|
|
225
|
+
contrast?: {
|
|
226
|
+
current: number;
|
|
227
|
+
required: number;
|
|
228
|
+
suggested: number;
|
|
229
|
+
fgColor: string;
|
|
230
|
+
bgColor: string;
|
|
231
|
+
suggestedColor: string;
|
|
232
|
+
};
|
|
233
|
+
/** WCAG reference */
|
|
234
|
+
wcagLink: string;
|
|
235
|
+
}
|
|
236
|
+
declare function generateDevSuggestion(issue: ScanIssue, framework: Framework, elementClasses?: string, fgColor?: string, bgColor?: string): DevSuggestion;
|
|
237
|
+
|
|
238
|
+
export { type BrowserDetector, type ContrastSuggestion, type DetectedIssue, type DevSuggestion, type FixDetector, type FixIssueType, type Framework, type FrameworkInfo, type IssueImpact, type IssueSource, type PageLike, type ScanIssue, type ScanOptions, type ScanResult, type SiteTheme, type TailwindSuggestion, VIEWPORT_SIZES, type ViewportPreset, WCAG_BY_ISSUE, type WcagLevel, detectFramework, dismissModals, extractSiteTheme, generateDevSuggestion, getContrastRatio, runAxe, runDetectors, scan, solveContrast, suggestTailwindFix, toHtmlReport };
|