mtrl-addons 0.1.1 → 0.2.1

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.
Files changed (115) hide show
  1. package/build.js +139 -108
  2. package/package.json +13 -4
  3. package/scripts/debug/vlist-selection.ts +121 -0
  4. package/src/components/index.ts +5 -41
  5. package/src/components/{list → vlist}/config.ts +66 -95
  6. package/src/components/vlist/constants.ts +23 -0
  7. package/src/components/vlist/features/api.ts +322 -0
  8. package/src/components/vlist/features/index.ts +10 -0
  9. package/src/components/vlist/features/selection.ts +444 -0
  10. package/src/components/vlist/features/viewport.ts +65 -0
  11. package/src/components/vlist/index.ts +16 -0
  12. package/src/components/{list → vlist}/types.ts +104 -26
  13. package/src/components/vlist/vlist.ts +92 -0
  14. package/src/core/compose/features/gestures/index.ts +227 -0
  15. package/src/core/compose/features/gestures/longpress.ts +383 -0
  16. package/src/core/compose/features/gestures/pan.ts +424 -0
  17. package/src/core/compose/features/gestures/pinch.ts +475 -0
  18. package/src/core/compose/features/gestures/rotate.ts +485 -0
  19. package/src/core/compose/features/gestures/swipe.ts +492 -0
  20. package/src/core/compose/features/gestures/tap.ts +334 -0
  21. package/src/core/compose/features/index.ts +2 -38
  22. package/src/core/compose/index.ts +13 -29
  23. package/src/core/gestures/index.ts +31 -0
  24. package/src/core/gestures/longpress.ts +68 -0
  25. package/src/core/gestures/manager.ts +418 -0
  26. package/src/core/gestures/pan.ts +48 -0
  27. package/src/core/gestures/pinch.ts +58 -0
  28. package/src/core/gestures/rotate.ts +58 -0
  29. package/src/core/gestures/swipe.ts +66 -0
  30. package/src/core/gestures/tap.ts +45 -0
  31. package/src/core/gestures/types.ts +387 -0
  32. package/src/core/gestures/utils.ts +128 -0
  33. package/src/core/index.ts +27 -151
  34. package/src/core/layout/schema.ts +73 -35
  35. package/src/core/layout/types.ts +5 -2
  36. package/src/core/viewport/constants.ts +140 -0
  37. package/src/core/viewport/features/base.ts +73 -0
  38. package/src/core/viewport/features/collection.ts +882 -0
  39. package/src/core/viewport/features/events.ts +130 -0
  40. package/src/core/viewport/features/index.ts +20 -0
  41. package/src/core/{list-manager/features/viewport → viewport/features}/item-size.ts +27 -30
  42. package/src/core/{list-manager/features/viewport → viewport/features}/loading.ts +4 -4
  43. package/src/core/viewport/features/momentum.ts +260 -0
  44. package/src/core/viewport/features/placeholders.ts +335 -0
  45. package/src/core/viewport/features/rendering.ts +568 -0
  46. package/src/core/viewport/features/scrollbar.ts +434 -0
  47. package/src/core/viewport/features/scrolling.ts +618 -0
  48. package/src/core/viewport/features/utils.ts +88 -0
  49. package/src/core/viewport/features/virtual.ts +384 -0
  50. package/src/core/viewport/index.ts +31 -0
  51. package/src/core/viewport/types.ts +133 -0
  52. package/src/core/viewport/utils/speed-tracker.ts +79 -0
  53. package/src/core/viewport/viewport.ts +246 -0
  54. package/src/index.ts +0 -7
  55. package/src/styles/components/_vlist.scss +331 -0
  56. package/src/styles/index.scss +1 -1
  57. package/test/components/vlist-selection.test.ts +240 -0
  58. package/test/components/vlist.test.ts +63 -0
  59. package/test/core/collection/adapter.test.ts +161 -0
  60. package/bun.lock +0 -792
  61. package/src/components/list/api.ts +0 -314
  62. package/src/components/list/constants.ts +0 -56
  63. package/src/components/list/features/api.ts +0 -428
  64. package/src/components/list/features/index.ts +0 -31
  65. package/src/components/list/features/list-manager.ts +0 -502
  66. package/src/components/list/index.ts +0 -39
  67. package/src/components/list/list.ts +0 -234
  68. package/src/core/collection/base-collection.ts +0 -100
  69. package/src/core/collection/collection-composer.ts +0 -178
  70. package/src/core/collection/collection.ts +0 -745
  71. package/src/core/collection/constants.ts +0 -172
  72. package/src/core/collection/events.ts +0 -428
  73. package/src/core/collection/features/api/loading.ts +0 -279
  74. package/src/core/collection/features/operations/data-operations.ts +0 -147
  75. package/src/core/collection/index.ts +0 -104
  76. package/src/core/collection/state.ts +0 -497
  77. package/src/core/collection/types.ts +0 -404
  78. package/src/core/compose/features/collection.ts +0 -119
  79. package/src/core/compose/features/selection.ts +0 -213
  80. package/src/core/compose/features/styling.ts +0 -108
  81. package/src/core/list-manager/api.ts +0 -599
  82. package/src/core/list-manager/config.ts +0 -593
  83. package/src/core/list-manager/constants.ts +0 -268
  84. package/src/core/list-manager/features/api.ts +0 -58
  85. package/src/core/list-manager/features/collection/collection.ts +0 -705
  86. package/src/core/list-manager/features/collection/index.ts +0 -17
  87. package/src/core/list-manager/features/viewport/constants.ts +0 -42
  88. package/src/core/list-manager/features/viewport/index.ts +0 -16
  89. package/src/core/list-manager/features/viewport/placeholders.ts +0 -281
  90. package/src/core/list-manager/features/viewport/rendering.ts +0 -575
  91. package/src/core/list-manager/features/viewport/scrollbar.ts +0 -495
  92. package/src/core/list-manager/features/viewport/scrolling.ts +0 -795
  93. package/src/core/list-manager/features/viewport/template.ts +0 -220
  94. package/src/core/list-manager/features/viewport/viewport.ts +0 -654
  95. package/src/core/list-manager/features/viewport/virtual.ts +0 -309
  96. package/src/core/list-manager/index.ts +0 -279
  97. package/src/core/list-manager/list-manager.ts +0 -206
  98. package/src/core/list-manager/types.ts +0 -439
  99. package/src/core/list-manager/utils/calculations.ts +0 -290
  100. package/src/core/list-manager/utils/range-calculator.ts +0 -349
  101. package/src/core/list-manager/utils/speed-tracker.ts +0 -273
  102. package/src/styles/components/_list.scss +0 -244
  103. package/src/types/mtrl.d.ts +0 -6
  104. package/test/components/list.test.ts +0 -256
  105. package/test/core/collection/failed-ranges.test.ts +0 -270
  106. package/test/core/compose/features.test.ts +0 -183
  107. package/test/core/list-manager/features/collection.test.ts +0 -704
  108. package/test/core/list-manager/features/viewport.test.ts +0 -698
  109. package/test/core/list-manager/list-manager.test.ts +0 -593
  110. package/test/core/list-manager/utils/calculations.test.ts +0 -433
  111. package/test/core/list-manager/utils/range-calculator.test.ts +0 -569
  112. package/test/core/list-manager/utils/speed-tracker.test.ts +0 -530
  113. package/tsconfig.build.json +0 -14
  114. /package/src/components/{list → vlist}/features.ts +0 -0
  115. /package/src/core/{compose → viewport}/features/performance.ts +0 -0
