@unocss/preset-wind3 66.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @unocss/preset-wind
2
+
3
+ Tailwind / Windi CSS compact preset for [UnoCSS](https://github.com/unocss/unocss).
4
+
5
+ ## Documentation
6
+
7
+ Please refer to the [documentation](https://unocss.dev/presets/wind).
8
+
9
+ ## License
10
+
11
+ MIT License &copy; 2021-PRESENT [Anthony Fu](https://github.com/antfu)
package/colors.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/rules'
@@ -0,0 +1,2 @@
1
+ export * from '@unocss/preset-mini/colors';
2
+ import '@unocss/rule-utils';
@@ -0,0 +1,2 @@
1
+ export * from '@unocss/preset-mini/colors';
2
+ import '@unocss/rule-utils';
@@ -0,0 +1 @@
1
+ export * from '@unocss/preset-mini/colors';
@@ -0,0 +1,33 @@
1
+ import * as _unocss_core from '@unocss/core';
2
+ import { Variant } from '@unocss/core';
3
+ import * as _unocss_preset_mini from '@unocss/preset-mini';
4
+ import { Theme, PresetMiniOptions } from '@unocss/preset-mini';
5
+ export { Theme, colors, preflights } from '@unocss/preset-mini';
6
+ export { shortcuts } from './shortcuts.mjs';
7
+ export { theme } from './theme.mjs';
8
+ export { r as rules } from './shared/preset-wind3.DRADYSMV.mjs';
9
+
10
+ declare function variants(options: PresetWind3Options): Variant<Theme>[];
11
+
12
+ interface PresetWind3Options extends PresetMiniOptions {
13
+ /**
14
+ * The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
15
+ *
16
+ * This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
17
+ *
18
+ * You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
19
+ *
20
+ * Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
21
+ *
22
+ * @default false
23
+ */
24
+ important?: boolean | string;
25
+ }
26
+ /**
27
+ * The Tailwind CSS v3 / Windi CSS compact preset for UnoCSS.
28
+ *
29
+ * @see https://unocss.dev/presets/wind
30
+ */
31
+ declare const presetWind3: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWind3Options>;
32
+
33
+ export { type PresetWind3Options, presetWind3 as default, presetWind3 as presetWind, presetWind3, variants };
@@ -0,0 +1,33 @@
1
+ import * as _unocss_core from '@unocss/core';
2
+ import { Variant } from '@unocss/core';
3
+ import * as _unocss_preset_mini from '@unocss/preset-mini';
4
+ import { Theme, PresetMiniOptions } from '@unocss/preset-mini';
5
+ export { Theme, colors, preflights } from '@unocss/preset-mini';
6
+ export { shortcuts } from './shortcuts.js';
7
+ export { theme } from './theme.js';
8
+ export { r as rules } from './shared/preset-wind3.DRADYSMV.js';
9
+
10
+ declare function variants(options: PresetWind3Options): Variant<Theme>[];
11
+
12
+ interface PresetWind3Options extends PresetMiniOptions {
13
+ /**
14
+ * The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
15
+ *
16
+ * This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
17
+ *
18
+ * You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
19
+ *
20
+ * Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
21
+ *
22
+ * @default false
23
+ */
24
+ important?: boolean | string;
25
+ }
26
+ /**
27
+ * The Tailwind CSS v3 / Windi CSS compact preset for UnoCSS.
28
+ *
29
+ * @see https://unocss.dev/presets/wind
30
+ */
31
+ declare const presetWind3: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWind3Options>;
32
+
33
+ export { type PresetWind3Options, presetWind3 as default, presetWind3 as presetWind, presetWind3, variants };
package/dist/index.mjs ADDED
@@ -0,0 +1,59 @@
1
+ import { toArray, definePreset } from '@unocss/core';
2
+ import presetMini, { presetMini as presetMini$1 } from '@unocss/preset-mini';
3
+ export { colors, preflights } from '@unocss/preset-mini';
4
+ import { shortcuts } from './shortcuts.mjs';
5
+ import { theme } from './theme.mjs';
6
+ import { b as variants } from './shared/preset-wind3.DIaVUBWk.mjs';
7
+ import { r as rules } from './shared/preset-wind3.C-c8jDe5.mjs';
8
+ import './shared/preset-wind3.BzmnsdqZ.mjs';
9
+ import '@unocss/preset-mini/utils';
10
+ import '@unocss/preset-mini/rules';
11
+ import '@unocss/preset-mini/theme';
12
+ import './shared/preset-wind3.DjKJQ_OR.mjs';
13
+ import '@unocss/preset-mini/variants';
14
+ import '@unocss/rule-utils';
15
+
16
+ function important(option) {
17
+ if (option == null || option === false)
18
+ return [];
19
+ const wrapWithIs = (selector) => {
20
+ if (selector.startsWith(":is(") && selector.endsWith(")"))
21
+ return selector;
22
+ if (selector.includes("::"))
23
+ return selector.replace(/(.*?)((?:\s\*)?::.*)/, ":is($1)$2");
24
+ return `:is(${selector})`;
25
+ };
26
+ return [
27
+ option === true ? (util) => {
28
+ util.entries.forEach((i) => {
29
+ if (i[1] != null && !String(i[1]).endsWith("!important"))
30
+ i[1] += " !important";
31
+ });
32
+ } : (util) => {
33
+ if (!util.selector.startsWith(option))
34
+ util.selector = `${option} ${wrapWithIs(util.selector)}`;
35
+ }
36
+ ];
37
+ }
38
+
39
+ function postprocessors(options) {
40
+ return [
41
+ ...toArray(presetMini(options).postprocess),
42
+ ...important(options.important)
43
+ ];
44
+ }
45
+
46
+ const presetWind3 = definePreset((options = {}) => {
47
+ options.important = options.important ?? false;
48
+ return {
49
+ ...presetMini$1(options),
50
+ name: "@unocss/preset-wind3",
51
+ theme,
52
+ rules,
53
+ shortcuts,
54
+ variants: variants(options),
55
+ postprocess: postprocessors(options)
56
+ };
57
+ });
58
+
59
+ export { presetWind3 as default, presetWind3 as presetWind, presetWind3, rules, shortcuts, theme, variants };
@@ -0,0 +1,95 @@
1
+ import { Rule, Shortcut } from '@unocss/core';
2
+ import { Theme } from '@unocss/preset-mini';
3
+ export { r as rules } from './shared/preset-wind3.DRADYSMV.mjs';
4
+
5
+ declare const animations: Rule<Theme>[];
6
+
7
+ declare const backgroundStyles: Rule[];
8
+
9
+ declare const listStyle: Rule[];
10
+ declare const accents: Rule[];
11
+ declare const carets: Rule[];
12
+ declare const imageRenderings: Rule[];
13
+ declare const overscrolls: Rule[];
14
+ declare const scrollBehaviors: Rule[];
15
+
16
+ declare const columns: Rule[];
17
+
18
+ declare const container: Rule<Theme>[];
19
+ declare const containerShortcuts: Shortcut<Theme>[];
20
+
21
+ declare const divides: Rule[];
22
+
23
+ declare const filterBase: {
24
+ '--un-blur': string;
25
+ '--un-brightness': string;
26
+ '--un-contrast': string;
27
+ '--un-drop-shadow': string;
28
+ '--un-grayscale': string;
29
+ '--un-hue-rotate': string;
30
+ '--un-invert': string;
31
+ '--un-saturate': string;
32
+ '--un-sepia': string;
33
+ };
34
+ declare const backdropFilterBase: {
35
+ '--un-backdrop-blur': string;
36
+ '--un-backdrop-brightness': string;
37
+ '--un-backdrop-contrast': string;
38
+ '--un-backdrop-grayscale': string;
39
+ '--un-backdrop-hue-rotate': string;
40
+ '--un-backdrop-invert': string;
41
+ '--un-backdrop-opacity': string;
42
+ '--un-backdrop-saturate': string;
43
+ '--un-backdrop-sepia': string;
44
+ };
45
+ declare const filters: Rule<Theme>[];
46
+
47
+ declare const lineClamps: Rule[];
48
+
49
+ declare const placeholders: Rule[];
50
+
51
+ declare const scrollSnapTypeBase: {
52
+ '--un-scroll-snap-strictness': string;
53
+ };
54
+ declare const scrolls: Rule[];
55
+
56
+ declare const spaces: Rule[];
57
+
58
+ declare const textTransforms: Rule[];
59
+ declare const hyphens: Rule[];
60
+ declare const writingModes: Rule[];
61
+ declare const writingOrientations: Rule[];
62
+ declare const screenReadersAccess: Rule[];
63
+ declare const isolations: Rule[];
64
+ declare const objectPositions: Rule[];
65
+ declare const backgroundBlendModes: Rule[];
66
+ declare const mixBlendModes: Rule[];
67
+ declare const dynamicViewportHeight: Rule[];
68
+
69
+ declare const borderSpacingBase: {
70
+ '--un-border-spacing-x': number;
71
+ '--un-border-spacing-y': number;
72
+ };
73
+ declare const tables: Rule<Theme>[];
74
+
75
+ declare const touchActionBase: {
76
+ '--un-pan-x': string;
77
+ '--un-pan-y': string;
78
+ '--un-pinch-zoom': string;
79
+ };
80
+ declare const touchActions: Rule[];
81
+
82
+ declare const fontVariantNumericBase: {
83
+ '--un-ordinal': string;
84
+ '--un-slashed-zero': string;
85
+ '--un-numeric-figure': string;
86
+ '--un-numeric-spacing': string;
87
+ '--un-numeric-fraction': string;
88
+ };
89
+ declare const fontVariantNumeric: Rule[];
90
+
91
+ declare const cssVariables: Rule[];
92
+
93
+ declare const viewTransition: Rule[];
94
+
95
+ export { accents, animations, backdropFilterBase, backgroundBlendModes, backgroundStyles, borderSpacingBase, carets, columns, container, containerShortcuts, cssVariables, divides, dynamicViewportHeight, filterBase, filters, fontVariantNumeric, fontVariantNumericBase, hyphens, imageRenderings, isolations, lineClamps, listStyle, mixBlendModes, objectPositions, overscrolls, placeholders, screenReadersAccess, scrollBehaviors, scrollSnapTypeBase, scrolls, spaces, tables, textTransforms, touchActionBase, touchActions, viewTransition, writingModes, writingOrientations };
@@ -0,0 +1,95 @@
1
+ import { Rule, Shortcut } from '@unocss/core';
2
+ import { Theme } from '@unocss/preset-mini';
3
+ export { r as rules } from './shared/preset-wind3.DRADYSMV.js';
4
+
5
+ declare const animations: Rule<Theme>[];
6
+
7
+ declare const backgroundStyles: Rule[];
8
+
9
+ declare const listStyle: Rule[];
10
+ declare const accents: Rule[];
11
+ declare const carets: Rule[];
12
+ declare const imageRenderings: Rule[];
13
+ declare const overscrolls: Rule[];
14
+ declare const scrollBehaviors: Rule[];
15
+
16
+ declare const columns: Rule[];
17
+
18
+ declare const container: Rule<Theme>[];
19
+ declare const containerShortcuts: Shortcut<Theme>[];
20
+
21
+ declare const divides: Rule[];
22
+
23
+ declare const filterBase: {
24
+ '--un-blur': string;
25
+ '--un-brightness': string;
26
+ '--un-contrast': string;
27
+ '--un-drop-shadow': string;
28
+ '--un-grayscale': string;
29
+ '--un-hue-rotate': string;
30
+ '--un-invert': string;
31
+ '--un-saturate': string;
32
+ '--un-sepia': string;
33
+ };
34
+ declare const backdropFilterBase: {
35
+ '--un-backdrop-blur': string;
36
+ '--un-backdrop-brightness': string;
37
+ '--un-backdrop-contrast': string;
38
+ '--un-backdrop-grayscale': string;
39
+ '--un-backdrop-hue-rotate': string;
40
+ '--un-backdrop-invert': string;
41
+ '--un-backdrop-opacity': string;
42
+ '--un-backdrop-saturate': string;
43
+ '--un-backdrop-sepia': string;
44
+ };
45
+ declare const filters: Rule<Theme>[];
46
+
47
+ declare const lineClamps: Rule[];
48
+
49
+ declare const placeholders: Rule[];
50
+
51
+ declare const scrollSnapTypeBase: {
52
+ '--un-scroll-snap-strictness': string;
53
+ };
54
+ declare const scrolls: Rule[];
55
+
56
+ declare const spaces: Rule[];
57
+
58
+ declare const textTransforms: Rule[];
59
+ declare const hyphens: Rule[];
60
+ declare const writingModes: Rule[];
61
+ declare const writingOrientations: Rule[];
62
+ declare const screenReadersAccess: Rule[];
63
+ declare const isolations: Rule[];
64
+ declare const objectPositions: Rule[];
65
+ declare const backgroundBlendModes: Rule[];
66
+ declare const mixBlendModes: Rule[];
67
+ declare const dynamicViewportHeight: Rule[];
68
+
69
+ declare const borderSpacingBase: {
70
+ '--un-border-spacing-x': number;
71
+ '--un-border-spacing-y': number;
72
+ };
73
+ declare const tables: Rule<Theme>[];
74
+
75
+ declare const touchActionBase: {
76
+ '--un-pan-x': string;
77
+ '--un-pan-y': string;
78
+ '--un-pinch-zoom': string;
79
+ };
80
+ declare const touchActions: Rule[];
81
+
82
+ declare const fontVariantNumericBase: {
83
+ '--un-ordinal': string;
84
+ '--un-slashed-zero': string;
85
+ '--un-numeric-figure': string;
86
+ '--un-numeric-spacing': string;
87
+ '--un-numeric-fraction': string;
88
+ };
89
+ declare const fontVariantNumeric: Rule[];
90
+
91
+ declare const cssVariables: Rule[];
92
+
93
+ declare const viewTransition: Rule[];
94
+
95
+ export { accents, animations, backdropFilterBase, backgroundBlendModes, backgroundStyles, borderSpacingBase, carets, columns, container, containerShortcuts, cssVariables, divides, dynamicViewportHeight, filterBase, filters, fontVariantNumeric, fontVariantNumericBase, hyphens, imageRenderings, isolations, lineClamps, listStyle, mixBlendModes, objectPositions, overscrolls, placeholders, screenReadersAccess, scrollBehaviors, scrollSnapTypeBase, scrolls, spaces, tables, textTransforms, touchActionBase, touchActions, viewTransition, writingModes, writingOrientations };
package/dist/rules.mjs ADDED
@@ -0,0 +1,7 @@
1
+ export { c as accents, a as animations, u as backgroundBlendModes, b as backgroundStyles, d as carets, e as columns, y as cssVariables, f as divides, x as dynamicViewportHeight, j as hyphens, i as imageRenderings, n as isolations, g as lineClamps, l as listStyle, v as mixBlendModes, q as objectPositions, o as overscrolls, p as placeholders, r as rules, m as screenReadersAccess, s as scrollBehaviors, h as spaces, t as textTransforms, z as viewTransition, w as writingModes, k as writingOrientations } from './shared/preset-wind3.C-c8jDe5.mjs';
2
+ export { c as container, a as containerShortcuts } from './shared/preset-wind3.BzmnsdqZ.mjs';
3
+ export { b as backdropFilterBase, d as borderSpacingBase, f as filterBase, a as filters, i as fontVariantNumeric, h as fontVariantNumericBase, s as scrollSnapTypeBase, c as scrolls, t as tables, e as touchActionBase, g as touchActions } from './shared/preset-wind3.DjKJQ_OR.mjs';
4
+ import '@unocss/preset-mini/rules';
5
+ import '@unocss/preset-mini/utils';
6
+ import '@unocss/rule-utils';
7
+ import '@unocss/core';
@@ -0,0 +1,67 @@
1
+ import { isString } from '@unocss/core';
2
+ import { resolveBreakpoints } from '@unocss/preset-mini/utils';
3
+
4
+ const queryMatcher = /@media \(min-width: (.+)\)/;
5
+ const container = [
6
+ [
7
+ /^__container$/,
8
+ (m, context) => {
9
+ const { theme, variantHandlers } = context;
10
+ const themePadding = theme.container?.padding;
11
+ let padding;
12
+ if (isString(themePadding))
13
+ padding = themePadding;
14
+ else
15
+ padding = themePadding?.DEFAULT;
16
+ const themeMaxWidth = theme.container?.maxWidth;
17
+ let maxWidth;
18
+ for (const v of variantHandlers) {
19
+ const query = v.handle?.({}, (x) => x)?.parent;
20
+ if (isString(query)) {
21
+ const match = query.match(queryMatcher)?.[1];
22
+ if (match) {
23
+ const bp = resolveBreakpoints(context) ?? [];
24
+ const matchBp = bp.find((i) => i.size === match)?.point;
25
+ if (!themeMaxWidth)
26
+ maxWidth = match;
27
+ else if (matchBp)
28
+ maxWidth = themeMaxWidth?.[matchBp];
29
+ if (matchBp && !isString(themePadding))
30
+ padding = themePadding?.[matchBp] ?? padding;
31
+ }
32
+ }
33
+ }
34
+ const css = {
35
+ "max-width": maxWidth
36
+ };
37
+ if (!variantHandlers.length)
38
+ css.width = "100%";
39
+ if (theme.container?.center) {
40
+ css["margin-left"] = "auto";
41
+ css["margin-right"] = "auto";
42
+ }
43
+ if (themePadding) {
44
+ css["padding-left"] = padding;
45
+ css["padding-right"] = padding;
46
+ }
47
+ return css;
48
+ },
49
+ { internal: true }
50
+ ]
51
+ ];
52
+ const containerShortcuts = [
53
+ [/^(?:(\w+)[:-])?container$/, ([, bp], context) => {
54
+ let points = (resolveBreakpoints(context) ?? []).map((i) => i.point);
55
+ if (bp) {
56
+ if (!points.includes(bp))
57
+ return;
58
+ points = points.slice(points.indexOf(bp));
59
+ }
60
+ const shortcuts = points.map((p) => `${p}:__container`);
61
+ if (!bp)
62
+ shortcuts.unshift("__container");
63
+ return shortcuts;
64
+ }]
65
+ ];
66
+
67
+ export { containerShortcuts as a, container as c };