refactor: refactor @idraw/board export

This commit is contained in:
chenshenhai 2022-02-27 17:20:53 +08:00
parent ebfa1905dd
commit 32b02e9ff7
9 changed files with 19 additions and 17 deletions

View file

@ -3,7 +3,7 @@
"version": "0.2.0-alpha.26",
"description": "",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.global.js",
"types": "dist/index.d.ts",
"scripts": {

View file

@ -0,0 +1,3 @@
import { Board } from './index';
export default Board;

View file

@ -0,0 +1,5 @@
import { Board } from './index';
export * from './index';
export default Board;

View file

@ -2,7 +2,7 @@ import {
TypeScreenPosition, TypeScreenSize, TypeScreenContext, TypePoint, TypePointCursor,
TypeBoardOptions, TypeBoardSizeOptions, TypeContext,
} from '@idraw/types';
import util from '@idraw/util';
import { throttle, Context } from '@idraw/util';
import { ScreenWatcher } from './lib/screen-watcher';
import { setStyle } from './lib/style';
import { TypeBoardEventArgMap } from './lib/event';
@ -16,14 +16,11 @@ import {
_screen, _tempData
} from './names';
const { Context } = util;
const { throttle } = util.time;
type PrivateOptions = TypeBoardOptions & {
devicePixelRatio: number
}
class Board {
export class Board {
private [_hasRendered] = false;
@ -342,5 +339,5 @@ class Board {
}
export default Board;

View file

@ -1,3 +1,3 @@
import util from '@idraw/util';
import { istype } from '@idraw/util';
export default util.istype;
export default istype;

View file

@ -1,5 +1,4 @@
import { TypePoint, TypeContext } from '@idraw/types';
// import util from '@idraw/util';
import { TypePoint, TypeContext } from '@idraw/types';
import { BoardEvent, TypeBoardEventArgMap } from './event';
import { TempData } from './watcher-temp';

View file

@ -3,7 +3,7 @@ import {
TypeScreenPosition,
TypeBoardScrollConfig,
} from '@idraw/types';
import util from '@idraw/util';
import { isColorStr } from '@idraw/util';
type TypeOptions = {
width: number,
@ -184,7 +184,7 @@ export class Scroller {
}
options.scrollConfig.lineWidth = Math.max(options.scrollConfig.lineWidth, defaultScrollConfig.lineWidth);
if (util.color.isColorStr(options.scrollConfig.color) !== true) {
if (isColorStr(options.scrollConfig.color) !== true) {
options.scrollConfig.color = options.scrollConfig.color;
}
return options;

View file

@ -1,7 +1,5 @@
import { TypeBoardOptions, TypeContext } from '@idraw/types';
import util from '@idraw/util';
const Context = util.Context;
import { Context } from '@idraw/util';
type TempDataDesc = {
ctx: TypeContext,

View file

@ -3,7 +3,7 @@
"version": "0.2.0-alpha.26",
"description": "",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.global.js",
"types": "dist/index.d.ts",
"scripts": {