@wcardinal/wcardinal-ui 0.277.0 → 0.278.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.
@@ -3,6 +3,7 @@ import { DCommandFlag } from "./d-command-flag";
3
3
  export declare class DCommandBase implements DCommand {
4
4
  execute(): boolean;
5
5
  merge(target: DCommand): boolean;
6
+ isMerged(): boolean;
6
7
  redo(): boolean;
7
8
  undo(): boolean;
8
9
  destroy(): void;
@@ -14,6 +14,7 @@ export interface DCommand {
14
14
  * @return true if merged successfully
15
15
  */
16
16
  merge(target: DCommand): boolean;
17
+ isMerged(): boolean;
17
18
  redo(): boolean;
18
19
  undo(): boolean;
19
20
  destroy(): void;
@@ -7,8 +7,8 @@ export declare class DControllerCommandImpl extends utils.EventEmitter implement
7
7
  constructor();
8
8
  last(): DCommand | null;
9
9
  push(command: DCommand): void;
10
+ protected merge(command: DCommand): void;
10
11
  protected execute(command: DCommand): void;
11
- protected onMerged(command: DCommand): void;
12
12
  protected onSuccess(command: DCommand): void;
13
13
  protected onFail(command: DCommand): void;
14
14
  protected cleanup(): void;
@@ -12,6 +12,9 @@ var DCommandBase = /** @class */ (function () {
12
12
  DCommandBase.prototype.merge = function (target) {
13
13
  return false;
14
14
  };
15
+ DCommandBase.prototype.isMerged = function () {
16
+ return false;
17
+ };
15
18
  DCommandBase.prototype.redo = function () {
16
19
  return true;
17
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"d-command-base.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;IAAA;IAwBA,CAAC;IAvBA,8BAAO,GAAP;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,4BAAK,GAAL,UAAM,MAAgB;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,2BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,2BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,8BAAO,GAAP;QACC,aAAa;IACd,CAAC;IAED,8BAAO,GAAP;QACC,OAAO,YAAY,CAAC,IAAI,CAAC;IAC1B,CAAC;IACF,mBAAC;AAAD,CAAC,AAxBD,IAwBC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DCommand } from \"./d-command\";\nimport { DCommandFlag } from \"./d-command-flag\";\n\nexport class DCommandBase implements DCommand {\n\texecute(): boolean {\n\t\treturn true;\n\t}\n\n\tmerge(target: DCommand): boolean {\n\t\treturn false;\n\t}\n\n\tredo(): boolean {\n\t\treturn true;\n\t}\n\n\tundo(): boolean {\n\t\treturn true;\n\t}\n\n\tdestroy(): void {\n\t\t// DO NOTHING\n\t}\n\n\tgetFlag(): DCommandFlag {\n\t\treturn DCommandFlag.NONE;\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-command-base.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;IAAA;IA4BA,CAAC;IA3BA,8BAAO,GAAP;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,4BAAK,GAAL,UAAM,MAAgB;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,+BAAQ,GAAR;QACC,OAAO,KAAK,CAAC;IACd,CAAC;IAED,2BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,2BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,8BAAO,GAAP;QACC,aAAa;IACd,CAAC;IAED,8BAAO,GAAP;QACC,OAAO,YAAY,CAAC,IAAI,CAAC;IAC1B,CAAC;IACF,mBAAC;AAAD,CAAC,AA5BD,IA4BC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DCommand } from \"./d-command\";\nimport { DCommandFlag } from \"./d-command-flag\";\n\nexport class DCommandBase implements DCommand {\n\texecute(): boolean {\n\t\treturn true;\n\t}\n\n\tmerge(target: DCommand): boolean {\n\t\treturn false;\n\t}\n\n\tisMerged(): boolean {\n\t\treturn false;\n\t}\n\n\tredo(): boolean {\n\t\treturn true;\n\t}\n\n\tundo(): boolean {\n\t\treturn true;\n\t}\n\n\tdestroy(): void {\n\t\t// DO NOTHING\n\t}\n\n\tgetFlag(): DCommandFlag {\n\t\treturn DCommandFlag.NONE;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"d-command.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DCommandFlag } from \"./d-command-flag\";\n\nexport interface DCommand {\n\t/**\n\t * Called to executed this command.\n\t *\n\t * @return true if executed successfully\n\t */\n\texecute(): boolean;\n\n\t/**\n\t * Called to merge the target command and this command.\n\t * Returns true if merged successfully.\n\t *\n\t * @param target a command to be merged\n\t * @return true if merged successfully\n\t */\n\tmerge(target: DCommand): boolean;\n\n\tredo(): boolean;\n\tundo(): boolean;\n\tdestroy(): void;\n\tgetFlag(): DCommandFlag;\n}\n"]}
1
+ {"version":3,"file":"d-command.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DCommandFlag } from \"./d-command-flag\";\n\nexport interface DCommand {\n\t/**\n\t * Called to executed this command.\n\t *\n\t * @return true if executed successfully\n\t */\n\texecute(): boolean;\n\n\t/**\n\t * Called to merge the target command and this command.\n\t * Returns true if merged successfully.\n\t *\n\t * @param target a command to be merged\n\t * @return true if merged successfully\n\t */\n\tmerge(target: DCommand): boolean;\n\n\tisMerged(): boolean;\n\n\tredo(): boolean;\n\tundo(): boolean;\n\tdestroy(): void;\n\tgetFlag(): DCommandFlag;\n}\n"]}
@@ -7,7 +7,7 @@ import { utils } from "pixi.js";
7
7
  import { DCommandClear } from "./d-command-clear";
8
8
  import { DCommandFlag } from "./d-command-flag";
9
9
  var isCommandStorable = function (command) {
10
- return !(command.getFlag() & DCommandFlag.UNSTORABLE);
10
+ return !(command.getFlag() & DCommandFlag.UNSTORABLE) && !command.isMerged();
11
11
  };
12
12
  var isCommandClear = function (command) {
13
13
  return !!(command.getFlag() & DCommandFlag.CLEAR);
@@ -34,8 +34,16 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
34
34
  }
35
35
  };
