fluid-tailwind
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -200,3 +200,3 @@ "use strict"; | ||
return; | ||
console.warn(import_picocolors.default.bold(type), "-", import_picocolors.default.bold(code) + ":", message); | ||
console.warn(import_picocolors.default.bold(type), "-", message); | ||
} | ||
@@ -225,3 +225,4 @@ var warn = (code, message) => log(import_picocolors.default.yellow("warn"), code, message); | ||
"bp-not-found": (key, name) => `Could not find \`theme.${key}.${name}\``, | ||
"no-utility": () => "Fluid variants can only be used with fluid utilities" | ||
"no-utility": () => "Fluid variants can only be used with fluid utilities", | ||
"fails-sc-144": (failingBp) => `Fails WCAG SC 1.4.4 at i.e. ${failingBp.cssText}` | ||
}; | ||
@@ -405,3 +406,4 @@ var FluidError = class extends Error { | ||
error("no-change", start); | ||
let comment = `/* fluid from ${start.cssText} at ${startBP.cssText} to ${end.cssText} at ${endBP.cssText}${atContainer ? " (container)" : ""} */`; | ||
const comment = (code, ...args) => `/* ${code ? "not " : ""}fluid from ${start.cssText} at ${startBP.cssText} to ${end.cssText} at ${endBP.cssText}${atContainer ? " (container)" : ""}${// @ts-expect-error | ||
code ? ": " + codes[code](...args) : ""} */`; | ||
if (startBP.number === 0) { | ||
@@ -412,15 +414,9 @@ startBP.unit = endBP.unit; | ||
} else if (!startBP.unit || startBP.unit !== endBP.unit) { | ||
if (checkBP) | ||
error("mismatched-bp-units", startBP, endBP); | ||
return comment; | ||
return (checkBP ? error : comment)("mismatched-bp-units", startBP, endBP); | ||
} | ||
if (startBP.number === endBP.number) { | ||
if (checkBP) | ||
error("no-change-bp", startBP); | ||
return comment; | ||
return (checkBP ? error : comment)("no-change-bp", startBP); | ||
} | ||
if (start.unit !== startBP.unit) { | ||
if (checkBP) | ||
error("mismatched-bp-val-units"); | ||
return comment; | ||
return (checkBP ? error : comment)("mismatched-bp-val-units"); | ||
} | ||
@@ -438,3 +434,2 @@ const p = Math.max( | ||
const intercept = start.number - startBP.number * slope; | ||
let failingBP = null; | ||
if (checkSC144) { | ||
@@ -444,10 +439,7 @@ const zoom1 = (vw) => clamp(start.number, intercept + slope * vw, end.number); | ||
if (5 * start.number < 2 * zoom1(5 * startBP.number)) | ||
failingBP = new Length(startBP.number * 5, startBP.unit); | ||
return comment("fails-sc-144", new Length(startBP.number * 5, startBP.unit)); | ||
else if (zoom5(endBP.number) < 2 * end.number) | ||
failingBP = endBP; | ||
return comment("fails-sc-144", endBP); | ||
} | ||
comment = `/* ${failingBP ? "not " : ""}fluid from ${start.cssText} at ${startBP.cssText} to ${end.cssText} at ${endBP.cssText}${atContainer ? " (container)" : ""}${checkSC144 ? "; " + (failingBP ? "fails WCAG SC 1.4.4 at i.e. " + failingBP.cssText : "passes WCAG SC 1.4.4") : ""} */`; | ||
if (failingBP) | ||
return comment; | ||
return `clamp(${min},${toPrecision(intercept, p)}${unit} + ${toPrecision(slope * 100, p)}${atContainer ? "cqw" : "vw"},${max})${comment}`; | ||
return `clamp(${min},${toPrecision(intercept, p)}${unit} + ${toPrecision(slope * 100, p)}${atContainer ? "cqw" : "vw"},${max})${comment()}`; | ||
}; | ||
@@ -454,0 +446,0 @@ var rewrite = (container, context, [startBP, endBP], atContainer) => { |
import { Length } from './css'; | ||
declare const codes: { | ||
export declare const codes: { | ||
'missing-start': () => string; | ||
@@ -11,3 +11,3 @@ 'missing-end': () => string; | ||
'non-length-end-bp': (bp: string) => string; | ||
'sort-mismatched-bp-units': (key: any) => string; | ||
'sort-mismatched-bp-units': (key: string) => string; | ||
'mismatched-bp-units': (start: Length, end: Length) => string; | ||
@@ -20,2 +20,3 @@ 'mismatched-bp-val-units': () => string; | ||
'no-utility': () => string; | ||
'fails-sc-144': (failingBp: Length) => string; | ||
}; | ||
@@ -28,2 +29,1 @@ export declare class FluidError extends Error { | ||
export declare function error<C extends keyof typeof codes>(code: C, ...args: Parameters<(typeof codes)[C]>): never; | ||
export {}; |
{ | ||
"name": "fluid-tailwind", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.mjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59829
1686