@@ -2,48 +2,46 @@ if (typeof window.livewire === 'undefined') {
2
2
throw 'Livewire Vue Plugin: window.livewire is undefined. Make sure @livewireScripts is placed above this script include'
3
3
}
4
4
5
- export default function ( ) {
6
- window . livewire . hook ( 'beforeDomUpdate' , ( component , mutableHtmlContainer ) => {
7
- if ( ! window . Vue ) return
5
+ window . livewire . hook ( 'beforeDomUpdate' , ( component , mutableHtmlContainer ) => {
6
+ if ( ! window . Vue ) return
8
7
9
- const div = document . createElement ( 'div' )
10
- div . innerHTML = mutableHtmlContainer . html
8
+ const div = document . createElement ( 'div' )
9
+ div . innerHTML = mutableHtmlContainer . html
11
10
12
- new window . Vue ( ) . $mount ( div . firstElementChild )
11
+ new window . Vue ( ) . $mount ( div . firstElementChild )
13
12
14
- mutableHtmlContainer . html = div . firstElementChild . outerHTML
15
- } )
13
+ mutableHtmlContainer . html = div . firstElementChild . outerHTML
14
+ } )
16
15
17
- window . livewire . hook ( 'elementInitialized' , el => {
18
- if ( el . rawNode ( ) . __vue__ ) el . rawNode ( ) . __livewire_ignore = true
19
- } )
16
+ window . livewire . hook ( 'elementInitialized' , el => {
17
+ if ( el . rawNode ( ) . __vue__ ) el . rawNode ( ) . __livewire_ignore = true
18
+ } )
20
19
21
- window . livewire . hook ( 'interceptWireModelSetValue' , ( el , value ) => {
22
- // If it's a vue component pass down the value prop.
23
- if ( ! el . rawNode ( ) . __vue__ ) return
20
+ window . livewire . hook ( 'interceptWireModelSetValue' , ( el , value ) => {
21
+ // If it's a vue component pass down the value prop.
22
+ if ( ! el . rawNode ( ) . __vue__ ) return
24
23
25
- // Also, Vue will throw a warning because we are programmaticallly
26
- // setting a prop, we need to silence that.
27
- const originalSilent = window . Vue . config . silent
28
- window . Vue . config . silent = true
24
+ // Also, Vue will throw a warning because we are programmaticallly
25
+ // setting a prop, we need to silence that.
26
+ const originalSilent = window . Vue . config . silent
27
+ window . Vue . config . silent = true
29
28
30
- el . rawNode ( ) . __vue__ . $props . value = value
29
+ el . rawNode ( ) . __vue__ . $props . value = value
31
30
32
- window . Vue . config . silent = originalSilent
33
- } )
31
+ window . Vue . config . silent = originalSilent
32
+ } )
34
33
35
- window . livewire . hook ( 'interceptWireModelAttachListener' , ( el , directive , component , debounceIf ) => {
36
- // If it's a vue component pass down the value prop.
37
- if ( ! el . rawNode ( ) . __vue__ ) return
34
+ window . livewire . hook ( 'interceptWireModelAttachListener' , ( el , directive , component , debounceIf ) => {
35
+ // If it's a vue component pass down the value prop.
36
+ if ( ! el . rawNode ( ) . __vue__ ) return
38
37
39
- const hasDebounceModifier = directive . modifiers . includes ( 'debounce' )
40
- const isLazy = directive . modifiers . includes ( 'lazy' )
38
+ const hasDebounceModifier = directive . modifiers . includes ( 'debounce' )
39
+ const isLazy = directive . modifiers . includes ( 'lazy' )
41
40
42
- el . rawNode ( ) . __vue__ . $on ( 'input' , debounceIf ( hasDebounceModifier || ! isLazy , e => {
43
- const model = directive . value
44
- const value = e
41
+ el . rawNode ( ) . __vue__ . $on ( 'input' , debounceIf ( hasDebounceModifier || ! isLazy , e => {
42
+ const model = directive . value
43
+ const value = e
45
44
46
- component . set ( model , value )
47
- } , directive . durationOr ( 150 ) ) )
48
- } )
49
- }
45
+ component . set ( model , value )
46
+ } , directive . durationOr ( 150 ) ) )
47
+ } )
0 commit comments