Skip to content

Commit a4850c4

Browse files
author
danil-nizamov
committed
updated agents context
1 parent 67b152b commit a4850c4

File tree

2 files changed

+103
-264
lines changed

2 files changed

+103
-264
lines changed
Lines changed: 103 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,103 @@
1+
# BESPOKE GENERALIZED COMPONENTS - IMPLEMENTATION CONTEXT
2+
3+
This document provides precise implementation instructions for creating embedded applications using the Bespoke generalized components. Follow these instructions exactly to ensure consistency across all applications.
4+
5+
## REQUIRED FILES STRUCTURE
6+
7+
Every application MUST include these files in the following order:
8+
9+
1. bespoke.css (core styling framework)
10+
2. help-modal.js (help system)
11+
3. app.js (application logic)
12+
4. server.js (server)
13+
14+
## HTML TEMPLATE IMPLEMENTATION
15+
16+
1. REPLACE the following placeholders in index.html EXACTLY as specified:
17+
18+
a) `<!-- APP_TITLE -->`
19+
Replace with your application's page title
20+
Example: "Database Designer" or "Task Manager"
21+
22+
b) `<!-- APP_NAME -->`
23+
Replace with your application's display name (appears in header)
24+
Example: "Database Designer" or "Task Manager"
25+
26+
c) `<!-- APP_SPECIFIC_MAIN_CONTENT -->`
27+
Add your application's main content area
28+
Example: `<div id="canvas"></div>` or `<div id="editor"></div>`
29+
30+
d) `<!-- APP_SPECIFIC_CSS -->`
31+
Add links to your application-specific CSS files
32+
Example: `<link rel="stylesheet" href="./my-app.css" />`
33+
34+
e) `<!-- APP_SPECIFIC_SCRIPTS -->`
35+
Add links to your application-specific JavaScript files
36+
Example: `<script src="./my-app-logic.js"></script>`
37+
38+
3. DO NOT modify the core structure (header, script loading order, etc.)
39+
40+
## CSS IMPLEMENTATION
41+
42+
1. ALWAYS use the `.bespoke` class on the body element
43+
2. USE ONLY the provided CSS custom properties for styling:
44+
- Colors: `--bespoke-bg`, `--bespoke-fg`, `--bespoke-accent`, etc.
45+
- Spacing: `--bespoke-space-xs` through `--bespoke-space-2xl`
46+
- Typography: `--bespoke-font-size-*`, `--bespoke-font-weight-*`
47+
- Borders: `--bespoke-radius-*`, `--bespoke-stroke`
48+
- Shadows: `--bespoke-shadow-*`
49+
50+
3. FOR custom styling, create app-specific CSS files
51+
4. OVERRIDE variables in your app-specific CSS, not in bespoke.css
52+
5. FOLLOW the existing naming conventions for consistency
53+
54+
## JAVASCRIPT IMPLEMENTATION
55+
56+
1. HELP MODAL SETUP:
57+
a) Create help content using help-content-template.html as reference
58+
b) Initialize HelpModal with:
59+
- triggerSelector: `'#btn-help'`
60+
- content: your help content (string or loaded from file)
61+
- theme: `'auto'`
62+
63+
2. STATUS MANAGEMENT:
64+
a) Use the provided setStatus() function for status updates
65+
b) Update status for: loading, saving, errors, user actions
66+
c) Keep status messages concise and informative
67+
68+
## ERROR HANDLING REQUIREMENTS
69+
70+
1. WRAP all async operations in try-catch blocks
71+
2. PROVIDE meaningful error messages to users
72+
3. LOG errors to console for debugging
73+
4. IMPLEMENT retry logic for network operations
74+
5. HANDLE localStorage quota exceeded errors
75+
6. VALIDATE data before saving operations
76+
77+
## STATUS MESSAGE CONVENTIONS
78+
79+
Use these EXACT status messages for consistency:
80+
81+
- "Ready" - Application loaded successfully
82+
- "Loading..." - Data is being loaded
83+
- "Saving..." - Data is being saved
84+
- "Changes saved" - Auto-save completed successfully
85+
- "Save failed (will retry)" - Server save failed, will retry
86+
- "Failed to load data" - Data loading failed
87+
- "Auto-save initialized" - Auto-save system started
88+
89+
## FILE NAMING CONVENTIONS
90+
91+
1. CSS files: kebab-case (e.g., my-app.css, task-manager.css)
92+
2. JavaScript files: kebab-case (e.g., my-app.js, task-manager.js)
93+
3. Data files: kebab-case (e.g., solution.json, initial-data.json)
94+
4. Image files: kebab-case (e.g., overview.png, help-icon.svg)
95+
96+
---
97+
198
# BESPOKE CSS SELECTOR GUIDELINES
2-
# Version: 1.0.0
3-
#
4-
# This document explains how to use the Bespoke CSS framework for embedded applications.
99+
100+
This section explains how to use the Bespoke CSS framework for embedded applications.
5101

6102
## OVERVIEW
7103
The Bespoke CSS framework provides a scoped, reusable set of components that can be embedded in any website without conflicts. All styles are scoped under the `.bespoke` class to prevent interference with parent site styles.
@@ -112,7 +208,7 @@ The Bespoke CSS framework provides a scoped, reusable set of components that can
112208
<!-- Checkbox -->
113209
<input type="checkbox" />
114210

115-
<!-- Radio buttons (NON TESTED) -->
211+
<!-- Radio buttons -->
116212
<div class="radio-group">
117213
<label class="row">
118214
<input type="radio" name="option" value="a" />
@@ -124,7 +220,7 @@ The Bespoke CSS framework provides a scoped, reusable set of components that can
124220
</label>
125221
</div>
126222

127-
<!-- Horizontal radio group (NON TESTED) -->
223+
<!-- Horizontal radio group -->
128224
<div class="radio-group horizontal">
129225
<label class="row">
130226
<input type="radio" name="size" value="small" />
@@ -136,10 +232,10 @@ The Bespoke CSS framework provides a scoped, reusable set of components that can
136232
</label>
137233
</div>
138234

139-
<!-- Textarea (NON TESTED) -->
235+
<!-- Textarea -->
140236
<textarea placeholder="Enter your message here..."></textarea>
141237

142-
<!-- Toggle switch (NON TESTED) -->
238+
<!-- Toggle switch -->
143239
<label class="row">
144240
<div class="toggle">
145241
<input type="checkbox" class="toggle-input" />
@@ -163,35 +259,6 @@ The Bespoke CSS framework provides a scoped, reusable set of components that can
163259
<a href="#" class="as-button">Link Button</a>
164260
```
165261

166-
### UTILITY COMPONENTS
167-
168-
#### Flexbox Utilities
169-
```html
170-
<!-- Horizontal row -->
171-
<div class="row">
172-
<span>Item 1</span>
173-
<span>Item 2</span>
174-
</div>
175-
176-
<!-- Space between items -->
177-
<div class="row-between">
178-
<span>Left</span>
179-
<span>Right</span>
180-
</div>
181-
182-
<!-- Spacer -->
183-
<div class="row">
184-
<span>Left</span>
185-
<div class="spacer"></div>
186-
<span>Right</span>
187-
</div>
188-
```
189-
190-
#### Dividers
191-
```html
192-
<hr />
193-
```
194-
195262
### MODAL COMPONENTS
196263

197264
#### Basic Modal
@@ -269,32 +336,6 @@ You can override any CSS custom property to customize the appearance:
269336
### Automatic Dark Mode
270337
The framework automatically detects the user's system preference and switches between light and dark themes. No additional configuration is needed.
271338

272-
### Manual Theme Override
273-
You can force a specific theme by overriding the CSS custom properties:
274-
275-
```css
276-
/* Force light theme */
277-
.bespoke {
278-
--bespoke-bg: #ffffff;
279-
--bespoke-fg: #000000;
280-
/* ... other light theme variables */
281-
}
282-
283-
/* Force dark theme */
284-
.bespoke {
285-
--bespoke-bg: #1a1a1a;
286-
--bespoke-fg: #ffffff;
287-
/* ... other dark theme variables */
288-
}
289-
```
290-
291-
## RESPONSIVE DESIGN
292-
293-
The framework includes responsive breakpoints:
294-
295-
- **Mobile (≤768px)**: Sidebar becomes full-width above content
296-
- **Tablet/Desktop (>768px)**: Sidebar and content side-by-side
297-
298339
## INTEGRATION EXAMPLES
299340

300341
### Database Designer
@@ -326,109 +367,9 @@ The framework includes responsive breakpoints:
326367
</main>
327368
</div>
328369
```
329-
330-
### Quiz Application
331-
```html
332-
<div class="bespoke">
333-
<header class="header">
334-
<h1>Quiz App</h1>
335-
<div class="status">Question 1 of 10</div>
336-
</header>
337-
338-
<main class="main-layout">
339-
<div class="content-area">
340-
<section class="card">
341-
<h2>What is the capital of France?</h2>
342-
<form>
343-
<label class="row">
344-
<input type="radio" name="answer" value="a" />
345-
Paris
346-
</label>
347-
<label class="row">
348-
<input type="radio" name="answer" value="b" />
349-
London
350-
</label>
351-
<button type="submit" class="primary">Submit Answer</button>
352-
</form>
353-
</section>
354-
</div>
355-
</main>
356-
</div>
357-
```
358-
359-
### Form Builder
360-
```html
361-
<div class="bespoke">
362-
<header class="header">
363-
<h1>Form Builder</h1>
364-
<div class="status">3 fields added</div>
365-
</header>
366-
367-
<main class="main-layout">
368-
<aside class="sidebar">
369-
<section class="card">
370-
<h2>Add Field</h2>
371-
<form>
372-
<label>Field Type
373-
<select>
374-
<option>Text Input</option>
375-
<option>Textarea</option>
376-
<option>Select</option>
377-
</select>
378-
</label>
379-
<button type="submit">Add Field</button>
380-
</form>
381-
</section>
382-
</aside>
383-
384-
<div class="content-area">
385-
<!-- Form preview -->
386-
</div>
387-
</main>
388-
</div>
389-
```
390-
391370
## BEST PRACTICES
392371

393372
1. **Always wrap in `.bespoke`**: This prevents style conflicts with the parent site
394373
2. **Use semantic HTML**: Combine with proper HTML elements for accessibility
395374
3. **Customize via CSS variables**: Don't modify the core CSS file
396375
4. **Test in both themes**: Ensure your app works in light and dark modes
397-
5. **Mobile-first**: Design for mobile devices first, then enhance for larger screens
398-
399-
## TROUBLESHOOTING
400-
401-
### Styles Not Applying
402-
- Ensure your content is wrapped in `<div class="bespoke">`
403-
- Check that the CSS file is loaded correctly
404-
- Verify there are no CSS conflicts from the parent site
405-
406-
### Dark Mode Not Working
407-
- Check if the user's system is set to dark mode
408-
- Verify that `@media (prefers-color-scheme: dark)` is supported
409-
- Override CSS variables if manual theme control is needed
410-
411-
### Layout Issues
412-
- Ensure parent containers have proper height/width
413-
- Check for conflicting CSS from the parent site
414-
- Use browser dev tools to inspect computed styles
415-
416-
## NEW COMPONENTS (NON TESTED)
417-
418-
The following components have been added but are marked as NON TESTED. Use with caution and test thoroughly in your specific use case:
419-
420-
### Radio Buttons
421-
- Custom styled radio buttons with accent color theming
422-
- Support for both vertical and horizontal layouts
423-
- Proper focus states and accessibility
424-
425-
### Textarea
426-
- Multi-line text input with vertical resize
427-
- Consistent styling with other form inputs
428-
- Placeholder support
429-
430-
### Toggle Switch
431-
- On/off toggle switch component
432-
- Smooth animations and transitions
433-
- Disabled state support
434-
- Requires specific HTML structure with hidden checkbox

0 commit comments

Comments
 (0)