@meursyphus/flitter 0.0.9 → 1.0.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/index.global.js CHANGED
@@ -595,7 +595,7 @@
595
595
  var calculable_default = Calculable;
596
596
 
597
597
  // src/type/_types/_offset.ts
598
- var Offset = class _Offset extends calculable_default {
598
+ var _Offset = class _Offset extends calculable_default {
599
599
  constructor({ x, y }) {
600
600
  super();
601
601
  __publicField(this, "x");
@@ -622,6 +622,10 @@
622
622
  return super.minus(other);
623
623
  }
624
624
  };
625
+ __publicField(_Offset, "Constants", {
626
+ zero: Object.freeze(_Offset.raw({ x: 0, y: 0 }))
627
+ });
628
+ var Offset = _Offset;
625
629
  var offset_default = Offset;
626
630
 
627
631
  // src/type/_types/_rect.ts
@@ -1017,29 +1021,26 @@
1017
1021
  this.maxHeight = maxHeight;
1018
1022
  }
1019
1023
  static lerp(a, b, t) {
1020
- assert(
1021
- Number.isFinite(a.minWidth) && Number.isFinite(b.minWidth) || a.minWidth === Infinity && b.minWidth === Infinity,
1022
- "Cannot interpolate between finite constraints and unbounded constraints."
1023
- );
1024
- assert(
1025
- Number.isFinite(a.maxWidth) && Number.isFinite(b.maxWidth) || a.maxWidth === Infinity && b.maxWidth === Infinity,
1026
- "Cannot interpolate between finite constraints and unbounded constraints."
1027
- );
1028
- assert(
1029
- Number.isFinite(a.minHeight) && Number.isFinite(b.minHeight) || a.minHeight === Infinity && b.minHeight === Infinity,
1030
- "Cannot interpolate between finite constraints and unbounded constraints."
1031
- );
1032
- assert(
1033
- Number.isFinite(a.minHeight) && Number.isFinite(b.minHeight) || a.minHeight === Infinity && b.minHeight === Infinity,
1034
- "Cannot interpolate between finite constraints and unbounded constraints."
1035
- );
1024
+ _Constraints.validateInterpolation(a, b);
1036
1025
  return new _Constraints({
1037
- minWidth: Number.isFinite(a.minWidth) ? Utils.lerp(a.minWidth, b.minWidth, t) : Infinity,
1038
- maxWidth: Number.isFinite(a.maxWidth) ? Utils.lerp(a.maxWidth, b.maxWidth, t) : Infinity,
1039
- minHeight: Number.isFinite(a.minHeight) ? Utils.lerp(a.minHeight, b.minHeight, t) : Infinity,
1040
- maxHeight: Number.isFinite(a.maxHeight) ? Utils.lerp(a.maxHeight, b.maxHeight, t) : Infinity
1026
+ minWidth: _Constraints.interpolateDimension(a.minWidth, b.minWidth, t),
1027
+ maxWidth: _Constraints.interpolateDimension(a.maxWidth, b.maxWidth, t),
1028
+ minHeight: _Constraints.interpolateDimension(a.minHeight, b.minHeight, t),
1029
+ maxHeight: _Constraints.interpolateDimension(a.maxHeight, b.maxHeight, t)
1041
1030
  });
1042
1031
  }
1032
+ static validateInterpolation(a, b) {
1033
+ const dimensions = ["minWidth", "maxWidth", "minHeight", "maxHeight"];
1034
+ dimensions.forEach((dimension) => {
1035
+ assert(
1036
+ Number.isFinite(a[dimension]) && Number.isFinite(b[dimension]) || a[dimension] === Infinity && b[dimension] === Infinity,
1037
+ "Cannot interpolate between finite constraints and unbounded constraints."
1038
+ );
1039
+ });
1040
+ }
1041
+ static interpolateDimension(aValue, bValue, t) {
1042
+ return Number.isFinite(aValue) ? Utils.lerp(aValue, bValue, t) : Infinity;
1043
+ }
1043
1044
  static expand({
1044
1045
  width = Infinity,
1045
1046
  height = Infinity
@@ -1068,12 +1069,7 @@
1068
1069
  });
1069
1070
  }
1070
1071
  static tight({ width, height }) {
1071
- return new _Constraints({
1072
- maxHeight: height,
1073
- minHeight: height,
1074
- maxWidth: width,
1075
- minWidth: width
1076
- });
1072
+ return _Constraints.tightFor({ width, height });
1077
1073
  }
1078
1074
  static tightFor({ width, height }) {
1079
1075
  return new _Constraints({
@@ -1084,11 +1080,18 @@
1084
1080
  });
1085
1081
  }
1086
1082
  enforce(parent) {
1083
+ const minWidth = parent.constrainWidth(this.minWidth);
1084
+ const maxWidth = parent.constrainWidth(this.maxWidth);
1085
+ const minHeight = parent.constrainHeight(this.minHeight);
1086
+ const maxHeight = parent.constrainHeight(this.maxHeight);
1087
+ if (minWidth === maxWidth && minHeight === maxHeight && this.maxWidth === maxWidth && this.maxHeight === maxHeight) {
1088
+ return this;
1089
+ }
1087
1090
  return new _Constraints({
1088
- minWidth: parent.constrainWidth(this.minWidth),
1089
- maxWidth: parent.constrainWidth(this.maxWidth),
1090
- minHeight: parent.constrainHeight(this.minHeight),
1091
- maxHeight: parent.constrainHeight(this.maxHeight)
1091
+ minWidth,
1092
+ maxWidth,
1093
+ minHeight,
1094
+ maxHeight
1092
1095
  });
1093
1096
  }
1094
1097
  loosen() {
@@ -1104,10 +1107,15 @@
1104
1107
  });
1105
1108
  }
1106
1109
  normalize() {
1107
- return new _Constraints(__spreadProps(__spreadValues({}, this), {
1110
+ if (this.minWidth <= this.maxWidth && this.minHeight <= this.maxHeight) {
1111
+ return this;
1112
+ }
1113
+ return new _Constraints({
1114
+ maxHeight: Math.max(this.maxHeight, this.minHeight),
1108
1115
  minHeight: Math.min(this.minHeight, this.maxHeight),
1116
+ maxWidth: Math.max(this.maxWidth, this.minWidth),
1109
1117
  minWidth: Math.min(this.minWidth, this.maxWidth)
1110
- }));
1118
+ });
1111
1119
  }
