@mandujs/core 0.19.0 → 0.19.2

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.
Files changed (90) hide show
  1. package/README.ko.md +0 -14
  2. package/package.json +4 -1
  3. package/src/brain/architecture/analyzer.ts +4 -4
  4. package/src/brain/doctor/analyzer.ts +18 -14
  5. package/src/bundler/build.test.ts +127 -0
  6. package/src/bundler/build.ts +291 -113
  7. package/src/bundler/css.ts +20 -5
  8. package/src/bundler/dev.ts +55 -2
  9. package/src/bundler/prerender.ts +195 -0
  10. package/src/change/snapshot.ts +4 -23
  11. package/src/change/types.ts +2 -3
  12. package/src/client/Form.tsx +105 -0
  13. package/src/client/__tests__/use-sse.test.ts +153 -0
  14. package/src/client/hooks.ts +105 -6
  15. package/src/client/index.ts +35 -6
  16. package/src/client/router.ts +670 -433
  17. package/src/client/rpc.ts +140 -0
  18. package/src/client/runtime.ts +24 -21
  19. package/src/client/use-fetch.ts +239 -0
  20. package/src/client/use-head.ts +197 -0
  21. package/src/client/use-sse.ts +378 -0
  22. package/src/components/Image.tsx +162 -0
  23. package/src/config/mandu.ts +5 -0
  24. package/src/config/validate.ts +34 -0
  25. package/src/content/index.ts +5 -1
  26. package/src/devtools/client/catchers/error-catcher.ts +17 -0
  27. package/src/devtools/client/catchers/network-proxy.ts +390 -367
  28. package/src/devtools/client/components/kitchen-root.tsx +479 -467
  29. package/src/devtools/client/components/panel/diff-viewer.tsx +219 -0
  30. package/src/devtools/client/components/panel/guard-panel.tsx +374 -244
  31. package/src/devtools/client/components/panel/index.ts +45 -32
  32. package/src/devtools/client/components/panel/panel-container.tsx +332 -312
  33. package/src/devtools/client/components/panel/preview-panel.tsx +188 -0
  34. package/src/devtools/client/state-manager.ts +535 -478
  35. package/src/devtools/design-tokens.ts +265 -264
  36. package/src/devtools/types.ts +345 -319
  37. package/src/filling/filling.ts +336 -14
  38. package/src/filling/index.ts +5 -1
  39. package/src/filling/session.ts +216 -0
  40. package/src/filling/ws.ts +78 -0
  41. package/src/generator/generate.ts +2 -2
  42. package/src/guard/auto-correct.ts +0 -29
  43. package/src/guard/check.ts +14 -31
  44. package/src/guard/presets/index.ts +296 -294
  45. package/src/guard/rules.ts +15 -19
  46. package/src/guard/validator.ts +834 -834
  47. package/src/index.ts +5 -1
  48. package/src/island/index.ts +373 -304
  49. package/src/kitchen/api/contract-api.ts +225 -0
  50. package/src/kitchen/api/diff-parser.ts +108 -0
  51. package/src/kitchen/api/file-api.ts +273 -0
  52. package/src/kitchen/api/guard-api.ts +83 -0
  53. package/src/kitchen/api/guard-decisions.ts +100 -0
  54. package/src/kitchen/api/routes-api.ts +50 -0
  55. package/src/kitchen/index.ts +21 -0
  56. package/src/kitchen/kitchen-handler.ts +256 -0
  57. package/src/kitchen/kitchen-ui.ts +1732 -0
  58. package/src/kitchen/stream/activity-sse.ts +145 -0
  59. package/src/kitchen/stream/file-tailer.ts +99 -0
  60. package/src/middleware/compress.ts +62 -0
  61. package/src/middleware/cors.ts +47 -0
  62. package/src/middleware/index.ts +10 -0
  63. package/src/middleware/jwt.ts +134 -0
  64. package/src/middleware/logger.ts +58 -0
  65. package/src/middleware/timeout.ts +55 -0
  66. package/src/paths.ts +0 -4
  67. package/src/plugins/hooks.ts +64 -0
  68. package/src/plugins/index.ts +3 -0
  69. package/src/plugins/types.ts +5 -0
  70. package/src/report/build.ts +0 -6
  71. package/src/resource/__tests__/backward-compat.test.ts +0 -1
  72. package/src/router/fs-patterns.ts +11 -1
  73. package/src/router/fs-routes.ts +78 -14
  74. package/src/router/fs-scanner.ts +2 -2
  75. package/src/router/fs-types.ts +2 -1
  76. package/src/runtime/adapter-bun.ts +62 -0
  77. package/src/runtime/adapter.ts +47 -0
  78. package/src/runtime/cache.ts +310 -0
  79. package/src/runtime/handler.ts +65 -0
  80. package/src/runtime/image-handler.ts +195 -0
  81. package/src/runtime/index.ts +12 -0
  82. package/src/runtime/middleware.ts +263 -0
  83. package/src/runtime/server.ts +662 -83
  84. package/src/runtime/ssr.ts +55 -29
  85. package/src/runtime/streaming-ssr.ts +106 -82
  86. package/src/spec/index.ts +0 -1
  87. package/src/spec/schema.ts +1 -0
  88. package/src/testing/index.ts +144 -0
  89. package/src/watcher/watcher.ts +27 -1
  90. package/src/spec/lock.ts +0 -56
