@humanspeak/svelte-virtual-list 0.3.1 → 0.3.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/README.md CHANGED
@@ -79,7 +79,14 @@ You can now programmatically scroll to any item in the list using the `scroll` m
79
79
  ## Installation
80
80
 
81
81
  ```bash
82
+ # Using npm
82
83
  npm install @humanspeak/svelte-virtual-list
84
+
85
+ # Using pnpm (recommended)
86
+ pnpm add @humanspeak/svelte-virtual-list
87
+
88
+ # Using yarn
89
+ yarn add @humanspeak/svelte-virtual-list
83
90
  ```
84
91
 
85
92
  ## Basic Usage
@@ -170,10 +177,50 @@ Use `mode="bottomToTop"` for chat-like lists anchored to the bottom. Programmati
170
177
 
171
178
  ## Testing
172
179
 
173
- - Unit tests (Vitest): `npm test`
174
- - E2E tests (Playwright):
175
- - One-time: `npx playwright install`
176
- - Run: `npm run test:e2e`
180
+ ### Unit Tests (Vitest)
181
+
182
+ ```bash
183
+ # Run unit tests with coverage
184
+ pnpm test
185
+
186
+ # Run specific test files
187
+ pnpm vitest src/lib/utils/throttle.test.ts
188
+ ```
189
+
190
+ ### E2E Tests (Playwright)
191
+
192
+ ```bash
193
+ # Install Playwright browsers (one-time setup)
194
+ npx playwright install
195
+
196
+ # Run all e2e tests
197
+ pnpm run test:e2e
198
+
199
+ # Run specific e2e test
200
+ npx playwright test tests/docs-visit.spec.ts --project=chromium
201
+
202
+ # Debug mode
203
+ npx playwright test --debug
204
+ ```
205
+
206
+ ### Development Commands
207
+
208
+ ```bash
209
+ # Start development server
210
+ pnpm dev
211
+
212
+ # Start both package and docs
213
+ pnpm run dev:all
214
+
215
+ # Check TypeScript/Svelte
216
+ pnpm run check
217
+
218
+ # Build package
219
+ pnpm run build
220
+
221
+ # Format and lint code
222
+ pnpm run lint:fix
223
+ ```
177
224
 
178
225
  ## Performance Considerations
179
226
 
@@ -183,6 +230,29 @@ Use `mode="bottomToTop"` for chat-like lists anchored to the bottom. Programmati
183
230
  - Resize observers handle container/content changes
184
231
  - Virtual DOM updates are batched for efficiency
185
232
 
233
+ ## Project Structure
234
+
235
+ This is a **PNPM workspace** with two packages:
236
+
237
+ 1. **`./`** - Main Svelte Virtual List component package
238
+ 2. **`./docs`** - Documentation site with live demos and examples
239
+
240
+ ### Development Workflow
241
+
242
+ ```bash
243
+ # Install dependencies for both packages
244
+ pnpm install
245
+
246
+ # Run development servers simultaneously
247
+ pnpm run dev:all
248
+
249
+ # Build both packages
250
+ pnpm run build
251
+
252
+ # Run tests across the workspace
253
+ pnpm test:all
254
+ ```
255
+
186
256
  ## License
187
257
 
188
258
  MIT © [Humanspeak, Inc.](LICENSE)
@@ -177,9 +177,13 @@
177
177
 
178
178
  const rafSchedule = createRafScheduler()
179
179
  // Package-specific debug flag - safe for library distribution
180
- // Enable with: NODE_ENV=development SVELTE_VIRTUAL_LIST_DEBUG=true
181
- const INTERNAL_DEBUG =
182
- import.meta.env.DEV && import.meta.env.VITE_SVELTE_VIRTUAL_LIST_DEBUG === 'true'
180
+ // Enable with: PUBLIC_SVELTE_VIRTUAL_LIST_DEBUG=true (preferred) or SVELTE_VIRTUAL_LIST_DEBUG=true
181
+ // Avoid SvelteKit-only $env imports so library works in non-Kit/Vitest contexts
182
+ const INTERNAL_DEBUG = Boolean(
183
+ typeof process !== 'undefined' &&
184
+ (process?.env?.PUBLIC_SVELTE_VIRTUAL_LIST_DEBUG === 'true' ||
185
+ process?.env?.SVELTE_VIRTUAL_LIST_DEBUG === 'true')
186
+ )
183
187
  /**
184
188
  * Core configuration props with default values
185
189
  * @type {SvelteVirtualListProps<TItem>}
@@ -533,7 +537,7 @@
533
537
  function updateDebugTailDistance() {
534
538
  if (!heightManager.viewportElement) return
535
539
  const last = heightManager.viewport.querySelector(
536
- '[data-original-index="999"]'
540
+ `[data-original-index="${items.length - 1}"]`
537
541
  ) as HTMLElement | null
538
542
  if (!last) return
539
543
  const v = heightManager.viewport.getBoundingClientRect()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanspeak/svelte-virtual-list",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "A lightweight, high-performance virtual list component for Svelte 5 that renders large datasets with minimal memory usage. Features include dynamic height support, smooth scrolling, TypeScript support, and efficient DOM recycling. Ideal for infinite scrolling lists, data tables, chat interfaces, and any application requiring the rendering of thousands of items without compromising performance. Zero dependencies and fully customizable.",
5
5
  "keywords": [
6
6
  "svelte",
@@ -46,6 +46,10 @@
46
46
  "!dist/**/*.spec.*",
