Skip to content

Commit fb4ae62

Browse files
committed
Merge branch 'release/1.0-beta-7'
2 parents 5527ecb + 7d2bf3e commit fb4ae62

File tree

132 files changed

+7158
-12617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+7158
-12617
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ buildNumber.properties
3131
.classpath
3232
.project
3333
.settings
34+
.factorypath
3435

3536
### Gitbook
3637
docs-source/book/_book
3738
docs-source/book/node_modules
3839
docs-source/book/scripts
39-
docs-source/book/resources/scripts
40+
docs-source/book/resources/scripts
41+
42+
### Utils out
43+
utils/out
44+
utils/node_modules

core/pom.xml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@
77
<parent>
88
<groupId>com.axellience</groupId>
99
<artifactId>vue-gwt-parent</artifactId>
10-
<version>1.0-beta-6</version>
10+
<version>1.0-beta-7</version>
1111
</parent>
1212

13-
<artifactId>vue-gwt-core</artifactId>
14-
<name>Vue GWT Core</name>
15-
<description>Vue GWT Core classes</description>
13+
<artifactId>vue-gwt</artifactId>
14+
<name>Vue GWT</name>
15+
<description>Vue GWT core classes</description>
1616
<packaging>gwt-lib</packaging>
17+
18+
<properties>
19+
<maven.compiler.source>1.8</maven.compiler.source>
20+
<maven.compiler.target>1.8</maven.compiler.target>
21+
</properties>
1722

1823
<dependencies>
1924

2025
<!-- GWT dependencies -->
21-
<dependency>
22-
<groupId>com.google.gwt</groupId>
23-
<artifactId>gwt-user</artifactId>
24-
</dependency>
25-
<dependency>
26-
<groupId>com.google.gwt</groupId>
27-
<artifactId>gwt-dev</artifactId>
28-
</dependency>
2926
<dependency>
3027
<groupId>com.google.jsinterop</groupId>
3128
<artifactId>base</artifactId>
@@ -39,28 +36,6 @@
3936
<artifactId>elemental2-dom</artifactId>
4037
</dependency>
4138

42-
<!-- Code Generation -->
43-
<dependency>
44-
<groupId>com.squareup</groupId>
45-
<artifactId>javapoet</artifactId>
46-
</dependency>
47-
48-
<!-- Template parsing -->
49-
<dependency>
50-
<groupId>org.jsoup</groupId>
51-
<artifactId>jsoup</artifactId>
52-
</dependency>
53-
<dependency>
54-
<groupId>com.github.javaparser</groupId>
55-
<artifactId>javaparser-core</artifactId>
56-
</dependency>
57-
58-
<!-- Nashorn dependencies -->
59-
<dependency>
60-
<groupId>com.coveo</groupId>
61-
<artifactId>nashorn-commonjs-modules</artifactId>
62-
</dependency>
63-
6439
<!-- Injection -->
6540
<dependency>
6641
<groupId>javax.inject</groupId>
@@ -81,7 +56,7 @@
8156
<artifactId>gwt-maven-plugin</artifactId>
8257
<extensions>true</extensions>
8358
<configuration>
84-
<moduleName>com.axellience.vuegwt.Core</moduleName>
59+
<moduleName>com.axellience.vuegwt.VueGWT</moduleName>
8560
</configuration>
8661
</plugin>
8762
</plugins>

