@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-
|
|
63
|
+
postcssPlugin: 'move-responsive-queries',
|
|
64
64
|
OnceExit(root) {
|
|
65
65
|
const mediaRules = [];
|
|
66
|
+
const containerRules = [];
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
const match =
|
|
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
|
-
|
|
76
|
-
|
|
80
|
+
const pxValue = extractMinWidth(rule.params);
|
|
81
|
+
if (pxValue === null) return;
|
|
77
82
|
|
|
78
|
-
|
|
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
|
],
|