mirror of
https://github.com/chanind/hanzi-writer.git
synced 2026-03-13 09:44:39 +08:00
fix: type exports (#214)
* Fix types bundle artifact for RecursivePartial Properly export PositionerOptions Bump packages * update(types) allow PositionerOptions (in HanziWriterOptions) to be optional * update(package.json) downgrade jest-canvas-mock to fix broken tests
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
"build/*",
|
||||
"examples/*",
|
||||
"babel.config.js",
|
||||
"rollup.config.js",
|
||||
"jest-setup.js"
|
||||
],
|
||||
"rules": {
|
||||
|
||||
30
package.json
30
package.json
@@ -8,31 +8,31 @@
|
||||
"module": "dist/index.esm.js",
|
||||
"types": "dist/types/index.esm.d.ts",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@babel/preset-typescript": "^7.10.4",
|
||||
"@rollup/plugin-babel": "^5.2.1",
|
||||
"@rollup/plugin-node-resolve": "^9.0.0",
|
||||
"@sinonjs/fake-timers": "^6.0.1",
|
||||
"@types/jest": "^26.0.14",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@babel/preset-typescript": "^7.12.7",
|
||||
"@rollup/plugin-babel": "^5.2.2",
|
||||
"@rollup/plugin-node-resolve": "^11.1.0",
|
||||
"@sinonjs/fake-timers": "^7.0.2",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/nise": "^1.4.0",
|
||||
"@types/sinonjs__fake-timers": "^6.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.4.0",
|
||||
"@typescript-eslint/parser": "^4.4.0",
|
||||
"@wessberg/rollup-plugin-ts": "^1.3.5",
|
||||
"codecov": "^3.8.0",
|
||||
"eslint": "^7.11.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.14.0",
|
||||
"@typescript-eslint/parser": "^4.14.0",
|
||||
"@wessberg/rollup-plugin-ts": "^1.3.8",
|
||||
"codecov": "^3.8.1",
|
||||
"eslint": "^7.18.0",
|
||||
"hanzi-writer-data": "^2.0.1",
|
||||
"jest-canvas-mock": "2.1.0",
|
||||
"jest-cli": "^26.5.3",
|
||||
"jest-cli": "^26.6.3",
|
||||
"jest-fetch-mock": "^3.0.3",
|
||||
"nise": "^4.0.4",
|
||||
"prettier": "^2.2.1",
|
||||
"rollup": "^2.29.0",
|
||||
"rollup": "^2.36.2",
|
||||
"rollup-plugin-filesize": "^9.1.0",
|
||||
"rollup-plugin-license": "^2.2.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"semantic-release": "^17.2.0",
|
||||
"semantic-release": "^17.3.3",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -9,11 +9,14 @@ const [from, to] = CHARACTER_BOUNDS;
|
||||
const preScaledWidth = to.x - from.x;
|
||||
const preScaledHeight = to.y - from.y;
|
||||
|
||||
interface PositionerOptions {
|
||||
export type PositionerOptions = {
|
||||
/** Default: 0 */
|
||||
width: number;
|
||||
/** Default: 0 */
|
||||
height: number;
|
||||
/** Default: 20 */
|
||||
padding: number;
|
||||
}
|
||||
};
|
||||
|
||||
export default class Positioner {
|
||||
padding: number;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import RenderTargetBase from '../renderers/RenderTargetBase';
|
||||
import { HanziWriterRendererConstructor } from '../renderers/HanziWriterRendererBase';
|
||||
import type { PositionerOptions } from '../Positioner';
|
||||
|
||||
export type { PositionerOptions };
|
||||
|
||||
export type CharacterJson = {
|
||||
strokes: string[];
|
||||
@@ -68,15 +71,6 @@ export type QuizOptions = {
|
||||
onComplete?: (summary: { character: string; totalMistakes: number }) => void;
|
||||
};
|
||||
|
||||
export type PositionerOptions = {
|
||||
/** Default: 20 */
|
||||
padding?: number;
|
||||
/** Default: 0 */
|
||||
width?: number;
|
||||
/** Default: 0 */
|
||||
height?: number;
|
||||
};
|
||||
|
||||
export type LoadingManagerOptions = {
|
||||
charDataLoader: CharDataLoaderFn;
|
||||
onLoadCharDataSuccess?: null | ((data: CharacterJson) => void);
|
||||
@@ -122,7 +116,7 @@ type BaseHanziWriterOptions = {
|
||||
strokeHighlightDuration: number;
|
||||
};
|
||||
|
||||
export type HanziWriterOptions = PositionerOptions &
|
||||
export type HanziWriterOptions = Partial<PositionerOptions> &
|
||||
QuizOptions &
|
||||
ColorOptions &
|
||||
LoadingManagerOptions &
|
||||
|
||||
Reference in New Issue
Block a user