feature: vor und nachteile

This commit is contained in:
Hikyu
2026-05-31 13:54:31 +02:00
parent 552a947a1c
commit e3dad17446
23270 changed files with 3024794 additions and 200 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+11
View File
@@ -0,0 +1,11 @@
# @unocss/preset-uno
The default preset for [UnoCSS](https://github.com/unocss/unocss).
## Documentation
Please refer to the [documentation](https://unocss.dev/presets/uno).
## License
MIT License &copy; 2021-PRESENT [Anthony Fu](https://github.com/antfu)
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/preset-mini/colors';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/preset-mini/colors';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/preset-mini/colors';
+14
View File
@@ -0,0 +1,14 @@
import * as _unocss_core from '@unocss/core';
import { PresetMiniOptions, Theme } from '@unocss/preset-mini';
export { Theme } from '@unocss/preset-mini';
interface PresetUnoOptions extends PresetMiniOptions {
}
/**
* The default UnoCSS preset, provide Tailwind-like utilities with some additional features.
*
* @see https://unocss.dev/presets/uno
*/
declare const presetUno: _unocss_core.PresetFactory<Theme, PresetUnoOptions>;
export { type PresetUnoOptions, presetUno as default, presetUno };
+14
View File
@@ -0,0 +1,14 @@
import * as _unocss_core from '@unocss/core';
import { PresetMiniOptions, Theme } from '@unocss/preset-mini';
export { Theme } from '@unocss/preset-mini';
interface PresetUnoOptions extends PresetMiniOptions {
}
/**
* The default UnoCSS preset, provide Tailwind-like utilities with some additional features.
*
* @see https://unocss.dev/presets/uno
*/
declare const presetUno: _unocss_core.PresetFactory<Theme, PresetUnoOptions>;
export { type PresetUnoOptions, presetUno as default, presetUno };
+80
View File
@@ -0,0 +1,80 @@
import { definePreset } from '@unocss/core';
import { presetWind } from '@unocss/preset-wind';
import { parseCssColor, colorToString } from '@unocss/rule-utils';
function mixComponent(v1, v2, w) {
return `calc(${v2} + (${v1} - ${v2}) * ${w} / 100)`;
}
function mixColor(color1, color2, weight) {
const colors = [color1, color2];
const cssColors = [];
for (let c = 0; c < 2; c++) {
const color = typeof colors[c] === "string" ? parseCssColor(colors[c]) : colors[c];
if (!color || !["rgb", "rgba"].includes(color.type))
return;
cssColors.push(color);
}
const newComponents = [];
for (let x = 0; x < 3; x++)
newComponents.push(mixComponent(cssColors[0].components[x], cssColors[1].components[x], weight));
return {
type: "rgb",
components: newComponents,
alpha: mixComponent(cssColors[0].alpha ?? 1, cssColors[1].alpha ?? 1, weight)
};
}
function tint(color, weight) {
return mixColor("#fff", color, weight);
}
function shade(color, weight) {
return mixColor("#000", color, weight);
}
function shift(color, weight) {
const num = Number.parseFloat(`${weight}`);
if (!Number.isNaN(num))
return num > 0 ? shade(color, weight) : tint(color, -num);
}
const fns = { tint, shade, shift };
function variantColorMix() {
let re;
return {
name: "mix",
match(matcher, ctx) {
if (!re)
re = new RegExp(`^mix-(tint|shade|shift)-(-?\\d{1,3})(?:${ctx.generator.config.separators.join("|")})`);
const m = matcher.match(re);
if (m) {
return {
matcher: matcher.slice(m[0].length),
body: (body) => {
body.forEach((v) => {
if (v[1]) {
const color = parseCssColor(`${v[1]}`);
if (color) {
const mixed = fns[m[1]](color, m[2]);
if (mixed)
v[1] = colorToString(mixed);
}
}
});
return body;
}
};
}
}
};
}
const presetUno = definePreset((options = {}) => {
const wind = presetWind(options);
return {
...wind,
name: "@unocss/preset-uno",
variants: [
...wind.variants,
variantColorMix()
]
};
});
export { presetUno as default, presetUno };
+3
View File
@@ -0,0 +1,3 @@
export * from '@unocss/preset-mini/theme';
import '@unocss/rule-utils';
import '@unocss/preset-mini/colors';
+3
View File
@@ -0,0 +1,3 @@
export * from '@unocss/preset-mini/theme';
import '@unocss/rule-utils';
import '@unocss/preset-mini/colors';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/preset-mini/theme';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/rule-utils';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/rule-utils';
+1
View File
@@ -0,0 +1 @@
export * from '@unocss/rule-utils';
+68
View File
@@ -0,0 +1,68 @@
{
"name": "@unocss/preset-uno",
"type": "module",
"version": "0.65.4",
"description": "The default preset for UnoCSS",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
"funding": "https://github.com/sponsors/antfu",
"homepage": "https://github.com/unocss/unocss/tree/main/packages/preset-uno#readme",
"repository": {
"type": "git",
"url": "https://github.com/unocss/unocss",
"directory": "packages/preset-uno"
},
"bugs": {
"url": "https://github.com/unocss/unocss/issues"
},
"keywords": [
"unocss",
"unocss-preset"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"./theme": {
"types": "./dist/theme.d.mts",
"default": "./dist/theme.mjs"
},
"./colors": {
"types": "./dist/colors.d.mts",
"default": "./dist/colors.mjs"
},
"./utils": {
"types": "./dist/utils.d.mts",
"default": "./dist/utils.mjs"
},
"./*": "./*"
},
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"files": [
"*.css",
"dist"
],
"dependencies": {
"@unocss/core": "0.65.4",
"@unocss/preset-mini": "0.65.4",
"@unocss/preset-wind": "0.65.4",
"@unocss/rule-utils": "0.65.4"
},
"scripts": {
"build": "unbuild",
"stub": "unbuild --stub",
"test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
}
}