@antv/g 5.0.23-alpha.13 → 5.0.23-alpha.16
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 -3
- package/es/css/CSS.js +1 -1
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +23 -22
- package/es/css/index.d.ts +1 -0
- package/es/css/index.js +1 -0
- package/es/css/interfaces.d.ts +6 -0
- package/es/css/interfaces.js +2 -0
- 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 +1 -1
- package/es/dom/Document.js +2 -2
- package/es/global-module.js +4 -8
- 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 -6
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +25 -22
- package/es/services/SceneGraphService.js +3 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +1 -2
- package/es/utils/interpolation.js +1 -1
- package/lib/css/CSS.js +2 -2
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +25 -24
- package/lib/css/index.d.ts +1 -0
- package/lib/css/index.js +13 -0
- package/lib/css/interfaces.d.ts +6 -0
- package/lib/css/interfaces.js +12 -0
- 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 +2 -2
- package/lib/dom/Document.js +2 -2
- package/lib/global-module.js +2 -6
- 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 -6
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +25 -22
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/interpolation.js +2 -2
- package/package.json +4 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
|
-
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe';
|
|
3
|
-
|
|
4
|
-
import {
|
|
2
|
+
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe'; // import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
3
|
+
|
|
4
|
+
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
5
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
5
6
|
import { ElementEvent } from '../dom';
|
|
6
7
|
import { RenderingContext, RenderReason } from './RenderingContext';
|
|
7
8
|
import { SceneGraphService, sortByZIndex } from './SceneGraphService';
|
|
@@ -47,50 +48,50 @@ function () {
|
|
|
47
48
|
/**
|
|
48
49
|
* only dirty object which has sth changed will be rendered
|
|
49
50
|
*/
|
|
50
|
-
dirtycheck: new SyncWaterfallHook(),
|
|
51
|
+
dirtycheck: new SyncWaterfallHook(['object']),
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* do culling
|
|
54
55
|
*/
|
|
55
|
-
cull: new SyncWaterfallHook(),
|
|
56
|
+
cull: new SyncWaterfallHook(['object']),
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
59
60
|
*/
|
|
60
|
-
beginFrame: new SyncHook(),
|
|
61
|
+
beginFrame: new SyncHook([]),
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* called before every dirty object get rendered
|
|
64
65
|
*/
|
|
65
|
-
beforeRender: new SyncHook(),
|
|
66
|
+
beforeRender: new SyncHook(['objectToRender']),
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* called when every dirty object rendering even it's culled
|
|
69
70
|
*/
|
|
70
|
-
render: new SyncHook(),
|
|
71
|
+
render: new SyncHook(['objectToRender']),
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
74
|
* called after every dirty object get rendered
|
|
74
75
|
*/
|
|
75
|
-
afterRender: new SyncHook(),
|
|
76
|
-
endFrame: new SyncHook(),
|
|
77
|
-
destroy: new SyncHook(),
|
|
76
|
+
afterRender: new SyncHook(['objectToRender']),
|
|
77
|
+
endFrame: new SyncHook([]),
|
|
78
|
+
destroy: new SyncHook([]),
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
81
82
|
*/
|
|
82
|
-
pick: new AsyncSeriesWaterfallHook(),
|
|
83
|
+
pick: new AsyncSeriesWaterfallHook(['result']),
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* used in event system
|
|
86
87
|
*/
|
|
87
|
-
pointerDown: new SyncHook(),
|
|
88
|
-
pointerUp: new SyncHook(),
|
|
89
|
-
pointerMove: new SyncHook(),
|
|
90
|
-
pointerOut: new SyncHook(),
|
|
91
|
-
pointerOver: new SyncHook(),
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
pointerDown: new SyncHook(['event']),
|
|
89
|
+
pointerUp: new SyncHook(['event']),
|
|
90
|
+
pointerMove: new SyncHook(['event']),
|
|
91
|
+
pointerOut: new SyncHook(['event']),
|
|
92
|
+
pointerOver: new SyncHook(['event']),
|
|
93
|
+
pointerWheel: new SyncHook(['event']),
|
|
94
|
+
pointerCancel: new SyncHook(['event'])
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -106,12 +107,14 @@ function () {
|
|
|
106
107
|
cache: false
|
|
107
108
|
}).forEach(function (plugin) {
|
|
108
109
|
plugin.apply(_this);
|
|
109
|
-
});
|
|
110
|
+
}); // await this.hooks.init.callPromise();
|
|
111
|
+
|
|
110
112
|
return [4
|
|
111
113
|
/*yield*/
|
|
112
|
-
, this.hooks.init.
|
|
114
|
+
, this.hooks.init.promise()];
|
|
113
115
|
|
|
114
116
|
case 1:
|
|
117
|
+
// await this.hooks.init.callPromise();
|
|
115
118
|
_a.sent();
|
|
116
119
|
|
|
117
120
|
this.inited = true;
|
|
@@ -219,7 +222,7 @@ function () {
|
|
|
219
222
|
|
|
220
223
|
__decorate([inject(SceneGraphService), __metadata("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
|
|
221
224
|
|
|
222
|
-
__decorate([inject(StyleValueRegistry), __metadata("design:type",
|
|
225
|
+
__decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], RenderingService.prototype, "styleValueRegistry", void 0);
|
|
223
226
|
|
|
224
227
|
RenderingService = __decorate([singleton()], RenderingService);
|
|
225
228
|
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
|
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { GlobalContainer } from 'mana-syringe';
|
|
3
|
-
import { StyleValueRegistry } from '../css';
|
|
3
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
4
4
|
import { parseEasingFunction } from './animation';
|
|
5
5
|
import { camelCase } from './string';
|
|
6
6
|
export function convertEffectInput(keyframes, timing, target) {
|
package/lib/css/CSS.js
CHANGED
|
@@ -9,7 +9,7 @@ var _manaSyringe = require("mana-syringe");
|
|
|
9
9
|
|
|
10
10
|
var _cssom = require("./cssom");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _interfaces = require("./interfaces");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* holds useful CSS-related methods.
|
|
@@ -104,7 +104,7 @@ var CSS = {
|
|
|
104
104
|
inherits = definition.inherits,
|
|
105
105
|
initialValue = definition.initialValue;
|
|
106
106
|
|
|
107
|
-
var registry = _manaSyringe.GlobalContainer.get(
|
|
107
|
+
var registry = _manaSyringe.GlobalContainer.get(_interfaces.StyleValueRegistry);
|
|
108
108
|
|
|
109
109
|
registry.registerMetadata({
|
|
110
110
|
name: name,
|
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
|
|
|
@@ -29,6 +29,8 @@ var _utils = require("../utils");
|
|
|
29
29
|
|
|
30
30
|
var _shapes = require("../shapes");
|
|
31
31
|
|
|
32
|
+
var _interfaces2 = require("./interfaces");
|
|
33
|
+
|
|
32
34
|
var PropertySyntax = {
|
|
33
35
|
COLOR: '<color>',
|
|
34
36
|
PAINT: '<paint>',
|
|
@@ -430,16 +432,13 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
430
432
|
}, {
|
|
431
433
|
name: 'whiteSpace',
|
|
432
434
|
layoutDependent: true
|
|
433
|
-
}];
|
|
434
|
-
// multiple: false,
|
|
435
|
-
// });
|
|
436
|
-
|
|
435
|
+
}];
|
|
437
436
|
exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
|
|
438
437
|
|
|
439
|
-
var
|
|
438
|
+
var DefaultStyleValueRegistry =
|
|
440
439
|
/** @class */
|
|
441
440
|
function () {
|
|
442
|
-
function
|
|
441
|
+
function DefaultStyleValueRegistry() {
|
|
443
442
|
/**
|
|
444
443
|
* need recalc later
|
|
445
444
|
*/
|
|
@@ -475,7 +474,7 @@ function () {
|
|
|
475
474
|
// > = {};
|
|
476
475
|
|
|
477
476
|
|
|
478
|
-
|
|
477
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
479
478
|
var _this = this;
|
|
480
479
|
|
|
481
480
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -483,7 +482,7 @@ function () {
|
|
|
483
482
|
});
|
|
484
483
|
};
|
|
485
484
|
|
|
486
|
-
|
|
485
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
487
486
|
var _this = this;
|
|
488
487
|
|
|
489
488
|
(0, _tslib.__spreadArray)([metadata.name], (0, _tslib.__read)(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -491,7 +490,7 @@ function () {
|
|
|
491
490
|
});
|
|
492
491
|
};
|
|
493
492
|
|
|
494
|
-
|
|
493
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
495
494
|
return this.cache[name];
|
|
496
495
|
};
|
|
497
496
|
/**
|
|
@@ -505,7 +504,7 @@ function () {
|
|
|
505
504
|
*/
|
|
506
505
|
|
|
507
506
|
|
|
508
|
-
|
|
507
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
509
508
|
var _this = this;
|
|
510
509
|
|
|
511
510
|
if (options === void 0) {
|
|
@@ -586,7 +585,7 @@ function () {
|
|
|
586
585
|
*/
|
|
587
586
|
|
|
588
587
|
|
|
589
|
-
|
|
588
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
590
589
|
var metadata = this.getMetadata(name);
|
|
591
590
|
var computed = value;
|
|
592
591
|
|
|
@@ -622,7 +621,7 @@ function () {
|
|
|
622
621
|
*/
|
|
623
622
|
|
|
624
623
|
|
|
625
|
-
|
|
624
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
626
625
|
var metadata = this.getMetadata(name);
|
|
627
626
|
var isDocumentElement = object.id === 'g-root';
|
|
628
627
|
var used = computed instanceof _cssom.CSSStyleValue ? computed.clone() : computed;
|
|
@@ -687,7 +686,7 @@ function () {
|
|
|
687
686
|
return false;
|
|
688
687
|
};
|
|
689
688
|
|
|
690
|
-
|
|
689
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
691
690
|
var metadata = this.getMetadata(name);
|
|
692
691
|
|
|
693
692
|
if (metadata && metadata.handler) {
|
|
@@ -699,7 +698,7 @@ function () {
|
|
|
699
698
|
}
|
|
700
699
|
};
|
|
701
700
|
|
|
702
|
-
|
|
701
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
703
702
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
704
703
|
return true;
|
|
705
704
|
}
|
|
@@ -711,7 +710,7 @@ function () {
|
|
|
711
710
|
*/
|
|
712
711
|
|
|
713
712
|
|
|
714
|
-
|
|
713
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
715
714
|
if (!this.unresolvedProperties[object.entity]) {
|
|
716
715
|
this.unresolvedProperties[object.entity] = [];
|
|
717
716
|
}
|
|
@@ -721,7 +720,7 @@ function () {
|
|
|
721
720
|
}
|
|
722
721
|
};
|
|
723
722
|
|
|
724
|
-
|
|
723
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
725
724
|
if (options === void 0) {
|
|
726
725
|
options = {};
|
|
727
726
|
}
|
|
@@ -745,7 +744,7 @@ function () {
|
|
|
745
744
|
return false;
|
|
746
745
|
};
|
|
747
746
|
|
|
748
|
-
|
|
747
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
749
748
|
var properties = this.unresolvedProperties[object.entity];
|
|
750
749
|
|
|
751
750
|
if (properties && properties.length) {
|
|
@@ -763,7 +762,7 @@ function () {
|
|
|
763
762
|
*/
|
|
764
763
|
|
|
765
764
|
|
|
766
|
-
|
|
765
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
767
766
|
var _a;
|
|
768
767
|
|
|
769
768
|
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
|
|
@@ -901,7 +900,7 @@ function () {
|
|
|
901
900
|
}
|
|
902
901
|
};
|
|
903
902
|
|
|
904
|
-
|
|
903
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
905
904
|
var metadata = this.getMetadata(name);
|
|
906
905
|
|
|
907
906
|
if (!metadata) {
|
|
@@ -911,9 +910,11 @@ function () {
|
|
|
911
910
|
return metadata.inherited;
|
|
912
911
|
};
|
|
913
912
|
|
|
914
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)],
|
|
915
|
-
|
|
916
|
-
|
|
913
|
+
(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);
|
|
914
|
+
DefaultStyleValueRegistry = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
915
|
+
token: _interfaces2.StyleValueRegistry
|
|
916
|
+
})], DefaultStyleValueRegistry);
|
|
917
|
+
return DefaultStyleValueRegistry;
|
|
917
918
|
}();
|
|
918
919
|
|
|
919
|
-
exports.
|
|
920
|
+
exports.DefaultStyleValueRegistry = DefaultStyleValueRegistry;
|
package/lib/css/index.d.ts
CHANGED
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) {
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@ import type { DisplayObject } from '../../display-objects';
|
|
|
3
3
|
import { parseColor, mergeColors } from '../parser';
|
|
4
4
|
import type { CSSGradientValue } from '../cssom';
|
|
5
5
|
import { CSSKeywordValue, CSSRGB } from '../cssom';
|
|
6
|
-
import type { StyleValueRegistry } from '../
|
|
6
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
7
7
|
/**
|
|
8
8
|
* opacity
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSUnitValue } from '../cssom';
|
|
2
2
|
import { mergeDimensions } from '../parser';
|
|
3
|
-
import type { StyleValueRegistry } from '../
|
|
3
|
+
import type { StyleValueRegistry } from '../interfaces';
|
|
4
4
|
import type { DisplayObject } from '../../display-objects';
|
|
5
5
|
import type { CSSProperty } from '../CSSProperty';
|
|
6
6
|
/**
|
|
@@ -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
|
*/
|
|
@@ -29,7 +29,7 @@ var _MutationEvent = require("../dom/MutationEvent");
|
|
|
29
29
|
|
|
30
30
|
var _shapes = require("../shapes");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _interfaces2 = require("../css/interfaces");
|
|
33
33
|
|
|
34
34
|
var _css = require("../css");
|
|
35
35
|
|
|
@@ -87,7 +87,7 @@ function (_super) {
|
|
|
87
87
|
var _a, _b, _c;
|
|
88
88
|
|
|
89
89
|
_this = _super.call(this) || this;
|
|
90
|
-
_this.styleValueRegistry = _manaSyringe.GlobalContainer.get(
|
|
90
|
+
_this.styleValueRegistry = _manaSyringe.GlobalContainer.get(_interfaces2.StyleValueRegistry);
|
|
91
91
|
/**
|
|
92
92
|
* push to active animations after calling `animate()`
|
|
93
93
|
*/
|
package/lib/dom/Document.js
CHANGED
|
@@ -159,7 +159,7 @@ function (_super) {
|
|
|
159
159
|
}), clientX = _c.x, clientY = _c.y;
|
|
160
160
|
return [4
|
|
161
161
|
/*yield*/
|
|
162
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
162
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
163
163
|
topmost: true,
|
|
164
164
|
position: {
|
|
165
165
|
x: x,
|
|
@@ -213,7 +213,7 @@ function (_super) {
|
|
|
213
213
|
}), clientX = _c.x, clientY = _c.y;
|
|
214
214
|
return [4
|
|
215
215
|
/*yield*/
|
|
216
|
-
, this.defaultView.getRenderingService().hooks.pick.
|
|
216
|
+
, this.defaultView.getRenderingService().hooks.pick.promise({
|
|
217
217
|
topmost: false,
|
|
218
218
|
position: {
|
|
219
219
|
x: x,
|
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,8 +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.
|
|
66
|
-
|
|
62
|
+
register(_css.DefaultStyleValueRegistry);
|
|
67
63
|
register(_css.CSSPropertyLengthOrPercentage);
|
|
68
64
|
register(_css.CSSPropertyLocalPosition);
|
|
69
65
|
register(_css.CSSPropertyOpacity);
|
|
@@ -11,6 +11,7 @@ export interface CullingStrategyContribution {
|
|
|
11
11
|
* 2. other custom culling strategies, eg. frustum culling
|
|
12
12
|
*/
|
|
13
13
|
export declare class CullingPlugin implements RenderingPlugin {
|
|
14
|
+
static tag: string;
|
|
14
15
|
private strategyProvider;
|
|
15
16
|
apply(renderingService: RenderingService): void;
|
|
16
17
|
}
|
|
@@ -26,9 +26,11 @@ var CullingPlugin =
|
|
|
26
26
|
function () {
|
|
27
27
|
function CullingPlugin() {}
|
|
28
28
|
|
|
29
|
+
CullingPlugin_1 = CullingPlugin;
|
|
30
|
+
|
|
29
31
|
CullingPlugin.prototype.apply = function (renderingService) {
|
|
30
32
|
var strategies = this.strategyProvider.getContributions();
|
|
31
|
-
renderingService.hooks.cull.tap(function (object) {
|
|
33
|
+
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
32
34
|
if (object) {
|
|
33
35
|
var cullable = object.cullable;
|
|
34
36
|
|
|
@@ -50,13 +52,15 @@ function () {
|
|
|
50
52
|
|
|
51
53
|
return object;
|
|
52
54
|
});
|
|
53
|
-
renderingService.hooks.afterRender.tap(function (object) {
|
|
55
|
+
renderingService.hooks.afterRender.tap(CullingPlugin_1.tag, function (object) {
|
|
54
56
|
object.cullable.visibilityPlaneMask = -1;
|
|
55
57
|
});
|
|
56
58
|
};
|
|
57
59
|
|
|
60
|
+
var CullingPlugin_1;
|
|
61
|
+
CullingPlugin.tag = 'Culling';
|
|
58
62
|
(0, _tslib.__decorate)([(0, _manaSyringe.contrib)(CullingStrategyContribution), (0, _tslib.__metadata)("design:type", Object)], CullingPlugin.prototype, "strategyProvider", void 0);
|
|
59
|
-
CullingPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
63
|
+
CullingPlugin = CullingPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
60
64
|
contrib: _RenderingService.RenderingPluginContribution
|
|
61
65
|
})], CullingPlugin);
|
|
62
66
|
return CullingPlugin;
|
|
@@ -3,6 +3,7 @@ import type { RenderingService, RenderingPlugin } from '../services/RenderingSer
|
|
|
3
3
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
4
4
|
*/
|
|
5
5
|
export declare class DirtyCheckPlugin implements RenderingPlugin {
|
|
6
|
+
static tag: string;
|
|
6
7
|
private canvasConfig;
|
|
7
8
|
private renderingContext;
|
|
8
9
|
apply(renderingService: RenderingService): void;
|
|
@@ -23,10 +23,12 @@ var DirtyCheckPlugin =
|
|
|
23
23
|
function () {
|
|
24
24
|
function DirtyCheckPlugin() {}
|
|
25
25
|
|
|
26
|
+
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
27
|
+
|
|
26
28
|
DirtyCheckPlugin.prototype.apply = function (renderingService) {
|
|
27
29
|
var _this = this;
|
|
28
30
|
|
|
29
|
-
renderingService.hooks.dirtycheck.tap(function (object) {
|
|
31
|
+
renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
|
|
30
32
|
if (object) {
|
|
31
33
|
var enableDirtyCheck = _this.canvasConfig.renderer.getConfig().enableDirtyCheck;
|
|
32
34
|
|
|
@@ -48,9 +50,11 @@ function () {
|
|
|
48
50
|
});
|
|
49
51
|
};
|
|
50
52
|
|
|
53
|
+
var DirtyCheckPlugin_1;
|
|
54
|
+
DirtyCheckPlugin.tag = 'DirtyCheck';
|
|
51
55
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_types.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], DirtyCheckPlugin.prototype, "canvasConfig", void 0);
|
|
52
56
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_RenderingContext.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
|
|
53
|
-
DirtyCheckPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
57
|
+
DirtyCheckPlugin = DirtyCheckPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
54
58
|
contrib: _RenderingService.RenderingPluginContribution
|
|
55
59
|
})], DirtyCheckPlugin);
|
|
56
60
|
return DirtyCheckPlugin;
|
|
@@ -7,6 +7,7 @@ import { RenderingService } from '../services';
|
|
|
7
7
|
* also provide some extra events such as `drag`
|
|
8
8
|
*/
|
|
9
9
|
export declare class EventPlugin implements RenderingPlugin {
|
|
10
|
+
static tag: string;
|
|
10
11
|
private canvasConfig;
|
|
11
12
|
private contextService;
|
|
12
13
|
private renderingService;
|
|
@@ -55,6 +55,8 @@ function () {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
EventPlugin_1 = EventPlugin;
|
|
59
|
+
|
|
58
60
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
59
61
|
var _this = this;
|
|
60
62
|
|
|
@@ -67,7 +69,7 @@ function () {
|
|
|
67
69
|
case 0:
|
|
68
70
|
return [4
|
|
69
71
|
/*yield*/
|
|
70
|
-
, this.renderingService.hooks.pick.
|
|
72
|
+
, this.renderingService.hooks.pick.promise({
|
|
71
73
|
position: position,
|
|
72
74
|
picked: [],
|
|
73
75
|
topmost: true // we only concern the topmost element
|
|
@@ -83,12 +85,12 @@ function () {
|
|
|
83
85
|
});
|
|
84
86
|
});
|
|
85
87
|
});
|
|
86
|
-
renderingService.hooks.pointerWheel.tap(function (nativeEvent) {
|
|
88
|
+
renderingService.hooks.pointerWheel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
87
89
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
88
90
|
|
|
89
91
|
_this.eventService.mapEvent(wheelEvent);
|
|
90
92
|
});
|
|
91
|
-
renderingService.hooks.pointerDown.tap(function (nativeEvent) {
|
|
93
|
+
renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
92
94
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
@@ -109,7 +111,7 @@ function () {
|
|
|
109
111
|
|
|
110
112
|
_this.setCursor(_this.eventService.cursor);
|
|
111
113
|
});
|
|
112
|
-
renderingService.hooks.pointerUp.tap(function (nativeEvent) {
|
|
114
|
+
renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
113
115
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
114
116
|
|
|
115
117
|
var $element = _this.contextService.getDomElement();
|
|
@@ -128,10 +130,10 @@ function () {
|
|
|
128
130
|
|
|
129
131
|
_this.setCursor(_this.eventService.cursor);
|
|
130
132
|
});
|
|
131
|
-
renderingService.hooks.pointerMove.tap(this.onPointerMove);
|
|
132
|
-
renderingService.hooks.pointerOver.tap(this.onPointerMove);
|
|
133
|
-
renderingService.hooks.pointerOut.tap(this.onPointerMove);
|
|
134
|
-
renderingService.hooks.pointerCancel.tap(function (nativeEvent) {
|
|
133
|
+
renderingService.hooks.pointerMove.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
134
|
+
renderingService.hooks.pointerOver.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
135
|
+
renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
|
|
136
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin_1.tag, function (nativeEvent) {
|
|
135
137
|
if (canvas.supportTouchEvent && nativeEvent.pointerType === 'touch') {
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
@@ -364,12 +366,14 @@ function () {
|
|
|
364
366
|
}
|
|
365
367
|
};
|
|
366
368
|
|
|
369
|
+
var EventPlugin_1;
|
|
370
|
+
EventPlugin.tag = 'Event';
|
|
367
371
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_types.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
368
372
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.ContextService), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "contextService", void 0);
|
|
369
373
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingService), (0, _tslib.__metadata)("design:type", _services.RenderingService)], EventPlugin.prototype, "renderingService", void 0);
|
|
370
374
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], EventPlugin.prototype, "renderingContext", void 0);
|
|
371
375
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_services.EventService), (0, _tslib.__metadata)("design:type", _services.EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
372
|
-
EventPlugin = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
376
|
+
EventPlugin = EventPlugin_1 = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
373
377
|
contrib: _services.RenderingPluginContribution
|
|
374
378
|
})], EventPlugin);
|
|
375
379
|
return EventPlugin;
|