@useavalon/avalon 0.1.10 → 0.1.12

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 (250) hide show
  1. package/README.md +54 -54
  2. package/dist/mod.js +1 -0
  3. package/dist/src/build/integration-bundler-plugin.js +1 -0
  4. package/dist/src/build/integration-config.js +1 -0
  5. package/dist/src/build/integration-detection-plugin.js +1 -0
  6. package/dist/src/build/integration-resolver-plugin.js +1 -0
  7. package/dist/src/build/island-manifest.js +1 -0
  8. package/dist/src/build/island-types-generator.js +5 -0
  9. package/dist/src/build/mdx-island-transform.js +2 -0
  10. package/dist/src/build/mdx-plugin.js +1 -0
  11. package/dist/src/build/page-island-transform.js +3 -0
  12. package/dist/src/build/prop-extractors/index.js +1 -0
  13. package/dist/src/build/prop-extractors/lit.js +1 -0
  14. package/dist/src/build/prop-extractors/qwik.js +1 -0
  15. package/dist/src/build/prop-extractors/solid.js +1 -0
  16. package/dist/src/build/prop-extractors/svelte.js +1 -0
  17. package/dist/src/build/prop-extractors/vue.js +1 -0
  18. package/dist/src/build/sidecar-file-manager.js +1 -0
  19. package/dist/src/build/sidecar-renderer.js +6 -0
  20. package/dist/src/client/adapters/index.js +1 -0
  21. package/dist/src/client/components.js +1 -0
  22. package/dist/src/client/css-hmr-handler.js +1 -0
  23. package/dist/src/client/framework-adapter.js +13 -0
  24. package/dist/src/client/hmr-coordinator.js +1 -0
  25. package/dist/src/client/hmr-error-overlay.js +214 -0
  26. package/dist/src/client/main.js +39 -0
  27. package/{src → dist/src}/client/types/framework-runtime.d.ts +68 -68
  28. package/{src → dist/src}/client/types/vite-hmr.d.ts +46 -46
  29. package/dist/src/client/types/vite-virtual-modules.d.ts +70 -0
  30. package/dist/src/components/Image.js +1 -0
  31. package/dist/src/components/IslandErrorBoundary.js +1 -0
  32. package/dist/src/components/LayoutDataErrorBoundary.js +1 -0
  33. package/dist/src/components/LayoutErrorBoundary.js +1 -0
  34. package/dist/src/components/PersistentIsland.js +1 -0
  35. package/dist/src/components/StreamingErrorBoundary.js +1 -0
  36. package/dist/src/components/StreamingLayout.js +29 -0
  37. package/dist/src/core/components/component-analyzer.js +1 -0
  38. package/dist/src/core/components/component-detection.js +5 -0
  39. package/dist/src/core/components/enhanced-framework-detector.js +1 -0
  40. package/dist/src/core/components/framework-registry.js +1 -0
  41. package/dist/src/core/content/mdx-processor.js +1 -0
  42. package/dist/src/core/integrations/index.js +1 -0
  43. package/dist/src/core/integrations/loader.js +1 -0
  44. package/dist/src/core/integrations/registry.js +1 -0
  45. package/dist/src/core/islands/island-persistence.js +1 -0
  46. package/dist/src/core/islands/island-state-serializer.js +1 -0
  47. package/dist/src/core/islands/persistent-island-context.js +1 -0
  48. package/dist/src/core/islands/use-persistent-state.js +1 -0
  49. package/dist/src/core/layout/enhanced-layout-resolver.js +1 -0
  50. package/dist/src/core/layout/layout-cache-manager.js +1 -0
  51. package/dist/src/core/layout/layout-composer.js +1 -0
  52. package/dist/src/core/layout/layout-data-loader.js +1 -0
  53. package/dist/src/core/layout/layout-discovery.js +1 -0
  54. package/dist/src/core/layout/layout-matcher.js +1 -0
  55. package/dist/src/core/layout/layout-types.js +1 -0
  56. package/dist/src/core/modules/framework-module-resolver.js +1 -0
  57. package/dist/src/islands/component-analysis.js +1 -0
  58. package/dist/src/islands/css-utils.js +17 -0
  59. package/dist/src/islands/discovery/index.js +1 -0
  60. package/dist/src/islands/discovery/registry.js +1 -0
  61. package/dist/src/islands/discovery/resolver.js +2 -0
  62. package/dist/src/islands/discovery/scanner.js +1 -0
  63. package/dist/src/islands/discovery/types.js +1 -0
  64. package/dist/src/islands/discovery/validator.js +18 -0
  65. package/dist/src/islands/discovery/watcher.js +1 -0
  66. package/dist/src/islands/framework-detection.js +1 -0
  67. package/dist/src/islands/integration-loader.js +1 -0
  68. package/dist/src/islands/island.js +1 -0
  69. package/dist/src/islands/render-cache.js +1 -0
  70. package/dist/src/islands/types.js +1 -0
  71. package/dist/src/islands/universal-css-collector.js +5 -0
  72. package/dist/src/islands/universal-head-collector.js +2 -0
  73. package/{src → dist/src}/layout-system.d.ts +592 -592
  74. package/dist/src/layout-system.js +1 -0
  75. package/dist/src/middleware/discovery.js +1 -0
  76. package/dist/src/middleware/executor.js +1 -0
  77. package/dist/src/middleware/index.js +1 -0
  78. package/dist/src/middleware/types.js +1 -0
  79. package/dist/src/nitro/build-config.js +1 -0
  80. package/dist/src/nitro/config.js +1 -0
  81. package/dist/src/nitro/error-handler.js +198 -0
  82. package/dist/src/nitro/index.js +1 -0
  83. package/dist/src/nitro/island-manifest.js +2 -0
  84. package/dist/src/nitro/middleware-adapter.js +1 -0
  85. package/dist/src/nitro/renderer.js +183 -0
  86. package/dist/src/nitro/route-discovery.js +1 -0
  87. package/dist/src/nitro/types.js +1 -0
  88. package/dist/src/render/collect-css.js +3 -0
  89. package/{src/render/error-pages.ts → dist/src/render/error-pages.js} +7 -38
  90. package/dist/src/render/isolated-ssr-renderer.js +1 -0
  91. package/dist/src/render/ssr.js +90 -0
  92. package/dist/src/schemas/api.js +1 -0
  93. package/dist/src/schemas/core.js +1 -0
  94. package/dist/src/schemas/index.js +1 -0
  95. package/dist/src/schemas/layout.js +1 -0
  96. package/dist/src/schemas/routing/index.js +1 -0
  97. package/dist/src/schemas/routing.js +1 -0
  98. package/dist/src/types/as-island.js +1 -0
  99. package/{src → dist/src}/types/image.d.ts +106 -106
  100. package/{src → dist/src}/types/index.d.ts +22 -22
  101. package/{src → dist/src}/types/island-jsx.d.ts +33 -33
  102. package/{src → dist/src}/types/island-prop.d.ts +20 -20
  103. package/dist/src/types/layout.js +1 -0
  104. package/{src → dist/src}/types/mdx.d.ts +6 -6
  105. package/dist/src/types/routing.js +1 -0
  106. package/dist/src/types/types.js +1 -0
  107. package/{src → dist/src}/types/urlpattern.d.ts +49 -49
  108. package/{src → dist/src}/types/vite-env.d.ts +11 -11
  109. package/dist/src/utils/dev-logger.js +12 -0
  110. package/dist/src/utils/fs.js +1 -0
  111. package/dist/src/vite-plugin/auto-discover.js +1 -0
  112. package/dist/src/vite-plugin/config.js +1 -0
  113. package/dist/src/vite-plugin/errors.js +1 -0
  114. package/dist/src/vite-plugin/image-optimization.js +45 -0
  115. package/dist/src/vite-plugin/integration-activator.js +1 -0
  116. package/dist/src/vite-plugin/island-sidecar-plugin.js +1 -0
  117. package/dist/src/vite-plugin/module-discovery.js +1 -0
  118. package/dist/src/vite-plugin/nitro-integration.js +42 -0
  119. package/dist/src/vite-plugin/plugin.js +1 -0
  120. package/dist/src/vite-plugin/types.js +1 -0
  121. package/dist/src/vite-plugin/validation.js +2 -0
  122. package/package.json +57 -26
  123. package/mod.ts +0 -302
  124. package/src/build/integration-bundler-plugin.ts +0 -116
  125. package/src/build/integration-config.ts +0 -168
  126. package/src/build/integration-detection-plugin.ts +0 -117
  127. package/src/build/integration-resolver-plugin.ts +0 -90
  128. package/src/build/island-manifest.ts +0 -269
  129. package/src/build/island-types-generator.ts +0 -476
  130. package/src/build/mdx-island-transform.ts +0 -464
  131. package/src/build/mdx-plugin.ts +0 -98
  132. package/src/build/page-island-transform.ts +0 -598
  133. package/src/build/prop-extractors/index.ts +0 -21
  134. package/src/build/prop-extractors/lit.ts +0 -140
  135. package/src/build/prop-extractors/qwik.ts +0 -16
  136. package/src/build/prop-extractors/solid.ts +0 -125
  137. package/src/build/prop-extractors/svelte.ts +0 -194
  138. package/src/build/prop-extractors/vue.ts +0 -111
  139. package/src/build/sidecar-file-manager.ts +0 -104
  140. package/src/build/sidecar-renderer.ts +0 -30
  141. package/src/client/adapters/index.js +0 -12
  142. package/src/client/adapters/index.ts +0 -13
  143. package/src/client/adapters/lit-adapter.js +0 -467
  144. package/src/client/adapters/lit-adapter.ts +0 -654
  145. package/src/client/adapters/preact-adapter.js +0 -223
  146. package/src/client/adapters/preact-adapter.ts +0 -331
  147. package/src/client/adapters/qwik-adapter.js +0 -259
  148. package/src/client/adapters/qwik-adapter.ts +0 -345
  149. package/src/client/adapters/react-adapter.js +0 -220
  150. package/src/client/adapters/react-adapter.ts +0 -353
  151. package/src/client/adapters/solid-adapter.js +0 -295
  152. package/src/client/adapters/solid-adapter.ts +0 -451
  153. package/src/client/adapters/svelte-adapter.js +0 -368
  154. package/src/client/adapters/svelte-adapter.ts +0 -524
  155. package/src/client/adapters/vue-adapter.js +0 -278
  156. package/src/client/adapters/vue-adapter.ts +0 -467
  157. package/src/client/components.js +0 -23
  158. package/src/client/components.ts +0 -35
  159. package/src/client/css-hmr-handler.js +0 -263
  160. package/src/client/css-hmr-handler.ts +0 -344
  161. package/src/client/framework-adapter.js +0 -283
  162. package/src/client/framework-adapter.ts +0 -462
  163. package/src/client/hmr-coordinator.js +0 -274
  164. package/src/client/hmr-coordinator.ts +0 -396
  165. package/src/client/hmr-error-overlay.js +0 -533
  166. package/src/client/main.js +0 -816
  167. package/src/client/types/vite-virtual-modules.d.ts +0 -60
  168. package/src/components/Image.tsx +0 -123
  169. package/src/components/IslandErrorBoundary.tsx +0 -145
  170. package/src/components/LayoutDataErrorBoundary.tsx +0 -141
  171. package/src/components/LayoutErrorBoundary.tsx +0 -127
  172. package/src/components/PersistentIsland.tsx +0 -52
  173. package/src/components/StreamingErrorBoundary.tsx +0 -233
  174. package/src/components/StreamingLayout.tsx +0 -538
  175. package/src/core/components/component-analyzer.ts +0 -192
  176. package/src/core/components/component-detection.ts +0 -508
  177. package/src/core/components/enhanced-framework-detector.ts +0 -500
  178. package/src/core/components/framework-registry.ts +0 -563
  179. package/src/core/content/mdx-processor.ts +0 -46
  180. package/src/core/integrations/index.ts +0 -19
  181. package/src/core/integrations/loader.ts +0 -125
  182. package/src/core/integrations/registry.ts +0 -175
  183. package/src/core/islands/island-persistence.ts +0 -325
  184. package/src/core/islands/island-state-serializer.ts +0 -258
  185. package/src/core/islands/persistent-island-context.tsx +0 -80
  186. package/src/core/islands/use-persistent-state.ts +0 -68
  187. package/src/core/layout/enhanced-layout-resolver.ts +0 -322
  188. package/src/core/layout/layout-cache-manager.ts +0 -485
  189. package/src/core/layout/layout-composer.ts +0 -357
  190. package/src/core/layout/layout-data-loader.ts +0 -516
  191. package/src/core/layout/layout-discovery.ts +0 -243
  192. package/src/core/layout/layout-matcher.ts +0 -299
  193. package/src/core/layout/layout-types.ts +0 -110
  194. package/src/core/modules/framework-module-resolver.ts +0 -273
  195. package/src/islands/component-analysis.ts +0 -213
  196. package/src/islands/css-utils.ts +0 -565
  197. package/src/islands/discovery/index.ts +0 -80
  198. package/src/islands/discovery/registry.ts +0 -340
  199. package/src/islands/discovery/resolver.ts +0 -477
  200. package/src/islands/discovery/scanner.ts +0 -386
  201. package/src/islands/discovery/types.ts +0 -117
  202. package/src/islands/discovery/validator.ts +0 -544
  203. package/src/islands/discovery/watcher.ts +0 -368
  204. package/src/islands/framework-detection.ts +0 -428
  205. package/src/islands/integration-loader.ts +0 -490
  206. package/src/islands/island.tsx +0 -565
  207. package/src/islands/render-cache.ts +0 -550
  208. package/src/islands/types.ts +0 -80
  209. package/src/islands/universal-css-collector.ts +0 -157
  210. package/src/islands/universal-head-collector.ts +0 -137
  211. package/src/layout-system.ts +0 -218
  212. package/src/middleware/discovery.ts +0 -268
  213. package/src/middleware/executor.ts +0 -315
  214. package/src/middleware/index.ts +0 -76
  215. package/src/middleware/types.ts +0 -99
  216. package/src/nitro/build-config.ts +0 -576
  217. package/src/nitro/config.ts +0 -483
  218. package/src/nitro/error-handler.ts +0 -636
  219. package/src/nitro/index.ts +0 -173
  220. package/src/nitro/island-manifest.ts +0 -584
  221. package/src/nitro/middleware-adapter.ts +0 -260
  222. package/src/nitro/renderer.ts +0 -1471
  223. package/src/nitro/route-discovery.ts +0 -439
  224. package/src/nitro/types.ts +0 -321
  225. package/src/render/collect-css.ts +0 -198
  226. package/src/render/isolated-ssr-renderer.ts +0 -654
  227. package/src/render/ssr.ts +0 -1030
  228. package/src/schemas/api.ts +0 -30
  229. package/src/schemas/core.ts +0 -64
  230. package/src/schemas/index.ts +0 -212
  231. package/src/schemas/layout.ts +0 -279
  232. package/src/schemas/routing/index.ts +0 -38
  233. package/src/schemas/routing.ts +0 -376
  234. package/src/types/as-island.ts +0 -20
  235. package/src/types/layout.ts +0 -285
  236. package/src/types/routing.ts +0 -555
  237. package/src/types/types.ts +0 -5
  238. package/src/utils/dev-logger.ts +0 -299
  239. package/src/utils/fs.ts +0 -151
  240. package/src/vite-plugin/auto-discover.ts +0 -551
  241. package/src/vite-plugin/config.ts +0 -266
  242. package/src/vite-plugin/errors.ts +0 -127
  243. package/src/vite-plugin/image-optimization.ts +0 -156
  244. package/src/vite-plugin/integration-activator.ts +0 -126
  245. package/src/vite-plugin/island-sidecar-plugin.ts +0 -176
  246. package/src/vite-plugin/module-discovery.ts +0 -189
  247. package/src/vite-plugin/nitro-integration.ts +0 -1354
  248. package/src/vite-plugin/plugin.ts +0 -401
  249. package/src/vite-plugin/types.ts +0 -327
  250. package/src/vite-plugin/validation.ts +0 -228
