You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@leafer/interface

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafer/interface - npm Package Compare versions

Comparing version
1.0.0-alpha.23
to
1.0.0-alpha.30
+5
src/control/IControl.ts
export interface IControl {
start(): void
stop(): void
destroy(): void
}
import { ILeaf } from '../ILeaf'
import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
export interface ILeafMask {
__updateMask?(value?: boolean): void
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
__removeMask?(child?: ILeaf): void
}
+1
-1
{
"name": "@leafer/interface",
"version": "1.0.0-alpha.23",
"version": "1.0.0-alpha.30",
"description": "@leafer/interface",

@@ -5,0 +5,0 @@ "author": "Chao (Leafer) Wan",

import { ILeafer } from './ILeafer'
export interface IApp extends ILeafer {
virtualCanvas: boolean
children: ILeafer[]
realCanvas: boolean
}

@@ -5,5 +5,5 @@ import { ILeaf } from '../display/ILeaf'

import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
import { ISelector } from '../selector/ISelector'
import { ISelector, ISelectorConfig } from '../selector/ISelector'
import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
import { IWatcher } from '../watcher/IWatcher'
import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
import { IAutoBounds, IScreenSizeData } from '../math/IMath'

@@ -13,2 +13,3 @@ import { ICanvasManager } from '../canvas/ICanvasManager'

import { IImageManager } from '../image/IImageManager'
import { IEventListenerId } from '../event/IEventer'
import { IObject } from '../data/IData'

@@ -18,3 +19,5 @@ import { IZoomView } from '../display/IView'

import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
import { IControl } from '../control/IControl'
export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'user'

@@ -24,9 +27,7 @@ export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {

type?: ILeaferType
virtualCanvas?: boolean
realCanvas?: boolean
}
export interface ILeafer extends IZoomView {
export interface ILeafer extends IZoomView, IControl {
creator: ICreator
readonly isApp: boolean

@@ -37,8 +38,8 @@ parent?: IApp

ready: boolean
viewReady: boolean
startTimer: number
pixelRatio: number
autoLayout?: IAutoBounds
view: unknown
view: unknown
canvas: ILeaferCanvas

@@ -57,10 +58,24 @@ renderer: IRenderer

autoLayout?: IAutoBounds
config: ILeaferConfig
start(): void
stop(): void
__eventIds: IEventListenerId[]
init(userConfig?: ILeaferConfig, parentApp?: IApp): void
forceFullRender(): void
resize(size: IScreenSizeData): void
}
export interface ILeaferTypeFunction {
(leafer: ILeafer): void
}
export interface ILeaferTypeList {
[key: string]: ILeaferTypeFunction
}
export interface ICreator {

@@ -71,6 +86,6 @@ image?(options?: ILeaferImageConfig): ILeaferImage

watcher?(target: ILeaf): IWatcher
layouter?(target: ILeaf): ILayouter
renderer?(target: ILeaf, canvas: ILeaferCanvas, options: IRendererConfig): IRenderer
selector?(target: ILeaf): ISelector
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer
selector?(target: ILeaf, options?: ISelectorConfig): ISelector

@@ -77,0 +92,0 @@ interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction

@@ -84,7 +84,7 @@ type GlobalCompositeOperation = 'color' | 'color-burn' | 'color-dodge' | 'copy' | 'darken' | 'destination-atop' | 'destination-in' | 'destination-out' | 'destination-over' | 'difference' | 'exclusion' | 'hard-light' | 'hue' | 'lighten' | 'lighter' | 'luminosity' | 'multiply' | 'overlay' | 'saturation' | 'screen' | 'soft-light' | 'source-atop' | 'source-in' | 'source-out' | 'source-over' | 'xor'

interface CanvasPath {
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
closePath(): void
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
lineTo(x: number, y: number): void

@@ -91,0 +91,0 @@ moveTo(x: number, y: number): void

@@ -13,2 +13,3 @@ import { IObject } from '../data/IData'

pixelRatio?: number
smooth?: boolean
hittable?: boolean

@@ -32,3 +33,3 @@ offscreen?: boolean

export interface ICanvasAttr extends ICanvasStrokeOptions {
export interface ICanvasAttr extends ICanvasStrokeOptions, IObject {

@@ -108,5 +109,6 @@ smooth: boolean // imageSmoothingEnabled: boolean

hitFill(point: IPointData, fillRule?: string): boolean
hitStroke(point: IPointData): boolean
hitStroke(point: IPointData, strokeWidth?: number): boolean
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
setStrokeOptions(options: ICanvasStrokeOptions): void

@@ -120,2 +122,4 @@ setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void

copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
fillWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void

@@ -131,6 +135,7 @@ strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void

readonly innerId: InnerId
name: string
manager: ICanvasManager
readonly innerId: InnerId
width: number

@@ -142,7 +147,15 @@ height: number

readonly pixelHeight: number
readonly allowBackgroundColor?: boolean
bounds: IBounds
config: ILeaferCanvasConfig
autoLayout: boolean
view: unknown
parentView: unknown
unreal?: boolean
offscreen: boolean

@@ -154,4 +167,7 @@

debug(): void
init(): void
setBackgroundColor(color: string): void
setHittable(hittable: boolean): void
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void

@@ -161,3 +177,3 @@ stopAutoLayout(): void

resize(size: IScreenSizeData): void
pixel(num: number): number
setViewSize(size: IScreenSizeData): void

@@ -171,3 +187,3 @@ // other

unloadView(): void
unrealCanvas(): void
destroy(): void

@@ -174,0 +190,0 @@ }

@@ -6,4 +6,3 @@ export type __Number = number // number | string will convert to number

export type __Value = __Number | __Boolean | __String | __Object //
export type ITimer = any
export interface IObject {

@@ -10,0 +9,0 @@ [name: string]: any

@@ -9,5 +9,8 @@ import { ILeaf, ILeafComputedData } from '../display/ILeaf'

__get(name: string): unknown
__setInput(name: string, value: unknown): void
__getInput(name: string): unknown
__removeInput(name: string): void
__getInputData(): IObject
__setMiddle(name: string, value: unknown): void

@@ -14,0 +17,0 @@ __getMiddle(name: string): unknown

@@ -17,2 +17,3 @@ import { ILeafer } from '../app/ILeafer'

import { ILeafRender } from './module/ILeafRender'
import { ILeafMask } from './module/ILeafMask'
import { ILeafData } from '../data/ILeafData'

@@ -54,4 +55,6 @@

hittable: __Boolean
hitType: IHitType
hitFill: IHitType
hitStroke: IHitType
hitChildren: __Boolean
hitSelf: __Boolean
}

@@ -61,7 +64,4 @@

| 'visible'
| 'fill-visible'
| 'stroke-visible'
| 'all'
| 'fill'
| 'stroke'
| 'always'
| 'none'

@@ -113,4 +113,6 @@ export type IBlendMode =

hittable?: __Boolean
hitType?: IHitType
hitFill?: IHitType
hitStroke?: IHitType
hitChildren?: __Boolean
hitSelf?: __Boolean
}

@@ -143,4 +145,6 @@ export interface ILeafComputedData {

hittable?: boolean
hitType?: IHitType
hitFill?: IHitType
hitStroke?: IHitType
hitChildren?: boolean
hitSelf?: boolean

@@ -152,5 +156,6 @@ // other

export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
tag: string
readonly __tag: string
readonly innerName: string

@@ -163,5 +168,6 @@ readonly __DataProcessor: IObject // IDataProcessor

readonly isApp?: boolean
isLeafer?: boolean
__isBranch?: boolean
__isBranchLeaf?: boolean
isBranch?: boolean
isBranchLeaf?: boolean

@@ -192,8 +198,12 @@ __: ILeafData

readonly __onlyHitMask: boolean
readonly __ignoreHitWorld: boolean
__parentWait?: IFunction[]
__leaferWait?: IFunction[]
__addParentWait(item: IFunction): void
__runParentWait(): void
waitParent(item: IFunction): void
waitLeafer(item: IFunction): void
__bindLeafer(leafer: ILeafer): void
__bindLeafer(leafer: ILeafer | null): void

@@ -206,5 +216,4 @@ set(data: IObject): void

__getAttr(attrName: string): __Value
__updateAttr(attrName?: string, value?: __Value): void
forceUpdate(): void
forceUpdate(attrName?: string): void

@@ -231,2 +240,7 @@ // ILeafMatrix ->

// IBranchMask ->
__updateMask(value?: boolean): void
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
__removeMask(child?: ILeaf): void
// convert

@@ -233,0 +247,0 @@ getWorld(attrName: IMatrixDecompositionAttr): number

@@ -9,4 +9,3 @@ import { ILeaf } from '../ILeaf'

__getAttr?(name: string): __Value
__updateAttr?(name?: string, value?: __Value): void
}

@@ -67,2 +67,3 @@ import { IEventer } from './IEventer'

readonly data: ILayoutBlockData[]
readonly times: number
}

@@ -69,0 +70,0 @@

export { IApp } from './app/IApp'
export { ILeafer, ILeaferType, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
export { ILeafer, ILeaferType, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode } from './display/ILeaf'

@@ -17,2 +17,3 @@ export { IBranch } from './display/IBranch'

export { ILeafEventer, ILeafEventerModule } from './display/module/ILeafEventer'
export { ILeafMask, ILeafMaskModule } from './display/module/ILeafMask'

@@ -22,3 +23,3 @@ export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'

export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
export { ISelector, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
export { ISelector, ISelectorConfig, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'

@@ -30,2 +31,3 @@ export { ICanvasManager } from './canvas/ICanvasManager'

export { IControl } from './control/IControl'
export { IPlatform } from './platform/IPlatform'

@@ -36,3 +38,3 @@ export { IPlugin } from './plugin/IPlugin'

export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
export { IPathDrawer } from './path/IPathDrawer'
export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'

@@ -49,5 +51,5 @@ export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'

export { __Number, __Boolean, __String, __Object, __Value, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
export { __Number, __Boolean, __String, __Object, __Value, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
export { IFunction } from './function/IFunction'

@@ -8,4 +8,5 @@ import { INumberFunction, IPointDataFunction } from '../function/IFunction'

import { IBounds } from '../math/IMath'
import { IControl } from '../control/IControl'
export interface IInteraction {
export interface IInteraction extends IControl {
target: ILeaf

@@ -24,6 +25,4 @@ canvas: IInteractionCanvas

downData: IPointerEvent
downTime: number
start(): void
stop(): void
pointerDown(data: IPointerEvent): void

@@ -40,4 +39,2 @@ pointerMove(data: IPointerEvent): void

emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
destroy(): void
}

@@ -70,3 +67,3 @@

through?: boolean
tapMulti?: boolean
tapMore?: boolean
tapTime?: number

@@ -73,0 +70,0 @@ longPressTime?: number

@@ -61,3 +61,3 @@ import { IBoundsData, IMatrixData, IMatrixDecompositionData } from '../math/IMath'

update(): void
checkUpdate(): void

@@ -64,0 +64,0 @@ getTransform(locationType: ILayoutLocationType): IMatrixData

import { IBounds } from '../math/IMath'
import { ILeaf } from '../display/ILeaf'
import { ILeafList } from '../data/IList'
import { IControl } from '../control/IControl'

@@ -33,3 +34,3 @@ export interface ILayoutChangedData {

export interface ILayouter {
export interface ILayouter extends IControl {
target: ILeaf

@@ -41,12 +42,14 @@ layoutedBlocks: ILayoutBlockData[]

disabled: boolean
running: boolean
changed: boolean
layouting: boolean
waitAgain: boolean
config: ILayouterConfig
start(): void
stop(): void
update(): void
disable(): void
layout(): void
layoutAgain(): void
layoutOnce(): void

@@ -58,5 +61,3 @@ partLayout(): void

getBlocks(list: ILeafList): ILayoutBlockData[]
setBlocks(current: ILayoutBlockData[]): void
destroy(): void
addBlocks(current: ILayoutBlockData[]): void
}

@@ -95,2 +95,3 @@ import { IObject } from '../data/IData'

addPoint(x: number, y: number): void
addBounds(x: number, y: number, width: number, height: number): void
add(pointBounds: ITwoPointBoundsData): void

@@ -168,2 +169,3 @@ }

divide(matrix: IMatrixData): IMatrix
preMultiply(matrix: IMatrixData): IMatrix
invert(): IMatrix

@@ -170,0 +172,0 @@

@@ -37,3 +37,3 @@ type Command = number

type endAngle = number
type counterclockwise = boolean
type anticlockwise = boolean
type cornerRadius = number | number[]

@@ -44,4 +44,4 @@ type radius = number

export type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]
export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise]
export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, counterclockwise]
export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]
export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]
export type ArcToCommandData = [Command, x1, y1, x2, y2, radius]

@@ -48,0 +48,0 @@

@@ -0,1 +1,2 @@

import { IPathCommandData } from './IPathCommand'
export interface IPathDrawer {

@@ -10,8 +11,27 @@ beginPath?(): void

arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
rect(x: number, y: number, width: number, height: number): void
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): void
}
export interface IPathCreator {
path: IPathCommandData
beginPath(): IPathCreator
moveTo(x: number, y: number): IPathCreator
lineTo(x: number, y: number): IPathCreator
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): IPathCreator
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator
closePath(): IPathCreator
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
rect(x: number, y: number, width: number, height: number): IPathCreator
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
}
import { IFunction } from '../function/IFunction'
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
import { ILeaf } from '../display/ILeaf'

@@ -9,2 +10,3 @@ export interface IPlatform {

conicGradientRotate90?: boolean // fixfox need rotate
layout(target: ILeaf): void
}

@@ -5,2 +5,3 @@ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'

import { IFunction } from '../function/IFunction'
import { IControl } from '../control/IControl'

@@ -17,5 +18,6 @@ export interface IRenderOptions {

maxFPS?: number
fill?: string
}
export interface IRenderer {
export interface IRenderer extends IControl {
target: ILeaf

@@ -30,2 +32,5 @@ canvas: ILeaferCanvas

running: boolean
rendering: boolean
waitAgain: boolean
changed: boolean

@@ -35,4 +40,2 @@

start(): void
stop(): void
update(): void

@@ -43,2 +46,3 @@

render(callback?: IFunction): void
renderAgain(): void
renderOnce(callback?: IFunction): void

@@ -49,6 +53,7 @@ partRender(): void

renderHitView(options: IRenderOptions): void
renderBoundsView(options: IRenderOptions): void
addBlock(block: IBounds): void
mergeBlocks(): void
destroy(): void
}

@@ -12,12 +12,19 @@ import { ILeaf } from '../display/ILeaf'

export interface ISelectPathOptions {
name?: string
through?: boolean
exclude?: ILeafList
ignoreHittable?: boolean
}
export interface ISelectorConfig {
}
export interface ISelector {
target: ILeaf
defaultPath: ILeafList
getHitPointPath(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
config: ISelectorConfig
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[]

@@ -24,0 +31,0 @@ getByInnerId(name: number, branch?: ILeaf): ILeaf

import { ILeaf } from '../display/ILeaf'
import { ILeafList } from '../data/IList'
import { IControl } from '../control/IControl'

@@ -12,3 +13,3 @@ export interface IWatchEventData {

export interface IWatcher {
export interface IWatcher extends IControl {
target: ILeaf

@@ -19,2 +20,3 @@ updatedList: ILeafList

disabled: boolean
running: boolean

@@ -25,7 +27,5 @@ changed: boolean

start(): void
stop(): void
disable(): void
update(): void
destroy(): void
}