flikkui 0.2.0-beta.7 → 0.2.0-beta.8

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.
@@ -1,5 +1,4 @@
1
1
  import React__default, { useRef, useState, useMemo, useEffect } from 'react';
2
- import * as math from 'mathjs';
3
2
 
4
3
  const DEFAULT_CONFIG = {
5
4
  position: "bottom",
@@ -128,15 +127,15 @@ const ProgressiveBlurBase = (props) => {
128
127
  let blurValue;
129
128
  if (config.exponential) {
130
129
  blurValue =
131
- Number(math.pow(2, progress * 4)) * 0.0625 * currentStrength;
130
+ Math.pow(2, progress * 4) * 0.0625 * currentStrength;
132
131
  }
133
132
  else {
134
133
  blurValue = 0.0625 * (progress * config.divCount + 1) * currentStrength;
135
134
  }
136
- const p1 = math.round((increment * i - increment) * 10) / 10;
137
- const p2 = math.round(increment * i * 10) / 10;
138
- const p3 = math.round((increment * i + increment) * 10) / 10;
139
- const p4 = math.round((increment * i + increment * 2) * 10) / 10;
135
+ const p1 = Math.round((increment * i - increment) * 10) / 10;
136
+ const p2 = Math.round(increment * i * 10) / 10;
137
+ const p3 = Math.round((increment * i + increment) * 10) / 10;
138
+ const p4 = Math.round((increment * i + increment * 2) * 10) / 10;
140
139
  let gradient = `transparent ${p1}%, black ${p2}%`;
141
140
  if (p3 <= 100)
142
141
  gradient += `, black ${p3}%`;
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "flikkui",
3
- "version": "0.2.0-beta.7",
3
+ "version": "0.2.0-beta.8",
4
4
  "description": "A modern React component library built with TypeScript, Tailwind CSS v4, and Framer Motion. Follows the shadcn philosophy with complete className override support.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "bin": {
10
- "flikkui": "./dist/cli/index.js"
11
- },
12
9
  "sideEffects": [
13
10
  "*.css",
14
11
  "*.scss",
@@ -138,12 +135,5 @@
138
135
  "tslib": "^2.8.1",
139
136
  "typescript": "^5.7.3",
140
137
  "eslint-plugin-storybook": "10.2.3"
141
- },
142
- "dependencies": {
143
- "mathjs": "^15.1.0",
144
- "commander": "^12.1.0",
145
- "@inquirer/prompts": "^7.2.1",
146
- "chalk": "^5.3.0",
147
- "ora": "^8.1.1"
148
138
  }
149
139
  }
