@wcardinal/wcardinal-ui 0.385.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.
Files changed (32) hide show
  1. package/dist/types/wcardinal/ui/d-button-select.d.ts +1 -1
  2. package/dist/types/wcardinal/ui/d-diagrams.d.ts +1 -0
  3. package/dist/types/wcardinal/ui/d-dialog.d.ts +7 -3
  4. package/dist/types/wcardinal/ui/d-menu-opener.d.ts +2 -1
  5. package/dist/types/wcardinal/ui/util/util-overlay.d.ts +1 -1
  6. package/dist/wcardinal/ui/d-button-select.js.map +1 -1
  7. package/dist/wcardinal/ui/d-diagrams.js +25 -0
  8. package/dist/wcardinal/ui/d-diagrams.js.map +1 -1
  9. package/dist/wcardinal/ui/d-dialog.js +6 -3
  10. package/dist/wcardinal/ui/d-dialog.js.map +1 -1
  11. package/dist/wcardinal/ui/d-menu-opener.js.map +1 -1
  12. package/dist/wcardinal/ui/d-menu.js +1 -1
  13. package/dist/wcardinal/ui/d-menu.js.map +1 -1
  14. package/dist/wcardinal/ui/util/util-overlay.js +6 -3
  15. package/dist/wcardinal/ui/util/util-overlay.js.map +1 -1
  16. package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
  17. package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
  18. package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
  19. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
  20. package/dist/wcardinal-ui-theme-dark.js +1 -1
  21. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  22. package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
  23. package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
  24. package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
  25. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
  26. package/dist/wcardinal-ui-theme-white.js +1 -1
  27. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  28. package/dist/wcardinal-ui.cjs.js +36 -8
  29. package/dist/wcardinal-ui.js +36 -8
  30. package/dist/wcardinal-ui.min.js +2 -2
  31. package/dist/wcardinal-ui.min.js.map +1 -1
  32. package/package.json +1 -1
