@undp/create-app 0.2.10 → 0.2.11

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.
@@ -60,32 +60,49 @@ export default defineConfig({
60
60
  },
61
61
  },
62
62
  {
63
- postcssPlugin: 'move-media-queries-by-breakpoint',
63
+ postcssPlugin: 'move-responsive-queries',
64
64
  OnceExit(root) {
65
65
  const mediaRules = [];
66
+ const containerRules = [];
66
67
 
67
- root.walkAtRules('media', rule => {
68
- const match = rule.params.match(/min-width:\s*([\d.]+)(px|rem)/);
69
-
70
- if (!match) return;
68
+ function extractMinWidth(params) {
69
+ const match = params.match(/min-width:\s*([\d.]+)(px|rem)/);
70
+ if (!match) return null;
71
71
 
72
72
  const value = parseFloat(match[1]);
73
73
  const unit = match[2];
74
+ return unit === 'rem' ? value * 16 : value;
75
+ }
76
+
77
+ root.walkAtRules(rule => {
78
+ if (rule.name !== 'media' && rule.name !== 'container') return;
74
79
 
75
- // Normalize to px (assuming 16px root for sorting)
76
- const pxValue = unit === 'rem' ? value * 16 : value;
80
+ const pxValue = extractMinWidth(rule.params);
81
+ if (pxValue === null) return;
77
82
 
78
- mediaRules.push({
83
+ const entry = {
79
84
  pxValue,
80
85
  rule: rule.clone(),
81
- });
86
+ };
87
+
88
+ if (rule.name === 'media') {
89
+ mediaRules.push(entry);
90
+ } else {
91
+ containerRules.push(entry);
92
+ }
82
93
 
83
94
  rule.remove();
84
95
  });
85
96
 
97
+ // 1. Append media first
86
98
  mediaRules
87
99
  .sort((a, b) => a.pxValue - b.pxValue)
88
100
  .forEach(({ rule }) => root.append(rule));
101
+
102
+ // 2. Append container after
103
+ containerRules
104
+ .sort((a, b) => a.pxValue - b.pxValue)
105
+ .forEach(({ rule }) => root.append(rule));
89
106
  },
90
107
  },` : ''}
91
108
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@undp/create-app",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "UNDP's project scaffolding tool",
5
5
  "bin": {
6
6
  "create-undp-app": "./bin/index.js"