package/build.js CHANGED
@@ -1,170 +1,201 @@
1
1
  // build.js
2
- import { mkdir } from "fs/promises";
3
- import { existsSync } from "fs";
4
- import { join, dirname } from "path";
5
- import { fileURLToPath } from "url";
2
+ import { mkdir } from 'fs/promises'
3
+ import { existsSync } from 'fs'
4
+ import { join, dirname } from 'path'
5
+ import { fileURLToPath } from 'url'
6
6
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const isWatch = process.argv.includes("--watch");
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+ const isWatch = process.argv.includes('--watch')
9
9
  const isProduction =
10
- process.argv.includes("--production") ||
11
- process.env.NODE_ENV === "production";
10
+ process.argv.includes('--production') ||
11
+ process.env.NODE_ENV === 'production'
12
12
 
13
13
  // Define consistent output paths
14
- const DIST_DIR = join(__dirname, "dist");
15
- const JS_OUTPUT = join(DIST_DIR, "index.js");
16
- const MJS_OUTPUT = join(DIST_DIR, "index.mjs");
14
+ const DIST_DIR = join(__dirname, 'dist')
15
+ const JS_OUTPUT = join(DIST_DIR, 'index.js')
16
+ const MJS_OUTPUT = join(DIST_DIR, 'index.mjs')
17
17
 
