@antv/g 5.0.23 → 5.0.24
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 +3 -2
- package/es/AbstractRenderer.d.ts +11 -0
- package/es/AbstractRenderer.js +17 -2
- package/es/Canvas.d.ts +1 -1
- package/es/components/Geometry.d.ts +0 -4
- package/es/css/CSS.d.ts +2 -1
- package/es/css/CSS.js +5 -1
- package/es/css/StyleValueRegistry.js +3 -16
- package/es/css/index.d.ts +1 -1
- package/es/css/index.js +1 -1
- 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/global-module.js +87 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/services/OffscreenCanvasCreator.d.ts +1 -1
- package/es/services/OffscreenCanvasCreator.js +1 -1
- package/es/services/RenderingService.d.ts +1 -1
- package/es/services/RenderingService.js +1 -1
- package/es/types.d.ts +1 -4
- 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 -0
- package/es/utils/index.js +3 -1
- package/lib/AbstractRenderer.d.ts +11 -0
- package/lib/AbstractRenderer.js +17 -2
- package/lib/Canvas.d.ts +1 -1
- package/lib/components/Geometry.d.ts +0 -4
- package/lib/css/CSS.d.ts +2 -1
- package/lib/css/CSS.js +7 -1
- package/lib/css/StyleValueRegistry.js +3 -17
- package/lib/css/index.d.ts +1 -1
- package/lib/css/index.js +12 -12
- 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/global-module.js +89 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +7 -2
- package/lib/services/OffscreenCanvasCreator.d.ts +1 -1
- package/lib/services/OffscreenCanvasCreator.js +1 -1
- package/lib/services/RenderingService.d.ts +1 -1
- package/lib/services/RenderingService.js +1 -1
- package/lib/types.d.ts +1 -4
- 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 -0
- package/lib/utils/index.js +26 -0
- package/package.json +3 -3
- package/es/css/LayoutRegistry.d.ts +0 -11
- package/es/css/LayoutRegistry.js +0 -22
- package/lib/css/LayoutRegistry.d.ts +0 -11
- package/lib/css/LayoutRegistry.js +0 -30
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LayoutRegistry = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
// export const LayoutContribution = Syringe.defineToken('LayoutContribution');
|
|
13
|
+
// // eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
14
|
+
// export interface LayoutContribution {
|
|
15
|
+
// registerLayout: (layoutRegistry: LayoutRegistry) => void;
|
|
16
|
+
// }
|
|
17
|
+
var LayoutRegistry =
|
|
18
|
+
/** @class */
|
|
19
|
+
function () {
|
|
20
|
+
function LayoutRegistry() {
|
|
21
|
+
this.registry = new Map();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
LayoutRegistry_1 = LayoutRegistry;
|
|
25
|
+
Object.defineProperty(LayoutRegistry.prototype, "size", {
|
|
26
|
+
get: function get() {
|
|
27
|
+
return this.registry.size;
|
|
28
|
+
},
|
|
29
|
+
enumerable: false,
|
|
30
|
+
configurable: true
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
LayoutRegistry.prototype.hasLayout = function (name) {
|
|
34
|
+
return this.registry.has(name);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param name layout name, default to 'absolute'
|
|
39
|
+
* @returns layout object
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
LayoutRegistry.prototype.getLayout = function (name) {
|
|
44
|
+
if (name === void 0) {
|
|
45
|
+
name = 'absolute';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!this.hasLayout(name)) {
|
|
49
|
+
throw new Error("invalid layout property: ".concat(name));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return this.registry.get(name);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
LayoutRegistry.prototype.updateLayout = function (name, layout) {
|
|
56
|
+
this.registry.set(name, layout);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
LayoutRegistry.prototype.registerLayout = function (name, layout) {
|
|
60
|
+
if (name === '') {
|
|
61
|
+
throw new TypeError("layout name cant't be empty");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (LayoutRegistry_1.reservedLayout.includes(name)) {
|
|
65
|
+
throw new Error("layout name '".concat(name, "' is a system reserved layout name, please use another name"));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this.hasLayout(name)) {
|
|
69
|
+
throw new Error("layout '".concat(name, "' already exist."));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.registry.set(name, layout);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
LayoutRegistry.prototype.deleteLayout = function (name) {
|
|
76
|
+
this.registry.delete(name);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var LayoutRegistry_1; // 系统保留的布局名称,外部用户不能使用
|
|
80
|
+
// private static reservedLayout = ['relative', 'absolute', 'fixed', 'flex', 'dagre', 'autolayout'];
|
|
81
|
+
|
|
82
|
+
LayoutRegistry.reservedLayout = [];
|
|
83
|
+
LayoutRegistry = LayoutRegistry_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], LayoutRegistry);
|
|
84
|
+
return LayoutRegistry;
|
|
85
|
+
}();
|
|
86
|
+
|
|
87
|
+
exports.LayoutRegistry = LayoutRegistry;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Deferred } from '../../utils';
|
|
2
|
+
import type { LayoutChildren } from './LayoutChildren';
|
|
3
|
+
import type { LayoutFragment } from './LayoutFragment';
|
|
4
|
+
import type { IntrinsicSizes, LayoutConstraints, LayoutTaskType } from './types';
|
|
5
|
+
export declare type LayoutWorkTask = {
|
|
6
|
+
layoutConstraints: LayoutConstraints;
|
|
7
|
+
layoutChild: LayoutChildren;
|
|
8
|
+
taskType: LayoutTaskType.Layout;
|
|
9
|
+
deferred: Deferred<LayoutFragment>;
|
|
10
|
+
} | {
|
|
11
|
+
layoutChild: LayoutChildren;
|
|
12
|
+
taskType: LayoutTaskType.IntrinsicSizes;
|
|
13
|
+
deferred: Deferred<IntrinsicSizes>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './FragmentResult';
|
|
2
|
+
export * from './LayoutChildren';
|
|
3
|
+
export * from './LayoutContext';
|
|
4
|
+
export * from './LayoutDefinition';
|
|
5
|
+
export * from './LayoutEdges';
|
|
6
|
+
export * from './LayoutEngine';
|
|
7
|
+
export * from './LayoutFragment';
|
|
8
|
+
export * from './LayoutRegistry';
|
|
9
|
+
export * from './LayoutWorkTask';
|
|
10
|
+
export * from './LayoutObject';
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _FragmentResult = require("./FragmentResult");
|
|
8
|
+
|
|
9
|
+
Object.keys(_FragmentResult).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _FragmentResult[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _FragmentResult[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _LayoutChildren = require("./LayoutChildren");
|
|
21
|
+
|
|
22
|
+
Object.keys(_LayoutChildren).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _LayoutChildren[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _LayoutChildren[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _LayoutContext = require("./LayoutContext");
|
|
34
|
+
|
|
35
|
+
Object.keys(_LayoutContext).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _LayoutContext[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _LayoutContext[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _LayoutDefinition = require("./LayoutDefinition");
|
|
47
|
+
|
|
48
|
+
Object.keys(_LayoutDefinition).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _LayoutDefinition[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function get() {
|
|
54
|
+
return _LayoutDefinition[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var _LayoutEdges = require("./LayoutEdges");
|
|
60
|
+
|
|
61
|
+
Object.keys(_LayoutEdges).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _LayoutEdges[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function get() {
|
|
67
|
+
return _LayoutEdges[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _LayoutEngine = require("./LayoutEngine");
|
|
73
|
+
|
|
74
|
+
Object.keys(_LayoutEngine).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _LayoutEngine[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function get() {
|
|
80
|
+
return _LayoutEngine[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
var _LayoutFragment = require("./LayoutFragment");
|
|
86
|
+
|
|
87
|
+
Object.keys(_LayoutFragment).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _LayoutFragment[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _LayoutFragment[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var _LayoutRegistry = require("./LayoutRegistry");
|
|
99
|
+
|
|
100
|
+
Object.keys(_LayoutRegistry).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (key in exports && exports[key] === _LayoutRegistry[key]) return;
|
|
103
|
+
Object.defineProperty(exports, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function get() {
|
|
106
|
+
return _LayoutRegistry[key];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
var _LayoutWorkTask = require("./LayoutWorkTask");
|
|
112
|
+
|
|
113
|
+
Object.keys(_LayoutWorkTask).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _LayoutWorkTask[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _LayoutWorkTask[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
var _LayoutObject = require("./LayoutObject");
|
|
125
|
+
|
|
126
|
+
Object.keys(_LayoutObject).forEach(function (key) {
|
|
127
|
+
if (key === "default" || key === "__esModule") return;
|
|
128
|
+
if (key in exports && exports[key] === _LayoutObject[key]) return;
|
|
129
|
+
Object.defineProperty(exports, key, {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function get() {
|
|
132
|
+
return _LayoutObject[key];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
var _types = require("./types");
|
|
138
|
+
|
|
139
|
+
Object.keys(_types).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function get() {
|
|
145
|
+
return _types[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export declare type ContextId = string;
|
|
2
|
+
export declare enum LayoutTaskType {
|
|
3
|
+
Layout = "layout",
|
|
4
|
+
IntrinsicSizes = "intrinsic-sizes"
|
|
5
|
+
}
|
|
6
|
+
export interface LayoutOptions {
|
|
7
|
+
/**
|
|
8
|
+
* = "block"
|
|
9
|
+
*/
|
|
10
|
+
childDisplay: ChildDisplayType;
|
|
11
|
+
/**
|
|
12
|
+
* = "block-like
|
|
13
|
+
*/
|
|
14
|
+
sizing: LayoutSizingMode;
|
|
15
|
+
}
|
|
16
|
+
declare enum ChildDisplayType {
|
|
17
|
+
'block' = 0,
|
|
18
|
+
'normal' = 1
|
|
19
|
+
}
|
|
20
|
+
declare enum LayoutSizingMode {
|
|
21
|
+
'block-like' = 0,
|
|
22
|
+
'manual' = 1
|
|
23
|
+
}
|
|
24
|
+
export interface IntrinsicSizes {
|
|
25
|
+
readonly minContentInlineSize: number;
|
|
26
|
+
readonly minContentBlockSize: number;
|
|
27
|
+
readonly maxContentInlineSize: number;
|
|
28
|
+
readonly maxContentBlockSize: number;
|
|
29
|
+
}
|
|
30
|
+
export interface LayoutConstraints<T = void> {
|
|
31
|
+
/**
|
|
32
|
+
* the available space the current layout must respect
|
|
33
|
+
*/
|
|
34
|
+
readonly availableInlineSize: number;
|
|
35
|
+
readonly availableBlockSize: number;
|
|
36
|
+
/**
|
|
37
|
+
* require current layout must to be exact size
|
|
38
|
+
*/
|
|
39
|
+
readonly fixedInlineSize?: number;
|
|
40
|
+
readonly fixedBlockSize?: number;
|
|
41
|
+
/**
|
|
42
|
+
* used to resolve percentage value
|
|
43
|
+
* Web developers should resolve any percentages against the percentage sizes.
|
|
44
|
+
* eg. `const value = constraints.percentageInlineSize * 0.5;`
|
|
45
|
+
*/
|
|
46
|
+
readonly percentageInlineSize: number;
|
|
47
|
+
readonly percentageBlockSize: number;
|
|
48
|
+
readonly data: T;
|
|
49
|
+
}
|
|
50
|
+
export declare enum PropertyName {
|
|
51
|
+
LAYOUT = "display",
|
|
52
|
+
LEFT = "left",
|
|
53
|
+
TOP = "top",
|
|
54
|
+
BOTTOM = "bottom",
|
|
55
|
+
RIGHT = "right",
|
|
56
|
+
WIDTH = "width",
|
|
57
|
+
HEIGHT = "height",
|
|
58
|
+
MIN_WIDTH = "minWidth",
|
|
59
|
+
MAX_WIDTH = "maxWidth",
|
|
60
|
+
MIN_HEIGHT = "minHeight",
|
|
61
|
+
MAX_HEIGHT = "maxHeight",
|
|
62
|
+
BOX_SIZING = "boxSizing",
|
|
63
|
+
PADDING = "padding",
|
|
64
|
+
PADDING_TOP = "paddingTop",
|
|
65
|
+
PADDING_BOTTOM = "paddingBottom",
|
|
66
|
+
PADDING_START = "paddingLeft",
|
|
67
|
+
PADDING_END = "paddingRight",
|
|
68
|
+
MARGIN = "margin",
|
|
69
|
+
MARGIN_TOP = "marginTop",
|
|
70
|
+
MARGIN_BOTTOM = "marginBottom",
|
|
71
|
+
MARGIN_START = "marginLeft",
|
|
72
|
+
MARGIN_END = "marginRight",
|
|
73
|
+
BORDER = "border",
|
|
74
|
+
BORDER_TOP = "borderTop",
|
|
75
|
+
BORDER_BOTTOM = "borderBottom",
|
|
76
|
+
BORDER_START = "borderLeft",
|
|
77
|
+
BORDER_END = "borderRight",
|
|
78
|
+
FLEX_DIRECTION = "flexDirection",
|
|
79
|
+
FLEX_WRAP = "flexWrap",
|
|
80
|
+
FLEX_FLOW = "flexFlow",
|
|
81
|
+
ALIGN_ITEMS = "alignItems",
|
|
82
|
+
ALIGN_CONTENT = "alignContent",
|
|
83
|
+
JUSTIFY_CONTENT = "justifyContent",
|
|
84
|
+
FLEX = "flex",
|
|
85
|
+
ALIGN_SELF = "alignSelf",
|
|
86
|
+
FLEX_SHRINK = "flexShrink",
|
|
87
|
+
FLEX_BASIS = "flexBasis",
|
|
88
|
+
FLEX_GROW = "flexGrow",
|
|
89
|
+
OFFSET_WIDTH = "offsetWidth",
|
|
90
|
+
OFFSET_HEIGHT = "offsetHeight",
|
|
91
|
+
ORDER = "order"
|
|
92
|
+
}
|
|
93
|
+
export declare type MeasureFn = (width?: number, height?: number) => {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
export interface ComputedLayout {
|
|
98
|
+
readonly width: number;
|
|
99
|
+
readonly height: number;
|
|
100
|
+
readonly x: number;
|
|
101
|
+
readonly y: number;
|
|
102
|
+
readonly children: ComputedLayout[];
|
|
103
|
+
}
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PropertyName = exports.LayoutTaskType = void 0;
|
|
7
|
+
var LayoutTaskType;
|
|
8
|
+
exports.LayoutTaskType = LayoutTaskType;
|
|
9
|
+
|
|
10
|
+
(function (LayoutTaskType) {
|
|
11
|
+
LayoutTaskType["Layout"] = "layout";
|
|
12
|
+
LayoutTaskType["IntrinsicSizes"] = "intrinsic-sizes";
|
|
13
|
+
})(LayoutTaskType || (exports.LayoutTaskType = LayoutTaskType = {}));
|
|
14
|
+
|
|
15
|
+
var ChildDisplayType;
|
|
16
|
+
|
|
17
|
+
(function (ChildDisplayType) {
|
|
18
|
+
ChildDisplayType[ChildDisplayType["block"] = 0] = "block";
|
|
19
|
+
ChildDisplayType[ChildDisplayType["normal"] = 1] = "normal";
|
|
20
|
+
})(ChildDisplayType || (ChildDisplayType = {}));
|
|
21
|
+
|
|
22
|
+
var LayoutSizingMode;
|
|
23
|
+
|
|
24
|
+
(function (LayoutSizingMode) {
|
|
25
|
+
LayoutSizingMode[LayoutSizingMode["block-like"] = 0] = "block-like";
|
|
26
|
+
LayoutSizingMode[LayoutSizingMode["manual"] = 1] = "manual";
|
|
27
|
+
})(LayoutSizingMode || (LayoutSizingMode = {}));
|
|
28
|
+
|
|
29
|
+
var PropertyName;
|
|
30
|
+
exports.PropertyName = PropertyName;
|
|
31
|
+
|
|
32
|
+
(function (PropertyName) {
|
|
33
|
+
PropertyName["LAYOUT"] = "display";
|
|
34
|
+
PropertyName["LEFT"] = "left";
|
|
35
|
+
PropertyName["TOP"] = "top";
|
|
36
|
+
PropertyName["BOTTOM"] = "bottom";
|
|
37
|
+
PropertyName["RIGHT"] = "right";
|
|
38
|
+
PropertyName["WIDTH"] = "width";
|
|
39
|
+
PropertyName["HEIGHT"] = "height";
|
|
40
|
+
PropertyName["MIN_WIDTH"] = "minWidth";
|
|
41
|
+
PropertyName["MAX_WIDTH"] = "maxWidth";
|
|
42
|
+
PropertyName["MIN_HEIGHT"] = "minHeight";
|
|
43
|
+
PropertyName["MAX_HEIGHT"] = "maxHeight";
|
|
44
|
+
PropertyName["BOX_SIZING"] = "boxSizing";
|
|
45
|
+
PropertyName["PADDING"] = "padding";
|
|
46
|
+
PropertyName["PADDING_TOP"] = "paddingTop";
|
|
47
|
+
PropertyName["PADDING_BOTTOM"] = "paddingBottom";
|
|
48
|
+
PropertyName["PADDING_START"] = "paddingLeft";
|
|
49
|
+
PropertyName["PADDING_END"] = "paddingRight";
|
|
50
|
+
PropertyName["MARGIN"] = "margin";
|
|
51
|
+
PropertyName["MARGIN_TOP"] = "marginTop";
|
|
52
|
+
PropertyName["MARGIN_BOTTOM"] = "marginBottom";
|
|
53
|
+
PropertyName["MARGIN_START"] = "marginLeft";
|
|
54
|
+
PropertyName["MARGIN_END"] = "marginRight";
|
|
55
|
+
PropertyName["BORDER"] = "border";
|
|
56
|
+
PropertyName["BORDER_TOP"] = "borderTop";
|
|
57
|
+
PropertyName["BORDER_BOTTOM"] = "borderBottom";
|
|
58
|
+
PropertyName["BORDER_START"] = "borderLeft";
|
|
59
|
+
PropertyName["BORDER_END"] = "borderRight";
|
|
60
|
+
PropertyName["FLEX_DIRECTION"] = "flexDirection";
|
|
61
|
+
PropertyName["FLEX_WRAP"] = "flexWrap";
|
|
62
|
+
PropertyName["FLEX_FLOW"] = "flexFlow";
|
|
63
|
+
PropertyName["ALIGN_ITEMS"] = "alignItems";
|
|
64
|
+
PropertyName["ALIGN_CONTENT"] = "alignContent";
|
|
65
|
+
PropertyName["JUSTIFY_CONTENT"] = "justifyContent";
|
|
66
|
+
PropertyName["FLEX"] = "flex";
|
|
67
|
+
PropertyName["ALIGN_SELF"] = "alignSelf";
|
|
68
|
+
PropertyName["FLEX_SHRINK"] = "flexShrink";
|
|
69
|
+
PropertyName["FLEX_BASIS"] = "flexBasis";
|
|
70
|
+
PropertyName["FLEX_GROW"] = "flexGrow";
|
|
71
|
+
PropertyName["OFFSET_WIDTH"] = "offsetWidth";
|
|
72
|
+
PropertyName["OFFSET_HEIGHT"] = "offsetHeight";
|
|
73
|
+
PropertyName["ORDER"] = "order";
|
|
74
|
+
})(PropertyName || (exports.PropertyName = PropertyName = {}));
|
package/lib/global-module.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.containerModule = void 0;
|
|
7
7
|
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
8
10
|
var _manaSyringe = require("mana-syringe");
|
|
9
11
|
|
|
10
12
|
var _eventemitter = require("eventemitter3");
|
|
@@ -15,6 +17,8 @@ var _services = require("./services");
|
|
|
15
17
|
|
|
16
18
|
var _css = require("./css");
|
|
17
19
|
|
|
20
|
+
var _layout = require("./css/layout");
|
|
21
|
+
|
|
18
22
|
var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
19
23
|
(0, _manaSyringe.decorate)((0, _manaSyringe.injectable)(), _eventemitter.EventEmitter); // bind DisplayObject pool
|
|
20
24
|
|
|
@@ -77,6 +81,90 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
77
81
|
register(_css.CSSPropertyPoints);
|
|
78
82
|
register(_css.CSSPropertyClipPath);
|
|
79
83
|
register(_css.CSSPropertyText);
|
|
80
|
-
register(_css.CSSPropertyTextTransform);
|
|
84
|
+
register(_css.CSSPropertyTextTransform); // bind layout engine
|
|
85
|
+
|
|
86
|
+
register(_layout.LayoutEngine);
|
|
87
|
+
register(_layout.LayoutEdges);
|
|
88
|
+
register({
|
|
89
|
+
token: _layout.LayoutEdgesFactory,
|
|
90
|
+
useFactory: function useFactory(context) {
|
|
91
|
+
return function (options) {
|
|
92
|
+
var container = context.container.createChild();
|
|
93
|
+
container.register({
|
|
94
|
+
token: _layout.LayoutEdgesOptions,
|
|
95
|
+
useValue: options
|
|
96
|
+
});
|
|
97
|
+
return container.get(_layout.LayoutEdges);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
register({
|
|
102
|
+
token: _layout.LayoutContextFactory,
|
|
103
|
+
useFactory: function useFactory(context) {
|
|
104
|
+
return function (options) {
|
|
105
|
+
var container = context.container.createChild();
|
|
106
|
+
container.register(_layout.LayoutContext);
|
|
107
|
+
container.register(_layout.LayoutChildren);
|
|
108
|
+
container.register({
|
|
109
|
+
token: _layout.LayoutChildrenFactory,
|
|
110
|
+
useFactory: function useFactory(childContext) {
|
|
111
|
+
return function (childOptions) {
|
|
112
|
+
var childContainer = childContext.container.createChild();
|
|
113
|
+
childContainer.register({
|
|
114
|
+
token: _layout.LayoutChildrenOptions,
|
|
115
|
+
useValue: childOptions
|
|
116
|
+
});
|
|
117
|
+
return childContainer.get(_layout.LayoutChildren);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
container.register(_layout.FragmentResult);
|
|
122
|
+
container.register({
|
|
123
|
+
token: _layout.FragmentResultFactory,
|
|
124
|
+
useFactory: function useFactory(childContext) {
|
|
125
|
+
return function (childOptions, node) {
|
|
126
|
+
var childContainer = childContext.container.createChild();
|
|
127
|
+
childContainer.register({
|
|
128
|
+
token: _layout.FragmentResultOptions,
|
|
129
|
+
useValue: childOptions
|
|
130
|
+
});
|
|
131
|
+
childContainer.register({
|
|
132
|
+
token: _layout.ContextNode,
|
|
133
|
+
useValue: node
|
|
134
|
+
});
|
|
135
|
+
return childContainer.get(_layout.FragmentResult);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
container.register(_layout.LayoutFragment);
|
|
140
|
+
container.register({
|
|
141
|
+
token: _layout.LayoutFragmentFactory,
|
|
142
|
+
useFactory: function useFactory(childContext) {
|
|
143
|
+
return function (childOptions) {
|
|
144
|
+
var childContainer = childContext.container.createChild();
|
|
145
|
+
childContainer.register({
|
|
146
|
+
token: _layout.LayoutFragmentOptions,
|
|
147
|
+
useValue: childOptions
|
|
148
|
+
});
|
|
149
|
+
return childContainer.get(_layout.LayoutFragment);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
var layoutChildrenFactory = container.get(_layout.LayoutChildrenFactory);
|
|
154
|
+
var layoutFragmentFactory = container.get(_layout.LayoutFragmentFactory);
|
|
155
|
+
var fragmentResultFactory = container.get(_layout.FragmentResultFactory);
|
|
156
|
+
container.register({
|
|
157
|
+
token: _layout.LayoutContextOptions,
|
|
158
|
+
useValue: (0, _tslib.__assign)((0, _tslib.__assign)({}, options), {
|
|
159
|
+
layoutChildrenFactory: layoutChildrenFactory,
|
|
160
|
+
layoutFragmentFactory: layoutFragmentFactory,
|
|
161
|
+
fragmentResultFactory: fragmentResultFactory
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
var layoutContext = container.get(_layout.LayoutContext);
|
|
165
|
+
return layoutContext;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
81
169
|
});
|
|
82
170
|
exports.containerModule = containerModule;
|
package/lib/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/lib/index.js
CHANGED
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
var _exportNames = {
|
|
9
|
+
layoutEngine: true,
|
|
9
10
|
ManaSyringe: true
|
|
10
11
|
};
|
|
11
|
-
exports.ManaSyringe = void 0;
|
|
12
|
+
exports.layoutEngine = exports.ManaSyringe = void 0;
|
|
12
13
|
|
|
13
14
|
require("reflect-metadata");
|
|
14
15
|
|
|
@@ -18,6 +19,8 @@ exports.ManaSyringe = ManaSyringe;
|
|
|
18
19
|
|
|
19
20
|
var _globalModule = require("./global-module");
|
|
20
21
|
|
|
22
|
+
var _layout = require("./css/layout");
|
|
23
|
+
|
|
21
24
|
var _types = require("./types");
|
|
22
25
|
|
|
23
26
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -190,4 +193,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
190
193
|
|
|
191
194
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
192
195
|
|
|
193
|
-
ManaSyringe.GlobalContainer.load(_globalModule.containerModule);
|
|
196
|
+
ManaSyringe.GlobalContainer.load(_globalModule.containerModule);
|
|
197
|
+
var layoutEngine = ManaSyringe.GlobalContainer.get(_layout.LayoutEngine);
|
|
198
|
+
exports.layoutEngine = layoutEngine;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* used in following scenes:
|
|
4
4
|
* - g `ctx.measureText`
|
|
5
5
|
* - g-plugin-canvas-picker `ctx.isPointInPath`
|
|
6
|
-
* - g-plugin-
|
|
6
|
+
* - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
|
|
7
7
|
*/
|
|
8
8
|
export declare class OffscreenCanvasCreator {
|
|
9
9
|
private canvas;
|
|
@@ -13,7 +13,7 @@ var _manaSyringe = require("mana-syringe");
|
|
|
13
13
|
* used in following scenes:
|
|
14
14
|
* - g `ctx.measureText`
|
|
15
15
|
* - g-plugin-canvas-picker `ctx.isPointInPath`
|
|
16
|
-
* - g-plugin-
|
|
16
|
+
* - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
|
|
17
17
|
*/
|
|
18
18
|
var OffscreenCanvasCreator =
|
|
19
19
|
/** @class */
|
|
@@ -66,7 +66,7 @@ export declare class RenderingService {
|
|
|
66
66
|
endFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
|
|
67
67
|
destroy: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
|
|
68
68
|
/**
|
|
69
|
-
* use async but faster method such as GPU-based picking in `g-plugin-
|
|
69
|
+
* use async but faster method such as GPU-based picking in `g-plugin-device-renderer`
|
|
70
70
|
*/
|
|
71
71
|
pick: AsyncSeriesWaterfallHook<[PickingResult], PickingResult>;
|
|
72
72
|
/**
|
|
@@ -95,7 +95,7 @@ function () {
|
|
|
95
95
|
destroy: new _tapable.SyncHook([]),
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* use async but faster method such as GPU-based picking in `g-plugin-
|
|
98
|
+
* use async but faster method such as GPU-based picking in `g-plugin-device-renderer`
|
|
99
99
|
*/
|
|
100
100
|
pick: new _tapable.AsyncSeriesWaterfallHook(['result']),
|
|
101
101
|
|
package/lib/types.d.ts
CHANGED
|
@@ -161,6 +161,7 @@ export interface BaseStyleProps {
|
|
|
161
161
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/miterLimit
|
|
162
162
|
*/
|
|
163
163
|
miterLimit?: number;
|
|
164
|
+
display?: string;
|
|
164
165
|
}
|
|
165
166
|
export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x' | 'y' | 'z' | 'opacity' | 'strokeOpacity' | 'fillOpacity' | 'fill' | 'stroke' | 'lineWidth' | 'increasedLineWidthForHitTesting' | 'lineJoin' | 'lineCap' | 'lineDash' | 'lineDashOffset' | 'path' | 'points' | 'shadowColor' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY' | 'visibility' | 'pointerEvents' | 'zIndex' | 'transformOrigin' | 'textTransform'> {
|
|
166
167
|
zIndex?: CSSUnitValue;
|
|
@@ -215,10 +216,6 @@ export interface RendererConfig {
|
|
|
215
216
|
* enable auto rendering
|
|
216
217
|
*/
|
|
217
218
|
enableAutoRendering: boolean;
|
|
218
|
-
/**
|
|
219
|
-
* enable TAA in WebGL
|
|
220
|
-
*/
|
|
221
|
-
enableTAA: boolean;
|
|
222
219
|
}
|
|
223
220
|
export declare const CanvasConfig: Syringe.DefinedToken;
|
|
224
221
|
export interface CanvasConfig {
|