@leafer/interface 1.0.0-rc.25 → 1.0.0-rc.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/display/ILeaf.ts +16 -9
- package/src/event/IUIEvent.ts +3 -1
- package/src/interaction/IInteraction.ts +1 -0
- package/src/math/IMath.ts +1 -0
- package/src/platform/IPlatform.ts +2 -1
- package/types/index.d.ts +19 -9
package/package.json
CHANGED
package/src/display/ILeaf.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface ILeafAttrData {
|
|
|
70
70
|
|
|
71
71
|
path: IPathCommandData | IPathString
|
|
72
72
|
windingRule: IWindingRule
|
|
73
|
-
closed:
|
|
73
|
+
closed: IBoolean
|
|
74
74
|
|
|
75
75
|
// auto layout
|
|
76
76
|
flow: IFlowType
|
|
@@ -83,6 +83,7 @@ export interface ILeafAttrData {
|
|
|
83
83
|
inFlow: IBoolean
|
|
84
84
|
autoWidth: IAutoSize
|
|
85
85
|
autoHeight: IAutoSize
|
|
86
|
+
lockRatio: IBoolean
|
|
86
87
|
autoBox: IAutoBoxData | IConstraint
|
|
87
88
|
|
|
88
89
|
widthRange: IRangeSize
|
|
@@ -324,7 +325,7 @@ export interface ILeafInputData {
|
|
|
324
325
|
|
|
325
326
|
path?: IPathCommandData | IPathString
|
|
326
327
|
windingRule?: IWindingRule
|
|
327
|
-
closed?:
|
|
328
|
+
closed?: IBoolean
|
|
328
329
|
|
|
329
330
|
// auto layout
|
|
330
331
|
flow?: IFlowType
|
|
@@ -337,6 +338,7 @@ export interface ILeafInputData {
|
|
|
337
338
|
inFlow?: IBoolean
|
|
338
339
|
autoWidth?: IAutoSize
|
|
339
340
|
autoHeight?: IAutoSize
|
|
341
|
+
lockRatio?: IBoolean
|
|
340
342
|
autoBox?: IAutoBoxData | IConstraint
|
|
341
343
|
|
|
342
344
|
widthRange?: IRangeSize
|
|
@@ -424,6 +426,7 @@ export interface ILeafComputedData {
|
|
|
424
426
|
inFlow?: boolean
|
|
425
427
|
autoWidth?: IAutoSize
|
|
426
428
|
autoHeight?: IAutoSize
|
|
429
|
+
lockRatio?: boolean
|
|
427
430
|
autoBox?: IAutoBoxData | IConstraint
|
|
428
431
|
|
|
429
432
|
widthRange?: IRangeSize
|
|
@@ -565,8 +568,9 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
565
568
|
get(name?: string | string[] | IObject): ILeafInputData | IValue
|
|
566
569
|
toJSON(): IObject
|
|
567
570
|
toString(): string
|
|
568
|
-
toSVG
|
|
569
|
-
|
|
571
|
+
toSVG(): string
|
|
572
|
+
__SVG(data: IObject): void
|
|
573
|
+
toHTML(): string
|
|
570
574
|
|
|
571
575
|
// ILeafData ->
|
|
572
576
|
__setAttr(attrName: string, newValue: IValue, checkFiniteNumber?: boolean): boolean
|
|
@@ -577,8 +581,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
577
581
|
// find
|
|
578
582
|
find(condition: number | string | IFindMethod, options?: any): ILeaf[]
|
|
579
583
|
findTag(tag: string | string[]): ILeaf[]
|
|
580
|
-
findOne(condition: number | string | IFindMethod, options?: any): ILeaf
|
|
581
|
-
findId(id: number | string): ILeaf
|
|
584
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined
|
|
585
|
+
findId(id: number | string): ILeaf | undefined
|
|
582
586
|
|
|
583
587
|
focus(value?: boolean): void
|
|
584
588
|
forceUpdate(attrName?: string): void
|
|
@@ -648,9 +652,9 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
648
652
|
transform(transform?: IMatrixData, resize?: boolean): void
|
|
649
653
|
|
|
650
654
|
move(x: number | IPointData, y?: number): void
|
|
651
|
-
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
652
|
-
rotateOf(origin: IPointData, rotation: number): void
|
|
653
|
-
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
655
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
656
|
+
rotateOf(origin: IPointData | IAlign, rotation: number): void
|
|
657
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void
|
|
654
658
|
|
|
655
659
|
transformWorld(worldTransform?: IMatrixData, resize?: boolean): void
|
|
656
660
|
moveWorld(x: number | IPointData, y?: number): void
|
|
@@ -661,6 +665,9 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
661
665
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
|
|
662
666
|
__scaleResize(scaleX: number, scaleY: number): void
|
|
663
667
|
|
|
668
|
+
resizeWidth(width: number): void
|
|
669
|
+
resizeHeight(height: number): void
|
|
670
|
+
|
|
664
671
|
// ILeafHit ->
|
|
665
672
|
__hitWorld(point: IRadiusPointData): boolean
|
|
666
673
|
__hit(local: IRadiusPointData): boolean
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ILeafList } from '../data/IList'
|
|
|
3
3
|
import { IEvent } from './IEvent'
|
|
4
4
|
import { ILeaferImage } from '../image/ILeaferImage'
|
|
5
5
|
import { ILeaf } from '../display/ILeaf'
|
|
6
|
-
import { IPointData } from '../math/IMath'
|
|
6
|
+
import { IPointData, IBoundsData } from '../math/IMath'
|
|
7
7
|
|
|
8
8
|
export interface IUIEvent extends IEvent {
|
|
9
9
|
x: number
|
|
@@ -55,6 +55,8 @@ export interface IDragEvent extends IPointerEvent {
|
|
|
55
55
|
getPageTotal?(): IPointData
|
|
56
56
|
getInnerTotal?(relative?: ILeaf): IPointData
|
|
57
57
|
getLocalTotal?(relative?: ILeaf): IPointData
|
|
58
|
+
|
|
59
|
+
getPageBounds?(): IBoundsData
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export interface IDropEvent extends IPointerEvent {
|
package/src/math/IMath.ts
CHANGED
|
@@ -103,6 +103,7 @@ export interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
|
103
103
|
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds
|
|
104
104
|
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds
|
|
105
105
|
|
|
106
|
+
setPoint(point: IPointData): IBounds
|
|
106
107
|
setPoints(points: IPointData[]): IBounds
|
|
107
108
|
addPoint(point: IPointData): IBounds
|
|
108
109
|
getPoints(): IPointData[] // topLeft, topRight, bottomRight, bottomLeft
|
|
@@ -9,6 +9,7 @@ import { ICanvasType } from '../canvas/ISkiaCanvas'
|
|
|
9
9
|
export interface IPlatform {
|
|
10
10
|
name?: 'web' | 'node' | 'miniapp'
|
|
11
11
|
os?: 'Mac' | 'Windows' | 'Linux'
|
|
12
|
+
toURL(text: string, fileType?: 'text' | 'svg'): string
|
|
12
13
|
requestRender?(render: IFunction): void
|
|
13
14
|
canvas?: ILeaferCanvas
|
|
14
15
|
canvasType?: ICanvasType
|
|
@@ -18,7 +19,7 @@ export interface IPlatform {
|
|
|
18
19
|
intWheelDeltaY?: boolean // firefox / Windows need
|
|
19
20
|
conicGradientSupport?: boolean
|
|
20
21
|
conicGradientRotate90?: boolean // firefox need rotate
|
|
21
|
-
fullImageShadow?: boolean // safari need
|
|
22
|
+
fullImageShadow?: boolean // safari need
|
|
22
23
|
syncDomFont?: boolean // firefox need
|
|
23
24
|
layout?(target: ILeaf): void
|
|
24
25
|
origin?: {
|
package/types/index.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
|
82
82
|
setList(boundsList: IBoundsData[]): IBounds;
|
|
83
83
|
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
84
84
|
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
85
|
+
setPoint(point: IPointData): IBounds;
|
|
85
86
|
setPoints(points: IPointData[]): IBounds;
|
|
86
87
|
addPoint(point: IPointData): IBounds;
|
|
87
88
|
getPoints(): IPointData[];
|
|
@@ -1255,7 +1256,7 @@ interface ILeafAttrData {
|
|
|
1255
1256
|
pixelRatio: INumber;
|
|
1256
1257
|
path: IPathCommandData | IPathString;
|
|
1257
1258
|
windingRule: IWindingRule;
|
|
1258
|
-
closed:
|
|
1259
|
+
closed: IBoolean;
|
|
1259
1260
|
flow: IFlowType;
|
|
1260
1261
|
padding: IFourNumber;
|
|
1261
1262
|
gap: IGap | IPointGap;
|
|
@@ -1265,6 +1266,7 @@ interface ILeafAttrData {
|
|
|
1265
1266
|
inFlow: IBoolean;
|
|
1266
1267
|
autoWidth: IAutoSize;
|
|
1267
1268
|
autoHeight: IAutoSize;
|
|
1269
|
+
lockRatio: IBoolean;
|
|
1268
1270
|
autoBox: IAutoBoxData | IConstraint;
|
|
1269
1271
|
widthRange: IRangeSize;
|
|
1270
1272
|
heightRange: IRangeSize;
|
|
@@ -1371,7 +1373,7 @@ interface ILeafInputData {
|
|
|
1371
1373
|
pixelRatio?: INumber;
|
|
1372
1374
|
path?: IPathCommandData | IPathString;
|
|
1373
1375
|
windingRule?: IWindingRule;
|
|
1374
|
-
closed?:
|
|
1376
|
+
closed?: IBoolean;
|
|
1375
1377
|
flow?: IFlowType;
|
|
1376
1378
|
padding?: IFourNumber;
|
|
1377
1379
|
gap?: IGap | IPointGap;
|
|
@@ -1381,6 +1383,7 @@ interface ILeafInputData {
|
|
|
1381
1383
|
inFlow?: IBoolean;
|
|
1382
1384
|
autoWidth?: IAutoSize;
|
|
1383
1385
|
autoHeight?: IAutoSize;
|
|
1386
|
+
lockRatio?: IBoolean;
|
|
1384
1387
|
autoBox?: IAutoBoxData | IConstraint;
|
|
1385
1388
|
widthRange?: IRangeSize;
|
|
1386
1389
|
heightRange?: IRangeSize;
|
|
@@ -1446,6 +1449,7 @@ interface ILeafComputedData {
|
|
|
1446
1449
|
inFlow?: boolean;
|
|
1447
1450
|
autoWidth?: IAutoSize;
|
|
1448
1451
|
autoHeight?: IAutoSize;
|
|
1452
|
+
lockRatio?: boolean;
|
|
1449
1453
|
autoBox?: IAutoBoxData | IConstraint;
|
|
1450
1454
|
widthRange?: IRangeSize;
|
|
1451
1455
|
heightRange?: IRangeSize;
|
|
@@ -1546,16 +1550,17 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
|
|
|
1546
1550
|
get(name?: string | string[] | IObject): ILeafInputData | IValue;
|
|
1547
1551
|
toJSON(): IObject;
|
|
1548
1552
|
toString(): string;
|
|
1549
|
-
toSVG
|
|
1550
|
-
|
|
1553
|
+
toSVG(): string;
|
|
1554
|
+
__SVG(data: IObject): void;
|
|
1555
|
+
toHTML(): string;
|
|
1551
1556
|
__setAttr(attrName: string, newValue: IValue, checkFiniteNumber?: boolean): boolean;
|
|
1552
1557
|
__getAttr(attrName: string): IValue;
|
|
1553
1558
|
setProxyAttr(name: string, newValue: IValue): void;
|
|
1554
1559
|
getProxyAttr(name: string): IValue;
|
|
1555
1560
|
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
1556
1561
|
findTag(tag: string | string[]): ILeaf[];
|
|
1557
|
-
findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
|
|
1558
|
-
findId(id: number | string): ILeaf;
|
|
1562
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined;
|
|
1563
|
+
findId(id: number | string): ILeaf | undefined;
|
|
1559
1564
|
focus(value?: boolean): void;
|
|
1560
1565
|
forceUpdate(attrName?: string): void;
|
|
1561
1566
|
updateLayout(): void;
|
|
@@ -1601,9 +1606,9 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
|
|
|
1601
1606
|
setTransform(transform?: IMatrixData, resize?: boolean): void;
|
|
1602
1607
|
transform(transform?: IMatrixData, resize?: boolean): void;
|
|
1603
1608
|
move(x: number | IPointData, y?: number): void;
|
|
1604
|
-
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1605
|
-
rotateOf(origin: IPointData, rotation: number): void;
|
|
1606
|
-
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1609
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1610
|
+
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
1611
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1607
1612
|
transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
|
|
1608
1613
|
moveWorld(x: number | IPointData, y?: number): void;
|
|
1609
1614
|
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
@@ -1611,6 +1616,8 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
|
|
|
1611
1616
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1612
1617
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1613
1618
|
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1619
|
+
resizeWidth(width: number): void;
|
|
1620
|
+
resizeHeight(height: number): void;
|
|
1614
1621
|
__hitWorld(point: IRadiusPointData): boolean;
|
|
1615
1622
|
__hit(local: IRadiusPointData): boolean;
|
|
1616
1623
|
__hitFill(inner: IRadiusPointData): boolean;
|
|
@@ -1720,6 +1727,7 @@ interface IDragEvent extends IPointerEvent {
|
|
|
1720
1727
|
getPageTotal?(): IPointData;
|
|
1721
1728
|
getInnerTotal?(relative?: ILeaf): IPointData;
|
|
1722
1729
|
getLocalTotal?(relative?: ILeaf): IPointData;
|
|
1730
|
+
getPageBounds?(): IBoundsData;
|
|
1723
1731
|
}
|
|
1724
1732
|
interface IDropEvent extends IPointerEvent {
|
|
1725
1733
|
list: ILeafList;
|
|
@@ -1801,6 +1809,7 @@ interface IInteractionConfig {
|
|
|
1801
1809
|
zoom?: IZoomConfig;
|
|
1802
1810
|
move?: IMoveConfig;
|
|
1803
1811
|
eventer?: IObject;
|
|
1812
|
+
keyEvent?: boolean;
|
|
1804
1813
|
}
|
|
1805
1814
|
interface IZoomConfig {
|
|
1806
1815
|
disabled?: boolean;
|
|
@@ -2040,6 +2049,7 @@ interface ISkiaNAPICanvas {
|
|
|
2040
2049
|
interface IPlatform {
|
|
2041
2050
|
name?: 'web' | 'node' | 'miniapp';
|
|
2042
2051
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
2052
|
+
toURL(text: string, fileType?: 'text' | 'svg'): string;
|
|
2043
2053
|
requestRender?(render: IFunction): void;
|
|
2044
2054
|
canvas?: ILeaferCanvas;
|
|
2045
2055
|
canvasType?: ICanvasType;
|