@wcardinal/wcardinal-ui 0.256.0 → 0.258.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.
- package/dist/types/wcardinal/ui/d-command-save-as.d.ts +1 -0
- package/dist/wcardinal/ui/d-command-save-as.js +7 -0
- package/dist/wcardinal/ui/d-command-save-as.js.map +1 -1
- package/dist/wcardinal/ui/d-controller-command-impl.js +7 -0
- package/dist/wcardinal/ui/d-controller-command-impl.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +15 -1
- package/dist/wcardinal-ui.js +15 -1
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { DCommandFlag } from "./d-command-flag";
|
|
|
3
3
|
export declare class DCommandSaveAs implements DCommand {
|
|
4
4
|
protected _name: string;
|
|
5
5
|
constructor(name: string);
|
|
6
|
+
get name(): string;
|
|
6
7
|
execute(): Promise<unknown> | boolean;
|
|
7
8
|
redo(): Promise<unknown> | boolean;
|
|
8
9
|
undo(): Promise<unknown> | boolean;
|
|
@@ -8,6 +8,13 @@ var DCommandSaveAs = /** @class */ (function () {
|
|
|
8
8
|
function DCommandSaveAs(name) {
|
|
9
9
|
this._name = name;
|
|
10
10
|
}
|
|
11
|
+
Object.defineProperty(DCommandSaveAs.prototype, "name", {
|
|
12
|
+
get: function () {
|
|
13
|
+
return this._name;
|
|
14
|
+
},
|
|
15
|
+
enumerable: false,
|
|
16
|
+
configurable: true
|
|
17
|
+
});
|
|
11
18
|
DCommandSaveAs.prototype.execute = function () {
|
|
12
19
|
return DControllers.getDocumentController().saveAs(this._name);
|
|
13
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-command-save-as.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command-save-as.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;IAGC,wBAAY,IAAY;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,gCAAO,GAAP;QACC,OAAO,YAAY,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,6BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,6BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,gCAAO,GAAP;QACC,aAAa;IACd,CAAC;IAED,gCAAO,GAAP;QACC,OAAO,YAAY,CAAC,UAAU,CAAC;IAChC,CAAC;IACF,qBAAC;AAAD,CAAC,
|
|
1
|
+
{"version":3,"file":"d-command-save-as.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-command-save-as.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;IAGC,wBAAY,IAAY;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,sBAAI,gCAAI;aAAR;YACC,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;;;OAAA;IAED,gCAAO,GAAP;QACC,OAAO,YAAY,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED,6BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,6BAAI,GAAJ;QACC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,gCAAO,GAAP;QACC,aAAa;IACd,CAAC;IAED,gCAAO,GAAP;QACC,OAAO,YAAY,CAAC,UAAU,CAAC;IAChC,CAAC;IACF,qBAAC;AAAD,CAAC,AA9BD,IA8BC","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\";\nimport { DControllers } from \"./d-controllers\";\n\nexport class DCommandSaveAs implements DCommand {\n\tprotected _name: string;\n\n\tconstructor(name: string) {\n\t\tthis._name = name;\n\t}\n\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\texecute(): Promise<unknown> | boolean {\n\t\treturn DControllers.getDocumentController().saveAs(this._name);\n\t}\n\n\tredo(): Promise<unknown> | boolean {\n\t\treturn true;\n\t}\n\n\tundo(): Promise<unknown> | 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.UNSTORABLE;\n\t}\n}\n"]}
|
|
@@ -43,6 +43,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
DControllerCommandImpl.prototype.push = function (command) {
|
|
46
|
+
this.emit("push", command, this);
|
|
46
47
|
this._waiting.push(command);
|
|
47
48
|
this.next();
|
|
48
49
|
};
|
|
@@ -81,6 +82,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
81
82
|
var current_1 = done[done.length - 1 - this._position];
|
|
82
83
|
this._position += 1;
|
|
83
84
|
this.emit("change", this);
|
|
85
|
+
this.emit("undoing", current_1, this);
|
|
84
86
|
var result = current_1.undo();
|
|
85
87
|
if (result === true) {
|
|
86
88
|
this.onSuccessUndo(current_1);
|
|
@@ -104,6 +106,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
104
106
|
var current_2 = done[done.length - this._position];
|
|
105
107
|
this._position -= 1;
|
|
106
108
|
this.emit("change", this);
|
|
109
|
+
this.emit("redoing", current_2, this);
|
|
107
110
|
var result = current_2.redo();
|
|
108
111
|
if (result === true) {
|
|
109
112
|
this.onSuccessRedo(current_2);
|
|
@@ -133,6 +136,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
133
136
|
}
|
|
134
137
|
this.cleanup();
|
|
135
138
|
}
|
|
139
|
+
this.emit("executing", command, this);
|
|
136
140
|
var result = command.execute();
|
|
137
141
|
if (result === true) {
|
|
138
142
|
this.onSuccess(command);
|
|
@@ -182,6 +186,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
this.emit("change", this);
|
|
189
|
+
this.emit("executed", command, this);
|
|
185
190
|
this.next();
|
|
186
191
|
};
|
|
187
192
|
DControllerCommandImpl.prototype.onSuccessUndo = function (undoed) {
|
|
@@ -190,6 +195,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
190
195
|
this.emit("dirty", this);
|
|
191
196
|
}
|
|
192
197
|
this.emit("change", this);
|
|
198
|
+
this.emit("undoed", undoed, this);
|
|
193
199
|
this.next();
|
|
194
200
|
};
|
|
195
201
|
DControllerCommandImpl.prototype.onSuccessRedo = function (redoed) {
|
|
@@ -198,6 +204,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
198
204
|
this.emit("dirty", this);
|
|
199
205
|
}
|
|
200
206
|
this.emit("change", this);
|
|
207
|
+
this.emit("redoed", redoed, this);
|
|
201
208
|
this.next();
|
|
202
209
|
};
|
|
203
210
|
DControllerCommandImpl.prototype.onFail = function (command) {
|
|
@@ -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,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CAAI,GAAJ;QACC,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,EAAE,CAAC;SACZ;IACF,CAAC;IAED,qCAAI,GAAJ;QACC,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI,EAAE,CAAC;SACZ;IACF,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IACtD,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IACtE,CAAC;IACF,6BAAC;AAAD,CAAC,AAhPD,CAA4C,KAAK,CAAC,YAAY,GAgP7D","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 { DCommandRedo } from \"./d-command-redo\";\nimport { DCommandUndo } from \"./d-command-undo\";\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\tprotected _waiting: DCommand[];\n\tprotected _executing: Promise<void> | null;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t\tthis._waiting = [];\n\t\tthis._executing = null;\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tconst waiting = this._waiting;\n\n\t\tif (waiting.length <= 0) {\n\t\t\tif (0 < done.length) {\n\t\t\t\treturn done[done.length - 1];\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\treturn waiting[waiting.length - 1];\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis._waiting.push(command);\n\t\tthis.next();\n\t}\n\n\tnext(): void {\n\t\tif (this._executing != null) {\n\t\t\t// Still executing a command.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tconst waiting = this._waiting;\n\t\tif (waiting.length <= 0) {\n\t\t\t// There is no waiting commands.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tconst command = waiting.shift();\n\t\tif (command == null) {\n\t\t\t// There is no waiting commands.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tif (command instanceof DCommandUndo) {\n\t\t\tthis.executeUndo(command);\n\t\t} else if (command instanceof DCommandRedo) {\n\t\t\tthis.executeRedo(command);\n\t\t} else {\n\t\t\tthis.execute(command);\n\t\t}\n\t}\n\n\tprotected executeUndo(command: DCommandUndo): 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\tconst result = current.undo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onSuccessUndo(current);\n\t\t\t} else if (result === false) {\n\t\t\t\tthis.onFail(command);\n\t\t\t} else {\n\t\t\t\tthis._executing = result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onSuccessUndo(current);\n\t\t\t\t\t},\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onFail(command);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected executeRedo(command: DCommandRedo): 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\tconst result = current.redo();\n\t\t\tif (result === true) {\n\t\t\t\tthis.onSuccessRedo(current);\n\t\t\t} else if (result === false) {\n\t\t\t\tthis.onFail(command);\n\t\t\t} else {\n\t\t\t\tthis._executing = result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onSuccessRedo(current);\n\t\t\t\t\t},\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onFail(command);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected execute(command: DCommand): void {\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\tthis.onSuccess(command);\n\t\t} else if (result === false) {\n\t\t\tthis.onFail(command);\n\t\t} else {\n\t\t\tthis._executing = result.then(\n\t\t\t\t() => {\n\t\t\t\t\tthis.onSuccess(command);\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tthis.onFail(command);\n\t\t\t\t}\n\t\t\t);\n\t\t}\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\tprotected onSuccess(command: DCommand): void {\n\t\tthis._executing = null;\n\t\tif (isCommandStorable(command)) {\n\t\t\tthis._done.push(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.next();\n\t}\n\n\tprotected onSuccessUndo(undoed: DCommand): void {\n\t\tthis._executing = null;\n\t\tif (!isCommandClean(undoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.next();\n\t}\n\n\tprotected onSuccessRedo(redoed: DCommand): void {\n\t\tthis._executing = null;\n\t\tif (!isCommandClean(redoed)) {\n\t\t\tthis.emit(\"dirty\", this);\n\t\t}\n\t\tthis.emit(\"change\", this);\n\t\tthis.next();\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tthis._executing = null;\n\t\tconst waiting = this._waiting;\n\t\tcommand.destroy();\n\t\tfor (let i = 0, imax = waiting.length; i < imax; ++i) {\n\t\t\twaiting[i].destroy();\n\t\t}\n\t\twaiting.length = 0;\n\t\tthis.emit(\"change\", this);\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._waiting.push(new DCommandRedo());\n\t\t\tthis.next();\n\t\t}\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis._waiting.push(new DCommandUndo());\n\t\t\tthis.next();\n\t\t}\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position && this._executing == null;\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length && this._executing == null;\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;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,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;IAM7D;QAAA,YACC,iBAAO,SAMP;QAJA,KAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAI,CAAC,QAAQ,GAAG,EAAE,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AAC,IAAI,EAAE,CAAC;SACZ;IACF,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IACtD,CAAC;IAED,2CAAU,GAAV;QACC,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;IACtE,CAAC;IACF,6BAAC;AAAD,CAAC,AAvPD,CAA4C,KAAK,CAAC,YAAY,GAuP7D","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 { DCommandRedo } from \"./d-command-redo\";\nimport { DCommandUndo } from \"./d-command-undo\";\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\tprotected _waiting: DCommand[];\n\tprotected _executing: Promise<void> | null;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._position = 0;\n\t\tthis._done = [];\n\t\tthis._waiting = [];\n\t\tthis._executing = null;\n\t}\n\n\tlast(): DCommand | null {\n\t\tconst done = this._done;\n\t\tconst waiting = this._waiting;\n\n\t\tif (waiting.length <= 0) {\n\t\t\tif (0 < done.length) {\n\t\t\t\treturn done[done.length - 1];\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\treturn waiting[waiting.length - 1];\n\t\t}\n\t}\n\n\tpush(command: DCommand): void {\n\t\tthis.emit(\"push\", command, this);\n\t\tthis._waiting.push(command);\n\t\tthis.next();\n\t}\n\n\tnext(): void {\n\t\tif (this._executing != null) {\n\t\t\t// Still executing a command.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tconst waiting = this._waiting;\n\t\tif (waiting.length <= 0) {\n\t\t\t// There is no waiting commands.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tconst command = waiting.shift();\n\t\tif (command == null) {\n\t\t\t// There is no waiting commands.\n\t\t\t// So do nothing.\n\t\t\treturn;\n\t\t}\n\n\t\tif (command instanceof DCommandUndo) {\n\t\t\tthis.executeUndo(command);\n\t\t} else if (command instanceof DCommandRedo) {\n\t\t\tthis.executeRedo(command);\n\t\t} else {\n\t\t\tthis.execute(command);\n\t\t}\n\t}\n\n\tprotected executeUndo(command: DCommandUndo): 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.onSuccessUndo(current);\n\t\t\t} else if (result === false) {\n\t\t\t\tthis.onFail(command);\n\t\t\t} else {\n\t\t\t\tthis._executing = result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onSuccessUndo(current);\n\t\t\t\t\t},\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onFail(command);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected executeRedo(command: DCommandRedo): 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.onSuccessRedo(current);\n\t\t\t} else if (result === false) {\n\t\t\t\tthis.onFail(command);\n\t\t\t} else {\n\t\t\t\tthis._executing = result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onSuccessRedo(current);\n\t\t\t\t\t},\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.onFail(command);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected execute(command: DCommand): void {\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\tthis.emit(\"executing\", command, this);\n\t\tconst result = command.execute();\n\t\tif (result === true) {\n\t\t\tthis.onSuccess(command);\n\t\t} else if (result === false) {\n\t\t\tthis.onFail(command);\n\t\t} else {\n\t\t\tthis._executing = result.then(\n\t\t\t\t() => {\n\t\t\t\t\tthis.onSuccess(command);\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tthis.onFail(command);\n\t\t\t\t}\n\t\t\t);\n\t\t}\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\tprotected onSuccess(command: DCommand): void {\n\t\tthis._executing = null;\n\t\tif (isCommandStorable(command)) {\n\t\t\tthis._done.push(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\tthis.next();\n\t}\n\n\tprotected onSuccessUndo(undoed: DCommand): void {\n\t\tthis._executing = null;\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\tthis.next();\n\t}\n\n\tprotected onSuccessRedo(redoed: DCommand): void {\n\t\tthis._executing = null;\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\tthis.next();\n\t}\n\n\tprotected onFail(command: DCommand): void {\n\t\tthis._executing = null;\n\t\tconst waiting = this._waiting;\n\t\tcommand.destroy();\n\t\tfor (let i = 0, imax = waiting.length; i < imax; ++i) {\n\t\t\twaiting[i].destroy();\n\t\t}\n\t\twaiting.length = 0;\n\t\tthis.emit(\"change\", this);\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._waiting.push(new DCommandRedo());\n\t\t\tthis.next();\n\t\t}\n\t}\n\n\tundo(): void {\n\t\tif (this.isUndoable()) {\n\t\t\tthis._waiting.push(new DCommandUndo());\n\t\t\tthis.next();\n\t\t}\n\t}\n\n\tisRedoable(): boolean {\n\t\treturn 0 < this._position && this._executing == null;\n\t}\n\n\tisUndoable(): boolean {\n\t\treturn this._position < this._done.length && this._executing == null;\n\t}\n}\n"]}
|
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.258.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -65400,6 +65400,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65400
65400
|
}
|
|
65401
65401
|
};
|
|
65402
65402
|
DControllerCommandImpl.prototype.push = function (command) {
|
|
65403
|
+
this.emit("push", command, this);
|
|
65403
65404
|
this._waiting.push(command);
|
|
65404
65405
|
this.next();
|
|
65405
65406
|
};
|
|
@@ -65438,6 +65439,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65438
65439
|
var current_1 = done[done.length - 1 - this._position];
|
|
65439
65440
|
this._position += 1;
|
|
65440
65441
|
this.emit("change", this);
|
|
65442
|
+
this.emit("undoing", current_1, this);
|
|
65441
65443
|
var result = current_1.undo();
|
|
65442
65444
|
if (result === true) {
|
|
65443
65445
|
this.onSuccessUndo(current_1);
|
|
@@ -65461,6 +65463,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65461
65463
|
var current_2 = done[done.length - this._position];
|
|
65462
65464
|
this._position -= 1;
|
|
65463
65465
|
this.emit("change", this);
|
|
65466
|
+
this.emit("redoing", current_2, this);
|
|
65464
65467
|
var result = current_2.redo();
|
|
65465
65468
|
if (result === true) {
|
|
65466
65469
|
this.onSuccessRedo(current_2);
|
|
@@ -65490,6 +65493,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65490
65493
|
}
|
|
65491
65494
|
this.cleanup();
|
|
65492
65495
|
}
|
|
65496
|
+
this.emit("executing", command, this);
|
|
65493
65497
|
var result = command.execute();
|
|
65494
65498
|
if (result === true) {
|
|
65495
65499
|
this.onSuccess(command);
|
|
@@ -65539,6 +65543,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65539
65543
|
}
|
|
65540
65544
|
}
|
|
65541
65545
|
this.emit("change", this);
|
|
65546
|
+
this.emit("executed", command, this);
|
|
65542
65547
|
this.next();
|
|
65543
65548
|
};
|
|
65544
65549
|
DControllerCommandImpl.prototype.onSuccessUndo = function (undoed) {
|
|
@@ -65547,6 +65552,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65547
65552
|
this.emit("dirty", this);
|
|
65548
65553
|
}
|
|
65549
65554
|
this.emit("change", this);
|
|
65555
|
+
this.emit("undoed", undoed, this);
|
|
65550
65556
|
this.next();
|
|
65551
65557
|
};
|
|
65552
65558
|
DControllerCommandImpl.prototype.onSuccessRedo = function (redoed) {
|
|
@@ -65555,6 +65561,7 @@ var DControllerCommandImpl = /** @class */ (function (_super) {
|
|
|
65555
65561
|
this.emit("dirty", this);
|
|
65556
65562
|
}
|
|
65557
65563
|
this.emit("change", this);
|
|
65564
|
+
this.emit("redoed", redoed, this);
|
|
65558
65565
|
this.next();
|
|
65559
65566
|
};
|
|
65560
65567
|
DControllerCommandImpl.prototype.onFail = function (command) {
|
|
@@ -76500,6 +76507,13 @@ var DCommandSaveAs = /** @class */ (function () {
|
|
|
76500
76507
|
function DCommandSaveAs(name) {
|
|
76501
76508
|
this._name = name;
|
|
76502
76509
|
}
|
|
76510
|
+
Object.defineProperty(DCommandSaveAs.prototype, "name", {
|
|
76511
|
+
get: function () {
|
|
76512
|
+
return this._name;
|
|
76513
|
+
},
|
|
76514
|
+
enumerable: false,
|
|
76515
|
+
configurable: true
|
|
76516
|
+
});
|
|
76503
76517
|
DCommandSaveAs.prototype.execute = function () {
|
|
76504
76518
|
return DControllers.getDocumentController().saveAs(this._name);
|
|
76505
76519
|
};
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.258.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -46785,6 +46785,7 @@
|
|
|
46785
46785
|
}
|
|
46786
46786
|
};
|
|
46787
46787
|
DControllerCommandImpl.prototype.push = function (command) {
|
|
46788
|
+
this.emit("push", command, this);
|
|
46788
46789
|
this._waiting.push(command);
|
|
46789
46790
|
this.next();
|
|
46790
46791
|
};
|
|
@@ -46823,6 +46824,7 @@
|
|
|
46823
46824
|
var current_1 = done[done.length - 1 - this._position];
|
|
46824
46825
|
this._position += 1;
|
|
46825
46826
|
this.emit("change", this);
|
|
46827
|
+
this.emit("undoing", current_1, this);
|
|
46826
46828
|
var result = current_1.undo();
|
|
46827
46829
|
if (result === true) {
|
|
46828
46830
|
this.onSuccessUndo(current_1);
|
|
@@ -46846,6 +46848,7 @@
|
|
|
46846
46848
|
var current_2 = done[done.length - this._position];
|
|
46847
46849
|
this._position -= 1;
|
|
46848
46850
|
this.emit("change", this);
|
|
46851
|
+
this.emit("redoing", current_2, this);
|
|
46849
46852
|
var result = current_2.redo();
|
|
46850
46853
|
if (result === true) {
|
|
46851
46854
|
this.onSuccessRedo(current_2);
|
|
@@ -46875,6 +46878,7 @@
|
|
|
46875
46878
|
}
|
|
46876
46879
|
this.cleanup();
|
|
46877
46880
|
}
|
|
46881
|
+
this.emit("executing", command, this);
|
|
46878
46882
|
var result = command.execute();
|
|
46879
46883
|
if (result === true) {
|
|
46880
46884
|
this.onSuccess(command);
|
|
@@ -46924,6 +46928,7 @@
|
|
|
46924
46928
|
}
|
|
46925
46929
|
}
|
|
46926
46930
|
this.emit("change", this);
|
|
46931
|
+
this.emit("executed", command, this);
|
|
46927
46932
|
this.next();
|
|
46928
46933
|
};
|
|
46929
46934
|
DControllerCommandImpl.prototype.onSuccessUndo = function (undoed) {
|
|
@@ -46932,6 +46937,7 @@
|
|
|
46932
46937
|
this.emit("dirty", this);
|
|
46933
46938
|
}
|
|
46934
46939
|
this.emit("change", this);
|
|
46940
|
+
this.emit("undoed", undoed, this);
|
|
46935
46941
|
this.next();
|
|
46936
46942
|
};
|
|
46937
46943
|
DControllerCommandImpl.prototype.onSuccessRedo = function (redoed) {
|
|
@@ -46940,6 +46946,7 @@
|
|
|
46940
46946
|
this.emit("dirty", this);
|
|
46941
46947
|
}
|
|
46942
46948
|
this.emit("change", this);
|
|
46949
|
+
this.emit("redoed", redoed, this);
|
|
46943
46950
|
this.next();
|
|
46944
46951
|
};
|
|
46945
46952
|
DControllerCommandImpl.prototype.onFail = function (command) {
|
|
@@ -58294,6 +58301,13 @@
|
|
|
58294
58301
|
function DCommandSaveAs(name) {
|
|
58295
58302
|
this._name = name;
|
|
58296
58303
|
}
|
|
58304
|
+
Object.defineProperty(DCommandSaveAs.prototype, "name", {
|
|
58305
|
+
get: function () {
|
|
58306
|
+
return this._name;
|
|
58307
|
+
},
|
|
58308
|
+
enumerable: false,
|
|
58309
|
+
configurable: true
|
|
58310
|
+
});
|
|
58297
58311
|
DCommandSaveAs.prototype.execute = function () {
|
|
58298
58312
|
return DControllers.getDocumentController().saveAs(this._name);
|
|
58299
58313
|
};
|