redhotmagma-visualization 1.28.0-beta.2 → 1.28.2
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/README.md +4 -11
- package/babel.config.js +41 -0
- package/package.json +72 -6
- package/public/libs/draco/README.md +32 -0
- package/public/libs/draco/draco_decoder.js +52 -0
- package/public/libs/draco/draco_decoder.wasm +0 -0
- package/public/libs/draco/draco_encoder.js +33 -0
- package/public/libs/draco/draco_wasm_wrapper.js +104 -0
- package/public/libs/draco/gltf/draco_decoder.js +48 -0
- package/public/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/public/libs/draco/gltf/draco_encoder.js +33 -0
- package/public/libs/draco/gltf/draco_wasm_wrapper.js +104 -0
- package/scripts/cpPath.js +151 -0
- package/scripts/cpPublic.js +39 -0
- package/scripts/moveLibToPackageRoot.js +44 -0
- package/scripts/utils/fileSystem.js +69 -0
- package/scripts/utils/process.js +19 -0
- package/src/CommonUtils/Observable.js +0 -1
- package/src/CommonUtils/pointerEvent.js +1 -2
- package/src/DevApp.js +1 -2
- package/src/FallbackVisualization.js +5 -1
- package/src/PrintingEffects/DomingEffect.js +0 -1
- package/src/PrintingEffects/EmbroideryEffect.js +2 -3
- package/src/React/ReactBase.js +1 -1
- package/src/Three/Controls/OrbitControls.js +0 -2
- package/src/Three/Loaders/ColladaLoader.js +294 -111
- package/src/Three/Loaders/MTLLoader.js +0 -2
- package/src/Three/Loaders/OBJLoader.js +0 -2
- package/src/Three/Three2D.js +6 -7
- package/src/Three/Three3D.js +1 -9
- package/src/Three/ThreeBase.js +1 -10
- package/src/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -1
- package/src/Utils/TextureBuilder/createTextureBuilder.js +0 -2
- package/src/Utils/imagePreloader.js +0 -1
- package/src/Utils/initTextureCanvas.js +0 -3
- package/src/Utils/isMobileDevice.js +0 -2
- package/src/Utils/optimizeTextureImage.js +0 -1
- package/src/VisualizationContainer.js +1 -3
- package/src/VisualizationInterface.js +1 -10
- package/tsconfig.json +22 -0
- package/AlignTargetProvider.js +0 -129
- package/CommonUtils/Deferred.js +0 -135
- package/CommonUtils/Observable.js +0 -126
- package/CommonUtils/PropertyObserver.js +0 -61
- package/CommonUtils/SyncCurrentFunction.js +0 -59
- package/CommonUtils/SyncObservableEvent.js +0 -19
- package/CommonUtils/pointerEvent.js +0 -415
- package/Constants.js +0 -23
- package/DevApp.js +0 -1049
- package/ExposedModules.js +0 -26
- package/FallbackVisualization.js +0 -26
- package/PrintingEffects/ColorEmbossingEffect.js +0 -58
- package/PrintingEffects/DomingEffect.js +0 -150
- package/PrintingEffects/EmbossingEffect.js +0 -65
- package/PrintingEffects/EmbroideryEffect.js +0 -541
- package/PrintingEffects/EngravingEffect.js +0 -65
- package/PrintingEffects/PrintingEffects.js +0 -117
- package/PrintingEffects/PrintingEffectsUtils.js +0 -53
- package/PrintingEffects/resources/embroidery_multiply.jpg +0 -0
- package/PrintingEffects/resources/embroidery_screen.jpg +0 -0
- package/React/ReactBase.js +0 -111
- package/Three/Controls/OrbitControls.js +0 -745
- package/Three/Exporters/glTFExporter.js +0 -48
- package/Three/Loaders/ColladaLoader.js +0 -2916
- package/Three/Loaders/MTLLoader.js +0 -449
- package/Three/Loaders/OBJLoader.js +0 -548
- package/Three/Three2D.js +0 -1778
- package/Three/Three2DLayers.js +0 -504
- package/Three/Three3D.js +0 -1412
- package/Three/Three3DScene.js +0 -1432
- package/Three/ThreeBase.js +0 -722
- package/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -32
- package/Utils/TextureBuilder/createTextureBuilder.js +0 -334
- package/Utils/TextureBuilder/textureBuilderFunctions.js +0 -87
- package/Utils/alignToElement.js +0 -58
- package/Utils/createAlphaMapFromAlphaChannel.js +0 -50
- package/Utils/createCache.js +0 -46
- package/Utils/createCanvas.js +0 -29
- package/Utils/createImageRepository.js +0 -124
- package/Utils/disposeMaterial.js +0 -41
- package/Utils/getImageSize.js +0 -15
- package/Utils/imagePreloader.js +0 -76
- package/Utils/initTextureCanvas.js +0 -49
- package/Utils/isMobileDevice.js +0 -19
- package/Utils/optimizeTextureImage.js +0 -73
- package/Utils/rememberCameraViewOffset.js +0 -21
- package/Utils/removeObject.js +0 -22
- package/Utils/restrictCameraMovement.js +0 -45
- package/Utils/setOrthographicCameraSize.js +0 -16
- package/Utils/updateFitSizeToElement.js +0 -39
- package/VisualizationContainer.js +0 -279
- package/VisualizationInterface.js +0 -293
- package/VisualizationProvider.js +0 -38
- package/__mocks__/exportedSample.svg +0 -45
- package/index.js +0 -16
- package/visualizationAdapterCreator.js +0 -76
package/src/Three/Three2D.js
CHANGED
|
@@ -262,7 +262,6 @@ export class Three2D extends ThreeBase {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
// eslint-disable-next-line no-unused-vars
|
|
266
265
|
setupDefaultControls(targetElement, options = {}) {
|
|
267
266
|
this.controls = {
|
|
268
267
|
enabled: true,
|
|
@@ -328,14 +327,12 @@ export class Three2D extends ThreeBase {
|
|
|
328
327
|
await this.observable.dispatch(EventTypes.MaterialUpdated, eventParams, true);
|
|
329
328
|
}
|
|
330
329
|
|
|
331
|
-
// eslint-disable-next-line no-unused-vars
|
|
332
330
|
async updateMaterial(targetObject = this.scene) {
|
|
333
331
|
return await this.updateView(this._currentDesignView);
|
|
334
332
|
}
|
|
335
333
|
|
|
336
334
|
async _getDrawingContext(
|
|
337
335
|
drawingFn,
|
|
338
|
-
// eslint-disable-next-line no-unused-vars
|
|
339
336
|
updateAlpha = false,
|
|
340
337
|
clearTexture = false,
|
|
341
338
|
materialName = undefined
|
|
@@ -373,7 +370,12 @@ export class Three2D extends ThreeBase {
|
|
|
373
370
|
}
|
|
374
371
|
}
|
|
375
372
|
|
|
376
|
-
async getDrawingContext(
|
|
373
|
+
async getDrawingContext(
|
|
374
|
+
drawingFn,
|
|
375
|
+
updateAlpha = false,
|
|
376
|
+
clearTexture = false,
|
|
377
|
+
materialName = undefined
|
|
378
|
+
) {
|
|
377
379
|
this._redraw = this._getDrawingContext.bind(this, ...arguments);
|
|
378
380
|
if (!this._redrawPromise) {
|
|
379
381
|
window.cancelAnimationFrame(this._redrawFrame);
|
|
@@ -606,7 +608,6 @@ export class Three2D extends ThreeBase {
|
|
|
606
608
|
|
|
607
609
|
const designViewIdentifier = designView && designView.identifier;
|
|
608
610
|
if (!designViewIdentifier) {
|
|
609
|
-
// eslint-disable-next-line no-console
|
|
610
611
|
console.log("No design view identifier! Skipping update.");
|
|
611
612
|
return;
|
|
612
613
|
}
|
|
@@ -708,7 +709,6 @@ export class Three2D extends ThreeBase {
|
|
|
708
709
|
}
|
|
709
710
|
|
|
710
711
|
if (!this._containerGroup) {
|
|
711
|
-
// eslint-disable-next-line no-console
|
|
712
712
|
console.log(`Container group is not available, skipping jump to view!`);
|
|
713
713
|
return false;
|
|
714
714
|
}
|
|
@@ -738,7 +738,6 @@ export class Three2D extends ThreeBase {
|
|
|
738
738
|
await this.updateView(designView);
|
|
739
739
|
|
|
740
740
|
if (!this._containerGroup) {
|
|
741
|
-
// eslint-disable-next-line no-console
|
|
742
741
|
console.log(`Container group is not available, skipping jump to view!`);
|
|
743
742
|
return false;
|
|
744
743
|
}
|
package/src/Three/Three3D.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Texture,
|
|
10
10
|
Spherical,
|
|
11
11
|
Vector2,
|
|
12
|
+
Vector3,
|
|
12
13
|
} from "three";
|
|
13
14
|
import TWEEN from "@tweenjs/tween.js";
|
|
14
15
|
import first from "lodash/first";
|
|
@@ -167,7 +168,6 @@ export class Three3D extends ThreeBase {
|
|
|
167
168
|
}
|
|
168
169
|
const matches = ("" + obj.name).toLowerCase().match(/(.+)_(position|lookat)$/);
|
|
169
170
|
if (!matches) {
|
|
170
|
-
// eslint-disable-next-line no-console
|
|
171
171
|
console.warn(`Camera view object skipped: ${obj.name}`);
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
@@ -248,12 +248,10 @@ export class Three3D extends ThreeBase {
|
|
|
248
248
|
*/
|
|
249
249
|
return src => {
|
|
250
250
|
if (_src === src) {
|
|
251
|
-
// eslint-disable-next-line no-console
|
|
252
251
|
console.log("Material is already loaded: " + src);
|
|
253
252
|
return promise;
|
|
254
253
|
}
|
|
255
254
|
_src = src;
|
|
256
|
-
// eslint-disable-next-line no-console
|
|
257
255
|
console.log("Loading material: " + src);
|
|
258
256
|
promise = new Promise((resolve, reject) => {
|
|
259
257
|
const { path, fileName } = this.getPathAndFileName(src);
|
|
@@ -262,7 +260,6 @@ export class Three3D extends ThreeBase {
|
|
|
262
260
|
materialCreator => {
|
|
263
261
|
const textureLoadingManager = new LoadingManager(
|
|
264
262
|
() => {
|
|
265
|
-
// eslint-disable-next-line no-console
|
|
266
263
|
console.log("All textures have been lodaed.");
|
|
267
264
|
resolve(materialCreator);
|
|
268
265
|
},
|
|
@@ -290,7 +287,6 @@ export class Three3D extends ThreeBase {
|
|
|
290
287
|
false
|
|
291
288
|
);
|
|
292
289
|
if (!isTexture) {
|
|
293
|
-
// eslint-disable-next-line no-console
|
|
294
290
|
console.log("Materials do not contain any texture.");
|
|
295
291
|
resolve(materialCreator);
|
|
296
292
|
}
|
|
@@ -342,12 +338,10 @@ export class Three3D extends ThreeBase {
|
|
|
342
338
|
}
|
|
343
339
|
|
|
344
340
|
async updateMaterial(targetObject = this.scene, options = {}) {
|
|
345
|
-
// eslint-disable-next-line no-console
|
|
346
341
|
console.log("Updating materials...");
|
|
347
342
|
const { mtlPath } = this.getModelPaths();
|
|
348
343
|
|
|
349
344
|
if (!mtlPath) {
|
|
350
|
-
// eslint-disable-next-line no-console
|
|
351
345
|
console.log("Missing material path!");
|
|
352
346
|
return;
|
|
353
347
|
}
|
|
@@ -416,7 +410,6 @@ export class Three3D extends ThreeBase {
|
|
|
416
410
|
* @param {*} materialsObj
|
|
417
411
|
*/
|
|
418
412
|
findCustomizableMaterials(materialsObj) {
|
|
419
|
-
// eslint-disable-next-line no-console
|
|
420
413
|
console.log("Looking for customizable materials...");
|
|
421
414
|
for (let key of this._customizableMaterialKeys) {
|
|
422
415
|
const mat = materialsObj[key];
|
|
@@ -523,7 +516,6 @@ export class Three3D extends ThreeBase {
|
|
|
523
516
|
const viewNameSafe = ("" + viewName).toLowerCase();
|
|
524
517
|
const view = this.cameraViews[viewNameSafe];
|
|
525
518
|
if (!view) {
|
|
526
|
-
// eslint-disable-next-line no-console
|
|
527
519
|
console.error(`Camera view does not exist: ${viewNameSafe}`);
|
|
528
520
|
return;
|
|
529
521
|
}
|
package/src/Three/ThreeBase.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Mesh,
|
|
4
4
|
Vector2,
|
|
5
5
|
BoxGeometry,
|
|
6
|
+
Material,
|
|
6
7
|
MeshBasicMaterial,
|
|
7
8
|
Raycaster,
|
|
8
9
|
AxesHelper,
|
|
@@ -23,7 +24,6 @@ import Deferred from "../CommonUtils/Deferred";
|
|
|
23
24
|
export const onProgress = xhr => {
|
|
24
25
|
if (xhr.lengthComputable) {
|
|
25
26
|
const percentComplete = (xhr.loaded / xhr.total) * 100;
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
27
|
console.log(percentComplete.toFixed(2) + "% downloaded");
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -104,7 +104,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
104
104
|
* @param {number} width
|
|
105
105
|
* @param {number} height
|
|
106
106
|
*/
|
|
107
|
-
// eslint-disable-next-line no-unused-vars
|
|
108
107
|
updateCamera(width, height) {}
|
|
109
108
|
|
|
110
109
|
addToContainer(container) {
|
|
@@ -167,7 +166,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
167
166
|
* @param {HTMLElement} targetElement
|
|
168
167
|
* @param {{}} options Custom options for the controls (see the OrbitControls.js file for details)
|
|
169
168
|
*/
|
|
170
|
-
// eslint-disable-next-line no-unused-vars
|
|
171
169
|
setupDefaultControls(targetElement, options = {}) {}
|
|
172
170
|
|
|
173
171
|
addAxesHelper() {
|
|
@@ -186,7 +184,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
186
184
|
this.controls.enabled = enabled;
|
|
187
185
|
}
|
|
188
186
|
|
|
189
|
-
// eslint-disable-next-line no-unused-vars
|
|
190
187
|
updateMaterial(targetObject = this.scene) {}
|
|
191
188
|
|
|
192
189
|
/**
|
|
@@ -227,11 +224,8 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
227
224
|
*/
|
|
228
225
|
getDrawingContext(
|
|
229
226
|
drawingFn,
|
|
230
|
-
// eslint-disable-next-line no-unused-vars
|
|
231
227
|
updateAlpha = false,
|
|
232
|
-
// eslint-disable-next-line no-unused-vars
|
|
233
228
|
clearTexture = false,
|
|
234
|
-
// eslint-disable-next-line no-unused-vars
|
|
235
229
|
materialName = undefined
|
|
236
230
|
) {}
|
|
237
231
|
|
|
@@ -385,7 +379,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
385
379
|
event => {
|
|
386
380
|
event.preventDefault();
|
|
387
381
|
window.cancelAnimationFrame(_this._animationFrame);
|
|
388
|
-
// eslint-disable-next-line no-console
|
|
389
382
|
console.warn("WEBGL CONTEXT LOST");
|
|
390
383
|
},
|
|
391
384
|
false
|
|
@@ -397,7 +390,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
397
390
|
if (_this._animationFrame) {
|
|
398
391
|
_this.animate();
|
|
399
392
|
}
|
|
400
|
-
// eslint-disable-next-line no-console
|
|
401
393
|
console.warn("WEGL CONTEXT RESTORED");
|
|
402
394
|
},
|
|
403
395
|
false
|
|
@@ -454,7 +446,6 @@ export class ThreeBase extends VisualizationInterface {
|
|
|
454
446
|
this._customizableMaterials = [];
|
|
455
447
|
this._isInitialized = false;
|
|
456
448
|
|
|
457
|
-
// eslint-disable-next-line no-console
|
|
458
449
|
console.info("Three instance has been successfully disposed.");
|
|
459
450
|
}
|
|
460
451
|
|
|
@@ -9,7 +9,6 @@ export const getDesignAreaCanvasSize = designArea => {
|
|
|
9
9
|
sourceObject = position;
|
|
10
10
|
}
|
|
11
11
|
if (!sourceObject) {
|
|
12
|
-
// eslint-disable-next-line no-console
|
|
13
12
|
console.error(
|
|
14
13
|
"Incomplete design area data, baseShape and position has to be set up correctly.",
|
|
15
14
|
designArea
|
|
@@ -26,7 +26,6 @@ export const createTextureBuilder = (textureImage, params = {}) => {
|
|
|
26
26
|
}) => {
|
|
27
27
|
const { baseShape, position } = designArea;
|
|
28
28
|
if (!baseShape || !position) {
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
29
|
console.log("No design area provided.");
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
@@ -56,7 +55,6 @@ export const createTextureBuilder = (textureImage, params = {}) => {
|
|
|
56
55
|
break;
|
|
57
56
|
}
|
|
58
57
|
default: {
|
|
59
|
-
// eslint-disable-next-line no-console
|
|
60
58
|
console.error(`Unknown baseShape type: ${type}. Texture update will be skipped.`);
|
|
61
59
|
return;
|
|
62
60
|
}
|
|
@@ -8,17 +8,14 @@ export function createCanvasFromImage(image) {
|
|
|
8
8
|
|
|
9
9
|
export function initTextureCanvas(texture) {
|
|
10
10
|
if (!texture.image) {
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
11
|
console.warn("There is no image for the given texture.", texture);
|
|
13
12
|
}
|
|
14
13
|
if (!texture.originalImage || texture.image.nodeName !== "CANVAS") {
|
|
15
14
|
const originalImage = optimizeTextureImage(texture.image);
|
|
16
|
-
// eslint-disable-next-line no-console
|
|
17
15
|
console.log(`Creating canvas from texture: ${originalImage.src}`);
|
|
18
16
|
texture.image = createCanvasFromImage(originalImage);
|
|
19
17
|
texture.originalImage = originalImage;
|
|
20
18
|
} else {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
19
|
console.log(`Texture for ${texture.originalImage.src} is already prepared, skipping.`);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
@@ -29,7 +29,6 @@ export const optimizeTextureImage = (image, maxTextureSize = 2048, minTextureSiz
|
|
|
29
29
|
width = height * ratio;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// eslint-disable-next-line no-console
|
|
33
32
|
console.log(
|
|
34
33
|
"Optimizing texture image for better mipmaps:",
|
|
35
34
|
`${image.width}x${image.height} -> ${width}x${height}`
|
|
@@ -51,7 +51,6 @@ export class VisualizationContainer extends React.Component {
|
|
|
51
51
|
const { visualization } = this.props;
|
|
52
52
|
|
|
53
53
|
if (!visualization) {
|
|
54
|
-
// eslint-disable-next-line no-console
|
|
55
54
|
console.warn("Visualization component is not provided! Visualization will not be rendered.");
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
@@ -66,7 +65,7 @@ export class VisualizationContainer extends React.Component {
|
|
|
66
65
|
this.updateVisualization();
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
componentDidUpdate(prevProps) {
|
|
68
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
70
69
|
this.updateVisualization(prevProps);
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -162,7 +161,6 @@ export class VisualizationContainer extends React.Component {
|
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
export const VisualizationContainerSwitch = props => {
|
|
165
|
-
// eslint-disable-next-line react/prop-types
|
|
166
164
|
const { visualization, VisualizationContainerComponent, FallbackComponent } = props;
|
|
167
165
|
const Component = visualization ? VisualizationContainerComponent : FallbackComponent;
|
|
168
166
|
return <Component {...props} />;
|
|
@@ -22,9 +22,8 @@ export class VisualizationInterface {
|
|
|
22
22
|
* This function is called from the container component.
|
|
23
23
|
* It provides the opportunity to add any visualization element to the container, and do initial setup if needed.
|
|
24
24
|
* @param {HTMLElement} [container=<div>]
|
|
25
|
-
* @param {boolean}
|
|
25
|
+
* @param {boolean} useDefaultSetup
|
|
26
26
|
*/
|
|
27
|
-
// eslint-disable-next-line no-unused-vars
|
|
28
27
|
init(container, useDefaultSetup) {}
|
|
29
28
|
|
|
30
29
|
/**
|
|
@@ -34,7 +33,6 @@ export class VisualizationInterface {
|
|
|
34
33
|
* This function should add the visualization element to the container, and do other updates if needed.
|
|
35
34
|
* @param container
|
|
36
35
|
*/
|
|
37
|
-
// eslint-disable-next-line no-unused-vars
|
|
38
36
|
addToContainer(container) {}
|
|
39
37
|
|
|
40
38
|
isInitialized() {
|
|
@@ -110,7 +108,6 @@ export class VisualizationInterface {
|
|
|
110
108
|
* @param {number} height
|
|
111
109
|
* @param {boolean} rerender
|
|
112
110
|
*/
|
|
113
|
-
// eslint-disable-next-line no-unused-vars
|
|
114
111
|
setSize({ width, height }, rerender = true) {}
|
|
115
112
|
|
|
116
113
|
/**
|
|
@@ -132,7 +129,6 @@ export class VisualizationInterface {
|
|
|
132
129
|
/**
|
|
133
130
|
* Handle updates of design area list if needed in the custom implementation
|
|
134
131
|
*/
|
|
135
|
-
// eslint-disable-next-line no-unused-vars
|
|
136
132
|
updateDesignAreaList(designAreaList) {}
|
|
137
133
|
|
|
138
134
|
/**
|
|
@@ -145,11 +141,8 @@ export class VisualizationInterface {
|
|
|
145
141
|
*/
|
|
146
142
|
getDrawingContext(
|
|
147
143
|
drawingFn,
|
|
148
|
-
// eslint-disable-next-line no-unused-vars
|
|
149
144
|
updateAlpha = false,
|
|
150
|
-
// eslint-disable-next-line no-unused-vars
|
|
151
145
|
clearTexture = false,
|
|
152
|
-
// eslint-disable-next-line no-unused-vars
|
|
153
146
|
materialName = undefined
|
|
154
147
|
) {}
|
|
155
148
|
|
|
@@ -164,7 +157,6 @@ export class VisualizationInterface {
|
|
|
164
157
|
|
|
165
158
|
onLoadError = url => {
|
|
166
159
|
const errorMessage = `Could not load file: ${url}`;
|
|
167
|
-
// eslint-disable-next-line no-console
|
|
168
160
|
console.error(errorMessage);
|
|
169
161
|
this.observable.dispatch(EventTypes.LoadError, {
|
|
170
162
|
url,
|
|
@@ -189,7 +181,6 @@ export class VisualizationInterface {
|
|
|
189
181
|
* @param {function} callback The callback function should get the generated screenshots in the first arg
|
|
190
182
|
* @param {object} options The options object to pass extra data
|
|
191
183
|
*/
|
|
192
|
-
// eslint-disable-next-line no-unused-vars
|
|
193
184
|
async getScreenshots(callback, options) {
|
|
194
185
|
callback && callback(null);
|
|
195
186
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Target latest version of ECMAScript.
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
// Search under node_modules for non-relative imports.
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
// Process & infer types from .js files.
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
// Don't emit; allow Babel to transform files.
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
// Enable strictest settings like strictNullChecks & noImplicitAny.
|
|
12
|
+
"strict": true,
|
|
13
|
+
// Disallow features that require cross-file information for emit.
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
// Import non-ES modules as default imports.
|
|
16
|
+
"esModuleInterop": true
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"./src",
|
|
20
|
+
"./node_modules/redhotmagma-graphics-editor"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/AlignTargetProvider.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.withCurrentTarget = exports.withAlignTarget = exports.AlignTargetProvider = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _last = _interopRequireDefault(require("lodash/last"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
|
-
|
|
26
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
|
|
28
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
-
|
|
30
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
-
|
|
32
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
-
|
|
34
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
-
|
|
36
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
-
|
|
38
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
-
|
|
40
|
-
var AlignTargetContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
41
|
-
|
|
42
|
-
var AlignTargetProvider = function AlignTargetProvider(_ref) {
|
|
43
|
-
var children = _ref.children;
|
|
44
|
-
|
|
45
|
-
var _useState = (0, _react.useState)({
|
|
46
|
-
targets: [],
|
|
47
|
-
currentTarget: null,
|
|
48
|
-
alignTarget: {
|
|
49
|
-
/**
|
|
50
|
-
* Add the element to the top of the target stack
|
|
51
|
-
* @param {Element} element
|
|
52
|
-
*/
|
|
53
|
-
add: function add(element) {
|
|
54
|
-
setState(function (state) {
|
|
55
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
56
|
-
targets: state.targets.concat([element]),
|
|
57
|
-
currentTarget: element
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Remove the element from the target stack
|
|
64
|
-
* @param {Element} element
|
|
65
|
-
*/
|
|
66
|
-
remove: function remove(element) {
|
|
67
|
-
setState(function (state) {
|
|
68
|
-
var targets = state.targets.filter(function (item) {
|
|
69
|
-
return item !== element;
|
|
70
|
-
});
|
|
71
|
-
var currentTarget = (0, _last["default"])(targets);
|
|
72
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
73
|
-
targets: targets,
|
|
74
|
-
currentTarget: currentTarget
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}),
|
|
80
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
81
|
-
state = _useState2[0],
|
|
82
|
-
setState = _useState2[1];
|
|
83
|
-
|
|
84
|
-
return /*#__PURE__*/_react["default"].createElement(AlignTargetContext.Provider, {
|
|
85
|
-
value: state
|
|
86
|
-
}, children);
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* HOC to provide the add and remove functions through the alignTarget prop
|
|
90
|
-
* so the wrapped component can add or remove its element ref (eg. after mount and before unmount)
|
|
91
|
-
* @param Component
|
|
92
|
-
* @return {function(*): *}
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
exports.AlignTargetProvider = AlignTargetProvider;
|
|
97
|
-
|
|
98
|
-
var withAlignTarget = function withAlignTarget(Component) {
|
|
99
|
-
return function (props) {
|
|
100
|
-
var _useContext = (0, _react.useContext)(AlignTargetContext),
|
|
101
|
-
alignTarget = _useContext.alignTarget;
|
|
102
|
-
|
|
103
|
-
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
|
|
104
|
-
alignTarget: alignTarget
|
|
105
|
-
}));
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* HOC to provide the current target element through the alignTargetElement prop
|
|
110
|
-
* so the wrapped component can react when it changes
|
|
111
|
-
* @param Component
|
|
112
|
-
* @return {function(*): *}
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
exports.withAlignTarget = withAlignTarget;
|
|
117
|
-
|
|
118
|
-
var withCurrentTarget = function withCurrentTarget(Component) {
|
|
119
|
-
return function (props) {
|
|
120
|
-
var _useContext2 = (0, _react.useContext)(AlignTargetContext),
|
|
121
|
-
currentTarget = _useContext2.currentTarget;
|
|
122
|
-
|
|
123
|
-
return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
|
|
124
|
-
alignTargetElement: currentTarget
|
|
125
|
-
}));
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
exports.withCurrentTarget = withCurrentTarget;
|
package/CommonUtils/Deferred.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DeferredGroup = exports["default"] = exports.Deferred = void 0;
|
|
7
|
-
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
-
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
13
|
-
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @private
|
|
18
|
-
* @type {{}}
|
|
19
|
-
*/
|
|
20
|
-
var promises = {};
|
|
21
|
-
|
|
22
|
-
var Deferred = /*#__PURE__*/function () {
|
|
23
|
-
function Deferred() {
|
|
24
|
-
var _this = this;
|
|
25
|
-
|
|
26
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
27
|
-
|
|
28
|
-
_classCallCheck(this, Deferred);
|
|
29
|
-
|
|
30
|
-
_defineProperty(this, "resolve", function () {
|
|
31
|
-
_this.remove();
|
|
32
|
-
|
|
33
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
-
args[_key] = arguments[_key];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
_this._resolve.apply(0, args);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
_defineProperty(this, "reject", function () {
|
|
41
|
-
_this.remove();
|
|
42
|
-
|
|
43
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
44
|
-
args[_key2] = arguments[_key2];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_this._reject.apply(0, args);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
if (promises[name]) {
|
|
51
|
-
throw new Error("Instance already exists with the name: " + name);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
this.name = name;
|
|
55
|
-
this.promise = new Promise(function (resolve, reject) {
|
|
56
|
-
_this._resolve = resolve;
|
|
57
|
-
_this._reject = reject;
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (name) {
|
|
61
|
-
promises[name] = this;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_createClass(Deferred, [{
|
|
66
|
-
key: "remove",
|
|
67
|
-
value: function remove() {
|
|
68
|
-
delete promises[this.name];
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "then",
|
|
72
|
-
value: function then(fn) {
|
|
73
|
-
this.promise.then(fn);
|
|
74
|
-
}
|
|
75
|
-
}], [{
|
|
76
|
-
key: "get",
|
|
77
|
-
value: function get(name) {
|
|
78
|
-
if (!promises[name]) {
|
|
79
|
-
throw new Error("Instance does not exist with the name: " + name);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return promises[name];
|
|
83
|
-
}
|
|
84
|
-
}]);
|
|
85
|
-
|
|
86
|
-
return Deferred;
|
|
87
|
-
}();
|
|
88
|
-
|
|
89
|
-
exports.Deferred = Deferred;
|
|
90
|
-
var _default = Deferred;
|
|
91
|
-
exports["default"] = _default;
|
|
92
|
-
|
|
93
|
-
var DeferredGroup = /*#__PURE__*/function () {
|
|
94
|
-
function DeferredGroup() {
|
|
95
|
-
_classCallCheck(this, DeferredGroup);
|
|
96
|
-
|
|
97
|
-
_defineProperty(this, "deferredList", []);
|
|
98
|
-
|
|
99
|
-
if (arguments.length > 0) {
|
|
100
|
-
this.deferredList = this.deferredList.concat(arguments);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
_createClass(DeferredGroup, [{
|
|
105
|
-
key: "create",
|
|
106
|
-
value: function create() {
|
|
107
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
108
|
-
var deferred = new Deferred(name);
|
|
109
|
-
this.add(deferred);
|
|
110
|
-
return deferred;
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
key: "createResolver",
|
|
114
|
-
value: function createResolver() {
|
|
115
|
-
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
116
|
-
return this.create(name).resolve;
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
key: "add",
|
|
120
|
-
value: function add(deferred) {
|
|
121
|
-
this.deferredList.push(deferred);
|
|
122
|
-
}
|
|
123
|
-
}, {
|
|
124
|
-
key: "then",
|
|
125
|
-
value: function then(fn) {
|
|
126
|
-
return Promise.all(this.deferredList.map(function (d) {
|
|
127
|
-
return d.promise;
|
|
128
|
-
})).then(fn);
|
|
129
|
-
}
|
|
130
|
-
}]);
|
|
131
|
-
|
|
132
|
-
return DeferredGroup;
|
|
133
|
-
}();
|
|
134
|
-
|
|
135
|
-
exports.DeferredGroup = DeferredGroup;
|