Skip to content

Commit 5e24c85

Browse files
author
Sascha Braun
committed
fix compiled version for easier package installation and usage: no more baseUrl / jsx usage in components
1 parent b2589a3 commit 5e24c85

24 files changed

+41
-29
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-threejs-composer",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"main": "build/src/index.js",
55
"typings": "build/src/index.d.ts",
66
"repository": "https://github.com/sascha245/vue-threejs-composer",

src/components/Axes.tsx renamed to src/components/Axes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ export class Axes extends Mixins(
5151
if (!this.m_created) {
5252
return null;
5353
}
54-
return <div>{this.$slots.default}</div>;
54+
return h("div", this.$slots.default);
5555
}
5656
}
File renamed without changes.

src/components/Camera.tsx renamed to src/components/Camera.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ export class Camera extends Mixins(ThreeComponent, ThreeSceneComponent) {
7474
if (!this.main || !this.m_created) {
7575
return null;
7676
}
77-
return <div>{this.$slots.default}</div>;
77+
return h("div", this.$slots.default);
7878
}
7979
}

src/components/Fog.tsx renamed to src/components/Fog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ export class Fog extends Mixins(ThreeComponent, ThreeSceneComponent) {
8686
if (!this.m_created) {
8787
return null;
8888
}
89-
return <div />;
89+
return h();
9090
}
9191
}

src/components/Geometry.tsx renamed to src/components/Geometry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export class Geometry extends Mixins(ThreeComponent, ThreeAssetComponent) {
2121
}
2222

2323
public render(h: any) {
24-
return <div />;
24+
return h();
2525
}
2626
}

src/components/Grid.tsx renamed to src/components/Grid.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as THREE from "three";
22
import { Component, Mixins, Prop, Provide } from "vue-property-decorator";
33

4-
import { AssetTypes, GeometryType, MaterialType } from "../types";
54
import { ThreeComponent, ThreeObjectComponent, ThreeSceneComponent } from "./base";
65

76
@Component
@@ -54,6 +53,6 @@ export class Grid extends Mixins(
5453
if (!this.m_created) {
5554
return null;
5655
}
57-
return <div>{this.$slots.default}</div>;
56+
return h("div", this.$slots.default);
5857
}
5958
}

src/components/Group.tsx renamed to src/components/Group.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ export class Group extends Mixins(
4646
if (!this.m_created) {
4747
return null;
4848
}
49-
return <div>{this.$slots.default}</div>;
49+
return h("div", this.$slots.default);
5050
}
5151
}

src/components/Light.tsx renamed to src/components/Light.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ export class Light extends Mixins(
5050
if (!this.m_created) {
5151
return null;
5252
}
53-
return <div>{this.$slots.default}</div>;
53+
return h("div", this.$slots.default);
5454
}
5555
}

src/components/Material.tsx renamed to src/components/Material.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export class Material extends Mixins(ThreeComponent, ThreeAssetComponent) {
2121
}
2222

2323
public render(h: any) {
24-
return <div />;
24+
return h();
2525
}
2626
}

src/components/Mesh.tsx renamed to src/components/Mesh.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class Mesh extends Mixins(
6969
if (!this.m_created) {
7070
return null;
7171
}
72-
return <div>{this.$slots.default}</div>;
72+
return h("div", this.$slots.default);
7373
}
7474

7575
private async createMeshFromModel() {

src/components/Model.tsx renamed to src/components/Model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Model extends Mixins(ThreeComponent, ThreeAssetComponent) {
4242
}
4343

4444
public render(h: any) {
45-
return <div />;
45+
return h();
4646
}
4747

4848
private overrideMaterials() {
File renamed without changes.

src/components/Scene.tsx renamed to src/components/Scene.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,9 @@ export class Scene extends Mixins(ThreeComponent) {
114114
return null;
115115
}
116116

117-
return (
118-
<div>
119-
<div>{this.$slots.preload}</div>
120-
<div>{this.m_isReady ? this.$slots.default : null}</div>
121-
</div>
122-
);
117+
return h("div", [
118+
h("div", this.$slots.preload),
119+
h("div", this.m_isReady ? this.$slots.default : null)
120+
]);
123121
}
124122
}

