dimaac 1.0.0
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/README.md +141 -0
- package/index.js +170 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# DiMaac UI CLI
|
|
2
|
+
|
|
3
|
+
Professional CLI tool for installing DiMaac UI components and examples.
|
|
4
|
+
|
|
5
|
+
## Installation Options
|
|
6
|
+
|
|
7
|
+
### Option 1: Global Installation (Recommended)
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g dimaac-ui-cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Option 2: Local Installation
|
|
13
|
+
```bash
|
|
14
|
+
npm install dimaac-ui-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Option 3: Use with npx (No Installation Required)
|
|
18
|
+
```bash
|
|
19
|
+
npx dimaac-ui-cli add component MouseTiltCard
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Install Components
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Global installation
|
|
28
|
+
dimaac add component MouseTiltCard
|
|
29
|
+
dimaac add component TextScrambleReveal
|
|
30
|
+
dimaac add component SwipeableCards
|
|
31
|
+
|
|
32
|
+
# Local installation
|
|
33
|
+
npx dimaac add component MouseTiltCard
|
|
34
|
+
npm run dimaac add component MouseTiltCard
|
|
35
|
+
|
|
36
|
+
# With npx (no installation)
|
|
37
|
+
npx dimaac-ui-cli add component MouseTiltCard
|
|
38
|
+
|
|
39
|
+
# Components will be installed to ./components/{category}/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Install Examples
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Global installation
|
|
46
|
+
dimaac add example MouseTiltCardDemo
|
|
47
|
+
dimaac add example TextScrambleRevealDemo
|
|
48
|
+
dimaac add example SwipeableCardsDemo
|
|
49
|
+
|
|
50
|
+
# Local installation
|
|
51
|
+
npx dimaac add example MouseTiltCardDemo
|
|
52
|
+
npm run dimaac add example MouseTiltCardDemo
|
|
53
|
+
|
|
54
|
+
# With npx (no installation)
|
|
55
|
+
npx dimaac-ui-cli add example MouseTiltCardDemo
|
|
56
|
+
|
|
57
|
+
# Examples will be installed to ./examples/{category}/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### List Available Components
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Global installation
|
|
64
|
+
dimaac list
|
|
65
|
+
|
|
66
|
+
# Local installation
|
|
67
|
+
npx dimaac list
|
|
68
|
+
npm run dimaac list
|
|
69
|
+
|
|
70
|
+
# With npx (no installation)
|
|
71
|
+
npx dimaac-ui-cli list
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Available Components
|
|
75
|
+
|
|
76
|
+
### Cards
|
|
77
|
+
- MouseTiltCard
|
|
78
|
+
- SwipeableCards
|
|
79
|
+
|
|
80
|
+
### Reveals
|
|
81
|
+
- TextScrambleReveal
|
|
82
|
+
- LiquidImageReveal
|
|
83
|
+
|
|
84
|
+
### Interactive
|
|
85
|
+
- MouseTrail
|
|
86
|
+
- ContextMenu
|
|
87
|
+
|
|
88
|
+
### Gallery
|
|
89
|
+
- ScrollingGallery
|
|
90
|
+
- ImageGallery
|
|
91
|
+
|
|
92
|
+
### Loaders
|
|
93
|
+
- TextLoader
|
|
94
|
+
|
|
95
|
+
### Layout
|
|
96
|
+
- ExpandablePanel
|
|
97
|
+
|
|
98
|
+
## Available Examples
|
|
99
|
+
|
|
100
|
+
Each component has a corresponding demo example:
|
|
101
|
+
- MouseTiltCardDemo
|
|
102
|
+
- SwipeableCardsDemo
|
|
103
|
+
- TextScrambleRevealDemo
|
|
104
|
+
- LiquidImageRevealDemo
|
|
105
|
+
- MouseTrailDemo
|
|
106
|
+
- ContextMenuDemo
|
|
107
|
+
- ScrollingGalleryDemo
|
|
108
|
+
- ImageGalleryDemo
|
|
109
|
+
- TextLoaderDemo
|
|
110
|
+
- ExpandablePanelDemo
|
|
111
|
+
|
|
112
|
+
## File Structure
|
|
113
|
+
|
|
114
|
+
After installation, your project will have:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
your-project/
|
|
118
|
+
├── components/
|
|
119
|
+
│ ├── cards/
|
|
120
|
+
│ │ ├── MouseTiltCard.tsx
|
|
121
|
+
│ │ └── SwipeableCards.tsx
|
|
122
|
+
│ ├── reveals/
|
|
123
|
+
│ │ ├── TextScrambleReveal.tsx
|
|
124
|
+
│ │ └── LiquidImageReveal.tsx
|
|
125
|
+
│ └── ...
|
|
126
|
+
└── examples/
|
|
127
|
+
├── cards/
|
|
128
|
+
│ ├── MouseTiltCardDemo.tsx
|
|
129
|
+
│ └── SwipeableCardsDemo.tsx
|
|
130
|
+
├── reveals/
|
|
131
|
+
│ ├── TextScrambleRevealDemo.tsx
|
|
132
|
+
│ └── LiquidImageRevealDemo.tsx
|
|
133
|
+
└── ...
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Requirements
|
|
137
|
+
|
|
138
|
+
- Node.js >= 14.0.0
|
|
139
|
+
- React project with TypeScript support
|
|
140
|
+
- Tailwind CSS
|
|
141
|
+
- Required dependencies based on components used
|
package/index.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require('commander');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
|
|
8
|
+
const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com/Hank-D-Tank/dimaac-ui/main';
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.name('dimaac')
|
|
12
|
+
.description('Add DiMaac UI components to your projects')
|
|
13
|
+
.version('1.0.0');
|
|
14
|
+
|
|
15
|
+
const componentCategories = {
|
|
16
|
+
'reveals': ['TextScrambleReveal', 'LiquidImageReveal'],
|
|
17
|
+
'cards': ['MouseTiltCard', 'SwipeableCards'],
|
|
18
|
+
'interactive': ['MouseTrail', 'ContextMenu'],
|
|
19
|
+
'gallery': ['ScrollingGallery', 'ImageGallery'],
|
|
20
|
+
'loaders': ['TextLoader'],
|
|
21
|
+
'layout': ['ExpandablePanel']
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const exampleCategories = {
|
|
25
|
+
'reveals': ['TextScrambleRevealDemo', 'LiquidImageRevealDemo'],
|
|
26
|
+
'cards': ['MouseTiltCardDemo', 'SwipeableCardsDemo'],
|
|
27
|
+
'interactive': ['MouseTrailDemo', 'ContextMenuDemo'],
|
|
28
|
+
'gallery': ['ScrollingGalleryDemo', 'ImageGalleryDemo'],
|
|
29
|
+
'loaders': ['TextLoaderDemo'],
|
|
30
|
+
'layout': ['ExpandablePanelDemo']
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function ensureDirectoryExists(dirPath) {
|
|
34
|
+
if (!fs.existsSync(dirPath)) {
|
|
35
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function downloadFile(url, destination) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const file = fs.createWriteStream(destination);
|
|
42
|
+
https.get(url, (response) => {
|
|
43
|
+
if (response.statusCode === 200) {
|
|
44
|
+
response.pipe(file);
|
|
45
|
+
file.on('finish', () => {
|
|
46
|
+
file.close();
|
|
47
|
+
resolve();
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
51
|
+
}
|
|
52
|
+
}).on('error', reject);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function installComponent(componentName, includeExample = false) {
|
|
57
|
+
let category = null;
|
|
58
|
+
let actualComponentName = null;
|
|
59
|
+
|
|
60
|
+
for (const [cat, components] of Object.entries(componentCategories)) {
|
|
61
|
+
if (components.includes(componentName)) {
|
|
62
|
+
category = cat;
|
|
63
|
+
actualComponentName = componentName;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!category) {
|
|
69
|
+
console.error(`Component "${componentName}" not found.`);
|
|
70
|
+
console.log('Available components:');
|
|
71
|
+
Object.entries(componentCategories).forEach(([cat, components]) => {
|
|
72
|
+
console.log(` ${cat}:`);
|
|
73
|
+
components.forEach(comp => console.log(` - ${comp}`));
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const componentDir = path.join(process.cwd(), 'components', category);
|
|
79
|
+
ensureDirectoryExists(componentDir);
|
|
80
|
+
|
|
81
|
+
const sourceUrl = `${GITHUB_RAW_BASE}/src/ui/components/${category}/${actualComponentName}.tsx`;
|
|
82
|
+
const destination = path.join(componentDir, `${actualComponentName}.tsx`);
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
await downloadFile(sourceUrl, destination);
|
|
86
|
+
console.log(`✅ Successfully installed ${actualComponentName} to components/${category}/`);
|
|
87
|
+
|
|
88
|
+
if (includeExample) {
|
|
89
|
+
const exampleName = `${actualComponentName}Demo`;
|
|
90
|
+
const exampleDir = path.join(process.cwd(), 'examples', category);
|
|
91
|
+
ensureDirectoryExists(exampleDir);
|
|
92
|
+
|
|
93
|
+
const exampleUrl = `${GITHUB_RAW_BASE}/src/examples/components/${category}/${exampleName}.tsx`;
|
|
94
|
+
const exampleDestination = path.join(exampleDir, `${exampleName}.tsx`);
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
await downloadFile(exampleUrl, exampleDestination);
|
|
98
|
+
console.log(`✅ Successfully installed ${exampleName} to examples/${category}/`);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.log(`⚠️ Example not found for ${actualComponentName}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(`❌ Failed to install ${actualComponentName}:`, error.message);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
program
|
|
109
|
+
.command('init')
|
|
110
|
+
.description('Initialize DiMaac UI in your project')
|
|
111
|
+
.action(async () => {
|
|
112
|
+
console.log('🚀 Initializing DiMaac UI...');
|
|
113
|
+
|
|
114
|
+
const componentsDir = path.join(process.cwd(), 'components');
|
|
115
|
+
ensureDirectoryExists(componentsDir);
|
|
116
|
+
|
|
117
|
+
console.log('✅ Created components directory');
|
|
118
|
+
console.log('📦 DiMaac UI initialized successfully!');
|
|
119
|
+
console.log('\nNext steps:');
|
|
120
|
+
console.log(' npx dimaac add [component]');
|
|
121
|
+
console.log(' npx dimaac add MouseTiltCard');
|
|
122
|
+
console.log(' npx dimaac add MouseTiltCard -e');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
program
|
|
126
|
+
.command('add')
|
|
127
|
+
.description('Add a component to your project')
|
|
128
|
+
.argument('[component]', 'Component name')
|
|
129
|
+
.option('-e, --example', 'Include example/demo file')
|
|
130
|
+
.option('--all', 'Install all components')
|
|
131
|
+
.action(async (component, options) => {
|
|
132
|
+
if (options.all) {
|
|
133
|
+
console.log('Installing all components...');
|
|
134
|
+
for (const [category, components] of Object.entries(componentCategories)) {
|
|
135
|
+
for (const comp of components) {
|
|
136
|
+
await installComponent(comp, options.example);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!component) {
|
|
143
|
+
console.log('\n📦 Available Components:');
|
|
144
|
+
Object.entries(componentCategories).forEach(([category, components]) => {
|
|
145
|
+
console.log(`\n ${category.toUpperCase()}:`);
|
|
146
|
+
components.forEach(comp => console.log(` - ${comp}`));
|
|
147
|
+
});
|
|
148
|
+
console.log('\nUsage: npx dimaac add [component]');
|
|
149
|
+
console.log('Example: npx dimaac add MouseTiltCard');
|
|
150
|
+
console.log('Add -e flag to include example: npx dimaac add MouseTiltCard -e');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
await installComponent(component, options.example);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
program
|
|
158
|
+
.command('list')
|
|
159
|
+
.description('List all available components')
|
|
160
|
+
.action(() => {
|
|
161
|
+
console.log('\n📦 Available Components:');
|
|
162
|
+
Object.entries(componentCategories).forEach(([category, components]) => {
|
|
163
|
+
console.log(`\n ${category.toUpperCase()}:`);
|
|
164
|
+
components.forEach(comp => console.log(` - ${comp}`));
|
|
165
|
+
});
|
|
166
|
+
console.log('\nUsage: npx dimaac add [component] [-e]');
|
|
167
|
+
console.log('Add -e flag to include example/demo files');
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dimaac",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Add DiMaac UI components to your projects",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dimaac": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"dimaac": "node index.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react",
|
|
15
|
+
"components",
|
|
16
|
+
"ui",
|
|
17
|
+
"cli",
|
|
18
|
+
"dimaac"
|
|
19
|
+
],
|
|
20
|
+
"author": "DiMaac",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"commander": "^11.0.0"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=14.0.0"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/your-username/dimaac-ui.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/your-username/dimaac-ui/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/your-username/dimaac-ui#readme"
|
|
36
|
+
}
|