18
18
  // Log build mode
19
- console.log(`Building in ${isProduction ? "PRODUCTION" : "DEVELOPMENT"} mode`);
19
+ console.log(`Building in ${isProduction ? 'PRODUCTION' : 'DEVELOPMENT'} mode`)
20
20
 
21
21
  const buildApp = async () => {
22
22
  try {
23
- console.log("┌─────────────────────────────────────────");
24
- console.log("│ JavaScript Build");
25
- console.log("│ Mode:", isProduction ? "PRODUCTION" : "DEVELOPMENT");
26
- console.log("│ Minify:", isProduction ? "Yes" : "No");
27
- console.log("│ Sourcemaps:", isProduction ? "No" : "Yes (inline)");
28
- console.log("└─────────────────────────────────────────");
23
+ console.log('┌─────────────────────────────────────────')
24
+ console.log('│ JavaScript Build')
25
+ console.log('│ Mode:', isProduction ? 'PRODUCTION' : 'DEVELOPMENT')
26
+ console.log('│ Minify:', isProduction ? 'Yes' : 'No')
27
+ console.log('│ Sourcemaps:', isProduction ? 'No' : 'Yes (inline)')
28
+ console.log('└─────────────────────────────────────────')
29
29
 
30
30
  // Create dist directory if it doesn't exist
31
- await mkdir(DIST_DIR, { recursive: true });
31
+ await mkdir(DIST_DIR, { recursive: true })
32
32
 
33
33
  // Build CJS version
34
34
  const cjsResult = await Bun.build({
35
- entrypoints: [join(__dirname, "src/index.ts")],
35
+ entrypoints: [join(__dirname, 'src/index.ts')],
36
36
  outdir: DIST_DIR,
37
37
  minify: isProduction,
38
- sourcemap: isProduction ? "none" : "inline",
39
- format: "cjs",
40
- target: "node",
41
- external: ["mtrl"],
42
- });
38
+ sourcemap: isProduction ? 'none' : 'inline',
39
+ format: 'cjs',
40
+ target: 'node',
41
+ external: ['mtrl']
42
+ })
43
43
 
44
44
  // Build ESM version
45
45
  const esmResult = await Bun.build({
46
- entrypoints: [join(__dirname, "src/index.ts")],
46
+ entrypoints: [join(__dirname, 'src/index.ts')],
47
47
  outdir: DIST_DIR,
48
48
  minify: isProduction,
49
- sourcemap: isProduction ? "none" : "inline",
50
- format: "esm",
51
- target: "node",
49
+ sourcemap: isProduction ? 'none' : 'inline',
50
+ format: 'esm',
51
+ target: 'node',
52
52
  naming: {
53
- entry: "index.mjs",
53
+ entry: 'index.mjs'
54
54
  },
55
- external: ["mtrl"],
56
- });
55
+ external: ['mtrl']
56
+ })
57
57
 
58
58
  if (!cjsResult.success || !esmResult.success) {
59
- console.error("❌ JavaScript build failed");
60
- console.error(cjsResult.logs);
61
- console.error(esmResult.logs);
62
- return false;
59
+ console.error('❌ JavaScript build failed')
60
+ console.error(cjsResult.logs)
61
+ console.error(esmResult.logs)
62
+ return false
63
63
  }
64
64
 
