mtrl-addons 0.2.2 → 0.2.3
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/{src/components/index.ts → dist/components/index.d.ts} +0 -2
- package/dist/components/vlist/config.d.ts +86 -0
- package/{src/components/vlist/constants.ts → dist/components/vlist/constants.d.ts} +10 -11
- package/dist/components/vlist/features/api.d.ts +7 -0
- package/{src/components/vlist/features/index.ts → dist/components/vlist/features/index.d.ts} +0 -2
- package/dist/components/vlist/features/selection.d.ts +6 -0
- package/dist/components/vlist/features/viewport.d.ts +9 -0
- package/dist/components/vlist/features.d.ts +31 -0
- package/{src/components/vlist/index.ts → dist/components/vlist/index.d.ts} +1 -10
- package/dist/components/vlist/types.d.ts +596 -0
- package/dist/components/vlist/vlist.d.ts +29 -0
- package/dist/core/compose/features/gestures/index.d.ts +86 -0
- package/dist/core/compose/features/gestures/longpress.d.ts +85 -0
- package/dist/core/compose/features/gestures/pan.d.ts +108 -0
- package/dist/core/compose/features/gestures/pinch.d.ts +111 -0
- package/dist/core/compose/features/gestures/rotate.d.ts +111 -0
- package/dist/core/compose/features/gestures/swipe.d.ts +149 -0
- package/dist/core/compose/features/gestures/tap.d.ts +79 -0
- package/{src/core/compose/features/index.ts → dist/core/compose/features/index.d.ts} +1 -2
- package/{src/core/compose/index.ts → dist/core/compose/index.d.ts} +2 -11
- package/{src/core/gestures/index.ts → dist/core/gestures/index.d.ts} +1 -20
- package/dist/core/gestures/longpress.d.ts +23 -0
- package/dist/core/gestures/manager.d.ts +14 -0
- package/dist/core/gestures/pan.d.ts +12 -0
- package/dist/core/gestures/pinch.d.ts +14 -0
- package/dist/core/gestures/rotate.d.ts +14 -0
- package/dist/core/gestures/swipe.d.ts +20 -0
- package/dist/core/gestures/tap.d.ts +12 -0
- package/dist/core/gestures/types.d.ts +320 -0
- package/dist/core/gestures/utils.d.ts +57 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/layout/config.d.ts +33 -0
- package/dist/core/layout/index.d.ts +51 -0
- package/dist/core/layout/jsx.d.ts +65 -0
- package/dist/core/layout/schema.d.ts +112 -0
- package/dist/core/layout/types.d.ts +69 -0
- package/dist/core/viewport/constants.d.ts +105 -0
- package/dist/core/viewport/features/base.d.ts +14 -0
- package/dist/core/viewport/features/collection.d.ts +41 -0
- package/dist/core/viewport/features/events.d.ts +13 -0
- package/{src/core/viewport/features/index.ts → dist/core/viewport/features/index.d.ts} +0 -7
- package/dist/core/viewport/features/item-size.d.ts +30 -0
- package/dist/core/viewport/features/loading.d.ts +34 -0
- package/dist/core/viewport/features/momentum.d.ts +17 -0
- package/dist/core/viewport/features/performance.d.ts +53 -0
- package/dist/core/viewport/features/placeholders.d.ts +38 -0
- package/dist/core/viewport/features/rendering.d.ts +16 -0
- package/dist/core/viewport/features/scrollbar.d.ts +26 -0
- package/dist/core/viewport/features/scrolling.d.ts +16 -0
- package/dist/core/viewport/features/utils.d.ts +43 -0
- package/dist/core/viewport/features/virtual.d.ts +18 -0
- package/{src/core/viewport/index.ts → dist/core/viewport/index.d.ts} +1 -17
- package/dist/core/viewport/types.d.ts +96 -0
- package/dist/core/viewport/utils/speed-tracker.d.ts +22 -0
- package/dist/core/viewport/viewport.d.ts +11 -0
- package/{src/index.ts → dist/index.d.ts} +0 -4
- package/dist/index.js +5143 -0
- package/dist/index.mjs +5111 -0
- package/dist/styles.css +254 -0
- package/dist/styles.css.map +1 -0
- package/package.json +5 -1
- package/.cursorrules +0 -117
- package/AI.md +0 -39
- package/CLAUDE.md +0 -882
- package/build.js +0 -377
- package/scripts/analyze-orphaned-functions.ts +0 -387
- package/scripts/debug/vlist-selection.ts +0 -121
- package/src/components/vlist/config.ts +0 -323
- package/src/components/vlist/features/api.ts +0 -626
- package/src/components/vlist/features/selection.ts +0 -436
- package/src/components/vlist/features/viewport.ts +0 -59
- package/src/components/vlist/features.ts +0 -112
- package/src/components/vlist/types.ts +0 -723
- package/src/components/vlist/vlist.ts +0 -92
- package/src/core/compose/features/gestures/index.ts +0 -227
- package/src/core/compose/features/gestures/longpress.ts +0 -383
- package/src/core/compose/features/gestures/pan.ts +0 -424
- package/src/core/compose/features/gestures/pinch.ts +0 -475
- package/src/core/compose/features/gestures/rotate.ts +0 -485
- package/src/core/compose/features/gestures/swipe.ts +0 -492
- package/src/core/compose/features/gestures/tap.ts +0 -334
- package/src/core/gestures/longpress.ts +0 -68
- package/src/core/gestures/manager.ts +0 -418
- package/src/core/gestures/pan.ts +0 -48
- package/src/core/gestures/pinch.ts +0 -58
- package/src/core/gestures/rotate.ts +0 -58
- package/src/core/gestures/swipe.ts +0 -66
- package/src/core/gestures/tap.ts +0 -45
- package/src/core/gestures/types.ts +0 -387
- package/src/core/gestures/utils.ts +0 -128
- package/src/core/index.ts +0 -43
- package/src/core/layout/config.ts +0 -102
- package/src/core/layout/index.ts +0 -168
- package/src/core/layout/jsx.ts +0 -174
- package/src/core/layout/schema.ts +0 -1044
- package/src/core/layout/types.ts +0 -95
- package/src/core/viewport/constants.ts +0 -145
- package/src/core/viewport/features/base.ts +0 -73
- package/src/core/viewport/features/collection.ts +0 -1182
- package/src/core/viewport/features/events.ts +0 -130
- package/src/core/viewport/features/item-size.ts +0 -271
- package/src/core/viewport/features/loading.ts +0 -263
- package/src/core/viewport/features/momentum.ts +0 -269
- package/src/core/viewport/features/performance.ts +0 -161
- package/src/core/viewport/features/placeholders.ts +0 -335
- package/src/core/viewport/features/rendering.ts +0 -962
- package/src/core/viewport/features/scrollbar.ts +0 -434
- package/src/core/viewport/features/scrolling.ts +0 -634
- package/src/core/viewport/features/utils.ts +0 -94
- package/src/core/viewport/features/virtual.ts +0 -525
- package/src/core/viewport/types.ts +0 -133
- package/src/core/viewport/utils/speed-tracker.ts +0 -79
- package/src/core/viewport/viewport.ts +0 -265
- package/test/benchmarks/layout/advanced.test.ts +0 -656
- package/test/benchmarks/layout/comparison.test.ts +0 -519
- package/test/benchmarks/layout/performance-comparison.test.ts +0 -274
- package/test/benchmarks/layout/real-components.test.ts +0 -733
- package/test/benchmarks/layout/simple.test.ts +0 -321
- package/test/benchmarks/layout/stress.test.ts +0 -990
- package/test/collection/basic.test.ts +0 -304
- package/test/components/vlist-selection.test.ts +0 -240
- package/test/components/vlist.test.ts +0 -63
- package/test/core/collection/adapter.test.ts +0 -161
- package/test/core/collection/collection.test.ts +0 -394
- package/test/core/layout/layout.test.ts +0 -201
- package/test/utils/dom-helpers.ts +0 -275
- package/test/utils/performance-helpers.ts +0 -392
- package/tsconfig.json +0 -20
package/CLAUDE.md
DELETED
|
@@ -1,882 +0,0 @@
|
|
|
1
|
-
# mtrl-addons - Extended Components for mtrl
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
mtrl-addons is an extension library for the mtrl Material Design 3 component system, providing specialized elements and extended functionality for modern applications. It maintains the same "less is more" philosophy with zero external dependencies (mtrl as peer dependency only).
|
|
6
|
-
|
|
7
|
-
**Key Details:**
|
|
8
|
-
- License: MIT
|
|
9
|
-
- Language: TypeScript (strict mode)
|
|
10
|
-
- Runtime: Bun (native TypeScript execution)
|
|
11
|
-
- Dependencies: mtrl (peer dependency only)
|
|
12
|
-
- Framework: Agnostic - works with any JavaScript framework or vanilla JS
|
|
13
|
-
|
|
14
|
-
## Architecture
|
|
15
|
-
|
|
16
|
-
### Package Ecosystem
|
|
17
|
-
|
|
18
|
-
mtrl-addons is part of the mtrl ecosystem:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
mtrl ecosystem/
|
|
22
|
-
├── mtrl/ # Core Material Design 3 components
|
|
23
|
-
├── mtrl-addons/ # Extended components (this package)
|
|
24
|
-
└── mtrl-app/ # Documentation hub and showcase
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Package Relationships:**
|
|
28
|
-
```
|
|
29
|
-
mtrl (Foundation)
|
|
30
|
-
↑
|
|
31
|
-
mtrl-addons (Extensions)
|
|
32
|
-
├── Peer dependency on mtrl
|
|
33
|
-
├── Virtual scrolling and collections
|
|
34
|
-
├── Layout schema system
|
|
35
|
-
└── Performance optimizations
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Development Environment Recommendation:**
|
|
39
|
-
Clone related packages as siblings for easier cross-package development:
|
|
40
|
-
```
|
|
41
|
-
~/Code/
|
|
42
|
-
├── mtrl/ # Core components
|
|
43
|
-
├── mtrl-addons/ # This package
|
|
44
|
-
└── mtrl-app/ # Documentation
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Package Structure
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
mtrl-addons/
|
|
51
|
-
├── src/
|
|
52
|
-
│ ├── components/ # Extended components
|
|
53
|
-
│ │ └── vlist/ # Virtual list component
|
|
54
|
-
│ ├── core/ # Advanced core features
|
|
55
|
-
│ │ ├── viewport/ # Viewport and virtual scrolling
|
|
56
|
-
│ │ ├── layout/ # Layout schema system (JSX-like)
|
|
57
|
-
│ │ ├── compose/ # Enhanced composition utilities
|
|
58
|
-
│ │ └── gestures/ # Touch and gesture handling
|
|
59
|
-
│ ├── styles/ # Extended component styles
|
|
60
|
-
│ └── types/ # Shared type definitions
|
|
61
|
-
├── test/ # Bun test suite
|
|
62
|
-
│ ├── components/ # Component tests
|
|
63
|
-
│ ├── core/ # Core feature tests
|
|
64
|
-
│ └── benchmarks/ # Performance benchmarks
|
|
65
|
-
├── debugging/ # Temporary debug files (gitignored)
|
|
66
|
-
├── dist/ # Built package (gitignored)
|
|
67
|
-
└── package.json
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Technology Stack
|
|
71
|
-
|
|
72
|
-
### Core
|
|
73
|
-
- **Language**: TypeScript (strict mode enabled)
|
|
74
|
-
- **Runtime**: Bun (native TypeScript execution, built-in test runner)
|
|
75
|
-
- **Build Tool**: Bun
|
|
76
|
-
- **Test Framework**: Bun's built-in test runner
|
|
77
|
-
- **DOM Testing**: JSDOM
|
|
78
|
-
|
|
79
|
-
### Key Features
|
|
80
|
-
- **VList Component**: High-performance virtual list with direct viewport integration
|
|
81
|
-
- **Viewport System**: Virtual scrolling and positioning engine
|
|
82
|
-
- **Layout Schema**: Declarative UI composition system (JSX-like, array-based)
|
|
83
|
-
- **Gesture System**: Touch and gesture handling for interactive components
|
|
84
|
-
- **Compose Utilities**: Enhanced functional composition patterns
|
|
85
|
-
|
|
86
|
-
## Development Philosophy
|
|
87
|
-
|
|
88
|
-
### Core Principles
|
|
89
|
-
|
|
90
|
-
1. **"Less is More"** - Minimalist but complete implementation
|
|
91
|
-
2. **Zero Dependencies** - Only mtrl as peer dependency
|
|
92
|
-
3. **Performance First** - Optimized for large datasets and smooth scrolling
|
|
93
|
-
4. **Functional Composition** - Build on mtrl's composition patterns
|
|
94
|
-
5. **Extensibility** - Design for modularity and customization
|
|
95
|
-
6. **Integration** - Seamless integration with mtrl core components
|
|
96
|
-
|
|
97
|
-
### Design Decisions
|
|
98
|
-
|
|
99
|
-
- **Why VList?** Handle 100k+ items without performance degradation
|
|
100
|
-
- **Why Viewport System?** Flexible virtual scrolling for any component
|
|
101
|
-
- **Why Layout Schema?** Declarative, composable UI patterns (JSX-like without JSX)
|
|
102
|
-
- **Why Gestures?** Rich interaction patterns for touch devices
|
|
103
|
-
- **Why Extend mtrl?** Specialized features not needed in base library
|
|
104
|
-
- **Why Peer Dependency?** Maintain single source of truth for core components
|
|
105
|
-
|
|
106
|
-
## Development Setup
|
|
107
|
-
|
|
108
|
-
### 🚫 CRITICAL - Git Commit and Push Rules
|
|
109
|
-
|
|
110
|
-
**ABSOLUTE PROHIBITIONS:**
|
|
111
|
-
- ❌ **NEVER commit before testing** - Always test changes first
|
|
112
|
-
- ❌ **NEVER commit without explicit user permission** - Even if changes are tested
|
|
113
|
-
- ❌ **NEVER push to remote without explicit user permission** - Even after committing
|
|
114
|
-
- ❌ **NEVER run `git commit` automatically** - Always ask first
|
|
115
|
-
- ❌ **NEVER run `git push` automatically** - Always ask first
|
|
116
|
-
- ❌ **NEVER assume user wants changes committed** - Testing does not mean committing
|
|
117
|
-
- ❌ **NEVER assume user wants changes pushed** - Committing does not mean pushing
|
|
118
|
-
- ❌ **NEVER repeatedly ask to push after commits** - User will ask when ready
|
|
119
|
-
- ❌ **NEVER create markdown files without asking first** - No .md files without permission
|
|
120
|
-
|
|
121
|
-
**MANDATORY WORKFLOW:**
|
|
122
|
-
1. ✅ Make changes to files
|
|
123
|
-
2. ✅ Test the changes thoroughly (`bun test`)
|
|
124
|
-
3. ✅ Run type checking (`bun run typecheck`)
|
|
125
|
-
4. ✅ Build the package (`bun run build`)
|
|
126
|
-
5. ✅ Show `git status` and `git diff` to user
|
|
127
|
-
6. ✅ **STOP and ASK**: "Should I commit these changes?"
|
|
128
|
-
7. ✅ Wait for explicit "yes" or "commit" from user
|
|
129
|
-
8. ✅ Only then run `git commit`
|
|
130
|
-
9. ✅ **DO NOT ASK to push** - Wait for user to request it
|
|
131
|
-
10. ✅ User will say "push" when they want to push to remote
|
|
132
|
-
11. ✅ Only then run `git push`
|
|
133
|
-
|
|
134
|
-
### Initial Setup
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
# Clone repository
|
|
138
|
-
git clone <repository-url> mtrl-addons
|
|
139
|
-
cd mtrl-addons
|
|
140
|
-
|
|
141
|
-
# Install dependencies
|
|
142
|
-
bun install
|
|
143
|
-
|
|
144
|
-
# Link mtrl for local development (if needed)
|
|
145
|
-
bun link mtrl
|
|
146
|
-
|
|
147
|
-
# Build package
|
|
148
|
-
bun run build
|
|
149
|
-
|
|
150
|
-
# Run tests
|
|
151
|
-
bun test
|
|
152
|
-
|
|
153
|
-
# Type check
|
|
154
|
-
bun run typecheck
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Key Commands
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
# Development
|
|
161
|
-
bun run dev # Development mode with watch
|
|
162
|
-
bun run build # Build package for distribution
|
|
163
|
-
bun run build:app # Build for mtrl-app integration
|
|
164
|
-
bun run typecheck # TypeScript type checking
|
|
165
|
-
|
|
166
|
-
# Testing
|
|
167
|
-
bun test # Run all tests
|
|
168
|
-
bun test --watch # Watch mode for tests
|
|
169
|
-
bun test <pattern> # Run specific test files
|
|
170
|
-
bun run test:perf # Run performance benchmarks
|
|
171
|
-
|
|
172
|
-
# Quality
|
|
173
|
-
bun run lint # Check code style
|
|
174
|
-
bun run lint:fix # Fix code style issues
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Coding Standards
|
|
178
|
-
|
|
179
|
-
### TypeScript Best Practices
|
|
180
|
-
|
|
181
|
-
**Type Safety (CRITICAL):**
|
|
182
|
-
- **Strict mode enabled** - All type checking rules active
|
|
183
|
-
- **NEVER use `any` type** - Always use proper interfaces or `unknown`
|
|
184
|
-
- **Create interfaces** for all data structures
|
|
185
|
-
- **Explicit return types** on all functions
|
|
186
|
-
- **Type all function parameters**
|
|
187
|
-
- **Use generic types** for reusable utilities
|
|
188
|
-
|
|
189
|
-
**Example:**
|
|
190
|
-
```typescript
|
|
191
|
-
// ✅ GOOD - Proper types
|
|
192
|
-
interface ListManagerConfig {
|
|
193
|
-
orientation: 'vertical' | 'horizontal'
|
|
194
|
-
estimatedItemSize: number
|
|
195
|
-
overscan?: number
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function createListManager<T>(config: ListManagerConfig): ListManager<T> {
|
|
199
|
-
// typed parameter and generic return
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// ❌ BAD - Using any
|
|
203
|
-
function createListManager(config: any): any { // NEVER DO THIS
|
|
204
|
-
return config
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Component Structure
|
|
209
|
-
|
|
210
|
-
**Standard Component File Structure:**
|
|
211
|
-
```typescript
|
|
212
|
-
// src/components/advanced-list/advanced-list.ts
|
|
213
|
-
|
|
214
|
-
// 1. Imports
|
|
215
|
-
import { pipe } from 'mtrl/core/compose'
|
|
216
|
-
import { createList } from 'mtrl/components/list'
|
|
217
|
-
import { createListManager } from '../../core/list-manager'
|
|
218
|
-
|
|
219
|
-
// 2. Types
|
|
220
|
-
interface AdvancedListConfig {
|
|
221
|
-
collection: CollectionConfig
|
|
222
|
-
viewport: ViewportConfig
|
|
223
|
-
scrollbar?: ScrollbarConfig
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// 3. Constants
|
|
227
|
-
const DEFAULTS: Partial<AdvancedListConfig> = {
|
|
228
|
-
viewport: {
|
|
229
|
-
orientation: 'vertical',
|
|
230
|
-
overscan: 5
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// 4. Features (composable functions)
|
|
235
|
-
const withListManager = (config: ListManagerConfig) => (element: HTMLElement): HTMLElement => {
|
|
236
|
-
const manager = createListManager(config)
|
|
237
|
-
// Attach manager to element
|
|
238
|
-
return element
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// 5. Main creator function
|
|
242
|
-
export const createAdvancedList = <T>(config: AdvancedListConfig): HTMLElement => {
|
|
243
|
-
const finalConfig = { ...DEFAULTS, ...config }
|
|
244
|
-
|
|
245
|
-
return pipe(
|
|
246
|
-
createList({ variant: 'basic' }),
|
|
247
|
-
withListManager(finalConfig),
|
|
248
|
-
withCollection(finalConfig.collection),
|
|
249
|
-
withScrollbar(finalConfig.scrollbar)
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Functional Composition
|
|
255
|
-
|
|
256
|
-
**Build on mtrl's Pipe Pattern:**
|
|
257
|
-
```typescript
|
|
258
|
-
import { pipe } from 'mtrl/core/compose'
|
|
259
|
-
|
|
260
|
-
// Compose features using pipe
|
|
261
|
-
const createEnhancedComponent = <T>(config: Config): HTMLElement => {
|
|
262
|
-
return pipe(
|
|
263
|
-
createBaseComponent(config),
|
|
264
|
-
withVirtualScrolling(config.viewport),
|
|
265
|
-
withDataLoading(config.collection),
|
|
266
|
-
withCustomScrollbar(config.scrollbar)
|
|
267
|
-
)
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### File Management
|
|
272
|
-
|
|
273
|
-
**Preferences:**
|
|
274
|
-
- Prefer editing existing files over creating new ones
|
|
275
|
-
- Avoid hyphens in filenames if possible
|
|
276
|
-
- Prefer short filenames if clear enough
|
|
277
|
-
- Use `debugging/` folder for temporary test files (gitignored)
|
|
278
|
-
- No summary .md files for coding sessions
|
|
279
|
-
|
|
280
|
-
**Component File Organization:**
|
|
281
|
-
- Main module: `list-manager.ts`
|
|
282
|
-
- Types: `types.ts`
|
|
283
|
-
- Constants: `constants.ts`
|
|
284
|
-
- API: `api.ts` (special features)
|
|
285
|
-
- Features: `features.ts` (or split into `features/` folder if large)
|
|
286
|
-
- Index: `index.ts` (exports)
|
|
287
|
-
|
|
288
|
-
## Core Systems
|
|
289
|
-
|
|
290
|
-
### VList Component
|
|
291
|
-
|
|
292
|
-
**Purpose:** High-performance virtual list with direct viewport integration
|
|
293
|
-
|
|
294
|
-
**Key Features:**
|
|
295
|
-
- Virtual scrolling for massive datasets (100k+ items)
|
|
296
|
-
- Direct viewport integration (no abstraction layer)
|
|
297
|
-
- Configurable pagination strategies
|
|
298
|
-
- Template-based item rendering
|
|
299
|
-
- Built-in selection support
|
|
300
|
-
|
|
301
|
-
**Architecture:**
|
|
302
|
-
```
|
|
303
|
-
vlist/
|
|
304
|
-
├── vlist.ts # Main component
|
|
305
|
-
├── types.ts # Type definitions
|
|
306
|
-
├── config.ts # Configuration defaults
|
|
307
|
-
├── constants.ts # Constants
|
|
308
|
-
├── features.ts # Feature composition
|
|
309
|
-
├── features/
|
|
310
|
-
│ ├── viewport/ # Virtual scrolling integration
|
|
311
|
-
│ ├── api/ # Public API methods
|
|
312
|
-
│ └── selection/ # Item selection handling
|
|
313
|
-
└── index.ts
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
**Usage Pattern:**
|
|
317
|
-
```typescript
|
|
318
|
-
import { createVList } from 'mtrl-addons/components/vlist'
|
|
319
|
-
|
|
320
|
-
const vlist = createVList({
|
|
321
|
-
container: '#my-list',
|
|
322
|
-
collection: myAdapter,
|
|
323
|
-
rangeSize: 20,
|
|
324
|
-
paginationStrategy: 'page',
|
|
325
|
-
template: (item, index) => [
|
|
326
|
-
{ class: 'viewport-item', attributes: { 'data-id': item.id }},
|
|
327
|
-
[{ class: 'viewport-item__name', text: item.name }],
|
|
328
|
-
[{ class: 'viewport-item__value', text: item.value }]
|
|
329
|
-
]
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
// VList automatically handles:
|
|
333
|
-
// - Virtual scrolling
|
|
334
|
-
// - Item positioning
|
|
335
|
-
// - Data loading
|
|
336
|
-
// - Template rendering
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Viewport System
|
|
340
|
-
|
|
341
|
-
**Purpose:** Virtual scrolling and positioning engine
|
|
342
|
-
|
|
343
|
-
**Key Features:**
|
|
344
|
-
- Flexible viewport for any component
|
|
345
|
-
- Item size calculation and caching
|
|
346
|
-
- Scroll position management
|
|
347
|
-
- Range-based rendering
|
|
348
|
-
- Orientation support (vertical/horizontal)
|
|
349
|
-
|
|
350
|
-
**Usage Pattern:**
|
|
351
|
-
```typescript
|
|
352
|
-
import { withViewport } from 'mtrl-addons/core/viewport'
|
|
353
|
-
|
|
354
|
-
// Apply viewport to any component
|
|
355
|
-
const component = pipe(
|
|
356
|
-
createBaseComponent(config),
|
|
357
|
-
withViewport({
|
|
358
|
-
orientation: 'vertical',
|
|
359
|
-
estimatedItemSize: 60,
|
|
360
|
-
overscan: 5
|
|
361
|
-
})
|
|
362
|
-
)
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### Layout Schema System
|
|
366
|
-
|
|
367
|
-
**Purpose:** Declarative UI composition system (JSX-like without JSX)
|
|
368
|
-
|
|
369
|
-
**Key Features:**
|
|
370
|
-
- Array-based schema for component composition
|
|
371
|
-
- JSX-like syntax without JSX transpilation
|
|
372
|
-
- Dynamic HTML generation
|
|
373
|
-
- Type-safe component creation
|
|
374
|
-
- Responsive layout configurations (stack, row, grid)
|
|
375
|
-
- Built-in performance optimizations
|
|
376
|
-
|
|
377
|
-
**Architecture:**
|
|
378
|
-
```
|
|
379
|
-
layout/
|
|
380
|
-
├── schema.ts # Main schema processor
|
|
381
|
-
├── jsx.ts # JSX-style API
|
|
382
|
-
├── config.ts # Layout configurations
|
|
383
|
-
├── types.ts # Type definitions
|
|
384
|
-
└── index.ts
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
**Usage Pattern:**
|
|
388
|
-
```typescript
|
|
389
|
-
import { createLayout } from 'mtrl-addons/core/layout'
|
|
390
|
-
import { createButton } from 'mtrl/components/button'
|
|
391
|
-
import { createText } from 'mtrl/components/text'
|
|
392
|
-
|
|
393
|
-
// Array-based schema
|
|
394
|
-
const layout = createLayout([
|
|
395
|
-
[createButton, { variant: 'filled', text: 'Click me' }],
|
|
396
|
-
[createText, { text: 'Hello World' }],
|
|
397
|
-
['div', { class: 'container' },
|
|
398
|
-
[createButton, { variant: 'outlined', text: 'Nested' }]
|
|
399
|
-
]
|
|
400
|
-
])
|
|
401
|
-
|
|
402
|
-
// With layout configuration
|
|
403
|
-
const responsiveLayout = createLayout({
|
|
404
|
-
type: 'row',
|
|
405
|
-
gap: 16,
|
|
406
|
-
mobileStack: true,
|
|
407
|
-
children: [
|
|
408
|
-
[createButton, { variant: 'filled', text: 'Button 1' }],
|
|
409
|
-
[createButton, { variant: 'outlined', text: 'Button 2' }]
|
|
410
|
-
]
|
|
411
|
-
})
|
|
412
|
-
|
|
413
|
-
document.body.appendChild(layout)
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
### Gesture System
|
|
417
|
-
|
|
418
|
-
**Purpose:** Touch and gesture handling for interactive components
|
|
419
|
-
|
|
420
|
-
**Key Features:**
|
|
421
|
-
- Touch event abstraction
|
|
422
|
-
- Gesture recognition (tap, swipe, pinch, etc.)
|
|
423
|
-
- Multi-touch support
|
|
424
|
-
- Velocity and momentum calculations
|
|
425
|
-
- Integration with scroll and drag behaviors
|
|
426
|
-
|
|
427
|
-
**Usage Pattern:**
|
|
428
|
-
```typescript
|
|
429
|
-
import { withGestures } from 'mtrl-addons/core/gestures'
|
|
430
|
-
|
|
431
|
-
const component = pipe(
|
|
432
|
-
createBaseComponent(config),
|
|
433
|
-
withGestures({
|
|
434
|
-
onSwipe: (direction, velocity) => {
|
|
435
|
-
console.log(`Swiped ${direction} at ${velocity}px/s`)
|
|
436
|
-
},
|
|
437
|
-
onTap: (position) => {
|
|
438
|
-
console.log(`Tapped at`, position)
|
|
439
|
-
}
|
|
440
|
-
})
|
|
441
|
-
)
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
### Compose Utilities
|
|
445
|
-
|
|
446
|
-
**Purpose:** Enhanced functional composition patterns
|
|
447
|
-
|
|
448
|
-
**Key Features:**
|
|
449
|
-
- Extended pipe and compose functions
|
|
450
|
-
- Conditional composition helpers
|
|
451
|
-
- Feature factory patterns
|
|
452
|
-
- Component enhancement utilities
|
|
453
|
-
|
|
454
|
-
**Usage Pattern:**
|
|
455
|
-
```typescript
|
|
456
|
-
import { pipe, composeFeatures } from 'mtrl-addons/core/compose'
|
|
457
|
-
|
|
458
|
-
const component = pipe(
|
|
459
|
-
createBase(config),
|
|
460
|
-
composeFeatures(
|
|
461
|
-
withFeature1(config.feature1),
|
|
462
|
-
config.feature2 && withFeature2(config.feature2),
|
|
463
|
-
withFeature3(config.feature3)
|
|
464
|
-
)
|
|
465
|
-
)
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
## Testing Strategy
|
|
469
|
-
|
|
470
|
-
### Test Structure
|
|
471
|
-
|
|
472
|
-
```typescript
|
|
473
|
-
// test/core/list-manager/list-manager.test.ts
|
|
474
|
-
import { describe, it, expect, beforeEach } from 'bun:test'
|
|
475
|
-
import { JSDOM } from 'jsdom'
|
|
476
|
-
import { createListManager } from '../../src/core/list-manager'
|
|
477
|
-
|
|
478
|
-
describe('ListManager', () => {
|
|
479
|
-
let dom: JSDOM
|
|
480
|
-
|
|
481
|
-
beforeEach(() => {
|
|
482
|
-
dom = new JSDOM('<!DOCTYPE html><body></body>')
|
|
483
|
-
global.document = dom.window.document as any
|
|
484
|
-
global.HTMLElement = dom.window.HTMLElement as any
|
|
485
|
-
})
|
|
486
|
-
|
|
487
|
-
it('should handle large datasets efficiently', async () => {
|
|
488
|
-
const vlist = createVList({
|
|
489
|
-
collection: {
|
|
490
|
-
loadData: async (range) => generateMockData(range),
|
|
491
|
-
totalItems: 100000
|
|
492
|
-
},
|
|
493
|
-
rangeSize: 20,
|
|
494
|
-
template: (item) => [{ text: item.name }]
|
|
495
|
-
})
|
|
496
|
-
|
|
497
|
-
expect(vlist).toBeDefined()
|
|
498
|
-
// Performance assertions
|
|
499
|
-
})
|
|
500
|
-
|
|
501
|
-
it('should render visible items only', async () => {
|
|
502
|
-
const vlist = createVList({
|
|
503
|
-
collection: mockAdapter,
|
|
504
|
-
rangeSize: 20,
|
|
505
|
-
template: (item) => [{ text: item.name }]
|
|
506
|
-
})
|
|
507
|
-
|
|
508
|
-
// Only visible range should be rendered
|
|
509
|
-
const renderedItems = vlist.element.querySelectorAll('.viewport-item')
|
|
510
|
-
expect(renderedItems.length).toBeLessThanOrEqual(20)
|
|
511
|
-
})
|
|
512
|
-
})
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
### Performance Benchmarks
|
|
516
|
-
|
|
517
|
-
```typescript
|
|
518
|
-
// test/benchmarks/virtual-scrolling.bench.ts
|
|
519
|
-
import { describe, it, bench } from 'bun:test'
|
|
520
|
-
import { createListManager } from '../../src/core/list-manager'
|
|
521
|
-
|
|
522
|
-
describe('Virtual Scrolling Performance', () => {
|
|
523
|
-
bench('render 100k items', () => {
|
|
524
|
-
const vlist = createVList({
|
|
525
|
-
collection: {
|
|
526
|
-
loadData: async (range) => generateMockData(range),
|
|
527
|
-
totalItems: 100000
|
|
528
|
-
},
|
|
529
|
-
template: (item) => [{ text: item.name }]
|
|
530
|
-
})
|
|
531
|
-
|
|
532
|
-
// Initial render
|
|
533
|
-
vlist.render()
|
|
534
|
-
})
|
|
535
|
-
|
|
536
|
-
bench('scroll through 100k items', async () => {
|
|
537
|
-
const vlist = createVList({
|
|
538
|
-
collection: {
|
|
539
|
-
loadData: async (range) => generateMockData(range),
|
|
540
|
-
totalItems: 100000
|
|
541
|
-
},
|
|
542
|
-
template: (item) => [{ text: item.name }]
|
|
543
|
-
})
|
|
544
|
-
|
|
545
|
-
// Simulate scrolling
|
|
546
|
-
for (let i = 0; i < 100; i++) {
|
|
547
|
-
await vlist.scrollToIndex(i * 100)
|
|
548
|
-
}
|
|
549
|
-
})
|
|
550
|
-
})
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
### Testing Guidelines
|
|
554
|
-
|
|
555
|
-
1. **Use Bun test runner** - Native TypeScript support, fast execution
|
|
556
|
-
2. **Use JSDOM** - For DOM testing in Node environment
|
|
557
|
-
3. **Mock data sources** - Create realistic mock datasets
|
|
558
|
-
4. **Test performance** - Use benchmarks for critical paths
|
|
559
|
-
5. **Test edge cases** - Empty datasets, loading failures, boundary conditions
|
|
560
|
-
6. **Test integration** - Verify mtrl component integration
|
|
561
|
-
|
|
562
|
-
## Performance Optimization
|
|
563
|
-
|
|
564
|
-
### Target Metrics
|
|
565
|
-
|
|
566
|
-
**Virtual Scrolling:**
|
|
567
|
-
- Initial render: < 100ms for 1000+ items
|
|
568
|
-
- Scroll performance: 60 FPS during scrolling
|
|
569
|
-
- Memory usage: < 50MB for 100k items
|
|
570
|
-
- Data loading: < 200ms for range requests
|
|
571
|
-
|
|
572
|
-
**Bundle Size:**
|
|
573
|
-
- VList component: < 12KB gzipped
|
|
574
|
-
- Viewport system: < 8KB gzipped
|
|
575
|
-
- Layout schema: < 5KB gzipped
|
|
576
|
-
- Gesture system: < 4KB gzipped
|
|
577
|
-
- Compose utilities: < 2KB gzipped
|
|
578
|
-
- Full package: < 30KB gzipped
|
|
579
|
-
|
|
580
|
-
### Optimization Strategies
|
|
581
|
-
|
|
582
|
-
**Virtual Scrolling:**
|
|
583
|
-
```typescript
|
|
584
|
-
// ✅ Good - Efficient viewport calculations
|
|
585
|
-
const calculateVisibleRange = memoize((scrollTop: number, viewportHeight: number, itemHeight: number) => {
|
|
586
|
-
const start = Math.floor(scrollTop / itemHeight)
|
|
587
|
-
const end = Math.ceil((scrollTop + viewportHeight) / itemHeight)
|
|
588
|
-
return { start, end }
|
|
589
|
-
})
|
|
590
|
-
|
|
591
|
-
// ❌ Bad - Recalculating every time
|
|
592
|
-
const calculateVisibleRange = (scrollTop: number, viewportHeight: number, itemHeight: number) => {
|
|
593
|
-
// Expensive calculation on every scroll
|
|
594
|
-
return expensiveCalculation(scrollTop, viewportHeight, itemHeight)
|
|
595
|
-
}
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
**Memory Management:**
|
|
599
|
-
```typescript
|
|
600
|
-
// ✅ Good - Reuse DOM elements
|
|
601
|
-
const itemPool = new Map<string, HTMLElement>()
|
|
602
|
-
|
|
603
|
-
const getOrCreateItem = (key: string): HTMLElement => {
|
|
604
|
-
if (itemPool.has(key)) {
|
|
605
|
-
return itemPool.get(key)!
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
const element = createItem()
|
|
609
|
-
itemPool.set(key, element)
|
|
610
|
-
return element
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// ❌ Bad - Create new elements every time
|
|
614
|
-
const createNewItem = (): HTMLElement => {
|
|
615
|
-
return document.createElement('div') // Memory leak!
|
|
616
|
-
}
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
## Showcase & Documentation
|
|
620
|
-
|
|
621
|
-
### Documentation Location
|
|
622
|
-
|
|
623
|
-
**❌ Do NOT create documentation in mtrl-addons package**
|
|
624
|
-
- No README files for features
|
|
625
|
-
- No .md files for components
|
|
626
|
-
- No inline documentation beyond JSDoc
|
|
627
|
-
|
|
628
|
-
**✅ DO create documentation in mtrl-app:**
|
|
629
|
-
- `mtrl-app/client/content/addons/` - Component showcases
|
|
630
|
-
- `mtrl-app/docs/addons/` - Architecture and usage guides
|
|
631
|
-
- Interactive demonstrations with live code examples
|
|
632
|
-
|
|
633
|
-
### Creating Showcases
|
|
634
|
-
|
|
635
|
-
**Always use layout schema:**
|
|
636
|
-
```typescript
|
|
637
|
-
// In mtrl-app, not in mtrl-addons
|
|
638
|
-
import { createAdvancedList } from 'mtrl-addons/components/list'
|
|
639
|
-
|
|
640
|
-
const showcase = [
|
|
641
|
-
[AdvancedList, {
|
|
642
|
-
collection: {
|
|
643
|
-
loadData: async (range) => mockData(range),
|
|
644
|
-
totalItems: 10000
|
|
645
|
-
}
|
|
646
|
-
}]
|
|
647
|
-
]
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
## Common Development Tasks
|
|
651
|
-
|
|
652
|
-
### Adding New Feature to VList
|
|
653
|
-
|
|
654
|
-
**1. Create feature module:**
|
|
655
|
-
```bash
|
|
656
|
-
mkdir -p src/components/vlist/features/new-feature
|
|
657
|
-
touch src/components/vlist/features/new-feature/new-feature.ts
|
|
658
|
-
touch src/components/vlist/features/new-feature/types.ts
|
|
659
|
-
touch src/components/vlist/features/new-feature/index.ts
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
**2. Implement feature:**
|
|
663
|
-
```typescript
|
|
664
|
-
// src/components/vlist/features/new-feature/new-feature.ts
|
|
665
|
-
import type { NewFeatureConfig } from './types'
|
|
666
|
-
|
|
667
|
-
export const withNewFeature = (config: NewFeatureConfig) => (vlist: VListComponent) => {
|
|
668
|
-
// Feature implementation
|
|
669
|
-
return vlist
|
|
670
|
-
}
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
**3. Integrate with VList:**
|
|
674
|
-
```typescript
|
|
675
|
-
// src/components/vlist/vlist.ts
|
|
676
|
-
import { withNewFeature } from './features/new-feature'
|
|
677
|
-
|
|
678
|
-
export const createVList = <T>(config: VListConfig<T>) => {
|
|
679
|
-
return pipe(
|
|
680
|
-
createBase(config),
|
|
681
|
-
withViewport(config),
|
|
682
|
-
withAPI(config),
|
|
683
|
-
config.newFeature && withNewFeature(config.newFeature)
|
|
684
|
-
)
|
|
685
|
-
}
|
|
686
|
-
```
|
|
687
|
-
|
|
688
|
-
### Extending Layout Schema
|
|
689
|
-
|
|
690
|
-
**Add new layout type:**
|
|
691
|
-
```typescript
|
|
692
|
-
// src/core/layout/types.ts
|
|
693
|
-
export interface LayoutConfig {
|
|
694
|
-
type?: 'stack' | 'row' | 'grid' | 'masonry' // Add new type
|
|
695
|
-
// ...
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
// src/core/layout/schema.ts
|
|
699
|
-
const createMasonryLayout = (config: LayoutConfig, children: any[]) => {
|
|
700
|
-
// Implement masonry layout logic
|
|
701
|
-
}
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
### Adding Gesture Recognition
|
|
705
|
-
|
|
706
|
-
**Add new gesture:**
|
|
707
|
-
```typescript
|
|
708
|
-
// src/core/gestures/recognizers/pinch.ts
|
|
709
|
-
export const createPinchRecognizer = (config: PinchConfig) => {
|
|
710
|
-
return {
|
|
711
|
-
recognize: (touches: Touch[]) => {
|
|
712
|
-
// Pinch gesture detection
|
|
713
|
-
},
|
|
714
|
-
onPinch: (scale: number) => {
|
|
715
|
-
// Handle pinch gesture
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
## Build System
|
|
722
|
-
|
|
723
|
-
### Package Configuration
|
|
724
|
-
|
|
725
|
-
**package.json exports:**
|
|
726
|
-
```json
|
|
727
|
-
{
|
|
728
|
-
"name": "mtrl-addons",
|
|
729
|
-
"type": "module",
|
|
730
|
-
"exports": {
|
|
731
|
-
".": {
|
|
732
|
-
"import": "./dist/index.js",
|
|
733
|
-
"require": "./dist/index.cjs"
|
|
734
|
-
},
|
|
735
|
-
"./core/*": {
|
|
736
|
-
"import": "./dist/core/*.js",
|
|
737
|
-
"require": "./dist/core/*.cjs"
|
|
738
|
-
},
|
|
739
|
-
"./components/*": {
|
|
740
|
-
"import": "./dist/components/*.js",
|
|
741
|
-
"require": "./dist/components/*.cjs"
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
### Build Commands
|
|
748
|
-
|
|
749
|
-
```bash
|
|
750
|
-
# Package build (for distribution)
|
|
751
|
-
bun run build
|
|
752
|
-
|
|
753
|
-
# App build (for mtrl-app integration)
|
|
754
|
-
bun run build:app
|
|
755
|
-
|
|
756
|
-
# Watch mode
|
|
757
|
-
bun run dev
|
|
758
|
-
|
|
759
|
-
# Type checking
|
|
760
|
-
bun run typecheck
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
**⚠️ Important:** Use `bun run build:app` when building for mtrl-app, NOT `bun run build`
|
|
764
|
-
|
|
765
|
-
## Common Issues & Solutions
|
|
766
|
-
|
|
767
|
-
### Performance Issues
|
|
768
|
-
|
|
769
|
-
**Issue:** Slow scrolling with large datasets
|
|
770
|
-
**Solution:**
|
|
771
|
-
- Check overscan value (don't make it too large)
|
|
772
|
-
- Verify item size caching is working
|
|
773
|
-
- Profile with browser DevTools
|
|
774
|
-
|
|
775
|
-
**Issue:** Memory leaks
|
|
776
|
-
**Solution:**
|
|
777
|
-
- Ensure proper cleanup in destroy methods
|
|
778
|
-
- Check event listener removal
|
|
779
|
-
- Verify DOM element recycling
|
|
780
|
-
|
|
781
|
-
### Integration Issues
|
|
782
|
-
|
|
783
|
-
**Issue:** Components not composing correctly
|
|
784
|
-
**Solution:**
|
|
785
|
-
- Check import order from mtrl
|
|
786
|
-
- Verify peer dependency version matches
|
|
787
|
-
- Test in isolation first
|
|
788
|
-
|
|
789
|
-
**Issue:** TypeScript errors with mtrl types
|
|
790
|
-
**Solution:**
|
|
791
|
-
- Ensure mtrl types are properly exported
|
|
792
|
-
- Check tsconfig.json moduleResolution
|
|
793
|
-
- Verify type imports use correct paths
|
|
794
|
-
|
|
795
|
-
## Related Packages
|
|
796
|
-
|
|
797
|
-
### mtrl
|
|
798
|
-
|
|
799
|
-
**Purpose:** Core Material Design 3 component library
|
|
800
|
-
- Foundation for all mtrl-addons features
|
|
801
|
-
- Provides base components and utilities
|
|
802
|
-
- Zero dependencies
|
|
803
|
-
|
|
804
|
-
**Documentation:** `mtrl/CLAUDE.md`
|
|
805
|
-
|
|
806
|
-
### mtrl-app
|
|
807
|
-
|
|
808
|
-
**Purpose:** Documentation hub and interactive showcase
|
|
809
|
-
- Component demonstrations
|
|
810
|
-
- Usage examples
|
|
811
|
-
- API documentation
|
|
812
|
-
- Interactive playground
|
|
813
|
-
|
|
814
|
-
**Documentation:** `mtrl-app/CLAUDE.md`
|
|
815
|
-
|
|
816
|
-
## Key Files Reference
|
|
817
|
-
|
|
818
|
-
### Core Systems
|
|
819
|
-
- `src/core/viewport/` - Viewport and virtual scrolling engine
|
|
820
|
-
- `src/core/layout/` - Layout schema system (JSX-like)
|
|
821
|
-
- `src/core/compose/` - Enhanced composition utilities
|
|
822
|
-
- `src/core/gestures/` - Touch and gesture handling
|
|
823
|
-
|
|
824
|
-
### Components
|
|
825
|
-
- `src/components/vlist/` - Virtual list component with direct viewport
|
|
826
|
-
- `src/components/index.ts` - Component exports
|
|
827
|
-
|
|
828
|
-
### Testing
|
|
829
|
-
- `test/core/` - Core feature tests
|
|
830
|
-
- `test/benchmarks/` - Performance benchmarks
|
|
831
|
-
- `test/components/` - Component tests
|
|
832
|
-
|
|
833
|
-
## Prohibited Actions
|
|
834
|
-
|
|
835
|
-
**❌ NEVER do these:**
|
|
836
|
-
- Use React or any framework (pure TypeScript/JavaScript only)
|
|
837
|
-
- Add external dependencies beyond mtrl peer dependency
|
|
838
|
-
- Create markdown documentation files in this package
|
|
839
|
-
- Hardcode prefix in TypeScript or SCSS files
|
|
840
|
-
- Use `any` type in TypeScript
|
|
841
|
-
- Duplicate mtrl core functionality
|
|
842
|
-
- Enhance components while fixing bugs (stay focused)
|
|
843
|
-
- Run development servers (Bun/Node)
|
|
844
|
-
- Use global Window object to store things
|
|
845
|
-
- Build using `bun run build` when integrating with mtrl-app (use `bun run build:app`)
|
|
846
|
-
|
|
847
|
-
**✅ ALWAYS do these:**
|
|
848
|
-
- Write tests before implementing features
|
|
849
|
-
- Use TypeScript strict mode
|
|
850
|
-
- Follow mtrl patterns and conventions
|
|
851
|
-
- Optimize for performance (size, memory, speed)
|
|
852
|
-
- Ensure mtrl integration works seamlessly
|
|
853
|
-
- Ask before creating .md files
|
|
854
|
-
- Ask before committing changes
|
|
855
|
-
- Ask before pushing to remote
|
|
856
|
-
|
|
857
|
-
## Contributing
|
|
858
|
-
|
|
859
|
-
1. Follow all coding standards and guidelines
|
|
860
|
-
2. Write comprehensive tests including performance benchmarks
|
|
861
|
-
3. Ensure seamless mtrl integration
|
|
862
|
-
4. Document in mtrl-app (not here)
|
|
863
|
-
5. Run type checking before committing
|
|
864
|
-
6. Ask for permission before git operations
|
|
865
|
-
7. Follow conventional commit format
|
|
866
|
-
|
|
867
|
-
## Conventional Commits
|
|
868
|
-
|
|
869
|
-
```bash
|
|
870
|
-
feat(list-manager): add infinite scroll support
|
|
871
|
-
fix(collection): correct cache invalidation logic
|
|
872
|
-
refactor(viewport): optimize range calculations
|
|
873
|
-
perf(scrolling): improve scroll performance by 30%
|
|
874
|
-
test(list-manager): add virtual scrolling benchmarks
|
|
875
|
-
docs(readme): update installation guide
|
|
876
|
-
style(list): fix formatting
|
|
877
|
-
chore(deps): update mtrl peer dependency
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
---
|
|
881
|
-
|
|
882
|
-
**Remember:** This package extends mtrl with advanced features. Every line of code matters. Stay minimal, stay fast, stay integrated with mtrl core. 🚀
|