@meursyphus/flitter 0.0.4 → 0.0.5

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
@@ -578,6 +578,10 @@
578
578
 
579
579
  // src/type/_types/_calculable.ts
580
580
  var Calculable = class extends data_default {
581
+ constructor() {
582
+ super(...arguments);
583
+ __publicField(this, "isCalculable", true);
584
+ }
581
585
  plus(_other) {
582
586
  throw Error("plus is not implemented");
583
587
  }
@@ -959,7 +963,7 @@
959
963
  if (typeof a === "number") {
960
964
  return lerp_default(a, b, t);
961
965
  }
962
- assert(b instanceof calculable_default);
966
+ assert(b == null ? void 0 : b.isCalculable, "b is not a Calculable");
963
967
  return a.plus(b.minus(a).multiply(t));
964
968
  }
965
969
  };
@@ -1857,6 +1861,7 @@
1857
1861
  // src/type/_types/_vector4.ts
1858
1862
  var Vector4 = class _Vector4 {
1859
1863
  constructor(arg0, arg1, arg2, arg3) {
1864
+ __publicField(this, "type", "v4");
1860
1865
  __publicField(this, "_v4storage");
1861
1866
  this._v4storage = [arg0, arg1, arg2, arg3];
1862
1867
  }
@@ -7236,6 +7241,7 @@
7236
7241
  // src/type/_types/_vector2.ts
7237
7242
  var Vector2 = class _Vector2 {
7238
7243
  constructor(arg0, arg1) {
7244
+ __publicField(this, "type", "v2");
7239
7245
  __publicField(this, "_v2storage");
7240
7246
  this._v2storage = [arg0, arg1];
7241
7247
  }
@@ -7292,63 +7298,63 @@
7292
7298
  return new _Vector2(this._v2storage[1], this._v2storage[1]);
7293
7299
  }
7294
7300
  get xxx() {
7295
- return new vector3_default(
7301
+ return new Vector3(
7296
7302
  this._v2storage[0],
7297
7303
  this._v2storage[0],
7298
7304
  this._v2storage[0]
7299
7305
  );
7300
7306
  }
7301
7307
  get xxy() {
7302
- return new vector3_default(
7308
+ return new Vector3(
7303
7309
  this._v2storage[0],
7304
7310
  this._v2storage[0],
7305
7311
  this._v2storage[1]
7306
7312
  );
7307
7313
  }
7308
7314
  get xyx() {
7309
- return new vector3_default(
7315
+ return new Vector3(
7310
7316
  this._v2storage[0],
7311
7317
  this._v2storage[1],
7312
7318
  this._v2storage[0]
7313
7319
  );
7314
7320
  }
7315
7321
  get xyy() {
7316
- return new vector3_default(
7322
+ return new Vector3(
7317
7323
  this._v2storage[0],
7318
7324
  this._v2storage[1],
7319
7325
  this._v2storage[1]
7320
7326
  );
7321
7327
  }
7322
7328
  get yxx() {
7323
- return new vector3_default(
7329
+ return new Vector3(
7324
7330
  this._v2storage[1],
7325
7331
  this._v2storage[0],
7326
7332
  this._v2storage[0]
7327
7333
  );
7328
7334
  }
7329
7335
  get yxy() {
7330
- return new vector3_default(
7336
+ return new Vector3(
7331
7337
  this._v2storage[1],
7332
7338
  this._v2storage[0],
7333
7339
  this._v2storage[1]
7334
7340
  );
7335
7341
  }
7336
7342
  get yyx() {
7337
- return new vector3_default(
7343
+ return new Vector3(
7338
7344
  this._v2storage[1],
7339
7345
  this._v2storage[1],
7340
7346
  this._v2storage[0]
7341
7347
  );
7342
7348
  }
7343
7349
  get yyy() {
7344
- return new vector3_default(
7350
+ return new Vector3(
7345
7351
  this._v2storage[1],
7346
7352
  this._v2storage[1],
7347
7353
  this._v2storage[1]
7348
7354
  );
7349
7355
  }
7350
7356
  get xxxx() {
7351
- return new vector4_default(
7357
+ return new Vector4(
7352
7358
  this._v2storage[0],
7353
7359
  this._v2storage[0],
7354
7360
  this._v2storage[0],
@@ -7356,7 +7362,7 @@
7356
7362
  );
7357
7363
  }
7358
7364
  get xxxy() {
7359
- return new vector4_default(
7365
+ return new Vector4(
7360
7366
  this._v2storage[0],
7361
7367
  this._v2storage[0],
7362
7368
  this._v2storage[0],
@@ -7364,7 +7370,7 @@
7364
7370
  );
7365
7371
  }
7366
7372
  get xxyx() {
7367
- return new vector4_default(
7373
+ return new Vector4(
7368
7374
  this._v2storage[0],
7369
7375
  this._v2storage[0],
7370
7376
  this._v2storage[1],
@@ -7372,7 +7378,7 @@
7372
7378
  );
7373
7379
  }
7374
7380
  get xxyy() {
7375
- return new vector4_default(
7381
+ return new Vector4(
7376
7382
  this._v2storage[0],
7377
7383
  this._v2storage[0],
7378
7384
  this._v2storage[1],
@@ -7380,7 +7386,7 @@
7380
7386
  );
7381
7387
  }
7382
7388
  get xyxx() {
7383
- return new vector4_default(
7389
+ return new Vector4(
7384
7390
  this._v2storage[0],
7385
7391
  this._v2storage[1],
7386
7392
  this._v2storage[0],
@@ -7388,7 +7394,7 @@
7388
7394
  );
7389
7395
  }
7390
7396
  get xyxy() {
7391
- return new vector4_default(
7397
+ return new Vector4(
7392
7398
  this._v2storage[0],
7393
7399
  this._v2storage[1],
7394
7400
  this._v2storage[0],
@@ -7396,7 +7402,7 @@
7396
7402
  );
7397
7403
  }
7398
7404
  get xyyx() {
7399
- return new vector4_default(
7405
+ return new Vector4(
7400
7406
  this._v2storage[0],
7401
7407
  this._v2storage[1],
7402
7408
  this._v2storage[1],
@@ -7404,7 +7410,7 @@
7404
7410
  );
7405
7411
  }
7406
7412
  get xyyy() {
7407
- return new vector4_default(
7413
+ return new Vector4(
7408
7414
  this._v2storage[0],
7409
7415
  this._v2storage[1],
7410
7416
  this._v2storage[1],
@@ -7412,7 +7418,7 @@
7412
7418
  );
7413
7419
  }
7414
7420
  get yxxx() {
7415
- return new vector4_default(
7421
+ return new Vector4(
7416
7422
  this._v2storage[1],
7417
7423
  this._v2storage[0],
7418
7424
  this._v2storage[0],
@@ -7420,7 +7426,7 @@
7420
7426
  );
7421
7427
  }
7422
7428
  get yxxy() {
7423
- return new vector4_default(
7429
+ return new Vector4(
7424
7430
  this._v2storage[1],
7425
7431
  this._v2storage[0],
7426
7432
  this._v2storage[0],
@@ -7428,7 +7434,7 @@
7428
7434
  );
7429
7435
  }
7430
7436
  get yxyx() {
7431
- return new vector4_default(
7437
+ return new Vector4(
7432
7438
  this._v2storage[1],
7433
7439
  this._v2storage[0],
7434
7440
  this._v2storage[1],
@@ -7436,7 +7442,7 @@
7436
7442
  );
7437
7443
  }
7438
7444
  get yxyy() {
7439
- return new vector4_default(
7445
+ return new Vector4(
7440
7446
  this._v2storage[1],
7441
7447
  this._v2storage[0],
7442
7448
  this._v2storage[1],
@@ -7444,7 +7450,7 @@
7444
7450
  );
7445
7451
  }
7446
7452
  get yyxx() {
7447
- return new vector4_default(
7453
+ return new Vector4(
7448
7454
  this._v2storage[1],
7449
7455
  this._v2storage[1],
7450
7456
  this._v2storage[0],
@@ -7452,7 +7458,7 @@
7452
7458
  );
7453
7459
  }
7454
7460
  get yyxy() {
7455
- return new vector4_default(
7461
+ return new Vector4(
7456
7462
  this._v2storage[1],
7457
7463
  this._v2storage[1],
7458
7464
  this._v2storage[0],
@@ -7460,7 +7466,7 @@
7460
7466
  );
7461
7467
  }
7462
7468
  get yyyx() {
7463
- return new vector4_default(
7469
+ return new Vector4(
7464
7470
  this._v2storage[1],
7465
7471
  this._v2storage[1],
7466
7472
  this._v2storage[1],
@@ -7468,7 +7474,7 @@
7468
7474
  );
7469
7475
  }
7470
7476
  get yyyy() {
7471
- return new vector4_default(
7477
+ return new Vector4(
7472
7478
  this._v2storage[1],
7473
7479
  this._v2storage[1],
7474
7480
  this._v2storage[1],
@@ -7667,6 +7673,7 @@
7667
7673
  // src/type/_types/_vector3.ts
7668
7674
  var Vector3 = class _Vector3 {
7669
7675
  constructor(arg0, arg1, arg2) {
7676
+ __publicField(this, "type", "v3");
7670
7677
  __publicField(this, "_v3storage");
7671
7678
  this._v3storage = [arg0, arg1, arg2];
7672
7679
  }
@@ -10344,12 +10351,12 @@
10344
10351
  */
10345
10352
  translate(x, y, z) {
10346
10353
  let tx, ty, tz;
10347
- const tw = x instanceof vector4_default ? x.w : 1;
10348
- if (x instanceof vector3_default) {
10354
+ const tw = (x == null ? void 0 : x.type) === "v4" ? x.w : 1;
10355
+ if ((x == null ? void 0 : x.type) === "v3") {
10349
10356
  tx = x.x;
10350
10357
  ty = x.y;
10351
10358
  tz = x.z;
10352
- } else if (x instanceof vector4_default) {
10359
+ } else if ((x == null ? void 0 : x.type) === "v4") {
10353
10360
  tx = x.x;
10354
10361
  ty = x.y;
10355
10362
  tz = x.z;
@@ -10379,21 +10386,21 @@
10379
10386
  */
10380
10387
  leftTranslate(x, y = 0, z = 0) {
10381
10388
  let tx, ty, tz;
10382
- const tw = x instanceof vector4_default ? x.w : 1;
10383
- if (x instanceof vector3_default) {
10389
+ const tw = (x == null ? void 0 : x.type) === "v4" ? x.w : 1;
10390
+ if ((x == null ? void 0 : x.type) === "v3") {
10384
10391
  tx = x.x;
10385
10392
  ty = x.y;
10386
10393
  tz = x.z;
10387
- } else if (x instanceof vector4_default) {
10394
+ } else if ((x == null ? void 0 : x.type) === "v4") {
10388
10395
  tx = x.x;
10389
10396
  ty = x.y;
10390
10397
  tz = x.z;
10391
10398
  } else if (typeof x === "number") {
10392
10399
  tx = x;
10393
- ty = y;
10394
- tz = z;
10400
+ ty = y || 0;
10401
+ tz = z || 0;
10395
10402
  } else {
10396
- throw new Error("Invalid argument type");
10403
+ throw new Error("Unsupported argument type.");
10397
10404
  }
10398
10405
  this._m4storage[0] += tx * this._m4storage[3];
10399
10406
  this._m4storage[1] += ty * this._m4storage[3];
@@ -10538,12 +10545,12 @@
10538
10545
  let sx;
10539
10546
  let sy;
10540
10547
  let sz;
10541
- const sw = x instanceof vector4_default ? x.w : 1;
10542
- if (x instanceof vector3_default) {
10548
+ const sw = (x == null ? void 0 : x.type) === "v4" ? x.w : 1;
10549
+ if (x.type === "v3") {
10543
10550
  sx = x.x;
10544
10551
  sy = x.y;
10545
10552
  sz = x.z;
10546
- } else if (x instanceof vector4_default) {
10553
+ } else if (x.type === "v4") {
10547
10554
  sx = x.x;
10548
10555
  sy = x.y;
10549
10556
  sz = x.z;
@@ -11910,8 +11917,6 @@
11910
11917
  equals(other) {
11911
11918
  if (this === other)
11912
11919
  return true;
11913
- if (!(other instanceof _Border))
11914
- return false;
11915
11920
  return this.top.equals(other.top) && this.right.equals(other.right) && this.bottom.equals(other.bottom) && this.left.equals(other.left);
11916
11921
  }
11917
11922
  /**
@@ -12304,8 +12309,6 @@
12304
12309
  equals(other) {
12305
12310
  if (this === other)
12306
12311
  return true;
12307
- if (!(other instanceof _BoxDecoration))
12308
- return false;
12309
12312
  if (!(this.color == null && other.color == null) && (!(this.color != null && other.color != null) || !this.color.equals(other.color))) {
12310
12313
  return false;
12311
12314
  }
@@ -12675,6 +12678,7 @@
12675
12678
  var _domNode, _domOrder, _domOrderChanged;
12676
12679
  var RenderObject = class {
12677
12680
  constructor({ isPainter }) {
12681
+ __publicField(this, "runtimeType", this.constructor.name);
12678
12682
  __publicField(this, "isPainter");
12679
12683
  __publicField(this, "ownerElement");
12680
12684
  __publicField(this, "renderOwner");
@@ -12970,485 +12974,489 @@
12970
12974
  };
12971
12975
  var Widget_default = Widget;
12972
12976
 
12973
- // src/scheduler/BuildOwner.ts
12974
- var BuildOwner = class {
12975
- constructor({ onNeedVisualUpdate }) {
12976
- __publicField(this, "onNeedVisualUpdate");
12977
- __publicField(this, "dirtyElements", []);
12978
- __publicField(this, "globalKeyRegistry", /* @__PURE__ */ new WeakMap());
12979
- this.onNeedVisualUpdate = () => onNeedVisualUpdate();
12980
- }
12981
- scheduleFor(elememt) {
12982
- this.dirtyElements.push(elememt);
12983
- this.requestVisualUpdate();
12977
+ // src/element/Element.ts
12978
+ var Element = class {
12979
+ constructor(widget) {
12980
+ __publicField(this, "scheduler");
12981
+ __publicField(this, "renderContext");
12982
+ __publicField(this, "buildOwner");
12983
+ __publicField(this, "widget");
12984
+ __publicField(this, "parent");
12985
+ __publicField(this, "dirty", true);
12986
+ __publicField(this, "depth", 0);
12987
+ __publicField(this, "type", "none");
12988
+ this.widget = widget;
12984
12989
  }
12985
- requestVisualUpdate() {
12986
- this.onNeedVisualUpdate();
12990
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12991
+ visitChildren(visitor) {
12992
+ throw { message: "not implemented" };
12987
12993
  }
12988
- flushBuild() {
12989
- const dirtyElements = this.dirtyElements;
12990
- this.dirtyElements = [];
12991
- dirtyElements.sort((a, b) => a.depth - b.depth).forEach((elememt) => {
12992
- if (!elememt.dirty)
12993
- return;
12994
- elememt.rebuild();
12994
+ get renderObject() {
12995
+ let result = null;
12996
+ this.visitChildren((child) => {
12997
+ result = child.renderObject;
12995
12998
  });
12999
+ if (result == null)
13000
+ throw { message: "can not find render object" };
13001
+ return result;
12996
13002
  }
12997
- registerGlobalKey(key, elememt) {
12998
- key.buildOwner = this;
12999
- this.globalKeyRegistry.set(key, elememt);
13003
+ //There are 5 case
13004
+ // 1. child is not null, but widget is null
13005
+ // in this case, child must be unmounted
13006
+ // 2. child is null, widget is null
13007
+ // nothing happend
13008
+ // 3. child is null, widget is not null
13009
+ // newWidget would be inflated,
13010
+ // 4. child is not null, widget is not null, and widget can be update
13011
+ // in this case, just update widget configruation
13012
+ // 5. it is similar to 4 but widget can not be update,
13013
+ // in this case, child must be unmounted and newWidget would be inflated
13014
+ updateChild(child, newWidget) {
13015
+ if (child != null && newWidget == null) {
13016
+ child.unmount();
13017
+ return null;
13018
+ } else if (child == null && newWidget == null) {
13019
+ } else if (child == null && newWidget != null) {
13020
+ return this.inflateWidget(newWidget);
13021
+ } else if (child != null && newWidget != null && Widget_default.canUpdate(child.widget, newWidget)) {
13022
+ child.update(newWidget);
13023
+ return child;
13024
+ } else {
13025
+ child.unmount();
13026
+ return this.inflateWidget(newWidget);
13027
+ }
13000
13028
  }
13001
- findByGlobalKey(key) {
13002
- const result = this.globalKeyRegistry.get(key);
13003
- return result;
13029
+ unmount() {
13030
+ this.parent = void 0;
13004
13031
  }
13005
- };
13006
- var BuildOwner_default = BuildOwner;
13007
-
13008
- // src/scheduler/RenderOwner.ts
13009
- var RenderOwner = class {
13010
- constructor({
13011
- onNeedVisualUpdate,
13012
- paintContext
13013
- }) {
13014
- __publicField(this, "paintContext");
13015
- __publicField(this, "onNeedVisualUpdate");
13016
- __publicField(this, "needsPaintRenderObjects", []);
13017
- __publicField(this, "needsLayoutRenderObjects", []);
13018
- /*
13019
- this will be set by RenderView
13020
- */
13021
- __publicField(this, "renderView");
13022
- __publicField(this, "domOrderChanged", true);
13023
- this.onNeedVisualUpdate = onNeedVisualUpdate;
13024
- this.paintContext = paintContext;
13032
+ mount(newParent) {
13033
+ var _a;
13034
+ if (newParent) {
13035
+ this.renderContext = newParent.renderContext;
13036
+ this.buildOwner = newParent.buildOwner;
13037
+ this.depth = newParent.depth + 1;
13038
+ this.scheduler = newParent.scheduler;
13039
+ }
13040
+ this.parent = newParent;
13041
+ if ((_a = this.widget.key) == null ? void 0 : _a.isGlobalKey) {
13042
+ this.buildOwner.registerGlobalKey(this.widget.key, this);
13043
+ }
13025
13044
  }
13026
- requestVisualUpdate() {
13027
- this.onNeedVisualUpdate();
13045
+ update(newWidget) {
13046
+ this.widget = newWidget;
13028
13047
  }
13029
- drawFrame() {
13030
- this.flushLayout();
13031
- this.rearrangeDomOrder();
13032
- this.flushPaint();
13048
+ inflateWidget(childWidget) {
13049
+ const newChild = childWidget.createElement();
13050
+ newChild.mount(this);
13051
+ return newChild;
13033
13052
  }
13034
- rearrangeDomOrder() {
13035
- if (!this.domOrderChanged)
13053
+ rebuild({ force = false } = {}) {
13054
+ if (!this.dirty && !force)
13036
13055
  return;
13037
- this.domOrderChanged = false;
13038
- const domOrderVisitor = new DomOrderVisitor();
13039
- this.renderView.accept(domOrderVisitor);
13040
- const painterRenderObjects = domOrderVisitor.getRenderObjectsByDomOrder();
13041
- for (let i = painterRenderObjects.length - 1; i >= 0; i--) {
13042
- const renderObject = painterRenderObjects[i];
13043
- renderObject.domOrder = i;
13044
- renderObject.rearrangeDomOrder();
13045
- }
13046
- }
13047
- didDomOrderChange() {
13048
- this.domOrderChanged = true;
13056
+ this.dirty = false;
13057
+ this.performRebuild();
13049
13058
  }
13050
- flushLayout() {
13051
- const dirties = this.needsLayoutRenderObjects;
13052
- this.needsLayoutRenderObjects = [];
13053
- dirties.sort((a, b) => a.depth - b.depth).forEach((renderObject) => {
13054
- if (!renderObject.needsLayout)
13055
- return;
13056
- renderObject.layoutWithoutResize();
13057
- });
13059
+ performRebuild() {
13060
+ throw new Error("not implemented performRebuild");
13058
13061
  }
13059
- flushPaint() {
13060
- const dirties = this.needsPaintRenderObjects;
13061
- this.needsPaintRenderObjects = [];
13062
- dirties.sort((a, b) => a.depth - b.depth).forEach((renderObject) => {
13063
- if (!renderObject.needsPaint)
13064
- return;
13065
- renderObject.paintWithoutLayout(this.paintContext);
13066
- });
13062
+ markNeedsBuild() {
13063
+ this.dirty = true;
13064
+ this.buildOwner.scheduleFor(this);
13067
13065
  }
13068
13066
  };
13069
- var DomOrderVisitor = class {
13070
- constructor() {
13071
- __publicField(this, "collectedRenderObjects", []);
13072
- __publicField(this, "currentVisitedOrder", 0);
13073
- __publicField(this, "currentStackingContext", []);
13067
+ var Element_default = Element;
13068
+
13069
+ // src/element/RenderObjectElement.ts
13070
+ var RenderObjectElement = class extends Element_default {
13071
+ constructor(widget) {
13072
+ super(widget);
13073
+ __publicField(this, "children");
13074
+ __publicField(this, "_renderObject");
13075
+ __publicField(this, "type", "render");
13076
+ __publicField(this, "ancestorRenderObjectElement");
13074
13077
  }
13075
- visit(renderObject, { willCollect }) {
13076
- if (willCollect) {
13077
- this.collectedRenderObjects.push({
13078
- renderObject,
13079
- contexts: this.currentStackingContext,
13080
- visitedOrder: this.currentVisitedOrder++
13081
- });
13082
- }
13083
- renderObject.visitChildren((child) => {
13084
- child.accept(this);
13085
- });
13078
+ createRenderObject() {
13079
+ const renderObject = this.widget.createRenderObject();
13080
+ return renderObject;
13086
13081
  }
13087
- visitGeneral(renderObject) {
13088
- this.visit(renderObject, { willCollect: renderObject.isPainter });
13082
+ get renderObject() {
13083
+ return this._renderObject;
13089
13084
  }
13090
- visitZIndex(renderObject) {
13091
- this.currentStackingContext = [...this.currentStackingContext];
13092
- this.currentStackingContext.push({
13093
- visitedOrder: this.currentVisitedOrder,
13094
- zIndex: renderObject.zIndex
13085
+ unmount() {
13086
+ super.unmount();
13087
+ this.renderObject.dispose(this.renderContext.paintContext);
13088
+ this.children.forEach((child) => {
13089
+ child.unmount();
13095
13090
  });
13096
- this.visit(renderObject, { willCollect: false });
13097
- this.currentStackingContext = [...this.currentStackingContext];
13098
- this.currentStackingContext.pop();
13091
+ this._renderObject.markNeedsParentLayout();
13099
13092
  }
13100
- getRenderObjectsByDomOrder() {
13101
- const sorted = this.collectedRenderObjects.sort((a, b) => {
13102
- var _a, _b;
13103
- const limit = Math.min(a.contexts.length, b.contexts.length);
13104
- for (let i = 0; i < limit; i++) {
13105
- const aContext = a.contexts[i];
13106
- const bContext = b.contexts[i];
13107
- if (aContext.zIndex !== bContext.zIndex) {
13108
- return aContext.zIndex - bContext.zIndex;
13109
- } else if (aContext.visitedOrder !== bContext.visitedOrder) {
13110
- return aContext.visitedOrder - bContext.visitedOrder;
13111
- }
13112
- }
13113
- if (limit > 0) {
13114
- const lastContext = a.contexts[limit - 1];
13115
- if (lastContext.visitedOrder === a.visitedOrder || lastContext.visitedOrder === b.visitedOrder) {
13116
- return a.visitedOrder - b.visitedOrder;
13117
- }
13118
- }
13119
- if (a.contexts.length !== b.contexts.length) {
13120
- const aContext = (_a = a.contexts[limit]) != null ? _a : {
13121
- visitedOrder: a.visitedOrder,
13122
- zIndex: 0
13123
- };
13124
- const bContext = (_b = b.contexts[limit]) != null ? _b : {
13125
- visitedOrder: b.visitedOrder,
13126
- zIndex: 0
13127
- };
13128
- if (aContext.zIndex !== bContext.zIndex) {
13129
- return aContext.zIndex - bContext.zIndex;
13130
- } else if (aContext.visitedOrder !== bContext.visitedOrder) {
13131
- return aContext.visitedOrder - bContext.visitedOrder;
13132
- }
13133
- }
13134
- return a.visitedOrder - b.visitedOrder;
13135
- });
13136
- return sorted.map(({ renderObject }) => renderObject);
13137
- }
13138
- };
13139
- var RenderOwner_default = RenderOwner;
13140
-
13141
- // src/scheduler/Scheduler.ts
13142
- var Scheduler = class {
13143
- constructor() {
13144
- __publicField(this, "phase");
13145
- __publicField(this, "persistenceCallbacks");
13146
- __publicField(this, "postFrameCallbacks");
13147
- this.phase = 0 /* idle */;
13148
- this.persistenceCallbacks = [];
13149
- this.postFrameCallbacks = [];
13150
- }
13151
- schedule() {
13152
- switch (this.phase) {
13153
- case 0 /* idle */:
13154
- case 2 /* postFrameCallbacks */:
13155
- this.performSchedule();
13156
- break;
13157
- case 1 /* persistenceCallbacks */:
13158
- break;
13093
+ mount(newParent) {
13094
+ var _a;
13095
+ super.mount(newParent);
13096
+ this._renderObject = this.createRenderObject();
13097
+ this.ancestorRenderObjectElement = this.findAncestorRenderObjectElement();
13098
+ const ancestorRenderObject = (_a = this.ancestorRenderObjectElement) == null ? void 0 : _a.renderObject;
13099
+ if (ancestorRenderObject) {
13100
+ this.renderObject.parent = ancestorRenderObject;
13101
+ this.renderObject.renderOwner = ancestorRenderObject.renderOwner;
13159
13102
  }
13103
+ this.children = this.widget.children.map(
13104
+ (childWidget) => this.inflateWidget(childWidget)
13105
+ );
13106
+ this._renderObject.attach(this);
13107
+ this._renderObject.markNeedsParentLayout();
13160
13108
  }
13161
- performSchedule() {
13162
- this.phase = 1 /* persistenceCallbacks */;
13163
- this.persistenceCallbacks.forEach((callback) => {
13164
- callback();
13109
+ update(newWidget) {
13110
+ super.update(newWidget);
13111
+ this.rebuild({ force: true });
13112
+ }
13113
+ updateChildren(newWidgets) {
13114
+ const updatedChildIndexes = [];
13115
+ const oldChildren = this.children;
13116
+ const newChildren = newWidgets.map((newWidget) => {
13117
+ const matchedChildIndex = oldChildren.findIndex(
13118
+ (oldChild, oldChildIndex) => !updatedChildIndexes.includes(oldChildIndex) && Widget_default.canUpdate(newWidget, oldChild.widget)
13119
+ );
13120
+ let matchedChild;
13121
+ if (matchedChildIndex === -1) {
13122
+ matchedChild = null;
13123
+ } else {
13124
+ matchedChild = oldChildren[matchedChildIndex];
13125
+ updatedChildIndexes.push(matchedChildIndex);
13126
+ }
13127
+ return this.updateChild(matchedChild, newWidget);
13165
13128
  });
13166
- this.phase = 2 /* postFrameCallbacks */;
13167
- this.postFrameCallbacks.forEach((callback) => {
13168
- callback();
13129
+ oldChildren.forEach((oldChild, i) => {
13130
+ if (updatedChildIndexes.includes(i))
13131
+ return;
13132
+ this.updateChild(oldChild, null);
13169
13133
  });
13170
- this.postFrameCallbacks = [];
13171
- this.phase = 0 /* idle */;
13134
+ this.children = newChildren;
13172
13135
  }
13173
- addPersistenceCallbacks(callback) {
13174
- this.persistenceCallbacks.push(() => callback());
13136
+ performRebuild() {
13137
+ this.widget.updateRenderObject(this._renderObject);
13138
+ const newChildWidgets = this.widget.children;
13139
+ this.updateChildren(newChildWidgets);
13175
13140
  }
13176
- addPostFrameCallbacks(callback) {
13177
- this.postFrameCallbacks.push(() => callback());
13141
+ visitChildren(visitor) {
13142
+ this.children.forEach((child) => visitor(child));
13143
+ }
13144
+ findAncestorRenderObjectElement() {
13145
+ let ancestor = this.parent;
13146
+ while (ancestor != null && !(ancestor.type === "render")) {
13147
+ ancestor = ancestor.parent;
13148
+ }
13149
+ return ancestor;
13178
13150
  }
13179
13151
  };
13180
- var Scheduler_default = Scheduler;
13152
+ var RenderObjectElement_default = RenderObjectElement;
13181
13153
 
13182
- // src/scheduler/RenderFrameDispatcher.ts
13183
- var RenderFrameDispatcher = class {
13184
- constructor({ onFrame } = {}) {
13185
- __publicField(this, "onFrame");
13186
- this.onFrame = onFrame;
13154
+ // src/widget/RenderObjectWidget.ts
13155
+ var RenderObjectWidget = class extends Widget_default {
13156
+ constructor({ children = [], key }) {
13157
+ super(key);
13158
+ __publicField(this, "children");
13159
+ this.children = children;
13187
13160
  }
13188
- setOnFrame(callback) {
13189
- this.onFrame = () => callback();
13161
+ createElement() {
13162
+ return new RenderObjectElement_default(this);
13190
13163
  }
13191
- // Actually we dont need to invoke browser to render because browser automatically render its own state periodically
13192
- // so Here we just call onFrame callback.
13193
- dispatch() {
13194
- if (typeof window === "undefined") {
13195
- setTimeout(() => {
13196
- var _a;
13197
- (_a = this.onFrame) == null ? void 0 : _a.call(this);
13198
- }, 0);
13199
- } else {
13200
- window.requestAnimationFrame(() => {
13201
- var _a;
13202
- (_a = this.onFrame) == null ? void 0 : _a.call(this);
13203
- });
13204
- }
13164
+ createRenderObject() {
13165
+ throw { message: "not implemented createRenderObject" };
13166
+ }
13167
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13168
+ updateRenderObject(renderObject) {
13169
+ throw { message: "not implemented updatedRenderObject" };
13205
13170
  }
13206
13171
  };
13207
- var RenderFrameDispatcher_default = RenderFrameDispatcher;
13172
+ var RenderObjectWidget_default = RenderObjectWidget;
13208
13173
 
13209
- // src/scheduler/Globalkey.ts
13210
- var GlobalKey = class {
13211
- constructor() {
13174
+ // src/widget/RenderObjectToWidgetAdapter.ts
13175
+ var RenderObjectToWidgetAdapter = class extends RenderObjectWidget_default {
13176
+ constructor({
13177
+ app,
13178
+ renderOwner,
13179
+ buildOwner,
13180
+ renderContext,
13181
+ scheduler
13182
+ }) {
13183
+ super({ children: [app] });
13184
+ __publicField(this, "renderOwner");
13212
13185
  __publicField(this, "buildOwner");
13186
+ __publicField(this, "renderContext");
13187
+ __publicField(this, "scheduler");
13188
+ this.renderOwner = renderOwner;
13189
+ this.buildOwner = buildOwner;
13190
+ this.renderContext = renderContext;
13191
+ this.scheduler = scheduler;
13213
13192
  }
13214
- get currentContext() {
13215
- assert(
13216
- this.buildOwner != null,
13217
- "buildOwner is null, currentContext must be called after initState"
13218
- );
13219
- return this.buildOwner.findByGlobalKey(this);
13193
+ createElement() {
13194
+ const el = super.createElement();
13195
+ el.renderContext = this.renderContext;
13196
+ el.buildOwner = this.buildOwner;
13197
+ el.scheduler = this.scheduler;
13198
+ return el;
13199
+ }
13200
+ createRenderObject() {
13201
+ return new RenderView_default({ renderOwner: this.renderOwner });
13202
+ }
13203
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13204
+ updateRenderObject(renderObject) {
13220
13205
  }
13221
13206
  };
13222
- var Globalkey_default = GlobalKey;
13207
+ var RenderObjectToWidgetAdapter_default = RenderObjectToWidgetAdapter;
13223
13208
 
13224
- // src/element/Element.ts
13225
- var Element = class {
13226
- constructor(widget) {
13227
- __publicField(this, "scheduler");
13228
- __publicField(this, "renderContext");
13229
- __publicField(this, "buildOwner");
13230
- __publicField(this, "widget");
13231
- __publicField(this, "parent");
13232
- __publicField(this, "dirty", true);
13233
- __publicField(this, "depth", 0);
13234
- this.widget = widget;
13209
+ // src/scheduler/BuildOwner.ts
13210
+ var BuildOwner = class {
13211
+ constructor({ onNeedVisualUpdate }) {
13212
+ __publicField(this, "onNeedVisualUpdate");
13213
+ __publicField(this, "dirtyElements", []);
13214
+ __publicField(this, "globalKeyRegistry", /* @__PURE__ */ new WeakMap());
13215
+ this.onNeedVisualUpdate = () => onNeedVisualUpdate();
13235
13216
  }
13236
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13237
- visitChildren(visitor) {
13238
- throw { message: "not implemented" };
13217
+ scheduleFor(elememt) {
13218
+ this.dirtyElements.push(elememt);
13219
+ this.requestVisualUpdate();
13239
13220
  }
13240
- get renderObject() {
13241
- let result = null;
13242
- this.visitChildren((child) => {
13243
- result = child.renderObject;
13221
+ requestVisualUpdate() {
13222
+ this.onNeedVisualUpdate();
13223
+ }
13224
+ flushBuild() {
13225
+ const dirtyElements = this.dirtyElements;
13226
+ this.dirtyElements = [];
13227
+ dirtyElements.sort((a, b) => a.depth - b.depth).forEach((elememt) => {
13228
+ if (!elememt.dirty)
13229
+ return;
13230
+ elememt.rebuild();
13244
13231
  });
13245
- if (result == null)
13246
- throw { message: "can not find render object" };
13232
+ }
13233
+ registerGlobalKey(key, elememt) {
13234
+ key.buildOwner = this;
13235
+ this.globalKeyRegistry.set(key, elememt);
13236
+ }
13237
+ findByGlobalKey(key) {
13238
+ const result = this.globalKeyRegistry.get(key);
13247
13239
  return result;
13248
13240
  }
13249
- //There are 5 case
13250
- // 1. child is not null, but widget is null
13251
- // in this case, child must be unmounted
13252
- // 2. child is null, widget is null
13253
- // nothing happend
13254
- // 3. child is null, widget is not null
13255
- // newWidget would be inflated,
13256
- // 4. child is not null, widget is not null, and widget can be update
13257
- // in this case, just update widget configruation
13258
- // 5. it is similar to 4 but widget can not be update,
13259
- // in this case, child must be unmounted and newWidget would be inflated
13260
- updateChild(child, newWidget) {
13261
- if (child != null && newWidget == null) {
13262
- child.unmount();
13263
- return null;
13264
- } else if (child == null && newWidget == null) {
13265
- } else if (child == null && newWidget != null) {
13266
- return this.inflateWidget(newWidget);
13267
- } else if (child != null && newWidget != null && Widget_default.canUpdate(child.widget, newWidget)) {
13268
- child.update(newWidget);
13269
- return child;
13270
- } else {
13271
- child.unmount();
13272
- return this.inflateWidget(newWidget);
13273
- }
13241
+ };
13242
+ var BuildOwner_default = BuildOwner;
13243
+
13244
+ // src/scheduler/RenderOwner.ts
13245
+ var RenderOwner = class {
13246
+ constructor({
13247
+ onNeedVisualUpdate,
13248
+ paintContext
13249
+ }) {
13250
+ __publicField(this, "paintContext");
13251
+ __publicField(this, "onNeedVisualUpdate");
13252
+ __publicField(this, "needsPaintRenderObjects", []);
13253
+ __publicField(this, "needsLayoutRenderObjects", []);
13254
+ /*
13255
+ this will be set by RenderView
13256
+ */
13257
+ __publicField(this, "renderView");
13258
+ __publicField(this, "domOrderChanged", true);
13259
+ this.onNeedVisualUpdate = onNeedVisualUpdate;
13260
+ this.paintContext = paintContext;
13274
13261
  }
13275
- unmount() {
13276
- this.parent = void 0;
13262
+ requestVisualUpdate() {
13263
+ this.onNeedVisualUpdate();
13277
13264
  }
13278
- mount(newParent) {
13279
- if (newParent) {
13280
- this.renderContext = newParent.renderContext;
13281
- this.buildOwner = newParent.buildOwner;
13282
- this.depth = newParent.depth + 1;
13283
- this.scheduler = newParent.scheduler;
13284
- }
13285
- this.parent = newParent;
13286
- if (this.widget.key instanceof Globalkey_default) {
13287
- this.buildOwner.registerGlobalKey(this.widget.key, this);
13265
+ drawFrame() {
13266
+ this.flushLayout();
13267
+ this.rearrangeDomOrder();
13268
+ this.flushPaint();
13269
+ }
13270
+ rearrangeDomOrder() {
13271
+ if (!this.domOrderChanged)
13272
+ return;
13273
+ this.domOrderChanged = false;
13274
+ const domOrderVisitor = new DomOrderVisitor();
13275
+ this.renderView.accept(domOrderVisitor);
13276
+ const painterRenderObjects = domOrderVisitor.getRenderObjectsByDomOrder();
13277
+ for (let i = painterRenderObjects.length - 1; i >= 0; i--) {
13278
+ const renderObject = painterRenderObjects[i];
13279
+ renderObject.domOrder = i;
13280
+ renderObject.rearrangeDomOrder();
13288
13281
  }
13289
13282
  }
13290
- update(newWidget) {
13291
- this.widget = newWidget;
13283
+ didDomOrderChange() {
13284
+ this.domOrderChanged = true;
13292
13285
  }
13293
- inflateWidget(childWidget) {
13294
- const newChild = childWidget.createElement();
13295
- newChild.mount(this);
13296
- return newChild;
13286
+ flushLayout() {
13287
+ const dirties = this.needsLayoutRenderObjects;
13288
+ this.needsLayoutRenderObjects = [];
13289
+ dirties.sort((a, b) => a.depth - b.depth).forEach((renderObject) => {
13290
+ if (!renderObject.needsLayout)
13291
+ return;
13292
+ renderObject.layoutWithoutResize();
13293
+ });
13297
13294
  }
13298
- rebuild({ force = false } = {}) {
13299
- if (!this.dirty && !force)
13300
- return;
13301
- this.dirty = false;
13302
- this.performRebuild();
13295
+ flushPaint() {
13296
+ const dirties = this.needsPaintRenderObjects;
13297
+ this.needsPaintRenderObjects = [];
13298
+ dirties.sort((a, b) => a.depth - b.depth).forEach((renderObject) => {
13299
+ if (!renderObject.needsPaint)
13300
+ return;
13301
+ renderObject.paintWithoutLayout(this.paintContext);
13302
+ });
13303
13303
  }
13304
- performRebuild() {
13305
- throw new Error("not implemented performRebuild");
13304
+ };
13305
+ var DomOrderVisitor = class {
13306
+ constructor() {
13307
+ __publicField(this, "collectedRenderObjects", []);
13308
+ __publicField(this, "currentVisitedOrder", 0);
13309
+ __publicField(this, "currentStackingContext", []);
13306
13310
  }
13307
- markNeedsBuild() {
13308
- this.dirty = true;
13309
- this.buildOwner.scheduleFor(this);
13311
+ visit(renderObject, { willCollect }) {
13312
+ if (willCollect) {
13313
+ this.collectedRenderObjects.push({
13314
+ renderObject,
13315
+ contexts: this.currentStackingContext,
13316
+ visitedOrder: this.currentVisitedOrder++
13317
+ });
13318
+ }
13319
+ renderObject.visitChildren((child) => {
13320
+ child.accept(this);
13321
+ });
13322
+ }
13323
+ visitGeneral(renderObject) {
13324
+ this.visit(renderObject, { willCollect: renderObject.isPainter });
13325
+ }
13326
+ visitZIndex(renderObject) {
13327
+ this.currentStackingContext = [...this.currentStackingContext];
13328
+ this.currentStackingContext.push({
13329
+ visitedOrder: this.currentVisitedOrder,
13330
+ zIndex: renderObject.zIndex
13331
+ });
13332
+ this.visit(renderObject, { willCollect: false });
13333
+ this.currentStackingContext = [...this.currentStackingContext];
13334
+ this.currentStackingContext.pop();
13335
+ }
13336
+ getRenderObjectsByDomOrder() {
13337
+ const sorted = this.collectedRenderObjects.sort((a, b) => {
13338
+ var _a, _b;
13339
+ const limit = Math.min(a.contexts.length, b.contexts.length);
13340
+ for (let i = 0; i < limit; i++) {
13341
+ const aContext = a.contexts[i];
13342
+ const bContext = b.contexts[i];
13343
+ if (aContext.zIndex !== bContext.zIndex) {
13344
+ return aContext.zIndex - bContext.zIndex;
13345
+ } else if (aContext.visitedOrder !== bContext.visitedOrder) {
13346
+ return aContext.visitedOrder - bContext.visitedOrder;
13347
+ }
13348
+ }
13349
+ if (limit > 0) {
13350
+ const lastContext = a.contexts[limit - 1];
13351
+ if (lastContext.visitedOrder === a.visitedOrder || lastContext.visitedOrder === b.visitedOrder) {
13352
+ return a.visitedOrder - b.visitedOrder;
13353
+ }
13354
+ }
13355
+ if (a.contexts.length !== b.contexts.length) {
13356
+ const aContext = (_a = a.contexts[limit]) != null ? _a : {
13357
+ visitedOrder: a.visitedOrder,
13358
+ zIndex: 0
13359
+ };
13360
+ const bContext = (_b = b.contexts[limit]) != null ? _b : {
13361
+ visitedOrder: b.visitedOrder,
13362
+ zIndex: 0
13363
+ };
13364
+ if (aContext.zIndex !== bContext.zIndex) {
13365
+ return aContext.zIndex - bContext.zIndex;
13366
+ } else if (aContext.visitedOrder !== bContext.visitedOrder) {
13367
+ return aContext.visitedOrder - bContext.visitedOrder;
13368
+ }
13369
+ }
13370
+ return a.visitedOrder - b.visitedOrder;
13371
+ });
13372
+ return sorted.map(({ renderObject }) => renderObject);
13310
13373
  }
13311
13374
  };
13312
- var Element_default = Element;
13375
+ var RenderOwner_default = RenderOwner;
13313
13376
 
13314
- // src/element/RenderObjectElement.ts
13315
- var RenderObjectElement = class _RenderObjectElement extends Element_default {
13316
- constructor(widget) {
13317
- super(widget);
13318
- __publicField(this, "children");
13319
- __publicField(this, "_renderObject");
13320
- __publicField(this, "ancestorRenderObjectElement");
13321
- }
13322
- createRenderObject() {
13323
- const renderObject = this.widget.createRenderObject();
13324
- return renderObject;
13325
- }
13326
- get renderObject() {
13327
- return this._renderObject;
13328
- }
13329
- unmount() {
13330
- super.unmount();
13331
- this.renderObject.dispose(this.renderContext.paintContext);
13332
- this.children.forEach((child) => {
13333
- child.unmount();
13334
- });
13335
- this._renderObject.markNeedsParentLayout();
13377
+ // src/scheduler/Scheduler.ts
13378
+ var Scheduler = class {
13379
+ constructor() {
13380
+ __publicField(this, "phase");
13381
+ __publicField(this, "persistenceCallbacks");
13382
+ __publicField(this, "postFrameCallbacks");
13383
+ this.phase = 0 /* idle */;
13384
+ this.persistenceCallbacks = [];
13385
+ this.postFrameCallbacks = [];
13336
13386
  }
13337
- mount(newParent) {
13338
- var _a;
13339
- super.mount(newParent);
13340
- this._renderObject = this.createRenderObject();
13341
- this.ancestorRenderObjectElement = this.findAncestorRenderObjectElement();
13342
- const ancestorRenderObject = (_a = this.ancestorRenderObjectElement) == null ? void 0 : _a.renderObject;
13343
- if (ancestorRenderObject) {
13344
- this.renderObject.parent = ancestorRenderObject;
13345
- this.renderObject.renderOwner = ancestorRenderObject.renderOwner;
13387
+ schedule() {
13388
+ switch (this.phase) {
13389
+ case 0 /* idle */:
13390
+ case 2 /* postFrameCallbacks */:
13391
+ this.performSchedule();
13392
+ break;
13393
+ case 1 /* persistenceCallbacks */:
13394
+ break;
13346
13395
  }
13347
- this.children = this.widget.children.map(
13348
- (childWidget) => this.inflateWidget(childWidget)
13349
- );
13350
- this._renderObject.attach(this);
13351
- this._renderObject.markNeedsParentLayout();
13352
- }
13353
- update(newWidget) {
13354
- super.update(newWidget);
13355
- this.rebuild({ force: true });
13356
13396
  }
13357
- updateChildren(newWidgets) {
13358
- const updatedChildIndexes = [];
13359
- const oldChildren = this.children;
13360
- const newChildren = newWidgets.map((newWidget) => {
13361
- const matchedChildIndex = oldChildren.findIndex(
13362
- (oldChild, oldChildIndex) => !updatedChildIndexes.includes(oldChildIndex) && Widget_default.canUpdate(newWidget, oldChild.widget)
13363
- );
13364
- let matchedChild;
13365
- if (matchedChildIndex === -1) {
13366
- matchedChild = null;
13367
- } else {
13368
- matchedChild = oldChildren[matchedChildIndex];
13369
- updatedChildIndexes.push(matchedChildIndex);
13370
- }
13371
- return this.updateChild(matchedChild, newWidget);
13397
+ performSchedule() {
13398
+ this.phase = 1 /* persistenceCallbacks */;
13399
+ this.persistenceCallbacks.forEach((callback) => {
13400
+ callback();
13372
13401
  });
13373
- oldChildren.forEach((oldChild, i) => {
13374
- if (updatedChildIndexes.includes(i))
13375
- return;
13376
- this.updateChild(oldChild, null);
13402
+ this.phase = 2 /* postFrameCallbacks */;
13403
+ this.postFrameCallbacks.forEach((callback) => {
13404
+ callback();
13377
13405
  });
13378
- this.children = newChildren;
13379
- }
13380
- performRebuild() {
13381
- this.widget.updateRenderObject(this._renderObject);
13382
- const newChildWidgets = this.widget.children;
13383
- this.updateChildren(newChildWidgets);
13406
+ this.postFrameCallbacks = [];
13407
+ this.phase = 0 /* idle */;
13384
13408
  }
13385
- visitChildren(visitor) {
13386
- this.children.forEach((child) => visitor(child));
13409
+ addPersistenceCallbacks(callback) {
13410
+ this.persistenceCallbacks.push(() => callback());
13387
13411
  }
13388
- findAncestorRenderObjectElement() {
13389
- let ancestor = this.parent;
13390
- while (ancestor != null && !(ancestor instanceof _RenderObjectElement)) {
13391
- ancestor = ancestor.parent;
13392
- }
13393
- return ancestor;
13412
+ addPostFrameCallbacks(callback) {
13413
+ this.postFrameCallbacks.push(() => callback());
13394
13414
  }
13395
13415
  };
13396
- var RenderObjectElement_default = RenderObjectElement;
13416
+ var Scheduler_default = Scheduler;
13397
13417
 
13398
- // src/widget/RenderObjectWidget.ts
13399
- var RenderObjectWidget = class extends Widget_default {
13400
- constructor({ children = [], key }) {
13401
- super(key);
13402
- __publicField(this, "children");
13403
- this.children = children;
13404
- }
13405
- createElement() {
13406
- return new RenderObjectElement_default(this);
13418
+ // src/scheduler/RenderFrameDispatcher.ts
13419
+ var RenderFrameDispatcher = class {
13420
+ constructor({ onFrame } = {}) {
13421
+ __publicField(this, "onFrame");
13422
+ this.onFrame = onFrame;
13407
13423
  }
13408
- createRenderObject() {
13409
- throw { message: "not implemented createRenderObject" };
13424
+ setOnFrame(callback) {
13425
+ this.onFrame = () => callback();
13410
13426
  }
13411
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13412
- updateRenderObject(renderObject) {
13413
- throw { message: "not implemented updatedRenderObject" };
13427
+ // Actually we dont need to invoke browser to render because browser automatically render its own state periodically
13428
+ // so Here we just call onFrame callback.
13429
+ dispatch() {
13430
+ if (typeof window === "undefined") {
13431
+ setTimeout(() => {
13432
+ var _a;
13433
+ (_a = this.onFrame) == null ? void 0 : _a.call(this);
13434
+ }, 0);
13435
+ } else {
13436
+ window.requestAnimationFrame(() => {
13437
+ var _a;
13438
+ (_a = this.onFrame) == null ? void 0 : _a.call(this);
13439
+ });
13440
+ }
13414
13441
  }
13415
13442
  };
13416
- var RenderObjectWidget_default = RenderObjectWidget;
13443
+ var RenderFrameDispatcher_default = RenderFrameDispatcher;
13417
13444
 
13418
- // src/widget/RenderObjectToWidgetAdapter.ts
13419
- var RenderObjectToWidgetAdapter = class extends RenderObjectWidget_default {
13420
- constructor({
13421
- app,
13422
- renderOwner,
13423
- buildOwner,
13424
- renderContext,
13425
- scheduler
13426
- }) {
13427
- super({ children: [app] });
13428
- __publicField(this, "renderOwner");
13445
+ // src/scheduler/Globalkey.ts
13446
+ var GlobalKey = class {
13447
+ constructor() {
13448
+ __publicField(this, "isGlobalKey", true);
13429
13449
  __publicField(this, "buildOwner");
13430
- __publicField(this, "renderContext");
13431
- __publicField(this, "scheduler");
13432
- this.renderOwner = renderOwner;
13433
- this.buildOwner = buildOwner;
13434
- this.renderContext = renderContext;
13435
- this.scheduler = scheduler;
13436
- }
13437
- createElement() {
13438
- const el = super.createElement();
13439
- el.renderContext = this.renderContext;
13440
- el.buildOwner = this.buildOwner;
13441
- el.scheduler = this.scheduler;
13442
- return el;
13443
- }
13444
- createRenderObject() {
13445
- return new RenderView_default({ renderOwner: this.renderOwner });
13446
13450
  }
13447
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13448
- updateRenderObject(renderObject) {
13451
+ get currentContext() {
13452
+ assert(
13453
+ this.buildOwner != null,
13454
+ "buildOwner is null, currentContext must be called after initState"
13455
+ );
13456
+ return this.buildOwner.findByGlobalKey(this);
13449
13457
  }
13450
13458
  };
13451
- var RenderObjectToWidgetAdapter_default = RenderObjectToWidgetAdapter;
13459
+ var Globalkey_default = GlobalKey;
13452
13460
 
13453
13461
  // src/runApp.ts
13454
13462
  var AppRunner = class {
@@ -13730,7 +13738,7 @@
13730
13738
  while (parent != null) {
13731
13739
  const current = parent;
13732
13740
  parent = current.parent;
13733
- if (!(current instanceof ProviderElement))
13741
+ if (!(current.type === "provider"))
13734
13742
  continue;
13735
13743
  if (current.providerKey !== key)
13736
13744
  continue;
@@ -13742,10 +13750,11 @@
13742
13750
  return new ProviderElement(this);
13743
13751
  }
13744
13752
  };
13745
- var ProviderElement = class extends Element_default {
13753
+ var _ProviderElement = class _ProviderElement extends Element_default {
13746
13754
  constructor(widget) {
13747
13755
  super(widget);
13748
13756
  __publicField(this, "child");
13757
+ __publicField(this, "type", _ProviderElement.type);
13749
13758
  this.widget = widget;
13750
13759
  }
13751
13760
  get providerKey() {
@@ -13769,6 +13778,8 @@
13769
13778
  this.child = this.updateChild(this.child, this.child.widget);
13770
13779
  }
13771
13780
  };
13781
+ __publicField(_ProviderElement, "type", "provider");
13782
+ var ProviderElement = _ProviderElement;
13772
13783
  function ProviderFn(props) {
13773
13784
  return new Provider(props);
13774
13785
  }
@@ -13883,7 +13894,7 @@
13883
13894
  };
13884
13895
  var StatefulWidget_default = StatefulWidget;
13885
13896
 
13886
- // ../../node_modules/tslib/tslib.es6.js
13897
+ // ../../node_modules/popmotion/node_modules/tslib/tslib.es6.js
13887
13898
  function __rest(s, e) {
13888
13899
  var t = {};
13889
13900
  for (var p in s)
@@ -15411,75 +15422,22 @@
15411
15422
  return new BaseClipPath_default({ child: this.child, clipper: this.clipper });
15412
15423
  }
15413
15424
  };
15414
- var ClipPath_default = classToFunction_default(ClipPath);
15415
-
15416
- // src/component/ClipRect.ts
15417
- function ClipRect({
15418
- child,
15419
- clipper,
15420
- clipped = true,
15421
- key
15422
- }) {
15423
- return ClipPath_default({
15424
- child,
15425
- clipped,
15426
- key,
15427
- clipper: (size) => new path_default().addRect(clipper(size))
15428
- });
15429
- }
15430
-
15431
- // src/component/base/BaseFlexible.ts
15432
- var Flexible = class extends SingleChildRenderObjectWidget_default {
15433
- constructor({
15434
- flex = 1,
15435
- child,
15436
- fit = "loose",
15437
- key
15438
- } = {}) {
15439
- super({ child, key });
15440
- __publicField(this, "flex");
15441
- __publicField(this, "fit");
15442
- if (flex < 0)
15443
- throw { message: "flex must not be under zero" };
15444
- this.flex = flex;
15445
- this.fit = fit;
15446
- }
15447
- createRenderObject() {
15448
- return new RenderFlexible({ flex: this.flex, fit: this.fit });
15449
- }
15450
- updateRenderObject(renderObject) {
15451
- renderObject.flex = this.flex;
15452
- renderObject.fit = this.fit;
15453
- }
15454
- };
15455
- var RenderFlexible = class extends SingleChildRenderObject_default {
15456
- constructor({ flex, fit }) {
15457
- super({ isPainter: false });
15458
- __publicField(this, "_flex");
15459
- __publicField(this, "_fit");
15460
- this._flex = flex;
15461
- this._fit = fit;
15462
- }
15463
- get flex() {
15464
- return this._flex;
15465
- }
15466
- set flex(newFlex) {
15467
- if (this._flex === newFlex)
15468
- return;
15469
- this._flex = newFlex;
15470
- this.markNeedsLayout();
15471
- }
15472
- get fit() {
15473
- return this._fit;
15474
- }
15475
- set fit(newFit) {
15476
- if (this._fit === newFit)
15477
- return;
15478
- this._fit = newFit;
15479
- this.markNeedsLayout();
15480
- }
15481
- };
15482
- var BaseFlexible_default = Flexible;
15425
+ var ClipPath_default = classToFunction_default(ClipPath);
15426
+
15427
+ // src/component/ClipRect.ts
15428
+ function ClipRect({
15429
+ child,
15430
+ clipper,
15431
+ clipped = true,
15432
+ key
15433
+ }) {
15434
+ return ClipPath_default({
15435
+ child,
15436
+ clipped,
15437
+ key,
15438
+ clipper: (size) => new path_default().addRect(clipper(size))
15439
+ });
15440
+ }
15483
15441
 
15484
15442
  // src/component/base/BaseFlex.ts
15485
15443
  var Flex = class extends MultiChildRenderObjectWidget_default {
@@ -15609,7 +15567,7 @@
15609
15567
  const sortedChildren = this.verticalDirection === "down" ? this.children : [...this.children].reverse();
15610
15568
  sortedChildren.forEach((child) => {
15611
15569
  child.layout(this.constraints.loosen());
15612
- const flex = child instanceof RenderFlexible ? child.flex : 0;
15570
+ const flex = (child == null ? void 0 : child.isRenderFlexible) ? child.flex : 0;
15613
15571
  totalFlex += flex;
15614
15572
  if (flex === 0) {
15615
15573
  childIntrinsicMainAxisValue += child.size[this.mainAxisSizeName];
@@ -15619,14 +15577,15 @@
15619
15577
  const flexUnitSize = (this.constraints.getMax(this.mainAxisSizeName) - childIntrinsicMainAxisValue) / totalFlex;
15620
15578
  sortedChildren.forEach((child) => {
15621
15579
  let childConstraint;
15622
- if (!(child instanceof RenderFlexible)) {
15580
+ if (!child.isRenderFlexible) {
15623
15581
  childConstraint = this.getNonFlexItemConstraint(crossAxisValue);
15624
15582
  } else {
15625
- const flex = child.flex;
15583
+ const flexible = child;
15584
+ const flex = flexible.flex;
15626
15585
  const childMainAxisValue = flex * flexUnitSize;
15627
15586
  childConstraint = this.getFlexItemConstraint(
15628
15587
  childMainAxisValue,
15629
- child.fit
15588
+ flexible.fit
15630
15589
  );
15631
15590
  }
15632
15591
  child.layout(childConstraint.enforce(this.constraints.loosen()));
@@ -16487,6 +16446,61 @@
16487
16446
  }
16488
16447
  };
16489
16448
 
16449
+ // src/component/base/BaseFlexible.ts
16450
+ var Flexible = class extends SingleChildRenderObjectWidget_default {
16451
+ constructor({
16452
+ flex = 1,
16453
+ child,
16454
+ fit = "loose",
16455
+ key
16456
+ } = {}) {
16457
+ super({ child, key });
16458
+ __publicField(this, "isFlexible", true);
16459
+ __publicField(this, "flex");
16460
+ __publicField(this, "fit");
16461
+ if (flex < 0)
16462
+ throw { message: "flex must not be under zero" };
16463
+ this.flex = flex;
16464
+ this.fit = fit;
16465
+ }
16466
+ createRenderObject() {
16467
+ return new RenderFlexible({ flex: this.flex, fit: this.fit });
16468
+ }
16469
+ updateRenderObject(renderObject) {
16470
+ renderObject.flex = this.flex;
16471
+ renderObject.fit = this.fit;
16472
+ }
16473
+ };
16474
+ var RenderFlexible = class extends SingleChildRenderObject_default {
16475
+ constructor({ flex, fit }) {
16476
+ super({ isPainter: false });
16477
+ __publicField(this, "isRenderFlexible", true);
16478
+ __publicField(this, "_flex");
16479
+ __publicField(this, "_fit");
16480
+ this._flex = flex;
16481
+ this._fit = fit;
16482
+ }
16483
+ get flex() {
16484
+ return this._flex;
16485
+ }
16486
+ set flex(newFlex) {
16487
+ if (this._flex === newFlex)
16488
+ return;
16489
+ this._flex = newFlex;
16490
+ this.markNeedsLayout();
16491
+ }
16492
+ get fit() {
16493
+ return this._fit;
16494
+ }
16495
+ set fit(newFit) {
16496
+ if (this._fit === newFit)
16497
+ return;
16498
+ this._fit = newFit;
16499
+ this.markNeedsLayout();
16500
+ }
16501
+ };
16502
+ var BaseFlexible_default = Flexible;
16503
+
16490
16504
  // src/component/Flexible.ts
16491
16505
  var Flexible_default = classToFunction_default(BaseFlexible_default);
16492
16506
 
@@ -16883,6 +16897,8 @@
16883
16897
  }) {
16884
16898
  super({ child, key });
16885
16899
  __publicField(this, "padding");
16900
+ if ((child == null ? void 0 : child.isFlexible) && child.fit === "tight")
16901
+ throw { message: "Padding must not have a Expanded Widget" };
16886
16902
  this.padding = padding;
16887
16903
  }
16888
16904
  createRenderObject() {
@@ -16938,8 +16954,6 @@
16938
16954
  child,
16939
16955
  key
16940
16956
  }) {
16941
- if (child instanceof Expanded_default)
16942
- throw { message: "Padding must not have a Expanded Widget" };
16943
16957
  return new Padding({ padding, child, key });
16944
16958
  }
16945
16959
 
@@ -17527,239 +17541,103 @@
17527
17541
  let result = 0;
17528
17542
  if (type === "fr") {
17529
17543
  result = value * frUnitOnWidth;
17530
- } else {
17531
- result = fixedColumnWidths[i];
17532
- }
17533
- return result;
17534
- });
17535
- const totalFrOnHeight = this.rows.filter(({ type }) => type === "fr").map(({ value }) => value).reduce(sum, 0);
17536
- const totalFixedHeight = fixedRowHeights.reduce(sum, 0);
17537
- const frUnitOnHeight = (this.size.height - totalFixedHeight) / totalFrOnHeight;
17538
- const heights = this.rows.map(({ type, value }, i) => {
17539
- let result = 0;
17540
- if (type === "fr") {
17541
- result = value * frUnitOnHeight;
17542
- } else {
17543
- result = fixedRowHeights[i];
17544
- }
17545
- return result;
17546
- });
17547
- this.childrenByRow.forEach((columnChildren, rowIndex) => {
17548
- columnChildren.forEach((child, columnIndex) => {
17549
- const childConstraint = new constraints_default(__spreadProps(__spreadValues({}, this.constraints), {
17550
- maxHeight: heights[rowIndex],
17551
- maxWidth: widths[columnIndex]
17552
- }));
17553
- child.layout(childConstraint);
17554
- child.offset = new offset_default({
17555
- x: widths.slice(0, columnIndex).reduce(sum, 0),
17556
- y: heights.slice(0, rowIndex).reduce(sum, 0)
17557
- });
17558
- });
17559
- });
17560
- }
17561
- getIntrinsicWidth(height) {
17562
- return this.childrenByRow.map(
17563
- (row) => row.map((child) => child.getIntrinsicWidth(height)).reduce(Utils.sumReducer)
17564
- ).reduce(Utils.maxReducer);
17565
- }
17566
- getIntrinsicHeight(width) {
17567
- return this.childrenByRow.map(
17568
- (row) => row.map((child) => child.getIntrinsicHeight(width)).reduce(Utils.maxReducer)
17569
- ).reduce(Utils.sumReducer);
17570
- }
17571
- };
17572
- var GridTemplate = class _GridTemplate {
17573
- constructor({
17574
- type,
17575
- value
17576
- }) {
17577
- __publicField(this, "type");
17578
- __publicField(this, "value");
17579
- this.type = type;
17580
- this.value = value;
17581
- }
17582
- static equals(target, other) {
17583
- if (target.length !== other.length)
17584
- return false;
17585
- return target.every((value, i) => value.equals(other[i]));
17586
- }
17587
- equals(other) {
17588
- if (this === other)
17589
- return true;
17590
- return this.type === other.type && this.value === other.value;
17591
- }
17592
- static Fr(value) {
17593
- return new _GridTemplate({ value, type: "fr" });
17594
- }
17595
- static Px(value) {
17596
- return new _GridTemplate({ value, type: "px" });
17597
- }
17598
- static ContentFit() {
17599
- return new _GridTemplate({ value: 0, type: "content-fit" });
17600
- }
17601
- // 0 ~ 100
17602
- static Percent(value) {
17603
- return new _GridTemplate({ value, type: "percent" });
17604
- }
17605
- repeat(count) {
17606
- return Array.from({ length: count }, () => this);
17607
- }
17608
- };
17609
- var BaseGrid_default = BaseGrid;
17610
-
17611
- // src/component/Grid.ts
17612
- function Grid(_a) {
17613
- var _b = _a, {
17614
- childrenByRow,
17615
- key
17616
- } = _b, props = __objRest(_b, [
17617
- "childrenByRow",
17618
- "key"
17619
- ]);
17620
- return new BaseGrid_default(__spreadValues({ childrenByRow, key }, props));
17621
- }
17622
- Grid.Fr = GridTemplate.Fr;
17623
- Grid.ContentFit = GridTemplate.ContentFit;
17624
- Grid.Percent = GridTemplate.Percent;
17625
- Grid.Px = GridTemplate.Px;
17626
- var Grid_default = Grid;
17627
-
17628
- // src/component/base/BasePositioned.ts
17629
- var BasePositioned = class extends SingleChildRenderObjectWidget_default {
17630
- constructor({
17631
- top,
17632
- bottom,
17633
- left,
17634
- right,
17635
- width,
17636
- height,
17637
- child,
17638
- key
17639
- }) {
17640
- super({ child, key });
17641
- __publicField(this, "top");
17642
- __publicField(this, "bottom");
17643
- __publicField(this, "right");
17644
- __publicField(this, "left");
17645
- __publicField(this, "width");
17646
- __publicField(this, "height");
17647
- this.top = top;
17648
- this.bottom = bottom;
17649
- this.left = left;
17650
- this.right = right;
17651
- this.width = width;
17652
- this.height = height;
17653
- }
17654
- createRenderObject() {
17655
- return new RenderPositioned({
17656
- top: this.top,
17657
- left: this.left,
17658
- right: this.right,
17659
- bottom: this.bottom,
17660
- width: this.width,
17661
- height: this.height
17662
- });
17663
- }
17664
- updateRenderObject(renderObject) {
17665
- renderObject.top = this.top;
17666
- renderObject.left = this.left;
17667
- renderObject.bottom = this.bottom;
17668
- renderObject.right = this.right;
17669
- renderObject.width = this.width;
17670
- renderObject.height = this.height;
17671
- }
17672
- };
17673
- var RenderPositioned = class extends SingleChildRenderObject_default {
17674
- constructor({
17675
- top,
17676
- bottom,
17677
- left,
17678
- right,
17679
- width,
17680
- height
17681
- }) {
17682
- super({ isPainter: false });
17683
- __publicField(this, "_top");
17684
- __publicField(this, "_bottom");
17685
- __publicField(this, "_right");
17686
- __publicField(this, "_left");
17687
- __publicField(this, "_width");
17688
- __publicField(this, "_height");
17689
- this._top = top;
17690
- this._bottom = bottom;
17691
- this._left = left;
17692
- this._right = right;
17693
- this._width = width;
17694
- this._height = height;
17695
- }
17696
- get top() {
17697
- return this._top;
17698
- }
17699
- set top(newTop) {
17700
- if (this._top === newTop)
17701
- return;
17702
- this._top = newTop;
17703
- this.markNeedsLayout();
17704
- }
17705
- get bottom() {
17706
- return this._bottom;
17707
- }
17708
- set bottom(newBottom) {
17709
- if (this._bottom === newBottom)
17710
- return;
17711
- this._bottom = newBottom;
17712
- this.markNeedsLayout();
17713
- }
17714
- get right() {
17715
- return this._right;
17544
+ } else {
17545
+ result = fixedColumnWidths[i];
17546
+ }
17547
+ return result;
17548
+ });
17549
+ const totalFrOnHeight = this.rows.filter(({ type }) => type === "fr").map(({ value }) => value).reduce(sum, 0);
17550
+ const totalFixedHeight = fixedRowHeights.reduce(sum, 0);
17551
+ const frUnitOnHeight = (this.size.height - totalFixedHeight) / totalFrOnHeight;
17552
+ const heights = this.rows.map(({ type, value }, i) => {
17553
+ let result = 0;
17554
+ if (type === "fr") {
17555
+ result = value * frUnitOnHeight;
17556
+ } else {
17557
+ result = fixedRowHeights[i];
17558
+ }
17559
+ return result;
17560
+ });
17561
+ this.childrenByRow.forEach((columnChildren, rowIndex) => {
17562
+ columnChildren.forEach((child, columnIndex) => {
17563
+ const childConstraint = new constraints_default(__spreadProps(__spreadValues({}, this.constraints), {
17564
+ maxHeight: heights[rowIndex],
17565
+ maxWidth: widths[columnIndex]
17566
+ }));
17567
+ child.layout(childConstraint);
17568
+ child.offset = new offset_default({
17569
+ x: widths.slice(0, columnIndex).reduce(sum, 0),
17570
+ y: heights.slice(0, rowIndex).reduce(sum, 0)
17571
+ });
17572
+ });
17573
+ });
17716
17574
  }
17717
- set right(newRight) {
17718
- if (this._right === newRight)
17719
- return;
17720
- this._right = newRight;
17721
- this.markNeedsLayout();
17575
+ getIntrinsicWidth(height) {
17576
+ return this.childrenByRow.map(
17577
+ (row) => row.map((child) => child.getIntrinsicWidth(height)).reduce(Utils.sumReducer)
17578
+ ).reduce(Utils.maxReducer);
17722
17579
  }
17723
- get left() {
17724
- return this._left;
17580
+ getIntrinsicHeight(width) {
17581
+ return this.childrenByRow.map(
17582
+ (row) => row.map((child) => child.getIntrinsicHeight(width)).reduce(Utils.maxReducer)
17583
+ ).reduce(Utils.sumReducer);
17725
17584
  }
17726
- set left(newLeft) {
17727
- if (this._left === newLeft)
17728
- return;
17729
- this._left = newLeft;
17730
- this.markNeedsLayout();
17585
+ };
17586
+ var GridTemplate = class _GridTemplate {
17587
+ constructor({
17588
+ type,
17589
+ value
17590
+ }) {
17591
+ __publicField(this, "type");
17592
+ __publicField(this, "value");
17593
+ this.type = type;
17594
+ this.value = value;
17731
17595
  }
17732
- get width() {
17733
- return this._width;
17596
+ static equals(target, other) {
17597
+ if (target.length !== other.length)
17598
+ return false;
17599
+ return target.every((value, i) => value.equals(other[i]));
17734
17600
  }
17735
- set width(newWidth) {
17736
- if (this._width === newWidth)
17737
- return;
17738
- this._width = newWidth;
17739
- this.markNeedsLayout();
17601
+ equals(other) {
17602
+ if (this === other)
17603
+ return true;
17604
+ return this.type === other.type && this.value === other.value;
17740
17605
  }
17741
- get height() {
17742
- return this._height;
17606
+ static Fr(value) {
17607
+ return new _GridTemplate({ value, type: "fr" });
17743
17608
  }
17744
- set height(newHeight) {
17745
- if (this._height === newHeight)
17746
- return;
17747
- this._height = newHeight;
17748
- this.markNeedsLayout();
17609
+ static Px(value) {
17610
+ return new _GridTemplate({ value, type: "px" });
17749
17611
  }
17750
- get isPositioned() {
17751
- return this.top != null || this.bottom != null || this.left != null || this.right != null || this.width != null || this.height != null;
17612
+ static ContentFit() {
17613
+ return new _GridTemplate({ value: 0, type: "content-fit" });
17752
17614
  }
17753
- getIntrinsicWidth(height) {
17754
- var _a;
17755
- return ((_a = this.child) == null ? void 0 : _a.getIntrinsicWidth(height)) || 0;
17615
+ // 0 ~ 100
17616
+ static Percent(value) {
17617
+ return new _GridTemplate({ value, type: "percent" });
17756
17618
  }
17757
- getIntrinsicHeight(width) {
17758
- var _a;
17759
- return ((_a = this.child) == null ? void 0 : _a.getIntrinsicHeight(width)) || 0;
17619
+ repeat(count) {
17620
+ return Array.from({ length: count }, () => this);
17760
17621
  }
17761
17622
  };
17762
- var BasePositioned_default = BasePositioned;
17623
+ var BaseGrid_default = BaseGrid;
17624
+
17625
+ // src/component/Grid.ts
17626
+ function Grid(_a) {
17627
+ var _b = _a, {
17628
+ childrenByRow,
17629
+ key
17630
+ } = _b, props = __objRest(_b, [
17631
+ "childrenByRow",
17632
+ "key"
17633
+ ]);
17634
+ return new BaseGrid_default(__spreadValues({ childrenByRow, key }, props));
17635
+ }
17636
+ Grid.Fr = GridTemplate.Fr;
17637
+ Grid.ContentFit = GridTemplate.ContentFit;
17638
+ Grid.Percent = GridTemplate.Percent;
17639
+ Grid.Px = GridTemplate.Px;
17640
+ var Grid_default = Grid;
17763
17641
 
17764
17642
  // src/component/base/BaseStack.ts
17765
17643
  var BaseStack = class extends MultiChildRenderObjectWidget_default {
@@ -17849,7 +17727,7 @@
17849
17727
  break;
17850
17728
  }
17851
17729
  this.children.forEach((child) => {
17852
- if (child instanceof RenderPositioned && child.isPositioned)
17730
+ if (child.isRenderPositioned && child.isPositioned)
17853
17731
  return;
17854
17732
  hasNonPositionedChildren = true;
17855
17733
  child.layout(nonPositionedConstraints);
@@ -17915,7 +17793,7 @@
17915
17793
  constraints: this.constraints
17916
17794
  });
17917
17795
  this.children.forEach((child) => {
17918
- if (!(child instanceof RenderPositioned && child.isPositioned)) {
17796
+ if (!(child.isRenderPositioned && child.isPositioned)) {
17919
17797
  child.offset = this.resolvedAlignment.alongOffset(
17920
17798
  this.size.minus(child.size)
17921
17799
  );
@@ -17957,6 +17835,143 @@
17957
17835
  });
17958
17836
  }
17959
17837
 
17838
+ // src/component/base/BasePositioned.ts
17839
+ var BasePositioned = class extends SingleChildRenderObjectWidget_default {
17840
+ constructor({
17841
+ top,
17842
+ bottom,
17843
+ left,
17844
+ right,
17845
+ width,
17846
+ height,
17847
+ child,
17848
+ key
17849
+ }) {
17850
+ super({ child, key });
17851
+ __publicField(this, "top");
17852
+ __publicField(this, "bottom");
17853
+ __publicField(this, "right");
17854
+ __publicField(this, "left");
17855
+ __publicField(this, "width");
17856
+ __publicField(this, "height");
17857
+ this.top = top;
17858
+ this.bottom = bottom;
17859
+ this.left = left;
17860
+ this.right = right;
17861
+ this.width = width;
17862
+ this.height = height;
17863
+ }
17864
+ createRenderObject() {
17865
+ return new RenderPositioned({
17866
+ top: this.top,
17867
+ left: this.left,
17868
+ right: this.right,
17869
+ bottom: this.bottom,
17870
+ width: this.width,
17871
+ height: this.height
17872
+ });
17873
+ }
17874
+ updateRenderObject(renderObject) {
17875
+ renderObject.top = this.top;
17876
+ renderObject.left = this.left;
17877
+ renderObject.bottom = this.bottom;
17878
+ renderObject.right = this.right;
17879
+ renderObject.width = this.width;
17880
+ renderObject.height = this.height;
17881
+ }
17882
+ };
17883
+ var RenderPositioned = class extends SingleChildRenderObject_default {
17884
+ constructor({
17885
+ top,
17886
+ bottom,
17887
+ left,
17888
+ right,
17889
+ width,
17890
+ height
17891
+ }) {
17892
+ super({ isPainter: false });
17893
+ __publicField(this, "isRenderPositioned", true);
17894
+ __publicField(this, "_top");
17895
+ __publicField(this, "_bottom");
17896
+ __publicField(this, "_right");
17897
+ __publicField(this, "_left");
17898
+ __publicField(this, "_width");
17899
+ __publicField(this, "_height");
17900
+ this._top = top;
17901
+ this._bottom = bottom;
17902
+ this._left = left;
17903
+ this._right = right;
17904
+ this._width = width;
17905
+ this._height = height;
17906
+ }
17907
+ get top() {
17908
+ return this._top;
17909
+ }
17910
+ set top(newTop) {
17911
+ if (this._top === newTop)
17912
+ return;
17913
+ this._top = newTop;
17914
+ this.markNeedsLayout();
17915
+ }
17916
+ get bottom() {
17917
+ return this._bottom;
17918
+ }
17919
+ set bottom(newBottom) {
17920
+ if (this._bottom === newBottom)
17921
+ return;
17922
+ this._bottom = newBottom;
17923
+ this.markNeedsLayout();
17924
+ }
17925
+ get right() {
17926
+ return this._right;
17927
+ }
17928
+ set right(newRight) {
17929
+ if (this._right === newRight)
17930
+ return;
17931
+ this._right = newRight;
17932
+ this.markNeedsLayout();
17933
+ }
17934
+ get left() {
17935
+ return this._left;
17936
+ }
17937
+ set left(newLeft) {
17938
+ if (this._left === newLeft)
17939
+ return;
17940
+ this._left = newLeft;
17941
+ this.markNeedsLayout();
17942
+ }
17943
+ get width() {
17944
+ return this._width;
17945
+ }
17946
+ set width(newWidth) {
17947
+ if (this._width === newWidth)
17948
+ return;
17949
+ this._width = newWidth;
17950
+ this.markNeedsLayout();
17951
+ }
17952
+ get height() {
17953
+ return this._height;
17954
+ }
17955
+ set height(newHeight) {
17956
+ if (this._height === newHeight)
17957
+ return;
17958
+ this._height = newHeight;
17959
+ this.markNeedsLayout();
17960
+ }
17961
+ get isPositioned() {
17962
+ return this.top != null || this.bottom != null || this.left != null || this.right != null || this.width != null || this.height != null;
17963
+ }
17964
+ getIntrinsicWidth(height) {
17965
+ var _a;
17966
+ return ((_a = this.child) == null ? void 0 : _a.getIntrinsicWidth(height)) || 0;
17967
+ }
17968
+ getIntrinsicHeight(width) {
17969
+ var _a;
17970
+ return ((_a = this.child) == null ? void 0 : _a.getIntrinsicHeight(width)) || 0;
17971
+ }
17972
+ };
17973
+ var BasePositioned_default = BasePositioned;
17974
+
17960
17975
  // src/component/Positioned.ts
17961
17976
  var Positioned = classToFunction_default(
17962
17977
  BasePositioned_default
@@ -18908,7 +18923,7 @@
18908
18923
  renderObject.onWheel = this.onWheel;
18909
18924
  }
18910
18925
  };
18911
- var RenderGestureDetector = class _RenderGestureDetector extends SingleChildRenderObject_default {
18926
+ var RenderGestureDetector = class extends SingleChildRenderObject_default {
18912
18927
  constructor({
18913
18928
  onClick,
18914
18929
  onMouseDown,
@@ -18925,6 +18940,7 @@
18925
18940
  onWheel
18926
18941
  }) {
18927
18942
  super({ isPainter: true });
18943
+ __publicField(this, "isRenderGestureDetector", true);
18928
18944
  __publicField(this, "id", createUniqueId());
18929
18945
  __publicField(this, "_bubble");
18930
18946
  __publicField(this, "_cursor");
@@ -19139,7 +19155,7 @@
19139
19155
  dispatchParent(e) {
19140
19156
  let parent = this.parent;
19141
19157
  while (parent != null) {
19142
- if (parent instanceof _RenderGestureDetector) {
19158
+ if (parent == null ? void 0 : parent.isRenderGestureDetector) {
19143
19159
  parent.dispatch(e);
19144
19160
  break;
19145
19161
  }