@antv/g 5.0.23-alpha.9 → 5.1.0
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/Canvas.js +2 -0
- package/es/css/CSS.d.ts +2 -1
- package/es/css/CSS.js +6 -2
- package/es/css/CSSProperty.d.ts +3 -2
- package/es/css/StyleValueRegistry.d.ts +4 -2
- package/es/css/StyleValueRegistry.js +100 -95
- 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/color.d.ts +1 -1
- package/es/css/parser/color.js +2 -2
- package/es/css/parser/dimension.js +5 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +9 -2
- package/es/css/parser/points.d.ts +8 -1
- package/es/css/parser/points.js +33 -3
- package/es/css/parser/transform.js +1 -1
- package/es/css/properties/CSSPropertyClipPath.js +7 -1
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/es/css/properties/CSSPropertyLocalPosition.js +64 -20
- package/es/css/properties/CSSPropertyPath.d.ts +2 -2
- package/es/css/properties/CSSPropertyPath.js +7 -5
- package/es/css/properties/CSSPropertyPoints.js +3 -4
- package/es/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/es/css/properties/CSSPropertyTransform.js +76 -104
- package/es/display-objects/Circle.d.ts +4 -0
- package/es/display-objects/Circle.js +2 -0
- package/es/display-objects/DisplayObject.d.ts +2 -9
- package/es/display-objects/DisplayObject.js +8 -27
- package/es/display-objects/Ellipse.d.ts +4 -0
- package/es/display-objects/Ellipse.js +2 -0
- package/es/display-objects/Group.d.ts +4 -0
- package/es/display-objects/Group.js +2 -0
- package/es/display-objects/HTML.d.ts +4 -4
- package/es/display-objects/HTML.js +5 -3
- package/es/display-objects/Image.d.ts +4 -0
- package/es/display-objects/Image.js +2 -0
- package/es/display-objects/Line.js +2 -0
- package/es/display-objects/Path.d.ts +2 -2
- package/es/display-objects/Polygon.js +1 -1
- package/es/display-objects/Polyline.js +1 -1
- package/es/display-objects/Rect.d.ts +6 -2
- package/es/display-objects/Rect.js +2 -0
- package/es/display-objects/Text.d.ts +4 -0
- package/es/display-objects/Text.js +2 -0
- package/es/dom/Document.js +2 -2
- package/es/dom/Element.js +1 -0
- 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 +14 -10
- 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.d.ts +2 -0
- package/es/services/SceneGraphService.js +12 -1
- package/es/services/aabb/CircleUpdater.d.ts +0 -2
- package/es/services/aabb/CircleUpdater.js +2 -6
- package/es/services/aabb/EllipseUpdater.d.ts +0 -2
- package/es/services/aabb/EllipseUpdater.js +2 -6
- package/es/services/aabb/LineUpdater.d.ts +0 -2
- package/es/services/aabb/LineUpdater.js +1 -3
- package/es/services/aabb/PathUpdater.d.ts +0 -2
- package/es/services/aabb/PathUpdater.js +1 -5
- package/es/services/aabb/PolylineUpdater.d.ts +0 -2
- package/es/services/aabb/PolylineUpdater.js +1 -3
- package/es/services/aabb/RectUpdater.d.ts +0 -2
- package/es/services/aabb/RectUpdater.js +1 -5
- package/es/services/aabb/TextUpdater.d.ts +7 -0
- package/es/services/aabb/TextUpdater.js +0 -4
- package/es/services/aabb/interfaces.d.ts +0 -3
- package/es/types.d.ts +12 -23
- package/es/types.js +1 -0
- 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 +3 -9
- package/es/utils/math.js +4 -3
- package/es/utils/path.d.ts +2 -2
- package/es/utils/path.js +61 -24
- package/lib/AbstractRenderer.d.ts +11 -0
- package/lib/AbstractRenderer.js +17 -2
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +2 -0
- package/lib/css/CSS.d.ts +2 -1
- package/lib/css/CSS.js +9 -3
- package/lib/css/CSSProperty.d.ts +3 -2
- package/lib/css/StyleValueRegistry.d.ts +4 -2
- package/lib/css/StyleValueRegistry.js +104 -96
- 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/color.d.ts +1 -1
- package/lib/css/parser/color.js +1 -1
- package/lib/css/parser/dimension.js +4 -0
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +9 -2
- package/lib/css/parser/points.d.ts +8 -1
- package/lib/css/parser/points.js +33 -3
- package/lib/css/parser/transform.js +1 -1
- package/lib/css/properties/CSSPropertyClipPath.js +8 -1
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLocalPosition.d.ts +0 -9
- package/lib/css/properties/CSSPropertyLocalPosition.js +65 -20
- package/lib/css/properties/CSSPropertyPath.d.ts +2 -2
- package/lib/css/properties/CSSPropertyPath.js +7 -5
- package/lib/css/properties/CSSPropertyPoints.js +3 -4
- package/lib/css/properties/CSSPropertyTransform.d.ts +1 -1
- package/lib/css/properties/CSSPropertyTransform.js +75 -103
- package/lib/display-objects/Circle.d.ts +4 -0
- package/lib/display-objects/Circle.js +2 -0
- package/lib/display-objects/DisplayObject.d.ts +2 -9
- package/lib/display-objects/DisplayObject.js +9 -29
- package/lib/display-objects/Ellipse.d.ts +4 -0
- package/lib/display-objects/Ellipse.js +2 -0
- package/lib/display-objects/Group.d.ts +4 -0
- package/lib/display-objects/Group.js +2 -0
- package/lib/display-objects/HTML.d.ts +4 -4
- package/lib/display-objects/HTML.js +5 -3
- package/lib/display-objects/Image.d.ts +4 -0
- package/lib/display-objects/Image.js +2 -0
- package/lib/display-objects/Line.js +2 -0
- package/lib/display-objects/Path.d.ts +2 -2
- package/lib/display-objects/Polygon.js +1 -1
- package/lib/display-objects/Polyline.js +1 -1
- package/lib/display-objects/Rect.d.ts +6 -2
- package/lib/display-objects/Rect.js +2 -0
- package/lib/display-objects/Text.d.ts +4 -0
- package/lib/display-objects/Text.js +2 -0
- package/lib/dom/Document.js +2 -2
- package/lib/dom/Element.js +1 -0
- 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 +14 -10
- 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.d.ts +2 -0
- package/lib/services/SceneGraphService.js +15 -1
- package/lib/services/aabb/CircleUpdater.d.ts +0 -2
- package/lib/services/aabb/CircleUpdater.js +2 -6
- package/lib/services/aabb/EllipseUpdater.d.ts +0 -2
- package/lib/services/aabb/EllipseUpdater.js +2 -6
- package/lib/services/aabb/LineUpdater.d.ts +0 -2
- package/lib/services/aabb/LineUpdater.js +1 -3
- package/lib/services/aabb/PathUpdater.d.ts +0 -2
- package/lib/services/aabb/PathUpdater.js +1 -5
- package/lib/services/aabb/PolylineUpdater.d.ts +0 -2
- package/lib/services/aabb/PolylineUpdater.js +1 -3
- package/lib/services/aabb/RectUpdater.d.ts +0 -2
- package/lib/services/aabb/RectUpdater.js +1 -5
- package/lib/services/aabb/TextUpdater.d.ts +7 -0
- package/lib/services/aabb/TextUpdater.js +0 -4
- package/lib/services/aabb/interfaces.d.ts +0 -3
- package/lib/types.d.ts +12 -23
- package/lib/types.js +1 -0
- 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 +4 -10
- package/lib/utils/math.js +4 -3
- package/lib/utils/path.d.ts +2 -2
- package/lib/utils/path.js +55 -24
- 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/es/AbstractRenderer.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Syringe } from 'mana-syringe';
|
|
2
2
|
import type { RendererConfig } from './types';
|
|
3
3
|
export interface RendererPlugin {
|
|
4
|
+
name: string;
|
|
4
5
|
init: (container: Syringe.Container) => void;
|
|
5
6
|
destroy: (container: Syringe.Container) => void;
|
|
6
7
|
}
|
|
@@ -10,6 +11,14 @@ export interface IRenderer {
|
|
|
10
11
|
* register plugin at runtime
|
|
11
12
|
*/
|
|
12
13
|
registerPlugin: (plugin: RendererPlugin) => void;
|
|
14
|
+
/**
|
|
15
|
+
* unregister plugin at runtime
|
|
16
|
+
*/
|
|
17
|
+
unregisterPlugin: (plugin: RendererPlugin) => void;
|
|
18
|
+
/**
|
|
19
|
+
* get plugin by name
|
|
20
|
+
*/
|
|
21
|
+
getPlugin: (name: string) => RendererPlugin;
|
|
13
22
|
/**
|
|
14
23
|
* return all registered plugins
|
|
15
24
|
*/
|
|
@@ -20,7 +29,9 @@ export declare class AbstractRenderer implements IRenderer {
|
|
|
20
29
|
private config;
|
|
21
30
|
constructor(config?: Partial<RendererConfig>);
|
|
22
31
|
registerPlugin(plugin: RendererPlugin): void;
|
|
32
|
+
unregisterPlugin(plugin: RendererPlugin): void;
|
|
23
33
|
getPlugins(): RendererPlugin[];
|
|
34
|
+
getPlugin(name: string): RendererPlugin;
|
|
24
35
|
getConfig(): RendererConfig;
|
|
25
36
|
setConfig(config: Partial<RendererConfig>): void;
|
|
26
37
|
}
|
package/es/AbstractRenderer.js
CHANGED
|
@@ -20,8 +20,7 @@ function () {
|
|
|
20
20
|
* enable dirty rectangle rendering by default
|
|
21
21
|
*/
|
|
22
22
|
enableDirtyRectangleRendering: true,
|
|
23
|
-
enableDirtyRectangleRenderingDebug: false
|
|
24
|
-
enableTAA: false
|
|
23
|
+
enableDirtyRectangleRenderingDebug: false
|
|
25
24
|
}, config);
|
|
26
25
|
}
|
|
27
26
|
|
|
@@ -29,10 +28,26 @@ function () {
|
|
|
29
28
|
this.plugins.push(plugin);
|
|
30
29
|
};
|
|
31
30
|
|
|
31
|
+
AbstractRenderer.prototype.unregisterPlugin = function (plugin) {
|
|
32
|
+
var index = this.plugins.findIndex(function (p) {
|
|
33
|
+
return p === plugin;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (index > -1) {
|
|
37
|
+
this.plugins.splice(index, 1);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
32
41
|
AbstractRenderer.prototype.getPlugins = function () {
|
|
33
42
|
return this.plugins;
|
|
34
43
|
};
|
|
35
44
|
|
|
45
|
+
AbstractRenderer.prototype.getPlugin = function (name) {
|
|
46
|
+
return this.plugins.find(function (plugin) {
|
|
47
|
+
return plugin.name === name;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
36
51
|
AbstractRenderer.prototype.getConfig = function () {
|
|
37
52
|
return this.config;
|
|
38
53
|
};
|
package/es/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/es/Canvas.js
CHANGED
|
@@ -94,6 +94,8 @@ function (_super) {
|
|
|
94
94
|
/**
|
|
95
95
|
* limits query
|
|
96
96
|
*/
|
|
97
|
+
// the following feature-detect from hammer.js
|
|
98
|
+
// @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
|
|
97
99
|
|
|
98
100
|
_this.supportTouchEvent = supportTouchEvent !== null && supportTouchEvent !== void 0 ? supportTouchEvent : 'ontouchstart' in globalThis;
|
|
99
101
|
_this.supportPointerEvent = supportPointerEvent !== null && supportPointerEvent !== void 0 ? supportPointerEvent : !!globalThis.PointerEvent;
|
package/es/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/es/css/CSS.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GlobalContainer } from 'mana-syringe';
|
|
2
2
|
import { CSSUnitValue } from './cssom';
|
|
3
|
-
import { StyleValueRegistry } from './
|
|
3
|
+
import { StyleValueRegistry } from './interfaces';
|
|
4
|
+
import { LayoutRegistry } from './layout';
|
|
4
5
|
/**
|
|
5
6
|
* holds useful CSS-related methods.
|
|
6
7
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSS
|
|
@@ -109,5 +110,8 @@ export var CSS = {
|
|
|
109
110
|
* @see https://github.com/w3c/css-houdini-drafts/blob/main/css-layout-api/EXPLAINER.md
|
|
110
111
|
* @see https://developer.mozilla.org/en-US/docs/Web/Guide/Houdini#css_layout_api
|
|
111
112
|
*/
|
|
112
|
-
registerLayout: function registerLayout(name) {
|
|
113
|
+
registerLayout: function registerLayout(name, clazz) {
|
|
114
|
+
var layoutRegistry = GlobalContainer.get(LayoutRegistry);
|
|
115
|
+
layoutRegistry.registerLayout(name, clazz);
|
|
116
|
+
}
|
|
113
117
|
};
|
package/es/css/CSSProperty.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
1
2
|
import type { IElement } from '../dom';
|
|
2
|
-
import type { StyleValueRegistry } from './
|
|
3
|
+
import type { StyleValueRegistry } from './interfaces';
|
|
3
4
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
4
5
|
declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
|
|
5
|
-
declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
|
|
6
|
+
declare type CSSPropertyParser<Parsed> = (value: string | any, object: DisplayObject) => Parsed;
|
|
6
7
|
declare type CSSPropertyCalculator<Parsed, Used> = (name: string, oldParsed: Parsed, parsed: Parsed, object: IElement, registry: StyleValueRegistry) => Used;
|
|
7
8
|
/**
|
|
8
9
|
* 1. parser: raw CSS string -> Computed Value
|
|
@@ -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;
|
|
@@ -13,6 +14,7 @@ export declare const PropertySyntax: {
|
|
|
13
14
|
LENGTH: string;
|
|
14
15
|
PERCENTAGE: string;
|
|
15
16
|
LENGTH_PERCENTAGE: string;
|
|
17
|
+
LIST_OF_POINTS: string;
|
|
16
18
|
};
|
|
17
19
|
export interface PropertyMetadata {
|
|
18
20
|
name: string;
|
|
@@ -65,7 +67,7 @@ export interface PropertyMetadata {
|
|
|
65
67
|
* Blink used them in code generation(css_properties.json5)
|
|
66
68
|
*/
|
|
67
69
|
export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
|
|
68
|
-
export declare class StyleValueRegistry {
|
|
70
|
+
export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
|
|
69
71
|
/**
|
|
70
72
|
* need recalc later
|
|
71
73
|
*/
|
|
@@ -98,7 +100,7 @@ export declare class StyleValueRegistry {
|
|
|
98
100
|
/**
|
|
99
101
|
* string -> parsed value
|
|
100
102
|
*/
|
|
101
|
-
parseProperty(name: string, value: any): CSSStyleValue;
|
|
103
|
+
parseProperty(name: string, value: any, object: DisplayObject): CSSStyleValue;
|
|
102
104
|
/**
|
|
103
105
|
* computed value -> used value
|
|
104
106
|
*/
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { __decorate, __metadata, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { postConstruct, singleton, GlobalContainer } from 'mana-syringe';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
|
-
import {
|
|
4
|
+
import { GeometryUpdaterFactory } from '../services/aabb/interfaces';
|
|
5
|
+
import { dirtifyToRoot } from '../services/SceneGraphService';
|
|
5
6
|
import { ElementEvent } from '../dom';
|
|
6
7
|
import { Shape } from '../types';
|
|
7
8
|
import { CSSKeywordValue, CSSStyleValue, CSSUnitValue } from './cssom';
|
|
8
9
|
import { convertPercentUnit } from './parser';
|
|
9
10
|
import { CSSPropertyLocalPosition, CSSPropertyOpacity, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLineDash, CSSPropertyShadowBlur, CSSPropertyOffsetPath, CSSPropertyOffsetDistance, CSSPropertyAnchor, CSSPropertyZIndex, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyPath, CSSPropertyClipPath, CSSPropertyPoints, CSSPropertyText, CSSPropertyTextTransform } from './properties';
|
|
10
|
-
import { formatAttribute } from '../utils';
|
|
11
|
+
import { formatAttribute, isNil } from '../utils';
|
|
11
12
|
import { AABB } from '../shapes';
|
|
13
|
+
import { StyleValueRegistry } from './interfaces';
|
|
12
14
|
export var PropertySyntax = {
|
|
13
15
|
COLOR: '<color>',
|
|
14
16
|
PAINT: '<paint>',
|
|
15
17
|
NUMBER: '<number>',
|
|
16
18
|
LENGTH: '<length>',
|
|
17
19
|
PERCENTAGE: '<percentage>',
|
|
18
|
-
LENGTH_PERCENTAGE: '<length> | <percentage>'
|
|
20
|
+
LENGTH_PERCENTAGE: '<length> | <percentage>',
|
|
21
|
+
LIST_OF_POINTS: '<list-of-points>'
|
|
19
22
|
};
|
|
20
23
|
/**
|
|
21
24
|
* Blink used them in code generation(css_properties.json5)
|
|
@@ -28,29 +31,6 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
28
31
|
*/
|
|
29
32
|
name: 'display',
|
|
30
33
|
keywords: ['none']
|
|
31
|
-
}, {
|
|
32
|
-
// x in local space
|
|
33
|
-
name: 'x',
|
|
34
|
-
interpolable: true,
|
|
35
|
-
alias: ['cx'],
|
|
36
|
-
defaultValue: '0',
|
|
37
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
38
|
-
handler: CSSPropertyLocalPosition
|
|
39
|
-
}, {
|
|
40
|
-
// y in local space
|
|
41
|
-
name: 'y',
|
|
42
|
-
interpolable: true,
|
|
43
|
-
alias: ['cy'],
|
|
44
|
-
defaultValue: '0',
|
|
45
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
46
|
-
handler: CSSPropertyLocalPosition
|
|
47
|
-
}, {
|
|
48
|
-
// z in local space
|
|
49
|
-
name: 'z',
|
|
50
|
-
interpolable: true,
|
|
51
|
-
defaultValue: '0',
|
|
52
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
53
|
-
handler: CSSPropertyLocalPosition
|
|
54
34
|
}, {
|
|
55
35
|
/**
|
|
56
36
|
* range [0.0, 1.0]
|
|
@@ -135,6 +115,13 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
135
115
|
alias: ['strokeWidth'],
|
|
136
116
|
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
137
117
|
handler: CSSPropertyLengthOrPercentage
|
|
118
|
+
}, {
|
|
119
|
+
name: 'increasedLineWidthForHitTesting',
|
|
120
|
+
inherited: true,
|
|
121
|
+
defaultValue: '0',
|
|
122
|
+
layoutDependent: true,
|
|
123
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
124
|
+
handler: CSSPropertyLengthOrPercentage
|
|
138
125
|
}, {
|
|
139
126
|
name: 'lineJoin',
|
|
140
127
|
inherited: true,
|
|
@@ -216,6 +203,7 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
216
203
|
handler: CSSPropertyClipPath
|
|
217
204
|
}, {
|
|
218
205
|
name: 'transform',
|
|
206
|
+
parsePriority: 100,
|
|
219
207
|
interpolable: true,
|
|
220
208
|
keywords: ['none'],
|
|
221
209
|
defaultValue: 'none',
|
|
@@ -232,8 +220,20 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
232
220
|
parsePriority: 99,
|
|
233
221
|
layoutDependent: true,
|
|
234
222
|
handler: CSSPropertyAnchor
|
|
235
|
-
}, //
|
|
223
|
+
}, // <circle> & <ellipse>
|
|
236
224
|
{
|
|
225
|
+
name: 'cx',
|
|
226
|
+
interpolable: true,
|
|
227
|
+
defaultValue: '0',
|
|
228
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
229
|
+
handler: CSSPropertyLocalPosition
|
|
230
|
+
}, {
|
|
231
|
+
name: 'cy',
|
|
232
|
+
interpolable: true,
|
|
233
|
+
defaultValue: '0',
|
|
234
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
235
|
+
handler: CSSPropertyLocalPosition
|
|
236
|
+
}, {
|
|
237
237
|
name: 'r',
|
|
238
238
|
interpolable: true,
|
|
239
239
|
layoutDependent: true,
|
|
@@ -251,8 +251,29 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
251
251
|
layoutDependent: true,
|
|
252
252
|
defaultValue: 'auto',
|
|
253
253
|
handler: CSSPropertyLengthOrPercentage
|
|
254
|
-
}, // Rect Image
|
|
254
|
+
}, // Rect Image Group
|
|
255
255
|
{
|
|
256
|
+
// x in local space
|
|
257
|
+
name: 'x',
|
|
258
|
+
interpolable: true,
|
|
259
|
+
defaultValue: '0',
|
|
260
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
261
|
+
handler: CSSPropertyLocalPosition
|
|
262
|
+
}, {
|
|
263
|
+
// y in local space
|
|
264
|
+
name: 'y',
|
|
265
|
+
interpolable: true,
|
|
266
|
+
defaultValue: '0',
|
|
267
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
268
|
+
handler: CSSPropertyLocalPosition
|
|
269
|
+
}, {
|
|
270
|
+
// z in local space
|
|
271
|
+
name: 'z',
|
|
272
|
+
interpolable: true,
|
|
273
|
+
defaultValue: '0',
|
|
274
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
275
|
+
handler: CSSPropertyLocalPosition
|
|
276
|
+
}, {
|
|
256
277
|
name: 'width',
|
|
257
278
|
interpolable: true,
|
|
258
279
|
layoutDependent: true,
|
|
@@ -317,11 +338,13 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
317
338
|
interpolable: true,
|
|
318
339
|
layoutDependent: true,
|
|
319
340
|
defaultValue: '',
|
|
341
|
+
alias: ['d'],
|
|
320
342
|
handler: CSSPropertyPath
|
|
321
|
-
}, // Polyline
|
|
343
|
+
}, // Polyline & Polygon
|
|
322
344
|
{
|
|
323
345
|
name: 'points',
|
|
324
346
|
layoutDependent: true,
|
|
347
|
+
syntax: PropertySyntax.LIST_OF_POINTS,
|
|
325
348
|
handler: CSSPropertyPoints
|
|
326
349
|
}, // Text
|
|
327
350
|
{
|
|
@@ -411,10 +434,10 @@ export var BUILT_IN_PROPERTIES = [{
|
|
|
411
434
|
layoutDependent: true
|
|
412
435
|
}];
|
|
413
436
|
|
|
414
|
-
var
|
|
437
|
+
var DefaultStyleValueRegistry =
|
|
415
438
|
/** @class */
|
|
416
439
|
function () {
|
|
417
|
-
function
|
|
440
|
+
function DefaultStyleValueRegistry() {
|
|
418
441
|
/**
|
|
419
442
|
* need recalc later
|
|
420
443
|
*/
|
|
@@ -450,7 +473,7 @@ function () {
|
|
|
450
473
|
// > = {};
|
|
451
474
|
|
|
452
475
|
|
|
453
|
-
|
|
476
|
+
DefaultStyleValueRegistry.prototype.init = function () {
|
|
454
477
|
var _this = this;
|
|
455
478
|
|
|
456
479
|
BUILT_IN_PROPERTIES.forEach(function (property) {
|
|
@@ -458,7 +481,7 @@ function () {
|
|
|
458
481
|
});
|
|
459
482
|
};
|
|
460
483
|
|
|
461
|
-
|
|
484
|
+
DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
|
|
462
485
|
var _this = this;
|
|
463
486
|
|
|
464
487
|
__spreadArray([metadata.name], __read(metadata.alias || []), false).forEach(function (name) {
|
|
@@ -466,7 +489,7 @@ function () {
|
|
|
466
489
|
});
|
|
467
490
|
};
|
|
468
491
|
|
|
469
|
-
|
|
492
|
+
DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
|
|
470
493
|
return this.cache[name];
|
|
471
494
|
};
|
|
472
495
|
/**
|
|
@@ -480,7 +503,7 @@ function () {
|
|
|
480
503
|
*/
|
|
481
504
|
|
|
482
505
|
|
|
483
|
-
|
|
506
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
484
507
|
var _this = this;
|
|
485
508
|
|
|
486
509
|
if (options === void 0) {
|
|
@@ -517,7 +540,7 @@ function () {
|
|
|
517
540
|
|
|
518
541
|
if (!skipParse) {
|
|
519
542
|
sortedNames.forEach(function (name) {
|
|
520
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name]);
|
|
543
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object);
|
|
521
544
|
});
|
|
522
545
|
}
|
|
523
546
|
|
|
@@ -561,11 +584,11 @@ function () {
|
|
|
561
584
|
*/
|
|
562
585
|
|
|
563
586
|
|
|
564
|
-
|
|
587
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object) {
|
|
565
588
|
var metadata = this.getMetadata(name);
|
|
566
589
|
var computed = value;
|
|
567
590
|
|
|
568
|
-
if (value === '') {
|
|
591
|
+
if (value === '' || isNil(value)) {
|
|
569
592
|
value = 'unset';
|
|
570
593
|
}
|
|
571
594
|
|
|
@@ -584,7 +607,7 @@ function () {
|
|
|
584
607
|
|
|
585
608
|
if (propertyHandler && propertyHandler.parser) {
|
|
586
609
|
// try to parse it to CSSStyleValue, eg. '10px' -> CSS.px(10)
|
|
587
|
-
computed = propertyHandler.parser(value);
|
|
610
|
+
computed = propertyHandler.parser(value, object);
|
|
588
611
|
}
|
|
589
612
|
}
|
|
590
613
|
}
|
|
@@ -597,7 +620,7 @@ function () {
|
|
|
597
620
|
*/
|
|
598
621
|
|
|
599
622
|
|
|
600
|
-
|
|
623
|
+
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
|
|
601
624
|
var metadata = this.getMetadata(name);
|
|
602
625
|
var isDocumentElement = object.id === 'g-root';
|
|
603
626
|
var used = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
@@ -623,8 +646,8 @@ function () {
|
|
|
623
646
|
|
|
624
647
|
if (value === 'initial') {
|
|
625
648
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
|
|
626
|
-
if (defaultValue) {
|
|
627
|
-
computed = this.parseProperty(name, defaultValue);
|
|
649
|
+
if (!isNil(defaultValue)) {
|
|
650
|
+
computed = this.parseProperty(name, defaultValue, object);
|
|
628
651
|
}
|
|
629
652
|
} else if (value === 'inherit') {
|
|
630
653
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
|
|
@@ -661,7 +684,7 @@ function () {
|
|
|
661
684
|
return false;
|
|
662
685
|
};
|
|
663
686
|
|
|
664
|
-
|
|
687
|
+
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
|
|
665
688
|
var metadata = this.getMetadata(name);
|
|
666
689
|
|
|
667
690
|
if (metadata && metadata.handler) {
|
|
@@ -673,7 +696,7 @@ function () {
|
|
|
673
696
|
}
|
|
674
697
|
};
|
|
675
698
|
|
|
676
|
-
|
|
699
|
+
DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
|
|
677
700
|
if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
|
|
678
701
|
return true;
|
|
679
702
|
}
|
|
@@ -685,7 +708,7 @@ function () {
|
|
|
685
708
|
*/
|
|
686
709
|
|
|
687
710
|
|
|
688
|
-
|
|
711
|
+
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
689
712
|
if (!this.unresolvedProperties[object.entity]) {
|
|
690
713
|
this.unresolvedProperties[object.entity] = [];
|
|
691
714
|
}
|
|
@@ -695,7 +718,7 @@ function () {
|
|
|
695
718
|
}
|
|
696
719
|
};
|
|
697
720
|
|
|
698
|
-
|
|
721
|
+
DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
|
|
699
722
|
if (options === void 0) {
|
|
700
723
|
options = {};
|
|
701
724
|
}
|
|
@@ -719,7 +742,7 @@ function () {
|
|
|
719
742
|
return false;
|
|
720
743
|
};
|
|
721
744
|
|
|
722
|
-
|
|
745
|
+
DefaultStyleValueRegistry.prototype.recalc = function (object) {
|
|
723
746
|
var properties = this.unresolvedProperties[object.entity];
|
|
724
747
|
|
|
725
748
|
if (properties && properties.length) {
|
|
@@ -737,7 +760,7 @@ function () {
|
|
|
737
760
|
*/
|
|
738
761
|
|
|
739
762
|
|
|
740
|
-
|
|
763
|
+
DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
|
|
741
764
|
var _a;
|
|
742
765
|
|
|
743
766
|
var geometryUpdaterFactory = GlobalContainer.get(GeometryUpdaterFactory);
|
|
@@ -761,40 +784,23 @@ function () {
|
|
|
761
784
|
height = _b.height,
|
|
762
785
|
_c = _b.depth,
|
|
763
786
|
depth = _c === void 0 ? 0 : _c,
|
|
764
|
-
_d = _b.
|
|
765
|
-
|
|
766
|
-
_e = _b.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
// z = 0,
|
|
771
|
-
offsetX = _f === void 0 ? 0 : _f,
|
|
772
|
-
_g = _b.offsetY,
|
|
773
|
-
offsetY = _g === void 0 ? 0 : _g,
|
|
774
|
-
_h = _b.offsetZ,
|
|
775
|
-
offsetZ = _h === void 0 ? 0 : _h;
|
|
776
|
-
|
|
777
|
-
if (object.nodeName === Shape.LINE || object.nodeName === Shape.POLYLINE || object.nodeName === Shape.POLYGON || object.nodeName === Shape.PATH) {
|
|
778
|
-
parsedStyle.offsetX = x - (parsedStyle.defX || 0);
|
|
779
|
-
parsedStyle.offsetY = y - (parsedStyle.defY || 0);
|
|
780
|
-
parsedStyle.defX = x;
|
|
781
|
-
parsedStyle.defY = y; // modify x/y/z
|
|
782
|
-
|
|
783
|
-
object.attributes.x += parsedStyle.offsetX;
|
|
784
|
-
object.attributes.y += parsedStyle.offsetY;
|
|
785
|
-
parsedStyle.x = parsedStyle.x.add(new CSSUnitValue(parsedStyle.offsetX, 'px'));
|
|
786
|
-
parsedStyle.y = parsedStyle.y.add(new CSSUnitValue(parsedStyle.offsetY, 'px'));
|
|
787
|
-
} // init with content box
|
|
787
|
+
_d = _b.offsetX,
|
|
788
|
+
offsetX = _d === void 0 ? 0 : _d,
|
|
789
|
+
_e = _b.offsetY,
|
|
790
|
+
offsetY = _e === void 0 ? 0 : _e,
|
|
791
|
+
_f = _b.offsetZ,
|
|
792
|
+
offsetZ = _f === void 0 ? 0 : _f; // init with content box
|
|
788
793
|
|
|
789
794
|
|
|
790
795
|
var halfExtents = vec3.fromValues(width / 2, height / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
|
|
791
796
|
|
|
792
|
-
var
|
|
793
|
-
lineWidth =
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
797
|
+
var _g = parsedStyle,
|
|
798
|
+
lineWidth = _g.lineWidth,
|
|
799
|
+
increasedLineWidthForHitTesting = _g.increasedLineWidthForHitTesting,
|
|
800
|
+
shadowColor = _g.shadowColor,
|
|
801
|
+
_h = _g.filter,
|
|
802
|
+
filter = _h === void 0 ? [] : _h,
|
|
803
|
+
transformOrigin = _g.transformOrigin;
|
|
798
804
|
var anchor = parsedStyle.anchor; // <Text> use textAlign & textBaseline instead of anchor
|
|
799
805
|
|
|
800
806
|
if (object.nodeName === Shape.TEXT) {
|
|
@@ -804,22 +810,19 @@ function () {
|
|
|
804
810
|
var center = vec3.fromValues((1 - (anchor && anchor[0].value || 0) * 2) * halfExtents[0] + offsetX, (1 - (anchor && anchor[1].value || 0) * 2) * halfExtents[1] + offsetY, (1 - (anchor && ((_a = anchor[2]) === null || _a === void 0 ? void 0 : _a.value) || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
|
|
805
811
|
|
|
806
812
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
813
|
+
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
|
|
807
814
|
|
|
808
|
-
|
|
809
|
-
// append border
|
|
810
|
-
vec3.add(halfExtents, halfExtents, vec3.fromValues(lineWidth.value / 2, lineWidth.value / 2, 0));
|
|
811
|
-
}
|
|
812
|
-
|
|
815
|
+
vec3.add(halfExtents, halfExtents, vec3.fromValues(halfLineWidth, halfLineWidth, 0));
|
|
813
816
|
geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
|
|
814
817
|
|
|
815
818
|
if (shadowColor) {
|
|
816
|
-
var
|
|
817
|
-
min =
|
|
818
|
-
max =
|
|
819
|
-
var
|
|
820
|
-
shadowBlur =
|
|
821
|
-
shadowOffsetX =
|
|
822
|
-
shadowOffsetY =
|
|
819
|
+
var _j = geometry_1.renderBounds,
|
|
820
|
+
min = _j.min,
|
|
821
|
+
max = _j.max;
|
|
822
|
+
var _k = parsedStyle,
|
|
823
|
+
shadowBlur = _k.shadowBlur,
|
|
824
|
+
shadowOffsetX = _k.shadowOffsetX,
|
|
825
|
+
shadowOffsetY = _k.shadowOffsetY;
|
|
823
826
|
var shadowBlurInPixels = shadowBlur && shadowBlur.value || 0;
|
|
824
827
|
var shadowOffsetXInPixels = shadowOffsetX && shadowOffsetX.value || 0;
|
|
825
828
|
var shadowOffsetYInPixels = shadowOffsetY && shadowOffsetY.value || 0;
|
|
@@ -872,7 +875,7 @@ function () {
|
|
|
872
875
|
}
|
|
873
876
|
};
|
|
874
877
|
|
|
875
|
-
|
|
878
|
+
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
876
879
|
var metadata = this.getMetadata(name);
|
|
877
880
|
|
|
878
881
|
if (!metadata) {
|
|
@@ -882,10 +885,12 @@ function () {
|
|
|
882
885
|
return metadata.inherited;
|
|
883
886
|
};
|
|
884
887
|
|
|
885
|
-
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)],
|
|
888
|
+
__decorate([postConstruct(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
|
|
886
889
|
|
|
887
|
-
|
|
888
|
-
|
|
890
|
+
DefaultStyleValueRegistry = __decorate([singleton({
|
|
891
|
+
token: StyleValueRegistry
|
|
892
|
+
})], DefaultStyleValueRegistry);
|
|
893
|
+
return DefaultStyleValueRegistry;
|
|
889
894
|
}();
|
|
890
895
|
|
|
891
|
-
export {
|
|
896
|
+
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
|
package/es/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/es/css/index.js
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';
|
|
@@ -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
|
+
}
|