@colijnit/configuratorcore 262.1.0

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.
package/index.d.ts ADDED
@@ -0,0 +1,281 @@
1
+ import * as THREE from 'three';
2
+ import { Scene, Color, Side, Object3D, Vector3, Material as Material$1, Group, Mesh, BufferGeometry, Vector2, Texture, Camera } from 'three';
3
+ import { BehaviorSubject, Subject } from 'rxjs';
4
+ import { DecoNode } from '@colijnit/configuratorapi/build/model/deco-node.js';
5
+ import { Selection } from '@colijnit/configuratorapi/build/model/selection.js';
6
+ import { Answer } from '@colijnit/configuratorapi/build/model/answer.js';
7
+ import { SelectorStructure } from '@colijnit/configuratorapi/build/model/selector-structure.bo.js';
8
+
9
+ declare class Builder {
10
+ modelLoaded: BehaviorSubject<THREE.Object3D>;
11
+ set debug(value: Function);
12
+ get debug(): Function;
13
+ private _scene;
14
+ private _instanceId;
15
+ private _sku;
16
+ private _goodId;
17
+ private _assetPath;
18
+ private _selections;
19
+ private _answers;
20
+ private _decos;
21
+ private _placedAdjustables;
22
+ private _placedAddables;
23
+ private _adjustables;
24
+ private _addables;
25
+ private _debug;
26
+ private _imageCache;
27
+ private _boFactory;
28
+ private _source;
29
+ private _threedUtils;
30
+ private _variationHelper;
31
+ private _articleCache;
32
+ constructor();
33
+ init(scene: Scene): void;
34
+ buildModelFromData(selections: Selection[], decos: DecoNode[], assetUrl: string, cdnUrl: string, schema: string): Promise<THREE.Object3D>;
35
+ destroy(): void;
36
+ _cleanUp(): void;
37
+ private _handleResponseData;
38
+ private _preloadMaterials;
39
+ private _downloadAsset;
40
+ private _build;
41
+ private _prepareTheSelections;
42
+ private _linkSelectionsAndDecos;
43
+ private _getVariations;
44
+ private _loadVariations;
45
+ private _getAdjustables;
46
+ private _updatePivot;
47
+ private _reset;
48
+ private _log;
49
+ }
50
+
51
+ declare class VariationSettingsSettings {
52
+ repeatx: number;
53
+ repeaty: number;
54
+ roughness: number;
55
+ metalness: number;
56
+ }
57
+ declare class VariationSettings {
58
+ id: string;
59
+ settings: VariationSettingsSettings;
60
+ texture: string;
61
+ textureFilename: string;
62
+ normal: string;
63
+ normalFilename: string;
64
+ ao: string;
65
+ aoFilename: string;
66
+ metalness: string;
67
+ metalnessFilename: string;
68
+ roughness: string;
69
+ roughnessFilename: string;
70
+ orm: string;
71
+ ormFilename: string;
72
+ displacement: string;
73
+ displacementValue: number;
74
+ displacementFilename: string;
75
+ sheen: number;
76
+ sheenColor: Color;
77
+ sheenColorMap: string;
78
+ sheenColorMapFilename: string;
79
+ sheenRoughness: number;
80
+ sheenRoughnessMap: string;
81
+ sheenRoughnessMapFilename: string;
82
+ transmissionMap: string;
83
+ transmissionMapFilename: string;
84
+ emissive: string;
85
+ emissiveFilename: string;
86
+ emissiveIntensity: number;
87
+ emissiveValue: Color;
88
+ opacity: number;
89
+ transparent: boolean;
90
+ envMap: string;
91
+ envMapFilename: string;
92
+ envMapIntensity: number;
93
+ reflectivity: number;
94
+ side: Side;
95
+ transmission: number;
96
+ ior: number;
97
+ thickness: number;
98
+ specularIntensity: number;
99
+ loading: boolean;
100
+ loaded: Subject<VariationSettings>;
101
+ material: any;
102
+ copyFrom(settings: VariationSettings): void;
103
+ }
104
+
105
+ declare class VariationCacheHelper {
106
+ private _variations;
107
+ assetPath: string;
108
+ threeDAssetPath: string;
109
+ needsMaterials: boolean;
110
+ debug: Function;
111
+ destroy(): void;
112
+ preloadVariations(schema: string, decoNodes: DecoNode[], articleAssetPath?: string): void;
113
+ preloadVariationsAsync(schema: string, decoNodes: DecoNode[] | Answer[] | SelectorStructure[], articleAssetPath?: string): Promise<void>;
114
+ protected log(message: string): void;
115
+ protected loadCachedVariation(fileName: string): Promise<VariationSettings>;
116
+ private _get;
117
+ private _set;
118
+ private _waitForVariationToLoad;
119
+ private _createSettingsForFileName;
120
+ }
121
+
122
+ declare class VariationHelper extends VariationCacheHelper {
123
+ loadedAsset: string;
124
+ private _lastKnownVariations;
125
+ clearCache(): void;
126
+ loadPart(assetPath: string, parts: any[], obj: Object3D, usePbr?: boolean): Promise<void>;
127
+ loadVariation(assetPath: string, parts: any[], obj: Object3D, usePbr?: boolean): Promise<void>;
128
+ loadVariationFromLocalFile(id: string, file: any, obj: Object3D): Promise<void>;
129
+ loadVariationForMaterial(gameObject: string): Promise<any>;
130
+ loadVariationByAssetUrl(assetUrl: string): Promise<any>;
131
+ createVariationForMaterialPreview(compressedZip: Blob): Promise<any>;
132
+ private _applyMaterialPart;
133
+ private _applyVariations;
134
+ private _applyMaterial;
135
+ private _setMeshMaterialFromVariation;
136
+ private _setLastKnownVariations;
137
+ private _getLastKnownVariations;
138
+ private _getChildrenFilterByProp;
139
+ private _createVariationFromNode;
140
+ }
141
+
142
+ interface ChangesInterface {
143
+ name: string;
144
+ object: Object3D;
145
+ oldPosition: Vector3;
146
+ newPosition: Vector3;
147
+ oldMaterial?: Material$1;
148
+ newMaterial?: Material$1;
149
+ }
150
+
151
+ declare class Material {
152
+ name: string;
153
+ schema: string;
154
+ specular: THREE.Color;
155
+ shininess: number;
156
+ normal: THREE.Texture;
157
+ texture: THREE.Texture;
158
+ ao: THREE.Texture;
159
+ metalness: THREE.Texture;
160
+ roughness: THREE.Texture;
161
+ repeatX: number;
162
+ repeatY: number;
163
+ loaded: boolean;
164
+ metalnessValue: number;
165
+ roughnessValue: number;
166
+ displacement: THREE.Texture;
167
+ displacementValue: number;
168
+ sheen: number;
169
+ sheenColor: THREE.Color;
170
+ sheenColorMap: THREE.Texture | null;
171
+ sheenRoughness: number;
172
+ sheenRoughnessMap: THREE.Texture | null;
173
+ emissive: THREE.Texture;
174
+ emissiveValue: THREE.Color;
175
+ emissiveIntensityValue: number;
176
+ envMap: THREE.Texture;
177
+ envMapIntensity: number;
178
+ opacity: number;
179
+ transparent: boolean;
180
+ reflectivity: number;
181
+ side: Side;
182
+ ior: number;
183
+ transmission: number;
184
+ thickness: number;
185
+ specularIntensity: number;
186
+ transmissionMap: THREE.Texture | null;
187
+ clearcoatMap: THREE.Texture | null;
188
+ clearcoatRoughnessMap: THREE.Texture | null;
189
+ }
190
+
191
+ declare class ImageUtils {
192
+ static textures: Map<string, THREE.Texture>;
193
+ static CreateTextureFromBase64(id: string, base64: string, material: Material, defaultFlip?: boolean): Promise<THREE.Texture>;
194
+ static getFixedImageFilepathUrl(imageFilepathUrl: string): string;
195
+ static getDocBodyWithMimeTypeDefinition(fileName: string, documentBody: string): string;
196
+ static ClearCache(): void;
197
+ }
198
+
199
+ declare class ObjectUtils {
200
+ static materialProps: string[];
201
+ static CreateArrow(name: string, color: Color | number | string, length: number, direction: Vector3, headLength: number, headWidth: number, doubleArrow?: boolean): Group;
202
+ static UpdateArrowLength(arrow: Group, length: number, direction: Vector3, headLength: number, headWidth: number, doubleArrow?: boolean): Group;
203
+ static ChildOf(obj: Mesh | Object3D, parentName: string): boolean;
204
+ static GetParentItem(element: any): Object3D;
205
+ static GetDefaultMaterial(object: Object3D): Material$1;
206
+ static SameMaterial(first: Material$1, second: Material$1): boolean;
207
+ static GetChanges(firstItems: Object3D[], secondItems: Object3D[]): any;
208
+ static GetSelectionFromSelectedObject(object: any): Selection;
209
+ static UpdateUvs(geo: BufferGeometry): void;
210
+ static LoadHDRI(path: string, scene: Scene): Promise<void>;
211
+ static ProjectToPlane(points: Vector3[]): Vector2[];
212
+ static CloneMaterial(material: Material$1 | Material$1[], deepClone?: boolean): Material$1 | Material$1[];
213
+ /**
214
+ * ThreeJS does not clone image property, so it stays a reference to the original image.
215
+ * When deepClone, this method creates a new image and copies the original image data to it.
216
+ * @param texture
217
+ * @param deepClone
218
+ * @constructor
219
+ */
220
+ static CloneTexture(texture: Texture, deepClone?: boolean): Texture;
221
+ static CloneObject3D(source: Object3D): Object3D;
222
+ static DeepCloneObject3D(source: Object3D): Object3D;
223
+ static DisposeMaterial(material: Material$1 | Material$1[]): void;
224
+ static DisposeObject(object: Object3D | Mesh): void;
225
+ static GetParentCustomObject(element: any): Object3D;
226
+ private static DisposeNode;
227
+ private static _remapFloat;
228
+ }
229
+
230
+ declare class SelectionUtils {
231
+ static BuildFromAdjustables(scene: Scene, item: Object3D, adjustables: Selection[], placedAdjustables: Selection[], sourceObj: Object3D, activeConnector?: any, baseElementNodeId?: number): string[];
232
+ static LinkSelectionsAndDecos(selections: Selection[], decos: DecoNode[], variations: any[]): void;
233
+ static PrepareTheSelections(selections: Selection[], adjustables: any[], addables: any[]): void;
234
+ /**
235
+ * Returns the materialId of the parent up the tree until presentionlevel 1 is reached
236
+ * @param id
237
+ * @private
238
+ */
239
+ static GetMaterialIdFromParent(selections: Selection[], id: number): string;
240
+ static CreateAdjustable(item: Object3D, adj: Selection, placedAdjustables: Selection[], sourceObj: Object3D): Object3D;
241
+ static CreateAddable(sourceObj: Object3D, item: Object3D, placedAddables: Object3D[], add: Selection, part2?: any, part1?: any): Object3D;
242
+ static PlaceAddable(item: Object3D, placedAddables: Object3D[], add: any): Object3D;
243
+ static PlaceAddables(scene: Scene, sourceObj: Object3D, item: Object3D, placedAdjustables: Object3D[], placedAddables: Object3D[]): void;
244
+ static CreateUniqueName(item: Object3D, obj: Object3D): string;
245
+ static IsMoveableObject(obj: Object3D): boolean;
246
+ static AddElementOnConnector(currentItem: Object3D, element: Object3D, connector: string, connectedNodeId: number): void;
247
+ }
248
+
249
+ declare class ThreedUtils {
250
+ clips: any;
251
+ private _objectCache;
252
+ clearCache(): void;
253
+ download3DSource(fileName: string, setVisibleFalse?: boolean): Promise<THREE.Object3D>;
254
+ readFileAsText(file: File): Promise<string>;
255
+ loadJsonModel(filePath: string): Promise<any>;
256
+ loadJsonObjectModel(filePath: string): Promise<any>;
257
+ loadGlbModel(file: string, cleanUp?: boolean, dracoPath?: string): Promise<THREE.Object3D>;
258
+ loadGlbSource(file: string, setVisibleFalse?: boolean, dracoPath?: string): Promise<THREE.Object3D>;
259
+ textureFromUrl(url: string): Promise<any>;
260
+ cleanedUpObjectsWeb(object: Object3D, cleanUp?: boolean): Object3D;
261
+ private _cleanedUpObjects;
262
+ private _addGroupChildrenToObject;
263
+ private _iterateChildren;
264
+ private _readJsonFile;
265
+ private _handleUpdateProgressBar;
266
+ }
267
+
268
+ declare class DebugUtils {
269
+ static log(message: string): void;
270
+ }
271
+
272
+ declare class Scene3DUtil {
273
+ static updatePivot(obj: Object3D): void;
274
+ static TrySelectorConnection(scene: Scene, parent: Object3D, part1: any, part2: any, isFirstElement: boolean, createAddableFn?: Function): boolean;
275
+ static Convert3DPointToScreenPoint(point: Vector3, camera: Camera, width: number, height: number): Vector2;
276
+ static CanSelectorConnect(consPart1: Object3D[], con1: Object3D | any, con2: Object3D | any, startWithMale?: boolean): boolean;
277
+ private static SelectorConnect;
278
+ }
279
+
280
+ export { Builder, DebugUtils, ImageUtils, Material, ObjectUtils, Scene3DUtil, SelectionUtils, ThreedUtils, VariationCacheHelper, VariationHelper };
281
+ export type { ChangesInterface };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@colijnit/configuratorcore",
3
+ "version": "262.1.0",
4
+ "description": "iOne configurator core specific for version 262",
5
+ "license": "UNLICENSED",
6
+ "private": false,
7
+ "repository": "npm/npm",
8
+ "engines": {
9
+ "node": "20.19.2"
10
+ },
11
+ "engineStrict": true,
12
+ "dependencies": {
13
+ "@types/three": "0.178.1",
14
+ "@colijnit/configuratorapi": "262.1.2",
15
+ "@colijnit/ioneconnector": "262.1.2",
16
+ "axios": "0.27.2",
17
+ "jszip": "3.6.0",
18
+ "rxjs": "~7.4.0",
19
+ "three": "0.178.0",
20
+ "tslib": "^2.3.0"
21
+ },
22
+ "module": "fesm2022/colijnit-configuratorcore.mjs",
23
+ "typings": "index.d.ts",
24
+ "exports": {
25
+ "./package.json": {
26
+ "default": "./package.json"
27
+ },
28
+ ".": {
29
+ "types": "./index.d.ts",
30
+ "default": "./fesm2022/colijnit-configuratorcore.mjs"
31
+ }
32
+ },
33
+ "sideEffects": false
34
+ }