@@ -1,283 +0,0 @@
1
- /**
2
- * Adapter registry for managing framework-specific HMR adapters
3
- */
4
- export class AdapterRegistry {
5
- adapters = new Map();
6
- /**
7
- * Register a framework-specific HMR adapter
8
- *
9
- * @param framework - Framework name (case-insensitive)
10
- * @param adapter - The adapter implementation
11
- * @throws Error if adapter is invalid or already registered
12
- *
13
- * Requirements: 2.1-2.7
14
- */
15
- register(framework, adapter) {
16
- const normalizedName = framework.toLowerCase();
17
- // Validate adapter
18
- if (!adapter) {
19
- throw new Error(`Cannot register null/undefined adapter for framework: ${framework}`);
20
- }
21
- if (!adapter.name) {
22
- throw new Error(`Adapter for framework ${framework} must have a name property`);
23
- }
24
- if (typeof adapter.canHandle !== "function") {
25
- throw new Error(`Adapter for framework ${framework} must implement canHandle method`);
26
- }
27
- if (typeof adapter.preserveState !== "function") {
28
- throw new Error(`Adapter for framework ${framework} must implement preserveState method`);
29
- }
30
- if (typeof adapter.update !== "function") {
31
- throw new Error(`Adapter for framework ${framework} must implement update method`);
32
- }
33
- if (typeof adapter.restoreState !== "function") {
34
- throw new Error(`Adapter for framework ${framework} must implement restoreState method`);
35
- }
36
- if (typeof adapter.handleError !== "function") {
37
- throw new Error(`Adapter for framework ${framework} must implement handleError method`);
38
- }
39
- // Check if already registered
40
- if (this.adapters.has(normalizedName)) {
41
- console.warn(`Overwriting existing HMR adapter for framework: ${framework}`);
42
- }
43
- this.adapters.set(normalizedName, adapter);
44
- }
45
- /**
46
- * Get an adapter for a specific framework
47
- *
48
- * @param framework - Framework name (case-insensitive)
49
- * @returns The adapter or undefined if not found
50
- */
51
- get(framework) {
52
- return this.adapters.get(framework.toLowerCase());
53
- }
54
- /**
55
- * Check if an adapter is registered for a framework
56
- *
57
- * @param framework - Framework name (case-insensitive)
58
- * @returns true if adapter is registered
59
- */
60
- has(framework) {
61
- return this.adapters.has(framework.toLowerCase());
62
- }
63
- /**
64
- * Get all registered framework names
65
- *
66
- * @returns Array of registered framework names
67
- */
68
- getRegisteredFrameworks() {
69
- return Array.from(this.adapters.keys());
70
- }
71
- /**
72
- * Find an adapter that can handle a specific component
73
- *
74
- * Iterates through all registered adapters and returns the first one
75
- * that can handle the component.
76
- *
77
- * @param component - The component to check
78
- * @returns The adapter that can handle the component, or undefined
79
- */
80
- findAdapter(component) {
81
- for (const adapter of this.adapters.values()) {
82
- if (adapter.canHandle(component)) {
83
- return adapter;
84
- }
85
- }
86
- return undefined;
87
- }
88
- /**
89
- * Unregister an adapter
90
- *
91
- * @param framework - Framework name (case-insensitive)
92
- * @returns true if adapter was removed, false if not found
93
- */
94
- unregister(framework) {
95
- const normalizedName = framework.toLowerCase();
96
- const removed = this.adapters.delete(normalizedName);
97
- return removed;
98
- }
99
- /**
100
- * Clear all registered adapters
101
- */
102
- clear() {
103
- this.adapters.clear();
104
- }
105
- /**
106
- * Get the number of registered adapters
107
- */
108
- get size() {
109
- return this.adapters.size;
110
- }
111
- }
112
- /**
113
- * Base adapter class with common functionality
114
- *
115
- * Framework-specific adapters can extend this class to inherit common behavior
116
- * and only override framework-specific methods.
117
- */
118
- export class BaseFrameworkAdapter {
119
- /**
120
- * Default state preservation implementation
121
- * Captures DOM state (scroll, focus, form values)
122
- *
123
- * Subclasses should override to add framework-specific state
124
- */
125
- preserveState(island) {
126
- try {
127
- const snapshot = {
128
- framework: this.name,
129
- timestamp: Date.now(),
130
- data: {},
131
- dom: this.captureDOMState(island)
132
- };
133
- return snapshot;
134
- } catch (error) {
135
- console.warn(`Failed to preserve state for ${this.name}:`, error);
136
- return null;
137
- }
138
- }
139
- /**
140
- * Default state restoration implementation
141
- * Restores DOM state (scroll, focus, form values)
142
- *
143
- * Subclasses should override to add framework-specific state restoration
144
- */
145
- restoreState(island, state) {
146
- try {
147
- if (state.dom) {
148
- this.restoreDOMState(island, state.dom);
149
- }
150
- } catch (error) {
151
- console.warn(`Failed to restore state for ${this.name}:`, error);
152
- }
153
- }
154
- /**
155
- * Default error handling implementation
156
- * Shows error indicator and preserves SSR HTML
157
- */
158
- handleError(island, error) {
159
- console.error(`HMR error in ${this.name} island:`, error);
160
- // Add error indicator
161
- const errorIndicator = document.createElement("div");
162
- errorIndicator.className = "hmr-error-indicator";
163
- errorIndicator.style.cssText = `
164
- position: absolute;
165
- top: 0;
166
- left: 0;
167
- right: 0;
168
- background: #ff4444;
169
- color: white;
170
- padding: 8px;
171
- font-size: 12px;
172
- font-family: monospace;
173
- z-index: 10000;
174
- border-bottom: 2px solid #cc0000;
175
- `;
176
- errorIndicator.textContent = `HMR Error: ${error.message}`;
177
- // Remove existing error indicators
178
- const existing = island.querySelector(".hmr-error-indicator");
179
- if (existing) {
180
- existing.remove();
181
- }
182
- island.style.position = "relative";
183
- island.insertBefore(errorIndicator, island.firstChild);
184
- // Mark island as having error
185
- island.setAttribute("data-hmr-error", "true");
186
- island.setAttribute("data-hmr-error-message", error.message);
187
- }
188
- /**
189
- * Capture DOM state (scroll, focus, form values)
190
- */
191
- captureDOMState(island) {
192
- const dom = {};
193
- // Capture scroll position
194
- const scrollableElements = island.querySelectorAll("[data-preserve-scroll]");
195
- if (scrollableElements.length > 0 || island.scrollTop > 0 || island.scrollLeft > 0) {
196
- dom.scrollPosition = {
197
- x: island.scrollLeft,
198
- y: island.scrollTop
199
- };
200
- }
201
- // Capture focused element
202
- const activeElement = document.activeElement;
203
- if (activeElement && island.contains(activeElement)) {
204
- const selector = this.getElementSelector(activeElement);
205
- if (selector) {
206
- dom.focusedElement = selector;
207
- }
208
- }
209
- // Capture form values
210
- const formElements = island.querySelectorAll("input, textarea, select");
211
- if (formElements.length > 0) {
212
- dom.formValues = {};
213
- formElements.forEach((element, index) => {
214
- const input = element;
215
- const name = input.name || input.id || `element-${index}`;
216
- if (input.type === "checkbox" || input.type === "radio") {
217
- dom.formValues[name] = input.checked;
218
- } else {
219
- dom.formValues[name] = input.value;
220
- }
221
- });
222
- }
223
- return dom;
224
- }
225
- /**
226
- * Restore DOM state (scroll, focus, form values)
227
- */
228
- restoreDOMState(island, dom) {
229
- if (!dom) return;
230
- // Restore scroll position
231
- if (dom.scrollPosition) {
232
- island.scrollLeft = dom.scrollPosition.x;
233
- island.scrollTop = dom.scrollPosition.y;
234
- }
235
- // Restore focused element
236
- if (dom.focusedElement) {
237
- try {
238
- const element = island.querySelector(dom.focusedElement);
239
- if (element && typeof element.focus === "function") {
240
- element.focus();
241
- }
242
- } catch (error) {
243
- console.warn("Failed to restore focus:", error);
244
- }
245
- }
246
- // Restore form values
247
- if (dom.formValues) {
248
- const formElements = island.querySelectorAll("input, textarea, select");
249
- formElements.forEach((element, index) => {
250
- const input = element;
251
- const name = input.name || input.id || `element-${index}`;
252
- const value = dom.formValues[name];
253
- if (value !== undefined) {
254
- if (input.type === "checkbox" || input.type === "radio") {
255
- input.checked = value;
256
- } else {
257
- input.value = value;
258
- }
259
- }
260
- });
261
- }
262
- }
263
- /**
264
- * Get a CSS selector for an element
265
- */
266
- getElementSelector(element) {
267
- if (element.id) {
268
- return `#${element.id}`;
269
- }
270
- // Check if element has name attribute (for form elements)
271
- const nameAttr = element.getAttribute("name");
272
- if (nameAttr) {
273
- return `[name="${nameAttr}"]`;
274
- }
275
- // Fallback to nth-child selector
276
- const parent = element.parentElement;
277
- if (parent) {
278
- const index = Array.from(parent.children).indexOf(element);
279
- return `${element.tagName.toLowerCase()}:nth-child(${index + 1})`;
280
- }
281
- return null;
282
- }
283
- }