1112
1120
  getMax(key) {
1113
1121
  return key === "width" ? this.maxWidth : this.maxHeight;
@@ -1792,42 +1800,42 @@
1792
1800
 
1793
1801
  // src/type/_types/text-direction.ts
1794
1802
  var TextDirection = /* @__PURE__ */ ((TextDirection2) => {
1795
- TextDirection2["rtl"] = "rtl";
1796
- TextDirection2["ltr"] = "ltr";
1803
+ TextDirection2[TextDirection2["rtl"] = 1] = "rtl";
1804
+ TextDirection2[TextDirection2["ltr"] = 2] = "ltr";
1797
1805
  return TextDirection2;
1798
1806
  })(TextDirection || {});
1799
1807
  var text_direction_default = TextDirection;
1800
1808
 
1801
1809
  // src/type/_types/_etc.ts
1802
1810
  var MainAxisSize = /* @__PURE__ */ ((MainAxisSize2) => {
1803
- MainAxisSize2["min"] = "min";
1804
- MainAxisSize2["max"] = "max";
1811
+ MainAxisSize2[MainAxisSize2["min"] = 1] = "min";
1812
+ MainAxisSize2[MainAxisSize2["max"] = 2] = "max";
1805
1813
  return MainAxisSize2;
1806
1814
  })(MainAxisSize || {});
1807
1815
  var VerticalDirection = /* @__PURE__ */ ((VerticalDirection2) => {
1808
- VerticalDirection2["up"] = "up";
1809
- VerticalDirection2["down"] = "down";
1816
+ VerticalDirection2[VerticalDirection2["up"] = 1] = "up";
1817
+ VerticalDirection2[VerticalDirection2["down"] = 2] = "down";
1810
1818
  return VerticalDirection2;
1811
1819
  })(VerticalDirection || {});
1812
1820
  var MainAxisAlignment = /* @__PURE__ */ ((MainAxisAlignment2) => {
1813
- MainAxisAlignment2["start"] = "start";
1814
- MainAxisAlignment2["end"] = "end";
1815
- MainAxisAlignment2["center"] = "center";
1816
- MainAxisAlignment2["spaceBetween"] = "spaceBetween";
1817
- MainAxisAlignment2["spaceAround"] = "spaceAround";
1818
- MainAxisAlignment2["spaceEvenly"] = "spaceEvenly";
1821
+ MainAxisAlignment2[MainAxisAlignment2["start"] = 1] = "start";
1822
+ MainAxisAlignment2[MainAxisAlignment2["end"] = 2] = "end";
1823
+ MainAxisAlignment2[MainAxisAlignment2["center"] = 3] = "center";
1824
+ MainAxisAlignment2[MainAxisAlignment2["spaceBetween"] = 4] = "spaceBetween";
1825
+ MainAxisAlignment2[MainAxisAlignment2["spaceAround"] = 5] = "spaceAround";
1826
+ MainAxisAlignment2[MainAxisAlignment2["spaceEvenly"] = 6] = "spaceEvenly";
1819
1827
  return MainAxisAlignment2;
1820
1828
  })(MainAxisAlignment || {});
1821
1829
  var CrossAxisAlignment = /* @__PURE__ */ ((CrossAxisAlignment2) => {
1822
- CrossAxisAlignment2["start"] = "start";
1823
- CrossAxisAlignment2["end"] = "end";
1824
- CrossAxisAlignment2["center"] = "center";
1825
- CrossAxisAlignment2["stretch"] = "stretch";
1830
+ CrossAxisAlignment2[CrossAxisAlignment2["start"] = 1] = "start";
1831
+ CrossAxisAlignment2[CrossAxisAlignment2["end"] = 2] = "end";
1832
+ CrossAxisAlignment2[CrossAxisAlignment2["center"] = 3] = "center";
1833
+ CrossAxisAlignment2[CrossAxisAlignment2["stretch"] = 4] = "stretch";
1826
1834
  return CrossAxisAlignment2;
1827
1835
  })(CrossAxisAlignment || {});
1828
1836
  var Axis = /* @__PURE__ */ ((Axis2) => {
1829
- Axis2["horizontal"] = "horizontal";
1830
- Axis2["vertical"] = "vertical";
1837
+ Axis2[Axis2["horizontal"] = 1] = "horizontal";
1838
+ Axis2[Axis2["vertical"] = 2] = "vertical";
1831
1839
  return Axis2;
1832
1840
  })(Axis || {});
1833
1841
 
@@ -9829,7 +9837,7 @@
9829
9837
  var vector3_default = Vector3;
9830
9838
 
9831
9839
  // src/type/_types/_matrix4.ts
9832
- var Matrix4 = class _Matrix4 extends calculable_default {
9840
+ var _Matrix4 = class _Matrix4 extends calculable_default {
9833
9841
  constructor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15) {
9834
9842
  super();
9835
9843
  // 4 x 4 matrix
@@ -10366,6 +10374,9 @@
10366
10374
  return this;
10367
10375
  }
10368
10376
  translated(x, y, z) {
10377
+ if ((y == null || y === 0) && (z == null || z === 0) && x === 0) {
10378
+ return this;
10379
+ }
10369
10380
  return this.clone().translate(x, y, z);
10370
10381
  }
10371
10382
  /**
@@ -11236,42 +11247,6 @@
11236
11247
  this._m4storage[11] = m30 * argStorage[2] + m31 * argStorage[6] + m32 * argStorage[10] + m33 * argStorage[14];
11237
11248
  this._m4storage[15] = m30 * argStorage[3] + m31 * argStorage[7] + m32 * argStorage[11] + m33 * argStorage[15];
11238
11249
  }
11239
- // /// Decomposes this into [translation], [rotation] and [scale] components.
11240
- // void decompose(Vector3 translation, Quaternion rotation, Vector3 scale) {
11241
- // final v = _decomposeV ??= Vector3.zero();
11242
- // var sx = (v..setValues(_m4storage[0], _m4storage[1], _m4storage[2])).length;
11243
- // final sy =
11244
- // (v..setValues(_m4storage[4], _m4storage[5], _m4storage[6])).length;
11245
- // final sz =
11246
- // (v..setValues(_m4storage[8], _m4storage[9], _m4storage[10])).length;
11247
- // if (determinant() < 0) {
11248
- // sx = -sx;
11249
- // }
11250
- // translation._v3storage[0] = _m4storage[12];
11251
- // translation._v3storage[1] = _m4storage[13];
11252
- // translation._v3storage[2] = _m4storage[14];
11253
- // final invSX = 1.0 / sx;
11254
- // final invSY = 1.0 / sy;
11255
- // final invSZ = 1.0 / sz;
11256
- // final m = _decomposeM ??= Matrix4.zero();
11257
- // m.setFrom(this);
11258
- // m._m4storage[0] *= invSX;
11259
- // m._m4storage[1] *= invSX;
11260
- // m._m4storage[2] *= invSX;
11261
- // m._m4storage[4] *= invSY;
11262
- // m._m4storage[5] *= invSY;
11263
- // m._m4storage[6] *= invSY;
11264
- // m._m4storage[8] *= invSZ;
11265
- // m._m4storage[9] *= invSZ;
11266
- // m._m4storage[10] *= invSZ;
11267
- // final r = _decomposeR ??= Matrix3.zero();
11268
- // m.copyRotation(r);
11269
- // rotation.setFromRotation(r);
11270
- // scale._v3storage[0] = sx;
11271
- // scale._v3storage[1] = sy;
11272
- // scale._v3storage[2] = sz;
11273
- // }
11274
- /// Rotate [arg] of type [Vector3] using the rotation defined by this.
11275
11250
  rotate3(arg) {
11276
11251
  const argStorage = arg._v3storage;
11277
11252
  const x = this._m4storage[0] * argStorage[0] + this._m4storage[4] * argStorage[1] + this._m4storage[8] * argStorage[2];
@@ -11386,13 +11361,17 @@
11386
11361
  this._m4storage[13] == 0 && this._m4storage[14] == 0 && this._m4storage[15] == 0;
11387
11362
  }
11388
11363
  };
11364
+ __publicField(_Matrix4, "Constants", {
11365
+ identity: Object.freeze(_Matrix4.identity())
11366
+ });
11367
+ var Matrix4 = _Matrix4;
11389
11368
  var matrix4_default = Matrix4;
11390
11369
 
11391
11370
  // src/type/_types/stack-fit.ts
11392
11371
  var StackFit = /* @__PURE__ */ ((StackFit2) => {
11393
- StackFit2["loose"] = "loose";
11394
- StackFit2["expand"] = "expand";
11395
- StackFit2["passthrough"] = "passthrough";
11372
+ StackFit2[StackFit2["loose"] = 1] = "loose";
11373
+ StackFit2[StackFit2["expand"] = 2] = "expand";
11374
+ StackFit2[StackFit2["passthrough"] = 3] = "passthrough";
11396
11375
  return StackFit2;
11397
11376
  })(StackFit || {});
11398
11377
  var stack_fit_default = StackFit;
@@ -11489,7 +11468,7 @@
11489
11468
 
11490
11469
  // src/type/_types/border-style.ts
11491
11470
  var BorderStyle = /* @__PURE__ */ ((BorderStyle2) => {
11492
- BorderStyle2["normal"] = "normal";
11471
+ BorderStyle2[BorderStyle2["normal"] = 1] = "normal";
11493
11472
  return BorderStyle2;
11494
11473
  })(BorderStyle || {});
11495
11474
  var border_style_default = BorderStyle;
@@ -12239,12 +12218,6 @@
12239
12218
  return true;
12240
12219
  return this.color === other.color && this.offset.equals(other.offset) && this.blurRadius === other.blurRadius;
12241
12220
  }
12242
- /**
12243
- * @deprecated The method should not be used
12244
- */
12245
- eqaul(other) {
12246
- return this.equals(other);
12247
- }
12248
12221
  };
