├── packages ├── app │ ├── README.md │ ├── src │ │ └── index.ts │ ├── package.json │ └── LICENSE ├── hit │ ├── README.md │ ├── src │ │ ├── index.ts │ │ ├── selector.ts │ │ ├── pick.ts │ │ ├── TextHit.ts │ │ ├── RectHit.ts │ │ ├── canvas.ts │ │ ├── HitCanvasManager.ts │ │ └── LeafHit.ts │ ├── package.json │ └── LICENSE ├── platform │ ├── canvaskit │ │ ├── src │ │ │ └── index.ts │ │ ├── README.md │ │ ├── package.json │ │ └── LICENSE │ ├── web │ │ ├── README.md │ │ ├── src │ │ │ └── index.ts │ │ ├── package.json │ │ └── LICENSE │ ├── node │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ └── core.ts │ │ ├── LICENSE │ │ └── package.json │ ├── worker │ │ ├── README.md │ │ ├── src │ │ │ └── index.ts │ │ ├── LICENSE │ │ └── package.json │ └── miniapp │ │ ├── README.md │ │ ├── src │ │ └── index.ts │ │ ├── LICENSE │ │ └── package.json ├── event │ ├── README.md │ ├── src │ │ ├── TouchEvent.ts │ │ ├── MoveEvent.ts │ │ ├── ZoomEvent.ts │ │ ├── PointerButton.ts │ │ ├── SwipeEvent.ts │ │ ├── RotateEvent.ts │ │ ├── KeyEvent.ts │ │ ├── index.ts │ │ ├── DropEvent.ts │ │ ├── Keyboard.ts │ │ ├── PointerEvent.ts │ │ ├── UIEvent.ts │ │ └── DragEvent.ts │ ├── package.json │ └── LICENSE ├── core │ ├── core │ │ ├── README.md │ │ ├── src │ │ │ └── index.ts │ │ ├── package.json │ │ └── LICENSE │ └── draw │ │ ├── README.md │ │ ├── src │ │ └── index.ts │ │ ├── package.json │ │ └── LICENSE ├── display │ ├── README.md │ ├── src │ │ ├── index.ts │ │ ├── Path.ts │ │ ├── Rect.ts │ │ ├── Frame.ts │ │ ├── Image.ts │ │ ├── Star.ts │ │ ├── Polygon.ts │ │ ├── Line.ts │ │ ├── Ellipse.ts │ │ ├── Pen.ts │ │ └── Group.ts │ ├── package.json │ └── LICENSE ├── external │ ├── README.md │ ├── package.json │ ├── src │ │ ├── color.ts │ │ └── index.ts │ └── LICENSE ├── partner │ ├── mask │ │ ├── README.md │ │ ├── package.json │ │ └── LICENSE │ ├── text │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── TextCase.ts │ │ │ ├── TextRowHelper.ts │ │ │ ├── TextDecoration.ts │ │ │ ├── TextClip.ts │ │ │ ├── TextLayout.ts │ │ │ ├── TextConvert.ts │ │ │ └── CharType.ts │ │ ├── package.json │ │ └── LICENSE │ ├── color │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ └── color.ts │ │ ├── package.json │ │ └── LICENSE │ ├── effect │ │ ├── README.md │ │ ├── src │ │ │ ├── BackgroundBlur.ts │ │ │ ├── Blur.ts │ │ │ ├── index.ts │ │ │ └── InnerShadow.ts │ │ ├── package.json │ │ └── LICENSE │ ├── image │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── recycle.ts │ │ │ └── pattern.ts │ │ └── LICENSE │ ├── paint │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── FillText.ts │ │ │ ├── Fill.ts │ │ │ ├── Stroke.ts │ │ │ └── Shape.ts │ │ ├── package.json │ │ └── LICENSE │ ├── gradient │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── conic.ts │ │ │ ├── linear.ts │ │ │ └── radial.ts │ │ ├── package.json │ │ └── LICENSE │ └── partner │ │ ├── README.md │ │ ├── src │ │ └── index.ts │ │ ├── package.json │ │ └── LICENSE ├── decorator │ ├── README.md │ ├── src │ │ ├── index.ts │ │ └── data.ts │ ├── package.json │ └── LICENSE ├── interface │ ├── README.md │ ├── src │ │ ├── module │ │ │ ├── IUIHit.ts │ │ │ ├── ITextConvert.ts │ │ │ ├── IUIBounds.ts │ │ │ ├── IColorConvert.ts │ │ │ ├── IPathArrow.ts │ │ │ ├── IExport.ts │ │ │ ├── IFilter.ts │ │ │ ├── ITransition.ts │ │ │ ├── IEffect.ts │ │ │ ├── IState.ts │ │ │ └── IUIRender.ts │ │ ├── ICachedShape.ts │ │ ├── type │ │ │ ├── IStringType.ts │ │ │ └── IComputedType.ts │ │ ├── app │ │ │ ├── IApp.ts │ │ │ └── ILeafer.ts │ │ ├── IScroller.ts │ │ └── IAnimation.ts │ ├── package.json │ └── LICENSE ├── display-module │ ├── data │ │ ├── README.md │ │ ├── src │ │ │ ├── StarData.ts │ │ │ ├── FrameData.ts │ │ │ ├── GroupData.ts │ │ │ ├── PenData.ts │ │ │ ├── PolygonData.ts │ │ │ ├── PathData.ts │ │ │ ├── RectData.ts │ │ │ ├── EllipseData.ts │ │ │ ├── LineData.ts │ │ │ ├── LeaferData.ts │ │ │ ├── BoxData.ts │ │ │ ├── index.ts │ │ │ ├── CanvasData.ts │ │ │ ├── ImageData.ts │ │ │ └── TextData.ts │ │ ├── package.json │ │ └── LICENSE │ ├── bounds │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ └── UIBounds.ts │ │ ├── package.json │ │ └── LICENSE │ ├── render │ │ ├── README.md │ │ ├── src │ │ │ ├── index.ts │ │ │ └── RectRender.ts │ │ ├── package.json │ │ └── LICENSE │ └── display-module │ │ ├── README.md │ │ ├── src │ │ └── index.ts │ │ ├── package.json │ │ └── LICENSE └── interaction │ ├── interaction │ ├── README.md │ ├── src │ │ ├── index.ts │ │ ├── Cursor.ts │ │ ├── config.ts │ │ ├── emit.ts │ │ └── InteractionHelper.ts │ ├── package.json │ └── LICENSE │ ├── interaction-web │ ├── README.md │ ├── src │ │ ├── index.ts │ │ ├── KeyEventHelper.ts │ │ └── PointerEventHelper.ts │ ├── package.json │ └── LICENSE │ └── interaction-miniapp │ ├── README.md │ ├── src │ ├── index.ts │ └── PointerEventHelper.ts │ ├── package.json │ └── LICENSE ├── src └── index.ts ├── .gitignore ├── LICENSE ├── contributor ├── code │ ├── LICENSE │ ├── README.md │ └── Checkerboard.ts └── CODE_OF_CONDUCT.md └── package.json /packages/app/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/app 2 | -------------------------------------------------------------------------------- /packages/hit/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/hit 2 | -------------------------------------------------------------------------------- /packages/platform/canvaskit/src/index.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/event/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/event 2 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/web' 2 | -------------------------------------------------------------------------------- /packages/app/src/index.ts: -------------------------------------------------------------------------------- 1 | export { App } from './App' -------------------------------------------------------------------------------- /packages/core/core/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/core 2 | -------------------------------------------------------------------------------- /packages/core/draw/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/draw 2 | -------------------------------------------------------------------------------- /packages/display/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/display 2 | -------------------------------------------------------------------------------- /packages/external/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/external 2 | -------------------------------------------------------------------------------- /packages/partner/mask/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/mask 2 | -------------------------------------------------------------------------------- /packages/partner/text/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/text 2 | -------------------------------------------------------------------------------- /packages/platform/web/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/web 2 | -------------------------------------------------------------------------------- /packages/decorator/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/decorator 2 | -------------------------------------------------------------------------------- /packages/interface/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/interface 2 | -------------------------------------------------------------------------------- /packages/partner/color/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/color 2 | -------------------------------------------------------------------------------- /packages/partner/effect/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/effect 2 | -------------------------------------------------------------------------------- /packages/partner/image/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/image 2 | -------------------------------------------------------------------------------- /packages/partner/paint/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/paint 2 | -------------------------------------------------------------------------------- /packages/platform/node/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/node 2 | -------------------------------------------------------------------------------- /packages/platform/worker/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/worker 2 | -------------------------------------------------------------------------------- /packages/display-module/data/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/data 2 | -------------------------------------------------------------------------------- /packages/partner/gradient/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/gradient 2 | -------------------------------------------------------------------------------- /packages/partner/partner/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/partner 2 | -------------------------------------------------------------------------------- /packages/platform/miniapp/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/miniapp 2 | -------------------------------------------------------------------------------- /packages/display-module/bounds/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/bounds 2 | -------------------------------------------------------------------------------- /packages/display-module/render/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/render 2 | -------------------------------------------------------------------------------- /packages/platform/canvaskit/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/canvaskit 2 | -------------------------------------------------------------------------------- /packages/interaction/interaction/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/interaction 2 | -------------------------------------------------------------------------------- /packages/display-module/display-module/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/display-module 2 | -------------------------------------------------------------------------------- /packages/interaction/interaction-web/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/interaction-web 2 | -------------------------------------------------------------------------------- /packages/display-module/bounds/src/index.ts: -------------------------------------------------------------------------------- 1 | export { UIBounds } from "./UIBounds" 2 | -------------------------------------------------------------------------------- /packages/interaction/interaction-miniapp/README.md: -------------------------------------------------------------------------------- 1 | # @leafer-ui/interaction-miniapp 2 | -------------------------------------------------------------------------------- /packages/interaction/interaction-web/src/index.ts: -------------------------------------------------------------------------------- 1 | export { Interaction } from './Interaction' -------------------------------------------------------------------------------- /packages/interaction/interaction-miniapp/src/index.ts: -------------------------------------------------------------------------------- 1 | export { Interaction } from './Interaction' -------------------------------------------------------------------------------- /packages/decorator/src/index.ts: -------------------------------------------------------------------------------- 1 | export { effectType, resizeType, zoomLayerType, createAttr } from './data' -------------------------------------------------------------------------------- /packages/display-module/render/src/index.ts: -------------------------------------------------------------------------------- 1 | export { UIRender } from './UIRender' 2 | export { RectRender } from './RectRender' 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | lib 3 | types 4 | node_modules 5 | 6 | .DS_Store 7 | .idea 8 | .vscode 9 | 10 | .eslintcache 11 | *.tsbuildinfo 12 | *.log -------------------------------------------------------------------------------- /packages/display-module/display-module/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/data' 2 | export * from '@leafer-ui/bounds' 3 | export * from '@leafer-ui/render' -------------------------------------------------------------------------------- /packages/interface/src/module/IUIHit.ts: -------------------------------------------------------------------------------- 1 | import { ILeafHit } from '@leafer/interface' 2 | 3 | import { IUI } from '../IUI' 4 | 5 | export type IUIHitModule = ILeafHit & ThisType -------------------------------------------------------------------------------- /packages/core/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/draw' 2 | 3 | export * from '@leafer-ui/app' 4 | 5 | export * from '@leafer-ui/interaction' 6 | export * from '@leafer-ui/event' 7 | export * from '@leafer-ui/hit' -------------------------------------------------------------------------------- /packages/display-module/data/src/StarData.ts: -------------------------------------------------------------------------------- 1 | import { IStarData } from '@leafer-ui/interface' 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class StarData extends UIData implements IStarData { 7 | 8 | } -------------------------------------------------------------------------------- /packages/interface/src/module/ITextConvert.ts: -------------------------------------------------------------------------------- 1 | import { ITextData, ITextDrawData } from '../IUI' 2 | 3 | export interface ITextConvertModule { 4 | getDrawData(content: string | number, style: ITextData): ITextDrawData 5 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/FrameData.ts: -------------------------------------------------------------------------------- 1 | import { IFrameData } from '@leafer-ui/interface' 2 | 3 | import { BoxData } from './BoxData' 4 | 5 | 6 | export class FrameData extends BoxData implements IFrameData { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /packages/display-module/data/src/GroupData.ts: -------------------------------------------------------------------------------- 1 | import { IGroupData } from '@leafer-ui/interface' 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class GroupData extends UIData implements IGroupData { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /packages/display-module/data/src/PenData.ts: -------------------------------------------------------------------------------- 1 | import { IPenData } from '@leafer-ui/interface' 2 | 3 | import { GroupData } from './GroupData' 4 | 5 | 6 | export class PenData extends GroupData implements IPenData { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /packages/interaction/interaction/src/index.ts: -------------------------------------------------------------------------------- 1 | export { InteractionBase } from './Interaction' 2 | export { InteractionHelper } from './InteractionHelper' 3 | export { Cursor } from './Cursor' 4 | export { Dragger } from './Dragger' -------------------------------------------------------------------------------- /packages/partner/color/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IColorConvertModule } from '@leafer-ui/interface' 2 | 3 | import { string } from './color' 4 | 5 | 6 | export const ColorConvertModule = { 7 | string 8 | } as IColorConvertModule -------------------------------------------------------------------------------- /packages/core/draw/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer/core' 2 | 3 | export * from '@leafer-ui/display' 4 | export * from '@leafer-ui/display-module' 5 | export * from '@leafer-ui/decorator' 6 | 7 | export * from '@leafer-ui/external' -------------------------------------------------------------------------------- /packages/display-module/data/src/PolygonData.ts: -------------------------------------------------------------------------------- 1 | import { IPolygonData } from '@leafer-ui/interface' 2 | 3 | import { LineData } from './LineData' 4 | 5 | 6 | export class PolygonData extends LineData implements IPolygonData { 7 | 8 | } -------------------------------------------------------------------------------- /packages/partner/text/src/index.ts: -------------------------------------------------------------------------------- 1 | import { ITextConvertModule } from '@leafer-ui/interface' 2 | 3 | import { getDrawData } from './TextConvert' 4 | 5 | export const TextConvertModule: ITextConvertModule = { 6 | getDrawData 7 | } -------------------------------------------------------------------------------- /packages/interface/src/module/IUIBounds.ts: -------------------------------------------------------------------------------- 1 | import { ILeafBounds } from '@leafer/interface' 2 | 3 | import { IUI } from '../IUI' 4 | 5 | export type IUIBoundsModule = IUIBounds & ThisType 6 | 7 | interface IUIBounds extends ILeafBounds { 8 | } -------------------------------------------------------------------------------- /packages/hit/src/index.ts: -------------------------------------------------------------------------------- 1 | export { HitCanvasManager } from './HitCanvasManager' 2 | 3 | import './selector' 4 | 5 | import './LeafHit' 6 | import './UIHit' 7 | import './RectHit' 8 | import './TextHit' 9 | 10 | import './pick' 11 | import './canvas' -------------------------------------------------------------------------------- /packages/display-module/data/src/PathData.ts: -------------------------------------------------------------------------------- 1 | import { IPathData } from '@leafer-ui/interface' 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class PathData extends UIData implements IPathData { 7 | public get __pathInputed(): number { return 2 } 8 | } -------------------------------------------------------------------------------- /packages/partner/effect/src/BackgroundBlur.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas } from '@leafer/interface' 2 | import { IUI, ICachedShape } from '@leafer-ui/interface' 3 | 4 | export function backgroundBlur(_ui: IUI, _current: ILeaferCanvas, _shape: ICachedShape): void { 5 | 6 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/RectData.ts: -------------------------------------------------------------------------------- 1 | import { IRectData } from "@leafer-ui/interface" 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class RectData extends UIData implements IRectData { 7 | get __boxStroke(): boolean { return !(this as IRectData).__pathInputed } 8 | } -------------------------------------------------------------------------------- /packages/interface/src/module/IColorConvert.ts: -------------------------------------------------------------------------------- 1 | import { IColor, IRGBA } from '../type/IType' 2 | 3 | export interface IColorConvertModule { 4 | string(color: IColor, opacity?: number): string 5 | object(color: IColor, opacity?: number): IRGBA 6 | hasTransparent(color: string): boolean 7 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/EllipseData.ts: -------------------------------------------------------------------------------- 1 | import { IEllipseData } from '@leafer-ui/interface' 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class EllipseData extends UIData implements IEllipseData { 7 | get __boxStroke(): boolean { return !(this as IEllipseData).__pathInputed } 8 | } -------------------------------------------------------------------------------- /packages/hit/src/selector.ts: -------------------------------------------------------------------------------- 1 | import { Platform, Creator } from '@leafer/core' 2 | 3 | import { ISelector, ILeaf } from '@leafer-ui/interface' 4 | 5 | 6 | Platform.getSelector = function (leaf: ILeaf): ISelector { 7 | return leaf.leafer ? leaf.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector())) 8 | } -------------------------------------------------------------------------------- /packages/event/src/TouchEvent.ts: -------------------------------------------------------------------------------- 1 | import { ITouchEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { UIEvent } from './UIEvent' 5 | 6 | 7 | @registerUIEvent() 8 | export class TouchEvent extends UIEvent implements ITouchEvent { 9 | 10 | } 11 | 12 | export const MyTouchEvent = TouchEvent -------------------------------------------------------------------------------- /packages/interface/src/module/IPathArrow.ts: -------------------------------------------------------------------------------- 1 | import { IPathDataArrow, IPathDataArrowMap } from '../type/IType' 2 | import { IUI } from '../IUI' 3 | 4 | 5 | export interface IPathArrowModule { 6 | list: IPathDataArrowMap 7 | addArrows(ui: IUI): void 8 | register(name: string, data: IPathDataArrow): void 9 | get(name: string): IPathDataArrow 10 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/LineData.ts: -------------------------------------------------------------------------------- 1 | import { ILineData } from "@leafer-ui/interface" 2 | 3 | import { UIData } from "./UIData" 4 | 5 | 6 | export class LineData extends UIData implements ILineData { 7 | 8 | public get __usePathBox(): boolean { 9 | return ((this as ILineData).points || (this as ILineData).__pathInputed) as any as boolean 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/partner/gradient/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IPaintGradientModule } from '@leafer-ui/interface' 2 | 3 | import { linearGradient } from './linear' 4 | import { radialGradient, getTransform } from './radial' 5 | import { conicGradient } from './conic' 6 | 7 | 8 | export const PaintGradientModule: IPaintGradientModule = { 9 | linearGradient, 10 | radialGradient, 11 | conicGradient, 12 | getTransform 13 | } -------------------------------------------------------------------------------- /packages/partner/effect/src/Blur.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas } from '@leafer/interface' 2 | 3 | import { IUI } from '@leafer-ui/interface' 4 | 5 | export function blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void { 6 | const { blur } = ui.__ 7 | origin.setWorldBlur(blur * ui.__nowWorld.a) 8 | origin.copyWorldToInner(current, ui.__nowWorld, ui.__layout.renderBounds) 9 | origin.filter = 'none' 10 | } 11 | -------------------------------------------------------------------------------- /packages/interface/src/module/IExport.ts: -------------------------------------------------------------------------------- 1 | import { ILeaf, IExportFileType, IExportOptions, IExportResult } from '@leafer/interface' 2 | 3 | 4 | export interface IExportModule { 5 | running?: boolean 6 | export(leaf: ILeaf, filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise 7 | syncExport(leaf: ILeaf, filename: string, options?: IExportOptions | number | boolean): IExportResult 8 | } -------------------------------------------------------------------------------- /packages/interaction/interaction/src/Cursor.ts: -------------------------------------------------------------------------------- 1 | import { ICursorTypeMap, ICursorType } from '@leafer/interface' 2 | 3 | 4 | export class Cursor { 5 | 6 | static custom: ICursorTypeMap = {} 7 | 8 | static set(name: string, value: ICursorType | ICursorType[]): void { 9 | this.custom[name] = value 10 | } 11 | 12 | static get(name: string): ICursorType | ICursorType[] { 13 | return this.custom[name] 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /packages/interface/src/ICachedShape.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas, IBoundsData, ICachedLeaf } from '@leafer/interface' 2 | 3 | export interface ICachedShape extends ICachedLeaf { 4 | worldCanvas?: ILeaferCanvas // 元素太大放不下,经过裁剪后的元素区域缓存画布 5 | shapeBounds: IBoundsData // 形状内容的包围盒,可能缩小了,但未进行偏移 6 | // bounds: IBoundsData // 形状内容的包围盒,可能会缩小、偏移至原点 7 | renderBounds: IBoundsData // 渲染内容的包围盒,可能会缩小、偏移至原点 8 | scaleX: number 9 | scaleY: number 10 | } 11 | -------------------------------------------------------------------------------- /packages/event/src/MoveEvent.ts: -------------------------------------------------------------------------------- 1 | import { IMoveEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { DragEvent } from './DragEvent' 5 | 6 | @registerUIEvent() 7 | export class MoveEvent extends DragEvent implements IMoveEvent { 8 | 9 | static BEFORE_MOVE = 'move.before_move' 10 | 11 | static START = 'move.start' 12 | static MOVE = 'move' 13 | static END = 'move.end' 14 | 15 | readonly moveType: 'drag' | 'move' 16 | } -------------------------------------------------------------------------------- /packages/hit/src/pick.ts: -------------------------------------------------------------------------------- 1 | import { Platform } from '@leafer/core' 2 | 3 | import { IPointData, IPickOptions, IPickResult } from '@leafer-ui/interface' 4 | import { Group, emptyData } from '@leafer-ui/draw' 5 | 6 | 7 | Group.prototype.pick = function (hitPoint: IPointData, options?: IPickOptions): IPickResult { 8 | options || (options = emptyData) 9 | this.updateLayout() 10 | return Platform.getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, { ...options, target: this }) 11 | } -------------------------------------------------------------------------------- /packages/partner/text/src/TextCase.ts: -------------------------------------------------------------------------------- 1 | import { ITextCase } from '@leafer-ui/interface' 2 | 3 | export function getTextCase(char: string, textCase: ITextCase, firstChar?: boolean): string { 4 | switch (textCase) { 5 | case 'title': 6 | return firstChar ? char.toUpperCase() : char 7 | case 'upper': 8 | return char.toUpperCase() 9 | case 'lower': 10 | return char.toLowerCase() 11 | default: 12 | return char 13 | } 14 | } -------------------------------------------------------------------------------- /packages/interaction/interaction-web/src/KeyEventHelper.ts: -------------------------------------------------------------------------------- 1 | import { IKeyCodes, IKeyEvent } from '@leafer/interface' 2 | import { InteractionHelper } from '@leafer-ui/core' 3 | 4 | 5 | export const KeyEventHelper = { 6 | 7 | convert(e: KeyboardEvent): IKeyEvent { 8 | const base = InteractionHelper.getBase(e) 9 | const data: IKeyEvent = { 10 | ...base, 11 | code: e.code as IKeyCodes, 12 | key: e.key 13 | } 14 | return data 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /packages/interface/src/type/IStringType.ts: -------------------------------------------------------------------------------- 1 | export type IPercent = string 2 | export type IColorString = string 3 | 4 | export type ICornerRadiusString = string 5 | export type IStrokeWidthString = string 6 | export type IDashPatternString = string 7 | 8 | export type IPaintString = ISolidPaintString | IGradientPaintString | IImagePaintString 9 | export type ISolidPaintString = string 10 | export type IGradientPaintString = string 11 | export type IImagePaintString = string 12 | 13 | export type IShadowString = string -------------------------------------------------------------------------------- /packages/event/src/ZoomEvent.ts: -------------------------------------------------------------------------------- 1 | import { IZoomEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { PointerEvent } from './PointerEvent' 5 | 6 | @registerUIEvent() 7 | export class ZoomEvent extends PointerEvent implements IZoomEvent { 8 | 9 | static BEFORE_ZOOM = 'zoom.before_zoom' 10 | 11 | static START = 'zoom.start' 12 | static ZOOM = 'zoom' 13 | static END = 'zoom.end' 14 | 15 | readonly scale: number 16 | readonly totalScale: number 17 | 18 | } -------------------------------------------------------------------------------- /packages/event/src/PointerButton.ts: -------------------------------------------------------------------------------- 1 | import { IUIEvent } from '@leafer/interface' 2 | 3 | 4 | export const PointerButton = { 5 | 6 | LEFT: 1, 7 | 8 | RIGHT: 2, 9 | 10 | MIDDLE: 4, 11 | 12 | defaultLeft(event: IUIEvent): void { if (!event.buttons) event.buttons = 1 }, 13 | 14 | left(event: IUIEvent): boolean { return event.buttons === 1 }, 15 | 16 | right(event: IUIEvent): boolean { return event.buttons === 2 }, 17 | 18 | middle(event: IUIEvent): boolean { return event.buttons === 4 } 19 | 20 | } -------------------------------------------------------------------------------- /packages/event/src/SwipeEvent.ts: -------------------------------------------------------------------------------- 1 | import { ISwipeEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { DragEvent } from './DragEvent' 5 | 6 | 7 | @registerUIEvent() 8 | export class SwipeEvent extends DragEvent implements ISwipeEvent { 9 | 10 | static SWIPE = 'swipe' 11 | 12 | static LEFT = 'swipe.left' 13 | static RIGHT = 'swipe.right' 14 | static UP = 'swipe.up' 15 | static DOWN = 'swipe.down' 16 | 17 | readonly speed: number 18 | readonly direction: string 19 | 20 | } -------------------------------------------------------------------------------- /packages/event/src/RotateEvent.ts: -------------------------------------------------------------------------------- 1 | import { IRotateEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { PointerEvent } from './PointerEvent' 5 | 6 | 7 | @registerUIEvent() 8 | export class RotateEvent extends PointerEvent implements IRotateEvent { 9 | 10 | static BEFORE_ROTATE = 'rotate.before_rotate' 11 | 12 | static START = 'rotate.start' 13 | static ROTATE = 'rotate' 14 | static END = 'rotate.end' 15 | 16 | readonly rotation: number 17 | readonly totalRotation: number 18 | 19 | } -------------------------------------------------------------------------------- /packages/hit/src/TextHit.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas } from '@leafer/interface' 2 | import { Text } from '@leafer-ui/draw' 3 | 4 | 5 | Text.prototype.__drawHitPath = function (canvas: ILeaferCanvas): void { 6 | const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__ 7 | 8 | canvas.beginPath() 9 | 10 | if (__letterSpacing < 0) this.__drawPathByBox(canvas) 11 | else data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight)) 12 | } 13 | 14 | -------------------------------------------------------------------------------- /packages/event/src/KeyEvent.ts: -------------------------------------------------------------------------------- 1 | import { IKeyCodes, IKeyEvent } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { UIEvent } from './UIEvent' 5 | 6 | 7 | @registerUIEvent() 8 | export class KeyEvent extends UIEvent implements IKeyEvent { 9 | 10 | static BEFORE_DOWN = 'key.before_down' 11 | static BEFORE_UP = 'key.before_up' 12 | 13 | static DOWN = 'key.down' 14 | static HOLD = 'key.hold' 15 | static UP = 'key.up' 16 | 17 | public readonly code: IKeyCodes 18 | public readonly key: string 19 | 20 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/LeaferData.ts: -------------------------------------------------------------------------------- 1 | import { canvasSizeAttrs } from '@leafer/core' 2 | 3 | import { ILeaferData, IObject, IJSONOptions } from '@leafer-ui/interface' 4 | 5 | import { GroupData } from './GroupData' 6 | 7 | export class LeaferData extends GroupData implements ILeaferData { 8 | 9 | public __getInputData(names?: string[] | IObject, options?: IJSONOptions): IObject { 10 | const data = super.__getInputData(names, options) 11 | canvasSizeAttrs.forEach(key => delete (data as IObject)[key]) 12 | return data 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/display/src/index.ts: -------------------------------------------------------------------------------- 1 | export { UI } from './UI' 2 | 3 | export { Leafer } from './Leafer' 4 | export { Group } from './Group' 5 | export { Box } from './Box' 6 | export { Frame } from './Frame' 7 | 8 | export { Rect } from './Rect' 9 | export { Ellipse } from './Ellipse' 10 | export { Polygon } from './Polygon' 11 | export { Star } from './Star' 12 | export { Line } from './Line' 13 | 14 | export { Image, MyImage } from './Image' 15 | export { Canvas } from './Canvas' 16 | 17 | export { Text } from './Text' 18 | 19 | export { Path } from './Path' 20 | export { Pen } from './Pen' 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /packages/display/src/Path.ts: -------------------------------------------------------------------------------- 1 | import { dataProcessor, affectStrokeBoundsType, registerUI } from '@leafer/core' 2 | 3 | import { IPath, IPathData, IPathInputData, IStrokeAlign } from '@leafer-ui/interface' 4 | import { PathData } from '@leafer-ui/data' 5 | 6 | import { UI } from './UI' 7 | 8 | 9 | @registerUI() 10 | export class Path extends UI implements IPath { 11 | 12 | public get __tag() { return 'Path' } 13 | 14 | @dataProcessor(PathData) 15 | declare public __: IPathData 16 | 17 | @affectStrokeBoundsType('center') 18 | declare public strokeAlign?: IStrokeAlign 19 | 20 | } -------------------------------------------------------------------------------- /packages/interface/src/app/IApp.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferConfig } from '@leafer/interface' 2 | 3 | import { ILeafer } from './ILeafer' 4 | import { IEditorConfig } from '../editor/IEditor' 5 | 6 | export interface IApp extends ILeafer { 7 | children: ILeafer[] 8 | realCanvas: boolean 9 | forEach(fn: IAppForEachFunction): void 10 | } 11 | 12 | export interface IAppConfig extends ILeaferConfig { 13 | ground?: ILeaferConfig 14 | tree?: ILeaferConfig 15 | sky?: ILeaferConfig 16 | editor?: IEditorConfig 17 | } 18 | 19 | export interface IAppForEachFunction { 20 | (value: ILeafer, index: number, array: ILeafer[]): void 21 | } -------------------------------------------------------------------------------- /packages/display/src/Rect.ts: -------------------------------------------------------------------------------- 1 | import { dataProcessor, registerUI, rewriteAble, useModule } from '@leafer/core' 2 | 3 | import { IRect, IRectInputData, IRectData } from '@leafer-ui/interface' 4 | import { RectData } from '@leafer-ui/data' 5 | import { RectRender } from '@leafer-ui/display-module' 6 | 7 | import { UI } from './UI' 8 | 9 | 10 | @useModule(RectRender) 11 | @rewriteAble() 12 | @registerUI() 13 | export class Rect extends UI implements IRect { // tip: rewrited Box 14 | 15 | public get __tag() { return 'Rect' } 16 | 17 | @dataProcessor(RectData) 18 | declare public __: IRectData 19 | 20 | } -------------------------------------------------------------------------------- /packages/event/src/index.ts: -------------------------------------------------------------------------------- 1 | export { UIEvent } from './UIEvent' 2 | export { DragEvent, MyDragEvent } from './DragEvent' 3 | export { DropEvent } from './DropEvent' 4 | export { MoveEvent } from './MoveEvent' 5 | export { PointerEvent, MyPointerEvent } from './PointerEvent' 6 | export { TouchEvent, MyTouchEvent } from './TouchEvent' 7 | export { RotateEvent } from './RotateEvent' 8 | export { SwipeEvent } from './SwipeEvent' 9 | export { ZoomEvent } from './ZoomEvent' 10 | export { KeyEvent } from './KeyEvent' 11 | 12 | export { Keyboard } from './Keyboard' 13 | export { PointerButton } from './PointerButton' 14 | export { DragBoundsHelper } from './DragBoundsHelper' -------------------------------------------------------------------------------- /packages/platform/canvaskit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/canvaskit", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/canvaskit", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/platform/canvaskit", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /packages/interface/src/app/ILeafer.ts: -------------------------------------------------------------------------------- 1 | import { IControl, ILeaferAttrData, ILeaferType } from '@leafer/interface' 2 | import { IApp } from './IApp' 3 | import { IGroup } from '../IUI' 4 | import { IEditorBase } from '../editor/IEditor' 5 | 6 | export interface ILeafer extends IGroup, ILeaferAttrData, IControl { 7 | readonly isApp: boolean 8 | readonly app: ILeafer 9 | parentApp?: IApp 10 | parent?: IApp 11 | zoomLayer: IGroup 12 | editor: IEditorBase 13 | 14 | ground?: ILeafer 15 | tree?: ILeafer 16 | sky?: ILeafer 17 | 18 | onInit(): void 19 | initType(type: ILeaferType): void 20 | destroy(sync?: boolean): void 21 | } 22 | -------------------------------------------------------------------------------- /packages/partner/paint/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IPaintModule } from '@leafer-ui/interface' 2 | 3 | import { fill, fills, fillPathOrText } from './Fill' 4 | import { fillText } from './FillText' 5 | import { stroke, strokes } from './Stroke' 6 | import { strokeText, drawTextStroke, drawStrokesStyle } from './StrokeText' 7 | import { shape } from './Shape' 8 | import { compute } from './Compute' 9 | 10 | 11 | export const PaintModule: IPaintModule = { 12 | compute, 13 | 14 | fill, 15 | fills, 16 | fillPathOrText, 17 | fillText, 18 | 19 | stroke, 20 | strokes, 21 | strokeText, 22 | drawTextStroke, 23 | drawStrokesStyle, 24 | 25 | shape 26 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/BoxData.ts: -------------------------------------------------------------------------------- 1 | import { IBox, IBoxData } from '@leafer-ui/interface' 2 | 3 | import { GroupData } from "./GroupData" 4 | 5 | 6 | export class BoxData extends GroupData implements IBoxData { 7 | 8 | public get __boxStroke(): boolean { return !(this as IBoxData).__pathInputed } 9 | 10 | // 当成整体处理 11 | public get __drawAfterFill(): boolean { const t = this as IBoxData; return t.__single || t.__clipAfterFill } 12 | 13 | public get __clipAfterFill(): boolean { const t = this as IBoxData; return t.overflow !== 'show' && t.__leaf.children.length && ((t.__leaf as IBox).isOverflow || super.__clipAfterFill) as unknown as boolean } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /packages/display-module/data/src/index.ts: -------------------------------------------------------------------------------- 1 | export { UIData } from './UIData' 2 | export { GroupData } from './GroupData' 3 | export { BoxData } from './BoxData' 4 | 5 | export { LeaferData } from './LeaferData' 6 | export { FrameData } from './FrameData' 7 | 8 | export { LineData } from './LineData' 9 | export { RectData } from './RectData' 10 | export { EllipseData } from './EllipseData' 11 | export { PolygonData } from './PolygonData' 12 | export { StarData } from './StarData' 13 | export { PathData } from './PathData' 14 | export { PenData } from './PenData' 15 | export { TextData } from './TextData' 16 | export { ImageData } from './ImageData' 17 | export { CanvasData } from './CanvasData' -------------------------------------------------------------------------------- /packages/event/src/DropEvent.ts: -------------------------------------------------------------------------------- 1 | import { IDropEvent, ILeaf, ILeafList, IObject } from '@leafer/interface' 2 | import { registerUIEvent } from '@leafer/core' 3 | 4 | import { PointerEvent } from './PointerEvent' 5 | import { DragEvent } from './DragEvent' 6 | 7 | 8 | @registerUIEvent() 9 | export class DropEvent extends PointerEvent implements IDropEvent { 10 | 11 | static DROP = 'drop' 12 | 13 | readonly list: ILeafList 14 | readonly data: IObject 15 | 16 | static setList(data: ILeaf | ILeaf[] | ILeafList): void { 17 | DragEvent.setList(data) 18 | } 19 | 20 | static setData(data: IObject): void { 21 | DragEvent.setData(data) 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/CanvasData.ts: -------------------------------------------------------------------------------- 1 | import { ICanvas, ICanvasData, ICanvasInputData, IObject, IJSONOptions } from '@leafer-ui/interface' 2 | 3 | import { RectData } from './RectData' 4 | 5 | 6 | export class CanvasData extends RectData implements ICanvasData { 7 | 8 | public get __isCanvas(): boolean { return true } 9 | public get __drawAfterFill(): boolean { return true } 10 | 11 | public __getInputData(names?: string[] | IObject, options?: IJSONOptions): IObject { 12 | const data: ICanvasInputData = super.__getInputData(names, options) 13 | data.url = (this.__leaf as ICanvas).canvas.toDataURL('image/png') as string 14 | return data 15 | } 16 | } -------------------------------------------------------------------------------- /packages/partner/text/src/TextRowHelper.ts: -------------------------------------------------------------------------------- 1 | import { ITextRowData, ITextCharData } from '@leafer-ui/interface' 2 | 3 | 4 | export const TextRowHelper = { 5 | 6 | trimRight(row: ITextRowData): void { 7 | const { words } = row 8 | let trimRight = 0, len = words.length, char: ITextCharData 9 | 10 | for (let i = len - 1; i > -1; i--) { 11 | char = words[i].data[0] 12 | if (char.char === ' ') { 13 | trimRight++ 14 | row.width -= char.width 15 | } else { 16 | break 17 | } 18 | } 19 | 20 | if (trimRight) words.splice(len - trimRight, trimRight) 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /packages/partner/effect/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IEffectModule, ILeafShadowEffect } from '@leafer-ui/interface' 2 | 3 | import { shadow, getShadowRenderSpread, getShadowTransform } from './Shadow' 4 | import { innerShadow, getInnerShadowSpread } from './InnerShadow' 5 | import { blur } from './Blur' 6 | import { backgroundBlur } from './BackgroundBlur' 7 | 8 | 9 | export const EffectModule: IEffectModule = { 10 | shadow, 11 | innerShadow, 12 | blur, 13 | backgroundBlur, 14 | 15 | // @leafer-in/shadow will rewrite 16 | getShadowRenderSpread, 17 | getShadowTransform, 18 | isTransformShadow(_shadow: ILeafShadowEffect): boolean { return undefined }, 19 | 20 | getInnerShadowSpread 21 | } -------------------------------------------------------------------------------- /packages/interface/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/interface", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/interface", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/interface", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/interface": "1.12.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/platform/worker/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/interface' 2 | 3 | export * from './core' 4 | export * from '@leafer/partner' 5 | 6 | export * from '@leafer-ui/core' 7 | export * from '@leafer-ui/partner' 8 | 9 | import { ICreator } from '@leafer/interface' 10 | import { useCanvas, Creator, LeaferCanvas } from './core' 11 | import { HitCanvasManager, InteractionBase } from '@leafer-ui/core' 12 | 13 | 14 | Object.assign(Creator, { 15 | interaction: (target, canvas, selector, options?) => new InteractionBase(target, canvas, selector, options), 16 | hitCanvas: (options?, manager?) => new LeaferCanvas(options, manager), 17 | hitCanvasManager: () => new HitCanvasManager() 18 | } as ICreator) 19 | 20 | useCanvas('canvas') -------------------------------------------------------------------------------- /packages/partner/color/src/color.ts: -------------------------------------------------------------------------------- 1 | import { isString, isNumber, isUndefined } from '@leafer/core' 2 | 3 | import { IColor } from '@leafer-ui/interface' 4 | import { ColorConvert } from '@leafer-ui/draw' 5 | 6 | 7 | export function string(color: IColor, opacity?: number): string { 8 | if (!color) return '#000' 9 | const doOpacity = isNumber(opacity) && opacity < 1 10 | if (isString(color)) { 11 | if (doOpacity && ColorConvert.object) color = ColorConvert.object(color) 12 | else return color 13 | } 14 | let a = isUndefined(color.a) ? 1 : color.a 15 | if (doOpacity) a *= opacity 16 | const rgb = color.r + ',' + color.g + ',' + color.b 17 | return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')' 18 | } -------------------------------------------------------------------------------- /packages/platform/node/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/interface' 2 | 3 | export * from './core' 4 | export * from '@leafer/partner' 5 | 6 | export * from '@leafer-ui/core' 7 | export * from '@leafer-ui/partner' 8 | 9 | export * from '@leafer-in/export' 10 | 11 | import { ICreator } from '@leafer/interface' 12 | import { Creator, LeaferCanvas } from './core' 13 | import { InteractionBase, HitCanvasManager } from '@leafer-ui/core' 14 | 15 | 16 | Object.assign(Creator, { 17 | interaction: (target, canvas, selector, options?) => { return new InteractionBase(target, canvas, selector, options) }, 18 | hitCanvas: (options?, manager?) => new LeaferCanvas(options, manager), 19 | hitCanvasManager: () => new HitCanvasManager() 20 | } as ICreator) 21 | -------------------------------------------------------------------------------- /packages/event/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/event", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/event", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/event", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer/interface": "1.12.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/external/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/external", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/external", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/external", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer-ui/interface": "1.12.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/display/src/Frame.ts: -------------------------------------------------------------------------------- 1 | import { dataProcessor, registerUI, affectRenderBoundsType, surfaceType } from '@leafer/core' 2 | 3 | import { IFrame, IFrameData, IFrameInputData, IFill, IOverflow } from '@leafer-ui/interface' 4 | import { FrameData } from '@leafer-ui/data' 5 | 6 | import { Box } from './Box' 7 | 8 | 9 | @registerUI() 10 | export class Frame extends Box implements IFrame { 11 | 12 | public get __tag() { return 'Frame' } 13 | 14 | public get isFrame(): boolean { return true } 15 | 16 | @dataProcessor(FrameData) 17 | declare public __: IFrameData 18 | 19 | @surfaceType('#FFFFFF') 20 | declare public fill?: IFill 21 | 22 | @affectRenderBoundsType('hide') 23 | declare public overflow?: IOverflow 24 | 25 | } 26 | -------------------------------------------------------------------------------- /packages/hit/src/RectHit.ts: -------------------------------------------------------------------------------- 1 | import { IRadiusPointData } from '@leafer/interface' 2 | import { BoundsHelper } from '@leafer/core' 3 | import { UI, Rect, Box } from '@leafer-ui/draw' 4 | 5 | 6 | const ui = UI.prototype, rect = Rect.prototype, box = Box.prototype 7 | 8 | // hit 9 | 10 | rect.__updateHitCanvas = box.__updateHitCanvas = function () { 11 | if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all') ui.__updateHitCanvas.call(this) 12 | else if (this.__hitCanvas) this.__hitCanvas = null 13 | } 14 | 15 | rect.__hitFill = box.__hitFill = function (inner: IRadiusPointData): boolean { 16 | return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner) 17 | } -------------------------------------------------------------------------------- /packages/display-module/bounds/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/bounds", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/bounds", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display-module/bounds", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer-ui/interface": "1.12.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/platform/web/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/interface' 2 | 3 | export * from './core' 4 | export * from '@leafer/partner' 5 | 6 | export * from '@leafer-ui/core' 7 | export * from '@leafer-ui/interaction-web' 8 | export * from '@leafer-ui/partner' 9 | 10 | import { ICreator } from '@leafer/interface' 11 | import { useCanvas, Creator, LeaferCanvas } from './core' 12 | import { HitCanvasManager } from '@leafer-ui/core' 13 | import { Interaction } from '@leafer-ui/interaction-web' 14 | 15 | 16 | Object.assign(Creator, { 17 | interaction: (target, canvas, selector, options?) => new Interaction(target, canvas, selector, options), 18 | hitCanvas: (options?, manager?) => new LeaferCanvas(options, manager), 19 | hitCanvasManager: () => new HitCanvasManager() 20 | } as ICreator) 21 | 22 | useCanvas('canvas') -------------------------------------------------------------------------------- /packages/partner/color/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/color", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/color", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/color", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer-ui/interface": "1.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/partner/text/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/text", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/text", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/text", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer/interface": "1.12.0", 25 | "@leafer-ui/interface": "1.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/decorator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/decorator", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/decorator", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/decorator", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer/interface": "1.12.0", 25 | "@leafer-ui/interface": "1.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/display-module/display-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/display-module", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/display-module", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display-module/display-module", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer-ui/data": "1.12.0", 22 | "@leafer-ui/bounds": "1.12.0", 23 | "@leafer-ui/render": "1.12.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/hit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/hit", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/hit", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/hit", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/partner/partner/src/index.ts: -------------------------------------------------------------------------------- 1 | // leaferui's partner, allow replace 2 | import { Paint, PaintImage, PaintGradient, Effect, TextConvert, ColorConvert } from '@leafer-ui/draw' 3 | 4 | import { PaintModule } from '@leafer-ui/paint' 5 | import { PaintImageModule } from '@leafer-ui/image' 6 | import { PaintGradientModule } from '@leafer-ui/gradient' 7 | import { EffectModule } from '@leafer-ui/effect' 8 | import '@leafer-ui/mask' 9 | 10 | import { TextConvertModule } from '@leafer-ui/text' 11 | import { ColorConvertModule } from '@leafer-ui/color' 12 | 13 | 14 | Object.assign(TextConvert, TextConvertModule) 15 | Object.assign(ColorConvert, ColorConvertModule) 16 | 17 | Object.assign(Paint, PaintModule) 18 | Object.assign(PaintImage, PaintImageModule) 19 | Object.assign(PaintGradient, PaintGradientModule) 20 | 21 | Object.assign(Effect, EffectModule) -------------------------------------------------------------------------------- /packages/interaction/interaction-miniapp/src/PointerEventHelper.ts: -------------------------------------------------------------------------------- 1 | import { IPointData, IPointerEvent } from '@leafer/interface' 2 | import { InteractionHelper } from '@leafer-ui/core' 3 | 4 | 5 | export const PointerEventHelper = { 6 | 7 | convertTouch(e: TouchEvent, local: IPointData): IPointerEvent { 8 | const touch = PointerEventHelper.getTouch(e) 9 | const base = InteractionHelper.getBase(e) 10 | return { 11 | ...base, 12 | x: local.x, 13 | y: local.y, 14 | width: 1, 15 | height: 1, 16 | pointerType: 'touch', 17 | multiTouch: e.touches.length > 1, 18 | pressure: touch.force || 1, 19 | } 20 | }, 21 | 22 | getTouch(e: TouchEvent): Touch { 23 | return e.touches[0] || e.changedTouches[0] 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /packages/interaction/interaction/src/config.ts: -------------------------------------------------------------------------------- 1 | import { IInteractionConfig } from '@leafer/interface' 2 | 3 | export const config: IInteractionConfig = { 4 | wheel: { 5 | zoomSpeed: 0.5, 6 | moveSpeed: 0.5, 7 | rotateSpeed: 0.5, 8 | delta: { x: 80 / 4, y: 8.0 }, // 基准速度(会影响zoomSpeed),可根据不同系统、浏览器细化定制 9 | }, 10 | pointer: { 11 | type: 'pointer', 12 | snap: true, 13 | hitRadius: 5, 14 | tapTime: 120, 15 | longPressTime: 800, 16 | transformTime: 500, 17 | hover: true, 18 | dragHover: true, 19 | dragDistance: 2, 20 | swipeDistance: 20, 21 | }, 22 | touch: { 23 | preventDefault: 'auto' 24 | }, 25 | multiTouch: {}, 26 | move: { autoDistance: 2 }, 27 | zoom: {}, 28 | cursor: true, 29 | keyEvent: true 30 | } -------------------------------------------------------------------------------- /packages/display-module/render/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/render", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/render", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display-module/render", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer-ui/external": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer/interface": "1.12.0", 25 | "@leafer-ui/interface": "1.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/interaction/interaction-miniapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/interaction-miniapp", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/interaction-miniapp", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/interaction/interaction-miniapp", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer-ui/core": "1.12.0" 22 | }, 23 | "devDependencies": { 24 | "@leafer/interface": "1.12.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/partner/mask/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/mask", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/mask", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/mask", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/interaction/interaction-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/interaction-web", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/interaction-web", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/interaction/interaction-web", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/core": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/partner/effect/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/effect", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/effect", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/effect", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/partner/image/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/image", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/image", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/image", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/partner/paint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/paint", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/paint", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/paint", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/partner/image/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IPaintImageModule } from '@leafer-ui/interface' 2 | 3 | import { image } from './image' 4 | import { createData, getPatternData } from './data' 5 | import { fillOrFitMode, clipMode, repeatMode, stretchMode } from './mode' 6 | import { createPatternTask, createPattern, getPatternFixScale } from './pattern' 7 | import { checkImage, drawImage, getImageRenderScaleData } from './check' 8 | import { recycleImage } from './recycle' 9 | 10 | 11 | export const PaintImageModule: IPaintImageModule = { 12 | image, 13 | 14 | checkImage, 15 | drawImage, 16 | getImageRenderScaleData, 17 | recycleImage, 18 | 19 | createPatternTask, 20 | createPattern, 21 | getPatternFixScale, 22 | 23 | createData, 24 | getPatternData, 25 | 26 | stretchMode, 27 | fillOrFitMode, 28 | clipMode, 29 | repeatMode 30 | } -------------------------------------------------------------------------------- /packages/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/app", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/app", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/app", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/display": "1.12.0", 23 | "@leafer-ui/data": "1.12.0" 24 | }, 25 | "devDependencies": { 26 | "@leafer/interface": "1.12.0", 27 | "@leafer-ui/interface": "1.12.0" 28 | } 29 | } -------------------------------------------------------------------------------- /packages/display-module/data/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/data", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/data", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display-module/data", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/external": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/event/src/Keyboard.ts: -------------------------------------------------------------------------------- 1 | import { IBooleanMap, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, IUIEvent } from '@leafer/interface' 2 | 3 | 4 | const downKeyMap: IBooleanMap = {} 5 | 6 | export const Keyboard = { 7 | 8 | isHoldSpaceKey(): boolean { 9 | return Keyboard.isHold('Space') 10 | }, 11 | 12 | isHold(code: IShortcutKeyCodes): boolean { 13 | return downKeyMap[code] 14 | }, 15 | 16 | // 是否按住快捷键,可扩展语义化快捷键组合 ctrl + F || shift + F 17 | isHoldKeys(shortcutKeys: IShortcutKeysCheck | IShortcutKeys, e?: IUIEvent): boolean { 18 | return e ? (shortcutKeys as IShortcutKeysCheck)(e) : undefined 19 | }, 20 | 21 | setDownCode(code: string): void { 22 | if (!downKeyMap[code]) downKeyMap[code] = true 23 | }, 24 | 25 | setUpCode(code: string): void { 26 | downKeyMap[code] = false 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /packages/partner/gradient/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/gradient", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/gradient", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/gradient", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0" 23 | }, 24 | "devDependencies": { 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/interface": "1.12.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/display/src/Image.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferImage, IString } from '@leafer/interface' 2 | import { boundsType, dataProcessor, registerUI, isArray } from '@leafer/core' 3 | 4 | import { IImage, IImageInputData, IImageData } from '@leafer-ui/interface' 5 | import { ImageData } from '@leafer-ui/data' 6 | 7 | import { Rect } from './Rect' 8 | 9 | 10 | @registerUI() 11 | export class Image extends Rect implements IImage { 12 | 13 | public get __tag() { return 'Image' } 14 | 15 | @dataProcessor(ImageData) 16 | declare public __: IImageData 17 | 18 | @boundsType('') 19 | public url: IString 20 | 21 | public get ready(): boolean { const { image } = this; return image && image.ready } 22 | 23 | public get image(): ILeaferImage { const { fill } = this.__; return isArray(fill) && fill[0].image } 24 | 25 | } 26 | 27 | export const MyImage = Image -------------------------------------------------------------------------------- /packages/external/src/color.ts: -------------------------------------------------------------------------------- 1 | export function hasTransparent(color?: string): boolean { 2 | 3 | if (!color || color.length === 7 || color.length === 4) return false 4 | if (color === 'transparent') return true // transparent keyword 5 | 6 | const first = color[0] 7 | 8 | if (first === '#') { 9 | 10 | // hex 11 | switch (color.length) { 12 | case 5: return color[4] !== 'f' && color[4] !== 'F' // #RGBA 13 | case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F') // #RRGGBBAA 14 | } 15 | 16 | } else if (first === 'r' || first === 'h') { 17 | 18 | // rgba(...) or hsla(...) 19 | if (color[3] === 'a') { 20 | const i = color.lastIndexOf(',') 21 | if (i > -1) return parseFloat(color.slice(i + 1)) < 1 22 | } 23 | 24 | } 25 | 26 | return false 27 | 28 | } -------------------------------------------------------------------------------- /packages/interaction/interaction/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/interaction", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/interaction", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/interaction/interaction", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/draw": "1.12.0", 23 | "@leafer-ui/event": "1.12.0" 24 | }, 25 | "devDependencies": { 26 | "@leafer/interface": "1.12.0", 27 | "@leafer-ui/interface": "1.12.0" 28 | } 29 | } -------------------------------------------------------------------------------- /packages/partner/partner/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/partner", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/partner", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/partner/partner", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer-ui/draw": "1.12.0", 22 | "@leafer-ui/paint": "1.12.0", 23 | "@leafer-ui/effect": "1.12.0", 24 | "@leafer-ui/text": "1.12.0", 25 | "@leafer-ui/color": "1.12.0" 26 | }, 27 | "devDependencies": { 28 | "@leafer-ui/interface": "1.12.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/display/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/display", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/display", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/display", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer-ui/data": "1.12.0", 23 | "@leafer-ui/display-module": "1.12.0", 24 | "@leafer-ui/decorator": "1.12.0", 25 | "@leafer-ui/external": "1.12.0" 26 | }, 27 | "devDependencies": { 28 | "@leafer/interface": "1.12.0", 29 | "@leafer-ui/interface": "1.12.0" 30 | } 31 | } -------------------------------------------------------------------------------- /packages/interface/src/module/IFilter.ts: -------------------------------------------------------------------------------- 1 | import { IMatrixWithBoundsScaleData, ILeaferCanvas, IFilter } from '@leafer/interface' 2 | 3 | import { IUI } from '../IUI' 4 | import { ICachedShape } from '../ICachedShape' 5 | 6 | 7 | export interface IFilterModule { 8 | list: IFilterProcessorMap 9 | register(name: string, filterProcessor: IFilterProcessor): void 10 | apply(filters: IFilter[], ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void 11 | getSpread(filters: IFilter[]): number 12 | } 13 | 14 | interface IFilterProcessorMap { 15 | [name: string]: IFilterProcessor 16 | } 17 | 18 | export interface IFilterProcessor { 19 | apply: IFilterFunction, 20 | getSpread(filter: IFilter): number 21 | } 22 | 23 | export interface IFilterFunction { 24 | (filter: IFilter, ui: IUI, bounds: IMatrixWithBoundsScaleData, currentCanvas: ILeaferCanvas, originCanvas: ILeaferCanvas, shape: ICachedShape): void 25 | } 26 | -------------------------------------------------------------------------------- /packages/interface/src/module/ITransition.ts: -------------------------------------------------------------------------------- 1 | import { IObject } from '@leafer/interface' 2 | import { IColor, IGradientPaint } from '../type/IType' 3 | 4 | export interface ITransitionModule { 5 | list: ITransitionMap 6 | register(attrName: string, fn: ITransitionFunction): void 7 | get(attrName: string): ITransitionFunction 8 | 9 | setBetweenStyle(betweenStyle: IObject, fromStyle: IObject, toStyle: IObject, bothStyle: IObject, t: number, target: any, attrs?: IObject): void 10 | 11 | value(from: any, to: any, t: number, target?: IObject): any 12 | number(from: number, to: number, t: number, roundValue?: number): number 13 | color(from: IColor, to: IColor, t: number): string 14 | gradient(from: IGradientPaint, to: IGradientPaint, t: number, target: IObject): IGradientPaint 15 | } 16 | 17 | export interface ITransitionMap { 18 | [name: string]: ITransitionFunction 19 | } 20 | 21 | export interface ITransitionFunction { 22 | (from: any, to: any, t: number, target?: any): any 23 | } -------------------------------------------------------------------------------- /packages/core/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/core", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/core", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "type": "module", 8 | "main": "lib/core.esm.min.js", 9 | "exports": { 10 | "import": "./lib/core.esm.min.js", 11 | "require": "./lib/core.min.cjs", 12 | "types": "./types/index.d.ts" 13 | }, 14 | "types": "types/index.d.ts", 15 | "files": ["src","types","lib"], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/leaferjs/leafer-ui.git" 19 | }, 20 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/core/core", 21 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 22 | "keywords": [ 23 | "leafer core", 24 | "leafer-ui", 25 | "leaferjs" 26 | ], 27 | "dependencies": { 28 | "@leafer-ui/draw": "1.12.0", 29 | "@leafer-ui/app": "1.12.0", 30 | "@leafer-ui/interaction": "1.12.0", 31 | "@leafer-ui/event": "1.12.0", 32 | "@leafer-ui/hit": "1.12.0" 33 | } 34 | } -------------------------------------------------------------------------------- /packages/platform/miniapp/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@leafer-ui/interface' 2 | 3 | export * from './core' 4 | export * from '@leafer/partner' 5 | 6 | export * from '@leafer-ui/core' 7 | export * from '@leafer-ui/interaction-miniapp' 8 | export * from '@leafer-ui/partner' 9 | 10 | import { ICreator } from '@leafer/interface' 11 | import { useCanvas, Creator, LeaferCanvas } from './core' 12 | import { Leafer } from '@leafer-ui/draw' 13 | import { HitCanvasManager } from '@leafer-ui/core' 14 | import { Interaction } from '@leafer-ui/interaction-miniapp' 15 | 16 | 17 | Object.assign(Creator, { 18 | interaction: (target, canvas, selector, options?) => new Interaction(target, canvas, selector, options), 19 | hitCanvas: (options?, manager?) => new LeaferCanvas(options, manager), 20 | hitCanvasManager: () => new HitCanvasManager() 21 | } as ICreator) 22 | 23 | Leafer.prototype.receiveEvent = function (event: any): void { 24 | this.interaction && this.interaction.receive(event) 25 | } 26 | 27 | try { 28 | if (wx) useCanvas('miniapp', wx) 29 | } catch { } -------------------------------------------------------------------------------- /packages/core/draw/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/draw", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/draw", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "type": "module", 8 | "main": "lib/draw.esm.min.js", 9 | "exports": { 10 | "import": "./lib/draw.esm.min.js", 11 | "require": "./lib/draw.min.cjs", 12 | "types": "./types/index.d.ts" 13 | }, 14 | "types": "types/index.d.ts", 15 | "files": ["src","types","lib"], 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/leaferjs/leafer-ui.git" 19 | }, 20 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/core/draw", 21 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 22 | "keywords": [ 23 | "leafer draw", 24 | "leafer-ui", 25 | "leaferjs" 26 | ], 27 | "dependencies": { 28 | "@leafer/core": "1.12.0", 29 | "@leafer-ui/display": "1.12.0", 30 | "@leafer-ui/display-module": "1.12.0", 31 | "@leafer-ui/decorator": "1.12.0", 32 | "@leafer-ui/external": "1.12.0" 33 | } 34 | } -------------------------------------------------------------------------------- /packages/display-module/data/src/ImageData.ts: -------------------------------------------------------------------------------- 1 | import { IImageData, IImageInputData, IImage, IObject, IJSONOptions } from '@leafer-ui/interface' 2 | 3 | import { RectData } from './RectData' 4 | 5 | 6 | export class ImageData extends RectData implements IImageData { 7 | 8 | declare public __leaf: IImage 9 | 10 | protected _url: string 11 | 12 | protected setUrl(value: string) { 13 | this.__setImageFill(value) 14 | this._url = value 15 | } 16 | 17 | public __setImageFill(value: string): void { 18 | (this as IImageInputData).fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined 19 | } 20 | 21 | public __getData(): IObject { 22 | const data: IImageInputData = super.__getData() 23 | if (data.url) delete data.fill 24 | return data 25 | } 26 | 27 | public __getInputData(names?: string[] | IObject, options?: IJSONOptions): IObject { 28 | const data: IImageInputData = super.__getInputData(names, options) 29 | if (data.url) delete data.fill 30 | return data 31 | } 32 | } -------------------------------------------------------------------------------- /packages/interface/src/module/IEffect.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas, IFourNumber, IBoundsData, IMatrixData } from '@leafer/interface' 2 | 3 | import { IUI } from '../IUI' 4 | import { ICachedShape } from '../ICachedShape' 5 | import { ILeafShadowEffect } from '../type/IComputedType' 6 | 7 | 8 | export interface IEffectModule { 9 | shadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void 10 | innerShadow(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void 11 | blur(ui: IUI, current: ILeaferCanvas, origin: ILeaferCanvas): void 12 | backgroundBlur(ui: IUI, current: ILeaferCanvas, shape: ICachedShape): void 13 | 14 | // shadow 15 | getShadowRenderSpread(ui: IUI, shadow: ILeafShadowEffect[], spreadSign?: 1 | -1): IFourNumber 16 | getShadowTransform(ui: IUI, canvas: ILeaferCanvas, shape: ICachedShape, shadow: ILeafShadowEffect, outBounds: IBoundsData, otherScale: number, isInnerShaodw?: boolean): IMatrixData 17 | isTransformShadow(shadow: ILeafShadowEffect): boolean 18 | 19 | getInnerShadowSpread(ui: IUI, innerShadow: ILeafShadowEffect[]): IFourNumber 20 | } -------------------------------------------------------------------------------- /packages/partner/paint/src/FillText.ts: -------------------------------------------------------------------------------- 1 | import { ILeaferCanvas, IRenderOptions } from '@leafer/interface' 2 | 3 | import { ITextRowData, IText } from '@leafer-ui/interface' 4 | 5 | 6 | export function fillText(ui: IText, canvas: ILeaferCanvas, _renderOptions: IRenderOptions): void { 7 | 8 | const data = ui.__, { rows, decorationY } = data.__textDrawData 9 | if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor 10 | 11 | let row: ITextRowData 12 | 13 | for (let i = 0, len = rows.length; i < len; i++) { 14 | row = rows[i] 15 | 16 | if (row.text) canvas.fillText(row.text, row.x, row.y) 17 | else if (row.data) row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y) }) 18 | } 19 | 20 | if (decorationY) { 21 | const { decorationColor, decorationHeight } = data.__textDrawData 22 | if (decorationColor) canvas.fillStyle = decorationColor 23 | rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight))) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /packages/platform/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@leafer-ui/web", 3 | "version": "1.12.0", 4 | "description": "@leafer-ui/web", 5 | "author": "Chao (Leafer) Wan", 6 | "license": "MIT", 7 | "main": "src/index.ts", 8 | "types": "types/index.d.ts", 9 | "files": ["src","types","dist"], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/leaferjs/leafer-ui.git" 13 | }, 14 | "homepage": "https://github.com/leaferjs/leafer-ui/tree/main/packages/platform/web", 15 | "bugs": "https://github.com/leaferjs/leafer-ui/issues", 16 | "keywords": [ 17 | "leafer-ui", 18 | "leaferjs" 19 | ], 20 | "dependencies": { 21 | "@leafer/core": "1.12.0", 22 | "@leafer/canvas-web": "1.12.0", 23 | "@leafer/image-web": "1.12.0", 24 | "@leafer/partner": "1.12.0", 25 | "@leafer/interface": "1.12.0", 26 | "@leafer-ui/draw": "1.12.0", 27 | "@leafer-ui/core": "1.12.0", 28 | "@leafer-ui/interaction-web": "1.12.0", 29 | "@leafer-ui/partner": "1.12.0", 30 | "@leafer-ui/interface": "1.12.0", 31 | "@leafer-in/interface": "1.12.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/interface/src/module/IState.ts: -------------------------------------------------------------------------------- 1 | import { ILeaf, IBoolean, IString, IObject, IStateName, IStateStyle } from '@leafer-ui/interface' 2 | 3 | export interface IStateModule { 4 | 5 | canAnimate: boolean 6 | animateExcludes: IObject // 动画中排除的状态属性 7 | 8 | isState(state: IStateName, leaf: ILeaf, button?: ILeaf | boolean): boolean 9 | isSelected(leaf: ILeaf, button?: ILeaf | boolean): boolean 10 | isDisabled(leaf: ILeaf, button?: ILeaf | boolean): boolean 11 | 12 | isFocus(leaf: ILeaf, button?: ILeaf | boolean): boolean 13 | isHover(leaf: ILeaf, button?: ILeaf | boolean): boolean 14 | isPress(leaf: ILeaf, button?: ILeaf | boolean): boolean 15 | isPlacehold(leaf: ILeaf, button?: ILeaf | boolean): boolean 16 | 17 | isDrag(leaf: ILeaf, button?: boolean | ILeaf): boolean 18 | 19 | setStyleName(leaf: ILeaf, styleName: IString, value: IBoolean): void 20 | set(leaf: ILeaf, stateName: IString): void 21 | 22 | getStyle(leaf: ILeaf): IStateStyle 23 | 24 | updateStyle(leaf: ILeaf, style?: IStateStyle, type?: 'in' | 'out'): void 25 | updateEventStyle(leaf: ILeaf, eventType: string): void 26 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/app/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/display/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/event/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/hit/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/core/core/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/core/draw/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/decorator/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/external/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/interface/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/mask/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/text/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/text/src/TextDecoration.ts: -------------------------------------------------------------------------------- 1 | import { isObject } from '@leafer/core' 2 | 3 | import { ITextData, ITextDecorationType, ITextDrawData } from '@leafer-ui/interface' 4 | import { ColorConvert } from '@leafer-ui/draw' 5 | 6 | 7 | export function decorationText(drawData: ITextDrawData, style: ITextData): void { 8 | let type: ITextDecorationType, offset = 0 9 | const { fontSize, textDecoration } = style 10 | drawData.decorationHeight = fontSize / 11 11 | if (isObject(textDecoration)) { 12 | type = textDecoration.type 13 | if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color) 14 | if (textDecoration.offset) offset = Math.min(fontSize * 0.3, Math.max(textDecoration.offset, -fontSize * 0.15)) 15 | } else type = textDecoration 16 | switch (type) { 17 | case 'under': 18 | drawData.decorationY = [fontSize * 0.15 + offset] 19 | break 20 | case 'delete': 21 | drawData.decorationY = [-fontSize * 0.35] 22 | break 23 | case 'under-delete': 24 | drawData.decorationY = [fontSize * 0.15 + offset, -fontSize * 0.35] 25 | } 26 | } -------------------------------------------------------------------------------- /packages/platform/web/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/color/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/effect/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/gradient/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/image/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/paint/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/partner/partner/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform/miniapp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform/node/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform/worker/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/display-module/bounds/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/display-module/data/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/display-module/render/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/platform/canvaskit/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/interaction/interaction-web/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/interaction/interaction/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/display-module/display-module/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/interaction/interaction-miniapp/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023-present, Chao (Leafer) Wan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/interface/src/module/IUIRender.ts: -------------------------------------------------------------------------------- 1 | import { ILeafRender, ILeaferCanvas, IRenderOptions } from '@leafer/interface' 2 | 3 | import { IUI, IRect, IImage, IText, IFrame, IGroup } from '../IUI' 4 | 5 | export type IUIRenderModule = IUIRender & ThisType 6 | 7 | export interface IUIRender extends ILeafRender { 8 | __drawAfterFill?(canvas: ILeaferCanvas, options: IRenderOptions): void 9 | __drawContent?(canvas: ILeaferCanvas, options: IRenderOptions): void 10 | } 11 | 12 | export type IRectRenderModule = IRectRender & ThisType 13 | 14 | export interface IRectRender extends IUIRender { 15 | 16 | } 17 | 18 | export type IImageRenderModule = IImageRender & ThisType 19 | 20 | export interface IImageRender extends IUIRender { 21 | 22 | } 23 | 24 | export type ITextRenderModule = ITextRender & ThisType 25 | 26 | export interface ITextRender extends IUIRender { 27 | 28 | } 29 | 30 | export type IGroupRenderModule = IGroupRender & ThisType 31 | 32 | export interface IGroupRender extends IUIRender { 33 | 34 | } 35 | 36 | export type IFrameRenderModule = IFrameRender & ThisType