rename folder

This commit is contained in:
sanjeed5
2025-02-27 00:04:07 +05:30
parent 519c3fa882
commit f7fa52c998
879 changed files with 0 additions and 0 deletions
@@ -0,0 +1,9 @@
---
description: Accessibility rules for Svelte and SvelteKit
globs: **/*.svelte
---
- Ensure proper semantic HTML structure in Svelte components.
- Implement ARIA attributes where necessary.
- Ensure keyboard navigation support for interactive elements.
- Use Svelte's bind:this for managing focus programmatically.
- Ensure text scaling and font adjustments for accessibility.
@@ -0,0 +1,5 @@
---
description: Configuration management techniques
globs: svelte.config.js
---
- Use environment variables for configuration management.
@@ -0,0 +1,7 @@
---
description: Describes Form and Actions implementations.
globs: **/*.svelte
---
- Utilize SvelteKit's form actions for server-side form handling.
- Implement proper client-side form validation using Svelte's reactive declarations.
- Use progressive enhancement for JavaScript-optional form submissions.
@@ -0,0 +1,13 @@
---
description: Details Paraglide.js i18n implementations.
globs: **/*.svelte
---
- Use Paraglide.js for internationalization: https://inlang.com/m/gerre34r/library-inlang-paraglideJs
- Install Paraglide.js: `npm install @inlang/paraglide-js`
- Set up language files in the `languages` directory.
- Use the `t` function to translate strings:
svelte
<br />
import { t } from '@inlang/paraglide-js';
<br />
- Support multiple languages and RTL layouts.
@@ -0,0 +1,11 @@
---
description: Performance Optimization techniques for Svelte and SvelteKit projects.
globs: **/*.svelte
---
- Leverage Svelte's compile-time optimizations.
- Use `{#key}` blocks to force re-rendering of components when needed.
- Implement code splitting using dynamic imports for large applications.
- Profile and monitor performance using browser developer tools.
- Use `$effect.tracking()` to optimize effect dependencies.
- Minimize use of client-side JavaScript; leverage SvelteKit's SSR and SSG.
- Implement proper lazy loading for images and other assets.
@@ -0,0 +1,7 @@
---
description: Provides SEO and Meta Tags guidelines in SvelteKit.
globs: **/*.svelte
---
- Use Svelte:head component for adding meta information.
- Implement canonical URLs for proper SEO.
- Create reusable SEO components for consistent meta tag management.
@@ -0,0 +1,25 @@
---
description: Applies general Svelte and SvelteKit best practices, including file structure, component development, and state management.
globs: **/*.svelte
---
- Write concise, technical TypeScript or JavaScript code with accurate examples.
- Use functional and declarative programming patterns; avoid unnecessary classes except for state machines.
- Prefer iteration and modularization over code duplication.
- Structure files: component logic, markup, styles, helpers, types.
- Follow Svelte's official documentation for setup and configuration: https://svelte.dev/docs
- Use lowercase with hyphens for component files (e.g., `components/auth-form.svelte`).
- Use PascalCase for component names in imports and usage.
- Use camelCase for variables, functions, and props.
- Implement proper component composition and reusability.
- Use Svelte's props for data passing.
- Leverage Svelte's reactive declarations for local state management.
- Ensure proper semantic HTML structure in Svelte components.
- Implement ARIA attributes where necessary.
- Ensure keyboard navigation support for interactive elements.
- Use Svelte's bind:this for managing focus programmatically.
- Embrace Svelte's simplicity and avoid over-engineering solutions.
- Use SvelteKit for full-stack applications with SSR and API routes.
- Prioritize Web Vitals (LCP, FID, CLS) for performance optimization.
- Follow Svelte's best practices for component composition and state management.
- Ensure cross-browser compatibility by testing on multiple platforms.
- Keep your Svelte and SvelteKit versions up to date.
@@ -0,0 +1,29 @@
---
description: Provides guidelines for using Svelte 5 runes ($state, $derived, $effect, $props, $bindable, $inspect) for reactive state management and lifecycle events.
globs: **/*.svelte
---
- `$state`: Declare reactive state
typescript
let count = $state(0);
- `$derived`: Compute derived values
typescript
let doubled = $derived(count * 2);
- `$effect`: Manage side effects and lifecycle
typescript
$effect(() => {
console.log(`Count is now ${count}`);
});
- `$props`: Declare component props
typescript
let { optionalProp = 42, requiredProp } = $props();
- `$bindable`: Create two-way bindable props
typescript
let { bindableProp = $bindable() } = $props();
- `$inspect`: Debug reactive state (development only)
typescript
$inspect(count);
@@ -0,0 +1,8 @@
---
description: Defines best practices for API routes in SvelteKit, focusing on request handling, response formatting, and global middleware.
globs: src/routes/api/**/*.ts
---
- Create API routes in the src/routes/api/ directory.
- Implement proper request handling and response formatting in API routes.
- Use SvelteKit's hooks for global API middleware.
- Implement proper error handling for data fetching operations.
@@ -0,0 +1,13 @@
---
description: Enforces the recommended SvelteKit project structure.
globs: src/
---
- Use the recommended SvelteKit project structure:
- src/
- lib/
- routes/
- app.html
- static/
- svelte.config.js
- vite.config.js
@@ -0,0 +1,8 @@
---
description: Applies routing conventions in SvelteKit projects.
globs: src/routes/**/*.svelte
---
- Utilize SvelteKit's file-based routing system in the src/routes/ directory.
- Implement dynamic routes using [slug] syntax.
- Use load functions for server-side data fetching and pre-rendering.
- Implement proper error handling with +error.svelte pages.
@@ -0,0 +1,7 @@
---
description: Applies Server-Side Rendering and Static Site Generation
globs: svelte.config.js
---
- Leverage SvelteKit's SSR capabilities for dynamic content.
- Implement SSG for static pages using prerender option.
- Use the adapter-auto for automatic deployment configuration.
@@ -0,0 +1,18 @@
---
description: Defines UI and styling conventions using Tailwind CSS and Shadcn components, emphasizing utility-first styling and reusable UI elements.
globs: **/*.svelte
---
- Use Tailwind CSS for utility-first styling approach.
- Leverage Shadcn components for pre-built, customizable UI elements.
- Import Shadcn components from `$lib/components/ui`.
- Organize Tailwind classes using the `cn()` utility from `$lib/utils`.
- Use Svelte's built-in transition and animation features.
- Shadcn Color Conventions:
- Use `background` and `foreground` convention for colors.
- Define CSS variables without color space function:
css
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
- Usage example:
svelte
@@ -0,0 +1,34 @@
---
description: Enforces TypeScript best practices within Svelte component logic files, including interface usage, avoiding enums, and strict mode.
globs: **/*.svelte.ts
---
- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use const objects instead.
- Use functional components with TypeScript interfaces for props.
- Enable strict mode in TypeScript for better type safety.
- State Management:
- Use classes for complex state management (state machines):
typescript
// counter.svelte.ts
class Counter {
count = $state(0);
incrementor = $state(1);
increment() {
this.count += this.incrementor;
}
resetCount() {
this.count = 0;
}
resetIncrementor() {
this.incrementor = 1;
}
}
export const counter = new Counter();
- State Management Example Usage:
svelte
<br />
import { counter } from './counter.svelte.ts';
<br />
<button on:click={() => counter.increment()}>
Count: {counter.count}