47
47
  "!dist/test/**/*"
48
48
  ],
49
+ "workspaces": [
50
+ ".",
51
+ "docs"
52
+ ],
49
53
  "overrides": {
50
54
  "@sveltejs/kit": {
51
55
  "cookie": "^0.7.0"
@@ -55,43 +59,44 @@
55
59
  "esm-env": "^1.2.2"
56
60
  },
57
61
  "devDependencies": {
58
- "@eslint/compat": "^1.3.2",
59
- "@eslint/js": "^9.34.0",
60
- "@faker-js/faker": "^9.9.0",
61
- "@playwright/test": "^1.55.0",
62
+ "@eslint/compat": "^1.4.0",
63
+ "@eslint/js": "^9.36.0",
64
+ "@faker-js/faker": "^10.0.0",
65
+ "@playwright/test": "^1.55.1",
62
66
  "@sveltejs/adapter-auto": "^6.1.0",
63
- "@sveltejs/kit": "^2.36.2",
64
- "@sveltejs/package": "^2.5.0",
65
- "@sveltejs/vite-plugin-svelte": "^6.1.3",
66
- "@tailwindcss/vite": "^4.1.12",
67
+ "@sveltejs/kit": "^2.43.4",
68
+ "@sveltejs/package": "^2.5.4",
69
+ "@sveltejs/vite-plugin-svelte": "^6.2.1",
70
+ "@tailwindcss/vite": "^4.1.13",
67
71
  "@testing-library/jest-dom": "^6.8.0",
68
72
  "@testing-library/svelte": "^5.2.8",
69
73
  "@testing-library/user-event": "^14.6.1",
70
- "@types/node": "^24.3.0",
71
- "@typescript-eslint/eslint-plugin": "^8.40.0",
72
- "@typescript-eslint/parser": "^8.40.0",
74
+ "@types/node": "^24.5.2",
75
+ "@typescript-eslint/eslint-plugin": "^8.44.1",
76
+ "@typescript-eslint/parser": "^8.44.1",
73
77
  "@vitest/coverage-v8": "^3.2.4",
74
- "eslint": "^9.34.0",
78
+ "concurrently": "^9.2.1",
79
+ "eslint": "^9.36.0",
75
80
  "eslint-config-prettier": "^10.1.8",
76
81
  "eslint-plugin-import": "^2.32.0",
77
- "eslint-plugin-svelte": "^3.11.0",
82
+ "eslint-plugin-svelte": "^3.12.4",
78
83
  "eslint-plugin-unused-imports": "^4.2.0",
79
- "globals": "^16.3.0",
84
+ "globals": "^16.4.0",
80
85
  "husky": "^9.1.7",
81
- "jsdom": "^26.1.0",
86
+ "jsdom": "^27.0.0",
82
87
  "prettier": "^3.6.2",
83
- "prettier-plugin-organize-imports": "^4.2.0",
88
+ "prettier-plugin-organize-imports": "^4.3.0",
84
89
  "prettier-plugin-sort-json": "^4.1.1",
85
90
  "prettier-plugin-svelte": "^3.4.0",
86
91
  "prettier-plugin-tailwindcss": "^0.6.14",
87
- "publint": "^0.3.12",
88
- "svelte": "^5.38.2",
89
- "svelte-check": "^4.3.1",
90
- "tailwindcss": "^4.1.12",
91
- "tw-animate-css": "^1.3.7",
92
+ "publint": "^0.3.13",
93
+ "svelte": "^5.39.6",
94
+ "svelte-check": "^4.3.2",
95
+ "tailwindcss": "^4.1.13",
96
+ "tw-animate-css": "^1.4.0",
92
97
  "typescript": "^5.9.2",
93
- "typescript-eslint": "^8.40.0",
94
- "vite": "^7.1.3",
98
+ "typescript-eslint": "^8.44.1",
99
+ "vite": "^7.1.7",
95
100
  "vitest": "^3.2.4"
96
101
  },
97
102
  "peerDependencies": {
@@ -118,6 +123,8 @@
118
123
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
119
124
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
120
125
  "dev": "vite dev",
126
+ "dev:all": "concurrently -k -n pkg,docs -c green,cyan \"pnpm -w -r --filter @humanspeak/svelte-virtual-list run dev:pkg\" \"pnpm --filter docs run dev\"",
127
+ "dev:pkg": "svelte-kit sync && svelte-package --watch",
121
128
  "format": "prettier --write .",
122
129
  "lint": "prettier --check . && eslint .",
123
130
  "lint:fix": "pnpm run format && eslint . --fix",