@energy8platform/game-engine 0.14.3 → 0.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1867,11 +1867,18 @@ declare class Modal extends Container {
1867
1867
  private _contentContainer;
1868
1868
  private _config;
1869
1869
  private _showing;
1870
+ private _internalSetup;
1870
1871
  /** Called when the modal is closed */
1871
1872
  onClose?: () => void;
1872
1873
  constructor(config?: ModalConfig);
1873
1874
  /** Content container — add your UI here */
1874
1875
  get content(): Container;
1876
+ /**
1877
+ * Override addChild so external children are routed to _contentContainer.
1878
+ * Enables `<modal><flexContainer>...</flexContainer></modal>` in React JSX.
1879
+ */
1880
+ addChild<T extends Container>(...children: T[]): T;
1881
+ removeChild<T extends Container>(...children: T[]): T;
1875
1882
  /** Whether the modal is currently showing */
1876
1883
  get isShowing(): boolean;
1877
1884
  /**
package/dist/index.esm.js CHANGED
@@ -4402,6 +4402,7 @@ class Modal extends Container {
4402
4402
  _contentContainer;
4403
4403
  _config;
4404
4404
  _showing = false;
4405
+ _internalSetup = true;
4405
4406
  /** Called when the modal is closed */
4406
4407
  onClose;
4407
4408
  constructor(config = {}) {
@@ -4423,11 +4424,34 @@ class Modal extends Container {
4423
4424
  this._contentContainer = new Container();
4424
4425
  this.addChild(this._contentContainer);
4425
4426
  this.visible = false;
4427
+ this._internalSetup = false;
4426
4428
  }
4427
4429
  /** Content container — add your UI here */
4428
4430
  get content() {
4429
4431
  return this._contentContainer;
4430
4432
  }
4433
+ /**
4434
+ * Override addChild so external children are routed to _contentContainer.
4435
+ * Enables `<modal><flexContainer>...</flexContainer></modal>` in React JSX.
4436
+ */
4437
+ addChild(...children) {
4438
+ if (this._internalSetup) {
4439
+ return super.addChild(...children);
4440
+ }
4441
+ for (const child of children) {
4442
+ this._contentContainer.addChild(child);
4443
+ }
4444
+ return children[0];
4445
+ }
4446
+ removeChild(...children) {
4447
+ if (this._internalSetup) {
4448
+ return super.removeChild(...children);
4449
+ }
4450
+ for (const child of children) {
4451
+ this._contentContainer.removeChild(child);
4452
+ }
4453
+ return children[0];
4454
+ }
4431
4455
  /** Whether the modal is currently showing */
4432
4456
  get isShowing() {
4433
4457
  return this._showing;