@unocss/preset-wind 0.47.5 → 0.48.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/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
  ]
package/dist/index.mjs CHANGED
@@ -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
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.47.5",
3
+ "version": "0.48.0",
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.5",
39
- "@unocss/preset-mini": "0.47.5"
38
+ "@unocss/core": "0.48.0",
39
+ "@unocss/preset-mini": "0.48.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",