@xmachines/play-router 1.0.0-beta.1
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/.oxfmtrc.json +3 -0
- package/.oxlintrc.json +3 -0
- package/README.md +436 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/build-tree.ts.html +316 -0
- package/coverage/connect-router.ts.html +505 -0
- package/coverage/coverage-summary.json +15 -0
- package/coverage/crawl-machine.ts.html +385 -0
- package/coverage/create-browser-history.ts.html +556 -0
- package/coverage/create-route-map.ts.html +400 -0
- package/coverage/create-router.ts.html +328 -0
- package/coverage/extract-route.ts.html +322 -0
- package/coverage/extract-routes.ts.html +286 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +296 -0
- package/coverage/index.ts.html +610 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/query.ts.html +307 -0
- package/coverage/router-bridge-base.ts.html +919 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/types.ts.html +787 -0
- package/coverage/validate-routes.ts.html +319 -0
- package/dist/build-tree.d.ts +13 -0
- package/dist/build-tree.d.ts.map +1 -0
- package/dist/build-tree.js +67 -0
- package/dist/build-tree.js.map +1 -0
- package/dist/connect-router.d.ts +56 -0
- package/dist/connect-router.d.ts.map +1 -0
- package/dist/connect-router.js +119 -0
- package/dist/connect-router.js.map +1 -0
- package/dist/crawl-machine.d.ts +74 -0
- package/dist/crawl-machine.d.ts.map +1 -0
- package/dist/crawl-machine.js +95 -0
- package/dist/crawl-machine.js.map +1 -0
- package/dist/create-browser-history.d.ts +68 -0
- package/dist/create-browser-history.d.ts.map +1 -0
- package/dist/create-browser-history.js +94 -0
- package/dist/create-browser-history.js.map +1 -0
- package/dist/create-route-map.d.ts +46 -0
- package/dist/create-route-map.d.ts.map +1 -0
- package/dist/create-route-map.js +73 -0
- package/dist/create-route-map.js.map +1 -0
- package/dist/create-router.d.ts +73 -0
- package/dist/create-router.d.ts.map +1 -0
- package/dist/create-router.js +63 -0
- package/dist/create-router.js.map +1 -0
- package/dist/extract-route.d.ts +25 -0
- package/dist/extract-route.d.ts.map +1 -0
- package/dist/extract-route.js +63 -0
- package/dist/extract-route.js.map +1 -0
- package/dist/extract-routes.d.ts +41 -0
- package/dist/extract-routes.d.ts.map +1 -0
- package/dist/extract-routes.js +61 -0
- package/dist/extract-routes.js.map +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +141 -0
- package/dist/index.js.map +1 -0
- package/dist/query.d.ts +52 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +69 -0
- package/dist/query.js.map +1 -0
- package/dist/router-bridge-base.d.ts +150 -0
- package/dist/router-bridge-base.d.ts.map +1 -0
- package/dist/router-bridge-base.js +240 -0
- package/dist/router-bridge-base.js.map +1 -0
- package/dist/types.d.ts +228 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/validate-routes.d.ts +39 -0
- package/dist/validate-routes.d.ts.map +1 -0
- package/dist/validate-routes.js +65 -0
- package/dist/validate-routes.js.map +1 -0
- package/examples/demo/README.md +127 -0
- package/examples/demo/index.html +41 -0
- package/examples/demo/package.json +27 -0
- package/examples/demo/src/main.ts +28 -0
- package/examples/demo/src/router.ts +37 -0
- package/examples/demo/src/shell.ts +316 -0
- package/examples/demo/test/browser/auth-flow.browser.test.ts +60 -0
- package/examples/demo/test/browser/startup.browser.test.ts +37 -0
- package/examples/demo/test/library-pattern.test.ts +51 -0
- package/examples/demo/tsconfig.json +17 -0
- package/examples/demo/vite.config.ts +7 -0
- package/examples/demo/vitest.browser.config.ts +20 -0
- package/examples/demo/vitest.config.ts +9 -0
- package/examples/shared/dist/auth-machine.d.ts +20 -0
- package/examples/shared/dist/auth-machine.d.ts.map +1 -0
- package/examples/shared/dist/auth-machine.js +212 -0
- package/examples/shared/dist/auth-machine.js.map +1 -0
- package/examples/shared/dist/catalog.d.ts +85 -0
- package/examples/shared/dist/catalog.d.ts.map +1 -0
- package/examples/shared/dist/catalog.js +86 -0
- package/examples/shared/dist/catalog.js.map +1 -0
- package/examples/shared/dist/index.d.ts +4 -0
- package/examples/shared/dist/index.d.ts.map +1 -0
- package/examples/shared/dist/index.js +3 -0
- package/examples/shared/dist/index.js.map +1 -0
- package/examples/shared/package.json +37 -0
- package/examples/shared/src/auth-machine.ts +234 -0
- package/examples/shared/src/catalog.ts +95 -0
- package/examples/shared/src/index.css +3 -0
- package/examples/shared/src/index.ts +3 -0
- package/examples/shared/src/styles/layout.css +413 -0
- package/examples/shared/src/styles/reset.css +42 -0
- package/examples/shared/src/styles/tokens.css +183 -0
- package/examples/shared/tsconfig.json +14 -0
- package/examples/shared/tsconfig.tsbuildinfo +1 -0
- package/package.json +44 -0
- package/src/build-tree.ts +77 -0
- package/src/connect-router.ts +142 -0
- package/src/crawl-machine.ts +100 -0
- package/src/create-browser-history.ts +157 -0
- package/src/create-route-map.ts +105 -0
- package/src/create-router.ts +87 -0
- package/src/extract-route.ts +79 -0
- package/src/extract-routes.ts +67 -0
- package/src/index.ts +175 -0
- package/src/query.ts +74 -0
- package/src/router-bridge-base.ts +279 -0
- package/src/types.ts +234 -0
- package/src/validate-routes.ts +76 -0
- package/test/connect-route-map.test.ts +320 -0
- package/test/crawl-extract.test.js +473 -0
- package/test/create-browser-history.test.ts +123 -0
- package/test/create-router.test.ts +23 -0
- package/test/extract-routes.test.ts +80 -0
- package/test/find-route-by-path-patterns.test.ts +69 -0
- package/test/integration.test.js +438 -0
- package/test/query.test.ts +56 -0
- package/test/router-bridge-base-edge.test.ts +165 -0
- package/test/router-bridge-base.test.ts +119 -0
- package/test/tree-query.test.js +692 -0
- package/test/validation.test.js +158 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +35 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout CSS - XMachines Play Demo Applications
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Common layout patterns for standardized UI structure
|
|
5
|
+
* Usage: Import after tokens.css and reset.css
|
|
6
|
+
*
|
|
7
|
+
* This is a TEMPLATE file - copy to your demo's src/styles/ directory
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: This file uses design tokens (CSS custom properties) from tokens.css
|
|
10
|
+
* Ensure tokens.css is imported BEFORE this file in your stylesheet cascade
|
|
11
|
+
*
|
|
12
|
+
* See: .planning/demos/UI-SPEC.md for complete specification
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/* ========================================
|
|
16
|
+
APPLICATION CONTAINER
|
|
17
|
+
======================================== */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Root application container
|
|
21
|
+
* Flex column layout ensures header, content, and footer stack vertically
|
|
22
|
+
* min-height: 100vh fills viewport even when content is short
|
|
23
|
+
* padding-bottom accounts for fixed debug panel at bottom
|
|
24
|
+
*/
|
|
25
|
+
.demo-app {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
min-height: 100vh;
|
|
29
|
+
padding-bottom: var(--debug-panel-height);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* ========================================
|
|
33
|
+
HEADER
|
|
34
|
+
======================================== */
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Top header bar containing title and navigation
|
|
38
|
+
* Fixed height ensures consistent layout across all views
|
|
39
|
+
* Border bottom provides visual separation from content
|
|
40
|
+
*/
|
|
41
|
+
.demo-header {
|
|
42
|
+
background: var(--color-bg);
|
|
43
|
+
border-bottom: var(--border-width) solid var(--color-border);
|
|
44
|
+
padding: var(--space-md) var(--space-lg);
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--space-md);
|
|
49
|
+
height: var(--header-height);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Application title (e.g., "XMachines Play - React Demo")
|
|
54
|
+
*/
|
|
55
|
+
.demo-title {
|
|
56
|
+
font-size: var(--font-size-h1);
|
|
57
|
+
font-weight: var(--font-weight-semibold);
|
|
58
|
+
line-height: var(--line-height-tight);
|
|
59
|
+
color: var(--color-text);
|
|
60
|
+
margin: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ========================================
|
|
64
|
+
NAVIGATION
|
|
65
|
+
======================================== */
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Navigation container
|
|
69
|
+
* Contains both links (for route navigation) and buttons (for state events)
|
|
70
|
+
*/
|
|
71
|
+
.demo-nav {
|
|
72
|
+
display: flex;
|
|
73
|
+
gap: var(--space-md);
|
|
74
|
+
align-items: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Common styling for navigation items (links and buttons)
|
|
79
|
+
* Base padding, border radius, and hover transitions
|
|
80
|
+
*/
|
|
81
|
+
.demo-nav a,
|
|
82
|
+
.demo-nav button {
|
|
83
|
+
padding: var(--space-sm) var(--space-md);
|
|
84
|
+
border-radius: var(--border-radius);
|
|
85
|
+
font-weight: var(--font-weight-semibold);
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
transition: background-color 0.15s ease;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Links - Used for route navigation (Home, Login, Profile)
|
|
92
|
+
* Semantic HTML: <a> elements represent navigation between routes
|
|
93
|
+
*/
|
|
94
|
+
.demo-nav a {
|
|
95
|
+
color: var(--color-text);
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
background: transparent;
|
|
98
|
+
border: var(--border-width) solid var(--color-border);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.demo-nav a:hover {
|
|
102
|
+
background: var(--color-bg-secondary);
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Active route link styling
|
|
108
|
+
* Accent color background indicates current route
|
|
109
|
+
*/
|
|
110
|
+
.demo-nav a.active {
|
|
111
|
+
background: var(--color-accent);
|
|
112
|
+
color: white;
|
|
113
|
+
border-color: var(--color-accent);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Buttons - Used for state events (Logout, Submit)
|
|
118
|
+
* Semantic HTML: <button> elements represent actions/events
|
|
119
|
+
*/
|
|
120
|
+
.demo-nav button {
|
|
121
|
+
background: var(--color-bg);
|
|
122
|
+
border: var(--border-width) solid var(--color-border);
|
|
123
|
+
color: var(--color-text);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.demo-nav button:hover {
|
|
127
|
+
background: var(--color-bg-secondary);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Primary button variant (typically for main actions)
|
|
132
|
+
*/
|
|
133
|
+
.demo-nav button.primary {
|
|
134
|
+
background: var(--color-accent);
|
|
135
|
+
color: white;
|
|
136
|
+
border-color: var(--color-accent);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.demo-nav button.primary:hover {
|
|
140
|
+
background: var(--color-accent-hover);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* ========================================
|
|
144
|
+
MAIN CONTENT AREA
|
|
145
|
+
======================================== */
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Main content container
|
|
149
|
+
* flex: 1 fills remaining vertical space
|
|
150
|
+
* max-width and auto margins center content on wide screens
|
|
151
|
+
*/
|
|
152
|
+
.demo-content {
|
|
153
|
+
flex: 1;
|
|
154
|
+
padding: var(--space-lg);
|
|
155
|
+
max-width: 1200px;
|
|
156
|
+
width: 100%;
|
|
157
|
+
margin: 0 auto;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* ========================================
|
|
161
|
+
VIEW CONTAINERS
|
|
162
|
+
======================================== */
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Generic container for view content
|
|
166
|
+
* Provides consistent card-like appearance across views
|
|
167
|
+
*/
|
|
168
|
+
.view-container {
|
|
169
|
+
background: var(--color-bg);
|
|
170
|
+
border: var(--border-width) solid var(--color-border);
|
|
171
|
+
border-radius: var(--border-radius);
|
|
172
|
+
padding: var(--space-lg);
|
|
173
|
+
margin-bottom: var(--space-lg);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.view-container h2 {
|
|
177
|
+
font-size: var(--font-size-h2);
|
|
178
|
+
font-weight: var(--font-weight-semibold);
|
|
179
|
+
margin-bottom: var(--space-md);
|
|
180
|
+
color: var(--color-text);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* ========================================
|
|
184
|
+
FORMS
|
|
185
|
+
======================================== */
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Form group pattern (label + input pairing)
|
|
189
|
+
* Consistent spacing for form fields
|
|
190
|
+
*/
|
|
191
|
+
.form-group {
|
|
192
|
+
margin-bottom: var(--space-md);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.form-group label {
|
|
196
|
+
display: block;
|
|
197
|
+
font-weight: var(--font-weight-semibold);
|
|
198
|
+
margin-bottom: var(--space-xs);
|
|
199
|
+
color: var(--color-text);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.form-group input {
|
|
203
|
+
width: 100%;
|
|
204
|
+
padding: var(--space-sm) var(--space-md);
|
|
205
|
+
border: var(--border-width) solid var(--color-border);
|
|
206
|
+
border-radius: var(--border-radius);
|
|
207
|
+
font-size: var(--font-size-base);
|
|
208
|
+
background: var(--color-bg);
|
|
209
|
+
color: var(--color-text);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Input focus state
|
|
214
|
+
* Accent color border with subtle shadow for visual feedback
|
|
215
|
+
*/
|
|
216
|
+
.form-group input:focus {
|
|
217
|
+
outline: none;
|
|
218
|
+
border-color: var(--color-accent);
|
|
219
|
+
box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Form actions container (Submit, Cancel buttons)
|
|
224
|
+
* Horizontal layout with spacing between buttons
|
|
225
|
+
*/
|
|
226
|
+
.form-actions {
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: var(--space-md);
|
|
229
|
+
margin-top: var(--space-lg);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* ========================================
|
|
233
|
+
STATUS DISPLAYS
|
|
234
|
+
======================================== */
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Status card for displaying information
|
|
238
|
+
* Secondary background differentiates from main content
|
|
239
|
+
*/
|
|
240
|
+
.status-card {
|
|
241
|
+
background: var(--color-bg-secondary);
|
|
242
|
+
border: var(--border-width) solid var(--color-border);
|
|
243
|
+
border-radius: var(--border-radius);
|
|
244
|
+
padding: var(--space-md);
|
|
245
|
+
margin-bottom: var(--space-md);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.status-card p {
|
|
249
|
+
margin: 0;
|
|
250
|
+
color: var(--color-text);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Emphasized text within status cards
|
|
255
|
+
* Accent color highlights important values
|
|
256
|
+
*/
|
|
257
|
+
.status-card strong {
|
|
258
|
+
color: var(--color-accent);
|
|
259
|
+
font-weight: var(--font-weight-semibold);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* ========================================
|
|
263
|
+
DEBUG PANEL (FIXED FOOTER)
|
|
264
|
+
======================================== */
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Fixed position debug panel at bottom of viewport
|
|
268
|
+
* Shows: State ID, Auth status, Current route
|
|
269
|
+
* Always visible for development/demonstration purposes
|
|
270
|
+
*/
|
|
271
|
+
.demo-debug {
|
|
272
|
+
position: fixed;
|
|
273
|
+
bottom: 0;
|
|
274
|
+
left: 0;
|
|
275
|
+
right: 0;
|
|
276
|
+
background: var(--color-bg-secondary);
|
|
277
|
+
border-top: var(--border-width) solid var(--color-border);
|
|
278
|
+
padding: var(--space-md);
|
|
279
|
+
font-size: var(--font-size-small);
|
|
280
|
+
max-height: var(--debug-panel-height);
|
|
281
|
+
overflow-y: auto;
|
|
282
|
+
z-index: 1000;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Debug panel heading
|
|
287
|
+
* Muted color indicates secondary/meta information
|
|
288
|
+
*/
|
|
289
|
+
.debug-title {
|
|
290
|
+
font-size: var(--font-size-base);
|
|
291
|
+
font-weight: var(--font-weight-semibold);
|
|
292
|
+
margin-bottom: var(--space-sm);
|
|
293
|
+
color: var(--color-muted);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Debug state container
|
|
298
|
+
* Horizontal layout with wrapping for narrow viewports
|
|
299
|
+
*/
|
|
300
|
+
.debug-state {
|
|
301
|
+
display: flex;
|
|
302
|
+
gap: var(--space-md);
|
|
303
|
+
flex-wrap: wrap;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Individual debug item (State: X, Auth: Y, Route: Z)
|
|
308
|
+
*/
|
|
309
|
+
.debug-item {
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
gap: var(--space-xs);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Debug value styling
|
|
317
|
+
* <code> elements use accent color for visual emphasis
|
|
318
|
+
* Monospace font distinguishes values from labels
|
|
319
|
+
*/
|
|
320
|
+
.debug-item code {
|
|
321
|
+
color: var(--color-accent);
|
|
322
|
+
font-weight: var(--font-weight-semibold);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* ========================================
|
|
326
|
+
BUTTON COMPONENT
|
|
327
|
+
======================================== */
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Generic button styling (not in navigation)
|
|
331
|
+
* Use for forms, actions within content areas
|
|
332
|
+
*/
|
|
333
|
+
.button {
|
|
334
|
+
padding: var(--space-sm) var(--space-md);
|
|
335
|
+
border: var(--border-width) solid var(--color-border);
|
|
336
|
+
border-radius: var(--border-radius);
|
|
337
|
+
background: var(--color-bg);
|
|
338
|
+
color: var(--color-text);
|
|
339
|
+
cursor: pointer;
|
|
340
|
+
font-weight: var(--font-weight-semibold);
|
|
341
|
+
font-size: var(--font-size-base);
|
|
342
|
+
transition: background-color 0.15s ease;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.button:hover {
|
|
346
|
+
background: var(--color-bg-secondary);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Primary button variant
|
|
351
|
+
* Accent color for main call-to-action
|
|
352
|
+
*/
|
|
353
|
+
.button.primary {
|
|
354
|
+
background: var(--color-accent);
|
|
355
|
+
color: white;
|
|
356
|
+
border-color: var(--color-accent);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.button.primary:hover {
|
|
360
|
+
background: var(--color-accent-hover);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Disabled button state
|
|
365
|
+
* Reduced opacity and no pointer cursor
|
|
366
|
+
*/
|
|
367
|
+
.button:disabled {
|
|
368
|
+
opacity: 0.5;
|
|
369
|
+
cursor: not-allowed;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.button:disabled:hover {
|
|
373
|
+
background: var(--color-bg);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.button.primary:disabled:hover {
|
|
377
|
+
background: var(--color-accent);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/* ========================================
|
|
381
|
+
USAGE NOTES
|
|
382
|
+
======================================== */
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Import Order (critical):
|
|
386
|
+
* 1. tokens.css (defines CSS custom properties)
|
|
387
|
+
* 2. reset.css (normalizes browser defaults)
|
|
388
|
+
* 3. layout.css (this file - uses tokens)
|
|
389
|
+
*
|
|
390
|
+
* Framework-Specific Imports:
|
|
391
|
+
*
|
|
392
|
+
* React:
|
|
393
|
+
* import './styles/tokens.css';
|
|
394
|
+
* import './styles/reset.css';
|
|
395
|
+
* import './styles/layout.css';
|
|
396
|
+
*
|
|
397
|
+
* Vue:
|
|
398
|
+
* <style>
|
|
399
|
+
* @import './styles/tokens.css';
|
|
400
|
+
* @import './styles/reset.css';
|
|
401
|
+
* @import './styles/layout.css';
|
|
402
|
+
* </style>
|
|
403
|
+
*
|
|
404
|
+
* Vanilla:
|
|
405
|
+
* import './styles/tokens.css';
|
|
406
|
+
* import './styles/reset.css';
|
|
407
|
+
* import './styles/layout.css';
|
|
408
|
+
*
|
|
409
|
+
* Customization:
|
|
410
|
+
* - Override specific classes in your demo's custom CSS
|
|
411
|
+
* - DO NOT modify token values in components (use tokens.css)
|
|
412
|
+
* - Add demo-specific styles AFTER this file in cascade
|
|
413
|
+
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
body {
|
|
8
|
+
font-family: var(--font-family);
|
|
9
|
+
font-size: var(--font-size-base);
|
|
10
|
+
line-height: var(--line-height-base);
|
|
11
|
+
color: var(--color-text);
|
|
12
|
+
background: var(--color-bg);
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
button,
|
|
18
|
+
input,
|
|
19
|
+
select,
|
|
20
|
+
textarea {
|
|
21
|
+
font-family: inherit;
|
|
22
|
+
font-size: inherit;
|
|
23
|
+
line-height: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
a {
|
|
27
|
+
color: var(--color-accent);
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
a:hover {
|
|
32
|
+
color: var(--color-accent-hover);
|
|
33
|
+
text-decoration: underline;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
code {
|
|
37
|
+
font-family: "Monaco", "Courier New", monospace;
|
|
38
|
+
font-size: 0.9em;
|
|
39
|
+
background: var(--color-bg-secondary);
|
|
40
|
+
padding: 0.125rem 0.25rem;
|
|
41
|
+
border-radius: var(--border-radius);
|
|
42
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Tokens - XMachines Play Demo Applications
|
|
3
|
+
*
|
|
4
|
+
* Purpose: CSS Custom Properties defining all design values (colors, spacing, typography)
|
|
5
|
+
* Usage: Import first in your application's stylesheet cascade
|
|
6
|
+
*
|
|
7
|
+
* This is a TEMPLATE file - copy to your demo's src/styles/ directory
|
|
8
|
+
*
|
|
9
|
+
* DO NOT modify token values without updating all 5 demos to maintain consistency
|
|
10
|
+
* See: .planning/demos/UI-SPEC.md for complete specification
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
/* ========================================
|
|
15
|
+
COLORS
|
|
16
|
+
======================================== */
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Base Colors
|
|
20
|
+
* Used for backgrounds, text, and borders throughout the application
|
|
21
|
+
*/
|
|
22
|
+
--color-bg: #ffffff; /* Primary background (white) */
|
|
23
|
+
--color-text: #1a1a1a; /* Primary text color (near black) */
|
|
24
|
+
--color-border: #e0e0e0; /* Border color (light gray) */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Accent Colors (Teal)
|
|
28
|
+
* Primary brand/accent color for interactive elements and active states
|
|
29
|
+
*/
|
|
30
|
+
--color-accent: #14b8a6; /* teal-500 - Primary accent */
|
|
31
|
+
--color-accent-hover: #0d9488; /* teal-600 - Hover state for accent */
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Semantic Colors
|
|
35
|
+
* Colors with specific meaning (errors, muted content, secondary backgrounds)
|
|
36
|
+
*/
|
|
37
|
+
--color-error: #dc2626; /* red-600 - Error states */
|
|
38
|
+
--color-muted: #737373; /* gray-500 - Muted/secondary text */
|
|
39
|
+
--color-bg-secondary: #f5f5f5; /* gray-100 - Secondary backgrounds */
|
|
40
|
+
|
|
41
|
+
/* ========================================
|
|
42
|
+
SPACING (8px base unit)
|
|
43
|
+
======================================== */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Spacing Scale
|
|
47
|
+
* All spacing values follow 8px base unit system
|
|
48
|
+
* Use these for padding, margin, gaps between elements
|
|
49
|
+
*/
|
|
50
|
+
--space-xs: 0.25rem; /* 4px - Tight spacing, icon gaps */
|
|
51
|
+
--space-sm: 0.5rem; /* 8px - Small padding, minimal gaps */
|
|
52
|
+
--space-md: 1rem; /* 16px - Standard padding, form gaps */
|
|
53
|
+
--space-lg: 1.5rem; /* 24px - Section spacing, content padding */
|
|
54
|
+
--space-xl: 2rem; /* 32px - Large section spacing */
|
|
55
|
+
|
|
56
|
+
/* ========================================
|
|
57
|
+
TYPOGRAPHY
|
|
58
|
+
======================================== */
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Font Family - System Font Stack
|
|
62
|
+
* Uses system fonts for zero latency and consistent native appearance
|
|
63
|
+
* Respects OS font preferences (SF Pro on macOS, Segoe UI on Windows, etc.)
|
|
64
|
+
*/
|
|
65
|
+
--font-family:
|
|
66
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
|
|
67
|
+
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Font Sizes
|
|
71
|
+
* Base size is 16px (1rem), all other sizes are relative
|
|
72
|
+
*/
|
|
73
|
+
--font-size-base: 1rem; /* 16px - Body text, buttons, inputs */
|
|
74
|
+
--font-size-small: 0.875rem; /* 14px - Small text, debug panel */
|
|
75
|
+
--font-size-large: 1.25rem; /* 20px - Large body text */
|
|
76
|
+
--font-size-h1: 1.5rem; /* 24px - Page titles (demo-title) */
|
|
77
|
+
--font-size-h2: 1.25rem; /* 20px - Section headings */
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Line Heights
|
|
81
|
+
* Base: 1.5 for comfortable reading
|
|
82
|
+
* Tight: 1.2 for headings where compact text is desired
|
|
83
|
+
*/
|
|
84
|
+
--line-height-base: 1.5;
|
|
85
|
+
--line-height-tight: 1.2;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Font Weights
|
|
89
|
+
* Normal: 400 for body text
|
|
90
|
+
* Semibold: 600 for emphasis, headings, buttons
|
|
91
|
+
*/
|
|
92
|
+
--font-weight-normal: 400;
|
|
93
|
+
--font-weight-semibold: 600;
|
|
94
|
+
|
|
95
|
+
/* ========================================
|
|
96
|
+
LAYOUT CONSTANTS
|
|
97
|
+
======================================== */
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Border Styling
|
|
101
|
+
* Consistent border radius and width across all elements
|
|
102
|
+
*/
|
|
103
|
+
--border-radius: 4px;
|
|
104
|
+
--border-width: 1px;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Layout Heights
|
|
108
|
+
* Fixed heights for header and debug panel ensure consistent layout
|
|
109
|
+
*/
|
|
110
|
+
--header-height: 60px;
|
|
111
|
+
--debug-panel-height: 200px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ========================================
|
|
115
|
+
USAGE EXAMPLES
|
|
116
|
+
======================================== */
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Example: Button with design tokens
|
|
120
|
+
*
|
|
121
|
+
* .button {
|
|
122
|
+
* padding: var(--space-sm) var(--space-md);
|
|
123
|
+
* background: var(--color-accent);
|
|
124
|
+
* color: white;
|
|
125
|
+
* border-radius: var(--border-radius);
|
|
126
|
+
* font-weight: var(--font-weight-semibold);
|
|
127
|
+
* border: none;
|
|
128
|
+
* cursor: pointer;
|
|
129
|
+
* }
|
|
130
|
+
*
|
|
131
|
+
* .button:hover {
|
|
132
|
+
* background: var(--color-accent-hover);
|
|
133
|
+
* }
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Example: Card with consistent spacing
|
|
138
|
+
*
|
|
139
|
+
* .card {
|
|
140
|
+
* background: var(--color-bg);
|
|
141
|
+
* border: var(--border-width) solid var(--color-border);
|
|
142
|
+
* border-radius: var(--border-radius);
|
|
143
|
+
* padding: var(--space-lg);
|
|
144
|
+
* margin-bottom: var(--space-md);
|
|
145
|
+
* }
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Example: Typography using tokens
|
|
150
|
+
*
|
|
151
|
+
* h1 {
|
|
152
|
+
* font-size: var(--font-size-h1);
|
|
153
|
+
* font-weight: var(--font-weight-semibold);
|
|
154
|
+
* line-height: var(--line-height-tight);
|
|
155
|
+
* color: var(--color-text);
|
|
156
|
+
* margin-bottom: var(--space-md);
|
|
157
|
+
* }
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
/* ========================================
|
|
161
|
+
IMPORTANT NOTES
|
|
162
|
+
======================================== */
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 1. ALWAYS use var() to reference tokens - never hardcode values
|
|
166
|
+
* ✅ CORRECT: color: var(--color-accent);
|
|
167
|
+
* ❌ WRONG: color: #14b8a6;
|
|
168
|
+
*
|
|
169
|
+
* 2. This file should be imported FIRST in your stylesheet cascade
|
|
170
|
+
* It defines variables that other stylesheets depend on
|
|
171
|
+
*
|
|
172
|
+
* 3. Browser support: IE 11+ (excellent support across all modern browsers)
|
|
173
|
+
* Fallback pattern if needed: color: #14b8a6; color: var(--color-accent);
|
|
174
|
+
*
|
|
175
|
+
* 4. Token modifications:
|
|
176
|
+
* - To change a value globally: Modify the token definition here
|
|
177
|
+
* - To override for specific demo: Use new token in that demo's CSS
|
|
178
|
+
* - To maintain consistency: Update all 5 demos simultaneously
|
|
179
|
+
*
|
|
180
|
+
* 5. Runtime theming:
|
|
181
|
+
* CSS Custom Properties can be modified via JavaScript if needed:
|
|
182
|
+
* document.documentElement.style.setProperty('--color-accent', '#0ea5e9');
|
|
183
|
+
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@xmachines/shared/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist"
|
|
7
|
+
},
|
|
8
|
+
"references": [
|
|
9
|
+
{ "path": "../../../play-xstate" },
|
|
10
|
+
{ "path": "../.." },
|
|
11
|
+
{ "path": "../../../play-catalog" }
|
|
12
|
+
],
|
|
13
|
+
"include": ["src/**/*"]
|
|
14
|
+
}
|