@wcardinal/wcardinal-ui 0.386.0 → 0.387.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.
@@ -7,7 +7,7 @@ import { DOnOptions } from "./d-on-options";
7
7
  * A dialog to select values.
8
8
  */
9
9
  export interface DButtonSelectDialog<VALUE> {
10
- readonly value: VALUE | null;
10
+ value: VALUE | null;
11
11
  open(opener?: DDialogOpener): Promise<unknown>;
12
12
  }
13
13
  /**
@@ -11,6 +11,7 @@ import { DDialogMode } from "./d-dialog-mode";
11
11
  import { DOnOptions } from "./d-on-options";
12
12
  import { DPadding } from "./d-padding";
13
13
  import { UtilOverlay } from "./util/util-overlay";
14
+ import { DApplicationTarget } from "./d-application-like";
14
15
  /**
15
16
  * {@link DDialog} events.
16
17
  */
@@ -65,7 +66,7 @@ export interface DThemeDialog extends DThemeBase {
65
66
  getAlign(mode: DDialogMode): DDialogAlign | null;
66
67
  newAnimation(mode: DDialogMode): DAnimation<DBase> | null;
67
68
  }
68
- export interface DDialogOpener {
69
+ export interface DDialogOpener extends DApplicationTarget {
69
70
  getBounds(skipUpdate?: boolean, rect?: PIXI.Rectangle): Rectangle;
70
71
  }
71
72
  /**
@@ -73,8 +74,11 @@ export interface DDialogOpener {
73
74
  *
74
75
  * If multiple application instances are there, better to set the constructor
75
76
  * option `parent` to an `application.stage` so that the dialog picks a right
76
- * application. By default, the dialog assumes the last created application is
77
- * the one it belongs to at the time when it is created.
77
+ * application. `DDialog` searches applications in a following order:
78
+ *
79
+ * * To begin, `DDialog` tries to find applications which it belongs to.
80
+ * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to.
81
+ * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to.
78
82
  */
79
83
  export declare class DDialog<VALUE = void, THEME extends DThemeDialog = DThemeDialog, OPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>> extends DBase<THEME, OPTIONS> {
80
84
  protected static WORK_BOUNDS?: Rectangle;
@@ -1,4 +1,5 @@
1
1
  import { Rectangle } from "pixi.js";
2
- export interface DMenuOpener {
2
+ import { DApplicationTarget } from "./d-application-like";
3
+ export interface DMenuOpener extends DApplicationTarget {
3
4
  getBounds(skipUpdate?: boolean, result?: Rectangle): Rectangle;
4
5
  }
@@ -7,5 +7,5 @@ export declare class UtilOverlay {
7
7
  parent?: unknown;
8
8
  });
9
9
  get picked(): DApplicationLayerLike | null;
10
- pick(target: DApplicationTarget): DApplicationLayerLike;
10
+ pick(owner: DApplicationTarget, opener?: DApplicationTarget): DApplicationLayerLike;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"d-button-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-button-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,OAAO,EAA+C,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AA8ExE,IAAM,aAAa,GAAG,UAAC,MAAgC;IACtD,qCAAqC;IACrC,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG;IACrB,aAAa;AACd,CAAC,CAAC;AAEF;IAaU,iCAAqC;IAK9C,uBAAY,OAAiB;;QAA7B,YACC,kBAAM,OAAO,CAAC,SAGd;QAFA,KAAI,CAAC,aAAa,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,aAAa,CAAC;QACtD,KAAI,CAAC,aAAa,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,aAAa,CAAC;;IACvD,CAAC;IAES,kCAAU,GAApB,UACC,CAA0E;QAD3E,iBAcC;;QAXA,iBAAM,UAAU,YAAC,CAAC,CAAC,CAAC;QACpB,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAM,QAAQ,GAAG,MAAA,I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0\n */\n\nimport { interaction } from \"pixi.js\";\nimport { DButton, DButtonEvents, DButtonOptions, DThemeButton } from \"./d-button\";\nimport { DDialogOpener } from \"./d-dialog\";\nimport { DDialogSelect, DDialogSelectOptions } from \"./d-dialog-select\";\nimport { DOnOptions } from \"./d-on-options\";\n\n/**\n * A dialog to select values.\n */\nexport interface DButtonSelectDialog<VALUE> {\n\treadonly value: VALUE | null;\n\topen(opener?: DDialogOpener): Promise<unknown>;\n}\n\n/**\n * A function to retrieve a selected value from a dialog.\n */\nexport type DButtonSelectGetter<VALUE, DIALOG> = (dialog: DIALOG) => VALUE | null;\n\n/**\n * A function to set a selecte value to a dialog.\n * Called before opening a dialog.\n */\nexport type DButtonSelectSetter<VALUE, DIALOG> = (dialog: DIALOG, value: VALUE | null) => void;\n\n/**\n * {@link DButtonSelect} events.\n */\nexport interface DButtonSelectEvents<VALUE, EMITTER> extends DButtonEvents<VALUE, EMITTER> {\n\t/**\n\t * Triggered when a selection is changed.\n\t *\n\t * @param newValue a newly selected value\n\t * @param oldValue a previously selected value\n\t * @param emitter an emitter\n\t */\n\tchange(newValue: VALUE | null, oldValue: VALUE | null, emitter: EMITTER): void;\n}\n\n/**\n * {@link DButtonSelect} \"on\" options.\n */\nexport interface DButtonSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DButtonSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DButtonSelect} options.\n */\nexport interface DButtonSelectOptions<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tEMITTER = any\n> extends DButtonOptions<VALUE | null, THEME, EMITTER> {\n\t/**\n\t * A function to retrieve a selected value from a dialog.\n\t */\n\tgetter?: DButtonSelectGetter<VALUE, DIALOG>;\n\n\t/**\n\t * A function to set a selected value to a dialog.\n\t * Called before opening a dialog.\n\t */\n\tsetter?: DButtonSelectSetter<VALUE, DIALOG>;\n\n\t/**\n\t * A dialog to select values.\n\t */\n\tdialog?: DDialogSelectOptions<DIALOG_VALUE, DIALOG_CATEGORY_ID> | DIALOG;\n\n\ton?: DButtonSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DButtonSelect} theme.\n */\nexport interface DThemeButtonSelect<VALUE = unknown> extends DThemeButton<VALUE | null> {}\n\nconst defaultGetter = (dialog: DButtonSelectDialog<any>): any => {\n\t// Assumes the dialog.value is VALUE.\n\treturn dialog.value;\n};\n\nconst defaultSetter = (): void => {\n\t// DO NOTHING\n};\n\nexport class DButtonSelect<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tOPTIONS extends DButtonSelectOptions<\n\t\tVALUE,\n\t\tDIALOG_VALUE,\n\t\tDIALOG_CATEGORY_ID,\n\t\tDIALOG,\n\t\tTHEME\n\t> = DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG_CATEGORY_ID, DIALOG, THEME>\n> extends DButton<VALUE | null, THEME, OPTIONS> {\n\tprotected _dialog?: DIALOG;\n\tprotected _dialogGetter: DButtonSelectGetter<VALUE, DIALOG>;\n\tprotected _dialogSetter: DButtonSelectSetter<VALUE, DIALOG>;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._dialogGetter = options?.getter ?? defaultGetter;\n\t\tthis._dialogSetter = options?.setter ?? defaultSetter;\n\t}\n\n\tprotected onActivate(\n\t\te?: interaction.InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent\n\t): void {\n\t\tsuper.onActivate(e);\n\t\tconst dialog = this.dialog;\n\t\tconst oldValue = this._textValueComputed ?? null;\n\t\tthis._dialogSetter(dialog, oldValue);\n\t\tdialog.open(this).then((): void => {\n\t\t\tconst newValue = this._dialogGetter(dialog);\n\t\t\tif (newValue !== oldValue) {\n\t\t\t\tthis.text = newValue;\n\t\t\t\tthis.emit(\"change\", newValue, oldValue, this);\n\t\t\t}\n\t\t});\n\t}\n\n\tget dialog(): DIALOG {\n\t\tlet dialog = this._dialog;\n\t\tif (dialog == null) {\n\t\t\tconst options = this._options?.dialog;\n\t\t\tif (options && \"open\" in options) {\n\t\t\t\tdialog = options;\n\t\t\t} else {\n\t\t\t\t// Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.\n\t\t\t\tdialog = new DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>(\n\t\t\t\t\toptions\n\t\t\t\t) as any as DIALOG;\n\t\t\t}\n\t\t\tthis._dialog = dialog;\n\t\t}\n\t\treturn dialog;\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._textValueComputed ?? null;\n\t}\n\n\tset value(value: VALUE | null) {\n\t\tthis.text = value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DButtonSelect\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-button-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-button-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,OAAO,EAA+C,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AA8ExE,IAAM,aAAa,GAAG,UAAC,MAAgC;IACtD,qCAAqC;IACrC,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG;IACrB,aAAa;AACd,CAAC,CAAC;AAEF;IAaU,iCAAqC;IAK9C,uBAAY,OAAiB;;QAA7B,YACC,kBAAM,OAAO,CAAC,SAGd;QAFA,KAAI,CAAC,aAAa,GAAG,MAA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;IAED,sBAAI,gCAAK;aAAT;;YACC,OAAO,MAAA,IAAI,CAAC,kBAAkB,mCAAI,IAAI,CAAC;QACxC,CAAC;aAED,UAAU,KAAmB;YAC5B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,CAAC;;;OAJA;IAMS,+BAAO,GAAjB;QACC,OAAO,eAAe,CAAC;IACxB,CAAC;IACF,oBAAC;AAAD,CAAC,AApED,CAaU,OAAO,GAuDhB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction } from \"pixi.js\";\nimport { DButton, DButtonEvents, DButtonOptions, DThemeButton } from \"./d-button\";\nimport { DDialogOpener } from \"./d-dialog\";\nimport { DDialogSelect, DDialogSelectOptions } from \"./d-dialog-select\";\nimport { DOnOptions } from \"./d-on-options\";\n\n/**\n * A dialog to select values.\n */\nexport interface DButtonSelectDialog<VALUE> {\n\tvalue: VALUE | null;\n\topen(opener?: DDialogOpener): Promise<unknown>;\n}\n\n/**\n * A function to retrieve a selected value from a dialog.\n */\nexport type DButtonSelectGetter<VALUE, DIALOG> = (dialog: DIALOG) => VALUE | null;\n\n/**\n * A function to set a selecte value to a dialog.\n * Called before opening a dialog.\n */\nexport type DButtonSelectSetter<VALUE, DIALOG> = (dialog: DIALOG, value: VALUE | null) => void;\n\n/**\n * {@link DButtonSelect} events.\n */\nexport interface DButtonSelectEvents<VALUE, EMITTER> extends DButtonEvents<VALUE, EMITTER> {\n\t/**\n\t * Triggered when a selection is changed.\n\t *\n\t * @param newValue a newly selected value\n\t * @param oldValue a previously selected value\n\t * @param emitter an emitter\n\t */\n\tchange(newValue: VALUE | null, oldValue: VALUE | null, emitter: EMITTER): void;\n}\n\n/**\n * {@link DButtonSelect} \"on\" options.\n */\nexport interface DButtonSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DButtonSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DButtonSelect} options.\n */\nexport interface DButtonSelectOptions<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tEMITTER = any\n> extends DButtonOptions<VALUE | null, THEME, EMITTER> {\n\t/**\n\t * A function to retrieve a selected value from a dialog.\n\t */\n\tgetter?: DButtonSelectGetter<VALUE, DIALOG>;\n\n\t/**\n\t * A function to set a selected value to a dialog.\n\t * Called before opening a dialog.\n\t */\n\tsetter?: DButtonSelectSetter<VALUE, DIALOG>;\n\n\t/**\n\t * A dialog to select values.\n\t */\n\tdialog?: DDialogSelectOptions<DIALOG_VALUE, DIALOG_CATEGORY_ID> | DIALOG;\n\n\ton?: DButtonSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DButtonSelect} theme.\n */\nexport interface DThemeButtonSelect<VALUE = unknown> extends DThemeButton<VALUE | null> {}\n\nconst defaultGetter = (dialog: DButtonSelectDialog<any>): any => {\n\t// Assumes the dialog.value is VALUE.\n\treturn dialog.value;\n};\n\nconst defaultSetter = (): void => {\n\t// DO NOTHING\n};\n\nexport class DButtonSelect<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tOPTIONS extends DButtonSelectOptions<\n\t\tVALUE,\n\t\tDIALOG_VALUE,\n\t\tDIALOG_CATEGORY_ID,\n\t\tDIALOG,\n\t\tTHEME\n\t> = DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG_CATEGORY_ID, DIALOG, THEME>\n> extends DButton<VALUE | null, THEME, OPTIONS> {\n\tprotected _dialog?: DIALOG;\n\tprotected _dialogGetter: DButtonSelectGetter<VALUE, DIALOG>;\n\tprotected _dialogSetter: DButtonSelectSetter<VALUE, DIALOG>;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._dialogGetter = options?.getter ?? defaultGetter;\n\t\tthis._dialogSetter = options?.setter ?? defaultSetter;\n\t}\n\n\tprotected onActivate(\n\t\te?: interaction.InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent\n\t): void {\n\t\tsuper.onActivate(e);\n\t\tconst dialog = this.dialog;\n\t\tconst oldValue = this._textValueComputed ?? null;\n\t\tthis._dialogSetter(dialog, oldValue);\n\t\tdialog.open(this).then((): void => {\n\t\t\tconst newValue = this._dialogGetter(dialog);\n\t\t\tif (newValue !== oldValue) {\n\t\t\t\tthis.text = newValue;\n\t\t\t\tthis.emit(\"change\", newValue, oldValue, this);\n\t\t\t}\n\t\t});\n\t}\n\n\tget dialog(): DIALOG {\n\t\tlet dialog = this._dialog;\n\t\tif (dialog == null) {\n\t\t\tconst options = this._options?.dialog;\n\t\t\tif (options && \"open\" in options) {\n\t\t\t\tdialog = options;\n\t\t\t} else {\n\t\t\t\t// Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.\n\t\t\t\tdialog = new DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>(\n\t\t\t\t\toptions\n\t\t\t\t) as any as DIALOG;\n\t\t\t}\n\t\t\tthis._dialog = dialog;\n\t\t}\n\t\treturn dialog;\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._textValueComputed ?? null;\n\t}\n\n\tset value(value: VALUE | null) {\n\t\tthis.text = value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DButtonSelect\";\n\t}\n}\n"]}
@@ -25,8 +25,11 @@ import { UtilOverlay } from "./util/util-overlay";
25
25
  *
