simplify imports

This commit is contained in:
casper 2021-05-20 04:16:53 +02:00
parent 87b6e9851b
commit f613c2b68d
51 changed files with 75 additions and 88 deletions

36
package-lock.json generated
View File

@ -10,8 +10,7 @@
"license": "UNLICENSED",
"dependencies": {
"@doodle3d/cal": "0.0.8",
"@doodle3d/clipper-js": "^1.0.7",
"@doodle3d/fill-path": "^1.0.7",
"@doodle3d/clipper-js": "^1.0.11",
"@doodle3d/potrace-js": "0.0.6",
"@doodle3d/threejs-export-obj": "0.0.8",
"@doodle3d/threejs-export-stl": "0.0.5",
@ -21,6 +20,7 @@
"blueimp-canvas-to-blob": "^3.14.0",
"bowser": "^1.8.1",
"file-loader": "^0.11.2",
"fill-path": "^1.0.9",
"fit-curve": "^0.1.6",
"font-loaded": "^1.0.0",
"imports-loader": "^0.7.1",
@ -148,14 +148,6 @@
"resolved": "https://registry.npmjs.org/@doodle3d/clipper-lib/-/clipper-lib-6.4.2-b.tgz",
"integrity": "sha512-glELSijsD9b+/0d9iOdasBwqH3s+xPxD59tJ7aXkBx7klugygGOMXn7PB05AdhVyA1OYMj7GUCegaQa7nvLtmQ=="
},
"node_modules/@doodle3d/fill-path": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@doodle3d/fill-path/-/fill-path-1.0.7.tgz",
"integrity": "sha512-4sdgWQ28JgRsmnyy1OnuKHE+DZ8kDGpluGqFmMASh2/6dlyjp2/oXnNEgNefG4/xiEitV8AtzEij9Bijh6yNRw==",
"dependencies": {
"@doodle3d/clipper-js": "^1.0.3"
}
},
"node_modules/@doodle3d/potrace-js": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@doodle3d/potrace-js/-/potrace-js-0.0.6.tgz",
@ -4986,6 +4978,14 @@
"node": ">= 0.4.0"
}
},
"node_modules/fill-path": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/fill-path/-/fill-path-1.0.9.tgz",
"integrity": "sha512-DfVMI9QySK8JrEp9FWE+E+YYCg6W2xkxDpH1kcHTu7ixz1pXQUr9j0eTTvfKS/ziy23dV6KR/FwKwvmANWRBVA==",
"dependencies": {
"@doodle3d/clipper-js": "^1.0.11"
}
},
"node_modules/fill-range": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz",
@ -18092,14 +18092,6 @@
"resolved": "https://registry.npmjs.org/@doodle3d/clipper-lib/-/clipper-lib-6.4.2-b.tgz",
"integrity": "sha512-glELSijsD9b+/0d9iOdasBwqH3s+xPxD59tJ7aXkBx7klugygGOMXn7PB05AdhVyA1OYMj7GUCegaQa7nvLtmQ=="
},
"@doodle3d/fill-path": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@doodle3d/fill-path/-/fill-path-1.0.7.tgz",
"integrity": "sha512-4sdgWQ28JgRsmnyy1OnuKHE+DZ8kDGpluGqFmMASh2/6dlyjp2/oXnNEgNefG4/xiEitV8AtzEij9Bijh6yNRw==",
"requires": {
"@doodle3d/clipper-js": "^1.0.3"
}
},
"@doodle3d/potrace-js": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@doodle3d/potrace-js/-/potrace-js-0.0.6.tgz",
@ -22335,6 +22327,14 @@
"integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==",
"dev": true
},
"fill-path": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/fill-path/-/fill-path-1.0.9.tgz",
"integrity": "sha512-DfVMI9QySK8JrEp9FWE+E+YYCg6W2xkxDpH1kcHTu7ixz1pXQUr9j0eTTvfKS/ziy23dV6KR/FwKwvmANWRBVA==",
"requires": {
"@doodle3d/clipper-js": "^1.0.11"
}
},
"fill-range": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz",

View File