12249
12222
  var box_shadow_default = BoxShadow;
12250
12223
 
@@ -12408,36 +12381,36 @@
12408
12381
 
12409
12382
  // src/type/_types/text-align.ts
12410
12383
  var TextAlign = /* @__PURE__ */ ((TextAlign2) => {
12411
- TextAlign2["left"] = "left";
12412
- TextAlign2["right"] = "right";
12413
- TextAlign2["center"] = "center";
12414
- TextAlign2["start"] = "start";
12415
- TextAlign2["end"] = "end";
12384
+ TextAlign2[TextAlign2["left"] = 1] = "left";
12385
+ TextAlign2[TextAlign2["right"] = 2] = "right";
12386
+ TextAlign2[TextAlign2["center"] = 3] = "center";
12387
+ TextAlign2[TextAlign2["start"] = 4] = "start";
12388
+ TextAlign2[TextAlign2["end"] = 5] = "end";
12416
12389
  return TextAlign2;
12417
12390
  })(TextAlign || {});
12418
12391
  var text_align_default = TextAlign;
12419
12392
 
12420
12393
  // src/type/_types/text-overflow.ts
12421
12394
  var TextOverflow = /* @__PURE__ */ ((TextOverflow2) => {
12422
- TextOverflow2["clip"] = "clip";
12423
- TextOverflow2["visible"] = "visible";
12424
- TextOverflow2["ellipsis"] = "ellipsis";
12395
+ TextOverflow2[TextOverflow2["clip"] = 1] = "clip";
12396
+ TextOverflow2[TextOverflow2["visible"] = 2] = "visible";
12397
+ TextOverflow2[TextOverflow2["ellipsis"] = 3] = "ellipsis";
12425
12398
  return TextOverflow2;
12426
12399
  })(TextOverflow || {});
12427
12400
  var text_overflow_default = TextOverflow;
12428
12401
 
12429
12402
  // src/type/_types/text-width-basis.ts
12430
12403
  var TextWidthBasis = /* @__PURE__ */ ((TextWidthBasis2) => {
12431
- TextWidthBasis2["parent"] = "parent";
12432
- TextWidthBasis2["longestLine"] = "longestLine";
12404
+ TextWidthBasis2[TextWidthBasis2["parent"] = 1] = "parent";
12405
+ TextWidthBasis2[TextWidthBasis2["longestLine"] = 2] = "longestLine";
12433
12406
  return TextWidthBasis2;
12434
12407
  })(TextWidthBasis || {});