36
36
  DControllerCommandImpl.prototype.push = function (command) {
37
+ this.merge(command);
37
38
  this.execute(command);
38
39
  };
40
+ DControllerCommandImpl.prototype.merge = function (command) {
41
+ var done = this._done;
42
+ var doneLength = done.length;
43
+ if (0 < doneLength) {
44
+ command.merge(done[doneLength - 1]);
45
+ }
46
+ };
39
47
  DControllerCommandImpl.prototype.execute = function (command) {
40
48
  this.emit("executing", command, this);
41
49
  var isClear = isCommandClear(command);
@@ -49,14 +57,6 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
49
57
  }
50
58
  this.cleanup();
51
59
  }
52
- var done = this._done;
53
- var doneLength = done.length;
54
- if (0 < doneLength) {
55
- var last = done[doneLength - 1];
56
- if (command.merge(last)) {
57
- return this.onMerged(command);
58
- }
59
- }
60
60
  var result = command.execute();
61
61
  if (result === true) {
62
62
  return this.onSuccess(command);
@@ -65,15 +65,6 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
65
65
  return this.onFail(command);
66
66
  }
67
67
  };
68
- DControllerCommandImpl.prototype.onMerged = function (command) {
69
- if (isCommandStorable(command)) {
70
- if (!isCommandClean(command)) {
71
- this.emit("dirty", this);
72
- }
73
- }
74
- this.emit("change", this);
75
- this.emit("executed", command, this);
76
- };
77
68
  DControllerCommandImpl.prototype.onSuccess = function (command) {
78
69
  if (isCommandStorable(command)) {
79
70
  var done = this._done;
@@ -1 +1 @@
1
- {"version":3,"file":"d-controller-command-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-controller-command-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,IAAM,iBAAiB,GAAG,UAAC,OAAiB;IAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;IAA4C,0CAAkB;IAI7D;QAAA,YACC,iBAAO,SAGP;QAFA,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;;IACjB,CAAC;IAED,qCAAI,GAAJ;QACC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,GAAG,UAAU,EAAE;YACnB,OAAO,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;SAC5B;a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AAD,CAAC,AAzMD,CAA4C,KAAK,CAAC,YAAY,GAyM7D","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport { DCommand } from \"./d-command\";\nimport { DCommandClear } from \"./d-command-clear\";\nimport { DCommandFlag } from \"./d-command-flag\";\nimport { DControllerCommand } from \"./d-controller-command\";\n\nconst isCommandStorable = (command: DCommand): boolean => {\n\treturn !(command.getFlag() & DCommandFlag.UNSTORABLE);\n};\n\nconst isCommandClear = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAR);\n};\n\nconst isCommandClean = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAN);\n};\n\nexport class DControllerCommandImpl extends utils.EventEmitter implements DControllerCommand {\n\tprotected _position: number;\n\tprotected _done: DCommand[];\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tconst doneLength = done.length;\n\t\tif (0 < doneLength) {\n\t\t\treturn done[doneLength - 1];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis.execute(command);\n\t}\n\n\tprotected execute(command: DCommand): void {\n\t\tthis.emit(\"executing\", command, this);\n\t\tconst isClear = isCommandClear(command);\n\t\tconst isStorable = isCommandStorable(command);\n\t\tif (isClear || isStorable) {\n\t\t\tconst size = isClear ? this._done.length : this._position;\n\t\t\tif (0 < size) {\n\t\t\t\tthis.remove(size);\n\t\t\t\tthis._position = 0;\n\t\t\t\tthis.emit(\"change\", this);\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t}\n\n\t\tconst done = this._done;\n\t\tconst doneLength = done.length;\n\t\tif (0 < doneLength) {\n\t\t\tconst last = done[doneLength - 1];\n\t\t\tif (command.merge(last)) {\n\t\t\t\treturn this.onMerged(command);\n\t\t\t}\n\t\t}\n\n\t\tconst result = command.execute();\n\t\tif (result === true) {\n\t\t\treturn this.onSuccess(command);\n\t\t} else {\n\t\t\treturn this.onFail(command);\n\t\t}\n\t}\n\n\tprotected onMerged(command: DCommand): void {\n\t\tif (isCommandStorable(command)) {\n\t\t\tif (!isCommandClean(command)) {\n\t\t\t\tthis.emit(\"dirty\", this);\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"executed\", command, this);\n\t}\n\n\tprotected onSuccess(command: DCommand): void {\n\t\tif (isCommandStorable(command)) {\n\t\t\tconst done = this._done;\n\t\t\tconst doneLength = done.length;\n\t\t\tif (0 < doneLength) {\n\t\t\t\tconst last = done[doneLength - 1];\n\t\t\t\tif (!last.merge(command)) {\n\t\t\t\t\tdone.push(command);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdone.push(command);\n\t\t\t}\n\t\t\tif (!isCommandClean(command)) {\n\t\t\t\tthis.emit(\"dirty\", this);\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"executed\", command, this);\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tcommand.destroy();\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tprotected cleanup(): void {\n\t\tconst done = this._done;\n\t\tconst size = done.length - 100;\n\t\tif (0 < size) {\n\t\t\tfor (let i = 0; i < size; ++i) {\n\t\t\t\tdone[i].destroy();\n\t\t\t\tdone.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected remove(size: number): boolean {\n\t\tconst done = this._done;\n\t\tif (0 < size) {\n\t\t\tconst ifrom = Math.max(0, done.length - size);\n\t\t\tsize = done.length - ifrom;\n\t\t\tif (0 < size) {\n\t\t\t\tfor (let i = ifrom, imax = done.length; i < imax; ++i) {\n\t\t\t\t\tdone[i].destroy();\n\t\t\t\t}\n\n\t\t\t\tdone.splice(ifrom, done.length - ifrom);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tsize(): number {\n\t\treturn this._done.length;\n\t}\n\n\tclear(): void {\n\t\tthis.push(new DCommandClear());\n\t}\n\n\tredo(): void {\n\t\tif (this.isRedoable()) {\n\t\t\tthis.doRedo();\n\t\t}\n\t}\n\n\tprotected doRedo(): void {\n\t\tconst done = this._done;\n\t\tif (0 < this._position) {\n\t\t\tconst current = done[done.length - this._position];\n\t\t\tthis._position -= 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"redoing\", current, this);\n\t\t\tconst result = current.redo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onRedoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onRedoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRedoSuccess(redoed: DCommand): void {\n\t\tif (!isCommandClean(redoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"redoed\", redoed, this);\n\t}\n\n\tprotected onRedoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position;\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis.doUndo();\n\t\t}\n\t}\n\n\tprotected doUndo(): void {\n\t\tconst done = this._done;\n\t\tif (this._position < done.length) {\n\t\t\tconst current = done[done.length - 1 - this._position];\n\t\t\tthis._position += 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"undoing\", current, this);\n\t\t\tconst result = current.undo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onUndoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onUndoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onUndoSuccess(undoed: DCommand): void {\n\t\tif (!isCommandClean(undoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"undoed\", undoed, this);\n\t}\n\n\tprotected onUndoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length;\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-controller-command-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-controller-command-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,IAAM,iBAAiB,GAAG,UAAC,OAAiB;IAC3C,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,IAAM,cAAc,GAAG,UAAC,OAAiB;IACxC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF;IAA4C,0CAAkB;IAI7D;QAAA,YACC,iBAAO,SAGP;QAFA,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;;IACjB,CAAC;IAED,qCAAI,GAAJ;QACC,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,CAAC,GAAG,UAAU,EAAE;YACnB,OAAO,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;SAC5B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B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACpC,IAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,MAAM,KAAK,IAAI,EAAE;gBACpB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;aAC5B;iBAAM;gBACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aACzB;SACD;IACF,CAAC;IAES,8CAAa,GAAvB,UAAwB,MAAgB;QACvC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACzB;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAES,2CAAU,GAApB,UAAqB,OAAiB;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3C,CAAC;IACF,6BAAC;AAAD,CAAC,AA9LD,CAA4C,KAAK,CAAC,YAAY,GA8L7D","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport { DCommand } from \"./d-command\";\nimport { DCommandClear } from \"./d-command-clear\";\nimport { DCommandFlag } from \"./d-command-flag\";\nimport { DControllerCommand } from \"./d-controller-command\";\n\nconst isCommandStorable = (command: DCommand): boolean => {\n\treturn !(command.getFlag() & DCommandFlag.UNSTORABLE) && !command.isMerged();\n};\n\nconst isCommandClear = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAR);\n};\n\nconst isCommandClean = (command: DCommand): boolean => {\n\treturn !!(command.getFlag() & DCommandFlag.CLEAN);\n};\n\nexport class DControllerCommandImpl extends utils.EventEmitter implements DControllerCommand {\n\tprotected _position: number;\n\tprotected _done: DCommand[];\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tconst doneLength = done.length;\n\t\tif (0 < doneLength) {\n\t\t\treturn done[doneLength - 1];\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis.merge(command);\n\t\tthis.execute(command);\n\t}\n\n\tprotected merge(command: DCommand): void {\n\t\tconst done = this._done;\n\t\tconst doneLength = done.length;\n\t\tif (0 < doneLength) {\n\t\t\tcommand.merge(done[doneLength - 1]);\n\t\t}\n\t}\n\n\tprotected execute(command: DCommand): void {\n\t\tthis.emit(\"executing\", command, this);\n\t\tconst isClear = isCommandClear(command);\n\t\tconst isStorable = isCommandStorable(command);\n\t\tif (isClear || isStorable) {\n\t\t\tconst size = isClear ? this._done.length : this._position;\n\t\t\tif (0 < size) {\n\t\t\t\tthis.remove(size);\n\t\t\t\tthis._position = 0;\n\t\t\t\tthis.emit(\"change\", this);\n\t\t\t}\n\t\t\tthis.cleanup();\n\t\t}\n\t\tconst result = command.execute();\n\t\tif (result === true) {\n\t\t\treturn this.onSuccess(command);\n\t\t} else {\n\t\t\treturn this.onFail(command);\n\t\t}\n\t}\n\n\tprotected onSuccess(command: DCommand): void {\n\t\tif (isCommandStorable(command)) {\n\t\t\tconst done = this._done;\n\t\t\tconst doneLength = done.length;\n\t\t\tif (0 < doneLength) {\n\t\t\t\tconst last = done[doneLength - 1];\n\t\t\t\tif (!last.merge(command)) {\n\t\t\t\t\tdone.push(command);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdone.push(command);\n\t\t\t}\n\t\t\tif (!isCommandClean(command)) {\n\t\t\t\tthis.emit(\"dirty\", this);\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"executed\", command, this);\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tcommand.destroy();\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tprotected cleanup(): void {\n\t\tconst done = this._done;\n\t\tconst size = done.length - 100;\n\t\tif (0 < size) {\n\t\t\tfor (let i = 0; i < size; ++i) {\n\t\t\t\tdone[i].destroy();\n\t\t\t\tdone.shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected remove(size: number): boolean {\n\t\tconst done = this._done;\n\t\tif (0 < size) {\n\t\t\tconst ifrom = Math.max(0, done.length - size);\n\t\t\tsize = done.length - ifrom;\n\t\t\tif (0 < size) {\n\t\t\t\tfor (let i = ifrom, imax = done.length; i < imax; ++i) {\n\t\t\t\t\tdone[i].destroy();\n\t\t\t\t}\n\n\t\t\t\tdone.splice(ifrom, done.length - ifrom);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tsize(): number {\n\t\treturn this._done.length;\n\t}\n\n\tclear(): void {\n\t\tthis.push(new DCommandClear());\n\t}\n\n\tredo(): void {\n\t\tif (this.isRedoable()) {\n\t\t\tthis.doRedo();\n\t\t}\n\t}\n\n\tprotected doRedo(): void {\n\t\tconst done = this._done;\n\t\tif (0 < this._position) {\n\t\t\tconst current = done[done.length - this._position];\n\t\t\tthis._position -= 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"redoing\", current, this);\n\t\t\tconst result = current.redo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onRedoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onRedoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onRedoSuccess(redoed: DCommand): void {\n\t\tif (!isCommandClean(redoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"redoed\", redoed, this);\n\t}\n\n\tprotected onRedoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position;\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis.doUndo();\n\t\t}\n\t}\n\n\tprotected doUndo(): void {\n\t\tconst done = this._done;\n\t\tif (this._position < done.length) {\n\t\t\tconst current = done[done.length - 1 - this._position];\n\t\t\tthis._position += 1;\n\t\t\tthis.emit(\"change\", this);\n\t\t\tthis.emit(\"undoing\", current, this);\n\t\t\tconst result = current.undo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onUndoSuccess(current);\n\t\t\t} else {\n\t\t\t\tthis.onUndoFail(current);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected onUndoSuccess(undoed: DCommand): void {\n\t\tif (!isCommandClean(undoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.emit(\"undoed\", undoed, this);\n\t}\n\n\tprotected onUndoFail(command: DCommand): void {\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.277.0
2
+ Winter Cardinal UI v0.278.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.277.0
2
+ Winter Cardinal UI v0.278.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.277.0
2
+ Winter Cardinal UI v0.278.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.277.0
2
+ Winter Cardinal UI v0.278.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.277.0
2
+ Winter Cardinal UI v0.278.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -66044,6 +66044,9 @@ var DCommandBase = /** @class */ (function () {
66044
66044
  DCommandBase.prototype.merge = function (target) {
66045
66045
  return false;
66046
66046
  };
66047
+ DCommandBase.prototype.isMerged = function () {
66048
+ return false;
66049
+ };
66047
66050
  DCommandBase.prototype.redo = function () {
66048
66051
  return true;
66049
66052
  };
@@ -66079,7 +66082,7 @@ var DCommandClear = /** @class */ (function (_super) {
66079
66082
  * SPDX-License-Identifier: Apache-2.0
66080
66083
  */
66081
66084
  var isCommandStorable = function (command) {
66082
- return !(command.getFlag() & DCommandFlag.UNSTORABLE);
66085
+ return !(command.getFlag() & DCommandFlag.UNSTORABLE) && !command.isMerged();
66083
66086
  };
66084
66087
  var isCommandClear = function (command) {
66085
66088
  return !!(command.getFlag() & DCommandFlag.CLEAR);
@@ -66106,8 +66109,16 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
66106
66109
  }
66107
66110
  };
66108
66111
  DControllerCommandImpl.prototype.push = function (command) {
66112
+ this.merge(command);
66109
66113
  this.execute(command);
66110
66114
  };
66115
+ DControllerCommandImpl.prototype.merge = function (command) {
66116
+ var done = this._done;
66117
+ var doneLength = done.length;
66118
+ if (0 < doneLength) {
66119
+ command.merge(done[doneLength - 1]);
66120
+ }
66121
+ };
66111
66122
  DControllerCommandImpl.prototype.execute = function (command) {
66112
66123
  this.emit("executing", command, this);
66113
66124
  var isClear = isCommandClear(command);
@@ -66121,14 +66132,6 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
66121
66132
  }
66122
66133
  this.cleanup();
66123
66134
  }
66124
- var done = this._done;
66125
- var doneLength = done.length;
66126
- if (0 < doneLength) {
66127
- var last = done[doneLength - 1];
66128
- if (command.merge(last)) {
66129
- return this.onMerged(command);
66130
- }
66131
- }
66132
66135
  var result = command.execute();
66133
66136
  if (result === true) {
66134
66137
  return this.onSuccess(command);
@@ -66137,15 +66140,6 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
66137
66140
  return this.onFail(command);
66138
66141
  }
66139
66142
  };
66140
- DControllerCommandImpl.prototype.onMerged = function (command) {
66141
- if (isCommandStorable(command)) {
66142
- if (!isCommandClean(command)) {
66143
- this.emit("dirty", this);
66144
- }
66145
- }
66146
- this.emit("change", this);
66147
- this.emit("executed", command, this);
66148
- };
66149
66143
  DControllerCommandImpl.prototype.onSuccess = function (command) {
66150
66144
  if (isCommandStorable(command)) {
66151
66145
  var done = this._done;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.277.0
2
+ Winter Cardinal UI v0.278.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -47361,6 +47361,9 @@
47361
47361
  DCommandBase.prototype.merge = function (target) {
47362
47362
  return false;
47363
47363
  };
47364
+ DCommandBase.prototype.isMerged = function () {
47365
+ return false;
47366
+ };
47364
47367
  DCommandBase.prototype.redo = function () {
47365
47368
  return true;
47366
47369
  };
@@ -47396,7 +47399,7 @@
47396
47399
  * SPDX-License-Identifier: Apache-2.0
47397
47400
  */
47398
47401
  var isCommandStorable = function (command) {
47399
- return !(command.getFlag() & DCommandFlag.UNSTORABLE);
47402
+ return !(command.getFlag() & DCommandFlag.UNSTORABLE) && !command.isMerged();
47400
47403
  };
47401
47404
  var isCommandClear = function (command) {
47402
47405
  return !!(command.getFlag() & DCommandFlag.CLEAR);
@@ -47423,8 +47426,16 @@
47423
47426
  }
47424
47427
  };
47425
47428
  DControllerCommandImpl.prototype.push = function (command) {
47429
+ this.merge(command);
47426
47430
  this.execute(command);
47427
47431
  };
47432
+ DControllerCommandImpl.prototype.merge = function (command) {
47433
+ var done = this._done;
47434
+ var doneLength = done.length;
47435
+ if (0 < doneLength) {
47436
+ command.merge(done[doneLength - 1]);
47437
+ }
47438
+ };
47428
47439
  DControllerCommandImpl.prototype.execute = function (command) {
47429
47440
  this.emit("executing", command, this);
47430
47441
  var isClear = isCommandClear(command);
@@ -47438,14 +47449,6 @@
47438
47449
  }
47439
47450
  this.cleanup();
47440
47451
  }
47441
- var done = this._done;
47442
- var doneLength = done.length;
47443
- if (0 < doneLength) {
47444
- var last = done[doneLength - 1];
47445
- if (command.merge(last)) {
47446
- return this.onMerged(command);
47447
- }
47448
- }
47449
47452
  var result = command.execute();
47450
47453
  if (result === true) {
47451
47454
  return this.onSuccess(command);
@@ -47454,15 +47457,6 @@
47454
47457
  return this.onFail(command);
47455
47458
  }
47456
47459
  };
47457
- DControllerCommandImpl.prototype.onMerged = function (command) {
47458
- if (isCommandStorable(command)) {
47459
- if (!isCommandClean(command)) {
47460
- this.emit("dirty", this);
47461
- }
47462
- }
47463
- this.emit("change", this);
47464
- this.emit("executed", command, this);
47465
- };
47466
47460
  DControllerCommandImpl.prototype.onSuccess = function (command) {
47467
47461
  if (isCommandStorable(command)) {
47468
47462
  var done = this._done;