@energy8platform/game-engine 0.14.2 → 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.cjs.js +41 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.esm.js +41 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/react.cjs.js +54 -10
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.esm.js +54 -10
- package/dist/react.esm.js.map +1 -1
- package/dist/ui.cjs.js +41 -3
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.d.ts +11 -0
- package/dist/ui.esm.js +41 -3
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/react/applyProps.ts +1 -1
- package/src/react/reconciler.ts +19 -7
- package/src/ui/FlexContainer.ts +7 -3
- package/src/ui/Modal.ts +29 -3
- package/src/ui/Panel.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -1693,6 +1693,10 @@ declare class Panel extends Container {
|
|
|
1693
1693
|
constructor(config?: PanelConfig);
|
|
1694
1694
|
/** Access the content flex container — add children here for layout */
|
|
1695
1695
|
get content(): FlexContainer;
|
|
1696
|
+
/** Suspend content layout recalculation. Call resumeLayout() to flush. */
|
|
1697
|
+
suspendLayout(): void;
|
|
1698
|
+
/** Resume content layout and flush if dirty. */
|
|
1699
|
+
resumeLayout(): void;
|
|
1696
1700
|
/** Convenience: add a child to the content layout */
|
|
1697
1701
|
addContent(child: Container): this;
|
|
1698
1702
|
/** Resize the panel */
|
|
@@ -1863,11 +1867,18 @@ declare class Modal extends Container {
|
|
|
1863
1867
|
private _contentContainer;
|
|
1864
1868
|
private _config;
|
|
1865
1869
|
private _showing;
|
|
1870
|
+
private _internalSetup;
|
|
1866
1871
|
/** Called when the modal is closed */
|
|
1867
1872
|
onClose?: () => void;
|
|
1868
1873
|
constructor(config?: ModalConfig);
|
|
1869
1874
|
/** Content container — add your UI here */
|
|
1870
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;
|
|
1871
1882
|
/** Whether the modal is currently showing */
|
|
1872
1883
|
get isShowing(): boolean;
|
|
1873
1884
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -3257,7 +3257,8 @@ class FlexContainer extends Container {
|
|
|
3257
3257
|
this._explicitWidth = width;
|
|
3258
3258
|
this._explicitHeight = height;
|
|
3259
3259
|
this._layoutDirty = true;
|
|
3260
|
-
this.
|
|
3260
|
+
if (!this._layoutSuspended)
|
|
3261
|
+
this.updateLayout();
|
|
3261
3262
|
}
|
|
3262
3263
|
/** Update layout direction */
|
|
3263
3264
|
setDirection(direction) {
|
|
@@ -3290,6 +3291,10 @@ class FlexContainer extends Container {
|
|
|
3290
3291
|
* adding/removing children without resize.
|
|
3291
3292
|
*/
|
|
3292
3293
|
updateLayout() {
|
|
3294
|
+
if (this._layoutSuspended) {
|
|
3295
|
+
this._layoutDirty = true;
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3293
3298
|
this._layoutDirty = false;
|
|
3294
3299
|
const { direction, justifyContent, alignItems, gap, flexWrap, alignContent } = this._config;
|
|
3295
3300
|
const [pt, pr, pb, pl] = this._padding;
|
|
@@ -3498,11 +3503,12 @@ class FlexContainer extends Container {
|
|
|
3498
3503
|
this._explicitWidth = typeof w === 'number' ? w : 0;
|
|
3499
3504
|
this._explicitHeight = typeof h === 'number' ? h : 0;
|
|
3500
3505
|
this._layoutDirty = true;
|
|
3501
|
-
this.
|
|
3506
|
+
if (!this._layoutSuspended)
|
|
3507
|
+
this.updateLayout();
|
|
3502
3508
|
}
|
|
3503
3509
|
return;
|
|
3504
3510
|
}
|
|
3505
|
-
if (this._layoutDirty)
|
|
3511
|
+
if (this._layoutDirty && !this._layoutSuspended)
|
|
3506
3512
|
this.updateLayout();
|
|
3507
3513
|
}
|
|
3508
3514
|
destroy(options) {
|
|
@@ -4085,6 +4091,14 @@ class Panel extends Container {
|
|
|
4085
4091
|
get content() {
|
|
4086
4092
|
return this._content;
|
|
4087
4093
|
}
|
|
4094
|
+
/** Suspend content layout recalculation. Call resumeLayout() to flush. */
|
|
4095
|
+
suspendLayout() {
|
|
4096
|
+
this._content.suspendLayout();
|
|
4097
|
+
}
|
|
4098
|
+
/** Resume content layout and flush if dirty. */
|
|
4099
|
+
resumeLayout() {
|
|
4100
|
+
this._content.resumeLayout();
|
|
4101
|
+
}
|
|
4088
4102
|
/** Convenience: add a child to the content layout */
|
|
4089
4103
|
addContent(child) {
|
|
4090
4104
|
this._content.addFlexChild(child);
|
|
@@ -4388,6 +4402,7 @@ class Modal extends Container {
|
|
|
4388
4402
|
_contentContainer;
|
|
4389
4403
|
_config;
|
|
4390
4404
|
_showing = false;
|
|
4405
|
+
_internalSetup = true;
|
|
4391
4406
|
/** Called when the modal is closed */
|
|
4392
4407
|
onClose;
|
|
4393
4408
|
constructor(config = {}) {
|
|
@@ -4409,11 +4424,34 @@ class Modal extends Container {
|
|
|
4409
4424
|
this._contentContainer = new Container();
|
|
4410
4425
|
this.addChild(this._contentContainer);
|
|
4411
4426
|
this.visible = false;
|
|
4427
|
+
this._internalSetup = false;
|
|
4412
4428
|
}
|
|
4413
4429
|
/** Content container — add your UI here */
|
|
4414
4430
|
get content() {
|
|
4415
4431
|
return this._contentContainer;
|
|
4416
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
|
+
}
|
|
4417
4455
|
/** Whether the modal is currently showing */
|
|
4418
4456
|
get isShowing() {
|
|
4419
4457
|
return this._showing;
|