@antv/g 5.0.23-alpha.11 → 5.0.23-alpha.14
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 +2 -2
- package/es/css/StyleValueRegistry.d.ts +5 -2
- package/es/css/StyleValueRegistry.js +22 -22
- package/es/css/cssom/CSSNumericValue.js +1 -1
- package/es/display-objects/DisplayObject.d.ts +1 -2
- package/es/global-module.js +4 -7
- package/es/plugins/PrepareRendererPlugin.js +2 -2
- package/es/services/RenderingService.js +2 -2
- package/es/services/SceneGraphService.js +3 -1
- package/lib/css/StyleValueRegistry.d.ts +5 -2
- package/lib/css/StyleValueRegistry.js +24 -24
- package/lib/css/cssom/CSSNumericValue.js +17 -17
- package/lib/display-objects/DisplayObject.d.ts +1 -2
- package/lib/global-module.js +2 -5
- package/lib/plugins/PrepareRendererPlugin.js +1 -1
- package/lib/services/RenderingService.js +1 -1
- package/lib/services/SceneGraphService.js +3 -1
- package/package.json +2 -2
|
@@ -66,8 +66,11 @@ export interface PropertyMetadata {
|
|
|
66
66
|
* Blink used them in code generation(css_properties.json5)
|
|
67
67
|
*/
|
|
68
68
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
69
|
-
export declare const
|
|
70
|
-
export
|
|
69
|
+
export declare const StyleValueRegistry: Syringe.DefinedToken;
|
|
70
|
+
export interface StyleValueRegistry {
|
|
71
|
+
recalc(displayObject: DisplayObject): void;
|
|
72
|
+
}
|
|
73
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
71
74
|
/**
|
|
72
75
|
* need recalc later
|
|
73
76
|
*/
|
|
@@ -411,12 +411,12 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
411
411
|
name: 'whiteSpace',
|
|
412
412
|
layoutDependent: true
|
|
413
413
|
}];
|
|
414
|
-
export var
|
|
414
|
+
export var StyleValueRegistry = Syringe.defineToken('StyleValueRegistry');
|
|
415
415
|
|
|
416
|
-
var
|
|
416
|
+
var DefaultStyleValueRegistry =
|
|
417
417
|
/** @class */
|
|
418
418
|
function () {
|
|
419
|
-
function
|
|
419
|
+
function DefaultStyleValueRegistry() {
|
|
420
420
|
/**
|
|
421
421
|
* need recalc later
|
|
422
422
|
*/
|
|
@@ -452,7 +452,7 @@ function () {
|
|
|
452
452
|
// > = {};
|
|
453
453
|
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
456
456
|
var _this = this;
|
|
457
457
|
|
|
458
458
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -460,7 +460,7 @@ function () {
|
|
|
460
460
|
});
|
|
461
461
|
};
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
464
464
|
var _this = this;
|
|
465
465
|
|
|
466
466
|
__spreadArray([metadata.name], __read(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -468,7 +468,7 @@ function () {
|
|
|
468
468
|
});
|
|
469
469
|
};
|
|
470
470
|
|
|
471
|
-
|
|
471
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
472
472
|
return this.cache[name];
|
|
473
473
|
};
|
|
474
474
|
/**
|
|
@@ -482,7 +482,7 @@ function () {
|
|
|
482
482
|
*/
|
|
483
483
|
|
|
484
484
|
|
|
485
|
-
|
|
485
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
486
486
|
var _this = this;
|
|
487
487
|
|
|
488
488
|
if (options === void 0) {
|
|
@@ -563,7 +563,7 @@ function () {
|
|
|
563
563
|
*/
|
|
564
564
|
|
|
565
565
|
|
|
566
|
-
|
|
566
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
567
567
|
var metadata = this.getMetadata(name);
|
|
568
568
|
var computed = value;
|
|
569
569
|
|
|
@@ -599,7 +599,7 @@ function () {
|
|
|
599
599
|
*/
|
|
600
600
|
|
|
601
601
|
|
|
602
|
-
|
|
602
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
603
603
|
var metadata = this.getMetadata(name);
|
|
604
604
|
var isDocumentElement = object.id === 'g-root';
|
|
605
605
|
var used = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -663,7 +663,7 @@ function () {
|
|
|
663
663
|
return false;
|
|
664
664
|
};
|
|
665
665
|
|
|
666
|
-
|
|
666
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
667
667
|
var metadata = this.getMetadata(name);
|
|
668
668
|
|
|
669
669
|
if (metadata && metadata.handler) {
|
|
@@ -675,7 +675,7 @@ function () {
|
|
|
675
675
|
}
|
|
676
676
|
};
|
|
677
677
|
|
|
678
|
-
|
|
678
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
679
679
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
680
680
|
return true;
|
|
681
681
|
}
|
|
@@ -687,7 +687,7 @@ function () {
|
|
|
687
687
|
*/
|
|
688
688
|
|
|
689
689
|
|
|
690
|
-
|
|
690
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
691
691
|
if (!this.unresolvedProperties[object.entity]) {
|
|
692
692
|
this.unresolvedProperties[object.entity] = [];
|
|
693
693
|
}
|
|
@@ -697,7 +697,7 @@ function () {
|
|
|
697
697
|
}
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
-
|
|
700
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
701
701
|
if (options === void 0) {
|
|
702
702
|
options = {};
|
|
703
703
|
}
|
|
@@ -721,7 +721,7 @@ function () {
|
|
|
721
721
|
return false;
|
|
722
722
|
};
|
|
723
723
|
|
|
724
|
-
|
|
724
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
725
725
|
var properties = this.unresolvedProperties[object.entity];
|
|
726
726
|
|
|
727
727
|
if (properties && properties.length) {
|
|
@@ -739,7 +739,7 @@ function () {
|
|
|
739
739
|
*/
|
|
740
740
|
|
|
741
741
|
|
|
742
|
-
|
|
742
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
743
743
|
var _a;
|
|
744
744
|
|
|
745
745
|
var geometryUpdaterFactory = GlobalContainer.get(GeometryUpdaterFactory);
|
|
@@ -874,7 +874,7 @@ function () {
|
|
|
874
874
|
}
|
|
875
875
|
};
|
|
876
876
|
|
|
877
|
-
|
|
877
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
878
878
|
var metadata = this.getMetadata(name);
|
|
879
879
|
|
|
880
880
|
if (!metadata) {
|
|
@@ -884,12 +884,12 @@ function () {
|
|
|
884
884
|
return metadata.inherited;
|
|
885
885
|
};
|
|
886
886
|
|
|
887
|
-
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)],
|
|
887
|
+
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
|
|
888
888
|
|
|
889
|
-
|
|
890
|
-
token:
|
|
891
|
-
})],
|
|
892
|
-
return
|
|
889
|
+
DefaultStyleValueRegistry = __decorate([singleton({
|
|
890
|
+
token: StyleValueRegistry
|
|
891
|
+
})], DefaultStyleValueRegistry);
|
|
892
|
+
return DefaultStyleValueRegistry;
|
|
893
893
|
}();
|
|
894
894
|
|
|
895
|
-
export {
|
|
895
|
+
export { DefaultStyleValueRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __read, __spreadArray, __values } from "tslib";
|
|
2
|
-
import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils';
|
|
2
|
+
import { DCHECK, DCHECK_EQ, DCHECK_NE } from '../../utils/assert';
|
|
3
3
|
import { CSSMathOperator } from './CSSMathOperator';
|
|
4
4
|
import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
|
|
5
5
|
import { Nested, ParenLess, UnitType } from './types'; // https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
|
|
@@ -5,7 +5,6 @@ import { Element } from '../dom/Element';
|
|
|
5
5
|
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { PropertyParseOptions } from '../css/StyleValueRegistry';
|
|
8
|
-
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
9
8
|
/**
|
|
10
9
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11
10
|
*
|
|
@@ -29,7 +28,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
29
28
|
* contains style props in constructor's params, eg. fill, stroke...
|
|
30
29
|
*/
|
|
31
30
|
config: DisplayObjectConfig<StyleProps>;
|
|
32
|
-
styleValueRegistry:
|
|
31
|
+
styleValueRegistry: any;
|
|
33
32
|
/**
|
|
34
33
|
* push to active animations after calling `animate()`
|
|
35
34
|
*/
|
package/es/global-module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, injectable, decorate } from 'mana-syringe';
|
|
2
2
|
import { EventEmitter } from 'eventemitter3';
|
|
3
3
|
import { DisplayObjectPool } from './DisplayObjectPool';
|
|
4
|
-
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService,
|
|
5
|
-
import { LayoutRegistry,
|
|
4
|
+
import { CircleUpdater, EllipseUpdater, GeometryAABBUpdater, GeometryUpdaterFactory, LineUpdater, PathUpdater, PolylineUpdater, RectUpdater, TextUpdater, TextService, OffscreenCanvasCreator, DefaultSceneGraphService, DefaultSceneGraphSelector, SceneGraphSelector, SceneGraphSelectorFactory } from './services';
|
|
5
|
+
import { LayoutRegistry, CSSPropertyLocalPosition, CSSPropertyLengthOrPercentage, CSSPropertyAnchor, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLineDash, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSPropertyShadowBlur, DefaultStyleValueRegistry } from './css';
|
|
6
6
|
export var containerModule = Module(function (register) {
|
|
7
7
|
decorate(injectable(), EventEmitter); // bind DisplayObject pool
|
|
8
8
|
|
|
@@ -18,10 +18,7 @@ export var containerModule = Module(function (register) {
|
|
|
18
18
|
}
|
|
19
19
|
}); // bind scenegraph service
|
|
20
20
|
|
|
21
|
-
register(
|
|
22
|
-
token: SceneGraphService,
|
|
23
|
-
useClass: DefaultSceneGraphService
|
|
24
|
-
}); // bind text service
|
|
21
|
+
register(DefaultSceneGraphService); // bind text service
|
|
25
22
|
|
|
26
23
|
register(OffscreenCanvasCreator);
|
|
27
24
|
register(TextService); // bind aabb updater
|
|
@@ -50,7 +47,7 @@ export var containerModule = Module(function (register) {
|
|
|
50
47
|
}); // bind CSS property handlers
|
|
51
48
|
|
|
52
49
|
register(LayoutRegistry);
|
|
53
|
-
register(
|
|
50
|
+
register(DefaultStyleValueRegistry);
|
|
54
51
|
register(CSSPropertyLengthOrPercentage);
|
|
55
52
|
register(CSSPropertyLocalPosition);
|
|
56
53
|
register(CSSPropertyOpacity);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
2
|
import { inject, singleton } from 'mana-syringe';
|
|
3
|
-
import {
|
|
3
|
+
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
4
4
|
import { ElementEvent } from '../dom';
|
|
5
5
|
import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
|
|
6
6
|
|
|
@@ -63,7 +63,7 @@ function () {
|
|
|
63
63
|
|
|
64
64
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
65
65
|
|
|
66
|
-
__decorate([inject(
|
|
66
|
+
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
67
67
|
|
|
68
68
|
PrepareRendererPlugin = __decorate([singleton({
|
|
69
69
|
contrib: RenderingPluginContribution
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
2
|
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe';
|
|
3
3
|
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
4
|
-
import {
|
|
4
|
+
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
5
5
|
import { ElementEvent } from '../dom';
|
|
6
6
|
import { RenderingContext, RenderReason } from './RenderingContext';
|
|
7
7
|
import { SceneGraphService, sortByZIndex } from './SceneGraphService';
|
|
@@ -219,7 +219,7 @@ function () {
|
|
|
219
219
|
|
|
220
220
|
__decorate([inject(SceneGraphService), __metadata("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
|
|
221
221
|
|
|
222
|
-
__decorate([inject(
|
|
222
|
+
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], RenderingService.prototype, "styleValueRegistry", void 0);
|
|
223
223
|
|
|
224
224
|
RenderingService = __decorate([singleton()], RenderingService);
|
|
225
225
|
return RenderingService;
|
|
@@ -801,7 +801,9 @@ function () {
|
|
|
801
801
|
|
|
802
802
|
__decorate([inject(SceneGraphSelectorFactory), __metadata("design:type", Function)], DefaultSceneGraphService.prototype, "sceneGraphSelectorFactory", void 0);
|
|
803
803
|
|
|
804
|
-
DefaultSceneGraphService = __decorate([singleton(
|
|
804
|
+
DefaultSceneGraphService = __decorate([singleton({
|
|
805
|
+
token: SceneGraphService
|
|
806
|
+
})], DefaultSceneGraphService);
|
|
805
807
|
return DefaultSceneGraphService;
|
|
806
808
|
}();
|
|
807
809
|
|
|
@@ -66,8 +66,11 @@ export interface PropertyMetadata {
|
|
|
66
66
|
* Blink used them in code generation(css_properties.json5)
|
|
67
67
|
*/
|
|
68
68
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
69
|
-
export declare const
|
|
70
|
-
export
|
|
69
|
+
export declare const StyleValueRegistry: Syringe.DefinedToken;
|
|
70
|
+
export interface StyleValueRegistry {
|
|
71
|
+
recalc(displayObject: DisplayObject): void;
|
|
72
|
+
}
|
|
73
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
71
74
|
/**
|
|
72
75
|
* need recalc later
|
|
73
76
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.StyleValueRegistry = exports.PropertySyntax = exports.DefaultStyleValueRegistry = exports.BUILT_IN_PROPERTIES = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
@@ -433,14 +433,14 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
433
433
|
}];
|
|
434
434
|
exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
|
|
435
435
|
|
|
436
|
-
var
|
|
436
|
+
var StyleValueRegistry = _manaSyringe.Syringe.defineToken('StyleValueRegistry');
|
|
437
437
|
|
|
438
|
-
exports.
|
|
438
|
+
exports.StyleValueRegistry = StyleValueRegistry;
|
|
439
439
|
|
|
440
|
-
var
|
|
440
|
+
var DefaultStyleValueRegistry =
|
|
441
441
|
/** @class */
|
|
442
442
|
function () {
|
|
443
|
-
function
|
|
443
|
+
function DefaultStyleValueRegistry() {
|
|
444
444
|
/**
|
|
445
445
|
* need recalc later
|
|
446
446
|
*/
|
|
@@ -476,7 +476,7 @@ function () {
|
|
|
476
476
|
// > = {};
|
|
477
477
|
|
|
478
478
|
|
|
479
|
-
|
|
479
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
480
480
|
var _this = this;
|
|
481
481
|
|
|
482
482
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -484,7 +484,7 @@ function () {
|
|
|
484
484
|
});
|
|
485
485
|
};
|
|
486
486
|
|
|
487
|
-
|
|
487
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
488
488
|
var _this = this;
|
|
489
489
|
|
|
490
490
|
(0, _tslib.__spreadArray)([metadata.name], (0, _tslib.__read)(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -492,7 +492,7 @@ function () {
|
|
|
492
492
|
});
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
|
|
495
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
496
496
|
return this.cache[name];
|
|
497
497
|
};
|
|
498
498
|
/**
|
|
@@ -506,7 +506,7 @@ function () {
|
|
|
506
506
|
*/
|
|
507
507
|
|
|
508
508
|
|
|
509
|
-
|
|
509
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
510
510
|
var _this = this;
|
|
511
511
|
|
|
512
512
|
if (options === void 0) {
|
|
@@ -587,7 +587,7 @@ function () {
|
|
|
587
587
|
*/
|
|
588
588
|
|
|
589
589
|
|
|
590
|
-
|
|
590
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
591
591
|
var metadata = this.getMetadata(name);
|
|
592
592
|
var computed = value;
|
|
593
593
|
|
|
@@ -623,7 +623,7 @@ function () {
|
|
|
623
623
|
*/
|
|
624
624
|
|
|
625
625
|
|
|
626
|
-
|
|
626
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
627
627
|
var metadata = this.getMetadata(name);
|
|
628
628
|
var isDocumentElement = object.id === 'g-root';
|
|
629
629
|
var used = computed instanceof _cssom.CSSStyleValue ? computed.clone() : computed;
|
|
@@ -688,7 +688,7 @@ function () {
|
|
|
688
688
|
return false;
|
|
689
689
|
};
|
|
690
690
|
|
|
691
|
-
|
|
691
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
692
692
|
var metadata = this.getMetadata(name);
|
|
693
693
|
|
|
694
694
|
if (metadata && metadata.handler) {
|
|
@@ -700,7 +700,7 @@ function () {
|
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
702
|
|
|
703
|
-
|
|
703
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
704
704
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
705
705
|
return true;
|
|
706
706
|
}
|
|
@@ -712,7 +712,7 @@ function () {
|
|
|
712
712
|
*/
|
|
713
713
|
|
|
714
714
|
|
|
715
|
-
|
|
715
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
716
716
|
if (!this.unresolvedProperties[object.entity]) {
|
|
717
717
|
this.unresolvedProperties[object.entity] = [];
|
|
718
718
|
}
|
|
@@ -722,7 +722,7 @@ function () {
|
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
724
|
|
|
725
|
-
|
|
725
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
726
726
|
if (options === void 0) {
|
|
727
727
|
options = {};
|
|
728
728
|
}
|
|
@@ -746,7 +746,7 @@ function () {
|
|
|
746
746
|
return false;
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
-
|
|
749
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
750
750
|
var properties = this.unresolvedProperties[object.entity];
|
|
751
751
|
|
|
752
752
|
if (properties && properties.length) {
|
|
@@ -764,7 +764,7 @@ function () {
|
|
|
764
764
|
*/
|
|
765
765
|
|
|
766
766
|
|
|
767
|
-
|
|
767
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
768
768
|
var _a;
|
|
769
769
|
|
|
770
770
|
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
|
|
@@ -902,7 +902,7 @@ function () {
|
|
|
902
902
|
}
|
|
903
903
|
};
|
|
904
904
|
|
|
905
|
-
|
|
905
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
906
906
|
var metadata = this.getMetadata(name);
|
|
907
907
|
|
|
908
908
|
if (!metadata) {
|
|
@@ -912,11 +912,11 @@ function () {
|
|
|
912
912
|
return metadata.inherited;
|
|
913
913
|
};
|
|
914
914
|
|
|
915
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)],
|
|
916
|
-
|
|
917
|
-
token:
|
|
918
|
-
})],
|
|
919
|
-
return
|
|
915
|
+
(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);
|
|
916
|
+
DefaultStyleValueRegistry = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
917
|
+
token: StyleValueRegistry
|
|
918
|
+
})], DefaultStyleValueRegistry);
|
|
919
|
+
return DefaultStyleValueRegistry;
|
|
920
920
|
}();
|
|
921
921
|
|
|
922
|
-
exports.
|
|
922
|
+
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) {
|
|
@@ -5,7 +5,6 @@ import { Element } from '../dom/Element';
|
|
|
5
5
|
import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
|
|
6
6
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
7
7
|
import type { PropertyParseOptions } from '../css/StyleValueRegistry';
|
|
8
|
-
import { StyleValueRegistry } from '../css/StyleValueRegistry';
|
|
9
8
|
/**
|
|
10
9
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
11
10
|
*
|
|
@@ -29,7 +28,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
29
28
|
* contains style props in constructor's params, eg. fill, stroke...
|
|
30
29
|
*/
|
|
31
30
|
config: DisplayObjectConfig<StyleProps>;
|
|
32
|
-
styleValueRegistry:
|
|
31
|
+
styleValueRegistry: any;
|
|
33
32
|
/**
|
|
34
33
|
* push to active animations after calling `animate()`
|
|
35
34
|
*/
|
package/lib/global-module.js
CHANGED
|
@@ -30,10 +30,7 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
30
30
|
}
|
|
31
31
|
}); // bind scenegraph service
|
|
32
32
|
|
|
33
|
-
register(
|
|
34
|
-
token: _services.SceneGraphService,
|
|
35
|
-
useClass: _services.DefaultSceneGraphService
|
|
36
|
-
}); // bind text service
|
|
33
|
+
register(_services.DefaultSceneGraphService); // bind text service
|
|
37
34
|
|
|
38
35
|
register(_services.OffscreenCanvasCreator);
|
|
39
36
|
register(_services.TextService); // bind aabb updater
|
|
@@ -62,7 +59,7 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
|
|
|
62
59
|
}); // bind CSS property handlers
|
|
63
60
|
|
|
64
61
|
register(_css.LayoutRegistry);
|
|
65
|
-
register(_css.
|
|
62
|
+
register(_css.DefaultStyleValueRegistry);
|
|
66
63
|
register(_css.CSSPropertyLengthOrPercentage);
|
|
67
64
|
register(_css.CSSPropertyLocalPosition);
|
|
68
65
|
register(_css.CSSPropertyOpacity);
|
|
@@ -73,7 +73,7 @@ function () {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
76
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_StyleValueRegistry.
|
|
76
|
+
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_StyleValueRegistry.StyleValueRegistry), (0, _tslib.__metadata)("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
|
|
77
77
|
PrepareRendererPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
78
78
|
contrib: _services.RenderingPluginContribution
|
|
79
79
|
})], PrepareRendererPlugin);
|
|
@@ -233,7 +233,7 @@ function () {
|
|
|
233
233
|
(0, _tslib.__decorate)([(0, _manaSyringe.contrib)(RenderingPluginContribution), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingPluginProvider", void 0);
|
|
234
234
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_RenderingContext.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingContext", void 0);
|
|
235
235
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_SceneGraphService.SceneGraphService), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
|
|
236
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_StyleValueRegistry.
|
|
236
|
+
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_StyleValueRegistry.StyleValueRegistry), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "styleValueRegistry", void 0);
|
|
237
237
|
RenderingService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], RenderingService);
|
|
238
238
|
return RenderingService;
|
|
239
239
|
}();
|
|
@@ -854,7 +854,9 @@ function () {
|
|
|
854
854
|
};
|
|
855
855
|
|
|
856
856
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_SceneGraphSelector.SceneGraphSelectorFactory), (0, _tslib.__metadata)("design:type", Function)], DefaultSceneGraphService.prototype, "sceneGraphSelectorFactory", void 0);
|
|
857
|
-
DefaultSceneGraphService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)(
|
|
857
|
+
DefaultSceneGraphService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
858
|
+
token: SceneGraphService
|
|
859
|
+
})], DefaultSceneGraphService);
|
|
858
860
|
return DefaultSceneGraphService;
|
|
859
861
|
}();
|
|
860
862
|
|