core/src/main/java/com/axellience/vuegwt/core/client/VueGWT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.axellience.vuegwt.core.client.observer.vuegwtobservers.MapObserver;
88
import com.axellience.vuegwt.core.client.vue.VueFactory;
99
import com.axellience.vuegwt.core.client.vue.VueJsConstructor;
10-
import com.google.gwt.core.client.JavaScriptObject;
10+
import elemental2.core.JsObject;
1111
import elemental2.dom.DomGlobal;
1212
import jsinterop.annotations.JsIgnore;
1313
import jsinterop.annotations.JsPackage;
@@ -101,7 +101,7 @@ public static <T extends VueComponent> T createInstance(Class<T> vueComponentCla
101101
@JsIgnore
102102
public static <T extends VueComponent> VueFactory<T> getFactory(Class<T> vueComponentClass)
103103
{
104-
if (JavaScriptObject.class.equals(vueComponentClass))
104+
if (JsObject.class.equals(vueComponentClass))
105105
{
106106
throw new RuntimeException(
107107
"You can't use the .class of a JsComponent to instantiate it. Please use MyComponentFactory.get() instead.");

core/src/main/java/com/axellience/vuegwt/core/client/VueLibDevInjector.java

Lines changed: 12 additions & 14 deletions
Large diffs are not rendered by default.

core/src/main/java/com/axellience/vuegwt/core/client/VueLibInjector.java

Lines changed: 12 additions & 4 deletions
Large diffs are not rendered by default.

core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.axellience.vuegwt.core.client.component.options.data.DataFactory;
88
import com.axellience.vuegwt.core.client.component.options.props.PropOptions;
99
import com.axellience.vuegwt.core.client.directive.options.VueDirectiveOptions;
10-
import com.axellience.vuegwt.core.client.template.ComponentTemplate;
1110
import elemental2.core.Function;
1211
import elemental2.core.JsArray;
1312
import elemental2.core.JsObject;
@@ -23,7 +22,6 @@
2322
import java.util.HashMap;
2423
import java.util.Map;
2524

26-
import static com.axellience.vuegwt.core.client.template.ComponentTemplate.EXPRESSION_PREFIX;
2725
import static elemental2.core.Global.JSON;
2826

2927
/**
@@ -40,65 +38,49 @@
4038
public class VueComponentOptions<T extends VueComponent> extends JsObject implements JsPropertyMap
4139
{
4240
private ComponentJavaPrototype<T> componentJavaPrototype;
43-
private ComponentTemplate<T> componentTemplate;
4441
private Map<String, Provider<?>> dependenciesProvider;
4542
private JsPropertyMap dataFields;
4643

4744
/**
4845
* Set the Java Prototype on this {@link VueComponentOptions}.
4946
* This prototype will be used to retrieve the java methods of our {@link VueComponent}.
50-
* @param javaPrototype An instance of the {@link ComponentTemplate} class for this
51-
* Component
47+
* @param javaPrototype The {@link ComponentJavaPrototype} for this Component
5248
*/
5349
@JsOverlay
5450
public final void setComponentJavaPrototype(ComponentJavaPrototype<T> javaPrototype)
5551
{
5652
this.componentJavaPrototype = javaPrototype;
5753
// This must be set for Components extending Native JS Components
5854
this.componentJavaPrototype.set("options", this);
59-
}
60-
61-
/**
62-
* Set the {@link ComponentTemplate} on this {@link VueComponentOptions}.
63-
* This instance will be used to retrieve the java methods of our {@link VueComponent}.
64-
* @param componentTemplate An instance of the {@link ComponentTemplate} class for this
65-
* Component
66-
*/
67-
@JsOverlay
68-
public final void setComponentTemplate(ComponentTemplate<T> componentTemplate)
69-
{
70-
this.componentTemplate = componentTemplate;
71-
this.initExpressions();
72-
this.initRenderFunctions();
55+
this.initTemplateExpressions();
7356
}
7457

7558
/**
7659
* Add template expressions to this {@link VueComponentOptions}.
7760
*/
7861
@JsOverlay
79-
private void initExpressions()
62+
private void initTemplateExpressions()
8063
{
81-
for (int i = 0; i < componentTemplate.getTemplateMethodsCount(); i++)
64+
int i = 0;
65+
Function templateMethod;
66+
while ((templateMethod = getJavaComponentMethod("exp$" + i)) != null)
8267
{
83-
String methodId = EXPRESSION_PREFIX + i;
84-
addMethod(methodId, componentTemplate.get(methodId));
68+
addMethod("exp$" + i, templateMethod);
69+
i++;
8570
}
8671
}
8772

8873
/**
8974
* Initialise the render functions from our template.
75+
* @param renderFunctionString The render function
76+
* @param staticRenderFnsStrings The static render functions
9077
*/
9178
@JsOverlay
92-
private void initRenderFunctions()
79+
public final void initRenderFunctions(Function renderFunctionString,
80+
Function[] staticRenderFnsStrings)
9381
{
94-
this.set("render", new Function(componentTemplate.getRenderFunction()));
95-
96-
JsArray<Object> staticRenderFns = new JsArray<>();
97-
for (String staticRenderFunction : componentTemplate.getStaticRenderFunctions())
98-
{
99-
staticRenderFns.push(new Function(staticRenderFunction));
100-
}
101-
this.setStaticRenderFns(staticRenderFns);
82+
this.setRender(renderFunctionString);
83+
this.setStaticRenderFns(Js.cast(staticRenderFnsStrings));
10284
}
10385

10486
/**
@@ -134,7 +116,7 @@ public final void initData(boolean useFactory, String... fieldNames)
134116
/**
135117
* Add a computed property to this ComponentOptions.
136118
* If the computed has both a getter and a setter, this will be called twice, once for each.
137-
* @param javaMethodName Name of the method in the {@link ComponentTemplate}
119+
* @param javaMethodName Name of the method in the {@link VueComponent}
138120
* @param computedPropertyName Name of the computed property in the Template and the
139121
* ComponentOptions
140122
* @param kind Kind of the computed method (getter or setter)
@@ -159,7 +141,7 @@ else if (kind == ComputedKind.SETTER)
159141

160142
/**
161143
* Add a watch property to this Component Definition
162-
* @param javaMethodName Name of the method in the {@link ComponentTemplate}
144+
* @param javaMethodName Name of the method in the {@link VueComponent}
163145
* @param watchedPropertyName Name of the property name to watch in the data model
164146
* @param isDeep Is the watcher deep (will watch child properties)
165147
*/
@@ -231,7 +213,7 @@ public final void addJavaProp(String propName, boolean required, String jsTypeNa
231213

232214
/**
233215
* Add a custom prop validator to validate a property
234-
* @param javaMethodName Name of the method in the {@link ComponentTemplate}
216+
* @param javaMethodName Name of the method in the {@link VueComponent}
235217
* @param propertyName The name of the property to validate
236218
*/
237219
@JsOverlay
@@ -243,7 +225,7 @@ public final void addJavaPropValidator(String javaMethodName, String propertyNam
243225

244226
/**
245227
* Add a custom prop validator to validate a property
246-
* @param javaMethodName Name of the method in the {@link ComponentTemplate}
228+
* @param javaMethodName Name of the method in the {@link VueComponent}
247229
* @param propertyName The name of the property to validate
248230
*/
249231
@JsOverlay
@@ -254,7 +236,7 @@ public final void addJavaPropDefaultValue(String javaMethodName, String property
254236
}
255237

256238
/**
257-
* Get the given java method from the {@link ComponentTemplate}.
239+
* Get the given java method from the {@link VueComponent}.
258240
* @param javaMethodName Name of the Java method to retrieve
259241
* @return The JS function that represent our Java method.
260242
*/
@@ -324,7 +306,8 @@ public final Map<String, Provider<?>> getProviders()
324306

325307
@JsProperty private String name;
326308

327-
@JsProperty private JsArray<Object> staticRenderFns;
309+
@JsProperty private Function render;
310+
@JsProperty private JsArray<Function> staticRenderFns;
328311

329312
@JsProperty private JsArray<Object> mixins;
330313

@@ -360,7 +343,7 @@ public final VueComponentOptions addProp(String name, PropOptions propOptions)
360343
if (this.props == null)
361344
this.props = JsPropertyMap.of();
362345

363-
((JsPropertyMap)this.props).set(name, propOptions);
346+
((JsPropertyMap) this.props).set(name, propOptions);
364347
return this;
365348
}
366349

@@ -481,18 +464,31 @@ public final VueComponentOptions setTemplate(String template)
481464
}
482465

483466
@JsOverlay
484-
public final JsArray<Object> getStaticRenderFns()
467+
public final JsArray<Function> getStaticRenderFns()
485468
{
486469
return staticRenderFns;
487470
}
488471

489472
@JsOverlay
490-
public final VueComponentOptions setStaticRenderFns(JsArray<Object> staticRenderFns)
473+
public final VueComponentOptions setStaticRenderFns(JsArray<Function> staticRenderFns)
491474
{
492475
this.staticRenderFns = staticRenderFns;
493476
return this;
494477
}
495478

479+
@JsOverlay
480+
public final Function getRender()
481+
{
482+
return render;
483+
}
484+
485+
@JsOverlay
486+
public final VueComponentOptions setRender(Function render)
487+
{
488+
this.render = render;
489+
return this;
490+
}
491+
496492
@JsOverlay
497493
public final JsPropertyMap<VueDirectiveOptions> getDirectives()
498494
{
@@ -554,7 +550,8 @@ public final JsArray<Object> getMixins()
554550
@JsOverlay
555551
public final VueComponentOptions addMixin(Object mixin)
556552
{
557-
if (this.mixins == null) {
553+
if (this.mixins == null)
554+
{
558555
this.mixins = new JsArray<>();
559556
}
560557

core/src/main/java/com/axellience/vuegwt/core/client/observer/VueGWTObserverManager.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.axellience.vuegwt.core.client.observer.functions.VueObserveArray;
44
import com.axellience.vuegwt.core.client.observer.functions.VueWalk;
5-
import com.google.gwt.core.client.JavaScriptObject;
65
import elemental2.core.JsArray;
76
import elemental2.core.JsObject;
87
import elemental2.dom.DomGlobal;
@@ -67,8 +66,8 @@ public void registerVueGWTObserver(VueGWTObserver observer)
6766
*/
6867
private boolean observeJavaObject(Object object)
6968
{
70-
// Ignore pure JS objects
71-
if (object.getClass() == JavaScriptObject.class)
69+
// Ignore pure JS objects, this is to avoid impacting pure Vue.js components
70+
if (object.getClass() == JsObject.class)
7271
return false;
7372

7473
// Don't observe Java classes

core/src/main/java/com/axellience/vuegwt/core/client/template/ComponentTemplate.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

core/src/main/java/com/axellience/vuegwt/core/client/vue/VueConfig.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.axellience.vuegwt.core.client.vue;
22

33
import elemental2.core.JsArray;
4+
import elemental2.core.JsString;
45
import jsinterop.annotations.JsOverlay;
56
import jsinterop.annotations.JsProperty;
67
import jsinterop.annotations.JsType;
8+
import jsinterop.base.Js;
79
import jsinterop.base.JsPropertyMap;
810

911
/**
@@ -19,7 +21,7 @@ public class VueConfig
1921
@JsProperty protected boolean performance;
2022
@JsProperty protected VueErrorHandler errorHandler;
2123
@JsProperty protected VueWarnHandler warnHandler;
22-
@JsProperty protected JsArray<String> ignoredElements;
24+
@JsProperty protected JsArray<JsString> ignoredElements;
2325
@JsProperty protected JsPropertyMap keyCodes;
2426

2527
@JsOverlay
@@ -114,13 +116,13 @@ public final VueConfig setWarnHandler(VueWarnHandler warnHandler)
114116
}
115117

116118
@JsOverlay
117-
public final JsArray<String> getIgnoredElements()
119+
public final JsArray<JsString> getIgnoredElements()
118120
{
119121
return ignoredElements;
120122
}
121123

122124
@JsOverlay
123-
public final VueConfig setIgnoredElements(JsArray<String> ignoredElements)
125+
public final VueConfig setIgnoredElements(JsArray<JsString> ignoredElements)
124126
{
125127
this.ignoredElements = ignoredElements;
126128
return this;
@@ -132,7 +134,7 @@ public final VueConfig addIgnoredElement(String ignoredElement)
132134
if (this.ignoredElements == null)
133135
this.ignoredElements = new JsArray<>();
134136

135-
this.ignoredElements.push(ignoredElement);
137+
this.ignoredElements.push(Js.cast(ignoredElement));
136138
return this;
137139
}
138140

0 commit comments

Comments
 (0)