@wireweave/core 1.0.0-beta.20260107130839 → 1.0.0-beta.20260107132939

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.
@@ -1,382 +0,0 @@
1
- /**
2
- * CSS Style Generator for wireweave
3
- *
4
- * Generates CSS classes for grid, spacing, and flex utilities
5
- */
6
-
7
- import type { ThemeConfig } from './types';
8
- import { generateComponentStyles } from './styles-components';
9
-
10
- /**
11
- * Generate all CSS styles for wireframe rendering
12
- *
13
- * @param theme - Theme configuration
14
- * @param prefix - CSS class prefix (default: 'wf')
15
- * @returns Complete CSS string
16
- */
17
- export function generateStyles(theme: ThemeConfig, prefix: string = 'wf'): string {
18
- const parts: string[] = [
19
- generateCssVariables(theme, prefix),
20
- generateBaseStyles(prefix),
21
- generateGridClasses(theme, prefix),
22
- generateSpacingClasses(theme, prefix),
23
- generateFlexClasses(prefix),
24
- generateSizeClasses(prefix),
25
- generateLayoutClasses(prefix),
26
- generateComponentStyles(theme, prefix),
27
- ];
28
-
29
- return parts.join('\n\n');
30
- }
31
-
32
- /**
33
- * Generate CSS custom properties (variables)
34
- */
35
- function generateCssVariables(theme: ThemeConfig, prefix: string): string {
36
- return `/* wireweave CSS Variables */
37
- :root {
38
- --${prefix}-primary: ${theme.colors.primary};
39
- --${prefix}-secondary: ${theme.colors.secondary};
40
- --${prefix}-success: ${theme.colors.success};
41
- --${prefix}-warning: ${theme.colors.warning};
42
- --${prefix}-danger: ${theme.colors.danger};
43
- --${prefix}-muted: ${theme.colors.muted};
44
- --${prefix}-bg: ${theme.colors.background};
45
- --${prefix}-fg: ${theme.colors.foreground};
46
- --${prefix}-border: ${theme.colors.border};
47
- --${prefix}-radius: ${theme.radius};
48
- --${prefix}-font: ${theme.fontFamily};
49
- --${prefix}-shadow-sm: ${theme.shadows.sm};
50
- --${prefix}-shadow-md: ${theme.shadows.md};
51
- --${prefix}-shadow-lg: ${theme.shadows.lg};
52
- --${prefix}-shadow-xl: ${theme.shadows.xl};
53
- }`;
54
- }
55
-
56
- /**
57
- * Generate base page styles
58
- */
59
- function generateBaseStyles(prefix: string): string {
60
- return `/* Base Styles */
61
- .${prefix}-page {
62
- font-family: var(--${prefix}-font);
63
- color: var(--${prefix}-fg);
64
- background: var(--${prefix}-bg);
65
- min-height: 100vh;
66
- box-sizing: border-box;
67
- position: relative;
68
- display: flex;
69
- flex-direction: column;
70
- /* Wireframe boundary visualization */
71
- box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
72
- border-radius: 8px;
73
- overflow: hidden;
74
- }
75
-
76
- /* Row containing sidebar should fill remaining space */
77
- .${prefix}-page > .${prefix}-row:has(.${prefix}-sidebar),
78
- .${prefix}-page > .${prefix}-row:has(.${prefix}-main) {
79
- flex: 1;
80
- align-items: stretch;
81
- }
82
-
83
- .${prefix}-page *, .${prefix}-page *::before, .${prefix}-page *::after {
84
- box-sizing: inherit;
85
- }
86
-
87
- /* Page with flex layout - enables justify/align for centering content */
88
- .${prefix}-page.${prefix}-flex,
89
- .${prefix}-page[class*="${prefix}-justify-"],
90
- .${prefix}-page[class*="${prefix}-align-"] {
91
- display: flex;
92
- flex-direction: column;
93
- }
94
-
95
- /* Page centered content (both horizontal and vertical) */
96
- .${prefix}-page.${prefix}-page-centered {
97
- display: flex;
98
- flex-direction: column;
99
- justify-content: center;
100
- align-items: center;
101
- }
102
-
103
- /* Prevent direct children from stretching in centered pages */
104
- .${prefix}-page.${prefix}-page-centered > * {
105
- flex: 0 0 auto;
106
- }`;
107
- }
108
-
109
- /**
110
- * Generate 12-column grid classes
111
- */
112
- function generateGridClasses(_theme: ThemeConfig, prefix: string): string {
113
- // No default gutters - use explicit gap for all spacing (px-based philosophy)
114
- let css = `/* Grid System - Explicit Gap Only */
115
- .${prefix}-row {
116
- display: flex;
117
- flex-wrap: nowrap;
118
- }
119
-
120
- .${prefix}-col {
121
- display: flex;
122
- flex-direction: column;
123
- flex: 1 0 0%;
124
- box-sizing: border-box;
125
- }
126
-
127
- `;
128
-
129
- // Generate column span classes (1-12)
130
- for (let i = 1; i <= 12; i++) {
131
- const width = ((i / 12) * 100).toFixed(4);
132
- css += `.${prefix}-col-${i} { flex: 0 0 auto; width: ${width}%; }\n`;
133
- }
134
-
135
- // Note: Responsive breakpoints intentionally not implemented
136
- // Wireframes use fixed layouts with scale mode for preview
137
-
138
- return css;
139
- }
140
-
141
- /**
142
- * Generate spacing utility classes (margin and padding)
143
- */
144
- function generateSpacingClasses(theme: ThemeConfig, prefix: string): string {
145
- const properties: Record<string, string> = {
146
- p: 'padding',
147
- pt: 'padding-top',
148
- pr: 'padding-right',
149
- pb: 'padding-bottom',
150
- pl: 'padding-left',
151
- px: 'padding-left',
152
- py: 'padding-top',
153
- m: 'margin',
154
- mt: 'margin-top',
155
- mr: 'margin-right',
156
- mb: 'margin-bottom',
157
- ml: 'margin-left',
158
- mx: 'margin-left',
159
- my: 'margin-top',
160
- };
161
-
162
- const multiAxisProps: Record<string, string[]> = {
163
- px: ['padding-left', 'padding-right'],
164
- py: ['padding-top', 'padding-bottom'],
165
- mx: ['margin-left', 'margin-right'],
166
- my: ['margin-top', 'margin-bottom'],
167
- };
168
-
169
- let css = '/* Spacing Utilities */\n';
170
-
171
- for (const [abbr, prop] of Object.entries(properties)) {
172
- for (const [value, size] of Object.entries(theme.spacing)) {
173
- if (multiAxisProps[abbr]) {
174
- const props = multiAxisProps[abbr];
175
- css += `.${prefix}-${abbr}-${value} { ${props.map((p) => `${p}: ${size}`).join('; ')}; }\n`;
176
- } else {
177
- css += `.${prefix}-${abbr}-${value} { ${prop}: ${size}; }\n`;
178
- }
179
- }
180
- }
181
-
182
- // Auto margin for centering
183
- css += `.${prefix}-mx-auto { margin-left: auto; margin-right: auto; }\n`;
184
-
185
- return css;
186
- }
187
-
188
- /**
189
- * Generate flexbox utility classes
190
- */
191
- function generateFlexClasses(prefix: string): string {
192
- return `/* Flexbox Utilities */
193
- .${prefix}-flex { display: flex; }
194
- .${prefix}-inline-flex { display: inline-flex; }
195
- .${prefix}-flex-row { flex-direction: row; }
196
- .${prefix}-flex-col { flex-direction: column; }
197
- .${prefix}-flex-row-reverse { flex-direction: row-reverse; }
198
- .${prefix}-flex-col-reverse { flex-direction: column-reverse; }
199
- .${prefix}-flex-wrap { flex-wrap: wrap; }
200
- .${prefix}-flex-nowrap { flex-wrap: nowrap; }
201
- .${prefix}-flex-1 { flex: 1 1 0%; }
202
- .${prefix}-flex-auto { flex: 1 1 auto; }
203
- .${prefix}-flex-none { flex: none; }
204
- .${prefix}-justify-start { justify-content: flex-start; }
205
- .${prefix}-justify-center { justify-content: center; }
206
- .${prefix}-justify-end { justify-content: flex-end; }
207
- .${prefix}-justify-between { justify-content: space-between; }
208
- .${prefix}-justify-around { justify-content: space-around; }
209
- .${prefix}-justify-evenly { justify-content: space-evenly; }
210
- .${prefix}-align-start { align-items: flex-start; }
211
- .${prefix}-align-center { align-items: center; }
212
- .${prefix}-align-end { align-items: flex-end; }
213
- .${prefix}-align-stretch { align-items: stretch; }
214
- .${prefix}-align-baseline { align-items: baseline; }
215
- .${prefix}-gap-0 { gap: 0; }
216
- .${prefix}-gap-1 { gap: 4px; }
217
- .${prefix}-gap-2 { gap: 8px; }
218
- .${prefix}-gap-3 { gap: 12px; }
219
- .${prefix}-gap-4 { gap: 16px; }
220
- .${prefix}-gap-5 { gap: 20px; }
221
- .${prefix}-gap-6 { gap: 24px; }
222
- .${prefix}-gap-8 { gap: 32px; }`;
223
- }
224
-
225
- /**
226
- * Generate size utility classes
227
- */
228
- function generateSizeClasses(prefix: string): string {
229
- return `/* Size Utilities */
230
- .${prefix}-w-full { width: 100%; }
231
- .${prefix}-w-auto { width: auto; }
232
- .${prefix}-w-fit { width: fit-content; }
233
- .${prefix}-w-screen { width: 100vw; }
234
- .${prefix}-h-full { height: 100%; }
235
- .${prefix}-h-auto { height: auto; }
236
- .${prefix}-h-screen { height: 100vh; }
237
-
238
- /* Viewport Preview Container */
239
- .${prefix}-viewport-preview {
240
- position: relative;
241
- overflow: hidden;
242
- display: flex;
243
- justify-content: center;
244
- align-items: flex-start;
245
- background: #f4f4f5;
246
- border-radius: 8px;
247
- }
248
-
249
- /* Dark mode background for preview container */
250
- .${prefix}-viewport-preview.dark {
251
- background: #18181b;
252
- }
253
-
254
- /* Inner wrapper for scaled viewport */
255
- .${prefix}-viewport-wrapper {
256
- transform-origin: top center;
257
- transition: transform 0.2s ease;
258
- }
259
-
260
- /* Scrollable viewport (when content overflows) */
261
- .${prefix}-page[data-scroll="true"] {
262
- overflow-y: auto;
263
- overflow-x: hidden;
264
- }
265
-
266
- /* Viewport boundary indicator */
267
- .${prefix}-viewport-preview::after {
268
- content: '';
269
- position: absolute;
270
- inset: 0;
271
- pointer-events: none;
272
- box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
273
- border-radius: inherit;
274
- }
275
-
276
- .${prefix}-viewport-preview.dark::after {
277
- box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
278
- }`;
279
- }
280
-
281
- /**
282
- * Generate layout component classes
283
- */
284
- function generateLayoutClasses(prefix: string): string {
285
- return `/* Layout Components */
286
- .${prefix}-header {
287
- border-bottom: 1px solid var(--${prefix}-border);
288
- padding: 0 16px;
289
- display: flex;
290
- align-items: center;
291
- min-height: 56px;
292
- }
293
-
294
- .${prefix}-header > .${prefix}-row {
295
- flex: 1;
296
- }
297
-
298
- .${prefix}-header.${prefix}-no-border {
299
- border-bottom: none;
300
- }
301
-
302
- /* Header avatar - smaller size */
303
- .${prefix}-header .${prefix}-avatar {
304
- width: 32px;
305
- height: 32px;
306
- font-size: 12px;
307
- }
308
-
309
- /* Header icon buttons - smaller size */
310
- .${prefix}-header .${prefix}-button-icon-only {
311
- padding: 6px;
312
- }
313
-
314
- .${prefix}-header .${prefix}-button-icon-only svg.${prefix}-icon {
315
- width: 18px;
316
- height: 18px;
317
- }
318
-
319
- .${prefix}-main {
320
- flex: 1;
321
- padding: 16px;
322
- }
323
-
324
- .${prefix}-footer {
325
- border-top: 1px solid var(--${prefix}-border);
326
- padding: 16px;
327
- }
328
-
329
- .${prefix}-footer.${prefix}-no-border {
330
- border-top: none;
331
- }
332
-
333
- .${prefix}-sidebar {
334
- width: 256px;
335
- border-right: 1px solid var(--${prefix}-border);
336
- padding: 16px 16px 16px 20px;
337
- flex-shrink: 0;
338
- }
339
-
340
- .${prefix}-sidebar-right {
341
- border-right: none;
342
- border-left: 1px solid var(--${prefix}-border);
343
- }
344
-
345
- /* Sidebar logo area - first row with logo */
346
- .${prefix}-sidebar > .${prefix}-row:first-child {
347
- margin-bottom: 24px;
348
- }
349
-
350
- /* Sidebar navigation links */
351
- .${prefix}-sidebar .${prefix}-nav-link {
352
- font-size: 14px;
353
- padding: 8px 12px;
354
- }
355
-
356
- /* Sidebar nav link icons */
357
- .${prefix}-sidebar .${prefix}-nav-link svg.${prefix}-icon {
358
- width: 18px;
359
- height: 18px;
360
- }
361
-
362
- .${prefix}-section {
363
- margin-bottom: 24px;
364
- }
365
-
366
- /* Section title in sidebar - smaller muted style */
367
- .${prefix}-sidebar .${prefix}-section .${prefix}-title {
368
- font-size: 11px;
369
- font-weight: 500;
370
- color: var(--${prefix}-muted);
371
- text-transform: uppercase;
372
- letter-spacing: 0.05em;
373
- margin-bottom: 8px;
374
- }
375
-
376
- /* Sidebar header text - prevent wrapping for logo text */
377
- .${prefix}-sidebar .${prefix}-header .${prefix}-text {
378
- white-space: nowrap;
379
- }`;
380
- }
381
-
382
- // Note: Component styles are now generated by styles-components.ts