babylonjs-gui 9.23.0 → 9.26.0

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.
@@ -4246,9 +4246,11 @@ export class ValueAndUnit {
4246
4246
  * Gets value as pixel
4247
4247
  * @param host defines the root host
4248
4248
  * @param refValue defines the reference value for percentages
4249
+ * @param fontSize defines the computed font size in pixels for em units
4250
+ * @param rootFontSize defines the computed root font size in pixels for rem units
4249
4251
  * @returns the value as pixel
4250
4252
  */
4251
- getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
4253
+ getValueInPixel(host: AdvancedDynamicTexture, refValue: number, fontSize?: number, rootFontSize?: number): number;
4252
4254
  /**
4253
4255
  * Update the current value and unit.
4254
4256
  * @param value defines the value to store
@@ -4258,10 +4260,12 @@ export class ValueAndUnit {
4258
4260
  updateInPlace(value: number, unit?: number): ValueAndUnit;
4259
4261
  /**
4260
4262
  * Gets the value accordingly to its unit
4261
- * @param host defines the root host
4263
+ * @param host defines the root host
4264
+ * @param fontSize defines the computed font size in pixels for em units
4265
+ * @param rootFontSize defines the computed root font size in pixels for rem units
4262
4266
  * @returns the value
4263
4267
  */
4264
- getValue(host: AdvancedDynamicTexture): number;
4268
+ getValue(host: AdvancedDynamicTexture, fontSize?: number, rootFontSize?: number): number;
4265
4269
  /**
4266
4270
  * Gets a string representation of the value
4267
4271
  * @param host defines the root host
@@ -4278,6 +4282,14 @@ export class ValueAndUnit {
4278
4282
  private static _Regex;
4279
4283
  private static _UNITMODE_PERCENTAGE;
4280
4284
  private static _UNITMODE_PIXEL;
4285
+ /**
4286
+ * Font-relative units, resolved against the control's computed font size.
4287
+ */
4288
+ static readonly UNITMODE_EM: number;
4289
+ /**
4290
+ * Root-relative units, resolved against the GUI root container's computed font size.
4291
+ */
4292
+ static readonly UNITMODE_REM: number;
4281
4293
  /** UNITMODE_PERCENTAGE */
4282
4294
  static get UNITMODE_PERCENTAGE(): number;
4283
4295
  /** UNITMODE_PIXEL */
@@ -6192,6 +6204,7 @@ export * from "babylonjs-gui/2D/controls/ellipse.pure";
6192
6204
  export * from "babylonjs-gui/2D/controls/focusableButton.pure";
6193
6205
  export * from "babylonjs-gui/2D/controls/focusableControl";
6194
6206
  export * from "babylonjs-gui/2D/controls/grid.pure";
6207
+ export * from "babylonjs-gui/2D/controls/flexPanel.pure";
6195
6208
  export * from "babylonjs-gui/2D/controls/image.pure";
6196
6209
  export * from "babylonjs-gui/2D/controls/inputText.pure";
6197
6210
  export * from "babylonjs-gui/2D/controls/inputTextArea.pure";
@@ -6817,6 +6830,7 @@ export * from "babylonjs-gui/2D/controls/ellipse";
6817
6830
  export * from "babylonjs-gui/2D/controls/focusableButton";
6818
6831
  export * from "babylonjs-gui/2D/controls/focusableControl";
6819
6832
  export * from "babylonjs-gui/2D/controls/grid";
6833
+ export * from "babylonjs-gui/2D/controls/flexPanel";
6820
6834
  export * from "babylonjs-gui/2D/controls/image";
6821
6835
  export * from "babylonjs-gui/2D/controls/inputText";
6822
6836
  export * from "babylonjs-gui/2D/controls/inputTextArea";
@@ -7333,6 +7347,104 @@ declare module "babylonjs-gui/2D/controls/focusableButton" {
7333
7347
  */
7334
7348
  export * from "babylonjs-gui/2D/controls/focusableButton.pure";
7335
7349
 
7350
+ }
7351
+ declare module "babylonjs-gui/2D/controls/flexPanel.pure" {
7352
+ import { Container } from "babylonjs-gui/2D/controls/container.pure";
7353
+ import { Control } from "babylonjs-gui/2D/controls/control.pure";
7354
+ import { Measure } from "babylonjs-gui/2D/measure";
7355
+ /**
7356
+ * Main-axis direction and ordering of a FlexPanel.
7357
+ */
7358
+ export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
7359
+ /**
7360
+ * Whether overflowing items form additional lines, and their cross-axis order.
7361
+ */
7362
+ export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
7363
+ /**
7364
+ * Distribution of spare space along the main axis.
7365
+ */
7366
+ export type FlexJustification = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
7367
+ /**
7368
+ * Alignment of items within each line. Stretch fills the line's cross-axis size.
7369
+ */
7370
+ export type FlexAlignment = "flex-start" | "flex-end" | "center" | "stretch";
7371
+ /**
7372
+ * Distribution of lines along the cross axis.
7373
+ */
7374
+ export type FlexContentAlignment = FlexJustification | "stretch";
7375
+ /**
7376
+ * Arranges controls in flexible rows or columns using their declared width/height as the basis.
7377
+ * Supports wrapping, gaps, alignment and Control.flexGrow/flexShrink without rewriting child properties.
7378
+ * The panel uses its declared size; intrinsic CSS sizing and baseline alignment are not supported.
7379
+ */
7380
+ export class FlexPanel extends Container {
7381
+ private _items;
7382
+ private _lines;
7383
+ private _boxes;
7384
+ private _gap;
7385
+ private _flexDirection;
7386
+ /**
7387
+ * Gets or sets the main axis and item direction. Defaults to row.
7388
+ */
7389
+ get flexDirection(): FlexDirection;
7390
+ set flexDirection(value: FlexDirection);
7391
+ private _flexWrap;
7392
+ /**
7393
+ * Gets or sets line wrapping. Defaults to nowrap.
7394
+ */
7395
+ get flexWrap(): FlexWrap;
7396
+ set flexWrap(value: FlexWrap);
7397
+ private _justifyContent;
7398
+ /**
7399
+ * Gets or sets the distribution of remaining main-axis space after flexing.
7400
+ */
7401
+ get justifyContent(): FlexJustification;
7402
+ set justifyContent(value: FlexJustification);
7403
+ private _alignItems;
7404
+ /**
7405
+ * Gets or sets cross-axis alignment within each line. Stretch fills the line.
7406
+ */
7407
+ get alignItems(): FlexAlignment;
7408
+ set alignItems(value: FlexAlignment);
7409
+ private _alignContent;
7410
+ /**
7411
+ * Gets or sets cross-axis line distribution when wrapping is enabled.
7412
+ */
7413
+ get alignContent(): FlexContentAlignment;
7414
+ set alignContent(value: FlexContentAlignment);
7415
+ /**
7416
+ * Gets or sets the gap between items and lines in px, em, rem, or percent of the main-axis size.
7417
+ */
7418
+ get gap(): string | number;
7419
+ set gap(value: string | number);
7420
+ /**
7421
+ * Creates a flex layout container.
7422
+ * @param name defines the control name
7423
+ */
7424
+ constructor(name?: string);
7425
+ protected _getTypeName(): string;
7426
+ /**
7427
+ * Removes a control and releases its cached layout data.
7428
+ * @param control defines the control to remove
7429
+ * @returns the current panel
7430
+ */
7431
+ removeControl(control: Control): FlexPanel;
7432
+ /** @internal */
7433
+ _getLayoutMeasureForChild(child: Control): Measure | null;
7434
+ private _spacing;
7435
+ private _offset;
7436
+ private _resolveFlexibleLengths;
7437
+ protected _beforeChildLayout(): void;
7438
+ }
7439
+ /**
7440
+ * Registers FlexPanel for serialization. Safe to call repeatedly.
7441
+ */
7442
+ export function RegisterFlexPanel(): void;
7443
+
7444
+ }
7445
+ declare module "babylonjs-gui/2D/controls/flexPanel" {
7446
+ export * from "babylonjs-gui/2D/controls/flexPanel.pure";
7447
+
7336
7448
  }
7337
7449
  declare module "babylonjs-gui/2D/controls/ellipse.pure" {
7338
7450
  import { Container } from "babylonjs-gui/2D/controls/container.pure";
@@ -7490,6 +7602,7 @@ export class Control implements IAnimatable, IFocusableControl {
7490
7602
  private _fontFamily;
7491
7603
  private _fontStyle;
7492
7604
  private _fontWeight;
7605
+ private static readonly _DefaultFontSize;
7493
7606
  private _fontSize;
7494
7607
  private _font;
7495
7608
  /** @internal */
@@ -7853,7 +7966,11 @@ export class Control implements IAnimatable, IFocusableControl {
7853
7966
  /** Gets or sets font size in pixels */
7854
7967
  get fontSizeInPixels(): number;
7855
7968
  set fontSizeInPixels(value: number);
7856
- /** Gets or sets font size */
7969
+ /**
7970
+ * Gets or sets the font size in px, percent of parent height, em, or rem.
7971
+ * For font declarations, em uses the parent font and rem uses the GUI root font.
7972
+ * Relative font sizes on the root use the default 18px font, including adaptive scaling.
7973
+ */
7857
7974
  get fontSize(): string | number;
7858
7975
  set fontSize(value: string | number);
7859
7976
  /** Gets or sets foreground color */
@@ -8061,6 +8178,18 @@ export class Control implements IAnimatable, IFocusableControl {
8061
8178
  * @param evt Defines the KeyboardEvent
8062
8179
  */
8063
8180
  processKeyboard(evt: IKeyboardEvent): void;
8181
+ private _flexGrow;
8182
+ /**
8183
+ * Gets or sets the nonnegative share of free main-axis space in a FlexPanel.
8184
+ */
8185
+ get flexGrow(): number;
8186
+ set flexGrow(value: number);
8187
+ private _flexShrink;
8188
+ /**
8189
+ * Gets or sets the nonnegative shrink factor in a FlexPanel, weighted by the declared main-axis size.
8190
+ */
8191
+ get flexShrink(): number;
8192
+ set flexShrink(value: number);
8064
8193
  /**
8065
8194
  * Creates a new control
8066
8195
  * @param name defines the name of the control
@@ -8221,6 +8350,14 @@ export class Control implements IAnimatable, IFocusableControl {
8221
8350
  */
8222
8351
  protected _processMeasures(parentMeasure: Measure, context: ICanvasRenderingContext): void;
8223
8352
  protected _evaluateClippingState(parentMeasure: Measure): void;
8353
+ /**
8354
+ * Resolves a GUI dimension using this control's computed font size.
8355
+ * @param value defines the dimension to resolve
8356
+ * @param reference defines the reference size for percentages
8357
+ * @returns the dimension in pixels
8358
+ * @internal
8359
+ */
8360
+ _getValueInPixel(value: ValueAndUnit, reference: number): number;
8224
8361
  /** @internal */
8225
8362
  _measure(): void;
8226
8363
  /**
@@ -8553,6 +8690,15 @@ export class Container extends Control {
8553
8690
  * @internal
8554
8691
  */
8555
8692
  _layout(parentMeasure: Measure, context: ICanvasRenderingContext): boolean;
8693
+ /** @internal */
8694
+ protected _beforeChildLayout(): void;
8695
+ /**
8696
+ * Gets an optional parent-controlled layout box, relative to the content origin.
8697
+ * @param _child defines the child to lay out
8698
+ * @returns the layout box, or null for the child's own layout
8699
+ * @internal
8700
+ */
8701
+ _getLayoutMeasureForChild(_child: Control): Nullable<Measure>;
8556
8702
  protected _postMeasure(): void;
8557
8703
  private _inverseTransformMatrix;
8558
8704
  private _inverseMeasure;
@@ -13591,9 +13737,11 @@ declare namespace BABYLON.GUI {
13591
13737
  * Gets value as pixel
13592
13738
  * @param host defines the root host
13593
13739
  * @param refValue defines the reference value for percentages
13740
+ * @param fontSize defines the computed font size in pixels for em units
13741
+ * @param rootFontSize defines the computed root font size in pixels for rem units
13594
13742
  * @returns the value as pixel
13595
13743
  */
13596
- getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
13744
+ getValueInPixel(host: AdvancedDynamicTexture, refValue: number, fontSize?: number, rootFontSize?: number): number;
13597
13745
  /**
13598
13746
  * Update the current value and unit.
13599
13747
  * @param value defines the value to store
@@ -13603,10 +13751,12 @@ declare namespace BABYLON.GUI {
13603
13751
  updateInPlace(value: number, unit?: number): ValueAndUnit;
13604
13752
  /**
13605
13753
  * Gets the value accordingly to its unit
13606
- * @param host defines the root host
13754
+ * @param host defines the root host
13755
+ * @param fontSize defines the computed font size in pixels for em units
13756
+ * @param rootFontSize defines the computed root font size in pixels for rem units
13607
13757
  * @returns the value
13608
13758
  */
13609
- getValue(host: AdvancedDynamicTexture): number;
13759
+ getValue(host: AdvancedDynamicTexture, fontSize?: number, rootFontSize?: number): number;
13610
13760
  /**
13611
13761
  * Gets a string representation of the value
13612
13762
  * @param host defines the root host
@@ -13623,6 +13773,14 @@ declare namespace BABYLON.GUI {
13623
13773
  private static _Regex;
13624
13774
  private static _UNITMODE_PERCENTAGE;
13625
13775
  private static _UNITMODE_PIXEL;
13776
+ /**
13777
+ * Font-relative units, resolved against the control's computed font size.
13778
+ */
13779
+ static readonly UNITMODE_EM = 2;
13780
+ /**
13781
+ * Root-relative units, resolved against the GUI root container's computed font size.
13782
+ */
13783
+ static readonly UNITMODE_REM = 3;
13626
13784
  /** UNITMODE_PERCENTAGE */
13627
13785
  static get UNITMODE_PERCENTAGE(): number;
13628
13786
  /** UNITMODE_PIXEL */
@@ -16411,6 +16569,98 @@ declare namespace BABYLON.GUI {
16411
16569
  */
16412
16570
 
16413
16571
 
16572
+ /**
16573
+ * Main-axis direction and ordering of a FlexPanel.
16574
+ */
16575
+ export type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
16576
+ /**
16577
+ * Whether overflowing items form additional lines, and their cross-axis order.
16578
+ */
16579
+ export type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
16580
+ /**
16581
+ * Distribution of spare space along the main axis.
16582
+ */
16583
+ export type FlexJustification = "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
16584
+ /**
16585
+ * Alignment of items within each line. Stretch fills the line's cross-axis size.
16586
+ */
16587
+ export type FlexAlignment = "flex-start" | "flex-end" | "center" | "stretch";
16588
+ /**
16589
+ * Distribution of lines along the cross axis.
16590
+ */
16591
+ export type FlexContentAlignment = FlexJustification | "stretch";
16592
+ /**
16593
+ * Arranges controls in flexible rows or columns using their declared width/height as the basis.
16594
+ * Supports wrapping, gaps, alignment and Control.flexGrow/flexShrink without rewriting child properties.
16595
+ * The panel uses its declared size; intrinsic CSS sizing and baseline alignment are not supported.
16596
+ */
16597
+ export class FlexPanel extends Container {
16598
+ private _items;
16599
+ private _lines;
16600
+ private _boxes;
16601
+ private _gap;
16602
+ private _flexDirection;
16603
+ /**
16604
+ * Gets or sets the main axis and item direction. Defaults to row.
16605
+ */
16606
+ get flexDirection(): FlexDirection;
16607
+ set flexDirection(value: FlexDirection);
16608
+ private _flexWrap;
16609
+ /**
16610
+ * Gets or sets line wrapping. Defaults to nowrap.
16611
+ */
16612
+ get flexWrap(): FlexWrap;
16613
+ set flexWrap(value: FlexWrap);
16614
+ private _justifyContent;
16615
+ /**
16616
+ * Gets or sets the distribution of remaining main-axis space after flexing.
16617
+ */
16618
+ get justifyContent(): FlexJustification;
16619
+ set justifyContent(value: FlexJustification);
16620
+ private _alignItems;
16621
+ /**
16622
+ * Gets or sets cross-axis alignment within each line. Stretch fills the line.
16623
+ */
16624
+ get alignItems(): FlexAlignment;
16625
+ set alignItems(value: FlexAlignment);
16626
+ private _alignContent;
16627
+ /**
16628
+ * Gets or sets cross-axis line distribution when wrapping is enabled.
16629
+ */
16630
+ get alignContent(): FlexContentAlignment;
16631
+ set alignContent(value: FlexContentAlignment);
16632
+ /**
16633
+ * Gets or sets the gap between items and lines in px, em, rem, or percent of the main-axis size.
16634
+ */
16635
+ get gap(): string | number;
16636
+ set gap(value: string | number);
16637
+ /**
16638
+ * Creates a flex layout container.
16639
+ * @param name defines the control name
16640
+ */
16641
+ constructor(name?: string);
16642
+ protected _getTypeName(): string;
16643
+ /**
16644
+ * Removes a control and releases its cached layout data.
16645
+ * @param control defines the control to remove
16646
+ * @returns the current panel
16647
+ */
16648
+ removeControl(control: Control): FlexPanel;
16649
+ /** @internal */
16650
+ _getLayoutMeasureForChild(child: Control): Measure | null;
16651
+ private _spacing;
16652
+ private _offset;
16653
+ private _resolveFlexibleLengths;
16654
+ protected _beforeChildLayout(): void;
16655
+ }
16656
+ /**
16657
+ * Registers FlexPanel for serialization. Safe to call repeatedly.
16658
+ */
16659
+ export function RegisterFlexPanel(): void;
16660
+
16661
+
16662
+
16663
+
16414
16664
  /** Class used to create 2D ellipse containers */
16415
16665
  export class Ellipse extends Container {
16416
16666
  name?: string | undefined;
@@ -16535,6 +16785,7 @@ declare namespace BABYLON.GUI {
16535
16785
  private _fontFamily;
16536
16786
  private _fontStyle;
16537
16787
  private _fontWeight;
16788
+ private static readonly _DefaultFontSize;
16538
16789
  private _fontSize;
16539
16790
  private _font;
16540
16791
  /** @internal */
@@ -16898,7 +17149,11 @@ declare namespace BABYLON.GUI {
16898
17149
  /** Gets or sets font size in pixels */
16899
17150
  get fontSizeInPixels(): number;
16900
17151
  set fontSizeInPixels(value: number);
16901
- /** Gets or sets font size */
17152
+ /**
17153
+ * Gets or sets the font size in px, percent of parent height, em, or rem.
17154
+ * For font declarations, em uses the parent font and rem uses the GUI root font.
17155
+ * Relative font sizes on the root use the default 18px font, including adaptive scaling.
17156
+ */
16902
17157
  get fontSize(): string | number;
16903
17158
  set fontSize(value: string | number);
16904
17159
  /** Gets or sets foreground color */
@@ -17106,6 +17361,18 @@ declare namespace BABYLON.GUI {
17106
17361
  * @param evt Defines the KeyboardEvent
17107
17362
  */
17108
17363
  processKeyboard(evt: BABYLON.IKeyboardEvent): void;
17364
+ private _flexGrow;
17365
+ /**
17366
+ * Gets or sets the nonnegative share of free main-axis space in a FlexPanel.
17367
+ */
17368
+ get flexGrow(): number;
17369
+ set flexGrow(value: number);
17370
+ private _flexShrink;
17371
+ /**
17372
+ * Gets or sets the nonnegative shrink factor in a FlexPanel, weighted by the declared main-axis size.
17373
+ */
17374
+ get flexShrink(): number;
17375
+ set flexShrink(value: number);
17109
17376
  /**
17110
17377
  * Creates a new control
17111
17378
  * @param name defines the name of the control
@@ -17266,6 +17533,14 @@ declare namespace BABYLON.GUI {
17266
17533
  */
17267
17534
  protected _processMeasures(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): void;
17268
17535
  protected _evaluateClippingState(parentMeasure: Measure): void;
17536
+ /**
17537
+ * Resolves a GUI dimension using this control's computed font size.
17538
+ * @param value defines the dimension to resolve
17539
+ * @param reference defines the reference size for percentages
17540
+ * @returns the dimension in pixels
17541
+ * @internal
17542
+ */
17543
+ _getValueInPixel(value: ValueAndUnit, reference: number): number;
17269
17544
  /** @internal */
17270
17545
  _measure(): void;
17271
17546
  /**
@@ -17586,6 +17861,15 @@ declare namespace BABYLON.GUI {
17586
17861
  * @internal
17587
17862
  */
17588
17863
  _layout(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): boolean;
17864
+ /** @internal */
17865
+ protected _beforeChildLayout(): void;
17866
+ /**
17867
+ * Gets an optional parent-controlled layout box, relative to the content origin.
17868
+ * @param _child defines the child to lay out
17869
+ * @returns the layout box, or null for the child's own layout
17870
+ * @internal
17871
+ */
17872
+ _getLayoutMeasureForChild(_child: Control): BABYLON.Nullable<Measure>;
17589
17873
  protected _postMeasure(): void;
17590
17874
  private _inverseTransformMatrix;
17591
17875
  private _inverseMeasure;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "babylonjs-gui",
3
- "version": "9.23.0",
3
+ "version": "9.26.0",
4
4
  "main": "babylon.gui.min.js",
5
5
  "types": "babylon.gui.module.d.ts",
6
6
  "files": [
7
7
  "*"
8
8
  ],
9
9
  "scripts": {
10
- "build": "npm run clean & npm run build:prod && npm run build:declaration",
10
+ "build": "npm run clean && npm run build:prod && npm run build:declaration",
11
11
  "build:dev": "rollup -c rollup.config.umd.mjs",
12
12
  "build:dev:fast": "rollup -c rollup.config.umd.mjs --environment ROLLUP_DEVMODE:true",
13
13
  "build:prod": "rollup -c rollup.config.umd.mjs --environment ROLLUP_MODE:production",
@@ -16,7 +16,7 @@
16
16
  "test:escheck": "es-check es6 ./babylon.gui.js"
17
17
  },
18
18
  "dependencies": {
19
- "babylonjs": "9.23.0"
19
+ "babylonjs": "9.26.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/build-tools": "1.0.0",