@@ -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
  /**
@@ -7,6 +7,7 @@ import { EShapeResourceManagerDeserialization } from "./shape/e-shape-resource-m
7
7
  import { EShapeResourceManagerDeserializationMode } from "./shape/e-shape-resource-manager-deserialization-mode";
8
8
  import { EShapeEmbeddedDatum } from "./shape/variant/e-shape-embedded-datum";
9
9
  export declare class DDiagrams {
10
+ static parse(target: unknown): DDiagramSerialized | null;
10
11
  static toSimple(serialized: DDiagramSerialized): DDiagramSerializedSimple;
11
12
  static toSerialized(target: DDiagramSerializedSimple | DDiagramSerialized): DDiagramSerialized;
12
13
  static newLayer(serialized: DDiagramSerialized, container: DDiagramLayerContainer | EShapeLayerContainer, manager: EShapeResourceManagerDeserialization): Promise<EShape[]>;
@@ -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;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ACnB;gBACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;aACtB;YACD,OAAO,MAAM,CAAC;QACf,CAAC;;;OAAA;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\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":["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;IAED,sBAAI,iCAAM;aAAV;;YACC,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC1B,IAAI,MAAM,IAAI,IAAI,EAAE;gBACnB,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAC;gBACtC,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,EAAE;oBACjC,MAAM,GAAG,OAAO,CAAC;iBACjB;qBAAM;oBACN,sEAAsE;oBACtE,MAAM,GAAG,IAAI,aAAa,CACzB,OAAO,CACU,CAAC;iBACnB;gBACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;aACtB;YACD,OAAO,MAAM,CAAC;QACf,CAAC;;;OAAA;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"]}
@@ -6,9 +6,34 @@ import { EShapeResourceManagerDeserialization } from "./shape/e-shape-resource-m
6
6
  import { deserializeAll } from "./shape/variant/deserialize-all";
7
7
  import { EShapeEmbeddedDatum } from "./shape/variant/e-shape-embedded-datum";
8
8
  import { EShapeEmbeddedLayerContainer } from "./shape/variant/e-shape-embedded-layer-container";
9
+ import { isArray } from "./util/is-array";
10
+ import { isNumber } from "./util/is-number";
11
+ import { isString } from "./util/is-string";
9
12
  var DDiagrams = /** @class */ (function () {
10
13
  function DDiagrams() {
11
14
  }
15
+ DDiagrams.parse = function (target) {
16
+ if (target != null && isString(target)) {
17
+ try {
18
+ var parsed = JSON.parse(target);
19
+ if (parsed != null && isNumber(parsed.version) && isString(parsed.name)) {
20
+ if (isNumber(parsed.width) &&
21
+ isNumber(parsed.height) &&
22
+ isArray(parsed.items) &&
23
+ isArray(parsed.resources)) {
24
+ return parsed;
25
+ }
26
+ else if (isString(parsed.data)) {
27
+ return this.toSerialized(parsed);
28
+ }
29
+ }
30
+ }
31
+ catch (e) {
32
+ // DO NOTHING
33
+ }
34
+ }
35
+ return null;
36
+ };
12
37
  DDiagrams.toSimple = function (serialized) {
13
38
  return {
14
39
  version: serialized.version,
@@ -1 +1 @@
1
- {"version":3,"file":"d-diagrams.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagrams.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AAExG,OA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ACV,SAAS,EACT,IAAI,oCAAoC,CACvC,UAAU,EACV,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,KAAK,CACL,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,gBAAC;AAAD,CAAC,AAxMD,IAwMC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDiagramBaseController } from \"./d-diagram-base-controller\";\nimport { DDiagramLayerContainer } from \"./d-diagram-layer-container\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedSimple,\n\tDDiagramSerializedSimpleData\n} from \"./d-diagram-serialized\";\nimport { EShape } from \"./shape/e-shape\";\nimport { EShapeLayerContainer } from \"./shape/e-shape-layer-container\";\nimport { EShapeResourceManagerDeserialization } from \"./shape/e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerDeserializationMode } from \"./shape/e-shape-resource-manager-deserialization-mode\";\nimport { deserializeAll } from \"./shape/variant/deserialize-all\";\nimport { EShapeEmbeddedDatum } from \"./shape/variant/e-shape-embedded-datum\";\nimport { EShapeEmbeddedLayerContainer } from \"./shape/variant/e-shape-embedded-layer-container\";\n\nexport class DDiagrams {\n\tstatic toSimple(serialized: DDiagramSerialized): DDiagramSerializedSimple {\n\t\treturn {\n\t\t\tversion: serialized.version,\n\t\t\tid: serialized.id,\n\t\t\tname: serialized.name,\n\t\t\tlabel: serialized.label,\n\t\t\tcategory: serialized.category,\n\t\t\tsummary: serialized.summary,\n\t\t\tdescription: serialized.description,\n\t\t\tthumbnail: serialized.thumbnail,\n\t\t\tdata: JSON.stringify({\n\t\t\t\twidth: serialized.width,\n\t\t\t\theight: serialized.height,\n\t\t\t\tbackground: serialized.background,\n\t\t\t\ttile: serialized.tile,\n\t\t\t\tresources: serialized.resources,\n\t\t\t\tdata: serialized.data || serialized.tags,\n\t\t\t\tpieces: serialized.pieces,\n\t\t\t\tlayers: serialized.layers,\n\t\t\t\titems: serialized.items,\n\t\t\t\tsnap: serialized.snap\n\t\t\t})\n\t\t};\n\t}\n\n\tstatic toSerialized(target: DDiagramSerializedSimple | DDiagramSerialized): DDiagramSerialized {\n\t\tif (!(\"items\" in target)) {\n\t\t\tconst data: DDiagramSerializedSimpleData = JSON.parse(target.data);\n\t\t\tconst result: DDiagramSerialized = {\n\t\t\t\tversion: target.version,\n\t\t\t\tid: target.id,\n\t\t\t\tname: target.name,\n\t\t\t\tlabel: target.label,\n\t\t\t\twidth: data.width,\n\t\t\t\theight: data.height,\n\t\t\t\tcategory: target.category,\n\t\t\t\tsummary: target.summary,\n\t\t\t\tdescription: target.description,\n\t\t\t\tbackground: data.background,\n\t\t\t\ttile: data.tile,\n\t\t\t\tresources: data.resources,\n\t\t\t\tdata: data.data || data.tags,\n\t\t\t\tpieces: data.pieces,\n\t\t\t\tlayers: data.layers,\n\t\t\t\titems: data.items,\n\t\t\t\tsnap: data.snap,\n\t\t\t\tthumbnail: target.thumbnail\n\t\t\t};\n\t\t\tif (result.data == null) {\n\t\t\t\tconst tags = target.tags;\n\t\t\t\tif (tags != null) {\n\t\t\t\t\tresult.data = JSON.parse(tags);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.pieces == null) {\n\t\t\t\tconst pieces = target.pieces;\n\t\t\t\tif (pieces != null) {\n\t\t\t\t\tresult.pieces = JSON.parse(pieces);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn target;\n\t}\n\n\tstatic newLayer(\n\t\tserialized: DDiagramSerialized,\n\t\tcontainer: DDiagramLayerContainer | EShapeLayerContainer,\n\t\tmanager: EShapeResourceManagerDeserialization\n\t): Promise<EShape[]> {\n\t\t// Layers\n\t\tcontainer.deserialize(serialized.layers, manager);\n\n\t\t// Items\n\t\tconst serializedItems = serialized.items;\n\t\tconst shapePromises = deserializeAll(serializedItems, manager);\n\t\tif (shapePromises != null) {\n\t\t\treturn shapePromises.then((shapes: EShape[]): EShape[] => {\n\t\t\t\tconst layers = container.children;\n\t\t\t\tfor (let i = 0, imax = shapes.length; i < imax; ++i) {\n\t\t\t\t\tconst serializedItem = serializedItems[i];\n\t\t\t\t\tconst shape = shapes[i];\n\t\t\t\t\tconst layer = layers[serializedItem[16]];\n\t\t\t\t\tif (layer != null) {\n\t\t\t\t\t\tshape.parent = layer;\n\t\t\t\t\t\tshape.uploaded = undefined;\n\t\t\t\t\t\tlayer.children.push(shape);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (let i = 0, imax = layers.length; i < imax; ++i) {\n\t\t\t\t\tconst layer = layers[i];\n\t\t\t\t\tlayer.onChildTransformChange();\n\t\t\t\t\tlayer.toDirty();\n\t\t\t\t\tconst children = layer.children;\n\t\t\t\t\tfor (let j = 0, jmax = children.length; j < jmax; ++j) {\n\t\t\t\t\t\tchildren[j].onAttach();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn shapes;\n\t\t\t});\n\t\t} else {\n\t\t\treturn Promise.resolve([]);\n\t\t}\n\t}\n\n\tstatic toPieceData(\n\t\tcontroller: DDiagramBaseController | null | undefined,\n\t\tpieces: string[] | null | undefined,\n\t\tmode: EShapeResourceManagerDeserializationMode\n\t): Promise<Map<string, EShapeEmbeddedDatum | null>> {\n\t\tconst pieceToDatum = new Map<string, EShapeEmbeddedDatum | null>();\n\t\tconst pieceToPromise = new Map<string, Promise<EShape[] | null>>();\n\t\tconst onFulfilled = () => {\n\t\t\treturn pieceToDatum;\n\t\t};\n\t\treturn this.toPieceData_(controller, pieces, pieceToDatum, pieceToPromise, mode, 0).then(\n\t\t\tonFulfilled,\n\t\t\tonFulfilled\n\t\t);\n\t}\n\n\tprivate static toPieceData_(\n\t\tcontroller: DDiagramBaseController | null | undefined,\n\t\tpieces: string[] | null | undefined,\n\t\tpieceToDatum: Map<string, EShapeEmbeddedDatum | null>,\n\t\tpieceToPromise: Map<string, Promise<EShape[] | null>>,\n\t\tmode: EShapeResourceManagerDeserializationMode,\n\t\tdepth: number\n\t): Promise<Array<EShape[] | null>> {\n\t\tconst promises: Array<Promise<EShape[] | null>> = [];\n\t\tif (pieces && 0 < pieces.length && controller) {\n\t\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\t\tconst piece = pieces[i];\n\t\t\t\tconst promise = pieceToPromise.get(piece);\n\t\t\t\tif (promise != null) {\n\t\t\t\t\tpromises.push(promise);\n\t\t\t\t} else {\n\t\t\t\t\tconst newPromise = controller.piece.getByName(piece).then(\n\t\t\t\t\t\t(found) => {\n\t\t\t\t\t\t\treturn this.toPieceData__(\n\t\t\t\t\t\t\t\tcontroller,\n\t\t\t\t\t\t\t\tpiece,\n\t\t\t\t\t\t\t\tfound,\n\t\t\t\t\t\t\t\tmode,\n\t\t\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\t\t\tpieceToDatum,\n\t\t\t\t\t\t\t\tpieceToPromise\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tpieceToPromise.set(piece, newPromise);\n\t\t\t\t\tpromises.push(newPromise);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn Promise.all(promises);\n\t}\n\n\tprivate static toPieceData__(\n\t\tcontroller: DDiagramBaseController,\n\t\tname: string,\n\t\tserializedOrSimple: DDiagramSerialized | DDiagramSerializedSimple,\n\t\tmode: EShapeResourceManagerDeserializationMode,\n\t\tdepth: number,\n\t\tpieceToDatum: Map<string, EShapeEmbeddedDatum | null>,\n\t\tpieceToPromise: Map<string, Promise<EShape[] | null>>\n\t): Promise<EShape[]> {\n\t\tconst serialized = this.toSerialized(serializedOrSimple);\n\t\tconst width = serialized.width;\n\t\tconst height = serialized.height;\n\t\tconst container = new EShapeEmbeddedLayerContainer(width, height);\n\n\t\tpieceToDatum.set(name, new EShapeEmbeddedDatum(name, width, height, container));\n\n\t\tconst pieces = serialized.pieces;\n\t\treturn this.toPieceData_(\n\t\t\tcontroller,\n\t\t\tpieces,\n\t\t\tpieceToDatum,\n\t\t\tpieceToPromise,\n\t\t\tmode,\n\t\t\tdepth\n\t\t).then(() => {\n\t\t\treturn this.newLayer(\n\t\t\t\tserialized,\n\t\t\t\tcontainer,\n\t\t\t\tnew EShapeResourceManagerDeserialization(\n\t\t\t\t\tserialized,\n\t\t\t\t\tpieces,\n\t\t\t\t\tpieceToDatum,\n\t\t\t\t\tmode,\n\t\t\t\t\tdepth\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-diagrams.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagrams.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AAExG,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;IAAA;IA+NA,CAAC;IA9NO,eAAK,GAAZ,UAAa,MAAe;QAC3B,IAAI,MAAM,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvC,IAAI;gBACH,IAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAClC,IAAI,MAAM,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBACxE,IACC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;wBACtB,QAAQ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AU,CAAC,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC,YAAY,CACvB,UAAU,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,KAAK,CACL,CAAC,IAAI,CAAC;YACN,OAAO,KAAI,CAAC,QAAQ,CACnB,UAAU,EACV,SAAS,EACT,IAAI,oCAAoC,CACvC,UAAU,EACV,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,KAAK,CACL,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,gBAAC;AAAD,CAAC,AA/ND,IA+NC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDiagramBaseController } from \"./d-diagram-base-controller\";\nimport { DDiagramLayerContainer } from \"./d-diagram-layer-container\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedSimple,\n\tDDiagramSerializedSimpleData\n} from \"./d-diagram-serialized\";\nimport { EShape } from \"./shape/e-shape\";\nimport { EShapeLayerContainer } from \"./shape/e-shape-layer-container\";\nimport { EShapeResourceManagerDeserialization } from \"./shape/e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerDeserializationMode } from \"./shape/e-shape-resource-manager-deserialization-mode\";\nimport { deserializeAll } from \"./shape/variant/deserialize-all\";\nimport { EShapeEmbeddedDatum } from \"./shape/variant/e-shape-embedded-datum\";\nimport { EShapeEmbeddedLayerContainer } from \"./shape/variant/e-shape-embedded-layer-container\";\nimport { isArray } from \"./util/is-array\";\nimport { isNumber } from \"./util/is-number\";\nimport { isString } from \"./util/is-string\";\n\nexport class DDiagrams {\n\tstatic parse(target: unknown): DDiagramSerialized | null {\n\t\tif (target != null && isString(target)) {\n\t\t\ttry {\n\t\t\t\tconst parsed = JSON.parse(target);\n\t\t\t\tif (parsed != null && isNumber(parsed.version) && isString(parsed.name)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisNumber(parsed.width) &&\n\t\t\t\t\t\tisNumber(parsed.height) &&\n\t\t\t\t\t\tisArray(parsed.items) &&\n\t\t\t\t\t\tisArray(parsed.resources)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn parsed;\n\t\t\t\t\t} else if (isString(parsed.data)) {\n\t\t\t\t\t\treturn this.toSerialized(parsed);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t// DO NOTHING\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic toSimple(serialized: DDiagramSerialized): DDiagramSerializedSimple {\n\t\treturn {\n\t\t\tversion: serialized.version,\n\t\t\tid: serialized.id,\n\t\t\tname: serialized.name,\n\t\t\tlabel: serialized.label,\n\t\t\tcategory: serialized.category,\n\t\t\tsummary: serialized.summary,\n\t\t\tdescription: serialized.description,\n\t\t\tthumbnail: serialized.thumbnail,\n\t\t\tdata: JSON.stringify({\n\t\t\t\twidth: serialized.width,\n\t\t\t\theight: serialized.height,\n\t\t\t\tbackground: serialized.background,\n\t\t\t\ttile: serialized.tile,\n\t\t\t\tresources: serialized.resources,\n\t\t\t\tdata: serialized.data || serialized.tags,\n\t\t\t\tpieces: serialized.pieces,\n\t\t\t\tlayers: serialized.layers,\n\t\t\t\titems: serialized.items,\n\t\t\t\tsnap: serialized.snap\n\t\t\t})\n\t\t};\n\t}\n\n\tstatic toSerialized(target: DDiagramSerializedSimple | DDiagramSerialized): DDiagramSerialized {\n\t\tif (!(\"items\" in target)) {\n\t\t\tconst data: DDiagramSerializedSimpleData = JSON.parse(target.data);\n\t\t\tconst result: DDiagramSerialized = {\n\t\t\t\tversion: target.version,\n\t\t\t\tid: target.id,\n\t\t\t\tname: target.name,\n\t\t\t\tlabel: target.label,\n\t\t\t\twidth: data.width,\n\t\t\t\theight: data.height,\n\t\t\t\tcategory: target.category,\n\t\t\t\tsummary: target.summary,\n\t\t\t\tdescription: target.description,\n\t\t\t\tbackground: data.background,\n\t\t\t\ttile: data.tile,\n\t\t\t\tresources: data.resources,\n\t\t\t\tdata: data.data || data.tags,\n\t\t\t\tpieces: data.pieces,\n\t\t\t\tlayers: data.layers,\n\t\t\t\titems: data.items,\n\t\t\t\tsnap: data.snap,\n\t\t\t\tthumbnail: target.thumbnail\n\t\t\t};\n\t\t\tif (result.data == null) {\n\t\t\t\tconst tags = target.tags;\n\t\t\t\tif (tags != null) {\n\t\t\t\t\tresult.data = JSON.parse(tags);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (result.pieces == null) {\n\t\t\t\tconst pieces = target.pieces;\n\t\t\t\tif (pieces != null) {\n\t\t\t\t\tresult.pieces = JSON.parse(pieces);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn target;\n\t}\n\n\tstatic newLayer(\n\t\tserialized: DDiagramSerialized,\n\t\tcontainer: DDiagramLayerContainer | EShapeLayerContainer,\n\t\tmanager: EShapeResourceManagerDeserialization\n\t): Promise<EShape[]> {\n\t\t// Layers\n\t\tcontainer.deserialize(serialized.layers, manager);\n\n\t\t// Items\n\t\tconst serializedItems = serialized.items;\n\t\tconst shapePromises = deserializeAll(serializedItems, manager);\n\t\tif (shapePromises != null) {\n\t\t\treturn shapePromises.then((shapes: EShape[]): EShape[] => {\n\t\t\t\tconst layers = container.children;\n\t\t\t\tfor (let i = 0, imax = shapes.length; i < imax; ++i) {\n\t\t\t\t\tconst serializedItem = serializedItems[i];\n\t\t\t\t\tconst shape = shapes[i];\n\t\t\t\t\tconst layer = layers[serializedItem[16]];\n\t\t\t\t\tif (layer != null) {\n\t\t\t\t\t\tshape.parent = layer;\n\t\t\t\t\t\tshape.uploaded = undefined;\n\t\t\t\t\t\tlayer.children.push(shape);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (let i = 0, imax = layers.length; i < imax; ++i) {\n\t\t\t\t\tconst layer = layers[i];\n\t\t\t\t\tlayer.onChildTransformChange();\n\t\t\t\t\tlayer.toDirty();\n\t\t\t\t\tconst children = layer.children;\n\t\t\t\t\tfor (let j = 0, jmax = children.length; j < jmax; ++j) {\n\t\t\t\t\t\tchildren[j].onAttach();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn shapes;\n\t\t\t});\n\t\t} else {\n\t\t\treturn Promise.resolve([]);\n\t\t}\n\t}\n\n\tstatic toPieceData(\n\t\tcontroller: DDiagramBaseController | null | undefined,\n\t\tpieces: string[] | null | undefined,\n\t\tmode: EShapeResourceManagerDeserializationMode\n\t): Promise<Map<string, EShapeEmbeddedDatum | null>> {\n\t\tconst pieceToDatum = new Map<string, EShapeEmbeddedDatum | null>();\n\t\tconst pieceToPromise = new Map<string, Promise<EShape[] | null>>();\n\t\tconst onFulfilled = () => {\n\t\t\treturn pieceToDatum;\n\t\t};\n\t\treturn this.toPieceData_(controller, pieces, pieceToDatum, pieceToPromise, mode, 0).then(\n\t\t\tonFulfilled,\n\t\t\tonFulfilled\n\t\t);\n\t}\n\n\tprivate static toPieceData_(\n\t\tcontroller: DDiagramBaseController | null | undefined,\n\t\tpieces: string[] | null | undefined,\n\t\tpieceToDatum: Map<string, EShapeEmbeddedDatum | null>,\n\t\tpieceToPromise: Map<string, Promise<EShape[] | null>>,\n\t\tmode: EShapeResourceManagerDeserializationMode,\n\t\tdepth: number\n\t): Promise<Array<EShape[] | null>> {\n\t\tconst promises: Array<Promise<EShape[] | null>> = [];\n\t\tif (pieces && 0 < pieces.length && controller) {\n\t\t\tfor (let i = 0, imax = pieces.length; i < imax; ++i) {\n\t\t\t\tconst piece = pieces[i];\n\t\t\t\tconst promise = pieceToPromise.get(piece);\n\t\t\t\tif (promise != null) {\n\t\t\t\t\tpromises.push(promise);\n\t\t\t\t} else {\n\t\t\t\t\tconst newPromise = controller.piece.getByName(piece).then(\n\t\t\t\t\t\t(found) => {\n\t\t\t\t\t\t\treturn this.toPieceData__(\n\t\t\t\t\t\t\t\tcontroller,\n\t\t\t\t\t\t\t\tpiece,\n\t\t\t\t\t\t\t\tfound,\n\t\t\t\t\t\t\t\tmode,\n\t\t\t\t\t\t\t\tdepth + 1,\n\t\t\t\t\t\t\t\tpieceToDatum,\n\t\t\t\t\t\t\t\tpieceToPromise\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tpieceToPromise.set(piece, newPromise);\n\t\t\t\t\tpromises.push(newPromise);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn Promise.all(promises);\n\t}\n\n\tprivate static toPieceData__(\n\t\tcontroller: DDiagramBaseController,\n\t\tname: string,\n\t\tserializedOrSimple: DDiagramSerialized | DDiagramSerializedSimple,\n\t\tmode: EShapeResourceManagerDeserializationMode,\n\t\tdepth: number,\n\t\tpieceToDatum: Map<string, EShapeEmbeddedDatum | null>,\n\t\tpieceToPromise: Map<string, Promise<EShape[] | null>>\n\t): Promise<EShape[]> {\n\t\tconst serialized = this.toSerialized(serializedOrSimple);\n\t\tconst width = serialized.width;\n\t\tconst height = serialized.height;\n\t\tconst container = new EShapeEmbeddedLayerContainer(width, height);\n\n\t\tpieceToDatum.set(name, new EShapeEmbeddedDatum(name, width, height, container));\n\n\t\tconst pieces = serialized.pieces;\n\t\treturn this.toPieceData_(\n\t\t\tcontroller,\n\t\t\tpieces,\n\t\t\tpieceToDatum,\n\t\t\tpieceToPromise,\n\t\t\tmode,\n\t\t\tdepth\n\t\t).then(() => {\n\t\t\treturn this.newLayer(\n\t\t\t\tserialized,\n\t\t\t\tcontainer,\n\t\t\t\tnew EShapeResourceManagerDeserialization(\n\t\t\t\t\tserialized,\n\t\t\t\t\tpieces,\n\t\t\t\t\tpieceToDatum,\n\t\t\t\t\tmode,\n\t\t\t\t\tdepth\n\t\t\t\t)\n\t\t\t);\n\t\t});\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,E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O,GAAG,IAAI,CAAC;QAEpB,YAAY;QACZ,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;AA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;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\";\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,gBA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AAiB;YACjB,IAAI,CAAC,IAAI,CAAC,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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;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, 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.385.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.385.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.385.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.385.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.385.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.385.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.385.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.385.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.385.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.385.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.385.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.385.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