swing-ui 1.1.4 → 1.1.5
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/SwingUI.js +5 -6
- package/classes/Table.js +1 -1
- package/icon.png +0 -0
- package/jar/gui-11.jar +0 -0
- package/package.json +1 -1
- package/types/SwingUI.d.ts +2 -2
- package/types/classes/Table.d.ts +1 -1
package/SwingUI.js
CHANGED
|
@@ -1293,7 +1293,7 @@ export class SwingUI
|
|
|
1293
1293
|
value: {id: args[0], options: args[1] ?? undefined}
|
|
1294
1294
|
}, r => {return r.value;});
|
|
1295
1295
|
if(e === false) throw new Error(`Failed to set UI '${args[0]}'.`);
|
|
1296
|
-
queueMicrotask(() => {this.#processEvent(e);});
|
|
1296
|
+
else if(typeof e === "object") queueMicrotask(() => {this.#processEvent(e);});
|
|
1297
1297
|
return this;
|
|
1298
1298
|
}
|
|
1299
1299
|
else
|
|
@@ -1881,7 +1881,7 @@ export class SwingUI
|
|
|
1881
1881
|
*
|
|
1882
1882
|
* @param {string|URL} file_path - Local destination file path.
|
|
1883
1883
|
* @param {string|ArrayBuffer|Uint8Array|Buffer} data - Data to write to a file.
|
|
1884
|
-
* @param {string} [
|
|
1884
|
+
* @param {string} [flag="w"] - `w` - write new data, or `a` - append to existing data.
|
|
1885
1885
|
* @param {boolean} [overwrite=true] - `true` to overwrite existing file with the same path. `false` to fail and return `false` if a file with the same path already exists.
|
|
1886
1886
|
* @param {boolean} [create_dir=false] - `true` to create directory if it doesn't exist. `false` is default. If `false` and directory doesn't exist, an Errow will be thrown.
|
|
1887
1887
|
* @returns {boolean} Returns `true` on success, or throws an Error on failure.
|
|
@@ -1892,7 +1892,7 @@ export class SwingUI
|
|
|
1892
1892
|
* @throws {Error} When the directory of the file path doesn't exist and `create_dir` argument is not true.
|
|
1893
1893
|
* @throws {Error} When failed to write the file.
|
|
1894
1894
|
*/
|
|
1895
|
-
writeFile(file_path, data,
|
|
1895
|
+
writeFile(file_path, data, flag = "w", overwrite = true, create_dir = false)
|
|
1896
1896
|
{
|
|
1897
1897
|
// validate path type
|
|
1898
1898
|
if(!(typeof file_path === "string")) throw new Error(`Invalid "file_path" argument: ${typeof file_path}`);
|
|
@@ -1902,7 +1902,7 @@ export class SwingUI
|
|
|
1902
1902
|
|
|
1903
1903
|
if(overwrite !== true && this.fileExists(file_path)) throw new Error(`File already exists. To overwrite the file set "overwrite" argument to true.`);
|
|
1904
1904
|
|
|
1905
|
-
if(
|
|
1905
|
+
if(flag === "a" && this.fileExists(file_path) && !this.canWriteFile(file_path)) throw new Error(`Failed to write file: Access Denied`);
|
|
1906
1906
|
|
|
1907
1907
|
if(typeof data === "string") data = new TextEncoder().encode(data); // convert string to Uint8Array
|
|
1908
1908
|
|
|
@@ -1928,11 +1928,10 @@ export class SwingUI
|
|
|
1928
1928
|
|
|
1929
1929
|
if(this.runtime === "deno")
|
|
1930
1930
|
{
|
|
1931
|
-
Deno.writeFileSync(file_path, (data instanceof Uint8Array) ? data : new Uint8Array(data), {append:
|
|
1931
|
+
Deno.writeFileSync(file_path, (data instanceof Uint8Array) ? data : new Uint8Array(data), {append: flag === "a"});
|
|
1932
1932
|
}
|
|
1933
1933
|
else
|
|
1934
1934
|
{
|
|
1935
|
-
const flag = mode === "append" ? "a" : "w";
|
|
1936
1935
|
fs.writeFileSync(file_path, (data instanceof ArrayBuffer) ? Buffer.from(data) : data, {flag: flag});
|
|
1937
1936
|
}
|
|
1938
1937
|
|
package/classes/Table.js
CHANGED
|
@@ -74,7 +74,7 @@ export class Table extends ScrollableComponent
|
|
|
74
74
|
* @property {number} None - No grid lines.
|
|
75
75
|
* @property {number} Horizontal - Show only horizontal lines.
|
|
76
76
|
* @property {number} Vertical - Show only vertical lines.
|
|
77
|
-
* @property {number} Both - Show both horizontal and vertical lines.
|
|
77
|
+
* @property {number} Both - Show both horizontal and vertical lines. (default)
|
|
78
78
|
* @see Table#gridLines
|
|
79
79
|
* @example <h2>Setting to show only horizontal grid lines:</h2>
|
|
80
80
|
* table.gridLines(Table.GridLines.Horizontal);
|
package/icon.png
CHANGED
|
Binary file
|
package/jar/gui-11.jar
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/SwingUI.d.ts
CHANGED
|
@@ -509,7 +509,7 @@ export class SwingUI {
|
|
|
509
509
|
*
|
|
510
510
|
* @param {string|URL} file_path - Local destination file path.
|
|
511
511
|
* @param {string|ArrayBuffer|Uint8Array|Buffer} data - Data to write to a file.
|
|
512
|
-
* @param {string} [
|
|
512
|
+
* @param {string} [flag="w"] - `w` - write new data, or `a` - append to existing data.
|
|
513
513
|
* @param {boolean} [overwrite=true] - `true` to overwrite existing file with the same path. `false` to fail and return `false` if a file with the same path already exists.
|
|
514
514
|
* @param {boolean} [create_dir=false] - `true` to create directory if it doesn't exist. `false` is default. If `false` and directory doesn't exist, an Errow will be thrown.
|
|
515
515
|
* @returns {boolean} Returns `true` on success, or throws an Error on failure.
|
|
@@ -520,7 +520,7 @@ export class SwingUI {
|
|
|
520
520
|
* @throws {Error} When the directory of the file path doesn't exist and `create_dir` argument is not true.
|
|
521
521
|
* @throws {Error} When failed to write the file.
|
|
522
522
|
*/
|
|
523
|
-
writeFile(file_path: string | URL, data: string | ArrayBuffer | Uint8Array | Buffer,
|
|
523
|
+
writeFile(file_path: string | URL, data: string | ArrayBuffer | Uint8Array | Buffer, flag?: string, overwrite?: boolean, create_dir?: boolean): boolean;
|
|
524
524
|
/**
|
|
525
525
|
* Gets information about a file or directory, like times, size, if it's a file or directory, etc.
|
|
526
526
|
*
|
package/types/classes/Table.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export class Table extends ScrollableComponent {
|
|
|
83
83
|
* @property {number} None - No grid lines.
|
|
84
84
|
* @property {number} Horizontal - Show only horizontal lines.
|
|
85
85
|
* @property {number} Vertical - Show only vertical lines.
|
|
86
|
-
* @property {number} Both - Show both horizontal and vertical lines.
|
|
86
|
+
* @property {number} Both - Show both horizontal and vertical lines. (default)
|
|
87
87
|
* @see Table#gridLines
|
|
88
88
|
* @example <h2>Setting to show only horizontal grid lines:</h2>
|
|
89
89
|
* table.gridLines(Table.GridLines.Horizontal);
|