@undp/create-app 0.2.9 → 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.
- package/bin/generateFiles/generateViteConfig.js +41 -12
- package/bin/templates/vite/basic/vite.config.ts +0 -17
- package/bin/templates/vite/query/vite.config.ts +0 -17
- package/bin/templates/vite/query+router/vite.config.ts +0 -17
- package/bin/templates/vite/router/vite.config.ts +0 -17
- package/package.json +1 -1
- package/bin/templates/vite/basic/src/components/Footer.tsx +0 -14
- package/bin/templates/vite/basic/src/components/Header.tsx +0 -25
- package/bin/templates/vite/query/src/components/Footer.tsx +0 -14
- package/bin/templates/vite/query/src/components/Header.tsx +0 -25
|
@@ -58,24 +58,53 @@ export default defineConfig({
|
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
60
|
},
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
62
|
{
|
|
63
|
-
postcssPlugin: 'move-
|
|
63
|
+
postcssPlugin: 'move-responsive-queries',
|
|
64
64
|
OnceExit(root) {
|
|
65
|
-
const
|
|
65
|
+
const mediaRules = [];
|
|
66
|
+
const containerRules = [];
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
function extractMinWidth(params) {
|
|
69
|
+
const match = params.match(/min-width:\s*([\d.]+)(px|rem)/);
|
|
70
|
+
if (!match) return null;
|
|
71
|
+
|
|
72
|
+
const value = parseFloat(match[1]);
|
|
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;
|
|
79
|
+
|
|
80
|
+
const pxValue = extractMinWidth(rule.params);
|
|
81
|
+
if (pxValue === null) return;
|
|
82
|
+
|
|
83
|
+
const entry = {
|
|
84
|
+
pxValue,
|
|
85
|
+
rule: rule.clone(),
|
|
86
|
+
};
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
if (rule.name === 'media') {
|
|
89
|
+
mediaRules.push(entry);
|
|
90
|
+
} else {
|
|
91
|
+
containerRules.push(entry);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
rule.remove();
|
|
76
95
|
});
|
|
96
|
+
|
|
97
|
+
// 1. Append media first
|
|
98
|
+
mediaRules
|
|
99
|
+
.sort((a, b) => a.pxValue - b.pxValue)
|
|
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));
|
|
77
106
|
},
|
|
78
|
-
}
|
|
107
|
+
},` : ''}
|
|
79
108
|
],
|
|
80
109
|
},
|
|
81
110
|
},
|
|
@@ -26,23 +26,6 @@ export default defineConfig({
|
|
|
26
26
|
plugins: [
|
|
27
27
|
postcssNested(),
|
|
28
28
|
tailwindcss(),
|
|
29
|
-
{
|
|
30
|
-
postcssPlugin: 'move-media-queries-last', // If you want to reorder media queries to the end
|
|
31
|
-
OnceExit(root) {
|
|
32
|
-
const mediaQueries = [];
|
|
33
|
-
|
|
34
|
-
// Collect all media queries
|
|
35
|
-
root.walkAtRules('media', mediaRule => {
|
|
36
|
-
mediaQueries.push(mediaRule.clone());
|
|
37
|
-
mediaRule.remove();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Append them at the end
|
|
41
|
-
mediaQueries.forEach(mediaQuery => {
|
|
42
|
-
root.append(mediaQuery);
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
29
|
],
|
|
47
30
|
},
|
|
48
31
|
},
|
|
@@ -26,23 +26,6 @@ export default defineConfig({
|
|
|
26
26
|
plugins: [
|
|
27
27
|
postcssNested(),
|
|
28
28
|
tailwindcss(),
|
|
29
|
-
{
|
|
30
|
-
postcssPlugin: 'move-media-queries-last', // If you want to reorder media queries to the end
|
|
31
|
-
OnceExit(root) {
|
|
32
|
-
const mediaQueries = [];
|
|
33
|
-
|
|
34
|
-
// Collect all media queries
|
|
35
|
-
root.walkAtRules('media', mediaRule => {
|
|
36
|
-
mediaQueries.push(mediaRule.clone());
|
|
37
|
-
mediaRule.remove();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Append them at the end
|
|
41
|
-
mediaQueries.forEach(mediaQuery => {
|
|
42
|
-
root.append(mediaQuery);
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
29
|
],
|
|
47
30
|
},
|
|
48
31
|
},
|
|
@@ -26,23 +26,6 @@ export default defineConfig({
|
|
|
26
26
|
plugins: [
|
|
27
27
|
postcssNested(),
|
|
28
28
|
tailwindcss(),
|
|
29
|
-
{
|
|
30
|
-
postcssPlugin: 'move-media-queries-last', // If you want to reorder media queries to the end
|
|
31
|
-
OnceExit(root) {
|
|
32
|
-
const mediaQueries = [];
|
|
33
|
-
|
|
34
|
-
// Collect all media queries
|
|
35
|
-
root.walkAtRules('media', mediaRule => {
|
|
36
|
-
mediaQueries.push(mediaRule.clone());
|
|
37
|
-
mediaRule.remove();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Append them at the end
|
|
41
|
-
mediaQueries.forEach(mediaQuery => {
|
|
42
|
-
root.append(mediaQuery);
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
29
|
],
|
|
47
30
|
},
|
|
48
31
|
},
|
|
@@ -26,23 +26,6 @@ export default defineConfig({
|
|
|
26
26
|
plugins: [
|
|
27
27
|
postcssNested(),
|
|
28
28
|
tailwindcss(),
|
|
29
|
-
{
|
|
30
|
-
postcssPlugin: 'move-media-queries-last', // If you want to reorder media queries to the end
|
|
31
|
-
OnceExit(root) {
|
|
32
|
-
const mediaQueries = [];
|
|
33
|
-
|
|
34
|
-
// Collect all media queries
|
|
35
|
-
root.walkAtRules('media', mediaRule => {
|
|
36
|
-
mediaQueries.push(mediaRule.clone());
|
|
37
|
-
mediaRule.remove();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Append them at the end
|
|
41
|
-
mediaQueries.forEach(mediaQuery => {
|
|
42
|
-
root.append(mediaQuery);
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
29
|
],
|
|
47
30
|
},
|
|
48
31
|
},
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Footer,
|
|
3
|
-
FooterLogoUnit,
|
|
4
|
-
FooterCopyrightUnit,
|
|
5
|
-
} from '@undp/design-system-react/Footer';
|
|
6
|
-
|
|
7
|
-
export default function FooterEl() {
|
|
8
|
-
return (
|
|
9
|
-
<Footer>
|
|
10
|
-
<FooterLogoUnit>subscribe to email</FooterLogoUnit>
|
|
11
|
-
<FooterCopyrightUnit>Footnote can be added here</FooterCopyrightUnit>
|
|
12
|
-
</Footer>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Header,
|
|
3
|
-
HeaderLogoUnit,
|
|
4
|
-
HeaderMainNavUnit,
|
|
5
|
-
HeaderMenuUnit,
|
|
6
|
-
} from '@undp/design-system-react/Header';
|
|
7
|
-
import { Link } from '@tanstack/react-router';
|
|
8
|
-
|
|
9
|
-
export default function HeaderEl() {
|
|
10
|
-
return (
|
|
11
|
-
<Header>
|
|
12
|
-
<HeaderLogoUnit
|
|
13
|
-
hyperlink='./'
|
|
14
|
-
siteName='Site name'
|
|
15
|
-
siteSubName='Sub-site name'
|
|
16
|
-
/>
|
|
17
|
-
<HeaderMainNavUnit>
|
|
18
|
-
<HeaderMenuUnit>
|
|
19
|
-
<Link to='/'>Home</Link>
|
|
20
|
-
<Link to='/query-demo'>Query demo</Link>
|
|
21
|
-
</HeaderMenuUnit>
|
|
22
|
-
</HeaderMainNavUnit>
|
|
23
|
-
</Header>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Footer,
|
|
3
|
-
FooterLogoUnit,
|
|
4
|
-
FooterCopyrightUnit,
|
|
5
|
-
} from '@undp/design-system-react/Footer';
|
|
6
|
-
|
|
7
|
-
export default function FooterEl() {
|
|
8
|
-
return (
|
|
9
|
-
<Footer>
|
|
10
|
-
<FooterLogoUnit>subscribe to email</FooterLogoUnit>
|
|
11
|
-
<FooterCopyrightUnit>Footnote can be added here</FooterCopyrightUnit>
|
|
12
|
-
</Footer>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Header,
|
|
3
|
-
HeaderLogoUnit,
|
|
4
|
-
HeaderMainNavUnit,
|
|
5
|
-
HeaderMenuUnit,
|
|
6
|
-
} from '@undp/design-system-react/Header';
|
|
7
|
-
import { Link } from '@tanstack/react-router';
|
|
8
|
-
|
|
9
|
-
export default function HeaderEl() {
|
|
10
|
-
return (
|
|
11
|
-
<Header>
|
|
12
|
-
<HeaderLogoUnit
|
|
13
|
-
hyperlink='./'
|
|
14
|
-
siteName='Site name'
|
|
15
|
-
siteSubName='Sub-site name'
|
|
16
|
-
/>
|
|
17
|
-
<HeaderMainNavUnit>
|
|
18
|
-
<HeaderMenuUnit>
|
|
19
|
-
<Link to='/'>Home</Link>
|
|
20
|
-
<Link to='/query-demo'>Query demo</Link>
|
|
21
|
-
</HeaderMenuUnit>
|
|
22
|
-
</HeaderMainNavUnit>
|
|
23
|
-
</Header>
|
|
24
|
-
);
|
|
25
|
-
}
|