65
- console.log("✓ JavaScript build successful");
65
+ console.log('✓ JavaScript build successful')
66
66
  console.log(
67
67
  ` CJS bundle: ${((await Bun.file(JS_OUTPUT).size) / 1024).toFixed(2)} KB`
68
- );
68
+ )
69
69
  console.log(
70
70
  ` ESM bundle: ${((await Bun.file(MJS_OUTPUT).size) / 1024).toFixed(
71
71
  2
72
72
  )} KB`
73
- );
74
-
75
- // Generate type definitions
76
- console.log("Generating TypeScript declarations...");
77
- const tscProcess = Bun.spawn(["tsc", "--project", "tsconfig.build.json"], {
78
- cwd: __dirname,
79
- stdout: "pipe",
80
- stderr: "pipe",
81
- });
82
-
83
- const [stdout, stderr] = await Promise.all([
84
- new Response(tscProcess.stdout).text(),
85
- new Response(tscProcess.stderr).text(),
86
- ]);
87
-
88
- const tscExitCode = await tscProcess.exited;
89
-
90
- if (stderr && stderr.includes("error TS")) {
91
- console.warn(
92
- "⚠️ TypeScript warnings/errors (declarations may still be generated):"
93
- );
94
- console.warn(stderr);
95
- }
73
+ )
74
+
75
+ // Generate type definitions with better error handling
76
+ console.log('Generating TypeScript declarations...')
77
+
78
+ try {
79
+ const tscProcess = Bun.spawn(
80
+ ['tsc', '--emitDeclarationOnly', '--outDir', DIST_DIR],
81
+ {
82
+ cwd: __dirname,
83
+ stdio: ['inherit', 'pipe', 'pipe']
84
+ }
85
+ )
86
+
87
+ // Capture stdout and stderr
88
+ const stdout = await new Response(tscProcess.stdout).text()
89
+ const stderr = await new Response(tscProcess.stderr).text()
90
+
91
+ const tscExitCode = await tscProcess.exited
92
+
93
+ if (tscExitCode !== 0) {
94
+ console.error('❌ TypeScript declaration generation failed')
95
+ console.error('Exit code:', tscExitCode)
96
+ if (stdout.trim()) {
97
+ console.error('STDOUT:', stdout)
98
+ }
99
+ if (stderr.trim()) {
100
+ console.error('STDERR:', stderr)
101
+ }
102
+
103
+ // Check if tsc is available
104
+ const whichResult = Bun.spawn(['which', 'tsc'], { stdio: ['inherit', 'pipe', 'pipe'] })
105
+ const tscPath = await new Response(whichResult.stdout).text()
106
+ if (!tscPath.trim()) {
107
+ console.error('💡 TypeScript compiler (tsc) not found. Install it with:')
108
+ console.error(' npm install -g typescript')
109
+ console.error(' or')
110
+ console.error(' bun add -g typescript')
111
+ }
112
+
113
+ return false
114
+ }
96
115
 
97
- // Check if declaration files were actually generated
98
- const declarationFiles = [
99
- join(DIST_DIR, "index.d.ts"),
100
- join(DIST_DIR, "components/index.d.ts"),
101
- join(DIST_DIR, "core/index.d.ts"),
102
- ];
103
-
104
- const declarationsGenerated = declarationFiles.some((file) =>
105
- existsSync(file)
106
- );
107
-
108
- if (!declarationsGenerated) {
109
- console.error(
110
- "❌ TypeScript declaration generation failed - no declaration files created"
111
- );
112
- return false;
113
- }
116
+ console.log('✓ TypeScript declarations generated')
117
+ if (stdout.trim()) {
118
+ console.log('TSC output:', stdout)
119
+ }
114
120
 
115
- console.log("✓ TypeScript declarations generated");
116
- return true;
121
+ return true
122
+ } catch (tscError) {
123
+ console.error('❌ Error running TypeScript compiler:', tscError.message)
124
+
125
+ // Check if TypeScript is installed
126
+ try {
127
+ const checkTsc = Bun.spawn(['tsc', '--version'], { stdio: ['inherit', 'pipe', 'pipe'] })
128
+ const versionOutput = await new Response(checkTsc.stdout).text()
129
+ const versionExitCode = await checkTsc.exited
130
+
131
+ if (versionExitCode === 0) {
132
+ console.log('TypeScript version:', versionOutput.trim())
133
+ } else {
134
+ console.error('💡 TypeScript compiler not properly installed. Install with:')
135
+ console.error(' npm install -g typescript')
136
+ console.error(' or')
137
+ console.error(' bun add -g typescript')
138
+ }
139
+ } catch (versionError) {
140
+ console.error('💡 TypeScript compiler not found. Install it with:')
141
+ console.error(' npm install -g typescript')
142
+ console.error(' or')
143
+ console.error(' bun add -g typescript')
144
+ }
145
+
146
+ return false
147
+ }
117
148
  } catch (error) {
118
- console.error("❌ JavaScript build error:", error);
119
- console.error(error.stack);
120
- return false;
149
+ console.error('❌ JavaScript build error:', error)
150
+ console.error(error.stack)
151
+ return false
121
152
  }