@ -18,8 +18,7 @@
},
"dependencies": {
"@doodle3d/cal": "0.0.8",
"@doodle3d/clipper-js": "^1.0.7",
"@doodle3d/fill-path": "^1.0.7",
"@doodle3d/clipper-js": "^1.0.11",
"@doodle3d/potrace-js": "0.0.6",
"@doodle3d/threejs-export-obj": "0.0.8",
"@doodle3d/threejs-export-stl": "0.0.5",
@ -29,6 +28,7 @@
"blueimp-canvas-to-blob": "^3.14.0",
"bowser": "^1.8.1",
"file-loader": "^0.11.2",
"fill-path": "^1.0.9",
"fit-curve": "^0.1.6",
"font-loaded": "^1.0.0",
"imports-loader": "^0.7.1",

View File

@ -8,7 +8,7 @@ import { createThrottle } from '../utils/async.js';
import { tween } from '../utils/tweenUtils.js';
import { DEFAULT_TRACE_TOLERANCE, MAX_TRACE_TOLERANCE } from '../constants/d2Constants.js';
import * as d2Tools from '../constants/d2Tools.js';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
// import createDebug from 'debug';
// const debug = createDebug('d3d:actions');

View File

@ -17,7 +17,7 @@ import keycode from 'keycode';
import bowser from 'bowser';
import * as d2Tools from '../constants/d2Tools.js';
import { isLoaded, load } from '../utils/loaded.js';
import { setConfig } from 'touch-events';
import { setConfig } from '@doodle3d/touch-events';
setConfig({ DRAG_THRESHOLD: 0 });

View File

@ -2,7 +2,7 @@ import React from 'react';
import injectSheet from 'react-jss';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import * as CAL from 'cal';
import * as CAL from '@doodle3d/cal';
import * as toolNames from '../constants/d2Tools';
import { PIPETTE } from '../constants/contextTools.js';
import { CANVAS_SIZE } from '../constants/d2Constants';

View File

@ -3,7 +3,7 @@ import injectSheet from 'react-jss';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import * as actions from '../actions/index.js';
import * as CAL from 'cal';
import * as CAL from '@doodle3d/cal';
import { TEXT_TOOL_FONT_SIZE } from '../constants/d2Constants.js';
const CONTEXT = document.createElement('canvas').getContext('2d');

View File

@ -1,4 +1,4 @@
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import transposeEvents from '../utils/transposeEvents.js';
import { PIXEL_RATIO } from '../constants/general.js';
import { convertEvent } from '../utils/pointerUtils.js';

View File

@ -1,5 +1,5 @@
import { Group, Utils } from 'cal';
import createListener from 'touch-events';
import { Group, Utils } from '@doodle3d/cal';
import createListener from '@doodle3d/touch-events';
import bowser from 'bowser';
import { convertEvent, isMouseEvent } from '../utils/pointerUtils.js';
import normalizeWheel from 'normalize-wheel';

View File

@ -1,4 +1,4 @@
import { Color, Vector } from 'cal';
import { Color, Vector } from '@doodle3d/cal';
import { CANVAS_SIZE, GRID_SIZE } from '../constants/d2Constants';
import { PIXEL_RATIO } from '../constants/general.js';

View File

@ -1,5 +1,5 @@
import { IMAGE_GUIDE_TRANSPARENCY, DESELECT_TRANSPARENCY } from '../constants/d2Constants.js';
import { Surface } from 'cal';
import { Surface } from '@doodle3d/cal';
export default class ImageShape extends Surface {
constructor(shapeData) {

View File

@ -1,6 +1,6 @@
import { shapeToPoints } from '../shape/shapeToPoints.js';
import { shapeChanged } from '../shape/shapeDataUtils.js';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
import { LINE_WIDTH } from '../constants/d2Constants.js';
import { hexToStyle } from '../utils/colorUtils.js';
import { DESELECT_TRANSPARENCY, FILL_TRANSPARENCY, LINE_TRANSPARENCY } from '../constants/d2Constants.js';

View File

@ -1,4 +1,4 @@
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import { PIXEL_RATIO } from '../constants/general.js';
export default class TolerancePointer {

View File

@ -1,4 +1,4 @@
import { Text, Color } from 'cal';
import { Text, Color } from '@doodle3d/cal';
export const dimensionsText = new Text({
size: 16,

View File

@ -1,14 +1,14 @@
import EventGroup from '../EventGroup.js';
import * as actions from '../../actions/index.js';
import transposeEvents from '../../utils/transposeEvents.js';
import ClipperShape from 'clipper-js';
import ClipperShape from '@doodle3d/clipper-js';
import { applyMatrixOnShape } from '../../utils/vectorUtils';
import { getPointsBounds } from '../../shape/shapeDataUtils';
import { shapeToPoints } from '../../shape/shapeToPoints';
import { LINE_COLLISION_MARGIN } from '../../constants/d2Constants';
import { LINE_WIDTH } from '../../constants/d2Constants';
import { PIXEL_RATIO } from '../../constants/general';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
const HIT_ORDER = {
RECT: 0,

View File

@ -1,5 +1,5 @@
import BaseTool from './BaseTool.js';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import { PIXEL_RATIO } from '../../constants/general.js';
import { convertEvent } from '../../utils/pointerUtils.js';
// import createDebug from 'debug';

View File

@ -1,4 +1,4 @@
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import BaseTool from './BaseTool.js';
import * as humanReadable from '../../utils/humanReadable.js';
import { dimensionsText } from '../texts.js';

View File

@ -1,5 +1,5 @@
import BaseTool from './BaseTool.js';
import * as CAL from 'cal';
import * as CAL from '@doodle3d/cal';
import TolerancePointer from '../TolerancePointer.js';
import * as actions from '../../actions/index.js';
import { calculateTolerance } from '../../utils/traceUtils';

View File

@ -1,5 +1,5 @@
import BaseTool from './BaseTool.js';
import { Vector, Utils } from 'cal';
import { Vector, Utils } from '@doodle3d/cal';
import * as humanReadable from '../../utils/humanReadable.js';
import { dimensionsText } from '../texts.js';
// import createDebug from 'debug';

View File

@ -1,4 +1,4 @@
import { Vector, Matrix, Image } from 'cal';
import { Vector, Matrix, Image } from '@doodle3d/cal';
import { SELECTION_VIEW_MIN_AXIS_SCALE, SELECTION_VIEW_MIN_SCALE } from '../../constants/d2Constants';
import dottedLineUrl from '../../../img/2d/dotLine01.png';
import rotateHandleUrl from '../../../img/2d/rotateHandle.png';

View File

@ -1,6 +1,6 @@
import * as THREE from 'three';
import { Utils } from 'cal';
import createListener from 'touch-events';
import { Utils } from '@doodle3d/cal';
import createListener from '@doodle3d/touch-events';
import bowser from 'bowser';
import { convertEvent, isMouseEvent } from '../utils/pointerUtils.js';
import normalizeWheel from 'normalize-wheel';

View File

@ -1,5 +1,5 @@
import * as THREE from 'three';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
// import createDebug from 'debug';
// const debug = createDebug('d3d:preview:selectionBox');

View File

@ -1,4 +1,4 @@
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import * as THREE from 'three';
import heightHandleURL from '../../../img/3d/heightHandle.png';
import pivitHandleURL from '../../../img/3d/sculptHandle.png';

View File

@ -1,5 +1,5 @@
import * as THREE from 'three';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import { SHAPE_TYPE_PROPERTIES } from '../../constants/shapeTypeProperties.js';
import * as d3Tools from '../../constants/d3Tools';
import handleURL from '../../../img/3d/sculptHandle.png';

View File

@ -6,7 +6,7 @@ import { SHAPE_TYPE_PROPERTIES } from '../constants/shapeTypeProperties.js';
import * as actions from '../actions/index.js';
import { select } from './menusReducer.js';
import { getSelectedObjectsSelector, getBoundingBox } from '../utils/selectionUtils.js';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
import { updateTool as updateTool2d } from './d2/toolReducer.js';
import { updateColor } from './selectionReducer.js';

View File

@ -1,5 +1,5 @@
import { CANVAS_SIZE, INITIAL_IMAGE_SCALE } from '../../constants/d2Constants.js';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
import { addObject } from '../objectReducers.js';
const IMAGE_SIZE = CANVAS_SIZE * 2 * INITIAL_IMAGE_SCALE;

View File

@ -1,4 +1,4 @@
import { Vector, Utils as CALUtils } from 'cal';
import { Vector, Utils as CALUtils } from '@doodle3d/cal';
import { MIN_ZOOM, MAX_ZOOM, CANVAS_SIZE } from '../../constants/d2Constants.js';
export default function constrainMatrix(matrix) {

View File

@ -1,6 +1,6 @@
import update from 'react-addons-update';
import fillPath from 'fill-path';
import ClipperShape from 'clipper-js';
import ClipperShape from '@doodle3d/clipper-js';
import * as actions from '../../../actions/index.js';
import { SHAPE_TYPE_PROPERTIES } from '../../../constants/shapeTypeProperties.js';
import { LINE_WIDTH, CLIPPER_PRECISION } from '../../../constants/d2Constants.js';

View File

@ -1,5 +1,5 @@
import * as actions from '../../../actions/index';
import ClipperShape from 'clipper-js';
import ClipperShape from '@doodle3d/clipper-js';
import * as d2Tools from '../../../constants/d2Tools';
import subtractShapeFromState from '../../../utils/subtractShapeFromState';
import { CLIPPER_PRECISION } from '../../../constants/d2Constants.js';

View File

@ -1,5 +1,5 @@
import update from 'react-addons-update';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import createDebug from 'debug';

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
// import createDebug from 'debug';
// const debug = createDebug('d3d:reducer:star');

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
// import createDebug from 'debug';
// const debug = createDebug('d3d:reducer:star');

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import createDebug from 'debug';
const debug = createDebug('d3d:reducer:rect');

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { removeObject, addObjectActive2D, setActive2D } from '../../../objectReducers.js';
import { Vector, Matrix } from 'cal';
import { Vector, Matrix } from '@doodle3d/cal';
import createDebug from 'debug';
const debug = createDebug('d3d:reducer:skewRect');

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
// import createDebug from 'debug';
// const debug = createDebug('d3d:reducer:star');

View File

@ -1,7 +1,7 @@
import update from 'react-addons-update';
import * as actions from '../../../../actions/index.js';
import { addObjectActive2D, addObject, setActive2D } from '../../../objectReducers.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import createDebug from 'debug';
const debug = createDebug('d3d:reducer:triangle');

View File

@ -1,4 +1,4 @@
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import update from 'react-addons-update';
import * as actions from '../../../actions/index.js';
import createDebug from 'debug';

View File

@ -1,5 +1,5 @@
import update from 'react-addons-update';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import { CANVAS_SIZE } from '../../../constants/d2Constants.js';
import * as actions from '../../../actions/index.js';
import { calculateGestureMatrix } from '../../../utils/matrixUtils.js';

View File

@ -1,5 +1,5 @@
import update from 'react-addons-update';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
import constrainMatrix from './constrainMatrix.js';
import { MAX_ZOOM } from '../../constants/d2Constants.js';

View File

@ -1,5 +1,5 @@
import update from 'react-addons-update';
import { Utils } from 'cal';
import { Utils } from '@doodle3d/cal';
import * as THREE from 'three';
import { SHAPE_TYPE_PROPERTIES } from '../../../constants/shapeTypeProperties.js';
import * as d3Tools from '../../../constants/d3Tools.js';

View File

@ -1,5 +1,5 @@
import update from 'react-addons-update';
import { Utils } from 'cal';
import { Utils } from '@doodle3d/cal';
import * as actions from '../../../actions/index.js';
import * as d3Tools from '../../../constants/d3Tools';
import { SHAPE_TYPE_PROPERTIES } from '../../../constants/shapeTypeProperties.js';

View File

@ -18,7 +18,7 @@ import d2PanZoomReducer from './d2/panReducer.js';
import selectionReducer from './selectionReducer.js';
import selectionOperationReducer from './selectionOperationReducer.js';
import contextReducer from './contextReducer.js';
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
import { setActiveSpace, addSpaceActive, setActive2D, getActive2D, addObject } from './objectReducers.js';
import menusReducer from './menusReducer.js';
// import createDebug from 'debug';

View File

@ -1,6 +1,6 @@
import update from 'react-addons-update';
import ClipperShape from 'clipper-js';
import { Matrix } from 'cal';
import ClipperShape from '@doodle3d/clipper-js';
import { Matrix } from '@doodle3d/cal';
import { addObject, removeObject } from './objectReducers.js';
import { recursiveClone } from '../utils/clone.js';
import { shapeToPoints } from '../shape/shapeToPoints.js';

View File

@ -1,6 +1,6 @@
import update from 'react-addons-update';
import * as actions from '../actions/index.js';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import { shapeToPoints } from '../shape/shapeToPoints.js';
import createDebug from 'debug';
const debug = createDebug('d3d:reducer:selection');

View File

@ -1,6 +1,6 @@
import fitCurve from 'fit-curve';
import Bezier from 'bezier-js';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
const DEFAULT_CURVE_ERROR = 3.0;
const DEFAULT_DISTANCE_THRESHOLD = 1.0;

View File

@ -1,4 +1,4 @@
import { Matrix, Vector } from 'cal';
import { Matrix, Vector } from '@doodle3d/cal';
export function calculateGestureMatrix(positions, previousPositions, screenMatrix, { rotate, scale, pan }) {
const matrix = screenMatrix.inverseMatrix();

View File

@ -1,4 +1,4 @@
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
export function convertEvent(DOMNode, event) {
const { left, top } = DOMNode.getBoundingClientRect();

View File

@ -1,7 +1,7 @@
import * as THREE from 'three';
import { shapeToPoints } from '../shape/shapeToPoints.js';
import { getPointsBounds } from '../shape/shapeDataUtils.js';
import { Vector } from 'cal';
import { Vector } from '@doodle3d/cal';
import arrayMemoizer from './arrayMemoizer.js';
import memoize from 'memoizee';
// import createDebug from 'debug';

View File

@ -1,6 +1,6 @@
import update from 'react-addons-update';
import { Matrix } from 'cal';
import ClipperShape from 'clipper-js';
import { Matrix } from '@doodle3d/cal';
import ClipperShape from '@doodle3d/clipper-js';
import { recursiveClone } from './clone.js';
import { addObject, removeObject } from '../reducer/objectReducers.js';
import { SHAPE_TYPE_PROPERTIES } from '../constants/shapeTypeProperties.js';

View File

@ -1,5 +1,5 @@
import { applyMatrixOnPath, pathToVectorPath } from './vectorUtils.js';
import { Matrix } from 'cal';
import { Matrix } from '@doodle3d/cal';
import TraceWorker from '../../workers/trace.worker.js';
import { getPixel } from './colorUtils.js';
import memoize from 'memoizee';

View File

@ -29,19 +29,6 @@ module.exports = {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
alias: {
'doodle3d-core': path.resolve(__dirname, devMode ? 'module' : 'lib'),
'clipper-lib': '@doodle3d/clipper-lib',
'clipper-js': '@doodle3d/clipper-js',
'cal': '@doodle3d/cal',
'touch-events': '@doodle3d/touch-events',
'potrace-js': '@doodle3d/potrace-js',
'fill-path': '@doodle3d/fill-path',
'threejs-export-stl': '@doodle3d/threejs-export-stl',
'threejs-export-obj': '@doodle3d/threejs-export-obj'
}
},
module: {
rules: [
{
@ -69,7 +56,7 @@ module.exports = {
}
}, {
test: /\.(woff)$/,
use: {
use: {
loader: 'file-loader'
}
}, {

View File

@ -1,6 +1,6 @@
import 'babel-polyfill';
import * as POTRACE from 'potrace-js';
import { POTRACE_OPTIONS } from 'doodle3d-core/constants/d2Constants.js';
import * as POTRACE from '@doodle3d/potrace-js';
import { POTRACE_OPTIONS } from '../src/constants/d2Constants.js';
self.addEventListener('message', (event) => {
switch (event.data.msg) {