Skip to content

Commit 9aba0a1

Browse files
committed
Fix vite plugin, Apply css optimize
1 parent 05036f7 commit 9aba0a1

File tree

168 files changed

+2115
-1990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+2115
-1990
lines changed

.changeset/fast-ravens-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/vite-plugin": patch
3+
---
4+
5+
Fix css duplicate issue when exporting

.changeset/young-chairs-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Apply css optimize

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/vite/src/App.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, Text } from '@devup-ui/react'
1+
import { Box, Center, Text } from '@devup-ui/react'
22
import { Lib } from 'vite-lib-example'
33

44
export default function App() {
@@ -14,7 +14,26 @@ export default function App() {
1414
hello
1515
<Lib />
1616
</Box>
17+
<Text color="#777777"></Text>
18+
<Text color="#777"></Text>
19+
<Text color="#777"></Text>
1720
<Text typography="header">typo</Text>
21+
<NoContent />
1822
</div>
1923
)
2024
}
25+
export function NoContent(props: { text?: string; background?: boolean }) {
26+
const { text, background } = props
27+
return (
28+
<Center
29+
bg={background ? 'var(--white-bg)' : undefined}
30+
h="100%"
31+
minH="80px"
32+
w="100%"
33+
>
34+
<Text color="var(--gray-color)" fontSize="13px" textAlign="center">
35+
{text ?? '표시할 정보가 없습니다.'}
36+
</Text>
37+
</Center>
38+
)
39+
}

benchmark/next-chakra-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "next lint"
1111
},
1212
"dependencies": {
13-
"@chakra-ui/react": "^3.15.0",
13+
"@chakra-ui/react": "^3.15.1",
1414
"@emotion/react": "^11.14.0",
1515
"next": "^15.2.4",
1616
"next-themes": "^0.4.6",

bindings/devup-ui-wasm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static GLOBAL_STYLE_SHEET: Lazy<Mutex<StyleSheet>> =
1313
#[wasm_bindgen]
1414
pub struct Output {
1515
code: String,
16-
styles: Vec<ExtractStyleValue>,
16+
styles: HashSet<ExtractStyleValue>,
1717
}
1818
#[wasm_bindgen]
1919
extern "C" {

libs/css/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ fn optimize_color(value: &str) -> String {
372372
format!("#{}", ret)
373373
}
374374

375-
fn optimize_value(value: &str) -> String {
375+
pub fn optimize_value(value: &str) -> String {
376376
let mut ret = value.trim().to_string();
377377
if ret.contains(",") {
378378
ret = F_SPACE_RE.replace_all(&ret, ",").trim().to_string();

libs/extractor/src/extract_style/mod.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use crate::utils::convert_value;
21
use crate::StyleProperty;
2+
use crate::utils::convert_value;
33
use css::{
4-
css_to_classname, sheet_to_classname, sheet_to_variable_name, short_to_long, StyleSelector,
4+
StyleSelector, css_to_classname, optimize_value, sheet_to_classname, sheet_to_variable_name,
5+
short_to_long,
56
};
67
use once_cell::sync::Lazy;
78
use std::collections::HashSet;
89

9-
#[derive(Debug, PartialEq, Clone)]
10+
#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)]
1011
pub struct ExtractStaticStyle {
1112
/// property
1213
property: String,
@@ -46,11 +47,11 @@ impl ExtractStaticStyle {
4647
/// create a new ExtractStaticStyle
4748
pub fn new(property: &str, value: &str, level: u8, selector: Option<StyleSelector>) -> Self {
4849
Self {
49-
value: if MAINTAIN_VALUE_PROPERTIES.contains(property) {
50+
value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) {
5051
value.to_string()
5152
} else {
5253
convert_value(value)
53-
},
54+
}),
5455
property: short_to_long(property),
5556
level,
5657
selector,
@@ -65,11 +66,11 @@ impl ExtractStaticStyle {
6566
selector: Option<StyleSelector>,
6667
) -> Self {
6768
Self {
68-
value: if MAINTAIN_VALUE_PROPERTIES.contains(property) {
69+
value: optimize_value(&if MAINTAIN_VALUE_PROPERTIES.contains(property) {
6970
value.to_string()
7071
} else {
7172
convert_value(value)
72-
},
73+
}),
7374
property: property.to_string(),
7475
level,
7576
selector,
@@ -113,7 +114,7 @@ impl ExtractStyleProperty for ExtractStaticStyle {
113114
if MAINTAIN_VALUE_PROPERTIES.contains(self.property.as_str()) {
114115
self.value.to_string()
115116
} else {
116-
convert_value(self.value.as_str())
117+
optimize_value(convert_value(self.value.as_str()).as_str())
117118
}
118119
.as_str(),
119120
),
@@ -122,7 +123,7 @@ impl ExtractStyleProperty for ExtractStaticStyle {
122123
))
123124
}
124125
}
125-
#[derive(Debug, PartialEq, Clone)]
126+
#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)]
126127
pub struct ExtractCss {
127128
/// css code
128129
pub css: String,
@@ -135,7 +136,7 @@ impl ExtractStyleProperty for ExtractCss {
135136
}
136137
}
137138

138-
#[derive(Debug, PartialEq, Clone)]
139+
#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)]
139140
pub struct ExtractDynamicStyle {
140141
/// property
141142
property: String,
@@ -207,7 +208,7 @@ impl ExtractStyleProperty for ExtractDynamicStyle {
207208
}
208209
}
209210
}
210-
#[derive(Debug, PartialEq, Clone)]
211+
#[derive(Debug, PartialEq, Clone, Eq, Hash, Ord, PartialOrd)]
211212
pub enum ExtractStyleValue {
212213
Static(ExtractStaticStyle),
213214
Typography(String),

0 commit comments

Comments
 (0)