podo-ui 0.1.38 → 0.1.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podo-ui",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "type": "module",
5
5
  "author": "hada0127 <work@tarucy.net>",
6
6
  "license": "MIT",
@@ -17,8 +17,7 @@
17
17
  "./global.scss": "./global.scss",
18
18
  "./mixin.scss": "./mixin.scss",
19
19
  "./system.scss": "./system.scss",
20
- "./react": "./react.ts",
21
- "./vite-plugin": "./vite-plugin.js"
20
+ "./react": "./react.ts"
22
21
  },
23
22
  "scripts": {
24
23
  "dev": "next dev",
package/readme.md CHANGED
@@ -38,32 +38,28 @@ import 'podo-ui/global.scss';
38
38
  }
39
39
  ```
40
40
 
41
- ### 3. Vite 프로젝트 설정 (필수)
41
+ ### 3. Vite 프로젝트 설정 (선택)
42
42
 
43
- ⚠️ **Vite 사용하는 경우 플러그인을 추가해야 합니다!**
44
-
45
- Vite에서 SCSS import 경로와 폰트 파일을 올바르게 처리하려면 플러그인이 필요합니다:
43
+ ⚠️ **Vite에서 `@use 'podo-ui/mixin'`이 작동하지 않는다면 아래 설정을 추가하세요:**
46
44
 
47
45
  ```javascript
48
46
  // vite.config.js
49
47
  import { defineConfig } from 'vite';
50
48
  import react from '@vitejs/plugin-react';
51
- import { podoUiVitePlugin } from 'podo-ui/vite-plugin';
49
+ import path from 'path';
52
50
 
53
51
  export default defineConfig({
54
- plugins: [
55
- react(),
56
- podoUiVitePlugin() // podo-ui 플러그인 추가
57
- ]
52
+ plugins: [react()],
53
+ resolve: {
54
+ alias: {
55
+ 'podo-ui/mixin': path.resolve(__dirname, 'node_modules/podo-ui/mixin.scss'),
56
+ 'podo-ui/system': path.resolve(__dirname, 'node_modules/podo-ui/system.scss'),
57
+ }
58
+ }
58
59
  });
