|
1 |
| -import { Controller } from '@hotwired/stimulus'; |
2 |
| - |
3 |
| -class default_1 extends Controller { |
4 |
| - connect() { |
5 |
| - this.element.innerHTML = ''; |
6 |
| - this.props = this.propsValue ?? undefined; |
7 |
| - this.intro = this.introValue ?? undefined; |
8 |
| - this.dispatchEvent('connect'); |
9 |
| - const Component = window.resolveSvelteComponent(this.componentValue); |
10 |
| - this._destroyIfExists(); |
11 |
| - this.app = new Component({ |
12 |
| - target: this.element, |
13 |
| - props: this.props, |
14 |
| - intro: this.intro, |
15 |
| - }); |
16 |
| - this.element.root = this.app; |
17 |
| - this.dispatchEvent('mount', { |
18 |
| - component: Component, |
19 |
| - }); |
20 |
| - } |
21 |
| - disconnect() { |
22 |
| - this._destroyIfExists(); |
23 |
| - this.dispatchEvent('unmount'); |
24 |
| - } |
25 |
| - _destroyIfExists() { |
26 |
| - if (this.element.root !== undefined) { |
27 |
| - this.element.root.$destroy(); |
28 |
| - delete this.element.root; |
29 |
| - } |
30 |
| - } |
31 |
| - dispatchEvent(name, payload = {}) { |
32 |
| - const detail = { |
33 |
| - componentName: this.componentValue, |
34 |
| - props: this.props, |
35 |
| - intro: this.intro, |
36 |
| - ...payload, |
37 |
| - }; |
38 |
| - this.dispatch(name, { detail, prefix: 'svelte' }); |
| 1 | +import { Controller } from "@hotwired/stimulus"; |
| 2 | +class render_controller_default extends Controller { |
| 3 | + connect() { |
| 4 | + this.element.innerHTML = ""; |
| 5 | + this.props = this.propsValue ?? void 0; |
| 6 | + this.intro = this.introValue ?? void 0; |
| 7 | + this.dispatchEvent("connect"); |
| 8 | + const Component = window.resolveSvelteComponent(this.componentValue); |
| 9 | + this._destroyIfExists(); |
| 10 | + this.app = new Component({ |
| 11 | + target: this.element, |
| 12 | + props: this.props, |
| 13 | + intro: this.intro |
| 14 | + }); |
| 15 | + this.element.root = this.app; |
| 16 | + this.dispatchEvent("mount", { |
| 17 | + component: Component |
| 18 | + }); |
| 19 | + } |
| 20 | + disconnect() { |
| 21 | + this._destroyIfExists(); |
| 22 | + this.dispatchEvent("unmount"); |
| 23 | + } |
| 24 | + _destroyIfExists() { |
| 25 | + if (this.element.root !== void 0) { |
| 26 | + this.element.root.$destroy(); |
| 27 | + delete this.element.root; |
39 | 28 | }
|
| 29 | + } |
| 30 | + dispatchEvent(name, payload = {}) { |
| 31 | + const detail = { |
| 32 | + componentName: this.componentValue, |
| 33 | + props: this.props, |
| 34 | + intro: this.intro, |
| 35 | + ...payload |
| 36 | + }; |
| 37 | + this.dispatch(name, { detail, prefix: "svelte" }); |
| 38 | + } |
40 | 39 | }
|
41 |
| -default_1.values = { |
42 |
| - component: String, |
43 |
| - props: Object, |
44 |
| - intro: Boolean, |
| 40 | +render_controller_default.values = { |
| 41 | + component: String, |
| 42 | + props: Object, |
| 43 | + intro: Boolean |
| 44 | +}; |
| 45 | +export { |
| 46 | + render_controller_default as default |
45 | 47 | };
|
46 |
| - |
47 |
| -export { default_1 as default }; |
0 commit comments