@colijnit/configurator 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/app/builder.d.ts +53 -0
  2. package/app/components/answers/answer/answer.component.d.ts +11 -0
  3. package/app/components/answers/answers.component.d.ts +8 -0
  4. package/app/components/answers/answers.module.d.ts +2 -0
  5. package/app/components/selections/selections.component.d.ts +22 -0
  6. package/app/components/selections/selections.module.d.ts +2 -0
  7. package/app/components/shared/loader/loader.component.d.ts +2 -0
  8. package/app/components/shared/shared.module.d.ts +2 -0
  9. package/app/directives/visibility-observer-master.directive.d.ts +9 -0
  10. package/app/directives/visibility-observer.directive.d.ts +13 -0
  11. package/app/services/configurator.service.d.ts +22 -0
  12. package/app/services/image-cache.service.d.ts +10 -0
  13. package/app/services/locator.service.d.ts +4 -0
  14. package/bundles/colijnit-configurator.umd.js +2745 -0
  15. package/bundles/colijnit-configurator.umd.js.map +1 -0
  16. package/bundles/colijnit-configurator.umd.min.js +17 -0
  17. package/bundles/colijnit-configurator.umd.min.js.map +1 -0
  18. package/colijnit-configurator.d.ts +10 -0
  19. package/colijnit-configurator.metadata.json +1 -0
  20. package/esm2015/app/builder.js +477 -0
  21. package/esm2015/app/components/answers/answer/answer.component.js +69 -0
  22. package/esm2015/app/components/answers/answers.component.js +43 -0
  23. package/esm2015/app/components/answers/answers.module.js +29 -0
  24. package/esm2015/app/components/selections/selections.component.js +134 -0
  25. package/esm2015/app/components/selections/selections.module.js +23 -0
  26. package/esm2015/app/components/shared/loader/loader.component.js +24 -0
  27. package/esm2015/app/components/shared/shared.module.js +21 -0
  28. package/esm2015/app/directives/visibility-observer-master.directive.js +51 -0
  29. package/esm2015/app/directives/visibility-observer.directive.js +57 -0
  30. package/esm2015/app/services/configurator.service.js +94 -0
  31. package/esm2015/app/services/image-cache.service.js +66 -0
  32. package/esm2015/app/services/locator.service.js +10 -0
  33. package/esm2015/colijnit-configurator.js +11 -0
  34. package/esm2015/helper/variation-helper.js +216 -0
  35. package/esm2015/model/material.js +11 -0
  36. package/esm2015/model/variation-settings.js +6 -0
  37. package/esm2015/model/variation.js +3 -0
  38. package/esm2015/public_api.js +7 -0
  39. package/esm2015/utils/asset.utils.js +74 -0
  40. package/esm2015/utils/file.utils.js +139 -0
  41. package/esm2015/utils/image.utils.js +52 -0
  42. package/esm2015/utils/object.utils.js +49 -0
  43. package/esm2015/utils/scene-utils.js +94 -0
  44. package/esm2015/utils/threed.utils.js +222 -0
  45. package/esm2015/utils/variation-utils.js +224 -0
  46. package/esm5/app/builder.js +591 -0
  47. package/esm5/app/components/answers/answer/answer.component.js +64 -0
  48. package/esm5/app/components/answers/answers.component.js +27 -0
  49. package/esm5/app/components/answers/answers.module.js +32 -0
  50. package/esm5/app/components/selections/selections.component.js +104 -0
  51. package/esm5/app/components/selections/selections.module.js +26 -0
  52. package/esm5/app/components/shared/loader/loader.component.js +16 -0
  53. package/esm5/app/components/shared/shared.module.js +24 -0
  54. package/esm5/app/directives/visibility-observer-master.directive.js +64 -0
  55. package/esm5/app/directives/visibility-observer.directive.js +59 -0
  56. package/esm5/app/services/configurator.service.js +160 -0
  57. package/esm5/app/services/image-cache.service.js +69 -0
  58. package/esm5/app/services/locator.service.js +13 -0
  59. package/esm5/colijnit-configurator.js +11 -0
  60. package/esm5/helper/variation-helper.js +268 -0
  61. package/esm5/model/material.js +13 -0
  62. package/esm5/model/variation-settings.js +8 -0
  63. package/esm5/model/variation.js +7 -0
  64. package/esm5/public_api.js +7 -0
  65. package/esm5/utils/asset.utils.js +106 -0
  66. package/esm5/utils/file.utils.js +151 -0
  67. package/esm5/utils/image.utils.js +56 -0
  68. package/esm5/utils/object.utils.js +56 -0
  69. package/esm5/utils/scene-utils.js +98 -0
  70. package/esm5/utils/threed.utils.js +279 -0
  71. package/esm5/utils/variation-utils.js +327 -0
  72. package/fesm2015/colijnit-configurator.js +2109 -0
  73. package/fesm2015/colijnit-configurator.js.map +1 -0
  74. package/fesm5/colijnit-configurator.js +2527 -0
  75. package/fesm5/colijnit-configurator.js.map +1 -0
  76. package/helper/variation-helper.d.ts +14 -0
  77. package/model/material.d.ts +17 -0
  78. package/model/variation-settings.d.ts +14 -0
  79. package/model/variation.d.ts +10 -0
  80. package/package.json +12 -45
  81. package/{src/public_api.ts → public_api.d.ts} +6 -6
  82. package/utils/asset.utils.d.ts +13 -0
  83. package/utils/file.utils.d.ts +27 -0
  84. package/utils/image.utils.d.ts +8 -0
  85. package/utils/object.utils.d.ts +7 -0
  86. package/utils/scene-utils.d.ts +7 -0
  87. package/utils/threed.utils.d.ts +16 -0
  88. package/utils/variation-utils.d.ts +12 -0
  89. package/.idea/Configurator.iml +0 -12
  90. package/.idea/codeStyles/Project.xml +0 -21
  91. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  92. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  93. package/.idea/misc.xml +0 -9
  94. package/.idea/modules.xml +0 -8
  95. package/.idea/vcs.xml +0 -6
  96. package/angular.json +0 -193
  97. package/configurator.iml +0 -11
  98. package/dist/configurator/index.html +0 -14
  99. package/dist/configurator/main-es2015.js +0 -3129
  100. package/dist/configurator/main-es2015.js.map +0 -1
  101. package/dist/configurator/main-es5.js +0 -5482
  102. package/dist/configurator/main-es5.js.map +0 -1
  103. package/dist/configurator/polyfills-es2015.js +0 -4520
  104. package/dist/configurator/polyfills-es2015.js.map +0 -1
  105. package/dist/configurator/polyfills-es5.js +0 -18375
  106. package/dist/configurator/polyfills-es5.js.map +0 -1
  107. package/dist/configurator/runtime-es2015.js +0 -155
  108. package/dist/configurator/runtime-es2015.js.map +0 -1
  109. package/dist/configurator/runtime-es5.js +0 -155
  110. package/dist/configurator/runtime-es5.js.map +0 -1
  111. package/dist/configurator/styles-es2015.js +0 -450
  112. package/dist/configurator/styles-es2015.js.map +0 -1
  113. package/dist/configurator/styles-es5.js +0 -432
  114. package/dist/configurator/styles-es5.js.map +0 -1
  115. package/dist/configurator/vendor-es2015.js +0 -155551
  116. package/dist/configurator/vendor-es2015.js.map +0 -1
  117. package/dist/configurator/vendor-es5.js +0 -183588
  118. package/dist/configurator/vendor-es5.js.map +0 -1
  119. package/ng-package.json +0 -9
  120. package/src/app/app.component.ts +0 -222
  121. package/src/app/app.module.ts +0 -34
  122. package/src/app/builder.ts +0 -480
  123. package/src/app/components/answers/answer/answer.component.ts +0 -61
  124. package/src/app/components/answers/answers.component.ts +0 -41
  125. package/src/app/components/answers/answers.module.ts +0 -26
  126. package/src/app/components/selections/selections.component.ts +0 -131
  127. package/src/app/components/selections/selections.module.ts +0 -20
  128. package/src/app/components/shared/loader/loader.component.scss +0 -33
  129. package/src/app/components/shared/loader/loader.component.ts +0 -20
  130. package/src/app/components/shared/shared.module.ts +0 -16
  131. package/src/app/directives/visibility-observer-master.directive.ts +0 -71
  132. package/src/app/directives/visibility-observer.directive.ts +0 -74
  133. package/src/app/services/configurator.service.ts +0 -86
  134. package/src/app/services/image-cache.service.ts +0 -56
  135. package/src/app/services/locator.service.ts +0 -6
  136. package/src/environments/environment.prod.ts +0 -3
  137. package/src/environments/environment.ts +0 -8
  138. package/src/helper/variation-helper.ts +0 -220
  139. package/src/index.html +0 -14
  140. package/src/main.ts +0 -11
  141. package/src/model/material.ts +0 -22
  142. package/src/model/variation-settings.ts +0 -14
  143. package/src/model/variation.ts +0 -11
  144. package/src/polyfills.ts +0 -73
  145. package/src/style/shared.scss +0 -173
  146. package/src/style/styles.scss +0 -45
  147. package/src/tsconfig.app.json +0 -16
  148. package/src/tsconfig.spec.json +0 -19
  149. package/src/utils/asset.utils.ts +0 -88
  150. package/src/utils/file.utils.ts +0 -156
  151. package/src/utils/file.utils.unit.test.ts +0 -8
  152. package/src/utils/image.utils.ts +0 -54
  153. package/src/utils/object.utils.ts +0 -52
  154. package/src/utils/scene-utils.ts +0 -119
  155. package/src/utils/threed.utils.ts +0 -219
  156. package/src/utils/variation-utils.ts +0 -216
  157. package/tsconfig.json +0 -23
  158. package/tslint.json +0 -132