@@ -1,7 +0,0 @@
1
- interface InitOptions {
2
- tailwind?: boolean;
3
- yes?: boolean;
4
- skipInstall?: boolean;
5
- }
6
- export declare function init(options: InitOptions): Promise<void>;
7
- export {};
@@ -1,82 +0,0 @@
1
- import chalk from 'chalk';
2
- import ora from 'ora';
3
- import { confirm } from '@inquirer/prompts';
4
- import { detectProjectType } from '../utils/detectProject.js';
5
- import { injectCSSImport } from '../utils/injectCSS.js';
6
- import { setupTailwind } from '../utils/setupTailwind.js';
7
- import { installDependencies } from '../utils/installDeps.js';
8
- import { logger } from '../utils/logger.js';
9
-
10
- async function init(options) {
11
- logger.welcome();
12
- const spinner = ora();
13
- try {
14
- // Step 1: Detect project type
15
- spinner.start('Detecting project type...');
16
- const projectType = await detectProjectType();
17
- spinner.succeed(`Detected: ${chalk.cyan(projectType.name)}`);
18
- // Step 2: Ask user preferences (unless --yes flag)
19
- let shouldSetupTailwind = options.tailwind || false;
20
- let shouldInstallDeps = !options.skipInstall;
21
- if (!options.yes) {
22
- shouldInstallDeps = await confirm({
23
- message: 'Install peer dependencies (recommended)?',
24
- default: true,
25
- });
26
- shouldSetupTailwind = await confirm({
27
- message: 'Set up Tailwind CSS integration?',
28
- default: false,
29
- });
30
- }
31
- // Step 3: Install dependencies
32
- if (shouldInstallDeps) {
33
- await installDependencies(projectType.packageManager, spinner);
34
- }
35
- else {
36
- logger.info('Skipping dependency installation');
37
- logger.info('You will need to install these manually:');
38
- logger.info('npm install @heroicons/react clsx motion tailwind-merge tailwindcss react-markdown react-syntax-highlighter remark-gfm three');
39
- }
40
- // Step 4: Inject CSS import
41
- spinner.start('Setting up CSS imports...');
42
- const cssResult = await injectCSSImport(projectType);
43
- if (cssResult.success) {
44
- spinner.succeed(`Added CSS import to ${chalk.cyan(cssResult.file)}`);
45
- }
46
- else {
47
- spinner.warn(cssResult.message || 'Could not auto-inject CSS import');
48
- logger.manual(`Add this to your main app file (${projectType.entryFile}):`);
49
- logger.code("import 'flikkui/styles.css'");
50
- }
51
- // Step 5: Setup Tailwind (optional)
52
- if (shouldSetupTailwind) {
53
- spinner.start('Setting up Tailwind CSS...');
54
- const tailwindResult = await setupTailwind(projectType);
55
- if (tailwindResult.success) {
56
- spinner.succeed('Tailwind CSS configured');
57
- }
58
- else {
59
- spinner.warn(tailwindResult.message || 'Could not auto-configure Tailwind');
60
- logger.manual('Add this to your tailwind.config.js:');
61
- logger.code("presets: [require('flikkui/tailwind.preset.cjs')]");
62
- }
63
- }
64
- // Step 6: Success message
65
- logger.success('\n✨ Flikkui has been initialized!');
66
- logger.info('\nNext steps:');
67
- logger.info(' 1. Start your development server');
68
- logger.info(' 2. Import components: import { Button } from "flikkui"');
69
- logger.info(' 3. Use in your code: <Button variant="primary">Click me</Button>');
70
- logger.info('\n📚 Documentation: https://flikkui.dev');
71
- logger.info('🐛 Issues: https://github.com/yourusername/flikkui/issues\n');
72
- }
73
- catch (error) {
74
- spinner.fail('Initialization failed');
75
- if (error instanceof Error) {
76
- logger.error(error.message);
77
- }
78
- process.exit(1);
79
- }
80
- }
81
-
82
- export { init };
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/cli/index.js DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import { init } from './commands/init.js';
4
-
5
- const program = new Command();
6
- program
7
- .name('flikkui')
8
- .description('CLI tool for Flikkui - Modern React Component Library')
9
- .version('0.1.0-beta.12');
10
- program
11
- .command('init')
12
- .description('Initialize Flikkui in your project')
13
- .option('-t, --tailwind', 'Set up Tailwind CSS integration')
14
- .option('-y, --yes', 'Skip prompts and use defaults')
15
- .option('--skip-install', 'Skip installing dependencies')
16
- .action(init);
17
- program.parse();
@@ -1,9 +0,0 @@
1
- export interface ProjectInfo {
2
- name: string;
3
- type: 'nextjs' | 'vite' | 'cra' | 'remix' | 'unknown';
4
- entryFile: string;
5
- packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
6
- hasTypeScript: boolean;
7
- tailwindConfigFile?: string;
8
- }
9
- export declare function detectProjectType(): Promise<ProjectInfo>;
@@ -1,126 +0,0 @@
1
- import { existsSync, readFileSync } from 'fs';
2
- import { join } from 'path';
3
-
4
- async function detectProjectType() {
5
- var _a, _b, _c, _d, _e, _f, _g;
6
- const cwd = process.cwd();
7
- // Detect package manager
8
- let packageManager = 'npm';
9
- if (existsSync(join(cwd, 'yarn.lock')))
10
- packageManager = 'yarn';
11
- else if (existsSync(join(cwd, 'pnpm-lock.yaml')))
12
- packageManager = 'pnpm';
13
- else if (existsSync(join(cwd, 'bun.lockb')))
14
- packageManager = 'bun';
15
- // Detect TypeScript
16
- const hasTypeScript = existsSync(join(cwd, 'tsconfig.json'));
17
- // Read package.json
18
- let packageJson = {};
19
- try {
20
- const packageJsonPath = join(cwd, 'package.json');
21
- if (existsSync(packageJsonPath)) {
22
- packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
23
- }
24
- }
25
- catch (error) {
26
- // Ignore errors
27
- }
28
- // Detect Tailwind config
29
- let tailwindConfigFile;
30
- const tailwindExtensions = ['js', 'cjs', 'mjs', 'ts'];
31
- for (const ext of tailwindExtensions) {
32
- const configFile = `tailwind.config.${ext}`;
33
- if (existsSync(join(cwd, configFile))) {
34
- tailwindConfigFile = configFile;
35
- break;
36
- }
37
- }
38
- // Detect project type
39
- let type = 'unknown';
40
- let name = 'Unknown Project';
41
- let entryFile = '';
42
- // Next.js detection
43
- if (((_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a.next) || ((_b = packageJson.devDependencies) === null || _b === void 0 ? void 0 : _b.next)) {
44
- type = 'nextjs';
45
- name = 'Next.js';
46
- // Check for App Router vs Pages Router
47
- if (existsSync(join(cwd, 'app'))) {
48
- entryFile = hasTypeScript ? 'app/layout.tsx' : 'app/layout.js';
49
- }
50
- else if (existsSync(join(cwd, 'src/app'))) {
51
- entryFile = hasTypeScript ? 'src/app/layout.tsx' : 'src/app/layout.js';
52
- }
53
- else {
54
- entryFile = hasTypeScript ? 'pages/_app.tsx' : 'pages/_app.js';
55
- }
56
- }
57
- // Vite detection
58
- else if (existsSync(join(cwd, 'vite.config.ts')) || existsSync(join(cwd, 'vite.config.js'))) {
59
- type = 'vite';
60
- name = 'Vite';
61
- if (existsSync(join(cwd, 'src/main.tsx')))
62
- entryFile = 'src/main.tsx';
63
- else if (existsSync(join(cwd, 'src/main.ts')))
64
- entryFile = 'src/main.ts';
65
- else if (existsSync(join(cwd, 'src/index.tsx')))
66
- entryFile = 'src/index.tsx';
67
- else if (existsSync(join(cwd, 'src/index.ts')))
68
- entryFile = 'src/index.ts';
69
- else if (existsSync(join(cwd, 'src/App.tsx')))
70
- entryFile = 'src/App.tsx';
71
- else if (existsSync(join(cwd, 'src/App.jsx')))
72
- entryFile = 'src/App.jsx';
73
- else
74
- entryFile = 'src/main.tsx';
75
- }
76
- // Remix detection
77
- else if (((_c = packageJson.dependencies) === null || _c === void 0 ? void 0 : _c['@remix-run/react']) || ((_d = packageJson.devDependencies) === null || _d === void 0 ? void 0 : _d['@remix-run/react'])) {
78
- type = 'remix';
79
- name = 'Remix';
80
- entryFile = hasTypeScript ? 'app/root.tsx' : 'app/root.jsx';
81
- }
82
- // Create React App detection
83
- else if ((_e = packageJson.dependencies) === null || _e === void 0 ? void 0 : _e['react-scripts']) {
84
- type = 'cra';
85
- name = 'Create React App';
86
- if (existsSync(join(cwd, 'src/index.tsx')))
87
- entryFile = 'src/index.tsx';
88
- else if (existsSync(join(cwd, 'src/index.js')))
89
- entryFile = 'src/index.js';
90
- else if (existsSync(join(cwd, 'src/App.tsx')))
91
- entryFile = 'src/App.tsx';
92
- else if (existsSync(join(cwd, 'src/App.jsx')))
93
- entryFile = 'src/App.jsx';
94
- else
95
- entryFile = 'src/index.js';
96
- }
97
- // Generic React project
98
- else if (((_f = packageJson.dependencies) === null || _f === void 0 ? void 0 : _f.react) || ((_g = packageJson.devDependencies) === null || _g === void 0 ? void 0 : _g.react)) {
99
- type = 'unknown';
100
- name = 'React Project';
101
- // Try common entry files
102
- const commonEntries = [
103
- 'src/index.tsx', 'src/index.ts', 'src/index.jsx', 'src/index.js',
104
- 'src/main.tsx', 'src/main.ts', 'src/main.jsx', 'src/main.js',
105
- 'src/App.tsx', 'src/App.jsx',
106
- ];
107
- for (const entry of commonEntries) {
108
- if (existsSync(join(cwd, entry))) {
109
- entryFile = entry;
110
- break;
111
- }
112
- }
113
- if (!entryFile)
114
- entryFile = 'src/index.tsx';
115
- }
116
- return {
117
- name,
118
- type,
119
- entryFile,
120
- packageManager,
121
- hasTypeScript,
122
- tailwindConfigFile,
123
- };
124
- }
125
-
126
- export { detectProjectType };
@@ -1,8 +0,0 @@
1
- import type { ProjectInfo } from './detectProject';
2
- interface InjectResult {
3
- success: boolean;
4
- file?: string;
5
- message?: string;
6
- }
7
- export declare function injectCSSImport(projectInfo: ProjectInfo): Promise<InjectResult>;
8
- export {};
@@ -1,82 +0,0 @@
1
- import { existsSync, readFileSync, writeFileSync } from 'fs';
2
- import { join } from 'path';
3
-
4
- async function injectCSSImport(projectInfo) {
5
- const cwd = process.cwd();
6
- const targetFile = join(cwd, projectInfo.entryFile);
7
- // Check if file exists
8
- if (!existsSync(targetFile)) {
9
- return {
10
- success: false,
11
- message: `Entry file not found: ${projectInfo.entryFile}`,
12
- };
13
- }
14
- try {
15
- // Read the file
16
- let content = readFileSync(targetFile, 'utf-8');
17
- // Check if import already exists
18
- if (content.includes("'flikkui/styles.css'") || content.includes('"flikkui/styles.css"')) {
19
- return {
20
- success: true,
21
- file: projectInfo.entryFile,
22
- message: 'CSS import already exists',
23
- };
24
- }
25
- // Find the right place to inject
26
- const importStatement = "import 'flikkui/styles.css';\n";
27
- // For Next.js layout files
28
- if (projectInfo.type === 'nextjs' && projectInfo.entryFile.includes('layout')) {
29
- // Add after other imports but before the layout component
30
- const lines = content.split('\n');
31
- let lastImportIndex = -1;
32
- for (let i = 0; i < lines.length; i++) {
33
- if (lines[i].trim().startsWith('import ')) {
34
- lastImportIndex = i;
35
- }
36
- }
37
- if (lastImportIndex !== -1) {
38
- lines.splice(lastImportIndex + 1, 0, importStatement.trim());
39
- content = lines.join('\n');
40
- }
41
- else {
42
- // No imports found, add at the top
43
- content = importStatement + content;
44
- }
45
- }
46
- // For other project types
47
- else {
48
- // Find the last import statement
49
- const importRegex = /^import\s+.*from\s+['"].*['"];?$/gm;
50
- const imports = Array.from(content.matchAll(importRegex));
51
- if (imports.length > 0) {
52
- const lastImport = imports[imports.length - 1];
53
- const lastImportIndex = lastImport.index + lastImport[0].length;
54
- content = content.slice(0, lastImportIndex) + '\n' + importStatement + content.slice(lastImportIndex);
55
- }
56
- else {
57
- // No imports found, add at the top (after any comments)
58
- const firstCodeLine = content.search(/^(?!\/\/|\/\*|\s*$)/m);
59
- if (firstCodeLine !== -1) {
60
- content = content.slice(0, firstCodeLine) + importStatement + '\n' + content.slice(firstCodeLine);
61
- }
62
- else {
63
- content = importStatement + content;
64
- }
65
- }
66
- }
67
- // Write the file back
68
- writeFileSync(targetFile, content, 'utf-8');
69
- return {
70
- success: true,
71
- file: projectInfo.entryFile,
72
- };
73
- }
74
- catch (error) {
75
- return {
76
- success: false,
77
- message: error instanceof Error ? error.message : 'Unknown error',
78
- };
79
- }
80
- }
81
-
82
- export { injectCSSImport };
@@ -1,2 +0,0 @@
1
- import type { Ora } from 'ora';
2
- export declare function installDependencies(packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun', spinner: Ora): Promise<void>;
@@ -1,44 +0,0 @@
1
- import { execSync } from 'child_process';
2
-
3
- const PEER_DEPENDENCIES = [
4
- '@heroicons/react',
5
- 'clsx',
6
- 'motion',
7
- 'tailwind-merge',
8
- 'tailwindcss',
9
- 'react-markdown',
10
- 'react-syntax-highlighter',
11
- 'remark-gfm',
12
- 'three',
13
- ];
14
- async function installDependencies(packageManager, spinner) {
15
- const deps = PEER_DEPENDENCIES.join(' ');
16
- let command;
17
- switch (packageManager) {
18
- case 'yarn':
19
- command = `yarn add ${deps}`;
20
- break;
21
- case 'pnpm':
22
- command = `pnpm add ${deps}`;
23
- break;
24
- case 'bun':
25
- command = `bun add ${deps}`;
26
- break;
27
- default:
28
- command = `npm install ${deps}`;
29
- }
30
- spinner.start(`Installing peer dependencies with ${packageManager}...`);
31
- try {
32
- execSync(command, {
33
- stdio: 'pipe',
34
- cwd: process.cwd(),
35
- });
36
- spinner.succeed('Peer dependencies installed');
37
- }
38
- catch (error) {
39
- spinner.fail('Failed to install dependencies');
40
- throw new Error(error instanceof Error ? error.message : 'Dependency installation failed');
41
- }
42
- }
43
-
44
- export { installDependencies };
@@ -1,9 +0,0 @@
1
- export declare const logger: {
2
- welcome(): void;
3
- success(message: string): void;
4
- error(message: string): void;
5
- info(message: string): void;
6
- warn(message: string): void;
7
- manual(message: string): void;
8
- code(code: string): void;
9
- };
@@ -1,35 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- const logger = {
4
- welcome() {
5
- console.log();
6
- console.log(chalk.bold.cyan('╔═══════════════════════════════════════╗'));
7
- console.log(chalk.bold.cyan('║ ║'));
8
- console.log(chalk.bold.cyan('║ ') + chalk.bold.white('Flikkui Initialization') + chalk.bold.cyan(' ║'));
9
- console.log(chalk.bold.cyan('║ ') + chalk.gray('Modern React Component Library') + chalk.bold.cyan(' ║'));
10
- console.log(chalk.bold.cyan('║ ║'));
11
- console.log(chalk.bold.cyan('╚═══════════════════════════════════════╝'));
12
- console.log();
13
- },
14
- success(message) {
15
- console.log(chalk.green('✓ ') + message);
16
- },
17
- error(message) {
18
- console.log(chalk.red('✗ ') + message);
19
- },
20
- info(message) {
21
- console.log(chalk.blue('ℹ ') + message);
22
- },
23
- warn(message) {
24
- console.log(chalk.yellow('⚠ ') + message);
25
- },
26
- manual(message) {
27
- console.log(chalk.yellow('\n📝 Manual step required:'));
28
- console.log(chalk.white(' ' + message));
29
- },
30
- code(code) {
31
- console.log(chalk.bgGray.white('\n ' + code + '\n'));
32
- },
33
- };
34
-
35
- export { logger };
@@ -1,7 +0,0 @@
1
- import type { ProjectInfo } from './detectProject';
2
- interface TailwindResult {
3
- success: boolean;
4
- message?: string;
5
- }
6
- export declare function setupTailwind(projectInfo: ProjectInfo): Promise<TailwindResult>;
7
- export {};
@@ -1,98 +0,0 @@
1
- import { readFileSync, writeFileSync } from 'fs';
2
- import { join } from 'path';
3
-
4
- async function setupTailwind(projectInfo) {
5
- const cwd = process.cwd();
6
- // Check if Tailwind config exists
7
- if (!projectInfo.tailwindConfigFile) {
8
- return {
9
- success: false,
10
- message: 'No Tailwind config file found. Create one first with: npx tailwindcss init',
11
- };
12
- }
13
- const configPath = join(cwd, projectInfo.tailwindConfigFile);
14
- try {
15
- let content = readFileSync(configPath, 'utf-8');
16
- // Check if preset already exists
17
- if (content.includes('flikkui/tailwind.preset')) {
18
- return {
19
- success: true,
20
- message: 'Tailwind preset already configured',
21
- };
22
- }
23
- // Different strategies for different file types
24
- if (projectInfo.tailwindConfigFile.endsWith('.ts')) {
25
- // TypeScript config
26
- content = updateTypeScriptConfig(content);
27
- }
28
- else {
29
- // JavaScript/CommonJS config
30
- content = updateJavaScriptConfig(content);
31
- }
32
- // Update content array to include flikkui
33
- if (!content.includes('node_modules/flikkui')) {
34
- content = addFlikkuiToContent(content);
35
- }
36
- // Write back
37
- writeFileSync(configPath, content, 'utf-8');
38
- return { success: true };
39
- }
40
- catch (error) {
41
- return {
42
- success: false,
43
- message: error instanceof Error ? error.message : 'Unknown error',
44
- };
45
- }
46
- }
47
- function updateTypeScriptConfig(content) {
48
- // Check if there's already a presets array
49
- if (content.includes('presets:')) {
50
- // Add to existing presets array
51
- content = content.replace(/presets:\s*\[(.*?)\]/s, (match, presets) => {
52
- if (!presets.trim()) {
53
- return `presets: [require('flikkui/tailwind.preset.cjs')]`;
54
- }
55
- return `presets: [require('flikkui/tailwind.preset.cjs'), ${presets}]`;
56
- });
57
- }
58
- else {
59
- // Add presets array to config
60
- content = content.replace(/(export default\s*{|module\.exports\s*=\s*{)/, `$1\n presets: [require('flikkui/tailwind.preset.cjs')],`);
61
- }
62
- return content;
63
- }
64
- function updateJavaScriptConfig(content) {
65
- // Check if there's already a presets array
66
- if (content.includes('presets:')) {
67
- // Add to existing presets array
68
- content = content.replace(/presets:\s*\[(.*?)\]/s, (match, presets) => {
69
- if (!presets.trim()) {
70
- return `presets: [require('flikkui/tailwind.preset.cjs')]`;
71
- }
72
- return `presets: [require('flikkui/tailwind.preset.cjs'), ${presets}]`;
73
- });
74
- }
75
- else {
76
- // Add presets array to config
77
- content = content.replace(/module\.exports\s*=\s*{/, `module.exports = {\n presets: [require('flikkui/tailwind.preset.cjs')],`);
78
- }
79
- return content;
80
- }
81
- function addFlikkuiToContent(content) {
82
- // Find the content array
83
- const contentMatch = content.match(/content:\s*\[([\s\S]*?)\]/);
84
- if (contentMatch) {
85
- const contentArray = contentMatch[1];
86
- const newContent = contentArray.trim()
87
- ? `${contentArray.trim()}, './node_modules/flikkui/**/*.{js,ts,jsx,tsx}'`
88
- : `'./node_modules/flikkui/**/*.{js,ts,jsx,tsx}'`;
89
- content = content.replace(/content:\s*\[([\s\S]*?)\]/, `content: [${newContent}]`);
90
- }
91
- else {
92
- // No content array found, add one
93
- content = content.replace(/(export default\s*{|module\.exports\s*=\s*{)/, `$1\n content: ['./node_modules/flikkui/**/*.{js,ts,jsx,tsx}'],`);
94
- }
95
- return content;
96
- }
97
-
98
- export { setupTailwind };