├── .gitignore ├── LICENSE ├── README.md ├── component.go ├── directive.go ├── examples ├── basic │ ├── basic.go │ └── index.html ├── component │ ├── index.html │ └── main.go ├── computed │ ├── computed.go │ └── index.html ├── directive │ ├── index.html │ └── main.go ├── features │ ├── features.go │ └── index.html └── unwritableTime │ ├── index.html │ └── main.go ├── extra.go ├── filter.go ├── inc_debug.go ├── inc_minified.go ├── jscode ├── debug │ ├── inc.go │ └── vue-2.1.10.inc.js └── minified │ ├── inc.go │ └── vue-2.1.10.min.inc.js ├── mapping.go ├── option.go └── vue.go /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | examples/basic/basic.js.map 26 | examples/basic/basic.js 27 | examples/unwritableTime/unwritableTime.js 28 | examples/unwritableTime/unwritableTime.js.map 29 | examples/component/component.js 30 | examples/component/component.js.map 31 | 32 | node_modules/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 oskca 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gopherjs-vue 2 | VueJS bindings for gopherjs 3 | 4 | # Usage 5 | 6 | Combined the power of [Gopherjs][gopherjs] and [VueJS][vuejs], you can use 7 | `golang struct` to provide the two-way data-binding context for [VueJS][vuejs], 8 | and easily implements the popular browser `MVVM` models in Go. 9 | 10 | Currently `ViewModel/Component/Directive/Filter` are supported and wrapped in 11 | a gopherjs friendly way. 12 | 13 | These are the basic rules to use this package: 14 | 15 | * all `exported fields` of the `golang struct` would become VueJS Instance's 16 | data which can be used in the html to do data binding: v-bind, etc 17 | 18 | * all `exported funcs` of the `golang struct` would become VueJS Instance's 19 | methods which can be called as html event handler: v-on, etc 20 | 21 | * the `golang struct` talked above is actually of pointer type and 22 | should have an anonymous embeded `*js.Object` field and the `exported fields` 23 | should have proper `js struct tag` for bidirectionaly data bindings 24 | 25 | # Using the debug|dev version of VueJS 26 | 27 | This package includes the `minified|product version` of VueJS code by default, 28 | if you want to include the `debug|dev version` of of VueJS code, please specify 29 | buidling tags `debug` to the `gopherjs build` cmd as this: 30 | 31 | gopherjs build --tags debug main.go 32 | 33 | for more details please see the examples. 34 | 35 | # Basic example 36 | 37 | gopherjs code: 38 | 39 | ```go 40 | package main 41 | 42 | import ( 43 | "github.com/gopherjs/gopherjs/js" 44 | "github.com/oskca/gopherjs-vue" 45 | ) 46 | 47 | type Model struct { 48 | *js.Object // this is needed for bidirectional data bindings 49 | IntValue int `js:"integer"` 50 | Str string `js:"str"` 51 | } 52 | 53 | // this would be recognized as Inc in html 54 | func (m *Model) Inc() { 55 | m.IntValue += 1 56 | println("inc called") 57 | } 58 | 59 | // this would be recognized as Repeat in html 60 | func (m *Model) Repeat() { 61 | m.Str = m.Str + m.Str 62 | } 63 | 64 | // this would be recognized as Reset in html 65 | func (m *Model) Reset() { 66 | m.Str = "a string " 67 | } 68 | 69 | func main() { 70 | m := &Model{ 71 | Object: js.Global.Get("Object").New(), 72 | } 73 | // field assignment is required in this way to make data passing works 74 | m.IntValue = 100 75 | m.Str = "a string" 76 | // create the VueJS viewModel using a struct pointer 77 | vue.New("#app", m) 78 | } 79 | ``` 80 | 81 | 82 | html markup: 83 | 84 | ```html 85 | 86 | 87 | 88 | 89 |
90 |
integer: {{ integer }} 91 | 92 |
93 |
str: {{ str }}
94 | 95 | 96 | 97 |
98 | 99 | 100 | 101 | 102 | ``` 103 | 104 | compile and run, then there you are :) 105 | 106 | [gopherjs]: https://github.com/gopherjs/gopherjs 107 | [vuejs]: http://vuejs.org/ 108 | -------------------------------------------------------------------------------- /component.go: -------------------------------------------------------------------------------- 1 | package vue 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | ) 6 | 7 | var ( 8 | creatorPool = make([]*pool, 0) 9 | ) 10 | 11 | type pool struct { 12 | creator func() (structPtr interface{}) 13 | structPtr interface{} 14 | counter int 15 | } 16 | 17 | // Component is actually an Extended Vue SubClass, 18 | // which acts as a Component constructor in VueJS world 19 | // thus you can use Component.New to create a 20 | // preConfigured VueJS instance(*ViewModel). 21 | type Component struct { 22 | *ViewModel 23 | } 24 | 25 | // New create the component instance 26 | func (c *Component) New() *ViewModel { 27 | return newViewModel(c.Object.New()) 28 | } 29 | 30 | func newComponent(o *js.Object) *Component { 31 | return &Component{ 32 | ViewModel: newViewModel(o), 33 | } 34 | } 35 | 36 | // Register register Component:c in the global namespace 37 | func (c *Component) Register(name string) *Component { 38 | vue.Call("component", name, c) 39 | return c 40 | } 41 | 42 | func GetComponent(name string) *Component { 43 | return newComponent(vue.Call("component", name)) 44 | } 45 | 46 | // NewComponent creates and registers a named global Component 47 | // 48 | // vmCreator should return a gopherjs struct pointer. see New for more details 49 | func NewComponent( 50 | vmCreator func() (structPtr interface{}), 51 | templateStr string, 52 | replaceMountPoint ...bool, 53 | ) *Component { 54 | // args 55 | idx := len(creatorPool) 56 | creatorPool = append(creatorPool, new(pool)) 57 | creatorPool[idx].creator = vmCreator 58 | vmfn := func() interface{} { 59 | p := creatorPool[idx] 60 | if p.counter%3 == 0 { 61 | p.structPtr = p.creator() 62 | } 63 | p.counter += 1 64 | return p.structPtr 65 | } 66 | // opts 67 | opt := NewOption() 68 | opt.Data = vmfn 69 | opt.Template = templateStr 70 | opt.OnLifeCycleEvent(EvtBeforeCreate, func(vm *ViewModel) { 71 | vm.Options.Set("methods", js.MakeWrapper(vmfn())) 72 | vMap[vmfn()] = vm 73 | }) 74 | return opt.NewComponent() 75 | } 76 | -------------------------------------------------------------------------------- /directive.go: -------------------------------------------------------------------------------- 1 | package vue 2 | 3 | import "github.com/gopherjs/gopherjs/js" 4 | import "github.com/oskca/gopherjs-dom" 5 | 6 | type DirectiveBinding struct { 7 | *js.Object 8 | // name: the name of the directive, without the prefix. 9 | Name string `js:"name"` 10 | // value: The value passed to the directive. For example in v-my-directive="1 + 1", the value would be 2. 11 | Value string `js:"value"` 12 | // oldValue: The previous value, only available in update and componentUpdated. It is available whether or not the value has changed. 13 | OldValue string `js:"oldValue"` 14 | // expression: the expression of the binding, excluding arguments and filters. 15 | Expression string `js:"expression"` 16 | // arg: the argument, if present. 17 | Arg string `js:"arg"` 18 | // modifiers: an object containing modifiers, if any. 19 | Modifiers *js.Object `js:"modifiers"` 20 | } 21 | 22 | // DirectiveCallback can be used in every directive callback functions 23 | type DirectiveCallback func(el *dom.Element, b *DirectiveBinding, vNode, oldVnode *js.Object) 24 | 25 | type Directive struct { 26 | *js.Object 27 | // // Name string 28 | // // advanced options 29 | // // Custom directive can provide a params array, 30 | // // and the Vue compiler will automatically extract 31 | // // these attributes on the element that the directive is bound to. 32 | // Params []string `js:"params"` 33 | // // If your custom directive is expected to be used on an Object, 34 | // // and it needs to trigger update when a nested property inside 35 | // // the object changes, you need to pass in deep: true in your directive definition. 36 | // Deep bool `js:"deep"` 37 | // // If your directive expects to write data back to 38 | // // the Vue instance, you need to pass in twoWay: true. 39 | // // This option allows the use of this.set(value) inside 40 | // // the directive:If your directive expects to write data back to 41 | // // the Vue instance, you need to pass in twoWay: true. 42 | // // This option allows the use of this.set(value) inside the directive 43 | // TwoWay bool `js:"twoWay"` 44 | // // Passing in acceptStatement:true enables 45 | // // your custom directive to accept inline statements like v-on does 46 | // AcceptStatement bool `js:"acceptStatement"` 47 | // // Vue compiles templates by recursively walking the DOM tree. 48 | // // However when it encounters a terminal directive, 49 | // // it will stop walking that element’s children. 50 | // // The terminal directive takes over the job of compiling the element and 51 | // // its children. For example, v-if and v-for are both terminal directives. 52 | // Terminal bool `js:"terminal"` 53 | // // You can optionally provide a priority number for your directive. 54 | // // If no priority is specified, a default priority will be used 55 | // // - 1000 for normal directives and 2000 for terminal directives. 56 | // // A directive with a higher priority will be processed earlier than 57 | // // other directives on the same element. Directives with 58 | // // the same priority will be processed in the order they appear in 59 | // // the element’s attribute list, although that order is not 60 | // // guaranteed to be consistent in different browsers. 61 | // Priority int `js:"priority"` 62 | } 63 | 64 | func NewDirective(updaterCallBack ...interface{}) *Directive { 65 | d := &Directive{ 66 | Object: js.Global.Get("Object").New(), 67 | } 68 | if len(updaterCallBack) > 0 { 69 | d.SetUpdater(updaterCallBack[0]) 70 | } 71 | return d 72 | } 73 | 74 | func (d *Directive) SetBinder(fnCallback interface{}) *Directive { 75 | d.Set("bind", fnCallback) 76 | return d 77 | } 78 | 79 | func (d *Directive) SetUnBinder(fnCallback interface{}) *Directive { 80 | d.Set("unbind", fnCallback) 81 | return d 82 | } 83 | 84 | func (d *Directive) SetUpdater(fnCallback interface{}) *Directive { 85 | d.Set("update", fnCallback) 86 | return d 87 | } 88 | 89 | func (d *Directive) Register(name string) { 90 | js.Global.Get("Vue").Call("directive", name, d.Object) 91 | } 92 | -------------------------------------------------------------------------------- /examples/basic/basic.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | "github.com/oskca/gopherjs-vue" 6 | ) 7 | 8 | type Model struct { 9 | *js.Object // this is needed for bidirectional data bindings 10 | IntValue int `js:"integer"` 11 | Str string `js:"str"` 12 | } 13 | 14 | // this would be recognized as Inc in html 15 | func (m *Model) Inc() { 16 | m.IntValue += 1 17 | println("inc called") 18 | } 19 | 20 | // this would be recognized as Repeat in html 21 | func (m *Model) Repeat() { 22 | m.Str = m.Str + m.Str 23 | } 24 | 25 | // this would be recognized as Reset in html 26 | func (m *Model) Reset() { 27 | m.Str = "a string " 28 | } 29 | 30 | func main() { 31 | m := &Model{ 32 | Object: js.Global.Get("Object").New(), 33 | } 34 | // field assignment is required in this way to make data passing works 35 | m.IntValue = 100 36 | m.Str = "a string" 37 | // create the VueJS viewModel using a struct pointer 38 | vue.New("#app", m) 39 | } 40 | -------------------------------------------------------------------------------- /examples/basic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
integer: {{ integer }} 7 | 8 |
9 |
str: {{ str }}
10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/component/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test for Component 6 | 7 | 8 | 9 |
10 | first: 11 | 12 | second: 13 | 14 |
15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/component/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | "github.com/oskca/gopherjs-vue" 6 | ) 7 | 8 | type Com struct { 9 | *js.Object 10 | Text string `js:"text"` 11 | } 12 | 13 | func (c *Com) Hello() { 14 | println("hello" + c.Text) 15 | vm := vue.GetVM(c) 16 | println("vm from Hello:", vm) 17 | println("vm.get:", vm.Get("text").String()) 18 | } 19 | 20 | func New() interface{} { 21 | cc := &Com{ 22 | Object: js.Global.Get("Object").New(), 23 | } 24 | cc.Text = "init value" 25 | return cc 26 | } 27 | 28 | type controller struct { 29 | *js.Object 30 | } 31 | 32 | func main() { 33 | vue.NewComponent(New, template).Register("my-el") 34 | vm := vue.New("#app", new(controller)) 35 | js.Global.Set("vm", vm) 36 | println("vm:", vm) 37 | } 38 | 39 | const ( 40 | template = ` 41 |
42 |
Text:{{text}}
43 | 44 | 45 |
46 | ` 47 | ) 48 | -------------------------------------------------------------------------------- /examples/computed/computed.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | "github.com/oskca/gopherjs-vue" 6 | ) 7 | 8 | type Model struct { 9 | *js.Object // this is needed for bidirectional data bindings 10 | IntValue int `js:"integer"` 11 | Str string `js:"str"` 12 | } 13 | 14 | // this would be recognized as Inc in html 15 | func (m *Model) Inc() { 16 | m.IntValue += 1 17 | println("inc called") 18 | } 19 | 20 | // this would be recognized as Repeat in html 21 | func (m *Model) Repeat() { 22 | m.Str = m.Str + m.Str 23 | } 24 | 25 | // this would be recognized as Reset in html 26 | func (m *Model) Reset() { 27 | m.Str = "a string " 28 | } 29 | 30 | func main() { 31 | // model 32 | m := &Model{ 33 | Object: js.Global.Get("Object").New(), 34 | } 35 | // field assignment is required in this way to make data passing works 36 | m.IntValue = 100 37 | m.Str = "a string" 38 | // options 39 | o := vue.NewOption() 40 | o.SetDataWithMethods(m) 41 | o.AddComputed("double", func(vm *vue.ViewModel) interface{} { 42 | println("reading computed double") 43 | i := vm.Data.Get("integer").Int() 44 | return i * 2 45 | }) 46 | v := o.NewViewModel() 47 | v.Mount("#app") 48 | } 49 | -------------------------------------------------------------------------------- /examples/computed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
integer: {{ integer }} 7 | 8 |
9 |
double: {{ double }}
10 |
str: {{ str }}
11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/directive/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test Directive 6 | 7 | 8 | 9 |
10 |
Text:{{Text}}
11 |
12 | 13 |
14 |
15 |
Time:{{Time}}
16 |
17 | 18 |
19 |
20 |
21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/directive/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/gopherjs/gopherjs/js" 7 | "github.com/oskca/gopherjs-vue" 8 | ) 9 | 10 | type Model struct { 11 | *js.Object 12 | Text string `js:"Text"` 13 | Time string `js:"Time"` 14 | } 15 | 16 | func main() { 17 | d := vue.NewDirective() 18 | d.SetUpdater(func(el *js.Object, ctx *vue.DirectiveBinding, val *js.Object) { 19 | println("directive name:", ctx.Name) 20 | println("directive exp:", ctx.Expression) 21 | println("directive values:", val) 22 | }).Register("myd") 23 | 24 | m := &Model{ 25 | Object: js.Global.Get("Object").New(), 26 | } 27 | m.Text = "a string" 28 | m.Time = time.Now().String() 29 | vue.New("#app", m) 30 | } 31 | -------------------------------------------------------------------------------- /examples/features/features.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/rand" 6 | "strings" 7 | "time" 8 | 9 | "github.com/gopherjs/gopherjs/js" 10 | "github.com/oskca/gopherjs-vue" 11 | ) 12 | 13 | // no *js.Object struct can only be manipulated by ViewModel.methods 14 | type Todo struct { 15 | *js.Object 16 | Time string `js:"time"` 17 | Content string `js:"content"` 18 | } 19 | 20 | func NewTodo(content string) *Todo { 21 | t := &Todo{ 22 | Object: js.Global.Get("Object").New(), 23 | } 24 | t.Time = time.Now().String() 25 | t.Content = content 26 | return t 27 | } 28 | 29 | type Model struct { 30 | *js.Object // this is needed for bidirectional data bindings 31 | IntValue int `js:"integer"` 32 | Str string `js:"str"` 33 | List []int `js:"list"` 34 | Todos []*Todo `js:"todos"` 35 | CheckedItems []string `js:"CheckedItems"` 36 | AllItems []string `js:"AllItems"` 37 | Now func() string `js:"Now"` 38 | } 39 | 40 | func (m *Model) Inc() { 41 | m.IntValue += 1 42 | println("inc called") 43 | } 44 | 45 | func (m *Model) Repeat() { 46 | m.Str = strings.Repeat(m.Str, 3) 47 | vm := vue.GetVM(m) 48 | // println("Get(m):", vm) 49 | // println("m keys:", js.Keys(m.Object)) 50 | // for i, key := range js.Keys(m.Object) { 51 | // println(i, key) 52 | // } 53 | // println("vm keys:", js.Keys(vm.Object)) 54 | // for i, key := range js.Keys(vm.Object) { 55 | // println(i, key) 56 | // } 57 | // println("integer from vm:", vm.Get("integer").Int()) 58 | println("integer from vm:", vm.Data.Get("integer").Int()) 59 | } 60 | 61 | func (m *Model) PopulateTodo() { 62 | // using append would cause GopherJS internalization problems 63 | // but this way works with Todo has js.Object embeded 64 | m.Todos = append(m.Todos, NewTodo(m.Str)) 65 | } 66 | 67 | func (m *Model) PopulateTodo2() { 68 | // so it's better to use VueJS ops to manipulates the array 69 | vm := vue.GetVM(m) 70 | todos := vm.Get("todos") 71 | vue.Push(todos, NewTodo(m.Str)) 72 | } 73 | 74 | func (m *Model) MapTodos() { 75 | data := []*Todo{} 76 | for i := 0; i < 10; i++ { 77 | str := fmt.Sprintf("%05d", rand.Int63n(100000)) 78 | data = append(data, NewTodo(str)) 79 | } 80 | obj := js.Global.Get("Object").New() 81 | obj.Set("todos", data) 82 | obj.Set("wtf", time.Now()) 83 | vm := vue.GetVM(m) 84 | // wtf would be created in `vm`, this way works but not suggested 85 | vm.FromJS(obj) 86 | } 87 | 88 | func (m *Model) ShiftTodo() { 89 | // m.Todos = m.Todos[1:] 90 | vm := vue.GetVM(m) 91 | todos := vm.Get("todos") 92 | vue.Shift(todos) 93 | } 94 | 95 | func (m *Model) WhatTF() string { 96 | println("then called", m.IntValue) 97 | // m.List = append(m.List, m.IntValue) 98 | return time.Now().String() 99 | } 100 | 101 | func (m *Model) DoubleInt() int { 102 | return 2 * m.IntValue 103 | } 104 | 105 | func main() { 106 | // register a time formating filter 107 | vue.NewFilter(func(v *js.Object) interface{} { 108 | t, _ := time.Parse("2006-01-02 15:04:05.999999999 -0700 MST", v.String()) 109 | return t.Format("2006-01-02 15:04:05") 110 | }).Register("timeFormat") 111 | // begin vm 112 | m := &Model{ 113 | Object: js.Global.Get("Object").New(), 114 | } 115 | // this is the correct way to initialize the gopherjs struct 116 | // which would be used in the JavaScript side. 117 | m.IntValue = 100 118 | m.Str = "a string" 119 | m.List = []int{1, 2, 3, 4} 120 | // m.Todos = []*Todo{NewTodo("Good Day")} 121 | m.Todos = []*Todo{} 122 | m.AllItems = []string{"A", "B", "C", "D", "John", "Bill"} 123 | m.CheckedItems = []string{"A", "B"} 124 | m.Now = func() string { 125 | println("now:", m.IntValue) 126 | return time.Now().String() + fmt.Sprintf(" ==> i:%d", m.IntValue) 127 | } 128 | v := vue.New("#app", m) 129 | v.Watch("integer", func(val *js.Object) { 130 | println("IntValue changed to:", val, "m.IntValue:", m.IntValue) 131 | m.Str = fmt.Sprintf("after watch:%d", m.IntValue) 132 | }) 133 | js.Global.Set("vm", v) 134 | } 135 | -------------------------------------------------------------------------------- /examples/features/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test Vue 6 | 11 | 12 | 13 | 14 |
15 | integer: {{ integer }} 16 |
17 |
Field Func: {{ Now() }}
18 |
Methond Func: {{ WhatTF() }}
19 |
DoubleInt: {{ DoubleInt() }}
20 | 26 |
27 | CheckedItems: {{ CheckedItems }} 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
  • 37 | {{ item }} 38 |
  • 39 | 40 | Todos:
    41 | 44 |

    {{str}}

    45 |
    46 | 47 | 50 | -------------------------------------------------------------------------------- /examples/unwritableTime/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Time Test 6 | 7 | 8 | 9 |
    time:{{Time}}
    10 |
    text:{{Text}}
    11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/unwritableTime/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | "time" 6 | ) 7 | 8 | type Test struct { 9 | *js.Object 10 | Time time.Time `js:"Time"` 11 | Text string `js:"Text"` 12 | } 13 | 14 | func main() { 15 | t := &Test{ 16 | Object: js.Global.Get("Object").New(), 17 | } 18 | t.Text = "Hello World" 19 | println(time.Now()) 20 | t.Time = time.Now() 21 | } 22 | -------------------------------------------------------------------------------- /extra.go: -------------------------------------------------------------------------------- 1 | package vue 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | ) 6 | 7 | // TConfig is used for declaration only 8 | type TConfig struct { 9 | *js.Object 10 | // Suppress all Vue logs and warnings. 11 | Silent bool `js:"silent"` 12 | // The merge strategy receives the value of that option defined on the parent and child instances as the first and second arguments, respectively. 13 | OptionMergeStrategies interface{} `js:"optionMergeStrategies"` 14 | // Configure whether to allow vue-devtools inspection. 15 | Devtools bool `js:"devtools"` 16 | // Assign a handler for uncaught errors during component render and watchers. 17 | ErrorHandler func(err, vm *js.Object) `js:"errorHandler"` 18 | // Make Vue ignore custom elements defined outside of Vue (e.g., using the Web Components APIs). 19 | IgnoredElements []string `js:"ignoredElements"` 20 | // Define custom key alias(es) for v-on. 21 | KeyCodes map[string]int `js:"keyCodes"` 22 | } 23 | 24 | // Vue.extend( options ) 25 | // Arguments: 26 | // {Object} options 27 | // Usage: 28 | // Create a “subclass” of the base Vue constructor. The argument should be an object containing component options. 29 | // The special case to note here is the data option - it must be a function when used with Vue.extend(). 30 | func Extend(o *Option) *Component { 31 | vm := vue.Call("extend", o.prepare()) 32 | return &Component{ 33 | &ViewModel{ 34 | Object: vm, 35 | }, 36 | } 37 | } 38 | 39 | // Defer the callback to be executed after the next DOM update cycle. 40 | // Use it immediately after you’ve changed some data to wait for the DOM update. 41 | func NextTick(cb func()) { 42 | vue.Call("nextTick", cb) 43 | } 44 | 45 | // Vue.set( object, key, value ) 46 | // 47 | // Arguments: 48 | // 49 | // {Object} object 50 | // {String} key 51 | // {*} value 52 | // Returns: the set value. 53 | // 54 | // Set a property on an object. If the object is reactive, 55 | // ensure the property is created as a reactive property and 56 | // trigger view updates. This is primarily used to get 57 | // around the limitation that Vue cannot detect property additions. 58 | func Set(obj, key, value interface{}) { 59 | vue.Call("set", obj, key, value) 60 | } 61 | 62 | // Vue.delete( object, key ) 63 | // 64 | // Arguments: 65 | // 66 | // {Object} object 67 | // {String} key 68 | // Usage: 69 | // 70 | // Delete a property on an object. 71 | // If the object is reactive, ensure the deletion triggers view updates. 72 | // This is primarily used to get around the limitation that 73 | // Vue cannot detect property deletions, but you should rarely need to use it. 74 | func Delete(obj, key interface{}) { 75 | vue.Call("delete", obj, key) 76 | } 77 | 78 | // Vue.use( mixin ) 79 | // 80 | // Arguments: 81 | // 82 | // {Object | Function} plugin 83 | // Usage: 84 | // 85 | // Install a Vue.js plugin. If the plugin is an Object, it must expose an install method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument. 86 | // When this method is called on the same plugin multiple times, the plugin will be installed only once. 87 | func Use(plugin interface{}) { 88 | vue.Call("use", plugin) 89 | } 90 | 91 | // Vue.mixin( mixin ) 92 | // 93 | // Arguments: 94 | // 95 | // {Object} mixin 96 | // Usage: 97 | // 98 | // Apply a mixin globally, which affects every Vue instance created afterwards. This can be used by plugin authors to inject custom behavior into components. Not recommended in application code. 99 | func Mixin(mixin interface{}) { 100 | vue.Call("mixin", mixin) 101 | } 102 | 103 | // Vue.compile( template ) 104 | // 105 | // Arguments: 106 | // 107 | // {string} template 108 | // Usage: 109 | // 110 | // Compiles a template string into a render function. Only available in the standalone build. 111 | func Compile(template string) (renderFn *js.Object) { 112 | return vue.Call("compile", template).Get("render") 113 | } 114 | 115 | var Config = &TConfig{ 116 | Object: js.Global.Get("Object").New(), 117 | } 118 | -------------------------------------------------------------------------------- /filter.go: -------------------------------------------------------------------------------- 1 | package vue 2 | 3 | import ( 4 | "github.com/gopherjs/gopherjs/js" 5 | ) 6 | 7 | // Filter return interface{} to utilize GopherJS type convertion automatically 8 | type Filter func(oldValue *js.Object) (newValue interface{}) 9 | 10 | // using interface{} type here to utilize GopherJS type convertion automatically 11 | func NewFilter(fn func(oldValue *js.Object) (newValue interface{})) Filter { 12 | return Filter(fn) 13 | } 14 | 15 | func (f Filter) Register(name string) { 16 | vue.Call("filter", name, f) 17 | } 18 | -------------------------------------------------------------------------------- /inc_debug.go: -------------------------------------------------------------------------------- 1 | //+build debug 2 | 3 | package vue 4 | 5 | import _ "github.com/oskca/gopherjs-vue/jscode/debug" 6 | -------------------------------------------------------------------------------- /inc_minified.go: -------------------------------------------------------------------------------- 1 | //+build !debug 2 | 3 | package vue 4 | 5 | import _ "github.com/oskca/gopherjs-vue/jscode/minified" 6 | -------------------------------------------------------------------------------- /jscode/debug/inc.go: -------------------------------------------------------------------------------- 1 | package debug 2 | -------------------------------------------------------------------------------- /jscode/minified/inc.go: -------------------------------------------------------------------------------- 1 | package minifiled 2 | -------------------------------------------------------------------------------- /jscode/minified/vue-2.1.10.min.inc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Vue.js v2.1.10 3 | * (c) 2014-2017 Evan You 4 | * Released under the MIT License. 5 | */ 6 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Vue=t()}(this,function(){"use strict";function e(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function t(e){var t=parseFloat(e);return isNaN(t)?e:t}function n(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}function i(e,t){return ii.call(e,t)}function o(e){return"string"==typeof e||"number"==typeof e}function a(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function s(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function c(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function u(e,t){for(var n in t)e[n]=t[n];return e}function l(e){return null!==e&&"object"==typeof e}function f(e){return li.call(e)===fi}function p(e){for(var t={},n=0;n1?c(n):n;for(var r=c(arguments,1),i=0,o=n.length;i=0&&Gi[n].id>e.id;)n--;Gi.splice(Math.max(n,eo)+1,0,e)}else Gi.push(e);Qi||(Qi=!0,Ai(xe))}}function Ae(e){ro.clear(),Oe(e,ro)}function Oe(e,t){var n,r,i=Array.isArray(e);if((i||l(e))&&Object.isExtensible(e)){if(e.__ob__){var o=e.__ob__.dep.id;if(t.has(o))return;t.add(o)}if(i)for(n=e.length;n--;)Oe(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)Oe(e[r[n]],t)}}function Se(e){e._watchers=[];var t=e.$options;t.props&&Te(e,t.props),t.methods&&Ne(e,t.methods),t.data?Ee(e):k(e._data={},!0),t.computed&&Ie(e,t.computed),t.watch&&Le(e,t.watch)}function Te(e,t){var n=e.$options.propsData||{},r=e.$options._propKeys=Object.keys(t),i=!e.$parent;Mi.shouldConvert=i;for(var o=function(i){var o=r[i];A(e,o,P(o,t,n,e))},a=0;a-1:e.test(t)}function We(e,t){for(var n in e){var r=e[n];if(r){var i=Ke(r.componentOptions);i&&!t(i)&&(Ze(r),e[n]=null)}}}function Ze(e){e&&(e.componentInstance._inactive||we(e.componentInstance,"deactivated"),e.componentInstance.$destroy())}function Ge(e){var t={};t.get=function(){return vi},Object.defineProperty(e,"config",t),e.util=Fi,e.set=O,e.delete=S,e.nextTick=Ai,e.options=Object.create(null),vi._assetTypes.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,u(e.options.components,co),Be(e),ze(e),Ve(e),Je(e)}function Ye(e){for(var t=e.data,n=e,r=e;r.componentInstance;)r=r.componentInstance._vnode,r.data&&(t=Qe(r.data,t));for(;n=n.parent;)n.data&&(t=Qe(t,n.data));return Xe(t)}function Qe(e,t){return{staticClass:et(e.staticClass,t.staticClass),class:e.class?[e.class,t.class]:t.class}}function Xe(e){var t=e.class,n=e.staticClass;return n||t?et(n,tt(t)):""}function et(e,t){return e?t?e+" "+t:e:t||""}function tt(e){var t="";if(!e)return t;if("string"==typeof e)return e;if(Array.isArray(e)){for(var n,r=0,i=e.length;r-1?ko[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:ko[e]=/HTMLUnknownElement/.test(t.toString())}function it(e){if("string"==typeof e){if(e=document.querySelector(e),!e)return document.createElement("div")}return e}function ot(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&"multiple"in t.data.attrs&&n.setAttribute("multiple","multiple"),n)}function at(e,t){return document.createElementNS(bo[e],t)}function st(e){return document.createTextNode(e)}function ct(e){return document.createComment(e)}function ut(e,t,n){e.insertBefore(t,n)}function lt(e,t){e.removeChild(t)}function ft(e,t){e.appendChild(t)}function pt(e){return e.parentNode}function dt(e){return e.nextSibling}function vt(e){return e.tagName}function ht(e,t){e.textContent=t}function mt(e,t,n){e.setAttribute(t,n)}function gt(e,t){var n=e.data.ref;if(n){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[n])?r(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])&&a[n].indexOf(o)<0?a[n].push(o):a[n]=[o]:a[n]=o}}function yt(e){return null==e}function _t(e){return null!=e}function bt(e,t){return e.key===t.key&&e.tag===t.tag&&e.isComment===t.isComment&&!e.data==!t.data}function $t(e,t,n){var r,i,o={};for(r=t;r<=n;++r)i=e[r].key,_t(i)&&(o[i]=r);return o}function wt(e){function t(e){return new Hi(O.tagName(e).toLowerCase(),{},[],void 0,e)}function r(e,t){function n(){0===--n.listeners&&i(e)}return n.listeners=t,n}function i(e){var t=O.parentNode(e);t&&O.removeChild(t,e)}function a(e,t,n,r,i){if(e.isRootInsert=!i,!s(e,t,n,r)){var o=e.data,a=e.children,c=e.tag;_t(c)?(e.elm=e.ns?O.createElementNS(e.ns,c):O.createElement(c,e),v(e),f(e,a,t),_t(o)&&d(e,t),l(n,e.elm,r)):e.isComment?(e.elm=O.createComment(e.text),l(n,e.elm,r)):(e.elm=O.createTextNode(e.text),l(n,e.elm,r))}}function s(e,t,n,r){var i=e.data;if(_t(i)){var o=_t(e.componentInstance)&&i.keepAlive;if(_t(i=i.hook)&&_t(i=i.init)&&i(e,!1,n,r),_t(e.componentInstance))return c(e,t),o&&u(e,t,n,r),!0}}function c(e,t){e.data.pendingInsert&&t.push.apply(t,e.data.pendingInsert),e.elm=e.componentInstance.$el,p(e)?(d(e,t),v(e)):(gt(e),t.push(e))}function u(e,t,n,r){for(var i,o=e;o.componentInstance;)if(o=o.componentInstance._vnode,_t(i=o.data)&&_t(i=i.transition)){for(i=0;ip?(u=yt(n[m+1])?null:n[m+1].elm,h(e,u,n,f,m,r)):f>m&&g(e,t,l,p)}function b(e,t,n,r){if(e!==t){if(t.isStatic&&e.isStatic&&t.key===e.key&&(t.isCloned||t.isOnce))return t.elm=e.elm,void(t.componentInstance=e.componentInstance);var i,o=t.data,a=_t(o);a&&_t(i=o.hook)&&_t(i=i.prepatch)&&i(e,t);var s=t.elm=e.elm,c=e.children,u=t.children;if(a&&p(t)){for(i=0;i-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+e.getAttribute("class")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function zt(e,t){if(t&&t.trim())if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+e.getAttribute("class")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Vt(e){Yo(function(){Yo(e)})}function Jt(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Bt(e,t)}function Kt(e,t){e._transitionClasses&&r(e._transitionClasses,t),zt(e,t)}function qt(e,t,n){var r=Wt(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Jo?Wo:Go,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=Jo,l=a,f=o.length):t===Ko?u>0&&(n=Ko,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Jo:Ko:null,f=n?n===Jo?o.length:c.length:0);var p=n===Jo&&Qo.test(r[qo+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:p}}function Zt(e,t){for(;e.length1,j=n._enterCb=en(function(){E&&(Kt(n,k),Kt(n,x)),j.cancelled?(E&&Kt(n,C),T&&T(n)):S&&S(n),n._enterCb=null});e.data.show||ne(e.data.hook||(e.data.hook={}),"insert",function(){var t=n.parentNode,r=t&&t._pending&&t._pending[e.key];r&&r.tag===e.tag&&r.elm._leaveCb&&r.elm._leaveCb(),O&&O(n,j)},"transition-insert"),A&&A(n),E&&(Jt(n,C),Jt(n,x),Vt(function(){Jt(n,k),Kt(n,C),j.cancelled||I||qt(n,o,j)})),e.data.show&&(t&&t(),O&&O(n,j)),E||I||j()}}}function Qt(e,t){function n(){g.cancelled||(e.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[e.key]=e),l&&l(r),h&&(Jt(r,s),Jt(r,u),Vt(function(){Jt(r,c),Kt(r,s),g.cancelled||m||qt(r,a,g)})),f&&f(r,g),h||m||g())}var r=e.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var i=Xt(e.data.transition);if(!i)return t();if(!r._leaveCb&&1===r.nodeType){var o=i.css,a=i.type,s=i.leaveClass,c=i.leaveToClass,u=i.leaveActiveClass,l=i.beforeLeave,f=i.leave,p=i.afterLeave,d=i.leaveCancelled,v=i.delayLeave,h=o!==!1&&!bi,m=f&&(f._length||f.length)>1,g=r._leaveCb=en(function(){r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[e.key]=null),h&&(Kt(r,c),Kt(r,u)),g.cancelled?(h&&Kt(r,s),d&&d(r)):(t(),p&&p(r)),r._leaveCb=null});v?v(n):n()}}function Xt(e){if(e){if("object"==typeof e){var t={};return e.css!==!1&&u(t,Xo(e.name||"v")),u(t,e),t}return"string"==typeof e?Xo(e):void 0}}function en(e){var t=!1;return function(){t||(t=!0,e())}}function tn(e,t){t.data.show||Yt(t)}function nn(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s-1,a.selected!==o&&(a.selected=o);else if(h(on(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function rn(e,t){for(var n=0,r=t.length;n',n.innerHTML.indexOf(t)>0}function _n(e){return pa=pa||document.createElement("div"),pa.innerHTML=e,pa.textContent}function bn(e,t){return t&&(e=e.replace(os,"\n")),e.replace(rs,"<").replace(is,">").replace(as,"&").replace(ss,'"')}function $n(e,t){function n(t){f+=t,e=e.substring(t)}function r(){var t=e.match(Ca);if(t){var r={tagName:t[1],attrs:[],start:f};n(t[0].length);for(var i,o;!(i=e.match(xa))&&(o=e.match(ba));)n(o[0].length),r.attrs.push(o);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=f,r}}function i(e){var n=e.tagName,r=e.unarySlash;u&&("p"===s&&ma(n)&&o(s),ha(n)&&s===n&&o(n));for(var i=l(n)||"html"===n&&"head"===s||!!r,a=e.attrs.length,f=new Array(a),p=0;p=0&&c[i].lowerCasedTag!==o;i--);else i=0;if(i>=0){for(var a=c.length-1;a>=i;a--)t.end&&t.end(c[a].tag,n,r);c.length=i,s=i&&c[i-1].tag}else"br"===o?t.start&&t.start(e,[],!0,n,r):"p"===o&&(t.start&&t.start(e,[],!1,n,r),t.end&&t.end(e,n,r))}for(var a,s,c=[],u=t.expectHTML,l=t.isUnaryTag||pi,f=0;e;){if(a=e,s&&ts(s)){var p=s.toLowerCase(),d=ns[p]||(ns[p]=new RegExp("([\\s\\S]*?)(]*>)","i")),v=0,h=e.replace(d,function(e,n,r){return v=r.length,"script"!==p&&"style"!==p&&"noscript"!==p&&(n=n.replace(//g,"$1").replace(//g,"$1")),t.chars&&t.chars(n),""});f+=e.length-h.length,e=h,o(p,f-v,f)}else{var m=e.indexOf("<");if(0===m){if(Oa.test(e)){var g=e.indexOf("-->");if(g>=0){n(g+3);continue}}if(Sa.test(e)){var y=e.indexOf("]>");if(y>=0){n(y+2);continue}}var _=e.match(Aa);if(_){n(_[0].length);continue}var b=e.match(ka);if(b){var $=f;n(b[0].length),o(b[1],$,f);continue}var w=r();if(w){i(w);continue}}var C=void 0,x=void 0,k=void 0;if(m>0){for(x=e.slice(m);!(ka.test(x)||Ca.test(x)||Oa.test(x)||Sa.test(x)||(k=x.indexOf("<",1),k<0));)m+=k,x=e.slice(m);C=e.substring(0,m),n(m)}m<0&&(C=e,e=""),t.chars&&C&&t.chars(C)}if(e===a&&t.chars){t.chars(e);break}}o()}function wn(e){function t(){(a||(a=[])).push(e.slice(v,i).trim()),v=i+1}var n,r,i,o,a,s=!1,c=!1,u=!1,l=!1,f=0,p=0,d=0,v=0;for(i=0;i=0&&(m=e.charAt(h)," "===m);h--);m&&/[\w$]/.test(m)||(l=!0)}}else void 0===o?(v=i+1,o=e.slice(0,i).trim()):t();if(void 0===o?o=e.slice(0,i).trim():0!==v&&t(),a)for(i=0;ia&&o.push(JSON.stringify(e.slice(a,i)));var s=wn(r[1].trim());o.push("_s("+s+")"),a=i+r[0].length}return a=Ea}function Dn(e){return 34===e||39===e}function Pn(e){var t=1;for(La=Na;!Mn();)if(e=Ln(),Dn(e))Rn(e);else if(91===e&&t++,93===e&&t--,0===t){Ma=Na;break}}function Rn(e){for(var t=e;!Mn()&&(e=Ln(),e!==t););}function Fn(e,t){Da=t.warn||kn,Pa=t.getTagNamespace||pi,Ra=t.mustUseProp||pi,Fa=t.isPreTag||pi,Ha=An(t.modules,"preTransformNode"),Ua=An(t.modules,"transformNode"),Ba=An(t.modules,"postTransformNode"),za=t.delimiters;var n,r,i=[],o=t.preserveWhitespace!==!1,a=!1,s=!1;return $n(e,{expectHTML:t.expectHTML,isUnaryTag:t.isUnaryTag,shouldDecodeNewlines:t.shouldDecodeNewlines,start:function(e,o,c){function u(e){}var l=r&&r.ns||Pa(e);_i&&"svg"===l&&(o=rr(o));var f={type:1,tag:e,attrsList:o,attrsMap:tr(o),parent:r,children:[]};l&&(f.ns=l),nr(f)&&!xi()&&(f.forbidden=!0);for(var p=0;p-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),En(e,"click","var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$c){$$i<0&&("+t+"=$$a.concat($$v))}else{$$i>-1&&("+t+"=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{"+t+"=$$c}",null,!0)}function Jr(e,t,n){var r=n&&n.number,i=In(e,"value")||"null";i=r?"_n("+i+")":i,On(e,"checked","_q("+t+","+i+")"),En(e,"click",Wr(t,i),null,!0)}function Kr(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=o||_i&&"range"===r?"change":"input",u=!o&&"range"!==r,l="input"===e.tag||"textarea"===e.tag,f=l?"$event.target.value"+(s?".trim()":""):s?"(typeof $event === 'string' ? $event.trim() : $event)":"$event";f=a||"number"===r?"_n("+f+")":f;var p=Wr(t,f);l&&u&&(p="if($event.target.composing)return;"+p),On(e,"value",l?"_s("+t+")":"("+t+")"),En(e,c,p,null,!0),(s||a||"number"===r)&&En(e,"blur","$forceUpdate()")}function qr(e,t,n){var r=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(r?"_n(val)":"val")+"})"+(null==e.attrsMap.multiple?"[0]":""),o=Wr(t,i);En(e,"change",o,null,!0)}function Wr(e,t){var n=Nn(e);return null===n.idx?e+"="+t:"var $$exp = "+n.exp+", $$idx = "+n.idx+";if (!Array.isArray($$exp)){"+e+"="+t+"}else{$$exp.splice($$idx, 1, "+t+")}"}function Zr(e,t){t.value&&On(e,"textContent","_s("+t.value+")")}function Gr(e,t){t.value&&On(e,"innerHTML","_s("+t.value+")")}function Yr(e,t){return t=t?u(u({},js),t):js,Rr(e,t)}function Qr(e,t,n){var r=(t&&t.warn||Si,t&&t.delimiters?String(t.delimiters)+e:e);if(Is[r])return Is[r];var i={},o=Yr(e,t);i.render=Xr(o.render);var a=o.staticRenderFns.length;i.staticRenderFns=new Array(a);for(var s=0;s0,$i=yi&&yi.indexOf("edge/")>0,wi=yi&&yi.indexOf("android")>0,Ci=yi&&/iphone|ipad|ipod|ios/.test(yi),xi=function(){return void 0===ti&&(ti=!gi&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),ti},ki=gi&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Ai=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t1&&(t[n[0].trim()]=n[1].trim())}}),t}),Ro=/^--/,Fo=/\s*!important$/,Ho=function(e,t,n){Ro.test(t)?e.style.setProperty(t,n):Fo.test(n)?e.style.setProperty(t,n.replace(Fo,""),"important"):e.style[Bo(t)]=n},Uo=["Webkit","Moz","ms"],Bo=a(function(e){if(lo=lo||document.createElement("div"),e=ai(e),"filter"!==e&&e in lo.style)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n\/=]+)/,ya=/(?:=)/,_a=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],ba=new RegExp("^\\s*"+ga.source+"(?:\\s*("+ya.source+")\\s*(?:"+_a.join("|")+"))?"),$a="[a-zA-Z_][\\w\\-\\.]*",wa="((?:"+$a+"\\:)?"+$a+")",Ca=new RegExp("^<"+wa),xa=/^\s*(\/?)>/,ka=new RegExp("^<\\/"+wa+"[^>]*>"),Aa=/^]+>/i,Oa=/^