package/ng-package.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "src/public_api.ts"
5
- },
6
- "whitelistedNonPeerDependencies": [
7
- "."
8
- ]
9
- }
@@ -1,222 +0,0 @@
1
- import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from "@angular/core";
2
- import * as THREE from "three";
3
- import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
4
- import {Builder} from "./builder";
5
- import {Options} from "@colijnit/ioneconnector/build/model/options";
6
- import axios from "axios";
7
- import {GLTFLoader} from "three/examples/jsm/loaders/GLTFLoader";
8
- import {Subscription} from "rxjs";
9
- import {Selection} from "@colijnit/configuratorapi/build/model/selection";
10
- import {Answer} from "@colijnit/configuratorapi/build/model/answer";
11
- import {ConfiguratorService} from './services/configurator.service';
12
- import {AmbientLight, DirectionalLight, HemisphereLight, Object3D, SpotLight} from 'three';
13
-
14
- // @ts-ignore
15
- window.loadGLTF = async (file: string) => {
16
- const gltfLoader: GLTFLoader = new GLTFLoader();
17
- try {
18
- return new Promise((resolve: Function) => {
19
- gltfLoader.load(file, (obj) => {
20
- resolve(obj.scene);
21
- });
22
- });
23
- } catch (e) {
24
- console.error(e);
25
- return null;
26
- }
27
- };
28
- // @ts-ignore
29
- window.downloadVariation = async (fileName: string) => {
30
- const response: any = await axios({
31
- method: "get",
32
- url: `https://cdn1.colijn-it.nl/${fileName}`,
33
- responseType: "arraybuffer"
34
- });
35
- if (response.status !== 200) {
36
- throw Error(response.statusText);
37
- }
38
- return await response.data;
39
- };
40
-
41
- @Component({
42
- selector: 'app-root',
43
- template: `
44
- <div #canvas class="canvas"></div>
45
- <selections *ngIf="!showAnswers" [selections]="selections" (selectionClick)="selectSelection($event)"></selections>
46
- <answers *ngIf="showAnswers" [selectionTitle]="selectionTitle" [answers]="answers" (answerClick)="selectAnswer($event)"></answers>
47
- `
48
- })
49
- export class AppComponent implements AfterViewInit, OnDestroy {
50
-
51
- @ViewChild('canvas', {read: ElementRef})
52
- public canvasElement: ElementRef;
53
-
54
- public selectionTitle: string;
55
- public selections: Selection[] = [];
56
- public answers: Answer[] = [];
57
-
58
- public showAnswers: boolean = false;
59
- public showSelections: boolean = true;
60
-
61
- private _builder: Builder;
62
- private _object: THREE.Object3D;
63
- private scene: THREE.Scene = new THREE.Scene();
64
- private renderer: THREE.WebGLRenderer;
65
- private camera: THREE.PerspectiveCamera;
66
- private controls: OrbitControls;
67
- private _subs: Subscription[] = [];
68
- private _options: Options = {
69
- url: "http://130.62.7.180:8082/ione",
70
- version: "251",
71
- schema: "815"
72
- };
73
- private _instanceId: string = undefined;
74
- private _sku: string = '1000234793';
75
-
76
- constructor(private _configuratorService: ConfiguratorService) {}
77
-
78
- ngAfterViewInit(): void {
79
- this._builder = new Builder(this.scene, this._options, true);
80
- this._subs.push(
81
- this._builder.selectionsReceived.subscribe((selections: Selection[]) => {
82
- this.selections = selections;
83
- }),
84
- this._builder.answersReceived.subscribe((answers: Answer[]) => {
85
- this.answers = answers;
86
- this.showAnswers = this.answers.length > 0;
87
- }),
88
- this._builder.modelLoaded.subscribe((object: Object3D) => {
89
- if (object && this.answers.length === 0) {
90
- this._loadModel(object);
91
- }
92
- })
93
- );
94
- this._initScene();
95
- this._initRenderer();
96
- this._initCameraAndControls();
97
- this._initLights();
98
- // this._test();
99
- this._animate();
100
- this._builder.buildModel(this._sku, this._instanceId);
101
- }
102
-
103
- ngOnDestroy(): void {
104
- this._subs.forEach(s => s.unsubscribe());
105
- }
106
-
107
- public disableControls(): void {
108
- this.controls.enabled = false;
109
- }
110
-
111
- public enableControls(): void {
112
- this.controls.enabled = true;
113
- }
114
-
115
- public selectSelection(selection: Selection): void {
116
- this._builder.selectSelection(selection);
117
- this.selectionTitle = selection.commercialQuestion;
118
- this.showSelections = false;
119
- }
120
-
121
- public selectAnswer(answer: Answer): void {
122
- this._builder.selectAnswer(answer);
123
- this.selectionTitle = ' . . / ' + answer.answer;
124
- }
125
-
126
- private _initScene(): void {
127
- this.scene = new THREE.Scene();
128
- }
129
-
130
- private _initRenderer(): void {
131
- this.renderer = new THREE.WebGLRenderer({
132
- alpha: true,
133
- antialias: true,
134
- preserveDrawingBuffer: true
135
- });
136
- this.renderer.setClearColor(0xfafafa);
137
- this.renderer.autoClear = true;
138
- this.renderer.setPixelRatio(window.devicePixelRatio);
139
- this.renderer.shadowMap.enabled = true;
140
- // Use PCFShadowMap to enable radius else use PCFSoftShadowMap
141
- this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
142
- this.renderer.outputEncoding = THREE.LinearEncoding;
143
- // this.renderer.gammaFactor = 2.2;
144
- // this.renderer.toneMappingExposure = 1.1;
145
- this.canvasElement.nativeElement.appendChild(this.renderer.domElement);
146
- }
147
-
148
- private _initCameraAndControls(): void {
149
- this.camera = new THREE.PerspectiveCamera(45, 1, 0.01, 100);
150
- this.controls = new OrbitControls( this.camera, this.renderer.domElement );
151
- this.camera.position.set(0, 3, 1.5);
152
- this.controls.update();
153
- }
154
-
155
- private _animate(): void {
156
- this.renderer.setAnimationLoop(() => this._render());
157
- }
158
-
159
- private _render(): void {
160
- this._checkCanvasResize();
161
- this.renderer.render(this.scene, this.camera);
162
- }
163
-
164
- private _checkCanvasResize(): void {
165
- const canvas = this.renderer.domElement;
166
- if (this.canvasElement.nativeElement.clientWidth !== canvas.width || this.canvasElement.nativeElement.clientHeight !== canvas.height) {
167
- this._updateWindowSize();
168
- }
169
- }
170
-
171
- private _updateWindowSize() {
172
- this._resizeRendererToDisplaySize();
173
- const canvas = this.renderer.domElement;
174
- const aspect = canvas.width / canvas.height;
175
- this.camera.aspect = aspect;
176
- (this.camera as THREE.PerspectiveCamera).updateProjectionMatrix();
177
- }
178
-
179
- private _resizeRendererToDisplaySize() {
180
- this.renderer.setSize(this.canvasElement.nativeElement.clientWidth, this.canvasElement.nativeElement.clientHeight, false);
181
- }
182
-
183
- private _test(): void {
184
- const mat: THREE.MeshBasicMaterial = new THREE.MeshBasicMaterial({color: 'blue'});
185
- const geo: THREE.BoxGeometry = new THREE.BoxGeometry(1, 1, 1);
186
- const mesh: THREE.Mesh = new THREE.Mesh(geo, mat);
187
- this.scene.add(mesh);
188
- }
189
-
190
- private async _loadModel(object: Object3D): Promise<void> {
191
- object.name = this._sku;
192
- object.visible = true;
193
- const objectFromScene = this.scene.getObjectByName(this._sku);
194
- if (objectFromScene) {
195
- this.scene.remove(objectFromScene);
196
- }
197
- this.scene.add(object);
198
- }
199
-
200
- private _initLights(): void {
201
- const ambientLight: AmbientLight = new AmbientLight('#595959', 1.2);
202
- ambientLight.name = 'ambientLight';
203
- const directional: DirectionalLight = new DirectionalLight('white', 1);
204
- directional.position.set(0, 4, 0);
205
- directional.castShadow = true;
206
- const spotLight1 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
207
- spotLight1.position.set(-15, 9 , -15);
208
- spotLight1.castShadow = true;
209
- const spotLight2 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
210
- spotLight2.position.set(15, 9 , -15);
211
- spotLight2.castShadow = true;
212
- const spotLight3 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
213
- spotLight3.position.set(-15, 9 , 15);
214
- spotLight3.castShadow = true;
215
- const spotLight4 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
216
- spotLight4.position.set(15, 9 , 15);
217
- spotLight4.castShadow = true;
218
- const hemiSphere = new HemisphereLight('white', 'white', 0.15);
219
-
220
- this.scene.add(ambientLight, directional, spotLight1, spotLight2, spotLight3, spotLight4, hemiSphere);
221
- }
222
- }
@@ -1,34 +0,0 @@
1
- import {NgModule} from '@angular/core';
2
- import {AppComponent} from "./app.component";
3
- import {CommonModule} from "@angular/common";
4
- import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
5
- import {SelectionsModule} from "./components/selections/selections.module";
6
- import {AnswersModule} from "./components/answers/answers.module";
7
- import {Builder} from './builder';
8
-
9
- @NgModule({
10
- imports: [
11
- BrowserAnimationsModule,
12
- CommonModule,
13
- SelectionsModule,
14
- AnswersModule
15
- ],
16
- providers: [
17
- Builder
18
- ],
19
- declarations: [
20
- AppComponent
21
- ],
22
- entryComponents: [
23
- AppComponent
24
- ],
25
- exports: [
26
- AppComponent
27
- ],
28
- bootstrap: [
29
- AppComponent
30
- ]
31
- })
32
-
33
- export class AppModule {
34
- }