@leapfrog/interactive-canvas 2.0.22-beta-7 → 2.0.22-beta-9
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _, { round, each, values, reduce, clone, max, isEqual } from 'lodash';
|
|
2
2
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
3
3
|
import * as fabric from 'fabric';
|
|
4
|
-
import { JSDOM } from 'jsdom';
|
|
5
4
|
|
|
6
5
|
const PIXELS_PER_MM$2 = 3.937;
|
|
7
6
|
class MillimeterDimensions {
|
|
@@ -3734,29 +3733,9 @@ class SelectionData {
|
|
|
3734
3733
|
}
|
|
3735
3734
|
}
|
|
3736
3735
|
|
|
3737
|
-
//import { createCanvas, loadImage } from 'canvas';
|
|
3738
3736
|
class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
3739
3737
|
constructor() {
|
|
3740
|
-
|
|
3741
|
-
if (typeof window === "undefined") {
|
|
3742
|
-
const { window } = new JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
3743
|
-
global.window = window;
|
|
3744
|
-
global.document = window.document;
|
|
3745
|
-
global.HTMLElement = window.HTMLElement;
|
|
3746
|
-
global.HTMLCanvasElement = window.HTMLCanvasElement;
|
|
3747
|
-
global.window.requestAnimationFrame = (callback) => {
|
|
3748
|
-
return setTimeout(() => callback(Date.now()), 16);
|
|
3749
|
-
};
|
|
3750
|
-
global.window.cancelAnimationFrame = (id) => {
|
|
3751
|
-
clearTimeout(id);
|
|
3752
|
-
};
|
|
3753
|
-
// const nodeCanvas = createCanvas(640, 480);
|
|
3754
|
-
// canvas = new fabric.StaticCanvas(nodeCanvas as unknown as HTMLCanvasElement) as Canvas;
|
|
3755
|
-
}
|
|
3756
|
-
//else {
|
|
3757
|
-
canvas = new fabric.StaticCanvas(undefined, { width: 640, height: 480 });
|
|
3758
|
-
// }
|
|
3759
|
-
super(fabric, canvas, 1);
|
|
3738
|
+
super(fabric, new fabric.StaticCanvas(undefined, { width: 640, height: 480 }), 0);
|
|
3760
3739
|
this.headless = true;
|
|
3761
3740
|
}
|
|
3762
3741
|
/**
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
var rxjs = require('rxjs');
|
|
5
5
|
var fabric = require('fabric');
|
|
6
|
-
var jsdom = require('jsdom');
|
|
7
6
|
|
|
8
7
|
function _interopNamespaceDefault(e) {
|
|
9
8
|
var n = Object.create(null);
|
|
@@ -3755,29 +3754,9 @@ class SelectionData {
|
|
|
3755
3754
|
}
|
|
3756
3755
|
}
|
|
3757
3756
|
|
|
3758
|
-
//import { createCanvas, loadImage } from 'canvas';
|
|
3759
3757
|
class HeadlessInteractiveCanvas extends AbstractInteractiveCanvas {
|
|
3760
3758
|
constructor() {
|
|
3761
|
-
|
|
3762
|
-
if (typeof window === "undefined") {
|
|
3763
|
-
const { window } = new jsdom.JSDOM('<!DOCTYPE html><html><body></body></html>');
|
|
3764
|
-
global.window = window;
|
|
3765
|
-
global.document = window.document;
|
|
3766
|
-
global.HTMLElement = window.HTMLElement;
|
|
3767
|
-
global.HTMLCanvasElement = window.HTMLCanvasElement;
|
|
3768
|
-
global.window.requestAnimationFrame = (callback) => {
|
|
3769
|
-
return setTimeout(() => callback(Date.now()), 16);
|
|
3770
|
-
};
|
|
3771
|
-
global.window.cancelAnimationFrame = (id) => {
|
|
3772
|
-
clearTimeout(id);
|
|
3773
|
-
};
|
|
3774
|
-
// const nodeCanvas = createCanvas(640, 480);
|
|
3775
|
-
// canvas = new fabric.StaticCanvas(nodeCanvas as unknown as HTMLCanvasElement) as Canvas;
|
|
3776
|
-
}
|
|
3777
|
-
//else {
|
|
3778
|
-
canvas = new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 });
|
|
3779
|
-
// }
|
|
3780
|
-
super(fabric__namespace, canvas, 1);
|
|
3759
|
+
super(fabric__namespace, new fabric__namespace.StaticCanvas(undefined, { width: 640, height: 480 }), 0);
|
|
3781
3760
|
this.headless = true;
|
|
3782
3761
|
}
|
|
3783
3762
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leapfrog/interactive-canvas",
|
|
3
|
-
"version": "2.0.22-beta-
|
|
3
|
+
"version": "2.0.22-beta-9",
|
|
4
4
|
"description": "Leapfrog interactive canvas",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
"prepublishOnly": "npm run build"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types/jsdom": "^28.0.3",
|
|
18
17
|
"@types/lodash": "^4.17.23",
|
|
19
18
|
"typescript": "^6.0.3"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
21
|
"fabric": "^7.2.0",
|
|
23
|
-
"jsdom": "^29.0.2",
|
|
24
22
|
"lodash": "^4.18.1",
|
|
25
23
|
"rollup": "^4.60.3",
|
|
26
24
|
"rollup-plugin-typescript2": "^0.37.0",
|