59
60
  ```
60
61
 
61
- 플러그인은 다음을 자동으로 처리합니다:
62
- - `@use 'podo-ui/mixin'` 같은 SCSS import 경로 해석
63
- - 아이콘 폰트 (icon.woff) 경로 처리
64
- - Pretendard 폰트 (woff2) 경로 처리
65
-
66
- **Next.js나 CRA 등 다른 번들러는 플러그인 없이 사용 가능합니다.**
62
+ **대부분의 경우 추가 설정 없이 바로 사용 가능합니다.**
67
63
 
68
64
  ---
69
65
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  @font-face {
5
5
  font-family: 'podo-ui-icon';
6
- src: url('./font/icon.woff') format('woff');
6
+ src: url('~/podo-ui/scss/icon/font/icon.woff') format('woff');
7
7
  font-display: swap;
8
8
  }
9
9
  :root {
@@ -3,7 +3,7 @@
3
3
  font-weight: 900;
4
4
  src:
5
5
  local('Pretendard Black'),
6
- url(./font/Pretendard-Black.woff2) format('woff2');
6
+ url(~/podo-ui/scss/typo/font/Pretendard-Black.woff2) format('woff2');
7
7
  font-display: swap;
8
8
  }
9
9
 
@@ -12,7 +12,7 @@
12
12
  font-weight: 800;
13
13
  src:
14
14
  local('Pretendard ExtraBold'),
15
- url(./font/Pretendard-ExtraBold.woff2) format('woff2');
15
+ url(~/podo-ui/scss/typo/font/Pretendard-ExtraBold.woff2) format('woff2');
16
16
  font-display: swap;
17
17
  }
18
18
 
@@ -21,7 +21,7 @@
21
21
  font-weight: 700;
22
22
  src:
23
23
  local('Pretendard Bold'),
24
- url(./font/Pretendard-Bold.woff2) format('woff2');
24
+ url(~/podo-ui/scss/typo/font/Pretendard-Bold.woff2) format('woff2');
25
25
  font-display: swap;
26
26
  }
27
27
 
@@ -30,7 +30,7 @@
30
30
  font-weight: 600;
31
31
  src:
32
32
  local('Pretendard SemiBold'),
33
- url(./font/Pretendard-SemiBold.woff2) format('woff2');
33
+ url(~/podo-ui/scss/typo/font/Pretendard-SemiBold.woff2) format('woff2');
34
34
  font-display: swap;
35
35
  }
36
36
 
@@ -39,7 +39,7 @@
39
39
  font-weight: 500;
40
40
  src:
41
41
  local('Pretendard Medium'),
42
- url(./font/Pretendard-Medium.woff2) format('woff2');
42
+ url(~/podo-ui/scss/typo/font/Pretendard-Medium.woff2) format('woff2');
43
43
  font-display: swap;
44
44
  }
45
45
 
@@ -48,7 +48,7 @@
48
48
  font-weight: 400;
49
49
  src:
50
50
  local('Pretendard Regular'),
51
- url(./font/Pretendard-Regular.woff2) format('woff2');
51
+ url(~/podo-ui/scss/typo/font/Pretendard-Regular.woff2) format('woff2');
52
52
  font-display: swap;
53
53
  }
54
54
 
@@ -57,7 +57,7 @@
57
57
  font-weight: 300;
58
58
  src:
59
59
  local('Pretendard Light'),
60
- url(./font/Pretendard-Light.woff2) format('woff2');
60
+ url(~/podo-ui/scss/typo/font/Pretendard-Light.woff2) format('woff2');
61
61
  font-display: swap;
62
62
  }
63
63
 
@@ -66,7 +66,7 @@
66
66
  font-weight: 200;
67
67
  src:
68
68
  local('Pretendard ExtraLight'),
69
- url(./font/Pretendard-ExtraLight.woff2) format('woff2');
69
+ url(~/podo-ui/scss/typo/font/Pretendard-ExtraLight.woff2) format('woff2');
70
70
  font-display: swap;
71
71
  }
72
72
 
@@ -75,6 +75,6 @@
75
75
  font-weight: 100;
76
76
  src:
77
77
  local('Pretendard Thin'),
78
- url(./font/Pretendard-Thin.woff2) format('woff2');
78
+ url(~/podo-ui/scss/typo/font/Pretendard-Thin.woff2) format('woff2');
79
79
  font-display: swap;
80
80
  }
package/vite-plugin.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { Plugin } from 'vite';
2
-
3
- /**
4
- * Vite plugin for podo-ui icon fonts
5
- * Resolves icon font path issues in Vite projects
6
- *
7
- * @example
8
- * ```js
9
- * // vite.config.js
10
- * import { podoUiVitePlugin } from 'podo-ui/vite-plugin';
11
- *
12
- * export default {
13
- * plugins: [podoUiVitePlugin()]
14
- * }
15
- * ```
16
- */
17
- export function podoUiVitePlugin(): Plugin;
18
-
19
- export default podoUiVitePlugin;
package/vite-plugin.js DELETED
@@ -1,153 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { join, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
-
8
- /**
9
- * Vite plugin for podo-ui icon fonts
10
- * Resolves icon font path issues in Vite projects
11
- */
12
- export function podoUiVitePlugin() {
13
- return {
14
- name: 'vite-plugin-podo-ui',
15
-
16
- // Add configuration for SCSS imports and fonts
17
- config(userConfig, { command }) {
18
- return {
19
- resolve: {
20
- alias: {
21
- 'podo-ui/mixin': join(__dirname, 'mixin.scss'),
22
- 'podo-ui/system': join(__dirname, 'system.scss'),
23
- 'podo-ui/global.scss': join(__dirname, 'global.scss'),
24
- }
25
- }
26
- };
27
- },
28
-
29
- // Resolve Sass @use statements
30
- resolveId(source, importer, options) {
31
- // Only intercept podo-ui imports
32
- if (source === 'podo-ui/mixin' || source === 'podo-ui/mixin.scss') {
33
- return join(__dirname, 'mixin.scss');
34
- }
35
- if (source === 'podo-ui/system' || source === 'podo-ui/system.scss') {
36
- return join(__dirname, 'system.scss');
37
- }
38
- if (source === 'podo-ui/global.scss' || source === 'podo-ui/global') {
39
- return join(__dirname, 'global.scss');
40
- }
41
- // Let Vite handle everything else
42
- return null;
43
- },
44
-
45
- // Load hook to handle the font file
46
- load(id) {
47
- // Check if it's requesting the icon font
48
- if (id.includes('podo-ui/scss/icon/font/icon.woff')) {
49
- const fontPath = join(__dirname, 'scss/icon/font/icon.woff');
50
- try {
51
- const buffer = readFileSync(fontPath);
52
- return buffer;
53
- } catch (error) {
54
- console.warn('[podo-ui] Failed to load icon font:', error.message);
55
- }
56
- }
57
- },
58
-
59
- // Transform hook to fix font URLs in SCSS/CSS
60
- transform(code, id) {
61
- // Only process SCSS/CSS files from podo-ui
62
- if (!id.includes('podo-ui') || !id.match(/\.(scss|css)$/)) {
63
- return null;
64
- }
65
-
66
- let transformedCode = code;
67
- let hasChanges = false;
68
-
69
- // Fix relative font paths in icon.scss
70
- if (id.includes('icon/icon.scss')) {
71
- const fontPath = join(__dirname, 'scss/icon/font/icon.woff');
72
- transformedCode = transformedCode.replace(
73
- /url\(['"]?\.\/font\/icon\.woff['"]?\)/g,
74
- () => {
75
- hasChanges = true;
76
- return `url('${fontPath}')`;
77
- }
78
- );
79
- }
80
-
81
- // Fix relative font paths in font-family.scss (Pretendard fonts)
82
- if (id.includes('typo/font-family.scss')) {
83
- const fontFiles = [
84
- 'Pretendard-Black.woff2',
85
- 'Pretendard-ExtraBold.woff2',
86
- 'Pretendard-Bold.woff2',
87
- 'Pretendard-SemiBold.woff2',
88
- 'Pretendard-Medium.woff2',
89
- 'Pretendard-Regular.woff2',
90
- 'Pretendard-Light.woff2',
91
- 'Pretendard-ExtraLight.woff2',
92
- 'Pretendard-Thin.woff2'
93
- ];
94
-
95
- fontFiles.forEach(fontFile => {
96
- const fontPath = join(__dirname, `scss/typo/font/${fontFile}`);
97
- const regex = new RegExp(`url\\(['"]?\\.\/font\/${fontFile}['"]?\\)`, 'g');
98
- transformedCode = transformedCode.replace(regex, () => {
99
- hasChanges = true;
100
- return `url('${fontPath}')`;
101
- });
102
- });
103
- }
104
-
105
- if (hasChanges) {
106
- return {
107
- code: transformedCode,
108
- map: null
109
- };
110
- }
111
-
112
- return null;
113
- },
114
-
115
- // Serve the font files in dev mode
116
- configureServer(server) {
117
- server.middlewares.use((req, res, next) => {
118
- // Serve icon font
119
- if (req.url?.includes('/podo-ui-icon.woff')) {
120
- const fontPath = join(__dirname, 'scss/icon/font/icon.woff');
121
- try {
122
- const buffer = readFileSync(fontPath);
123
- res.setHeader('Content-Type', 'font/woff');
124
- res.setHeader('Cache-Control', 'public, max-age=31536000');
125
- res.end(buffer);
126
- return;
127
- } catch (error) {
128
- console.warn('[podo-ui] Failed to serve icon font:', error.message);
129
- }
130
- }
131
-
132
- // Serve Pretendard fonts
133
- if (req.url?.includes('/Pretendard-') && req.url?.includes('.woff2')) {
134
- const fontFileName = req.url.split('/').pop();
135
- const fontPath = join(__dirname, 'scss/typo/font', fontFileName);
136
- try {
137
- const buffer = readFileSync(fontPath);
138
- res.setHeader('Content-Type', 'font/woff2');
139
- res.setHeader('Cache-Control', 'public, max-age=31536000');
140
- res.end(buffer);
141
- return;
142
- } catch (error) {
143
- console.warn('[podo-ui] Failed to serve Pretendard font:', error.message);
144
- }
145
- }
146
-
147
- next();
148
- });
149
- }
150
- };
151
- }
152
-
153
- export default podoUiVitePlugin;