@tldraw/core
Advanced tools
Comparing version 0.0.41 to 0.0.42
@@ -1,4 +0,8 @@ | ||
export * from './renderer'; | ||
export * from './components'; | ||
export * from './types'; | ||
export * from './utils'; | ||
export * from './inputs'; | ||
export interface Steve { | ||
age: string; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -16,3 +16,2 @@ import type React from 'react'; | ||
pan: (delta: number[], e: WheelEvent) => TLPointerInfo<'wheel'>; | ||
canAccept: (_pointerId: PointerEvent['pointerId']) => boolean; | ||
isDoubleClick(): boolean; | ||
@@ -31,1 +30,2 @@ clear(): void; | ||
export {}; | ||
//# sourceMappingURL=inputs.d.ts.map |
/// <reference types="react" /> | ||
import { TLShapeUtil, TLShape, TLBounds, TLRenderInfo, TLTransformInfo } from '../types'; | ||
import { TLShapeUtil, TLShape, TLBounds, TLRenderInfo, TLTransformInfo } from '+types'; | ||
export declare class ExampleShape extends TLShapeUtil<TLShape> { | ||
@@ -23,3 +23,3 @@ type: string; | ||
children?: string[] | undefined; | ||
handles?: Record<string, import("../types").TLHandle> | undefined; | ||
handles?: Record<string, import("+types").TLHandle> | undefined; | ||
isLocked?: boolean | undefined; | ||
@@ -42,1 +42,2 @@ isHidden?: boolean | undefined; | ||
} | ||
//# sourceMappingURL=example-shape.d.ts.map |
/// <reference types="react" /> | ||
export interface TLPage<T extends TLShape> { | ||
export interface TLPage<T extends TLShape, B extends TLBinding> { | ||
id: string; | ||
@@ -7,3 +7,3 @@ name?: string; | ||
shapes: Record<string, T>; | ||
bindings: Record<string, TLBinding>; | ||
bindings: Record<string, B>; | ||
backgroundColor?: string; | ||
@@ -17,3 +17,3 @@ } | ||
editingId?: string; | ||
editingBindingId?: string; | ||
bindingId?: string; | ||
boundsRotation?: number; | ||
@@ -31,2 +31,4 @@ currentParentId?: string; | ||
point: number[]; | ||
canBind?: boolean; | ||
bindingId?: string; | ||
} | ||
@@ -56,7 +58,7 @@ export interface TLShape { | ||
ref?: React.RefObject<T>; | ||
onTextChange?: TLCallbacks["onTextChange"]; | ||
onTextBlur?: TLCallbacks["onTextBlur"]; | ||
onTextFocus?: TLCallbacks["onTextFocus"]; | ||
onTextKeyDown?: TLCallbacks["onTextKeyDown"]; | ||
onTextKeyUp?: TLCallbacks["onTextKeyUp"]; | ||
onTextChange?: TLCallbacks['onTextChange']; | ||
onTextBlur?: TLCallbacks['onTextBlur']; | ||
onTextFocus?: TLCallbacks['onTextFocus']; | ||
onTextKeyDown?: TLCallbacks['onTextKeyDown']; | ||
onTextKeyUp?: TLCallbacks['onTextKeyUp']; | ||
} | ||
@@ -89,5 +91,5 @@ export interface TLTool { | ||
export declare type TLPointerEventHandler = (info: TLPointerInfo<string>, e: React.PointerEvent) => void; | ||
export declare type TLCanvasEventHandler = (info: TLPointerInfo<"canvas">, e: React.PointerEvent) => void; | ||
export declare type TLBoundsEventHandler = (info: TLPointerInfo<"bounds">, e: React.PointerEvent) => void; | ||
export declare type TLBoundsHandleEventHandler = (info: TLPointerInfo<TLBoundsCorner | TLBoundsEdge | "rotate">, e: React.PointerEvent) => void; | ||
export declare type TLCanvasEventHandler = (info: TLPointerInfo<'canvas'>, e: React.PointerEvent) => void; | ||
export declare type TLBoundsEventHandler = (info: TLPointerInfo<'bounds'>, e: React.PointerEvent) => void; | ||
export declare type TLBoundsHandleEventHandler = (info: TLPointerInfo<TLBoundsCorner | TLBoundsEdge | 'rotate'>, e: React.PointerEvent) => void; | ||
export interface TLCallbacks { | ||
@@ -214,3 +216,4 @@ onChange: (ids: string[]) => void; | ||
canEdit: boolean; | ||
abstract type: T["type"]; | ||
canBind: boolean; | ||
abstract type: T['type']; | ||
abstract defaultProps: T; | ||
@@ -228,13 +231,17 @@ abstract render(shape: T, info: TLRenderInfo): JSX.Element; | ||
getCenter(shape: T): number[]; | ||
getBindingPoint(shape: T, point: number[], origin: number[], direction: number[], padding: number, anywhere: boolean): { | ||
point: number[]; | ||
distance: number; | ||
} | undefined; | ||
create(props: Partial<T>): T; | ||
mutate(shape: T, props: Partial<T>): T; | ||
updateChildren<K extends TLShape>(_shape: T, _children: K[]): Partial<K>[] | void; | ||
onChildrenChange(_shape: T, _children: TLShape[]): Partial<T> | void; | ||
onBindingChange(_shape: T, _binding: TLBinding, _target: TLShape, _targetBounds: TLBounds): Partial<T> | void; | ||
onHandleChange(_shape: T, _handle: Partial<T["handles"]>, _info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onRightPointHandle(_shape: T, _handle: Partial<T["handles"]>, _info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onDoubleClickHandle(_shape: T, _handle: Partial<T["handles"]>, _info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onSessionComplete(_shape: T): Partial<T> | void; | ||
onBoundsReset(_shape: T): Partial<T> | void; | ||
onStyleChange(_shape: T): Partial<T> | void; | ||
updateChildren<K extends TLShape>(shape: T, children: K[]): Partial<K>[] | void; | ||
onChildrenChange(shape: T, children: TLShape[]): Partial<T> | void; | ||
onBindingChange(shape: T, binding: TLBinding, target: TLShape, targetBounds: TLBounds, center: number[]): Partial<T> | void; | ||
onHandleChange(shape: T, handle: Partial<T['handles']>, info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onRightPointHandle(shape: T, handle: Partial<T['handles']>, info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onDoubleClickHandle(shape: T, handle: Partial<T['handles']>, info: Partial<TLPointerInfo>): Partial<T> | void; | ||
onSessionComplete(shape: T): Partial<T> | void; | ||
onBoundsReset(shape: T): Partial<T> | void; | ||
onStyleChange(shape: T): Partial<T> | void; | ||
} | ||
@@ -252,3 +259,3 @@ export interface IShapeTreeNode { | ||
}> = { | ||
[P in T["type"]]: T extends any ? (P extends T["type"] ? T : never) : never; | ||
[P in T['type']]: T extends any ? (P extends T['type'] ? T : never) : never; | ||
}; | ||
@@ -258,2 +265,2 @@ export declare type RequiredKeys<T> = { | ||
}[keyof T]; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -7,1 +7,2 @@ import { Utils } from './utils'; | ||
export default Utils; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,5 +6,5 @@ import type { TLBounds, TLIntersection } from '../types'; | ||
lineSegment(origin: number[], direction: number[], a1: number[], a2: number[]): TLIntersection; | ||
rectangle(origin: number[], direction: number[], point: number[], size: number[]): TLIntersection[]; | ||
rectangle(origin: number[], direction: number[], point: number[], size: number[], rotation?: number): TLIntersection[]; | ||
ellipse(origin: number[], direction: number[], center: number[], rx: number, ry: number, rotation: number): TLIntersection; | ||
bounds(origin: number[], direction: number[], bounds: TLBounds): TLIntersection[]; | ||
bounds(origin: number[], direction: number[], bounds: TLBounds, rotation?: number): TLIntersection[]; | ||
}; | ||
@@ -22,3 +22,3 @@ static lineSegment: { | ||
static rectangle: { | ||
ray(point: number[], size: number[], origin: number[], direction: number[]): TLIntersection[]; | ||
ray(point: number[], size: number[], rotation: number, origin: number[], direction: number[]): TLIntersection[]; | ||
lineSegment(point: number[], size: number[], a1: number[], a2: number[]): TLIntersection[]; | ||
@@ -68,1 +68,2 @@ rectangle(point1: number[], size1: number[], point2: number[], size2: number[]): TLIntersection[]; | ||
export default Intersect; | ||
//# sourceMappingURL=intersect.d.ts.map |
@@ -1,1 +0,1 @@ | ||
export {}; | ||
//# sourceMappingURL=polyfills.d.ts.map |
@@ -15,1 +15,2 @@ export declare class Svg { | ||
export default Svg; | ||
//# sourceMappingURL=svg.d.ts.map |
@@ -53,3 +53,3 @@ import type React from 'react'; | ||
static rng(seed?: string): () => number; | ||
static getRectangleSides(point: number[], size: number[]): [string, number[][]][]; | ||
static getRectangleSides(point: number[], size: number[], rotation?: number): [string, number[][]][]; | ||
static getBoundsSides(bounds: TLBounds): [string, number[][]][]; | ||
@@ -475,1 +475,2 @@ static shallowEqual<T extends Record<string, unknown>>(objA: T, objB: T): boolean; | ||
}[keyof T]; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -10,2 +10,9 @@ export declare class Vec { | ||
/** | ||
* Clamp a value into a range. | ||
* @param n | ||
* @param min | ||
*/ | ||
static clampV(A: number[], min: number): number[]; | ||
static clampV(A: number[], min: number, max: number): number[]; | ||
/** | ||
* Negate a vector. | ||
@@ -288,1 +295,2 @@ * @param A | ||
export default Vec; | ||
//# sourceMappingURL=vec.d.ts.map |
{ | ||
"name": "@tldraw/core", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"private": false, | ||
@@ -21,6 +21,5 @@ "description": "A tiny little drawing app (core).", | ||
"scripts": { | ||
"dev": "node scripts/dev", | ||
"start": "node scripts/dev & tsc --watch --incremental --emitDeclarationOnly --declarationMap --outDir dist/types", | ||
"build": "yarn clean && node scripts/build && tsc --emitDeclarationOnly --outDir dist/types", | ||
"lint": "eslint src/ --ext .ts,.tsx", | ||
"test": "jest", | ||
"clean": "rm -rf dist", | ||
@@ -31,3 +30,3 @@ "ts-node": "ts-node", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.24", | ||
"@types/jest": "^27.0.1", | ||
"@types/node": "^15.0.1", | ||
@@ -38,8 +37,7 @@ "@types/react": "^17.0.16", | ||
"@typescript-eslint/parser": "^4.19.0", | ||
"babel-jest": "^27.0.6", | ||
"esbuild": "^0.11.11", | ||
"eslint": "^7.22.0", | ||
"jest": "^26.6.3", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"ts-jest": "^26.5.4", | ||
"ts-node": "^9.1.1", | ||
@@ -60,3 +58,3 @@ "tslib": "^2.3.0", | ||
}, | ||
"gitHead": "2fc7405d9668ba08e05b927c6311758223702e5b" | ||
"gitHead": "4a7439ddf81b615ee49fddbe00802699975f9375" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
313390
15
110
6271