@moontra/moonui-pro 0.1.0 → 2.0.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/LICENSE +44 -0
- package/README.md +256 -0
- package/dist/index.css +1 -0
- package/dist/index.js +171 -464
- package/dist/index.mjs +152 -446
- package/package.json +43 -10
- package/scripts/postinstall.js +228 -0
- package/dist/index.d.ts +0 -61
package/package.json
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "Premium
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"
|
|
10
|
+
"scripts",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
11
13
|
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.esm.js",
|
|
18
|
+
"require": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
12
21
|
"scripts": {
|
|
13
|
-
"
|
|
22
|
+
"postinstall": "node scripts/postinstall.js",
|
|
23
|
+
"build": "tsup src/index.ts --format cjs,esm --external react --external react-dom",
|
|
24
|
+
"build:dts": "tsup src/index.ts --format cjs,esm --dts --external react --external react-dom",
|
|
14
25
|
"dev": "tsup src/index.ts --format cjs,esm --dts --external react --external react-dom --watch",
|
|
15
26
|
"clean": "rm -rf dist",
|
|
16
27
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
17
|
-
"test": "jest"
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"test:watch": "jest --watch",
|
|
30
|
+
"test:coverage": "jest --coverage",
|
|
31
|
+
"prepublishOnly": "npm run clean && npm run build || true",
|
|
32
|
+
"pub": "npm version patch && npm run build && npm publish",
|
|
33
|
+
"pub:minor": "npm version minor && npm run build && npm publish",
|
|
34
|
+
"pub:major": "npm version major && npm run build && npm publish"
|
|
18
35
|
},
|
|
19
36
|
"keywords": [
|
|
20
37
|
"ui",
|
|
@@ -23,7 +40,18 @@
|
|
|
23
40
|
"typescript",
|
|
24
41
|
"moonui",
|
|
25
42
|
"premium",
|
|
26
|
-
"pro"
|
|
43
|
+
"pro",
|
|
44
|
+
"virtual-list",
|
|
45
|
+
"performance",
|
|
46
|
+
"memory-efficient",
|
|
47
|
+
"animations",
|
|
48
|
+
"gestures",
|
|
49
|
+
"touch",
|
|
50
|
+
"interactive",
|
|
51
|
+
"3d-effects",
|
|
52
|
+
"charts",
|
|
53
|
+
"data-table",
|
|
54
|
+
"advanced-components"
|
|
27
55
|
],
|
|
28
56
|
"author": "MoonUI Team",
|
|
29
57
|
"license": "Commercial",
|
|
@@ -33,11 +61,11 @@
|
|
|
33
61
|
},
|
|
34
62
|
"homepage": "https://moonui.dev",
|
|
35
63
|
"peerDependencies": {
|
|
64
|
+
"@moontra/moonui": ">=2.0.0",
|
|
36
65
|
"react": ">=18.0.0",
|
|
37
66
|
"react-dom": ">=18.0.0"
|
|
38
67
|
},
|
|
39
68
|
"dependencies": {
|
|
40
|
-
"@moontra/moonui": "^0.1.0",
|
|
41
69
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
42
70
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
43
71
|
"@radix-ui/react-checkbox": "^1.3.2",
|
|
@@ -50,8 +78,6 @@
|
|
|
50
78
|
"date-fns": "^3.6.0",
|
|
51
79
|
"framer-motion": "^11.11.17",
|
|
52
80
|
"lucide-react": "^0.263.1",
|
|
53
|
-
"react": "^19.1.0",
|
|
54
|
-
"react-dom": "^19.1.0",
|
|
55
81
|
"recharts": "^2.12.7",
|
|
56
82
|
"tailwind-merge": "^2.5.4",
|
|
57
83
|
"tailwindcss-animate": "^1.0.7"
|
|
@@ -60,12 +86,19 @@
|
|
|
60
86
|
"@types/react": "^19.0.0",
|
|
61
87
|
"@types/react-dom": "^19.0.0",
|
|
62
88
|
"@types/node": "^18.16.0",
|
|
89
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
90
|
+
"@testing-library/react": "^16.3.0",
|
|
91
|
+
"@testing-library/user-event": "^14.6.1",
|
|
92
|
+
"@types/jest": "^30.0.0",
|
|
63
93
|
"eslint": "^8.39.0",
|
|
64
94
|
"jest": "^29.5.0",
|
|
95
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
96
|
+
"ts-jest": "^29.1.0",
|
|
65
97
|
"tsup": "^6.7.0",
|
|
66
98
|
"typescript": "^5.0.4"
|
|
67
99
|
},
|
|
68
100
|
"publishConfig": {
|
|
69
|
-
"access": "
|
|
101
|
+
"access": "public",
|
|
102
|
+
"registry": "https://registry.npmjs.org/"
|
|
70
103
|
}
|
|
71
104
|
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
// ANSI color codes for console output
|
|
9
|
+
const colors = {
|
|
10
|
+
reset: '\x1b[0m',
|
|
11
|
+
bright: '\x1b[1m',
|
|
12
|
+
red: '\x1b[31m',
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
yellow: '\x1b[33m',
|
|
15
|
+
blue: '\x1b[34m',
|
|
16
|
+
cyan: '\x1b[36m',
|
|
17
|
+
gray: '\x1b[90m'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const log = (message, color = '') => {
|
|
21
|
+
console.log(`${color}${message}${colors.reset}`);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getLicenseConfig = () => {
|
|
25
|
+
try {
|
|
26
|
+
const configPath = path.join(os.homedir(), '.moonui', 'license.json');
|
|
27
|
+
|
|
28
|
+
if (fs.existsSync(configPath)) {
|
|
29
|
+
const configData = fs.readFileSync(configPath, 'utf-8');
|
|
30
|
+
return JSON.parse(configData);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const validateLicense = async (licenseKey) => {
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
const API_BASE = process.env.MOONUI_API_BASE || 'moonui.dev';
|
|
42
|
+
|
|
43
|
+
const postData = JSON.stringify({
|
|
44
|
+
licenseKey,
|
|
45
|
+
packageName: '@moontra/moonui-pro',
|
|
46
|
+
version: '1.0.0',
|
|
47
|
+
userId: 'npm-install'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const options = {
|
|
51
|
+
hostname: API_BASE.replace('https://', '').replace('http://', ''),
|
|
52
|
+
port: 443,
|
|
53
|
+
path: '/api/license/validate',
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: {
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
'Content-Length': Buffer.byteLength(postData),
|
|
58
|
+
'User-Agent': 'moonui-pro-postinstall/1.0.0'
|
|
59
|
+
},
|
|
60
|
+
timeout: 10000
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const req = https.request(options, (res) => {
|
|
64
|
+
let data = '';
|
|
65
|
+
|
|
66
|
+
res.on('data', (chunk) => {
|
|
67
|
+
data += chunk;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
res.on('end', () => {
|
|
71
|
+
try {
|
|
72
|
+
const result = JSON.parse(data);
|
|
73
|
+
resolve(result);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
resolve({ valid: false, error: 'PARSE_ERROR', message: 'Invalid response from server' });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
req.on('error', (error) => {
|
|
81
|
+
resolve({ valid: false, error: 'NETWORK_ERROR', message: 'Could not connect to license server' });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
req.on('timeout', () => {
|
|
85
|
+
resolve({ valid: false, error: 'TIMEOUT', message: 'License validation timeout' });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
req.write(postData);
|
|
89
|
+
req.end();
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const checkEnvironmentLicense = () => {
|
|
94
|
+
// Check for license in environment variables
|
|
95
|
+
const envLicense = process.env.MOONUI_PRO_LICENSE || process.env.MOONUI_LICENSE_KEY;
|
|
96
|
+
|
|
97
|
+
if (envLicense) {
|
|
98
|
+
log('🔑 Found license in environment variables', colors.blue);
|
|
99
|
+
return envLicense;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return null;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const main = async () => {
|
|
106
|
+
log('', ''); // Empty line
|
|
107
|
+
log('🌙 MoonUI Pro Installation', colors.cyan + colors.bright);
|
|
108
|
+
log('═'.repeat(50), colors.gray);
|
|
109
|
+
|
|
110
|
+
// Check if this is a CI environment
|
|
111
|
+
const isCI = process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.GITHUB_ACTIONS;
|
|
112
|
+
|
|
113
|
+
if (isCI) {
|
|
114
|
+
log('🤖 CI Environment detected', colors.blue);
|
|
115
|
+
|
|
116
|
+
const envLicense = checkEnvironmentLicense();
|
|
117
|
+
if (!envLicense) {
|
|
118
|
+
log('⚠️ No license found in CI environment', colors.yellow);
|
|
119
|
+
log(' Set MOONUI_PRO_LICENSE environment variable for CI builds', colors.gray);
|
|
120
|
+
log(' Example: MOONUI_PRO_LICENSE=moonui_your_license_key_here', colors.gray);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Validate CI license
|
|
125
|
+
log('🔍 Validating CI license...', colors.blue);
|
|
126
|
+
const validation = await validateLicense(envLicense);
|
|
127
|
+
|
|
128
|
+
if (validation.valid) {
|
|
129
|
+
log('✅ CI License validation successful!', colors.green);
|
|
130
|
+
log(` Plan: ${validation.planType}`, colors.blue);
|
|
131
|
+
return;
|
|
132
|
+
} else {
|
|
133
|
+
log('❌ CI License validation failed!', colors.red);
|
|
134
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Regular installation - check for existing license
|
|
140
|
+
const licenseConfig = getLicenseConfig();
|
|
141
|
+
|
|
142
|
+
if (!licenseConfig || !licenseConfig.licenseKey) {
|
|
143
|
+
log('🔐 MoonUI Pro License Required', colors.yellow + colors.bright);
|
|
144
|
+
log('', '');
|
|
145
|
+
log('This package requires a valid MoonUI Pro license.', colors.yellow);
|
|
146
|
+
log('', '');
|
|
147
|
+
log('📋 Next Steps:', colors.blue + colors.bright);
|
|
148
|
+
log(' 1. Get a license: https://moonui.dev/pricing', colors.blue);
|
|
149
|
+
log(' 2. Configure license: moonui license set <your-license-key>', colors.blue);
|
|
150
|
+
log(' 3. Or set environment variable: MOONUI_PRO_LICENSE=<your-key>', colors.blue);
|
|
151
|
+
log('', '');
|
|
152
|
+
log('📖 Documentation: https://moonui.dev/docs/license', colors.gray);
|
|
153
|
+
log('🔧 CLI Help: moonui license --help', colors.gray);
|
|
154
|
+
log('', '');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Validate existing license
|
|
159
|
+
log('🔍 Validating license...', colors.blue);
|
|
160
|
+
|
|
161
|
+
const validation = await validateLicense(licenseConfig.licenseKey);
|
|
162
|
+
|
|
163
|
+
if (validation.valid) {
|
|
164
|
+
log('✅ License validation successful!', colors.green + colors.bright);
|
|
165
|
+
log(` Plan: ${validation.planType}`, colors.blue);
|
|
166
|
+
log(` Licensed to: ${licenseConfig.email || 'N/A'}`, colors.blue);
|
|
167
|
+
|
|
168
|
+
if (validation.expiresAt) {
|
|
169
|
+
const expiryDate = new Date(validation.expiresAt);
|
|
170
|
+
const daysLeft = Math.ceil((expiryDate - new Date()) / (1000 * 60 * 60 * 24));
|
|
171
|
+
|
|
172
|
+
if (daysLeft > 0) {
|
|
173
|
+
log(` Expires: ${expiryDate.toLocaleDateString()} (${daysLeft} days)`, colors.blue);
|
|
174
|
+
} else {
|
|
175
|
+
log(` Status: EXPIRED on ${expiryDate.toLocaleDateString()}`, colors.red);
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
log(' Expires: Never (Lifetime)', colors.green);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (validation.downloadLimit) {
|
|
182
|
+
const { current, max, period } = validation.downloadLimit;
|
|
183
|
+
const percentage = Math.round((current / max) * 100);
|
|
184
|
+
const warningColor = percentage > 80 ? colors.yellow : colors.blue;
|
|
185
|
+
log(` Usage: ${current}/${max} downloads this ${period} (${percentage}%)`, warningColor);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
log('', '');
|
|
189
|
+
log('🚀 Ready to use MoonUI Pro components!', colors.green);
|
|
190
|
+
log(' Documentation: https://moonui.dev/docs/components', colors.gray);
|
|
191
|
+
|
|
192
|
+
} else {
|
|
193
|
+
log('❌ License validation failed!', colors.red + colors.bright);
|
|
194
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
195
|
+
log('', '');
|
|
196
|
+
|
|
197
|
+
if (validation.error === 'INVALID_LICENSE') {
|
|
198
|
+
log('🔧 Troubleshooting:', colors.yellow + colors.bright);
|
|
199
|
+
log(' • Check your license key is correct', colors.yellow);
|
|
200
|
+
log(' • Ensure your subscription is active', colors.yellow);
|
|
201
|
+
log(' • Contact support: support@moonui.dev', colors.yellow);
|
|
202
|
+
} else if (validation.error === 'NETWORK_ERROR') {
|
|
203
|
+
log('🌐 Network Issue:', colors.yellow + colors.bright);
|
|
204
|
+
log(' • License validation requires internet connection', colors.yellow);
|
|
205
|
+
log(' • Components will work offline after initial validation', colors.yellow);
|
|
206
|
+
log(' • Retry: npm install --force', colors.yellow);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
log('', '');
|
|
210
|
+
log('📖 License Guide: https://moonui.dev/docs/license', colors.gray);
|
|
211
|
+
|
|
212
|
+
// Don't fail installation for network issues, only for invalid licenses
|
|
213
|
+
if (validation.error === 'INVALID_LICENSE') {
|
|
214
|
+
process.exit(1);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
log('═'.repeat(50), colors.gray);
|
|
219
|
+
log('', '');
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Run postinstall script
|
|
223
|
+
main().catch((error) => {
|
|
224
|
+
log('❌ Postinstall script failed:', colors.red);
|
|
225
|
+
log(` ${error.message}`, colors.red);
|
|
226
|
+
log('', '');
|
|
227
|
+
log('📖 If this persists, see: https://moonui.dev/docs/troubleshooting', colors.gray);
|
|
228
|
+
});
|
package/dist/index.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export * from '@moontra/moonui';
|
|
2
|
-
export { Alert, Avatar, Badge, Button, Card, Dialog, Input, Select, Switch, Tabs, Toast, Tooltip, cn } from '@moontra/moonui';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
5
|
-
|
|
6
|
-
interface DataTableProps<TData, TValue> {
|
|
7
|
-
columns: ColumnDef<TData, TValue>[];
|
|
8
|
-
data: TData[];
|
|
9
|
-
searchable?: boolean;
|
|
10
|
-
filterable?: boolean;
|
|
11
|
-
exportable?: boolean;
|
|
12
|
-
selectable?: boolean;
|
|
13
|
-
pagination?: boolean;
|
|
14
|
-
pageSize?: number;
|
|
15
|
-
className?: string;
|
|
16
|
-
onRowSelect?: (rows: TData[]) => void;
|
|
17
|
-
onExport?: (data: TData[]) => void;
|
|
18
|
-
}
|
|
19
|
-
declare function DataTable<TData, TValue>({ columns, data, searchable, filterable, exportable, selectable, pagination, pageSize, className, onRowSelect, onExport, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
20
|
-
|
|
21
|
-
interface UseDataTableOptions<TData> {
|
|
22
|
-
data: TData[];
|
|
23
|
-
columns: ColumnDef<TData, any>[];
|
|
24
|
-
searchable?: boolean;
|
|
25
|
-
filterable?: boolean;
|
|
26
|
-
sortable?: boolean;
|
|
27
|
-
pagination?: boolean;
|
|
28
|
-
pageSize?: number;
|
|
29
|
-
enableRowSelection?: boolean;
|
|
30
|
-
enableMultiRowSelection?: boolean;
|
|
31
|
-
}
|
|
32
|
-
interface UseDataTableReturn<TData> {
|
|
33
|
-
filteredData: TData[];
|
|
34
|
-
selectedRows: TData[];
|
|
35
|
-
searchQuery: string;
|
|
36
|
-
currentPage: number;
|
|
37
|
-
totalPages: number;
|
|
38
|
-
setSearchQuery: (query: string) => void;
|
|
39
|
-
setCurrentPage: (page: number) => void;
|
|
40
|
-
selectRow: (row: TData) => void;
|
|
41
|
-
selectAllRows: () => void;
|
|
42
|
-
clearSelection: () => void;
|
|
43
|
-
exportData: (format?: 'csv' | 'json') => void;
|
|
44
|
-
getRowCount: () => number;
|
|
45
|
-
getSelectedCount: () => number;
|
|
46
|
-
isRowSelected: (row: TData) => boolean;
|
|
47
|
-
}
|
|
48
|
-
declare function useDataTable<TData extends Record<string, any>>(options: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
|
|
49
|
-
|
|
50
|
-
interface DataProcessor<T = any> {
|
|
51
|
-
filter: (data: T[], predicate: (item: T) => boolean) => T[];
|
|
52
|
-
sort: (data: T[], key: keyof T, direction?: 'asc' | 'desc') => T[];
|
|
53
|
-
group: (data: T[], key: keyof T) => Record<string, T[]>;
|
|
54
|
-
aggregate: (data: T[], key: keyof T, operation: 'sum' | 'avg' | 'min' | 'max' | 'count') => number;
|
|
55
|
-
paginate: (data: T[], page: number, pageSize: number) => T[];
|
|
56
|
-
search: (data: T[], query: string, searchKeys?: (keyof T)[]) => T[];
|
|
57
|
-
transform: <U>(data: T[], transformer: (item: T) => U) => U[];
|
|
58
|
-
}
|
|
59
|
-
declare function createDataProcessor<T = any>(): DataProcessor<T>;
|
|
60
|
-
|
|
61
|
-
export { DataProcessor, DataTable, createDataProcessor, useDataTable };
|