@csedl/svelte-on-rails 11.0.2 → 11.0.4

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@csedl/svelte-on-rails",
3
- "version": "11.0.2",
3
+ "version": "11.0.4",
4
4
  "description": "Client-side runtime for svelte-on-rails: hydration, SSR build support & Turbo Stream actions",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "build": "vite build"
8
+ "build:package": "vite build"
9
9
  },
10
10
  "exports": {
11
11
  ".": "./index.js",
package/src/config.js CHANGED
@@ -25,7 +25,7 @@ export const SvelteOnRails = {
25
25
  const loader = components[componentKey];
26
26
 
27
27
  if (!loader) {
28
- throw new Error(`[svelte-on-rails] Component not found: ${componentKey} (relative to vites sourceCodeDir / frontend-folder)`);
28
+ throw new Error(`[svelte-on-rails] Component not found: «${componentKey}»\nAvailable imported Components are:\n\n+++\n ${Object.keys(components).join('\n • ')}\n+++\n`);
29
29
  //return;
30
30
  } else {
31
31
  debugLog(`[svelte-on-rails] Component found: ${componentKey}`);
@@ -11,8 +11,10 @@ export function cleanupSvelteComponent(element) {
11
11
  try {
12
12
  const instance = svelteInstances.get(element);
13
13
  if (instance) {
14
- unmount(instance); // Destroy the Svelte component instance in Svelte 5
15
- debugLog(`Successfully unmounted Svelte component for element:`, element);
14
+ unmount(instance).then(()=>{
15
+ debugLog(`Successfully unmounted Svelte component for element:`, element);
16
+ }); // Destroy the Svelte component instance in Svelte 5
17
+ debugLog(`Unmounted Svelte component for element:`, element);
16
18
  element.removeAttribute('data-svelte-initialized'); // Reset initialized state
17
19
  svelteInstances.delete(element); // Remove from WeakMap
18
20
  } else {
@@ -5,6 +5,9 @@ import {cleanupSvelteComponent} from "./cleanupSvelteComponent.js";
5
5
  export default class extends Controller {
6
6
 
7
7
  connect() {
8
+
9
+ console.log('SVELTE CONNECT')
10
+
8
11
  const stat = this.element.getAttribute('data-svelte-status');
9
12
  if (stat === 'do-not-hydrate-build-me') return;
10
13