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