122
- };
153
+ }
123
154
 
124
155
  const build = async () => {
125
156
  try {
126
- const startTime = Date.now();
157
+ const startTime = Date.now()
127
158
 
128
- console.log("┌───────────────────────────────────────────────");
129
- console.log("│ 🚀 MTRL-Addons Build Process");
130
- console.log("│ Mode:", isProduction ? "🏭 PRODUCTION" : "🔧 DEVELOPMENT");
131
- console.log("│ Watch:", isWatch ? "✓ Enabled" : "✗ Disabled");
132
- console.log("└───────────────────────────────────────────────");
133
- console.log("");
159
+ console.log('┌───────────────────────────────────────────────')
160
+ console.log('│ 🚀 MTRL-Addons Build Process')
161
+ console.log('│ Mode:', isProduction ? '🏭 PRODUCTION' : '🔧 DEVELOPMENT')
162
+ console.log('│ Watch:', isWatch ? '✓ Enabled' : '✗ Disabled')
163
+ console.log('└───────────────────────────────────────────────')
164
+ console.log('')
134
165
 
135
166
  // Create output directory
136
- await mkdir(DIST_DIR, { recursive: true });
167
+ await mkdir(DIST_DIR, { recursive: true })
137
168
 
138
169
  // Build JavaScript
139
- const jsSuccess = await buildApp();
170
+ const jsSuccess = await buildApp()
140
171
 
141
- const buildTime = ((Date.now() - startTime) / 1000).toFixed(2);
172
+ const buildTime = ((Date.now() - startTime) / 1000).toFixed(2)
142
173
 
143
174
  if (isWatch && !isProduction) {
144
- console.log("");
145
- console.log("┌───────────────────────────────────────────────");
146
- console.log("│ 👀 Watching for changes...");
147
- console.log("└───────────────────────────────────────────────");
175
+ console.log('')
176
+ console.log('┌───────────────────────────────────────────────')
177
+ console.log('│ 👀 Watching for changes...')
178
+ console.log('└───────────────────────────────────────────────')
148
179
 
149
180
  // Watch implementation would go here
150
181
  } else {
151
- console.log("");
152
- console.log("┌───────────────────────────────────────────────");
153
- console.log(`│ ✅ Build completed in ${buildTime}s`);
182
+ console.log('')
183
+ console.log('┌───────────────────────────────────────────────')
184
+ console.log(`│ ✅ Build completed in ${buildTime}s`)
154
185
  if (!jsSuccess) {
155
- console.log("│ ⚠️ Build completed with some errors");
186
+ console.log('│ ⚠️ Build completed with some errors')
156
187
  }
157
- console.log("└───────────────────────────────────────────────");
188
+ console.log('└───────────────────────────────────────────────')
158
189
 
159
190
  // Only exit with error code in non-watch mode if there were failures
160
191
  if (!isWatch && !jsSuccess) {
161
- process.exit(1);
192
+ process.exit(1)
162
193
  }
163
194
  }
164
195
  } catch (error) {
165
- console.error("❌ Build failed with error:", error);
166
- process.exit(1);
196
+ console.error('❌ Build failed with error:', error)
197
+ process.exit(1)
167
198
  }
168
- };
199
+ }
169
200
 
170
- build();
201
+ build()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtrl-addons",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Additional components and utilities for the mtrl system, featuring forms, specialized elements, and extended functionality for modern applications",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -10,8 +10,15 @@
10
10
  "dev": "bun run ./build.js --watch",