12435
12408
  var text_width_basis_default = TextWidthBasis;
12436
12409
 
12437
12410
  // src/type/_types/text-baseline.ts
12438
12411
  var TextBaseline = /* @__PURE__ */ ((TextBaseline2) => {
12439
- TextBaseline2["alphabetic"] = "alphabetic";
12440
- TextBaseline2["ideographic"] = "ideographic";
12412
+ TextBaseline2[TextBaseline2["alphabetic"] = 1] = "alphabetic";
12413
+ TextBaseline2[TextBaseline2["ideographic"] = 2] = "ideographic";
12441
12414
  return TextBaseline2;
12442
12415
  })(TextBaseline || {});
12443
12416
  var text_baseline_default = TextBaseline;
@@ -12579,9 +12552,9 @@
12579
12552
  static equals(targets, values) {
12580
12553
  if (targets.length !== values.length)
12581
12554
  return false;
12582
- return targets.every((value, i) => values[i].eqauls(value));
12555
+ return targets.every((value, i) => values[i].equals(value));
12583
12556
  }
12584
- eqauls(other) {
12557
+ equals(other) {
12585
12558
  if (this.style != null || other.style != null) {
12586
12559
  return this.style.equals(other.style);
12587
12560
  }
@@ -12617,7 +12590,7 @@
12617
12590
  this.children = children;
12618
12591
  this.text = text;
12619
12592
  }
12620
- eqauls(other) {
12593
+ equals(other) {
12621
12594
  if (other === this)
12622
12595
  return true;
12623
12596
  return this.text === other.text && Inline_span_default.equals(this.children, other.children);
@@ -12682,8 +12655,8 @@
12682
12655
  __publicField(this, "needsPaint", true);
12683
12656
  __publicField(this, "needsLayout", true);
12684
12657
  __publicField(this, "clipId");
12685
- __publicField(this, "matrix", matrix4_default.identity());
12686
- __publicField(this, "opacity", 0);
12658
+ __publicField(this, "matrix", matrix4_default.Constants.identity);
12659
+ __publicField(this, "opacity", 1);
12687
12660
  __publicField(this, "depth", 0);
12688
12661
  __privateAdd(this, _domNode, void 0);
12689
12662
  /**
@@ -12750,9 +12723,12 @@
12750
12723
  this.needsLayout = false;
12751
12724
  this.markNeedsPaint();
12752
12725
  }
12753
- paint(context, clipId, matrix4 = matrix4_default.identity(), opacity = 1) {
12726
+ paint(context, clipId, matrix4 = matrix4_default.Constants.identity, opacity = 1) {
12754
12727
  const translatedMatrix4 = matrix4.translated(this.offset.x, this.offset.y);
12755
- if (this.clipId === clipId && this.matrix.equals(translatedMatrix4) && this.opacity === opacity && !this.needsPaint) {
12728
+ const clipIdChanged = this.clipId !== clipId;
12729
+ const opacityChanged = this.opacity !== opacity;
12730
+ const matrixChanged = !this.matrix.equals(translatedMatrix4);
12731
+ if (!clipIdChanged && !opacityChanged && !matrixChanged && !this.needsPaint) {
12756
12732
  return;
12757
12733
  }
12758
12734
  this.matrix = translatedMatrix4;
@@ -12760,14 +12736,17 @@
12760
12736
  this.opacity = opacity;
12761
12737
  if (this.isPainter) {
12762
12738
  const { svgEls, container } = this.resolveSvgEl();
12763
- if (clipId) {
12739
+ if (clipId && clipIdChanged) {
12764
12740
  container.setAttribute("clip-path", `url(#${clipId})`);
12765
12741
  }
12766
- container.setAttribute("opacity", `${opacity}`);
12767
- container.setAttribute("pointer-events", "none");
12768
- Object.values(svgEls).forEach(
12769
- (el) => this.setSvgTransform(el, this.matrix)
12770
- );
12742
+ if (opacityChanged) {
12743
+ container.setAttribute("opacity", `${opacity}`);
12744
+ }
12745
+ if (matrixChanged) {
12746
+ Object.values(svgEls).forEach(
12747
+ (el) => this.setSvgTransform(el, this.matrix)
12748
+ );
12749
+ }
12771
12750
  if (this.needsPaint) {
12772
12751
  this.performPaint(svgEls, context);
12773
12752
  }
@@ -12823,16 +12802,17 @@
12823
12802
  mountSvgEl(context) {
12824
12803
  const { appendSvgEl } = context;
12825
12804
  const svgEls = this.createDefaultSvgEl(context);
12826
- Object.entries(svgEls).forEach(([name, value]) => {
12805
+ const entries = Object.entries(svgEls);
12806
+ entries.forEach(([name, value]) => {
12827
12807
  value.setAttribute("data-render-name", name);
12828
12808
  });
12829
- const values = Object.values(svgEls);
12830
12809
  const svgG = context.createSvgEl("g");
12831
12810
  appendSvgEl(svgG);
12832
12811
  svgG.setAttribute("data-render-type", this.type);
12833
- values.forEach((value) => {
12812
+ entries.forEach(([_, value]) => {
12834
12813
  svgG.appendChild(value);
12835
12814
  });
12815
+ svgG.setAttribute("pointer-events", "none");
12836
12816
  __privateSet(this, _domNode, svgG);
12837
12817
  }
12838
12818
  resolveSvgEl() {
@@ -12856,12 +12836,11 @@
12856
12836
  }
12857
12837
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
12858
12838
  createDefaultSvgEl(paintContext) {
12859
- throw { message: "not implemented defaultSvgEl" };
12839
+ throw new NotImplementedError("createDefaultSvgEl");
12860
12840
  }
12861
12841
  /*
12862
12842
  * Do not call this method directly. instead call layout
12863
12843
  */
12864
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12865
12844
  preformLayout() {
12866
12845
  throw new NotImplementedError("performLayout");
12867
12846
  }
@@ -12900,16 +12879,14 @@
12900
12879
  didChangeDomOrder() {
12901
12880
  this.renderOwner.didDomOrderChange();
12902
12881
  }
12903
- localToGlobal(additionalOffset = offset_default.zero()) {
12882
+ localToGlobal(additionalOffset = offset_default.Constants.zero) {
12904
12883
  return new offset_default({
12905
12884
  x: this.matrix.storage[12] + additionalOffset.x,
12906
12885
  y: this.matrix.storage[13] + additionalOffset.y
12907
12886
  });
12908
12887
  }
12909
12888
  visitChildren(callback) {
12910
- this.children.forEach((child) => {
12911
- callback(child);
12912
- });
12889
+ this.children.forEach(callback);
12913
12890
  }
12914
12891
  /**
12915
12892
  * It is currently only used on ZIndexRenderObject
@@ -12920,13 +12897,11 @@
12920
12897
  hitTest({ globalPoint }) {
12921
12898
  const viewPort = this.renderOwner.renderContext.viewPort;
12922
12899
  const { translation, scale: scale2 } = viewPort;
12923
- const bounds = {
12924
- left: (this.matrix.storage[12] + translation.x) * scale2,
12925
- top: (this.matrix.storage[13] + translation.y) * scale2,
12926
- right: (this.matrix.storage[12] + translation.x + this.size.width) * scale2,
12927
- bottom: (this.matrix.storage[13] + translation.y + this.size.height) * scale2
12928
- };
12929
- return globalPoint.x >= bounds.left && globalPoint.x <= bounds.right && globalPoint.y >= bounds.top && globalPoint.y <= bounds.bottom;
12900
+ const left = (this.matrix.storage[12] + translation.x) * scale2;
12901
+ const top = (this.matrix.storage[13] + translation.y) * scale2;
12902
+ const right = left + this.size.width * scale2;
12903
+ const bottom = top + this.size.height * scale2;
12904
+ return globalPoint.x >= left && globalPoint.x <= right && globalPoint.y >= top && globalPoint.y <= bottom;
12930
12905
  }
12931
12906
  };
12932
12907
  _domNode = new WeakMap();
@@ -12994,7 +12969,7 @@
12994
12969
  __publicField(this, "parent");
12995
12970
  __publicField(this, "dirty", true);
12996
12971
  __publicField(this, "depth", 0);
12997
- __publicField(this, "type", "none");
12972
+ __publicField(this, "type", 0 /* none */);
12998
12973
  this.widget = widget;
12999
12974
  }
13000
12975
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -13004,7 +12979,9 @@
13004
12979
  get renderObject() {
13005
12980
  let result = null;
13006
12981
  this.visitChildren((child) => {
13007
- result = child.renderObject;
12982
+ if (result == null) {
12983
+ result = child.renderObject;
12984
+ }
13008
12985
  });
13009
12986
  if (result == null)
13010
12987
  throw { message: "can not find render object" };
@@ -13082,7 +13059,7 @@
13082
13059
  super(widget);
13083
13060
  __publicField(this, "children");
13084
13061
  __publicField(this, "_renderObject");
13085
- __publicField(this, "type", "render");
13062
+ __publicField(this, "type", 2 /* render */);
13086
13063
  __publicField(this, "ancestorRenderObjectElement");
13087
13064
  }
13088
13065
  createRenderObject() {
@@ -13153,7 +13130,7 @@
13153
13130
  }
13154
13131
  findAncestorRenderObjectElement() {
13155
13132
  let ancestor = this.parent;
13156
- while (ancestor != null && ancestor.type !== "render") {
13133
+ while (ancestor != null && ancestor.type !== 2 /* render */) {
13157
13134
  ancestor = ancestor.parent;
13158
13135
  }
13159
13136
  return ancestor;
@@ -13843,7 +13820,7 @@
13843
13820
  this.rebuild({ force: true });
13844
13821
  }
13845
13822
  initState() {
13846
- throw new Error("not implemented initState on compoenent element");
13823
+ throw new Error("not implemented initState on component element");
13847
13824
  }
13848
13825
  build() {
13849
13826
  throw new Error("not implemented build on component element");
@@ -13939,7 +13916,7 @@
13939
13916
  while (parent != null) {
13940
13917
  const current = parent;
13941
13918
  parent = current.parent;
13942
- if (!(current.type === "provider"))
13919
+ if (!(current.type === 1 /* provider */))
13943
13920
  continue;
13944
13921
  if (current.providerKey !== key)
13945
13922
  continue;
@@ -13951,11 +13928,11 @@
13951
13928
  return new ProviderElement(this);
13952
13929
  }
13953
13930
  };
13954
- var _ProviderElement = class _ProviderElement extends Element_default {
13931
+ var ProviderElement = class extends Element_default {
13955
13932
  constructor(widget) {
13956
13933
  super(widget);
13957
13934
  __publicField(this, "child");
13958
- __publicField(this, "type", _ProviderElement.type);
13935
+ __publicField(this, "type", 1 /* provider */);
13959
13936
  this.widget = widget;
13960
13937
  }
13961
13938
  get providerKey() {
@@ -13979,8 +13956,6 @@
13979
13956
  this.child = this.updateChild(this.child, this.child.widget);
13980
13957
  }
13981
13958
  };
13982
- __publicField(_ProviderElement, "type", "provider");
13983
- var ProviderElement = _ProviderElement;
13984
13959
  function ProviderFn(props) {
13985
13960
  return new Provider(props);
13986
13961
  }
@@ -15645,10 +15620,10 @@
15645
15620
  constructor({
15646
15621
  children,
15647
15622
  direction,
15648
- mainAxisAlignment = "start" /* start */,
15649
- crossAxisAlignment = "center" /* center */,
15650
- verticalDirection = "down" /* down */,
15651
- mainAxisSize = "max" /* max */,
15623
+ mainAxisAlignment = 1 /* start */,
15624
+ crossAxisAlignment = 3 /* center */,
15625
+ verticalDirection = 2 /* down */,
15626
+ mainAxisSize = 2 /* max */,
15652
15627
  key
15653
15628
  }) {
15654
15629
  super({ children, key });
@@ -15745,27 +15720,27 @@
15745
15720
  this.markNeedsLayout();
15746
15721
  }
15747
15722
  get mainAxisSizeName() {
15748
- return this.direction === "horizontal" ? "width" : "height";
15723
+ return this.direction === 1 /* horizontal */ ? "width" : "height";
15749
15724
  }
15750
15725
  get crossAxisSizeName() {
15751
- return this.direction === "horizontal" ? "height" : "width";
15726
+ return this.direction === 1 /* horizontal */ ? "height" : "width";
15752
15727
  }
15753
15728
  get minMainAxisSizeName() {
15754
- return this.direction === "horizontal" ? "minWidth" : "minHeight";
15729
+ return this.direction === 1 /* horizontal */ ? "minWidth" : "minHeight";
15755
15730
  }
15756
15731
  get maxMainAxisSizeName() {
15757
- return this.direction === "horizontal" ? "maxWidth" : "maxHeight";
15732
+ return this.direction === 1 /* horizontal */ ? "maxWidth" : "maxHeight";
15758
15733
  }
15759
15734
  get minCrossAxisSizeName() {
15760
- return this.direction === "horizontal" ? "minHeight" : "minWidth";
15735
+ return this.direction === 1 /* horizontal */ ? "minHeight" : "minWidth";
15761
15736
  }
15762
15737
  get maxCrossAxisSizeName() {
15763
- return this.direction === "horizontal" ? "maxHeight" : "maxWidth";
15738
+ return this.direction === 1 /* horizontal */ ? "maxHeight" : "maxWidth";
15764
15739
  }
15765
15740
  preformLayout() {
15766
15741
  let totalFlex = 0;
15767
15742
  let [childIntrinsicMainAxisValue, crossAxisValue] = [0, 0];
15768
- const sortedChildren = this.verticalDirection === "down" ? this.children : [...this.children].reverse();
15743
+ const sortedChildren = this.verticalDirection === 2 /* down */ ? this.children : [...this.children].reverse();
15769
15744
  sortedChildren.forEach((child) => {
15770
15745
  child.layout(this.constraints.loosen());
15771
15746
  const flex = (child == null ? void 0 : child.isRenderFlexible) ? child.flex : 0;
@@ -15773,7 +15748,7 @@
15773
15748
  if (flex === 0) {
15774
15749
  childIntrinsicMainAxisValue += child.size[this.mainAxisSizeName];
15775
15750
  }
15776
- crossAxisValue = this.crossAxisAlignment === "stretch" ? this.constraints.getMax(this.crossAxisSizeName) : Math.max(crossAxisValue, child.size[this.crossAxisSizeName]);
15751
+ crossAxisValue = this.crossAxisAlignment === 4 /* stretch */ ? this.constraints.getMax(this.crossAxisSizeName) : Math.max(crossAxisValue, child.size[this.crossAxisSizeName]);
15777
15752
  });
15778
15753
  const flexUnitSize = (this.constraints.getMax(this.mainAxisSizeName) - childIntrinsicMainAxisValue) / totalFlex;
15779
15754
  sortedChildren.forEach((child) => {
@@ -15793,7 +15768,7 @@
15793
15768
  });
15794
15769
  this.size = this.constraints.constrain(
15795
15770
  new size_default({
15796
- [this.mainAxisSizeName]: this.mainAxisSize === "max" ? this.constraints.getMax(this.mainAxisSizeName) : sortedChildren.map((child) => child.size[this.mainAxisSizeName]).reduce((acc, childMainAxisSize) => acc + childMainAxisSize, 0),
15771
+ [this.mainAxisSizeName]: this.mainAxisSize === 2 /* max */ ? this.constraints.getMax(this.mainAxisSizeName) : sortedChildren.map((child) => child.size[this.mainAxisSizeName]).reduce((acc, childMainAxisSize) => acc + childMainAxisSize, 0),
15797
15772
  [this.crossAxisSizeName]: crossAxisValue
15798
15773
  })
15799
15774
  );
@@ -15801,7 +15776,7 @@
15801
15776
  sortedChildren.map(({ size }) => size[this.mainAxisSizeName])
15802
15777
  );
15803
15778
  sortedChildren.forEach((child, i) => {
15804
- const [mainAxisOffset, crossAxisOffset] = this.direction === "horizontal" ? ["x", "y"] : ["y", "x"];
15779
+ const [mainAxisOffset, crossAxisOffset] = this.direction === 1 /* horizontal */ ? ["x", "y"] : ["y", "x"];
15805
15780
  child.offset = new offset_default({
15806
15781
  [mainAxisOffset]: mainAxisOffsets[i],
15807
15782
  [crossAxisOffset]: this.getChildOffsetOnCrossAxis(
@@ -15811,7 +15786,7 @@
15811
15786
  });
15812
15787
  }
15813
15788
  getNonFlexItemConstraint(crossAxisValue) {
15814
- if (this.crossAxisAlignment === "stretch" /* stretch */) {
15789
+ if (this.crossAxisAlignment === 4 /* stretch */) {
15815
15790
  return constraints_default.tightFor({
15816
15791
  [this.crossAxisSizeName]: crossAxisValue
15817
15792
  });
@@ -15820,7 +15795,7 @@
15820
15795
  }
15821
15796
  getFlexItemConstraint(childExtent, fit) {
15822
15797
  return new constraints_default({
15823
- [this.minCrossAxisSizeName]: this.crossAxisAlignment === "stretch" ? this.constraints[this.maxCrossAxisSizeName] : 0,
15798
+ [this.minCrossAxisSizeName]: this.crossAxisAlignment === 4 /* stretch */ ? this.constraints[this.maxCrossAxisSizeName] : 0,
15824
15799
  [this.maxCrossAxisSizeName]: this.constraints[this.maxCrossAxisSizeName],
15825
15800
  [this.maxMainAxisSizeName]: childExtent,
15826
15801
  [this.minMainAxisSizeName]: fit === "tight" ? childExtent : 0
@@ -15831,21 +15806,21 @@
15831
15806
  const sum = (acc, value) => acc + value;
15832
15807
  const restSpaceSize = this.size[this.mainAxisSizeName] - childMainAxisValues.reduce(sum, 0);
15833
15808
  switch (this.mainAxisAlignment) {
15834
- case "start":
15809
+ case 1 /* start */:
15835
15810
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15836
15811
  startOffset: 0,
15837
15812
  additionalSpace: 0,
15838
15813
  childMainAxisValues
15839
15814
  });
15840
15815
  break;
15841
- case "end":
15816
+ case 2 /* end */:
15842
15817
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15843
15818
  startOffset: restSpaceSize,
15844
15819
  additionalSpace: 0,
15845
15820
  childMainAxisValues
15846
15821
  });
15847
15822
  break;
15848
- case "spaceAround":
15823
+ case 5 /* spaceAround */:
15849
15824
  const aroundSpace = restSpaceSize / childMainAxisValues.length;
15850
15825
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15851
15826
  startOffset: aroundSpace / 2,
@@ -15853,14 +15828,14 @@
15853
15828
  childMainAxisValues
15854
15829
  });
15855
15830
  break;
15856
- case "spaceBetween":
15831
+ case 4 /* spaceBetween */:
15857
15832
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15858
15833
  startOffset: 0,
15859
15834
  additionalSpace: restSpaceSize / (childMainAxisValues.length - 1),
15860
15835
  childMainAxisValues
15861
15836
  });
15862
15837
  break;
15863
- case "spaceEvenly":
15838
+ case 6 /* spaceEvenly */:
15864
15839
  const evenSpace = restSpaceSize / (childMainAxisValues.length + 1);
15865
15840
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15866
15841
  startOffset: evenSpace,
@@ -15868,7 +15843,7 @@
15868
15843
  childMainAxisValues
15869
15844
  });
15870
15845
  break;
15871
- case "center":
15846
+ case 3 /* center */:
15872
15847
  offsetsOnMainAxis = this._getChildOffsetsOnMainAxis({
15873
15848
  startOffset: restSpaceSize / 2,
15874
15849
  additionalSpace: 0,
@@ -15877,7 +15852,7 @@
15877
15852
  break;
15878
15853
  default:
15879
15854
  throw new Error(
15880
- `this mainAixsAlignment(${this.mainAxisAlignment}) is not supported yet`
15855
+ `this mainAxisAlignment(${this.mainAxisAlignment}) is not supported yet`
15881
15856
  );
15882
15857
  }
15883
15858
  return offsetsOnMainAxis;
@@ -15899,16 +15874,16 @@
15899
15874
  const parentCrossAxisValue = this.size[this.crossAxisSizeName];
15900
15875
  let offsetOnCrossAxis;
15901
15876
  switch (this.crossAxisAlignment) {
15902
- case "center" /* center */:
15877
+ case 3 /* center */:
15903
15878
  offsetOnCrossAxis = (parentCrossAxisValue - childCrossAxisValue) / 2;
15904
15879
  break;
15905
- case "start" /* start */:
15880
+ case 1 /* start */:
15906
15881
  offsetOnCrossAxis = 0;
15907
15882
  break;
15908
- case "end" /* end */:
15883
+ case 2 /* end */:
15909
15884
  offsetOnCrossAxis = parentCrossAxisValue - childCrossAxisValue;
15910
15885
  break;
15911
- case "stretch" /* stretch */:
15886
+ case 4 /* stretch */:
15912
15887
  offsetOnCrossAxis = 0;
15913
15888
  break;
15914
15889
  }
@@ -15920,7 +15895,7 @@
15920
15895
  const childIntrinsicHeights = this.children.map(
15921
15896
  (child) => child.getIntrinsicHeight(width)
15922
15897
  );
15923
- return this.direction === "horizontal" ? childIntrinsicHeights.reduce(max, 0) : childIntrinsicHeights.reduce(sum, 0);
15898
+ return this.direction === 1 /* horizontal */ ? childIntrinsicHeights.reduce(max, 0) : childIntrinsicHeights.reduce(sum, 0);
15924
15899
  }
15925
15900
  getIntrinsicWidth(height) {
15926
15901
  const sum = (acc, value) => acc + value;
@@ -15928,7 +15903,7 @@
15928
15903
  const childIntrinsicWidths = this.children.map(
15929
15904
  (child) => child.getIntrinsicWidth(height)
15930
15905
  );
15931
- return this.direction === "vertical" ? childIntrinsicWidths.reduce(max, 0) : childIntrinsicWidths.reduce(sum, 0);
15906
+ return this.direction === 2 /* vertical */ ? childIntrinsicWidths.reduce(max, 0) : childIntrinsicWidths.reduce(sum, 0);
15932
15907
  }
15933
15908
  };
15934
15909
  var BaseFlex_default = Flex;
@@ -15977,7 +15952,7 @@
15977
15952
  return Flex2({
15978
15953
  key,
15979
15954
  children,
15980
- direction: "vertical" /* vertical */,
15955
+ direction: 2 /* vertical */,
15981
15956
  mainAxisAlignment,
15982
15957
  crossAxisAlignment,
15983
15958
  verticalDirection,
@@ -15996,7 +15971,7 @@
15996
15971
  }) {
15997
15972
  return Flex2({
15998
15973
  children,
15999
- direction: "horizontal" /* horizontal */,
15974
+ direction: 1 /* horizontal */,
16000
15975
  mainAxisAlignment,
16001
15976
  crossAxisAlignment,
16002
15977
  verticalDirection,
@@ -16247,10 +16222,10 @@
16247
16222
  }
16248
16223
  get resolvedTextAlign() {
16249
16224
  if (this.textAlign === text_align_default.start) {
16250
- return this.textDirection === text_direction_default.ltr ? "left" : "right";
16225
+ return this.textDirection === text_direction_default.ltr ? text_align_default.left : text_align_default.right;
16251
16226
  }
16252
16227
  if (this.textAlign === text_align_default.end) {
16253
- return this.textDirection === text_direction_default.ltr ? "right" : "left";
16228
+ return this.textDirection === text_direction_default.ltr ? text_align_default.right : text_align_default.left;
16254
16229
  }
16255
16230
  return this.textAlign;
16256
16231
  }
@@ -16260,7 +16235,7 @@
16260
16235
  fontWeight = defaultTextStyle.fontWeight,
16261
16236
  content = "",
16262
16237
  height = 1.2,
16263
- fontStyle = "normal" /* normal */,
16238
+ fontStyle = 1 /* normal */,
16264
16239
  color: color2 = defaultTextStyle.fontColor
16265
16240
  }) {
16266
16241
  this.source.push({
@@ -16323,13 +16298,13 @@
16323
16298
  spanBox.offset.y = offsetY - spanBox.size.height + this.height;
16324
16299
  });
16325
16300
  switch (textAlign) {
16326
- case "left":
16301
+ case text_align_default.left:
16327
16302
  this.alignHorizontally(0);
16328
16303
  break;
16329
- case "right":
16304
+ case text_align_default.right:
16330
16305
  this.alignHorizontally(paragraphWidth - this.width);
16331
16306
  break;
16332
- case "center":
16307
+ case text_align_default.center:
16333
16308
  this.alignHorizontally((paragraphWidth - this.width) / 2);
16334
16309
  break;
16335
16310
  }
@@ -16452,7 +16427,7 @@
16452
16427
  return this.textPainter.text;
16453
16428
  }
16454
16429
  set text(value) {
16455
- if (this.textPainter.text.eqauls(value))
16430
+ if (this.textPainter.text.equals(value))
16456
16431
  return;
16457
16432
  this.textPainter.text = value;
16458
16433
  this.markNeedsLayout();
@@ -16889,20 +16864,16 @@
16889
16864
  const shrinkWrapHeight = this.heightFactor != null || constraints.maxHeight == Infinity;
16890
16865
  if (this.child != null) {
16891
16866
  this.child.layout(constraints.loosen());
16892
- this.size = constraints.constrain(
16893
- new size_default({
16894
- width: shrinkWrapWidth ? this.child.size.width * ((_a = this.widthFactor) != null ? _a : 1) : Infinity,
16895
- height: shrinkWrapHeight ? this.child.size.height * ((_b = this.heightFactor) != null ? _b : 1) : Infinity
16896
- })
16897
- );
16867
+ this.size = constraints.constrain({
16868
+ width: shrinkWrapWidth ? this.child.size.width * ((_a = this.widthFactor) != null ? _a : 1) : Infinity,
16869
+ height: shrinkWrapHeight ? this.child.size.height * ((_b = this.heightFactor) != null ? _b : 1) : Infinity
16870
+ });
16898
16871
  this.alignChild();
16899
16872
  } else {
16900
- this.size = constraints.constrain(
16901
- new size_default({
16902
- width: shrinkWrapWidth ? 0 : Infinity,
16903
- height: shrinkWrapHeight ? 0 : Infinity
16904
- })
16905
- );
16873
+ this.size = constraints.constrain({
16874
+ width: shrinkWrapWidth ? 0 : Infinity,
16875
+ height: shrinkWrapHeight ? 0 : Infinity
16876
+ });
16906
16877
  }
16907
16878
  }
16908
16879
  };
