@antv/g 5.0.23-alpha.9 → 5.1.0
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/dist/index.umd.min.js +4 -3
- package/es/AbstractRenderer.d.ts +11 -0
- package/es/AbstractRenderer.js +17 -2
- package/es/Canvas.d.ts +1 -1
- package/es/Canvas.js +2 -0
- package/es/css/CSS.d.ts +2 -1
- package/es/css/CSS.js +6 -2
- package/es/css/CSSProperty.d.ts +3 -2
- package/es/css/StyleValueRegistry.d.ts +4 -2
- package/es/css/StyleValueRegistry.js +100 -95
- package/es/css/cssom/CSSNumericValue.js +1 -1
- package/es/css/index.d.ts +2 -1
- package/es/css/index.js +2 -1
- package/es/css/interfaces.d.ts +6 -0
- package/es/css/interfaces.js +2 -0
- package/es/css/layout/FragmentResult.d.ts +32 -0
- package/es/css/layout/FragmentResult.js +32 -0
- package/es/css/layout/LayoutChildren.d.ts +23 -0
- package/es/css/layout/LayoutChildren.js +55 -0
- package/es/css/layout/LayoutContext.d.ts +35 -0
- package/es/css/layout/LayoutContext.js +35 -0
- package/es/css/layout/LayoutDefinition.d.ts +20 -0
- package/es/css/layout/LayoutDefinition.js +9 -0
- package/es/css/layout/LayoutEdges.d.ts +24 -0
- package/es/css/layout/LayoutEdges.js +41 -0
- package/es/css/layout/LayoutEngine.d.ts +41 -0
- package/es/css/layout/LayoutEngine.js +332 -0
- package/es/css/layout/LayoutFragment.d.ts +26 -0
- package/es/css/layout/LayoutFragment.js +28 -0
- package/es/css/layout/LayoutObject.d.ts +46 -0
- package/es/css/layout/LayoutObject.js +172 -0
- package/es/css/layout/LayoutRegistry.d.ts +16 -0
- package/es/css/layout/LayoutRegistry.js +78 -0
- package/es/css/layout/LayoutWorkTask.d.ts +14 -0
- package/es/css/layout/LayoutWorkTask.js +1 -0
- package/es/css/layout/index.d.ts +11 -0
- package/es/css/layout/index.js +11 -0
- package/es/css/layout/types.d.ts +104 -0
- package/es/css/layout/types.js +66 -0
- package/es/css/parser/color.d.ts +1 -1
- package/es/css/parser/color.js +2 -2
- package/es/css/parser/dimension.js +5 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +9 -2
- package/es/css/parser/points.d.ts +8 -1
- package/es/css/parser/points.js +33 -3
- package/es/css/parser/transform.js +1 -1
- package/es/css/properties/CSSPropertyClipPath.js +7 -1
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/es/css/properties/CSSPropertyLocalPosition.js +64 -20
- package/es/css/properties/CSSPropertyPath.d.ts +2 -2
- package/es/css/properties/CSSPropertyPath.js +7 -5
- package/es/css/properties/CSSPropertyPoints.js +3 -4
- package/es/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/es/css/properties/CSSPropertyTransform.js +76 -104
- package/es/display-objects/Circle.d.ts +4 -0
- package/es/display-objects/Circle.js +2 -0
- package/es/display-objects/DisplayObject.d.ts +2 -9
- package/es/display-objects/DisplayObject.js +8 -27
- package/es/display-objects/Ellipse.d.ts +4 -0
- package/es/display-objects/Ellipse.js +2 -0
- package/es/display-objects/Group.d.ts +4 -0
- package/es/display-objects/Group.js +2 -0
- package/es/display-objects/HTML.d.ts +4 -4
- package/es/display-objects/HTML.js +5 -3
- package/es/display-objects/Image.d.ts +4 -0
- package/es/display-objects/Image.js +2 -0
- package/es/display-objects/Line.js +2 -0
- package/es/display-objects/Path.d.ts +2 -2
- package/es/display-objects/Polygon.js +1 -1
- package/es/display-objects/Polyline.js +1 -1
- package/es/display-objects/Rect.d.ts +6 -2
- package/es/display-objects/Rect.js +2 -0
- package/es/display-objects/Text.d.ts +4 -0
- package/es/display-objects/Text.js +2 -0
- package/es/dom/Document.js +2 -2
- package/es/dom/Element.js +1 -0
- package/es/global-module.js +91 -8
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/plugins/CullingPlugin.d.ts +1 -0
- package/es/plugins/CullingPlugin.js +8 -3
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/es/plugins/DirtyCheckPlugin.js +7 -2
- package/es/plugins/EventPlugin.d.ts +1 -0
- package/es/plugins/EventPlugin.js +14 -9
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/es/plugins/PrepareRendererPlugin.js +10 -5
- package/es/services/EventService.js +14 -10
- package/es/services/OffscreenCanvasCreator.d.ts +1 -1
- package/es/services/OffscreenCanvasCreator.js +1 -1
- package/es/services/RenderingService.d.ts +18 -18
- package/es/services/RenderingService.js +26 -23
- package/es/services/SceneGraphService.d.ts +2 -0
- package/es/services/SceneGraphService.js +12 -1
- package/es/services/aabb/CircleUpdater.d.ts +0 -2
- package/es/services/aabb/CircleUpdater.js +2 -6
- package/es/services/aabb/EllipseUpdater.d.ts +0 -2
- package/es/services/aabb/EllipseUpdater.js +2 -6
- package/es/services/aabb/LineUpdater.d.ts +0 -2
- package/es/services/aabb/LineUpdater.js +1 -3
- package/es/services/aabb/PathUpdater.d.ts +0 -2
- package/es/services/aabb/PathUpdater.js +1 -5
- package/es/services/aabb/PolylineUpdater.d.ts +0 -2
- package/es/services/aabb/PolylineUpdater.js +1 -3
- package/es/services/aabb/RectUpdater.d.ts +0 -2
- package/es/services/aabb/RectUpdater.js +1 -5
- package/es/services/aabb/TextUpdater.d.ts +7 -0
- package/es/services/aabb/TextUpdater.js +0 -4
- package/es/services/aabb/interfaces.d.ts +0 -3
- package/es/types.d.ts +12 -23
- package/es/types.js +1 -0
- package/es/utils/deferred.d.ts +43 -0
- package/es/utils/deferred.js +117 -0
- package/es/utils/dom.d.ts +2 -0
- package/es/utils/dom.js +8 -0
- package/es/utils/index.d.ts +2 -1
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.js +3 -9
- package/es/utils/math.js +4 -3
- package/es/utils/path.d.ts +2 -2
- package/es/utils/path.js +61 -24
- package/lib/AbstractRenderer.d.ts +11 -0
- package/lib/AbstractRenderer.js +17 -2
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +2 -0
- package/lib/css/CSS.d.ts +2 -1
- package/lib/css/CSS.js +9 -3
- package/lib/css/CSSProperty.d.ts +3 -2
- package/lib/css/StyleValueRegistry.d.ts +4 -2
- package/lib/css/StyleValueRegistry.js +104 -96
- package/lib/css/cssom/CSSNumericValue.js +17 -17
- package/lib/css/index.d.ts +2 -1
- package/lib/css/index.js +25 -12
- package/lib/css/interfaces.d.ts +6 -0
- package/lib/css/interfaces.js +12 -0
- package/lib/css/layout/FragmentResult.d.ts +32 -0
- package/lib/css/layout/FragmentResult.js +51 -0
- package/lib/css/layout/LayoutChildren.d.ts +23 -0
- package/lib/css/layout/LayoutChildren.js +72 -0
- package/lib/css/layout/LayoutContext.d.ts +35 -0
- package/lib/css/layout/LayoutContext.js +49 -0
- package/lib/css/layout/LayoutDefinition.d.ts +20 -0
- package/lib/css/layout/LayoutDefinition.js +16 -0
- package/lib/css/layout/LayoutEdges.d.ts +24 -0
- package/lib/css/layout/LayoutEdges.js +56 -0
- package/lib/css/layout/LayoutEngine.d.ts +41 -0
- package/lib/css/layout/LayoutEngine.js +345 -0
- package/lib/css/layout/LayoutFragment.d.ts +26 -0
- package/lib/css/layout/LayoutFragment.js +44 -0
- package/lib/css/layout/LayoutObject.d.ts +46 -0
- package/lib/css/layout/LayoutObject.js +182 -0
- package/lib/css/layout/LayoutRegistry.d.ts +16 -0
- package/lib/css/layout/LayoutRegistry.js +87 -0
- package/lib/css/layout/LayoutWorkTask.d.ts +14 -0
- package/lib/css/layout/LayoutWorkTask.js +5 -0
- package/lib/css/layout/index.d.ts +11 -0
- package/lib/css/layout/index.js +148 -0
- package/lib/css/layout/types.d.ts +104 -0
- package/lib/css/layout/types.js +74 -0
- package/lib/css/parser/color.d.ts +1 -1
- package/lib/css/parser/color.js +1 -1
- package/lib/css/parser/dimension.js +4 -0
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +9 -2
- package/lib/css/parser/points.d.ts +8 -1
- package/lib/css/parser/points.js +33 -3
- package/lib/css/parser/transform.js +1 -1
- package/lib/css/properties/CSSPropertyClipPath.js +8 -1
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/lib/css/properties/CSSPropertyLocalPosition.js +65 -20
- package/lib/css/properties/CSSPropertyPath.d.ts +2 -2
- package/lib/css/properties/CSSPropertyPath.js +7 -5
- package/lib/css/properties/CSSPropertyPoints.js +3 -4
- package/lib/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/lib/css/properties/CSSPropertyTransform.js +75 -103
- package/lib/display-objects/Circle.d.ts +4 -0
- package/lib/display-objects/Circle.js +2 -0
- package/lib/display-objects/DisplayObject.d.ts +2 -9
- package/lib/display-objects/DisplayObject.js +9 -29
- package/lib/display-objects/Ellipse.d.ts +4 -0
- package/lib/display-objects/Ellipse.js +2 -0
- package/lib/display-objects/Group.d.ts +4 -0
- package/lib/display-objects/Group.js +2 -0
- package/lib/display-objects/HTML.d.ts +4 -4
- package/lib/display-objects/HTML.js +5 -3
- package/lib/display-objects/Image.d.ts +4 -0
- package/lib/display-objects/Image.js +2 -0
- package/lib/display-objects/Line.js +2 -0
- package/lib/display-objects/Path.d.ts +2 -2
- package/lib/display-objects/Polygon.js +1 -1
- package/lib/display-objects/Polyline.js +1 -1
- package/lib/display-objects/Rect.d.ts +6 -2
- package/lib/display-objects/Rect.js +2 -0
- package/lib/display-objects/Text.d.ts +4 -0
- package/lib/display-objects/Text.js +2 -0
- package/lib/dom/Document.js +2 -2
- package/lib/dom/Element.js +1 -0
- package/lib/global-module.js +91 -6
- package/lib/index.d.ts +3 -0
- package/lib/index.js +7 -2
- package/lib/plugins/CullingPlugin.d.ts +1 -0
- package/lib/plugins/CullingPlugin.js +7 -3
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/lib/plugins/DirtyCheckPlugin.js +6 -2
- package/lib/plugins/EventPlugin.d.ts +1 -0
- package/lib/plugins/EventPlugin.js +13 -9
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/lib/plugins/PrepareRendererPlugin.js +9 -5
- package/lib/services/EventService.js +14 -10
- package/lib/services/OffscreenCanvasCreator.d.ts +1 -1
- package/lib/services/OffscreenCanvasCreator.js +1 -1
- package/lib/services/RenderingService.d.ts +18 -18
- package/lib/services/RenderingService.js +26 -23
- package/lib/services/SceneGraphService.d.ts +2 -0
- package/lib/services/SceneGraphService.js +15 -1
- package/lib/services/aabb/CircleUpdater.d.ts +0 -2
- package/lib/services/aabb/CircleUpdater.js +2 -6
- package/lib/services/aabb/EllipseUpdater.d.ts +0 -2
- package/lib/services/aabb/EllipseUpdater.js +2 -6
- package/lib/services/aabb/LineUpdater.d.ts +0 -2
- package/lib/services/aabb/LineUpdater.js +1 -3
- package/lib/services/aabb/PathUpdater.d.ts +0 -2
- package/lib/services/aabb/PathUpdater.js +1 -5
- package/lib/services/aabb/PolylineUpdater.d.ts +0 -2
- package/lib/services/aabb/PolylineUpdater.js +1 -3
- package/lib/services/aabb/RectUpdater.d.ts +0 -2
- package/lib/services/aabb/RectUpdater.js +1 -5
- package/lib/services/aabb/TextUpdater.d.ts +7 -0
- package/lib/services/aabb/TextUpdater.js +0 -4
- package/lib/services/aabb/interfaces.d.ts +0 -3
- package/lib/types.d.ts +12 -23
- package/lib/types.js +1 -0
- package/lib/utils/deferred.d.ts +43 -0
- package/lib/utils/deferred.js +131 -0
- package/lib/utils/dom.d.ts +2 -0
- package/lib/utils/dom.js +17 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +17 -4
- package/lib/utils/interpolation.js +4 -10
- package/lib/utils/math.js +4 -3
- package/lib/utils/path.d.ts +2 -2
- package/lib/utils/path.js +55 -24
- package/package.json +4 -3
- package/es/css/LayoutRegistry.d.ts +0 -11
- package/es/css/LayoutRegistry.js +0 -22
- package/es/utils/hooks.d.ts +0 -280
- package/es/utils/hooks.js +0 -753
- package/lib/css/LayoutRegistry.d.ts +0 -11
- package/lib/css/LayoutRegistry.js +0 -30
- package/lib/utils/hooks.d.ts +0 -280
- package/lib/utils/hooks.js +0 -759
|
@@ -3,10 +3,14 @@ import { DisplayObject } from './DisplayObject';
|
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import type { CSSUnitValue } from '../css';
|
|
5
5
|
export interface GroupStyleProps extends BaseStyleProps {
|
|
6
|
+
x?: number | string;
|
|
7
|
+
y?: number | string;
|
|
6
8
|
width?: number | string;
|
|
7
9
|
height?: number | string;
|
|
8
10
|
}
|
|
9
11
|
export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
|
|
12
|
+
x: CSSUnitValue;
|
|
13
|
+
y: CSSUnitValue;
|
|
10
14
|
width?: CSSUnitValue;
|
|
11
15
|
height?: CSSUnitValue;
|
|
12
16
|
}
|
|
@@ -4,19 +4,19 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
4
4
|
import { AABB } from '../shapes';
|
|
5
5
|
import type { CSSUnitValue } from '../css';
|
|
6
6
|
export interface HTMLStyleProps extends BaseStyleProps {
|
|
7
|
+
x?: number | string;
|
|
8
|
+
y?: number | string;
|
|
7
9
|
innerHTML: string | HTMLElement;
|
|
8
10
|
width: number;
|
|
9
11
|
height: number;
|
|
10
|
-
className?: string | string[];
|
|
11
|
-
style?: string;
|
|
12
12
|
}
|
|
13
13
|
export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
|
|
14
|
+
x: CSSUnitValue;
|
|
15
|
+
y: CSSUnitValue;
|
|
14
16
|
$el: HTMLElement;
|
|
15
17
|
innerHTML: string | HTMLElement;
|
|
16
18
|
width: CSSUnitValue;
|
|
17
19
|
height: CSSUnitValue;
|
|
18
|
-
className?: string | string[];
|
|
19
|
-
style?: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* HTML container
|
|
@@ -26,9 +26,11 @@ function (_super) {
|
|
|
26
26
|
_this = _super.call(this, __assign({
|
|
27
27
|
type: Shape.HTML,
|
|
28
28
|
style: __assign({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
x: '',
|
|
30
|
+
y: '',
|
|
31
|
+
width: '',
|
|
32
|
+
height: '',
|
|
33
|
+
innerHTML: ''
|
|
32
34
|
}, style)
|
|
33
35
|
}, rest)) || this;
|
|
34
36
|
_this.cullable.enable = false;
|
|
@@ -3,12 +3,16 @@ import { DisplayObject } from './DisplayObject';
|
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import type { CSSUnitValue } from '../css';
|
|
5
5
|
export interface ImageStyleProps extends BaseStyleProps {
|
|
6
|
+
x?: number | string;
|
|
7
|
+
y?: number | string;
|
|
6
8
|
img?: string | HTMLImageElement;
|
|
7
9
|
src?: string | HTMLImageElement;
|
|
8
10
|
width?: number | string;
|
|
9
11
|
height?: number | string;
|
|
10
12
|
}
|
|
11
13
|
export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
|
|
14
|
+
x: CSSUnitValue;
|
|
15
|
+
y: CSSUnitValue;
|
|
12
16
|
img?: string | HTMLImageElement;
|
|
13
17
|
src?: string | HTMLImageElement;
|
|
14
18
|
width?: CSSUnitValue;
|
|
@@ -37,6 +37,7 @@ function (_super) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
Line.prototype.getPoint = function (ratio) {
|
|
40
|
+
// TODO: account for z1/z2 in 3D line
|
|
40
41
|
var _a = this.parsedStyle,
|
|
41
42
|
x1 = _a.x1,
|
|
42
43
|
y1 = _a.y1,
|
|
@@ -47,6 +48,7 @@ function (_super) {
|
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
Line.prototype.getTotalLength = function () {
|
|
51
|
+
// TODO: account for z1/z2 in 3D line
|
|
50
52
|
var _a = this.parsedStyle,
|
|
51
53
|
x1 = _a.x1,
|
|
52
54
|
y1 = _a.y1,
|
|
@@ -4,8 +4,8 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
import type { Rectangle } from '../shapes/Rectangle';
|
|
6
6
|
export interface PathStyleProps extends BaseStyleProps {
|
|
7
|
-
path?: string | PathCommand[];
|
|
8
|
-
d?: string | PathCommand[];
|
|
7
|
+
path?: string | PathCommand[] | DisplayObject;
|
|
8
|
+
d?: string | PathCommand[] | DisplayObject;
|
|
9
9
|
}
|
|
10
10
|
export interface PathSegment {
|
|
11
11
|
command: PathCommand[0];
|
|
@@ -3,13 +3,17 @@ import { DisplayObject } from './DisplayObject';
|
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import type { CSSUnitValue } from '../css';
|
|
5
5
|
export interface RectStyleProps extends BaseStyleProps {
|
|
6
|
+
x?: number | string;
|
|
7
|
+
y?: number | string;
|
|
6
8
|
width: number | string;
|
|
7
9
|
height: number | string;
|
|
8
10
|
radius?: number | string;
|
|
9
11
|
}
|
|
10
12
|
export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
x: CSSUnitValue;
|
|
14
|
+
y: CSSUnitValue;
|
|
15
|
+
width: CSSUnitValue;
|
|
16
|
+
height: CSSUnitValue;
|
|
13
17
|
radius?: CSSUnitValue;
|
|
14
18
|
}
|
|
15
19
|
export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
|
|
@@ -4,6 +4,8 @@ import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
5
|
import type { CSSUnitValue, CSSGlobalKeywords, CSSKeywordValue } from '../css';
|
|
6
6
|
export interface TextStyleProps extends BaseStyleProps {
|
|
7
|
+
x?: number | string;
|
|
8
|
+
y?: number | string;
|
|
7
9
|
text: string;
|
|
8
10
|
/** 设置文本内容的当前对齐方式 */
|
|
9
11
|
textAlign?: CSSGlobalKeywords | 'start' | 'center' | 'end' | 'left' | 'right';
|
|
@@ -31,6 +33,8 @@ export interface TextStyleProps extends BaseStyleProps {
|
|
|
31
33
|
dy?: number | string;
|
|
32
34
|
}
|
|
33
35
|
export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
|
|
36
|
+
x: CSSUnitValue;
|
|
37
|
+
y: CSSUnitValue;
|
|
34
38
|
text: string;
|
|
35
39
|
/** 设置文本内容的当前对齐方式 */
|
|
36
40
|
textAlign?: CSSKeywordValue;
|
package/es/dom/Document.js
CHANGED
|
@@ -146,7 +146,7 @@ function (_super) {
|
|
|
146
146
|
}), clientX = _c.x, clientY = _c.y;
|
|
147
147
|
return [4
|
|
148
148
|
/*yield*/
|
|
149
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
149
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
150
150
|
topmost: true,
|
|
151
151
|
position: {
|
|
152
152
|
x: x,
|
|
@@ -200,7 +200,7 @@ function (_super) {
|
|
|
200
200
|
}), clientX = _c.x, clientY = _c.y;
|
|
201
201
|
return [4
|
|
202
202
|
/*yield*/
|
|
203
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
203
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
204
204
|
topmost: false,
|
|
205
205
|
position: {
|
|
206
206
|
x: x,
|
package/es/dom/Element.js
CHANGED
package/es/global-module.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import { Module, injectable, decorate } from 'mana-syringe';
|
|
2
3
|
import { EventEmitter } from 'eventemitter3';
|
|
3
4
|
import { DisplayObjectPool } from './DisplayObjectPool';
|
|
4
|
-
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService,
|
|
5
|
-
import { LayoutRegistry,
|
|
5
|
+
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService, DefaultSceneGraphSelector, SceneGraphSelector, SceneGraphSelectorFactory } from './services';
|
|
6
|
+
import { LayoutRegistry, CSSPropertyLocalPosition, CSSPropertyLengthOrPercentage, CSSPropertyAnchor, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLineDash, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSPropertyShadowBlur, DefaultStyleValueRegistry } from './css';
|
|
7
|
+
import { ContextNode, FragmentResult, FragmentResultFactory, FragmentResultOptions, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions } from './css/layout';
|
|
6
8
|
export var containerModule = Module(function (register) {
|
|
7
9
|
decorate(injectable(), EventEmitter); // bind DisplayObject pool
|
|
8
10
|
|
|
@@ -18,10 +20,7 @@ export var containerModule = Module(function (register) {
|
|
|
18
20
|
}
|
|
19
21
|
}); // bind scenegraph service
|
|
20
22
|
|
|
21
|
-
register(
|
|
22
|
-
token: SceneGraphService,
|
|
23
|
-
useClass: DefaultSceneGraphService
|
|
24
|
-
}); // bind text service
|
|
23
|
+
register(DefaultSceneGraphService); // bind text service
|
|
25
24
|
|
|
26
25
|
register(OffscreenCanvasCreator);
|
|
27
26
|
register(TextService); // bind aabb updater
|
|
@@ -50,7 +49,7 @@ export var containerModule = Module(function (register) {
|
|
|
50
49
|
}); // bind CSS property handlers
|
|
51
50
|
|
|
52
51
|
register(LayoutRegistry);
|
|
53
|
-
register(
|
|
52
|
+
register(DefaultStyleValueRegistry);
|
|
54
53
|
register(CSSPropertyLengthOrPercentage);
|
|
55
54
|
register(CSSPropertyLocalPosition);
|
|
56
55
|
register(CSSPropertyOpacity);
|
|
@@ -68,5 +67,89 @@ export var containerModule = Module(function (register) {
|
|
|
68
67
|
register(CSSPropertyPoints);
|
|
69
68
|
register(CSSPropertyClipPath);
|
|
70
69
|
register(CSSPropertyText);
|
|
71
|
-
register(CSSPropertyTextTransform);
|
|
70
|
+
register(CSSPropertyTextTransform); // bind layout engine
|
|
71
|
+
|
|
72
|
+
register(LayoutEngine);
|
|
73
|
+
register(LayoutEdges);
|
|
74
|
+
register({
|
|
75
|
+
token: LayoutEdgesFactory,
|
|
76
|
+
useFactory: function useFactory(context) {
|
|
77
|
+
return function (options) {
|
|
78
|
+
var container = context.container.createChild();
|
|
79
|
+
container.register({
|
|
80
|
+
token: LayoutEdgesOptions,
|
|
81
|
+
useValue: options
|
|
82
|
+
});
|
|
83
|
+
return container.get(LayoutEdges);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
register({
|
|
88
|
+
token: LayoutContextFactory,
|
|
89
|
+
useFactory: function useFactory(context) {
|
|
90
|
+
return function (options) {
|
|
91
|
+
var container = context.container.createChild();
|
|
92
|
+
container.register(LayoutContext);
|
|
93
|
+
container.register(LayoutChildren);
|
|
94
|
+
container.register({
|
|
95
|
+
token: LayoutChildrenFactory,
|
|
96
|
+
useFactory: function useFactory(childContext) {
|
|
97
|
+
return function (childOptions) {
|
|
98
|
+
var childContainer = childContext.container.createChild();
|
|
99
|
+
childContainer.register({
|
|
100
|
+
token: LayoutChildrenOptions,
|
|
101
|
+
useValue: childOptions
|
|
102
|
+
});
|
|
103
|
+
return childContainer.get(LayoutChildren);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
container.register(FragmentResult);
|
|
108
|
+
container.register({
|
|
109
|
+
token: FragmentResultFactory,
|
|
110
|
+
useFactory: function useFactory(childContext) {
|
|
111
|
+
return function (childOptions, node) {
|
|
112
|
+
var childContainer = childContext.container.createChild();
|
|
113
|
+
childContainer.register({
|
|
114
|
+
token: FragmentResultOptions,
|
|
115
|
+
useValue: childOptions
|
|
116
|
+
});
|
|
117
|
+
childContainer.register({
|
|
118
|
+
token: ContextNode,
|
|
119
|
+
useValue: node
|
|
120
|
+
});
|
|
121
|
+
return childContainer.get(FragmentResult);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
container.register(LayoutFragment);
|
|
126
|
+
container.register({
|
|
127
|
+
token: LayoutFragmentFactory,
|
|
128
|
+
useFactory: function useFactory(childContext) {
|
|
129
|
+
return function (childOptions) {
|
|
130
|
+
var childContainer = childContext.container.createChild();
|
|
131
|
+
childContainer.register({
|
|
132
|
+
token: LayoutFragmentOptions,
|
|
133
|
+
useValue: childOptions
|
|
134
|
+
});
|
|
135
|
+
return childContainer.get(LayoutFragment);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
var layoutChildrenFactory = container.get(LayoutChildrenFactory);
|
|
140
|
+
var layoutFragmentFactory = container.get(LayoutFragmentFactory);
|
|
141
|
+
var fragmentResultFactory = container.get(FragmentResultFactory);
|
|
142
|
+
container.register({
|
|
143
|
+
token: LayoutContextOptions,
|
|
144
|
+
useValue: __assign(__assign({}, options), {
|
|
145
|
+
layoutChildrenFactory: layoutChildrenFactory,
|
|
146
|
+
layoutFragmentFactory: layoutFragmentFactory,
|
|
147
|
+
fragmentResultFactory: fragmentResultFactory
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
var layoutContext = container.get(LayoutContext);
|
|
151
|
+
return layoutContext;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
72
155
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as ManaSyringe from 'mana-syringe';
|
|
3
|
+
import { LayoutEngine } from './css/layout';
|
|
3
4
|
export { ManaSyringe };
|
|
5
|
+
declare const layoutEngine: LayoutEngine;
|
|
6
|
+
export { layoutEngine };
|
|
4
7
|
export * from './types';
|
|
5
8
|
export * from './css';
|
|
6
9
|
export * from './dom';
|
package/es/index.js
CHANGED
|
@@ -2,8 +2,11 @@ import 'reflect-metadata';
|
|
|
2
2
|
import * as ManaSyringe from 'mana-syringe';
|
|
3
3
|
import { containerModule as globalModule } from './global-module';
|
|
4
4
|
import { GlobalContainer } from 'mana-syringe';
|
|
5
|
+
import { LayoutEngine } from './css/layout';
|
|
5
6
|
export { ManaSyringe };
|
|
6
7
|
GlobalContainer.load(globalModule);
|
|
8
|
+
var layoutEngine = GlobalContainer.get(LayoutEngine);
|
|
9
|
+
export { layoutEngine };
|
|
7
10
|
export * from './types';
|
|
8
11
|
export * from './css';
|
|
9
12
|
export * from './dom';
|
|
@@ -11,6 +11,7 @@ export interface CullingStrategyContribution {
|
|
|
11
11
|
* 2. other custom culling strategies, eg. frustum culling
|
|
12
12
|
*/
|
|
13
13
|
export declare class CullingPlugin implements RenderingPlugin {
|
|
14
|
+
static tag: string;
|
|
14
15
|
private strategyProvider;
|
|
15
16
|
apply(renderingService: RenderingService): void;
|
|
16
17
|
}
|
|
@@ -13,9 +13,11 @@ var CullingPlugin =
|
|
|
13
13
|
function () {
|
|
14
14
|
function CullingPlugin() {}
|
|
15
15
|
|
|
16
|
+
CullingPlugin_1 = CullingPlugin;
|
|
17
|
+
|
|
16
18
|
CullingPlugin.prototype.apply = function (renderingService) {
|
|
17
19
|
var strategies = this.strategyProvider.getContributions();
|
|
18
|
-
renderingService.hooks.cull.tap(function (object) {
|
|
20
|
+
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var cullable = object.cullable;
|
|
21
23
|
|
|
@@ -37,14 +39,17 @@ function () {
|
|
|
37
39
|
|
|
38
40
|
return object;
|
|
39
41
|
});
|
|
40
|
-
renderingService.hooks.afterRender.tap(function (object) {
|
|
42
|
+
renderingService.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
|
|
41
43
|
object.cullable.visibilityPlaneMask = -1;
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
var CullingPlugin_1;
|
|
48
|
+
CullingPlugin.tag = 'Culling';
|
|
49
|
+
|
|
45
50
|
__decorate([contrib(CullingStrategyContribution), __metadata("design:type", Object)], CullingPlugin.prototype, "strategyProvider", void 0);
|
|
46
51
|
|
|
47
|
-
CullingPlugin = __decorate([singleton({
|
|
52
|
+
CullingPlugin = CullingPlugin_1 = __decorate([singleton({
|
|
48
53
|
contrib: RenderingPluginContribution
|
|
49
54
|
})], CullingPlugin);
|
|
50
55
|
return CullingPlugin;
|
|
@@ -3,6 +3,7 @@ import type { RenderingService, RenderingPlugin } from '../services/RenderingSer
|
|
|
3
3
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
4
4
|
*/
|
|
5
5
|
export declare class DirtyCheckPlugin implements RenderingPlugin {
|
|
6
|
+
static tag: string;
|
|
6
7
|
private canvasConfig;
|
|
7
8
|
private renderingContext;
|
|
8
9
|
apply(renderingService: RenderingService): void;
|
|
@@ -12,10 +12,12 @@ var DirtyCheckPlugin =
|
|
|
12
12
|
function () {
|
|
13
13
|
function DirtyCheckPlugin() {}
|
|
14
14
|
|
|
15
|
+
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
16
|
+
|
|
15
17
|
DirtyCheckPlugin.prototype.apply = function (renderingService) {
|
|
16
18
|
var _this = this;
|
|
17
19
|
|
|
18
|
-
renderingService.hooks.dirtycheck.tap(function (object) {
|
|
20
|
+
renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
|
|
19
21
|
if (object) {
|
|
20
22
|
var enableDirtyCheck = _this.canvasConfig.renderer.getConfig().enableDirtyCheck;
|
|
21
23
|
|
|
@@ -37,11 +39,14 @@ function () {
|
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
|
|
42
|
+
var DirtyCheckPlugin_1;
|
|
43
|
+
DirtyCheckPlugin.tag = 'DirtyCheck';
|
|
44
|
+
|
|
40
45
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
|
|
41
46
|
|
|
42
47
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
|
|
43
48
|
|
|
44
|
-
DirtyCheckPlugin = __decorate([singleton({
|
|
49
|
+
DirtyCheckPlugin = DirtyCheckPlugin_1 = __decorate([singleton({
|
|
45
50
|
contrib: RenderingPluginContribution
|
|
46
51
|
})], DirtyCheckPlugin);
|
|
47
52
|
return DirtyCheckPlugin;
|
|
@@ -7,6 +7,7 @@ import { RenderingService } from '../services';
|
|
|
7
7
|
* also provide some extra events such as `drag`
|
|
8
8
|
*/
|
|
9
9
|
export declare class EventPlugin implements RenderingPlugin {
|
|
10
|
+
static tag: string;
|
|
10
11
|
private canvasConfig;
|
|
11
12
|
private contextService;
|
|
12
13
|
private renderingService;
|
|
@@ -41,6 +41,8 @@ function () {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
EventPlugin_1 = EventPlugin;
|
|
45
|
+
|
|
44
46
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
45
47
|
var _this = this;
|
|
46
48
|
|
|
@@ -53,7 +55,7 @@ function () {
|
|
|
53
55
|
case 0:
|
|
54
56
|
return [4
|
|
55
57
|
/*yield*/
|
|
56
|
-
, this.renderingService.hooks.pick.
|
|
58
|
+
, this.renderingService.hooks.pick.promise({
|
|
57
59
|
position: position,
|
|
58
60
|
picked: [],
|
|
59
61
|
topmost: true // we only concern the topmost element
|
|
@@ -69,12 +71,12 @@ function () {
|
|
|
69
71
|
});
|
|
70
72
|
});
|
|
71
73
|
});
|
|
72
|
-
renderingService.hooks.pointerWheel.tap(function (nativeEvent) {
|
|
74
|
+
renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
73
75
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
74
76
|
|
|
75
77
|
_this.eventService.mapEvent(wheelEvent);
|
|
76
78
|
});
|
|
77
|
-
renderingService.hooks.pointerDown.tap(function (nativeEvent) {
|
|
79
|
+
renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
78
80
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
@@ -95,7 +97,7 @@ function () {
|
|
|
95
97
|
|
|
96
98
|
_this.setCursor(_this.eventService.cursor);
|
|
97
99
|
});
|
|
98
|
-
renderingService.hooks.pointerUp.tap(function (nativeEvent) {
|
|
100
|
+
renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
99
101
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
100
102
|
|
|
101
103
|
var $element = _this.contextService.getDomElement();
|
|
@@ -114,10 +116,10 @@ function () {
|
|
|
114
116
|
|
|
115
117
|
_this.setCursor(_this.eventService.cursor);
|
|
116
118
|
});
|
|
117
|
-
renderingService.hooks.pointerMove.tap(this.onPointerMove);
|
|
118
|
-
renderingService.hooks.pointerOver.tap(this.onPointerMove);
|
|
119
|
-
renderingService.hooks.pointerOut.tap(this.onPointerMove);
|
|
120
|
-
renderingService.hooks.pointerCancel.tap(function (nativeEvent) {
|
|
119
|
+
renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
120
|
+
renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
121
|
+
renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
122
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
121
123
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
@@ -350,6 +352,9 @@ function () {
|
|
|
350
352
|
}
|
|
351
353
|
};
|
|
352
354
|
|
|
355
|
+
var EventPlugin_1;
|
|
356
|
+
EventPlugin.tag = 'Event';
|
|
357
|
+
|
|
353
358
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
354
359
|
|
|
355
360
|
__decorate([inject(ContextService), __metadata("design:type", Object)], EventPlugin.prototype, "contextService", void 0);
|
|
@@ -360,7 +365,7 @@ function () {
|
|
|
360
365
|
|
|
361
366
|
__decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
362
367
|
|
|
363
|
-
EventPlugin = __decorate([singleton({
|
|
368
|
+
EventPlugin = EventPlugin_1 = __decorate([singleton({
|
|
364
369
|
contrib: RenderingPluginContribution
|
|
365
370
|
})], EventPlugin);
|
|
366
371
|
return EventPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderingService, RenderingPlugin } from '../services';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
|
+
static tag: string;
|
|
3
4
|
private renderingContext;
|
|
4
5
|
private styleValueRegistry;
|
|
5
6
|
apply(renderingService: RenderingService): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
2
|
import { inject, singleton } from 'mana-syringe';
|
|
3
|
-
import { StyleValueRegistry } from '../css';
|
|
3
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
4
4
|
import { ElementEvent } from '../dom';
|
|
5
5
|
import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
|
|
6
6
|
|
|
@@ -9,6 +9,8 @@ var PrepareRendererPlugin =
|
|
|
9
9
|
function () {
|
|
10
10
|
function PrepareRendererPlugin() {}
|
|
11
11
|
|
|
12
|
+
PrepareRendererPlugin_1 = PrepareRendererPlugin;
|
|
13
|
+
|
|
12
14
|
PrepareRendererPlugin.prototype.apply = function (renderingService) {
|
|
13
15
|
var _this = this;
|
|
14
16
|
|
|
@@ -37,7 +39,7 @@ function () {
|
|
|
37
39
|
renderingService.dirtify();
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
renderingService.hooks.init.tapPromise(function () {
|
|
42
|
+
renderingService.hooks.init.tapPromise(PrepareRendererPlugin_1.tag, function () {
|
|
41
43
|
return __awaiter(_this, void 0, void 0, function () {
|
|
42
44
|
return __generator(this, function (_a) {
|
|
43
45
|
this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
@@ -50,7 +52,7 @@ function () {
|
|
|
50
52
|
});
|
|
51
53
|
});
|
|
52
54
|
});
|
|
53
|
-
renderingService.hooks.destroy.tap(function () {
|
|
55
|
+
renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
|
|
54
56
|
_this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
55
57
|
|
|
56
58
|
_this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
@@ -61,11 +63,14 @@ function () {
|
|
|
61
63
|
});
|
|
62
64
|
};
|
|
63
65
|
|
|
66
|
+
var PrepareRendererPlugin_1;
|
|
67
|
+
PrepareRendererPlugin.tag = 'Prepare';
|
|
68
|
+
|
|
64
69
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
65
70
|
|
|
66
|
-
__decorate([inject(StyleValueRegistry), __metadata("design:type",
|
|
71
|
+
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
67
72
|
|
|
68
|
-
PrepareRendererPlugin = __decorate([singleton({
|
|
73
|
+
PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([singleton({
|
|
69
74
|
contrib: RenderingPluginContribution
|
|
70
75
|
})], PrepareRendererPlugin);
|
|
71
76
|
return PrepareRendererPlugin;
|