@unocss/preset-wind 0.47.6 → 0.48.1

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 CHANGED
@@ -295,24 +295,40 @@ const queryMatcher = /@media \(min-width: (.+)\)/;
295
295
  const container = [
296
296
  [
297
297
  /^__container$/,
298
- (m, { theme, variantHandlers }) => {
298
+ (m, context) => {
299
+ const { theme, variantHandlers } = context;
299
300
  let width = "100%";
301
+ const themePadding = theme.container?.padding;
302
+ let padding;
303
+ if (typeof themePadding === "string")
304
+ padding = themePadding;
305
+ else
306
+ padding = themePadding?.DEFAULT;
300
307
  for (const v of variantHandlers) {
301
308
  const query = v.handle?.({}, (x) => x)?.parent;
302
309
  if (typeof query === "string") {
303
310
  const match = query.match(queryMatcher)?.[1];
304
- if (match)
311
+ if (match) {
305
312
  width = match;
313
+ const bp = utils.resolveBreakpoints(context) ?? {};
314
+ const matchBp = Object.keys(bp).find((key) => bp[key] === match);
315
+ if (matchBp && typeof themePadding !== "string")
316
+ padding = themePadding?.[matchBp] ?? padding;
317
+ }
306
318
  }
307
319
  }
320
+ const css = {
321
+ "max-width": width
322
+ };
308
323
  if (theme.container?.center) {
309
- return {
310
- "max-width": width,
311
- "margin-left": "auto",
312
- "margin-right": "auto"
313
- };
324
+ css["margin-left"] = "auto";
325
+ css["margin-right"] = "auto";
326
+ }
327
+ if (themePadding) {
328
+ css["padding-left"] = padding;
329
+ css["padding-right"] = padding;
314
330
  }
315
- return { "max-width": width };
331
+ return css;
316
332
  },
317
333
  { internal: true }
318
334
  ]
@@ -1165,6 +1181,7 @@ const presetWind = (options = {}) => {
1165
1181
  shortcuts,
1166
1182
  variants: variants(options),
1167
1183
  options,
1184
+ postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? presetMini.VarPrefixPostprocessor(options.variablePrefix) : void 0,
1168
1185
  preflights: options.preflight ? presetMini.preflights : [],
1169
1186
  prefix: options.prefix
1170
1187
  };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { preflights } from '@unocss/preset-mini';
1
+ import { VarPrefixPostprocessor, preflights } from '@unocss/preset-mini';
2
2
  export { colors, preflights } from '@unocss/preset-mini';
3
3
  import { handler, globalKeywords, makeGlobalStaticRules, positionMap, parseColor, colorToString, colorOpacityToString, colorResolver, resolveBreakpoints, colorableShadows, directionMap, directionSize, variantMatcher, variantParentMatcher, hasParseableColor } from '@unocss/preset-mini/utils';
4
4
  import { varEmpty, borderStyles, handlerBorderStyle, cssVariables as cssVariables$1, cssProperty, pointerEvents, appearances, positions, insets, zIndexes, orders, grids, floats, margins, boxSizing, displays, aspectRatio, sizes, flex, transforms, cursors, userSelects, resizes, appearance, placements, alignments, justifies, gaps, overflows, textOverflows, whitespaces, breaks, borders, bgColors, svgUtilities, paddings, textAligns, textIndents, verticalAligns, fonts, textTransforms as textTransforms$1, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contentVisibility, contents, containerParent, questionMark, transformBase, boxShadowsBase, ringBase } from '@unocss/preset-mini/rules';
@@ -292,24 +292,40 @@ const queryMatcher = /@media \(min-width: (.+)\)/;
292
292
  const container = [
293
293
  [
294
294
  /^__container$/,
295
- (m, { theme, variantHandlers }) => {
295
+ (m, context) => {
296
+ const { theme, variantHandlers } = context;
296
297
  let width = "100%";
298
+ const themePadding = theme.container?.padding;
299
+ let padding;
300
+ if (typeof themePadding === "string")
301
+ padding = themePadding;
302
+ else
303
+ padding = themePadding?.DEFAULT;
297
304
  for (const v of variantHandlers) {
298
305
  const query = v.handle?.({}, (x) => x)?.parent;
299
306
  if (typeof query === "string") {
300
307
  const match = query.match(queryMatcher)?.[1];
301
- if (match)
308
+ if (match) {
302
309
  width = match;
310
+ const bp = resolveBreakpoints(context) ?? {};
311
+ const matchBp = Object.keys(bp).find((key) => bp[key] === match);
312
+ if (matchBp && typeof themePadding !== "string")
313
+ padding = themePadding?.[matchBp] ?? padding;
314
+ }
303
315
  }
304
316
  }
317
+ const css = {
318
+ "max-width": width
319
+ };
305
320
  if (theme.container?.center) {
306
- return {
307
- "max-width": width,
308
- "margin-left": "auto",
309
- "margin-right": "auto"
310
- };
321
+ css["margin-left"] = "auto";
322
+ css["margin-right"] = "auto";
323
+ }
324
+ if (themePadding) {
325
+ css["padding-left"] = padding;
326
+ css["padding-right"] = padding;
311
327
  }
312
- return { "max-width": width };
328
+ return css;
313
329
  },
314
330
  { internal: true }
315
331
  ]
@@ -1162,6 +1178,7 @@ const presetWind = (options = {}) => {
1162
1178
  shortcuts,
1163
1179
  variants: variants(options),
1164
1180
  options,
1181
+ postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0,
1165
1182
  preflights: options.preflight ? preflights : [],
1166
1183
  prefix: options.prefix
1167
1184
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.47.6",
3
+ "version": "0.48.1",
4
4
  "description": "Tailwind / Windi CSS compact preset for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -35,8 +35,8 @@
35
35
  "*.css"
36
36
  ],
37
37
  "dependencies": {
38
- "@unocss/core": "0.47.6",
39
- "@unocss/preset-mini": "0.47.6"
38
+ "@unocss/core": "0.48.1",
39
+ "@unocss/preset-mini": "0.48.1"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",