@antv/g 5.0.23 → 5.1.1
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 -2
- 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/components/Geometry.d.ts +0 -4
- package/es/css/CSS.d.ts +2 -1
- package/es/css/CSS.js +5 -1
- package/es/css/CSSProperty.d.ts +2 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +71 -88
- package/es/css/index.d.ts +1 -1
- package/es/css/index.js +1 -1
- 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/CSSPropertyLocalPosition.d.ts +0 -9
- package/es/css/properties/CSSPropertyLocalPosition.js +59 -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/CustomElement.d.ts +6 -2
- package/es/display-objects/CustomElement.js +15 -5
- package/es/display-objects/DisplayObject.d.ts +1 -7
- package/es/display-objects/DisplayObject.js +6 -26
- 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/Element.js +1 -0
- package/es/global-module.js +87 -1
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/services/EventService.js +10 -2
- package/es/services/OffscreenCanvasCreator.d.ts +1 -1
- package/es/services/OffscreenCanvasCreator.js +1 -1
- package/es/services/RenderingService.d.ts +1 -1
- package/es/services/RenderingService.js +1 -1
- package/es/services/SceneGraphService.d.ts +2 -0
- package/es/services/SceneGraphService.js +9 -0
- 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 +7 -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 -0
- package/es/utils/index.js +3 -1
- package/es/utils/interpolation.js +2 -8
- 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/components/Geometry.d.ts +0 -4
- package/lib/css/CSS.d.ts +2 -1
- package/lib/css/CSS.js +7 -1
- package/lib/css/CSSProperty.d.ts +2 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +70 -88
- package/lib/css/index.d.ts +1 -1
- package/lib/css/index.js +12 -12
- 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/CSSPropertyLocalPosition.d.ts +0 -9
- package/lib/css/properties/CSSPropertyLocalPosition.js +60 -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/CustomElement.d.ts +6 -2
- package/lib/display-objects/CustomElement.js +13 -4
- package/lib/display-objects/DisplayObject.d.ts +1 -7
- package/lib/display-objects/DisplayObject.js +6 -27
- 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/Element.js +1 -0
- package/lib/global-module.js +89 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +7 -2
- package/lib/services/EventService.js +10 -2
- package/lib/services/OffscreenCanvasCreator.d.ts +1 -1
- package/lib/services/OffscreenCanvasCreator.js +1 -1
- package/lib/services/RenderingService.d.ts +1 -1
- package/lib/services/RenderingService.js +1 -1
- package/lib/services/SceneGraphService.d.ts +2 -0
- package/lib/services/SceneGraphService.js +12 -0
- 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 +7 -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 -0
- package/lib/utils/index.js +26 -0
- package/lib/utils/interpolation.js +2 -8
- 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 +3 -3
- package/es/css/LayoutRegistry.d.ts +0 -11
- package/es/css/LayoutRegistry.js +0 -22
- package/lib/css/LayoutRegistry.d.ts +0 -11
- package/lib/css/LayoutRegistry.js +0 -30
|
@@ -37,7 +37,8 @@ var PropertySyntax = {
|
|
|
37
37
|
NUMBER: '<number>',
|
|
38
38
|
LENGTH: '<length>',
|
|
39
39
|
PERCENTAGE: '<percentage>',
|
|
40
|
-
LENGTH_PERCENTAGE: '<length> | <percentage>'
|
|
40
|
+
LENGTH_PERCENTAGE: '<length> | <percentage>',
|
|
41
|
+
LIST_OF_POINTS: '<list-of-points>'
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
44
|
* Blink used them in code generation(css_properties.json5)
|
|
@@ -51,29 +52,6 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
51
52
|
*/
|
|
52
53
|
name: 'display',
|
|
53
54
|
keywords: ['none']
|
|
54
|
-
}, {
|
|
55
|
-
// x in local space
|
|
56
|
-
name: 'x',
|
|
57
|
-
interpolable: true,
|
|
58
|
-
alias: ['cx'],
|
|
59
|
-
defaultValue: '0',
|
|
60
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
61
|
-
handler: _properties.CSSPropertyLocalPosition
|
|
62
|
-
}, {
|
|
63
|
-
// y in local space
|
|
64
|
-
name: 'y',
|
|
65
|
-
interpolable: true,
|
|
66
|
-
alias: ['cy'],
|
|
67
|
-
defaultValue: '0',
|
|
68
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
69
|
-
handler: _properties.CSSPropertyLocalPosition
|
|
70
|
-
}, {
|
|
71
|
-
// z in local space
|
|
72
|
-
name: 'z',
|
|
73
|
-
interpolable: true,
|
|
74
|
-
defaultValue: '0',
|
|
75
|
-
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
76
|
-
handler: _properties.CSSPropertyLocalPosition
|
|
77
55
|
}, {
|
|
78
56
|
/**
|
|
79
57
|
* range [0.0, 1.0]
|
|
@@ -163,7 +141,6 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
163
141
|
inherited: true,
|
|
164
142
|
defaultValue: '0',
|
|
165
143
|
layoutDependent: true,
|
|
166
|
-
alias: ['lineAppendWidth'],
|
|
167
144
|
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
168
145
|
handler: _properties.CSSPropertyLengthOrPercentage
|
|
169
146
|
}, {
|
|
@@ -247,6 +224,7 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
247
224
|
handler: _properties.CSSPropertyClipPath
|
|
248
225
|
}, {
|
|
249
226
|
name: 'transform',
|
|
227
|
+
parsePriority: 100,
|
|
250
228
|
interpolable: true,
|
|
251
229
|
keywords: ['none'],
|
|
252
230
|
defaultValue: 'none',
|
|
@@ -263,8 +241,20 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
263
241
|
parsePriority: 99,
|
|
264
242
|
layoutDependent: true,
|
|
265
243
|
handler: _properties.CSSPropertyAnchor
|
|
266
|
-
}, //
|
|
244
|
+
}, // <circle> & <ellipse>
|
|
267
245
|
{
|
|
246
|
+
name: 'cx',
|
|
247
|
+
interpolable: true,
|
|
248
|
+
defaultValue: '0',
|
|
249
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
250
|
+
handler: _properties.CSSPropertyLocalPosition
|
|
251
|
+
}, {
|
|
252
|
+
name: 'cy',
|
|
253
|
+
interpolable: true,
|
|
254
|
+
defaultValue: '0',
|
|
255
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
256
|
+
handler: _properties.CSSPropertyLocalPosition
|
|
257
|
+
}, {
|
|
268
258
|
name: 'r',
|
|
269
259
|
interpolable: true,
|
|
270
260
|
layoutDependent: true,
|
|
@@ -282,8 +272,29 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
282
272
|
layoutDependent: true,
|
|
283
273
|
defaultValue: 'auto',
|
|
284
274
|
handler: _properties.CSSPropertyLengthOrPercentage
|
|
285
|
-
}, // Rect Image
|
|
275
|
+
}, // Rect Image Group
|
|
286
276
|
{
|
|
277
|
+
// x in local space
|
|
278
|
+
name: 'x',
|
|
279
|
+
interpolable: true,
|
|
280
|
+
defaultValue: '0',
|
|
281
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
282
|
+
handler: _properties.CSSPropertyLocalPosition
|
|
283
|
+
}, {
|
|
284
|
+
// y in local space
|
|
285
|
+
name: 'y',
|
|
286
|
+
interpolable: true,
|
|
287
|
+
defaultValue: '0',
|
|
288
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
289
|
+
handler: _properties.CSSPropertyLocalPosition
|
|
290
|
+
}, {
|
|
291
|
+
// z in local space
|
|
292
|
+
name: 'z',
|
|
293
|
+
interpolable: true,
|
|
294
|
+
defaultValue: '0',
|
|
295
|
+
syntax: PropertySyntax.LENGTH_PERCENTAGE,
|
|
296
|
+
handler: _properties.CSSPropertyLocalPosition
|
|
297
|
+
}, {
|
|
287
298
|
name: 'width',
|
|
288
299
|
interpolable: true,
|
|
289
300
|
layoutDependent: true,
|
|
@@ -348,11 +359,13 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
348
359
|
interpolable: true,
|
|
349
360
|
layoutDependent: true,
|
|
350
361
|
defaultValue: '',
|
|
362
|
+
alias: ['d'],
|
|
351
363
|
handler: _properties.CSSPropertyPath
|
|
352
|
-
}, // Polyline
|
|
364
|
+
}, // Polyline & Polygon
|
|
353
365
|
{
|
|
354
366
|
name: 'points',
|
|
355
367
|
layoutDependent: true,
|
|
368
|
+
syntax: PropertySyntax.LIST_OF_POINTS,
|
|
356
369
|
handler: _properties.CSSPropertyPoints
|
|
357
370
|
}, // Text
|
|
358
371
|
{
|
|
@@ -549,7 +562,7 @@ function () {
|
|
|
549
562
|
|
|
550
563
|
if (!skipParse) {
|
|
551
564
|
sortedNames.forEach(function (name) {
|
|
552
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name]);
|
|
565
|
+
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object);
|
|
553
566
|
});
|
|
554
567
|
}
|
|
555
568
|
|
|
@@ -593,11 +606,11 @@ function () {
|
|
|
593
606
|
*/
|
|
594
607
|
|
|
595
608
|
|
|
596
|
-
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
|
|
609
|
+
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object) {
|
|
597
610
|
var metadata = this.getMetadata(name);
|
|
598
611
|
var computed = value;
|
|
599
612
|
|
|
600
|
-
if (value === '') {
|
|
613
|
+
if (value === '' || (0, _utils.isNil)(value)) {
|
|
601
614
|
value = 'unset';
|
|
602
615
|
}
|
|
603
616
|
|
|
@@ -616,7 +629,7 @@ function () {
|
|
|
616
629
|
|
|
617
630
|
if (propertyHandler && propertyHandler.parser) {
|
|
618
631
|
// try to parse it to CSSStyleValue, eg. '10px' -> CSS.px(10)
|
|
619
|
-
computed = propertyHandler.parser(value);
|
|
632
|
+
computed = propertyHandler.parser(value, object);
|
|
620
633
|
}
|
|
621
634
|
}
|
|
622
635
|
}
|
|
@@ -655,8 +668,8 @@ function () {
|
|
|
655
668
|
|
|
656
669
|
if (value === 'initial') {
|
|
657
670
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
|
|
658
|
-
if (defaultValue) {
|
|
659
|
-
computed = this.parseProperty(name, defaultValue);
|
|
671
|
+
if (!(0, _utils.isNil)(defaultValue)) {
|
|
672
|
+
computed = this.parseProperty(name, defaultValue, object);
|
|
660
673
|
}
|
|
661
674
|
} else if (value === 'inherit') {
|
|
662
675
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
|
|
@@ -788,10 +801,6 @@ function () {
|
|
|
788
801
|
geometry_1.renderBounds = new _shapes.AABB();
|
|
789
802
|
}
|
|
790
803
|
|
|
791
|
-
if (!geometry_1.hitAreaBounds) {
|
|
792
|
-
geometry_1.hitAreaBounds = new _shapes.AABB();
|
|
793
|
-
}
|
|
794
|
-
|
|
795
804
|
var parsedStyle = object.parsedStyle;
|
|
796
805
|
|
|
797
806
|
var _b = geometryUpdater.update(parsedStyle, object),
|
|
@@ -799,42 +808,24 @@ function () {
|
|
|
799
808
|
height = _b.height,
|
|
800
809
|
_c = _b.depth,
|
|
801
810
|
depth = _c === void 0 ? 0 : _c,
|
|
802
|
-
_d = _b.
|
|
803
|
-
|
|
804
|
-
_e = _b.
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
// z = 0,
|
|
809
|
-
offsetX = _f === void 0 ? 0 : _f,
|
|
810
|
-
_g = _b.offsetY,
|
|
811
|
-
offsetY = _g === void 0 ? 0 : _g,
|
|
812
|
-
_h = _b.offsetZ,
|
|
813
|
-
offsetZ = _h === void 0 ? 0 : _h;
|
|
814
|
-
|
|
815
|
-
if (object.nodeName === _types.Shape.LINE || object.nodeName === _types.Shape.POLYLINE || object.nodeName === _types.Shape.POLYGON || object.nodeName === _types.Shape.PATH) {
|
|
816
|
-
parsedStyle.offsetX = x - (parsedStyle.defX || 0);
|
|
817
|
-
parsedStyle.offsetY = y - (parsedStyle.defY || 0);
|
|
818
|
-
parsedStyle.defX = x;
|
|
819
|
-
parsedStyle.defY = y; // modify x/y/z
|
|
820
|
-
|
|
821
|
-
object.attributes.x += parsedStyle.offsetX;
|
|
822
|
-
object.attributes.y += parsedStyle.offsetY;
|
|
823
|
-
parsedStyle.x = parsedStyle.x.add(new _cssom.CSSUnitValue(parsedStyle.offsetX, 'px'));
|
|
824
|
-
parsedStyle.y = parsedStyle.y.add(new _cssom.CSSUnitValue(parsedStyle.offsetY, 'px'));
|
|
825
|
-
} // init with content box
|
|
811
|
+
_d = _b.offsetX,
|
|
812
|
+
offsetX = _d === void 0 ? 0 : _d,
|
|
813
|
+
_e = _b.offsetY,
|
|
814
|
+
offsetY = _e === void 0 ? 0 : _e,
|
|
815
|
+
_f = _b.offsetZ,
|
|
816
|
+
offsetZ = _f === void 0 ? 0 : _f; // init with content box
|
|
826
817
|
|
|
827
818
|
|
|
828
819
|
var halfExtents = _glMatrix.vec3.fromValues(width / 2, height / 2, depth / 2); // anchor is center by default, don't account for lineWidth here
|
|
829
820
|
|
|
830
821
|
|
|
831
|
-
var
|
|
832
|
-
lineWidth =
|
|
833
|
-
increasedLineWidthForHitTesting =
|
|
834
|
-
shadowColor =
|
|
835
|
-
|
|
836
|
-
filter =
|
|
837
|
-
transformOrigin =
|
|
822
|
+
var _g = parsedStyle,
|
|
823
|
+
lineWidth = _g.lineWidth,
|
|
824
|
+
increasedLineWidthForHitTesting = _g.increasedLineWidthForHitTesting,
|
|
825
|
+
shadowColor = _g.shadowColor,
|
|
826
|
+
_h = _g.filter,
|
|
827
|
+
filter = _h === void 0 ? [] : _h,
|
|
828
|
+
transformOrigin = _g.transformOrigin;
|
|
838
829
|
var anchor = parsedStyle.anchor; // <Text> use textAlign & textBaseline instead of anchor
|
|
839
830
|
|
|
840
831
|
if (object.nodeName === _types.Shape.TEXT) {
|
|
@@ -845,29 +836,20 @@ function () {
|
|
|
845
836
|
|
|
846
837
|
|
|
847
838
|
geometry_1.contentBounds.update(center, halfExtents);
|
|
839
|
+
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
|
|
848
840
|
|
|
849
|
-
|
|
850
|
-
// append border
|
|
851
|
-
_glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(lineWidth.value / 2, lineWidth.value / 2, 0));
|
|
852
|
-
|
|
853
|
-
geometry_1.renderBounds.update(center, halfExtents);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
if (increasedLineWidthForHitTesting) {
|
|
857
|
-
_glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(increasedLineWidthForHitTesting.value / 2, increasedLineWidthForHitTesting.value / 2, 0));
|
|
858
|
-
|
|
859
|
-
geometry_1.hitAreaBounds.update(center, halfExtents);
|
|
860
|
-
} // account for shadow, only support constant value now
|
|
841
|
+
_glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(halfLineWidth, halfLineWidth, 0));
|
|
861
842
|
|
|
843
|
+
geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
|
|
862
844
|
|
|
863
845
|
if (shadowColor) {
|
|
864
|
-
var
|
|
865
|
-
min =
|
|
866
|
-
max =
|
|
867
|
-
var
|
|
868
|
-
shadowBlur =
|
|
869
|
-
shadowOffsetX =
|
|
870
|
-
shadowOffsetY =
|
|
846
|
+
var _j = geometry_1.renderBounds,
|
|
847
|
+
min = _j.min,
|
|
848
|
+
max = _j.max;
|
|
849
|
+
var _k = parsedStyle,
|
|
850
|
+
shadowBlur = _k.shadowBlur,
|
|
851
|
+
shadowOffsetX = _k.shadowOffsetX,
|
|
852
|
+
shadowOffsetY = _k.shadowOffsetY;
|
|
871
853
|
var shadowBlurInPixels = shadowBlur && shadowBlur.value || 0;
|
|
872
854
|
var shadowOffsetXInPixels = shadowOffsetX && shadowOffsetX.value || 0;
|
|
873
855
|
var shadowOffsetYInPixels = shadowOffsetY && shadowOffsetY.value || 0;
|
package/lib/css/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './interfaces';
|
|
|
5
5
|
export * from './cssom';
|
|
6
6
|
export * from './parser';
|
|
7
7
|
export * from './properties';
|
|
8
|
+
export * from './layout';
|
|
8
9
|
export * from './CSS';
|
|
9
10
|
export * from './CSSProperty';
|
|
10
|
-
export * from './LayoutRegistry';
|
|
11
11
|
export * from './StyleValueRegistry';
|
package/lib/css/index.js
CHANGED
|
@@ -56,41 +56,41 @@ Object.keys(_properties).forEach(function (key) {
|
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var _layout = require("./layout");
|
|
60
60
|
|
|
61
|
-
Object.keys(
|
|
61
|
+
Object.keys(_layout).forEach(function (key) {
|
|
62
62
|
if (key === "default" || key === "__esModule") return;
|
|
63
|
-
if (key in exports && exports[key] ===
|
|
63
|
+
if (key in exports && exports[key] === _layout[key]) return;
|
|
64
64
|
Object.defineProperty(exports, key, {
|
|
65
65
|
enumerable: true,
|
|
66
66
|
get: function get() {
|
|
67
|
-
return
|
|
67
|
+
return _layout[key];
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var _CSS = require("./CSS");
|
|
73
73
|
|
|
74
|
-
Object.keys(
|
|
74
|
+
Object.keys(_CSS).forEach(function (key) {
|
|
75
75
|
if (key === "default" || key === "__esModule") return;
|
|
76
|
-
if (key in exports && exports[key] ===
|
|
76
|
+
if (key in exports && exports[key] === _CSS[key]) return;
|
|
77
77
|
Object.defineProperty(exports, key, {
|
|
78
78
|
enumerable: true,
|
|
79
79
|
get: function get() {
|
|
80
|
-
return
|
|
80
|
+
return _CSS[key];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
var
|
|
85
|
+
var _CSSProperty = require("./CSSProperty");
|
|
86
86
|
|
|
87
|
-
Object.keys(
|
|
87
|
+
Object.keys(_CSSProperty).forEach(function (key) {
|
|
88
88
|
if (key === "default" || key === "__esModule") return;
|
|
89
|
-
if (key in exports && exports[key] ===
|
|
89
|
+
if (key in exports && exports[key] === _CSSProperty[key]) return;
|
|
90
90
|
Object.defineProperty(exports, key, {
|
|
91
91
|
enumerable: true,
|
|
92
92
|
get: function get() {
|
|
93
|
-
return
|
|
93
|
+
return _CSSProperty[key];
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
import { LayoutObject } from './LayoutObject';
|
|
3
|
+
import { LayoutContext } from './LayoutContext';
|
|
4
|
+
import type { LayoutFragment } from './LayoutFragment';
|
|
5
|
+
export declare const FragmentResultFactory: Syringe.DefinedToken;
|
|
6
|
+
export interface FragmentResultFactory {
|
|
7
|
+
(options: FragmentResultOptions): FragmentResult;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The web developer defined layout method can return either a FragmentResultOptions or a FragmentResult.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FragmentResultOptions: Syringe.DefinedToken;
|
|
13
|
+
export interface FragmentResultOptions<T = void> {
|
|
14
|
+
inlineSize: number;
|
|
15
|
+
blockSize: number;
|
|
16
|
+
autoBlockSize: number;
|
|
17
|
+
childFragments: LayoutFragment[];
|
|
18
|
+
data: T;
|
|
19
|
+
}
|
|
20
|
+
export declare const ContextNode: Syringe.DefinedToken;
|
|
21
|
+
export declare class FragmentResult<T = void> {
|
|
22
|
+
protected readonly _layoutContext: LayoutContext;
|
|
23
|
+
protected readonly _node: LayoutObject;
|
|
24
|
+
protected readonly options: FragmentResultOptions<T>;
|
|
25
|
+
private layoutContext;
|
|
26
|
+
readonly inlineSize: number;
|
|
27
|
+
readonly blockSize: number;
|
|
28
|
+
private node;
|
|
29
|
+
childFragments: LayoutFragment[];
|
|
30
|
+
data: T;
|
|
31
|
+
constructor(_layoutContext: LayoutContext, _node: LayoutObject, options: FragmentResultOptions<T>);
|
|
32
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FragmentResultOptions = exports.FragmentResultFactory = exports.FragmentResult = exports.ContextNode = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var _LayoutObject = require("./LayoutObject");
|
|
13
|
+
|
|
14
|
+
var _LayoutContext = require("./LayoutContext");
|
|
15
|
+
|
|
16
|
+
var FragmentResultFactory = _manaSyringe.Syringe.defineToken('FragmentResultFactory');
|
|
17
|
+
/**
|
|
18
|
+
* The web developer defined layout method can return either a FragmentResultOptions or a FragmentResult.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.FragmentResultFactory = FragmentResultFactory;
|
|
23
|
+
|
|
24
|
+
var FragmentResultOptions = _manaSyringe.Syringe.defineToken('FragmentResultOptions');
|
|
25
|
+
|
|
26
|
+
exports.FragmentResultOptions = FragmentResultOptions;
|
|
27
|
+
|
|
28
|
+
var ContextNode = _manaSyringe.Syringe.defineToken('contextNode');
|
|
29
|
+
|
|
30
|
+
exports.ContextNode = ContextNode;
|
|
31
|
+
|
|
32
|
+
var FragmentResult =
|
|
33
|
+
/** @class */
|
|
34
|
+
function () {
|
|
35
|
+
function FragmentResult(_layoutContext, _node, options) {
|
|
36
|
+
this._layoutContext = _layoutContext;
|
|
37
|
+
this._node = _node;
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.layoutContext = _layoutContext;
|
|
40
|
+
this.inlineSize = options === null || options === void 0 ? void 0 : options.inlineSize;
|
|
41
|
+
this.blockSize = options === null || options === void 0 ? void 0 : options.blockSize;
|
|
42
|
+
this.childFragments = options === null || options === void 0 ? void 0 : options.childFragments;
|
|
43
|
+
this.data = options.data;
|
|
44
|
+
this.node = _node;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
FragmentResult = (0, _tslib.__decorate)([(0, _manaSyringe.injectable)(), (0, _tslib.__param)(0, (0, _manaSyringe.inject)(_LayoutContext.LayoutContext)), (0, _tslib.__param)(1, (0, _manaSyringe.inject)(ContextNode)), (0, _tslib.__param)(2, (0, _manaSyringe.inject)(FragmentResultOptions)), (0, _tslib.__metadata)("design:paramtypes", [_LayoutContext.LayoutContext, _LayoutObject.LayoutObject, Object])], FragmentResult);
|
|
48
|
+
return FragmentResult;
|
|
49
|
+
}();
|
|
50
|
+
|
|
51
|
+
exports.FragmentResult = FragmentResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
import type { LayoutObject } from './LayoutObject';
|
|
3
|
+
import { LayoutContext } from './LayoutContext';
|
|
4
|
+
import type { LayoutFragment } from './LayoutFragment';
|
|
5
|
+
import type { IntrinsicSizes, LayoutConstraints } from './types';
|
|
6
|
+
export declare const LayoutChildrenFactory: Syringe.DefinedToken;
|
|
7
|
+
export interface LayoutChildrenFactory {
|
|
8
|
+
(options: LayoutChildrenOptions): LayoutChildren;
|
|
9
|
+
}
|
|
10
|
+
export declare const LayoutChildrenOptions: Syringe.DefinedToken;
|
|
11
|
+
export interface LayoutChildrenOptions {
|
|
12
|
+
node: LayoutObject;
|
|
13
|
+
}
|
|
14
|
+
export declare class LayoutChildren {
|
|
15
|
+
protected readonly _layoutContext: LayoutContext;
|
|
16
|
+
protected readonly options: LayoutChildrenOptions;
|
|
17
|
+
node: LayoutObject;
|
|
18
|
+
readonly styleMap: Map<string, any>;
|
|
19
|
+
layoutContext: LayoutContext;
|
|
20
|
+
constructor(_layoutContext: LayoutContext, options: LayoutChildrenOptions);
|
|
21
|
+
intrinsicSizes(): Promise<IntrinsicSizes>;
|
|
22
|
+
layoutNextFragment(constraints: LayoutConstraints): Promise<LayoutFragment>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LayoutChildrenOptions = exports.LayoutChildrenFactory = exports.LayoutChildren = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var _utils = require("../../utils");
|
|
13
|
+
|
|
14
|
+
var _LayoutContext = require("./LayoutContext");
|
|
15
|
+
|
|
16
|
+
var _types = require("./types");
|
|
17
|
+
|
|
18
|
+
var LayoutChildrenFactory = _manaSyringe.Syringe.defineToken('LayoutChildrenFactory');
|
|
19
|
+
|
|
20
|
+
exports.LayoutChildrenFactory = LayoutChildrenFactory;
|
|
21
|
+
|
|
22
|
+
var LayoutChildrenOptions = _manaSyringe.Syringe.defineToken('LayoutChildrenOptions');
|
|
23
|
+
|
|
24
|
+
exports.LayoutChildrenOptions = LayoutChildrenOptions;
|
|
25
|
+
|
|
26
|
+
var LayoutChildren =
|
|
27
|
+
/** @class */
|
|
28
|
+
function () {
|
|
29
|
+
function LayoutChildren(_layoutContext, options) {
|
|
30
|
+
this._layoutContext = _layoutContext;
|
|
31
|
+
this.options = options;
|
|
32
|
+
this.layoutContext = _layoutContext;
|
|
33
|
+
this.node = options.node;
|
|
34
|
+
this.styleMap = options.node.getAllStyle();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
LayoutChildren.prototype.intrinsicSizes = function () {
|
|
38
|
+
// if (this.contextId !== this.layoutContext.contextId) {
|
|
39
|
+
// throw new Error('Invalid State: wrong layout context');
|
|
40
|
+
// }
|
|
41
|
+
var deferred = new _utils.Deferred();
|
|
42
|
+
this.layoutContext.appendWorkTask({
|
|
43
|
+
layoutChild: this,
|
|
44
|
+
taskType: _types.LayoutTaskType.IntrinsicSizes,
|
|
45
|
+
deferred: deferred
|
|
46
|
+
});
|
|
47
|
+
return deferred.promise;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
LayoutChildren.prototype.layoutNextFragment = function (constraints) {
|
|
51
|
+
// if (this.layoutContext.contextId !== this.layoutContext.contextId) {
|
|
52
|
+
// throw new Error('Invalid State: wrong layout context');
|
|
53
|
+
// }
|
|
54
|
+
if (this.layoutContext.mode === _types.LayoutTaskType.IntrinsicSizes) {
|
|
55
|
+
throw new Error('Not Supported: cant call layoutNextFragment in intrinsicSizes');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var deferred = new _utils.Deferred();
|
|
59
|
+
this.layoutContext.appendWorkTask({
|
|
60
|
+
layoutConstraints: constraints,
|
|
61
|
+
layoutChild: this,
|
|
62
|
+
taskType: _types.LayoutTaskType.Layout,
|
|
63
|
+
deferred: deferred
|
|
64
|
+
});
|
|
65
|
+
return deferred.promise;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
LayoutChildren = (0, _tslib.__decorate)([(0, _manaSyringe.injectable)(), (0, _tslib.__param)(0, (0, _manaSyringe.inject)(_LayoutContext.LayoutContext)), (0, _tslib.__param)(1, (0, _manaSyringe.inject)(LayoutChildrenOptions)), (0, _tslib.__metadata)("design:paramtypes", [_LayoutContext.LayoutContext, Object])], LayoutChildren);
|
|
69
|
+
return LayoutChildren;
|
|
70
|
+
}();
|
|
71
|
+
|
|
72
|
+
exports.LayoutChildren = LayoutChildren;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
import type { LayoutWorkTask } from './LayoutWorkTask';
|
|
3
|
+
import type { LayoutTaskType } from './types';
|
|
4
|
+
import type { ContextId } from './types';
|
|
5
|
+
import type { FragmentResultFactory } from './FragmentResult';
|
|
6
|
+
import type { LayoutChildrenFactory } from './LayoutChildren';
|
|
7
|
+
import type { LayoutFragmentFactory } from './LayoutFragment';
|
|
8
|
+
export declare const LayoutContextFactory: Syringe.DefinedToken;
|
|
9
|
+
export interface LayoutContextFactory {
|
|
10
|
+
(options: {
|
|
11
|
+
mode: LayoutTaskType;
|
|
12
|
+
}): LayoutContext;
|
|
13
|
+
}
|
|
14
|
+
export declare const LayoutContextOptions: Syringe.DefinedToken;
|
|
15
|
+
export interface LayoutContextOptions {
|
|
16
|
+
mode: LayoutTaskType;
|
|
17
|
+
layoutChildrenFactory: LayoutChildrenFactory;
|
|
18
|
+
fragmentResultFactory: FragmentResultFactory;
|
|
19
|
+
layoutFragmentFactory: LayoutFragmentFactory;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 每次layout 有单独的 context
|
|
23
|
+
*/
|
|
24
|
+
export declare class LayoutContext {
|
|
25
|
+
protected readonly options: LayoutContextOptions;
|
|
26
|
+
contextId: ContextId;
|
|
27
|
+
workQueue: LayoutWorkTask[];
|
|
28
|
+
mode: LayoutTaskType;
|
|
29
|
+
layoutChildrenFactory: LayoutChildrenFactory;
|
|
30
|
+
fragmentResultFactory: FragmentResultFactory;
|
|
31
|
+
layoutFragmentFactory: LayoutFragmentFactory;
|
|
32
|
+
constructor(options: LayoutContextOptions);
|
|
33
|
+
appendWorkTask(work: LayoutWorkTask): void;
|
|
34
|
+
clearWorkQueue(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LayoutContextOptions = exports.LayoutContextFactory = exports.LayoutContext = void 0;
|
|
7
|
+
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
10
|
+
var _manaSyringe = require("mana-syringe");
|
|
11
|
+
|
|
12
|
+
var LayoutContextFactory = _manaSyringe.Syringe.defineToken('LayoutContextFactory');
|
|
13
|
+
|
|
14
|
+
exports.LayoutContextFactory = LayoutContextFactory;
|
|
15
|
+
|
|
16
|
+
var LayoutContextOptions = _manaSyringe.Syringe.defineToken('LayoutContextOptions');
|
|
17
|
+
|
|
18
|
+
exports.LayoutContextOptions = LayoutContextOptions;
|
|
19
|
+
var guid = 0;
|
|
20
|
+
/**
|
|
21
|
+
* 每次layout 有单独的 context
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var LayoutContext =
|
|
25
|
+
/** @class */
|
|
26
|
+
function () {
|
|
27
|
+
function LayoutContext(options) {
|
|
28
|
+
this.options = options;
|
|
29
|
+
this.workQueue = [];
|
|
30
|
+
this.contextId = "".concat(guid++);
|
|
31
|
+
this.mode = options.mode;
|
|
32
|
+
this.layoutChildrenFactory = options.layoutChildrenFactory;
|
|
33
|
+
this.fragmentResultFactory = options.fragmentResultFactory;
|
|
34
|
+
this.layoutFragmentFactory = options.layoutFragmentFactory;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
LayoutContext.prototype.appendWorkTask = function (work) {
|
|
38
|
+
this.workQueue.push(work);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
LayoutContext.prototype.clearWorkQueue = function () {
|
|
42
|
+
this.workQueue = [];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
LayoutContext = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)(), (0, _tslib.__param)(0, (0, _manaSyringe.inject)(LayoutContextOptions)), (0, _tslib.__metadata)("design:paramtypes", [Object])], LayoutContext);
|
|
46
|
+
return LayoutContext;
|
|
47
|
+
}();
|
|
48
|
+
|
|
49
|
+
exports.LayoutContext = LayoutContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IntrinsicSizes, LayoutConstraints, LayoutOptions } from './types';
|
|
2
|
+
import type { FragmentResultOptions, FragmentResult } from './FragmentResult';
|
|
3
|
+
import type { LayoutChildren } from './LayoutChildren';
|
|
4
|
+
import type { LayoutEdges } from './LayoutEdges';
|
|
5
|
+
export declare abstract class AbstractLayoutDefinition {
|
|
6
|
+
static inputProperties: string[];
|
|
7
|
+
static childrenInputProperties: string[];
|
|
8
|
+
static layoutOptions: LayoutOptions;
|
|
9
|
+
abstract intrinsicSizes(children: LayoutChildren[], edges: LayoutEdges, styleMap: Map<string, any>): Promise<IntrinsicSizes>;
|
|
10
|
+
abstract layout(children: LayoutChildren[], edges: LayoutEdges, constraints: LayoutConstraints, styleMap: Map<string, any>): Promise<FragmentResultOptions | FragmentResult>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* internal use
|
|
14
|
+
*/
|
|
15
|
+
export declare type LayoutDefinitionCtor = {
|
|
16
|
+
new (): AbstractLayoutDefinition;
|
|
17
|
+
inputProperties: string[];
|
|
18
|
+
childrenInputProperties: string[];
|
|
19
|
+
layoutOptions: LayoutOptions;
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AbstractLayoutDefinition = void 0;
|
|
7
|
+
|
|
8
|
+
var AbstractLayoutDefinition =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
11
|
+
function AbstractLayoutDefinition() {}
|
|
12
|
+
|
|
13
|
+
return AbstractLayoutDefinition;
|
|
14
|
+
}();
|
|
15
|
+
|
|
16
|
+
exports.AbstractLayoutDefinition = AbstractLayoutDefinition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
import type { LayoutObject } from './LayoutObject';
|
|
3
|
+
export declare const LayoutEdgesFactory: Syringe.DefinedToken;
|
|
4
|
+
export interface LayoutEdgesFactory {
|
|
5
|
+
(options: LayoutEdgesOptions): LayoutEdges;
|
|
6
|
+
}
|
|
7
|
+
export declare const LayoutEdgesOptions: Syringe.DefinedToken;
|
|
8
|
+
export interface LayoutEdgesOptions {
|
|
9
|
+
node: LayoutObject;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* https://drafts.css-houdini.org/css-layout-api/#layoutedges
|
|
13
|
+
* the size of border, scrollbar, padding
|
|
14
|
+
*/
|
|
15
|
+
export declare class LayoutEdges {
|
|
16
|
+
protected readonly options: LayoutEdgesOptions;
|
|
17
|
+
readonly inlineStart: number;
|
|
18
|
+
readonly inlineEnd: number;
|
|
19
|
+
readonly blockStart: number;
|
|
20
|
+
readonly blockEnd: number;
|
|
21
|
+
readonly inline: number;
|
|
22
|
+
readonly block: number;
|
|
23
|
+
constructor(options: LayoutEdgesOptions);
|
|
24
|
+
}
|