src/components/Texture.tsx renamed to src/components/Texture.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export class Texture extends Mixins(ThreeComponent, ThreeAssetComponent) {
3535
}
3636

3737
public render(h: any) {
38-
return <div />;
38+
return h();
3939
}
4040
}

src/components/Three.tsx renamed to src/components/Three.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CreateElement } from "vue";
12
import { Component, Prop, Provide, Vue, Watch } from "vue-property-decorator";
23

34
import { Application } from "../core";
@@ -88,7 +89,10 @@ export class Three extends Vue {
8889
}
8990
}
9091

91-
public render(h: any) {
92-
return <div>{this.isReady ? this.$slots.default : null}</div>;
92+
public render(h: CreateElement) {
93+
if (!this.isReady) {
94+
return null;
95+
}
96+
return h("div", this.$slots.default);
9397
}
9498
}

src/components/properties/Position.tsx renamed to src/components/properties/Position.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export class Position extends Mixins(ThreeObjectComponent) {
2525
}
2626

2727
public render(h: any) {
28-
return <div />;
28+
return h();
2929
}
3030
}

src/components/properties/Property.tsx renamed to src/components/properties/Property.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ export class Property extends Mixins(ThreeObjectComponent) {
3131
}
3232

3333
public render(h: any) {
34-
return <div />;
34+
return h();
3535
}
3636
}

src/components/properties/Rotation.tsx renamed to src/components/properties/Rotation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ export class Rotation extends Mixins(ThreeObjectComponent) {
4141
}
4242

4343
public render(h: any) {
44-
return <div />;
44+
return h();
4545
}
4646
}

src/components/properties/Scale.tsx renamed to src/components/properties/Scale.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export class Scale extends Mixins(ThreeObjectComponent) {
2525
}
2626

2727
public render(h: any) {
28-
return <div />;
28+
return h();
2929
}
3030
}

src/components/properties/Shadows.tsx renamed to src/components/properties/Shadows.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Shadows extends Mixins(ThreeObjectComponent) {
4242
}
4343

4444
public render(h: any) {
45-
return <div />;
45+
return h();
4646
}
4747

4848
private changeReceive(obj: THREE.Object3D) {

src/core/Utils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { ModelType, TextureType } from "src/types";
21
import * as THREE from "three";
32

3+
import { ModelType, TextureType } from "../types";
4+
45
const REGEXP_EXT = /(?:\.([^.]+))?$/;
56

67
export function getFileExtension(file: string) {

src/types.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@ import * as THREE from "three";
22

33
import { Application } from "./core";
44

5+
export type MeshMaterialType =
6+
| THREE.MeshBasicMaterial
7+
| THREE.MeshDepthMaterial
8+
| THREE.MeshFaceMaterial
9+
| THREE.MeshLambertMaterial
10+
| THREE.MeshNormalMaterial
11+
| THREE.MeshPhongMaterial
12+
| THREE.MeshStandardMaterial
13+
| THREE.ShaderMaterial
14+
| THREE.ShadowMaterial;
15+
516
export type GeometryType = THREE.Geometry | THREE.BufferGeometry;
6-
export type MaterialType = THREE.MeshMaterialType;
17+
export type MaterialType = MeshMaterialType;
718
export type TextureType = THREE.Texture;
819
export type ModelType = THREE.Object3D;
920

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"esModuleInterop": true,
1111
"allowSyntheticDefaultImports": true,
1212
"sourceMap": true,
13-
"baseUrl": ".",
1413
"types": ["webpack-env", "jest"],
1514
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
1615
},

0 commit comments

Comments
 (0)