@antv/g 5.0.23-alpha.12 → 5.0.23-alpha.15
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/CSS.js +1 -1
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -3
- package/es/css/StyleValueRegistry.js +23 -23
- 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/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/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 -3
- package/lib/css/StyleValueRegistry.js +24 -26
- 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/global-module.js +2 -5
- package/lib/plugins/PrepareRendererPlugin.js +2 -2
- package/lib/services/RenderingService.js +2 -2
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/utils/interpolation.js +2 -2
- package/package.json +2 -2
package/es/css/CSS.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalContainer } from 'mana-syringe';
|
|
2
2
|
import { CSSUnitValue } from './cssom';
|
|
3
|
-
import { StyleValueRegistry } from './
|
|
3
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
4
|
/**
|
|
5
5
|
* holds useful CSS-related methods.
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
package/es/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,7 +1,7 @@
|
|
|
1
|
-
import { Syringe } from 'mana-syringe';
|
|
2
1
|
import type { DisplayObject } from '../display-objects';
|
|
3
2
|
import type { BaseStyleProps } from '../types';
|
|
4
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { StyleValueRegistry } from './interfaces';
|
|
5
5
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
6
6
|
export interface PropertyParseOptions {
|
|
7
7
|
skipUpdateAttribute: boolean;
|
|
@@ -66,8 +66,7 @@ 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
|
|
70
|
-
export declare class StyleValueRegistry {
|
|
69
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
71
70
|
/**
|
|
72
71
|
* need recalc later
|
|
73
72
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __metadata, __read, __spreadArray } from "tslib";
|
|
2
|
-
import { postConstruct, singleton, GlobalContainer
|
|
2
|
+
import { postConstruct, singleton, GlobalContainer } from 'mana-syringe';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
4
|
import { GeometryUpdaterFactory } from '../services/aabb/interfaces';
|
|
5
5
|
import { dirtifyToRoot } from '../services/SceneGraphService';
|
|
@@ -10,6 +10,7 @@ import { convertPercentUnit } from './parser';
|
|
|
10
10
|
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLineDash, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyAnchor, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
11
11
|
import { formatAttribute } from '../utils';
|
|
12
12
|
import { AABB } from '../shapes';
|
|
13
|
+
import { StyleValueRegistry } from './interfaces';
|
|
13
14
|
export var PropertySyntax = {
|
|
14
15
|
COLOR: '<color>',
|
|
15
16
|
PAINT: '<paint>',
|
|
@@ -411,12 +412,11 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
411
412
|
name: 'whiteSpace',
|
|
412
413
|
layoutDependent: true
|
|
413
414
|
}];
|
|
414
|
-
export var StyleValueRegistryContribution = 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 };
|
package/es/css/index.d.ts
CHANGED
package/es/css/index.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -10,7 +10,7 @@ import { createVec3, decompose, formatAttribute, fromRotationTranslationScale, g
|
|
|
10
10
|
import { dirtifyToRoot } from '../services';
|
|
11
11
|
import { MutationEvent } from '../dom/MutationEvent';
|
|
12
12
|
import { Rectangle } from '../shapes';
|
|
13
|
-
import { StyleValueRegistry } from '../css/
|
|
13
|
+
import { StyleValueRegistry } from '../css/interfaces';
|
|
14
14
|
import { CSSUnitValue } from '../css';
|
|
15
15
|
var DEFAULT_STYLE_PROPS = {
|
|
16
16
|
x: '',
|
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/interfaces';
|
|
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/interfaces';
|
|
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
|
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
import { Syringe } from 'mana-syringe';
|
|
2
1
|
import type { DisplayObject } from '../display-objects';
|
|
3
2
|
import type { BaseStyleProps } from '../types';
|
|
4
3
|
import { CSSStyleValue } from './cssom';
|
|
4
|
+
import { StyleValueRegistry } from './interfaces';
|
|
5
5
|
export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
|
|
6
6
|
export interface PropertyParseOptions {
|
|
7
7
|
skipUpdateAttribute: boolean;
|
|
@@ -66,8 +66,7 @@ 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
|
|
70
|
-
export declare class StyleValueRegistry {
|
|
69
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
71
70
|
/**
|
|
72
71
|
* need recalc later
|
|
73
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>',
|
|
@@ -433,14 +435,10 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
433
435
|
}];
|
|
434
436
|
exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
|
|
435
437
|
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
exports.StyleValueRegistryContribution = StyleValueRegistryContribution;
|
|
439
|
-
|
|
440
|
-
var StyleValueRegistry =
|
|
438
|
+
var DefaultStyleValueRegistry =
|
|
441
439
|
/** @class */
|
|
442
440
|
function () {
|
|
443
|
-
function
|
|
441
|
+
function DefaultStyleValueRegistry() {
|
|
444
442
|
/**
|
|
445
443
|
* need recalc later
|
|
446
444
|
*/
|
|
@@ -476,7 +474,7 @@ function () {
|
|
|
476
474
|
// > = {};
|
|
477
475
|
|
|
478
476
|
|
|
479
|
-
|
|
477
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
480
478
|
var _this = this;
|
|
481
479
|
|
|
482
480
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -484,7 +482,7 @@ function () {
|
|
|
484
482
|
});
|
|
485
483
|
};
|
|
486
484
|
|
|
487
|
-
|
|
485
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
488
486
|
var _this = this;
|
|
489
487
|
|
|
490
488
|
(0, _tslib.__spreadArray)([metadata.name], (0, _tslib.__read)(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -492,7 +490,7 @@ function () {
|
|
|
492
490
|
});
|
|
493
491
|
};
|
|
494
492
|
|
|
495
|
-
|
|
493
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
496
494
|
return this.cache[name];
|
|
497
495
|
};
|
|
498
496
|
/**
|
|
@@ -506,7 +504,7 @@ function () {
|
|
|
506
504
|
*/
|
|
507
505
|
|
|
508
506
|
|
|
509
|
-
|
|
507
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
510
508
|
var _this = this;
|
|
511
509
|
|
|
512
510
|
if (options === void 0) {
|
|
@@ -587,7 +585,7 @@ function () {
|
|
|
587
585
|
*/
|
|
588
586
|
|
|
589
587
|
|
|
590
|
-
|
|
588
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
591
589
|
var metadata = this.getMetadata(name);
|
|
592
590
|
var computed = value;
|
|
593
591
|
|
|
@@ -623,7 +621,7 @@ function () {
|
|
|
623
621
|
*/
|
|
624
622
|
|
|
625
623
|
|
|
626
|
-
|
|
624
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
627
625
|
var metadata = this.getMetadata(name);
|
|
628
626
|
var isDocumentElement = object.id === 'g-root';
|
|
629
627
|
var used = computed instanceof _cssom.CSSStyleValue ? computed.clone() : computed;
|
|
@@ -688,7 +686,7 @@ function () {
|
|
|
688
686
|
return false;
|
|
689
687
|
};
|
|
690
688
|
|
|
691
|
-
|
|
689
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
692
690
|
var metadata = this.getMetadata(name);
|
|
693
691
|
|
|
694
692
|
if (metadata && metadata.handler) {
|
|
@@ -700,7 +698,7 @@ function () {
|
|
|
700
698
|
}
|
|
701
699
|
};
|
|
702
700
|
|
|
703
|
-
|
|
701
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
704
702
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
705
703
|
return true;
|
|
706
704
|
}
|
|
@@ -712,7 +710,7 @@ function () {
|
|
|
712
710
|
*/
|
|
713
711
|
|
|
714
712
|
|
|
715
|
-
|
|
713
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
716
714
|
if (!this.unresolvedProperties[object.entity]) {
|
|
717
715
|
this.unresolvedProperties[object.entity] = [];
|
|
718
716
|
}
|
|
@@ -722,7 +720,7 @@ function () {
|
|
|
722
720
|
}
|
|
723
721
|
};
|
|
724
722
|
|
|
725
|
-
|
|
723
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
726
724
|
if (options === void 0) {
|
|
727
725
|
options = {};
|
|
728
726
|
}
|
|
@@ -746,7 +744,7 @@ function () {
|
|
|
746
744
|
return false;
|
|
747
745
|
};
|
|
748
746
|
|
|
749
|
-
|
|
747
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
750
748
|
var properties = this.unresolvedProperties[object.entity];
|
|
751
749
|
|
|
752
750
|
if (properties && properties.length) {
|
|
@@ -764,7 +762,7 @@ function () {
|
|
|
764
762
|
*/
|
|
765
763
|
|
|
766
764
|
|
|
767
|
-
|
|
765
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
768
766
|
var _a;
|
|
769
767
|
|
|
770
768
|
var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
|
|
@@ -902,7 +900,7 @@ function () {
|
|
|
902
900
|
}
|
|
903
901
|
};
|
|
904
902
|
|
|
905
|
-
|
|
903
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
906
904
|
var metadata = this.getMetadata(name);
|
|
907
905
|
|
|
908
906
|
if (!metadata) {
|
|
@@ -912,11 +910,11 @@ function () {
|
|
|
912
910
|
return metadata.inherited;
|
|
913
911
|
};
|
|
914
912
|
|
|
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
|
|
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;
|
|
920
918
|
}();
|
|
921
919
|
|
|
922
|
-
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
|
/**
|