initial commit
This commit is contained in:
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
### Lua ###
|
||||
# Compiled Lua sources
|
||||
luac.out
|
||||
|
||||
# luarocks build files
|
||||
*.src.rock
|
||||
*.zip
|
||||
*.tar.gz
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
*.def
|
||||
*.exp
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/lua
|
||||
171
CONTRIBUTING.md
Normal file
171
CONTRIBUTING.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# Contributing to CargDev-Cyberpunk.nvim
|
||||
|
||||
Thank you for your interest in contributing to CargDev-Cyberpunk.nvim! This document provides guidelines for contributing to the project.
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Neovim 0.8.0 or higher
|
||||
- Git
|
||||
- A GitHub account
|
||||
|
||||
### Fork and Clone
|
||||
|
||||
1. Fork the repository on GitHub
|
||||
2. Clone your fork locally:
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME/cargdev-cyberpunk.nvim.git
|
||||
cd cargdev-cyberpunk.nvim
|
||||
```
|
||||
|
||||
## Development Setup
|
||||
|
||||
### Local Development
|
||||
|
||||
1. Create a new branch for your changes:
|
||||
```bash
|
||||
git checkout -b feature/your-feature-name
|
||||
```
|
||||
|
||||
2. Make your changes to the codebase
|
||||
|
||||
3. Test your changes:
|
||||
```bash
|
||||
# Test the color scheme in Neovim
|
||||
nvim --headless -c "lua dofile('test/test_colors.lua')"
|
||||
```
|
||||
|
||||
### Testing Your Changes
|
||||
|
||||
1. Open Neovim with your local version:
|
||||
```bash
|
||||
nvim -u NONE -c "set runtimepath+=/path/to/your/cargdev-cyberpunk.nvim"
|
||||
```
|
||||
|
||||
2. Test with different file types:
|
||||
```bash
|
||||
nvim examples/sample.ts
|
||||
```
|
||||
|
||||
3. Verify the colors are applied correctly
|
||||
|
||||
## Making Changes
|
||||
|
||||
### Code Style Guidelines
|
||||
|
||||
- Follow Lua best practices
|
||||
- Use consistent indentation (2 spaces)
|
||||
- Keep functions focused and concise
|
||||
- Add comments for complex logic
|
||||
- Maintain the cyberpunk aesthetic in color choices
|
||||
|
||||
### File Structure
|
||||
|
||||
```
|
||||
lua/cargdev-cyberpunk/
|
||||
├── init.lua # Main plugin entry point
|
||||
├── colors.lua # Color palette definitions
|
||||
└── plugin.lua # Plugin configuration
|
||||
```
|
||||
|
||||
### Color Guidelines
|
||||
|
||||
When adding new colors or modifying existing ones:
|
||||
|
||||
- Maintain high contrast for readability
|
||||
- Use vibrant, neon colors that fit the cyberpunk theme
|
||||
- Test colors in different lighting conditions
|
||||
- Ensure accessibility standards are met
|
||||
|
||||
## Submitting Your Changes
|
||||
|
||||
### Commit Guidelines
|
||||
|
||||
1. Make atomic commits (one logical change per commit)
|
||||
2. Use clear, descriptive commit messages
|
||||
3. Follow conventional commit format:
|
||||
```
|
||||
type(scope): description
|
||||
|
||||
[optional body]
|
||||
[optional footer]
|
||||
```
|
||||
|
||||
Examples:
|
||||
- `feat(colors): add new neon purple for decorators`
|
||||
- `fix(highlights): correct function highlighting in TypeScript`
|
||||
- `docs(readme): update installation instructions`
|
||||
|
||||
### Pull Request Process
|
||||
|
||||
1. **One Change Per PR**: Each pull request should contain only one logical change or feature
|
||||
|
||||
2. **Update Documentation**: If your change affects user experience, update the README.md
|
||||
|
||||
3. **Test Thoroughly**: Ensure your changes work across different file types and Neovim configurations
|
||||
|
||||
4. **Create Pull Request**:
|
||||
- Go to your fork on GitHub
|
||||
- Click "New Pull Request"
|
||||
- Select the `master` branch as the base
|
||||
- Provide a clear title and description
|
||||
|
||||
### Pull Request Template
|
||||
|
||||
```markdown
|
||||
## Description
|
||||
Brief description of the changes made.
|
||||
|
||||
## Type of Change
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
- [ ] Documentation update
|
||||
- [ ] Code refactoring
|
||||
|
||||
## Testing
|
||||
- [ ] Tested with TypeScript files
|
||||
- [ ] Tested with other file types
|
||||
- [ ] Verified colors are applied correctly
|
||||
- [ ] No breaking changes introduced
|
||||
|
||||
## Screenshots (if applicable)
|
||||
Add screenshots showing the visual changes.
|
||||
|
||||
## Checklist
|
||||
- [ ] My code follows the project's style guidelines
|
||||
- [ ] I have tested my changes thoroughly
|
||||
- [ ] I have updated documentation if needed
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests if applicable
|
||||
```
|
||||
|
||||
## Review Process
|
||||
|
||||
1. **Code Review**: All PRs will be reviewed by maintainers
|
||||
2. **Testing**: Changes will be tested in different environments
|
||||
3. **Feedback**: You may be asked to make adjustments
|
||||
4. **Merge**: Once approved, your PR will be merged to master
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you need help or have questions:
|
||||
|
||||
1. Check existing issues and discussions
|
||||
2. Create a new issue with detailed information
|
||||
3. Join the project discussions
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
- Be respectful and inclusive
|
||||
- Focus on constructive feedback
|
||||
- Help others learn and grow
|
||||
- Follow the project's coding standards
|
||||
|
||||
## License
|
||||
|
||||
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
|
||||
|
||||
---
|
||||
|
||||
Thank you for contributing to CargDev-Cyberpunk.nvim! Your help makes the project better for everyone.
|
||||
135
INSTALL.md
Normal file
135
INSTALL.md
Normal file
@@ -0,0 +1,135 @@
|
||||
# Installation Guide
|
||||
|
||||
This guide will help you install and configure the CargDev-Cyberpunk.nvim color scheme.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Neovim 0.8.0 or higher
|
||||
- A plugin manager (Packer, Lazy.nvim, vim-plug, etc.)
|
||||
|
||||
## Quick Installation
|
||||
|
||||
### Using Lazy.nvim (Recommended)
|
||||
|
||||
Add this to your Neovim configuration:
|
||||
|
||||
```lua
|
||||
-- In your init.lua or plugins.lua
|
||||
{
|
||||
'cargdev-cyberpunk.nvim',
|
||||
config = true,
|
||||
priority = 1000, -- Load early
|
||||
}
|
||||
```
|
||||
|
||||
### Using Packer
|
||||
|
||||
```lua
|
||||
-- In your init.lua or plugins.lua
|
||||
use {
|
||||
'cargdev-cyberpunk.nvim',
|
||||
config = function()
|
||||
require('cargdev-cyberpunk').setup()
|
||||
end
|
||||
}
|
||||
```
|
||||
|
||||
### Using vim-plug
|
||||
|
||||
```vim
|
||||
" In your .vimrc or init.vim
|
||||
Plug 'cargdev-cyberpunk.nvim'
|
||||
```
|
||||
|
||||
Then in your Neovim configuration:
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup()
|
||||
```
|
||||
|
||||
## Manual Installation
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/yourusername/cargdev-cyberpunk.nvim ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim
|
||||
```
|
||||
|
||||
2. Add to your Neovim configuration:
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup()
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Basic Configuration
|
||||
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup()
|
||||
```
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup({
|
||||
-- Configuration options will be added in future versions
|
||||
})
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
||||
To verify the installation:
|
||||
|
||||
1. Open Neovim
|
||||
2. Open a TypeScript file (like the example in `examples/sample.ts`)
|
||||
3. You should see vibrant colors applied to different syntax elements
|
||||
|
||||
### Test the Installation
|
||||
|
||||
You can run the test file to verify everything is working:
|
||||
|
||||
```lua
|
||||
-- In Neovim, run:
|
||||
:lua dofile('test/test_colors.lua')
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Colors not appearing
|
||||
|
||||
1. Make sure you have Treesitter installed and configured
|
||||
2. Ensure LSP is properly set up for TypeScript
|
||||
3. Check that the plugin is loaded correctly
|
||||
|
||||
### Plugin not found
|
||||
|
||||
1. Verify the plugin is installed in the correct directory
|
||||
2. Check your plugin manager configuration
|
||||
3. Restart Neovim after installation
|
||||
|
||||
### Performance issues
|
||||
|
||||
1. The color scheme is optimized for performance
|
||||
2. If you experience issues, try disabling other color schemes
|
||||
3. Ensure you're using Neovim 0.8.0 or higher
|
||||
|
||||
## Uninstallation
|
||||
|
||||
To remove the color scheme:
|
||||
|
||||
1. Remove the plugin from your plugin manager
|
||||
2. Remove any configuration lines from your Neovim config
|
||||
3. Restart Neovim
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Check the [Issues](https://github.com/yourusername/cargdev-cyberpunk.nvim/issues) page
|
||||
2. Create a new issue with:
|
||||
- Your Neovim version
|
||||
- Plugin manager and configuration
|
||||
- Error messages
|
||||
- Steps to reproduce
|
||||
|
||||
## Contributing
|
||||
|
||||
See the main README.md for contribution guidelines.
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 CargDev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
177
README.md
Normal file
177
README.md
Normal file
@@ -0,0 +1,177 @@
|
||||
# CargDev-Cyberpunk.nvim
|
||||
|
||||
A vibrant, high-contrast Neovim color scheme crafted for developers who thrive in bold, electrifying visuals. Built with TypeScript support and atomic design principles in mind, this theme delivers blazing neon tones and a cyberpunk aesthetic that maximizes focus and visual impact.
|
||||
|
||||
## Features
|
||||
|
||||
- **High-Contrast Neon Colors**: Hot pink keywords, electric purple types, vibrant cyan strings, and lush green functions
|
||||
- **Cyberpunk Aesthetic**: Deep blue backgrounds with neon accents for maximum visual impact
|
||||
- **TypeScript Support**: Comprehensive LSP and Treesitter highlighting for TypeScript/JavaScript
|
||||
- **Atomic Design**: Modular structure following atomic design principles
|
||||
- **Bold Styling**: High-saturation colors with bold styling for maximum readability
|
||||
- **LSP Integration**: Full support for Language Server Protocol highlighting
|
||||
- **Treesitter Support**: Advanced syntax highlighting with Treesitter
|
||||
|
||||
## Color Palette
|
||||
|
||||
### Syntax Colors
|
||||
- **Keywords**: `#FF79C6` - Control flow and declarations (bold)
|
||||
- **Functions**: `#50FA7B` - Function calls and definitions (bold)
|
||||
- **Strings**: `#8BE9FD` - String literals and comments
|
||||
- **Numbers**: `#FFB86C` - Numeric literals and constants
|
||||
- **Types**: `#BD93F9` - Type annotations and interfaces (bold)
|
||||
- **Variables**: `#BD93F9` - Variable names
|
||||
- **Properties**: `#50FA7B` - Object properties (bold)
|
||||
|
||||
### Background Colors
|
||||
- **Primary**: `#002B36` - Deep blue background
|
||||
- **Secondary**: `#003B46` - Secondary background
|
||||
- **Tertiary**: `#004B56` - Tertiary background
|
||||
- **Cursor Line**: `#112233` - Slightly lighter than background
|
||||
- **Selection**: `#44475A` - Selection highlight
|
||||
|
||||
### Special Colors
|
||||
- **Error**: `#FF5555` - Error messages (bold)
|
||||
- **Warning**: `#FFB86C` - Warning messages
|
||||
- **Info**: `#8BE9FD` - Information messages
|
||||
- **Success**: `#50FA7B` - Success indicators
|
||||
|
||||
## Installation
|
||||
|
||||
### Using Packer
|
||||
```lua
|
||||
use {
|
||||
'cargdev-cyberpunk.nvim',
|
||||
config = function()
|
||||
require('cargdev-cyberpunk').setup()
|
||||
end
|
||||
}
|
||||
```
|
||||
|
||||
### Using Lazy.nvim
|
||||
```lua
|
||||
{
|
||||
'cargdev-cyberpunk.nvim',
|
||||
config = true,
|
||||
}
|
||||
```
|
||||
|
||||
### Manual Installation
|
||||
1. Clone this repository to your Neovim plugins directory:
|
||||
```bash
|
||||
git clone https://github.com/yourusername/cargdev-cyberpunk.nvim ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim
|
||||
```
|
||||
|
||||
2. Add to your `init.lua`:
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup()
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Basic Setup
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup()
|
||||
```
|
||||
|
||||
### Advanced Configuration
|
||||
```lua
|
||||
require('cargdev-cyberpunk').setup({
|
||||
-- Future configuration options will be added here
|
||||
})
|
||||
```
|
||||
|
||||
### Customizing Colors
|
||||
You can easily override colors by requiring the colors module:
|
||||
|
||||
```lua
|
||||
local colors = require('cargdev-cyberpunk.colors')
|
||||
|
||||
-- Override specific colors
|
||||
colors.override({
|
||||
syntax = {
|
||||
keyword = "#FF0000", -- Make keywords red
|
||||
function = "#00FF00", -- Make functions green
|
||||
},
|
||||
bg = {
|
||||
primary = "#000000", -- Make background pure black
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
After installation, the color scheme will be automatically applied. You can also manually apply it:
|
||||
|
||||
```lua
|
||||
-- Apply the color scheme
|
||||
require('cargdev-cyberpunk').apply_highlights()
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
The plugin follows atomic design principles with a modular structure:
|
||||
|
||||
```
|
||||
lua/cargdev-cyberpunk/
|
||||
├── init.lua # Main plugin entry point
|
||||
├── colors.lua # Color palette definitions
|
||||
└── plugin.lua # Plugin configuration
|
||||
```
|
||||
|
||||
### Modules
|
||||
|
||||
- **`init.lua`**: Main setup and configuration functions
|
||||
- **`colors.lua`**: Centralized color palette with vibrant cyberpunk colors
|
||||
- **`highlights.lua`**: Comprehensive highlight group definitions for all syntax elements
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
This color scheme includes extensive TypeScript support:
|
||||
|
||||
- **LSP Integration**: Full support for TypeScript Language Server highlighting
|
||||
- **Treesitter**: Advanced syntax highlighting with Treesitter
|
||||
- **Type Annotations**: Special highlighting for type annotations and interfaces
|
||||
- **Import/Export**: Distinct colors for import and export statements
|
||||
- **Decorators**: Support for TypeScript decorators
|
||||
- **Generics**: Proper highlighting for generic types
|
||||
|
||||
## Requirements
|
||||
|
||||
- Neovim 0.8.0 or higher
|
||||
- Treesitter (recommended for best experience)
|
||||
- LSP support (recommended for TypeScript features)
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||
|
||||
### Development Setup
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Test thoroughly
|
||||
5. Submit a pull request
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- **Neovim Community**: For the excellent plugin ecosystem
|
||||
- **Cyberpunk Aesthetic**: Inspired by the vibrant neon colors of cyberpunk culture
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter any issues or have questions:
|
||||
|
||||
1. Check the [Issues](https://github.com/yourusername/cargdev-cyberpunk.nvim/issues) page
|
||||
2. Create a new issue with detailed information
|
||||
3. Include your Neovim version and configuration
|
||||
|
||||
---
|
||||
|
||||
**Enjoy coding with vibrant colors!**
|
||||
|
||||
*"If I squint at this theme, I should feel like Tron is about to compile!"*
|
||||
228
examples/sample.ts
Normal file
228
examples/sample.ts
Normal file
@@ -0,0 +1,228 @@
|
||||
// Sample TypeScript file to showcase the CargDev-Cyberpunk theme
|
||||
// This demonstrates the vibrant cyberpunk color palette
|
||||
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import type { User, ApiResponse } from './types';
|
||||
|
||||
// Interface definitions
|
||||
interface UserProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
avatar?: string;
|
||||
preferences: UserPreferences;
|
||||
}
|
||||
|
||||
interface UserPreferences {
|
||||
theme: 'light' | 'dark';
|
||||
notifications: boolean;
|
||||
language: string;
|
||||
}
|
||||
|
||||
// Type aliases
|
||||
type UserStatus = 'active' | 'inactive' | 'pending';
|
||||
type ApiMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||
|
||||
// Enums
|
||||
enum UserRole {
|
||||
ADMIN = 'admin',
|
||||
USER = 'user',
|
||||
MODERATOR = 'moderator'
|
||||
}
|
||||
|
||||
// Constants
|
||||
const API_BASE_URL = 'https://api.example.com';
|
||||
const DEFAULT_TIMEOUT = 5000;
|
||||
const SUPPORTED_LANGUAGES = ['en', 'es', 'fr', 'de'] as const;
|
||||
|
||||
// Generic utility types
|
||||
type ApiResponse<T> = {
|
||||
data: T;
|
||||
status: number;
|
||||
message: string;
|
||||
timestamp: Date;
|
||||
};
|
||||
|
||||
type PaginatedResponse<T> = ApiResponse<T> & {
|
||||
pagination: {
|
||||
page: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
hasNext: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
// Decorators
|
||||
function log(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
descriptor.value = function (...args: any[]) {
|
||||
console.log(`Calling ${propertyKey} with:`, args);
|
||||
const result = originalMethod.apply(this, args);
|
||||
console.log(`Result:`, result);
|
||||
return result;
|
||||
};
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
// Class with decorators and generics
|
||||
class UserService<T extends User> {
|
||||
private baseUrl: string;
|
||||
private timeout: number;
|
||||
|
||||
constructor(baseUrl: string = API_BASE_URL, timeout: number = DEFAULT_TIMEOUT) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
@log
|
||||
async fetchUser(id: string): Promise<ApiResponse<T>> {
|
||||
const response = await fetch(`${this.baseUrl}/users/${id}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${this.getAuthToken()}`
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
@log
|
||||
async createUser(userData: Partial<T>): Promise<ApiResponse<T>> {
|
||||
const response = await fetch(`${this.baseUrl}/users`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${this.getAuthToken()}`
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
private getAuthToken(): string {
|
||||
return localStorage.getItem('authToken') || '';
|
||||
}
|
||||
}
|
||||
|
||||
// React component with hooks
|
||||
function UserProfileComponent({ userId }: { userId: string }) {
|
||||
const [user, setUser] = useState<UserProfile | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const userService = new UserService<UserProfile>();
|
||||
|
||||
const fetchUserProfile = useCallback(async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const response = await userService.fetchUser(userId);
|
||||
setUser(response.data);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Unknown error occurred');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [userId, userService]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchUserProfile();
|
||||
}, [fetchUserProfile]);
|
||||
|
||||
const handleUpdateProfile = async (updates: Partial<UserProfile>) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await userService.createUser(updates);
|
||||
setUser(response.data);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to update profile');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return <div>Loading user profile...</div>;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return <div className="error">Error: {error}</div>;
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return <div>User not found</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="user-profile">
|
||||
<h1>{user.name}</h1>
|
||||
<p>Email: {user.email}</p>
|
||||
{user.avatar && <img src={user.avatar} alt="User avatar" />}
|
||||
<div className="preferences">
|
||||
<h2>Preferences</h2>
|
||||
<p>Theme: {user.preferences.theme}</p>
|
||||
<p>Notifications: {user.preferences.notifications ? 'Enabled' : 'Disabled'}</p>
|
||||
<p>Language: {user.preferences.language}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Utility functions
|
||||
function formatDate(date: Date): string {
|
||||
return date.toLocaleDateString('en-US', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
});
|
||||
}
|
||||
|
||||
function validateEmail(email: string): boolean {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
return emailRegex.test(email);
|
||||
}
|
||||
|
||||
function debounce<T extends (...args: any[]) => any>(
|
||||
func: T,
|
||||
wait: number
|
||||
): (...args: Parameters<T>) => void {
|
||||
let timeout: NodeJS.Timeout;
|
||||
|
||||
return (...args: Parameters<T>) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => func(...args), wait);
|
||||
};
|
||||
}
|
||||
|
||||
// Export statements
|
||||
export {
|
||||
UserService,
|
||||
UserProfileComponent,
|
||||
formatDate,
|
||||
validateEmail,
|
||||
debounce
|
||||
};
|
||||
|
||||
export type {
|
||||
UserProfile,
|
||||
UserPreferences,
|
||||
UserStatus,
|
||||
ApiMethod,
|
||||
ApiResponse,
|
||||
PaginatedResponse
|
||||
};
|
||||
|
||||
export { UserRole, SUPPORTED_LANGUAGES };
|
||||
52
lua/cargdev-cyberpunk/colors.lua
Normal file
52
lua/cargdev-cyberpunk/colors.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
local colors = {
|
||||
bg = {
|
||||
primary = "#002B36",
|
||||
secondary = "#003B46",
|
||||
tertiary = "#004B56",
|
||||
float = "#003B46",
|
||||
highlight = "#112233",
|
||||
selection = "#44475A",
|
||||
},
|
||||
|
||||
fg = {
|
||||
primary = "#E0E0E0",
|
||||
secondary = "#B8B8B8",
|
||||
muted = "#888888",
|
||||
accent = "#8BE9FD",
|
||||
},
|
||||
|
||||
syntax = {
|
||||
keyword = "#FF79C6",
|
||||
["function"] = "#50FA7B",
|
||||
string = "#8BE9FD",
|
||||
number = "#FFB86C",
|
||||
comment = "#8BE9FD",
|
||||
type = "#BD93F9",
|
||||
constant = "#FFB86C",
|
||||
operator = "#FF79C6",
|
||||
variable = "#BD93F9",
|
||||
property = "#50FA7B",
|
||||
},
|
||||
|
||||
special = {
|
||||
error = "#FF5555",
|
||||
warning = "#FFB86C",
|
||||
info = "#8BE9FD",
|
||||
success = "#50FA7B",
|
||||
diff_add = "#50FA7B",
|
||||
diff_delete = "#FF5555",
|
||||
diff_change = "#FFB86C",
|
||||
}
|
||||
}
|
||||
|
||||
function colors.override(new_colors)
|
||||
for category, values in pairs(new_colors) do
|
||||
if colors[category] then
|
||||
for key, value in pairs(values) do
|
||||
colors[category][key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return colors
|
||||
214
lua/cargdev-cyberpunk/init.lua
Normal file
214
lua/cargdev-cyberpunk/init.lua
Normal file
@@ -0,0 +1,214 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(opts)
|
||||
opts = opts or {}
|
||||
M.apply_highlights()
|
||||
end
|
||||
|
||||
function M.apply_highlights()
|
||||
local colors = {
|
||||
bg = {
|
||||
primary = "#002B36",
|
||||
secondary = "#003B46",
|
||||
tertiary = "#004B56",
|
||||
float = "#003B46",
|
||||
highlight = "#112233",
|
||||
selection = "#44475A",
|
||||
},
|
||||
|
||||
fg = {
|
||||
primary = "#E0E0E0",
|
||||
secondary = "#B8B8B8",
|
||||
muted = "#888888",
|
||||
accent = "#8BE9FD",
|
||||
},
|
||||
|
||||
syntax = {
|
||||
keyword = "#FF79C6",
|
||||
["function"] = "#50FA7B",
|
||||
string = "#8BE9FD",
|
||||
number = "#FFB86C",
|
||||
comment = "#8BE9FD",
|
||||
type = "#BD93F9",
|
||||
constant = "#FFB86C",
|
||||
operator = "#FF79C6",
|
||||
variable = "#BD93F9",
|
||||
property = "#50FA7B",
|
||||
},
|
||||
|
||||
special = {
|
||||
error = "#FF5555",
|
||||
warning = "#FFB86C",
|
||||
info = "#8BE9FD",
|
||||
success = "#50FA7B",
|
||||
diff_add = "#50FA7B",
|
||||
diff_delete = "#FF5555",
|
||||
diff_change = "#FFB86C",
|
||||
}
|
||||
}
|
||||
|
||||
local groups = {
|
||||
Normal = { fg = colors.fg.primary, bg = colors.bg.primary },
|
||||
NormalFloat = { fg = colors.fg.primary, bg = colors.bg.float },
|
||||
NormalNC = { fg = colors.fg.primary, bg = colors.bg.primary },
|
||||
|
||||
LineNr = { fg = colors.fg.muted },
|
||||
LineNrAbove = { fg = colors.fg.muted },
|
||||
LineNrBelow = { fg = colors.fg.muted },
|
||||
CursorLineNr = { fg = colors.fg.accent, bold = true },
|
||||
|
||||
Cursor = { fg = colors.bg.primary, bg = colors.fg.accent },
|
||||
CursorLine = { bg = colors.bg.highlight },
|
||||
CursorColumn = { bg = colors.bg.highlight },
|
||||
|
||||
Visual = { bg = colors.bg.selection },
|
||||
VisualNOS = { bg = colors.bg.selection },
|
||||
|
||||
Search = { fg = colors.bg.primary, bg = colors.special.warning },
|
||||
IncSearch = { fg = colors.bg.primary, bg = colors.syntax.number },
|
||||
|
||||
StatusLine = { fg = colors.fg.primary, bg = colors.bg.secondary },
|
||||
StatusLineNC = { fg = colors.fg.muted, bg = colors.bg.secondary },
|
||||
StatusLineTerm = { fg = colors.fg.primary, bg = colors.bg.secondary },
|
||||
StatusLineTermNC = { fg = colors.fg.muted, bg = colors.bg.secondary },
|
||||
|
||||
TabLine = { fg = colors.fg.muted, bg = colors.bg.secondary },
|
||||
TabLineFill = { bg = colors.bg.secondary },
|
||||
TabLineSel = { fg = colors.fg.accent, bg = colors.bg.tertiary, bold = true },
|
||||
|
||||
WinBar = { fg = colors.fg.primary, bg = colors.bg.primary },
|
||||
WinBarNC = { fg = colors.fg.muted, bg = colors.bg.primary },
|
||||
|
||||
Pmenu = { fg = colors.fg.primary, bg = colors.bg.float },
|
||||
PmenuSel = { fg = colors.fg.primary, bg = colors.fg.accent },
|
||||
PmenuSbar = { bg = colors.bg.float },
|
||||
PmenuThumb = { bg = colors.bg.highlight },
|
||||
|
||||
Comment = { fg = colors.syntax.comment, italic = true },
|
||||
String = { fg = colors.syntax.string },
|
||||
Character = { fg = colors.syntax.string },
|
||||
Number = { fg = colors.syntax.number },
|
||||
Boolean = { fg = colors.syntax.constant },
|
||||
Float = { fg = colors.syntax.number },
|
||||
|
||||
Identifier = { fg = colors.syntax.variable },
|
||||
["Function"] = { fg = colors.syntax["function"], bold = true },
|
||||
Statement = { fg = colors.syntax.keyword, bold = true },
|
||||
Conditional = { fg = colors.syntax.keyword, bold = true },
|
||||
Repeat = { fg = colors.syntax.keyword, bold = true },
|
||||
Label = { fg = colors.syntax.keyword, bold = true },
|
||||
Operator = { fg = colors.syntax.operator, bold = true },
|
||||
Keyword = { fg = colors.syntax.keyword, bold = true },
|
||||
Exception = { fg = colors.syntax.keyword, bold = true },
|
||||
|
||||
PreProc = { fg = colors.syntax.keyword, bold = true },
|
||||
Include = { fg = colors.syntax.keyword, bold = true },
|
||||
Define = { fg = colors.syntax.keyword, bold = true },
|
||||
Macro = { fg = colors.syntax.keyword, bold = true },
|
||||
PreCondit = { fg = colors.syntax.keyword, bold = true },
|
||||
|
||||
Type = { fg = colors.syntax.type, bold = true },
|
||||
StorageClass = { fg = colors.syntax.keyword, bold = true },
|
||||
Structure = { fg = colors.syntax.type, bold = true },
|
||||
Typedef = { fg = colors.syntax.type, bold = true },
|
||||
|
||||
Special = { fg = colors.syntax.property },
|
||||
SpecialChar = { fg = colors.syntax.property },
|
||||
Tag = { fg = colors.syntax.property },
|
||||
Delimiter = { fg = colors.syntax.operator },
|
||||
SpecialComment = { fg = colors.syntax.comment },
|
||||
Debug = { fg = colors.syntax.property },
|
||||
|
||||
Underlined = { underline = true },
|
||||
Ignore = { fg = colors.fg.muted },
|
||||
Error = { fg = colors.special.error, bold = true },
|
||||
Todo = { fg = colors.special.warning, bold = true },
|
||||
|
||||
DiffAdd = { fg = colors.special.diff_add },
|
||||
DiffChange = { fg = colors.special.diff_change },
|
||||
DiffDelete = { fg = colors.special.diff_delete },
|
||||
DiffText = { fg = colors.fg.primary, bg = colors.special.diff_change },
|
||||
|
||||
SpellBad = { sp = colors.special.error, underline = true },
|
||||
SpellCap = { sp = colors.special.warning, underline = true },
|
||||
SpellLocal = { sp = colors.special.info, underline = true },
|
||||
SpellRare = { sp = colors.special.success, underline = true },
|
||||
|
||||
["@text"] = { fg = colors.fg.primary },
|
||||
["@text.strong"] = { bold = true },
|
||||
["@text.emphasis"] = { italic = true },
|
||||
["@text.underline"] = { underline = true },
|
||||
["@text.strike"] = { strikethrough = true },
|
||||
["@text.literal"] = { fg = colors.syntax.string },
|
||||
["@text.uri"] = { fg = colors.syntax["function"], underline = true },
|
||||
|
||||
["@comment"] = { fg = colors.syntax.comment, italic = true },
|
||||
["@comment.documentation"] = { fg = colors.syntax.comment },
|
||||
|
||||
["@constant"] = { fg = colors.syntax.constant },
|
||||
["@constant.builtin"] = { fg = colors.syntax.constant },
|
||||
["@constant.macro"] = { fg = colors.syntax.constant },
|
||||
["@define"] = { fg = colors.syntax.keyword },
|
||||
["@macro"] = { fg = colors.syntax.keyword },
|
||||
["@string"] = { fg = colors.syntax.string },
|
||||
["@string.escape"] = { fg = colors.syntax.property },
|
||||
["@string.special"] = { fg = colors.syntax.property },
|
||||
["@character"] = { fg = colors.syntax.string },
|
||||
["@character.special"] = { fg = colors.syntax.property },
|
||||
["@number"] = { fg = colors.syntax.number },
|
||||
["@boolean"] = { fg = colors.syntax.constant },
|
||||
["@float"] = { fg = colors.syntax.number },
|
||||
|
||||
["@function"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@function.builtin"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@function.macro"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@parameter"] = { fg = colors.syntax.variable },
|
||||
["@method"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@field"] = { fg = colors.syntax.property, bold = true },
|
||||
["@property"] = { fg = colors.syntax.property, bold = true },
|
||||
["@constructor"] = { fg = colors.syntax["function"], bold = true },
|
||||
|
||||
["@conditional"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@repeat"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@label"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@operator"] = { fg = colors.syntax.operator, bold = true },
|
||||
["@keyword"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@exception"] = { fg = colors.syntax.keyword, bold = true },
|
||||
|
||||
["@variable"] = { fg = colors.syntax.variable },
|
||||
["@variable.builtin"] = { fg = colors.syntax.constant, bold = true },
|
||||
["@type"] = { fg = colors.syntax.type, bold = true },
|
||||
["@type.qualifier"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@type.builtin"] = { fg = colors.syntax.type, bold = true },
|
||||
["@type.definition"] = { fg = colors.syntax.type, bold = true },
|
||||
["@storageclass"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@structure"] = { fg = colors.syntax.type, bold = true },
|
||||
["@namespace"] = { fg = colors.syntax.type, bold = true },
|
||||
["@include"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@preproc"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@debug"] = { fg = colors.syntax.property, bold = true },
|
||||
["@tag"] = { fg = colors.syntax.property, bold = true },
|
||||
|
||||
["@lsp.type.comment"] = { fg = colors.syntax.comment, italic = true },
|
||||
["@lsp.type.namespace"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.type"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.class"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.enum"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.interface"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.struct"] = { fg = colors.syntax.type, bold = true },
|
||||
["@lsp.type.parameter"] = { fg = colors.syntax.variable },
|
||||
["@lsp.type.variable"] = { fg = colors.syntax.variable },
|
||||
["@lsp.type.property"] = { fg = colors.syntax.property, bold = true },
|
||||
["@lsp.type.enumMember"] = { fg = colors.syntax.constant, bold = true },
|
||||
["@lsp.type.function"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@lsp.type.method"] = { fg = colors.syntax["function"], bold = true },
|
||||
["@lsp.type.macro"] = { fg = colors.syntax.keyword, bold = true },
|
||||
["@lsp.type.decorator"] = { fg = colors.syntax.property, bold = true },
|
||||
}
|
||||
|
||||
for group, settings in pairs(groups) do
|
||||
vim.api.nvim_set_hl(0, group, settings)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
13
lua/cargdev-cyberpunk/plugin.lua
Normal file
13
lua/cargdev-cyberpunk/plugin.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
local M = {}
|
||||
|
||||
M.name = "cargdev-cyberpunk.nvim"
|
||||
M.description = "A vibrant Neovim color scheme with cyberpunk aesthetics"
|
||||
M.version = "1.0.0"
|
||||
M.author = "CargDev"
|
||||
M.license = "MIT"
|
||||
|
||||
function M.config()
|
||||
require('cargdev-cyberpunk').setup()
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user