@antv/g 5.0.23-alpha.8 → 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 +4 -3
- package/es/AbstractRenderer.d.ts +11 -0
- package/es/AbstractRenderer.js +17 -2
- package/es/Canvas.d.ts +1 -1
- package/es/css/CSS.d.ts +2 -1
- package/es/css/CSS.js +6 -2
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +34 -25
- 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/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/transform.js +5 -4
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/display-objects/DisplayObject.d.ts +1 -2
- package/es/display-objects/DisplayObject.js +2 -1
- package/es/dom/Document.js +2 -2
- 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 +4 -8
- 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.js +3 -1
- package/es/types.d.ts +7 -5
- 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 +1 -1
- package/lib/AbstractRenderer.d.ts +11 -0
- package/lib/AbstractRenderer.js +17 -2
- package/lib/Canvas.d.ts +1 -1
- package/lib/css/CSS.d.ts +2 -1
- package/lib/css/CSS.js +9 -3
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +39 -27
- 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/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +4 -4
- package/lib/css/parser/transform.js +6 -4
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/display-objects/DisplayObject.d.ts +1 -2
- package/lib/display-objects/DisplayObject.js +3 -2
- package/lib/dom/Document.js +2 -2
- 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 +4 -8
- 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.js +3 -1
- package/lib/types.d.ts +7 -5
- 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 +2 -2
- 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
package/lib/AbstractRenderer.js
CHANGED
|
@@ -27,8 +27,7 @@ function () {
|
|
|
27
27
|
* enable dirty rectangle rendering by default
|
|
28
28
|
*/
|
|
29
29
|
enableDirtyRectangleRendering: true,
|
|
30
|
-
enableDirtyRectangleRenderingDebug: false
|
|
31
|
-
enableTAA: false
|
|
30
|
+
enableDirtyRectangleRenderingDebug: false
|
|
32
31
|
}, config);
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -36,10 +35,26 @@ function () {
|
|
|
36
35
|
this.plugins.push(plugin);
|
|
37
36
|
};
|
|
38
37
|
|
|
38
|
+
AbstractRenderer.prototype.unregisterPlugin = function (plugin) {
|
|
39
|
+
var index = this.plugins.findIndex(function (p) {
|
|
40
|
+
return p === plugin;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (index > -1) {
|
|
44
|
+
this.plugins.splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
39
48
|
AbstractRenderer.prototype.getPlugins = function () {
|
|
40
49
|
return this.plugins;
|
|
41
50
|
};
|
|
42
51
|
|
|
52
|
+
AbstractRenderer.prototype.getPlugin = function (name) {
|
|
53
|
+
return this.plugins.find(function (plugin) {
|
|
54
|
+
return plugin.name === name;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
43
58
|
AbstractRenderer.prototype.getConfig = function () {
|
|
44
59
|
return this.config;
|
|
45
60
|
};
|
package/lib/Canvas.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
|
|
|
96
96
|
* get the root displayObject in scenegraph
|
|
97
97
|
* @alias this.document.documentElement
|
|
98
98
|
*/
|
|
99
|
-
getRoot(): import("
|
|
99
|
+
getRoot(): import(".").Group;
|
|
100
100
|
/**
|
|
101
101
|
* get the camera of canvas
|
|
102
102
|
*/
|
package/lib/css/CSS.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CSSUnitValue } from './cssom';
|
|
2
|
+
import type { LayoutDefinitionCtor } from './layout';
|
|
2
3
|
/**
|
|
3
4
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS/RegisterProperty#parameters
|
|
4
5
|
*/
|
|
@@ -80,5 +81,5 @@ export declare const CSS: {
|
|
|
80
81
|
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
81
82
|
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
82
83
|
*/
|
|
83
|
-
registerLayout: (name: string) => void;
|
|
84
|
+
registerLayout: (name: string, clazz: LayoutDefinitionCtor) => void;
|
|
84
85
|
};
|
package/lib/css/CSS.js
CHANGED
|
@@ -9,7 +9,9 @@ var _manaSyringe = require("mana-syringe");
|
|
|
9
9
|
|
|
10
10
|
var _cssom = require("./cssom");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _interfaces = require("./interfaces");
|
|
13
|
+
|
|
14
|
+
var _layout = require("./layout");
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* holds useful CSS-related methods.
|
|
@@ -104,7 +106,7 @@ var CSS = {
|
|
|
104
106
|
inherits = definition.inherits,
|
|
105
107
|
initialValue = definition.initialValue;
|
|
106
108
|
|
|
107
|
-
var registry = _manaSyringe.GlobalContainer.get(
|
|
109
|
+
var registry = _manaSyringe.GlobalContainer.get(_interfaces.StyleValueRegistry);
|
|
108
110
|
|
|
109
111
|
registry.registerMetadata({
|
|
110
112
|
name: name,
|
|
@@ -120,6 +122,10 @@ var CSS = {
|
|
|
120
122
|
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
121
123
|
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
122
124
|
*/
|
|
123
|
-
registerLayout: function registerLayout(name) {
|
|
125
|
+
registerLayout: function registerLayout(name, clazz) {
|
|
126
|
+
var layoutRegistry = _manaSyringe.GlobalContainer.get(_layout.LayoutRegistry);
|
|
127
|
+
|
|
128
|
+
layoutRegistry.registerLayout(name, clazz);
|
|
129
|
+
}
|
|
124
130
|
};
|
|
125
131
|
exports.CSS = CSS;
|
package/lib/css/CSSProperty.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElement } from '../dom';
|
|
2
|
-
import type { StyleValueRegistry } from './
|
|
2
|
+
import type { StyleValueRegistry } from './interfaces';
|
|
3
3
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
4
4
|
declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
|
|
5
5
|
declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
import type { BaseStyleProps } from '../types';
|
|
3
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
5
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
5
6
|
export interface PropertyParseOptions {
|
|
6
7
|
skipUpdateAttribute: boolean;
|
|
@@ -65,7 +66,7 @@ export interface PropertyMetadata {
|
|
|
65
66
|
* Blink used them in code generation(css_properties.json5)
|
|
66
67
|
*/
|
|
67
68
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
68
|
-
export declare class StyleValueRegistry {
|
|
69
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
69
70
|
/**
|
|
70
71
|
* need recalc later
|
|
71
72
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.PropertySyntax = exports.DefaultStyleValueRegistry = exports.BUILT_IN_PROPERTIES = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
@@ -11,7 +11,9 @@ var _manaSyringe = require("mana-syringe");
|
|
|
11
11
|
|
|
12
12
|
var _glMatrix = require("gl-matrix");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _interfaces = require("../services/aabb/interfaces");
|
|
15
|
+
|
|
16
|
+
var _SceneGraphService = require("../services/SceneGraphService");
|
|
15
17
|
|
|
16
18
|
var _dom = require("../dom");
|
|
17
19
|
|
|
@@ -27,6 +29,8 @@ var _utils = require("../utils");
|
|
|
27
29
|
|
|
28
30
|
var _shapes = require("../shapes");
|
|
29
31
|
|
|
32
|
+
var _interfaces2 = require("./interfaces");
|
|
33
|
+
|
|
30
34
|
var PropertySyntax = {
|
|
31
35
|
COLOR: '<color>',
|
|
32
36
|
PAINT: '<paint>',
|
|
@@ -154,6 +158,13 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
154
158
|
alias: ['strokeWidth'],
|
|
155
159
|
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
156
160
|
handler: _properties.CSSPropertyLengthOrPercentage
|
|
161
|
+
}, {
|
|
162
|
+
name: 'increasedLineWidthForHitTesting',
|
|
163
|
+
inherited: true,
|
|
164
|
+
defaultValue: '0',
|
|
165
|
+
layoutDependent: true,
|
|
166
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
167
|
+
handler: _properties.CSSPropertyLengthOrPercentage
|
|
157
168
|
}, {
|
|
158
169
|
name: 'lineJoin',
|
|
159
170
|
inherited: true,
|
|
@@ -431,10 +442,10 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
431
442
|
}];
|
|
432
443
|
exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
|
|
433
444
|
|
|
434
|
-
var
|
|
445
|
+
var DefaultStyleValueRegistry =
|
|
435
446
|
/** @class */
|
|
436
447
|
function () {
|
|
437
|
-
function
|
|
448
|
+
function DefaultStyleValueRegistry() {
|
|
438
449
|
/**
|
|
439
450
|
* need recalc later
|
|
440
451
|
*/
|
|
@@ -470,7 +481,7 @@ function () {
|
|
|
470
481
|
// > = {};
|
|
471
482
|
|
|
472
483
|
|
|
473
|
-
|
|
484
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
474
485
|
var _this = this;
|
|
475
486
|
|
|
476
487
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -478,7 +489,7 @@ function () {
|
|
|
478
489
|
});
|
|
479
490
|
};
|
|
480
491
|
|
|
481
|
-
|
|
492
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
482
493
|
var _this = this;
|
|
483
494
|
|
|
484
495
|
(0, _tslib.__spreadArray)([metadata.name], (0, _tslib.__read)(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -486,7 +497,7 @@ function () {
|
|
|
486
497
|
});
|
|
487
498
|
};
|
|
488
499
|
|
|
489
|
-
|
|
500
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
490
501
|
return this.cache[name];
|
|
491
502
|
};
|
|
492
503
|
/**
|
|
@@ -500,7 +511,7 @@ function () {
|
|
|
500
511
|
*/
|
|
501
512
|
|
|
502
513
|
|
|
503
|
-
|
|
514
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
504
515
|
var _this = this;
|
|
505
516
|
|
|
506
517
|
if (options === void 0) {
|
|
@@ -581,7 +592,7 @@ function () {
|
|
|
581
592
|
*/
|
|
582
593
|
|
|
583
594
|
|
|
584
|
-
|
|
595
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
585
596
|
var metadata = this.getMetadata(name);
|
|
586
597
|
var computed = value;
|
|
587
598
|
|
|
@@ -617,7 +628,7 @@ function () {
|
|
|
617
628
|
*/
|
|
618
629
|
|
|
619
630
|
|
|
620
|
-
|
|
631
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
621
632
|
var metadata = this.getMetadata(name);
|
|
622
633
|
var isDocumentElement = object.id === 'g-root';
|
|
623
634
|
var used = computed instanceof _cssom.CSSStyleValue ? computed.clone() : computed;
|
|
@@ -682,7 +693,7 @@ function () {
|
|
|
682
693
|
return false;
|
|
683
694
|
};
|
|
684
695
|
|
|
685
|
-
|
|
696
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
686
697
|
var metadata = this.getMetadata(name);
|
|
687
698
|
|
|
688
699
|
if (metadata && metadata.handler) {
|
|
@@ -694,7 +705,7 @@ function () {
|
|
|
694
705
|
}
|
|
695
706
|
};
|
|
696
707
|
|
|
697
|
-
|
|
708
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
698
709
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
699
710
|
return true;
|
|
700
711
|
}
|
|
@@ -706,7 +717,7 @@ function () {
|
|
|
706
717
|
*/
|
|
707
718
|
|
|
708
719
|
|
|
709
|
-
|
|
720
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
710
721
|
if (!this.unresolvedProperties[object.entity]) {
|
|
711
722
|
this.unresolvedProperties[object.entity] = [];
|
|
712
723
|
}
|
|
@@ -716,7 +727,7 @@ function () {
|
|
|
716
727
|
}
|
|
717
728
|
};
|
|
718
729
|
|
|
719
|
-
|
|
730
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
720
731
|
if (options === void 0) {
|
|
721
732
|
options = {};
|
|
722
733
|
}
|
|
@@ -740,7 +751,7 @@ function () {
|
|
|
740
751
|
return false;
|
|
741
752
|
};
|
|
742
753
|
|
|
743
|
-
|
|
754
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
744
755
|
var properties = this.unresolvedProperties[object.entity];
|
|
745
756
|
|
|
746
757
|
if (properties && properties.length) {
|
|
@@ -758,10 +769,10 @@ function () {
|
|
|
758
769
|
*/
|
|
759
770
|
|
|
760
771
|
|
|
761
|
-
|
|
772
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
762
773
|
var _a;
|
|
763
774
|
|
|
764
|
-
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(
|
|
775
|
+
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
|
|
765
776
|
|
|
766
777
|
var geometryUpdater = geometryUpdaterFactory(object.nodeName);
|
|
767
778
|
|
|
@@ -814,6 +825,7 @@ function () {
|
|
|
814
825
|
|
|
815
826
|
var _j = parsedStyle,
|
|
816
827
|
lineWidth = _j.lineWidth,
|
|
828
|
+
increasedLineWidthForHitTesting = _j.increasedLineWidthForHitTesting,
|
|
817
829
|
shadowColor = _j.shadowColor,
|
|
818
830
|
_k = _j.filter,
|
|
819
831
|
filter = _k === void 0 ? [] : _k,
|
|
@@ -828,11 +840,9 @@ function () {
|
|
|
828
840
|
|
|
829
841
|
|
|
830
842
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
843
|
+
var halfLineWidth = (((lineWidth === null || lineWidth === void 0 ? void 0 : lineWidth.value) || 0) + ((increasedLineWidthForHitTesting === null || increasedLineWidthForHitTesting === void 0 ? void 0 : increasedLineWidthForHitTesting.value) || 0)) / 2; // append border
|
|
831
844
|
|
|
832
|
-
|
|
833
|
-
// append border
|
|
834
|
-
_glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(lineWidth.value / 2, lineWidth.value / 2, 0));
|
|
835
|
-
}
|
|
845
|
+
_glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(halfLineWidth, halfLineWidth, 0));
|
|
836
846
|
|
|
837
847
|
geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
|
|
838
848
|
|
|
@@ -892,11 +902,11 @@ function () {
|
|
|
892
902
|
usedOriginYValue -= (anchor && anchor[1].value || 0) * geometry_1.contentBounds.halfExtents[1] * 2;
|
|
893
903
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
894
904
|
object.emit(_dom.ElementEvent.GEOMETRY_BOUNDS_CHANGED, {});
|
|
895
|
-
(0,
|
|
905
|
+
(0, _SceneGraphService.dirtifyToRoot)(object);
|
|
896
906
|
}
|
|
897
907
|
};
|
|
898
908
|
|
|
899
|
-
|
|
909
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
900
910
|
var metadata = this.getMetadata(name);
|
|
901
911
|
|
|
902
912
|
if (!metadata) {
|
|
@@ -906,9 +916,11 @@ function () {
|
|
|
906
916
|
return metadata.inherited;
|
|
907
917
|
};
|
|
908
918
|
|
|
909
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)],
|
|
910
|
-
|
|
911
|
-
|
|
919
|
+
(0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
|
|
920
|
+
DefaultStyleValueRegistry = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
921
|
+
token: _interfaces2.StyleValueRegistry
|
|
922
|
+
})], DefaultStyleValueRegistry);
|
|
923
|
+
return DefaultStyleValueRegistry;
|
|
912
924
|
}();
|
|
913
925
|
|
|
914
|
-
exports.
|
|
926
|
+
exports.DefaultStyleValueRegistry = DefaultStyleValueRegistry;
|
|
@@ -10,7 +10,7 @@ exports.unitTypeToBaseType = unitTypeToBaseType;
|
|
|
10
10
|
|
|
11
11
|
var _tslib = require("tslib");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _assert = require("../../utils/assert");
|
|
14
14
|
|
|
15
15
|
var _CSSMathOperator = require("./CSSMathOperator");
|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ exports.BaseType = BaseType;
|
|
|
34
34
|
})(BaseType || (exports.BaseType = BaseType = {}));
|
|
35
35
|
|
|
36
36
|
function unitTypeToBaseType(unit) {
|
|
37
|
-
(0,
|
|
37
|
+
(0, _assert.DCHECK_NE)(unit, _types.UnitType.kNumber);
|
|
38
38
|
|
|
39
39
|
switch (unit) {
|
|
40
40
|
case _types.UnitType.kEms:
|
|
@@ -165,7 +165,7 @@ function () {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
CSSNumericValueType.prototype.applyPercentHint = function (hint) {
|
|
168
|
-
(0,
|
|
168
|
+
(0, _assert.DCHECK_NE)(hint, BaseType.kPercent);
|
|
169
169
|
this.setExponent(hint, this.exponent(hint) + this.exponent(BaseType.kPercent));
|
|
170
170
|
this.setExponent(BaseType.kPercent, 0);
|
|
171
171
|
this.percentHint = hint;
|
|
@@ -177,7 +177,7 @@ function () {
|
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
CSSNumericValueType.prototype.isOnlyNonZeroEntry = function (baseType, value) {
|
|
180
|
-
(0,
|
|
180
|
+
(0, _assert.DCHECK_NE)(value, 0);
|
|
181
181
|
return this.numNonZeroEntries === 1 && this.exponent(baseType) === value;
|
|
182
182
|
};
|
|
183
183
|
|
|
@@ -205,7 +205,7 @@ function () {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
CSSNumericValueType.prototype.matchesBaseType = function (baseType) {
|
|
208
|
-
(0,
|
|
208
|
+
(0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
209
209
|
return this.isOnlyNonZeroEntry(baseType, 1) && !this.hasPercentHint;
|
|
210
210
|
};
|
|
211
211
|
|
|
@@ -214,7 +214,7 @@ function () {
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
CSSNumericValueType.prototype.matchesBaseTypePercentage = function (baseType) {
|
|
217
|
-
(0,
|
|
217
|
+
(0, _assert.DCHECK_NE)(baseType, BaseType.kPercent);
|
|
218
218
|
return this.isOnlyNonZeroEntry(baseType, 1) || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
|
|
219
219
|
};
|
|
220
220
|
|
|
@@ -233,7 +233,7 @@ function () {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
|
|
236
|
-
(0,
|
|
236
|
+
(0, _assert.DCHECK_EQ)(type1.percentHint, type2.percentHint); // Match up base types. Try to use the percent hint to match up any
|
|
237
237
|
// differences.
|
|
238
238
|
|
|
239
239
|
for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
|
|
@@ -567,7 +567,7 @@ function (_super) {
|
|
|
567
567
|
}); // We got 'values' from a sum value, so it must be a valid CSSMathSum.
|
|
568
568
|
|
|
569
569
|
var result_1 = CSSMathSum.create(values);
|
|
570
|
-
(0,
|
|
570
|
+
(0, _assert.DCHECK)(!!result_1);
|
|
571
571
|
return result_1;
|
|
572
572
|
}
|
|
573
573
|
|
|
@@ -575,7 +575,7 @@ function (_super) {
|
|
|
575
575
|
|
|
576
576
|
var _loop_1 = function _loop_1(unit_string) {
|
|
577
577
|
var target_unit = CSSNumericValue.unitFromName(unit_string);
|
|
578
|
-
(0,
|
|
578
|
+
(0, _assert.DCHECK)(CSSNumericValue.isValidUnit(target_unit)); // Collect all the terms that are compatible with this unit.
|
|
579
579
|
// We mark used terms as null so we don't use them again.
|
|
580
580
|
|
|
581
581
|
var total_value = values.reduce(function (cur_sum, value, i) {
|
|
@@ -710,7 +710,7 @@ function cssNumberishesToNumericValues(values) {
|
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
function prependValueForArithmetic(type, values, value) {
|
|
713
|
-
(0,
|
|
713
|
+
(0, _assert.DCHECK)(!!value);
|
|
714
714
|
|
|
715
715
|
if (value.getType() === type) {
|
|
716
716
|
values.unshift.apply(values, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(value.numericValues()), false));
|
|
@@ -732,7 +732,7 @@ function cssNumericSumValueEntryToUnitValue(term) {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
function maybeSimplifyAsUnitValue(values, operator) {
|
|
735
|
-
(0,
|
|
735
|
+
(0, _assert.DCHECK)(!!values.length);
|
|
736
736
|
var first_unit_value = values[0] instanceof CSSUnitValue ? values[0] : null;
|
|
737
737
|
if (!first_unit_value) return null;
|
|
738
738
|
var final_value = first_unit_value.value;
|
|
@@ -754,7 +754,7 @@ function maybeSimplifyAsUnitValue(values, operator) {
|
|
|
754
754
|
}
|
|
755
755
|
|
|
756
756
|
function maybeMultiplyAsUnitValue(values) {
|
|
757
|
-
(0,
|
|
757
|
+
(0, _assert.DCHECK)(!!values.length); // We are allowed one unit value with type other than kNumber.
|
|
758
758
|
|
|
759
759
|
var unit_other_than_number = _types.UnitType.kNumber;
|
|
760
760
|
var final_value = 1.0;
|
|
@@ -800,7 +800,7 @@ function (_super) {
|
|
|
800
800
|
unit = unitOrName;
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
-
(0,
|
|
803
|
+
(0, _assert.DCHECK)(CSSUnitValue.isValidUnit(unit));
|
|
804
804
|
_this = _super.call(this, new CSSNumericValueType(unit)) || this;
|
|
805
805
|
_this.unit = unit;
|
|
806
806
|
_this.value = value;
|
|
@@ -833,7 +833,7 @@ function (_super) {
|
|
|
833
833
|
if (!Number.isFinite(number)) {
|
|
834
834
|
if (number > 0) result = 'infinity';else result = '-infinity';
|
|
835
835
|
} else {
|
|
836
|
-
(0,
|
|
836
|
+
(0, _assert.DCHECK)(Number.isNaN(number));
|
|
837
837
|
result = 'NaN';
|
|
838
838
|
}
|
|
839
839
|
|
|
@@ -1490,7 +1490,7 @@ function (_super) {
|
|
|
1490
1490
|
var exp = units[key];
|
|
1491
1491
|
var error = false;
|
|
1492
1492
|
type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
|
|
1493
|
-
(0,
|
|
1493
|
+
(0, _assert.DCHECK)(!error);
|
|
1494
1494
|
});
|
|
1495
1495
|
return type;
|
|
1496
1496
|
};
|
|
@@ -1498,7 +1498,7 @@ function (_super) {
|
|
|
1498
1498
|
CSSMathSum.canCreateNumericTypeFromSumValue = function (sum) {
|
|
1499
1499
|
var _this = this;
|
|
1500
1500
|
|
|
1501
|
-
(0,
|
|
1501
|
+
(0, _assert.DCHECK)(!!sum.length);
|
|
1502
1502
|
var first_type = this.numericTypeFromUnitMap(sum[0].units);
|
|
1503
1503
|
return sum.every(function (term) {
|
|
1504
1504
|
var error = false;
|
|
@@ -1599,7 +1599,7 @@ function (_super) {
|
|
|
1599
1599
|
|
|
1600
1600
|
CSSMathProduct.multiplyUnitMaps = function (a, b) {
|
|
1601
1601
|
Object.keys(b).forEach(function (key) {
|
|
1602
|
-
(0,
|
|
1602
|
+
(0, _assert.DCHECK_NE)(b[key].value, 0);
|
|
1603
1603
|
var old_value = key in a ? a[key].value : 0;
|
|
1604
1604
|
|
|
1605
1605
|
if (old_value + b[key].value === 0) {
|
package/lib/css/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model
|
|
3
3
|
*/
|
|
4
|
+
export * from './interfaces';
|
|
4
5
|
export * from './cssom';
|
|
5
6
|
export * from './parser';
|
|
6
7
|
export * from './properties';
|
|
8
|
+
export * from './layout';
|
|
7
9
|
export * from './CSS';
|
|
8
10
|
export * from './CSSProperty';
|
|
9
|
-
export * from './LayoutRegistry';
|
|
10
11
|
export * from './StyleValueRegistry';
|
package/lib/css/index.js
CHANGED
|
@@ -4,6 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _interfaces = require("./interfaces");
|
|
8
|
+
|
|
9
|
+
Object.keys(_interfaces).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _interfaces[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
7
20
|
var _cssom = require("./cssom");
|
|
8
21
|
|
|
9
22
|
Object.keys(_cssom).forEach(function (key) {
|
|
@@ -43,41 +56,41 @@ Object.keys(_properties).forEach(function (key) {
|
|
|
43
56
|
});
|
|
44
57
|
});
|
|
45
58
|
|
|
46
|
-
var
|
|
59
|
+
var _layout = require("./layout");
|
|
47
60
|
|
|
48
|
-
Object.keys(
|
|
61
|
+
Object.keys(_layout).forEach(function (key) {
|
|
49
62
|
if (key === "default" || key === "__esModule") return;
|
|
50
|
-
if (key in exports && exports[key] ===
|
|
63
|
+
if (key in exports && exports[key] === _layout[key]) return;
|
|
51
64
|
Object.defineProperty(exports, key, {
|
|
52
65
|
enumerable: true,
|
|
53
66
|
get: function get() {
|
|
54
|
-
return
|
|
67
|
+
return _layout[key];
|
|
55
68
|
}
|
|
56
69
|
});
|
|
57
70
|
});
|
|
58
71
|
|
|
59
|
-
var
|
|
72
|
+
var _CSS = require("./CSS");
|
|
60
73
|
|
|
61
|
-
Object.keys(
|
|
74
|
+
Object.keys(_CSS).forEach(function (key) {
|
|
62
75
|
if (key === "default" || key === "__esModule") return;
|
|
63
|
-
if (key in exports && exports[key] ===
|
|
76
|
+
if (key in exports && exports[key] === _CSS[key]) return;
|
|
64
77
|
Object.defineProperty(exports, key, {
|
|
65
78
|
enumerable: true,
|
|
66
79
|
get: function get() {
|
|
67
|
-
return
|
|
80
|
+
return _CSS[key];
|
|
68
81
|
}
|
|
69
82
|
});
|
|
70
83
|
});
|
|
71
84
|
|
|
72
|
-
var
|
|
85
|
+
var _CSSProperty = require("./CSSProperty");
|
|
73
86
|
|
|
74
|
-
Object.keys(
|
|
87
|
+
Object.keys(_CSSProperty).forEach(function (key) {
|
|
75
88
|
if (key === "default" || key === "__esModule") return;
|
|
76
|
-
if (key in exports && exports[key] ===
|
|
89
|
+
if (key in exports && exports[key] === _CSSProperty[key]) return;
|
|
77
90
|
Object.defineProperty(exports, key, {
|
|
78
91
|
enumerable: true,
|
|
79
92
|
get: function get() {
|
|
80
|
-
return
|
|
93
|
+
return _CSSProperty[key];
|
|
81
94
|
}
|
|
82
95
|
});
|
|
83
96
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyleValueRegistry = void 0;
|
|
7
|
+
|
|
8
|
+
var _manaSyringe = require("mana-syringe");
|
|
9
|
+
|
|
10
|
+
var StyleValueRegistry = _manaSyringe.Syringe.defineToken('StyleValueRegistry');
|
|
11
|
+
|
|
12
|
+
exports.StyleValueRegistry = StyleValueRegistry;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
import { LayoutObject } from './LayoutObject';
|
|
3
|
+
import { LayoutContext } from './LayoutContext';
|
|
4
|
+
import type { LayoutFragment } from './LayoutFragment';
|
|
5
|
+
export declare const FragmentResultFactory: Syringe.DefinedToken;
|
|
6
|
+
export interface FragmentResultFactory {
|
|
7
|
+
(options: FragmentResultOptions): FragmentResult;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The web developer defined layout method can return either a FragmentResultOptions or a FragmentResult.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FragmentResultOptions: Syringe.DefinedToken;
|
|
13
|
+
export interface FragmentResultOptions<T = void> {
|
|
14
|
+
inlineSize: number;
|
|
15
|
+
blockSize: number;
|
|
16
|
+
autoBlockSize: number;
|
|
17
|
+
childFragments: LayoutFragment[];
|
|
18
|
+
data: T;
|
|
19
|
+
}
|
|
20
|
+
export declare const ContextNode: Syringe.DefinedToken;
|
|
21
|
+
export declare class FragmentResult<T = void> {
|
|
22
|
+
protected readonly _layoutContext: LayoutContext;
|
|
23
|
+
protected readonly _node: LayoutObject;
|
|
24
|
+
protected readonly options: FragmentResultOptions<T>;
|
|
25
|
+
private layoutContext;
|
|
26
|
+
readonly inlineSize: number;
|
|
27
|
+
readonly blockSize: number;
|
|
28
|
+
private node;
|
|
29
|
+
childFragments: LayoutFragment[];
|
|
30
|
+
data: T;
|
|
31
|
+
constructor(_layoutContext: LayoutContext, _node: LayoutObject, options: FragmentResultOptions<T>);
|
|
32
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FragmentResultOptions = exports.FragmentResultFactory = exports.FragmentResult = exports.ContextNode = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var _LayoutObject = require("./LayoutObject");
|
|
13
|
+
|
|
14
|
+
var _LayoutContext = require("./LayoutContext");
|
|
15
|
+
|
|
16
|
+
var FragmentResultFactory = _manaSyringe.Syringe.defineToken('FragmentResultFactory');
|
|
17
|
+
/**
|
|
18
|
+
* The web developer defined layout method can return either a FragmentResultOptions or a FragmentResult.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.FragmentResultFactory = FragmentResultFactory;
|
|
23
|
+
|
|
24
|
+
var FragmentResultOptions = _manaSyringe.Syringe.defineToken('FragmentResultOptions');
|
|
25
|
+
|
|
26
|
+
exports.FragmentResultOptions = FragmentResultOptions;
|
|
27
|
+
|
|
28
|
+
var ContextNode = _manaSyringe.Syringe.defineToken('contextNode');
|
|
29
|
+
|
|
30
|
+
exports.ContextNode = ContextNode;
|
|
31
|
+
|
|
32
|
+
var FragmentResult =
|
|
33
|
+
/** @class */
|
|
34
|
+
function () {
|
|
35
|
+
function FragmentResult(_layoutContext, _node, options) {
|
|
36
|
+
this._layoutContext = _layoutContext;
|
|
37
|
+
this._node = _node;
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.layoutContext = _layoutContext;
|
|
40
|
+
this.inlineSize = options === null || options === void 0 ? void 0 : options.inlineSize;
|
|
41
|
+
this.blockSize = options === null || options === void 0 ? void 0 : options.blockSize;
|
|
42
|
+
this.childFragments = options === null || options === void 0 ? void 0 : options.childFragments;
|
|
43
|
+
this.data = options.data;
|
|
44
|
+
this.node = _node;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
FragmentResult = (0, _tslib.__decorate)([(0, _manaSyringe.injectable)(), (0, _tslib.__param)(0, (0, _manaSyringe.inject)(_LayoutContext.LayoutContext)), (0, _tslib.__param)(1, (0, _manaSyringe.inject)(ContextNode)), (0, _tslib.__param)(2, (0, _manaSyringe.inject)(FragmentResultOptions)), (0, _tslib.__metadata)("design:paramtypes", [_LayoutContext.LayoutContext, _LayoutObject.LayoutObject, Object])], FragmentResult);
|
|
48
|
+
return FragmentResult;
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
exports.FragmentResult = FragmentResult;
|