@@ -17374,7 +17345,7 @@
17374
17345
  var Transform_default = Transform2;
17375
17346
 
17376
17347
  // src/component/Container.ts
17377
- var _Container = class extends StatelessWidget_default {
17348
+ var Container = class extends StatelessWidget_default {
17378
17349
  constructor({
17379
17350
  key,
17380
17351
  padding,
@@ -17515,7 +17486,7 @@
17515
17486
  return current;
17516
17487
  }
17517
17488
  };
17518
- var Container_default = classToFunction_default(_Container);
17489
+ var Container_default = classToFunction_default(Container);
17519
17490
 
17520
17491
  // src/component/Builder.ts
17521
17492
  function Builder(...props) {
@@ -17917,13 +17888,13 @@
17917
17888
  let [width, height] = [constraints.minWidth, constraints.minHeight];
17918
17889
  let nonPositionedConstraints;
17919
17890
  switch (this.fit) {
17920
- case "loose":
17891
+ case stack_fit_default.loose:
17921
17892
  nonPositionedConstraints = constraints.loosen();
17922
17893
  break;
17923
- case "expand":
17894
+ case stack_fit_default.expand:
17924
17895
  nonPositionedConstraints = constraints_default.tight(constraints.biggest);
17925
17896
  break;
17926
- case "passthrough":
17897
+ case stack_fit_default.passthrough:
17927
17898
  nonPositionedConstraints = constraints;
17928
17899
  break;
17929
17900
  }
@@ -18834,7 +18805,7 @@
18834
18805
  var AspectRatio_default = classToFunction_default(BaseAspectRatio_default);
18835
18806
 
18836
18807
  // src/component/base/BaseIndexedStack.ts
18837
- var IndexedStack = class extends BaseStack {
18808
+ var IndexedStack = class extends StatelessWidget_default {
18838
18809
  constructor({
18839
18810
  children,
18840
18811
  index = 0,
@@ -18842,52 +18813,23 @@
18842
18813
  alignment,
18843
18814
  key
18844
18815
  }) {
18845
- super({ children, fit: sizing, alignment, key });
18816
+ super(key);
18846
18817
  __publicField(this, "index");
18818
+ __publicField(this, "fit");
18819
+ __publicField(this, "alignment");
18820
+ __publicField(this, "children");
18847
18821
  this.index = index;
18822
+ this.fit = sizing;
18823
+ this.alignment = alignment;
18824
+ this.children = children;
18848
18825
  }
18849
- createRenderObject() {
18850
- return new RenderIndexedStack({
18851
- index: this.index,
18852
- fit: this.fit,
18853
- alignment: this.alignment
18826
+ build() {
18827
+ return new BaseStack({
18828
+ children: this.children.slice(this.index, this.index + 1),
18829
+ alignment: this.alignment,
18830
+ fit: this.fit
18854
18831
  });
18855
18832
  }
18856
- updateRenderObject(renderObject) {
18857
- renderObject.index = this.index;
18858
- renderObject.fit = this.fit;
18859
- renderObject.alignment = this.alignment;
18860
- }
18861
- };
18862
- var RenderIndexedStack = class extends RenderStack {
18863
- constructor({
18864
- index,
18865
- fit,
18866
- alignment
18867
- }) {
18868
- super({ alignment, fit });
18869
- __publicField(this, "_index");
18870
- this._index = index;
18871
- }
18872
- get index() {
18873
- return this._index;
18874
- }
18875
- set index(value) {
18876
- if (this._index === value)
18877
- return;
18878
- this._index = value;
18879
- this.markNeedsPaint();
18880
- }
18881
- paintChildren(context, {
18882
- clipId,
18883
- matrix4,
18884
- opacity
18885
- }) {
18886
- this.children.forEach((child2) => child2.dispose(context));
18887
- const child = this.children[this.index];
18888
- assert(child != null);
18889
- child.paint(context, clipId, matrix4, opacity);
18890
- }
18891
18833
  };
18892
18834
  var BaseIndexedStack_default = IndexedStack;
18893
18835