26
26
  * If multiple application instances are there, better to set the constructor
27
27
  * option `parent` to an `application.stage` so that the dialog picks a right
28
- * application. By default, the dialog assumes the last created application is
29
- * the one it belongs to at the time when it is created.
28
+ * application. `DDialog` searches applications in a following order:
29
+ *
30
+ * * To begin, `DDialog` tries to find applications which it belongs to.
31
+ * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to.
32
+ * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to.
30
33
  */
31
34
  var DDialog = /** @class */ (function (_super) {
32
35
  __extends(DDialog, _super);
@@ -246,7 +249,7 @@ var DDialog = /** @class */ (function (_super) {
246
249
  switch (this._mode) {
247
250
  case DDialogMode.MODAL:
248
251
  case DDialogMode.MENU:
249
- layer = this._overlay.pick(this);
252
+ layer = this._overlay.pick(this, opener);
250
253
  layer.stage.addChild(this);
251
254
  break;
252
255
  case DDialogMode.MODELESS:
@@ -1 +1 @@
1
- {"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAA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Z,IAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACtC,IAAI,SAAS,EAAE;YACd,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACtB;aAAM;YACN,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAES,2BAAS,GAAnB,UAAoB,CAAgB;QACnC,IAAI,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE;YACvC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;gBACrC,IAAI,CAAC,SAAS,EAAE,CAAC;aACjB;SACD;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,2BAAS,GAAnB;QACC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAES,qCAAmB,GAA7B,UAA8B,KAAY;QACzC,QAAQ,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,WAAW,CAAC,KAAK,CAAC;YACvB,KAAK,WAAW,CAAC,IAAI;gBACpB,OAAO,IAAI,CAAC;YACb,KAAK,WAAW,CAAC,QAAQ;gBACxB,OAAO,iBAAM,mBAAmB,YAAC,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA1ZD,CAIU,KAAK,GAsZd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DControllerFocus, DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogGesture, DDialogGestureOptions } from \"./d-dialog-gesture\";\nimport { DDialogGestureImpl } from \"./d-dialog-gesture-impl\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DPadding } from \"./d-padding\";\nimport { isArray } from \"./util/is-array\";\nimport { isString } from \"./util/is-string\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn | Array<keyof typeof DDialogCloseOn> | keyof typeof DDialogCloseOn;\n\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\tgesture?: boolean | DDialogGestureOptions;\n\n\talign?: DDialogAlign | null | keyof typeof DDialogAlign;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(mode: DDialogMode): DDialogCloseOn;\n\tisSticky(mode: DDialogMode): boolean;\n\tisGestureEnabled(mode: DDialogMode): boolean;\n\tgetGestureMode(mode: DDialogMode): DDialogGestureMode;\n\tgetOffsetX(mode: DDialogMode): number;\n\tgetOffsetY(mode: DDialogMode): number;\n\tgetAlign(mode: DDialogMode): DDialogAlign | null;\n\tnewAnimation(mode: DDialogMode): DAnimation<DBase> | null;\n}\n\nexport interface DDialogOpener {\n\tgetBounds(skipUpdate?: boolean, rect?: PIXI.Rectangle): Rectangle;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. By default, the dialog assumes the last created application is\n * the one it belongs to at the time when it is created.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign | null;\n\tprotected _opener?: DDialogOpener | null;\n\n\tprotected _gesture!: DDialogGesture<this>;\n\tprotected _layer!: DApplicationLayerLike | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\t\tthis._layer = null;\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky(mode);\n\n\t\t// Close On\n\t\tconst closeOn = this.toCloseOn(mode, theme, options);\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = this.toAlign(mode, theme, options);\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay();\n\n\t\t// Gesture\n\t\tthis._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));\n\n\t\t// Visibility\n\t\tthis.visible = false;\n\n\t\t// State\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Outside-click handling\n\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\tthis.onCloseOn();\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn {\n\t\tconst closeOn = options?.closeOn;\n\t\tif (closeOn == null) {\n\t\t\treturn theme.closeOn(mode);\n\t\t} else if (isArray(closeOn)) {\n\t\t\tlet result = DDialogCloseOn.NONE;\n\t\t\tfor (let i = 0, imax = closeOn.length; i < imax; ++i) {\n\t\t\t\tresult |= DDialogCloseOn[closeOn[i]];\n\t\t\t}\n\t\t\treturn result;\n\t\t} else if (isString(closeOn)) {\n\t\t\treturn DDialogCloseOn[closeOn];\n\t\t}\n\t\treturn closeOn;\n\t}\n\n\tprotected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null {\n\t\tconst align = options?.align;\n\t\tif (align === null) {\n\t\t\treturn null;\n\t\t} else if (align === undefined) {\n\t\t\treturn theme.getAlign(mode);\n\t\t} else {\n\t\t\treturn toEnum(align, DDialogAlign);\n\t\t}\n\t}\n\n\tget mode(): DDialogMode {\n\t\treturn this._mode;\n\t}\n\n\tget align(): DDialogAlign | null {\n\t\treturn this._align;\n\t}\n\n\tset algin(align: DDialogAlign | null) {\n\t\tthis._align = align;\n\t}\n\n\tget gesture(): DDialogGesture<this> {\n\t\treturn this._gesture;\n\t}\n\n\tget layer(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tprotected toGestureOptions(\n\t\tmode: DDialogMode,\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DDialogGestureOptions {\n\t\tconst gesture = options?.gesture;\n\t\tif (gesture === true) {\n\t\t\treturn {\n\t\t\t\tenable: true,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture === false) {\n\t\t\treturn {\n\t\t\t\tenable: false,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture != null) {\n\t\t\tif (gesture.enable === undefined) {\n\t\t\t\tgesture.enable = theme.isGestureEnabled(mode);\n\t\t\t}\n\t\t\tif (gesture.mode === undefined) {\n\t\t\t\tgesture.mode = theme.getGestureMode(mode);\n\t\t\t}\n\t\t\treturn gesture;\n\t\t}\n\t\treturn {\n\t\t\tenable: theme.isGestureEnabled(mode),\n\t\t\tmode: theme.getGestureMode(mode)\n\t\t};\n\t}\n\n\tonParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void {\n\t\tif (this.isOpened()) {\n\t\t\tconst layer = this._layer;\n\t\t\tif (layer != null) {\n\t\t\t\tconst gesture = this._gesture;\n\t\t\t\tif (gesture.isDirty()) {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsuper.onParentResize(parentWidth, parentHeight, parentPadding);\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tresult = this._options?.animation ?? this.theme.newAnimation(this._mode);\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tif (this._mode === DDialogMode.MODELESS) {\n\t\t\t\tthis.hide();\n\t\t\t} else {\n\t\t\t\tconst parent = this.parent;\n\t\t\t\tif (parent) {\n\t\t\t\t\tparent.removeChild(this);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tfocusController.focus(this.findFirstFocusable(focusController) || this);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected findFirstFocusable(focusController: DControllerFocus): DFocusable | null {\n\t\treturn focusController.find(this, false, true, true);\n\t}\n\n\t/**\n\t * Opens a dialog.\n\t *\n\t * @param opener An opener of a dialog.\n\t * The dialog position is determined based on a position and a size of the opener.\n\t * If the opener is undefined, the dialog is placed at the center of the screen.\n\t *\n\t * @returns a value of this dialog\n\t */\n\topen(opener?: DDialogOpener): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._opener = opener;\n\n\t\t\t// Attach to a layer\n\t\t\tlet layer: DApplicationLayerLike | null = null;\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tlayer = this._overlay.pick(this);\n\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tlayer = DApplications.getLayer(this);\n\t\t\t\t\tthis.show();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._layer = layer;\n\n\t\t\t// Position & size\n\t\t\tconst gesture = this._gesture;\n\t\t\tif (gesture.mode === DDialogGestureMode.CLEAN) {\n\t\t\t\tgesture.toClean();\n\t\t\t}\n\t\t\tif (layer != null) {\n\t\t\t\tif (gesture.isClean()) {\n\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Done\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst layer = this._layer;\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst align = this._align;\n\t\tif (align === DDialogAlign.NONE) {\n\t\t\treturn;\n\t\t}\n\t\tconst opener = this._opener;\n\t\tif (align != null && opener != null) {\n\t\t\tconst mode = this._mode;\n\t\t\tconst bounds = opener.getBounds(false, (DDialog.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tconst theme = this.theme;\n\t\t\tUtilAttach.attach(\n\t\t\t\tthis,\n\t\t\t\tbounds,\n\t\t\t\ttheme.getOffsetX(mode),\n\t\t\t\ttheme.getOffsetY(mode),\n\t\t\t\tlayer.width,\n\t\t\t\tlayer.height,\n\t\t\t\talign\n\t\t\t);\n\t\t} else {\n\t\t\tthis.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._layer;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler and forget the layer\n\t\tif (layer) {\n\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\tthis._layer = null;\n\t\t}\n\n\t\t// Forget the opener\n\t\tthis._opener = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tprotected onKeyDown(e: KeyboardEvent): boolean {\n\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\tthis.onCloseOn();\n\t\t\t}\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,k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B,OAAO,iBAAM,mBAAmB,YAAC,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA1ZD,CAIU,KAAK,GAsZd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DControllerFocus, DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogGesture, DDialogGestureOptions } from \"./d-dialog-gesture\";\nimport { DDialogGestureImpl } from \"./d-dialog-gesture-impl\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DPadding } from \"./d-padding\";\nimport { isArray } from \"./util/is-array\";\nimport { isString } from \"./util/is-string\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\nimport { DApplicationTarget } from \"./d-application-like\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn | Array<keyof typeof DDialogCloseOn> | keyof typeof DDialogCloseOn;\n\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\tgesture?: boolean | DDialogGestureOptions;\n\n\talign?: DDialogAlign | null | keyof typeof DDialogAlign;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(mode: DDialogMode): DDialogCloseOn;\n\tisSticky(mode: DDialogMode): boolean;\n\tisGestureEnabled(mode: DDialogMode): boolean;\n\tgetGestureMode(mode: DDialogMode): DDialogGestureMode;\n\tgetOffsetX(mode: DDialogMode): number;\n\tgetOffsetY(mode: DDialogMode): number;\n\tgetAlign(mode: DDialogMode): DDialogAlign | null;\n\tnewAnimation(mode: DDialogMode): DAnimation<DBase> | null;\n}\n\nexport interface DDialogOpener extends DApplicationTarget {\n\tgetBounds(skipUpdate?: boolean, rect?: PIXI.Rectangle): Rectangle;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. `DDialog` searches applications in a following order:\n *\n * * To begin, `DDialog` tries to find applications which it belongs to.\n * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to.\n * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign | null;\n\tprotected _opener?: DDialogOpener | null;\n\n\tprotected _gesture!: DDialogGesture<this>;\n\tprotected _layer!: DApplicationLayerLike | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\t\tthis._layer = null;\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky(mode);\n\n\t\t// Close On\n\t\tconst closeOn = this.toCloseOn(mode, theme, options);\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = this.toAlign(mode, theme, options);\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay();\n\n\t\t// Gesture\n\t\tthis._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));\n\n\t\t// Visibility\n\t\tthis.visible = false;\n\n\t\t// State\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Outside-click handling\n\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\tthis.onCloseOn();\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn {\n\t\tconst closeOn = options?.closeOn;\n\t\tif (closeOn == null) {\n\t\t\treturn theme.closeOn(mode);\n\t\t} else if (isArray(closeOn)) {\n\t\t\tlet result = DDialogCloseOn.NONE;\n\t\t\tfor (let i = 0, imax = closeOn.length; i < imax; ++i) {\n\t\t\t\tresult |= DDialogCloseOn[closeOn[i]];\n\t\t\t}\n\t\t\treturn result;\n\t\t} else if (isString(closeOn)) {\n\t\t\treturn DDialogCloseOn[closeOn];\n\t\t}\n\t\treturn closeOn;\n\t}\n\n\tprotected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null {\n\t\tconst align = options?.align;\n\t\tif (align === null) {\n\t\t\treturn null;\n\t\t} else if (align === undefined) {\n\t\t\treturn theme.getAlign(mode);\n\t\t} else {\n\t\t\treturn toEnum(align, DDialogAlign);\n\t\t}\n\t}\n\n\tget mode(): DDialogMode {\n\t\treturn this._mode;\n\t}\n\n\tget align(): DDialogAlign | null {\n\t\treturn this._align;\n\t}\n\n\tset algin(align: DDialogAlign | null) {\n\t\tthis._align = align;\n\t}\n\n\tget gesture(): DDialogGesture<this> {\n\t\treturn this._gesture;\n\t}\n\n\tget layer(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tprotected toGestureOptions(\n\t\tmode: DDialogMode,\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DDialogGestureOptions {\n\t\tconst gesture = options?.gesture;\n\t\tif (gesture === true) {\n\t\t\treturn {\n\t\t\t\tenable: true,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture === false) {\n\t\t\treturn {\n\t\t\t\tenable: false,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture != null) {\n\t\t\tif (gesture.enable === undefined) {\n\t\t\t\tgesture.enable = theme.isGestureEnabled(mode);\n\t\t\t}\n\t\t\tif (gesture.mode === undefined) {\n\t\t\t\tgesture.mode = theme.getGestureMode(mode);\n\t\t\t}\n\t\t\treturn gesture;\n\t\t}\n\t\treturn {\n\t\t\tenable: theme.isGestureEnabled(mode),\n\t\t\tmode: theme.getGestureMode(mode)\n\t\t};\n\t}\n\n\tonParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void {\n\t\tif (this.isOpened()) {\n\t\t\tconst layer = this._layer;\n\t\t\tif (layer != null) {\n\t\t\t\tconst gesture = this._gesture;\n\t\t\t\tif (gesture.isDirty()) {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsuper.onParentResize(parentWidth, parentHeight, parentPadding);\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tresult = this._options?.animation ?? this.theme.newAnimation(this._mode);\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tif (this._mode === DDialogMode.MODELESS) {\n\t\t\t\tthis.hide();\n\t\t\t} else {\n\t\t\t\tconst parent = this.parent;\n\t\t\t\tif (parent) {\n\t\t\t\t\tparent.removeChild(this);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tfocusController.focus(this.findFirstFocusable(focusController) || this);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected findFirstFocusable(focusController: DControllerFocus): DFocusable | null {\n\t\treturn focusController.find(this, false, true, true);\n\t}\n\n\t/**\n\t * Opens a dialog.\n\t *\n\t * @param opener An opener of a dialog.\n\t * The dialog position is determined based on a position and a size of the opener.\n\t * If the opener is undefined, the dialog is placed at the center of the screen.\n\t *\n\t * @returns a value of this dialog\n\t */\n\topen(opener?: DDialogOpener): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._opener = opener;\n\n\t\t\t// Attach to a layer\n\t\t\tlet layer: DApplicationLayerLike | null = null;\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tlayer = this._overlay.pick(this, opener);\n\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tlayer = DApplications.getLayer(this);\n\t\t\t\t\tthis.show();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._layer = layer;\n\n\t\t\t// Position & size\n\t\t\tconst gesture = this._gesture;\n\t\t\tif (gesture.mode === DDialogGestureMode.CLEAN) {\n\t\t\t\tgesture.toClean();\n\t\t\t}\n\t\t\tif (layer != null) {\n\t\t\t\tif (gesture.isClean()) {\n\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Done\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst layer = this._layer;\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst align = this._align;\n\t\tif (align === DDialogAlign.NONE) {\n\t\t\treturn;\n\t\t}\n\t\tconst opener = this._opener;\n\t\tif (align != null && opener != null) {\n\t\t\tconst mode = this._mode;\n\t\t\tconst bounds = opener.getBounds(false, (DDialog.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tconst theme = this.theme;\n\t\t\tUtilAttach.attach(\n\t\t\t\tthis,\n\t\t\t\tbounds,\n\t\t\t\ttheme.getOffsetX(mode),\n\t\t\t\ttheme.getOffsetY(mode),\n\t\t\t\tlayer.width,\n\t\t\t\tlayer.height,\n\t\t\t\talign\n\t\t\t);\n\t\t} else {\n\t\t\tthis.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._layer;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler and forget the layer\n\t\tif (layer) {\n\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\tthis._layer = null;\n\t\t}\n\n\t\t// Forget the opener\n\t\tthis._opener = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tprotected onKeyDown(e: KeyboardEvent): boolean {\n\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\tthis.onCloseOn();\n\t\t\t}\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"d-menu-opener.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu-opener.ts"],"names":[],"mappings":"","sourcesContent":["import { Rectangle } from \"pixi.js\";\n\nexport interface DMenuOpener {\n\tgetBounds(skipUpdate?: boolean, result?: Rectangle): Rectangle;\n}\n"]}
1
+ {"version":3,"file":"d-menu-opener.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu-opener.ts"],"names":[],"mappings":"","sourcesContent":["import { Rectangle } from \"pixi.js\";\nimport { DApplicationTarget } from \"./d-application-like\";\n\nexport interface DMenuOpener extends DApplicationTarget {\n\tgetBounds(skipUpdate?: boolean, result?: Rectangle): Rectangle;\n}\n"]}
@@ -73,7 +73,7 @@ var DMenu = /** @class */ (function (_super) {
73
73
  DMenu.prototype.open = function (owner, closeable, context) {
74
74
  var _a;
75
75
  if (this.isHidden()) {
76
- var layer = this._overlay.pick(this);
76
+ var layer = this._overlay.pick(this, owner);
77
77
  this._owner = owner;
78
78
  // States
79
79
  var children = this.children;
@@ -1 +1 @@
1
- {"version":3,"file":"d-menu.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAwB,SAAS,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,eAAe,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OAAO,EAAE,IAAI,CAAC,CAAC;SACzB;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAES,yBAAS,GAAnB,UAAoB,CAAgB;QACnC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9D,IACC,IAAI,CAAC,KAAK,CAAC,YAAY;YACvB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACxE;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;SACb;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,mCAAmB,GAA7B,UAA8B,KAAY;QACzC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACF,YAAC;AAAD,CAAC,AA5ND,CAIU,eAAe,GAwNxB;;AAED,MAAM,CAAC,cAAc,CAAC,UAAC,OAA2B,IAAK,OAAA,IAAI,KAAK,CAAM,OAAO,CAAC,EAAvB,CAAuB,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, Point, Rectangle } from \"pixi.js\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DLayoutVertical, DLayoutVerticalOptions, DThemeLayoutVertical } from \"./d-layout-vertical\";\nimport { DMenuAlign } from \"./d-menu-align\";\nimport { DMenuContext } from \"./d-menu-context\";\nimport { DMenuItem } from \"./d-menu-item\";\nimport { DMenuItemOptionsUnion } from \"./d-menu-item-options-union\";\nimport { DMenus } from \"./d-menus\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\nimport { DMenuOpener } from \"./d-menu-opener\";\nimport { DMenuCloseable } from \"./d-menu-closeable\";\n\nexport interface DMenuOptions<VALUE = unknown, THEME extends DThemeMenu = DThemeMenu>\n\textends DLayoutVerticalOptions<THEME> {\n\talign?: keyof typeof DMenuAlign | DMenuAlign;\n\tfit?: boolean;\n\tsticky?: boolean;\n\titems?: Array<DMenuItemOptionsUnion<VALUE> | DisplayObject | null | undefined>;\n}\n\nexport interface DThemeMenu extends DThemeLayoutVertical {\n\tgetOffsetX(): number;\n\tgetOffsetY(): number;\n}\n\nexport class DMenu<\n\tVALUE,\n\tTHEME extends DThemeMenu = DThemeMenu,\n\tOPTIONS extends DMenuOptions<VALUE, THEME> = DMenuOptions<VALUE, THEME>\n> extends DLayoutVertical<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _align!: DMenuAlign;\n\tprotected _fit!: boolean;\n\tprotected _sticky!: boolean;\n\tprotected _sub!: boolean;\n\tprotected _owner!: DMenuOpener | null;\n\tprotected _context!: DMenuContext | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _focused?: DFocusable | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\n\t\tthis._align = toEnum(options?.align ?? DMenuAlign.BOTTOM, DMenuAlign);\n\t\tthis._fit = options?.fit ?? false;\n\t\tthis._sticky = options?.sticky ?? false;\n\t\tthis._sub = false;\n\t\tthis._owner = null;\n\t\tthis._context = null;\n\t\tthis.visible = false;\n\n\t\t// Event handlers\n\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\tthis.close();\n\t\t});\n\n\t\tthis.on(\"select\", (): void => {\n\t\t\tthis.close();\n\t\t});\n\n\t\t// Items\n\t\tconst items = options?.items;\n\t\tif (items) {\n\t\t\tDMenus.newItems(this, items, this._sticky);\n\t\t}\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay(options);\n\t}\n\n\tfindItem(value: VALUE): DMenuItem<VALUE> | null {\n\t\tconst children = this.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DMenuItem && child.value === value) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DMenu\";\n\t}\n\n\tgetContext(): DMenuContext | null {\n\t\treturn this._context;\n\t}\n\n\tgetCloseable(): DMenuCloseable | null {\n\t\treturn this;\n\t}\n\n\topen(\n\t\towner: DMenuOpener,\n\t\tcloseable?: DMenuCloseable | null,\n\t\tcontext?: DMenuContext | null\n\t): this {\n\t\tif (this.isHidden()) {\n\t\t\tconst layer = this._overlay.pick(this);\n\t\t\tthis._owner = owner;\n\n\t\t\t// States\n\t\t\tconst children = this.children;\n\t\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (child instanceof DBase) {\n\t\t\t\t\tchild.state.removeAll(DBaseState.FOCUSED, DBaseState.HOVERED);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Position & size\n\t\t\tconst renderer = layer.renderer;\n\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\tif (this._sticky) {\n\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t} else {\n\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t}\n\t\t\tif (this._fit) {\n\t\t\t\tconst bounds = owner.getBounds(false, (DMenu.WORK_BOUNDS ??= new Rectangle()));\n\t\t\t\tif (bounds != null) {\n\t\t\t\t\tthis.width = bounds.width;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Target\n\t\t\tthis._sub = context != null;\n\t\t\tcontext = context || new DMenuContext(owner);\n\t\t\tif (closeable != null) {\n\t\t\t\tcontext.trim(closeable);\n\t\t\t}\n\t\t\tcontext.add(this);\n\t\t\tthis._context = context;\n\n\t\t\t// Stage\n\t\t\tlayer.stage.addChild(this);\n\n\t\t\t// Focus\n\t\t\tthis._focused = layer.getFocusController().get();\n\t\t\tthis.focus();\n\n\t\t\t// Show\n\t\t\tsuper.show();\n\n\t\t\t// Event\n\t\t\tthis.emit(\"open\", this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst owner = this._owner;\n\t\tif (owner) {\n\t\t\tconst bounds = owner.getBounds(false, (DMenu.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tif (bounds) {\n\t\t\t\tif (this._fit) {\n\t\t\t\t\tthis.width = bounds.width;\n\t\t\t\t}\n\t\t\t\tconst layer = this._overlay.picked;\n\t\t\t\tif (layer) {\n\t\t\t\t\tconst theme = this.theme;\n\t\t\t\t\tUtilAttach.attach(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\ttheme.getOffsetX(),\n\t\t\t\t\t\ttheme.getOffsetY(),\n\t\t\t\t\t\tlayer.width,\n\t\t\t\t\t\tlayer.height,\n\t\t\t\t\t\tthis._align\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclose(): this {\n\t\tif (this.isShown()) {\n\t\t\t// Remove from the context\n\t\t\tconst context = this._context;\n\t\t\tif (context) {\n\t\t\t\tcontext.remove(this);\n\t\t\t}\n\n\t\t\t// Remove the prerender event handler\n\t\t\tconst layer = this._overlay.picked;\n\t\t\tif (layer) {\n\t\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\t}\n\n\t\t\t// Forget the owner\n\t\t\tthis._owner = null;\n\n\t\t\t// Restore the focus\n\t\t\tconst focused = this._focused;\n\t\t\tif (focused != null) {\n\t\t\t\tthis._focused = null;\n\t\t\t\tif (layer) {\n\t\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t\t}\n\t\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t\t} else {\n\t\t\t\t\tthis.blur(true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\n\t\t\t// Visibility\n\t\t\tsuper.hide();\n\n\t\t\t// Remove from the tree\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\n\t\t\t// Emit the event\n\t\t\tthis.emit(\"close\", this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected onKeyDown(e: KeyboardEvent): boolean {\n\t\tUtilKeyboardEvent.moveFocusVertically(e, this, this._overlay);\n\t\tif (\n\t\t\tthis.state.isActionable &&\n\t\t\t(UtilKeyboardEvent.isArrowLeftKey(e) || UtilKeyboardEvent.isCancelKey(e))\n\t\t) {\n\t\t\tthis.close();\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\treturn !this._sub;\n\t}\n}\n\nDMenus.setMenuCreator((options?: DMenuOptions<any>) => new DMenu<any>(options));\n"]}
1
+ {"version":3,"file":"d-menu.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAwB,SAAS,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAgD,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAA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B,CAAgB;QACnC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9D,IACC,IAAI,CAAC,KAAK,CAAC,YAAY;YACvB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EACxE;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;SACb;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,mCAAmB,GAA7B,UAA8B,KAAY;QACzC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACF,YAAC;AAAD,CAAC,AA5ND,CAIU,eAAe,GAwNxB;;AAED,MAAM,CAAC,cAAc,CAAC,UAAC,OAA2B,IAAK,OAAA,IAAI,KAAK,CAAM,OAAO,CAAC,EAAvB,CAAuB,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, Point, Rectangle } from \"pixi.js\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DLayoutVertical, DLayoutVerticalOptions, DThemeLayoutVertical } from \"./d-layout-vertical\";\nimport { DMenuAlign } from \"./d-menu-align\";\nimport { DMenuContext } from \"./d-menu-context\";\nimport { DMenuItem } from \"./d-menu-item\";\nimport { DMenuItemOptionsUnion } from \"./d-menu-item-options-union\";\nimport { DMenus } from \"./d-menus\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\nimport { DMenuOpener } from \"./d-menu-opener\";\nimport { DMenuCloseable } from \"./d-menu-closeable\";\n\nexport interface DMenuOptions<VALUE = unknown, THEME extends DThemeMenu = DThemeMenu>\n\textends DLayoutVerticalOptions<THEME> {\n\talign?: keyof typeof DMenuAlign | DMenuAlign;\n\tfit?: boolean;\n\tsticky?: boolean;\n\titems?: Array<DMenuItemOptionsUnion<VALUE> | DisplayObject | null | undefined>;\n}\n\nexport interface DThemeMenu extends DThemeLayoutVertical {\n\tgetOffsetX(): number;\n\tgetOffsetY(): number;\n}\n\nexport class DMenu<\n\tVALUE,\n\tTHEME extends DThemeMenu = DThemeMenu,\n\tOPTIONS extends DMenuOptions<VALUE, THEME> = DMenuOptions<VALUE, THEME>\n> extends DLayoutVertical<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _align!: DMenuAlign;\n\tprotected _fit!: boolean;\n\tprotected _sticky!: boolean;\n\tprotected _sub!: boolean;\n\tprotected _owner!: DMenuOpener | null;\n\tprotected _context!: DMenuContext | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _focused?: DFocusable | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\n\t\tthis._align = toEnum(options?.align ?? DMenuAlign.BOTTOM, DMenuAlign);\n\t\tthis._fit = options?.fit ?? false;\n\t\tthis._sticky = options?.sticky ?? false;\n\t\tthis._sub = false;\n\t\tthis._owner = null;\n\t\tthis._context = null;\n\t\tthis.visible = false;\n\n\t\t// Event handlers\n\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\tthis.close();\n\t\t});\n\n\t\tthis.on(\"select\", (): void => {\n\t\t\tthis.close();\n\t\t});\n\n\t\t// Items\n\t\tconst items = options?.items;\n\t\tif (items) {\n\t\t\tDMenus.newItems(this, items, this._sticky);\n\t\t}\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay(options);\n\t}\n\n\tfindItem(value: VALUE): DMenuItem<VALUE> | null {\n\t\tconst children = this.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DMenuItem && child.value === value) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DMenu\";\n\t}\n\n\tgetContext(): DMenuContext | null {\n\t\treturn this._context;\n\t}\n\n\tgetCloseable(): DMenuCloseable | null {\n\t\treturn this;\n\t}\n\n\topen(\n\t\towner: DMenuOpener,\n\t\tcloseable?: DMenuCloseable | null,\n\t\tcontext?: DMenuContext | null\n\t): this {\n\t\tif (this.isHidden()) {\n\t\t\tconst layer = this._overlay.pick(this, owner);\n\t\t\tthis._owner = owner;\n\n\t\t\t// States\n\t\t\tconst children = this.children;\n\t\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (child instanceof DBase) {\n\t\t\t\t\tchild.state.removeAll(DBaseState.FOCUSED, DBaseState.HOVERED);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Position & size\n\t\t\tconst renderer = layer.renderer;\n\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\tif (this._sticky) {\n\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t} else {\n\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t}\n\t\t\tif (this._fit) {\n\t\t\t\tconst bounds = owner.getBounds(false, (DMenu.WORK_BOUNDS ??= new Rectangle()));\n\t\t\t\tif (bounds != null) {\n\t\t\t\t\tthis.width = bounds.width;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Target\n\t\t\tthis._sub = context != null;\n\t\t\tcontext = context || new DMenuContext(owner);\n\t\t\tif (closeable != null) {\n\t\t\t\tcontext.trim(closeable);\n\t\t\t}\n\t\t\tcontext.add(this);\n\t\t\tthis._context = context;\n\n\t\t\t// Stage\n\t\t\tlayer.stage.addChild(this);\n\n\t\t\t// Focus\n\t\t\tthis._focused = layer.getFocusController().get();\n\t\t\tthis.focus();\n\n\t\t\t// Show\n\t\t\tsuper.show();\n\n\t\t\t// Event\n\t\t\tthis.emit(\"open\", this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst owner = this._owner;\n\t\tif (owner) {\n\t\t\tconst bounds = owner.getBounds(false, (DMenu.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tif (bounds) {\n\t\t\t\tif (this._fit) {\n\t\t\t\t\tthis.width = bounds.width;\n\t\t\t\t}\n\t\t\t\tconst layer = this._overlay.picked;\n\t\t\t\tif (layer) {\n\t\t\t\t\tconst theme = this.theme;\n\t\t\t\t\tUtilAttach.attach(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tbounds,\n\t\t\t\t\t\ttheme.getOffsetX(),\n\t\t\t\t\t\ttheme.getOffsetY(),\n\t\t\t\t\t\tlayer.width,\n\t\t\t\t\t\tlayer.height,\n\t\t\t\t\t\tthis._align\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclose(): this {\n\t\tif (this.isShown()) {\n\t\t\t// Remove from the context\n\t\t\tconst context = this._context;\n\t\t\tif (context) {\n\t\t\t\tcontext.remove(this);\n\t\t\t}\n\n\t\t\t// Remove the prerender event handler\n\t\t\tconst layer = this._overlay.picked;\n\t\t\tif (layer) {\n\t\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\t}\n\n\t\t\t// Forget the owner\n\t\t\tthis._owner = null;\n\n\t\t\t// Restore the focus\n\t\t\tconst focused = this._focused;\n\t\t\tif (focused != null) {\n\t\t\t\tthis._focused = null;\n\t\t\t\tif (layer) {\n\t\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t\t}\n\t\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t\t} else {\n\t\t\t\t\tthis.blur(true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\n\t\t\t// Visibility\n\t\t\tsuper.hide();\n\n\t\t\t// Remove from the tree\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\n\t\t\t// Emit the event\n\t\t\tthis.emit(\"close\", this);\n\t\t}\n\t\treturn this;\n\t}\n\n\tprotected onKeyDown(e: KeyboardEvent): boolean {\n\t\tUtilKeyboardEvent.moveFocusVertically(e, this, this._overlay);\n\t\tif (\n\t\t\tthis.state.isActionable &&\n\t\t\t(UtilKeyboardEvent.isArrowLeftKey(e) || UtilKeyboardEvent.isCancelKey(e))\n\t\t) {\n\t\t\tthis.close();\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\treturn !this._sub;\n\t}\n}\n\nDMenus.setMenuCreator((options?: DMenuOptions<any>) => new DMenu<any>(options));\n"]}
@@ -11,11 +11,14 @@ var UtilOverlay = /** @class */ (function () {
11
11
  enumerable: false,
12
12
  configurable: true
13
13
  });
14
- UtilOverlay.prototype.pick = function (target) {
14
+ UtilOverlay.prototype.pick = function (owner, opener) {
15
15
  var layer = this._layer;
16
16
  if (layer == null) {
17
- layer = DApplications.getLayerOverlay(target);
18
- if (!layer) {
17
+ layer = DApplications.getLayerOverlay(owner);
18
+ if (layer == null && opener != null) {
19
+ layer = DApplications.getLayerOverlay(opener);
20
+ }
21
+ if (layer == null) {
19
22
  var application = this._application;
20
23
  if (application) {
21
24
  layer = application.getLayerOverlay();
@@ -1 +1 @@
1
- {"version":3,"file":"util-overlay.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-overlay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;IAIC,qBAAY,OAA8B;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;IAED,sBAAI,+BAAM;aAAV;YACC,OAAO,IAAI,CAAC,MAAM,CAAC;QACpB,CAAC;;;OAAA;IAED,0BAAI,GAAJ,UAAK,MAA0B;QAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,KAAK,GAAG,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,EAAE;gBACX,IAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;gBACtC,IAAI,WAAW,EAAE;oBAChB,KAAK,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC;iBACtC;qBAAM;oBACN,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,eAAe,EAAE,CAAC;iBAC/C;aACD;YACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACpB;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,kBAAC;AAAD,CAAC,AA7BD,IA6BC","sourcesContent":["import { DApplicationLayerLike } from \"../d-application-layer-like\";\nimport { DApplicationLike, DApplicationTarget } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\n\nexport class UtilOverlay {\n\tprotected _layer: DApplicationLayerLike | null;\n\tprotected _application: DApplicationLike | null;\n\n\tconstructor(options?: { parent?: unknown }) {\n\t\tthis._layer = null;\n\t\tthis._application = options?.parent == null ? DApplications.last() : null;\n\t}\n\n\tget picked(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tpick(target: DApplicationTarget): DApplicationLayerLike {\n\t\tlet layer = this._layer;\n\t\tif (layer == null) {\n\t\t\tlayer = DApplications.getLayerOverlay(target);\n\t\t\tif (!layer) {\n\t\t\t\tconst application = this._application;\n\t\t\t\tif (application) {\n\t\t\t\t\tlayer = application.getLayerOverlay();\n\t\t\t\t} else {\n\t\t\t\t\tlayer = DApplications.last().getLayerOverlay();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._layer = layer;\n\t\t}\n\t\treturn layer;\n\t}\n}\n"]}
1
+ {"version":3,"file":"util-overlay.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-overlay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;IAIC,qBAAY,OAA8B;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC;IAED,sBAAI,+BAAM;aAAV;YACC,OAAO,IAAI,CAAC,MAAM,CAAC;QACpB,CAAC;;;OAAA;IAED,0BAAI,GAAJ,UAAK,KAAyB,EAAE,MAA2B;QAC1D,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,KAAK,GAAG,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,KAAK,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE;gBACpC,KAAK,GAAG,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;aAC9C;YACD,IAAI,KAAK,IAAI,IAAI,EAAE;gBAClB,IAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;gBACtC,IAAI,WAAW,EAAE;oBAChB,KAAK,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC;iBACtC;qBAAM;oBACN,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,eAAe,EAAE,CAAC;iBAC/C;aACD;YACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACpB;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,kBAAC;AAAD,CAAC,AAhCD,IAgCC","sourcesContent":["import { DApplicationLayerLike } from \"../d-application-layer-like\";\nimport { DApplicationLike, DApplicationTarget } from \"../d-application-like\";\nimport { DApplications } from \"../d-applications\";\n\nexport class UtilOverlay {\n\tprotected _layer: DApplicationLayerLike | null;\n\tprotected _application: DApplicationLike | null;\n\n\tconstructor(options?: { parent?: unknown }) {\n\t\tthis._layer = null;\n\t\tthis._application = options?.parent == null ? DApplications.last() : null;\n\t}\n\n\tget picked(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tpick(owner: DApplicationTarget, opener?: DApplicationTarget): DApplicationLayerLike {\n\t\tlet layer = this._layer;\n\t\tif (layer == null) {\n\t\t\tlayer = DApplications.getLayerOverlay(owner);\n\t\t\tif (layer == null && opener != null) {\n\t\t\t\tlayer = DApplications.getLayerOverlay(opener);\n\t\t\t}\n\t\t\tif (layer == null) {\n\t\t\t\tconst application = this._application;\n\t\t\t\tif (application) {\n\t\t\t\t\tlayer = application.getLayerOverlay();\n\t\t\t\t} else {\n\t\t\t\t\tlayer = DApplications.last().getLayerOverlay();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._layer = layer;\n\t\t}\n\t\treturn layer;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -26304,11 +26304,14 @@ var UtilOverlay = /** @class */ (function () {
26304
26304
  enumerable: false,
26305
26305
  configurable: true
26306
26306
  });
26307
- UtilOverlay.prototype.pick = function (target) {
26307
+ UtilOverlay.prototype.pick = function (owner, opener) {
26308
26308
  var layer = this._layer;
26309
26309
  if (layer == null) {
26310
- layer = DApplications.getLayerOverlay(target);
26311
- if (!layer) {
26310
+ layer = DApplications.getLayerOverlay(owner);
26311
+ if (layer == null && opener != null) {
26312
+ layer = DApplications.getLayerOverlay(opener);
26313
+ }
26314
+ if (layer == null) {
26312
26315
  var application = this._application;
26313
26316
  if (application) {
26314
26317
  layer = application.getLayerOverlay();
@@ -26333,8 +26336,11 @@ var UtilOverlay = /** @class */ (function () {
26333
26336
  *
26334
26337
  * If multiple application instances are there, better to set the constructor
26335
26338
  * option `parent` to an `application.stage` so that the dialog picks a right
26336
- * application. By default, the dialog assumes the last created application is
26337
- * the one it belongs to at the time when it is created.
26339
+ * application. `DDialog` searches applications in a following order:
26340
+ *
26341
+ * * To begin, `DDialog` tries to find applications which it belongs to.
26342
+ * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to.
26343
+ * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to.
26338
26344
  */
26339
26345
  var DDialog = /** @class */ (function (_super) {
26340
26346
  __extends(DDialog, _super);
@@ -26554,7 +26560,7 @@ var DDialog = /** @class */ (function (_super) {
26554
26560
  switch (this._mode) {
26555
26561
  case DDialogMode.MODAL:
26556
26562
  case DDialogMode.MENU:
26557
- layer = this._overlay.pick(this);
26563
+ layer = this._overlay.pick(this, opener);
26558
26564
  layer.stage.addChild(this);
26559
26565
  break;
26560
26566
  case DDialogMode.MODELESS:
@@ -70980,7 +70986,7 @@ var DMenu = /** @class */ (function (_super) {
70980
70986
  DMenu.prototype.open = function (owner, closeable, context) {
70981
70987
  var _a;
70982
70988
  if (this.isHidden()) {
70983
- var layer = this._overlay.pick(this);
70989
+ var layer = this._overlay.pick(this, owner);
70984
70990
  this._owner = owner;
70985
70991
  // States
70986
70992
  var children = this.children;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.386.0
2
+ Winter Cardinal UI v0.387.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -26301,11 +26301,14 @@
26301
26301
  enumerable: false,
26302
26302
  configurable: true
26303
26303
  });
26304
- UtilOverlay.prototype.pick = function (target) {
26304
+ UtilOverlay.prototype.pick = function (owner, opener) {
26305
26305
  var layer = this._layer;
26306
26306
  if (layer == null) {
26307
- layer = DApplications.getLayerOverlay(target);
26308
- if (!layer) {
26307
+ layer = DApplications.getLayerOverlay(owner);
26308
+ if (layer == null && opener != null) {
26309
+ layer = DApplications.getLayerOverlay(opener);
26310
+ }
26311
+ if (layer == null) {
26309
26312
  var application = this._application;
26310
26313
  if (application) {
26311
26314
  layer = application.getLayerOverlay();
@@ -26330,8 +26333,11 @@
26330
26333
  *
26331
26334
  * If multiple application instances are there, better to set the constructor
26332
26335
  * option `parent` to an `application.stage` so that the dialog picks a right
26333
- * application. By default, the dialog assumes the last created application is
26334
- * the one it belongs to at the time when it is created.
26336
+ * application. `DDialog` searches applications in a following order:
26337
+ *
26338
+ * * To begin, `DDialog` tries to find applications which it belongs to.
26339
+ * * If `DDialog` can't find applications, then `DDialog` tries to find applications which openers belong to.
26340
+ * * If openers are not given, `DDialog` assumes the last created application at the very moment `DDialog` is instantiated is the one it belongs to.
26335
26341
  */
26336
26342
  var DDialog = /** @class */ (function (_super) {
26337
26343
  __extends(DDialog, _super);
@@ -26551,7 +26557,7 @@
26551
26557
  switch (this._mode) {
26552
26558
  case DDialogMode.MODAL:
26553
26559
  case DDialogMode.MENU:
26554
- layer = this._overlay.pick(this);
26560
+ layer = this._overlay.pick(this, opener);
26555
26561
  layer.stage.addChild(this);
26556
26562
  break;
26557
26563
  case DDialogMode.MODELESS:
@@ -50180,7 +50186,7 @@
50180
50186
  DMenu.prototype.open = function (owner, closeable, context) {
50181
50187
  var _a;
50182
50188
  if (this.isHidden()) {
50183
- var layer = this._overlay.pick(this);
50189
+ var layer = this._overlay.pick(this, owner);
50184
50190
  this._owner = owner;
50185
50191
  // States
50186
50192
  var children = this.children;