@@ -1,264 +1,265 @@
1
- /**
2
- * Mandu Kitchen DevTools - Design Tokens
3
- * @version 1.0.3
4
- */
5
-
6
- // ============================================================================
7
- // Color Tokens
8
- // ============================================================================
9
-
10
- export const colors = {
11
- brand: {
12
- primary: '#F5E6D3', // 만두피 베이지
13
- secondary: '#8B4513', // 구운 갈색
14
- accent: '#E8967A', // 새우 만두 분홍
15
- },
16
- semantic: {
17
- success: '#7EC8A0', // 세이지 그린 (따뜻한 톤)
18
- warning: '#E8B84D', // 앰버 (부드러운 경고)
19
- error: '#E86464', // 소프트 레드
20
- info: '#7AAFC8', // 스틸 블루 (차분한 정보)
21
- },
22
- background: {
23
- dark: '#1C1B2E', // 따뜻한 다크 인디고
24
- medium: '#2A2940', // 따뜻한 미디엄
25
- light: '#3A3854', // 따뜻한 라이트
26
- overlay: 'rgba(10, 8, 20, 0.88)',
27
- },
28
- text: {
29
- primary: '#F0EDE8', // 크림 화이트 (따뜻한 톤)
30
- secondary: '#A8A4A0', // 따뜻한 그레이
31
- muted: '#6B6866', // 따뜻한 뮤트
32
- },
33
- } as const;
34
-
35
- // ============================================================================
36
- // Typography Tokens
37
- // ============================================================================
38
-
39
- export const typography = {
40
- fontFamily: {
41
- mono: "'JetBrains Mono', 'Fira Code', 'Consolas', monospace",
42
- sans: "'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
43
- },
44
- fontSize: {
45
- xs: '10px',
46
- sm: '12px',
47
- md: '14px',
48
- lg: '16px',
49
- xl: '20px',
50
- '2xl': '24px',
51
- },
52
- fontWeight: {
53
- normal: 400,
54
- medium: 500,
55
- semibold: 600,
56
- bold: 700,
57
- },
58
- lineHeight: {
59
- tight: 1.25,
60
- normal: 1.5,
61
- relaxed: 1.75,
62
- },
63
- } as const;
64
-
65
- // ============================================================================
66
- // Spacing Tokens
67
- // ============================================================================
68
-
69
- export const spacing = {
70
- xs: '4px',
71
- sm: '8px',
72
- md: '12px',
73
- lg: '16px',
74
- xl: '24px',
75
- '2xl': '32px',
76
- '3xl': '48px',
77
- } as const;
78
-
79
- // ============================================================================
80
- // Border Tokens
81
- // ============================================================================
82
-
83
- export const borderRadius = {
84
- sm: '4px',
85
- md: '8px',
86
- lg: '12px',
87
- xl: '16px',
88
- full: '9999px',
89
- } as const;
90
-
91
- export const borderWidth = {
92
- thin: '1px',
93
- medium: '2px',
94
- thick: '4px',
95
- } as const;
96
-
97
- // ============================================================================
98
- // Shadow Tokens
99
- // ============================================================================
100
-
101
- export const shadows = {
102
- sm: '0 1px 3px rgba(8, 6, 18, 0.12)',
103
- md: '0 4px 8px rgba(8, 6, 18, 0.18)',
104
- lg: '0 10px 20px rgba(8, 6, 18, 0.24)',
105
- xl: '0 20px 30px rgba(8, 6, 18, 0.32)',
106
- overlay: '0 25px 50px rgba(8, 6, 18, 0.5)',
107
- } as const;
108
-
109
- // ============================================================================
110
- // Animation Tokens
111
- // ============================================================================
112
-
113
- export const animation = {
114
- duration: {
115
- fast: '150ms',
116
- normal: '300ms',
117
- slow: '500ms',
118
- },
119
- easing: {
120
- ease: 'ease',
121
- easeIn: 'ease-in',
122
- easeOut: 'ease-out',
123
- easeInOut: 'ease-in-out',
124
- spring: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
125
- },
126
- } as const;
127
-
128
- // ============================================================================
129
- // Z-Index Tokens
130
- // ============================================================================
131
-
132
- export const zIndex = {
133
- base: 0,
134
- dropdown: 1000,
135
- sticky: 1020,
136
- fixed: 1030,
137
- modalBackdrop: 1040,
138
- modal: 1050,
139
- popover: 1060,
140
- tooltip: 1070,
141
- devtools: 2147483640, // 최상위 (max safe - 7)
142
- overlay: 2147483647, // 가장 높음 (max safe)
143
- } as const;
144
-
145
- // ============================================================================
146
- // Breakpoints
147
- // ============================================================================
148
-
149
- export const breakpoints = {
150
- sm: '640px',
151
- md: '768px',
152
- lg: '1024px',
153
- xl: '1280px',
154
- '2xl': '1536px',
155
- } as const;
156
-
157
- // ============================================================================
158
- // Combined Design Tokens
159
- // ============================================================================
160
-
161
- export const ManduDesignTokens = {
162
- colors,
163
- typography,
164
- spacing,
165
- borderRadius,
166
- borderWidth,
167
- shadows,
168
- animation,
169
- zIndex,
170
- breakpoints,
171
- } as const;
172
-
173
- export type ManduDesignTokens = typeof ManduDesignTokens;
174
-
175
- // ============================================================================
176
- // CSS Variables Generator
177
- // ============================================================================
178
-
179
- export function generateCSSVariables(): string {
180
- return `
181
- :host {
182
- /* Colors - Brand */
183
- --mk-color-brand-primary: ${colors.brand.primary};
184
- --mk-color-brand-secondary: ${colors.brand.secondary};
185
- --mk-color-brand-accent: ${colors.brand.accent};
186
-
187
- /* Colors - Semantic */
188
- --mk-color-success: ${colors.semantic.success};
189
- --mk-color-warning: ${colors.semantic.warning};
190
- --mk-color-error: ${colors.semantic.error};
191
- --mk-color-info: ${colors.semantic.info};
192
-
193
- /* Colors - Background */
194
- --mk-color-bg-dark: ${colors.background.dark};
195
- --mk-color-bg-medium: ${colors.background.medium};
196
- --mk-color-bg-light: ${colors.background.light};
197
- --mk-color-bg-overlay: ${colors.background.overlay};
198
-
199
- /* Colors - Text */
200
- --mk-color-text-primary: ${colors.text.primary};
201
- --mk-color-text-secondary: ${colors.text.secondary};
202
- --mk-color-text-muted: ${colors.text.muted};
203
-
204
- /* Typography */
205
- --mk-font-mono: ${typography.fontFamily.mono};
206
- --mk-font-sans: ${typography.fontFamily.sans};
207
- --mk-font-size-xs: ${typography.fontSize.xs};
208
- --mk-font-size-sm: ${typography.fontSize.sm};
209
- --mk-font-size-md: ${typography.fontSize.md};
210
- --mk-font-size-lg: ${typography.fontSize.lg};
211
- --mk-font-size-xl: ${typography.fontSize.xl};
212
-
213
- /* Spacing */
214
- --mk-space-xs: ${spacing.xs};
215
- --mk-space-sm: ${spacing.sm};
216
- --mk-space-md: ${spacing.md};
217
- --mk-space-lg: ${spacing.lg};
218
- --mk-space-xl: ${spacing.xl};
219
-
220
- /* Border Radius */
221
- --mk-radius-sm: ${borderRadius.sm};
222
- --mk-radius-md: ${borderRadius.md};
223
- --mk-radius-lg: ${borderRadius.lg};
224
- --mk-radius-full: ${borderRadius.full};
225
-
226
- /* Shadows */
227
- --mk-shadow-sm: ${shadows.sm};
228
- --mk-shadow-md: ${shadows.md};
229
- --mk-shadow-lg: ${shadows.lg};
230
- --mk-shadow-overlay: ${shadows.overlay};
231
-
232
- /* Animation */
233
- --mk-duration-fast: ${animation.duration.fast};
234
- --mk-duration-normal: ${animation.duration.normal};
235
- --mk-duration-slow: ${animation.duration.slow};
236
- --mk-easing-spring: ${animation.easing.spring};
237
-
238
- /* Z-Index */
239
- --mk-z-devtools: ${zIndex.devtools};
240
- --mk-z-overlay: ${zIndex.overlay};
241
- }
242
- `;
243
- }
244
-
245
- // ============================================================================
246
- // Test Selectors (data-testid)
247
- // ============================================================================
248
-
249
- export const testIds = {
250
- host: 'mk-host',
251
- root: 'mk-root',
252
- overlay: 'mk-overlay',
253
- panel: 'mk-panel',
254
- badge: 'mk-badge',
255
- tabErrors: 'mk-tab-errors',
256
- tabIslands: 'mk-tab-islands',
257
- tabNetwork: 'mk-tab-network',
258
- tabGuard: 'mk-tab-guard',
259
- errorList: 'mk-error-list',
260
- mandu: 'mk-mandu',
261
- restartButton: 'mk-restart-button',
262
- } as const;
263
-
264
- export type TestId = (typeof testIds)[keyof typeof testIds];
1
+ /**
2
+ * Mandu Kitchen DevTools - Design Tokens
3
+ * @version 1.0.3
4
+ */
5
+
6
+ // ============================================================================
7
+ // Color Tokens
8
+ // ============================================================================
9
+
10
+ export const colors = {
11
+ brand: {
12
+ primary: '#F5E6D3', // 만두피 베이지
13
+ secondary: '#8B4513', // 구운 갈색
14
+ accent: '#E8967A', // 새우 만두 분홍
15
+ },
16
+ semantic: {
17
+ success: '#7EC8A0', // 세이지 그린 (따뜻한 톤)
18
+ warning: '#E8B84D', // 앰버 (부드러운 경고)
19
+ error: '#E86464', // 소프트 레드
20
+ info: '#7AAFC8', // 스틸 블루 (차분한 정보)
21
+ },
22
+ background: {
23
+ dark: '#1C1B2E', // 따뜻한 다크 인디고
24
+ medium: '#2A2940', // 따뜻한 미디엄
25
+ light: '#3A3854', // 따뜻한 라이트
26
+ overlay: 'rgba(10, 8, 20, 0.88)',
27
+ },
28
+ text: {
29
+ primary: '#F0EDE8', // 크림 화이트 (따뜻한 톤)
30
+ secondary: '#A8A4A0', // 따뜻한 그레이
31
+ muted: '#6B6866', // 따뜻한 뮤트
32
+ },
33
+ } as const;
34
+
35
+ // ============================================================================
36
+ // Typography Tokens
37
+ // ============================================================================
38
+
39
+ export const typography = {
40
+ fontFamily: {
41
+ mono: "'JetBrains Mono', 'Fira Code', 'Consolas', monospace",
42
+ sans: "'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
43
+ },
44
+ fontSize: {
45
+ xs: '10px',
46
+ sm: '12px',
47
+ md: '14px',
48
+ lg: '16px',
49
+ xl: '20px',
50
+ '2xl': '24px',
51
+ },
52
+ fontWeight: {
53
+ normal: 400,
54
+ medium: 500,
55
+ semibold: 600,
56
+ bold: 700,
57
+ },
58
+ lineHeight: {
59
+ tight: 1.25,
60
+ normal: 1.5,
61
+ relaxed: 1.75,
62
+ },
63
+ } as const;
64
+
65
+ // ============================================================================
66
+ // Spacing Tokens
67
+ // ============================================================================
68
+
69
+ export const spacing = {
70
+ xs: '4px',
71
+ sm: '8px',
72
+ md: '12px',
73
+ lg: '16px',
74
+ xl: '24px',
75
+ '2xl': '32px',
76
+ '3xl': '48px',
77
+ } as const;
78
+
79
+ // ============================================================================
80
+ // Border Tokens
81
+ // ============================================================================
82
+
83
+ export const borderRadius = {
84
+ sm: '4px',
85
+ md: '8px',
86
+ lg: '12px',
87
+ xl: '16px',
88
+ full: '9999px',
89
+ } as const;
90
+
91
+ export const borderWidth = {
92
+ thin: '1px',
93
+ medium: '2px',
94
+ thick: '4px',
95
+ } as const;
96
+
97
+ // ============================================================================
98
+ // Shadow Tokens
99
+ // ============================================================================
100
+
101
+ export const shadows = {
102
+ sm: '0 1px 3px rgba(8, 6, 18, 0.12)',
103
+ md: '0 4px 8px rgba(8, 6, 18, 0.18)',
104
+ lg: '0 10px 20px rgba(8, 6, 18, 0.24)',
105
+ xl: '0 20px 30px rgba(8, 6, 18, 0.32)',
106
+ overlay: '0 25px 50px rgba(8, 6, 18, 0.5)',
107
+ } as const;
108
+
109
+ // ============================================================================
110
+ // Animation Tokens
111
+ // ============================================================================
112
+
113
+ export const animation = {
114
+ duration: {
115
+ fast: '150ms',
116
+ normal: '300ms',
117
+ slow: '500ms',
118
+ },
119
+ easing: {
120
+ ease: 'ease',
121
+ easeIn: 'ease-in',
122
+ easeOut: 'ease-out',
123
+ easeInOut: 'ease-in-out',
124
+ spring: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
125
+ },
126
+ } as const;
127
+
128
+ // ============================================================================
129
+ // Z-Index Tokens
130
+ // ============================================================================
131
+
132
+ export const zIndex = {
133
+ base: 0,
134
+ dropdown: 1000,
135
+ sticky: 1020,
136
+ fixed: 1030,
137
+ modalBackdrop: 1040,
138
+ modal: 1050,
139
+ popover: 1060,
140
+ tooltip: 1070,
141
+ devtools: 2147483640, // 최상위 (max safe - 7)
142
+ overlay: 2147483647, // 가장 높음 (max safe)
143
+ } as const;
144
+
145
+ // ============================================================================
146
+ // Breakpoints
147
+ // ============================================================================
148
+
149
+ export const breakpoints = {
150
+ sm: '640px',
151
+ md: '768px',
152
+ lg: '1024px',
153
+ xl: '1280px',
154
+ '2xl': '1536px',
155
+ } as const;
156
+
157
+ // ============================================================================
158
+ // Combined Design Tokens
159
+ // ============================================================================
160
+
161
+ export const ManduDesignTokens = {
162
+ colors,
163
+ typography,
164
+ spacing,
165
+ borderRadius,
166
+ borderWidth,
167
+ shadows,
168
+ animation,
169
+ zIndex,
170
+ breakpoints,
171
+ } as const;
172
+
173
+ export type ManduDesignTokens = typeof ManduDesignTokens;
174
+
175
+ // ============================================================================
176
+ // CSS Variables Generator
177
+ // ============================================================================
178
+
179
+ export function generateCSSVariables(): string {
180
+ return `
181
+ :host {
182
+ /* Colors - Brand */
183
+ --mk-color-brand-primary: ${colors.brand.primary};
184
+ --mk-color-brand-secondary: ${colors.brand.secondary};
185
+ --mk-color-brand-accent: ${colors.brand.accent};
186
+
187
+ /* Colors - Semantic */
188
+ --mk-color-success: ${colors.semantic.success};
189
+ --mk-color-warning: ${colors.semantic.warning};
190
+ --mk-color-error: ${colors.semantic.error};
191
+ --mk-color-info: ${colors.semantic.info};
192
+
193
+ /* Colors - Background */
194
+ --mk-color-bg-dark: ${colors.background.dark};
195
+ --mk-color-bg-medium: ${colors.background.medium};
196
+ --mk-color-bg-light: ${colors.background.light};
197
+ --mk-color-bg-overlay: ${colors.background.overlay};
198
+
199
+ /* Colors - Text */
200
+ --mk-color-text-primary: ${colors.text.primary};
201
+ --mk-color-text-secondary: ${colors.text.secondary};
202
+ --mk-color-text-muted: ${colors.text.muted};
203
+
204
+ /* Typography */
205
+ --mk-font-mono: ${typography.fontFamily.mono};
206
+ --mk-font-sans: ${typography.fontFamily.sans};
207
+ --mk-font-size-xs: ${typography.fontSize.xs};
208
+ --mk-font-size-sm: ${typography.fontSize.sm};
209
+ --mk-font-size-md: ${typography.fontSize.md};
210
+ --mk-font-size-lg: ${typography.fontSize.lg};
211
+ --mk-font-size-xl: ${typography.fontSize.xl};
212
+
213
+ /* Spacing */
214
+ --mk-space-xs: ${spacing.xs};
215
+ --mk-space-sm: ${spacing.sm};
216
+ --mk-space-md: ${spacing.md};
217
+ --mk-space-lg: ${spacing.lg};
218
+ --mk-space-xl: ${spacing.xl};
219
+
220
+ /* Border Radius */
221
+ --mk-radius-sm: ${borderRadius.sm};
222
+ --mk-radius-md: ${borderRadius.md};
223
+ --mk-radius-lg: ${borderRadius.lg};
224
+ --mk-radius-full: ${borderRadius.full};
225
+
226
+ /* Shadows */
227
+ --mk-shadow-sm: ${shadows.sm};
228
+ --mk-shadow-md: ${shadows.md};
229
+ --mk-shadow-lg: ${shadows.lg};
230
+ --mk-shadow-overlay: ${shadows.overlay};
231
+
232
+ /* Animation */
233
+ --mk-duration-fast: ${animation.duration.fast};
234
+ --mk-duration-normal: ${animation.duration.normal};
235
+ --mk-duration-slow: ${animation.duration.slow};
236
+ --mk-easing-spring: ${animation.easing.spring};
237
+
238
+ /* Z-Index */
239
+ --mk-z-devtools: ${zIndex.devtools};
240
+ --mk-z-overlay: ${zIndex.overlay};
241
+ }
242
+ `;
243
+ }
244
+
245
+ // ============================================================================
246
+ // Test Selectors (data-testid)
247
+ // ============================================================================
248
+
249
+ export const testIds = {
250
+ host: 'mk-host',
251
+ root: 'mk-root',
252
+ overlay: 'mk-overlay',
253
+ panel: 'mk-panel',
254
+ badge: 'mk-badge',
255
+ tabErrors: 'mk-tab-errors',
256
+ tabIslands: 'mk-tab-islands',
257
+ tabNetwork: 'mk-tab-network',
258
+ tabGuard: 'mk-tab-guard',
259
+ tabPreview: 'mk-tab-preview',
260
+ errorList: 'mk-error-list',
261
+ mandu: 'mk-mandu',
262
+ restartButton: 'mk-restart-button',
263
+ } as const;
264
+
265
+ export type TestId = (typeof testIds)[keyof typeof testIds];