11
11
  "test": "bun test",
12
12
  "prepublishOnly": "bun run build",
13
- "debug:list": "bun run ../mtrl-app/scripts/debug/list-addons.ts",
14
- "debug:list:interactive": "bun run ../mtrl-app/scripts/debug/list-addons.ts --interactive"
13
+ "server:start": "pm2 start ../mtrl-app/ecosystem.config.js",
14
+ "server:stop": "pm2 stop mtrl-app",
15
+ "server:reload": "pm2 restart mtrl-app",
16
+ "server:logs": "pm2 logs mtrl-app",
17
+ "link:mtrl": "rm -rf node_modules/mtrl && ln -sf ../../mtrl node_modules/mtrl",
18
+ "debug:vlist": "bun run ../mtrl-app/scripts/debug/vlist examples/vlist",
19
+ "debug:vlist:interactive": "bun run ../mtrl-app/scripts/debug/vlist examples/vlist --interactive",
20
+ "debug:vlist-cursor": "bun run ../mtrl-app/scripts/debug/vlist examples/vlist-cursor",
21
+ "debug:vlist-cursor:interactive": "bun run ../mtrl-app/scripts/debug/vlist examples/vlist-cursor --interactive"
15
22
  },
16
23
  "repository": {
17
24
  "type": "git",
@@ -27,11 +34,13 @@
27
34
  "author": "floor",
28
35
  "license": "MIT",
29
36
  "peerDependencies": {
30
- "mtrl": "^0.2.8"
37
+ "mtrl": "^0.5.1"
31
38
  },
32
39
  "devDependencies": {
40
+ "@types/jsdom": "^21.1.7",
33
41
  "@types/node": "^20.0.0",
34
42
  "bun-types": "^1.0.0",
43
+ "jsdom": "^26.1.0",
35
44
  "madge": "^8.0.0",
36
45
  "mtrl": "^0.2.8",
37
46
  "standard": "^17.0.0",
@@ -0,0 +1,121 @@
1
+ // scripts/debug/vlist-selection.ts
2
+
3
+ import puppeteer from "puppeteer";
4
+
5
+ async function testVListSelection() {
6
+ console.log("🎯 Testing VList Selection Feature");
7
+
8
+ const browser = await puppeteer.launch({
9
+ headless: false,
10
+ devtools: true,
11
+ args: ["--no-sandbox", "--disable-setuid-sandbox"],
12
+ });
13
+
14
+ const page = await browser.newPage();
15
+
16
+ // Listen to console logs
17
+ page.on("console", (msg) => {
18
+ const text = msg.text();
19
+ if (text.includes("[Selection]") || text.includes("selection")) {
20
+ console.log(`💬 [${msg.type().toUpperCase()}] ${text}`);
21
+ }
22
+ });
23
+
24
+ await page.goto("http://localhost:4000/examples/vlist-addons");
25
+
26
+ // Wait for list to load
27
+ await page.waitForSelector(".mtrl-viewport-item", { timeout: 5000 });
28
+
29
+ console.log("📋 Page loaded, looking for list items...");
30
+
31
+ // Get info about items
32
+ const itemInfo = await page.evaluate(() => {
33
+ const items = document.querySelectorAll(".mtrl-viewport-item");
34
+ const firstItem = items[0];
35
+ const listItem = firstItem?.querySelector(".list-item, .user-item");
36
+
37
+ return {
38
+ viewportItemCount: items.length,
39
+ firstViewportItemClasses: firstItem?.className,
40
+ firstViewportItemDataIndex: firstItem?.getAttribute("data-index"),
41
+ firstListItemClasses: listItem?.className,
42
+ firstListItemDataId: listItem?.getAttribute("data-id"),
43
+ hasClickHandler: !!(window as any).listExample?.userList,
44
+ };
45
+ });
46
+
47
+ console.log("📊 Item info:", itemInfo);
48
+
49
+ // Click on the first item
50
+ console.log("🖱️ Clicking on first item...");
51
+ await page.click(".mtrl-viewport-item:first-child");
52
+
53
+ // Wait a bit for selection to process
54
+ await page.waitForTimeout(500);
55
+
56
+ // Check if selection class was applied
57
+ const selectionInfo = await page.evaluate(() => {
58
+ const firstItem = document.querySelector(".mtrl-viewport-item:first-child");
59
+ const listItem = firstItem?.querySelector(".list-item, .user-item");
60
+ const selectedItems = document.querySelectorAll(
61
+ ".mtrl-list-item--selected"
62
+ );
63
+
64
+ return {
65
+ hasSelectionClass: listItem?.classList.contains(
66
+ "mtrl-list-item--selected"
67
+ ),
68
+ listItemClasses: listItem?.className,
69
+ selectedCount: selectedItems.length,
70
+ userListExists: !!(window as any).listExample?.userList,
71
+ hasSelectItems:
72
+ typeof (window as any).listExample?.userList?.selectItems ===
73
+ "function",
74
+ hasGetSelectedItems:
75
+ typeof (window as any).listExample?.userList?.getSelectedItems ===
76
+ "function",
77
+ };
78
+ });
79
+
80
+ console.log("✅ Selection info after click:", selectionInfo);
81
+
82
+ // Try programmatic selection
83
+ console.log("🔧 Testing programmatic selection...");
84
+ const programmaticResult = await page.evaluate(() => {
85
+ const userList = (window as any).listExample?.userList;
86
+ if (userList && userList.selectItems) {
87
+ userList.selectItems([0, 1, 2]);
88
+ const selected = userList.getSelectedItems
89
+ ? userList.getSelectedItems()
90
+ : [];
91
+ return {
92
+ success: true,
93
+ selectedCount: selected.length,
94
+ selectedIds: selected.map((item: any) => item.id),
95
+ };
96
+ }
97
+ return { success: false, reason: "No selectItems method" };
98
+ });
99
+
100
+ console.log("📊 Programmatic selection result:", programmaticResult);
101
+
102
+ // Final check
103
+ await page.waitForTimeout(500);
104
+ const finalState = await page.evaluate(() => {
105
+ const selectedElements = document.querySelectorAll(
106
+ ".mtrl-list-item--selected"
107
+ );
108
+ return {
109
+ selectedElementCount: selectedElements.length,
110
+ selectedClasses: Array.from(selectedElements).map((el) => el.className),
111
+ };
112
+ });
113
+
114
+ console.log("🎯 Final selection state:", finalState);
115
+
116
+ // Keep browser open for inspection
117
+ console.log("✨ Test complete. Browser will stay open for inspection.");
118
+ console.log("Press Ctrl+C to exit.");
119
+ }
120
+
121
+ testVListSelection().catch(console.error);
@@ -1,45 +1,9 @@
1
1
  /**
2
- * mtrl-addons Components
2
+ * Components Module Exports
3
3
  *
4
- * Exports all component modules
4
+ * Central export point for all components
5
5
  */
6
6
 
7
- // Export the existing list component
8
- export { createList } from "./list";
9
-
10
- // Export list types and utilities
11
- export type {
12
- ListConfig,
13
- ListComponent,
14
- ListAPI,
15
- ListState,
16
- ListEvents,
17
- ListItemTemplate,
18
- ListScrollConfig,
19
- ListSelectionConfig,
20
- ListEventHandlers,
21
- ListItemContext,
22
- } from "./list";
23
-
24
- // List configuration utilities
25
- export {
26
- createBaseConfig,
27
- getElementConfig,
28
- getApiConfig,
29
- getCollectionConfig,
30
- getListManagerConfig,
31
- validateConfig,
32
- } from "./list";
33
-
34
- // List features
35
- export { withListManager } from "./list/features/list-manager";
36
- export { withAPI } from "./list/api";
37
-
38
- // Components will be exported here as they're added
39
- // For example:
40
- // export { VirtualList } from './virtual-list';
41
- // export { DataTable } from './data-table';
42
- // export { InfiniteScroll } from './infinite-scroll';
43
-
44
- // Currently no other components - this is the foundation for future components
45
- export const componentsVersion = "0.1.0";
7
+ // VList component (virtual list with viewport)
8
+ export { createVList } from "./vlist";
9
+ export type { VListConfig, VListComponent } from "./vlist/types";