🐛 部分依赖优化 Cloudflare构建优化
This commit is contained in:
parent
886fcfde70
commit
ef224f1326
|
|
@ -4,6 +4,5 @@ const breakpoints = {
|
||||||
'lg': '1024px',
|
'lg': '1024px',
|
||||||
'xl': '1280px',
|
'xl': '1280px',
|
||||||
'2xl': '1536px',
|
'2xl': '1536px',
|
||||||
'hidden-logo': '1736px',
|
|
||||||
};
|
};
|
||||||
export default breakpoints;
|
export default breakpoints;
|
||||||
|
|
|
||||||
11
package.json
11
package.json
|
|
@ -33,7 +33,7 @@
|
||||||
"vue-router": "^4.5.1",
|
"vue-router": "^4.5.1",
|
||||||
"word-count": "^0.3.1"
|
"word-count": "^0.3.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.18.0",
|
"packageManager": "pnpm@10.22.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/clarity": "^1.2.4",
|
"@iconify-json/clarity": "^1.2.4",
|
||||||
"@iconify-json/codicon": "^1.2.32",
|
"@iconify-json/codicon": "^1.2.32",
|
||||||
|
|
@ -50,5 +50,14 @@
|
||||||
"overlayscrollbars": "^2.12.0",
|
"overlayscrollbars": "^2.12.0",
|
||||||
"typescript-eslint": "^8.44.1",
|
"typescript-eslint": "^8.44.1",
|
||||||
"vue-eslint-parser": "^10.2.0"
|
"vue-eslint-parser": "^10.2.0"
|
||||||
|
},
|
||||||
|
"pnpm": {
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@parcel/watcher",
|
||||||
|
"better-sqlite3",
|
||||||
|
"esbuild",
|
||||||
|
"unrs-resolver",
|
||||||
|
"vue-demi"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
// tailwind config file
|
|
||||||
import plugin from 'tailwindcss/plugin';
|
|
||||||
import tailwindScrollbar from 'tailwind-scrollbar';
|
|
||||||
import breakpoints from '~/configs/breakpoints';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
mode: 'jit',
|
|
||||||
darkMode: 'class',
|
|
||||||
theme: {
|
|
||||||
screens: breakpoints,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
plugin(function ({ addUtilities }) {
|
|
||||||
addUtilities({
|
|
||||||
'.scrollbar-hide': {
|
|
||||||
/* IE and Edge */
|
|
||||||
'-ms-overflow-style': 'none',
|
|
||||||
|
|
||||||
/* Firefox */
|
|
||||||
'scrollbar-width': 'none',
|
|
||||||
|
|
||||||
/* Safari and Chrome */
|
|
||||||
'&::-webkit-scrollbar': {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
tailwindScrollbar,
|
|
||||||
],
|
|
||||||
content: [
|
|
||||||
'./app.vue',
|
|
||||||
'./components/**/*.{vue,js,ts}',
|
|
||||||
'./layouts/**/*.vue',
|
|
||||||
'./pages/**/*.vue',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
@ -4,6 +4,9 @@ export function rgbToHsl(rgb: number[]) {
|
||||||
throw new Error('Input must be an array of three numbers representing RGB values.');
|
throw new Error('Input must be an array of three numbers representing RGB values.');
|
||||||
}
|
}
|
||||||
let [r, g, b] = rgb;
|
let [r, g, b] = rgb;
|
||||||
|
r = r!;
|
||||||
|
b = b!;
|
||||||
|
g = g!;
|
||||||
r /= 255;
|
r /= 255;
|
||||||
g /= 255;
|
g /= 255;
|
||||||
b /= 255;
|
b /= 255;
|
||||||
|
|
@ -36,6 +39,9 @@ export function hslToRgb(hsl: number[]) {
|
||||||
throw new Error('Input must be an array of three numbers representing HSL values.');
|
throw new Error('Input must be an array of three numbers representing HSL values.');
|
||||||
}
|
}
|
||||||
let [h, s, l] = hsl;
|
let [h, s, l] = hsl;
|
||||||
|
h = h!;
|
||||||
|
s = s!;
|
||||||
|
l = l!;
|
||||||
h /= 360;
|
h /= 360;
|
||||||
s /= 100;
|
s /= 100;
|
||||||
l /= 100;
|
l /= 100;
|
||||||
|
|
@ -65,16 +71,16 @@ export function toRGBArray(color: string): number[] {
|
||||||
// 处理 rgb/rgba
|
// 处理 rgb/rgba
|
||||||
const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/);
|
const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/);
|
||||||
if (rgbMatch) {
|
if (rgbMatch) {
|
||||||
return [parseInt(rgbMatch[1]), parseInt(rgbMatch[2]), parseInt(rgbMatch[3])];
|
return [parseInt(rgbMatch[1]!), parseInt(rgbMatch[2]!), parseInt(rgbMatch[3]!)];
|
||||||
}
|
}
|
||||||
// 处理 #fff 或 #ffffff
|
// 处理 #fff 或 #ffffff
|
||||||
const hexMatch = color.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
const hexMatch = color.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
||||||
if (hexMatch) {
|
if (hexMatch) {
|
||||||
let hex = hexMatch[1];
|
let hex = hexMatch[1];
|
||||||
if (hex.length === 3) {
|
if (hex!.length === 3) {
|
||||||
hex = hex.split('').map((x) => x + x).join('');
|
hex = hex!.split('').map((x) => x + x).join('');
|
||||||
}
|
}
|
||||||
const num = parseInt(hex, 16);
|
const num = parseInt(hex!, 16);
|
||||||
return [
|
return [
|
||||||
(num >> 16) & 255,
|
(num >> 16) & 255,
|
||||||
(num >> 8) & 255,
|
(num >> 8) & 255,
|
||||||
|
|
@ -97,14 +103,14 @@ export function toHexString(rgb: number[]): string {
|
||||||
|
|
||||||
export function toLightColor(rgb: number[]): number[] {
|
export function toLightColor(rgb: number[]): number[] {
|
||||||
const hsl = rgbToHsl(rgb);
|
const hsl = rgbToHsl(rgb);
|
||||||
if (hsl[2] < 50)
|
if (hsl[2]! < 50)
|
||||||
hsl[2] = hsl[2] / 5 + 50; // 增加亮度
|
hsl[2] = hsl[2]! / 5 + 50; // 增加亮度
|
||||||
return hslToRgb(hsl);
|
return hslToRgb(hsl);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toDarkColor(rgb: number[]): number[] {
|
export function toDarkColor(rgb: number[]): number[] {
|
||||||
const hsl = rgbToHsl(rgb);
|
const hsl = rgbToHsl(rgb);
|
||||||
if (hsl[2] > 50)
|
if (hsl[2]! > 50)
|
||||||
hsl[2] = 50 - (hsl[2] - 50) / 5; // 减少亮度
|
hsl[2] = 50 - (hsl[2]! - 50) / 5; // 减少亮度
|
||||||
return hslToRgb(hsl);
|
return hslToRgb(hsl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue