create-template-html-css 1.7.0 ā 1.8.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/CHANGELOG.md +102 -0
- package/COMPONENTS-GALLERY.html +773 -0
- package/PUBLISH-GUIDE.md +112 -0
- package/README.md +177 -1
- package/bin/cli.js +153 -5
- package/create-template-html-css-1.8.0.tgz +0 -0
- package/package.json +3 -2
- package/src/generator.js +204 -3
- package/src/inserter.js +7 -1
- package/templates/login/index.html +58 -0
- package/templates/login/script.js +83 -0
- package/templates/login/style.css +232 -0
- package/templates/navigation/index.html +51 -0
- package/templates/navigation/script.js +109 -3
- package/templates/navigation/style.css +269 -0
- package/templates/register/index.html +85 -0
- package/templates/register/script.js +205 -0
- package/templates/register/style.css +298 -0
- package/templates/skeleton/index.html +115 -0
- package/templates/skeleton/script.js +28 -0
- package/templates/skeleton/style.css +409 -0
- package/demo/css/accordion-component.css +0 -135
- package/demo/css/button-component.css +0 -110
- package/demo/css/card-component.css +0 -381
- package/demo/index.html +0 -169
- package/demo/js/accordion-component.js +0 -31
- package/demo/js/button-component.js +0 -17
- package/demo/js/card-component.js +0 -124
package/PUBLISH-GUIDE.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Publishing Guide for v1.8.0
|
|
2
|
+
|
|
3
|
+
## Pre-Publish Checklist ā
|
|
4
|
+
|
|
5
|
+
- [x] Version updated to 1.8.0 in package.json
|
|
6
|
+
- [x] Version updated to 1.8.0 in bin/cli.js
|
|
7
|
+
- [x] README.md updated with all features
|
|
8
|
+
- [x] CHANGELOG.md updated with v1.8.0 features
|
|
9
|
+
- [x] All commits pushed to GitHub
|
|
10
|
+
- [x] Security audit passed (npm audit: 0 vulnerabilities)
|
|
11
|
+
- [x] No Hebrew text in codebase
|
|
12
|
+
- [x] Path traversal protection added
|
|
13
|
+
- [x] Input validation verified
|
|
14
|
+
- [x] All 26 components available and tested
|
|
15
|
+
|
|
16
|
+
## Features in v1.8.0
|
|
17
|
+
|
|
18
|
+
### š Dark Mode Support
|
|
19
|
+
- Automatic `prefers-color-scheme: dark` detection
|
|
20
|
+
- `--dark-mode` flag to enable dark theme support
|
|
21
|
+
|
|
22
|
+
### šØ Color Customizer with Presets
|
|
23
|
+
- 10 preset color schemes: vibrant, pastel, ocean, sunset, forest, purple, minimal, coral, teal, neon
|
|
24
|
+
- `--color-scheme` flag for preset selection
|
|
25
|
+
- Interactive CLI color selection (preset/custom/skip)
|
|
26
|
+
- Hex color validation
|
|
27
|
+
- Automatic RGB conversion for rgba() support
|
|
28
|
+
|
|
29
|
+
### š Interactive Component Gallery
|
|
30
|
+
- Browse all 26 components with descriptions
|
|
31
|
+
- Search and filter by category
|
|
32
|
+
- Live color scheme preview with hex values
|
|
33
|
+
- Copy commands (both npx and local)
|
|
34
|
+
- Dark mode support
|
|
35
|
+
- Print-friendly layout
|
|
36
|
+
- Mobile responsive design
|
|
37
|
+
|
|
38
|
+
### šŖ Gallery Command
|
|
39
|
+
- `create-template gallery` opens COMPONENTS-GALLERY.html in browser
|
|
40
|
+
- Cross-platform support (Windows, macOS, Linux)
|
|
41
|
+
|
|
42
|
+
### š¦ Package Updates
|
|
43
|
+
- Added `open` dependency for cross-platform file opening
|
|
44
|
+
- Updated .npmignore to exclude development files
|
|
45
|
+
- All dependencies verified and security audited
|
|
46
|
+
|
|
47
|
+
## Publishing Steps
|
|
48
|
+
|
|
49
|
+
### 1. Login to npm (if not already logged in)
|
|
50
|
+
```bash
|
|
51
|
+
npm login
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Verify package contents
|
|
55
|
+
```bash
|
|
56
|
+
npm pack
|
|
57
|
+
# This creates a .tgz file showing what will be published
|
|
58
|
+
tar -tzf create-template-html-css-1.8.0.tgz | head -20
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Publish to npm
|
|
62
|
+
```bash
|
|
63
|
+
npm publish
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. Verify published package
|
|
67
|
+
```bash
|
|
68
|
+
npm info create-template-html-css
|
|
69
|
+
npm view create-template-html-css@1.8.0
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 5. Test installation from npm
|
|
73
|
+
```bash
|
|
74
|
+
npm install -g create-template-html-css@1.8.0
|
|
75
|
+
create-template --version
|
|
76
|
+
create-template list
|
|
77
|
+
create-template gallery
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 6. Push commits to GitHub
|
|
81
|
+
```bash
|
|
82
|
+
git push origin main
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Post-Publish Tasks
|
|
86
|
+
|
|
87
|
+
- [ ] Add release tag: `git tag -a v1.8.0 -m "Release v1.8.0"`
|
|
88
|
+
- [ ] Push tags: `git push origin v1.8.0`
|
|
89
|
+
- [ ] Create GitHub Release with changelog
|
|
90
|
+
- [ ] Update social media/documentation sites
|
|
91
|
+
- [ ] Monitor npm page for feedback
|
|
92
|
+
|
|
93
|
+
## Package Statistics
|
|
94
|
+
|
|
95
|
+
- **Version**: 1.8.0
|
|
96
|
+
- **License**: MIT
|
|
97
|
+
- **Repository**: https://github.com/benshabbat/create-template-html-css
|
|
98
|
+
- **NPM**: https://www.npmjs.com/package/create-template-html-css
|
|
99
|
+
- **Components**: 26 total
|
|
100
|
+
- **Color Schemes**: 10 presets
|
|
101
|
+
- **Dependencies**: 3 (chalk, commander, inquirer, open)
|
|
102
|
+
- **DevDependencies**: 1 (prettier)
|
|
103
|
+
|
|
104
|
+
## Security & Quality
|
|
105
|
+
|
|
106
|
+
- ā
No vulnerabilities (npm audit: 0)
|
|
107
|
+
- ā
Path traversal protection implemented
|
|
108
|
+
- ā
Input validation on all user inputs
|
|
109
|
+
- ā
Component whitelist validation
|
|
110
|
+
- ā
HTML structure validation
|
|
111
|
+
- ā
Cross-platform support verified
|
|
112
|
+
- ā
All code is English (no Hebrew text)
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ npm install -g create-template-html-css
|
|
|
33
33
|
- š **Stunning Gradients** - Colorful and attractive designs
|
|
34
34
|
- ā” **Animations** - Smooth and professional effects
|
|
35
35
|
- š§ **Customizable** - Easy to edit and modify the code
|
|
36
|
-
- š¦ **
|
|
36
|
+
- š¦ **26 Templates** - Button, Card, Form, Navigation, Modal, Footer, Hero, Slider, Table, Login, Register, Skeleton, Spinner, Animated Cards, Typing Effect, Fade Gallery, Grid Layouts, Masonry Grid, Dashboard, Flexbox Layouts, Todo List, Counter, Accordion, Tabs
|
|
37
37
|
- šÆ **Two Modes** - Create new projects or insert into existing HTML pages
|
|
38
38
|
- š **Secure** - Input validation and path protection
|
|
39
39
|
- š **Well Documented** - Comprehensive guides and examples
|
|
@@ -43,6 +43,90 @@ npm install -g create-template-html-css
|
|
|
43
43
|
- š¾ **Simple Backups** - Clean backup naming without timestamps (v1.6.2+)
|
|
44
44
|
- šÆ **Customizable Components** - Choose navigation items and form fields during creation (v1.7.0+)
|
|
45
45
|
|
|
46
|
+
## š What's New in v1.8.0
|
|
47
|
+
|
|
48
|
+
### š Dark Mode Support
|
|
49
|
+
Every component now supports automatic dark mode detection:
|
|
50
|
+
- Add `--dark-mode` flag to enable dark mode styles
|
|
51
|
+
- Uses `prefers-color-scheme: dark` media query
|
|
52
|
+
- Automatic color inversion in dark theme
|
|
53
|
+
- Perfect for modern user preferences
|
|
54
|
+
|
|
55
|
+
**Example:**
|
|
56
|
+
```bash
|
|
57
|
+
create-template create -c button -n my-button --dark-mode
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### šØ Color Customizer
|
|
61
|
+
Create components with custom colors instantly:
|
|
62
|
+
- Use `--primary-color <hex>` flag for primary gradient color
|
|
63
|
+
- Use `--secondary-color <hex>` flag for secondary color
|
|
64
|
+
- Automatic CSS variables generation
|
|
65
|
+
- RGB values automatically calculated
|
|
66
|
+
|
|
67
|
+
**Custom Colors:**
|
|
68
|
+
```bash
|
|
69
|
+
create-template create -c button --primary-color "#FF5733"
|
|
70
|
+
create-template create -c card --primary-color "#667eea" --secondary-color "#764ba2"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### šØ Preset Color Schemes
|
|
74
|
+
10 beautiful color schemes ready to use instantly:
|
|
75
|
+
|
|
76
|
+
| Scheme | Primary | Secondary | Use Case |
|
|
77
|
+
|--------|---------|-----------|----------|
|
|
78
|
+
| **Vibrant** | #FF6B6B | #4ECDC4 | Bold, energetic designs |
|
|
79
|
+
| **Pastel** | #FFB3BA | #FFDFBA | Soft, friendly interfaces |
|
|
80
|
+
| **Ocean** | #0066CC | #00CCFF | Professional, tech-focused |
|
|
81
|
+
| **Sunset** | #FF6B35 | #FFA500 | Warm, engaging UIs |
|
|
82
|
+
| **Forest** | #2D6A4F | #40916C | Natural, organic themes |
|
|
83
|
+
| **Purple** | #7209B7 | #B5179E | Elegant, premium feel |
|
|
84
|
+
| **Minimal** | #1A1A1A | #666666 | Clean, modern look |
|
|
85
|
+
| **Coral** | #FF6B9D | #FFA07A | Playful, warm designs |
|
|
86
|
+
| **Teal** | #008B8B | #20B2AA | Balanced, professional |
|
|
87
|
+
| **Neon** | #FF006E | #00D9FF | Bold, futuristic style |
|
|
88
|
+
|
|
89
|
+
**Usage:**
|
|
90
|
+
```bash
|
|
91
|
+
# Using the vibrant color scheme
|
|
92
|
+
create-template create -c button -n vibrant-button --color-scheme vibrant
|
|
93
|
+
|
|
94
|
+
# Using the ocean color scheme
|
|
95
|
+
create-template create -c card -n ocean-card --color-scheme ocean
|
|
96
|
+
|
|
97
|
+
# Interactive mode - select from presets
|
|
98
|
+
create-template create -c modal
|
|
99
|
+
# Then choose "Use preset color schemes" option
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**View All Schemes:** Run `create-template gallery` to see live previews of all color schemes with swatches.
|
|
103
|
+
|
|
104
|
+
### š Interactive Component Gallery
|
|
105
|
+
New **COMPONENTS-GALLERY.html** showcase page:
|
|
106
|
+
- Browse all 26 components with descriptions
|
|
107
|
+
- Search and filter by category
|
|
108
|
+
- View all 10 color scheme presets with color swatches
|
|
109
|
+
- Copy CLI commands (both npx and local) with one click
|
|
110
|
+
- Dark mode support
|
|
111
|
+
- Print-friendly layout
|
|
112
|
+
- Mobile responsive design
|
|
113
|
+
|
|
114
|
+
**Open gallery:**
|
|
115
|
+
```bash
|
|
116
|
+
# After global install
|
|
117
|
+
create-template gallery
|
|
118
|
+
|
|
119
|
+
# Or run directly with npx (first install package)
|
|
120
|
+
npx create-template-html-css
|
|
121
|
+
# Then run:
|
|
122
|
+
create-template gallery
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### š Enhanced Documentation
|
|
126
|
+
- Updated README with all new features
|
|
127
|
+
- Improved CLI help text with examples
|
|
128
|
+
- Detailed component showcase with features
|
|
129
|
+
|
|
46
130
|
## š What's New in v1.7.0
|
|
47
131
|
|
|
48
132
|
### šÆ Customizable Navigation
|
|
@@ -321,6 +405,86 @@ Dialog boxes for various purposes:
|
|
|
321
405
|
- Smooth animations
|
|
322
406
|
- Backdrop blur effect
|
|
323
407
|
|
|
408
|
+
### 6. Login (NEW in v1.8.0)
|
|
409
|
+
|
|
410
|
+
Complete authentication login form with validation and social login:
|
|
411
|
+
|
|
412
|
+
**Features:**
|
|
413
|
+
- Email validation
|
|
414
|
+
- Password validation (minimum 6 characters)
|
|
415
|
+
- "Remember me" checkbox
|
|
416
|
+
- "Forgot password" link
|
|
417
|
+
- Social login buttons (Google, GitHub)
|
|
418
|
+
- Real-time form validation
|
|
419
|
+
- Focus states and animations
|
|
420
|
+
- Responsive design
|
|
421
|
+
- Modal integration with navigation
|
|
422
|
+
|
|
423
|
+
**Includes:**
|
|
424
|
+
- Login form with email/password fields
|
|
425
|
+
- Remember me functionality
|
|
426
|
+
- Forgot password handler
|
|
427
|
+
- Social authentication placeholders
|
|
428
|
+
- Professional gradient styling
|
|
429
|
+
- Mobile-optimized layout
|
|
430
|
+
|
|
431
|
+
### 7. Register (NEW in v1.8.0)
|
|
432
|
+
|
|
433
|
+
Advanced user registration form with real-time password validation:
|
|
434
|
+
|
|
435
|
+
**Features:**
|
|
436
|
+
- Full name, email, username fields
|
|
437
|
+
- Real-time password strength validation
|
|
438
|
+
- Password requirements display:
|
|
439
|
+
- Minimum 8 characters
|
|
440
|
+
- Uppercase letter required
|
|
441
|
+
- Number required
|
|
442
|
+
- Special character required (@, #, $, %)
|
|
443
|
+
- Password matching validation
|
|
444
|
+
- Username validation (3-20 characters, alphanumeric + underscore)
|
|
445
|
+
- Terms of Service checkbox
|
|
446
|
+
- Newsletter subscription option
|
|
447
|
+
- Dynamic submit button (enabled only when all requirements met)
|
|
448
|
+
- Social registration buttons (Google, GitHub)
|
|
449
|
+
- Real-time visual feedback
|
|
450
|
+
|
|
451
|
+
**Includes:**
|
|
452
|
+
- Registration form with custom fields
|
|
453
|
+
- Live password strength checker
|
|
454
|
+
- Visual requirement indicators (ā/ā)
|
|
455
|
+
- Matching password validator
|
|
456
|
+
- Professional styling
|
|
457
|
+
- Mobile-responsive layout
|
|
458
|
+
|
|
459
|
+
### 8. Skeleton (NEW in v1.8.0)
|
|
460
|
+
|
|
461
|
+
Loading placeholders with smooth shimmer animation - perfect for displaying while content loads:
|
|
462
|
+
|
|
463
|
+
**Features:**
|
|
464
|
+
- Multiple skeleton variations (card, article, list, profile, grid)
|
|
465
|
+
- Smooth shimmer animation effect
|
|
466
|
+
- Fade-in animations for loaded content
|
|
467
|
+
- Toggle between skeleton and actual content
|
|
468
|
+
- Professional gray gradient styling
|
|
469
|
+
- Responsive grid layout
|
|
470
|
+
- ESC key support for controls
|
|
471
|
+
|
|
472
|
+
**Includes:**
|
|
473
|
+
- Card skeleton with image and content blocks
|
|
474
|
+
- Article skeleton with avatar and text
|
|
475
|
+
- List skeleton with multiple items
|
|
476
|
+
- Profile skeleton with cover and info sections
|
|
477
|
+
- Grid skeleton for gallery-like layouts
|
|
478
|
+
- Toggle button to switch between skeleton and demo content
|
|
479
|
+
- Demo content section with real images and text
|
|
480
|
+
- Mobile-responsive design
|
|
481
|
+
|
|
482
|
+
**Perfect For:**
|
|
483
|
+
- Loading states in applications
|
|
484
|
+
- API response delays
|
|
485
|
+
- Perceived performance optimization
|
|
486
|
+
- Professional user experience
|
|
487
|
+
|
|
324
488
|
### 6. Footer
|
|
325
489
|
|
|
326
490
|
Professional footer section:
|
|
@@ -677,6 +841,18 @@ See [SECURITY.md](SECURITY.md) for more details.
|
|
|
677
841
|
- **[Security Policy](SECURITY.md)** - Security guidelines
|
|
678
842
|
- **[Component Showcase](SHOWCASE.html)** - View all components in action
|
|
679
843
|
|
|
844
|
+
## š Security
|
|
845
|
+
|
|
846
|
+
This project includes security features to protect your files:
|
|
847
|
+
|
|
848
|
+
- **Component Whitelist** - Only validated components can be inserted
|
|
849
|
+
- **Path Traversal Protection** - Prevents access to files outside the working directory
|
|
850
|
+
- **Input Validation** - Hex color validation and component name validation
|
|
851
|
+
- **HTML Structure Validation** - Ensures proper HTML structure before insertion
|
|
852
|
+
- **Zero Dependencies for Security** - Uses only Node.js built-in modules for security checks
|
|
853
|
+
|
|
854
|
+
For security concerns, see [SECURITY.md](SECURITY.md)
|
|
855
|
+
|
|
680
856
|
## š¤ Contributing
|
|
681
857
|
|
|
682
858
|
Contributions are welcome! Here's how you can help:
|
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,8 @@ const { program } = require("commander");
|
|
|
4
4
|
const inquirer = require("inquirer").default || require("inquirer");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const fs = require("fs").promises;
|
|
7
|
-
const {
|
|
7
|
+
const { exec } = require("child_process");
|
|
8
|
+
const { generateTemplate, COLOR_SCHEMES } = require("../src/generator");
|
|
8
9
|
const { insertComponent } = require("../src/inserter");
|
|
9
10
|
const chalk = require("chalk");
|
|
10
11
|
|
|
@@ -13,7 +14,7 @@ program
|
|
|
13
14
|
.description(
|
|
14
15
|
chalk.cyan("šØ Create HTML/CSS UI component templates in seconds"),
|
|
15
16
|
)
|
|
16
|
-
.version("1.
|
|
17
|
+
.version("1.8.1");
|
|
17
18
|
|
|
18
19
|
// Add intro message
|
|
19
20
|
program.on("--help", () => {
|
|
@@ -22,6 +23,12 @@ program.on("--help", () => {
|
|
|
22
23
|
" $ create-template create # Interactive mode",
|
|
23
24
|
);
|
|
24
25
|
console.log(" $ create-template create -c button -n my-btn # With flags");
|
|
26
|
+
console.log(
|
|
27
|
+
" $ create-template create -c card --dark-mode --color-scheme vibrant # With preset colors",
|
|
28
|
+
);
|
|
29
|
+
console.log(
|
|
30
|
+
" $ create-template create -c card --primary-color #FF5733 # With custom colors",
|
|
31
|
+
);
|
|
25
32
|
console.log(
|
|
26
33
|
" $ create-template insert # Interactive mode",
|
|
27
34
|
);
|
|
@@ -34,6 +41,14 @@ program.on("--help", () => {
|
|
|
34
41
|
console.log(
|
|
35
42
|
" $ create-template list # List all templates",
|
|
36
43
|
);
|
|
44
|
+
console.log(
|
|
45
|
+
" $ create-template gallery # Open interactive gallery",
|
|
46
|
+
);
|
|
47
|
+
console.log("");
|
|
48
|
+
console.log(chalk.yellow("Available Color Schemes:"));
|
|
49
|
+
Object.entries(COLOR_SCHEMES).forEach(([key, scheme]) => {
|
|
50
|
+
console.log(` ${key.padEnd(12)} - ${scheme.description}`);
|
|
51
|
+
});
|
|
37
52
|
console.log("");
|
|
38
53
|
console.log(chalk.yellow("Create Command Flags:"));
|
|
39
54
|
console.log(
|
|
@@ -43,6 +58,15 @@ program.on("--help", () => {
|
|
|
43
58
|
console.log(
|
|
44
59
|
" --include-js Include JavaScript file (default: true)",
|
|
45
60
|
);
|
|
61
|
+
console.log(
|
|
62
|
+
" --dark-mode Add dark mode support (prefers-color-scheme)",
|
|
63
|
+
);
|
|
64
|
+
console.log(
|
|
65
|
+
" --primary-color <hex> Primary color (e.g., #667eea)",
|
|
66
|
+
);
|
|
67
|
+
console.log(
|
|
68
|
+
" --secondary-color <hex> Secondary color (e.g., #764ba2)",
|
|
69
|
+
);
|
|
46
70
|
console.log(" --no-include-js Exclude JavaScript file");
|
|
47
71
|
console.log(" -v, --verbose Show detailed output");
|
|
48
72
|
console.log("");
|
|
@@ -67,6 +91,10 @@ program
|
|
|
67
91
|
.option("-n, --name <name>", "Component name/project name")
|
|
68
92
|
.option("--include-js", "Include JavaScript file", true)
|
|
69
93
|
.option("--no-include-js", "Exclude JavaScript file")
|
|
94
|
+
.option("--dark-mode", "Add dark mode support (prefers-color-scheme)")
|
|
95
|
+
.option("--primary-color <color>", "Primary color (hex format: #667eea)")
|
|
96
|
+
.option("--secondary-color <color>", "Secondary color (hex format: #764ba2)")
|
|
97
|
+
.option("--color-scheme <scheme>", "Use a color scheme preset (vibrant, pastel, ocean, sunset, forest, purple, minimal, coral, teal, neon)")
|
|
70
98
|
.option("-v, --verbose", "Verbose output")
|
|
71
99
|
.action(async (options) => {
|
|
72
100
|
try {
|
|
@@ -84,6 +112,10 @@ program
|
|
|
84
112
|
component: options.component,
|
|
85
113
|
name: options.name,
|
|
86
114
|
includeJs: options.includeJs,
|
|
115
|
+
darkMode: options.darkMode,
|
|
116
|
+
colorScheme: options.colorScheme,
|
|
117
|
+
primaryColor: options.primaryColor,
|
|
118
|
+
secondaryColor: options.secondaryColor,
|
|
87
119
|
};
|
|
88
120
|
|
|
89
121
|
await generateTemplate(createOptions);
|
|
@@ -121,6 +153,11 @@ program
|
|
|
121
153
|
{ name: "Hero Section", value: "hero" },
|
|
122
154
|
{ name: "Slider", value: "slider" },
|
|
123
155
|
{ name: "Table", value: "table" },
|
|
156
|
+
new inquirer.Separator(chalk.gray("ā Authentication Forms")),
|
|
157
|
+
{ name: "Login Form", value: "login" },
|
|
158
|
+
{ name: "Register Form", value: "register" },
|
|
159
|
+
new inquirer.Separator(chalk.gray("ā Loading Placeholders")),
|
|
160
|
+
{ name: "Skeleton (Loading Placeholders)", value: "skeleton" },
|
|
124
161
|
new inquirer.Separator(chalk.gray("ā Animation Templates")),
|
|
125
162
|
{ name: "Spinner (Loading Animations)", value: "spinner" },
|
|
126
163
|
{
|
|
@@ -309,6 +346,68 @@ program
|
|
|
309
346
|
return true;
|
|
310
347
|
},
|
|
311
348
|
},
|
|
349
|
+
{
|
|
350
|
+
type: "confirm",
|
|
351
|
+
name: "darkMode",
|
|
352
|
+
message: "Add dark mode support (prefers-color-scheme)?",
|
|
353
|
+
default: false,
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
type: "list",
|
|
357
|
+
name: "colorOption",
|
|
358
|
+
message: "How would you like to choose colors?",
|
|
359
|
+
choices: [
|
|
360
|
+
{ name: "Use a preset color scheme", value: "preset" },
|
|
361
|
+
{ name: "Enter custom hex colors", value: "custom" },
|
|
362
|
+
{ name: "Skip color customization", value: "skip" },
|
|
363
|
+
],
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
type: "list",
|
|
367
|
+
name: "colorScheme",
|
|
368
|
+
message: "Choose a color scheme:",
|
|
369
|
+
choices: Object.entries(COLOR_SCHEMES).map(([key, scheme]) => ({
|
|
370
|
+
name: `${scheme.name} - ${scheme.description}`,
|
|
371
|
+
value: key,
|
|
372
|
+
})),
|
|
373
|
+
when: (answers) => answers.colorOption === "preset",
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
type: "input",
|
|
377
|
+
name: "primaryColor",
|
|
378
|
+
message: "Primary color (hex format, e.g., #667eea) [skip for default]:",
|
|
379
|
+
default: "",
|
|
380
|
+
when: (answers) => answers.colorOption === "custom",
|
|
381
|
+
validate: (input) => {
|
|
382
|
+
if (!input || input.trim().length === 0) {
|
|
383
|
+
return true; // Optional field
|
|
384
|
+
}
|
|
385
|
+
// Basic hex color validation
|
|
386
|
+
const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
387
|
+
if (!hexRegex.test(input.trim())) {
|
|
388
|
+
return "Please enter a valid hex color (e.g., #667eea)";
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
type: "input",
|
|
395
|
+
name: "secondaryColor",
|
|
396
|
+
message: "Secondary color (hex format, e.g., #764ba2) [skip for default]:",
|
|
397
|
+
default: "",
|
|
398
|
+
when: (answers) => answers.colorOption === "custom",
|
|
399
|
+
validate: (input) => {
|
|
400
|
+
if (!input || input.trim().length === 0) {
|
|
401
|
+
return true; // Optional field
|
|
402
|
+
}
|
|
403
|
+
// Basic hex color validation
|
|
404
|
+
const hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
405
|
+
if (!hexRegex.test(input.trim())) {
|
|
406
|
+
return "Please enter a valid hex color (e.g., #764ba2)";
|
|
407
|
+
}
|
|
408
|
+
return true;
|
|
409
|
+
},
|
|
410
|
+
},
|
|
312
411
|
]);
|
|
313
412
|
|
|
314
413
|
// Always include JavaScript file
|
|
@@ -433,6 +532,11 @@ program
|
|
|
433
532
|
{ name: "Hero Section", value: "hero" },
|
|
434
533
|
{ name: "Slider", value: "slider" },
|
|
435
534
|
{ name: "Table", value: "table" },
|
|
535
|
+
new inquirer.Separator(chalk.gray("ā Authentication Forms")),
|
|
536
|
+
{ name: "Login Form", value: "login" },
|
|
537
|
+
{ name: "Register Form", value: "register" },
|
|
538
|
+
new inquirer.Separator(chalk.gray("ā Loading Placeholders")),
|
|
539
|
+
{ name: "Skeleton (Loading Placeholders)", value: "skeleton" },
|
|
436
540
|
new inquirer.Separator(chalk.gray("ā Animation Templates")),
|
|
437
541
|
{ name: "Spinner", value: "spinner" },
|
|
438
542
|
{ name: "Animated Card", value: "animated-card" },
|
|
@@ -497,7 +601,7 @@ program
|
|
|
497
601
|
.command("list")
|
|
498
602
|
.description(chalk.green("List all available templates"))
|
|
499
603
|
.action(() => {
|
|
500
|
-
console.log("\n" + chalk.blue("š¦ Available Components (
|
|
604
|
+
console.log("\n" + chalk.blue("š¦ Available Components (26 total)\n"));
|
|
501
605
|
|
|
502
606
|
console.log(chalk.yellow("ā Basic Components (9)"));
|
|
503
607
|
console.log(" button Styled button component");
|
|
@@ -510,6 +614,13 @@ program
|
|
|
510
614
|
console.log(" slider Image carousel with navigation");
|
|
511
615
|
console.log(" table Data table with search and filtering");
|
|
512
616
|
|
|
617
|
+
console.log("\n" + chalk.green("ā Authentication Forms (2)"));
|
|
618
|
+
console.log(" login Login form with validation");
|
|
619
|
+
console.log(" register Register form with password requirements");
|
|
620
|
+
|
|
621
|
+
console.log("\n" + chalk.cyan("ā Loading Placeholders (1)"));
|
|
622
|
+
console.log(" skeleton Skeleton loading placeholder with shimmer animation");
|
|
623
|
+
|
|
513
624
|
console.log("\n" + chalk.magenta("ā Animation Templates (4)"));
|
|
514
625
|
console.log(" spinner 5 loading spinner variations");
|
|
515
626
|
console.log(" animated-card 6 interactive card animations");
|
|
@@ -521,7 +632,7 @@ program
|
|
|
521
632
|
console.log(" masonry-grid Pinterest-style masonry layout");
|
|
522
633
|
console.log(" dashboard-grid Complete admin dashboard (Grid)");
|
|
523
634
|
|
|
524
|
-
console.log("\n" + chalk.
|
|
635
|
+
console.log("\n" + chalk.blue("ā Flexbox Layouts (3)"));
|
|
525
636
|
console.log(" flex-layout Flexbox patterns and examples");
|
|
526
637
|
console.log(" flex-cards Equal-height card layouts");
|
|
527
638
|
console.log(" flex-dashboard Complete admin dashboard (Flexbox)");
|
|
@@ -538,6 +649,41 @@ program
|
|
|
538
649
|
console.log("");
|
|
539
650
|
});
|
|
540
651
|
|
|
652
|
+
program
|
|
653
|
+
.command("gallery")
|
|
654
|
+
.description(chalk.magenta("šØ Open interactive component gallery in browser"))
|
|
655
|
+
.action(async () => {
|
|
656
|
+
try {
|
|
657
|
+
const galleryPath = path.join(__dirname, "..", "COMPONENTS-GALLERY.html");
|
|
658
|
+
const fileUrl = `file:///${galleryPath.replace(/\\/g, "/")}`;
|
|
659
|
+
|
|
660
|
+
console.log(chalk.cyan("\nšØ Opening Component Gallery...\n"));
|
|
661
|
+
|
|
662
|
+
// Cross-platform: open file in default browser
|
|
663
|
+
let command;
|
|
664
|
+
if (process.platform === "win32") {
|
|
665
|
+
command = `start "" "${galleryPath}"`;
|
|
666
|
+
} else if (process.platform === "darwin") {
|
|
667
|
+
command = `open "${galleryPath}"`;
|
|
668
|
+
} else {
|
|
669
|
+
// Linux and others
|
|
670
|
+
command = `xdg-open "${galleryPath}"`;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
exec(command, (error) => {
|
|
674
|
+
if (error) {
|
|
675
|
+
console.error(chalk.red("ā Could not open gallery:"), error.message);
|
|
676
|
+
console.log(chalk.gray(`Try opening manually: ${galleryPath}`));
|
|
677
|
+
} else {
|
|
678
|
+
console.log(chalk.green("ā Gallery opened in your browser!"));
|
|
679
|
+
console.log(chalk.gray(`Location: ${galleryPath}\n`));
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
} catch (error) {
|
|
683
|
+
console.error(chalk.red("ā Error:"), error.message);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
|
|
541
687
|
program.parse(process.argv);
|
|
542
688
|
|
|
543
689
|
if (!process.argv.slice(2).length) {
|
|
@@ -547,11 +693,13 @@ if (!process.argv.slice(2).length) {
|
|
|
547
693
|
console.log(" create Create a new template component");
|
|
548
694
|
console.log(" insert Insert component into existing HTML file");
|
|
549
695
|
console.log(" list Show all available templates");
|
|
696
|
+
console.log(" gallery Open interactive component gallery");
|
|
550
697
|
console.log(" help Display help information\n");
|
|
551
698
|
console.log(chalk.gray("Interactive Examples:"));
|
|
552
699
|
console.log(" $ create-template create # Create with prompts");
|
|
553
700
|
console.log(" $ create-template insert # Insert with prompts");
|
|
554
|
-
console.log(" $ create-template
|
|
701
|
+
console.log(" $ create-template gallery # View all components in gallery");
|
|
702
|
+
console.log(" $ create-template list # View all 26 templates\n");
|
|
555
703
|
console.log(chalk.gray("Flag Examples (Non-interactive):"));
|
|
556
704
|
console.log(" $ create-template create -c button -n my-btn");
|
|
557
705
|
console.log(" $ create-template insert -f index.html -c card -s separate");
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-template-html-css",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "CLI tool to generate HTML and CSS templates for common UI elements",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"chalk": "^4.1.2",
|
|
55
55
|
"commander": "^11.1.0",
|
|
56
|
-
"inquirer": "^9.2.12"
|
|
56
|
+
"inquirer": "^9.2.12",
|
|
57
|
+
"open": "^11.0.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"prettier": "^3.8.1"
|